generated from halo-dev/plugin-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
731 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const register = (path: string) => { | ||
console.log('register', path); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
declare global { | ||
|
||
export class Mono<T = any> { | ||
static just<T>(value: T): Mono<T> ; | ||
} | ||
|
||
export class SearchService<T = any> { | ||
|
||
constructor(_config: SearchServiceConfig) | ||
|
||
} | ||
|
||
export interface SearchOption { | ||
// 根据实际需要添加属性 | ||
[key: string]: any; | ||
} | ||
|
||
export interface SearchResult { | ||
keyword: string; | ||
// 其他可能的结果字段 | ||
} | ||
|
||
export type SearchFunction = (option: SearchOption) => Mono<SearchResult>; | ||
|
||
export interface SearchServiceConfig { | ||
search: SearchFunction; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
export function using<T>(path: string) { | ||
// @ts-ignore | ||
return Java.type(path) as T | ||
} | ||
export function extend<T>(type: any) { | ||
// @ts-ignore | ||
return Java.extend(type) as T | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import {register} from "./apis.ts"; | ||
|
||
export const createImplSearchService = () => { | ||
const impl = new SearchService({ | ||
search: (option) => { | ||
register('hello') | ||
console.log(option); | ||
debugger | ||
return Mono.just({ | ||
keyword: "test" | ||
}); | ||
} | ||
}); | ||
return impl; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/// <reference types="vite/client" /> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"name": "script-server", | ||
"private": true, | ||
"version": "0.0.0", | ||
"type": "module", | ||
"module": "main.mjs", | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "tsc && vite build", | ||
"preview": "vite preview" | ||
}, | ||
"devDependencies": { | ||
"typescript": "~5.6.2", | ||
"vite": "^5.4.9" | ||
}, | ||
"dependencies": { | ||
"@types/node": "^22.8.4" | ||
} | ||
} |
Oops, something went wrong.