diff --git a/.gitignore b/.gitignore index 9ee6d08..a41c740 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ node_modules dist -pack-dist \ No newline at end of file +pack-dist +apps diff --git a/apps/.gitignore b/apps/.gitignore index 50208cb..ae76b4b 100644 --- a/apps/.gitignore +++ b/apps/.gitignore @@ -1 +1,2 @@ -container \ No newline at end of file +container +root \ No newline at end of file diff --git a/bun.config.mjs b/bun.config.mjs new file mode 100644 index 0000000..2a81474 --- /dev/null +++ b/bun.config.mjs @@ -0,0 +1,18 @@ +// @ts-check +// https://bun.sh/docs/bundler +import pkg from './package.json' assert { type: 'json' }; +// bun run src/index.ts -- +await Bun.build({ + target: 'node', + format: 'esm', + entrypoints: ['./src/index.ts'], + outdir: './dist', + naming: { + entry: 'app.mjs', + }, + + define: { + ENVISION_VERSION: JSON.stringify(pkg.version), + }, + env: 'ENVISION_*', +}); diff --git a/package.json b/package.json index 7d60233..58bb9a9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@kevisual/envision-cli", - "version": "0.0.40", + "version": "0.0.41", "description": "envision command tools", "main": "dist/app.mjs", "type": "module", @@ -24,8 +24,8 @@ "bin" ], "scripts": { - "dev": "tsx src/run.ts ", - "build": "rimraf dist && rollup -c" + "dev": "bun run src/run.ts ", + "build": "rimraf dist && bun run bun.config.mjs" }, "keywords": [ "kevisual", @@ -33,35 +33,28 @@ ], "author": "abearxiong", "devDependencies": { - "@kevisual/query": "0.0.15", - "@kevisual/query-login": "workspace:*", - "@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", + "@kevisual/load": "^0.0.6", + "@kevisual/query": "0.0.17", + "@kevisual/query-login": "0.0.5", + "@types/bun": "^1.2.10", "@types/crypto-js": "^4.2.2", "@types/jsonwebtoken": "^9.0.9", - "@types/node": "^22.13.17", + "@types/node": "^22.14.1", "chalk": "^5.4.1", "commander": "^13.1.0", + "crypto-js": "^4.2.0", "fast-glob": "^3.3.3", "filesize": "^10.1.6", "form-data": "^4.0.2", "ignore": "^7.0.3", - "inquirer": "^12.5.0", - "rollup": "^4.39.0", - "rollup-plugin-esbuild": "^6.2.1", - "tar": "^7.4.3", - "@kevisual/load": "^0.0.6", - "crypto-js": "^4.2.0", - "jsonwebtoken": "^9.0.2" + "inquirer": "^12.5.2", + "jsonwebtoken": "^9.0.2", + "tar": "^7.4.3" }, "engines": { "node": ">=22.0.0" }, "publishConfig": { "access": "public" - }, - "dependencies": {} + } } \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b68a094..20cf3e6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,26 +12,14 @@ importers: specifier: ^0.0.6 version: 0.0.6 '@kevisual/query': - specifier: 0.0.15 - version: 0.0.15(encoding@0.1.13)(ws@8.18.0) + specifier: 0.0.17 + version: 0.0.17(encoding@0.1.13)(ws@8.18.0) '@kevisual/query-login': - specifier: workspace:* - version: link:submodules/kevisual-query-login - '@rollup/plugin-alias': - specifier: ^5.1.1 - version: 5.1.1(rollup@4.39.0) - '@rollup/plugin-commonjs': - specifier: ^28.0.3 - version: 28.0.3(rollup@4.39.0) - '@rollup/plugin-json': - specifier: ^6.1.0 - version: 6.1.0(rollup@4.39.0) - '@rollup/plugin-node-resolve': - specifier: ^16.0.1 - version: 16.0.1(rollup@4.39.0) - '@rollup/plugin-replace': - specifier: ^6.0.2 - version: 6.0.2(rollup@4.39.0) + specifier: 0.0.5 + version: 0.0.5(@kevisual/query@0.0.17(encoding@0.1.13)(ws@8.18.0)) + '@types/bun': + specifier: ^1.2.10 + version: 1.2.10 '@types/crypto-js': specifier: ^4.2.2 version: 4.2.2 @@ -39,8 +27,8 @@ importers: specifier: ^9.0.9 version: 9.0.9 '@types/node': - specifier: ^22.13.17 - version: 22.13.17 + specifier: ^22.14.1 + version: 22.14.1 chalk: specifier: ^5.4.1 version: 5.4.1 @@ -63,17 +51,11 @@ importers: specifier: ^7.0.3 version: 7.0.3 inquirer: - specifier: ^12.5.0 - version: 12.5.0(@types/node@22.13.17) + specifier: ^12.5.2 + version: 12.5.2(@types/node@22.14.1) jsonwebtoken: specifier: ^9.0.2 version: 9.0.2 - rollup: - specifier: ^4.39.0 - version: 4.39.0 - rollup-plugin-esbuild: - specifier: ^6.2.1 - version: 6.2.1(esbuild@0.25.0)(rollup@4.39.0) tar: specifier: ^7.4.3 version: 7.4.3 @@ -81,18 +63,18 @@ importers: submodules/kevisual-query-login: dependencies: '@kevisual/cache': - specifier: ^0.0.1 - version: 0.0.1(rollup@4.39.0)(tslib@2.8.1)(typescript@5.8.2) + specifier: ^0.0.2 + version: 0.0.2(rollup@4.39.0)(tslib@2.8.1)(typescript@5.8.2) '@kevisual/query': - specifier: ^0.0.15 - version: 0.0.15(encoding@0.1.13)(ws@8.18.0) + specifier: ^0.0.17 + version: 0.0.17(encoding@0.1.13)(ws@8.18.0) dotenv: - specifier: ^16.4.7 - version: 16.4.7 + specifier: ^16.5.0 + version: 16.5.0 devDependencies: '@types/node': - specifier: ^22.13.11 - version: 22.13.11 + specifier: ^22.14.1 + version: 22.14.1 tsup: specifier: ^8.4.0 version: 8.4.0(postcss@8.5.3)(typescript@5.8.2) @@ -257,8 +239,8 @@ packages: cpu: [x64] os: [win32] - '@inquirer/checkbox@4.1.4': - resolution: {integrity: sha512-d30576EZdApjAMceijXA5jDzRQHT/MygbC+J8I7EqA6f/FRpYxlRtRJbHF8gHeWYeSdOuTEJqonn7QLB1ELezA==} + '@inquirer/checkbox@4.1.5': + resolution: {integrity: sha512-swPczVU+at65xa5uPfNP9u3qx/alNwiaykiI/ExpsmMSQW55trmZcwhYWzw/7fj+n6Q8z1eENvR7vFfq9oPSAQ==} engines: {node: '>=18'} peerDependencies: '@types/node': '>=18' @@ -266,8 +248,8 @@ packages: '@types/node': optional: true - '@inquirer/confirm@5.1.8': - resolution: {integrity: sha512-dNLWCYZvXDjO3rnQfk2iuJNL4Ivwz/T2+C3+WnNfJKsNGSuOs3wAo2F6e0p946gtSAk31nZMfW+MRmYaplPKsg==} + '@inquirer/confirm@5.1.9': + resolution: {integrity: sha512-NgQCnHqFTjF7Ys2fsqK2WtnA8X1kHyInyG+nMIuHowVTIgIuS10T4AznI/PvbqSpJqjCUqNBlKGh1v3bwLFL4w==} engines: {node: '>=18'} peerDependencies: '@types/node': '>=18' @@ -275,8 +257,8 @@ packages: '@types/node': optional: true - '@inquirer/core@10.1.9': - resolution: {integrity: sha512-sXhVB8n20NYkUBfDYgizGHlpRVaCRjtuzNZA6xpALIUbkgfd2Hjz+DfEN6+h1BRnuxw0/P4jCIMjMsEOAMwAJw==} + '@inquirer/core@10.1.10': + resolution: {integrity: sha512-roDaKeY1PYY0aCqhRmXihrHjoSW2A00pV3Ke5fTpMCkzcGF64R8e0lw3dK+eLEHwS4vB5RnW1wuQmvzoRul8Mw==} engines: {node: '>=18'} peerDependencies: '@types/node': '>=18' @@ -284,8 +266,8 @@ packages: '@types/node': optional: true - '@inquirer/editor@4.2.9': - resolution: {integrity: sha512-8HjOppAxO7O4wV1ETUlJFg6NDjp/W2NP5FB9ZPAcinAlNT4ZIWOLe2pUVwmmPRSV0NMdI5r/+lflN55AwZOKSw==} + '@inquirer/editor@4.2.10': + resolution: {integrity: sha512-5GVWJ+qeI6BzR6TIInLP9SXhWCEcvgFQYmcRG6d6RIlhFjM5TyG18paTGBgRYyEouvCmzeco47x9zX9tQEofkw==} engines: {node: '>=18'} peerDependencies: '@types/node': '>=18' @@ -293,8 +275,8 @@ packages: '@types/node': optional: true - '@inquirer/expand@4.0.11': - resolution: {integrity: sha512-OZSUW4hFMW2TYvX/Sv+NnOZgO8CHT2TU1roUCUIF2T+wfw60XFRRp9MRUPCT06cRnKL+aemt2YmTWwt7rOrNEA==} + '@inquirer/expand@4.0.12': + resolution: {integrity: sha512-jV8QoZE1fC0vPe6TnsOfig+qwu7Iza1pkXoUJ3SroRagrt2hxiL+RbM432YAihNR7m7XnU0HWl/WQ35RIGmXHw==} engines: {node: '>=18'} peerDependencies: '@types/node': '>=18' @@ -306,8 +288,8 @@ packages: resolution: {integrity: sha512-eOg92lvrn/aRUqbxRyvpEWnrvRuTYRifixHkYVpJiygTgVSBIHDqLh0SrMQXkafvULg3ck11V7xvR+zcgvpHFw==} engines: {node: '>=18'} - '@inquirer/input@4.1.8': - resolution: {integrity: sha512-WXJI16oOZ3/LiENCAxe8joniNp8MQxF6Wi5V+EBbVA0ZIOpFcL4I9e7f7cXse0HJeIPCWO8Lcgnk98juItCi7Q==} + '@inquirer/input@4.1.9': + resolution: {integrity: sha512-mshNG24Ij5KqsQtOZMgj5TwEjIf+F2HOESk6bjMwGWgcH5UBe8UoljwzNFHqdMbGYbgAf6v2wU/X9CAdKJzgOA==} engines: {node: '>=18'} peerDependencies: '@types/node': '>=18' @@ -315,8 +297,8 @@ packages: '@types/node': optional: true - '@inquirer/number@3.0.11': - resolution: {integrity: sha512-pQK68CsKOgwvU2eA53AG/4npRTH2pvs/pZ2bFvzpBhrznh8Mcwt19c+nMO7LHRr3Vreu1KPhNBF3vQAKrjIulw==} + '@inquirer/number@3.0.12': + resolution: {integrity: sha512-7HRFHxbPCA4e4jMxTQglHJwP+v/kpFsCf2szzfBHy98Wlc3L08HL76UDiA87TOdX5fwj2HMOLWqRWv9Pnn+Z5Q==} engines: {node: '>=18'} peerDependencies: '@types/node': '>=18' @@ -324,8 +306,8 @@ packages: '@types/node': optional: true - '@inquirer/password@4.0.11': - resolution: {integrity: sha512-dH6zLdv+HEv1nBs96Case6eppkRggMe8LoOTl30+Gq5Wf27AO/vHFgStTVz4aoevLdNXqwE23++IXGw4eiOXTg==} + '@inquirer/password@4.0.12': + resolution: {integrity: sha512-FlOB0zvuELPEbnBYiPaOdJIaDzb2PmJ7ghi/SVwIHDDSQ2K4opGBkF+5kXOg6ucrtSUQdLhVVY5tycH0j0l+0g==} engines: {node: '>=18'} peerDependencies: '@types/node': '>=18' @@ -333,8 +315,8 @@ packages: '@types/node': optional: true - '@inquirer/prompts@7.4.0': - resolution: {integrity: sha512-EZiJidQOT4O5PYtqnu1JbF0clv36oW2CviR66c7ma4LsupmmQlUwmdReGKRp456OWPWMz3PdrPiYg3aCk3op2w==} + '@inquirer/prompts@7.4.1': + resolution: {integrity: sha512-UlmM5FVOZF0gpoe1PT/jN4vk8JmpIWBlMvTL8M+hlvPmzN89K6z03+IFmyeu/oFCenwdwHDr2gky7nIGSEVvlA==} engines: {node: '>=18'} peerDependencies: '@types/node': '>=18' @@ -342,8 +324,8 @@ packages: '@types/node': optional: true - '@inquirer/rawlist@4.0.11': - resolution: {integrity: sha512-uAYtTx0IF/PqUAvsRrF3xvnxJV516wmR6YVONOmCWJbbt87HcDHLfL9wmBQFbNJRv5kCjdYKrZcavDkH3sVJPg==} + '@inquirer/rawlist@4.0.12': + resolution: {integrity: sha512-wNPJZy8Oc7RyGISPxp9/MpTOqX8lr0r+lCCWm7hQra+MDtYRgINv1hxw7R+vKP71Bu/3LszabxOodfV/uTfsaA==} engines: {node: '>=18'} peerDependencies: '@types/node': '>=18' @@ -351,8 +333,8 @@ packages: '@types/node': optional: true - '@inquirer/search@3.0.11': - resolution: {integrity: sha512-9CWQT0ikYcg6Ls3TOa7jljsD7PgjcsYEM0bYE+Gkz+uoW9u8eaJCRHJKkucpRE5+xKtaaDbrND+nPDoxzjYyew==} + '@inquirer/search@3.0.12': + resolution: {integrity: sha512-H/kDJA3kNlnNIjB8YsaXoQI0Qccgf0Na14K1h8ExWhNmUg2E941dyFPrZeugihEa9AZNW5NdsD/NcvUME83OPQ==} engines: {node: '>=18'} peerDependencies: '@types/node': '>=18' @@ -360,8 +342,8 @@ packages: '@types/node': optional: true - '@inquirer/select@4.1.0': - resolution: {integrity: sha512-z0a2fmgTSRN+YBuiK1ROfJ2Nvrpij5lVN3gPDkQGhavdvIVGHGW29LwYZfM/j42Ai2hUghTI/uoBuTbrJk42bA==} + '@inquirer/select@4.1.1': + resolution: {integrity: sha512-IUXzzTKVdiVNMA+2yUvPxWsSgOG4kfX93jOM4Zb5FgujeInotv5SPIJVeXQ+fO4xu7tW8VowFhdG5JRmmCyQ1Q==} engines: {node: '>=18'} peerDependencies: '@types/node': '>=18' @@ -369,8 +351,8 @@ packages: '@types/node': optional: true - '@inquirer/type@3.0.5': - resolution: {integrity: sha512-ZJpeIYYueOz/i/ONzrfof8g89kNdO2hjGuvULROo3O8rlB2CRtSseE5KeirnyE4t/thAn/EwvS/vuQeJCn+NZg==} + '@inquirer/type@3.0.6': + resolution: {integrity: sha512-/mKVCtVpyBu3IDarv0G+59KC4stsD5mDsGpYh+GKs1NZT88Jh52+cuoA1AtLk2Q0r/quNl+1cSUyLRHBFeD0XA==} engines: {node: '>=18'} peerDependencies: '@types/node': '>=18' @@ -404,14 +386,19 @@ packages: '@jridgewell/trace-mapping@0.3.25': resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==} - '@kevisual/cache@0.0.1': - resolution: {integrity: sha512-yjQJ47NdE3smtJahA3UMcEEBU86uI3V93WnQZHTgFP1S1L8iD0Abct1cFWkuPIlsow8uBxbn4z4iN58KrsQlpA==} + '@kevisual/cache@0.0.2': + resolution: {integrity: sha512-2Cl5KF2Gi27uLfhO6CdTMFnRzx9vYnqevAo7d9ab3rOaqTgF8tLeAXglXyRbaWW3WUbHU2XaOb4r98uUsqIQQw==} '@kevisual/load@0.0.6': resolution: {integrity: sha512-+3YTFehRcZ1haGel5DKYMUwmi5i6f2psyaPZlfkKU/cOXgkpwoG9/BEqPCnPjicKqqnksEpixVRkyHJ+5bjLVA==} - '@kevisual/query@0.0.15': - resolution: {integrity: sha512-DK41qvyOiJMmlj70QyVP/48M0gszA39DdnBLtgU94YwAe6OqKrr9tYXHLjZrOROmUVMezIIBQuWMLedSAvb54A==} + '@kevisual/query-login@0.0.5': + resolution: {integrity: sha512-389cMMWAisjQoafxX+cUEa2z41S5koDjiyHkucfCkhRoP4M6g0iqbBMavLKmLOWSKx3R8e3ZmXT6RfsYGBb8Ww==} + peerDependencies: + '@kevisual/query': ^0.0.17 + + '@kevisual/query@0.0.17': + resolution: {integrity: sha512-WMvWM+3pNlPKNhoxPX9fldMp1tOeJrkRM/tXA4bvOnftIoX2yeI4v0wTpbGJXES/bLlo7OC2kV8SeKF0K6dnxQ==} '@nodelib/fs.scandir@2.1.5': resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} @@ -429,15 +416,6 @@ packages: resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} engines: {node: '>=14'} - '@rollup/plugin-alias@5.1.1': - resolution: {integrity: sha512-PR9zDb+rOzkRb2VD+EuKB7UC41vU5DIwZ5qqCpk0KJudcWAyi8rvYOhS7+L5aZCspw1stTViLgN5v6FF1p5cgQ==} - engines: {node: '>=14.0.0'} - peerDependencies: - rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0 - peerDependenciesMeta: - rollup: - optional: true - '@rollup/plugin-commonjs@28.0.3': resolution: {integrity: sha512-pyltgilam1QPdn+Zd9gaCfOLcnjMEJ9gV+bTw6/r73INdvzf1ah9zLIJBm+kW7R6IUFIQ1YO+VqZtYxZNWFPEQ==} engines: {node: '>=16.0.0 || 14 >= 14.17'} @@ -447,15 +425,6 @@ packages: rollup: optional: true - '@rollup/plugin-json@6.1.0': - resolution: {integrity: sha512-EGI2te5ENk1coGeADSIwZ7G2Q8CJS2sF120T7jLw4xFw9n7wIOXHo+kIYRAoVpJAN+kmqZSoO3Fp4JtoNF4ReA==} - engines: {node: '>=14.0.0'} - peerDependencies: - rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0 - peerDependenciesMeta: - rollup: - optional: true - '@rollup/plugin-node-resolve@16.0.1': resolution: {integrity: sha512-tk5YCxJWIG81umIvNkSod2qK5KyQW19qcBF/B78n1bjtOON6gzKoVeSzAE8yHCZEDmqkHKkxplExA8KzdJLJpA==} engines: {node: '>=14.0.0'} @@ -465,15 +434,6 @@ packages: rollup: optional: true - '@rollup/plugin-replace@6.0.2': - resolution: {integrity: sha512-7QaYCf8bqF04dOy7w/eHmJeNExxTYwvKAmlSAH/EaWWUzbT0h5sbF6bktFoX/0F/0qwng5/dWFMyf3gzaM8DsQ==} - engines: {node: '>=14.0.0'} - peerDependencies: - rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0 - peerDependenciesMeta: - rollup: - optional: true - '@rollup/plugin-typescript@12.1.2': resolution: {integrity: sha512-cdtSp154H5sv637uMr1a8OTWB0L1SWDSm1rDGiyfcGcvQ6cuTs4MDk2BVEBGysUWago4OJN4EQZqOTl/QY3Jgg==} engines: {node: '>=14.0.0'} @@ -596,6 +556,9 @@ packages: cpu: [x64] os: [win32] + '@types/bun@1.2.10': + resolution: {integrity: sha512-eilv6WFM3M0c9ztJt7/g80BDusK98z/FrFwseZgT4bXCq2vPhXD4z8R3oddmAn+R/Nmz9vBn4kweJKmGTZj+lg==} + '@types/crypto-js@4.2.2': resolution: {integrity: sha512-sDOLlVbHhXpAUAL0YHDUUwDZf3iN4Bwi4W6a0W0b+QcAezUbRtH4FVb+9J4h+XFPW7l/gQ9F8qC7P+Ec4k8QVQ==} @@ -617,11 +580,8 @@ packages: '@types/node@18.19.80': resolution: {integrity: sha512-kEWeMwMeIvxYkeg1gTc01awpwLbfMRZXdIhwRcakd/KlK53jmRC26LqcbIt7fnAQTu5GzlnWmzA3H6+l1u6xxQ==} - '@types/node@22.13.11': - resolution: {integrity: sha512-iEUCUJoU0i3VnrCmgoWCXttklWcvoCIx4jzcP22fioIVSdTmjgoEvmAO/QPw6TcS9k5FrNgn4w7q5lGOd1CT5g==} - - '@types/node@22.13.17': - resolution: {integrity: sha512-nAJuQXoyPj04uLgu+obZcSmsfOenUg6DxPKogeUy6yNCFwWaj5sBF8/G/pNo8EtBJjAfSVgfIlugR/BCOleO+g==} + '@types/node@22.14.1': + resolution: {integrity: sha512-u0HuPQwe/dHrItgHHpmw3N2fYCR6x4ivMNbPHRkBVP4CvN+kiRrKHWk3i8tXiO/joPwXLMYvF9TTF0eqgHIuOw==} '@types/resolve@1.20.2': resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==} @@ -673,6 +633,9 @@ packages: buffer-equal-constant-time@1.0.1: resolution: {integrity: sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==} + bun-types@1.2.10: + resolution: {integrity: sha512-b5ITZMnVdf3m1gMvJHG+gIfeJHiQPJak0f7925Hxu6ZN5VKA8AGy4GZ4lM+Xkn6jtWxg5S3ldWvfmXdvnkp3GQ==} + bundle-require@5.1.0: resolution: {integrity: sha512-3WrrOuZiyaaZPWiEt4G3+IffISVC9HYlWueJEBWED4ZH4aIAC2PnkdnuRrR94M+w6yGWn4AglWtJtBI8YqvgoA==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} @@ -756,8 +719,8 @@ packages: resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} engines: {node: '>=0.4.0'} - dotenv@16.4.7: - resolution: {integrity: sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ==} + dotenv@16.5.0: + resolution: {integrity: sha512-m/C+AwOAr9/W1UOIZUo232ejMNnJAJtYQjUbHoNTBNTJSvqzzDh7vnrei3o3r3m9blf6ZoDkvcw0VmozNRFJxg==} engines: {node: '>=12'} dunder-proto@1.0.1: @@ -787,9 +750,6 @@ packages: resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==} engines: {node: '>= 0.4'} - es-module-lexer@1.6.0: - resolution: {integrity: sha512-qqnD1yMU6tk/jnaMosogGySTZP8YtUgAffA9nMN+E/rjxcfRQ6IEk7IiozUjgxKoFHBGjTLnrHB/YC45r/59EQ==} - es-object-atoms@1.1.1: resolution: {integrity: sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==} engines: {node: '>= 0.4'} @@ -879,9 +839,6 @@ packages: resolution: {integrity: sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==} engines: {node: '>= 0.4'} - get-tsconfig@4.10.0: - resolution: {integrity: sha512-kGzZ3LWWQcGIAmg6iWvXn0ei6WDtV26wzHRMwDSzmAbcXrTEXxHy6IehI6/4eT6VRKyMP1eF1VqwrVUmE/LR7A==} - glob-parent@5.1.2: resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} engines: {node: '>= 6'} @@ -924,8 +881,8 @@ packages: resolution: {integrity: sha512-bAH5jbK/F3T3Jls4I0SO1hmPR0dKU0a7+SY6n1yzRtG54FLO8d6w/nxLFX2Nb7dBu6cCWXPaAME6cYqFUMmuCA==} engines: {node: '>= 4'} - inquirer@12.5.0: - resolution: {integrity: sha512-aiBBq5aKF1k87MTxXDylLfwpRwToShiHrSv4EmB07EYyLgmnjEz5B3rn0aGw1X3JA/64Ngf2T54oGwc+BCsPIQ==} + inquirer@12.5.2: + resolution: {integrity: sha512-qoDk/vdSTIaXNXAoNnlg7ubexpJfUo7t8GT2vylxvE49BrLhToFuPPdMViidG2boHV7+AcP1TCkJs/+PPoF2QQ==} engines: {node: '>=18'} peerDependencies: '@types/node': '>=18' @@ -1125,9 +1082,6 @@ packages: resolution: {integrity: sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==} engines: {node: '>=16 || 14 >=14.18'} - pathe@2.0.3: - resolution: {integrity: sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==} - picocolors@1.1.1: resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} @@ -1180,9 +1134,6 @@ packages: resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==} engines: {node: '>=8'} - resolve-pkg-maps@1.0.0: - resolution: {integrity: sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==} - resolve@1.22.8: resolution: {integrity: sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==} hasBin: true @@ -1202,13 +1153,6 @@ packages: rollup: ^3.29.4 || ^4 typescript: ^4.5 || ^5.0 - rollup-plugin-esbuild@6.2.1: - resolution: {integrity: sha512-jTNOMGoMRhs0JuueJrJqbW8tOwxumaWYq+V5i+PD+8ecSCVkuX27tGW7BXqDgoULQ55rO7IdNxPcnsWtshz3AA==} - engines: {node: '>=14.18.0'} - peerDependencies: - esbuild: '>=0.18.0' - rollup: ^1.20.0 || ^2.0.0 || ^3.0.0 || ^4.0.0 - rollup@4.39.0: resolution: {integrity: sha512-thI8kNc02yNvnmJp8dr3fNWJ9tCONDhp6TV35X6HkKGGs9E6q7YWCHbe5vKiTa7TAiNcFEmXKj3X/pG2b3ci0g==} engines: {node: '>=18.0.0', npm: '>=8.0.0'} @@ -1353,12 +1297,8 @@ packages: undici-types@5.26.5: resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} - undici-types@6.20.0: - resolution: {integrity: sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==} - - unplugin-utils@0.2.4: - resolution: {integrity: sha512-8U/MtpkPkkk3Atewj1+RcKIjb5WBimZ/WSLhhR3w6SsIj8XJuKTacSP8g+2JhfSGw0Cb125Y+2zA/IzJZDVbhA==} - engines: {node: '>=18.12.0'} + undici-types@6.21.0: + resolution: {integrity: sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==} web-streams-polyfill@4.0.0-beta.3: resolution: {integrity: sha512-QW95TCTaHmsYfHDybGMwO5IJIM93I/6vTRk+daHTWFPhwh+C8Cg7j7XyKrwrj8Ib6vYXe0ocYNrmzY4xAAN6ug==} @@ -1500,27 +1440,27 @@ snapshots: '@esbuild/win32-x64@0.25.0': optional: true - '@inquirer/checkbox@4.1.4(@types/node@22.13.17)': + '@inquirer/checkbox@4.1.5(@types/node@22.14.1)': dependencies: - '@inquirer/core': 10.1.9(@types/node@22.13.17) + '@inquirer/core': 10.1.10(@types/node@22.14.1) '@inquirer/figures': 1.0.11 - '@inquirer/type': 3.0.5(@types/node@22.13.17) + '@inquirer/type': 3.0.6(@types/node@22.14.1) ansi-escapes: 4.3.2 yoctocolors-cjs: 2.1.2 optionalDependencies: - '@types/node': 22.13.17 + '@types/node': 22.14.1 - '@inquirer/confirm@5.1.8(@types/node@22.13.17)': + '@inquirer/confirm@5.1.9(@types/node@22.14.1)': dependencies: - '@inquirer/core': 10.1.9(@types/node@22.13.17) - '@inquirer/type': 3.0.5(@types/node@22.13.17) + '@inquirer/core': 10.1.10(@types/node@22.14.1) + '@inquirer/type': 3.0.6(@types/node@22.14.1) optionalDependencies: - '@types/node': 22.13.17 + '@types/node': 22.14.1 - '@inquirer/core@10.1.9(@types/node@22.13.17)': + '@inquirer/core@10.1.10(@types/node@22.14.1)': dependencies: '@inquirer/figures': 1.0.11 - '@inquirer/type': 3.0.5(@types/node@22.13.17) + '@inquirer/type': 3.0.6(@types/node@22.14.1) ansi-escapes: 4.3.2 cli-width: 4.1.0 mute-stream: 2.0.0 @@ -1528,93 +1468,93 @@ snapshots: wrap-ansi: 6.2.0 yoctocolors-cjs: 2.1.2 optionalDependencies: - '@types/node': 22.13.17 + '@types/node': 22.14.1 - '@inquirer/editor@4.2.9(@types/node@22.13.17)': + '@inquirer/editor@4.2.10(@types/node@22.14.1)': dependencies: - '@inquirer/core': 10.1.9(@types/node@22.13.17) - '@inquirer/type': 3.0.5(@types/node@22.13.17) + '@inquirer/core': 10.1.10(@types/node@22.14.1) + '@inquirer/type': 3.0.6(@types/node@22.14.1) external-editor: 3.1.0 optionalDependencies: - '@types/node': 22.13.17 + '@types/node': 22.14.1 - '@inquirer/expand@4.0.11(@types/node@22.13.17)': + '@inquirer/expand@4.0.12(@types/node@22.14.1)': dependencies: - '@inquirer/core': 10.1.9(@types/node@22.13.17) - '@inquirer/type': 3.0.5(@types/node@22.13.17) + '@inquirer/core': 10.1.10(@types/node@22.14.1) + '@inquirer/type': 3.0.6(@types/node@22.14.1) yoctocolors-cjs: 2.1.2 optionalDependencies: - '@types/node': 22.13.17 + '@types/node': 22.14.1 '@inquirer/figures@1.0.11': {} - '@inquirer/input@4.1.8(@types/node@22.13.17)': + '@inquirer/input@4.1.9(@types/node@22.14.1)': dependencies: - '@inquirer/core': 10.1.9(@types/node@22.13.17) - '@inquirer/type': 3.0.5(@types/node@22.13.17) + '@inquirer/core': 10.1.10(@types/node@22.14.1) + '@inquirer/type': 3.0.6(@types/node@22.14.1) optionalDependencies: - '@types/node': 22.13.17 + '@types/node': 22.14.1 - '@inquirer/number@3.0.11(@types/node@22.13.17)': + '@inquirer/number@3.0.12(@types/node@22.14.1)': dependencies: - '@inquirer/core': 10.1.9(@types/node@22.13.17) - '@inquirer/type': 3.0.5(@types/node@22.13.17) + '@inquirer/core': 10.1.10(@types/node@22.14.1) + '@inquirer/type': 3.0.6(@types/node@22.14.1) optionalDependencies: - '@types/node': 22.13.17 + '@types/node': 22.14.1 - '@inquirer/password@4.0.11(@types/node@22.13.17)': + '@inquirer/password@4.0.12(@types/node@22.14.1)': dependencies: - '@inquirer/core': 10.1.9(@types/node@22.13.17) - '@inquirer/type': 3.0.5(@types/node@22.13.17) + '@inquirer/core': 10.1.10(@types/node@22.14.1) + '@inquirer/type': 3.0.6(@types/node@22.14.1) ansi-escapes: 4.3.2 optionalDependencies: - '@types/node': 22.13.17 + '@types/node': 22.14.1 - '@inquirer/prompts@7.4.0(@types/node@22.13.17)': + '@inquirer/prompts@7.4.1(@types/node@22.14.1)': dependencies: - '@inquirer/checkbox': 4.1.4(@types/node@22.13.17) - '@inquirer/confirm': 5.1.8(@types/node@22.13.17) - '@inquirer/editor': 4.2.9(@types/node@22.13.17) - '@inquirer/expand': 4.0.11(@types/node@22.13.17) - '@inquirer/input': 4.1.8(@types/node@22.13.17) - '@inquirer/number': 3.0.11(@types/node@22.13.17) - '@inquirer/password': 4.0.11(@types/node@22.13.17) - '@inquirer/rawlist': 4.0.11(@types/node@22.13.17) - '@inquirer/search': 3.0.11(@types/node@22.13.17) - '@inquirer/select': 4.1.0(@types/node@22.13.17) + '@inquirer/checkbox': 4.1.5(@types/node@22.14.1) + '@inquirer/confirm': 5.1.9(@types/node@22.14.1) + '@inquirer/editor': 4.2.10(@types/node@22.14.1) + '@inquirer/expand': 4.0.12(@types/node@22.14.1) + '@inquirer/input': 4.1.9(@types/node@22.14.1) + '@inquirer/number': 3.0.12(@types/node@22.14.1) + '@inquirer/password': 4.0.12(@types/node@22.14.1) + '@inquirer/rawlist': 4.0.12(@types/node@22.14.1) + '@inquirer/search': 3.0.12(@types/node@22.14.1) + '@inquirer/select': 4.1.1(@types/node@22.14.1) optionalDependencies: - '@types/node': 22.13.17 + '@types/node': 22.14.1 - '@inquirer/rawlist@4.0.11(@types/node@22.13.17)': + '@inquirer/rawlist@4.0.12(@types/node@22.14.1)': dependencies: - '@inquirer/core': 10.1.9(@types/node@22.13.17) - '@inquirer/type': 3.0.5(@types/node@22.13.17) + '@inquirer/core': 10.1.10(@types/node@22.14.1) + '@inquirer/type': 3.0.6(@types/node@22.14.1) yoctocolors-cjs: 2.1.2 optionalDependencies: - '@types/node': 22.13.17 + '@types/node': 22.14.1 - '@inquirer/search@3.0.11(@types/node@22.13.17)': + '@inquirer/search@3.0.12(@types/node@22.14.1)': dependencies: - '@inquirer/core': 10.1.9(@types/node@22.13.17) + '@inquirer/core': 10.1.10(@types/node@22.14.1) '@inquirer/figures': 1.0.11 - '@inquirer/type': 3.0.5(@types/node@22.13.17) + '@inquirer/type': 3.0.6(@types/node@22.14.1) yoctocolors-cjs: 2.1.2 optionalDependencies: - '@types/node': 22.13.17 + '@types/node': 22.14.1 - '@inquirer/select@4.1.0(@types/node@22.13.17)': + '@inquirer/select@4.1.1(@types/node@22.14.1)': dependencies: - '@inquirer/core': 10.1.9(@types/node@22.13.17) + '@inquirer/core': 10.1.10(@types/node@22.14.1) '@inquirer/figures': 1.0.11 - '@inquirer/type': 3.0.5(@types/node@22.13.17) + '@inquirer/type': 3.0.6(@types/node@22.14.1) ansi-escapes: 4.3.2 yoctocolors-cjs: 2.1.2 optionalDependencies: - '@types/node': 22.13.17 + '@types/node': 22.14.1 - '@inquirer/type@3.0.5(@types/node@22.13.17)': + '@inquirer/type@3.0.6(@types/node@22.14.1)': optionalDependencies: - '@types/node': 22.13.17 + '@types/node': 22.14.1 '@isaacs/cliui@8.0.2': dependencies: @@ -1646,7 +1586,7 @@ snapshots: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.5.0 - '@kevisual/cache@0.0.1(rollup@4.39.0)(tslib@2.8.1)(typescript@5.8.2)': + '@kevisual/cache@0.0.2(rollup@4.39.0)(tslib@2.8.1)(typescript@5.8.2)': dependencies: '@rollup/plugin-commonjs': 28.0.3(rollup@4.39.0) '@rollup/plugin-node-resolve': 16.0.1(rollup@4.39.0) @@ -1662,7 +1602,17 @@ snapshots: dependencies: eventemitter3: 5.0.1 - '@kevisual/query@0.0.15(encoding@0.1.13)(ws@8.18.0)': + '@kevisual/query-login@0.0.5(@kevisual/query@0.0.17(encoding@0.1.13)(ws@8.18.0))': + dependencies: + '@kevisual/cache': 0.0.2(rollup@4.39.0)(tslib@2.8.1)(typescript@5.8.2) + '@kevisual/query': 0.0.17(encoding@0.1.13)(ws@8.18.0) + dotenv: 16.5.0 + transitivePeerDependencies: + - rollup + - tslib + - typescript + + '@kevisual/query@0.0.17(encoding@0.1.13)(ws@8.18.0)': dependencies: openai: 4.88.0(encoding@0.1.13)(ws@8.18.0) transitivePeerDependencies: @@ -1685,10 +1635,6 @@ snapshots: '@pkgjs/parseargs@0.11.0': optional: true - '@rollup/plugin-alias@5.1.1(rollup@4.39.0)': - optionalDependencies: - rollup: 4.39.0 - '@rollup/plugin-commonjs@28.0.3(rollup@4.39.0)': dependencies: '@rollup/pluginutils': 5.1.2(rollup@4.39.0) @@ -1701,12 +1647,6 @@ snapshots: optionalDependencies: rollup: 4.39.0 - '@rollup/plugin-json@6.1.0(rollup@4.39.0)': - dependencies: - '@rollup/pluginutils': 5.1.2(rollup@4.39.0) - optionalDependencies: - rollup: 4.39.0 - '@rollup/plugin-node-resolve@16.0.1(rollup@4.39.0)': dependencies: '@rollup/pluginutils': 5.1.2(rollup@4.39.0) @@ -1717,13 +1657,6 @@ snapshots: optionalDependencies: rollup: 4.39.0 - '@rollup/plugin-replace@6.0.2(rollup@4.39.0)': - dependencies: - '@rollup/pluginutils': 5.1.2(rollup@4.39.0) - magic-string: 0.30.11 - optionalDependencies: - rollup: 4.39.0 - '@rollup/plugin-typescript@12.1.2(rollup@4.39.0)(tslib@2.8.1)(typescript@5.8.2)': dependencies: '@rollup/pluginutils': 5.1.2(rollup@4.39.0) @@ -1801,6 +1734,10 @@ snapshots: '@rollup/rollup-win32-x64-msvc@4.39.0': optional: true + '@types/bun@1.2.10': + dependencies: + bun-types: 1.2.10 + '@types/crypto-js@4.2.2': {} '@types/estree@1.0.6': {} @@ -1810,26 +1747,22 @@ snapshots: '@types/jsonwebtoken@9.0.9': dependencies: '@types/ms': 0.7.34 - '@types/node': 22.13.17 + '@types/node': 22.14.1 '@types/ms@0.7.34': {} '@types/node-fetch@2.6.12': dependencies: - '@types/node': 22.13.17 + '@types/node': 22.14.1 form-data: 4.0.2 '@types/node@18.19.80': dependencies: undici-types: 5.26.5 - '@types/node@22.13.11': + '@types/node@22.14.1': dependencies: - undici-types: 6.20.0 - - '@types/node@22.13.17': - dependencies: - undici-types: 6.20.0 + undici-types: 6.21.0 '@types/resolve@1.20.2': {} @@ -1871,6 +1804,10 @@ snapshots: buffer-equal-constant-time@1.0.1: {} + bun-types@1.2.10: + dependencies: + '@types/node': 22.14.1 + bundle-require@5.1.0(esbuild@0.25.0): dependencies: esbuild: 0.25.0 @@ -1929,7 +1866,7 @@ snapshots: delayed-stream@1.0.0: {} - dotenv@16.4.7: {} + dotenv@16.5.0: {} dunder-proto@1.0.1: dependencies: @@ -1956,8 +1893,6 @@ snapshots: es-errors@1.3.0: {} - es-module-lexer@1.6.0: {} - es-object-atoms@1.1.1: dependencies: es-errors: 1.3.0 @@ -2077,10 +2012,6 @@ snapshots: dunder-proto: 1.0.1 es-object-atoms: 1.1.1 - get-tsconfig@4.10.0: - dependencies: - resolve-pkg-maps: 1.0.0 - glob-parent@5.1.2: dependencies: is-glob: 4.0.3 @@ -2123,17 +2054,17 @@ snapshots: ignore@7.0.3: {} - inquirer@12.5.0(@types/node@22.13.17): + inquirer@12.5.2(@types/node@22.14.1): dependencies: - '@inquirer/core': 10.1.9(@types/node@22.13.17) - '@inquirer/prompts': 7.4.0(@types/node@22.13.17) - '@inquirer/type': 3.0.5(@types/node@22.13.17) + '@inquirer/core': 10.1.10(@types/node@22.14.1) + '@inquirer/prompts': 7.4.1(@types/node@22.14.1) + '@inquirer/type': 3.0.6(@types/node@22.14.1) ansi-escapes: 4.3.2 mute-stream: 2.0.0 run-async: 3.0.0 rxjs: 7.8.2 optionalDependencies: - '@types/node': 22.13.17 + '@types/node': 22.14.1 is-core-module@2.15.1: dependencies: @@ -2302,8 +2233,6 @@ snapshots: lru-cache: 10.4.3 minipass: 7.1.2 - pathe@2.0.3: {} - picocolors@1.1.1: {} picomatch@2.3.1: {} @@ -2333,8 +2262,6 @@ snapshots: resolve-from@5.0.0: {} - resolve-pkg-maps@1.0.0: {} - resolve@1.22.8: dependencies: is-core-module: 2.15.1 @@ -2355,17 +2282,6 @@ snapshots: optionalDependencies: '@babel/code-frame': 7.26.2 - rollup-plugin-esbuild@6.2.1(esbuild@0.25.0)(rollup@4.39.0): - dependencies: - debug: 4.4.0 - es-module-lexer: 1.6.0 - esbuild: 0.25.0 - get-tsconfig: 4.10.0 - rollup: 4.39.0 - unplugin-utils: 0.2.4 - transitivePeerDependencies: - - supports-color - rollup@4.39.0: dependencies: '@types/estree': 1.0.7 @@ -2532,12 +2448,7 @@ snapshots: undici-types@5.26.5: {} - undici-types@6.20.0: {} - - unplugin-utils@0.2.4: - dependencies: - pathe: 2.0.3 - picomatch: 4.0.2 + undici-types@6.21.0: {} web-streams-polyfill@4.0.0-beta.3: {} diff --git a/rollup.config.js b/rollup.config.js deleted file mode 100644 index be2aa4a..0000000 --- a/rollup.config.js +++ /dev/null @@ -1,70 +0,0 @@ -// rollup.config.js -import resolve from '@rollup/plugin-node-resolve'; -import commonjs from '@rollup/plugin-commonjs'; -import json from '@rollup/plugin-json'; -import path from 'path'; -import fs from 'fs'; - -import esbuild from 'rollup-plugin-esbuild'; -import alias from '@rollup/plugin-alias'; -import replace from '@rollup/plugin-replace'; - -const pkg = JSON.parse(fs.readFileSync('./package.json', 'utf-8')); -/** - * @type {import('rollup').RollupOptions} - */ -const config = { - input: 'src/index.ts', // TypeScript 入口文件 - output: { - dir: 'dist', - entryFileNames: 'app.mjs', - chunkFileNames: '[name]-[hash].mjs', - format: 'esm', // 输出格式设置为 ES 模块 - }, - plugins: [ - replace({ - preventAssignment: true, // 防止意外赋值 - VERSION: JSON.stringify(pkg.version || '1.0.0'), - }), - 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, // 强制优先使用内置模块 - }), // 使用 @rollup/plugin-node-resolve 解析 node_modules 中的模块 - commonjs({ - // dynamicRequireTargets: ['node_modules/sqlite3/lib/*.js'], - }), - esbuild({ - target: 'node22', // 目标为 Node.js 14 - minify: false, // 启用代码压缩 - tsconfig: 'tsconfig.json', - }), - json(), - ], -}; - -export default [config]; diff --git a/src/command/app/front-app/index.ts b/src/command/app/front-app/index.ts index 11d9ac3..337506a 100644 --- a/src/command/app/front-app/index.ts +++ b/src/command/app/front-app/index.ts @@ -8,6 +8,7 @@ import { queryApp } from '../../../query/app-manager/query-app.ts'; import { checkAppDir, installApp, uninstallApp } from '@/module/download/install.ts'; import { fileIsExist } from '@/uitls/file.ts'; import fs from 'fs'; +import { getConfig } from '@/module/get-config.ts'; export const appCommand = new Command('app').description('app 命令').action(() => { console.log('app'); }); @@ -27,7 +28,7 @@ program.addCommand(appCommand); const downloadAppCommand = new Command('download') .description('下载 app serve client的包. \napp download -i root/code-center') .option('-i, --id ', '下载 app serve client的包, id 或者user/key') - .option('-o, --output ', '下载 app serve client的包, 输出路径') + .option('-o, --output ', '下载 app serve client的包, 输出路径, 默认是当前目录') .option('-t, --type ', '下载 app serve client的包, 类型, app,或者web, 默认为web') .option('-r, --registry ', '下载 app serve client的包, 使用私有源') .action(async (options) => { @@ -58,6 +59,9 @@ const downloadAppCommand = new Command('download') let registry = 'https://kevisual.cn'; if (options?.registry) { registry = new URL(options.registry).origin; + } else { + const config = getConfig(); + registry = new URL(config.baseURL).origin; } if (res.code === 200) { const app = res.data; diff --git a/src/command/login.ts b/src/command/login.ts index 79759be..5dd5eea 100644 --- a/src/command/login.ts +++ b/src/command/login.ts @@ -106,8 +106,21 @@ const command = new Command('me') .action(async (options) => { try { let res = await showMe(false); + let isRefresh = false; if (res.code === 200 && res.data?.accessToken) { res = await showMe(false); + isRefresh = true; + } + if (res.code === 200) { + if (isRefresh) { + console.log(chalk.green('refresh token success'), '\n'); + } + } else { + console.log( + isRefresh ? chalk.red('refresh token failed, please login again.') : chalk.red('you need login first. \n run `envision login` to login'), + '\n', + ); + return; } const baseURL = getConfig().baseURL; const pickData = pick(res?.data, ['username', 'type', 'orgs']); diff --git a/src/command/ls-token.ts b/src/command/ls-token.ts index 4b799d0..bc8525a 100644 --- a/src/command/ls-token.ts +++ b/src/command/ls-token.ts @@ -3,14 +3,27 @@ import { getConfig, writeConfig } from '@/module/index.ts'; import { queryLogin, storage } from '@/module/query.ts'; import inquirer from 'inquirer'; import util from 'util'; - +function isNumeric(str: string) { + return /^-?\d+\.?\d*$/.test(str); +} +const showList = (list: string[]) => { + if (list.length === 0) { + console.log('expand baseURLList is empty'); + return; + } + const config = getConfig(); + console.log('----current baseURL:' + config.baseURL + '----\n'); + list.forEach((item, index) => { + console.log(`${index + 1}: ${item}`); + }); +}; const token = new Command('token') .option('-e, --env', 'show token in env') .description('show token') .action(async (opts) => { const token = storage.getItem('token'); if (opts.env) { - console.log('token', process.env.KEVISUAL_TOKEN); + console.log('token in env', process.env.KEVISUAL_TOKEN); } else { console.log('token', token); } @@ -30,7 +43,6 @@ app.addCommand(token); const baseURL = new Command('baseURL') .alias('base') - .alias('registry') .description('show baseURL') .option('-a, --add ', 'add baseURL') .option('-r, --remove ', 'remove baseURL number') @@ -49,20 +61,7 @@ const baseURL = new Command('baseURL') const newList = new Set(list); return Array.from(newList); }; - const showList = (list: string[]) => { - if (list.length === 0) { - console.log('expand baseURLList is empty'); - return; - } - const config = getConfig(); - console.log('----current baseURL:' + config.baseURL + '----\n'); - list.forEach((item, index) => { - console.log(`${index + 1}: ${item}`); - }); - }; - function isNumeric(str: string) { - return /^-?\d+\.?\d*$/.test(str); - } + if (opts.add || opts.set) { let change = false; if (opts.add) { @@ -132,12 +131,10 @@ app.addCommand(baseURL); const setBaseURL = new Command('set') .option('-b, --baseURL ', 'set baseURL') - // .argument('', 'set baseURL', '') .description('set baseURL') .action(async (opt) => { const config = getConfig(); let baseURL = opt.baseURL; - // let baseURL = opt; if (!baseURL) { const answers = await inquirer.prompt([ { @@ -147,6 +144,10 @@ const setBaseURL = new Command('set') }, ]); baseURL = answers.baseURL; + if (!baseURL) { + console.log('baseURL is required'); + return; + } } writeConfig({ ...config, baseURL }); }); @@ -158,3 +159,44 @@ baseURL.addCommand(setBaseURL); // }); // app.addCommand(showQueryURL); + +const rvm = new Command('registry') + .alias('reg') + .description('registry manager') + .option('-l, --list', 'list registry') + .option('-s, --set ', 'set registry') + .action(async (opts) => { + const config = getConfig(); + const defaultRegistry = ['https://kevisual.cn', 'https://kevisual.silkyai.cn', 'https://kevisual.xiongxiao.me']; + if (opts.list) { + showList(defaultRegistry); + return; + } + if (opts.set) { + const isNumber = isNumeric(opts.set); + if (isNumber) { + const index = Number(opts.set) - 1; + if (index < 0 || index >= defaultRegistry.length) { + console.log('index out of range'); + return; + } + writeConfig({ ...config, baseURL: defaultRegistry[index] }); + console.log('set registry', defaultRegistry[index]); + } else { + writeConfig({ ...config, baseURL: opts.set }); + console.log('set registry', opts.set); + } + } + }); + +app.addCommand(rvm); + +const silky = new Command('silky').description('silky registry').action(async (opts) => { + console.log('silky registry'); + const config = getConfig(); + const defaultRegistry = ['https://kevisual.silkyai.cn']; + writeConfig({ ...config, baseURL: defaultRegistry[0] }); + showList(defaultRegistry); +}); + +app.addCommand(silky); diff --git a/src/module/download/install.ts b/src/module/download/install.ts index ed2485f..4609628 100644 --- a/src/module/download/install.ts +++ b/src/module/download/install.ts @@ -1,6 +1,7 @@ import path from 'path'; import fs from 'fs'; import { storage } from '../query.ts'; +import { chalk } from '../chalk.ts'; type DownloadTask = { downloadPath: string; @@ -69,8 +70,17 @@ export const installApp = async (app: Package, opts: InstallAppOpts = {}) => { if (token) { fetchURL.searchParams.set('token', token); } + fetchURL.searchParams.set('download', 'true'); const res = await fetch(fetchURL.toString()); const blob = await res.blob(); + const type = blob.type; + if (type.includes('text/html')) { + const html = await blob.text(); + if (html === 'fetchRes is error') { + console.log(chalk.red('fetchRes is error')); + break; + } + } fs.writeFileSync(downloadPath, Buffer.from(await blob.arrayBuffer())); } let indexHtml = files.find((file: any) => file.name === 'index.html'); diff --git a/src/program.ts b/src/program.ts index 21beb39..2a5c57c 100644 --- a/src/program.ts +++ b/src/program.ts @@ -4,7 +4,7 @@ import fs from 'fs'; let version = '0.0.1'; try { // @ts-ignore - if (VERSION) version = VERSION; + if (ENVISION_VERSION) version = ENVISION_VERSION; } catch (e) {} // @ts-ignore program.name('app').description('A CLI tool with envison').version(version); diff --git a/submodules/kevisual-query-login b/submodules/kevisual-query-login index f8af245..557cd99 160000 --- a/submodules/kevisual-query-login +++ b/submodules/kevisual-query-login @@ -1 +1 @@ -Subproject commit f8af24506bdfdbd895be293c8fd8ce061c94e7af +Subproject commit 557cd99b20ae6c051d5b448e32c6fc6075e4b04e diff --git a/tsconfig.json b/tsconfig.json index bea82a0..93c39bf 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -23,12 +23,13 @@ "@/*": [ "src/*" ], - } + }, + "resolveJsonModule": true }, "include": [ "typings.d.ts", "src/**/*.ts", - "test/**/*.ts" + "./bun.config.mjs" ], "exclude": [ "node_modules",