bump: 和更新配置

This commit is contained in:
xion 2024-11-29 01:45:54 +08:00
parent 73118f8454
commit 5c91ac8b8d
10 changed files with 37 additions and 27 deletions

View File

@ -1,9 +1,20 @@
{ {
"name": "var-proxy", "name": "page-proxy",
"version": "0.0.1", "version": "0.0.1",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"type": "module", "type": "module",
"app": {
"key": "page-proxy",
"entry": "dist/app.mjs",
"type": "micro-app",
"files": [
"dist"
]
},
"files": [
"dist"
],
"scripts": { "scripts": {
"dev": "cross-env NODE_ENV=development nodemon --ignore upload --exec tsx src/index.ts", "dev": "cross-env NODE_ENV=development nodemon --ignore upload --exec tsx src/index.ts",
"build": "rimraf dist && rollup -c", "build": "rimraf dist && rollup -c",
@ -15,25 +26,24 @@
"author": "", "author": "",
"license": "ISC", "license": "ISC",
"devDependencies": { "devDependencies": {
"@rollup/plugin-commonjs": "^28.0.0", "@rollup/plugin-commonjs": "^28.0.1",
"@rollup/plugin-json": "^6.1.0", "@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.3.0", "@rollup/plugin-node-resolve": "^15.3.0",
"@rollup/plugin-typescript": "^12.1.0", "@rollup/plugin-typescript": "^12.1.1",
"@types/http-proxy": "^1.17.15", "@types/http-proxy": "^1.17.15",
"@types/node": "^22.7.5", "@types/node": "^22.10.1",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"nodemon": "^3.1.7", "nodemon": "^3.1.7",
"rollup": "^4.24.0", "rollup": "^4.27.4",
"ts-lib": "^0.0.5", "tslib": "^2.8.1",
"tslib": "^2.7.0", "typescript": "^5.7.2"
"typescript": "^5.6.3"
}, },
"dependencies": { "dependencies": {
"@abearxiong/router": "0.0.1-alpha.43", "@kevisual/router": "0.0.6-alpha-2",
"@abearxiong/use-config": "^0.0.2", "@kevisual/use-config": "^1.0.3",
"@abearxiong/use-file-store": "^0.0.1", "@abearxiong/use-file-store": "^0.0.1",
"ioredis": "^5.4.1", "ioredis": "^5.4.1",
"nanoid": "^5.0.7" "nanoid": "^5.0.9"
}, },
"resolutions": { "resolutions": {
"picomatch": "^4.0.2" "picomatch": "^4.0.2"

8
pnpm-lock.yaml generated
View File

@ -14,7 +14,7 @@ importers:
'@abearxiong/router': '@abearxiong/router':
specifier: 0.0.1-alpha.43 specifier: 0.0.1-alpha.43
version: 0.0.1-alpha.43 version: 0.0.1-alpha.43
'@abearxiong/use-config': '@kevisual/use-config':
specifier: ^0.0.2 specifier: ^0.0.2
version: 0.0.2 version: 0.0.2
'@abearxiong/use-file-store': '@abearxiong/use-file-store':
@ -66,8 +66,8 @@ packages:
'@abearxiong/router@0.0.1-alpha.43': '@abearxiong/router@0.0.1-alpha.43':
resolution: {integrity: sha512-umwi4T5s54Zb8ItseGw3uB7PDG8BqnHyAughlXH2dhub4f49fO+rwR+Zth7scUONkmc21Z27/lPgLBHXrYOkYw==, tarball: https://npm.pkg.github.com/download/@abearxiong/router/0.0.1-alpha.43/287c6e2597b36c5e3ed351b473e38f468b5f49ea} resolution: {integrity: sha512-umwi4T5s54Zb8ItseGw3uB7PDG8BqnHyAughlXH2dhub4f49fO+rwR+Zth7scUONkmc21Z27/lPgLBHXrYOkYw==, tarball: https://npm.pkg.github.com/download/@abearxiong/router/0.0.1-alpha.43/287c6e2597b36c5e3ed351b473e38f468b5f49ea}
'@abearxiong/use-config@0.0.2': '@kevisual/use-config@0.0.2':
resolution: {integrity: sha512-IBOmeP46ykbDlkplFS65UsAHjyPDKnvS2oqbkpLWhbSwDbF5zhBnD4ibsFZKPCyc3lMlPeRqYva4x6puX3E/qQ==, tarball: https://npm.pkg.github.com/download/@abearxiong/use-config/0.0.2/59fbeec8c8e086ec48e55024fe39020b079e6fa5} resolution: {integrity: sha512-IBOmeP46ykbDlkplFS65UsAHjyPDKnvS2oqbkpLWhbSwDbF5zhBnD4ibsFZKPCyc3lMlPeRqYva4x6puX3E/qQ==, tarball: https://npm.pkg.github.com/download/@kevisual/use-config/0.0.2/59fbeec8c8e086ec48e55024fe39020b079e6fa5}
'@abearxiong/use-file-store@0.0.1': '@abearxiong/use-file-store@0.0.1':
resolution: {integrity: sha512-65ZQBHxwr76sAFG+Xd4IQstx8dERhkaX5MLqtqJ0f9m+2NnS/klNe0t4q9tgjMWAEWQxHjnPShpHWzkCENaDnQ==, tarball: https://npm.pkg.github.com/download/@abearxiong/use-file-store/0.0.1/f171e398c078d4940c1ddedf5ad529d17b0eec32} resolution: {integrity: sha512-65ZQBHxwr76sAFG+Xd4IQstx8dERhkaX5MLqtqJ0f9m+2NnS/klNe0t4q9tgjMWAEWQxHjnPShpHWzkCENaDnQ==, tarball: https://npm.pkg.github.com/download/@abearxiong/use-file-store/0.0.1/f171e398c078d4940c1ddedf5ad529d17b0eec32}
@ -830,7 +830,7 @@ snapshots:
- bufferutil - bufferutil
- utf-8-validate - utf-8-validate
'@abearxiong/use-config@0.0.2': {} '@kevisual/use-config@0.0.2': {}
'@abearxiong/use-file-store@0.0.1(typescript@5.6.3)': '@abearxiong/use-file-store@0.0.1(typescript@5.6.3)':
dependencies: dependencies:

View File

@ -11,7 +11,7 @@ import json from '@rollup/plugin-json';
export default { export default {
input: 'src/index.ts', // TypeScript 入口文件 input: 'src/index.ts', // TypeScript 入口文件
output: { output: {
file: 'dist/app.js', // 输出文件 file: 'dist/app.mjs', // 输出文件
format: 'es', // 输出格式设置为 ES 模块 format: 'es', // 输出格式设置为 ES 模块
}, },
plugins: [ plugins: [
@ -26,4 +26,5 @@ export default {
}), // 使用 @rollup/plugin-typescript 处理 TypeScript 文件 }), // 使用 @rollup/plugin-typescript 处理 TypeScript 文件
], ],
// external: ['ws'], // external: ['ws'],
external: ['ioredis', '@kevisual/router', '@kevisual/use-config'],
}; };

View File

@ -1,4 +1,4 @@
import { App } from '@abearxiong/router'; import { App } from '@kevisual/router';
export const app = new App({ export const app = new App({
serverOptions: { serverOptions: {

View File

@ -1,5 +1,5 @@
import { handleRequest } from './module/index.ts'; import { handleRequest } from './module/index.ts';
import { useConfig } from '@abearxiong/use-config'; import { useConfig } from '@kevisual/use-config';
import { app } from './app.ts'; import { app } from './app.ts';
import './route/route.ts' import './route/route.ts'
const { port } = useConfig<{ port: number }>(); const { port } = useConfig<{ port: number }>();

View File

@ -1,7 +1,7 @@
import path from 'path'; import path from 'path';
import { redis, subscriber } from './redis/redis.ts'; import { redis, subscriber } from './redis/redis.ts';
import { useFileStore } from '@abearxiong/use-file-store'; import { useFileStore } from '@abearxiong/use-file-store';
import { useConfig } from '@abearxiong/use-config'; import { useConfig } from '@kevisual/use-config';
import fs from 'fs'; import fs from 'fs';
import crypto from 'crypto'; import crypto from 'crypto';
import { nanoid } from 'nanoid'; import { nanoid } from 'nanoid';

View File

@ -4,7 +4,7 @@ import { UserApp } from './get-user-app.ts';
import { useFileStore } from '@abearxiong/use-file-store'; import { useFileStore } from '@abearxiong/use-file-store';
import path from 'path'; import path from 'path';
import fs from 'fs'; import fs from 'fs';
import { useConfig } from '@abearxiong/use-config'; import { useConfig } from '@kevisual/use-config';
import { redis } from './redis/redis.ts'; import { redis } from './redis/redis.ts';
import { getContentType } from './get-content-type.ts'; import { getContentType } from './get-content-type.ts';
import { sleep } from '@/utils/sleep.ts'; import { sleep } from '@/utils/sleep.ts';

View File

@ -1,4 +1,4 @@
import { useConfig } from '@abearxiong/use-config'; import { useConfig } from '@kevisual/use-config';
const { resources, api } = useConfig<{ const { resources, api } = useConfig<{
resources: string; resources: string;

View File

@ -1,5 +1,5 @@
import { Redis } from 'ioredis'; import { Redis } from 'ioredis';
import { useConfig } from '@abearxiong/use-config'; import { useConfig } from '@kevisual/use-config';
const config = useConfig<{ const config = useConfig<{
redis: ConstructorParameters<typeof Redis>; redis: ConstructorParameters<typeof Redis>;

View File

@ -1,7 +1,6 @@
import { UserApp } from '@/module/get-user-app.ts'; import { UserApp } from '@/module/get-user-app.ts';
import { app } from '../../app.ts'; import { app } from '../../app.ts';
import { redis } from '@/module/redis/redis.ts'; import { redis } from '@/module/redis/redis.ts';
import { CustomError } from '@abearxiong/router';
import fs from 'fs'; import fs from 'fs';
import { useFileStore } from '@abearxiong/use-file-store'; import { useFileStore } from '@abearxiong/use-file-store';
const fileStore = useFileStore('upload'); const fileStore = useFileStore('upload');
@ -34,7 +33,7 @@ app
await userApp.clearCacheData(); await userApp.clearCacheData();
} catch (error) { } catch (error) {
console.error(error); console.error(error);
throw new CustomError('删除失败'); ctx.throw('删除失败');
} }
ctx.body = 'successfully'; ctx.body = 'successfully';
}) })
@ -83,16 +82,16 @@ app
const { user, app } = ctx.query.data || {}; const { user, app } = ctx.query.data || {};
if (!user || !app) { if (!user || !app) {
if (!user) { if (!user) {
throw new CustomError('user is required'); ctx.throw('user is required');
} }
if (!app) { if (!app) {
throw new CustomError('app is required'); ctx.throw('app is required');
} }
} }
const userApp = new UserApp({ user, app }); const userApp = new UserApp({ user, app });
const cache = await userApp.getCache(); const cache = await userApp.getCache();
if (!cache) { if (!cache) {
throw new CustomError('Not Found App'); ctx.throw('Not Found App');
} }
ctx.body = cache; ctx.body = cache;
}) })