feat: add index file to export app module

This commit is contained in:
2025-12-18 15:44:05 +08:00
parent e9c626c590
commit a18b39d21f
5 changed files with 46 additions and 11 deletions

2
.gitignore vendored
View File

@@ -3,3 +3,5 @@ node_modules
.env
pnpm-lock.yaml
dist

22
bun.config.ts Normal file
View 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);

View File

@@ -2,13 +2,14 @@
"name": "@kevisual/app",
"version": "0.0.2",
"description": "",
"main": "index.js",
"scripts": {
"dev": "bun"
"dev": "bun",
"build": "bun bun.config.ts"
},
"files": [
"src",
"mod.ts"
"mod.ts",
"dist"
],
"publishConfig": {
"access": "public"
@@ -16,14 +17,23 @@
"keywords": [],
"author": "abearxiong <xiongxiao@xiongxiao.me> (https://www.xiongxiao.me)",
"license": "MIT",
"packageManager": "pnpm@10.14.0",
"packageManager": "pnpm@10.26.0",
"type": "module",
"dependencies": {
"@kevisual/ai": "^0.0.19",
"@kevisual/context": "^0.0.4",
"@kevisual/query": "^0.0.31",
"@kevisual/router": "^0.0.36",
"@kevisual/query": "^0.0.32",
"@kevisual/router": "^0.0.39",
"@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"
}
}

View File

@@ -1,4 +1,4 @@
import { QueryRouterServer } from '@kevisual/router'
import { QueryRouterServer } from '@kevisual/router/src/route.ts'
import { use } from '@kevisual/context'
import { Query } from '@kevisual/query'
import { Kevisual, ChatProviderMap } from '@kevisual/ai'
@@ -119,8 +119,8 @@ export class App {
}
return config;
}
async chat(message: string) {
const routes = this.router.getList();
async chat(message: string, options?: { filter?: (data?: any) => boolean }) {
const routes = this.router.getList(options?.filter);
let v = '';
if (routes.length > 0) {

1
src/index.ts Normal file
View File

@@ -0,0 +1 @@
export * from './app.ts'