@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.
Files changed (44) hide show
  1. package/node_modules/@posthog/types/dist/posthog-config.d.ts +12 -6
  2. package/node_modules/@posthog/types/dist/posthog-config.d.ts.map +1 -1
  3. package/node_modules/@posthog/types/package.json +1 -1
  4. package/node_modules/@posthog/types/src/posthog-config.ts +20 -6
  5. package/node_modules/@zuplo/core/package.json +1 -1
  6. package/node_modules/@zuplo/graphql/package.json +1 -1
  7. package/node_modules/@zuplo/openapi-tools/package.json +1 -1
  8. package/node_modules/@zuplo/otel/package.json +1 -1
  9. package/node_modules/@zuplo/runtime/out/esm/{chunk-TPXAFGLU.js → chunk-WH7LSEQF.js} +2 -2
  10. package/node_modules/@zuplo/runtime/out/esm/{chunk-TPXAFGLU.js.map → chunk-WH7LSEQF.js.map} +1 -1
  11. package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
  12. package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +1 -1
  13. package/node_modules/@zuplo/runtime/out/types/index.d.ts +0 -1
  14. package/node_modules/@zuplo/runtime/package.json +1 -1
  15. package/node_modules/hono/dist/cjs/client/utils.js +1 -1
  16. package/node_modules/hono/dist/cjs/context.js +4 -0
  17. package/node_modules/hono/dist/cjs/middleware/cors/index.js +1 -1
  18. package/node_modules/hono/dist/cjs/middleware/csrf/index.js +1 -1
  19. package/node_modules/hono/dist/cjs/middleware/etag/digest.js +1 -1
  20. package/node_modules/hono/dist/cjs/middleware/etag/index.js +2 -2
  21. package/node_modules/hono/dist/cjs/middleware/pretty-json/index.js +3 -1
  22. package/node_modules/hono/dist/cjs/router/linear-router/router.js +7 -2
  23. package/node_modules/hono/dist/cjs/router/pattern-router/router.js +3 -9
  24. package/node_modules/hono/dist/cjs/router/trie-router/node.js +43 -67
  25. package/node_modules/hono/dist/cjs/router/trie-router/router.js +3 -11
  26. package/node_modules/hono/dist/cjs/utils/ipaddr.js +5 -3
  27. package/node_modules/hono/dist/client/utils.js +1 -1
  28. package/node_modules/hono/dist/context.js +4 -0
  29. package/node_modules/hono/dist/middleware/cors/index.js +1 -1
  30. package/node_modules/hono/dist/middleware/csrf/index.js +1 -1
  31. package/node_modules/hono/dist/middleware/etag/digest.js +1 -1
  32. package/node_modules/hono/dist/middleware/etag/index.js +2 -2
  33. package/node_modules/hono/dist/middleware/pretty-json/index.js +3 -1
  34. package/node_modules/hono/dist/router/linear-router/router.js +7 -2
  35. package/node_modules/hono/dist/router/pattern-router/router.js +3 -9
  36. package/node_modules/hono/dist/router/trie-router/node.js +43 -67
  37. package/node_modules/hono/dist/router/trie-router/router.js +3 -11
  38. package/node_modules/hono/dist/types/context.d.ts +4 -0
  39. package/node_modules/hono/dist/types/router/trie-router/node.d.ts +1 -2
  40. package/node_modules/hono/dist/types/router/trie-router/router.d.ts +0 -1
  41. package/node_modules/hono/dist/utils/ipaddr.js +5 -3
  42. package/node_modules/hono/package.json +1 -1
  43. package/package.json +6 -6
  44. /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 hasChildren = (children) => {
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
- #order = 0;
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
- for (let i = 0, len = parts.length; i < len; i++) {
33
- const p = parts[i];
34
- const nextP = parts[i + 1];
35
- const pattern = getPattern(p, nextP);
36
- const key = Array.isArray(pattern) ? pattern[0] : p;
37
- if (key in curNode.#children) {
38
- curNode = curNode.#children[key];
39
- if (pattern) {
40
- possibleKeys.push(pattern[1]);
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.#children[key] = new _Node();
45
- if (pattern) {
46
- curNode.#patterns.push(pattern);
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.filter((v, i, a) => a.indexOf(v) === i),
55
- score: this.#order
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
- const processedSet = {};
65
- if (handlerSet !== void 0) {
44
+ if (handlerSet) {
66
45
  handlerSet.params = /* @__PURE__ */ Object.create(null);
67
46
  handlerSets.push(handlerSet);
68
- if (nodeParams !== emptyParams || params && params !== emptyParams) {
69
- for (let i2 = 0, len2 = handlerSet.possibleKeys.length; i2 < len2; i2++) {
70
- const key = handlerSet.possibleKeys[i2];
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 (let k = 0, len3 = node.#patterns.length; k < len3; k++) {
107
- const pattern = node.#patterns[k];
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
- const astNode = node.#children["*"];
111
- if (astNode) {
112
- this.#pushHandlerSets(handlerSets, astNode, method, node.#params);
113
- astNode.#params = params;
114
- tempNodes.push(astNode);
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 [key, name, matcher] = pattern;
119
- if (!part && !(matcher instanceof RegExp)) {
94
+ const [, name, matcher] = pattern;
95
+ if (!part && matcher === true) {
120
96
  continue;
121
97
  }
122
- const child = node.#children[key];
123
- if (matcher instanceof RegExp) {
124
- if (partOffsets === null) {
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.substring(partOffsets[i]);
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
- if (hasChildren(child.#children)) {
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.length > 1) {
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 results = checkOptionalParameter(path);
12
- if (results) {
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
- constructor(method?: string, handler?: T, children?: Record<string, Node<T>>);
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
  }
@@ -2,7 +2,6 @@ import type { Result, Router } from '../../router';
2
2
  export declare class TrieRouter<T> implements Router<T> {
3
3
 
4
4
  name: string;
5
- constructor();
6
5
  add(method: string, path: string, handler: T): void;
7
6
  match(method: string, path: string): Result<T>;
8
7
  }
@@ -1,12 +1,14 @@
1
1
  // src/utils/ipaddr.ts
2
2
  var expandIPv6 = (ipV6) => {
3
3
  const sections = ipV6.split(":");
4
- if (IPV4_REGEX.test(sections.at(-1))) {
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
- ...convertIPv6BinaryToString(convertIPv4ToBinary(sections.at(-1))).substring(2).split(":")
9
- // => ['7f00', '0001']
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++) {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hono",
3
- "version": "4.13.2",
3
+ "version": "4.13.3",
4
4
  "description": "Web framework built on Web Standards",
5
5
  "main": "dist/cjs/index.js",
6
6
  "type": "module",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zuplo/cli",
3
- "version": "7.2.3",
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.2.3",
31
+ "@zuplo/core": "7.3.0",
32
32
  "@zuplo/editor": "1.0.31094607111",
33
- "@zuplo/openapi-tools": "7.2.3",
34
- "@zuplo/runtime": "7.2.3",
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.2.3",
66
- "@zuplo/otel": "7.2.3"
65
+ "@zuplo/graphql": "7.3.0",
66
+ "@zuplo/otel": "7.3.0"
67
67
  },
68
68
  "bundleDependencies": [
69
69
  "@inquirer/prompts",