@qwik.dev/core 2.0.0-beta.24 → 2.0.0-beta.25
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/bindings/qwik.darwin-arm64.node +0 -0
- package/bindings/qwik.linux-x64-gnu.node +0 -0
- package/bindings/qwik.win32-x64-msvc.node +0 -0
- package/bindings/qwik_wasm_bg.wasm +0 -0
- package/dist/backpatch/package.json +1 -1
- package/dist/build/package.json +1 -1
- package/dist/cli.mjs +2 -2
- package/dist/core-internal.d.ts +6 -4
- package/dist/core.min.mjs +1 -1
- package/dist/core.mjs +137 -98
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.mjs +127 -80
- package/dist/loader/package.json +1 -1
- package/dist/optimizer.mjs +1 -1
- package/dist/server.mjs +2 -2
- package/dist/testing/index.d.ts +133 -2
- package/dist/testing/index.mjs +134 -106
- package/dist/testing/package.json +1 -1
- package/package.json +2 -2
package/dist/core.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* @qwik.dev/core 2.0.0-beta.
|
|
3
|
+
* @qwik.dev/core 2.0.0-beta.25-dev+2677279
|
|
4
4
|
* Copyright QwikDev. All Rights Reserved.
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://github.com/QwikDev/qwik/blob/main/LICENSE
|
|
@@ -1007,7 +1007,7 @@ const COMMA = ',';
|
|
|
1007
1007
|
*
|
|
1008
1008
|
* @public
|
|
1009
1009
|
*/
|
|
1010
|
-
const version = "2.0.0-beta.
|
|
1010
|
+
const version = "2.0.0-beta.25-dev+2677279";
|
|
1011
1011
|
|
|
1012
1012
|
// keep this import from core/build so the cjs build works
|
|
1013
1013
|
const createPlatform = () => {
|
|
@@ -3068,6 +3068,14 @@ const _jsxSplit = (type, varProps, constProps, children, flags, key, dev) => {
|
|
|
3068
3068
|
}
|
|
3069
3069
|
delete constProps[k];
|
|
3070
3070
|
}
|
|
3071
|
+
else if (k === BIND_CHECKED) {
|
|
3072
|
+
// Set flag, will process after walk
|
|
3073
|
+
bindCheckedSignal = constProps[k];
|
|
3074
|
+
}
|
|
3075
|
+
else if (k === BIND_VALUE) {
|
|
3076
|
+
// Set flag, will process after walk
|
|
3077
|
+
bindValueSignal = constProps[k];
|
|
3078
|
+
}
|
|
3071
3079
|
processedKeys.add(k);
|
|
3072
3080
|
}
|
|
3073
3081
|
}
|
|
@@ -3097,44 +3105,65 @@ const _jsxSplit = (type, varProps, constProps, children, flags, key, dev) => {
|
|
|
3097
3105
|
}
|
|
3098
3106
|
processedKeys.add(k);
|
|
3099
3107
|
}
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3108
|
+
}
|
|
3109
|
+
// Handle bind:* - only in varProps, bind:* should be moved to varProps
|
|
3110
|
+
if (bindCheckedSignal || bindValueSignal) {
|
|
3111
|
+
if (!varPropsCopied) {
|
|
3112
|
+
varProps = { ...varProps };
|
|
3113
|
+
varPropsCopied = true;
|
|
3114
|
+
}
|
|
3115
|
+
varProps ||= {};
|
|
3116
|
+
if (bindCheckedSignal) {
|
|
3117
|
+
// Delete from both varProps and constProps if present
|
|
3118
|
+
if (varProps && _hasOwnProperty$1.call(varProps, BIND_CHECKED)) {
|
|
3107
3119
|
delete varProps[BIND_CHECKED];
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
constProps = { ...constProps };
|
|
3114
|
-
constPropsCopied = true;
|
|
3115
|
-
}
|
|
3116
|
-
const existingHandler = constProps['q-e:input'];
|
|
3117
|
-
delete constProps['q-e:input'];
|
|
3118
|
-
toSort = mergeHandlers(varProps, 'q-e:input', existingHandler) || toSort;
|
|
3120
|
+
}
|
|
3121
|
+
if (constProps && _hasOwnProperty$1.call(constProps, BIND_CHECKED)) {
|
|
3122
|
+
if (!constPropsCopied) {
|
|
3123
|
+
constProps = { ...constProps };
|
|
3124
|
+
constPropsCopied = true;
|
|
3119
3125
|
}
|
|
3120
|
-
|
|
3126
|
+
delete constProps[BIND_CHECKED];
|
|
3121
3127
|
}
|
|
3122
|
-
|
|
3128
|
+
varProps.checked = bindCheckedSignal;
|
|
3129
|
+
const handler = createQRL(null, '_chk', _chk, null, [bindCheckedSignal]);
|
|
3130
|
+
// Move q-e:input from constProps if it exists
|
|
3131
|
+
if (constProps && _hasOwnProperty$1.call(constProps, 'q-e:input')) {
|
|
3132
|
+
if (!constPropsCopied) {
|
|
3133
|
+
constProps = { ...constProps };
|
|
3134
|
+
constPropsCopied = true;
|
|
3135
|
+
}
|
|
3136
|
+
const existingHandler = constProps['q-e:input'];
|
|
3137
|
+
delete constProps['q-e:input'];
|
|
3138
|
+
toSort = mergeHandlers(varProps, 'q-e:input', existingHandler) || toSort;
|
|
3139
|
+
}
|
|
3140
|
+
toSort = mergeHandlers(varProps, 'q-e:input', handler) || toSort;
|
|
3141
|
+
}
|
|
3142
|
+
else if (bindValueSignal) {
|
|
3143
|
+
// Delete from both varProps and constProps if present
|
|
3144
|
+
if (varProps && _hasOwnProperty$1.call(varProps, BIND_VALUE)) {
|
|
3123
3145
|
delete varProps[BIND_VALUE];
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3146
|
+
}
|
|
3147
|
+
if (constProps && _hasOwnProperty$1.call(constProps, BIND_VALUE)) {
|
|
3148
|
+
if (!constPropsCopied) {
|
|
3149
|
+
constProps = { ...constProps };
|
|
3150
|
+
constPropsCopied = true;
|
|
3151
|
+
}
|
|
3152
|
+
delete constProps[BIND_VALUE];
|
|
3153
|
+
}
|
|
3154
|
+
varProps.value = bindValueSignal;
|
|
3155
|
+
const handler = createQRL(null, '_val', _val, null, [bindValueSignal]);
|
|
3156
|
+
// Move q-e:input from constProps if it exists
|
|
3157
|
+
if (constProps && _hasOwnProperty$1.call(constProps, 'q-e:input')) {
|
|
3158
|
+
if (!constPropsCopied) {
|
|
3159
|
+
constProps = { ...constProps };
|
|
3160
|
+
constPropsCopied = true;
|
|
3135
3161
|
}
|
|
3136
|
-
|
|
3162
|
+
const existingHandler = constProps['q-e:input'];
|
|
3163
|
+
delete constProps['q-e:input'];
|
|
3164
|
+
toSort = mergeHandlers(varProps, 'q-e:input', existingHandler) || toSort;
|
|
3137
3165
|
}
|
|
3166
|
+
toSort = mergeHandlers(varProps, 'q-e:input', handler) || toSort;
|
|
3138
3167
|
}
|
|
3139
3168
|
}
|
|
3140
3169
|
// Transform className -> class
|
|
@@ -3712,6 +3741,10 @@ function runEventHandlerQRL(handler, event, element, ctx = newInvokeContextFromD
|
|
|
3712
3741
|
* @internal
|
|
3713
3742
|
*/
|
|
3714
3743
|
function _run(event, element) {
|
|
3744
|
+
if (!element.isConnected) {
|
|
3745
|
+
// ignore events on disconnected elements, this can happen when the event is triggered while the element is being removed
|
|
3746
|
+
return;
|
|
3747
|
+
}
|
|
3715
3748
|
const ctx = newInvokeContextFromDOM(event, element);
|
|
3716
3749
|
if (typeof this === 'string') {
|
|
3717
3750
|
setCaptures(deserializeCaptures(ctx.$container$, this));
|
|
@@ -7619,6 +7652,15 @@ function materializeFromVNodeData(vParent, vData, element, child) {
|
|
|
7619
7652
|
vnode_ensureElementKeyInflated(elementVNode);
|
|
7620
7653
|
addVNode(elementVNode);
|
|
7621
7654
|
child = fastNextSibling(child);
|
|
7655
|
+
while (
|
|
7656
|
+
// skip only elements, not text nodes
|
|
7657
|
+
isElement(child) &&
|
|
7658
|
+
shouldSkipElement(child)) {
|
|
7659
|
+
child = fastNextSibling(child);
|
|
7660
|
+
if (!child && value > 0) {
|
|
7661
|
+
throw qError(27 /* QError.materializeVNodeDataError */, [vData, peek(), nextToConsumeIdx]);
|
|
7662
|
+
}
|
|
7663
|
+
}
|
|
7622
7664
|
}
|
|
7623
7665
|
// collect the elements;
|
|
7624
7666
|
}
|
|
@@ -9010,12 +9052,7 @@ class Serializer {
|
|
|
9010
9052
|
]);
|
|
9011
9053
|
}
|
|
9012
9054
|
else if (value instanceof EffectSubscription) {
|
|
9013
|
-
this.output(32 /* TypeIds.EffectSubscription */, [
|
|
9014
|
-
value.consumer,
|
|
9015
|
-
value.property,
|
|
9016
|
-
value.backRef,
|
|
9017
|
-
value.data,
|
|
9018
|
-
]);
|
|
9055
|
+
this.output(32 /* TypeIds.EffectSubscription */, [value.consumer, value.property, value.data]);
|
|
9019
9056
|
}
|
|
9020
9057
|
else if (isStore(value)) {
|
|
9021
9058
|
const storeHandler = getStoreHandler(value);
|
|
@@ -9083,19 +9120,13 @@ class Serializer {
|
|
|
9083
9120
|
this.output(2 /* TypeIds.ForwardRef */, forwardRefId);
|
|
9084
9121
|
}
|
|
9085
9122
|
else {
|
|
9086
|
-
this.output(26 /* TypeIds.SerializerSignal */, [
|
|
9087
|
-
value.$computeQrl$,
|
|
9088
|
-
filterEffectBackRefs(value[_EFFECT_BACK_REF]),
|
|
9089
|
-
value.$effects$,
|
|
9090
|
-
maybeValue,
|
|
9091
|
-
]);
|
|
9123
|
+
this.output(26 /* TypeIds.SerializerSignal */, [value.$computeQrl$, value.$effects$, maybeValue]);
|
|
9092
9124
|
}
|
|
9093
9125
|
return;
|
|
9094
9126
|
}
|
|
9095
9127
|
if (value instanceof WrappedSignalImpl) {
|
|
9096
9128
|
this.output(23 /* TypeIds.WrappedSignal */, [
|
|
9097
9129
|
...serializeWrappingFn(this.$serializationContext$, value),
|
|
9098
|
-
filterEffectBackRefs(value[_EFFECT_BACK_REF]),
|
|
9099
9130
|
value.$flags$,
|
|
9100
9131
|
value.$hostElement$,
|
|
9101
9132
|
...(value.$effects$ || []),
|
|
@@ -9123,11 +9154,7 @@ class Serializer {
|
|
|
9123
9154
|
else if (shouldNeverSerialize) {
|
|
9124
9155
|
v = NEEDS_COMPUTATION;
|
|
9125
9156
|
}
|
|
9126
|
-
const out = [
|
|
9127
|
-
value.$computeQrl$,
|
|
9128
|
-
filterEffectBackRefs(value[_EFFECT_BACK_REF]),
|
|
9129
|
-
value.$effects$,
|
|
9130
|
-
];
|
|
9157
|
+
const out = [value.$computeQrl$, value.$effects$];
|
|
9131
9158
|
if (isAsync) {
|
|
9132
9159
|
// After SSR, the signal is never loading, so no need to send it
|
|
9133
9160
|
out.push(value.$loadingEffects$, value.$errorEffects$, value.$untrackedError$);
|
|
@@ -9254,14 +9281,7 @@ class Serializer {
|
|
|
9254
9281
|
this.output(29 /* TypeIds.JSXNode */, out);
|
|
9255
9282
|
}
|
|
9256
9283
|
else if (value instanceof Task) {
|
|
9257
|
-
const out = [
|
|
9258
|
-
value.$qrl$,
|
|
9259
|
-
value.$flags$,
|
|
9260
|
-
value.$index$,
|
|
9261
|
-
value.$el$,
|
|
9262
|
-
value[_EFFECT_BACK_REF],
|
|
9263
|
-
value.$state$,
|
|
9264
|
-
];
|
|
9284
|
+
const out = [value.$qrl$, value.$flags$, value.$index$, value.$el$, value.$state$];
|
|
9265
9285
|
while (out[out.length - 1] === undefined) {
|
|
9266
9286
|
out.pop();
|
|
9267
9287
|
}
|
|
@@ -9460,18 +9480,6 @@ function serializeWrappingFn(serializationContext, value) {
|
|
|
9460
9480
|
const syncFnId = serializationContext.$addSyncFn$(value.$funcStr$, value.$args$.length, value.$func$);
|
|
9461
9481
|
return [syncFnId, value.$args$];
|
|
9462
9482
|
}
|
|
9463
|
-
function filterEffectBackRefs(effectBackRef) {
|
|
9464
|
-
let effectBackRefToSerialize = undefined;
|
|
9465
|
-
if (effectBackRef) {
|
|
9466
|
-
for (const [effectProp, effect] of effectBackRef) {
|
|
9467
|
-
if (effect.backRef) {
|
|
9468
|
-
effectBackRefToSerialize ||= new Map();
|
|
9469
|
-
effectBackRefToSerialize.set(effectProp, effect);
|
|
9470
|
-
}
|
|
9471
|
-
}
|
|
9472
|
-
}
|
|
9473
|
-
return effectBackRefToSerialize;
|
|
9474
|
-
}
|
|
9475
9483
|
function tryGetBackRefs(props) {
|
|
9476
9484
|
return Object.prototype.hasOwnProperty.call(props, QBackRefs)
|
|
9477
9485
|
? props[QBackRefs]
|
|
@@ -10195,8 +10203,7 @@ const inflate = (container, target, typeId, data) => {
|
|
|
10195
10203
|
task.$flags$ = v[1];
|
|
10196
10204
|
task.$index$ = v[2];
|
|
10197
10205
|
task.$el$ = v[3];
|
|
10198
|
-
task
|
|
10199
|
-
task.$state$ = v[5];
|
|
10206
|
+
task.$state$ = v[4];
|
|
10200
10207
|
break;
|
|
10201
10208
|
case 21 /* TypeIds.Component */:
|
|
10202
10209
|
target[SERIALIZABLE_STATE][0] = data[0];
|
|
@@ -10217,6 +10224,7 @@ const inflate = (container, target, typeId, data) => {
|
|
|
10217
10224
|
const storeHandler = getStoreHandler(target);
|
|
10218
10225
|
storeHandler.$flags$ = flags;
|
|
10219
10226
|
storeHandler.$effects$ = effects;
|
|
10227
|
+
restoreEffectBackRefForEffectsMap(storeHandler.$effects$, store);
|
|
10220
10228
|
break;
|
|
10221
10229
|
}
|
|
10222
10230
|
case 22 /* TypeIds.Signal */: {
|
|
@@ -10224,6 +10232,7 @@ const inflate = (container, target, typeId, data) => {
|
|
|
10224
10232
|
const d = data;
|
|
10225
10233
|
signal.$untrackedValue$ = d[0];
|
|
10226
10234
|
signal.$effects$ = new Set(d.slice(1));
|
|
10235
|
+
restoreEffectBackRefForEffects(signal.$effects$, signal);
|
|
10227
10236
|
break;
|
|
10228
10237
|
}
|
|
10229
10238
|
case 23 /* TypeIds.WrappedSignal */: {
|
|
@@ -10231,41 +10240,43 @@ const inflate = (container, target, typeId, data) => {
|
|
|
10231
10240
|
const d = data;
|
|
10232
10241
|
signal.$func$ = container.getSyncFn(d[0]);
|
|
10233
10242
|
signal.$args$ = d[1];
|
|
10234
|
-
signal[_EFFECT_BACK_REF] = d[2];
|
|
10235
10243
|
signal.$untrackedValue$ = NEEDS_COMPUTATION;
|
|
10236
|
-
signal.$flags$ = d[
|
|
10244
|
+
signal.$flags$ = d[2];
|
|
10237
10245
|
signal.$flags$ |= 1 /* SignalFlags.INVALID */;
|
|
10238
|
-
signal.$hostElement$ = d[
|
|
10239
|
-
signal.$effects$ = new Set(d.slice(
|
|
10246
|
+
signal.$hostElement$ = d[3];
|
|
10247
|
+
signal.$effects$ = new Set(d.slice(4));
|
|
10240
10248
|
inflateWrappedSignalValue(signal);
|
|
10249
|
+
restoreEffectBackRefForEffects(signal.$effects$, signal);
|
|
10241
10250
|
break;
|
|
10242
10251
|
}
|
|
10243
10252
|
case 25 /* TypeIds.AsyncSignal */: {
|
|
10244
10253
|
const asyncSignal = target;
|
|
10245
10254
|
const d = data;
|
|
10246
10255
|
asyncSignal.$computeQrl$ = d[0];
|
|
10247
|
-
asyncSignal
|
|
10248
|
-
asyncSignal.$
|
|
10249
|
-
asyncSignal.$
|
|
10250
|
-
asyncSignal.$
|
|
10251
|
-
asyncSignal.$
|
|
10252
|
-
asyncSignal.$flags$ = d[6] ?? 0;
|
|
10256
|
+
asyncSignal.$effects$ = new Set(d[1]);
|
|
10257
|
+
asyncSignal.$loadingEffects$ = new Set(d[2]);
|
|
10258
|
+
asyncSignal.$errorEffects$ = new Set(d[3]);
|
|
10259
|
+
asyncSignal.$untrackedError$ = d[4];
|
|
10260
|
+
asyncSignal.$flags$ = d[5] ?? 0;
|
|
10253
10261
|
if (asyncSignal.$flags$ & 64 /* AsyncSignalFlags.CLIENT_ONLY */) {
|
|
10254
10262
|
// If it's client only, it was serialized because it pretended to be loading
|
|
10255
10263
|
asyncSignal.$untrackedLoading$ = true;
|
|
10256
10264
|
}
|
|
10257
|
-
const hasValue = d.length >
|
|
10265
|
+
const hasValue = d.length > 6;
|
|
10258
10266
|
if (hasValue) {
|
|
10259
|
-
asyncSignal.$untrackedValue$ = d[
|
|
10267
|
+
asyncSignal.$untrackedValue$ = d[6];
|
|
10260
10268
|
}
|
|
10261
10269
|
// can happen when never serialize etc
|
|
10262
10270
|
if (asyncSignal.$untrackedValue$ === NEEDS_COMPUTATION) {
|
|
10263
10271
|
asyncSignal.$flags$ |= 1 /* SignalFlags.INVALID */;
|
|
10264
10272
|
}
|
|
10265
10273
|
// Note, we use the setter so that it schedules polling if needed
|
|
10266
|
-
asyncSignal.interval = (d[
|
|
10267
|
-
asyncSignal.$concurrency$ = (d[
|
|
10268
|
-
asyncSignal.$timeoutMs$ = (d[
|
|
10274
|
+
asyncSignal.interval = (d[7] ?? 0);
|
|
10275
|
+
asyncSignal.$concurrency$ = (d[8] ?? 1);
|
|
10276
|
+
asyncSignal.$timeoutMs$ = (d[9] ?? 0);
|
|
10277
|
+
restoreEffectBackRefForEffects(asyncSignal.$effects$, asyncSignal);
|
|
10278
|
+
restoreEffectBackRefForEffects(asyncSignal.$loadingEffects$, asyncSignal);
|
|
10279
|
+
restoreEffectBackRefForEffects(asyncSignal.$errorEffects$, asyncSignal);
|
|
10269
10280
|
break;
|
|
10270
10281
|
}
|
|
10271
10282
|
// Inflating a SerializerSignal is the same as inflating a ComputedSignal
|
|
@@ -10283,19 +10294,19 @@ const inflate = (container, target, typeId, data) => {
|
|
|
10283
10294
|
// ignore preload errors
|
|
10284
10295
|
});
|
|
10285
10296
|
loading = loading.finally(() => p);
|
|
10286
|
-
|
|
10287
|
-
|
|
10288
|
-
computed.$effects$ = new Set(d[2]);
|
|
10297
|
+
if (d[1]) {
|
|
10298
|
+
computed.$effects$ = new Set(d[1]);
|
|
10289
10299
|
}
|
|
10290
|
-
const hasValue = d.length >
|
|
10300
|
+
const hasValue = d.length > 2;
|
|
10291
10301
|
if (hasValue) {
|
|
10292
|
-
computed.$untrackedValue$ = d[
|
|
10302
|
+
computed.$untrackedValue$ = d[2];
|
|
10293
10303
|
}
|
|
10294
10304
|
if (typeId !== 26 /* TypeIds.SerializerSignal */ && computed.$untrackedValue$ !== NEEDS_COMPUTATION) {
|
|
10295
10305
|
// If we have a value after SSR, it will always be mean the signal was not invalid
|
|
10296
10306
|
// The serialized signal is always left invalid so it can recreate the custom object
|
|
10297
10307
|
computed.$flags$ &= -2 /* SignalFlags.INVALID */;
|
|
10298
10308
|
}
|
|
10309
|
+
restoreEffectBackRefForEffects(computed.$effects$, computed);
|
|
10299
10310
|
break;
|
|
10300
10311
|
}
|
|
10301
10312
|
case 15 /* TypeIds.Error */: {
|
|
@@ -10370,7 +10381,9 @@ const inflate = (container, target, typeId, data) => {
|
|
|
10370
10381
|
owner._proxy = propsProxy;
|
|
10371
10382
|
}
|
|
10372
10383
|
propsProxy[_OWNER] = owner;
|
|
10373
|
-
|
|
10384
|
+
const propsHandler = propsProxy[_PROPS_HANDLER];
|
|
10385
|
+
propsHandler.$effects$ = d[3];
|
|
10386
|
+
restoreEffectBackRefForEffectsMap(propsHandler.$effects$, propsProxy);
|
|
10374
10387
|
break;
|
|
10375
10388
|
case 31 /* TypeIds.SubscriptionData */: {
|
|
10376
10389
|
const effectData = target;
|
|
@@ -10383,14 +10396,15 @@ const inflate = (container, target, typeId, data) => {
|
|
|
10383
10396
|
const d = data;
|
|
10384
10397
|
effectSub.consumer = d[0];
|
|
10385
10398
|
effectSub.property = d[1];
|
|
10386
|
-
effectSub.
|
|
10387
|
-
effectSub
|
|
10399
|
+
effectSub.data = d[2];
|
|
10400
|
+
restoreEffectBackRefForConsumer(effectSub);
|
|
10388
10401
|
break;
|
|
10389
10402
|
}
|
|
10390
10403
|
default:
|
|
10391
10404
|
throw qError(16 /* QError.serializeErrorNotImplemented */, [typeId]);
|
|
10392
10405
|
}
|
|
10393
|
-
};
|
|
10406
|
+
};
|
|
10407
|
+
/**
|
|
10394
10408
|
* Restores an array eagerly. If you need it lazily, use `deserializeData(container, TypeIds.Array,
|
|
10395
10409
|
* array)` instead
|
|
10396
10410
|
*/
|
|
@@ -10441,6 +10455,31 @@ function inflateWrappedSignalValue(signal) {
|
|
|
10441
10455
|
}
|
|
10442
10456
|
}
|
|
10443
10457
|
}
|
|
10458
|
+
function restoreEffectBackRefForConsumer(effect) {
|
|
10459
|
+
const isServerSide = import.meta.env.TEST ? isServerPlatform() : isServer;
|
|
10460
|
+
const consumerBackRef = effect.consumer;
|
|
10461
|
+
if (isServerSide && !consumerBackRef) {
|
|
10462
|
+
// on browser, we don't serialize for example VNodes, so then on server side we don't have consumer
|
|
10463
|
+
return;
|
|
10464
|
+
}
|
|
10465
|
+
consumerBackRef[_EFFECT_BACK_REF] ||= new Map();
|
|
10466
|
+
consumerBackRef[_EFFECT_BACK_REF].set(effect.property, effect);
|
|
10467
|
+
}
|
|
10468
|
+
function restoreEffectBackRefForEffects(effects, consumer) {
|
|
10469
|
+
if (effects) {
|
|
10470
|
+
for (const effect of effects) {
|
|
10471
|
+
effect.backRef ||= new Set();
|
|
10472
|
+
effect.backRef.add(consumer);
|
|
10473
|
+
}
|
|
10474
|
+
}
|
|
10475
|
+
}
|
|
10476
|
+
function restoreEffectBackRefForEffectsMap(effectsMap, consumer) {
|
|
10477
|
+
if (effectsMap) {
|
|
10478
|
+
for (const [, effects] of effectsMap) {
|
|
10479
|
+
restoreEffectBackRefForEffects(effects, consumer);
|
|
10480
|
+
}
|
|
10481
|
+
}
|
|
10482
|
+
}
|
|
10444
10483
|
|
|
10445
10484
|
/** Arrays/Objects are special-cased so their identifiers is a single digit. */
|
|
10446
10485
|
const needsInflation = (typeId) => typeId >= 15 /* TypeIds.Error */ || typeId === 4 /* TypeIds.Array */ || typeId === 5 /* TypeIds.Object */;
|