feat: add index file to export app module
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -3,3 +3,5 @@ node_modules
|
|||||||
.env
|
.env
|
||||||
|
|
||||||
pnpm-lock.yaml
|
pnpm-lock.yaml
|
||||||
|
|
||||||
|
dist
|
||||||
22
bun.config.ts
Normal file
22
bun.config.ts
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import { resolvePath } from '@kevisual/use-config';
|
||||||
|
import { execSync } from 'node:child_process';
|
||||||
|
|
||||||
|
const entry = 'src/index.ts';
|
||||||
|
const naming = 'app';
|
||||||
|
const external: string[] = [];
|
||||||
|
/**
|
||||||
|
* @type {import('bun').BuildConfig}
|
||||||
|
*/
|
||||||
|
await Bun.build({
|
||||||
|
target: 'browser',
|
||||||
|
format: 'esm',
|
||||||
|
entrypoints: [resolvePath(entry, { meta: import.meta })],
|
||||||
|
outdir: resolvePath('./dist', { meta: import.meta }),
|
||||||
|
naming: {
|
||||||
|
entry: `${naming}.js`,
|
||||||
|
},
|
||||||
|
external,
|
||||||
|
});
|
||||||
|
|
||||||
|
const dts = 'dts -i src/index.ts -o app.d.ts';
|
||||||
|
execSync(dts);
|
||||||
24
package.json
24
package.json
@@ -2,13 +2,14 @@
|
|||||||
"name": "@kevisual/app",
|
"name": "@kevisual/app",
|
||||||
"version": "0.0.2",
|
"version": "0.0.2",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "bun"
|
"dev": "bun",
|
||||||
|
"build": "bun bun.config.ts"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"src",
|
"src",
|
||||||
"mod.ts"
|
"mod.ts",
|
||||||
|
"dist"
|
||||||
],
|
],
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
@@ -16,14 +17,23 @@
|
|||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "abearxiong <xiongxiao@xiongxiao.me> (https://www.xiongxiao.me)",
|
"author": "abearxiong <xiongxiao@xiongxiao.me> (https://www.xiongxiao.me)",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"packageManager": "pnpm@10.14.0",
|
"packageManager": "pnpm@10.26.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@kevisual/ai": "^0.0.19",
|
"@kevisual/ai": "^0.0.19",
|
||||||
"@kevisual/context": "^0.0.4",
|
"@kevisual/context": "^0.0.4",
|
||||||
"@kevisual/query": "^0.0.31",
|
"@kevisual/query": "^0.0.32",
|
||||||
"@kevisual/router": "^0.0.36",
|
"@kevisual/router": "^0.0.39",
|
||||||
"@kevisual/use-config": "^1.0.21",
|
"@kevisual/use-config": "^1.0.21",
|
||||||
"mitt": "^3.0.1"
|
"mitt": "^3.0.1",
|
||||||
|
"nanoid": "^5.1.6"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/bun": "^1.3.4",
|
||||||
|
"@types/node": "^25.0.3"
|
||||||
|
},
|
||||||
|
"exports": {
|
||||||
|
".": "./dist/app.js",
|
||||||
|
"./mod.ts": "./mod.ts"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { QueryRouterServer } from '@kevisual/router'
|
import { QueryRouterServer } from '@kevisual/router/src/route.ts'
|
||||||
import { use } from '@kevisual/context'
|
import { use } from '@kevisual/context'
|
||||||
import { Query } from '@kevisual/query'
|
import { Query } from '@kevisual/query'
|
||||||
import { Kevisual, ChatProviderMap } from '@kevisual/ai'
|
import { Kevisual, ChatProviderMap } from '@kevisual/ai'
|
||||||
@@ -119,8 +119,8 @@ export class App {
|
|||||||
}
|
}
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
async chat(message: string) {
|
async chat(message: string, options?: { filter?: (data?: any) => boolean }) {
|
||||||
const routes = this.router.getList();
|
const routes = this.router.getList(options?.filter);
|
||||||
let v = '';
|
let v = '';
|
||||||
|
|
||||||
if (routes.length > 0) {
|
if (routes.length > 0) {
|
||||||
|
|||||||
1
src/index.ts
Normal file
1
src/index.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export * from './app.ts'
|
||||||
Reference in New Issue
Block a user