@zuplo/cli 7.2.3 → 7.3.0
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/node_modules/@posthog/types/dist/posthog-config.d.ts +12 -6
- package/node_modules/@posthog/types/dist/posthog-config.d.ts.map +1 -1
- package/node_modules/@posthog/types/package.json +1 -1
- package/node_modules/@posthog/types/src/posthog-config.ts +20 -6
- package/node_modules/@zuplo/core/package.json +1 -1
- package/node_modules/@zuplo/graphql/package.json +1 -1
- package/node_modules/@zuplo/openapi-tools/package.json +1 -1
- package/node_modules/@zuplo/otel/package.json +1 -1
- package/node_modules/@zuplo/runtime/out/esm/{chunk-TPXAFGLU.js → chunk-WH7LSEQF.js} +2 -2
- package/node_modules/@zuplo/runtime/out/esm/{chunk-TPXAFGLU.js.map → chunk-WH7LSEQF.js.map} +1 -1
- package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/types/index.d.ts +0 -1
- package/node_modules/@zuplo/runtime/package.json +1 -1
- package/node_modules/hono/dist/cjs/client/utils.js +1 -1
- package/node_modules/hono/dist/cjs/context.js +4 -0
- package/node_modules/hono/dist/cjs/middleware/cors/index.js +1 -1
- package/node_modules/hono/dist/cjs/middleware/csrf/index.js +1 -1
- package/node_modules/hono/dist/cjs/middleware/etag/digest.js +1 -1
- package/node_modules/hono/dist/cjs/middleware/etag/index.js +2 -2
- package/node_modules/hono/dist/cjs/middleware/pretty-json/index.js +3 -1
- package/node_modules/hono/dist/cjs/router/linear-router/router.js +7 -2
- package/node_modules/hono/dist/cjs/router/pattern-router/router.js +3 -9
- package/node_modules/hono/dist/cjs/router/trie-router/node.js +43 -67
- package/node_modules/hono/dist/cjs/router/trie-router/router.js +3 -11
- package/node_modules/hono/dist/cjs/utils/ipaddr.js +5 -3
- package/node_modules/hono/dist/client/utils.js +1 -1
- package/node_modules/hono/dist/context.js +4 -0
- package/node_modules/hono/dist/middleware/cors/index.js +1 -1
- package/node_modules/hono/dist/middleware/csrf/index.js +1 -1
- package/node_modules/hono/dist/middleware/etag/digest.js +1 -1
- package/node_modules/hono/dist/middleware/etag/index.js +2 -2
- package/node_modules/hono/dist/middleware/pretty-json/index.js +3 -1
- package/node_modules/hono/dist/router/linear-router/router.js +7 -2
- package/node_modules/hono/dist/router/pattern-router/router.js +3 -9
- package/node_modules/hono/dist/router/trie-router/node.js +43 -67
- package/node_modules/hono/dist/router/trie-router/router.js +3 -11
- package/node_modules/hono/dist/types/context.d.ts +4 -0
- package/node_modules/hono/dist/types/router/trie-router/node.d.ts +1 -2
- package/node_modules/hono/dist/types/router/trie-router/router.d.ts +0 -1
- package/node_modules/hono/dist/utils/ipaddr.js +5 -3
- package/node_modules/hono/package.json +1 -1
- package/package.json +6 -6
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-TPXAFGLU.js.LEGAL.txt → chunk-WH7LSEQF.js.LEGAL.txt} +0 -0
|
@@ -2,76 +2,51 @@
|
|
|
2
2
|
import { METHOD_NAME_ALL } from "../../router.js";
|
|
3
3
|
import { getPattern, splitPath, splitRoutingPath } from "../../utils/url.js";
|
|
4
4
|
var emptyParams = /* @__PURE__ */ Object.create(null);
|
|
5
|
-
var
|
|
6
|
-
for (const _ in children) {
|
|
7
|
-
return true;
|
|
8
|
-
}
|
|
9
|
-
return false;
|
|
10
|
-
};
|
|
5
|
+
var order = 0;
|
|
11
6
|
var Node = class _Node {
|
|
12
|
-
#methods;
|
|
13
|
-
#children;
|
|
14
|
-
#patterns;
|
|
15
|
-
#
|
|
7
|
+
#methods = [];
|
|
8
|
+
#children = /* @__PURE__ */ Object.create(null);
|
|
9
|
+
#patterns = [];
|
|
10
|
+
#pattern;
|
|
16
11
|
#params = emptyParams;
|
|
17
|
-
constructor(method, handler, children) {
|
|
18
|
-
this.#children = children || /* @__PURE__ */ Object.create(null);
|
|
19
|
-
this.#methods = [];
|
|
20
|
-
if (method && handler) {
|
|
21
|
-
const m = /* @__PURE__ */ Object.create(null);
|
|
22
|
-
m[method] = { handler, possibleKeys: [], score: 0 };
|
|
23
|
-
this.#methods = [m];
|
|
24
|
-
}
|
|
25
|
-
this.#patterns = [];
|
|
26
|
-
}
|
|
27
12
|
insert(method, path, handler) {
|
|
28
|
-
this.#order = ++this.#order;
|
|
29
13
|
let curNode = this;
|
|
30
14
|
const parts = splitRoutingPath(path);
|
|
31
|
-
const possibleKeys =
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const nextP = parts[i
|
|
35
|
-
const pattern = getPattern(p, nextP);
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
continue;
|
|
15
|
+
const possibleKeys = /* @__PURE__ */ new Set();
|
|
16
|
+
let i = 0;
|
|
17
|
+
for (const p of parts) {
|
|
18
|
+
const nextP = parts[++i];
|
|
19
|
+
const pattern = getPattern(p, nextP) || (nextP === void 0 && p && p.indexOf("*") === p.length - 1 ? p : null);
|
|
20
|
+
const isParam = Array.isArray(pattern);
|
|
21
|
+
const key = isParam ? pattern[0] : pattern || p;
|
|
22
|
+
const child = curNode.#children[key] ||= new _Node();
|
|
23
|
+
if (pattern && !child.#pattern) {
|
|
24
|
+
child.#pattern = pattern;
|
|
25
|
+
curNode.#patterns.push(child);
|
|
43
26
|
}
|
|
44
|
-
curNode
|
|
45
|
-
if (
|
|
46
|
-
|
|
47
|
-
possibleKeys.push(pattern[1]);
|
|
27
|
+
curNode = child;
|
|
28
|
+
if (isParam) {
|
|
29
|
+
possibleKeys.add(pattern[1]);
|
|
48
30
|
}
|
|
49
|
-
curNode = curNode.#children[key];
|
|
50
31
|
}
|
|
51
32
|
curNode.#methods.push({
|
|
52
33
|
[method]: {
|
|
53
34
|
handler,
|
|
54
|
-
possibleKeys: possibleKeys
|
|
55
|
-
score:
|
|
35
|
+
possibleKeys: [...possibleKeys],
|
|
36
|
+
score: ++order
|
|
56
37
|
}
|
|
57
38
|
});
|
|
58
|
-
return curNode;
|
|
59
39
|
}
|
|
60
40
|
#pushHandlerSets(handlerSets, node, method, nodeParams, params) {
|
|
61
41
|
for (let i = 0, len = node.#methods.length; i < len; i++) {
|
|
62
42
|
const m = node.#methods[i];
|
|
63
43
|
const handlerSet = m[method] || m[METHOD_NAME_ALL];
|
|
64
|
-
|
|
65
|
-
if (handlerSet !== void 0) {
|
|
44
|
+
if (handlerSet) {
|
|
66
45
|
handlerSet.params = /* @__PURE__ */ Object.create(null);
|
|
67
46
|
handlerSets.push(handlerSet);
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
const processed = processedSet[handlerSet.score];
|
|
72
|
-
handlerSet.params[key] = params?.[key] && !processed ? params[key] : nodeParams[key] ?? params?.[key];
|
|
73
|
-
processedSet[handlerSet.score] = true;
|
|
74
|
-
}
|
|
47
|
+
for (let i2 = 0, len2 = handlerSet.possibleKeys.length; i2 < len2; i2++) {
|
|
48
|
+
const key = handlerSet.possibleKeys[i2];
|
|
49
|
+
handlerSet.params[key] = params?.[key] && !i2 ? params[key] : nodeParams[key] ?? params?.[key];
|
|
75
50
|
}
|
|
76
51
|
}
|
|
77
52
|
}
|
|
@@ -103,33 +78,33 @@ var Node = class _Node {
|
|
|
103
78
|
tempNodes.push(nextNode);
|
|
104
79
|
}
|
|
105
80
|
}
|
|
106
|
-
for (
|
|
107
|
-
const pattern =
|
|
81
|
+
for (const child of node.#patterns) {
|
|
82
|
+
const pattern = child.#pattern;
|
|
108
83
|
const params = node.#params === emptyParams ? {} : { ...node.#params };
|
|
109
|
-
if (pattern === "
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
84
|
+
if (typeof pattern === "string") {
|
|
85
|
+
if (pattern === "*" || part.startsWith(pattern.slice(0, -1))) {
|
|
86
|
+
this.#pushHandlerSets(handlerSets, child, method, node.#params);
|
|
87
|
+
if (pattern === "*") {
|
|
88
|
+
child.#params = params;
|
|
89
|
+
tempNodes.push(child);
|
|
90
|
+
}
|
|
115
91
|
}
|
|
116
92
|
continue;
|
|
117
93
|
}
|
|
118
|
-
const [
|
|
119
|
-
if (!part &&
|
|
94
|
+
const [, name, matcher] = pattern;
|
|
95
|
+
if (!part && matcher === true) {
|
|
120
96
|
continue;
|
|
121
97
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
partOffsets = new Array(len);
|
|
98
|
+
if (matcher !== true) {
|
|
99
|
+
if (!partOffsets) {
|
|
100
|
+
partOffsets = [];
|
|
126
101
|
let offset = path[0] === "/" ? 1 : 0;
|
|
127
102
|
for (let p = 0; p < len; p++) {
|
|
128
103
|
partOffsets[p] = offset;
|
|
129
104
|
offset += parts[p].length + 1;
|
|
130
105
|
}
|
|
131
106
|
}
|
|
132
|
-
const restPathString = path.
|
|
107
|
+
const restPathString = path.slice(partOffsets[i]);
|
|
133
108
|
const m = matcher.exec(restPathString);
|
|
134
109
|
if (m) {
|
|
135
110
|
params[name] = m[0];
|
|
@@ -143,11 +118,12 @@ var Node = class _Node {
|
|
|
143
118
|
params
|
|
144
119
|
);
|
|
145
120
|
}
|
|
146
|
-
|
|
121
|
+
for (const _ in child.#children) {
|
|
147
122
|
child.#params = params;
|
|
148
123
|
const componentCount = m[0].match(/\//g)?.length ?? 0;
|
|
149
124
|
const targetCurNodes = curNodesQueue[componentCount] ||= [];
|
|
150
125
|
targetCurNodes.push(child);
|
|
126
|
+
break;
|
|
151
127
|
}
|
|
152
128
|
continue;
|
|
153
129
|
}
|
|
@@ -175,7 +151,7 @@ var Node = class _Node {
|
|
|
175
151
|
const shifted = curNodesQueue.shift();
|
|
176
152
|
curNodes = shifted ? tempNodes.concat(shifted) : tempNodes;
|
|
177
153
|
}
|
|
178
|
-
if (handlerSets
|
|
154
|
+
if (handlerSets[1]) {
|
|
179
155
|
handlerSets.sort((a, b) => {
|
|
180
156
|
return a.score - b.score;
|
|
181
157
|
});
|
|
@@ -3,19 +3,11 @@ import { checkOptionalParameter } from "../../utils/url.js";
|
|
|
3
3
|
import { Node } from "./node.js";
|
|
4
4
|
var TrieRouter = class {
|
|
5
5
|
name = "TrieRouter";
|
|
6
|
-
#node;
|
|
7
|
-
constructor() {
|
|
8
|
-
this.#node = new Node();
|
|
9
|
-
}
|
|
6
|
+
#node = new Node();
|
|
10
7
|
add(method, path, handler) {
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
for (let i = 0, len = results.length; i < len; i++) {
|
|
14
|
-
this.#node.insert(method, results[i], handler);
|
|
15
|
-
}
|
|
16
|
-
return;
|
|
8
|
+
for (const result of checkOptionalParameter(path) || [path]) {
|
|
9
|
+
this.#node.insert(method, result, handler);
|
|
17
10
|
}
|
|
18
|
-
this.#node.insert(method, path, handler);
|
|
19
11
|
}
|
|
20
12
|
match(method, path) {
|
|
21
13
|
return this.#node.search(method, path);
|
|
@@ -323,6 +323,10 @@ export declare class Context<E extends Env = any, P extends string = any, I exte
|
|
|
323
323
|
* c.header('X-Message', 'Hello!')
|
|
324
324
|
* c.header('Content-Type', 'text/plain')
|
|
325
325
|
*
|
|
326
|
+
* // Append multiple headers using the append option (e.g. Vary)
|
|
327
|
+
* c.header('Vary', 'Accept-Encoding', { append: true })
|
|
328
|
+
* c.header('Vary', 'User-Agent', { append: true })
|
|
329
|
+
*
|
|
326
330
|
* return c.body('Thank you for coming')
|
|
327
331
|
* })
|
|
328
332
|
* ```
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { Params } from '../../router';
|
|
2
2
|
export declare class Node<T> {
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
insert(method: string, path: string, handler: T): Node<T>;
|
|
4
|
+
insert(method: string, path: string, handler: T): void;
|
|
6
5
|
search(method: string, path: string): [[T, Params][]];
|
|
7
6
|
}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
// src/utils/ipaddr.ts
|
|
2
2
|
var expandIPv6 = (ipV6) => {
|
|
3
3
|
const sections = ipV6.split(":");
|
|
4
|
-
|
|
4
|
+
const lastSection = sections.at(-1);
|
|
5
|
+
if (IPV4_REGEX.test(lastSection)) {
|
|
6
|
+
const octets = lastSection.split(".").map(Number);
|
|
5
7
|
sections.splice(
|
|
6
8
|
-1,
|
|
7
9
|
1,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
(octets[0] << 8 | octets[1]).toString(16),
|
|
11
|
+
(octets[2] << 8 | octets[3]).toString(16)
|
|
10
12
|
);
|
|
11
13
|
}
|
|
12
14
|
for (let i = 0; i < sections.length; i++) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zuplo/cli",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.3.0",
|
|
4
4
|
"repository": "https://github.com/zuplo/zuplo",
|
|
5
5
|
"author": "Zuplo, Inc.",
|
|
6
6
|
"type": "module",
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
"@opentelemetry/api": "1.9.0",
|
|
29
29
|
"@opentelemetry/api-logs": "0.220.0",
|
|
30
30
|
"@swc/core": "1.10.18",
|
|
31
|
-
"@zuplo/core": "7.
|
|
31
|
+
"@zuplo/core": "7.3.0",
|
|
32
32
|
"@zuplo/editor": "1.0.31094607111",
|
|
33
|
-
"@zuplo/openapi-tools": "7.
|
|
34
|
-
"@zuplo/runtime": "7.
|
|
33
|
+
"@zuplo/openapi-tools": "7.3.0",
|
|
34
|
+
"@zuplo/runtime": "7.3.0",
|
|
35
35
|
"chalk": "5.4.1",
|
|
36
36
|
"chokidar": "3.5.3",
|
|
37
37
|
"cookie": "1.0.2",
|
|
@@ -62,8 +62,8 @@
|
|
|
62
62
|
"workerd": "1.20241230.0",
|
|
63
63
|
"yargs": "17.7.2",
|
|
64
64
|
"zod": "4.4.3",
|
|
65
|
-
"@zuplo/graphql": "7.
|
|
66
|
-
"@zuplo/otel": "7.
|
|
65
|
+
"@zuplo/graphql": "7.3.0",
|
|
66
|
+
"@zuplo/otel": "7.3.0"
|
|
67
67
|
},
|
|
68
68
|
"bundleDependencies": [
|
|
69
69
|
"@inquirer/prompts",
|
|
File without changes
|