@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.
- 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 +6 -4
- 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/dom/synthetic-event.ts +9 -4
- 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/reconcile.js
CHANGED
|
@@ -17,7 +17,7 @@ import { acquireResource } from "./resources.js";
|
|
|
17
17
|
import { a as transitionRender, p as hasTransition, t as flushTransitions, c as cancelPendingTransitions, s as scheduleTransitionRoot } from "./features/suspense-runtime/index.js";
|
|
18
18
|
import { commitFragmentRef, placeFragmentCommits, updateFragmentHost, refreshFragmentInstances } from "./features/fragment-refs/index.js";
|
|
19
19
|
import { isObject } from "../core/functions.js";
|
|
20
|
-
import { createFiber, REACT_ELEMENT_TYPE, REACT_LEGACY_ELEMENT_TYPE, REACT_FRAGMENT_TYPE } from "../core/index.js";
|
|
20
|
+
import { FiberTag, createFiber, REACT_ELEMENT_TYPE, REACT_LEGACY_ELEMENT_TYPE, REACT_FRAGMENT_TYPE } from "../core/index.js";
|
|
21
21
|
import { createHostNode, setProp } from "./dom.js";
|
|
22
22
|
import { rememberRefreshRender, scheduleRefreshRoot, commitRefreshRoot, failRefreshRoot, failRefreshBoundary, resolveRefreshType, sameRefreshFamily, needsRefreshRemount } from "./refresh.js";
|
|
23
23
|
import { forkId, assignReactIds, deferHydration as deferHydration2, queueHydrationEnd, finishHydration, adoptHostDom, adoptTextDom, findHostParent as findHydrationHost, abortHydration, recoverHydration, isHydrationBailout, resumeHydration } from "./features/hydration/index.js";
|
|
@@ -29,24 +29,24 @@ let flushing = false;
|
|
|
29
29
|
let isBatching = false;
|
|
30
30
|
const pendingRoots = /* @__PURE__ */ new Set();
|
|
31
31
|
let forceRerenderingFiber = null;
|
|
32
|
-
function tagForType(type, fallback =
|
|
32
|
+
function tagForType(type, fallback = FiberTag.Host) {
|
|
33
33
|
if (isString(type))
|
|
34
|
-
return
|
|
34
|
+
return FiberTag.Host;
|
|
35
35
|
if (type === REACT_FRAGMENT_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_VIEW_TRANSITION_TYPE)
|
|
36
|
-
return
|
|
36
|
+
return FiberTag.Fragment;
|
|
37
37
|
const marker = type?.$$typeof;
|
|
38
38
|
for (const match of TYPE_MATCHERS) {
|
|
39
39
|
const tag = match(type, marker);
|
|
40
40
|
if (tag !== null)
|
|
41
41
|
return tag;
|
|
42
42
|
}
|
|
43
|
-
return isFunction(type) ? type.prototype?.isReactComponent ?
|
|
43
|
+
return isFunction(type) ? type.prototype?.isReactComponent ? FiberTag.Class : FiberTag.Function : fallback;
|
|
44
44
|
}
|
|
45
45
|
function registerElementMarker(sym) {
|
|
46
46
|
ACCEPTED_ELEMENT_MARKERS.add(sym);
|
|
47
47
|
}
|
|
48
48
|
function collectHostDoms(fiber, out) {
|
|
49
|
-
if (fiber.t ===
|
|
49
|
+
if (fiber.t === FiberTag.Suspense && fiber.b?.w) {
|
|
50
50
|
let node = fiber.b.b;
|
|
51
51
|
while (node) {
|
|
52
52
|
out.push(node);
|
|
@@ -56,23 +56,23 @@ function collectHostDoms(fiber, out) {
|
|
|
56
56
|
}
|
|
57
57
|
return;
|
|
58
58
|
}
|
|
59
|
-
if (fiber.t <=
|
|
59
|
+
if (fiber.t <= FiberTag.Text) {
|
|
60
60
|
if (fiber.n && !documentMetadataParent(fiber))
|
|
61
61
|
out.push(fiber.n);
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
64
|
-
if (fiber.t ===
|
|
64
|
+
if (fiber.t === FiberTag.Portal)
|
|
65
65
|
return;
|
|
66
|
-
if (fiber.t ===
|
|
66
|
+
if (fiber.t === FiberTag.Suspense && fiber.b?.b)
|
|
67
67
|
out.push(fiber.b.b);
|
|
68
68
|
let c = fiber.c;
|
|
69
69
|
while (c) {
|
|
70
70
|
collectHostDoms(c, out);
|
|
71
71
|
c = c.s;
|
|
72
72
|
}
|
|
73
|
-
if (fiber.t ===
|
|
73
|
+
if (fiber.t === FiberTag.Suspense && fiber.b?.f)
|
|
74
74
|
collectHostDoms(fiber.b.f, out);
|
|
75
|
-
if (fiber.t ===
|
|
75
|
+
if (fiber.t === FiberTag.Suspense && fiber.b?.e)
|
|
76
76
|
out.push(fiber.b.e);
|
|
77
77
|
}
|
|
78
78
|
function stageCommit(fiber, work, ref = false) {
|
|
@@ -89,7 +89,7 @@ function markPendingDeletion(fiber, deleted) {
|
|
|
89
89
|
deleted.push(fiber);
|
|
90
90
|
for (let child = fiber.c; child; child = child.s)
|
|
91
91
|
markPendingDeletion(child, deleted);
|
|
92
|
-
if (fiber.t ===
|
|
92
|
+
if (fiber.t === FiberTag.Suspense && fiber.b?.f)
|
|
93
93
|
markPendingDeletion(fiber.b.f, deleted);
|
|
94
94
|
}
|
|
95
95
|
function resolvedType(type) {
|
|
@@ -154,8 +154,7 @@ function captureRootError(root, stack, error) {
|
|
|
154
154
|
if (!errors.length)
|
|
155
155
|
root.u = void 0;
|
|
156
156
|
errors.push({ error, stack });
|
|
157
|
-
if (process.env.NODE_ENV !== "production")
|
|
158
|
-
errors[errors.length - 1].ownerStack = devToolsMetadata.errorStack ?? null;
|
|
157
|
+
if (process.env.NODE_ENV !== "production") errors[errors.length - 1].ownerStack = devToolsMetadata.errorStack ?? null;
|
|
159
158
|
scheduleUpdate(root.r);
|
|
160
159
|
}
|
|
161
160
|
function captureError(capture) {
|
|
@@ -180,8 +179,7 @@ function flushRoot(root) {
|
|
|
180
179
|
renderUpdates(root, pending);
|
|
181
180
|
flushTransitions?.(root, renderUpdates);
|
|
182
181
|
runEffects(root);
|
|
183
|
-
if (process.env.NODE_ENV !== "production")
|
|
184
|
-
commitRefreshRoot(root);
|
|
182
|
+
if (process.env.NODE_ENV !== "production") commitRefreshRoot(root);
|
|
185
183
|
}
|
|
186
184
|
function rememberActivityEffect(fiber, hook, effect) {
|
|
187
185
|
if (fiber.r?.a || fiber.r?.sp && effect.t === 1 && !effect.s)
|
|
@@ -256,11 +254,10 @@ function unmountAllChildren(parent) {
|
|
|
256
254
|
function fiberFromChild(child, parent) {
|
|
257
255
|
const text = isString(child);
|
|
258
256
|
const type = text ? null : process.env.NODE_ENV !== "production" ? resolveRefreshType(child.type) : child.type;
|
|
259
|
-
const fiber = createFiber(text ?
|
|
257
|
+
const fiber = createFiber(text ? FiberTag.Text : tagForType(type), type, text ? null : child.key ?? null);
|
|
260
258
|
fiber.ref = text ? null : child.ref ?? null;
|
|
261
259
|
fiber.v = text ? child : child.props;
|
|
262
|
-
if (process.env.NODE_ENV !== "production" && !text)
|
|
263
|
-
rememberDevToolsFiber(fiber, child);
|
|
260
|
+
if (process.env.NODE_ENV !== "production" && !text) rememberDevToolsFiber(fiber, child);
|
|
264
261
|
fiber.p = parent;
|
|
265
262
|
if (currentCommit?.c.length)
|
|
266
263
|
onCommitRollback(() => {
|
|
@@ -316,7 +313,7 @@ function renderUpdates(root, pending, update) {
|
|
|
316
313
|
continue;
|
|
317
314
|
}
|
|
318
315
|
if (error instanceof RenderErrorCapture) {
|
|
319
|
-
if (error.b.t ===
|
|
316
|
+
if (error.b.t === FiberTag.Root)
|
|
320
317
|
throw error;
|
|
321
318
|
rewindCommit(checkpoint);
|
|
322
319
|
captureError(error);
|
|
@@ -335,7 +332,7 @@ function attachRef(fiber, value) {
|
|
|
335
332
|
if (isActivityHidden(fiber) || layoutIsDisconnected(fiber))
|
|
336
333
|
return;
|
|
337
334
|
stageCommit(fiber, () => {
|
|
338
|
-
if (fiber.t ===
|
|
335
|
+
if (fiber.t === FiberTag.Resource)
|
|
339
336
|
value = fiber.i;
|
|
340
337
|
fiber.cr = ref;
|
|
341
338
|
if (isFunction(ref)) {
|
|
@@ -361,17 +358,17 @@ function enqueueEffect(fiber, effect) {
|
|
|
361
358
|
const getCurrentRoot = () => currentRoot;
|
|
362
359
|
function sameType(fiber, child) {
|
|
363
360
|
if (isString(child))
|
|
364
|
-
return fiber.t ===
|
|
361
|
+
return fiber.t === FiberTag.Text;
|
|
365
362
|
if (process.env.NODE_ENV !== "production" && sameRefreshFamily(fiber.type, child.type))
|
|
366
363
|
return fiber.key === (child.key ?? null);
|
|
367
364
|
return fiber.key === (child.key ?? null) && (fiber.type === child.type || resolvedType(fiber.type) === resolvedType(child.type));
|
|
368
365
|
}
|
|
369
366
|
const getForceRerenderingFiber = () => forceRerenderingFiber;
|
|
370
|
-
installRenderer(
|
|
371
|
-
installRenderer(
|
|
372
|
-
installRenderer(
|
|
373
|
-
installRenderer(
|
|
374
|
-
installRenderer(
|
|
367
|
+
installRenderer(FiberTag.Text, renderText);
|
|
368
|
+
installRenderer(FiberTag.Host, renderHost);
|
|
369
|
+
installRenderer(FiberTag.Resource, renderHost);
|
|
370
|
+
installRenderer(FiberTag.Function, renderFunction);
|
|
371
|
+
installRenderer(FiberTag.Fragment, renderFragment);
|
|
375
372
|
function placeDomsInOrder(doms, domParent) {
|
|
376
373
|
if (domParent.nodeType === 9) {
|
|
377
374
|
const doc = domParent;
|
|
@@ -413,10 +410,8 @@ function handleErrorInRender(fiber, err) {
|
|
|
413
410
|
if (root && currentCommit && (flushing || root.ue))
|
|
414
411
|
throw new RenderErrorCapture(root.r, err, fiber);
|
|
415
412
|
if (root?.ue) {
|
|
416
|
-
if (process.env.NODE_ENV !== "production")
|
|
417
|
-
|
|
418
|
-
else
|
|
419
|
-
root.ue(err, { componentStack: componentStack(fiber) });
|
|
413
|
+
if (process.env.NODE_ENV !== "production") runWithOwnerStack(readOwnerStack(fiber), () => root.ue(err, { componentStack: componentStack(fiber) }));
|
|
414
|
+
else root.ue(err, { componentStack: componentStack(fiber) });
|
|
420
415
|
} else
|
|
421
416
|
throw err;
|
|
422
417
|
}
|
|
@@ -428,10 +423,8 @@ function handleCommitError(fiber, error) {
|
|
|
428
423
|
}
|
|
429
424
|
const root = findRoot2(fiber);
|
|
430
425
|
if (root) {
|
|
431
|
-
if (process.env.NODE_ENV !== "production")
|
|
432
|
-
|
|
433
|
-
else
|
|
434
|
-
captureRootError(root, componentStack(fiber), error);
|
|
426
|
+
if (process.env.NODE_ENV !== "production") runWithOwnerStack(readOwnerStack(fiber), () => captureRootError(root, componentStack(fiber), error));
|
|
427
|
+
else captureRootError(root, componentStack(fiber), error);
|
|
435
428
|
} else
|
|
436
429
|
queueMicrotask(() => {
|
|
437
430
|
throw error;
|
|
@@ -439,12 +432,10 @@ function handleCommitError(fiber, error) {
|
|
|
439
432
|
}
|
|
440
433
|
function invokeCommit(fiber, callback) {
|
|
441
434
|
try {
|
|
442
|
-
if (process.env.NODE_ENV !== "production" && fiber)
|
|
443
|
-
return invokeDevToolsCallback(fiber, callback);
|
|
435
|
+
if (process.env.NODE_ENV !== "production" && fiber) return invokeDevToolsCallback(fiber, callback);
|
|
444
436
|
return callback();
|
|
445
437
|
} catch (error) {
|
|
446
|
-
if (!fiber)
|
|
447
|
-
throw error;
|
|
438
|
+
if (!fiber) throw error;
|
|
448
439
|
handleCommitError(fiber, error);
|
|
449
440
|
}
|
|
450
441
|
}
|
|
@@ -543,17 +534,16 @@ function runEffect(fiber, effect) {
|
|
|
543
534
|
(fiber.e ||= []).push(cleanup);
|
|
544
535
|
}
|
|
545
536
|
class RenderSuspenseCapture {
|
|
546
|
-
b;
|
|
547
537
|
constructor(b) {
|
|
548
538
|
this.b = b;
|
|
549
539
|
}
|
|
540
|
+
b;
|
|
550
541
|
}
|
|
551
542
|
function scheduleRootRender(root, render) {
|
|
552
543
|
if (process.env.NODE_ENV !== "production")
|
|
553
544
|
rememberRefreshRender(root, render);
|
|
554
545
|
markTransitionUpdate && markTransitionUpdate(root);
|
|
555
|
-
if (!scheduleTransitionRoot?.(root, render))
|
|
556
|
-
root.u = render;
|
|
546
|
+
if (!scheduleTransitionRoot?.(root, render)) root.u = render;
|
|
557
547
|
pendingRoots.add(root);
|
|
558
548
|
if (isBatching)
|
|
559
549
|
return;
|
|
@@ -563,16 +553,15 @@ function scheduleRootRender(root, render) {
|
|
|
563
553
|
flushPending();
|
|
564
554
|
}
|
|
565
555
|
class RenderErrorCapture {
|
|
566
|
-
b;
|
|
567
|
-
e;
|
|
568
|
-
s;
|
|
569
556
|
constructor(b, e, source = b) {
|
|
570
557
|
this.b = b;
|
|
571
558
|
this.e = e;
|
|
572
559
|
this.s = componentStack(source);
|
|
573
|
-
if (process.env.NODE_ENV !== "production")
|
|
574
|
-
this.o = readOwnerStack(source);
|
|
560
|
+
if (process.env.NODE_ENV !== "production") this.o = readOwnerStack(source);
|
|
575
561
|
}
|
|
562
|
+
b;
|
|
563
|
+
e;
|
|
564
|
+
s;
|
|
576
565
|
}
|
|
577
566
|
function flushRootErrors(root) {
|
|
578
567
|
const errors = root.er;
|
|
@@ -588,10 +577,8 @@ function flushRootErrors(root) {
|
|
|
588
577
|
throw captured.error;
|
|
589
578
|
});
|
|
590
579
|
} else if (root.ue) {
|
|
591
|
-
if (process.env.NODE_ENV !== "production")
|
|
592
|
-
|
|
593
|
-
else
|
|
594
|
-
root.ue(captured.error, { componentStack: captured.stack });
|
|
580
|
+
if (process.env.NODE_ENV !== "production") runWithOwnerStack(captured.ownerStack ?? null, () => root.ue(captured.error, { componentStack: captured.stack }));
|
|
581
|
+
else root.ue(captured.error, { componentStack: captured.stack });
|
|
595
582
|
} else if (isFunction(globalThis.reportError))
|
|
596
583
|
globalThis.reportError(captured.error);
|
|
597
584
|
else
|
|
@@ -657,10 +644,9 @@ function reconcileChildren(parent, nodes, _domParent, _anchor) {
|
|
|
657
644
|
function installRenderer(tag, fn) {
|
|
658
645
|
RENDERERS[tag] = fn;
|
|
659
646
|
}
|
|
660
|
-
const recoveringBoundaries = /* @__PURE__ */ new Set();
|
|
661
647
|
function findErrorBoundary(fiber) {
|
|
662
648
|
for (let parent = fiber.p; parent; parent = parent.p) {
|
|
663
|
-
if (parent.u || parent.pd ||
|
|
649
|
+
if (parent.u || parent.pd || parent.br)
|
|
664
650
|
continue;
|
|
665
651
|
const instance = parent.i;
|
|
666
652
|
if (instance?._f === parent && (parent.b?.b?.getDerivedStateFromError || instance.componentDidCatch))
|
|
@@ -705,27 +691,19 @@ function runEffects(root) {
|
|
|
705
691
|
effectQueues.forEach((queue, index) => queue.unshift(...batches[index]));
|
|
706
692
|
});
|
|
707
693
|
queueCommitEffects(() => {
|
|
708
|
-
if (process.env.NODE_ENV !== "production")
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
});
|
|
713
|
-
else
|
|
714
|
-
for (const [fiber, effect] of insertion)
|
|
715
|
-
runEffect(fiber, effect);
|
|
694
|
+
if (process.env.NODE_ENV !== "production") measureDevToolsLayout(root, () => {
|
|
695
|
+
for (const [fiber, effect] of insertion) runEffect(fiber, effect);
|
|
696
|
+
});
|
|
697
|
+
else for (const [fiber, effect] of insertion) runEffect(fiber, effect);
|
|
716
698
|
if (layout.length) {
|
|
717
|
-
if (process.env.NODE_ENV !== "production")
|
|
718
|
-
measureDevToolsLayout(root, () => {
|
|
719
|
-
for (const [fiber, work] of layout) {
|
|
720
|
-
if (!isFunction(work) && !fiber.u && !isActivityHidden(fiber) && !layoutIsDisconnected(fiber))
|
|
721
|
-
work.d?.();
|
|
722
|
-
}
|
|
723
|
-
});
|
|
724
|
-
else
|
|
699
|
+
if (process.env.NODE_ENV !== "production") measureDevToolsLayout(root, () => {
|
|
725
700
|
for (const [fiber, work] of layout) {
|
|
726
|
-
if (!isFunction(work) && !fiber.u && !isActivityHidden(fiber) && !layoutIsDisconnected(fiber))
|
|
727
|
-
work.d?.();
|
|
701
|
+
if (!isFunction(work) && !fiber.u && !isActivityHidden(fiber) && !layoutIsDisconnected(fiber)) work.d?.();
|
|
728
702
|
}
|
|
703
|
+
});
|
|
704
|
+
else for (const [fiber, work] of layout) {
|
|
705
|
+
if (!isFunction(work) && !fiber.u && !isActivityHidden(fiber) && !layoutIsDisconnected(fiber)) work.d?.();
|
|
706
|
+
}
|
|
729
707
|
const runLayout = () => {
|
|
730
708
|
for (const [fiber, work] of layout) {
|
|
731
709
|
if (!isFunction(work))
|
|
@@ -737,29 +715,23 @@ function runEffects(root) {
|
|
|
737
715
|
};
|
|
738
716
|
if (process.env.NODE_ENV !== "production") {
|
|
739
717
|
const measured = wrapDevToolsLayout(root, runLayout);
|
|
740
|
-
if (!(deferTransitionLayout && deferTransitionLayout(measured)))
|
|
741
|
-
|
|
742
|
-
} else if (!(deferTransitionLayout && deferTransitionLayout(runLayout)))
|
|
743
|
-
runLayout();
|
|
718
|
+
if (!(deferTransitionLayout && deferTransitionLayout(measured))) measured();
|
|
719
|
+
} else if (!(deferTransitionLayout && deferTransitionLayout(runLayout))) runLayout();
|
|
744
720
|
}
|
|
745
721
|
if (batch.length) {
|
|
746
722
|
const passive = () => {
|
|
747
723
|
for (const [fiber, effect] of batch)
|
|
748
|
-
if (!fiber.u && !isActivityHidden(fiber) && !activityIsDisconnected(fiber))
|
|
749
|
-
effect.d?.();
|
|
724
|
+
if (!fiber.u && !isActivityHidden(fiber) && !activityIsDisconnected(fiber)) effect.d?.();
|
|
750
725
|
for (const [fiber, effect] of batch)
|
|
751
726
|
runEffect(fiber, effect);
|
|
752
727
|
};
|
|
753
728
|
if (process.env.NODE_ENV !== "production") {
|
|
754
729
|
const measured = wrapDevToolsPassive(root, passive);
|
|
755
730
|
if (!(deferTransitionPassive && deferTransitionPassive(measured))) {
|
|
756
|
-
if (ReactSharedInternals.A)
|
|
757
|
-
|
|
758
|
-
else
|
|
759
|
-
queueMicrotask(measured);
|
|
731
|
+
if (ReactSharedInternals.A) ReactSharedInternals.A.push(measured);
|
|
732
|
+
else queueMicrotask(measured);
|
|
760
733
|
}
|
|
761
|
-
} else if (!(deferTransitionPassive && deferTransitionPassive(passive)))
|
|
762
|
-
queueMicrotask(passive);
|
|
734
|
+
} else if (!(deferTransitionPassive && deferTransitionPassive(passive))) queueMicrotask(passive);
|
|
763
735
|
}
|
|
764
736
|
});
|
|
765
737
|
})();
|
|
@@ -773,9 +745,9 @@ function renderFragment(fiber) {
|
|
|
773
745
|
function findSuspenseBoundary(fiber) {
|
|
774
746
|
let child = fiber;
|
|
775
747
|
for (let parent = fiber.p; parent; parent = parent.p) {
|
|
776
|
-
if (child.t ===
|
|
748
|
+
if (child.t === FiberTag.Activity && child.v?.mode === "hidden")
|
|
777
749
|
return null;
|
|
778
|
-
if (parent.t ===
|
|
750
|
+
if (parent.t === FiberTag.Suspense && parent.b?.f !== child)
|
|
779
751
|
return parent;
|
|
780
752
|
child = parent;
|
|
781
753
|
}
|
|
@@ -828,10 +800,10 @@ function renderHost(fiber) {
|
|
|
828
800
|
const type = fiber.type;
|
|
829
801
|
const isSvg = type === "svg" || domParent.namespaceURI === "http://www.w3.org/2000/svg";
|
|
830
802
|
const singleton = !isSvg && documentSingleton(fiber);
|
|
831
|
-
const isResource = fiber.t ===
|
|
803
|
+
const isResource = fiber.t === FiberTag.Resource;
|
|
832
804
|
const canAcquire = !isSvg && (isResource || !fiber.m) && resourceKind(type, props);
|
|
833
805
|
if (isResource || canAcquire) {
|
|
834
|
-
fiber.t =
|
|
806
|
+
fiber.t = FiberTag.Resource;
|
|
835
807
|
if (canAcquire) {
|
|
836
808
|
let container = domParent.ownerDocument || domParent;
|
|
837
809
|
if (type !== "script") {
|
|
@@ -867,6 +839,8 @@ function renderHost(fiber) {
|
|
|
867
839
|
applyHostProps(fiber.n, props, void 0, isSvg, isInput, isTextarea, deferValue);
|
|
868
840
|
}
|
|
869
841
|
updateFragmentHost(fiber, true);
|
|
842
|
+
if (!hydrated && props.autoFocus && !isSvg && (deferValue || type === "button"))
|
|
843
|
+
scheduleLifecycle(fiber, () => fiber.n.focus());
|
|
870
844
|
attachRef(fiber, fiber.n);
|
|
871
845
|
} else if (prev !== props) {
|
|
872
846
|
queueMutation(() => applyHostProps(fiber.n, props, prev, isSvg, isInput, isTextarea, deferValue));
|
|
@@ -875,10 +849,8 @@ function renderHost(fiber) {
|
|
|
875
849
|
const node = fiber.n;
|
|
876
850
|
const previous = devToolsMetadata.hosts.get(node);
|
|
877
851
|
onCommitRollback(() => {
|
|
878
|
-
if (previous)
|
|
879
|
-
|
|
880
|
-
else
|
|
881
|
-
devToolsMetadata.hosts.delete(node);
|
|
852
|
+
if (previous) devToolsMetadata.hosts.set(node, previous);
|
|
853
|
+
else devToolsMetadata.hosts.delete(node);
|
|
882
854
|
});
|
|
883
855
|
devToolsMetadata.hosts.set(node, fiber);
|
|
884
856
|
}
|
|
@@ -906,8 +878,7 @@ function renderNode(fiber) {
|
|
|
906
878
|
siblings[i].s = siblings[i + 1] ?? null;
|
|
907
879
|
});
|
|
908
880
|
const next = fiberFromChild({ $$typeof: REACT_ELEMENT_TYPE, type: fiber2.type, key: fiber2.key, ref: fiber2.ref, props: fiber2.v }, parent);
|
|
909
|
-
if (fiber2.ix !== void 0)
|
|
910
|
-
next.ix = fiber2.ix;
|
|
881
|
+
if (fiber2.ix !== void 0) next.ix = fiber2.ix;
|
|
911
882
|
next.s = fiber2.s;
|
|
912
883
|
const previous = siblings[siblings.indexOf(fiber2) - 1];
|
|
913
884
|
if (previous)
|
|
@@ -919,7 +890,7 @@ function renderNode(fiber) {
|
|
|
919
890
|
})(fiber);
|
|
920
891
|
fiber.type = resolveRefreshType(fiber.type);
|
|
921
892
|
}
|
|
922
|
-
if (fiber.t !==
|
|
893
|
+
if (fiber.t !== FiberTag.Memo)
|
|
923
894
|
fiber.g = false;
|
|
924
895
|
fiber.r ||= currentRoot || findRoot2(fiber);
|
|
925
896
|
if (fiber.r?.sp && fiber.p?.ld && fiber.m === null)
|
|
@@ -928,10 +899,8 @@ function renderNode(fiber) {
|
|
|
928
899
|
CAPABILITIES.p(fiber);
|
|
929
900
|
const fn = RENDERERS[fiber.t];
|
|
930
901
|
try {
|
|
931
|
-
if (process.env.NODE_ENV !== "production")
|
|
932
|
-
|
|
933
|
-
else if (fn)
|
|
934
|
-
fn(fiber);
|
|
902
|
+
if (process.env.NODE_ENV !== "production") renderWithDevTools(fiber, fn);
|
|
903
|
+
else if (fn) fn(fiber);
|
|
935
904
|
} catch (error) {
|
|
936
905
|
stagedCommits.delete(fiber);
|
|
937
906
|
if (currentRoot?.h && !findErrorBoundary(fiber) || error instanceof RenderErrorCapture || error instanceof RenderSuspenseCapture || isHydrationBailout(error))
|
|
@@ -950,8 +919,7 @@ function renderNode(fiber) {
|
|
|
950
919
|
function indexChildren(parent, next) {
|
|
951
920
|
rememberChildList(parent, collectChildren(parent));
|
|
952
921
|
const remaining = /* @__PURE__ */ new Map();
|
|
953
|
-
for (; next; next = next.s)
|
|
954
|
-
remaining.set(next.key ?? next.ix, next);
|
|
922
|
+
for (; next; next = next.s) remaining.set(next.key ?? next.ix, next);
|
|
955
923
|
return remaining;
|
|
956
924
|
}
|
|
957
925
|
function reconcile(parent, newChildren) {
|
|
@@ -961,8 +929,7 @@ function reconcile(parent, newChildren) {
|
|
|
961
929
|
const hydrating = !!currentRoot?.h;
|
|
962
930
|
for (let i = 0; i < newChildren.length; i++) {
|
|
963
931
|
const child = newChildren[i];
|
|
964
|
-
if (child == null)
|
|
965
|
-
continue;
|
|
932
|
+
if (child == null) continue;
|
|
966
933
|
let match;
|
|
967
934
|
if (!remaining && !hydrating && next && next.ix === i && sameType(next, child)) {
|
|
968
935
|
match = next;
|
|
@@ -980,25 +947,20 @@ function reconcile(parent, newChildren) {
|
|
|
980
947
|
}
|
|
981
948
|
const fiber = match ?? fiberFromChild(child, parent);
|
|
982
949
|
if (match) {
|
|
983
|
-
if (isString(child))
|
|
984
|
-
fiber.v = child;
|
|
950
|
+
if (isString(child)) fiber.v = child;
|
|
985
951
|
else {
|
|
986
|
-
if (fiber.type !== child.type)
|
|
987
|
-
fiber.t = tagForType(child.type);
|
|
952
|
+
if (fiber.type !== child.type) fiber.t = tagForType(child.type);
|
|
988
953
|
fiber.type = child.type;
|
|
989
954
|
fiber.v = child.props;
|
|
990
|
-
if (process.env.NODE_ENV !== "production")
|
|
991
|
-
rememberDevToolsFiber(fiber, child);
|
|
955
|
+
if (process.env.NODE_ENV !== "production") rememberDevToolsFiber(fiber, child);
|
|
992
956
|
fiber.ref = child.ref ?? null;
|
|
993
957
|
}
|
|
994
958
|
}
|
|
995
959
|
fiber.ix = i;
|
|
996
960
|
if (remaining) {
|
|
997
961
|
fiber.p = parent;
|
|
998
|
-
if (previous)
|
|
999
|
-
|
|
1000
|
-
else
|
|
1001
|
-
parent.c = fiber;
|
|
962
|
+
if (previous) previous.s = fiber;
|
|
963
|
+
else parent.c = fiber;
|
|
1002
964
|
}
|
|
1003
965
|
previous = fiber;
|
|
1004
966
|
}
|
|
@@ -1009,14 +971,10 @@ function reconcile(parent, newChildren) {
|
|
|
1009
971
|
if (!remaining && next) {
|
|
1010
972
|
remaining = indexChildren(parent, next);
|
|
1011
973
|
}
|
|
1012
|
-
if (previous)
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
for (const fiber of remaining?.values() ?? [])
|
|
1017
|
-
removeFiber(fiber);
|
|
1018
|
-
if (hydrating)
|
|
1019
|
-
assignReactIds(parent, newChildren);
|
|
974
|
+
if (previous) previous.s = null;
|
|
975
|
+
else parent.c = null;
|
|
976
|
+
for (const fiber of remaining?.values() ?? []) removeFiber(fiber);
|
|
977
|
+
if (hydrating) assignReactIds(parent, newChildren);
|
|
1020
978
|
renderChildChain(parent);
|
|
1021
979
|
}
|
|
1022
980
|
const pendingEffects = [];
|
|
@@ -1027,7 +985,7 @@ let stagedCommits = /* @__PURE__ */ new Map();
|
|
|
1027
985
|
function renderChildChain(parent) {
|
|
1028
986
|
for (let child = parent.c; child; child = child.s)
|
|
1029
987
|
renderNode(child);
|
|
1030
|
-
while (parent.t !==
|
|
988
|
+
while (parent.t !== FiberTag.Host && parent.t !== FiberTag.Root && parent.t !== FiberTag.Portal)
|
|
1031
989
|
parent = parent.p;
|
|
1032
990
|
queuePlacement(parent);
|
|
1033
991
|
}
|
|
@@ -1042,7 +1000,7 @@ function commitPlacements(parents) {
|
|
|
1042
1000
|
for (const parent of [...new Set(parents)].sort((a, b) => fiberDepth(b) - fiberDepth(a))) {
|
|
1043
1001
|
if (parent.u || parent.pd)
|
|
1044
1002
|
continue;
|
|
1045
|
-
const domParent = parent.t ===
|
|
1003
|
+
const domParent = parent.t === FiberTag.Host ? parent.n : parent.t === FiberTag.Portal ? parent.v.container : parent.r.c;
|
|
1046
1004
|
const doms = [];
|
|
1047
1005
|
for (let child = parent.c; child; child = child.s)
|
|
1048
1006
|
collectHostDoms(child, doms);
|
|
@@ -1060,7 +1018,7 @@ function removeFiber(fiber, remove = true) {
|
|
|
1060
1018
|
stagedCommits.delete(fiber);
|
|
1061
1019
|
commitFragmentRef(fiber, 1);
|
|
1062
1020
|
fiber.u = true;
|
|
1063
|
-
if (fiber.t ===
|
|
1021
|
+
if (fiber.t === FiberTag.Suspense && fiber.b?.b) {
|
|
1064
1022
|
const state = fiber.b;
|
|
1065
1023
|
state.x?.();
|
|
1066
1024
|
state.b._reactRetry = void 0;
|
|
@@ -1079,10 +1037,10 @@ function removeFiber(fiber, remove = true) {
|
|
|
1079
1037
|
}
|
|
1080
1038
|
}
|
|
1081
1039
|
}
|
|
1082
|
-
if (fiber.t <=
|
|
1040
|
+
if (fiber.t <= FiberTag.Text)
|
|
1083
1041
|
updateFragmentHost(fiber, false);
|
|
1084
1042
|
commitFragmentRef(fiber, 2);
|
|
1085
|
-
if (fiber.t ===
|
|
1043
|
+
if (fiber.t === FiberTag.Suspense && fiber.b?.f) {
|
|
1086
1044
|
removeFiber(fiber.b.f, remove);
|
|
1087
1045
|
fiber.b.f = null;
|
|
1088
1046
|
}
|
|
@@ -1102,11 +1060,11 @@ function removeFiber(fiber, remove = true) {
|
|
|
1102
1060
|
let c = fiber.c;
|
|
1103
1061
|
while (c) {
|
|
1104
1062
|
const next = c.s;
|
|
1105
|
-
removeFiber(c, fiber.t ===
|
|
1063
|
+
removeFiber(c, fiber.t === FiberTag.Portal || remove && (singleton || fiber.t !== FiberTag.Host));
|
|
1106
1064
|
c = next;
|
|
1107
1065
|
}
|
|
1108
1066
|
fiber.c = null;
|
|
1109
|
-
if (!singleton && (remove || documentMetadataParent(fiber)) && fiber.t <=
|
|
1067
|
+
if (!singleton && (remove || documentMetadataParent(fiber)) && fiber.t <= FiberTag.Text && fiber.n) {
|
|
1110
1068
|
fiber.n.parentNode?.removeChild(fiber.n);
|
|
1111
1069
|
}
|
|
1112
1070
|
}
|
|
@@ -1133,8 +1091,7 @@ function handleSuspended(fiber, thenable) {
|
|
|
1133
1091
|
function scheduleUpdate(fiber) {
|
|
1134
1092
|
if (fiber.u || fiber.pd)
|
|
1135
1093
|
return;
|
|
1136
|
-
if (process.env.NODE_ENV !== "production")
|
|
1137
|
-
markDevToolsUpdate(fiber);
|
|
1094
|
+
if (process.env.NODE_ENV !== "production") markDevToolsUpdate(fiber);
|
|
1138
1095
|
fiber.bt = !!ReactSharedInternals.T && (!fiber.g || !!fiber.bt);
|
|
1139
1096
|
fiber.g = true;
|
|
1140
1097
|
if (ReactSharedInternals.F === fiber)
|
|
@@ -1152,12 +1109,19 @@ function scheduleUpdate(fiber) {
|
|
|
1152
1109
|
pendingRoots.add(root);
|
|
1153
1110
|
if (isBatching)
|
|
1154
1111
|
return;
|
|
1112
|
+
if (process.env.NODE_ENV !== "production" && ReactSharedInternals.A) {
|
|
1113
|
+
ReactSharedInternals.A.push(flushPending);
|
|
1114
|
+
return;
|
|
1115
|
+
}
|
|
1155
1116
|
if (!root.s) {
|
|
1156
1117
|
root.s = true;
|
|
1157
|
-
if (process.env.NODE_ENV !== "production"
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1118
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1119
|
+
const scheduled = () => {
|
|
1120
|
+
if (root.s === scheduled) flushPending();
|
|
1121
|
+
};
|
|
1122
|
+
root.s = scheduled;
|
|
1123
|
+
queueMicrotask(scheduled);
|
|
1124
|
+
} else queueMicrotask(flushPending);
|
|
1161
1125
|
}
|
|
1162
1126
|
}
|
|
1163
1127
|
setCommitCheckpointHook(() => {
|
|
@@ -1211,23 +1175,17 @@ import { renderWithDevTools, rememberDevToolsFiber, markDevToolsUpdate, invokeDe
|
|
|
1211
1175
|
import { measureDevToolsLayout, wrapDevToolsLayout, wrapDevToolsPassive } from "./devtools-effects.js";
|
|
1212
1176
|
setCommitPlacementHook(commitPlacements);
|
|
1213
1177
|
function recoverRootError(error, abort) {
|
|
1214
|
-
if (!(error instanceof RenderErrorCapture) || error.b.t !==
|
|
1178
|
+
if (!(error instanceof RenderErrorCapture) || error.b.t !== FiberTag.Root)
|
|
1215
1179
|
return false;
|
|
1216
1180
|
const root = error.b.r;
|
|
1217
1181
|
abort?.();
|
|
1218
1182
|
discardPendingWork(root);
|
|
1219
1183
|
discardPendingEffects(root);
|
|
1220
|
-
if (process.env.NODE_ENV !== "production")
|
|
1221
|
-
|
|
1222
|
-
else
|
|
1223
|
-
captureRootError(root, error.s, error.e);
|
|
1184
|
+
if (process.env.NODE_ENV !== "production") runWithOwnerStack(error.o ?? null, () => captureRootError(root, error.s, error.e));
|
|
1185
|
+
else captureRootError(root, error.s, error.e);
|
|
1224
1186
|
return true;
|
|
1225
1187
|
}
|
|
1226
|
-
function delegateFiber(fiber, type, tag = tagForType(
|
|
1227
|
-
type,
|
|
1228
|
-
4
|
|
1229
|
-
/* FiberTag.Fragment */
|
|
1230
|
-
)) {
|
|
1188
|
+
function delegateFiber(fiber, type, tag = tagForType(type, FiberTag.Fragment)) {
|
|
1231
1189
|
const previousType = fiber.type, previousTag = fiber.t;
|
|
1232
1190
|
fiber.type = type;
|
|
1233
1191
|
fiber.t = tag;
|
|
@@ -1284,7 +1242,6 @@ export {
|
|
|
1284
1242
|
reconcileChildren,
|
|
1285
1243
|
reconcileRaw,
|
|
1286
1244
|
recoverRootError,
|
|
1287
|
-
recoveringBoundaries,
|
|
1288
1245
|
registerElementMarker,
|
|
1289
1246
|
registerTypeMatcher,
|
|
1290
1247
|
rememberActivityEffect,
|
|
@@ -1303,3 +1260,4 @@ export {
|
|
|
1303
1260
|
unmountFiber,
|
|
1304
1261
|
withCurrentRoot
|
|
1305
1262
|
};
|
|
1263
|
+
//# sourceMappingURL=reconcile.js.map
|