feat: add load types

This commit is contained in:
xion 2024-11-10 21:12:45 +08:00
parent 2bbf3983c1
commit 696be2a28c
14 changed files with 356 additions and 217 deletions

View File

@ -19,13 +19,11 @@
"docker:build": "docker build -t docker.xiongxiao.me/code-flow:v0.0.2 .",
"docker:push": "docker push docker.xiongxiao.me/code-flow:v0.0.2",
"docker:run": "docker run -it --name code-flow -p 4000:4000 docker.xiongxiao.me/code-flow:v0.0.2",
"docker:build:gitea": "docker build -t git.xiongxiao.me/abearxiong/code-flow:v0.0.2 .",
"docker:push:gitea": "docker push git.xiongxiao.me/abearxiong/code-flow:v0.0.2",
"dts": "./node_modules/.bin/dts-bundle-generator -o types/index.d.ts src/type.ts",
"postinstall2": "patch-package",
"pub": "npm run build && npm run deploy && npm run reload",
"bud": "rimraf dist && rollup -c",
"bud:watch": "rollup -c -w"
"bud:watch": "rollup -c -w",
"apps:build": "rollup -c rollup.apps.config.mjs",
"apps:watch": "rollup -c rollup.apps.config.mjs -w"
},
"keywords": [],
"types": "types/index.d.ts",
@ -42,7 +40,7 @@
"@babel/preset-typescript": "^7.26.0",
"@kevisual/ai-graph": "workspace:^",
"@kevisual/ai-lang": "workspace:^",
"@kevisual/router": "0.0.4-alpha-6",
"@kevisual/router": "0.0.4-alpha-7",
"@supabase/supabase-js": "^2.46.1",
"@types/semver": "^7.5.8",
"archiver": "^7.0.1",
@ -87,11 +85,12 @@
"copy-webpack-plugin": "^12.0.2",
"cross-env": "^7.0.3",
"fork-ts-checker-webpack-plugin": "^9.0.2",
"glob": "^11.0.0",
"nodemon": "^3.1.7",
"patch-package": "^8.0.0",
"postinstall-postinstall": "^2.1.0",
"rimraf": "^6.0.1",
"rollup": "^4.24.4",
"rollup": "^4.25.0",
"rollup-plugin-copy": "^3.5.0",
"rollup-plugin-dts": "^6.1.1",
"tape": "^5.9.0",

209
pnpm-lock.yaml generated
View File

@ -39,8 +39,8 @@ importers:
specifier: workspace:^
version: link:packages/ai-lang
'@kevisual/router':
specifier: 0.0.4-alpha-6
version: 0.0.4-alpha-6
specifier: 0.0.4-alpha-7
version: 0.0.4-alpha-7
'@supabase/supabase-js':
specifier: ^2.46.1
version: 2.46.1
@ -119,16 +119,16 @@ importers:
version: 0.0.1(typescript@5.6.3)(webpack-cli@5.1.4)
'@rollup/plugin-commonjs':
specifier: ^28.0.1
version: 28.0.1(rollup@4.24.4)
version: 28.0.1(rollup@4.25.0)
'@rollup/plugin-json':
specifier: ^6.1.0
version: 6.1.0(rollup@4.24.4)
version: 6.1.0(rollup@4.25.0)
'@rollup/plugin-node-resolve':
specifier: ^15.3.0
version: 15.3.0(rollup@4.24.4)
version: 15.3.0(rollup@4.25.0)
'@rollup/plugin-typescript':
specifier: ^12.1.1
version: 12.1.1(rollup@4.24.4)(tslib@2.7.0)(typescript@5.6.3)
version: 12.1.1(rollup@4.25.0)(tslib@2.7.0)(typescript@5.6.3)
'@types/archiver':
specifier: ^6.0.3
version: 6.0.3
@ -168,6 +168,9 @@ importers:
fork-ts-checker-webpack-plugin:
specifier: ^9.0.2
version: 9.0.2(typescript@5.6.3)(webpack@5.96.1)
glob:
specifier: ^11.0.0
version: 11.0.0
nodemon:
specifier: ^3.1.7
version: 3.1.7
@ -181,14 +184,14 @@ importers:
specifier: latest
version: 6.0.1
rollup:
specifier: ^4.24.4
version: 4.24.4
specifier: ^4.25.0
version: 4.25.0
rollup-plugin-copy:
specifier: ^3.5.0
version: 3.5.0
rollup-plugin-dts:
specifier: ^6.1.1
version: 6.1.1(rollup@4.24.4)(typescript@5.6.3)
version: 6.1.1(rollup@4.25.0)(typescript@5.6.3)
tape:
specifier: ^5.9.0
version: 5.9.0
@ -1095,8 +1098,8 @@ packages:
'@jridgewell/trace-mapping@0.3.25':
resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==}
'@kevisual/router@0.0.4-alpha-6':
resolution: {integrity: sha512-pPV+dNuvclG+7ed0to8Xo2djlQsyVKTPUQud6T+JiyAjSDMfmw/5VVFIzPrgIeCdTsTGVsn8/zkjNmvsr6MAuw==}
'@kevisual/router@0.0.4-alpha-7':
resolution: {integrity: sha512-YMMr1+n2A9O9EzJpfQKHK4QKrTWL094wKH9S8Rz3ECBOBvx0n3VYftfs5jfORWlMQ4TwHJh8g17zz8d935ZL0A==}
'@langchain/core@0.3.3':
resolution: {integrity: sha512-WAtkmhbdl2T41qzimTzhb3pXCHQxO4onqxzPxgdf3KftQdTwLq0YYBDhozRMZLNAd/+cfH0ymZGaZSsnc9Ogsg==}
@ -1245,8 +1248,8 @@ packages:
cpu: [arm]
os: [android]
'@rollup/rollup-android-arm-eabi@4.24.4':
resolution: {integrity: sha512-jfUJrFct/hTA0XDM5p/htWKoNNTbDLY0KRwEt6pyOA6k2fmk0WVwl65PdUdJZgzGEHWx+49LilkcSaumQRyNQw==}
'@rollup/rollup-android-arm-eabi@4.25.0':
resolution: {integrity: sha512-CC/ZqFZwlAIbU1wUPisHyV/XRc5RydFrNLtgl3dGYskdwPZdt4HERtKm50a/+DtTlKeCq9IXFEWR+P6blwjqBA==}
cpu: [arm]
os: [android]
@ -1260,8 +1263,8 @@ packages:
cpu: [arm64]
os: [android]
'@rollup/rollup-android-arm64@4.24.4':
resolution: {integrity: sha512-j4nrEO6nHU1nZUuCfRKoCcvh7PIywQPUCBa2UsootTHvTHIoIu2BzueInGJhhvQO/2FTRdNYpf63xsgEqH9IhA==}
'@rollup/rollup-android-arm64@4.25.0':
resolution: {integrity: sha512-/Y76tmLGUJqVBXXCfVS8Q8FJqYGhgH4wl4qTA24E9v/IJM0XvJCGQVSW1QZ4J+VURO9h8YCa28sTFacZXwK7Rg==}
cpu: [arm64]
os: [android]
@ -1275,8 +1278,8 @@ packages:
cpu: [arm64]
os: [darwin]
'@rollup/rollup-darwin-arm64@4.24.4':
resolution: {integrity: sha512-GmU/QgGtBTeraKyldC7cDVVvAJEOr3dFLKneez/n7BvX57UdhOqDsVwzU7UOnYA7AAOt+Xb26lk79PldDHgMIQ==}
'@rollup/rollup-darwin-arm64@4.25.0':
resolution: {integrity: sha512-YVT6L3UrKTlC0FpCZd0MGA7NVdp7YNaEqkENbWQ7AOVOqd/7VzyHpgIpc1mIaxRAo1ZsJRH45fq8j4N63I/vvg==}
cpu: [arm64]
os: [darwin]
@ -1290,18 +1293,18 @@ packages:
cpu: [x64]
os: [darwin]
'@rollup/rollup-darwin-x64@4.24.4':
resolution: {integrity: sha512-N6oDBiZCBKlwYcsEPXGDE4g9RoxZLK6vT98M8111cW7VsVJFpNEqvJeIPfsCzbf0XEakPslh72X0gnlMi4Ddgg==}
'@rollup/rollup-darwin-x64@4.25.0':
resolution: {integrity: sha512-ZRL+gexs3+ZmmWmGKEU43Bdn67kWnMeWXLFhcVv5Un8FQcx38yulHBA7XR2+KQdYIOtD0yZDWBCudmfj6lQJoA==}
cpu: [x64]
os: [darwin]
'@rollup/rollup-freebsd-arm64@4.24.4':
resolution: {integrity: sha512-py5oNShCCjCyjWXCZNrRGRpjWsF0ic8f4ieBNra5buQz0O/U6mMXCpC1LvrHuhJsNPgRt36tSYMidGzZiJF6mw==}
'@rollup/rollup-freebsd-arm64@4.25.0':
resolution: {integrity: sha512-xpEIXhiP27EAylEpreCozozsxWQ2TJbOLSivGfXhU4G1TBVEYtUPi2pOZBnvGXHyOdLAUUhPnJzH3ah5cqF01g==}
cpu: [arm64]
os: [freebsd]
'@rollup/rollup-freebsd-x64@4.24.4':
resolution: {integrity: sha512-L7VVVW9FCnTTp4i7KrmHeDsDvjB4++KOBENYtNYAiYl96jeBThFfhP6HVxL74v4SiZEVDH/1ILscR5U9S4ms4g==}
'@rollup/rollup-freebsd-x64@4.25.0':
resolution: {integrity: sha512-sC5FsmZGlJv5dOcURrsnIK7ngc3Kirnx3as2XU9uER+zjfyqIjdcMVgzy4cOawhsssqzoAX19qmxgJ8a14Qrqw==}
cpu: [x64]
os: [freebsd]
@ -1317,8 +1320,8 @@ packages:
os: [linux]
libc: [glibc]
'@rollup/rollup-linux-arm-gnueabihf@4.24.4':
resolution: {integrity: sha512-10ICosOwYChROdQoQo589N5idQIisxjaFE/PAnX2i0Zr84mY0k9zul1ArH0rnJ/fpgiqfu13TFZR5A5YJLOYZA==}
'@rollup/rollup-linux-arm-gnueabihf@4.25.0':
resolution: {integrity: sha512-uD/dbLSs1BEPzg564TpRAQ/YvTnCds2XxyOndAO8nJhaQcqQGFgv/DAVko/ZHap3boCvxnzYMa3mTkV/B/3SWA==}
cpu: [arm]
os: [linux]
libc: [glibc]
@ -1335,8 +1338,8 @@ packages:
os: [linux]
libc: [musl]
'@rollup/rollup-linux-arm-musleabihf@4.24.4':
resolution: {integrity: sha512-ySAfWs69LYC7QhRDZNKqNhz2UKN8LDfbKSMAEtoEI0jitwfAG2iZwVqGACJT+kfYvvz3/JgsLlcBP+WWoKCLcw==}
'@rollup/rollup-linux-arm-musleabihf@4.25.0':
resolution: {integrity: sha512-ZVt/XkrDlQWegDWrwyC3l0OfAF7yeJUF4fq5RMS07YM72BlSfn2fQQ6lPyBNjt+YbczMguPiJoCfaQC2dnflpQ==}
cpu: [arm]
os: [linux]
libc: [musl]
@ -1353,8 +1356,8 @@ packages:
os: [linux]
libc: [glibc]
'@rollup/rollup-linux-arm64-gnu@4.24.4':
resolution: {integrity: sha512-uHYJ0HNOI6pGEeZ/5mgm5arNVTI0nLlmrbdph+pGXpC9tFHFDQmDMOEqkmUObRfosJqpU8RliYoGz06qSdtcjg==}
'@rollup/rollup-linux-arm64-gnu@4.25.0':
resolution: {integrity: sha512-qboZ+T0gHAW2kkSDPHxu7quaFaaBlynODXpBVnPxUgvWYaE84xgCKAPEYE+fSMd3Zv5PyFZR+L0tCdYCMAtG0A==}
cpu: [arm64]
os: [linux]
libc: [glibc]
@ -1371,8 +1374,8 @@ packages:
os: [linux]
libc: [musl]
'@rollup/rollup-linux-arm64-musl@4.24.4':
resolution: {integrity: sha512-38yiWLemQf7aLHDgTg85fh3hW9stJ0Muk7+s6tIkSUOMmi4Xbv5pH/5Bofnsb6spIwD5FJiR+jg71f0CH5OzoA==}
'@rollup/rollup-linux-arm64-musl@4.25.0':
resolution: {integrity: sha512-ndWTSEmAaKr88dBuogGH2NZaxe7u2rDoArsejNslugHZ+r44NfWiwjzizVS1nUOHo+n1Z6qV3X60rqE/HlISgw==}
cpu: [arm64]
os: [linux]
libc: [musl]
@ -1389,8 +1392,8 @@ packages:
os: [linux]
libc: [glibc]
'@rollup/rollup-linux-powerpc64le-gnu@4.24.4':
resolution: {integrity: sha512-q73XUPnkwt9ZNF2xRS4fvneSuaHw2BXuV5rI4cw0fWYVIWIBeDZX7c7FWhFQPNTnE24172K30I+dViWRVD9TwA==}
'@rollup/rollup-linux-powerpc64le-gnu@4.25.0':
resolution: {integrity: sha512-BVSQvVa2v5hKwJSy6X7W1fjDex6yZnNKy3Kx1JGimccHft6HV0THTwNtC2zawtNXKUu+S5CjXslilYdKBAadzA==}
cpu: [ppc64]
os: [linux]
libc: [glibc]
@ -1407,8 +1410,8 @@ packages:
os: [linux]
libc: [glibc]
'@rollup/rollup-linux-riscv64-gnu@4.24.4':
resolution: {integrity: sha512-Aie/TbmQi6UXokJqDZdmTJuZBCU3QBDA8oTKRGtd4ABi/nHgXICulfg1KI6n9/koDsiDbvHAiQO3YAUNa/7BCw==}
'@rollup/rollup-linux-riscv64-gnu@4.25.0':
resolution: {integrity: sha512-G4hTREQrIdeV0PE2JruzI+vXdRnaK1pg64hemHq2v5fhv8C7WjVaeXc9P5i4Q5UC06d/L+zA0mszYIKl+wY8oA==}
cpu: [riscv64]
os: [linux]
libc: [glibc]
@ -1425,8 +1428,8 @@ packages:
os: [linux]
libc: [glibc]
'@rollup/rollup-linux-s390x-gnu@4.24.4':
resolution: {integrity: sha512-P8MPErVO/y8ohWSP9JY7lLQ8+YMHfTI4bAdtCi3pC2hTeqFJco2jYspzOzTUB8hwUWIIu1xwOrJE11nP+0JFAQ==}
'@rollup/rollup-linux-s390x-gnu@4.25.0':
resolution: {integrity: sha512-9T/w0kQ+upxdkFL9zPVB6zy9vWW1deA3g8IauJxojN4bnz5FwSsUAD034KpXIVX5j5p/rn6XqumBMxfRkcHapQ==}
cpu: [s390x]
os: [linux]
libc: [glibc]
@ -1443,8 +1446,8 @@ packages:
os: [linux]
libc: [glibc]
'@rollup/rollup-linux-x64-gnu@4.24.4':
resolution: {integrity: sha512-K03TljaaoPK5FOyNMZAAEmhlyO49LaE4qCsr0lYHUKyb6QacTNF9pnfPpXnFlFD3TXuFbFbz7tJ51FujUXkXYA==}
'@rollup/rollup-linux-x64-gnu@4.25.0':
resolution: {integrity: sha512-ThcnU0EcMDn+J4B9LD++OgBYxZusuA7iemIIiz5yzEcFg04VZFzdFjuwPdlURmYPZw+fgVrFzj4CA64jSTG4Ig==}
cpu: [x64]
os: [linux]
libc: [glibc]
@ -1461,8 +1464,8 @@ packages:
os: [linux]
libc: [musl]
'@rollup/rollup-linux-x64-musl@4.24.4':
resolution: {integrity: sha512-VJYl4xSl/wqG2D5xTYncVWW+26ICV4wubwN9Gs5NrqhJtayikwCXzPL8GDsLnaLU3WwhQ8W02IinYSFJfyo34Q==}
'@rollup/rollup-linux-x64-musl@4.25.0':
resolution: {integrity: sha512-zx71aY2oQxGxAT1JShfhNG79PnjYhMC6voAjzpu/xmMjDnKNf6Nl/xv7YaB/9SIa9jDYf8RBPWEnjcdlhlv1rQ==}
cpu: [x64]
os: [linux]
libc: [musl]
@ -1477,8 +1480,8 @@ packages:
cpu: [arm64]
os: [win32]
'@rollup/rollup-win32-arm64-msvc@4.24.4':
resolution: {integrity: sha512-ku2GvtPwQfCqoPFIJCqZ8o7bJcj+Y54cZSr43hHca6jLwAiCbZdBUOrqE6y29QFajNAzzpIOwsckaTFmN6/8TA==}
'@rollup/rollup-win32-arm64-msvc@4.25.0':
resolution: {integrity: sha512-JT8tcjNocMs4CylWY/CxVLnv8e1lE7ff1fi6kbGocWwxDq9pj30IJ28Peb+Y8yiPNSF28oad42ApJB8oUkwGww==}
cpu: [arm64]
os: [win32]
@ -1492,8 +1495,8 @@ packages:
cpu: [ia32]
os: [win32]
'@rollup/rollup-win32-ia32-msvc@4.24.4':
resolution: {integrity: sha512-V3nCe+eTt/W6UYNr/wGvO1fLpHUrnlirlypZfKCT1fG6hWfqhPgQV/K/mRBXBpxc0eKLIF18pIOFVPh0mqHjlg==}
'@rollup/rollup-win32-ia32-msvc@4.25.0':
resolution: {integrity: sha512-dRLjLsO3dNOfSN6tjyVlG+Msm4IiZnGkuZ7G5NmpzwF9oOc582FZG05+UdfTbz5Jd4buK/wMb6UeHFhG18+OEg==}
cpu: [ia32]
os: [win32]
@ -1507,8 +1510,8 @@ packages:
cpu: [x64]
os: [win32]
'@rollup/rollup-win32-x64-msvc@4.24.4':
resolution: {integrity: sha512-LTw1Dfd0mBIEqUVCxbvTE/LLo+9ZxVC9k99v1v4ahg9Aak6FpqOfNu5kRkeTAn0wphoC4JU7No1/rL+bBCEwhg==}
'@rollup/rollup-win32-x64-msvc@4.25.0':
resolution: {integrity: sha512-/RqrIFtLB926frMhZD0a5oDa4eFIbyNEwLLloMTEjmqfwZWXywwVVOVmwTsuyhC9HKkVEZcOOi+KV4U9wmOdlg==}
cpu: [x64]
os: [win32]
@ -3565,8 +3568,8 @@ packages:
engines: {node: '>=18.0.0', npm: '>=8.0.0'}
hasBin: true
rollup@4.24.4:
resolution: {integrity: sha512-vGorVWIsWfX3xbcyAS+I047kFKapHYivmkaT63Smj77XwvLSJos6M1xGqZnBPFQFBRZDOcG1QnYEIxAvTr/HjA==}
rollup@4.25.0:
resolution: {integrity: sha512-uVbClXmR6wvx5R1M3Od4utyLUxrmOcEm3pAtMphn73Apq19PDtHpgZoEvqH2YnnaNUuvKmg2DgRd2Sqv+odyqg==}
engines: {node: '>=18.0.0', npm: '>=8.0.0'}
hasBin: true
@ -5117,7 +5120,7 @@ snapshots:
'@jridgewell/resolve-uri': 3.1.2
'@jridgewell/sourcemap-codec': 1.5.0
'@kevisual/router@0.0.4-alpha-6':
'@kevisual/router@0.0.4-alpha-7':
dependencies:
ws: 8.18.0
transitivePeerDependencies:
@ -5244,9 +5247,9 @@ snapshots:
optionalDependencies:
rollup: 4.24.0
'@rollup/plugin-commonjs@28.0.1(rollup@4.24.4)':
'@rollup/plugin-commonjs@28.0.1(rollup@4.25.0)':
dependencies:
'@rollup/pluginutils': 5.1.2(rollup@4.24.4)
'@rollup/pluginutils': 5.1.2(rollup@4.25.0)
commondir: 1.0.1
estree-walker: 2.0.2
fdir: 6.3.0(picomatch@4.0.2)
@ -5254,7 +5257,7 @@ snapshots:
magic-string: 0.30.11
picomatch: 4.0.2
optionalDependencies:
rollup: 4.24.4
rollup: 4.25.0
'@rollup/plugin-json@6.1.0(rollup@4.24.0)':
dependencies:
@ -5262,11 +5265,11 @@ snapshots:
optionalDependencies:
rollup: 4.24.0
'@rollup/plugin-json@6.1.0(rollup@4.24.4)':
'@rollup/plugin-json@6.1.0(rollup@4.25.0)':
dependencies:
'@rollup/pluginutils': 5.1.2(rollup@4.24.4)
'@rollup/pluginutils': 5.1.2(rollup@4.25.0)
optionalDependencies:
rollup: 4.24.4
rollup: 4.25.0
'@rollup/plugin-node-resolve@15.3.0(rollup@4.22.4)':
dependencies:
@ -5288,15 +5291,15 @@ snapshots:
optionalDependencies:
rollup: 4.24.0
'@rollup/plugin-node-resolve@15.3.0(rollup@4.24.4)':
'@rollup/plugin-node-resolve@15.3.0(rollup@4.25.0)':
dependencies:
'@rollup/pluginutils': 5.1.2(rollup@4.24.4)
'@rollup/pluginutils': 5.1.2(rollup@4.25.0)
'@types/resolve': 1.20.2
deepmerge: 4.3.1
is-module: 1.0.0
resolve: 1.22.8
optionalDependencies:
rollup: 4.24.4
rollup: 4.25.0
'@rollup/plugin-typescript@12.1.0(rollup@4.22.4)(tslib@2.7.0)(typescript@5.6.3)':
dependencies:
@ -5316,13 +5319,13 @@ snapshots:
rollup: 4.24.0
tslib: 2.7.0
'@rollup/plugin-typescript@12.1.1(rollup@4.24.4)(tslib@2.7.0)(typescript@5.6.3)':
'@rollup/plugin-typescript@12.1.1(rollup@4.25.0)(tslib@2.7.0)(typescript@5.6.3)':
dependencies:
'@rollup/pluginutils': 5.1.2(rollup@4.24.4)
'@rollup/pluginutils': 5.1.2(rollup@4.25.0)
resolve: 1.22.8
typescript: 5.6.3
optionalDependencies:
rollup: 4.24.4
rollup: 4.25.0
tslib: 2.7.0
'@rollup/pluginutils@5.1.2(rollup@4.22.4)':
@ -5341,13 +5344,13 @@ snapshots:
optionalDependencies:
rollup: 4.24.0
'@rollup/pluginutils@5.1.2(rollup@4.24.4)':
'@rollup/pluginutils@5.1.2(rollup@4.25.0)':
dependencies:
'@types/estree': 1.0.6
estree-walker: 2.0.2
picomatch: 4.0.2
optionalDependencies:
rollup: 4.24.4
rollup: 4.25.0
'@rollup/rollup-android-arm-eabi@4.22.4':
optional: true
@ -5355,7 +5358,7 @@ snapshots:
'@rollup/rollup-android-arm-eabi@4.24.0':
optional: true
'@rollup/rollup-android-arm-eabi@4.24.4':
'@rollup/rollup-android-arm-eabi@4.25.0':
optional: true
'@rollup/rollup-android-arm64@4.22.4':
@ -5364,7 +5367,7 @@ snapshots:
'@rollup/rollup-android-arm64@4.24.0':
optional: true
'@rollup/rollup-android-arm64@4.24.4':
'@rollup/rollup-android-arm64@4.25.0':
optional: true
'@rollup/rollup-darwin-arm64@4.22.4':
@ -5373,7 +5376,7 @@ snapshots:
'@rollup/rollup-darwin-arm64@4.24.0':
optional: true
'@rollup/rollup-darwin-arm64@4.24.4':
'@rollup/rollup-darwin-arm64@4.25.0':
optional: true
'@rollup/rollup-darwin-x64@4.22.4':
@ -5382,13 +5385,13 @@ snapshots:
'@rollup/rollup-darwin-x64@4.24.0':
optional: true
'@rollup/rollup-darwin-x64@4.24.4':
'@rollup/rollup-darwin-x64@4.25.0':
optional: true
'@rollup/rollup-freebsd-arm64@4.24.4':
'@rollup/rollup-freebsd-arm64@4.25.0':
optional: true
'@rollup/rollup-freebsd-x64@4.24.4':
'@rollup/rollup-freebsd-x64@4.25.0':
optional: true
'@rollup/rollup-linux-arm-gnueabihf@4.22.4':
@ -5397,7 +5400,7 @@ snapshots:
'@rollup/rollup-linux-arm-gnueabihf@4.24.0':
optional: true
'@rollup/rollup-linux-arm-gnueabihf@4.24.4':
'@rollup/rollup-linux-arm-gnueabihf@4.25.0':
optional: true
'@rollup/rollup-linux-arm-musleabihf@4.22.4':
@ -5406,7 +5409,7 @@ snapshots:
'@rollup/rollup-linux-arm-musleabihf@4.24.0':
optional: true
'@rollup/rollup-linux-arm-musleabihf@4.24.4':
'@rollup/rollup-linux-arm-musleabihf@4.25.0':
optional: true
'@rollup/rollup-linux-arm64-gnu@4.22.4':
@ -5415,7 +5418,7 @@ snapshots:
'@rollup/rollup-linux-arm64-gnu@4.24.0':
optional: true
'@rollup/rollup-linux-arm64-gnu@4.24.4':
'@rollup/rollup-linux-arm64-gnu@4.25.0':
optional: true
'@rollup/rollup-linux-arm64-musl@4.22.4':
@ -5424,7 +5427,7 @@ snapshots:
'@rollup/rollup-linux-arm64-musl@4.24.0':
optional: true
'@rollup/rollup-linux-arm64-musl@4.24.4':
'@rollup/rollup-linux-arm64-musl@4.25.0':
optional: true
'@rollup/rollup-linux-powerpc64le-gnu@4.22.4':
@ -5433,7 +5436,7 @@ snapshots:
'@rollup/rollup-linux-powerpc64le-gnu@4.24.0':
optional: true
'@rollup/rollup-linux-powerpc64le-gnu@4.24.4':
'@rollup/rollup-linux-powerpc64le-gnu@4.25.0':
optional: true
'@rollup/rollup-linux-riscv64-gnu@4.22.4':
@ -5442,7 +5445,7 @@ snapshots:
'@rollup/rollup-linux-riscv64-gnu@4.24.0':
optional: true
'@rollup/rollup-linux-riscv64-gnu@4.24.4':
'@rollup/rollup-linux-riscv64-gnu@4.25.0':
optional: true
'@rollup/rollup-linux-s390x-gnu@4.22.4':
@ -5451,7 +5454,7 @@ snapshots:
'@rollup/rollup-linux-s390x-gnu@4.24.0':
optional: true
'@rollup/rollup-linux-s390x-gnu@4.24.4':
'@rollup/rollup-linux-s390x-gnu@4.25.0':
optional: true
'@rollup/rollup-linux-x64-gnu@4.22.4':
@ -5460,7 +5463,7 @@ snapshots:
'@rollup/rollup-linux-x64-gnu@4.24.0':
optional: true
'@rollup/rollup-linux-x64-gnu@4.24.4':
'@rollup/rollup-linux-x64-gnu@4.25.0':
optional: true
'@rollup/rollup-linux-x64-musl@4.22.4':
@ -5469,7 +5472,7 @@ snapshots:
'@rollup/rollup-linux-x64-musl@4.24.0':
optional: true
'@rollup/rollup-linux-x64-musl@4.24.4':
'@rollup/rollup-linux-x64-musl@4.25.0':
optional: true
'@rollup/rollup-win32-arm64-msvc@4.22.4':
@ -5478,7 +5481,7 @@ snapshots:
'@rollup/rollup-win32-arm64-msvc@4.24.0':
optional: true
'@rollup/rollup-win32-arm64-msvc@4.24.4':
'@rollup/rollup-win32-arm64-msvc@4.25.0':
optional: true
'@rollup/rollup-win32-ia32-msvc@4.22.4':
@ -5487,7 +5490,7 @@ snapshots:
'@rollup/rollup-win32-ia32-msvc@4.24.0':
optional: true
'@rollup/rollup-win32-ia32-msvc@4.24.4':
'@rollup/rollup-win32-ia32-msvc@4.25.0':
optional: true
'@rollup/rollup-win32-x64-msvc@4.22.4':
@ -5496,7 +5499,7 @@ snapshots:
'@rollup/rollup-win32-x64-msvc@4.24.0':
optional: true
'@rollup/rollup-win32-x64-msvc@4.24.4':
'@rollup/rollup-win32-x64-msvc@4.25.0':
optional: true
'@sindresorhus/merge-streams@2.3.0': {}
@ -7766,10 +7769,10 @@ snapshots:
globby: 10.0.1
is-plain-object: 3.0.1
rollup-plugin-dts@6.1.1(rollup@4.24.4)(typescript@5.6.3):
rollup-plugin-dts@6.1.1(rollup@4.25.0)(typescript@5.6.3):
dependencies:
magic-string: 0.30.11
rollup: 4.24.4
rollup: 4.25.0
typescript: 5.6.3
optionalDependencies:
'@babel/code-frame': 7.26.2
@ -7818,28 +7821,28 @@ snapshots:
'@rollup/rollup-win32-x64-msvc': 4.24.0
fsevents: 2.3.3
rollup@4.24.4:
rollup@4.25.0:
dependencies:
'@types/estree': 1.0.6
optionalDependencies:
'@rollup/rollup-android-arm-eabi': 4.24.4
'@rollup/rollup-android-arm64': 4.24.4
'@rollup/rollup-darwin-arm64': 4.24.4
'@rollup/rollup-darwin-x64': 4.24.4
'@rollup/rollup-freebsd-arm64': 4.24.4
'@rollup/rollup-freebsd-x64': 4.24.4
'@rollup/rollup-linux-arm-gnueabihf': 4.24.4
'@rollup/rollup-linux-arm-musleabihf': 4.24.4
'@rollup/rollup-linux-arm64-gnu': 4.24.4
'@rollup/rollup-linux-arm64-musl': 4.24.4
'@rollup/rollup-linux-powerpc64le-gnu': 4.24.4
'@rollup/rollup-linux-riscv64-gnu': 4.24.4
'@rollup/rollup-linux-s390x-gnu': 4.24.4
'@rollup/rollup-linux-x64-gnu': 4.24.4
'@rollup/rollup-linux-x64-musl': 4.24.4
'@rollup/rollup-win32-arm64-msvc': 4.24.4
'@rollup/rollup-win32-ia32-msvc': 4.24.4
'@rollup/rollup-win32-x64-msvc': 4.24.4
'@rollup/rollup-android-arm-eabi': 4.25.0
'@rollup/rollup-android-arm64': 4.25.0
'@rollup/rollup-darwin-arm64': 4.25.0
'@rollup/rollup-darwin-x64': 4.25.0
'@rollup/rollup-freebsd-arm64': 4.25.0
'@rollup/rollup-freebsd-x64': 4.25.0
'@rollup/rollup-linux-arm-gnueabihf': 4.25.0
'@rollup/rollup-linux-arm-musleabihf': 4.25.0
'@rollup/rollup-linux-arm64-gnu': 4.25.0
'@rollup/rollup-linux-arm64-musl': 4.25.0
'@rollup/rollup-linux-powerpc64le-gnu': 4.25.0
'@rollup/rollup-linux-riscv64-gnu': 4.25.0
'@rollup/rollup-linux-s390x-gnu': 4.25.0
'@rollup/rollup-linux-x64-gnu': 4.25.0
'@rollup/rollup-linux-x64-musl': 4.25.0
'@rollup/rollup-win32-arm64-msvc': 4.25.0
'@rollup/rollup-win32-ia32-msvc': 4.25.0
'@rollup/rollup-win32-x64-msvc': 4.25.0
fsevents: 2.3.3
run-parallel@1.2.0:

49
rollup.apps.config.mjs Normal file
View File

@ -0,0 +1,49 @@
import typescript from '@rollup/plugin-typescript';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import copy from 'rollup-plugin-copy';
import { dts } from 'rollup-plugin-dts';
import json from '@rollup/plugin-json';
import * as glob from 'glob';
import path from 'path';
const files = glob.sync('src-apps/**/index.ts');
console.log(files);
const configs = files.map((file) => {
const inputFile = file;
const directory = file.split('/').slice(0, -1).join('/');
const outputDirectory = directory.replace('src-apps', 'dist/apps');
console.log(directory);
console.log(outputDirectory);
/**
* @type {import('rollup').RollupOptions}
*/
const config = {
input: inputFile,
output: {
outDir: outputDirectory,
file: path.join(outputDirectory, 'index.cjs'),
format: 'cjs',
// format: 'esm',
},
plugins: [
resolve(),
// commonjs(),
typescript({
declaration: false,
}),
// json(),
// copy({
// targets: [
// {
// src: `${directory}/*.html`,
// dest: outputDirectory,
// },
// ],
// }),
],
external: ['sequelize'],
};
return config;
});
export default [...configs];

View File

@ -1,32 +0,0 @@
import typescript from '@rollup/plugin-typescript';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import copy from 'rollup-plugin-copy';
import { dts } from 'rollup-plugin-dts';
import json from '@rollup/plugin-json';
/**
* @type {import('rollup').RollupOptions}
*/
const config1 = {
input: 'src/index.ts', // TypeScript 入口文件
output: {
dir: 'dist',
// file: 'dist/app.js', // 输出文件
format: 'es', // 输出格式设置为 ES 模块
},
plugins: [
resolve({
browser: false,
}), // 使用 @rollup/plugin-node-resolve 解析 node_modules 中的模块
commonjs(), //
json(),
typescript({
allowImportingTsExtensions: true,
noEmit: true,
declaration: false,
}), // 使用 @rollup/plugin-typescript 处理 TypeScript 文件
],
external: ['sequelize', 'socket.io', '@babel/preset-env', '@babel/preset-typescript', 'ioredis'],
};
export default [config1];

37
rollup.config.mjs Normal file
View File

@ -0,0 +1,37 @@
import typescript from '@rollup/plugin-typescript';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import copy from 'rollup-plugin-copy';
import { dts } from 'rollup-plugin-dts';
import json from '@rollup/plugin-json';
import path from 'path';
const config = {
input: 'src/index.ts',
output: {
dir: 'dist',
// file: path.join('dist', 'app.cjs'),
format: 'esm',
},
plugins: [
resolve(),
commonjs(),
typescript({
declaration: false,
}),
json(),
// copy({
// targets: [
// {
// src: `${directory}/*.html`,
// dest: outputDirectory,
// },
// ],
// }),
],
external: ['sequelize'],
resolve: {
stream: true,
},
};
export default [config];

129
src-apps/favorite/index.ts Normal file
View File

@ -0,0 +1,129 @@
import type { App, RouteContext } from '@kevisual/router';
import { DataTypes, Model } from 'sequelize';
type AppContext = {
import: any;
sequelize: any;
};
type Ctx = RouteContext<AppContext>;
class Favorite extends Model {
declare id: string;
declare title: string;
declare description: string;
declare cover: string;
declare url: string;
declare share: boolean;
declare tags: string[];
declare uid: string;
declare username: string;
}
export const getModel = async (ctx: Ctx) => {
const sequelize = ctx.sequelize;
if (!sequelize) {
ctx.throw?.('sequelize instance not found');
}
Favorite.init(
{
id: {
type: DataTypes.UUID,
primaryKey: true,
defaultValue: DataTypes.UUIDV4,
},
cover: {
type: DataTypes.TEXT,
allowNull: true,
defaultValue: '',
},
title: {
type: DataTypes.TEXT,
allowNull: false,
defaultValue: '',
},
description: {
type: DataTypes.TEXT,
allowNull: true,
},
url: {
type: DataTypes.TEXT,
allowNull: false,
},
share: {
type: DataTypes.BOOLEAN,
defaultValue: false,
},
tags: {
type: DataTypes.JSONB,
defaultValue: [],
},
uid: {
type: DataTypes.UUID,
allowNull: false,
},
username: {
type: DataTypes.TEXT,
allowNull: false,
defaultValue: '',
},
},
{
sequelize,
modelName: 'apps_favorite',
},
);
return Favorite;
};
/**
*
* @param ctx
*/
export const initModel = async (ctx: RouteContext<AppContext>) => {
try {
const Favorite = await getModel(ctx);
const res = await Favorite.sync({ alter: true });
ctx.body = 'success';
} catch (error) {
console.error(error);
ctx.throw?.(error.message);
}
};
export const render = (app: App) => {
app
.route({
path: 'nav',
key: 'init',
middleware: ['auth'],
})
.define(initModel)
.addTo(app);
app
.route({
path: 'nav',
key: 'list',
})
.define<AppContext>(async (ctx) => {
const Favorite = await getModel(ctx);
const res = await Favorite.findAll();
ctx.body = res;
})
.addTo(app);
app
.route({
path: 'nav',
key: 'delete',
})
.define(async (ctx) => {
ctx.body = 'success';
})
.addTo(app);
app
.route({
path: 'nav',
key: 'update',
})
.define(async (ctx) => {
ctx.body = 'update success';
}).addTo(app);
};

View File

@ -1,4 +1,6 @@
import { EventEmitter, once } from 'stream';
import stream from 'stream'; // 默认导入整个模块
const { once } = stream; // 从中解构出 EventEmitter
import { load, CodeManager, CodeStatus, loadOne } from './load.ts';
import { RouterCodeModel, TableIsExist } from '../models/code.ts';
import { emitter } from '../modules/event.ts';

View File

@ -1,10 +1,11 @@
import { EventEmitter, once } from 'stream';
import stream from 'stream'; // 默认导入整个模块
const { EventEmitter, once } = stream; // 从中解构出 EventEmitter
// 事件
export const emitter = new EventEmitter();
type EmitterType = typeof emitter;
// 异步触发事件 demo
export const asyncEmit = (emitter: EventEmitter, eventName: string) => {
export const asyncEmit = (emitter: EmitterType, eventName: string) => {
return new Promise((resolve) => {
emitter.once(eventName, (value: any) => resolve(value));
});

View File

@ -5,13 +5,14 @@ import { redisPublisher, redisSubscriber, redis } from './modules/redis.ts';
import { neode, getSession } from './modules/neo4j.ts';
import { minioClient } from './modules/minio.ts';
import { sequelize } from './modules/sequelize.ts';
useConfig();
export const emit = (channel: string, message?: any) => {
redisPublisher.publish(channel, JSON.stringify(message));
};
export { neode, getSession, redis, minioClient, sequelize };
export const app = new App<{ import: any; emit: typeof emit }>({
export const app = new App<{ import: any; emit: typeof emit; sequelize: typeof sequelize }>({
serverOptions: {
cors: {
origin: '*',
@ -21,6 +22,7 @@ export const app = new App<{ import: any; emit: typeof emit }>({
routerContext: {
import: dynamicImport,
emit,
sequelize,
},
// routerHandle(res) {
// console.log('routerHandle', res.query);

View File

@ -4,9 +4,10 @@ import './route.ts';
const config = useConfig();
import { app as aiApp } from '@kevisual/ai-lang/src/index.ts';
import { uploadMiddleware } from './lib/upload.ts';
//
import { loadApps } from './load-apps.ts';
export { aiApp };
export { app };
loadApps(app);
app.listen(config.port, () => {
console.log(`server is running at http://localhost:${config.port}`);
});

13
src/load-apps.ts Normal file
View File

@ -0,0 +1,13 @@
import * as glob from 'glob';
import * as path from 'path';
const files = glob.sync(path.resolve(__dirname, './apps/**/index.cjs'));
export const loadApps = async (app: any) => {
for (const file of files) {
const module = __non_webpack_require__(file);
if (module.render) {
module.render(app);
}
}
};

View File

@ -32,7 +32,8 @@
"include": [
"typings.d.ts",
"src/**/*.ts",
"test/**/*.ts"
"test/**/*.ts",
"src-apps/**/*.ts",
],
"exclude": [
"node_modules",

View File

@ -24,20 +24,14 @@ module.exports = {
mode: 'production',
entry: path.join(__dirname, './src/index.ts'),
target: 'node',
// devtool: 'source-map',
output: {
path: path.join(__dirname, './dist'),
// path: path.join(__dirname, './dev-package'),
// filename: 'app.mjs',
filename: 'app.cjs',
// module: true,
// chunkFormat: 'module',
},
// experiments: {
// outputModule: true,
// },
optimization: {
minimize: false,
minimize: true,
},
module: {
rules: [
@ -68,7 +62,6 @@ module.exports = {
extensions: ['.ts', '.js'],
alias: {
'@': path.join(__dirname, './src'),
// hexoid: 'hexoid/dist/index.js',
},
},

View File

@ -1,59 +0,0 @@
/* eslint-disable */
const path = require('path');
const webpack = require('webpack');
const nodeExternals = require('webpack-node-externals');
const pkgs = require('./package.json');
const glob = require('glob');
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
const plugins = [new ForkTsCheckerWebpackPlugin()];
module.exports = {
// mode: 'production',
// entry: path.join(__dirname, './src/app.ts'),
entry: glob.sync('./src/scripts/*.ts').reduce((entries, p) => {
const name = path.basename(p, '.ts'); //获取路径的文件名 aaa/bbb.js => bbb
return { ...entries, [name]: p };
}, {}),
target: 'node',
output: {
path: path.join(__dirname, './dist/scripts'),
module: true,
chunkFormat: 'module',
},
experiments: {
outputModule: true,
},
optimization: {
minimize: false,
},
module: {
rules: [
{
test: /\.tsx?$/,
exclude: '/node_modules/',
use: {
loader: 'ts-loader',
options: {
allowTsInNodeModules: true,
},
},
},
],
},
resolve: {
extensions: ['.ts', '.js'],
alias: {
'@': path.join(__dirname, './src'),
hexoid: 'hexoid/dist/index.js',
},
},
externals: [
nodeExternals({
allowlist: ['/@abearxiong*/'],
}),
],
plugins: [...plugins],
node: {},
};