@kevisual/router 0.2.7 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.js +26 -7
- package/dist/opencode.js +25 -6
- package/dist/router-browser.js +28 -7
- package/dist/router.js +25 -6
- package/package.json +3 -3
- package/src/commander.ts +0 -1
package/dist/app.js
CHANGED
|
@@ -17248,7 +17248,7 @@ config(en_default());
|
|
|
17248
17248
|
// ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/index.js
|
|
17249
17249
|
var zod_default = exports_external;
|
|
17250
17250
|
|
|
17251
|
-
// ../../node_modules/.pnpm/nanoid@5.1.
|
|
17251
|
+
// ../../node_modules/.pnpm/nanoid@5.1.9/node_modules/nanoid/index.js
|
|
17252
17252
|
import { webcrypto as crypto } from "node:crypto";
|
|
17253
17253
|
var POOL_SIZE_MULTIPLIER = 128;
|
|
17254
17254
|
var pool;
|
|
@@ -17269,8 +17269,25 @@ function random2(bytes) {
|
|
|
17269
17269
|
return pool.subarray(poolOffset - bytes, poolOffset);
|
|
17270
17270
|
}
|
|
17271
17271
|
function customRandom(alphabet, defaultSize, getRandom) {
|
|
17272
|
-
let
|
|
17273
|
-
|
|
17272
|
+
let safeByteCutoff = 256 - 256 % alphabet.length;
|
|
17273
|
+
if (safeByteCutoff === 256) {
|
|
17274
|
+
let mask = alphabet.length - 1;
|
|
17275
|
+
return (size = defaultSize) => {
|
|
17276
|
+
if (!size)
|
|
17277
|
+
return "";
|
|
17278
|
+
let id = "";
|
|
17279
|
+
while (true) {
|
|
17280
|
+
let bytes = getRandom(size);
|
|
17281
|
+
let i = size;
|
|
17282
|
+
while (i--) {
|
|
17283
|
+
id += alphabet[bytes[i] & mask];
|
|
17284
|
+
if (id.length >= size)
|
|
17285
|
+
return id;
|
|
17286
|
+
}
|
|
17287
|
+
}
|
|
17288
|
+
};
|
|
17289
|
+
}
|
|
17290
|
+
let step = Math.ceil(1.6 * 256 * defaultSize / safeByteCutoff);
|
|
17274
17291
|
return (size = defaultSize) => {
|
|
17275
17292
|
if (!size)
|
|
17276
17293
|
return "";
|
|
@@ -17279,9 +17296,11 @@ function customRandom(alphabet, defaultSize, getRandom) {
|
|
|
17279
17296
|
let bytes = getRandom(step);
|
|
17280
17297
|
let i = step;
|
|
17281
17298
|
while (i--) {
|
|
17282
|
-
|
|
17283
|
-
|
|
17284
|
-
|
|
17299
|
+
if (bytes[i] < safeByteCutoff) {
|
|
17300
|
+
id += alphabet[bytes[i] % alphabet.length];
|
|
17301
|
+
if (id.length >= size)
|
|
17302
|
+
return id;
|
|
17303
|
+
}
|
|
17285
17304
|
}
|
|
17286
17305
|
}
|
|
17287
17306
|
};
|
|
@@ -20112,7 +20131,7 @@ app
|
|
|
20112
20131
|
10. **中间件找不到会返回 404**,错误信息中会包含找不到的中间件列表。
|
|
20113
20132
|
`;
|
|
20114
20133
|
// package.json
|
|
20115
|
-
var version2 = "0.2.
|
|
20134
|
+
var version2 = "0.2.7";
|
|
20116
20135
|
|
|
20117
20136
|
// agent/routes/route-create.ts
|
|
20118
20137
|
app.route({
|
package/dist/opencode.js
CHANGED
|
@@ -14774,7 +14774,7 @@ function date4(params) {
|
|
|
14774
14774
|
|
|
14775
14775
|
// ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/external.js
|
|
14776
14776
|
config(en_default());
|
|
14777
|
-
// ../../node_modules/.pnpm/nanoid@5.1.
|
|
14777
|
+
// ../../node_modules/.pnpm/nanoid@5.1.9/node_modules/nanoid/index.js
|
|
14778
14778
|
import { webcrypto as crypto } from "node:crypto";
|
|
14779
14779
|
var POOL_SIZE_MULTIPLIER = 128;
|
|
14780
14780
|
var pool;
|
|
@@ -14795,8 +14795,25 @@ function random(bytes) {
|
|
|
14795
14795
|
return pool.subarray(poolOffset - bytes, poolOffset);
|
|
14796
14796
|
}
|
|
14797
14797
|
function customRandom(alphabet, defaultSize, getRandom) {
|
|
14798
|
-
let
|
|
14799
|
-
|
|
14798
|
+
let safeByteCutoff = 256 - 256 % alphabet.length;
|
|
14799
|
+
if (safeByteCutoff === 256) {
|
|
14800
|
+
let mask = alphabet.length - 1;
|
|
14801
|
+
return (size = defaultSize) => {
|
|
14802
|
+
if (!size)
|
|
14803
|
+
return "";
|
|
14804
|
+
let id = "";
|
|
14805
|
+
while (true) {
|
|
14806
|
+
let bytes = getRandom(size);
|
|
14807
|
+
let i = size;
|
|
14808
|
+
while (i--) {
|
|
14809
|
+
id += alphabet[bytes[i] & mask];
|
|
14810
|
+
if (id.length >= size)
|
|
14811
|
+
return id;
|
|
14812
|
+
}
|
|
14813
|
+
}
|
|
14814
|
+
};
|
|
14815
|
+
}
|
|
14816
|
+
let step = Math.ceil(1.6 * 256 * defaultSize / safeByteCutoff);
|
|
14800
14817
|
return (size = defaultSize) => {
|
|
14801
14818
|
if (!size)
|
|
14802
14819
|
return "";
|
|
@@ -14805,9 +14822,11 @@ function customRandom(alphabet, defaultSize, getRandom) {
|
|
|
14805
14822
|
let bytes = getRandom(step);
|
|
14806
14823
|
let i = step;
|
|
14807
14824
|
while (i--) {
|
|
14808
|
-
|
|
14809
|
-
|
|
14810
|
-
|
|
14825
|
+
if (bytes[i] < safeByteCutoff) {
|
|
14826
|
+
id += alphabet[bytes[i] % alphabet.length];
|
|
14827
|
+
if (id.length >= size)
|
|
14828
|
+
return id;
|
|
14829
|
+
}
|
|
14811
14830
|
}
|
|
14812
14831
|
}
|
|
14813
14832
|
};
|
package/dist/router-browser.js
CHANGED
|
@@ -32534,20 +32534,41 @@ function date4(params) {
|
|
|
32534
32534
|
|
|
32535
32535
|
// ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/external.js
|
|
32536
32536
|
config(en_default());
|
|
32537
|
-
// ../../node_modules/.pnpm/nanoid@5.1.
|
|
32537
|
+
// ../../node_modules/.pnpm/nanoid@5.1.9/node_modules/nanoid/index.browser.js
|
|
32538
32538
|
var random2 = (bytes) => crypto.getRandomValues(new Uint8Array(bytes));
|
|
32539
32539
|
var customRandom = (alphabet, defaultSize, getRandom) => {
|
|
32540
|
-
let
|
|
32541
|
-
|
|
32540
|
+
let safeByteCutoff = 256 - 256 % alphabet.length;
|
|
32541
|
+
if (safeByteCutoff === 256) {
|
|
32542
|
+
let mask = alphabet.length - 1;
|
|
32543
|
+
return (size = defaultSize) => {
|
|
32544
|
+
if (!size)
|
|
32545
|
+
return "";
|
|
32546
|
+
let id = "";
|
|
32547
|
+
while (true) {
|
|
32548
|
+
let bytes = getRandom(size);
|
|
32549
|
+
let j = size;
|
|
32550
|
+
while (j--) {
|
|
32551
|
+
id += alphabet[bytes[j] & mask];
|
|
32552
|
+
if (id.length >= size)
|
|
32553
|
+
return id;
|
|
32554
|
+
}
|
|
32555
|
+
}
|
|
32556
|
+
};
|
|
32557
|
+
}
|
|
32558
|
+
let step = Math.ceil(1.6 * 256 * defaultSize / safeByteCutoff);
|
|
32542
32559
|
return (size = defaultSize) => {
|
|
32560
|
+
if (!size)
|
|
32561
|
+
return "";
|
|
32543
32562
|
let id = "";
|
|
32544
32563
|
while (true) {
|
|
32545
32564
|
let bytes = getRandom(step);
|
|
32546
|
-
let j = step
|
|
32565
|
+
let j = step;
|
|
32547
32566
|
while (j--) {
|
|
32548
|
-
|
|
32549
|
-
|
|
32550
|
-
|
|
32567
|
+
if (bytes[j] < safeByteCutoff) {
|
|
32568
|
+
id += alphabet[bytes[j] % alphabet.length];
|
|
32569
|
+
if (id.length >= size)
|
|
32570
|
+
return id;
|
|
32571
|
+
}
|
|
32551
32572
|
}
|
|
32552
32573
|
}
|
|
32553
32574
|
};
|
package/dist/router.js
CHANGED
|
@@ -17245,7 +17245,7 @@ function date4(params) {
|
|
|
17245
17245
|
|
|
17246
17246
|
// ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/external.js
|
|
17247
17247
|
config(en_default());
|
|
17248
|
-
// ../../node_modules/.pnpm/nanoid@5.1.
|
|
17248
|
+
// ../../node_modules/.pnpm/nanoid@5.1.9/node_modules/nanoid/index.js
|
|
17249
17249
|
import { webcrypto as crypto } from "node:crypto";
|
|
17250
17250
|
var POOL_SIZE_MULTIPLIER = 128;
|
|
17251
17251
|
var pool;
|
|
@@ -17266,8 +17266,25 @@ function random2(bytes) {
|
|
|
17266
17266
|
return pool.subarray(poolOffset - bytes, poolOffset);
|
|
17267
17267
|
}
|
|
17268
17268
|
function customRandom(alphabet, defaultSize, getRandom) {
|
|
17269
|
-
let
|
|
17270
|
-
|
|
17269
|
+
let safeByteCutoff = 256 - 256 % alphabet.length;
|
|
17270
|
+
if (safeByteCutoff === 256) {
|
|
17271
|
+
let mask = alphabet.length - 1;
|
|
17272
|
+
return (size = defaultSize) => {
|
|
17273
|
+
if (!size)
|
|
17274
|
+
return "";
|
|
17275
|
+
let id = "";
|
|
17276
|
+
while (true) {
|
|
17277
|
+
let bytes = getRandom(size);
|
|
17278
|
+
let i = size;
|
|
17279
|
+
while (i--) {
|
|
17280
|
+
id += alphabet[bytes[i] & mask];
|
|
17281
|
+
if (id.length >= size)
|
|
17282
|
+
return id;
|
|
17283
|
+
}
|
|
17284
|
+
}
|
|
17285
|
+
};
|
|
17286
|
+
}
|
|
17287
|
+
let step = Math.ceil(1.6 * 256 * defaultSize / safeByteCutoff);
|
|
17271
17288
|
return (size = defaultSize) => {
|
|
17272
17289
|
if (!size)
|
|
17273
17290
|
return "";
|
|
@@ -17276,9 +17293,11 @@ function customRandom(alphabet, defaultSize, getRandom) {
|
|
|
17276
17293
|
let bytes = getRandom(step);
|
|
17277
17294
|
let i = step;
|
|
17278
17295
|
while (i--) {
|
|
17279
|
-
|
|
17280
|
-
|
|
17281
|
-
|
|
17296
|
+
if (bytes[i] < safeByteCutoff) {
|
|
17297
|
+
id += alphabet[bytes[i] % alphabet.length];
|
|
17298
|
+
if (id.length >= size)
|
|
17299
|
+
return id;
|
|
17300
|
+
}
|
|
17282
17301
|
}
|
|
17283
17302
|
}
|
|
17284
17303
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "@kevisual/router",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.8",
|
|
5
5
|
"description": "",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/router.js",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"@kevisual/dts": "^0.0.4",
|
|
28
28
|
"@kevisual/js-filter": "^0.0.6",
|
|
29
29
|
"@kevisual/local-proxy": "^0.0.8",
|
|
30
|
-
"@kevisual/query": "^0.0.
|
|
30
|
+
"@kevisual/query": "^0.0.56",
|
|
31
31
|
"@kevisual/remote-app": "^0.0.7",
|
|
32
32
|
"@kevisual/use-config": "^1.0.30",
|
|
33
33
|
"@opencode-ai/plugin": "^1.4.6",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"es-toolkit": "^1.45.1",
|
|
43
43
|
"eventemitter3": "^5.0.4",
|
|
44
44
|
"fast-glob": "^3.3.3",
|
|
45
|
-
"nanoid": "^5.1.
|
|
45
|
+
"nanoid": "^5.1.9",
|
|
46
46
|
"path-to-regexp": "^8.4.2",
|
|
47
47
|
"send": "^1.2.1",
|
|
48
48
|
"typescript": "^6.0.2",
|
package/src/commander.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { Command, program } from 'commander';
|
|
|
2
2
|
import { App } from './app.ts';
|
|
3
3
|
import { RemoteApp } from '@kevisual/remote-app'
|
|
4
4
|
import z from 'zod';
|
|
5
|
-
import { create } from 'node:domain';
|
|
6
5
|
export const groupByPath = (routes: App['routes']) => {
|
|
7
6
|
return routes.reduce((acc, route) => {
|
|
8
7
|
const path = route.path || 'default';
|