generated from tailored/app-template
Compare commits
No commits in common. "0804bb9f2bc2a8436fa497091a8eb0dd9fb220b4" and "fe716b8ea3512f4a1875dabdc070446bbbfc9adf" have entirely different histories.
0804bb9f2b
...
fe716b8ea3
@ -1,28 +0,0 @@
|
|||||||
// @ts-check
|
|
||||||
// https://bun.sh/docs/bundler
|
|
||||||
// @ts-ignore
|
|
||||||
import pkg from './package.json';
|
|
||||||
import { rollup } from 'rollup';
|
|
||||||
import rollupConfig from './rollup.config.mjs';
|
|
||||||
|
|
||||||
// bun run src/index.ts --
|
|
||||||
await Bun.build({
|
|
||||||
target: 'node',
|
|
||||||
format: 'esm',
|
|
||||||
entrypoints: ['./src/provider/index.ts'],
|
|
||||||
outdir: './dist',
|
|
||||||
naming: {
|
|
||||||
entry: 'ai-provider.mjs',
|
|
||||||
},
|
|
||||||
|
|
||||||
define: {
|
|
||||||
ENVISION_VERSION: JSON.stringify(pkg.version),
|
|
||||||
},
|
|
||||||
env: 'ENVISION_*',
|
|
||||||
});
|
|
||||||
|
|
||||||
// Rollup build for the CLI
|
|
||||||
const rollupBundle = await rollup(rollupConfig);
|
|
||||||
rollupBundle.write({
|
|
||||||
file: 'dist/ai-provider.d.ts',
|
|
||||||
});
|
|
75
package.json
75
package.json
@ -14,63 +14,70 @@
|
|||||||
"types"
|
"types"
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "npm run clean && bun bun.config.mjs",
|
"watch": "rollup -c rollup.config.mjs -w",
|
||||||
"dev": "bun run --watch bun.config.mjs",
|
"build": "rollup -c rollup.config.mjs",
|
||||||
|
"dev": "cross-env NODE_ENV=development nodemon --delay 2.5 -e js,cjs,mjs --exec node dist/app.mjs",
|
||||||
"test": "tsx test/**/*.ts",
|
"test": "tsx test/**/*.ts",
|
||||||
|
"dev:watch": "cross-env NODE_ENV=development concurrently -n \"Watch,Dev\" -c \"green,blue\" \"npm run watch\" \"sleep 1 && npm run dev\" ",
|
||||||
"clean": "rm -rf dist",
|
"clean": "rm -rf dist",
|
||||||
"pub": "envision pack -p -u"
|
"pub": "envision pack -p -u"
|
||||||
},
|
},
|
||||||
"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.9.0",
|
"packageManager": "pnpm@10.7.1",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"publishConfig": {
|
"dependencies": {
|
||||||
"registry": "https://registry.npmjs.org/",
|
"@kevisual/cache": "^0.0.2",
|
||||||
"access": "public"
|
"@kevisual/permission": "^0.0.1",
|
||||||
|
"@kevisual/router": "0.0.10",
|
||||||
|
"pino-pretty": "^13.0.0"
|
||||||
},
|
},
|
||||||
"exports": {
|
|
||||||
".": {
|
|
||||||
"import": "./dist/ai-provider.mjs",
|
|
||||||
"types": "./dist/ai-provider.d.ts"
|
|
||||||
},
|
|
||||||
"./ai-provider": {
|
|
||||||
"import": "./dist/ai-provider.mjs",
|
|
||||||
"types": "./dist/ai-provider.d.ts"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"dependencies": {},
|
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@kevisual/code-center-module": "0.0.18",
|
"@kevisual/code-center-module": "0.0.18",
|
||||||
"@kevisual/mark": "0.0.7",
|
"@kevisual/mark": "0.0.7",
|
||||||
"@kevisual/router": "0.0.13",
|
"@kevisual/query": "^0.0.15",
|
||||||
"cookie": "^1.0.2",
|
"@kevisual/query-config": "workspace:*",
|
||||||
"crypto-js": "^4.2.0",
|
|
||||||
"dayjs": "^1.11.13",
|
|
||||||
"formidable": "^3.5.4",
|
|
||||||
"json5": "^2.2.3",
|
|
||||||
"lodash-es": "^4.17.21",
|
|
||||||
"openai": "^4.96.0",
|
|
||||||
"@kevisual/types": "^0.0.6",
|
"@kevisual/types": "^0.0.6",
|
||||||
"@kevisual/use-config": "^1.0.11",
|
"@kevisual/use-config": "^1.0.10",
|
||||||
"@types/bun": "^1.2.10",
|
"@rollup/plugin-alias": "^5.1.1",
|
||||||
|
"@rollup/plugin-commonjs": "^28.0.3",
|
||||||
|
"@rollup/plugin-json": "^6.1.0",
|
||||||
|
"@rollup/plugin-node-resolve": "^16.0.1",
|
||||||
|
"@rollup/plugin-replace": "^6.0.2",
|
||||||
|
"@rollup/plugin-typescript": "^12.1.2",
|
||||||
"@types/crypto-js": "^4.2.2",
|
"@types/crypto-js": "^4.2.2",
|
||||||
"@types/formidable": "^3.4.5",
|
"@types/formidable": "^3.4.5",
|
||||||
"@types/lodash-es": "^4.17.12",
|
"@types/lodash-es": "^4.17.12",
|
||||||
"@types/node": "^22.15.2",
|
"@types/node": "^22.14.0",
|
||||||
"@vitejs/plugin-basic-ssl": "^2.0.0",
|
"@vitejs/plugin-basic-ssl": "^2.0.0",
|
||||||
|
"concurrently": "^9.1.2",
|
||||||
|
"cookie": "^1.0.2",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"dotenv": "^16.5.0",
|
"crypto-js": "^4.2.0",
|
||||||
"ioredis": "^5.6.1",
|
"dayjs": "^1.11.13",
|
||||||
|
"dotenv": "^16.4.7",
|
||||||
|
"formidable": "^3.5.2",
|
||||||
|
"ioredis": "^5.6.0",
|
||||||
|
"jsrepo": "^1.45.3",
|
||||||
|
"lodash-es": "^4.17.21",
|
||||||
|
"nanoid": "^5.1.5",
|
||||||
|
"nodemon": "^3.1.9",
|
||||||
|
"openai": "^4.91.1",
|
||||||
|
"pg": "^8.14.1",
|
||||||
|
"pg-hstore": "^2.3.4",
|
||||||
"pino": "^9.6.0",
|
"pino": "^9.6.0",
|
||||||
"pm2": "^6.0.5",
|
"pm2": "^6.0.5",
|
||||||
"rimraf": "^6.0.1",
|
"rimraf": "^6.0.1",
|
||||||
"rollup": "^4.40.0",
|
"rollup": "^4.39.0",
|
||||||
|
"rollup-plugin-copy": "^3.5.0",
|
||||||
"rollup-plugin-dts": "^6.2.1",
|
"rollup-plugin-dts": "^6.2.1",
|
||||||
|
"rollup-plugin-esbuild": "^6.2.1",
|
||||||
"sequelize": "^6.37.7",
|
"sequelize": "^6.37.7",
|
||||||
"tape": "^5.9.0",
|
"tape": "^5.9.0",
|
||||||
"tiktoken": "^1.0.21",
|
"tiktoken": "^1.0.20",
|
||||||
"typescript": "^5.8.3",
|
"tsx": "^4.19.3",
|
||||||
"vite": "^6.3.3"
|
"typescript": "^5.8.2",
|
||||||
|
"vite": "^6.2.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
2454
pnpm-lock.yaml
generated
2454
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -1,9 +1,79 @@
|
|||||||
import dts from 'rollup-plugin-dts';
|
import resolve from '@rollup/plugin-node-resolve';
|
||||||
|
import commonjs from '@rollup/plugin-commonjs';
|
||||||
|
import json from '@rollup/plugin-json';
|
||||||
|
import path from 'path';
|
||||||
|
import esbuild from 'rollup-plugin-esbuild';
|
||||||
|
import alias from '@rollup/plugin-alias';
|
||||||
|
import replace from '@rollup/plugin-replace';
|
||||||
|
import pkgs from './package.json' with {type: 'json'};
|
||||||
|
|
||||||
export default {
|
const isDev = process.env.NODE_ENV === 'development';
|
||||||
input: 'src/provider/index.ts',
|
const input = isDev ? './src/dev.ts' : './src/index.ts';
|
||||||
|
/**
|
||||||
|
* @type {import('rollup').RollupOptions}
|
||||||
|
*/
|
||||||
|
const config = {
|
||||||
|
input,
|
||||||
output: {
|
output: {
|
||||||
file: 'dist/ai-provider.d.ts',
|
dir: './dist',
|
||||||
|
entryFileNames: 'app.mjs',
|
||||||
|
chunkFileNames: '[name]-[hash].mjs',
|
||||||
|
format: 'esm',
|
||||||
},
|
},
|
||||||
plugins: [dts()],
|
plugins: [
|
||||||
|
replace({
|
||||||
|
preventAssignment: true, // 防止意外赋值
|
||||||
|
DEV_SERVER: JSON.stringify(isDev), // 替换 process.env.NODE_ENV
|
||||||
|
// VERSION: JSON.stringify(pkgs.version),
|
||||||
|
}),
|
||||||
|
alias({
|
||||||
|
// only esbuild needs to be configured
|
||||||
|
entries: [
|
||||||
|
{ find: '@', replacement: path.resolve('src') }, // 配置 @ 为 src 目录
|
||||||
|
{ find: 'http', replacement: 'node:http' },
|
||||||
|
{ find: 'https', replacement: 'node:https' },
|
||||||
|
{ find: 'fs', replacement: 'node:fs' },
|
||||||
|
{ find: 'path', replacement: 'node:path' },
|
||||||
|
{ find: 'crypto', replacement: 'node:crypto' },
|
||||||
|
{ find: 'zlib', replacement: 'node:zlib' },
|
||||||
|
{ find: 'stream', replacement: 'node:stream' },
|
||||||
|
{ find: 'net', replacement: 'node:net' },
|
||||||
|
{ find: 'tty', replacement: 'node:tty' },
|
||||||
|
{ find: 'tls', replacement: 'node:tls' },
|
||||||
|
{ find: 'buffer', replacement: 'node:buffer' },
|
||||||
|
{ find: 'timers', replacement: 'node:timers' },
|
||||||
|
// { find: 'string_decoder', replacement: 'node:string_decoder' },
|
||||||
|
{ find: 'dns', replacement: 'node:dns' },
|
||||||
|
{ find: 'domain', replacement: 'node:domain' },
|
||||||
|
{ find: 'os', replacement: 'node:os' },
|
||||||
|
{ find: 'events', replacement: 'node:events' },
|
||||||
|
{ find: 'url', replacement: 'node:url' },
|
||||||
|
{ find: 'assert', replacement: 'node:assert' },
|
||||||
|
{ find: 'util', replacement: 'node:util' },
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
resolve({
|
||||||
|
preferBuiltins: true, // 强制优先使用内置模块
|
||||||
|
browser: false,
|
||||||
|
}),
|
||||||
|
commonjs(),
|
||||||
|
esbuild({
|
||||||
|
target: 'node22', //
|
||||||
|
minify: false, // 启用代码压缩
|
||||||
|
tsconfig: 'tsconfig.json',
|
||||||
|
}),
|
||||||
|
json(),
|
||||||
|
],
|
||||||
|
external: [
|
||||||
|
/@kevisual\/router(\/.*)?/, //, // 路由
|
||||||
|
/@kevisual\/use-config(\/.*)?/, //
|
||||||
|
|
||||||
|
'sequelize', // 数据库 orm
|
||||||
|
'ioredis', // redis
|
||||||
|
'pg', // pg
|
||||||
|
'pino', // pino
|
||||||
|
'pino-pretty', // pino-pretty
|
||||||
|
|
||||||
|
],
|
||||||
};
|
};
|
||||||
|
export default config;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user