@bleedingdev/tanstack-redact 0.2.1 → 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.
Files changed (120) hide show
  1. package/dist/bundler-core/resolution.d.ts +31 -0
  2. package/dist/bundler-core/resolution.js +80 -0
  3. package/dist/bundler-core/resolution.js.map +7 -0
  4. package/dist/bundler-core/selection.d.ts +89 -0
  5. package/dist/bundler-core/selection.js +103 -0
  6. package/dist/bundler-core/selection.js.map +7 -0
  7. package/dist/core/devtools.d.ts +1 -1
  8. package/dist/core/devtools.js +1 -0
  9. package/dist/core/devtools.js.map +2 -2
  10. package/dist/core/functions.js +1 -0
  11. package/dist/core/functions.js.map +2 -2
  12. package/dist/core/internal.d.ts +5 -4
  13. package/dist/core/internal.js +4 -3
  14. package/dist/core/internal.js.map +2 -2
  15. package/dist/core/types.d.ts +2 -2
  16. package/dist/core/types.js +1 -0
  17. package/dist/core/types.js.map +1 -1
  18. package/dist/dom/devtools.d.ts +5 -5
  19. package/dist/dom/devtools.js +1 -0
  20. package/dist/dom/devtools.js.map +2 -2
  21. package/dist/dom/dispatcher.d.ts +1 -1
  22. package/dist/dom/dispatcher.js +1 -0
  23. package/dist/dom/dispatcher.js.map +3 -3
  24. package/dist/dom/document-metadata.d.ts +1 -1
  25. package/dist/dom/document-metadata.js +3 -1
  26. package/dist/dom/document-metadata.js.map +2 -2
  27. package/dist/dom/dom.js +1 -1
  28. package/dist/dom/dom.js.map +2 -2
  29. package/dist/dom/features/class/full.js +25 -32
  30. package/dist/dom/features/class/full.js.map +2 -2
  31. package/dist/dom/features/class/stub.js +1 -0
  32. package/dist/dom/features/class/stub.js.map +2 -2
  33. package/dist/dom/features/hydration/full.d.ts +6 -6
  34. package/dist/dom/features/hydration/full.js +20 -29
  35. package/dist/dom/features/hydration/full.js.map +2 -2
  36. package/dist/dom/features/hydration/stub.d.ts +7 -2
  37. package/dist/dom/features/hydration/stub.js +1 -0
  38. package/dist/dom/features/hydration/stub.js.map +2 -2
  39. package/dist/dom/features/lazy/full.js +1 -0
  40. package/dist/dom/features/lazy/full.js.map +2 -2
  41. package/dist/dom/features/suspense/full.d.ts +4 -1
  42. package/dist/dom/features/suspense/full.js +22 -161
  43. package/dist/dom/features/suspense/full.js.map +2 -2
  44. package/dist/dom/features/suspense-hydration/full.d.ts +8 -0
  45. package/dist/dom/features/suspense-hydration/full.js +147 -0
  46. package/dist/dom/features/suspense-hydration/full.js.map +7 -0
  47. package/dist/dom/features/suspense-hydration/index.d.ts +1 -0
  48. package/dist/dom/features/suspense-hydration/index.js +2 -0
  49. package/dist/dom/features/suspense-hydration/index.js.map +7 -0
  50. package/dist/dom/features/suspense-hydration/stub.d.ts +2 -0
  51. package/dist/dom/features/suspense-hydration/stub.js +9 -0
  52. package/dist/dom/features/suspense-hydration/stub.js.map +7 -0
  53. package/dist/dom/features/suspense-runtime/stub.js +1 -0
  54. package/dist/dom/features/suspense-runtime/stub.js.map +2 -2
  55. package/dist/dom/profiling.d.ts +36 -0
  56. package/dist/dom/profiling.js +9 -0
  57. package/dist/dom/profiling.js.map +7 -0
  58. package/dist/dom/react-ids.js +1 -0
  59. package/dist/dom/react-ids.js.map +2 -2
  60. package/dist/dom/reconcile.d.ts +4 -5
  61. package/dist/dom/reconcile.js +102 -144
  62. package/dist/dom/reconcile.js.map +2 -2
  63. package/dist/dom/resources.js +1 -0
  64. package/dist/dom/resources.js.map +2 -2
  65. package/dist/dom/root-internal.d.ts +1 -1
  66. package/dist/dom/root-internal.js +4 -3
  67. package/dist/dom/root-internal.js.map +2 -2
  68. package/dist/dom/root.d.ts +2 -2
  69. package/dist/dom/root.js +1 -0
  70. package/dist/dom/root.js.map +2 -2
  71. package/dist/dom/synthetic-event.js +6 -4
  72. package/dist/dom/synthetic-event.js.map +2 -2
  73. package/dist/dom/transitions.d.ts +1 -1
  74. package/dist/dom/transitions.js +1 -0
  75. package/dist/dom/transitions.js.map +2 -2
  76. package/dist/react/action-scope.d.ts +1 -1
  77. package/dist/react/action-scope.js +1 -0
  78. package/dist/react/action-scope.js.map +2 -2
  79. package/dist/rspack/index.d.ts +2 -0
  80. package/dist/rspack/index.js +6 -0
  81. package/dist/rspack/index.js.map +7 -0
  82. package/dist/server/bootstrap-script.js +1 -0
  83. package/dist/server/bootstrap-script.js.map +2 -2
  84. package/dist/server/dispatcher.js +11 -20
  85. package/dist/server/dispatcher.js.map +2 -2
  86. package/dist/server/insertion-context.js +9 -16
  87. package/dist/server/insertion-context.js.map +7 -0
  88. package/dist/server/stream-ids.js +1 -0
  89. package/dist/server/stream-ids.js.map +7 -0
  90. package/dist/server/stream.d.ts +1 -2
  91. package/dist/server/stream.js +106 -122
  92. package/dist/server/stream.js.map +2 -2
  93. package/dist/server/walk.js +69 -72
  94. package/dist/server/walk.js.map +3 -3
  95. package/dist/vite/index.d.ts +5 -99
  96. package/dist/vite/index.js +56 -179
  97. package/dist/vite/index.js.map +2 -2
  98. package/dist/webpack/index.d.ts +46 -0
  99. package/dist/webpack/index.js +102 -0
  100. package/dist/webpack/index.js.map +7 -0
  101. package/dist/webpack/react18-loader.cjs +25 -0
  102. package/package.json +17 -3
  103. package/src/bundler-core/resolution.ts +131 -0
  104. package/src/bundler-core/selection.ts +192 -0
  105. package/src/core/internal.ts +2 -1
  106. package/src/core/types.ts +3 -2
  107. package/src/dom/dom.ts +1 -1
  108. package/src/dom/features/class/full.ts +26 -34
  109. package/src/dom/features/suspense/full.ts +7 -165
  110. package/src/dom/features/suspense-hydration/full.ts +166 -0
  111. package/src/dom/features/suspense-hydration/index.ts +1 -0
  112. package/src/dom/features/suspense-hydration/stub.ts +2 -0
  113. package/src/dom/profiling.ts +6 -0
  114. package/src/dom/reconcile.ts +16 -6
  115. package/src/dom/synthetic-event.ts +9 -4
  116. package/src/rspack/index.ts +2 -0
  117. package/src/server/stream.ts +15 -14
  118. package/src/vite/index.ts +55 -317
  119. package/src/webpack/index.ts +108 -0
  120. package/src/webpack/react18-loader.cjs +25 -0
@@ -4,15 +4,44 @@ import { forkId } from "../dom/react-ids.js";
4
4
  import { isTextContent } from "../core/functions.js";
5
5
  import { isFunction, isThenable } from "../core/functions.js";
6
6
  import { resolveClassProps } from "../core/class-props.js";
7
- import { REACT_ELEMENT_TYPE, REACT_LEGACY_ELEMENT_TYPE, REACT_FRAGMENT_TYPE } from "../core/index.js";
8
- import { REACT_SUSPENSE_TYPE, REACT_CONTEXT_TYPE, REACT_PROVIDER_TYPE, REACT_CONSUMER_TYPE, REACT_FORWARD_REF_TYPE, REACT_MEMO_TYPE, REACT_LAZY_TYPE, REACT_STRICT_MODE_TYPE, REACT_PROFILER_TYPE, REACT_PORTAL_TYPE, REACT_ACTIVITY_TYPE, REACT_VIEW_TRANSITION_TYPE } from "../react/index.js";
9
- import { escapeAttr, attrToHtml, escapeText, escapeScript, VOID_ELEMENTS, RAW_TEXT_ELEMENTS } from "./escape.js";
10
- import { pushContext, popContext, snapshotContexts, recordHostResource, currentSSRFrame } from "./dispatcher.js";
7
+ import {
8
+ REACT_ELEMENT_TYPE,
9
+ REACT_LEGACY_ELEMENT_TYPE,
10
+ REACT_FRAGMENT_TYPE
11
+ } from "../core/index.js";
12
+ import {
13
+ REACT_SUSPENSE_TYPE,
14
+ REACT_CONTEXT_TYPE,
15
+ REACT_PROVIDER_TYPE,
16
+ REACT_CONSUMER_TYPE,
17
+ REACT_FORWARD_REF_TYPE,
18
+ REACT_MEMO_TYPE,
19
+ REACT_LAZY_TYPE,
20
+ REACT_STRICT_MODE_TYPE,
21
+ REACT_PROFILER_TYPE,
22
+ REACT_PORTAL_TYPE,
23
+ REACT_ACTIVITY_TYPE,
24
+ REACT_VIEW_TRANSITION_TYPE
25
+ } from "../react/index.js";
26
+ import {
27
+ escapeAttr,
28
+ attrToHtml,
29
+ escapeText,
30
+ escapeScript,
31
+ VOID_ELEMENTS,
32
+ RAW_TEXT_ELEMENTS
33
+ } from "./escape.js";
34
+ import {
35
+ pushContext,
36
+ popContext,
37
+ snapshotContexts,
38
+ recordHostResource,
39
+ currentSSRFrame
40
+ } from "./dispatcher.js";
11
41
  import { isBrowserError } from "../core/browser.js";
12
42
  import { resourceKind } from "../core/resource-hints.js";
13
43
  function walk(node, opts) {
14
- if (!opts.textState)
15
- opts = { ...opts, textState: { bits: +(opts.insertionContext === "svg") } };
44
+ if (!opts.textState) opts = { ...opts, textState: { bits: +(opts.insertionContext === "svg") } };
16
45
  walkNode(node, opts);
17
46
  }
18
47
  const selectValueStack = [];
@@ -26,41 +55,33 @@ function currentSelectValue() {
26
55
  return selectValueStack.length ? selectValueStack[selectValueStack.length - 1] : void 0;
27
56
  }
28
57
  function optionChildText(children) {
29
- if (children == null)
30
- return "";
31
- if (isTextContent(children))
32
- return "" + children;
33
- if (Array.isArray(children))
34
- return children.map(optionChildText).join("");
58
+ if (children == null) return "";
59
+ if (isTextContent(children)) return "" + children;
60
+ if (Array.isArray(children)) return children.map(optionChildText).join("");
35
61
  return "";
36
62
  }
37
63
  function emitText(text, opts) {
38
- if (text === "")
39
- return;
40
- if (opts.textState.bits & 2)
41
- opts.emit("<!-- -->");
64
+ if (text === "") return;
65
+ if (opts.textState.bits & 2) opts.emit("<!-- -->");
42
66
  opts.emit(escapeText(text));
43
67
  opts.textState.bits |= 2;
44
68
  }
45
69
  function walkNode(node, opts) {
46
- if (node == null || node === false || node === true)
47
- return;
70
+ if (node == null || node === false || node === true) return;
48
71
  if (isTextContent(node)) {
49
72
  emitText("" + node, opts);
50
73
  return;
51
74
  }
52
75
  if (Array.isArray(node)) {
53
76
  const treeId = opts.treeId ?? 1n;
54
- for (let i = 0; i < node.length; i++)
55
- walkNode(node[i], { ...opts, treeId: forkId(treeId, node.length, i) });
77
+ for (let i = 0; i < node.length; i++) walkNode(node[i], { ...opts, treeId: forkId(treeId, node.length, i) });
56
78
  return;
57
79
  }
58
80
  if (isFunction(node[Symbol.iterator])) {
59
81
  walkNode(Array.from(node), opts);
60
82
  return;
61
83
  }
62
- if (typeof node !== "object")
63
- return;
84
+ if (typeof node !== "object") return;
64
85
  const t = node.$$typeof;
65
86
  if (t === REACT_LAZY_TYPE) {
66
87
  const lazy = node;
@@ -68,8 +89,7 @@ function walkNode(node, opts) {
68
89
  walkNode(resolved, opts);
69
90
  return;
70
91
  }
71
- if (t !== REACT_ELEMENT_TYPE && t !== REACT_LEGACY_ELEMENT_TYPE)
72
- return;
92
+ if (t !== REACT_ELEMENT_TYPE && t !== REACT_LEGACY_ELEMENT_TYPE) return;
73
93
  const el = node;
74
94
  walkElement(el, opts);
75
95
  }
@@ -89,8 +109,7 @@ function walkElement(el, opts) {
89
109
  return;
90
110
  }
91
111
  if (type === REACT_ACTIVITY_TYPE) {
92
- if (props.mode !== "hidden")
93
- walkNode(props.children, opts);
112
+ if (props.mode !== "hidden") walkNode(props.children, opts);
94
113
  return;
95
114
  }
96
115
  if (type === REACT_VIEW_TRANSITION_TYPE) {
@@ -143,8 +162,7 @@ function walkElement(el, opts) {
143
162
  }
144
163
  function walkHost(tag, props, opts) {
145
164
  const isSvg = !!(opts.textState.bits & 1) || tag === "svg";
146
- if (!isSvg && resourceKind(tag, props) && recordHostResource(tag, props, opts.resourceScope))
147
- return;
165
+ if (!isSvg && resourceKind(tag, props) && recordHostResource(tag, props, opts.resourceScope)) return;
148
166
  const isTextarea = tag === "textarea";
149
167
  const textareaValue = isTextarea ? props.value != null ? props.value : props.defaultValue : void 0;
150
168
  const isInput = tag === "input";
@@ -157,18 +175,13 @@ function walkHost(tag, props, opts) {
157
175
  }
158
176
  const isOption = tag === "option";
159
177
  try {
160
- if (tag === "html")
161
- opts.emit("<!DOCTYPE html>");
178
+ if (tag === "html") opts.emit("<!DOCTYPE html>");
162
179
  opts.emit("<" + tag);
163
180
  for (const k in props) {
164
- if (isTextarea && (k === "value" || k === "defaultValue"))
165
- continue;
166
- if (isInput && (k === "defaultValue" || k === "defaultChecked"))
167
- continue;
168
- if (isSelect && (k === "value" || k === "defaultValue"))
169
- continue;
170
- if (isOption && k === "selected")
171
- continue;
181
+ if (isTextarea && (k === "value" || k === "defaultValue")) continue;
182
+ if (isInput && (k === "defaultValue" || k === "defaultChecked")) continue;
183
+ if (isSelect && (k === "value" || k === "defaultValue")) continue;
184
+ if (isOption && k === "selected") continue;
172
185
  opts.emit(attrToHtml(k, props[k], isSvg));
173
186
  }
174
187
  if (inputValueAttr !== void 0) {
@@ -182,8 +195,7 @@ function walkHost(tag, props, opts) {
182
195
  if (selectVal !== void 0) {
183
196
  const optionValue = props.value != null ? props.value : optionChildText(props.children);
184
197
  const matches = Array.isArray(selectVal) ? selectVal.some((v) => "" + v === "" + optionValue) : "" + selectVal === "" + optionValue;
185
- if (matches)
186
- opts.emit(' selected=""');
198
+ if (matches) opts.emit(' selected=""');
187
199
  } else if (props.selected) {
188
200
  opts.emit(' selected=""');
189
201
  }
@@ -194,8 +206,7 @@ function walkHost(tag, props, opts) {
194
206
  return;
195
207
  }
196
208
  opts.emit(">");
197
- if (tag === "head")
198
- opts.onHead?.();
209
+ if (tag === "head") opts.onHead?.();
199
210
  const parentTextState = opts.textState;
200
211
  if (tag === "html" && !hasHeadChild(props.children)) {
201
212
  opts.emit("<head>");
@@ -238,19 +249,15 @@ function walkHost(tag, props, opts) {
238
249
  opts.emit(`</${tag}>`);
239
250
  parentTextState.bits &= 1;
240
251
  } finally {
241
- if (isSelect)
242
- popSelectContext();
252
+ if (isSelect) popSelectContext();
243
253
  }
244
254
  }
245
255
  function hasHeadChild(children) {
246
- if (children == null || typeof children === "boolean")
247
- return false;
248
- if (Array.isArray(children))
249
- return children.some(hasHeadChild);
256
+ if (children == null || typeof children === "boolean") return false;
257
+ if (Array.isArray(children)) return children.some(hasHeadChild);
250
258
  if (typeof children !== "string" && isIterable(children)) {
251
259
  for (const child of children) {
252
- if (hasHeadChild(child))
253
- return true;
260
+ if (hasHeadChild(child)) return true;
254
261
  }
255
262
  return false;
256
263
  }
@@ -282,8 +289,7 @@ function walkComponent(fn, props, opts, ref) {
282
289
  instance.context = ctxValue;
283
290
  if (fn.getDerivedStateFromProps) {
284
291
  const d = fn.getDerivedStateFromProps(props, instance.state);
285
- if (d)
286
- instance.state = { ...instance.state, ...d };
292
+ if (d) instance.state = { ...instance.state, ...d };
287
293
  }
288
294
  walkNode(instance.render(), opts);
289
295
  return;
@@ -291,8 +297,7 @@ function walkComponent(fn, props, opts, ref) {
291
297
  const rendered = fn(props, ref);
292
298
  walkNode(rendered, frame.localId ? { ...opts, treeId: forkId(frame.treeId, 1, 0) } : opts);
293
299
  } catch (error) {
294
- if (opts.thrownInfo && !opts.thrownInfo.componentStack)
295
- opts.thrownInfo.componentStack = opts.componentStack;
300
+ if (opts.thrownInfo && !opts.thrownInfo.componentStack) opts.thrownInfo.componentStack = opts.componentStack;
296
301
  if (isBrowserError(error) && !error.componentStack) {
297
302
  Object.defineProperty(error, "componentStack", { value: opts.componentStack });
298
303
  }
@@ -323,10 +328,8 @@ function walkSuspense(props, opts) {
323
328
  nested.length = 0;
324
329
  const suspended = isThenable(thenable);
325
330
  if (!suspended) {
326
- if (isBrowserError(thenable))
327
- opts.onBrowserBailout?.(thenable, { componentStack: thenable.componentStack || opts.componentStack || "" });
328
- else
329
- opts.onError?.(thenable);
331
+ if (isBrowserError(thenable)) opts.onBrowserBailout?.(thenable, { componentStack: thenable.componentStack || opts.componentStack || "" });
332
+ else opts.onError?.(thenable);
330
333
  }
331
334
  const fallbackParts = [];
332
335
  walkNode(props.fallback, {
@@ -345,27 +348,20 @@ function walkSuspense(props, opts) {
345
348
  contextSnapshot,
346
349
  componentStack: thrownInfo.componentStack || opts.componentStack || ""
347
350
  } : void 0;
348
- if (boundary)
349
- opts.emit(boundary);
350
- else
351
- emitBoundary(opts, id, fallbackParts, suspended ? "$?" : isBrowserError(thenable) ? "$!" : "$E");
352
- for (const inner of nested)
353
- opts.onSuspend?.(inner);
354
- if (boundary)
355
- opts.onSuspend(boundary);
351
+ if (boundary) opts.emit(boundary);
352
+ else emitBoundary(opts, id, fallbackParts, suspended ? "$?" : isBrowserError(thenable) ? "$!" : "$E");
353
+ for (const inner of nested) opts.onSuspend?.(inner);
354
+ if (boundary) opts.onSuspend(boundary);
356
355
  return;
357
356
  }
358
- if (resourceScope)
359
- currentSSRFrame().resources?.mergeScope(resourceScope, opts.resourceScope);
357
+ if (resourceScope) currentSSRFrame().resources?.mergeScope(resourceScope, opts.resourceScope);
360
358
  emitBoundary(opts, id, childParts, "$");
361
- for (const boundary of nested)
362
- opts.onSuspend?.(boundary);
359
+ for (const boundary of nested) opts.onSuspend?.(boundary);
363
360
  }
364
361
  function emitBoundary(opts, id, parts, marker) {
365
362
  const [open, close] = boundaryEdges(id, marker, opts.insertionContext, currentSSRFrame().identifierPrefix);
366
363
  opts.emit(open);
367
- for (const part of parts)
368
- opts.emit(part);
364
+ for (const part of parts) opts.emit(part);
369
365
  opts.emit(close);
370
366
  }
371
367
  function boundaryEdges(id, marker, context, prefix) {
@@ -376,3 +372,4 @@ export {
376
372
  boundaryEdges,
377
373
  walk
378
374
  };
375
+ //# sourceMappingURL=walk.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/server/walk.ts"],
4
- "sourcesContent": ["import { isFunction, isThenable } from '../core/functions'\nimport { resolveClassProps } from '../core/class-props'\nimport {\n REACT_ELEMENT_TYPE,\n REACT_LEGACY_ELEMENT_TYPE,\n REACT_FRAGMENT_TYPE,\n type ReactNode,\n type ReactElement,\n} from '../core'\nimport {\n REACT_SUSPENSE_TYPE,\n REACT_CONTEXT_TYPE,\n REACT_PROVIDER_TYPE,\n REACT_CONSUMER_TYPE,\n REACT_FORWARD_REF_TYPE,\n REACT_MEMO_TYPE,\n REACT_LAZY_TYPE,\n REACT_STRICT_MODE_TYPE,\n REACT_PROFILER_TYPE,\n REACT_PORTAL_TYPE,\n REACT_ACTIVITY_TYPE,\n REACT_VIEW_TRANSITION_TYPE,\n} from '../react'\nimport {\n attrToHtml,\n escapeText,\n escapeScript,\n VOID_ELEMENTS,\n RAW_TEXT_ELEMENTS,\n} from './escape'\nimport {\n pushContext,\n popContext,\n snapshotContexts,\n recordHostResource,\n currentSSRFrame,\n type ContextSnapshot,\n} from './dispatcher'\nimport { isBrowserError } from '../core/browser'\nimport { resourceKind } from '../core/resource-hints'\nimport type { ResourceScope } from './resource-hints'\n\nexport interface ServerErrorInfo {\n componentStack: string\n}\n\nexport type BrowserBailoutCallback = (error: Error, errorInfo: ServerErrorInfo) => void\n\nexport interface SuspendedBoundary {\n id: number\n fallbackHTML: string\n children: ReactNode\n thenable: Promise<any>\n contextSnapshot: ContextSnapshot\n componentStack: string\n}\n\nexport interface WalkOptions {\n emit: (chunk: string) => void\n onHead?: () => void\n onSuspend?: ((boundary: SuspendedBoundary) => void) | undefined\n onBrowserBailout?: BrowserBailoutCallback | undefined\n onError?: ((error: unknown) => unknown) | undefined\n componentStack?: string | undefined\n thrownInfo?: { componentStack?: string | undefined }\n nextBoundaryId: () => number\n bootstrapped?: boolean | undefined\n isBoundaryResolution?: boolean | undefined\n resourceScope?: ResourceScope | undefined\n // Shared traversal flags: SVG = 1, adjacent text = 2.\n // Host children restore previous flags on return or throw.\n textState?: { bits: number }\n}\n\n/**\n * Synchronously walk a React node and emit HTML string pieces to `opts.emit`.\n * Suspended boundaries are emitted as fallbacks with marker IDs; if `opts.onSuspend`\n * is provided, the suspension is recorded for later streaming.\n */\nexport function walk(node: ReactNode, opts: WalkOptions): void {\n // Seed a text state if the caller didn't provide one so the separator logic\n // is active for the whole tree.\n if (!opts.textState) opts = { ...opts, textState: { bits: 0 } }\n walkNode(node, opts)\n}\n\n// --- <select> selection context ----------------------------------------------\n// Stack of active select values (or `undefined` when the current select has\n// no controlled value). `<option>` walks read the top of stack to decide\n// whether to emit `selected=\"\"`.\nconst selectValueStack: unknown[] = []\nfunction pushSelectContext(value: unknown): void {\n selectValueStack.push(value)\n}\nfunction popSelectContext(): void {\n selectValueStack.pop()\n}\nfunction currentSelectValue(): unknown {\n return selectValueStack.length ? selectValueStack[selectValueStack.length - 1] : undefined\n}\n\nfunction optionChildText(children: unknown): string {\n // `<option>Text</option>` — if no `value` prop, the option's value is its\n // flat string/number child content. Matches DOM semantics (`option.value`\n // defaults to `textContent` when no attribute is set).\n if (children == null) return ''\n if (typeof children === 'string' || typeof children === 'number') return '' + children\n if (Array.isArray(children)) return children.map(optionChildText).join('')\n return ''\n}\n\nfunction emitText(text: string, opts: WalkOptions): void {\n // Empty string renders no text node and doesn't start/extend a text flow —\n // skip entirely so sibling text isn't separated by a stray `<!-- -->`.\n if (text === '') return\n if (opts.textState!.bits & 2) opts.emit('<!-- -->')\n opts.emit(escapeText(text))\n opts.textState!.bits |= 2\n}\n\nfunction walkNode(node: ReactNode, opts: WalkOptions): void {\n if (node == null || node === false || node === true) return\n\n if (typeof node === 'string') {\n emitText(node, opts)\n return\n }\n if (typeof node === 'number') {\n emitText(String(node), opts)\n return\n }\n if (Array.isArray(node)) {\n for (const c of node) walkNode(c, opts)\n return\n }\n if (isFunction((node as any)[Symbol.iterator])) {\n for (const item of node as Iterable<ReactNode>) walkNode(item, opts)\n return\n }\n\n if (typeof node !== 'object') return\n const t = (node as any).$$typeof\n\n // Raw React.lazy in the tree (RSC Flight encodes 'use client' components —\n // CodeBlock, CodeExplorer, etc. — as bare Lazy objects directly in the\n // tree, not wrapped in REACT_ELEMENT_TYPE). SSR previously dropped these\n // here, so code snippets never made it into the server HTML. The RSC\n // decoder server-side awaits payloads before rendering, so status is\n // 'fulfilled' and `_init()` returns the resolved element synchronously.\n // If still pending (shouldn't happen post-awaitLazyElements), throw the\n // thenable so streaming SSR suspends the current boundary and retries.\n if (t === REACT_LAZY_TYPE) {\n const lazy = node as any\n const resolved = lazy._init(lazy._payload)\n walkNode(resolved, opts)\n return\n }\n\n if (t !== REACT_ELEMENT_TYPE && t !== REACT_LEGACY_ELEMENT_TYPE) return\n\n const el = node as ReactElement\n walkElement(el, opts)\n}\n\nfunction walkElement(el: ReactElement, opts: WalkOptions): void {\n const type = el.type\n const props = el.props ?? {}\n\n if (typeof type === 'string') {\n walkHost(type, props, opts)\n return\n }\n\n if (type === REACT_FRAGMENT_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_PROFILER_TYPE) {\n walkNode(props.children, opts)\n return\n }\n\n if (type === REACT_SUSPENSE_TYPE) {\n walkSuspense(props, opts)\n return\n }\n\n if (type === REACT_ACTIVITY_TYPE) {\n if (props.mode !== 'hidden') walkNode(props.children, opts)\n return\n }\n if (type === REACT_VIEW_TRANSITION_TYPE) {\n walkNode(props.children, opts)\n return\n }\n\n const marker = (type as any)?.$$typeof\n\n if (marker === REACT_PORTAL_TYPE) {\n // Portals don't render to the main HTML output on the server.\n return\n }\n\n if (marker === REACT_CONTEXT_TYPE || marker === REACT_PROVIDER_TYPE) {\n const ctx = (type as any)._context\n pushContext(ctx, props.value)\n try {\n walkNode(props.children, opts)\n } finally {\n popContext(ctx)\n }\n return\n }\n\n if (marker === REACT_CONSUMER_TYPE) {\n const render = props.children\n if (isFunction(render)) {\n walkNode(render((type as any)._context._currentValue), opts)\n }\n return\n }\n\n if (marker === REACT_FORWARD_REF_TYPE) {\n const render = (type as any).render\n const ref = (props as any).ref ?? null\n const { ref: _omit, ...rest } = props as any\n walkComponent(render, rest, opts, ref)\n return\n }\n\n if (marker === REACT_MEMO_TYPE) {\n const inner = (type as any).type\n walkElement({ ...el, type: inner } as ReactElement, opts)\n return\n }\n\n if (marker === REACT_LAZY_TYPE) {\n const { _payload, _init } = type as any\n const resolved = _init(_payload)\n walkElement({ ...el, type: resolved } as ReactElement, opts)\n return\n }\n\n if (isFunction(type)) {\n walkComponent(type, props, opts)\n return\n }\n}\n\nfunction walkHost(\n tag: string,\n props: Record<string, any>,\n opts: WalkOptions,\n): void {\n const isSvg = !!(opts.textState!.bits & 1) || tag === 'svg'\n if (!isSvg && resourceKind(tag, props) && recordHostResource(tag, props, opts.resourceScope)) return\n // <textarea value=\"...\"> serializes its value as a TEXT CHILD, not an\n // attribute. `defaultValue` is the fallback when `value` is absent. This\n // matches React and the HTML spec — `<textarea value=\"x\">` is not valid\n // HTML; the value is the element's textContent.\n const isTextarea = tag === 'textarea'\n const textareaValue = isTextarea\n ? props.value != null\n ? props.value\n : props.defaultValue\n : undefined\n\n // <input defaultValue=\"...\"> should parse with that value — emit it as a\n // `value` attribute. Similarly `defaultChecked` becomes `checked`. This\n // keeps hydration consistent: the browser parser sees the initial value,\n // and on client commit our setProp seeds `.defaultValue`/`.defaultChecked`\n // without stomping the user-typed value.\n const isInput = tag === 'input'\n const inputValueAttr =\n isInput && props.value == null && props.defaultValue != null\n ? props.defaultValue\n : undefined\n const inputCheckedAttr =\n isInput && props.checked == null && props.defaultChecked != null\n ? props.defaultChecked\n : undefined\n\n // <select value=\"...\"> does NOT become an attribute on `<select>` — the\n // HTML spec has no such attribute. React resolves the selection by stamping\n // `selected` on the matching `<option>` children during render. Stash the\n // target value(s) on the walk state and the child `<option>` walk reads it.\n const isSelect = tag === 'select'\n if (isSelect) {\n const val = props.value != null ? props.value : props.defaultValue\n pushSelectContext(val)\n }\n const isOption = tag === 'option'\n try {\n\n // Prepend the HTML5 doctype to the stream when rendering an <html> root.\n // Without it the browser parses the document in quirks mode, which breaks\n // CSS sizing (documentElement.clientHeight returns the content height, not\n // the viewport) — and Floating-UI-based libraries (Radix dropdowns etc.)\n // then compute off-screen positions for overlays.\n if (tag === 'html') opts.emit('<!DOCTYPE html>')\n\n opts.emit('<' + tag)\n for (const k in props) {\n if (isTextarea && (k === 'value' || k === 'defaultValue')) continue\n if (isInput && (k === 'defaultValue' || k === 'defaultChecked')) continue\n if (isSelect && (k === 'value' || k === 'defaultValue')) continue\n if (isOption && k === 'selected') continue\n opts.emit(attrToHtml(k, props[k], isSvg))\n }\n if (inputValueAttr !== undefined) {\n opts.emit(attrToHtml('value', inputValueAttr, isSvg))\n }\n if (inputCheckedAttr !== undefined) {\n opts.emit(attrToHtml('checked', inputCheckedAttr, isSvg))\n }\n if (isOption) {\n const selectVal = currentSelectValue()\n if (selectVal !== undefined) {\n const optionValue =\n props.value != null ? props.value : optionChildText(props.children)\n const matches = Array.isArray(selectVal)\n ? selectVal.some((v) => '' + v === '' + optionValue)\n : '' + selectVal === '' + optionValue\n if (matches) opts.emit(' selected=\"\"')\n } else if (props.selected) {\n opts.emit(' selected=\"\"')\n }\n }\n\n if (VOID_ELEMENTS.has(tag)) {\n opts.emit('/>')\n opts.textState!.bits &= 1\n return\n }\n opts.emit('>')\n if (tag === 'head') opts.onHead?.()\n // Opening a host element starts a fresh text flow context for its children.\n // Children's text separator tracking is independent of the outer context.\n const parentTextState = opts.textState\n\n if (tag === 'html' && !hasHeadChild(props.children)) {\n opts.emit('<head>')\n opts.onHead?.()\n opts.emit('</head>')\n }\n\n const dangerouslyHtml = props.dangerouslySetInnerHTML?.__html\n\n if (isTextarea && textareaValue != null) {\n opts.emit(escapeText(String(textareaValue)))\n opts.emit(`</${tag}>`)\n parentTextState!.bits &= 1\n return\n }\n\n if (RAW_TEXT_ELEMENTS.has(tag)) {\n // script/style: raw-text. React allows either a string/number child or\n // dangerouslySetInnerHTML — some libs (Start's Scripts) use the latter.\n if (dangerouslyHtml != null) {\n opts.emit(escapeScript(String(dangerouslyHtml)))\n } else {\n const children = props.children\n if (typeof children === 'string' || typeof children === 'number') {\n opts.emit(escapeScript(String(children)))\n } else if (Array.isArray(children)) {\n opts.emit(escapeScript(children.filter((c) => c != null).join('')))\n }\n }\n opts.emit(`</${tag}>`)\n parentTextState!.bits &= 1\n return\n }\n\n if (dangerouslyHtml != null) {\n opts.emit(String(dangerouslyHtml))\n } else {\n const previousState = parentTextState!.bits\n parentTextState!.bits = +(isSvg && tag !== 'foreignObject')\n try {\n walkNode(props.children, opts)\n } finally {\n parentTextState!.bits = previousState\n }\n }\n opts.emit(`</${tag}>`)\n // Host element closing resets outer flow — next sibling text starts fresh.\n parentTextState!.bits &= 1\n } finally {\n if (isSelect) popSelectContext()\n }\n}\n\nfunction hasHeadChild(children: unknown): boolean {\n if (children == null || typeof children === 'boolean') return false\n if (Array.isArray(children)) return children.some(hasHeadChild)\n if (typeof children !== 'string' && isIterable(children)) {\n for (const child of children as Iterable<unknown>) {\n if (hasHeadChild(child)) return true\n }\n return false\n }\n return isElementOfType(children, 'head')\n}\n\nfunction isElementOfType(value: unknown, type: string): value is ReactElement {\n const marker = (value as ReactElement | null)?.$$typeof as unknown\n return (\n !!value &&\n typeof value === 'object' &&\n (marker === REACT_ELEMENT_TYPE || marker === REACT_LEGACY_ELEMENT_TYPE) &&\n (value as ReactElement).type === type\n )\n}\n\nfunction isIterable(value: unknown): value is Iterable<unknown> {\n return !!value && isFunction((value as { [Symbol.iterator]?: unknown })[Symbol.iterator])\n}\n\nfunction walkComponent(\n fn: Function,\n props: Record<string, any>,\n opts: WalkOptions,\n ref?: unknown,\n): void {\n if (opts.onBrowserBailout) {\n opts = { ...opts, componentStack: `\\n at ${(fn as any).displayName || fn.name || 'Anonymous'}${opts.componentStack || ''}` }\n }\n try {\n if ((fn as any).prototype?.isReactComponent) {\n props = resolveClassProps(fn, props)\n const ctxType = (fn as any).contextType\n const ctxValue = ctxType ? ctxType._currentValue : undefined\n const instance = new (fn as any)(props, ctxValue)\n instance.props = props\n instance.context = ctxValue\n if ((fn as any).getDerivedStateFromProps) {\n const d = (fn as any).getDerivedStateFromProps(props, instance.state)\n if (d) instance.state = { ...instance.state, ...d }\n }\n walkNode(instance.render(), opts)\n return\n }\n const rendered = (fn as any)(props, ref)\n walkNode(rendered, opts)\n } catch (error) {\n if (opts.thrownInfo && !opts.thrownInfo.componentStack) opts.thrownInfo.componentStack = opts.componentStack\n if (isBrowserError(error) && !(error as any).componentStack) {\n Object.defineProperty(error, 'componentStack', { value: opts.componentStack })\n }\n throw error\n }\n}\n\nfunction walkSuspense(\n props: Record<string, any>,\n opts: WalkOptions,\n): void {\n const id = opts.nextBoundaryId()\n // Snapshot contexts BEFORE attempting children, so if a descendant suspends\n // we can replay the same provider stack when re-rendering the boundary.\n const contextSnapshot = snapshotContexts()\n\n // Try to render the children synchronously. If a thenable is thrown,\n // record the boundary and emit the fallback.\n const childParts: string[] = []\n const nested: SuspendedBoundary[] = []\n const thrownInfo: { componentStack?: string | undefined } = {}\n const childEmit = (s: string) => childParts.push(s)\n const resourceScope: ResourceScope | undefined = currentSSRFrame().shellFlushed ? {} : undefined\n try {\n walkNode(props.children, {\n ...opts,\n resourceScope,\n thrownInfo,\n emit: childEmit,\n onSuspend: opts.onSuspend ? (boundary) => nested.push(boundary) : undefined,\n nextBoundaryId: opts.nextBoundaryId,\n })\n } catch (thenable: any) {\n nested.length = 0\n const suspended = isThenable(thenable)\n if (!suspended) {\n if (isBrowserError(thenable)) opts.onBrowserBailout?.(thenable, { componentStack: (thenable as any).componentStack || opts.componentStack || '' })\n else opts.onError?.(thenable)\n }\n const fallbackParts: string[] = []\n walkNode(props.fallback, {\n ...opts,\n emit: (s) => fallbackParts.push(s),\n onSuspend: opts.onSuspend ? (boundary) => nested.push(boundary) : undefined,\n nextBoundaryId: opts.nextBoundaryId,\n })\n if (!suspended) {\n opts.emit(`<!--${isBrowserError(thenable) ? '$!' : '$E'}${id}-->${fallbackParts.join('')}<!--/$-->`)\n } else emitBoundary(opts, id, fallbackParts.join(''))\n for (const boundary of nested) opts.onSuspend?.(boundary)\n if (suspended) opts.onSuspend?.({\n id, fallbackHTML: fallbackParts.join(''), children: props.children, thenable, contextSnapshot,\n componentStack: thrownInfo.componentStack || opts.componentStack || '',\n })\n return\n }\n\n if (resourceScope) currentSSRFrame().resources?.mergeScope(resourceScope, opts.resourceScope)\n\n // Children rendered fully — emit them wrapped in resolved-boundary markers\n // (`<!--$N-->` / `<!--/$-->`). Without markers, the client hydrator has no\n // way to know this subtree is inside a Suspense, so if the client version\n // of a descendant (e.g. `React.lazy`) suspends it can't pinpoint which DOM\n // range to adopt on resolve — it creates fresh DOM next to the SSR content,\n // producing visible duplicates (e.g. double navbar logos). Markers let the\n // client treat this as a resolved boundary and hydrate in-place.\n opts.emit(`<!--$${id}-->`)\n opts.emit(childParts.join(''))\n opts.emit(`<!--/$-->`)\n for (const boundary of nested) opts.onSuspend?.(boundary)\n}\n\nfunction emitBoundary(opts: WalkOptions, id: number, fallbackHTML: string): void {\n // Visible div wrapper so the fallback UI shows; B: id lets $RC locate it on\n // reveal. The leading/trailing comments let hydration detect a pending\n // boundary and register a reveal callback.\n opts.emit(`<!--$?${id}--><div id=\"B:${id}\">`)\n opts.emit(fallbackHTML)\n opts.emit(`</div><!--/$-->`)\n}\n"],
5
- "mappings": "AAAA,SAAS,YAAY,kBAAkB;AACvC,SAAS,yBAAyB;AAClC,SACE,oBACA,2BACA,2BAGK;AACP,SACE,qBACA,oBACA,qBACA,qBACA,wBACA,iBACA,iBACA,wBACA,qBACA,mBACA,qBACA,kCACK;AACP,SACE,YACA,YACA,cACA,eACA,yBACK;AACP,SACE,aACA,YACA,kBACA,oBACA,uBAEK;AACP,SAAS,sBAAsB;AAC/B,SAAS,oBAAoB;AAwCvB,SAAU,KAAK,MAAiB,MAAiB;AAGrD,MAAI,CAAC,KAAK;AAAW,WAAO,EAAE,GAAG,MAAM,WAAW,EAAE,MAAM,EAAC,EAAE;AAC7D,WAAS,MAAM,IAAI;AACrB;AAMA,MAAM,mBAA8B,CAAA;AACpC,SAAS,kBAAkB,OAAc;AACvC,mBAAiB,KAAK,KAAK;AAC7B;AACA,SAAS,mBAAgB;AACvB,mBAAiB,IAAG;AACtB;AACA,SAAS,qBAAkB;AACzB,SAAO,iBAAiB,SAAS,iBAAiB,iBAAiB,SAAS,CAAC,IAAI;AACnF;AAEA,SAAS,gBAAgB,UAAiB;AAIxC,MAAI,YAAY;AAAM,WAAO;AAC7B,MAAI,OAAO,aAAa,YAAY,OAAO,aAAa;AAAU,WAAO,KAAK;AAC9E,MAAI,MAAM,QAAQ,QAAQ;AAAG,WAAO,SAAS,IAAI,eAAe,EAAE,KAAK,EAAE;AACzE,SAAO;AACT;AAEA,SAAS,SAAS,MAAc,MAAiB;AAG/C,MA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M,cAAc,KAAK,EAAE,CAAC,WAAW;IACrG;AAAO,mBAAa,MAAM,IAAI,cAAc,KAAK,EAAE,CAAC;AACpD,eAAW,YAAY;AAAQ,WAAK,YAAY,QAAQ;AACxD,QAAI;AAAW,WAAK,YAAY;QAC9B;QAAI,cAAc,cAAc,KAAK,EAAE;QAAG,UAAU,MAAM;QAAU;QAAU;QAC9E,gBAAgB,WAAW,kBAAkB,KAAK,kBAAkB;OACrE;AACD;EACF;AAEA,MAAI;AAAe,oBAAe,EAAG,WAAW,WAAW,eAAe,KAAK,aAAa;AAS5F,OAAK,KAAK,QAAQ,EAAE,KAAK;AACzB,OAAK,KAAK,WAAW,KAAK,EAAE,CAAC;AAC7B,OAAK,KAAK,WAAW;AACrB,aAAW,YAAY;AAAQ,SAAK,YAAY,QAAQ;AAC1D;AAEA,SAAS,aAAa,MAAmB,IAAY,cAAoB;AAIvE,OAAK,KAAK,SAAS,EAAE,iBAAiB,EAAE,IAAI;AAC5C,OAAK,KAAK,YAAY;AACtB,OAAK,KAAK,iBAAiB;AAC7B;",
6
- "names": []
4
+ "sourcesContent": ["import { boundaryId } from './stream-ids.js'\nimport { childInsertionContext, type InsertionContext } from './insertion-context.js'\nimport { forkId } from '../dom/react-ids.js'\nimport { isTextContent } from '../core/functions.js';\nimport { isFunction, isThenable } from '../core/functions.js'\nimport { resolveClassProps } from '../core/class-props.js'\nimport {\n REACT_ELEMENT_TYPE,\n REACT_LEGACY_ELEMENT_TYPE,\n REACT_FRAGMENT_TYPE,\n type ReactNode,\n type ReactElement,\n} from '../core/index.js'\nimport {\n REACT_SUSPENSE_TYPE,\n REACT_CONTEXT_TYPE,\n REACT_PROVIDER_TYPE,\n REACT_CONSUMER_TYPE,\n REACT_FORWARD_REF_TYPE,\n REACT_MEMO_TYPE,\n REACT_LAZY_TYPE,\n REACT_STRICT_MODE_TYPE,\n REACT_PROFILER_TYPE,\n REACT_PORTAL_TYPE,\n REACT_ACTIVITY_TYPE,\n REACT_VIEW_TRANSITION_TYPE,\n} from '../react/index.js'\nimport {\n escapeAttr,\n attrToHtml,\n escapeText,\n escapeScript,\n VOID_ELEMENTS,\n RAW_TEXT_ELEMENTS,\n} from './escape.js'\nimport {\n pushContext,\n popContext,\n snapshotContexts,\n recordHostResource,\n currentSSRFrame,\n type ContextSnapshot,\n} from './dispatcher.js'\nimport { isBrowserError } from '../core/browser.js'\nimport { resourceKind } from '../core/resource-hints.js'\nimport type { ResourceScope } from './resource-hints.js'\n\nexport interface ServerErrorInfo {\n componentStack: string\n}\n\nexport type BrowserBailoutCallback = (error: Error, errorInfo: ServerErrorInfo) => void\n\n/** Streamed output keeps pending boundaries addressable until it is written. */\nexport type HtmlPart = string | SuspendedBoundary\n\nexport interface SuspendedBoundary {\n id: number\n treeId: bigint\n insertionContext: InsertionContext\n fallback: HtmlPart[]\n children: ReactNode\n thenable: Promise<any>\n contextSnapshot: ContextSnapshot\n componentStack: string\n // Set by the stream: completed content and failure markers are inlined\n // when the boundary is written; `written` boundaries need a later reveal.\n content?: HtmlPart[]\n marker?: string\n written?: boolean\n}\n\nexport interface WalkOptions {\n insertionContext?: InsertionContext | undefined\n treeId?: bigint | undefined\n emit: (chunk: HtmlPart) => void\n onHead?: () => void\n onSuspend?: ((boundary: SuspendedBoundary) => void) | undefined\n onBrowserBailout?: BrowserBailoutCallback | undefined\n onError?: ((error: unknown) => unknown) | undefined\n componentStack?: string | undefined\n thrownInfo?: { componentStack?: string | undefined }\n nextBoundaryId: () => number\n bootstrapped?: boolean | undefined\n isBoundaryResolution?: boolean | undefined\n resourceScope?: ResourceScope | undefined\n // Shared traversal flags: SVG = 1, adjacent text = 2.\n // Host children restore previous flags on return or throw.\n textState?: { bits: number }\n}\n\n/**\n * Synchronously walk a React node and emit HTML string pieces to `opts.emit`.\n * Suspended boundaries are emitted as fallbacks with marker IDs; if `opts.onSuspend`\n * is provided, the suspension is recorded for later streaming.\n */\nexport function walk(node: ReactNode, opts: WalkOptions): void {\n // Seed a text state if the caller didn't provide one so the separator logic\n // is active for the whole tree.\n if (!opts.textState) opts = { ...opts, textState: { bits: +(opts.insertionContext === 'svg') } }\n walkNode(node, opts)\n}\n\n// --- <select> selection context ----------------------------------------------\n// Stack of active select values (or `undefined` when the current select has\n// no controlled value). `<option>` walks read the top of stack to decide\n// whether to emit `selected=\"\"`.\nconst selectValueStack: unknown[] = []\nfunction pushSelectContext(value: unknown): void {\n selectValueStack.push(value)\n}\nfunction popSelectContext(): void {\n selectValueStack.pop()\n}\nfunction currentSelectValue(): unknown {\n return selectValueStack.length ? selectValueStack[selectValueStack.length - 1] : undefined\n}\n\nfunction optionChildText(children: unknown): string {\n // `<option>Text</option>` \u2014 if no `value` prop, the option's value is its\n // flat string/number child content. Matches DOM semantics (`option.value`\n // defaults to `textContent` when no attribute is set).\n if (children == null) return ''\n if (isTextContent(children)) return '' + children\n if (Array.isArray(children)) return children.map(optionChildText).join('')\n return ''\n}\n\nfunction emitText(text: string, opts: WalkOptions): void {\n // Empty string renders no text node and doesn't start/extend a text flow \u2014\n // skip entirely so sibling text isn't separated by a stray `<!-- -->`.\n if (text === '') return\n if (opts.textState!.bits & 2) opts.emit('<!-- -->')\n opts.emit(escapeText(text))\n opts.textState!.bits |= 2\n}\n\nfunction walkNode(node: ReactNode, opts: WalkOptions): void {\n if (node == null || node === false || node === true) return\n\n if (isTextContent(node)) {\n emitText('' + node, opts)\n return\n }\n if (Array.isArray(node)) {\n const treeId = opts.treeId ?? 1n\n for (let i = 0; i < node.length; i++) walkNode(node[i], { ...opts, treeId: forkId(treeId, node.length, i) })\n return\n }\n if (isFunction((node as any)[Symbol.iterator])) {\n walkNode(Array.from(node as Iterable<ReactNode>), opts)\n return\n }\n\n if (typeof node !== 'object') return\n const t = (node as any).$$typeof\n\n // Raw React.lazy in the tree (RSC Flight encodes 'use client' components \u2014\n // CodeBlock, CodeExplorer, etc. \u2014 as bare Lazy objects directly in the\n // tree, not wrapped in REACT_ELEMENT_TYPE). SSR previously dropped these\n // here, so code snippets never made it into the server HTML. The RSC\n // decoder server-side awaits payloads before rendering, so status is\n // 'fulfilled' and `_init()` returns the resolved element synchronously.\n // If still pending (shouldn't happen post-awaitLazyElements), throw the\n // thenable so streaming SSR suspends the current boundary and retries.\n if (t === REACT_LAZY_TYPE) {\n const lazy = node as any\n const resolved = lazy._init(lazy._payload)\n walkNode(resolved, opts)\n return\n }\n\n if (t !== REACT_ELEMENT_TYPE && t !== REACT_LEGACY_ELEMENT_TYPE) return\n\n const el = node as ReactElement\n walkElement(el, opts)\n}\n\nfunction walkElement(el: ReactElement, opts: WalkOptions): void {\n const type = el.type\n const props = el.props ?? {}\n\n if (typeof type === 'string') {\n walkHost(type, props, opts)\n return\n }\n\n if (type === REACT_FRAGMENT_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_PROFILER_TYPE) {\n walkNode(props.children, opts)\n return\n }\n\n if (type === REACT_SUSPENSE_TYPE) {\n walkSuspense(props, opts)\n return\n }\n\n if (type === REACT_ACTIVITY_TYPE) {\n if (props.mode !== 'hidden') walkNode(props.children, opts)\n return\n }\n if (type === REACT_VIEW_TRANSITION_TYPE) {\n walkNode(props.children, opts)\n return\n }\n\n const marker = (type as any)?.$$typeof\n\n if (marker === REACT_PORTAL_TYPE) {\n // Portals don't render to the main HTML output on the server.\n return\n }\n\n if (marker === REACT_CONTEXT_TYPE || marker === REACT_PROVIDER_TYPE) {\n const ctx = (type as any)._context\n pushContext(ctx, props.value)\n try {\n walkNode(props.children, opts)\n } finally {\n popContext(ctx)\n }\n return\n }\n\n if (marker === REACT_CONSUMER_TYPE) {\n const render = props.children\n if (isFunction(render)) {\n walkNode(render((type as any)._context._currentValue), opts)\n }\n return\n }\n\n if (marker === REACT_FORWARD_REF_TYPE) {\n const render = (type as any).render\n const ref = (props as any).ref ?? null\n const { ref: _omit, ...rest } = props as any\n walkComponent(render, rest, opts, ref)\n return\n }\n\n if (marker === REACT_MEMO_TYPE) {\n const inner = (type as any).type\n walkElement({ ...el, type: inner } as ReactElement, opts)\n return\n }\n\n if (marker === REACT_LAZY_TYPE) {\n const { _payload, _init } = type as any\n const resolved = _init(_payload)\n walkElement({ ...el, type: resolved } as ReactElement, opts)\n return\n }\n\n if (isFunction(type)) {\n walkComponent(type, props, opts)\n return\n }\n}\n\nfunction walkHost(\n tag: string,\n props: Record<string, any>,\n opts: WalkOptions,\n): void {\n const isSvg = !!(opts.textState!.bits & 1) || tag === 'svg'\n if (!isSvg && resourceKind(tag, props) && recordHostResource(tag, props, opts.resourceScope)) return\n // <textarea value=\"...\"> serializes its value as a TEXT CHILD, not an\n // attribute. `defaultValue` is the fallback when `value` is absent. This\n // matches React and the HTML spec \u2014 `<textarea value=\"x\">` is not valid\n // HTML; the value is the element's textContent.\n const isTextarea = tag === 'textarea'\n const textareaValue = isTextarea\n ? props.value != null\n ? props.value\n : props.defaultValue\n : undefined\n\n // <input defaultValue=\"...\"> should parse with that value \u2014 emit it as a\n // `value` attribute. Similarly `defaultChecked` becomes `checked`. This\n // keeps hydration consistent: the browser parser sees the initial value,\n // and on client commit our setProp seeds `.defaultValue`/`.defaultChecked`\n // without stomping the user-typed value.\n const isInput = tag === 'input'\n const inputValueAttr =\n isInput && props.value == null && props.defaultValue != null\n ? props.defaultValue\n : undefined\n const inputCheckedAttr =\n isInput && props.checked == null && props.defaultChecked != null\n ? props.defaultChecked\n : undefined\n\n // <select value=\"...\"> does NOT become an attribute on `<select>` \u2014 the\n // HTML spec has no such attribute. React resolves the selection by stamping\n // `selected` on the matching `<option>` children during render. Stash the\n // target value(s) on the walk state and the child `<option>` walk reads it.\n const isSelect = tag === 'select'\n if (isSelect) {\n const val = props.value != null ? props.value : props.defaultValue\n pushSelectContext(val)\n }\n const isOption = tag === 'option'\n try {\n\n // Prepend the HTML5 doctype to the stream when rendering an <html> root.\n // Without it the browser parses the document in quirks mode, which breaks\n // CSS sizing (documentElement.clientHeight returns the content height, not\n // the viewport) \u2014 and Floating-UI-based libraries (Radix dropdowns etc.)\n // then compute off-screen positions for overlays.\n if (tag === 'html') opts.emit('<!DOCTYPE html>')\n\n opts.emit('<' + tag)\n for (const k in props) {\n if (isTextarea && (k === 'value' || k === 'defaultValue')) continue\n if (isInput && (k === 'defaultValue' || k === 'defaultChecked')) continue\n if (isSelect && (k === 'value' || k === 'defaultValue')) continue\n if (isOption && k === 'selected') continue\n opts.emit(attrToHtml(k, props[k], isSvg))\n }\n if (inputValueAttr !== undefined) {\n opts.emit(attrToHtml('value', inputValueAttr, isSvg))\n }\n if (inputCheckedAttr !== undefined) {\n opts.emit(attrToHtml('checked', inputCheckedAttr, isSvg))\n }\n if (isOption) {\n const selectVal = currentSelectValue()\n if (selectVal !== undefined) {\n const optionValue =\n props.value != null ? props.value : optionChildText(props.children)\n const matches = Array.isArray(selectVal)\n ? selectVal.some((v) => '' + v === '' + optionValue)\n : '' + selectVal === '' + optionValue\n if (matches) opts.emit(' selected=\"\"')\n } else if (props.selected) {\n opts.emit(' selected=\"\"')\n }\n }\n\n if (VOID_ELEMENTS.has(tag)) {\n opts.emit('/>')\n opts.textState!.bits &= 1\n return\n }\n opts.emit('>')\n if (tag === 'head') opts.onHead?.()\n // Opening a host element starts a fresh text flow context for its children.\n // Children's text separator tracking is independent of the outer context.\n const parentTextState = opts.textState\n\n if (tag === 'html' && !hasHeadChild(props.children)) {\n opts.emit('<head>')\n opts.onHead?.()\n opts.emit('</head>')\n }\n\n const dangerouslyHtml = props.dangerouslySetInnerHTML?.__html\n\n if (isTextarea && textareaValue != null) {\n opts.emit(escapeText(String(textareaValue)))\n opts.emit(`</${tag}>`)\n parentTextState!.bits &= 1\n return\n }\n\n if (RAW_TEXT_ELEMENTS.has(tag)) {\n // script/style: raw-text. React allows either a string/number child or\n // dangerouslySetInnerHTML \u2014 some libs (Start's Scripts) use the latter.\n if (dangerouslyHtml != null) {\n opts.emit(escapeScript(String(dangerouslyHtml)))\n } else {\n const children = props.children\n if (typeof children === 'string' || typeof children === 'number') {\n opts.emit(escapeScript(String(children)))\n } else if (Array.isArray(children)) {\n opts.emit(escapeScript(children.filter((c) => c != null).join('')))\n }\n }\n opts.emit(`</${tag}>`)\n parentTextState!.bits &= 1\n return\n }\n\n if (dangerouslyHtml != null) {\n opts.emit(String(dangerouslyHtml))\n } else {\n const previousState = parentTextState!.bits\n parentTextState!.bits = +(isSvg && tag !== 'foreignObject')\n try {\n walkNode(props.children, { ...opts, insertionContext: childInsertionContext(tag, props, opts.insertionContext ?? 'html') })\n } finally {\n parentTextState!.bits = previousState\n }\n }\n opts.emit(`</${tag}>`)\n // Host element closing resets outer flow \u2014 next sibling text starts fresh.\n parentTextState!.bits &= 1\n } finally {\n if (isSelect) popSelectContext()\n }\n}\n\nfunction hasHeadChild(children: unknown): boolean {\n if (children == null || typeof children === 'boolean') return false\n if (Array.isArray(children)) return children.some(hasHeadChild)\n if (typeof children !== 'string' && isIterable(children)) {\n for (const child of children as Iterable<unknown>) {\n if (hasHeadChild(child)) return true\n }\n return false\n }\n return isElementOfType(children, 'head')\n}\n\nfunction isElementOfType(value: unknown, type: string): value is ReactElement {\n const marker = (value as ReactElement | null)?.$$typeof as unknown\n return (\n !!value &&\n typeof value === 'object' &&\n (marker === REACT_ELEMENT_TYPE || marker === REACT_LEGACY_ELEMENT_TYPE) &&\n (value as ReactElement).type === type\n )\n}\n\nfunction isIterable(value: unknown): value is Iterable<unknown> {\n return !!value && isFunction((value as { [Symbol.iterator]?: unknown })[Symbol.iterator])\n}\n\nfunction walkComponent(\n fn: Function,\n props: Record<string, any>,\n opts: WalkOptions,\n ref?: unknown,\n): void {\n if (opts.onBrowserBailout) {\n opts = { ...opts, componentStack: `\\n at ${(fn as any).displayName || fn.name || 'Anonymous'}${opts.componentStack || ''}` }\n }\n const frame = currentSSRFrame()\n const previousTree = frame.treeId, previousLocal = frame.localId\n frame.treeId = opts.treeId ?? 1n\n frame.localId = 0\n try {\n if ((fn as any).prototype?.isReactComponent) {\n props = resolveClassProps(fn, props)\n const ctxType = (fn as any).contextType\n const ctxValue = ctxType ? ctxType._currentValue : undefined\n const instance = new (fn as any)(props, ctxValue)\n instance.props = props\n instance.context = ctxValue\n if ((fn as any).getDerivedStateFromProps) {\n const d = (fn as any).getDerivedStateFromProps(props, instance.state)\n if (d) instance.state = { ...instance.state, ...d }\n }\n walkNode(instance.render(), opts)\n return\n }\n const rendered = (fn as any)(props, ref)\n // A component which materialized IDs owns one extra tree slot for its children.\n walkNode(rendered, frame.localId ? { ...opts, treeId: forkId(frame.treeId, 1, 0) } : opts)\n } catch (error) {\n if (opts.thrownInfo && !opts.thrownInfo.componentStack) opts.thrownInfo.componentStack = opts.componentStack\n if (isBrowserError(error) && !(error as any).componentStack) {\n Object.defineProperty(error, 'componentStack', { value: opts.componentStack })\n }\n throw error\n } finally {\n frame.treeId = previousTree\n frame.localId = previousLocal\n }\n}\n\nfunction walkSuspense(\n props: Record<string, any>,\n opts: WalkOptions,\n): void {\n const id = opts.nextBoundaryId()\n // Snapshot contexts BEFORE attempting children, so if a descendant suspends\n // we can replay the same provider stack when re-rendering the boundary.\n const contextSnapshot = snapshotContexts()\n\n // Try to render the children synchronously. If a thenable is thrown,\n // record the boundary and emit the fallback.\n const childParts: HtmlPart[] = []\n const nested: SuspendedBoundary[] = []\n const thrownInfo: { componentStack?: string | undefined } = {}\n const childEmit = (s: HtmlPart) => childParts.push(s)\n const resourceScope: ResourceScope | undefined = currentSSRFrame().shellFlushed ? {} : undefined\n try {\n walkNode(props.children, {\n ...opts,\n resourceScope,\n thrownInfo,\n emit: childEmit,\n onSuspend: opts.onSuspend ? (boundary) => nested.push(boundary) : undefined,\n nextBoundaryId: opts.nextBoundaryId,\n })\n } catch (thenable: any) {\n nested.length = 0\n const suspended = isThenable(thenable)\n if (!suspended) {\n if (isBrowserError(thenable)) opts.onBrowserBailout?.(thenable, { componentStack: (thenable as any).componentStack || opts.componentStack || '' })\n else opts.onError?.(thenable)\n }\n const fallbackParts: HtmlPart[] = []\n walkNode(props.fallback, {\n ...opts,\n emit: (s) => fallbackParts.push(s),\n onSuspend: opts.onSuspend ? (boundary) => nested.push(boundary) : undefined,\n nextBoundaryId: opts.nextBoundaryId,\n })\n // A streamed suspension is emitted as itself, so the stream can still\n // inline its content if it completes before these bytes are written.\n const boundary: SuspendedBoundary | undefined = suspended && opts.onSuspend ? {\n id, treeId: opts.treeId ?? 1n, insertionContext: opts.insertionContext ?? 'html', fallback: fallbackParts, children: props.children, thenable, contextSnapshot,\n componentStack: thrownInfo.componentStack || opts.componentStack || '',\n } : undefined\n if (boundary) opts.emit(boundary)\n else emitBoundary(opts, id, fallbackParts, suspended ? '$?' : isBrowserError(thenable) ? '$!' : '$E')\n for (const inner of nested) opts.onSuspend?.(inner)\n if (boundary) opts.onSuspend!(boundary)\n return\n }\n\n if (resourceScope) currentSSRFrame().resources?.mergeScope(resourceScope, opts.resourceScope)\n\n // Children rendered fully \u2014 emit them wrapped in resolved-boundary markers\n // (`<!--$N-->` / `<!--/$-->`). Without markers, the client hydrator has no\n // way to know this subtree is inside a Suspense, so if the client version\n // of a descendant (e.g. `React.lazy`) suspends it can't pinpoint which DOM\n // range to adopt on resolve \u2014 it creates fresh DOM next to the SSR content,\n // producing visible duplicates (e.g. double navbar logos). Markers let the\n // client treat this as a resolved boundary and hydrate in-place.\n emitBoundary(opts, id, childParts, '$')\n for (const boundary of nested) opts.onSuspend?.(boundary)\n}\n\nfunction emitBoundary(opts: WalkOptions, id: number, parts: HtmlPart[], marker: string): void {\n const [open, close] = boundaryEdges(id, marker, opts.insertionContext, currentSSRFrame().identifierPrefix)\n opts.emit(open)\n for (const part of parts) opts.emit(part)\n opts.emit(close)\n}\n\n/**\n * Boundary markers: `$` completed, `$E`/`$!` client-rendered, `$?` pending.\n * A pending template is allowed in table insertion modes and does not break\n * out of SVG/MathML. The visible fallback is a sibling, not an HTML div wrapper.\n * Bare rows/columns create implicit containers. Close them on both sides so\n * neither preceding rows nor the fallback can move a marker inside one.\n * These end tags are ignored when no such container is open.\n */\nexport function boundaryEdges(id: number, marker: string, context: InsertionContext | undefined, prefix: string): [string, string] {\n const close = context === 'table' ? '</tbody></colgroup>' : ''\n return [`${close}<!--${marker}${id}-->${marker === '$?' ? `<template id=\"${escapeAttr(boundaryId(id, prefix))}\"></template>` : ''}`, `${close}<!--/$-->`]\n}\n"],
5
+ "mappings": "AAAA,SAAS,kBAAkB;AAC3B,SAAS,6BAAoD;AAC7D,SAAS,cAAc;AACvB,SAAS,qBAAqB;AAC9B,SAAS,YAAY,kBAAkB;AACvC,SAAS,yBAAyB;AAClC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,sBAAsB;AAC/B,SAAS,oBAAoB;AAoDtB,SAAS,KAAK,MAAiB,MAAyB;AAG7D,MAAI,CAAC,KAAK,UAAW,QAAO,EAAE,GAAG,MAAM,WAAW,EAAE,MAAM,EAAE,KAAK,qBAAqB,OAAO,EAAE;AAC/F,WAAS,MAAM,IAAI;AACrB;AAMA,MAAM,mBAA8B,CAAC;AACrC,SAAS,kBAAkB,OAAsB;AAC/C,mBAAiB,KAAK,KAAK;AAC7B;AACA,SAAS,mBAAyB;AAChC,mBAAiB,IAAI;AACvB;AACA,SAAS,qBAA8B;AACrC,SAAO,iBAAiB,SAAS,iBAAiB,iBAAiB,SAAS,CAAC,IAAI;AACnF;AAEA,SAAS,gBAAgB,UAA2B;AAIlD,MAAI,YAAY,KAAM,QAAO;AAC7B,MAAI,cAAc,QAAQ,EAAG,QAAO,KAAK;AACzC,MAAI,MAAM,QAAQ,QAAQ,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,QAAI,SAAU,MAAK,UAAW,QAAQ;AACtC;AAAA,EACF;AAEA,MAAI,cAAe,iBAAgB,EAAE,WAAW,WAAW,eAAe,KAAK,aAAa;AAS5F,eAAa,MAAM,IAAI,YAAY,GAAG;AACtC,aAAW,YAAY,OAAQ,MAAK,YAAY,QAAQ;AAC1D;AAEA,SAAS,aAAa,MAAmB,IAAY,OAAmB,QAAsB;AAC5F,QAAM,CAAC,MAAM,KAAK,IAAI,cAAc,IAAI,QAAQ,KAAK,kBAAkB,gBAAgB,EAAE,gBAAgB;AACzG,OAAK,KAAK,IAAI;AACd,aAAW,QAAQ,MAAO,MAAK,KAAK,IAAI;AACxC,OAAK,KAAK,KAAK;AACjB;AAUO,SAAS,cAAc,IAAY,QAAgB,SAAuC,QAAkC;AACjI,QAAM,QAAQ,YAAY,UAAU,wBAAwB;AAC5D,SAAO,CAAC,GAAG,KAAK,OAAO,MAAM,GAAG,EAAE,MAAM,WAAW,OAAO,iBAAiB,WAAW,WAAW,IAAI,MAAM,CAAC,CAAC,kBAAkB,EAAE,IAAI,GAAG,KAAK,WAAW;AAC1J;",
6
+ "names": ["boundary"]
7
7
  }
@@ -1,102 +1,8 @@
1
- export type RedactPreset = 'nano' | 'full';
2
- /**
3
- * Opt-in feature set. Each flag toggles whether the feature's real
4
- * implementation ships (`true`) or is swapped with a stub module that
5
- * degrades gracefully (`false`). Missing keys fall back to the preset's
6
- * default. Adding a feature to this interface propagates to consumer
7
- * configs as autocompleted options.
8
- */
9
- export interface RedactFeatures {
10
- /** Activity visibility, retained state and disconnected effects. */
11
- activity?: boolean;
12
- /** DOM instances, events, focus, layout and observers for Fragment refs. */
13
- fragmentRefs?: boolean;
14
- /** Experimental native ViewTransition animations. Opt-in until snapshot parity is complete. */
15
- viewTransitions?: boolean;
16
- /**
17
- * `createPortal`. When `false`, portal elements render in place as a
18
- * Fragment (the `container` prop is ignored). `renderPortal` and its
19
- * deps are stripped from the bundle.
20
- */
21
- portal?: boolean;
22
- /**
23
- * `createContext` / `useContext` / `<Provider>` / `<Consumer>`. When
24
- * `false`, Providers render as Fragments (value never propagates),
25
- * Consumers invoke their function-children with the context's default
26
- * value, and `useContext` returns the default. Provider-walk logic and
27
- * `renderProvider` are stripped.
28
- */
29
- context?: boolean;
30
- /**
31
- * `<Suspense>` boundaries + streaming hydration. When `false`, Suspense
32
- * elements render as Fragments (children mount inline, `fallback` is
33
- * ignored). Thrown thenables still schedule a re-render on settle, so
34
- * eventual consistency works — just no fallback UI during the pending
35
- * window. Boundary-handler stack and hydration integration are stripped.
36
- */
37
- suspense?: boolean;
38
- /**
39
- * `React.memo`. When `false`, memoized components still render but without
40
- * the prop-equality gate — every parent rerender passes through.
41
- * `shallowEqual` and the force-rerender bypass are stripped.
42
- */
43
- memo?: boolean;
44
- /**
45
- * `React.forwardRef`. When `false`, forwardRef components still render but
46
- * the ref prop isn't forwarded to the inner function. React 19+ treats
47
- * refs as normal props on function components anyway, so most apps can
48
- * drop this. The dispatcher save/restore machinery is stripped.
49
- */
50
- forwardRef?: boolean;
51
- /**
52
- * `React.lazy`. When `false`, lazy elements still resolve if their payload
53
- * is already available synchronously (e.g. pre-awaited RSC Flight); async
54
- * resolution throws a clear error. The hydration-deferred-reveal path and
55
- * Suspense coordination are stripped.
56
- */
57
- lazy?: boolean;
58
- /**
59
- * Class components (`extends Component`). When `false`, class components
60
- * still render but only honor the core contract: constructor + `render()`
61
- * + `setState`. Dropped: `contextType`, `getDerivedStateFromProps`,
62
- * `shouldComponentUpdate`, `componentDidMount`/`Update`/`WillUnmount`,
63
- * `getDerivedStateFromError`/`componentDidCatch` (error boundaries).
64
- */
65
- classComponents?: boolean;
66
- /**
67
- * SSR hydration (`hydrateRoot`). When `false`, `hydrateRoot` throws
68
- * (use `createRoot` for SPAs). The HydrationCursor / DOM adoption /
69
- * streaming-boundary coordination / event-replay / scroll-guard
70
- * machinery is stripped — the biggest single chunk of reducible code.
71
- */
72
- hydration?: boolean;
73
- }
74
- export interface RedactOptions {
75
- /** Skip aliasing specific specifiers, e.g. if a consumer wants real React somewhere. */
76
- skip?: ReadonlyArray<string>;
77
- /**
78
- * Override package resolution root. Defaults to the Vite config root. Useful
79
- * for monorepos where the plugin lives in a different workspace than the
80
- * consumer app.
81
- */
82
- resolveFrom?: string;
83
- /**
84
- * Explicit package roots, bypassing node_modules lookup. Keys are package
85
- * names (e.g. `@tanstack/redact`), values are absolute paths to the package
86
- * directory. Handy for cross-workspace testing / bring-your-own-build setups.
87
- */
88
- packageRoots?: Record<string, string>;
89
- /**
90
- * Starting point for feature selection. `'full'` (default) turns every
91
- * feature on — drop-in React parity, opt-out individual features via
92
- * `features`. `'nano'` turns everything off — opt in to what you need.
93
- */
94
- preset?: RedactPreset;
95
- /**
96
- * Per-feature overrides merged on top of the preset's defaults. Enables
97
- * fine-grained "preset minus X" or "preset plus Y" configurations.
98
- */
99
- features?: RedactFeatures;
1
+ export type { RedactPreset, RedactFeatures } from "../bundler-core/selection.js";
2
+ import type { RedactOptions as CommonRedactOptions } from "../bundler-core/resolution.js";
3
+ export interface RedactOptions extends CommonRedactOptions {
4
+ /** Select browser and/or SSR replacement. RSC always keeps native React. */
5
+ environments?: ReadonlyArray<'client' | 'ssr'>;
100
6
  }
101
7
  export declare function redact(options?: RedactOptions): any;
102
8
  export default redact;