@bleedingdev/tanstack-redact 0.2.2 → 0.3.2
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/bundler-core/resolution.d.ts +31 -0
- package/dist/bundler-core/resolution.js +80 -0
- package/dist/bundler-core/resolution.js.map +7 -0
- package/dist/bundler-core/selection.d.ts +89 -0
- package/dist/bundler-core/selection.js +103 -0
- package/dist/bundler-core/selection.js.map +7 -0
- package/dist/core/devtools.d.ts +1 -1
- package/dist/core/devtools.js +1 -0
- package/dist/core/devtools.js.map +2 -2
- package/dist/core/functions.js +1 -0
- package/dist/core/functions.js.map +2 -2
- package/dist/core/internal.d.ts +5 -4
- package/dist/core/internal.js +4 -3
- package/dist/core/internal.js.map +2 -2
- package/dist/core/types.d.ts +2 -2
- package/dist/core/types.js +1 -0
- package/dist/core/types.js.map +1 -1
- package/dist/dom/devtools.d.ts +5 -5
- package/dist/dom/devtools.js +1 -0
- package/dist/dom/devtools.js.map +2 -2
- package/dist/dom/dispatcher.d.ts +1 -1
- package/dist/dom/dispatcher.js +1 -0
- package/dist/dom/dispatcher.js.map +3 -3
- package/dist/dom/document-metadata.d.ts +1 -1
- package/dist/dom/document-metadata.js +3 -1
- package/dist/dom/document-metadata.js.map +2 -2
- package/dist/dom/dom.js +1 -1
- package/dist/dom/dom.js.map +2 -2
- package/dist/dom/features/class/full.js +25 -32
- package/dist/dom/features/class/full.js.map +2 -2
- package/dist/dom/features/class/stub.js +1 -0
- package/dist/dom/features/class/stub.js.map +2 -2
- package/dist/dom/features/hydration/full.d.ts +6 -6
- package/dist/dom/features/hydration/full.js +20 -29
- package/dist/dom/features/hydration/full.js.map +2 -2
- package/dist/dom/features/hydration/stub.d.ts +7 -2
- package/dist/dom/features/hydration/stub.js +1 -0
- package/dist/dom/features/hydration/stub.js.map +2 -2
- package/dist/dom/features/lazy/full.js +1 -0
- package/dist/dom/features/lazy/full.js.map +2 -2
- package/dist/dom/features/suspense/full.d.ts +4 -1
- package/dist/dom/features/suspense/full.js +22 -161
- package/dist/dom/features/suspense/full.js.map +2 -2
- package/dist/dom/features/suspense-hydration/full.d.ts +8 -0
- package/dist/dom/features/suspense-hydration/full.js +147 -0
- package/dist/dom/features/suspense-hydration/full.js.map +7 -0
- package/dist/dom/features/suspense-hydration/index.d.ts +1 -0
- package/dist/dom/features/suspense-hydration/index.js +2 -0
- package/dist/dom/features/suspense-hydration/index.js.map +7 -0
- package/dist/dom/features/suspense-hydration/stub.d.ts +2 -0
- package/dist/dom/features/suspense-hydration/stub.js +9 -0
- package/dist/dom/features/suspense-hydration/stub.js.map +7 -0
- package/dist/dom/features/suspense-runtime/stub.js +1 -0
- package/dist/dom/features/suspense-runtime/stub.js.map +2 -2
- package/dist/dom/profiling.d.ts +36 -0
- package/dist/dom/profiling.js +9 -0
- package/dist/dom/profiling.js.map +7 -0
- package/dist/dom/react-ids.js +1 -0
- package/dist/dom/react-ids.js.map +2 -2
- package/dist/dom/reconcile.d.ts +4 -5
- package/dist/dom/reconcile.js +102 -144
- package/dist/dom/reconcile.js.map +2 -2
- package/dist/dom/resources.js +1 -0
- package/dist/dom/resources.js.map +2 -2
- package/dist/dom/root-internal.d.ts +1 -1
- package/dist/dom/root-internal.js +4 -3
- package/dist/dom/root-internal.js.map +2 -2
- package/dist/dom/root.d.ts +2 -2
- package/dist/dom/root.js +1 -0
- package/dist/dom/root.js.map +2 -2
- package/dist/dom/synthetic-event.js.map +2 -2
- package/dist/dom/transitions.d.ts +1 -1
- package/dist/dom/transitions.js +1 -0
- package/dist/dom/transitions.js.map +2 -2
- package/dist/react/action-scope.d.ts +1 -1
- package/dist/react/action-scope.js +1 -0
- package/dist/react/action-scope.js.map +2 -2
- package/dist/rspack/index.d.ts +2 -0
- package/dist/rspack/index.js +6 -0
- package/dist/rspack/index.js.map +7 -0
- package/dist/server/bootstrap-script.js +1 -0
- package/dist/server/bootstrap-script.js.map +2 -2
- package/dist/server/dispatcher.js +11 -20
- package/dist/server/dispatcher.js.map +2 -2
- package/dist/server/insertion-context.js +9 -16
- package/dist/server/insertion-context.js.map +7 -0
- package/dist/server/stream-ids.js +1 -0
- package/dist/server/stream-ids.js.map +7 -0
- package/dist/server/stream.d.ts +1 -2
- package/dist/server/stream.js +106 -122
- package/dist/server/stream.js.map +2 -2
- package/dist/server/walk.js +69 -72
- package/dist/server/walk.js.map +3 -3
- package/dist/vite/index.d.ts +5 -99
- package/dist/vite/index.js +56 -179
- package/dist/vite/index.js.map +2 -2
- package/dist/webpack/index.d.ts +46 -0
- package/dist/webpack/index.js +102 -0
- package/dist/webpack/index.js.map +7 -0
- package/dist/webpack/react18-loader.cjs +25 -0
- package/package.json +17 -3
- package/src/bundler-core/resolution.ts +131 -0
- package/src/bundler-core/selection.ts +192 -0
- package/src/core/internal.ts +2 -1
- package/src/core/types.ts +3 -2
- package/src/dom/dom.ts +1 -1
- package/src/dom/features/class/full.ts +26 -34
- package/src/dom/features/suspense/full.ts +7 -165
- package/src/dom/features/suspense-hydration/full.ts +166 -0
- package/src/dom/features/suspense-hydration/index.ts +1 -0
- package/src/dom/features/suspense-hydration/stub.ts +2 -0
- package/src/dom/profiling.ts +6 -0
- package/src/dom/reconcile.ts +16 -6
- package/src/rspack/index.ts +2 -0
- package/src/server/stream.ts +15 -14
- package/src/vite/index.ts +55 -317
- package/src/webpack/index.ts +108 -0
- package/src/webpack/react18-loader.cjs +25 -0
package/dist/dom/transitions.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/dom/transitions.ts"],
|
|
4
|
-
"sourcesContent": ["import type { Fiber, FiberRoot, Hook } from '../core';\nimport { findRoot, scheduleUpdate } from './reconcile';\nimport { finish, type ActionScope } from '../react/action-scope';\nimport { isThenable } from '../core/functions';\nimport { checkpointCommit, rewindCommit, queueCommitEffects } from './commit';\nimport { ReactSharedInternals } from '../react/shared-internals';\nimport { transitionScope } from '../react/hooks';\nexport let a = false;\nexport const p = (fiber: Fiber): boolean => !!fiber.r?.tr?.has(fiber);\nexport function q(hook: Hook, fiber: Fiber, action: any): boolean {\n const scope = ReactSharedInternals.T && ReactSharedInternals.B;\n if (!scope && !hook.t)\n return false;\n const previous = hook.t || (hook.c || []).reduce((p: any, a: any) => ([p, undefined, a, hook.s]), null);\n hook.c = null;\n hook.t = [previous, scope, action, previous ? previous[3] : hook.s];\n if (scope)\n enqueue(fiber, scope);\n else\n scheduleUpdate(fiber);\n return true;\n}\nexport function v(hook: Hook, fiber: Fiber, value: any): any {\n if (!hook.d || a) {\n hook.d = true;\n return value;\n }\n else if (!Object.is(value, hook.s))\n enqueue(fiber);\n return hook.s;\n}\nexport function c(root: FiberRoot): void {\n const pending = root.tr;\n if (pending) {\n complete(pending.s);\n pending.s.clear();\n pending.clear();\n }\n}\nexport function t(root: FiberRoot, render: (root: FiberRoot, fibers: Fiber[]) => void): void {\n const pending = root.tr;\n if (!pending?.size)\n return;\n const checkpoint = checkpointCommit(root.r);\n const fibers = [...pending];\n a = true;\n try {\n render(root, fibers);\n for (const fiber of fibers) {\n pending.delete(fiber);\n }\n if (!pending.size) {\n const work = pending.s;\n pending.s = new Set();\n queueCommitEffects(() => complete(work));\n }\n }\n catch (error) {\n if (!isThenable(error))\n throw error;\n rewindCommit(checkpoint);\n for (const scope of pending.s)\n scope.n?.();\n if (pending.w !== error) {\n pending.w = error;\n const retry = () => transitionScope(() => {\n for (const fiber of pending)\n scheduleUpdate(fiber);\n });\n error.then(retry, retry);\n }\n }\n finally {\n a = false;\n }\n}\nfunction complete(work: Set<ActionScope>): void {\n for (const scope of work) {\n scope.v!--;\n finish(scope);\n }\n}\nfunction enqueue(fiber: Fiber, scope?: ActionScope | null): void {\n const root = findRoot(fiber);\n if (!root)\n return;\n let pending = root.tr;\n if (!pending) {\n pending = root.tr = new Set() as NonNullable<FiberRoot[\"tr\"]>;\n pending.s = new Set();\n }\n const fresh = !pending.has(fiber);\n pending.add(fiber);\n if (scope && !pending.s.has(scope)) {\n scope.v = (scope.v || 0) + 1;\n scope.p++;\n pending.s.add(scope);\n }\n if (ReactSharedInternals.F) {\n if (fresh)\n queueCommitEffects(() => scheduleUpdate(fiber));\n }\n else\n scheduleUpdate(fiber);\n}\nexport function r(hook: Hook, reducer: (state: any, action: any) => any): boolean {\n if (!hook.t)\n return false;\n let state = hook.t[3], base = state, pending: any = undefined;\n const stack = [];\n for (let node = hook.t; node; node = node[0])\n stack.push(node);\n while (stack.length) {\n const node = stack.pop()!;\n const skipped = node[1] && !a;\n if (skipped) {\n if (!pending)\n base = state;\n }\n else\n state = reducer(state, node[2]);\n if (pending || skipped)\n pending = [pending, node[1], node[2], base];\n }\n hook.t = pending;\n hook.s = state;\n return true;\n}\n"],
|
|
5
|
-
"mappings": "AACA,SAAS,UAAU,sBAAsB;AACzC,SAAS,cAAgC;AACzC,SAAS,kBAAkB;AAC3B,SAAS,kBAAkB,cAAc,0BAA0B;AACnE,SAAS,4BAA4B;AACrC,SAAS,uBAAuB;AACzB,IAAI,IAAI;AACR,MAAM,IAAI,CAAC,UAA0B,CAAC,CAAC,MAAM,GAAG,IAAI,IAAI,KAAK;AAC9D,SAAU,EAAE,MAAY,OAAc,QAAW;AACnD,QAAM,QAAQ,qBAAqB,KAAK,qBAAqB;AAC7D,MAAI,CAAC,SAAS,CAAC,KAAK;AAChB,WAAO;AACX,QAAM,WAAW,KAAK,MAAM,KAAK,KAAK,CAAA,GAAI,OAAO,CAACA,IAAQC,OAAY,CAACD,IAAG,QAAWC,IAAG,KAAK,CAAC,GAAI,IAAI;AACtG,OAAK,IAAI;AACT,OAAK,IAAI,CAAC,UAAU,OAAO,QAAQ,WAAW,SAAS,CAAC,IAAI,KAAK,CAAC;AAClE,MAAI;AACA,YAAQ,OAAO,KAAK;;AAEpB,mBAAe,KAAK;AACxB,SAAO;AACX;AACM,SAAU,EAAE,MAAY,OAAc,OAAU;AAClD,MAAI,CAAC,KAAK,KAAK,GAAG;AACd,SAAK,IAAI;AACT,WAAO;EACX,WACS,CAAC,OAAO,GAAG,OAAO,KAAK,CAAC;AAC7B,YAAQ,KAAK;AACjB,SAAO,KAAK;AAChB;AACM,SAAU,EAAE,MAAe;AAC7B,QAAM,UAAU,KAAK;AACrB,MAAI,SAAS;AACT,aAAS,QAAQ,CAAC;AAClB,YAAQ,EAAE,MAAK;AACf,YAAQ,MAAK;
|
|
4
|
+
"sourcesContent": ["import type { Fiber, FiberRoot, Hook } from '../core';\nimport { findRoot, scheduleUpdate } from './reconcile';\nimport { finish, type ActionScope } from '../react/action-scope';\nimport { isThenable } from '../core/functions';\nimport { checkpointCommit, rewindCommit, queueCommitEffects } from './commit';\nimport { ReactSharedInternals } from '../react/shared-internals';\nimport { transitionScope } from '../react/hooks';\nexport let a = false;\nexport const p = (fiber: Fiber): boolean => !!fiber.r?.tr?.has(fiber);\nexport function q(hook: Hook, fiber: Fiber, action: any): boolean {\n const scope = ReactSharedInternals.T && ReactSharedInternals.B;\n if (!scope && !hook.t)\n return false;\n const previous = hook.t || (hook.c || []).reduce((p: any, a: any) => ([p, undefined, a, hook.s]), null);\n hook.c = null;\n hook.t = [previous, scope, action, previous ? previous[3] : hook.s];\n if (scope)\n enqueue(fiber, scope);\n else\n scheduleUpdate(fiber);\n return true;\n}\nexport function v(hook: Hook, fiber: Fiber, value: any): any {\n if (!hook.d || a) {\n hook.d = true;\n return value;\n }\n else if (!Object.is(value, hook.s))\n enqueue(fiber);\n return hook.s;\n}\nexport function c(root: FiberRoot): void {\n const pending = root.tr;\n if (pending) {\n complete(pending.s);\n pending.s.clear();\n pending.clear();\n pending.u = undefined;\n }\n}\nexport function t(root: FiberRoot, render: (root: FiberRoot, fibers: Fiber[], update?: () => void) => void): void {\n const pending = root.tr;\n if (!pending?.size)\n return;\n const checkpoint = checkpointCommit(root.r);\n const fibers = [...pending];\n a = true;\n try {\n const update = pending.u;\n render(root, fibers, update);\n if (pending.u === update) pending.u = undefined;\n for (const fiber of fibers) {\n pending.delete(fiber);\n }\n if (!pending.size) {\n const work = pending.s;\n pending.s = new Set();\n queueCommitEffects(() => complete(work));\n }\n }\n catch (error) {\n if (!isThenable(error))\n throw error;\n rewindCommit(checkpoint);\n for (const scope of pending.s)\n scope.n?.(scope);\n if (pending.w !== error) {\n pending.w = error;\n const retry = () => transitionScope(() => {\n for (const fiber of pending)\n scheduleUpdate(fiber);\n });\n error.then(retry, retry);\n }\n }\n finally {\n a = false;\n }\n}\nfunction complete(work: Set<ActionScope>): void {\n for (const scope of work) {\n scope.v!--;\n finish(scope);\n }\n}\nfunction enqueue(fiber: Fiber, scope?: ActionScope | null): void {\n const root = findRoot(fiber);\n if (!root)\n return;\n let pending = root.tr;\n if (!pending) {\n pending = root.tr = new Set() as NonNullable<FiberRoot[\"tr\"]>;\n pending.s = new Set();\n }\n const fresh = !pending.has(fiber);\n pending.add(fiber);\n if (scope && !pending.s.has(scope)) {\n scope.v = (scope.v || 0) + 1;\n scope.p++;\n pending.s.add(scope);\n }\n if (ReactSharedInternals.F) {\n if (fresh)\n queueCommitEffects(() => scheduleUpdate(fiber));\n }\n else\n scheduleUpdate(fiber);\n}\nexport function s(root: FiberRoot, render: () => void): boolean {\n if (!ReactSharedInternals.T) {\n if (root.tr) root.tr.u = undefined;\n return false;\n }\n const scope = ReactSharedInternals.B;\n enqueue(root.r, scope?.o === root ? scope : undefined);\n root.tr!.u = render;\n return true;\n}\nexport function r(hook: Hook, reducer: (state: any, action: any) => any): boolean {\n if (!hook.t)\n return false;\n let state = hook.t[3], base = state, pending: any = undefined;\n const stack = [];\n for (let node = hook.t; node; node = node[0])\n stack.push(node);\n while (stack.length) {\n const node = stack.pop()!;\n const skipped = node[1] && !a;\n if (skipped) {\n if (!pending)\n base = state;\n }\n else\n state = reducer(state, node[2]);\n if (pending || skipped)\n pending = [pending, node[1], node[2], base];\n }\n hook.t = pending;\n hook.s = state;\n return true;\n}\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,UAAU,sBAAsB;AACz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GAAG;AACzB,QAAI,KAAK;AAAI,WAAK,GAAG,IAAI;AACzB,WAAO;EACX;AACA,QAAM,QAAQ,qBAAqB;AACnC,UAAQ,KAAK,GAAG,OAAO,MAAM,OAAO,QAAQ,MAAS;AACrD,OAAK,GAAI,IAAI;AACb,SAAO;AACX;AACM,SAAU,EAAE,MAAY,SAAyC;AACnE,MAAI,CAAC,KAAK;AACN,WAAO;AACX,MAAI,QAAQ,KAAK,EAAE,CAAC,GAAG,OAAO,OAAO,UAAe;AACpD,QAAM,QAAQ,CAAA;AACd,WAAS,OAAO,KAAK,GAAG,MAAM,OAAO,KAAK,CAAC;AACvC,UAAM,KAAK,IAAI;AACnB,SAAO,MAAM,QAAQ;AACjB,UAAM,OAAO,MAAM,IAAG;AACtB,UAAM,UAAU,KAAK,CAAC,KAAK,CAAC;AAC5B,QAAI,SAAS;AACT,UAAI,CAAC;AACD,eAAO;IACf;AAEI,cAAQ,QAAQ,OAAO,KAAK,CAAC,CAAC;AAClC,QAAI,WAAW;AACX,gBAAU,CAAC,SAAS,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,IAAI;EAClD;AACA,OAAK,IAAI;AACT,OAAK,IAAI;AACT,SAAO;AACX;",
|
|
6
6
|
"names": ["p", "a"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/react/action-scope.ts"],
|
|
4
|
-
"sourcesContent": ["import { ReactSharedInternals } from './shared-internals'\nimport { isThenable } from '../core/functions'\n// Action lifetimes are separate from transition types used by ViewTransition.\nexport interface ActionScope {\n v?: number\n n?: () => void\n p: number\n d: Promise<void>\n r: () => void\n e?: unknown\n h?: boolean\n f: boolean\n l: Set<() => void>\n}\n\nexport function trackAction(scope: ActionScope, promise: PromiseLike<unknown>, nested?: ActionScope): void {\n scope.p++\n Promise.resolve(promise).then(() => {\n if (nested?.f) { scope.e = nested.e; scope.f = true }\n finish(scope)\n }, error => {\n scope.e = error\n scope.f = true\n finish(scope)\n })\n}\nexport function finish(scope: ActionScope): void {\n if (--scope.p !== 0) return\n for (const listener of scope.l) listener()\n scope.l.clear()\n scope.r()\n}\nexport function runAction(callback: () => unknown): ActionScope {\n const previous = ReactSharedInternals.B\n let resolve!: () => void\n const done = new Promise<void>(yes => { resolve = yes })\n const scope: ActionScope = { p: 1, d: done, r: resolve, f: false, l: new Set() }\n try {\n const result = withinAction(scope, callback)\n if (isThenable(result)) trackAction(scope, result as PromiseLike<unknown>)\n } catch (error) {\n scope.f = true\n scope.e = error\n } finally {\n finish(scope)\n }\n if (previous && scope.p > 0) trackAction(previous, done, scope)\n return scope\n}\n\nexport function withinAction<T>(scope: ActionScope | null | undefined, callback: () => T): T {\n const previous = ReactSharedInternals.B\n ReactSharedInternals.B = scope\n try { return callback() } finally { ReactSharedInternals.B = previous }\n}\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import type { FiberRoot } from '../core'\nimport { ReactSharedInternals } from './shared-internals'\nimport { isThenable } from '../core/functions'\n// Action lifetimes are separate from transition types used by ViewTransition.\nexport interface ActionScope {\n o?: FiberRoot | null | undefined\n v?: number\n n?: ((scope: ActionScope) => void) | undefined\n p: number\n d: Promise<void>\n r: () => void\n e?: unknown\n h?: boolean\n f: boolean\n l: Set<() => void>\n}\n\nexport function trackAction(scope: ActionScope, promise: PromiseLike<unknown>, nested?: ActionScope): void {\n scope.p++\n Promise.resolve(promise).then(() => {\n if (nested?.f) { scope.e = nested.e; scope.f = true }\n finish(scope)\n }, error => {\n scope.e = error\n scope.f = true\n finish(scope)\n })\n}\nexport function finish(scope: ActionScope): void {\n if (--scope.p !== 0) return\n for (const listener of scope.l) listener()\n scope.l.clear()\n scope.r()\n}\nexport function runAction(callback: () => unknown, owner?: FiberRoot | null, notify?: (scope: ActionScope) => void): ActionScope {\n const previous = ReactSharedInternals.B\n let resolve!: () => void\n const done = new Promise<void>(yes => { resolve = yes })\n const scope: ActionScope = { p: 1, d: done, r: resolve, f: false, l: new Set(), o: owner ?? previous?.o, n: notify }\n try {\n const result = withinAction(scope, callback)\n if (isThenable(result)) trackAction(scope, result as PromiseLike<unknown>)\n } catch (error) {\n scope.f = true\n scope.e = error\n } finally {\n finish(scope)\n }\n if (previous && scope.p > 0) trackAction(previous, done, scope)\n return scope\n}\n\nexport function withinAction<T>(scope: ActionScope | null | undefined, callback: () => T): T {\n const previous = ReactSharedInternals.B\n ReactSharedInternals.B = scope\n try { return callback() } finally { ReactSharedInternals.B = previous }\n}\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,4BAA4B;AACrC,SAAS,kBAAkB;AAerB,SAAU,YAAY,OAAoB,SAA+B,QAAoB;AACjG,QAAM;AACN,UAAQ,QAAQ,OAAO,EAAE,KAAK,MAAK;AACjC,QAAI,QAAQ,GAAG;AAAE,YAAM,IAAI,OAAO;AAAG,YAAM,IAAI;IAAK;AACpD,WAAO,KAAK;EACd,GAAG,WAAQ;AACT,UAAM,IAAI;AACV,UAAM,IAAI;AACV,WAAO,KAAK;EACd,CAAC;AACH;AACM,SAAU,OAAO,OAAkB;AACvC,MAAI,EAAE,MAAM,MAAM;AAAG;AACrB,aAAW,YAAY,MAAM;AAAG,aAAQ;AACxC,QAAM,EAAE,MAAK;AACb,QAAM,EAAC;AACT;AACM,SAAU,UAAU,UAAyB,OAA0B,QAAqC;AAChH,QAAM,WAAW,qBAAqB;AACtC,MAAI;AACJ,QAAM,OAAO,IAAI,QAAc,SAAM;AAAG,cAAU;EAAI,CAAC;AACvD,QAAM,QAAqB,EAAE,GAAG,GAAG,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,oBAAI,IAAG,GAAI,GAAG,SAAS,UAAU,GAAG,GAAG,OAAM;AAClH,MAAI;AACF,UAAM,SAAS,aAAa,OAAO,QAAQ;AAC3C,QAAI,WAAW,MAAM;AAAG,kBAAY,OAAO,MAA8B;EAC3E,SAAS,OAAO;AACd,UAAM,IAAI;AACV,UAAM,IAAI;EACZ;AACE,WAAO,KAAK;EACd;AACA,MAAI,YAAY,MAAM,IAAI;AAAG,gBAAY,UAAU,MAAM,KAAK;AAC9D,SAAO;AACT;AAEM,SAAU,aAAgB,OAAuC,UAAiB;AACtF,QAAM,WAAW,qBAAqB;AACtC,uBAAqB,IAAI;AACzB,MAAI;AAAE,WAAO,SAAQ;EAAG;AAAY,yBAAqB,IAAI;EAAS;AACxE;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/rspack/index.ts"],
|
|
4
|
+
"sourcesContent": ["export { redact, default } from '../webpack/index'\nexport type { RedactOptions, RedactPreset, RedactFeatures } from '../webpack/index'\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,QAAQ,WAAAA,gBAAe;",
|
|
6
|
+
"names": ["default"]
|
|
7
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/server/bootstrap-script.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Inline client runtime injected into the streamed HTML. Two jobs:\n *\n * 1. Reveal suspense boundaries as their resolved chunks arrive ($RC).\n * 2. Capture interaction events from the moment the shell is visible so the\n * main bundle can replay them against un-hydrated subtrees ($RE_q buffer).\n *\n * Wire format:\n * Fallback: <!--$?ID--><
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { boundaryId, segmentId, scriptId } from './stream-ids.js'\n/**\n * Inline client runtime injected into the streamed HTML. Two jobs:\n *\n * 1. Reveal suspense boundaries as their resolved chunks arrive ($RC).\n * 2. Capture interaction events from the moment the shell is visible so the\n * main bundle can replay them against un-hydrated subtrees ($RE_q buffer).\n *\n * Wire format:\n * Fallback: <!--$?ID--><template id=\"PREFIXB:HEX\"></template>fallback<!--/$-->\n * Resolved: a context-specific hidden segment followed by $RC(boundaryID, segmentID).\n * Reveal removes the entire fallback range, moves the segment's\n * children inline, and rewrites the opening comment to <!--$ID-->.\n *\n * Client hydration calls $RH(boundaryID, cb) to register a callback invoked once the\n * boundary has been revealed (or immediately, if it was already revealed).\n *\n * Early-event buffering: before the main bundle is parsed, we attach capture\n * listeners for a small set of interactive events and push them into a buffer.\n * The bundle drains and replays them via the replay code in @tanstack/redact/dom.\n */\nimport { escapeAttr } from './escape.js'\n\nexport const BOUNDARY_REVEAL_RUNTIME =\n `(function(){` +\n // All independently prefixed streams in a document share one reveal registry.\n `if(!window.$RH){` +\n `var c={},r=new Map;` +\n `function place(n,v){` +\n `var a=document.head.querySelectorAll('link[rel=\"stylesheet\"][data-precedence],style[data-precedence]'),t=a.length?a[a.length-1]:null,p=t;` +\n `for(var k=0;k<a.length;k++){if(a[k].getAttribute(\"data-precedence\")===v)p=a[k];else if(p!==t)break}` +\n `document.head.insertBefore(n,p?p.nextSibling:document.head.firstChild);` +\n `}` +\n `function drop(s){var w=/^(TBODY|TR|COLGROUP|mtext)$/.test(s.nodeName)?s.closest(\"table,math\"):s;w.remove()}` +\n `function load(n,e){return new Promise(function(y,x){n.onload=function(){e.p=null;y()};n.onerror=function(){e.p=null;x()}})}` +\n `window.$RH=function(i,f){` +\n `if(!document.getElementById(i))f();` +\n `else{c[i]=f;return function(){if(c[i]===f)delete c[i]}}` +\n `};` +\n `window.$RC=function(i,j){` +\n `var s=document.getElementById(j),b=document.getElementById(i);` +\n `if(!b){delete c[i];if(s)drop(s);return}if(!s)return;` +\n `var a=document.querySelectorAll('body link[rel=\"stylesheet\"][data-precedence],body style[data-precedence]');` +\n `for(var j=0;j<a.length;j++){` +\n `var n=a[j];if(n.getAttribute(\"media\")===\"not all\")n.removeAttribute(\"media\");place(n,n.getAttribute(\"data-precedence\"));` +\n `}` +\n `var p=b.parentNode,m=b.previousSibling;` +\n `var n=b.nextSibling,d=0;while(n){var t=n.nextSibling;if(n.nodeType===8){if(n.data===\"/$\"){if(d===0)break;d--}else if(/^\\\\$(?:[?!E~])?\\\\d*$/.test(n.data))d++}p.removeChild(n);n=t}` +\n `while(s.firstChild)p.insertBefore(s.firstChild,b);` +\n `drop(s);` +\n `p.removeChild(b);` +\n `if(m&&m.nodeType===8)m.data=m.data.replace(\"$?\",\"$\");` +\n `if(c[i]){var f=c[i];delete c[i];f()}` +\n `};` +\n `window.$RR=function(i,s,d){` +\n `var w=[];for(var j=0;j<d.length;j++){` +\n `var a=d[j],e=r.get(a[0]);if(!e){` +\n `var n=null,l=document.querySelectorAll('link[rel=\"stylesheet\"]');for(var k=0;k<l.length;k++)if(l[k].getAttribute(\"href\")===a[0]){n=l[k];break}` +\n `e={n:n,p:null};r.set(a[0],e);if(!n){` +\n `n=e.n=document.createElement(\"link\");n.rel=\"stylesheet\";n.href=a[0];n.setAttribute(\"data-precedence\",a[1]);` +\n `for(var k=2;k<a.length;k+=2)n.setAttribute(a[k],a[k+1]);` +\n `e.p=load(n,e);place(n,a[1]);` +\n `}` +\n `}` +\n `var m=e.n.getAttribute(\"media\");if(e.p&&(!m||matchMedia(m).matches))w.push(e.p);` +\n `}` +\n `Promise.all(w).then(function(){$RC(i,s)},function(){$RB(i,1,s)});` +\n `};` +\n `window.$RB=function(i,e,j){` +\n `var s=j&&document.getElementById(j);if(s)drop(s);` +\n `var b=document.getElementById(i);if(!b){delete c[i];return}` +\n `var m=b.previousSibling;if(m&&m.nodeType===8)m.data=(e?\"$E\":\"$!\")+m.data.replace(/^\\\\$[?~!E]?/,\"\");` +\n `b.removeAttribute(\"id\");if(c[i]){var f=c[i];delete c[i];f()}` +\n `};` +\n `}` +\n `var q=[];window.$RE_q=q;` +\n `var evs=[\"click\",\"submit\",\"input\",\"change\",\"keydown\"];` +\n `function h(e){q.push([e.type,e.target,e.timeStamp])}` +\n `for(var j=0;j<evs.length;j++)document.addEventListener(evs[j],h,true);` +\n `window.$RE_stop=function(){for(var j=0;j<evs.length;j++)document.removeEventListener(evs[j],h,true)};` +\n `})();`\n\nexport function injectBootstrapScript(nonce?: string): string {\n const n = nonce ? ` nonce=\"${escapeAttr(nonce)}\"` : ''\n return `<script${n}>${BOUNDARY_REVEAL_RUNTIME}</script>`\n}\n\nexport function revealScript(id: number, nonce?: string, styles?: string[][], identifierPrefix = ''): string {\n const n = nonce ? ` nonce=\"${escapeAttr(nonce)}\"` : ''\n const b = scriptId(boundaryId(id, identifierPrefix)), s = scriptId(segmentId(id, identifierPrefix))\n return `<script${n}>${styles?.length ? `$RR(${b},${s},${JSON.stringify(styles).replace(/</g, '\\\\u003c')})` : `$RC(${b},${s})`}</script>`\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,YAAY,WAAW,gBAAgB;AAqBhD,SAAS,kBAAkB;AAEpB,MAAM,0BACX;AA0DK,SAAS,sBAAsB,OAAwB;AAC5D,QAAM,IAAI,QAAQ,WAAW,WAAW,KAAK,CAAC,MAAM;AACpD,SAAO,UAAU,CAAC,IAAI,uBAAuB;AAC/C;AAEO,SAAS,aAAa,IAAY,OAAgB,QAAqB,mBAAmB,IAAY;AAC3G,QAAM,IAAI,QAAQ,WAAW,WAAW,KAAK,CAAC,MAAM;AACpD,QAAM,IAAI,SAAS,WAAW,IAAI,gBAAgB,CAAC,GAAG,IAAI,SAAS,UAAU,IAAI,gBAAgB,CAAC;AAClG,SAAO,UAAU,CAAC,IAAI,QAAQ,SAAS,OAAO,CAAC,IAAI,CAAC,IAAI,KAAK,UAAU,MAAM,EAAE,QAAQ,MAAM,SAAS,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG;AAC/H;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -8,8 +8,7 @@ import { resourceHintDispatcher } from "../core/resource-hints.js";
|
|
|
8
8
|
import { createResourceHints } from "./resource-hints.js";
|
|
9
9
|
let frame = null;
|
|
10
10
|
resourceHintDispatcher.emit = (kind, href, options) => {
|
|
11
|
-
if (!frame)
|
|
12
|
-
return false;
|
|
11
|
+
if (!frame) return false;
|
|
13
12
|
(frame.resources ||= createResourceHints(!!frame.shellFlushed, frame.styleNonce)).add(kind, href, options);
|
|
14
13
|
return true;
|
|
15
14
|
};
|
|
@@ -36,21 +35,17 @@ function endSSR(previous) {
|
|
|
36
35
|
frame = previous?.frame ?? null;
|
|
37
36
|
}
|
|
38
37
|
function pushContext(context, value) {
|
|
39
|
-
if (!frame)
|
|
40
|
-
throw new Error(process.env.NODE_ENV !== "production" ? "pushContext called outside SSR" : "");
|
|
38
|
+
if (!frame) throw new Error(process.env.NODE_ENV !== "production" ? "pushContext called outside SSR" : "");
|
|
41
39
|
frame.contextStack.push({ context, prev: context._currentValue });
|
|
42
40
|
context._currentValue = value;
|
|
43
41
|
}
|
|
44
42
|
function popContext(context) {
|
|
45
|
-
if (!frame)
|
|
46
|
-
return;
|
|
43
|
+
if (!frame) return;
|
|
47
44
|
const top = frame.contextStack.pop();
|
|
48
|
-
if (top && top.context === context)
|
|
49
|
-
context._currentValue = top.prev;
|
|
45
|
+
if (top && top.context === context) context._currentValue = top.prev;
|
|
50
46
|
}
|
|
51
47
|
function snapshotContexts() {
|
|
52
|
-
if (!frame)
|
|
53
|
-
return [];
|
|
48
|
+
if (!frame) return [];
|
|
54
49
|
const out = [];
|
|
55
50
|
for (const entry of frame.contextStack) {
|
|
56
51
|
out.push({ context: entry.context, value: entry.context._currentValue });
|
|
@@ -58,11 +53,9 @@ function snapshotContexts() {
|
|
|
58
53
|
return out;
|
|
59
54
|
}
|
|
60
55
|
function applyContextSnapshot(snapshot) {
|
|
61
|
-
for (const { context, value } of snapshot)
|
|
62
|
-
pushContext(context, value);
|
|
56
|
+
for (const { context, value } of snapshot) pushContext(context, value);
|
|
63
57
|
return () => {
|
|
64
|
-
for (let i = snapshot.length - 1; i >= 0; i--)
|
|
65
|
-
popContext(snapshot[i].context);
|
|
58
|
+
for (let i = snapshot.length - 1; i >= 0; i--) popContext(snapshot[i].context);
|
|
66
59
|
};
|
|
67
60
|
}
|
|
68
61
|
const ssrDispatcher = {
|
|
@@ -104,8 +97,7 @@ const ssrDispatcher = {
|
|
|
104
97
|
useDebugValue() {
|
|
105
98
|
},
|
|
106
99
|
useId() {
|
|
107
|
-
if (!frame)
|
|
108
|
-
return ":r0:";
|
|
100
|
+
if (!frame) return ":r0:";
|
|
109
101
|
const local = frame.localId++;
|
|
110
102
|
const tree = frame.treeId;
|
|
111
103
|
return "_" + frame.identifierPrefix + "R_" + (tree ^ leadingBit(tree)).toString(32) + (local ? "H" + local.toString(32) : "") + "_";
|
|
@@ -131,10 +123,8 @@ const ssrDispatcher = {
|
|
|
131
123
|
return getServerSnapshot ? getServerSnapshot() : getSnapshot();
|
|
132
124
|
},
|
|
133
125
|
use(resource) {
|
|
134
|
-
if (resource == null)
|
|
135
|
-
|
|
136
|
-
if (isBrowserToken(resource))
|
|
137
|
-
throw browserError(resource);
|
|
126
|
+
if (resource == null) throw new Error("use() received null or undefined");
|
|
127
|
+
if (isBrowserToken(resource)) throw browserError(resource);
|
|
138
128
|
if (resource.$$typeof === REACT_CONTEXT_TYPE) {
|
|
139
129
|
return resource._currentValue;
|
|
140
130
|
}
|
|
@@ -155,3 +145,4 @@ export {
|
|
|
155
145
|
snapshotContexts,
|
|
156
146
|
ssrDispatcher
|
|
157
147
|
};
|
|
148
|
+
//# sourceMappingURL=dispatcher.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/server/dispatcher.ts"],
|
|
4
|
-
"sourcesContent": ["import { isFunction } from '../core/functions'\nimport { readThenable } from '../react/thenable'\nimport { idleFormStatus } from '../react/form-state'\nimport { ReactSharedInternals, REACT_CONTEXT_TYPE } from '../react'\nimport { isBrowserToken, browserError } from '../core/browser'\nimport { resourceHintDispatcher } from '../core/resource-hints'\nimport { createResourceHints, type ResourceScope } from './resource-hints'\n\nexport interface SSRFrame {\n
|
|
5
|
-
"mappings": "AAAA,SAAS,kBAAkB;AAC3B,SAAS,oBAAoB;AAC7B,SAAS,sBAAsB;AAC/B,SAAS,sBAAsB,0BAA0B;AACzD,SAAS,gBAAgB,oBAAoB;AAC7C,SAAS,8BAA8B;AACvC,SAAS,2BAA+C;
|
|
4
|
+
"sourcesContent": ["import { leadingBit } from '../dom/react-ids.js'\nimport { isFunction } from '../core/functions.js'\nimport { readThenable } from '../react/thenable.js'\nimport { idleFormStatus } from '../react/form-state.js'\nimport { ReactSharedInternals, REACT_CONTEXT_TYPE } from '../react/index.js'\nimport { isBrowserToken, browserError } from '../core/browser.js'\nimport { resourceHintDispatcher } from '../core/resource-hints.js'\nimport { createResourceHints, type ResourceScope } from './resource-hints.js'\n\nexport interface SSRFrame {\n treeId: bigint\n localId: number\n identifierPrefix: string\n contextStack: Array<{ context: any; prev: any }>\n resources?: ReturnType<typeof createResourceHints>\n shellFlushed?: boolean\n styleNonce?: string | undefined\n}\n\nlet frame: SSRFrame | null = null\n\nresourceHintDispatcher.emit = (kind, href, options) => {\n if (!frame) return false\n ;(frame.resources ||= createResourceHints(!!frame.shellFlushed, frame.styleNonce)).add(kind, href, options)\n return true\n}\n\nexport function beginSSR(identifierPrefix = '', nextFrame?: SSRFrame) {\n const previous = { frame, dispatcher: ReactSharedInternals.H }\n frame = nextFrame ?? { treeId: 1n, localId: 0, identifierPrefix, contextStack: [] }\n ReactSharedInternals.H = ssrDispatcher as any\n return previous\n}\n\nexport function currentSSRFrame(): SSRFrame {\n return frame!\n}\n\nexport function recordHostResource(type: string, props: any, scope?: ResourceScope): boolean {\n return !!frame && (frame.resources ||= createResourceHints(!!frame.shellFlushed, frame.styleNonce)).addHost(type, props, scope)\n}\n\nexport function endSSR(previous?: ReturnType<typeof beginSSR>): void {\n // Restore any remaining pushed contexts (defensive)\n if (frame) {\n for (let i = frame.contextStack.length - 1; i >= 0; i--) {\n const { context, prev } = frame.contextStack[i]!\n context._currentValue = prev\n }\n }\n // Only synchronous renders restore their caller. A stream can finish\n // after its caller has returned, so it must not reinstall that dispatcher.\n ReactSharedInternals.H = previous?.dispatcher ?? null\n frame = previous?.frame ?? null\n}\n\nexport function pushContext(context: any, value: any): void {\n if (!frame) throw new Error(process.env.NODE_ENV !== 'production' ? 'pushContext called outside SSR' : '')\n frame.contextStack.push({ context, prev: context._currentValue })\n context._currentValue = value\n}\n\nexport function popContext(context: any): void {\n if (!frame) return\n const top = frame.contextStack.pop()\n if (top && top.context === context) context._currentValue = top.prev\n}\n\nexport type ContextSnapshot = Array<{ context: any; value: any }>\n\nexport function snapshotContexts(): ContextSnapshot {\n if (!frame) return []\n const out: ContextSnapshot = []\n for (const entry of frame.contextStack) {\n out.push({ context: entry.context, value: entry.context._currentValue })\n }\n return out\n}\n\n/**\n * Push snapshot values and return a function that pops them.\n * Called when we re-render a suspended boundary so it sees the same provider\n * values that were active at suspension time.\n */\nexport function applyContextSnapshot(snapshot: ContextSnapshot): () => void {\n for (const { context, value } of snapshot) pushContext(context, value)\n return () => {\n for (let i = snapshot.length - 1; i >= 0; i--) popContext(snapshot[i]!.context)\n }\n}\n\nexport const ssrDispatcher = {\n useCacheRefresh() {\n return () => { throw new Error('Refreshing the cache is not supported during server rendering.') }\n },\n useState<S>(initial: S | (() => S)) {\n const v = isFunction(initial) ? (initial as () => S)() : initial\n return [v, (() => {}) as any] as [S, any]\n },\n useReducer<S, A>(_reducer: (s: S, a: A) => S, initialArg: any, init?: (a: any) => S) {\n const v = init ? init(initialArg) : initialArg\n return [v, (() => {}) as any]\n },\n useEffect() {\n // noop on server\n },\n useLayoutEffect() {\n // noop on server\n },\n useInsertionEffect() {\n // noop on server\n },\n useRef<T>(initial: T) {\n return { current: initial }\n },\n useMemo<T>(factory: () => T) {\n return factory()\n },\n useCallback<T extends Function>(fn: T) {\n return fn\n },\n useContext<T>(ctx: any): T {\n return ctx._currentValue\n },\n useImperativeHandle() {\n // noop on server\n },\n useDebugValue() {\n // noop\n },\n useId(): string {\n if (!frame) return ':r0:'\n const local = frame.localId++\n const tree = frame.treeId\n return '_' + frame.identifierPrefix + 'R_' + (tree ^ leadingBit(tree)).toString(32) + (local ? 'H' + local.toString(32) : '') + '_'\n },\n useTransition(): [boolean, (fn: () => void) => void] {\n return [false, (fn) => fn()]\n },\n useActionState<S, P>(_action: (state: Awaited<S>, payload: P) => S | Promise<S>, initial: Awaited<S>): [Awaited<S>, (payload: P) => void, boolean] {\n return [initial, () => {}, false]\n },\n useOptimistic<S, A>(state: S): [S, (action: A) => void] {\n return [state, () => {}]\n },\n useFormStatus() { return idleFormStatus },\n useDeferredValue<T>(v: T): T {\n return v\n },\n useSyncExternalStore<T>(\n _subscribe: (cb: () => void) => () => void,\n getSnapshot: () => T,\n getServerSnapshot?: () => T,\n ): T {\n return getServerSnapshot ? getServerSnapshot() : getSnapshot()\n },\n use<T>(resource: any): T {\n if (resource == null) throw new Error('use() received null or undefined')\n if (isBrowserToken(resource)) throw browserError(resource)\n if (resource.$$typeof === REACT_CONTEXT_TYPE) {\n return resource._currentValue\n }\n if (isFunction(resource.then)) {\n return readThenable(resource) as T\n }\n throw new Error('use() expected a Promise or Context')\n },\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,kBAAkB;AAC3B,SAAS,kBAAkB;AAC3B,SAAS,oBAAoB;AAC7B,SAAS,sBAAsB;AAC/B,SAAS,sBAAsB,0BAA0B;AACzD,SAAS,gBAAgB,oBAAoB;AAC7C,SAAS,8BAA8B;AACvC,SAAS,2BAA+C;AAYxD,IAAI,QAAyB;AAE7B,uBAAuB,OAAO,CAAC,MAAM,MAAM,YAAY;AACrD,MAAI,CAAC,MAAO,QAAO;AAClB,GAAC,MAAM,cAAc,oBAAoB,CAAC,CAAC,MAAM,cAAc,MAAM,UAAU,GAAG,IAAI,MAAM,MAAM,OAAO;AAC1G,SAAO;AACT;AAEO,SAAS,SAAS,mBAAmB,IAAI,WAAsB;AACpE,QAAM,WAAW,EAAE,OAAO,YAAY,qBAAqB,EAAE;AAC7D,UAAQ,aAAa,EAAE,QAAQ,IAAI,SAAS,GAAG,kBAAkB,cA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C,GAAG,KAAK;AAAA,EAClC;AAAA,EACA,cAAoB,OAAoC;AACtD,WAAO,CAAC,OAAO,MAAM;AAAA,IAAC,CAAC;AAAA,EACzB;AAAA,EACA,gBAAgB;AAAE,WAAO;AAAA,EAAe;AAAA,EACxC,iBAAoB,GAAS;AAC3B,WAAO;AAAA,EACT;AAAA,EACA,qBACE,YACA,aACA,mBACG;AACH,WAAO,oBAAoB,kBAAkB,IAAI,YAAY;AAAA,EAC/D;AAAA,EACA,IAAO,UAAkB;AACvB,QAAI,YAAY,KAAM,OAAM,IAAI,MAAM,kCAAkC;AACxE,QAAI,eAAe,QAAQ,EAAG,OAAM,aAAa,QAAQ;AACzD,QAAI,SAAS,aAAa,oBAAoB;AAC5C,aAAO,SAAS;AAAA,IAClB;AACA,QAAI,WAAW,SAAS,IAAI,GAAG;AAC7B,aAAO,aAAa,QAAQ;AAAA,IAC9B;AACA,UAAM,IAAI,MAAM,qCAAqC;AAAA,EACvD;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,21 +1,13 @@
|
|
|
1
1
|
import { escapeAttr } from "./escape.js";
|
|
2
2
|
function childInsertionContext(tag, props, parent) {
|
|
3
|
-
if (tag === "svg")
|
|
4
|
-
|
|
5
|
-
if (tag === "
|
|
6
|
-
|
|
7
|
-
if (parent === "
|
|
8
|
-
|
|
9
|
-
if (
|
|
10
|
-
|
|
11
|
-
if (parent === "mtext" && (tag === "mglyph" || tag === "malignmark"))
|
|
12
|
-
return "math";
|
|
13
|
-
if (parent === "svg" || parent === "math")
|
|
14
|
-
return parent;
|
|
15
|
-
if (tag === "table" || tag === "tr" || tag === "colgroup")
|
|
16
|
-
return tag;
|
|
17
|
-
if (tag === "tbody" || tag === "thead" || tag === "tfoot")
|
|
18
|
-
return "tbody";
|
|
3
|
+
if (tag === "svg") return "svg";
|
|
4
|
+
if (tag === "math") return "math";
|
|
5
|
+
if (parent === "svg" && (tag === "foreignObject" || tag === "desc" || tag === "title") || tag === "annotation-xml" && /^(text\/html|application\/xhtml\+xml)$/i.test(props.encoding ?? "")) return "html";
|
|
6
|
+
if (parent === "math" && /^(mi|mo|mn|ms|mtext)$/.test(tag)) return "mtext";
|
|
7
|
+
if (parent === "mtext" && (tag === "mglyph" || tag === "malignmark")) return "math";
|
|
8
|
+
if (parent === "svg" || parent === "math") return parent;
|
|
9
|
+
if (tag === "table" || tag === "tr" || tag === "colgroup") return tag;
|
|
10
|
+
if (tag === "tbody" || tag === "thead" || tag === "tfoot") return "tbody";
|
|
19
11
|
return "html";
|
|
20
12
|
}
|
|
21
13
|
function segmentHtml(content, id, context) {
|
|
@@ -30,3 +22,4 @@ export {
|
|
|
30
22
|
childInsertionContext,
|
|
31
23
|
segmentHtml
|
|
32
24
|
};
|
|
25
|
+
//# sourceMappingURL=insertion-context.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/server/insertion-context.ts"],
|
|
4
|
+
"sourcesContent": ["import { escapeAttr } from './escape.js'\n\n// The context belongs to the *parent* of a suspended subtree. It must survive\n// retries: looking at the first resolved child cannot recover HTML insertion mode.\nexport type InsertionContext = 'html' | 'svg' | 'math' | 'mtext' | 'table' | 'tbody' | 'tr' | 'colgroup'\n\nexport function childInsertionContext(tag: string, props: Record<string, any>, parent: InsertionContext): InsertionContext {\n if (tag === 'svg') return 'svg'\n if (tag === 'math') return 'math'\n if ((parent === 'svg' && (tag === 'foreignObject' || tag === 'desc' || tag === 'title')) || (tag === 'annotation-xml' && /^(text\\/html|application\\/xhtml\\+xml)$/i.test(props.encoding ?? ''))) return 'html'\n // WHATWG tree-construction dispatcher: MathML text integration points use\n // HTML rules except for mglyph/malignmark. Keep that mixed context on retries.\n if (parent === 'math' && /^(mi|mo|mn|ms|mtext)$/.test(tag)) return 'mtext'\n if (parent === 'mtext' && (tag === 'mglyph' || tag === 'malignmark')) return 'math'\n if (parent === 'svg' || parent === 'math') return parent\n if (tag === 'table' || tag === 'tr' || tag === 'colgroup') return tag\n if (tag === 'tbody' || tag === 'thead' || tag === 'tfoot') return 'tbody'\n return 'html'\n}\n\nexport function segmentHtml(content: string, id: string, context: InsertionContext): string {\n const mathText = context === 'mtext'\n const nested = mathText || context === 'tbody' || context === 'tr' || context === 'colgroup'\n const tag = context === 'html' ? 'div' : context\n const hidden = nested ? '' : context === 'svg' || context === 'math' ? ' aria-hidden=\"true\" style=\"display:none\"' : ' hidden'\n const wrapper = mathText ? '<math style=\"display:none\">' : '<table hidden>'\n return `${nested ? wrapper : ''}<${tag}${hidden} id=\"${escapeAttr(id)}\">${content}</${tag}>${nested ? mathText ? '</math>' : '</table>' : ''}`\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,kBAAkB;AAMpB,SAAS,sBAAsB,KAAa,OAA4B,QAA4C;AACzH,MAAI,QAAQ,MAAO,QAAO;AAC1B,MAAI,QAAQ,OAAQ,QAAO;AAC3B,MAAK,WAAW,UAAU,QAAQ,mBAAmB,QAAQ,UAAU,QAAQ,YAAc,QAAQ,oBAAoB,0CAA0C,KAAK,MAAM,YAAY,EAAE,EAAI,QAAO;AAGvM,MAAI,WAAW,UAAU,wBAAwB,KAAK,GAAG,EAAG,QAAO;AACnE,MAAI,WAAW,YAAY,QAAQ,YAAY,QAAQ,cAAe,QAAO;AAC7E,MAAI,WAAW,SAAS,WAAW,OAAQ,QAAO;AAClD,MAAI,QAAQ,WAAW,QAAQ,QAAQ,QAAQ,WAAY,QAAO;AAClE,MAAI,QAAQ,WAAW,QAAQ,WAAW,QAAQ,QAAS,QAAO;AAClE,SAAO;AACT;AAEO,SAAS,YAAY,SAAiB,IAAY,SAAmC;AAC1F,QAAM,WAAW,YAAY;AAC7B,QAAM,SAAS,YAAY,YAAY,WAAW,YAAY,QAAQ,YAAY;AAClF,QAAM,MAAM,YAAY,SAAS,QAAQ;AACzC,QAAM,SAAS,SAAS,KAAK,YAAY,SAAS,YAAY,SAAS,6CAA6C;AACpH,QAAM,UAAU,WAAW,gCAAgC;AAC3D,SAAO,GAAG,SAAS,UAAU,EAAE,IAAI,GAAG,GAAG,MAAM,QAAQ,WAAW,EAAE,CAAC,KAAK,OAAO,KAAK,GAAG,IAAI,SAAS,WAAW,YAAY,aAAa,EAAE;AAC9I;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/server/stream-ids.ts"],
|
|
4
|
+
"sourcesContent": ["// Match Fizz's transport identifiers. Hook IDs and boundary comment numbers are\n// separate namespaces; only the DOM transport IDs use this prefixed hex scheme.\nexport const boundaryId = (id: number, prefix = ''): string => prefix + 'B:' + id.toString(16)\nexport const segmentId = (id: number, prefix = ''): string => prefix + 'S:' + id.toString(16)\nexport const scriptId = (id: string): string => JSON.stringify(id).replace(/</g, '\\\\u003c')\n"],
|
|
5
|
+
"mappings": "AAEO,MAAM,aAAa,CAAC,IAAY,SAAS,OAAe,SAAS,OAAO,GAAG,SAAS,EAAE;AACtF,MAAM,YAAY,CAAC,IAAY,SAAS,OAAe,SAAS,OAAO,GAAG,SAAS,EAAE;AACrF,MAAM,WAAW,CAAC,OAAuB,KAAK,UAAU,EAAE,EAAE,QAAQ,MAAM,SAAS;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/server/stream.d.ts
CHANGED
|
@@ -32,9 +32,8 @@ export interface PipeableWritable {
|
|
|
32
32
|
}
|
|
33
33
|
export interface OrchestratorState {
|
|
34
34
|
nextId: number;
|
|
35
|
-
pending:
|
|
35
|
+
pending: (task?: Promise<void>) => Promise<void> | undefined;
|
|
36
36
|
closed: boolean;
|
|
37
|
-
errored: unknown | null;
|
|
38
37
|
aborted: boolean;
|
|
39
38
|
reason: unknown;
|
|
40
39
|
abort: (reason?: unknown) => void;
|