@zuplo/cli 6.71.10 → 6.71.12

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 (50) hide show
  1. package/node_modules/@posthog/core/dist/logs/index.d.ts +2 -1
  2. package/node_modules/@posthog/core/dist/logs/index.d.ts.map +1 -1
  3. package/node_modules/@posthog/core/dist/logs/index.js +3 -2
  4. package/node_modules/@posthog/core/dist/logs/index.mjs +3 -2
  5. package/node_modules/@posthog/core/dist/logs/logs-utils.d.ts +5 -5
  6. package/node_modules/@posthog/core/dist/logs/logs-utils.d.ts.map +1 -1
  7. package/node_modules/@posthog/core/dist/logs/logs-utils.js +3 -3
  8. package/node_modules/@posthog/core/dist/logs/logs-utils.mjs +3 -3
  9. package/node_modules/@posthog/core/dist/types.d.ts +23 -2
  10. package/node_modules/@posthog/core/dist/types.d.ts.map +1 -1
  11. package/node_modules/@posthog/core/dist/utils/index.d.ts +1 -0
  12. package/node_modules/@posthog/core/dist/utils/index.d.ts.map +1 -1
  13. package/node_modules/@posthog/core/dist/utils/index.js +17 -2
  14. package/node_modules/@posthog/core/dist/utils/index.mjs +5 -1
  15. package/node_modules/@posthog/core/package.json +2 -2
  16. package/node_modules/@posthog/core/src/logs/index.spec.ts +26 -0
  17. package/node_modules/@posthog/core/src/logs/index.ts +6 -2
  18. package/node_modules/@posthog/core/src/logs/logs-utils.ts +8 -8
  19. package/node_modules/@posthog/core/src/types.ts +23 -2
  20. package/node_modules/@posthog/core/src/utils/index.ts +8 -0
  21. package/node_modules/@posthog/types/dist/posthog-config.d.ts +24 -1
  22. package/node_modules/@posthog/types/dist/posthog-config.d.ts.map +1 -1
  23. package/node_modules/@posthog/types/package.json +1 -1
  24. package/node_modules/@posthog/types/src/posthog-config.ts +25 -1
  25. package/node_modules/@zuplo/core/package.json +1 -1
  26. package/node_modules/@zuplo/graphql/package.json +1 -1
  27. package/node_modules/@zuplo/openapi-tools/package.json +1 -1
  28. package/node_modules/@zuplo/otel/package.json +1 -1
  29. package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +13 -13
  30. package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js.map +1 -1
  31. package/node_modules/@zuplo/runtime/package.json +3 -1
  32. package/node_modules/hono/dist/adapter/aws-lambda/handler.js +9 -17
  33. package/node_modules/hono/dist/cjs/adapter/aws-lambda/handler.js +9 -17
  34. package/node_modules/hono/dist/cjs/helper/css/common.js +3 -1
  35. package/node_modules/hono/dist/cjs/helper/css/index.js +9 -1
  36. package/node_modules/hono/dist/cjs/jsx/base.js +8 -14
  37. package/node_modules/hono/dist/cjs/jsx/components.js +41 -21
  38. package/node_modules/hono/dist/cjs/jsx/context.js +131 -5
  39. package/node_modules/hono/dist/cjs/jsx/streaming.js +9 -7
  40. package/node_modules/hono/dist/helper/css/common.js +3 -1
  41. package/node_modules/hono/dist/helper/css/index.js +9 -1
  42. package/node_modules/hono/dist/jsx/base.js +15 -15
  43. package/node_modules/hono/dist/jsx/components.js +42 -22
  44. package/node_modules/hono/dist/jsx/context.js +129 -5
  45. package/node_modules/hono/dist/jsx/streaming.js +10 -8
  46. package/node_modules/hono/dist/tsconfig.build.tsbuildinfo +1 -1
  47. package/node_modules/hono/dist/types/jsx/base.d.ts +1 -3
  48. package/node_modules/hono/dist/types/jsx/context.d.ts +39 -0
  49. package/node_modules/hono/package.json +1 -1
  50. package/package.json +6 -6
@@ -3,7 +3,7 @@ import { raw } from "../helper/html/index.js";
3
3
  import { HtmlEscapedCallbackPhase, resolveCallback } from "../utils/html.js";
4
4
  import { jsx, Fragment } from "./base.js";
5
5
  import { DOM_RENDERER } from "./constants.js";
6
- import { useContext } from "./context.js";
6
+ import { captureRenderContext, useContext } from "./context.js";
7
7
  import { ErrorBoundary as ErrorBoundaryDomRenderer } from "./dom/components.js";
8
8
  import { StreamingContext } from "./streaming.js";
9
9
  var errorBoundaryCounter = 0;
@@ -12,8 +12,9 @@ var childrenToString = async (children) => {
12
12
  return children.flat().map((c) => c == null || typeof c === "boolean" ? "" : c.toString());
13
13
  } catch (e) {
14
14
  if (e instanceof Promise) {
15
+ const resume = captureRenderContext();
15
16
  await e;
16
- return childrenToString(children);
17
+ return resume(() => childrenToString(children));
17
18
  } else {
18
19
  throw e;
19
20
  }
@@ -41,51 +42,68 @@ var ErrorBoundary = async ({ children, fallback, fallbackRender, onError }) => {
41
42
  children = [children];
42
43
  }
43
44
  const nonce = useContext(StreamingContext)?.scriptNonce;
44
- let fallbackStr;
45
- const resolveFallbackStr = async () => {
45
+ let resume;
46
+ const getResume = () => resume ||= captureRenderContext();
47
+ let fallbackStrPromise;
48
+ const resolveFallbackStr = () => fallbackStrPromise ||= (async () => {
46
49
  const awaitedFallback = await fallback;
47
50
  if (typeof awaitedFallback === "string") {
48
- fallbackStr = awaitedFallback;
51
+ return awaitedFallback;
49
52
  } else {
50
- fallbackStr = await awaitedFallback?.toString();
51
- if (typeof fallbackStr === "string") {
52
- fallbackStr = raw(fallbackStr);
53
+ const fallbackResult = await getResume()(() => awaitedFallback?.toString());
54
+ if (typeof fallbackResult === "string") {
55
+ return raw(
56
+ fallbackResult,
57
+ fallbackResult.callbacks || awaitedFallback?.callbacks
58
+ );
53
59
  }
54
60
  }
55
- };
56
- const fallbackRes = (error) => {
57
- onError?.(error);
58
- return fallbackStr || fallbackRender && jsx(Fragment, {}, fallbackRender(error)) || "";
61
+ })();
62
+ const renderFallback = async (error) => {
63
+ const fallbackStr = await resolveFallbackStr();
64
+ return getResume()(async () => {
65
+ onError?.(error);
66
+ const fallbackRes = fallbackStr !== void 0 ? fallbackStr : fallbackRender && jsx(Fragment, {}, fallbackRender(error)) || "";
67
+ const fallbackResString = await Fragment({
68
+ children: fallbackRes
69
+ }).toString();
70
+ return raw(
71
+ fallbackResString,
72
+ fallbackResString.callbacks || fallbackRes.callbacks
73
+ );
74
+ });
59
75
  };
60
76
  let resArray = [];
61
77
  try {
62
78
  resArray = children.map(resolveChildEarly);
63
79
  } catch (e) {
64
- await resolveFallbackStr();
80
+ const resume2 = getResume();
65
81
  if (e instanceof Promise) {
66
82
  resArray = [
67
- e.then(() => childrenToString(children)).catch((e2) => fallbackRes(e2))
83
+ e.then(() => resume2(() => childrenToString(children))).catch((e2) => renderFallback(e2))
68
84
  ];
69
85
  } else {
70
- resArray = [fallbackRes(e)];
86
+ resArray = [await renderFallback(e)];
71
87
  }
72
88
  }
73
89
  if (resArray.some((res) => res instanceof Promise)) {
74
- await resolveFallbackStr();
90
+ getResume();
75
91
  const index = errorBoundaryCounter++;
76
92
  const replaceRe = RegExp(`(<template id="E:${index}"></template>.*?)(.*?)(<!--E:${index}-->)`);
77
- const caught = false;
93
+ let caught = false;
78
94
  const catchCallback = async ({ error: error2, buffer }) => {
79
95
  if (caught) {
80
96
  return "";
81
97
  }
82
- const fallbackResString = await Fragment({
83
- children: fallbackRes(error2)
84
- }).toString();
98
+ caught = true;
99
+ const fallbackResString = await renderFallback(error2);
100
+ const fallbackCallbacks = fallbackResString.callbacks;
85
101
  if (buffer) {
86
102
  buffer[0] = buffer[0].replace(replaceRe, fallbackResString);
103
+ return fallbackCallbacks?.length ? raw("", fallbackCallbacks) : "";
87
104
  }
88
- return buffer ? "" : `<template data-hono-target="E:${index}">${fallbackResString}</template><script>
105
+ return raw(
106
+ `<template data-hono-target="E:${index}">${fallbackResString}</template><script>
89
107
  ((d,c,n) => {
90
108
  c=d.currentScript.previousSibling
91
109
  d=d.getElementById('E:${index}')
@@ -93,7 +111,9 @@ if(!d)return
93
111
  do{n=d.nextSibling;n.remove()}while(n.nodeType!=8||n.nodeValue!='E:${index}')
94
112
  d.replaceWith(c.content)
95
113
  })(document)
96
- </script>`;
114
+ </script>`,
115
+ fallbackCallbacks
116
+ );
97
117
  };
98
118
  let error;
99
119
  const promiseAll = Promise.all(resArray).catch((e) => error = e);
@@ -4,21 +4,143 @@ import { JSXFragmentNode } from "./base.js";
4
4
  import { DOM_RENDERER } from "./constants.js";
5
5
  import { createContextProviderFunction } from "./dom/context.js";
6
6
  var globalContexts = [];
7
+ var alsProbed = false;
8
+ var asyncLocalStorage;
9
+ var fallbackStore;
10
+ var fallbackRendersInFlight = 0;
11
+ var warnedFallbackDefault = false;
12
+ var loadAsyncLocalStorage = () => {
13
+ if (alsProbed) {
14
+ return asyncLocalStorage;
15
+ }
16
+ alsProbed = true;
17
+ const global = globalThis;
18
+ let AsyncLocalStorage;
19
+ for (const probe of [
20
+ // Node.js >= 20.16, Deno, Bun, Cloudflare Workers (nodejs_compat). Property
21
+ // access only, so bundlers don't statically resolve `node:async_hooks`.
22
+ () => global.process?.getBuiltinModule?.("node:async_hooks")?.AsyncLocalStorage,
23
+ // Node.js < 20.16 has no `process.getBuiltinModule`, but a CJS entrypoint
24
+ // exposes the main module's `require` here.
25
+ () => global.process?.mainModule?.require?.("node:async_hooks")?.AsyncLocalStorage
26
+ ]) {
27
+ try {
28
+ AsyncLocalStorage = probe();
29
+ } catch {
30
+ }
31
+ if (AsyncLocalStorage) {
32
+ break;
33
+ }
34
+ }
35
+ if (AsyncLocalStorage) {
36
+ asyncLocalStorage = new AsyncLocalStorage();
37
+ }
38
+ return asyncLocalStorage;
39
+ };
40
+ var getCurrentStore = () => {
41
+ return loadAsyncLocalStorage()?.getStore() || fallbackStore;
42
+ };
43
+ var warnIfStorelessAccess = () => {
44
+ if (fallbackRendersInFlight > 0 && !warnedFallbackDefault) {
45
+ warnedFallbackDefault = true;
46
+ console.warn(
47
+ "hono/jsx: AsyncLocalStorage is unavailable in this runtime, so useContext() after an await in an async component falls back to the context default value during server-side rendering. To get provided values across await boundaries, use a runtime with AsyncLocalStorage (Node.js >= 20.16, Deno, Bun, or Cloudflare Workers with the nodejs_compat flag)."
48
+ );
49
+ }
50
+ };
51
+ var getContextValuesIn = (store, context) => {
52
+ if (!store) {
53
+ warnIfStorelessAccess();
54
+ return context.values;
55
+ }
56
+ let values = store.get(context);
57
+ if (!values) {
58
+ values = [context.values[0]];
59
+ store.set(context, values);
60
+ }
61
+ return values;
62
+ };
63
+ var readContextValueIn = (store, context) => {
64
+ if (!store) {
65
+ warnIfStorelessAccess();
66
+ return context.values.at(-1);
67
+ }
68
+ const values = store.get(context);
69
+ return values?.length ? values.at(-1) : context.values[0];
70
+ };
71
+ var captureContextValues = (store) => (store ? globalContexts.filter((c) => store.has(c)) : globalContexts).map((c) => [
72
+ c,
73
+ readContextValueIn(store, c)
74
+ ]);
75
+ var resumeWithContextValues = (callback, store, contexts) => runWithRenderContext(() => {
76
+ const currentStore = getCurrentStore();
77
+ const valuesPerContext = contexts.map(([context, value]) => {
78
+ const values = getContextValuesIn(currentStore, context);
79
+ values.push(value);
80
+ return values;
81
+ });
82
+ const popContextValues = () => {
83
+ valuesPerContext.forEach((values) => {
84
+ values.pop();
85
+ });
86
+ };
87
+ try {
88
+ const result = callback();
89
+ if (result instanceof Promise) {
90
+ return result.finally(popContextValues);
91
+ }
92
+ popContextValues();
93
+ return result;
94
+ } catch (e) {
95
+ popContextValues();
96
+ throw e;
97
+ }
98
+ }, store);
99
+ var runWithRenderContext = (callback, resumeStore) => {
100
+ if (getCurrentStore()) {
101
+ return callback();
102
+ }
103
+ const store = resumeStore ?? /* @__PURE__ */ new WeakMap();
104
+ const storage = loadAsyncLocalStorage();
105
+ if (storage) {
106
+ return storage.run(store, callback);
107
+ }
108
+ fallbackStore = store;
109
+ let result;
110
+ try {
111
+ result = callback();
112
+ } finally {
113
+ fallbackStore = void 0;
114
+ }
115
+ if (!warnedFallbackDefault && result instanceof Promise) {
116
+ fallbackRendersInFlight++;
117
+ result = result.finally(() => {
118
+ fallbackRendersInFlight--;
119
+ });
120
+ }
121
+ return result;
122
+ };
123
+ var captureRenderContext = () => {
124
+ const store = getCurrentStore();
125
+ const contexts = captureContextValues(store);
126
+ return (callback) => resumeWithContextValues(callback, store, contexts);
127
+ };
7
128
  var createContext = (defaultValue) => {
8
129
  const values = [defaultValue];
9
130
  const context = ((props) => {
10
- values.push(props.value);
131
+ const contextValues = getContextValuesIn(getCurrentStore(), context);
132
+ contextValues.push(props.value);
11
133
  let string;
12
134
  try {
13
135
  string = props.children ? (Array.isArray(props.children) ? new JSXFragmentNode("", {}, props.children) : props.children).toString() : "";
14
136
  } catch (e) {
15
- values.pop();
137
+ contextValues.pop();
16
138
  throw e;
17
139
  }
18
140
  if (string instanceof Promise) {
19
- return string.finally(() => values.pop()).then((resString) => raw(resString, resString.callbacks));
141
+ return string.finally(() => contextValues.pop()).then((resString) => raw(resString, resString.callbacks));
20
142
  } else {
21
- values.pop();
143
+ contextValues.pop();
22
144
  return raw(string);
23
145
  }
24
146
  });
@@ -29,10 +151,12 @@ var createContext = (defaultValue) => {
29
151
  return context;
30
152
  };
31
153
  var useContext = (context) => {
32
- return context.values.at(-1);
154
+ return readContextValueIn(getCurrentStore(), context);
33
155
  };
34
156
  export {
157
+ captureRenderContext,
35
158
  createContext,
36
159
  globalContexts,
160
+ runWithRenderContext,
37
161
  useContext
38
162
  };
@@ -4,7 +4,7 @@ import { HtmlEscapedCallbackPhase, resolveCallback } from "../utils/html.js";
4
4
  import { JSXNode } from "./base.js";
5
5
  import { childrenToString } from "./components.js";
6
6
  import { DOM_RENDERER, DOM_STASH } from "./constants.js";
7
- import { createContext, useContext } from "./context.js";
7
+ import { captureRenderContext, createContext, useContext } from "./context.js";
8
8
  import { Suspense as SuspenseDomRenderer } from "./dom/components.js";
9
9
  import { buildDataStack } from "./dom/render.js";
10
10
  var StreamingContext = createContext(null);
@@ -19,9 +19,8 @@ var Suspense = async ({
19
19
  const nonce = useContext(StreamingContext)?.scriptNonce;
20
20
  let resArray = [];
21
21
  const stackNode = { [DOM_STASH]: [0, []] };
22
- const popNodeStack = (value) => {
22
+ const popNodeStack = () => {
23
23
  buildDataStack.pop();
24
- return value;
25
24
  };
26
25
  try {
27
26
  stackNode[DOM_STASH][0] = 0;
@@ -31,12 +30,15 @@ var Suspense = async ({
31
30
  );
32
31
  } catch (e) {
33
32
  if (e instanceof Promise) {
33
+ const resume = captureRenderContext();
34
34
  resArray = [
35
- e.then(() => {
36
- stackNode[DOM_STASH][0] = 0;
37
- buildDataStack.push([[], stackNode]);
38
- return childrenToString(children).then(popNodeStack);
39
- })
35
+ e.then(
36
+ () => resume(() => {
37
+ stackNode[DOM_STASH][0] = 0;
38
+ buildDataStack.push([[], stackNode]);
39
+ return childrenToString(children).finally(popNodeStack);
40
+ })
41
+ )
40
42
  ];
41
43
  } else {
42
44
  throw e;