@qwik.dev/core 2.0.0-beta.23 → 2.0.0-beta.24
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 +142 -179
- package/dist/core-internal.d.ts +76 -35
- package/dist/core.min.mjs +1 -1
- package/dist/core.mjs +1362 -1112
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.mjs +4410 -3255
- package/dist/loader/index.mjs +2 -2
- package/dist/loader/package.json +1 -1
- package/dist/optimizer.mjs +1076 -1077
- package/dist/qwikloader.debug.js +0 -2
- package/dist/qwikloader.js +1 -1
- package/dist/server.d.ts +11 -7
- package/dist/server.mjs +442 -395
- package/dist/testing/index.d.ts +17 -78
- package/dist/testing/index.mjs +1172 -1050
- package/dist/testing/package.json +1 -1
- package/package.json +2 -2
package/dist/testing/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* @qwik.dev/core/testing 2.0.0-beta.
|
|
3
|
+
* @qwik.dev/core/testing 2.0.0-beta.24-dev+314726b
|
|
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
|
|
@@ -23645,7 +23645,10 @@ import { _isJSXNode, _isStringifiable } from "@qwik.dev/core/internal";
|
|
|
23645
23645
|
import { expect } from "vitest";
|
|
23646
23646
|
|
|
23647
23647
|
// packages/qwik/src/core/client/vnode-utils.ts
|
|
23648
|
-
import { isDev as
|
|
23648
|
+
import { isDev as isDev24 } from "@qwik.dev/core/build";
|
|
23649
|
+
|
|
23650
|
+
// packages/qwik/src/core/shared/error/assert.ts
|
|
23651
|
+
import { isDev } from "@qwik.dev/core/build";
|
|
23649
23652
|
|
|
23650
23653
|
// packages/qwik/src/core/shared/utils/qdev.ts
|
|
23651
23654
|
var qDev = globalThis.qDev !== false;
|
|
@@ -23702,7 +23705,7 @@ var createAndLogError = (asyncThrow, message, ...optionalParams) => {
|
|
|
23702
23705
|
// packages/qwik/src/core/shared/error/assert.ts
|
|
23703
23706
|
var ASSERT_DISCLAIMER = "Internal assert, this is likely caused by a bug in Qwik: ";
|
|
23704
23707
|
function assertDefined(value, text, ...parts) {
|
|
23705
|
-
if (
|
|
23708
|
+
if (isDev) {
|
|
23706
23709
|
if (value != null) {
|
|
23707
23710
|
return;
|
|
23708
23711
|
}
|
|
@@ -23710,7 +23713,7 @@ function assertDefined(value, text, ...parts) {
|
|
|
23710
23713
|
}
|
|
23711
23714
|
}
|
|
23712
23715
|
function assertEqual(value1, value2, text, ...parts) {
|
|
23713
|
-
if (
|
|
23716
|
+
if (isDev) {
|
|
23714
23717
|
if (value1 === value2) {
|
|
23715
23718
|
return;
|
|
23716
23719
|
}
|
|
@@ -23718,7 +23721,7 @@ function assertEqual(value1, value2, text, ...parts) {
|
|
|
23718
23721
|
}
|
|
23719
23722
|
}
|
|
23720
23723
|
function assertTrue(value1, text, ...parts) {
|
|
23721
|
-
if (
|
|
23724
|
+
if (isDev) {
|
|
23722
23725
|
if (value1 === true) {
|
|
23723
23726
|
return;
|
|
23724
23727
|
}
|
|
@@ -23726,7 +23729,7 @@ function assertTrue(value1, text, ...parts) {
|
|
|
23726
23729
|
}
|
|
23727
23730
|
}
|
|
23728
23731
|
function assertFalse(value1, text, ...parts) {
|
|
23729
|
-
if (
|
|
23732
|
+
if (isDev) {
|
|
23730
23733
|
if (value1 === false) {
|
|
23731
23734
|
return;
|
|
23732
23735
|
}
|
|
@@ -23734,7 +23737,7 @@ function assertFalse(value1, text, ...parts) {
|
|
|
23734
23737
|
}
|
|
23735
23738
|
}
|
|
23736
23739
|
function assertNumber(value1, text, ...parts) {
|
|
23737
|
-
if (
|
|
23740
|
+
if (isDev) {
|
|
23738
23741
|
if (typeof value1 === "number") {
|
|
23739
23742
|
return;
|
|
23740
23743
|
}
|
|
@@ -23834,7 +23837,12 @@ See https://qwik.dev/docs/core/tasks/#use-method-rules`,
|
|
|
23834
23837
|
// 28
|
|
23835
23838
|
"useComputed$ QRL {{0}} {{1}} cannot return a Promise",
|
|
23836
23839
|
// 29
|
|
23837
|
-
|
|
23840
|
+
`===
|
|
23841
|
+
Qwik version {{0}} already imported while importing {{1}}.
|
|
23842
|
+
This can lead to issues due to duplicated shared structures.
|
|
23843
|
+
Verify that the Qwik libraries you're using are in "resolve.noExternal[]" and in "optimizeDeps.exclude".
|
|
23844
|
+
===
|
|
23845
|
+
`,
|
|
23838
23846
|
// 30
|
|
23839
23847
|
"WrappedSignal is read-only",
|
|
23840
23848
|
// 31
|
|
@@ -23857,7 +23865,7 @@ See https://qwik.dev/docs/core/tasks/#use-method-rules`,
|
|
|
23857
23865
|
}
|
|
23858
23866
|
return `Code(Q${code2}): ${text}`;
|
|
23859
23867
|
} else {
|
|
23860
|
-
return `Code(Q${code2}) https://github.com/QwikDev/qwik/blob/
|
|
23868
|
+
return `Code(Q${code2}) https://github.com/QwikDev/qwik/blob/build/v2/packages/qwik/src/core/shared/error/error.ts#${parts.join()}L${9 + code2}`;
|
|
23861
23869
|
}
|
|
23862
23870
|
};
|
|
23863
23871
|
var qError = (code2, errorMessageArgs = []) => {
|
|
@@ -23866,7 +23874,7 @@ var qError = (code2, errorMessageArgs = []) => {
|
|
|
23866
23874
|
};
|
|
23867
23875
|
|
|
23868
23876
|
// packages/qwik/src/core/shared/qrl/qrl-utils.ts
|
|
23869
|
-
import { isDev } from "@qwik.dev/core/build";
|
|
23877
|
+
import { isDev as isDev2 } from "@qwik.dev/core/build";
|
|
23870
23878
|
var SYNC_QRL = "<sync>";
|
|
23871
23879
|
var isSyncQrl = (value) => {
|
|
23872
23880
|
return isQrl(value) && value.$symbol$ == SYNC_QRL;
|
|
@@ -23875,7 +23883,7 @@ var isQrl = (value) => {
|
|
|
23875
23883
|
return typeof value === "function" && typeof value.getSymbol === "function";
|
|
23876
23884
|
};
|
|
23877
23885
|
function assertQrl(qrl) {
|
|
23878
|
-
if (
|
|
23886
|
+
if (isDev2) {
|
|
23879
23887
|
if (!isQrl(qrl)) {
|
|
23880
23888
|
throw new Error("Not a QRL");
|
|
23881
23889
|
}
|
|
@@ -23981,9 +23989,6 @@ var NON_SERIALIZABLE_MARKER_PREFIX = ":";
|
|
|
23981
23989
|
var USE_ON_LOCAL = NON_SERIALIZABLE_MARKER_PREFIX + "on";
|
|
23982
23990
|
var USE_ON_LOCAL_SEQ_IDX = NON_SERIALIZABLE_MARKER_PREFIX + "onIdx";
|
|
23983
23991
|
var USE_ON_LOCAL_FLAGS = NON_SERIALIZABLE_MARKER_PREFIX + "onFlags";
|
|
23984
|
-
var FLUSH_COMMENT = "qkssr-f";
|
|
23985
|
-
var STREAM_BLOCK_START_COMMENT = "qkssr-pu";
|
|
23986
|
-
var STREAM_BLOCK_END_COMMENT = "qkssr-po";
|
|
23987
23992
|
var Q_PROPS_SEPARATOR = ":";
|
|
23988
23993
|
var dangerouslySetInnerHTML = "dangerouslySetInnerHTML";
|
|
23989
23994
|
var debugStyleScopeIdPrefixAttr = "__scopedStyleIdPrefix__";
|
|
@@ -24055,7 +24060,7 @@ var isText = (value) => {
|
|
|
24055
24060
|
};
|
|
24056
24061
|
|
|
24057
24062
|
// packages/qwik/src/core/shared/utils/promises.ts
|
|
24058
|
-
import { isDev as
|
|
24063
|
+
import { isDev as isDev3, isServer as isServer2 } from "@qwik.dev/core/build";
|
|
24059
24064
|
var MAX_RETRY_ON_PROMISE_COUNT = 100;
|
|
24060
24065
|
var isPromise = (value) => {
|
|
24061
24066
|
return !!value && typeof value == "object" && typeof value.then === "function";
|
|
@@ -24096,7 +24101,7 @@ function retryOnPromise(fn, onError = justThrow) {
|
|
|
24096
24101
|
if (ok) {
|
|
24097
24102
|
return result2;
|
|
24098
24103
|
}
|
|
24099
|
-
|
|
24104
|
+
isDev3 && checkError(result2);
|
|
24100
24105
|
return onError(result2);
|
|
24101
24106
|
}
|
|
24102
24107
|
let retryCount = MAX_RETRY_ON_PROMISE_COUNT;
|
|
@@ -24119,17 +24124,17 @@ function retryOnPromise(fn, onError = justThrow) {
|
|
|
24119
24124
|
}
|
|
24120
24125
|
}
|
|
24121
24126
|
}
|
|
24122
|
-
|
|
24127
|
+
isDev3 && checkError(p);
|
|
24123
24128
|
return onError(p);
|
|
24124
24129
|
};
|
|
24125
24130
|
return ok ? result2.catch(retry) : retry(result2);
|
|
24126
24131
|
}
|
|
24127
24132
|
|
|
24128
24133
|
// packages/qwik/src/core/use/use-core.ts
|
|
24129
|
-
import { isDev as
|
|
24134
|
+
import { isDev as isDev20 } from "@qwik.dev/core/build";
|
|
24130
24135
|
|
|
24131
24136
|
// packages/qwik/src/core/client/dom-container.ts
|
|
24132
|
-
import { isDev as
|
|
24137
|
+
import { isDev as isDev19 } from "@qwik.dev/core/build";
|
|
24133
24138
|
|
|
24134
24139
|
// packages/qwik/src/core/use/use-sequential-scope.ts
|
|
24135
24140
|
var useSequentialScope = () => {
|
|
@@ -24217,9 +24222,9 @@ var fromCamelToKebabCase = (text) => {
|
|
|
24217
24222
|
};
|
|
24218
24223
|
|
|
24219
24224
|
// packages/qwik/src/core/use/use-context.ts
|
|
24220
|
-
import { isDev as
|
|
24225
|
+
import { isDev as isDev4 } from "@qwik.dev/core/build";
|
|
24221
24226
|
var createContextId = (name) => {
|
|
24222
|
-
|
|
24227
|
+
isDev4 && assertTrue(/^[\w/.-]+$/.test(name), "Context name must only contain A-Z,a-z,0-9,_,.,-", name);
|
|
24223
24228
|
return /* @__PURE__ */ Object.freeze({
|
|
24224
24229
|
id: fromCamelToKebabCase(name)
|
|
24225
24230
|
});
|
|
@@ -24283,7 +24288,7 @@ Object.freeze(EMPTY_ARRAY);
|
|
|
24283
24288
|
Object.freeze(EMPTY_OBJ);
|
|
24284
24289
|
|
|
24285
24290
|
// packages/qwik/src/core/shared/qrl/qrl-class.ts
|
|
24286
|
-
import { isBrowser as isBrowser2, isDev as
|
|
24291
|
+
import { isBrowser as isBrowser2, isDev as isDev18 } from "@qwik.dev/core/build";
|
|
24287
24292
|
import { p as preload } from "@qwik.dev/core/preloader";
|
|
24288
24293
|
|
|
24289
24294
|
// packages/qwik/src/core/reactive-primitives/backref.ts
|
|
@@ -24297,7 +24302,7 @@ var BackRef = class {
|
|
|
24297
24302
|
};
|
|
24298
24303
|
|
|
24299
24304
|
// packages/qwik/src/core/shared/vnode/vnode.ts
|
|
24300
|
-
import { isDev as
|
|
24305
|
+
import { isDev as isDev5 } from "@qwik.dev/core/build";
|
|
24301
24306
|
var _a2;
|
|
24302
24307
|
_a2 = _EFFECT_BACK_REF;
|
|
24303
24308
|
var VNode = class {
|
|
@@ -24315,7 +24320,7 @@ var VNode = class {
|
|
|
24315
24320
|
}
|
|
24316
24321
|
// TODO: this creates debug issues
|
|
24317
24322
|
toString() {
|
|
24318
|
-
if (
|
|
24323
|
+
if (isDev5) {
|
|
24319
24324
|
return vnode_toString.call(this);
|
|
24320
24325
|
}
|
|
24321
24326
|
return Object.prototype.toString.call(this);
|
|
@@ -24342,13 +24347,13 @@ var ElementVNode = class extends VirtualVNode {
|
|
|
24342
24347
|
};
|
|
24343
24348
|
|
|
24344
24349
|
// packages/qwik/src/core/shared/serdes/qrl-to-string.ts
|
|
24345
|
-
import { isDev as
|
|
24350
|
+
import { isDev as isDev6 } from "@qwik.dev/core/build";
|
|
24346
24351
|
function qrlToString(serializationContext, qrl, raw) {
|
|
24347
24352
|
let symbol = qrl.$symbol$;
|
|
24348
24353
|
let chunk = qrl.$chunk$;
|
|
24349
24354
|
const platform = getPlatform();
|
|
24350
24355
|
if (platform) {
|
|
24351
|
-
const result2 =
|
|
24356
|
+
const result2 = isDev6 ? platform.chunkForSymbol(symbol, chunk, qrl.dev?.file) : platform.chunkForSymbol(symbol, chunk);
|
|
24352
24357
|
if (result2) {
|
|
24353
24358
|
chunk = result2[1];
|
|
24354
24359
|
symbol = result2[0];
|
|
@@ -24359,7 +24364,7 @@ function qrlToString(serializationContext, qrl, raw) {
|
|
|
24359
24364
|
if (!chunk) {
|
|
24360
24365
|
chunk = serializationContext.$symbolToChunkResolver$(qrl.$hash$);
|
|
24361
24366
|
}
|
|
24362
|
-
if (
|
|
24367
|
+
if (isDev6) {
|
|
24363
24368
|
const backChannel = globalThis.__qrl_back_channel__ || (globalThis.__qrl_back_channel__ = /* @__PURE__ */ new Map());
|
|
24364
24369
|
backChannel.set(qrl.$symbol$, qrl.$symbolRef$);
|
|
24365
24370
|
if (!chunk) {
|
|
@@ -24393,9 +24398,9 @@ function qrlToString(serializationContext, qrl, raw) {
|
|
|
24393
24398
|
}
|
|
24394
24399
|
function createQRLWithBackChannel(chunk, symbol, captures) {
|
|
24395
24400
|
let qrlImporter = null;
|
|
24396
|
-
if (
|
|
24401
|
+
if (isDev6 && chunk === QRL_RUNTIME_CHUNK) {
|
|
24397
24402
|
const backChannel = globalThis.__qrl_back_channel__;
|
|
24398
|
-
|
|
24403
|
+
isDev6 && assertDefined(backChannel, "Missing QRL_RUNTIME_CHUNK");
|
|
24399
24404
|
const fn = backChannel.get(symbol);
|
|
24400
24405
|
if (fn) {
|
|
24401
24406
|
qrlImporter = () => Promise.resolve({ [symbol]: fn });
|
|
@@ -24443,9 +24448,9 @@ function runEventHandlerQRL(handler, event, element, ctx = newInvokeContextFromD
|
|
|
24443
24448
|
}
|
|
24444
24449
|
|
|
24445
24450
|
// packages/qwik/src/core/client/util-mapArray.ts
|
|
24446
|
-
import { isDev as
|
|
24451
|
+
import { isDev as isDev7 } from "@qwik.dev/core/build";
|
|
24447
24452
|
var mapApp_findIndx = (array, key, start) => {
|
|
24448
|
-
|
|
24453
|
+
isDev7 && assertTrue(start % 2 === 0, "Expecting even number.");
|
|
24449
24454
|
let bottom = start >> 1;
|
|
24450
24455
|
let top = array.length - 2 >> 1;
|
|
24451
24456
|
while (bottom <= top) {
|
|
@@ -24497,7 +24502,7 @@ var mapArray_has = (array, key, start) => {
|
|
|
24497
24502
|
};
|
|
24498
24503
|
|
|
24499
24504
|
// packages/qwik/src/core/reactive-primitives/impl/signal-impl.ts
|
|
24500
|
-
import { isDev as
|
|
24505
|
+
import { isDev as isDev8, isServer as isServer3 } from "@qwik.dev/core/build";
|
|
24501
24506
|
var DEBUG = false;
|
|
24502
24507
|
var log = (...args) => console.log("SIGNAL", ...args.map(qwikDebugToString));
|
|
24503
24508
|
var SignalImpl = class {
|
|
@@ -24512,16 +24517,20 @@ var SignalImpl = class {
|
|
|
24512
24517
|
DEBUG && log("new", this);
|
|
24513
24518
|
}
|
|
24514
24519
|
/**
|
|
24515
|
-
* Use this to
|
|
24520
|
+
* Use this to trigger running subscribers, for example when the calculated value has mutated but
|
|
24516
24521
|
* remained the same object
|
|
24517
24522
|
*/
|
|
24523
|
+
trigger() {
|
|
24524
|
+
scheduleEffects(this.$container$, this, this.$effects$);
|
|
24525
|
+
}
|
|
24526
|
+
/** @deprecated Use `trigger()` instead */
|
|
24518
24527
|
force() {
|
|
24519
24528
|
scheduleEffects(this.$container$, this, this.$effects$);
|
|
24520
24529
|
}
|
|
24530
|
+
// We need this to be getter/setter so subclasses can override them
|
|
24521
24531
|
get untrackedValue() {
|
|
24522
24532
|
return this.$untrackedValue$;
|
|
24523
24533
|
}
|
|
24524
|
-
// TODO: should we disallow setting the value directly?
|
|
24525
24534
|
set untrackedValue(value) {
|
|
24526
24535
|
this.$untrackedValue$ = value;
|
|
24527
24536
|
}
|
|
@@ -24535,7 +24544,7 @@ var SignalImpl = class {
|
|
|
24535
24544
|
if (this.$container$ === null) {
|
|
24536
24545
|
this.$container$ = ctx.$container$;
|
|
24537
24546
|
} else {
|
|
24538
|
-
|
|
24547
|
+
isDev8 && assertTrue(
|
|
24539
24548
|
!ctx.$container$ || ctx.$container$ === this.$container$,
|
|
24540
24549
|
"Do not use signals across containers"
|
|
24541
24550
|
);
|
|
@@ -24572,7 +24581,7 @@ var SignalImpl = class {
|
|
|
24572
24581
|
}
|
|
24573
24582
|
}
|
|
24574
24583
|
toString() {
|
|
24575
|
-
if (
|
|
24584
|
+
if (isDev8) {
|
|
24576
24585
|
try {
|
|
24577
24586
|
return `[${this.constructor.name}${this.$flags$ & 1 /* INVALID */ ? " INVALID" : ""} ${this.$untrackedValue$}]` + (Array.from(this.$effects$ || []).map((e) => "\n -> " + pad(qwikDebugToString(e.consumer), " ")).join("\n") || "");
|
|
24578
24587
|
} catch (e) {
|
|
@@ -24589,7 +24598,7 @@ var SignalImpl = class {
|
|
|
24589
24598
|
var setupSignalValueAccess = (target, effectsProp, valueProp) => {
|
|
24590
24599
|
const ctx = tryGetInvokeContext();
|
|
24591
24600
|
if (ctx && (target.$container$ || (target.$container$ = ctx.$container$ || null))) {
|
|
24592
|
-
|
|
24601
|
+
isDev8 && assertTrue(
|
|
24593
24602
|
!ctx.$container$ || ctx.$container$ === target.$container$,
|
|
24594
24603
|
"Do not use signals across containers"
|
|
24595
24604
|
);
|
|
@@ -24608,7 +24617,7 @@ var setupSignalValueAccess = (target, effectsProp, valueProp) => {
|
|
|
24608
24617
|
};
|
|
24609
24618
|
|
|
24610
24619
|
// packages/qwik/src/core/shared/jsx/props-proxy.ts
|
|
24611
|
-
import { isDev as
|
|
24620
|
+
import { isDev as isDev9 } from "@qwik.dev/core/build";
|
|
24612
24621
|
function createPropsProxy(owner) {
|
|
24613
24622
|
return new Proxy({}, new PropsProxyHandler(owner));
|
|
24614
24623
|
}
|
|
@@ -24741,7 +24750,7 @@ var addPropsProxyEffect = (propsProxy, prop) => {
|
|
|
24741
24750
|
propsProxy.$container$ = ctx.$container$;
|
|
24742
24751
|
}
|
|
24743
24752
|
} else {
|
|
24744
|
-
|
|
24753
|
+
isDev9 && assertTrue(
|
|
24745
24754
|
!ctx.$container$ || ctx.$container$ === propsProxy.$container$,
|
|
24746
24755
|
"Do not use props across containers"
|
|
24747
24756
|
);
|
|
@@ -24847,7 +24856,7 @@ var cleanupFn = (target, handleError) => {
|
|
|
24847
24856
|
};
|
|
24848
24857
|
|
|
24849
24858
|
// packages/qwik/src/core/reactive-primitives/impl/computed-signal-impl.ts
|
|
24850
|
-
import { isDev as
|
|
24859
|
+
import { isDev as isDev10 } from "@qwik.dev/core/build";
|
|
24851
24860
|
var DEBUG2 = false;
|
|
24852
24861
|
var log2 = (...args) => console.log("COMPUTED SIGNAL", ...args.map(qwikDebugToString));
|
|
24853
24862
|
var _a3, _b;
|
|
@@ -24883,9 +24892,12 @@ var ComputedSignalImpl = class extends (_b = SignalImpl, _a3 = _EFFECT_BACK_REF,
|
|
|
24883
24892
|
}
|
|
24884
24893
|
get untrackedValue() {
|
|
24885
24894
|
this.$computeIfNeeded$();
|
|
24886
|
-
|
|
24895
|
+
isDev10 && assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION, "Invalid state");
|
|
24887
24896
|
return this.$untrackedValue$;
|
|
24888
24897
|
}
|
|
24898
|
+
set untrackedValue(value) {
|
|
24899
|
+
this.$untrackedValue$ = value;
|
|
24900
|
+
}
|
|
24889
24901
|
$computeIfNeeded$() {
|
|
24890
24902
|
if (!(this.$flags$ & 1 /* INVALID */)) {
|
|
24891
24903
|
return;
|
|
@@ -24972,25 +24984,55 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a4 = _EFFECT_BAC
|
|
|
24972
24984
|
__publicField(this, "$jobs$", []);
|
|
24973
24985
|
__publicField(this, "$concurrency$", 1);
|
|
24974
24986
|
__publicField(this, "$interval$", 0);
|
|
24975
|
-
__publicField(this, "$pollTimeoutId$");
|
|
24976
24987
|
__publicField(this, "$timeoutMs$");
|
|
24977
|
-
__publicField(this, "$computationTimeoutId$");
|
|
24978
24988
|
__publicField(this, _a4);
|
|
24979
|
-
const interval = options?.interval
|
|
24989
|
+
const interval = options?.interval;
|
|
24980
24990
|
const concurrency = options?.concurrency ?? 1;
|
|
24981
24991
|
const initial = options?.initial;
|
|
24982
24992
|
const timeout = options?.timeout;
|
|
24983
24993
|
const eagerCleanup = options?.eagerCleanup;
|
|
24994
|
+
const clientOnly = options?.clientOnly;
|
|
24984
24995
|
if (initial !== void 0) {
|
|
24985
24996
|
const initialValue = typeof initial === "function" ? initial() : initial;
|
|
24986
24997
|
this.$untrackedValue$ = initialValue;
|
|
24987
24998
|
}
|
|
24988
24999
|
this.$concurrency$ = concurrency;
|
|
24989
|
-
|
|
25000
|
+
if (timeout) {
|
|
25001
|
+
this.$timeoutMs$ = timeout;
|
|
25002
|
+
}
|
|
24990
25003
|
if (eagerCleanup) {
|
|
24991
25004
|
this.$flags$ |= 32 /* EAGER_CLEANUP */;
|
|
24992
25005
|
}
|
|
24993
|
-
|
|
25006
|
+
if (clientOnly) {
|
|
25007
|
+
this.$flags$ |= 64 /* CLIENT_ONLY */;
|
|
25008
|
+
}
|
|
25009
|
+
if (interval) {
|
|
25010
|
+
this.interval = interval;
|
|
25011
|
+
}
|
|
25012
|
+
}
|
|
25013
|
+
get untrackedValue() {
|
|
25014
|
+
this.$computeIfNeeded$();
|
|
25015
|
+
if (this.$current$?.$promise$) {
|
|
25016
|
+
if (this.$untrackedValue$ === NEEDS_COMPUTATION || (import.meta.env.TEST ? isServerPlatform() : isServer5)) {
|
|
25017
|
+
DEBUG3 && log3("Throwing promise while computing initial value", this);
|
|
25018
|
+
throw this.$current$?.$promise$;
|
|
25019
|
+
}
|
|
25020
|
+
DEBUG3 && log3("Returning stale value", this.$untrackedValue$, "while computing", this.$current$);
|
|
25021
|
+
return this.$untrackedValue$;
|
|
25022
|
+
}
|
|
25023
|
+
if (this.$untrackedError$) {
|
|
25024
|
+
DEBUG3 && log3("Throwing error while reading value", this);
|
|
25025
|
+
throw this.$untrackedError$;
|
|
25026
|
+
}
|
|
25027
|
+
if ((import.meta.env.TEST ? isServerPlatform() : isServer5) && this.$flags$ & 64 /* CLIENT_ONLY */ && this.$untrackedValue$ === NEEDS_COMPUTATION) {
|
|
25028
|
+
throw new Error(
|
|
25029
|
+
"During SSR, cannot read .value from clientOnly async signal without an initial value. Use .loading or provide an initial value."
|
|
25030
|
+
);
|
|
25031
|
+
}
|
|
25032
|
+
return this.$untrackedValue$;
|
|
25033
|
+
}
|
|
25034
|
+
set untrackedValue(value) {
|
|
25035
|
+
this.$untrackedValue$ = value;
|
|
24994
25036
|
}
|
|
24995
25037
|
/**
|
|
24996
25038
|
* Loading is true if the signal is still waiting for the promise to resolve, false if the promise
|
|
@@ -25081,6 +25123,11 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a4 = _EFFECT_BAC
|
|
|
25081
25123
|
if (!(this.$flags$ & 1 /* INVALID */)) {
|
|
25082
25124
|
return;
|
|
25083
25125
|
}
|
|
25126
|
+
if ((import.meta.env.TEST ? isServerPlatform() : isServer5) && this.$flags$ & 64 /* CLIENT_ONLY */) {
|
|
25127
|
+
this.$untrackedLoading$ = true;
|
|
25128
|
+
this.$container$?.serializationCtx.$eagerResume$.add(this);
|
|
25129
|
+
return;
|
|
25130
|
+
}
|
|
25084
25131
|
this.$clearNextPoll$();
|
|
25085
25132
|
if (this.$current$) {
|
|
25086
25133
|
this.$requestCleanups$(this.$current$);
|
|
@@ -25152,22 +25199,6 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a4 = _EFFECT_BAC
|
|
|
25152
25199
|
}
|
|
25153
25200
|
await Promise.all(this.$jobs$.map((job) => job.$promise$));
|
|
25154
25201
|
}
|
|
25155
|
-
get untrackedValue() {
|
|
25156
|
-
this.$computeIfNeeded$();
|
|
25157
|
-
if (this.$current$?.$promise$) {
|
|
25158
|
-
if (this.$untrackedValue$ === NEEDS_COMPUTATION || (import.meta.env.TEST ? isServerPlatform() : isServer5)) {
|
|
25159
|
-
DEBUG3 && log3("Throwing promise while computing initial value", this);
|
|
25160
|
-
throw this.$current$?.$promise$;
|
|
25161
|
-
}
|
|
25162
|
-
DEBUG3 && log3("Returning stale value", this.$untrackedValue$, "while computing", this.$current$);
|
|
25163
|
-
return this.$untrackedValue$;
|
|
25164
|
-
}
|
|
25165
|
-
if (this.$untrackedError$) {
|
|
25166
|
-
DEBUG3 && log3("Throwing error while reading value", this);
|
|
25167
|
-
throw this.$untrackedError$;
|
|
25168
|
-
}
|
|
25169
|
-
return this.$untrackedValue$;
|
|
25170
|
-
}
|
|
25171
25202
|
$clearNextPoll$() {
|
|
25172
25203
|
if (this.$pollTimeoutId$ !== void 0) {
|
|
25173
25204
|
clearTimeout(this.$pollTimeoutId$);
|
|
@@ -25424,7 +25455,7 @@ function setCursorData(vNode, cursorData) {
|
|
|
25424
25455
|
}
|
|
25425
25456
|
|
|
25426
25457
|
// packages/qwik/src/core/client/vnode-diff.ts
|
|
25427
|
-
import { isDev as
|
|
25458
|
+
import { isDev as isDev14 } from "@qwik.dev/core/build";
|
|
25428
25459
|
|
|
25429
25460
|
// packages/qwik/src/core/reactive-primitives/subscription-data.ts
|
|
25430
25461
|
var SubscriptionData = class {
|
|
@@ -25435,14 +25466,14 @@ var SubscriptionData = class {
|
|
|
25435
25466
|
};
|
|
25436
25467
|
|
|
25437
25468
|
// packages/qwik/src/core/shared/component-execution.ts
|
|
25438
|
-
import { isDev as
|
|
25469
|
+
import { isDev as isDev12, isServer as isServer6 } from "@qwik.dev/core/build";
|
|
25439
25470
|
|
|
25440
25471
|
// packages/qwik/src/core/shared/component.public.ts
|
|
25441
|
-
import { isDev as
|
|
25472
|
+
import { isDev as isDev11 } from "@qwik.dev/core/build";
|
|
25442
25473
|
var componentQrl = (componentQrl2) => {
|
|
25443
25474
|
function QwikComponent(props, key, flags = 0) {
|
|
25444
|
-
|
|
25445
|
-
|
|
25475
|
+
isDev11 && assertQrl(componentQrl2);
|
|
25476
|
+
isDev11 && assertNumber(flags, "The Qwik Component was not invoked correctly");
|
|
25446
25477
|
const hash3 = qTest ? "sX" : componentQrl2.$hash$.slice(0, 4);
|
|
25447
25478
|
const finalKey = hash3 + ":" + (key ? key : "");
|
|
25448
25479
|
const InnerCmp = () => {
|
|
@@ -25515,6 +25546,9 @@ var isJSXNode = (n) => {
|
|
|
25515
25546
|
return true;
|
|
25516
25547
|
}
|
|
25517
25548
|
if (isObject(n) && _hasOwnProperty.call(n, "key") && _hasOwnProperty.call(n, "props") && _hasOwnProperty.call(n, "type")) {
|
|
25549
|
+
if (isPropsProxy(n)) {
|
|
25550
|
+
return false;
|
|
25551
|
+
}
|
|
25518
25552
|
logWarn(`Duplicate implementations of "JSXNode" found`);
|
|
25519
25553
|
return true;
|
|
25520
25554
|
}
|
|
@@ -25543,7 +25577,7 @@ var executeComponent = (container, renderHost, subscriptionHost, componentQRL, p
|
|
|
25543
25577
|
let isInlineComponent = false;
|
|
25544
25578
|
if (componentQRL === null) {
|
|
25545
25579
|
componentQRL = container.getHostProp(renderHost, OnRenderProp);
|
|
25546
|
-
|
|
25580
|
+
isDev12 && assertDefined(componentQRL, "No Component found at this location");
|
|
25547
25581
|
}
|
|
25548
25582
|
if (isQrl(componentQRL)) {
|
|
25549
25583
|
props = props || container.getHostProp(renderHost, ELEMENT_PROPS) || EMPTY_OBJ;
|
|
@@ -25622,7 +25656,7 @@ function addUseOnEvents(jsx2, useOnEvents) {
|
|
|
25622
25656
|
}
|
|
25623
25657
|
targetElement = placeholderElement;
|
|
25624
25658
|
} else {
|
|
25625
|
-
if (
|
|
25659
|
+
if (isDev12) {
|
|
25626
25660
|
logWarn(
|
|
25627
25661
|
'You are trying to add an event "' + key + '" using `useOn` hook, but a node to which you can add an event is not found. Please make sure that the component has a valid element node. '
|
|
25628
25662
|
);
|
|
@@ -25633,7 +25667,7 @@ function addUseOnEvents(jsx2, useOnEvents) {
|
|
|
25633
25667
|
if (targetElement) {
|
|
25634
25668
|
if (targetElement.type === "script" && key === qVisibleEvent) {
|
|
25635
25669
|
eventKey = "q-d:qinit";
|
|
25636
|
-
if (
|
|
25670
|
+
if (isDev12) {
|
|
25637
25671
|
logWarn(
|
|
25638
25672
|
'You are trying to add an event "' + key + '" using the `useVisibleTask$` hook with the "intersection-observer" strategy, but a node to which you can add an event is not found. Using "document-ready" or "document-idle" instead.'
|
|
25639
25673
|
);
|
|
@@ -25666,7 +25700,6 @@ function addUseOnEvent(jsxElement, key, value) {
|
|
|
25666
25700
|
props[key] = void 0;
|
|
25667
25701
|
}
|
|
25668
25702
|
}
|
|
25669
|
-
var getValue = (o) => o.value;
|
|
25670
25703
|
function findFirstElementNode(jsx2) {
|
|
25671
25704
|
const queue2 = [jsx2];
|
|
25672
25705
|
while (queue2.length) {
|
|
@@ -25681,7 +25714,7 @@ function findFirstElementNode(jsx2) {
|
|
|
25681
25714
|
} else if (isPromise(jsx3)) {
|
|
25682
25715
|
return maybeThen(jsx3, (jsx4) => findFirstElementNode(jsx4));
|
|
25683
25716
|
} else if (isSignal(jsx3)) {
|
|
25684
|
-
return findFirstElementNode(
|
|
25717
|
+
return findFirstElementNode(jsx3.untrackedValue);
|
|
25685
25718
|
}
|
|
25686
25719
|
}
|
|
25687
25720
|
return null;
|
|
@@ -25721,9 +25754,9 @@ var SSRRaw = () => null;
|
|
|
25721
25754
|
var SSRComment = () => null;
|
|
25722
25755
|
|
|
25723
25756
|
// packages/qwik/src/core/client/vnode-namespace.ts
|
|
25724
|
-
import { isDev as
|
|
25757
|
+
import { isDev as isDev13 } from "@qwik.dev/core/build";
|
|
25725
25758
|
var isForeignObjectElement = (elementName) => {
|
|
25726
|
-
return
|
|
25759
|
+
return isDev13 ? elementName.toLowerCase() === "foreignobject" : elementName === "foreignObject";
|
|
25727
25760
|
};
|
|
25728
25761
|
var isSvgElement = (elementName) => elementName === "svg" || isForeignObjectElement(elementName);
|
|
25729
25762
|
var isMathElement = (elementName) => elementName === "math";
|
|
@@ -26479,7 +26512,6 @@ var SetTextOperation = class {
|
|
|
26479
26512
|
constructor(target, text) {
|
|
26480
26513
|
this.target = target;
|
|
26481
26514
|
this.text = text;
|
|
26482
|
-
__publicField(this, "operationType", 16 /* SetText */);
|
|
26483
26515
|
}
|
|
26484
26516
|
};
|
|
26485
26517
|
var InsertOrMoveOperation = class {
|
|
@@ -26578,8 +26610,8 @@ var vnode_diff = (container, journal, jsxNode, vStartNode, cursor, scopedStyleId
|
|
|
26578
26610
|
}
|
|
26579
26611
|
};
|
|
26580
26612
|
function diff(diffContext, jsxNode, vStartNode) {
|
|
26581
|
-
|
|
26582
|
-
|
|
26613
|
+
isDev14 && assertFalse(vnode_isVNode(jsxNode), "JSXNode should not be a VNode");
|
|
26614
|
+
isDev14 && assertTrue(vnode_isVNode(vStartNode), "vStartNode should be a VNode");
|
|
26583
26615
|
diffContext.vParent = vStartNode;
|
|
26584
26616
|
diffContext.vNewNode = null;
|
|
26585
26617
|
diffContext.vCurrent = vnode_getFirstChild(vStartNode);
|
|
@@ -26589,7 +26621,7 @@ function diff(diffContext, jsxNode, vStartNode) {
|
|
|
26589
26621
|
}
|
|
26590
26622
|
while (diffContext.stack.length) {
|
|
26591
26623
|
while (diffContext.jsxIdx < diffContext.jsxCount) {
|
|
26592
|
-
|
|
26624
|
+
isDev14 && assertFalse(
|
|
26593
26625
|
diffContext.vParent === diffContext.vCurrent,
|
|
26594
26626
|
"Parent and current can't be the same"
|
|
26595
26627
|
);
|
|
@@ -26601,7 +26633,7 @@ function diff(diffContext, jsxNode, vStartNode) {
|
|
|
26601
26633
|
if (isJSXNode(diffContext.jsxValue)) {
|
|
26602
26634
|
const type = diffContext.jsxValue.type;
|
|
26603
26635
|
if (typeof type === "string") {
|
|
26604
|
-
|
|
26636
|
+
expectNoTextNode(diffContext);
|
|
26605
26637
|
expectElement(diffContext, diffContext.jsxValue, type);
|
|
26606
26638
|
const hasDangerousInnerHTML = diffContext.jsxValue.constProps && _hasOwnProperty2.call(diffContext.jsxValue.constProps, dangerouslySetInnerHTML) || _hasOwnProperty2.call(diffContext.jsxValue.varProps, dangerouslySetInnerHTML);
|
|
26607
26639
|
if (hasDangerousInnerHTML) {
|
|
@@ -26611,11 +26643,11 @@ function diff(diffContext, jsxNode, vStartNode) {
|
|
|
26611
26643
|
}
|
|
26612
26644
|
} else if (typeof type === "function") {
|
|
26613
26645
|
if (type === Fragment) {
|
|
26614
|
-
|
|
26646
|
+
expectNoTextNode(diffContext);
|
|
26615
26647
|
expectVirtual(diffContext, "F" /* Fragment */, diffContext.jsxValue.key);
|
|
26616
26648
|
descend(diffContext, diffContext.jsxValue.children, true);
|
|
26617
26649
|
} else if (type === Slot) {
|
|
26618
|
-
|
|
26650
|
+
expectNoTextNode(diffContext);
|
|
26619
26651
|
if (!expectSlot(diffContext)) {
|
|
26620
26652
|
descend(diffContext, diffContext.jsxValue.children, true);
|
|
26621
26653
|
}
|
|
@@ -26634,7 +26666,7 @@ function diff(diffContext, jsxNode, vStartNode) {
|
|
|
26634
26666
|
} else if (type === SSRRaw) {
|
|
26635
26667
|
expectNoMore(diffContext);
|
|
26636
26668
|
} else {
|
|
26637
|
-
|
|
26669
|
+
expectNoTextNode(diffContext);
|
|
26638
26670
|
expectComponent(diffContext, type);
|
|
26639
26671
|
}
|
|
26640
26672
|
}
|
|
@@ -26720,7 +26752,7 @@ function descend(diffContext, children, descendVNode, shouldExpectNoChildren = t
|
|
|
26720
26752
|
}
|
|
26721
26753
|
stackPush(diffContext, children, descendVNode);
|
|
26722
26754
|
if (descendVNode) {
|
|
26723
|
-
|
|
26755
|
+
isDev14 && assertDefined(
|
|
26724
26756
|
diffContext.vCurrent || diffContext.vNewNode,
|
|
26725
26757
|
"Expecting vCurrent to be defined."
|
|
26726
26758
|
);
|
|
@@ -26804,11 +26836,10 @@ function descendContentToProject(diffContext, children, host) {
|
|
|
26804
26836
|
if (host) {
|
|
26805
26837
|
const props = host.props;
|
|
26806
26838
|
if (props) {
|
|
26807
|
-
for (const prop
|
|
26839
|
+
for (const prop in props) {
|
|
26808
26840
|
if (isSlotProp(prop)) {
|
|
26809
26841
|
const slotName = prop;
|
|
26810
|
-
projections
|
|
26811
|
-
projections.push(createProjectionJSXNode(slotName));
|
|
26842
|
+
mapArray_set(projections, slotName, createProjectionJSXNode(slotName), 0);
|
|
26812
26843
|
}
|
|
26813
26844
|
}
|
|
26814
26845
|
}
|
|
@@ -26849,8 +26880,8 @@ function expectProjection(diffContext) {
|
|
|
26849
26880
|
diffContext.vCurrent = diffContext.vCurrent && diffContext.vCurrent.flags & 32 /* Deleted */ ? null : diffContext.vCurrent;
|
|
26850
26881
|
if (diffContext.vCurrent == null) {
|
|
26851
26882
|
diffContext.vNewNode = vnode_newVirtual();
|
|
26852
|
-
|
|
26853
|
-
|
|
26883
|
+
isDev14 && vnode_setProp(diffContext.vNewNode, DEBUG_TYPE, "P" /* Projection */);
|
|
26884
|
+
isDev14 && vnode_setProp(diffContext.vNewNode, "q:code", "expectProjection");
|
|
26854
26885
|
vnode_setProp(diffContext.vNewNode, QSlot, slotName);
|
|
26855
26886
|
diffContext.vNewNode.slotParent = diffContext.vParent;
|
|
26856
26887
|
vnode_setProp(diffContext.vParent, slotName, diffContext.vNewNode);
|
|
@@ -26871,7 +26902,7 @@ function expectSlot(diffContext) {
|
|
|
26871
26902
|
diffContext.vNewNode = vnode_newVirtual();
|
|
26872
26903
|
vnode_setProp(diffContext.vNewNode, QSlot, slotNameKey);
|
|
26873
26904
|
vHost && vnode_setProp(vHost, slotNameKey, diffContext.vNewNode);
|
|
26874
|
-
|
|
26905
|
+
isDev14 && vnode_setProp(diffContext.vNewNode, DEBUG_TYPE, "P" /* Projection */);
|
|
26875
26906
|
vnode_insertBefore(
|
|
26876
26907
|
diffContext.journal,
|
|
26877
26908
|
diffContext.vParent,
|
|
@@ -26885,7 +26916,7 @@ function expectSlot(diffContext) {
|
|
|
26885
26916
|
diffContext.vNewNode = vProjectedNode;
|
|
26886
26917
|
vnode_setProp(diffContext.vNewNode, QSlot, slotNameKey);
|
|
26887
26918
|
vHost && vnode_setProp(vHost, slotNameKey, diffContext.vNewNode);
|
|
26888
|
-
|
|
26919
|
+
isDev14 && vnode_setProp(diffContext.vNewNode, DEBUG_TYPE, "P" /* Projection */);
|
|
26889
26920
|
vnode_insertBefore(
|
|
26890
26921
|
diffContext.journal,
|
|
26891
26922
|
diffContext.vParent,
|
|
@@ -26977,7 +27008,7 @@ function expectNoChildren(diffContext, removeDOM = true) {
|
|
|
26977
27008
|
}
|
|
26978
27009
|
}
|
|
26979
27010
|
function expectNoMore(diffContext) {
|
|
26980
|
-
|
|
27011
|
+
isDev14 && assertFalse(
|
|
26981
27012
|
diffContext.vParent === diffContext.vCurrent,
|
|
26982
27013
|
"Parent and current can't be the same"
|
|
26983
27014
|
);
|
|
@@ -26992,9 +27023,8 @@ function expectNoMore(diffContext) {
|
|
|
26992
27023
|
}
|
|
26993
27024
|
}
|
|
26994
27025
|
}
|
|
26995
|
-
function
|
|
26996
|
-
|
|
26997
|
-
cleanup(diffContext.container, diffContext.journal, diffContext.vCurrent, diffContext.cursor);
|
|
27026
|
+
function expectNoTextNode(diffContext) {
|
|
27027
|
+
if (diffContext.vCurrent !== null && vnode_isTextVNode(diffContext.vCurrent)) {
|
|
26998
27028
|
const toRemove = diffContext.vCurrent;
|
|
26999
27029
|
diffContext.vCurrent = peekNextSibling(diffContext.vCurrent);
|
|
27000
27030
|
vnode_remove(diffContext.journal, diffContext.vParent, toRemove, true);
|
|
@@ -27064,7 +27094,7 @@ function createNewElement(diffContext, jsx2, elementName, currentFile) {
|
|
|
27064
27094
|
}
|
|
27065
27095
|
if (elementName === "textarea" && key2 === "value") {
|
|
27066
27096
|
if (value && typeof value !== "string") {
|
|
27067
|
-
if (
|
|
27097
|
+
if (isDev14) {
|
|
27068
27098
|
throw qError(23 /* wrongTextareaValue */, [currentFile, value]);
|
|
27069
27099
|
}
|
|
27070
27100
|
continue;
|
|
@@ -27115,7 +27145,9 @@ function registerEventHandlers(key, value, element, vnode, diffContext) {
|
|
|
27115
27145
|
handlers.push(runEventHandlerQRL.bind(null, item));
|
|
27116
27146
|
}
|
|
27117
27147
|
}
|
|
27118
|
-
|
|
27148
|
+
if (handlers.length > 0) {
|
|
27149
|
+
(element._qDispatch || (element._qDispatch = {}))[scopedKebabName] = handlers;
|
|
27150
|
+
}
|
|
27119
27151
|
} else if (value) {
|
|
27120
27152
|
(element._qDispatch || (element._qDispatch = {}))[scopedKebabName] = [
|
|
27121
27153
|
runEventHandlerQRL.bind(null, value)
|
|
@@ -27161,7 +27193,7 @@ function expectElement(diffContext, jsx2, elementName) {
|
|
|
27161
27193
|
const jsxProps = jsx2.varProps;
|
|
27162
27194
|
const vNode = diffContext.vNewNode || diffContext.vCurrent;
|
|
27163
27195
|
if (jsxProps) {
|
|
27164
|
-
diffProps(diffContext, vNode, jsxProps,
|
|
27196
|
+
diffProps(diffContext, vNode, jsxProps, isDev14 && getFileLocationFromJsx(jsx2.dev) || null);
|
|
27165
27197
|
}
|
|
27166
27198
|
}
|
|
27167
27199
|
function diffProps(diffContext, vnode, newAttrs, currentFile) {
|
|
@@ -27425,7 +27457,7 @@ function expectVirtual(diffContext, type, jsxKey) {
|
|
|
27425
27457
|
diffContext.vCurrent && getInsertBefore(diffContext)
|
|
27426
27458
|
);
|
|
27427
27459
|
diffContext.vNewNode.key = jsxKey;
|
|
27428
|
-
|
|
27460
|
+
isDev14 && vnode_setProp(diffContext.vNewNode, DEBUG_TYPE, type);
|
|
27429
27461
|
return;
|
|
27430
27462
|
}
|
|
27431
27463
|
if (moveOrCreateKeyedNode(
|
|
@@ -27443,7 +27475,7 @@ function expectVirtual(diffContext, type, jsxKey) {
|
|
|
27443
27475
|
diffContext.vCurrent && getInsertBefore(diffContext)
|
|
27444
27476
|
);
|
|
27445
27477
|
diffContext.vNewNode.key = jsxKey;
|
|
27446
|
-
|
|
27478
|
+
isDev14 && vnode_setProp(diffContext.vNewNode, DEBUG_TYPE, type);
|
|
27447
27479
|
}
|
|
27448
27480
|
}
|
|
27449
27481
|
function expectComponent(diffContext, component) {
|
|
@@ -27530,7 +27562,7 @@ function expectComponent(diffContext, component) {
|
|
|
27530
27562
|
OnRenderProp,
|
|
27531
27563
|
null
|
|
27532
27564
|
) === null : true)) {
|
|
27533
|
-
componentHost = componentHost.parent;
|
|
27565
|
+
componentHost = componentHost.parent || vnode_getProjectionParentComponent(componentHost);
|
|
27534
27566
|
}
|
|
27535
27567
|
const jsxOutput = executeComponent(
|
|
27536
27568
|
diffContext.container,
|
|
@@ -27554,7 +27586,7 @@ function insertNewComponent(diffContext, host, componentQRL, jsxProps) {
|
|
|
27554
27586
|
diffContext.vCurrent && getInsertBefore(diffContext)
|
|
27555
27587
|
);
|
|
27556
27588
|
const jsxNode = diffContext.jsxValue;
|
|
27557
|
-
|
|
27589
|
+
isDev14 && vnode_setProp(diffContext.vNewNode, DEBUG_TYPE, "C" /* Component */);
|
|
27558
27590
|
vnode_setProp(diffContext.vNewNode, OnRenderProp, componentQRL);
|
|
27559
27591
|
vnode_setProp(diffContext.vNewNode, ELEMENT_PROPS, jsxProps);
|
|
27560
27592
|
diffContext.vNewNode.key = jsxNode.key;
|
|
@@ -27567,7 +27599,7 @@ function insertNewInlineComponent(diffContext) {
|
|
|
27567
27599
|
diffContext.vCurrent && getInsertBefore(diffContext)
|
|
27568
27600
|
);
|
|
27569
27601
|
const jsxNode = diffContext.jsxValue;
|
|
27570
|
-
|
|
27602
|
+
isDev14 && vnode_setProp(diffContext.vNewNode, DEBUG_TYPE, "I" /* InlineComponent */);
|
|
27571
27603
|
vnode_setProp(diffContext.vNewNode, ELEMENT_PROPS, jsxNode.props);
|
|
27572
27604
|
if (jsxNode.key) {
|
|
27573
27605
|
diffContext.vNewNode.key = jsxNode.key;
|
|
@@ -28179,7 +28211,7 @@ var createMacroTask = (fn) => {
|
|
|
28179
28211
|
};
|
|
28180
28212
|
|
|
28181
28213
|
// packages/qwik/src/core/shared/cursor/cursor-walker.ts
|
|
28182
|
-
import { isDev as
|
|
28214
|
+
import { isDev as isDev15, isServer as isServer7 } from "@qwik.dev/core/build";
|
|
28183
28215
|
var DEBUG6 = false;
|
|
28184
28216
|
var nextMicroTask = createMicroTask(processCursorQueue);
|
|
28185
28217
|
var nextMacroTask = createMacroTask(processCursorQueue);
|
|
@@ -28216,7 +28248,7 @@ function walkCursor(cursor, options) {
|
|
|
28216
28248
|
return;
|
|
28217
28249
|
}
|
|
28218
28250
|
const container = cursorData.container;
|
|
28219
|
-
|
|
28251
|
+
isDev15 && assertDefined(container, "Cursor container not found");
|
|
28220
28252
|
if (!cursor.dirty) {
|
|
28221
28253
|
finishWalk(container, cursor, cursorData, isRunningOnServer);
|
|
28222
28254
|
return;
|
|
@@ -28239,6 +28271,12 @@ function walkCursor(cursor, options) {
|
|
|
28239
28271
|
if (currentVNode.flags & 32 /* Deleted */) {
|
|
28240
28272
|
if (currentVNode.dirty & 64 /* CLEANUP */) {
|
|
28241
28273
|
executeCleanup(currentVNode, container);
|
|
28274
|
+
} else if (currentVNode.dirty & 32 /* CHILDREN */) {
|
|
28275
|
+
const next = tryDescendDirtyChildren(container, cursorData, currentVNode, cursor);
|
|
28276
|
+
if (next !== null) {
|
|
28277
|
+
currentVNode = next;
|
|
28278
|
+
continue;
|
|
28279
|
+
}
|
|
28242
28280
|
}
|
|
28243
28281
|
currentVNode.dirty &= ~127 /* DIRTY_MASK */;
|
|
28244
28282
|
setCursorPosition(container, cursorData, getNextVNode(currentVNode, cursor));
|
|
@@ -28257,14 +28295,9 @@ function walkCursor(cursor, options) {
|
|
|
28257
28295
|
} else if (currentVNode.dirty & 16 /* COMPUTE */) {
|
|
28258
28296
|
result2 = executeCompute(currentVNode, container);
|
|
28259
28297
|
} else if (currentVNode.dirty & 32 /* CHILDREN */) {
|
|
28260
|
-
const
|
|
28261
|
-
if (
|
|
28262
|
-
currentVNode
|
|
28263
|
-
} else {
|
|
28264
|
-
partitionDirtyChildren(dirtyChildren, currentVNode);
|
|
28265
|
-
currentVNode.nextDirtyChildIndex = 0;
|
|
28266
|
-
currentVNode = getNextVNode(dirtyChildren[0], cursor);
|
|
28267
|
-
setCursorPosition(container, cursorData, currentVNode);
|
|
28298
|
+
const next = tryDescendDirtyChildren(container, cursorData, currentVNode, cursor);
|
|
28299
|
+
if (next !== null) {
|
|
28300
|
+
currentVNode = next;
|
|
28268
28301
|
continue;
|
|
28269
28302
|
}
|
|
28270
28303
|
}
|
|
@@ -28293,7 +28326,7 @@ function walkCursor(cursor, options) {
|
|
|
28293
28326
|
}
|
|
28294
28327
|
}
|
|
28295
28328
|
}
|
|
28296
|
-
|
|
28329
|
+
isDev15 && assertFalse(
|
|
28297
28330
|
!!(cursor.dirty & 127 /* DIRTY_MASK */ && !cursorData.position),
|
|
28298
28331
|
"Cursor is still dirty and position is not set after walking"
|
|
28299
28332
|
);
|
|
@@ -28319,6 +28352,18 @@ function resolveCursor(container) {
|
|
|
28319
28352
|
DEBUG6 && console.warn(`walkCursor: cursor resolved, ${container.$pendingCount$} remaining`);
|
|
28320
28353
|
container.$checkPendingCount$();
|
|
28321
28354
|
}
|
|
28355
|
+
function tryDescendDirtyChildren(container, cursorData, currentVNode, cursor) {
|
|
28356
|
+
const dirtyChildren = currentVNode.dirtyChildren;
|
|
28357
|
+
if (!dirtyChildren || dirtyChildren.length === 0) {
|
|
28358
|
+
currentVNode.dirty &= ~32 /* CHILDREN */;
|
|
28359
|
+
return null;
|
|
28360
|
+
}
|
|
28361
|
+
partitionDirtyChildren(dirtyChildren, currentVNode);
|
|
28362
|
+
currentVNode.nextDirtyChildIndex = 0;
|
|
28363
|
+
const next = getNextVNode(dirtyChildren[0], cursor);
|
|
28364
|
+
setCursorPosition(container, cursorData, next);
|
|
28365
|
+
return next;
|
|
28366
|
+
}
|
|
28322
28367
|
function partitionDirtyChildren(dirtyChildren, parent) {
|
|
28323
28368
|
let writeIndex = 0;
|
|
28324
28369
|
for (let readIndex = 0; readIndex < dirtyChildren.length; readIndex++) {
|
|
@@ -28515,7 +28560,7 @@ function addVNodeOperation(journal, operation) {
|
|
|
28515
28560
|
}
|
|
28516
28561
|
|
|
28517
28562
|
// packages/qwik/src/core/reactive-primitives/impl/wrapped-signal-impl.ts
|
|
28518
|
-
import { isDev as
|
|
28563
|
+
import { isDev as isDev16 } from "@qwik.dev/core/build";
|
|
28519
28564
|
var _a5, _b3;
|
|
28520
28565
|
var WrappedSignalImpl = class extends (_b3 = SignalImpl, _a5 = _EFFECT_BACK_REF, _b3) {
|
|
28521
28566
|
constructor(container, fn, args, fnStr, flags = 1 /* INVALID */ | 4 /* UNWRAP */) {
|
|
@@ -28525,6 +28570,8 @@ var WrappedSignalImpl = class extends (_b3 = SignalImpl, _a5 = _EFFECT_BACK_REF,
|
|
|
28525
28570
|
__publicField(this, "$funcStr$");
|
|
28526
28571
|
__publicField(this, "$flags$");
|
|
28527
28572
|
__publicField(this, "$hostElement$");
|
|
28573
|
+
// important: don't use implemnets BackRef here
|
|
28574
|
+
// it causes v8 optimizations eager bailouts, because of not consistent class shape
|
|
28528
28575
|
__publicField(this, _a5);
|
|
28529
28576
|
this.$args$ = args;
|
|
28530
28577
|
this.$func$ = fn;
|
|
@@ -28548,7 +28595,7 @@ var WrappedSignalImpl = class extends (_b3 = SignalImpl, _a5 = _EFFECT_BACK_REF,
|
|
|
28548
28595
|
}
|
|
28549
28596
|
get untrackedValue() {
|
|
28550
28597
|
this.$computeIfNeeded$();
|
|
28551
|
-
|
|
28598
|
+
isDev16 && assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION, "Invalid state");
|
|
28552
28599
|
return this.$untrackedValue$;
|
|
28553
28600
|
}
|
|
28554
28601
|
$computeIfNeeded$() {
|
|
@@ -28785,27 +28832,42 @@ function _chk(_, element) {
|
|
|
28785
28832
|
var version = globalThis.QWIK_VERSION;
|
|
28786
28833
|
|
|
28787
28834
|
// packages/qwik/src/core/shared/serdes/serialize.ts
|
|
28788
|
-
import { isDev as
|
|
28789
|
-
|
|
28790
|
-
|
|
28791
|
-
|
|
28792
|
-
|
|
28793
|
-
|
|
28794
|
-
|
|
28795
|
-
|
|
28796
|
-
|
|
28797
|
-
|
|
28798
|
-
|
|
28799
|
-
|
|
28800
|
-
|
|
28801
|
-
|
|
28802
|
-
|
|
28803
|
-
|
|
28804
|
-
|
|
28805
|
-
|
|
28806
|
-
|
|
28807
|
-
|
|
28808
|
-
|
|
28835
|
+
import { isDev as isDev17 } from "@qwik.dev/core/build";
|
|
28836
|
+
|
|
28837
|
+
// packages/qwik/src/core/shared/ssr-const.ts
|
|
28838
|
+
var LT = "<";
|
|
28839
|
+
var GT = ">";
|
|
28840
|
+
var CLOSE_TAG = "</";
|
|
28841
|
+
var ESCAPED_CLOSE_TAG = "<\\/";
|
|
28842
|
+
var SPACE = " ";
|
|
28843
|
+
var ATTR_EQUALS_QUOTE = '="';
|
|
28844
|
+
var QUOTE = '"';
|
|
28845
|
+
var EMPTY_ATTR = '=""';
|
|
28846
|
+
var BRACKET_OPEN = "[";
|
|
28847
|
+
var BRACKET_CLOSE = "]";
|
|
28848
|
+
var PAREN_CLOSE = ")";
|
|
28849
|
+
var COMMA = ",";
|
|
28850
|
+
|
|
28851
|
+
// packages/qwik/src/core/shared/serdes/serialize.ts
|
|
28852
|
+
var Serializer = class {
|
|
28853
|
+
constructor($serializationContext$) {
|
|
28854
|
+
this.$serializationContext$ = $serializationContext$;
|
|
28855
|
+
__publicField(this, "rootIdx", 0);
|
|
28856
|
+
__publicField(this, "forwardRefs", []);
|
|
28857
|
+
__publicField(this, "forwardRefsId", 0);
|
|
28858
|
+
__publicField(this, "promises", /* @__PURE__ */ new Set());
|
|
28859
|
+
__publicField(this, "s11nWeakRefs", /* @__PURE__ */ new Map());
|
|
28860
|
+
__publicField(this, "parent");
|
|
28861
|
+
__publicField(this, "qrlMap", /* @__PURE__ */ new Map());
|
|
28862
|
+
__publicField(this, "$writer$");
|
|
28863
|
+
this.$writer$ = $serializationContext$.$writer$;
|
|
28864
|
+
}
|
|
28865
|
+
async serialize() {
|
|
28866
|
+
await this.outputRoots();
|
|
28867
|
+
}
|
|
28868
|
+
/** Helper to output an array */
|
|
28869
|
+
outputArray(value, keepUndefined, writeFn) {
|
|
28870
|
+
this.$writer$.write(BRACKET_OPEN);
|
|
28809
28871
|
let separator = false;
|
|
28810
28872
|
let length;
|
|
28811
28873
|
if (keepUndefined) {
|
|
@@ -28819,165 +28881,183 @@ async function serialize(serializationContext) {
|
|
|
28819
28881
|
}
|
|
28820
28882
|
for (let i = 0; i < length; i++) {
|
|
28821
28883
|
if (separator) {
|
|
28822
|
-
|
|
28884
|
+
this.$writer$.write(COMMA);
|
|
28823
28885
|
} else {
|
|
28824
28886
|
separator = true;
|
|
28825
28887
|
}
|
|
28826
28888
|
writeFn(value[i], i);
|
|
28827
28889
|
}
|
|
28828
|
-
|
|
28829
|
-
}
|
|
28830
|
-
|
|
28831
|
-
|
|
28890
|
+
this.$writer$.write(BRACKET_CLOSE);
|
|
28891
|
+
}
|
|
28892
|
+
/** Whether a string needs JSON escaping (quote, backslash, or control chars). */
|
|
28893
|
+
stringNeedsJsonEscape$(str) {
|
|
28894
|
+
for (let i = 0; i < str.length; i++) {
|
|
28895
|
+
const c = str.charCodeAt(i);
|
|
28896
|
+
if (c < 32 || c === 34 || c === 92) {
|
|
28897
|
+
return true;
|
|
28898
|
+
}
|
|
28899
|
+
}
|
|
28900
|
+
return false;
|
|
28901
|
+
}
|
|
28902
|
+
/** Output a type,value pair. If the value is an array, it calls writeValue on each item. */
|
|
28903
|
+
output(type, value, keepUndefined) {
|
|
28832
28904
|
if (typeof value === "number") {
|
|
28833
|
-
|
|
28905
|
+
this.$writer$.write(type + COMMA + value);
|
|
28834
28906
|
} else if (typeof value === "string") {
|
|
28835
|
-
const s = JSON.stringify(value);
|
|
28907
|
+
const s = this.stringNeedsJsonEscape$(value) ? JSON.stringify(value) : QUOTE + value + QUOTE;
|
|
28908
|
+
this.$writer$.write(type + COMMA);
|
|
28836
28909
|
let angleBracketIdx = -1;
|
|
28837
28910
|
let lastIdx = 0;
|
|
28838
|
-
while ((angleBracketIdx = s.indexOf(
|
|
28839
|
-
|
|
28840
|
-
|
|
28911
|
+
while ((angleBracketIdx = s.indexOf(CLOSE_TAG, lastIdx)) !== -1) {
|
|
28912
|
+
this.$writer$.write(s.slice(lastIdx, angleBracketIdx));
|
|
28913
|
+
this.$writer$.write(ESCAPED_CLOSE_TAG);
|
|
28841
28914
|
lastIdx = angleBracketIdx + 2;
|
|
28842
28915
|
}
|
|
28843
|
-
|
|
28916
|
+
this.$writer$.write(lastIdx === 0 ? s : s.slice(lastIdx));
|
|
28844
28917
|
} else {
|
|
28845
|
-
|
|
28846
|
-
|
|
28918
|
+
this.$writer$.write(type + COMMA);
|
|
28919
|
+
this.outputArray(value, !!keepUndefined, (valueItem, idx) => {
|
|
28920
|
+
this.writeValue(valueItem, idx);
|
|
28847
28921
|
});
|
|
28848
28922
|
}
|
|
28849
|
-
}
|
|
28850
|
-
|
|
28851
|
-
let seen = getSeenRef(value);
|
|
28852
|
-
const forwardRefIdx = !keepWeak && s11nWeakRefs.get(value);
|
|
28923
|
+
}
|
|
28924
|
+
getSeenRefOrOutput(value, index, keepWeak) {
|
|
28925
|
+
let seen = this.$serializationContext$.getSeenRef(value);
|
|
28926
|
+
const forwardRefIdx = !keepWeak && this.s11nWeakRefs.get(value);
|
|
28853
28927
|
if (!seen) {
|
|
28854
28928
|
if (keepWeak) {
|
|
28855
28929
|
return true;
|
|
28856
28930
|
}
|
|
28857
28931
|
if (typeof forwardRefIdx === "number") {
|
|
28858
|
-
seen =
|
|
28932
|
+
seen = this.$serializationContext$.$addRoot$(value, true);
|
|
28859
28933
|
} else {
|
|
28860
|
-
return
|
|
28934
|
+
return this.$serializationContext$.$markSeen$(value, this.parent, index);
|
|
28861
28935
|
}
|
|
28862
28936
|
}
|
|
28863
28937
|
if (seen.$parent$) {
|
|
28864
|
-
if (!parent) {
|
|
28865
|
-
|
|
28866
|
-
value = serializationContext
|
|
28938
|
+
if (!this.parent) {
|
|
28939
|
+
this.$serializationContext$.$promoteToRoot$(seen, index);
|
|
28940
|
+
value = this.$serializationContext$.$roots$[index];
|
|
28867
28941
|
} else {
|
|
28868
|
-
|
|
28942
|
+
this.$serializationContext$.$promoteToRoot$(seen);
|
|
28869
28943
|
}
|
|
28870
28944
|
}
|
|
28871
28945
|
if (typeof forwardRefIdx === "number") {
|
|
28872
|
-
forwardRefs[forwardRefIdx] = seen.$index$;
|
|
28873
|
-
s11nWeakRefs.delete(value);
|
|
28946
|
+
this.forwardRefs[forwardRefIdx] = seen.$index$;
|
|
28947
|
+
this.s11nWeakRefs.delete(value);
|
|
28874
28948
|
}
|
|
28875
|
-
const
|
|
28876
|
-
if (!parent &&
|
|
28949
|
+
const rootIdx = value instanceof SerializationBackRef ? value.$path$ : seen.$index$;
|
|
28950
|
+
if (!this.parent && rootIdx === index) {
|
|
28877
28951
|
return seen;
|
|
28878
28952
|
}
|
|
28879
|
-
output(1 /* RootRef */,
|
|
28880
|
-
}
|
|
28881
|
-
|
|
28953
|
+
this.output(1 /* RootRef */, rootIdx);
|
|
28954
|
+
}
|
|
28955
|
+
// First check for scalars, then do objects with seen checks
|
|
28956
|
+
// Make sure to only get the SeenRef once, it's expensive
|
|
28957
|
+
writeValue(value, index) {
|
|
28882
28958
|
if (fastSkipSerialize(value)) {
|
|
28883
|
-
output(3 /* Constant */, 0 /* Undefined */);
|
|
28959
|
+
this.output(3 /* Constant */, 0 /* Undefined */);
|
|
28884
28960
|
} else {
|
|
28885
28961
|
switch (typeof value) {
|
|
28886
28962
|
case "undefined":
|
|
28887
|
-
output(3 /* Constant */, 0 /* Undefined */);
|
|
28963
|
+
this.output(3 /* Constant */, 0 /* Undefined */);
|
|
28888
28964
|
break;
|
|
28889
28965
|
case "boolean":
|
|
28890
|
-
output(3 /* Constant */, value ? 2 /* True */ : 3 /* False */);
|
|
28966
|
+
this.output(3 /* Constant */, value ? 2 /* True */ : 3 /* False */);
|
|
28891
28967
|
break;
|
|
28892
28968
|
case "number":
|
|
28893
28969
|
if (Number.isNaN(value)) {
|
|
28894
|
-
output(3 /* Constant */, 12 /* NaN */);
|
|
28970
|
+
this.output(3 /* Constant */, 12 /* NaN */);
|
|
28895
28971
|
} else if (!Number.isFinite(value)) {
|
|
28896
|
-
output(
|
|
28972
|
+
this.output(
|
|
28897
28973
|
3 /* Constant */,
|
|
28898
28974
|
value < 0 ? 14 /* NegativeInfinity */ : 13 /* PositiveInfinity */
|
|
28899
28975
|
);
|
|
28900
28976
|
} else if (value === Number.MAX_SAFE_INTEGER) {
|
|
28901
|
-
output(3 /* Constant */, 15 /* MaxSafeInt */);
|
|
28977
|
+
this.output(3 /* Constant */, 15 /* MaxSafeInt */);
|
|
28902
28978
|
} else if (value === Number.MAX_SAFE_INTEGER - 1) {
|
|
28903
|
-
output(3 /* Constant */, 16 /* AlmostMaxSafeInt */);
|
|
28979
|
+
this.output(3 /* Constant */, 16 /* AlmostMaxSafeInt */);
|
|
28904
28980
|
} else if (value === Number.MIN_SAFE_INTEGER) {
|
|
28905
|
-
output(3 /* Constant */, 17 /* MinSafeInt */);
|
|
28981
|
+
this.output(3 /* Constant */, 17 /* MinSafeInt */);
|
|
28906
28982
|
} else {
|
|
28907
|
-
output(0 /* Plain */, value);
|
|
28983
|
+
this.output(0 /* Plain */, value);
|
|
28908
28984
|
}
|
|
28909
28985
|
break;
|
|
28910
28986
|
case "string":
|
|
28911
28987
|
if (value.length === 0) {
|
|
28912
|
-
output(3 /* Constant */, 4 /* EmptyString */);
|
|
28988
|
+
this.output(3 /* Constant */, 4 /* EmptyString */);
|
|
28913
28989
|
} else {
|
|
28914
|
-
if (value.length < 4 || getSeenRefOrOutput(value, index)) {
|
|
28915
|
-
output(0 /* Plain */, value);
|
|
28990
|
+
if (value.length < 4 || this.getSeenRefOrOutput(value, index)) {
|
|
28991
|
+
this.output(0 /* Plain */, value);
|
|
28916
28992
|
}
|
|
28917
28993
|
}
|
|
28918
28994
|
break;
|
|
28919
28995
|
case "bigint":
|
|
28920
|
-
if (value < 1e4 && value > -1e3 || getSeenRefOrOutput(value, index)) {
|
|
28921
|
-
output(12 /* BigInt */, value.toString());
|
|
28996
|
+
if (value < 1e4 && value > -1e3 || this.getSeenRefOrOutput(value, index)) {
|
|
28997
|
+
this.output(12 /* BigInt */, value.toString());
|
|
28922
28998
|
}
|
|
28923
28999
|
break;
|
|
28924
29000
|
case "symbol":
|
|
28925
29001
|
if (value === NEEDS_COMPUTATION) {
|
|
28926
|
-
output(3 /* Constant */, 7 /* NEEDS_COMPUTATION */);
|
|
29002
|
+
this.output(3 /* Constant */, 7 /* NEEDS_COMPUTATION */);
|
|
28927
29003
|
} else if (value === STORE_ALL_PROPS) {
|
|
28928
|
-
output(3 /* Constant */, 8 /* STORE_ALL_PROPS */);
|
|
29004
|
+
this.output(3 /* Constant */, 8 /* STORE_ALL_PROPS */);
|
|
28929
29005
|
} else if (value === _UNINITIALIZED) {
|
|
28930
|
-
output(3 /* Constant */, 9 /* UNINITIALIZED */);
|
|
29006
|
+
this.output(3 /* Constant */, 9 /* UNINITIALIZED */);
|
|
28931
29007
|
}
|
|
28932
29008
|
break;
|
|
28933
29009
|
case "function":
|
|
28934
29010
|
if (value === Slot) {
|
|
28935
|
-
output(3 /* Constant */, 10 /* Slot */);
|
|
29011
|
+
this.output(3 /* Constant */, 10 /* Slot */);
|
|
28936
29012
|
} else if (value === Fragment) {
|
|
28937
|
-
output(3 /* Constant */, 11 /* Fragment */);
|
|
29013
|
+
this.output(3 /* Constant */, 11 /* Fragment */);
|
|
28938
29014
|
} else if (isQrl(value)) {
|
|
28939
|
-
if (getSeenRefOrOutput(value, index)) {
|
|
28940
|
-
const [chunk, symbol, captures] = qrlToString(
|
|
29015
|
+
if (this.getSeenRefOrOutput(value, index)) {
|
|
29016
|
+
const [chunk, symbol, captures] = qrlToString(
|
|
29017
|
+
this.$serializationContext$,
|
|
29018
|
+
value,
|
|
29019
|
+
true
|
|
29020
|
+
);
|
|
28941
29021
|
let data;
|
|
28942
29022
|
if (chunk !== "") {
|
|
28943
|
-
data = `${
|
|
28944
|
-
const existing = qrlMap.get(data);
|
|
29023
|
+
data = `${this.$serializationContext$.$addRoot$(chunk)}#${this.$serializationContext$.$addRoot$(symbol)}${captures ? "#" + captures : ""}`;
|
|
29024
|
+
const existing = this.qrlMap.get(data);
|
|
28945
29025
|
if (existing) {
|
|
28946
|
-
const ref =
|
|
28947
|
-
output(1 /* RootRef */, ref);
|
|
29026
|
+
const ref = this.$serializationContext$.$addRoot$(existing);
|
|
29027
|
+
this.output(1 /* RootRef */, ref);
|
|
28948
29028
|
return;
|
|
28949
29029
|
} else {
|
|
28950
|
-
qrlMap.set(data, value);
|
|
29030
|
+
this.qrlMap.set(data, value);
|
|
28951
29031
|
}
|
|
28952
29032
|
} else {
|
|
28953
29033
|
data = Number(symbol);
|
|
28954
29034
|
}
|
|
28955
|
-
output(9 /* QRL */, data);
|
|
29035
|
+
this.output(9 /* QRL */, data);
|
|
28956
29036
|
}
|
|
28957
29037
|
} else if (isQwikComponent(value)) {
|
|
28958
29038
|
const [qrl] = value[SERIALIZABLE_STATE];
|
|
28959
|
-
serializationContext
|
|
28960
|
-
output(21 /* Component */, [qrl]);
|
|
29039
|
+
this.$serializationContext$.$renderSymbols$.add(qrl.$symbol$);
|
|
29040
|
+
this.output(21 /* Component */, [qrl]);
|
|
28961
29041
|
} else {
|
|
28962
29042
|
throw qError(34 /* serializeErrorCannotSerializeFunction */, [value.toString()]);
|
|
28963
29043
|
}
|
|
28964
29044
|
break;
|
|
28965
29045
|
case "object":
|
|
28966
29046
|
if (value === EMPTY_ARRAY) {
|
|
28967
|
-
output(3 /* Constant */, 5 /* EMPTY_ARRAY */);
|
|
29047
|
+
this.output(3 /* Constant */, 5 /* EMPTY_ARRAY */);
|
|
28968
29048
|
} else if (value === EMPTY_OBJ) {
|
|
28969
|
-
output(3 /* Constant */, 6 /* EMPTY_OBJ */);
|
|
29049
|
+
this.output(3 /* Constant */, 6 /* EMPTY_OBJ */);
|
|
28970
29050
|
} else if (value === null) {
|
|
28971
|
-
output(3 /* Constant */, 1 /* Null */);
|
|
29051
|
+
this.output(3 /* Constant */, 1 /* Null */);
|
|
28972
29052
|
} else if (value instanceof SerializationBackRef) {
|
|
28973
|
-
output(1 /* RootRef */, value.$path$);
|
|
29053
|
+
this.output(1 /* RootRef */, value.$path$);
|
|
28974
29054
|
} else {
|
|
28975
|
-
const newSeenRef = getSeenRefOrOutput(value, index);
|
|
29055
|
+
const newSeenRef = this.getSeenRefOrOutput(value, index);
|
|
28976
29056
|
if (newSeenRef) {
|
|
28977
|
-
const oldParent = parent;
|
|
28978
|
-
parent = newSeenRef;
|
|
28979
|
-
writeObjectValue(value);
|
|
28980
|
-
parent = oldParent;
|
|
29057
|
+
const oldParent = this.parent;
|
|
29058
|
+
this.parent = newSeenRef;
|
|
29059
|
+
this.writeObjectValue(value);
|
|
29060
|
+
this.parent = oldParent;
|
|
28981
29061
|
}
|
|
28982
29062
|
}
|
|
28983
29063
|
break;
|
|
@@ -28985,20 +29065,23 @@ async function serialize(serializationContext) {
|
|
|
28985
29065
|
throw qError(20 /* serializeErrorUnknownType */, [typeof value]);
|
|
28986
29066
|
}
|
|
28987
29067
|
}
|
|
28988
|
-
}
|
|
28989
|
-
|
|
29068
|
+
}
|
|
29069
|
+
writeObjectValue(value) {
|
|
28990
29070
|
if (isPropsProxy(value)) {
|
|
28991
29071
|
const owner = value[_OWNER];
|
|
28992
|
-
output(30 /* PropsProxy */, [
|
|
29072
|
+
this.output(30 /* PropsProxy */, [
|
|
28993
29073
|
_serializationWeakRef(owner),
|
|
28994
29074
|
owner.varProps,
|
|
28995
29075
|
owner.constProps,
|
|
28996
29076
|
value[_PROPS_HANDLER].$effects$
|
|
28997
29077
|
]);
|
|
28998
29078
|
} else if (value instanceof SubscriptionData) {
|
|
28999
|
-
output(31 /* SubscriptionData */, [
|
|
29079
|
+
this.output(31 /* SubscriptionData */, [
|
|
29080
|
+
value.data.$scopedStyleIdPrefix$,
|
|
29081
|
+
value.data.$isConst$
|
|
29082
|
+
]);
|
|
29000
29083
|
} else if (value instanceof EffectSubscription) {
|
|
29001
|
-
output(32 /* EffectSubscription */, [
|
|
29084
|
+
this.output(32 /* EffectSubscription */, [
|
|
29002
29085
|
value.consumer,
|
|
29003
29086
|
value.property,
|
|
29004
29087
|
value.backRef,
|
|
@@ -29012,7 +29095,7 @@ async function serialize(serializationContext) {
|
|
|
29012
29095
|
const innerStores = [];
|
|
29013
29096
|
for (const prop in storeTarget) {
|
|
29014
29097
|
const propValue = storeTarget[prop];
|
|
29015
|
-
const innerStore =
|
|
29098
|
+
const innerStore = this.$serializationContext$.$storeProxyMap$.get(propValue);
|
|
29016
29099
|
if (innerStore) {
|
|
29017
29100
|
innerStores.push(innerStore);
|
|
29018
29101
|
}
|
|
@@ -29021,11 +29104,11 @@ async function serialize(serializationContext) {
|
|
|
29021
29104
|
while (out[out.length - 1] === void 0) {
|
|
29022
29105
|
out.pop();
|
|
29023
29106
|
}
|
|
29024
|
-
output(27 /* Store */, out);
|
|
29107
|
+
this.output(27 /* Store */, out);
|
|
29025
29108
|
} else if (isSerializerObj(value)) {
|
|
29026
29109
|
const result2 = value[SerializerSymbol](value);
|
|
29027
29110
|
if (isPromise(result2)) {
|
|
29028
|
-
const forwardRef = resolvePromise(result2,
|
|
29111
|
+
const forwardRef = this.resolvePromise(result2, (resolved, resolvedValue) => {
|
|
29029
29112
|
return new PromiseResult(
|
|
29030
29113
|
26 /* SerializerSignal */,
|
|
29031
29114
|
resolved,
|
|
@@ -29034,15 +29117,15 @@ async function serialize(serializationContext) {
|
|
|
29034
29117
|
void 0
|
|
29035
29118
|
);
|
|
29036
29119
|
});
|
|
29037
|
-
output(2 /* ForwardRef */, forwardRef);
|
|
29120
|
+
this.output(2 /* ForwardRef */, forwardRef);
|
|
29038
29121
|
} else {
|
|
29039
|
-
const index = parent.$index$;
|
|
29040
|
-
parent = parent.$parent$;
|
|
29041
|
-
writeValue(result2, index);
|
|
29122
|
+
const index = this.parent.$index$;
|
|
29123
|
+
this.parent = this.parent.$parent$;
|
|
29124
|
+
this.writeValue(result2, index);
|
|
29042
29125
|
}
|
|
29043
29126
|
} else if (isObjectLiteral(value)) {
|
|
29044
29127
|
if (Array.isArray(value)) {
|
|
29045
|
-
output(4 /* Array */, value);
|
|
29128
|
+
this.output(4 /* Array */, value);
|
|
29046
29129
|
} else {
|
|
29047
29130
|
const out = [];
|
|
29048
29131
|
for (const key in value) {
|
|
@@ -29053,16 +29136,16 @@ async function serialize(serializationContext) {
|
|
|
29053
29136
|
}
|
|
29054
29137
|
}
|
|
29055
29138
|
}
|
|
29056
|
-
output(5 /* Object */, out.length ? out : 0);
|
|
29139
|
+
this.output(5 /* Object */, out.length ? out : 0);
|
|
29057
29140
|
}
|
|
29058
|
-
} else if (
|
|
29141
|
+
} else if (this.$serializationContext$.$isDomRef$(value)) {
|
|
29059
29142
|
value.$ssrNode$.vnodeData[0] |= 16 /* SERIALIZE */;
|
|
29060
|
-
output(11 /* RefVNode */, value.$ssrNode$.id);
|
|
29143
|
+
this.output(11 /* RefVNode */, value.$ssrNode$.id);
|
|
29061
29144
|
} else if (value instanceof SignalImpl) {
|
|
29062
29145
|
if (value instanceof SerializerSignalImpl) {
|
|
29063
29146
|
const maybeValue = getCustomSerializerPromise(value, value.$untrackedValue$);
|
|
29064
29147
|
if (isPromise(maybeValue)) {
|
|
29065
|
-
const forwardRefId = resolvePromise(maybeValue,
|
|
29148
|
+
const forwardRefId = this.resolvePromise(maybeValue, (resolved, resolvedValue) => {
|
|
29066
29149
|
return new PromiseResult(
|
|
29067
29150
|
26 /* SerializerSignal */,
|
|
29068
29151
|
resolved,
|
|
@@ -29071,9 +29154,9 @@ async function serialize(serializationContext) {
|
|
|
29071
29154
|
value.$computeQrl$
|
|
29072
29155
|
);
|
|
29073
29156
|
});
|
|
29074
|
-
output(2 /* ForwardRef */, forwardRefId);
|
|
29157
|
+
this.output(2 /* ForwardRef */, forwardRefId);
|
|
29075
29158
|
} else {
|
|
29076
|
-
output(26 /* SerializerSignal */, [
|
|
29159
|
+
this.output(26 /* SerializerSignal */, [
|
|
29077
29160
|
value.$computeQrl$,
|
|
29078
29161
|
filterEffectBackRefs(value[_EFFECT_BACK_REF]),
|
|
29079
29162
|
value.$effects$,
|
|
@@ -29083,8 +29166,8 @@ async function serialize(serializationContext) {
|
|
|
29083
29166
|
return;
|
|
29084
29167
|
}
|
|
29085
29168
|
if (value instanceof WrappedSignalImpl) {
|
|
29086
|
-
output(23 /* WrappedSignal */, [
|
|
29087
|
-
...serializeWrappingFn(serializationContext
|
|
29169
|
+
this.output(23 /* WrappedSignal */, [
|
|
29170
|
+
...serializeWrappingFn(this.$serializationContext$, value),
|
|
29088
29171
|
filterEffectBackRefs(value[_EFFECT_BACK_REF]),
|
|
29089
29172
|
value.$flags$,
|
|
29090
29173
|
value.$hostElement$,
|
|
@@ -29100,7 +29183,7 @@ async function serialize(serializationContext) {
|
|
|
29100
29183
|
const interval = isAsync && value.$interval$ > 0 ? value.$interval$ : void 0;
|
|
29101
29184
|
const concurrency = isAsync && value.$concurrency$ !== 1 ? value.$concurrency$ : void 0;
|
|
29102
29185
|
const timeout = isAsync && value.$timeoutMs$ !== 0 ? value.$timeoutMs$ : void 0;
|
|
29103
|
-
const
|
|
29186
|
+
const asyncFlags = isAsync && value.$flags$ & ~24 /* SERIALIZATION_ALL_STRATEGIES */ || void 0;
|
|
29104
29187
|
if (isInvalid || isSkippable) {
|
|
29105
29188
|
v = NEEDS_COMPUTATION;
|
|
29106
29189
|
} else if (shouldAlwaysSerialize) {
|
|
@@ -29115,6 +29198,7 @@ async function serialize(serializationContext) {
|
|
|
29115
29198
|
];
|
|
29116
29199
|
if (isAsync) {
|
|
29117
29200
|
out.push(value.$loadingEffects$, value.$errorEffects$, value.$untrackedError$);
|
|
29201
|
+
out.push(asyncFlags || void 0);
|
|
29118
29202
|
}
|
|
29119
29203
|
let keepUndefined = false;
|
|
29120
29204
|
if (v !== NEEDS_COMPUTATION || interval !== void 0 || concurrency !== void 0 || timeout !== void 0) {
|
|
@@ -29127,9 +29211,8 @@ async function serialize(serializationContext) {
|
|
|
29127
29211
|
out.push(interval);
|
|
29128
29212
|
out.push(concurrency);
|
|
29129
29213
|
out.push(timeout);
|
|
29130
|
-
out.push(eagerCleanup);
|
|
29131
29214
|
}
|
|
29132
|
-
output(isAsync ? 25 /* AsyncSignal */ : 24 /* ComputedSignal */, out, keepUndefined);
|
|
29215
|
+
this.output(isAsync ? 25 /* AsyncSignal */ : 24 /* ComputedSignal */, out, keepUndefined);
|
|
29133
29216
|
} else {
|
|
29134
29217
|
const v = value.$untrackedValue$;
|
|
29135
29218
|
const keepUndefined = v === void 0;
|
|
@@ -29137,39 +29220,45 @@ async function serialize(serializationContext) {
|
|
|
29137
29220
|
if (value.$effects$) {
|
|
29138
29221
|
out.push(...value.$effects$);
|
|
29139
29222
|
}
|
|
29140
|
-
output(22 /* Signal */, out, keepUndefined);
|
|
29223
|
+
this.output(22 /* Signal */, out, keepUndefined);
|
|
29141
29224
|
}
|
|
29142
29225
|
} else if (value instanceof URL) {
|
|
29143
|
-
output(6 /* URL */, value.href);
|
|
29226
|
+
this.output(6 /* URL */, value.href);
|
|
29144
29227
|
} else if (value instanceof Date) {
|
|
29145
|
-
output(7 /* Date */, Number.isNaN(value.valueOf()) ? "" : value.valueOf());
|
|
29228
|
+
this.output(7 /* Date */, Number.isNaN(value.valueOf()) ? "" : value.valueOf());
|
|
29146
29229
|
} else if (value instanceof RegExp) {
|
|
29147
|
-
output(8 /* Regex */, value.toString());
|
|
29230
|
+
this.output(8 /* Regex */, value.toString());
|
|
29148
29231
|
} else if (value instanceof Error) {
|
|
29149
29232
|
const out = [value.message];
|
|
29150
29233
|
out.push(...Object.entries(value).flat());
|
|
29151
|
-
if (
|
|
29234
|
+
if (isDev17) {
|
|
29152
29235
|
out.push("stack", value.stack);
|
|
29153
29236
|
}
|
|
29154
|
-
output(15 /* Error */, out);
|
|
29155
|
-
} else if (
|
|
29156
|
-
const rootIndex =
|
|
29157
|
-
serializationContext
|
|
29158
|
-
output(10 /* VNode */, value.id);
|
|
29237
|
+
this.output(15 /* Error */, out);
|
|
29238
|
+
} else if (this.$serializationContext$.$isSsrNode$(value)) {
|
|
29239
|
+
const rootIndex = this.$serializationContext$.$addRoot$(value);
|
|
29240
|
+
this.$serializationContext$.$setProp$(value, ELEMENT_ID, String(rootIndex));
|
|
29241
|
+
this.output(10 /* VNode */, value.id);
|
|
29159
29242
|
const vNodeData = value.vnodeData;
|
|
29160
29243
|
if (vNodeData) {
|
|
29161
|
-
discoverValuesForVNodeData(
|
|
29244
|
+
discoverValuesForVNodeData(
|
|
29245
|
+
vNodeData,
|
|
29246
|
+
(vNodeDataValue) => this.$serializationContext$.$addRoot$(vNodeDataValue)
|
|
29247
|
+
);
|
|
29162
29248
|
vNodeData[0] |= 16 /* SERIALIZE */;
|
|
29163
29249
|
}
|
|
29164
29250
|
if (value.children) {
|
|
29165
|
-
|
|
29251
|
+
const childrenLength = value.children.length;
|
|
29252
|
+
for (let i = 0; i < childrenLength; i++) {
|
|
29253
|
+
const child = value.children[i];
|
|
29166
29254
|
const childVNodeData = child.vnodeData;
|
|
29167
29255
|
if (childVNodeData) {
|
|
29168
|
-
for (
|
|
29256
|
+
for (let i2 = 0; i2 < childVNodeData.length; i2++) {
|
|
29257
|
+
const value2 = childVNodeData[i2];
|
|
29169
29258
|
if (isSsrAttrs(value2)) {
|
|
29170
|
-
const
|
|
29171
|
-
if (
|
|
29172
|
-
|
|
29259
|
+
const backRefs = tryGetBackRefs(value2);
|
|
29260
|
+
if (backRefs) {
|
|
29261
|
+
this.$serializationContext$.$addRoot$(backRefs);
|
|
29173
29262
|
}
|
|
29174
29263
|
}
|
|
29175
29264
|
}
|
|
@@ -29179,24 +29268,22 @@ async function serialize(serializationContext) {
|
|
|
29179
29268
|
}
|
|
29180
29269
|
} else if (typeof FormData !== "undefined" && value instanceof FormData) {
|
|
29181
29270
|
const array = [];
|
|
29182
|
-
value.
|
|
29183
|
-
if (typeof
|
|
29184
|
-
array.push(
|
|
29185
|
-
} else {
|
|
29186
|
-
array.push(key, value2.name);
|
|
29271
|
+
for (const [k, v] of value.entries()) {
|
|
29272
|
+
if (typeof v === "string") {
|
|
29273
|
+
array.push(k, v);
|
|
29187
29274
|
}
|
|
29188
|
-
}
|
|
29189
|
-
output(28 /* FormData */, array);
|
|
29275
|
+
}
|
|
29276
|
+
this.output(28 /* FormData */, array);
|
|
29190
29277
|
} else if (value instanceof URLSearchParams) {
|
|
29191
|
-
output(13 /* URLSearchParams */, value.toString());
|
|
29278
|
+
this.output(13 /* URLSearchParams */, value.toString());
|
|
29192
29279
|
} else if (value instanceof Set) {
|
|
29193
|
-
output(17 /* Set */, [...value.values()]);
|
|
29280
|
+
this.output(17 /* Set */, [...value.values()]);
|
|
29194
29281
|
} else if (value instanceof Map) {
|
|
29195
29282
|
const combined = [];
|
|
29196
29283
|
for (const [k, v] of value.entries()) {
|
|
29197
29284
|
combined.push(k, v);
|
|
29198
29285
|
}
|
|
29199
|
-
output(18 /* Map */, combined);
|
|
29286
|
+
this.output(18 /* Map */, combined);
|
|
29200
29287
|
} else if (isJSXNode(value)) {
|
|
29201
29288
|
const out = [
|
|
29202
29289
|
value.type,
|
|
@@ -29209,7 +29296,7 @@ async function serialize(serializationContext) {
|
|
|
29209
29296
|
while (out[out.length - 1] === void 0) {
|
|
29210
29297
|
out.pop();
|
|
29211
29298
|
}
|
|
29212
|
-
output(29 /* JSXNode */, out);
|
|
29299
|
+
this.output(29 /* JSXNode */, out);
|
|
29213
29300
|
} else if (value instanceof Task) {
|
|
29214
29301
|
const out = [
|
|
29215
29302
|
value.$qrl$,
|
|
@@ -29222,104 +29309,108 @@ async function serialize(serializationContext) {
|
|
|
29222
29309
|
while (out[out.length - 1] === void 0) {
|
|
29223
29310
|
out.pop();
|
|
29224
29311
|
}
|
|
29225
|
-
output(20 /* Task */, out);
|
|
29312
|
+
this.output(20 /* Task */, out);
|
|
29226
29313
|
} else if (isPromise(value)) {
|
|
29227
|
-
const forwardRefId = resolvePromise(value,
|
|
29314
|
+
const forwardRefId = this.resolvePromise(value, (resolved, resolvedValue) => {
|
|
29228
29315
|
return new PromiseResult(16 /* Promise */, resolved, resolvedValue);
|
|
29229
29316
|
});
|
|
29230
|
-
output(2 /* ForwardRef */, forwardRefId);
|
|
29317
|
+
this.output(2 /* ForwardRef */, forwardRefId);
|
|
29231
29318
|
} else if (value instanceof PromiseResult) {
|
|
29232
29319
|
if (value.$type$ === 26 /* SerializerSignal */) {
|
|
29233
29320
|
if (value.$qrl$) {
|
|
29234
|
-
output(26 /* SerializerSignal */, [value.$qrl$, value.$effects$, value.$value$]);
|
|
29321
|
+
this.output(26 /* SerializerSignal */, [value.$qrl$, value.$effects$, value.$value$]);
|
|
29235
29322
|
} else if (value.$resolved$) {
|
|
29236
|
-
const index = parent.$index$;
|
|
29237
|
-
parent = parent.$parent$;
|
|
29238
|
-
writeValue(value.$value$, index);
|
|
29323
|
+
const index = this.parent.$index$;
|
|
29324
|
+
this.parent = this.parent.$parent$;
|
|
29325
|
+
this.writeValue(value.$value$, index);
|
|
29239
29326
|
} else {
|
|
29240
29327
|
console.error(value.$value$);
|
|
29241
29328
|
throw qError(33 /* serializerSymbolRejectedPromise */);
|
|
29242
29329
|
}
|
|
29243
29330
|
} else {
|
|
29244
|
-
output(16 /* Promise */, [value.$resolved$, value.$value$]);
|
|
29331
|
+
this.output(16 /* Promise */, [value.$resolved$, value.$value$]);
|
|
29245
29332
|
}
|
|
29246
29333
|
} else if (value instanceof Uint8Array) {
|
|
29247
29334
|
let buf = "";
|
|
29248
|
-
|
|
29249
|
-
|
|
29335
|
+
const length = value.length;
|
|
29336
|
+
for (let i = 0; i < length; i++) {
|
|
29337
|
+
buf += String.fromCharCode(value[i]);
|
|
29250
29338
|
}
|
|
29251
29339
|
const out = btoa(buf).replace(/=+$/, "");
|
|
29252
|
-
output(19 /* Uint8Array */, out);
|
|
29340
|
+
this.output(19 /* Uint8Array */, out);
|
|
29253
29341
|
} else if (value instanceof SerializationWeakRef) {
|
|
29254
29342
|
const obj = value.$obj$;
|
|
29255
|
-
if (getSeenRefOrOutput(obj, parent.$index$, true)) {
|
|
29256
|
-
let forwardRefId = s11nWeakRefs.get(obj);
|
|
29343
|
+
if (this.getSeenRefOrOutput(obj, this.parent.$index$, true)) {
|
|
29344
|
+
let forwardRefId = this.s11nWeakRefs.get(obj);
|
|
29257
29345
|
if (forwardRefId === void 0) {
|
|
29258
|
-
forwardRefId = forwardRefsId++;
|
|
29259
|
-
s11nWeakRefs.set(obj, forwardRefId);
|
|
29260
|
-
forwardRefs[forwardRefId] = -1;
|
|
29346
|
+
forwardRefId = this.forwardRefsId++;
|
|
29347
|
+
this.s11nWeakRefs.set(obj, forwardRefId);
|
|
29348
|
+
this.forwardRefs[forwardRefId] = -1;
|
|
29261
29349
|
}
|
|
29262
|
-
output(2 /* ForwardRef */, forwardRefId);
|
|
29350
|
+
this.output(2 /* ForwardRef */, forwardRefId);
|
|
29263
29351
|
}
|
|
29264
29352
|
} else if (vnode_isVNode(value)) {
|
|
29265
|
-
output(3 /* Constant */, 0 /* Undefined */);
|
|
29353
|
+
this.output(3 /* Constant */, 0 /* Undefined */);
|
|
29266
29354
|
} else {
|
|
29267
29355
|
throw qError(20 /* serializeErrorUnknownType */, [typeof value]);
|
|
29268
29356
|
}
|
|
29269
|
-
}
|
|
29270
|
-
|
|
29271
|
-
const forwardRefId = forwardRefsId++;
|
|
29357
|
+
}
|
|
29358
|
+
resolvePromise(promise, classCreator) {
|
|
29359
|
+
const forwardRefId = this.forwardRefsId++;
|
|
29272
29360
|
promise.then((resolvedValue) => {
|
|
29273
|
-
promises.delete(promise);
|
|
29274
|
-
forwardRefs[forwardRefId] =
|
|
29361
|
+
this.promises.delete(promise);
|
|
29362
|
+
this.forwardRefs[forwardRefId] = this.$serializationContext$.$addRoot$(
|
|
29363
|
+
classCreator(true, resolvedValue)
|
|
29364
|
+
);
|
|
29275
29365
|
}).catch((err) => {
|
|
29276
|
-
promises.delete(promise);
|
|
29277
|
-
forwardRefs[forwardRefId] =
|
|
29366
|
+
this.promises.delete(promise);
|
|
29367
|
+
this.forwardRefs[forwardRefId] = this.$serializationContext$.$addRoot$(
|
|
29368
|
+
classCreator(false, err)
|
|
29369
|
+
);
|
|
29278
29370
|
});
|
|
29279
|
-
promises.add(promise);
|
|
29371
|
+
this.promises.add(promise);
|
|
29280
29372
|
return forwardRefId;
|
|
29281
29373
|
}
|
|
29282
|
-
|
|
29283
|
-
|
|
29284
|
-
const { $roots$ } = serializationContext
|
|
29285
|
-
while (rootIdx < $roots$.length || promises.size) {
|
|
29286
|
-
if (rootIdx !== 0) {
|
|
29287
|
-
|
|
29374
|
+
async outputRoots() {
|
|
29375
|
+
this.$writer$.write(BRACKET_OPEN);
|
|
29376
|
+
const { $roots$ } = this.$serializationContext$;
|
|
29377
|
+
while (this.rootIdx < $roots$.length || this.promises.size) {
|
|
29378
|
+
if (this.rootIdx !== 0) {
|
|
29379
|
+
this.$writer$.write(COMMA);
|
|
29288
29380
|
}
|
|
29289
29381
|
let separator = false;
|
|
29290
|
-
for (; rootIdx < $roots$.length; rootIdx++) {
|
|
29382
|
+
for (; this.rootIdx < $roots$.length; this.rootIdx++) {
|
|
29291
29383
|
if (separator) {
|
|
29292
|
-
|
|
29384
|
+
this.$writer$.write(COMMA);
|
|
29293
29385
|
} else {
|
|
29294
29386
|
separator = true;
|
|
29295
29387
|
}
|
|
29296
|
-
writeValue($roots$[rootIdx], rootIdx);
|
|
29388
|
+
this.writeValue($roots$[this.rootIdx], this.rootIdx);
|
|
29297
29389
|
}
|
|
29298
|
-
if (promises.size) {
|
|
29390
|
+
if (this.promises.size) {
|
|
29299
29391
|
try {
|
|
29300
|
-
await Promise.race(promises);
|
|
29392
|
+
await Promise.race(this.promises);
|
|
29301
29393
|
} catch {
|
|
29302
29394
|
}
|
|
29303
29395
|
}
|
|
29304
29396
|
}
|
|
29305
|
-
if (forwardRefs.length) {
|
|
29306
|
-
let lastIdx = forwardRefs.length - 1;
|
|
29307
|
-
while (lastIdx >= 0 && forwardRefs[lastIdx] === -1) {
|
|
29397
|
+
if (this.forwardRefs.length) {
|
|
29398
|
+
let lastIdx = this.forwardRefs.length - 1;
|
|
29399
|
+
while (lastIdx >= 0 && this.forwardRefs[lastIdx] === -1) {
|
|
29308
29400
|
lastIdx--;
|
|
29309
29401
|
}
|
|
29310
29402
|
if (lastIdx >= 0) {
|
|
29311
|
-
|
|
29312
|
-
|
|
29313
|
-
const out = lastIdx === forwardRefs.length - 1 ? forwardRefs : forwardRefs.slice(0, lastIdx + 1);
|
|
29314
|
-
outputArray(out, true, (value) => {
|
|
29315
|
-
|
|
29403
|
+
this.$writer$.write(COMMA);
|
|
29404
|
+
this.$writer$.write(14 /* ForwardRefs */ + COMMA);
|
|
29405
|
+
const out = lastIdx === this.forwardRefs.length - 1 ? this.forwardRefs : this.forwardRefs.slice(0, lastIdx + 1);
|
|
29406
|
+
this.outputArray(out, true, (value) => {
|
|
29407
|
+
this.$writer$.write(String(value));
|
|
29316
29408
|
});
|
|
29317
29409
|
}
|
|
29318
29410
|
}
|
|
29319
|
-
|
|
29320
|
-
}
|
|
29321
|
-
|
|
29322
|
-
}
|
|
29411
|
+
this.$writer$.write(BRACKET_CLOSE);
|
|
29412
|
+
}
|
|
29413
|
+
};
|
|
29323
29414
|
var PromiseResult = class {
|
|
29324
29415
|
constructor($type$, $resolved$, $value$, $effects$ = void 0, $qrl$ = void 0) {
|
|
29325
29416
|
this.$type$ = $type$;
|
|
@@ -29353,13 +29444,13 @@ function getCustomSerializerPromise(signal, value) {
|
|
|
29353
29444
|
);
|
|
29354
29445
|
}
|
|
29355
29446
|
var discoverValuesForVNodeData = (vnodeData, callback) => {
|
|
29356
|
-
|
|
29447
|
+
const length = vnodeData.length;
|
|
29448
|
+
for (let i = 0; i < length; i++) {
|
|
29449
|
+
const value = vnodeData[i];
|
|
29357
29450
|
if (isSsrAttrs(value)) {
|
|
29358
|
-
for (
|
|
29359
|
-
const
|
|
29360
|
-
|
|
29361
|
-
if (attrValue == null || typeof attrValue === "string" || // skip empty props
|
|
29362
|
-
keyValue === ELEMENT_PROPS && Object.keys(attrValue).length === 0) {
|
|
29451
|
+
for (const key in value) {
|
|
29452
|
+
const attrValue = value[key];
|
|
29453
|
+
if (attrValue == null || typeof attrValue === "string" || key === ELEMENT_PROPS && isObjectEmpty(attrValue)) {
|
|
29363
29454
|
continue;
|
|
29364
29455
|
}
|
|
29365
29456
|
callback(attrValue);
|
|
@@ -29367,7 +29458,7 @@ var discoverValuesForVNodeData = (vnodeData, callback) => {
|
|
|
29367
29458
|
}
|
|
29368
29459
|
}
|
|
29369
29460
|
};
|
|
29370
|
-
var isSsrAttrs = (value) =>
|
|
29461
|
+
var isSsrAttrs = (value) => typeof value === "object" && value !== null && !isObjectEmpty(value);
|
|
29371
29462
|
function isObjectLiteral(obj) {
|
|
29372
29463
|
const prototype = Object.getPrototypeOf(obj);
|
|
29373
29464
|
return prototype == null || prototype === Object.prototype || prototype === Array.prototype;
|
|
@@ -29395,6 +29486,9 @@ function filterEffectBackRefs(effectBackRef) {
|
|
|
29395
29486
|
}
|
|
29396
29487
|
return effectBackRefToSerialize;
|
|
29397
29488
|
}
|
|
29489
|
+
function tryGetBackRefs(props) {
|
|
29490
|
+
return Object.prototype.hasOwnProperty.call(props, QBackRefs) ? props[QBackRefs] : void 0;
|
|
29491
|
+
}
|
|
29398
29492
|
var SerializationWeakRef = class {
|
|
29399
29493
|
constructor($obj$) {
|
|
29400
29494
|
this.$obj$ = $obj$;
|
|
@@ -29409,26 +29503,41 @@ var SerializationBackRef = class {
|
|
|
29409
29503
|
this.$path$ = $path$;
|
|
29410
29504
|
}
|
|
29411
29505
|
};
|
|
29412
|
-
var
|
|
29413
|
-
|
|
29414
|
-
|
|
29415
|
-
|
|
29416
|
-
|
|
29417
|
-
|
|
29418
|
-
|
|
29419
|
-
|
|
29420
|
-
|
|
29421
|
-
|
|
29422
|
-
|
|
29423
|
-
|
|
29424
|
-
|
|
29425
|
-
|
|
29426
|
-
|
|
29506
|
+
var SerializationContextImpl = class {
|
|
29507
|
+
constructor(NodeConstructor, DomRefConstructor, $symbolToChunkResolver$, $setProp$, $storeProxyMap$, $writer$) {
|
|
29508
|
+
this.NodeConstructor = NodeConstructor;
|
|
29509
|
+
this.DomRefConstructor = DomRefConstructor;
|
|
29510
|
+
this.$symbolToChunkResolver$ = $symbolToChunkResolver$;
|
|
29511
|
+
this.$setProp$ = $setProp$;
|
|
29512
|
+
this.$storeProxyMap$ = $storeProxyMap$;
|
|
29513
|
+
this.$writer$ = $writer$;
|
|
29514
|
+
__publicField(this, "$seenObjsMap$", /* @__PURE__ */ new Map());
|
|
29515
|
+
__publicField(this, "$syncFnMap$", /* @__PURE__ */ new Map());
|
|
29516
|
+
__publicField(this, "$syncFns$", []);
|
|
29517
|
+
__publicField(this, "$roots$", []);
|
|
29518
|
+
__publicField(this, "$eagerResume$", /* @__PURE__ */ new Set());
|
|
29519
|
+
__publicField(this, "$eventQrls$", /* @__PURE__ */ new Set());
|
|
29520
|
+
__publicField(this, "$eventNames$", /* @__PURE__ */ new Set());
|
|
29521
|
+
__publicField(this, "$renderSymbols$", /* @__PURE__ */ new Set());
|
|
29522
|
+
__publicField(this, "$serializer$");
|
|
29523
|
+
this.$serializer$ = new Serializer(this);
|
|
29524
|
+
}
|
|
29525
|
+
async $serialize$() {
|
|
29526
|
+
return await this.$serializer$.serialize();
|
|
29527
|
+
}
|
|
29528
|
+
getSeenRef(obj) {
|
|
29529
|
+
return this.$seenObjsMap$.get(obj);
|
|
29530
|
+
}
|
|
29531
|
+
$markSeen$(obj, parent, index) {
|
|
29427
29532
|
const ref = { $index$: index, $parent$: parent };
|
|
29428
|
-
seenObjsMap
|
|
29533
|
+
this.$seenObjsMap$.set(obj, ref);
|
|
29429
29534
|
return ref;
|
|
29430
|
-
}
|
|
29431
|
-
|
|
29535
|
+
}
|
|
29536
|
+
/**
|
|
29537
|
+
* Returns a path string representing the path from roots through all parents to the object.
|
|
29538
|
+
* Format: "3 2 0" where each number is the index within its parent, from root to leaf.
|
|
29539
|
+
*/
|
|
29540
|
+
$getObjectPath$(ref) {
|
|
29432
29541
|
const path = [];
|
|
29433
29542
|
while (ref.$parent$) {
|
|
29434
29543
|
path.unshift(ref.$index$);
|
|
@@ -29436,86 +29545,85 @@ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToCh
|
|
|
29436
29545
|
}
|
|
29437
29546
|
path.unshift(ref.$index$);
|
|
29438
29547
|
return path.join(" ");
|
|
29439
|
-
}
|
|
29440
|
-
|
|
29441
|
-
const path =
|
|
29548
|
+
}
|
|
29549
|
+
$promoteToRoot$(ref, index) {
|
|
29550
|
+
const path = this.$getObjectPath$(ref);
|
|
29442
29551
|
if (index === void 0) {
|
|
29443
|
-
index = roots
|
|
29552
|
+
index = this.$roots$.length;
|
|
29444
29553
|
}
|
|
29445
|
-
roots[index] = new SerializationBackRef(path);
|
|
29554
|
+
this.$roots$[index] = new SerializationBackRef(path);
|
|
29446
29555
|
ref.$parent$ = null;
|
|
29447
29556
|
ref.$index$ = index;
|
|
29448
|
-
}
|
|
29449
|
-
|
|
29450
|
-
let seen = seenObjsMap
|
|
29557
|
+
}
|
|
29558
|
+
$addRoot$(obj, returnRef = false) {
|
|
29559
|
+
let seen = this.$seenObjsMap$.get(obj);
|
|
29451
29560
|
let index;
|
|
29452
29561
|
if (!seen) {
|
|
29453
|
-
index = roots
|
|
29562
|
+
index = this.$roots$.length;
|
|
29454
29563
|
seen = {
|
|
29455
29564
|
$index$: index
|
|
29456
29565
|
// TODO benchmark with and without $parent$
|
|
29457
29566
|
// $parent$: undefined
|
|
29458
29567
|
};
|
|
29459
|
-
seenObjsMap
|
|
29460
|
-
roots
|
|
29568
|
+
this.$seenObjsMap$.set(obj, seen);
|
|
29569
|
+
this.$roots$.push(obj);
|
|
29461
29570
|
} else {
|
|
29462
29571
|
if (seen.$parent$) {
|
|
29463
|
-
|
|
29572
|
+
this.$promoteToRoot$(seen);
|
|
29464
29573
|
}
|
|
29465
29574
|
index = seen.$index$;
|
|
29466
29575
|
}
|
|
29467
29576
|
return returnRef ? seen : index;
|
|
29468
|
-
}
|
|
29469
|
-
|
|
29470
|
-
|
|
29471
|
-
|
|
29472
|
-
|
|
29473
|
-
|
|
29474
|
-
|
|
29475
|
-
|
|
29476
|
-
|
|
29477
|
-
$
|
|
29478
|
-
|
|
29479
|
-
|
|
29480
|
-
|
|
29481
|
-
|
|
29482
|
-
|
|
29483
|
-
|
|
29484
|
-
|
|
29485
|
-
|
|
29486
|
-
|
|
29487
|
-
|
|
29488
|
-
$addSyncFn$: (funcStr, argCount, fn) => {
|
|
29489
|
-
const isFullFn = funcStr == null;
|
|
29577
|
+
}
|
|
29578
|
+
$isSsrNode$(obj) {
|
|
29579
|
+
return this.NodeConstructor ? obj instanceof this.NodeConstructor : false;
|
|
29580
|
+
}
|
|
29581
|
+
$isDomRef$(obj) {
|
|
29582
|
+
return this.DomRefConstructor ? obj instanceof this.DomRefConstructor : false;
|
|
29583
|
+
}
|
|
29584
|
+
$hasRootId$(obj) {
|
|
29585
|
+
const id = this.$seenObjsMap$.get(obj);
|
|
29586
|
+
return id && (id.$parent$ ? void 0 : id.$index$);
|
|
29587
|
+
}
|
|
29588
|
+
$addSyncFn$(funcStr, argCount, fn) {
|
|
29589
|
+
const isFullFn = funcStr == null;
|
|
29590
|
+
if (isFullFn) {
|
|
29591
|
+
funcStr = fn.serialized || fn.toString();
|
|
29592
|
+
}
|
|
29593
|
+
let id = this.$syncFnMap$.get(funcStr);
|
|
29594
|
+
if (id === void 0) {
|
|
29595
|
+
id = this.$syncFns$.length;
|
|
29596
|
+
this.$syncFnMap$.set(funcStr, id);
|
|
29490
29597
|
if (isFullFn) {
|
|
29491
|
-
funcStr
|
|
29492
|
-
}
|
|
29493
|
-
|
|
29494
|
-
|
|
29495
|
-
|
|
29496
|
-
syncFnMap.set(funcStr, id);
|
|
29497
|
-
if (isFullFn) {
|
|
29498
|
-
syncFns.push(funcStr);
|
|
29499
|
-
} else {
|
|
29500
|
-
let code2 = "(";
|
|
29501
|
-
for (let i = 0; i < argCount; i++) {
|
|
29502
|
-
code2 += (i == 0 ? "p" : ",p") + i;
|
|
29503
|
-
}
|
|
29504
|
-
syncFns.push(code2 += ")=>" + funcStr);
|
|
29598
|
+
this.$syncFns$.push(funcStr);
|
|
29599
|
+
} else {
|
|
29600
|
+
let code2 = "(";
|
|
29601
|
+
for (let i = 0; i < argCount; i++) {
|
|
29602
|
+
code2 += (i == 0 ? "p" : ",p") + i;
|
|
29505
29603
|
}
|
|
29604
|
+
this.$syncFns$.push(code2 += ")=>" + funcStr);
|
|
29506
29605
|
}
|
|
29507
|
-
|
|
29508
|
-
|
|
29509
|
-
|
|
29510
|
-
|
|
29511
|
-
|
|
29512
|
-
|
|
29513
|
-
|
|
29514
|
-
|
|
29515
|
-
|
|
29516
|
-
|
|
29517
|
-
|
|
29518
|
-
}
|
|
29606
|
+
}
|
|
29607
|
+
return id;
|
|
29608
|
+
}
|
|
29609
|
+
};
|
|
29610
|
+
var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToChunkResolver, setProp, storeProxyMap, writer) => {
|
|
29611
|
+
if (!writer) {
|
|
29612
|
+
const buffer = [];
|
|
29613
|
+
writer = {
|
|
29614
|
+
write: (text) => buffer.push(text),
|
|
29615
|
+
toString: () => buffer.join("")
|
|
29616
|
+
};
|
|
29617
|
+
}
|
|
29618
|
+
isDomRef = DomRefConstructor ? (obj) => obj instanceof DomRefConstructor : (() => false);
|
|
29619
|
+
return new SerializationContextImpl(
|
|
29620
|
+
NodeConstructor,
|
|
29621
|
+
DomRefConstructor,
|
|
29622
|
+
symbolToChunkResolver,
|
|
29623
|
+
setProp,
|
|
29624
|
+
storeProxyMap,
|
|
29625
|
+
writer
|
|
29626
|
+
);
|
|
29519
29627
|
};
|
|
29520
29628
|
|
|
29521
29629
|
// packages/qwik/src/core/shared/shared-container.ts
|
|
@@ -29550,7 +29658,6 @@ var _SharedContainer = class {
|
|
|
29550
29658
|
NodeConstructor,
|
|
29551
29659
|
DomRefConstructor,
|
|
29552
29660
|
symbolToChunkResolver,
|
|
29553
|
-
this.getHostProp.bind(this),
|
|
29554
29661
|
this.setHostProp.bind(this),
|
|
29555
29662
|
this.$storeProxyMap$,
|
|
29556
29663
|
writer
|
|
@@ -29772,19 +29879,20 @@ var inflate = (container, target, typeId, data) => {
|
|
|
29772
29879
|
asyncSignal.$loadingEffects$ = new Set(d2[3]);
|
|
29773
29880
|
asyncSignal.$errorEffects$ = new Set(d2[4]);
|
|
29774
29881
|
asyncSignal.$untrackedError$ = d2[5];
|
|
29775
|
-
|
|
29776
|
-
if (
|
|
29777
|
-
asyncSignal.$
|
|
29882
|
+
asyncSignal.$flags$ = d2[6] ?? 0;
|
|
29883
|
+
if (asyncSignal.$flags$ & 64 /* CLIENT_ONLY */) {
|
|
29884
|
+
asyncSignal.$untrackedLoading$ = true;
|
|
29778
29885
|
}
|
|
29779
|
-
|
|
29780
|
-
|
|
29886
|
+
const hasValue = d2.length > 7;
|
|
29887
|
+
if (hasValue) {
|
|
29888
|
+
asyncSignal.$untrackedValue$ = d2[7];
|
|
29781
29889
|
}
|
|
29782
|
-
asyncSignal
|
|
29783
|
-
|
|
29784
|
-
asyncSignal.$timeoutMs$ = d2[9] ?? 0;
|
|
29785
|
-
if (d2[10]) {
|
|
29786
|
-
asyncSignal.$flags$ |= 32 /* EAGER_CLEANUP */;
|
|
29890
|
+
if (asyncSignal.$untrackedValue$ === NEEDS_COMPUTATION) {
|
|
29891
|
+
asyncSignal.$flags$ |= 1 /* INVALID */;
|
|
29787
29892
|
}
|
|
29893
|
+
asyncSignal.interval = d2[8] ?? 0;
|
|
29894
|
+
asyncSignal.$concurrency$ = d2[9] ?? 1;
|
|
29895
|
+
asyncSignal.$timeoutMs$ = d2[10] ?? 0;
|
|
29788
29896
|
break;
|
|
29789
29897
|
}
|
|
29790
29898
|
// Inflating a SerializerSignal is the same as inflating a ComputedSignal
|
|
@@ -30010,7 +30118,7 @@ var makeResolveFunction = (qrl, symbolFn) => {
|
|
|
30010
30118
|
}
|
|
30011
30119
|
}
|
|
30012
30120
|
if (qrl.$chunk$ === "") {
|
|
30013
|
-
|
|
30121
|
+
isDev18 && assertDefined(qrl.$container$, "Sync QRL must have container element");
|
|
30014
30122
|
const hash3 = qrl.$container$.$instanceHash$;
|
|
30015
30123
|
const doc2 = qrl.$container$.element?.ownerDocument || document;
|
|
30016
30124
|
const qFuncs2 = getQFuncs(doc2, hash3);
|
|
@@ -30114,8 +30222,8 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, captures) => {
|
|
|
30114
30222
|
})
|
|
30115
30223
|
);
|
|
30116
30224
|
}
|
|
30117
|
-
if (isBrowser2 &&
|
|
30118
|
-
preload(
|
|
30225
|
+
if (isBrowser2 && chunk) {
|
|
30226
|
+
preload(chunk, 0.8);
|
|
30119
30227
|
}
|
|
30120
30228
|
return qrl;
|
|
30121
30229
|
};
|
|
@@ -30484,7 +30592,6 @@ function processVNodeData(document2) {
|
|
|
30484
30592
|
const getNodeType = getter(prototype, "nodeType");
|
|
30485
30593
|
const attachVnodeDataAndRefs = (element) => {
|
|
30486
30594
|
Array.from(element.querySelectorAll('script[type="qwik/vnode"]')).forEach((script2) => {
|
|
30487
|
-
script2.setAttribute("type", "x-qwik/vnode");
|
|
30488
30595
|
const qContainerElement = script2.closest("[q\\:container]");
|
|
30489
30596
|
qContainerElement.qVnodeData = script2.textContent;
|
|
30490
30597
|
qContainerElement.qVNodeRefs = /* @__PURE__ */ new Map();
|
|
@@ -30783,9 +30890,14 @@ var DomContainer = class extends _SharedContainer {
|
|
|
30783
30890
|
$hoistStyles$() {
|
|
30784
30891
|
const document2 = this.element.ownerDocument;
|
|
30785
30892
|
const head = document2.head;
|
|
30786
|
-
const styles = document2.querySelectorAll(QStylesAllSelector);
|
|
30787
|
-
|
|
30788
|
-
|
|
30893
|
+
const styles = document2.body.querySelectorAll(QStylesAllSelector);
|
|
30894
|
+
const styleTagCount = styles.length;
|
|
30895
|
+
if (styleTagCount) {
|
|
30896
|
+
const fragment = document2.createDocumentFragment();
|
|
30897
|
+
for (let i = 0; i < styleTagCount; i++) {
|
|
30898
|
+
fragment.appendChild(styles[i]);
|
|
30899
|
+
}
|
|
30900
|
+
head.appendChild(fragment);
|
|
30789
30901
|
}
|
|
30790
30902
|
}
|
|
30791
30903
|
$setRawState$(id, vParent) {
|
|
@@ -30904,7 +31016,7 @@ var DomContainer = class extends _SharedContainer {
|
|
|
30904
31016
|
}
|
|
30905
31017
|
getSyncFn(id) {
|
|
30906
31018
|
const fn = this.$qFuncs$[id];
|
|
30907
|
-
|
|
31019
|
+
isDev19 && assertTrue(typeof fn === "function", "Invalid reference: " + id);
|
|
30908
31020
|
return fn;
|
|
30909
31021
|
}
|
|
30910
31022
|
$appendStyle$(content, styleId, host, scoped) {
|
|
@@ -30946,6 +31058,278 @@ var DomContainer = class extends _SharedContainer {
|
|
|
30946
31058
|
}
|
|
30947
31059
|
};
|
|
30948
31060
|
|
|
31061
|
+
// packages/qwik/src/core/preloader/queue.ts
|
|
31062
|
+
import { isBrowser as isBrowser4 } from "@qwik.dev/core/build";
|
|
31063
|
+
|
|
31064
|
+
// packages/qwik/src/core/preloader/constants.ts
|
|
31065
|
+
import { isBrowser as isBrowser3 } from "@qwik.dev/core/build";
|
|
31066
|
+
var doc = isBrowser3 ? document : void 0;
|
|
31067
|
+
var config = {
|
|
31068
|
+
$DEBUG$: false,
|
|
31069
|
+
$maxIdlePreloads$: 25,
|
|
31070
|
+
$invPreloadProbability$: 0.65
|
|
31071
|
+
};
|
|
31072
|
+
var rel = isBrowser3 && doc.createElement("link").relList.supports("modulepreload") ? "modulePreload" : "preload";
|
|
31073
|
+
var loadStart = Date.now();
|
|
31074
|
+
var isJSRegex = /\.[mc]?js$/;
|
|
31075
|
+
|
|
31076
|
+
// packages/qwik/src/core/preloader/types.ts
|
|
31077
|
+
var BundleImportState_None = 0;
|
|
31078
|
+
var BundleImportState_Queued = 1;
|
|
31079
|
+
var BundleImportState_Preload = 2;
|
|
31080
|
+
var BundleImportState_Alias = 3;
|
|
31081
|
+
var BundleImportState_Loaded = 4;
|
|
31082
|
+
|
|
31083
|
+
// packages/qwik/src/core/preloader/bundle-graph.ts
|
|
31084
|
+
var base;
|
|
31085
|
+
var graph;
|
|
31086
|
+
var makeBundle = (name, deps) => {
|
|
31087
|
+
return {
|
|
31088
|
+
$name$: name,
|
|
31089
|
+
$state$: isJSRegex.test(name) ? BundleImportState_None : BundleImportState_Alias,
|
|
31090
|
+
$deps$: shouldResetFactor ? deps?.map((d) => ({ ...d, $factor$: 1 })) : deps,
|
|
31091
|
+
$inverseProbability$: 1,
|
|
31092
|
+
$createdTs$: Date.now(),
|
|
31093
|
+
$waitedMs$: 0,
|
|
31094
|
+
$loadedMs$: 0
|
|
31095
|
+
};
|
|
31096
|
+
};
|
|
31097
|
+
var parseBundleGraph = (serialized) => {
|
|
31098
|
+
const graph2 = /* @__PURE__ */ new Map();
|
|
31099
|
+
let i = 0;
|
|
31100
|
+
while (i < serialized.length) {
|
|
31101
|
+
const name = serialized[i++];
|
|
31102
|
+
const deps = [];
|
|
31103
|
+
let idx;
|
|
31104
|
+
let probability = 1;
|
|
31105
|
+
while (idx = serialized[i], typeof idx === "number") {
|
|
31106
|
+
if (idx < 0) {
|
|
31107
|
+
probability = -idx / 10;
|
|
31108
|
+
} else {
|
|
31109
|
+
deps.push({
|
|
31110
|
+
$name$: serialized[idx],
|
|
31111
|
+
$importProbability$: probability,
|
|
31112
|
+
$factor$: 1
|
|
31113
|
+
});
|
|
31114
|
+
}
|
|
31115
|
+
i++;
|
|
31116
|
+
}
|
|
31117
|
+
graph2.set(name, deps);
|
|
31118
|
+
}
|
|
31119
|
+
return graph2;
|
|
31120
|
+
};
|
|
31121
|
+
var getBundle = (name) => {
|
|
31122
|
+
let bundle = bundles.get(name);
|
|
31123
|
+
if (!bundle) {
|
|
31124
|
+
let deps;
|
|
31125
|
+
if (graph) {
|
|
31126
|
+
deps = graph.get(name);
|
|
31127
|
+
if (!deps) {
|
|
31128
|
+
return;
|
|
31129
|
+
}
|
|
31130
|
+
if (!deps.length) {
|
|
31131
|
+
deps = void 0;
|
|
31132
|
+
}
|
|
31133
|
+
}
|
|
31134
|
+
bundle = makeBundle(name, deps);
|
|
31135
|
+
bundles.set(name, bundle);
|
|
31136
|
+
}
|
|
31137
|
+
return bundle;
|
|
31138
|
+
};
|
|
31139
|
+
var initPreloader = (serializedBundleGraph, opts) => {
|
|
31140
|
+
if (opts) {
|
|
31141
|
+
if ("debug" in opts) {
|
|
31142
|
+
config.$DEBUG$ = !!opts.debug;
|
|
31143
|
+
}
|
|
31144
|
+
if (typeof opts.preloadProbability === "number") {
|
|
31145
|
+
config.$invPreloadProbability$ = 1 - opts.preloadProbability;
|
|
31146
|
+
}
|
|
31147
|
+
}
|
|
31148
|
+
if (base != null || !serializedBundleGraph) {
|
|
31149
|
+
return;
|
|
31150
|
+
}
|
|
31151
|
+
base = "";
|
|
31152
|
+
graph = parseBundleGraph(serializedBundleGraph);
|
|
31153
|
+
};
|
|
31154
|
+
|
|
31155
|
+
// packages/qwik/src/core/preloader/queue.ts
|
|
31156
|
+
var bundles = /* @__PURE__ */ new Map();
|
|
31157
|
+
var shouldResetFactor;
|
|
31158
|
+
var queueDirty;
|
|
31159
|
+
var preloadCount = 0;
|
|
31160
|
+
var queue = [];
|
|
31161
|
+
var log5 = (...args) => {
|
|
31162
|
+
console.log(
|
|
31163
|
+
`Preloader ${Date.now() - loadStart}ms ${preloadCount}/${queue.length} queued>`,
|
|
31164
|
+
...args
|
|
31165
|
+
);
|
|
31166
|
+
};
|
|
31167
|
+
var resetQueue = () => {
|
|
31168
|
+
bundles.clear();
|
|
31169
|
+
queueDirty = false;
|
|
31170
|
+
shouldResetFactor = true;
|
|
31171
|
+
preloadCount = 0;
|
|
31172
|
+
queue.length = 0;
|
|
31173
|
+
};
|
|
31174
|
+
var sortQueue = () => {
|
|
31175
|
+
if (queueDirty) {
|
|
31176
|
+
queue.sort((a, b) => a.$inverseProbability$ - b.$inverseProbability$);
|
|
31177
|
+
queueDirty = false;
|
|
31178
|
+
}
|
|
31179
|
+
};
|
|
31180
|
+
var getQueue = () => {
|
|
31181
|
+
sortQueue();
|
|
31182
|
+
let probability = 0.4;
|
|
31183
|
+
const result2 = [];
|
|
31184
|
+
for (const b of queue) {
|
|
31185
|
+
const nextProbability = Math.round((1 - b.$inverseProbability$) * 10);
|
|
31186
|
+
if (nextProbability !== probability) {
|
|
31187
|
+
probability = nextProbability;
|
|
31188
|
+
result2.push(probability);
|
|
31189
|
+
}
|
|
31190
|
+
result2.push(b.$name$);
|
|
31191
|
+
}
|
|
31192
|
+
return result2;
|
|
31193
|
+
};
|
|
31194
|
+
var trigger = () => {
|
|
31195
|
+
if (!queue.length) {
|
|
31196
|
+
return;
|
|
31197
|
+
}
|
|
31198
|
+
sortQueue();
|
|
31199
|
+
while (queue.length) {
|
|
31200
|
+
const bundle = queue[0];
|
|
31201
|
+
const inverseProbability = bundle.$inverseProbability$;
|
|
31202
|
+
const probability = 1 - inverseProbability;
|
|
31203
|
+
const allowedPreloads = graph ? config.$maxIdlePreloads$ : (
|
|
31204
|
+
// While the graph is not available, we limit to 5 preloads
|
|
31205
|
+
5
|
|
31206
|
+
);
|
|
31207
|
+
if (probability >= 0.99 || preloadCount < allowedPreloads) {
|
|
31208
|
+
queue.shift();
|
|
31209
|
+
preloadOne(bundle);
|
|
31210
|
+
} else {
|
|
31211
|
+
break;
|
|
31212
|
+
}
|
|
31213
|
+
}
|
|
31214
|
+
if (config.$DEBUG$ && !queue.length) {
|
|
31215
|
+
const loaded = [...bundles.values()].filter((b) => b.$state$ > BundleImportState_None);
|
|
31216
|
+
const waitTime = loaded.reduce((acc, b) => acc + b.$waitedMs$, 0);
|
|
31217
|
+
const loadTime = loaded.reduce((acc, b) => acc + b.$loadedMs$, 0);
|
|
31218
|
+
log5(
|
|
31219
|
+
`>>>> done ${loaded.length}/${bundles.size} total: ${waitTime}ms waited, ${loadTime}ms loaded`
|
|
31220
|
+
);
|
|
31221
|
+
}
|
|
31222
|
+
};
|
|
31223
|
+
var preloadOne = (bundle) => {
|
|
31224
|
+
if (bundle.$state$ >= BundleImportState_Preload) {
|
|
31225
|
+
return;
|
|
31226
|
+
}
|
|
31227
|
+
preloadCount++;
|
|
31228
|
+
const start = Date.now();
|
|
31229
|
+
bundle.$waitedMs$ = start - bundle.$createdTs$;
|
|
31230
|
+
bundle.$state$ = BundleImportState_Preload;
|
|
31231
|
+
config.$DEBUG$ && log5(
|
|
31232
|
+
`<< load ${Math.round((1 - bundle.$inverseProbability$) * 100)}% after ${`${bundle.$waitedMs$}ms`}`,
|
|
31233
|
+
bundle.$name$
|
|
31234
|
+
);
|
|
31235
|
+
const link = doc.createElement("link");
|
|
31236
|
+
link.href = new URL(`${base}${bundle.$name$}`, doc.baseURI).toString();
|
|
31237
|
+
link.rel = rel;
|
|
31238
|
+
link.as = "script";
|
|
31239
|
+
link.onload = link.onerror = () => {
|
|
31240
|
+
preloadCount--;
|
|
31241
|
+
const end = Date.now();
|
|
31242
|
+
bundle.$loadedMs$ = end - start;
|
|
31243
|
+
bundle.$state$ = BundleImportState_Loaded;
|
|
31244
|
+
config.$DEBUG$ && log5(`>> done after ${bundle.$loadedMs$}ms`, bundle.$name$);
|
|
31245
|
+
link.remove();
|
|
31246
|
+
trigger();
|
|
31247
|
+
};
|
|
31248
|
+
doc.head.appendChild(link);
|
|
31249
|
+
};
|
|
31250
|
+
var adjustProbabilities = (bundle, newInverseProbability, seen) => {
|
|
31251
|
+
if (seen?.has(bundle)) {
|
|
31252
|
+
return;
|
|
31253
|
+
}
|
|
31254
|
+
const previousInverseProbability = bundle.$inverseProbability$;
|
|
31255
|
+
bundle.$inverseProbability$ = newInverseProbability;
|
|
31256
|
+
if (previousInverseProbability - bundle.$inverseProbability$ < 0.01) {
|
|
31257
|
+
return;
|
|
31258
|
+
}
|
|
31259
|
+
if (
|
|
31260
|
+
// don't queue until we have initialized the preloader
|
|
31261
|
+
base != null && bundle.$state$ < BundleImportState_Preload
|
|
31262
|
+
) {
|
|
31263
|
+
if (bundle.$state$ === BundleImportState_None) {
|
|
31264
|
+
bundle.$state$ = BundleImportState_Queued;
|
|
31265
|
+
queue.push(bundle);
|
|
31266
|
+
config.$DEBUG$ && log5(`queued ${Math.round((1 - bundle.$inverseProbability$) * 100)}%`, bundle.$name$);
|
|
31267
|
+
}
|
|
31268
|
+
queueDirty = true;
|
|
31269
|
+
}
|
|
31270
|
+
if (bundle.$deps$) {
|
|
31271
|
+
seen || (seen = /* @__PURE__ */ new Set());
|
|
31272
|
+
seen.add(bundle);
|
|
31273
|
+
const probability = 1 - bundle.$inverseProbability$;
|
|
31274
|
+
for (const dep of bundle.$deps$) {
|
|
31275
|
+
const depBundle = getBundle(dep.$name$);
|
|
31276
|
+
if (depBundle.$inverseProbability$ === 0) {
|
|
31277
|
+
continue;
|
|
31278
|
+
}
|
|
31279
|
+
let newInverseProbability2;
|
|
31280
|
+
if (probability === 1 || probability >= 0.99 && depsCount < 100) {
|
|
31281
|
+
depsCount++;
|
|
31282
|
+
newInverseProbability2 = Math.min(0.01, 1 - dep.$importProbability$);
|
|
31283
|
+
} else {
|
|
31284
|
+
const newInverseImportProbability = 1 - dep.$importProbability$ * probability;
|
|
31285
|
+
const prevAdjust = dep.$factor$;
|
|
31286
|
+
const factor = newInverseImportProbability / prevAdjust;
|
|
31287
|
+
newInverseProbability2 = Math.max(0.02, depBundle.$inverseProbability$ * factor);
|
|
31288
|
+
dep.$factor$ = factor;
|
|
31289
|
+
}
|
|
31290
|
+
adjustProbabilities(depBundle, newInverseProbability2, seen);
|
|
31291
|
+
}
|
|
31292
|
+
}
|
|
31293
|
+
};
|
|
31294
|
+
var handleBundle = (name, inverseProbability) => {
|
|
31295
|
+
const bundle = getBundle(name);
|
|
31296
|
+
if (bundle && bundle.$inverseProbability$ > inverseProbability) {
|
|
31297
|
+
adjustProbabilities(bundle, inverseProbability);
|
|
31298
|
+
}
|
|
31299
|
+
};
|
|
31300
|
+
var depsCount;
|
|
31301
|
+
var preload2 = (name, probability) => {
|
|
31302
|
+
if (!name?.length) {
|
|
31303
|
+
return;
|
|
31304
|
+
}
|
|
31305
|
+
depsCount = 0;
|
|
31306
|
+
let inverseProbability = probability ? 1 - probability : 0.4;
|
|
31307
|
+
if (Array.isArray(name)) {
|
|
31308
|
+
for (let i = name.length - 1; i >= 0; i--) {
|
|
31309
|
+
const item = name[i];
|
|
31310
|
+
if (typeof item === "number") {
|
|
31311
|
+
inverseProbability = 1 - item / 10;
|
|
31312
|
+
} else {
|
|
31313
|
+
handleBundle(item, inverseProbability);
|
|
31314
|
+
}
|
|
31315
|
+
}
|
|
31316
|
+
} else {
|
|
31317
|
+
handleBundle(name, inverseProbability);
|
|
31318
|
+
}
|
|
31319
|
+
if (isBrowser4) {
|
|
31320
|
+
trigger();
|
|
31321
|
+
}
|
|
31322
|
+
};
|
|
31323
|
+
if (isBrowser4) {
|
|
31324
|
+
document.addEventListener("qsymbol", (ev) => {
|
|
31325
|
+
const { symbol, href } = ev.detail;
|
|
31326
|
+
if (href) {
|
|
31327
|
+
const hash3 = symbol.slice(symbol.lastIndexOf("_") + 1);
|
|
31328
|
+
preload2(hash3, 1);
|
|
31329
|
+
}
|
|
31330
|
+
});
|
|
31331
|
+
}
|
|
31332
|
+
|
|
30949
31333
|
// packages/qwik/src/core/use/use-locale.ts
|
|
30950
31334
|
import { isServer as isServer9 } from "@qwik.dev/core/build";
|
|
30951
31335
|
var _locale = void 0;
|
|
@@ -30966,14 +31350,7 @@ function setLocale(locale) {
|
|
|
30966
31350
|
|
|
30967
31351
|
// packages/qwik/src/core/index.ts
|
|
30968
31352
|
if (globalThis.__qwik) {
|
|
30969
|
-
|
|
30970
|
-
`==============================================
|
|
30971
|
-
Qwik version ${globalThis.__qwik} already imported while importing ${version}.
|
|
30972
|
-
This can lead to issues due to duplicated shared structures.
|
|
30973
|
-
Verify that the Qwik libraries you're using are in "resolve.noExternal[]" and in "optimizeDeps.exclude".
|
|
30974
|
-
==============================================
|
|
30975
|
-
`
|
|
30976
|
-
);
|
|
31353
|
+
qError(30 /* duplicateQwik */, [globalThis.__qwik, version]);
|
|
30977
31354
|
}
|
|
30978
31355
|
globalThis.__qwik = version;
|
|
30979
31356
|
if (import.meta.hot) {
|
|
@@ -30992,8 +31369,8 @@ var useInvokeContext = () => {
|
|
|
30992
31369
|
if (!ctx || ctx.$event$ !== RenderEvent) {
|
|
30993
31370
|
throw qError(10 /* useInvokeContext */);
|
|
30994
31371
|
}
|
|
30995
|
-
|
|
30996
|
-
|
|
31372
|
+
isDev20 && assertDefined(ctx.$hostElement$, `invoke: $hostElement$ must be defined`, ctx);
|
|
31373
|
+
isDev20 && assertDefined(ctx.$effectSubscriber$, `invoke: $effectSubscriber$ must be defined`, ctx);
|
|
30997
31374
|
return ctx;
|
|
30998
31375
|
};
|
|
30999
31376
|
function invoke(context, fn, ...args) {
|
|
@@ -31081,9 +31458,9 @@ var trackSignalAndAssignHost = (value, host, property, container, data) => {
|
|
|
31081
31458
|
};
|
|
31082
31459
|
|
|
31083
31460
|
// packages/qwik/src/core/reactive-primitives/impl/store.ts
|
|
31084
|
-
import { isDev as
|
|
31461
|
+
import { isDev as isDev21, isServer as isServer10 } from "@qwik.dev/core/build";
|
|
31085
31462
|
var DEBUG7 = false;
|
|
31086
|
-
var
|
|
31463
|
+
var log6 = (...args) => console.log("STORE", ...args.map(qwikDebugToString));
|
|
31087
31464
|
var getStoreHandler = (value) => {
|
|
31088
31465
|
return value[STORE_HANDLER];
|
|
31089
31466
|
};
|
|
@@ -31142,7 +31519,7 @@ var StoreHandler2 = class {
|
|
|
31142
31519
|
}
|
|
31143
31520
|
this.$container$ = ctx.$container$;
|
|
31144
31521
|
} else {
|
|
31145
|
-
|
|
31522
|
+
isDev21 && assertTrue(
|
|
31146
31523
|
!ctx.$container$ || ctx.$container$ === this.$container$,
|
|
31147
31524
|
"Do not use signals across containers"
|
|
31148
31525
|
);
|
|
@@ -31176,11 +31553,11 @@ var StoreHandler2 = class {
|
|
|
31176
31553
|
if (prop in target) {
|
|
31177
31554
|
const oldValue = target[prop];
|
|
31178
31555
|
if (newValue !== oldValue) {
|
|
31179
|
-
DEBUG7 &&
|
|
31556
|
+
DEBUG7 && log6("Store.set", oldValue, "->", newValue, pad("\n" + this.toString(), " "));
|
|
31180
31557
|
setNewValueAndTriggerEffects(prop, newValue, target, this);
|
|
31181
31558
|
}
|
|
31182
31559
|
} else {
|
|
31183
|
-
DEBUG7 &&
|
|
31560
|
+
DEBUG7 && log6("Store.set", "create property", newValue, pad("\n" + this.toString(), " "));
|
|
31184
31561
|
setNewValueAndTriggerEffects(prop, newValue, target, this);
|
|
31185
31562
|
}
|
|
31186
31563
|
return true;
|
|
@@ -31246,7 +31623,7 @@ function addStoreEffect(target, prop, store, effectSubscription) {
|
|
|
31246
31623
|
ensureContainsSubscription(effects, effectSubscription);
|
|
31247
31624
|
ensureContainsBackRef(effectSubscription, target);
|
|
31248
31625
|
(import.meta.env.TEST ? !isDomContainer(store.$container$) : isServer10) && addQrlToSerializationCtx(effectSubscription, store.$container$);
|
|
31249
|
-
DEBUG7 &&
|
|
31626
|
+
DEBUG7 && log6(
|
|
31250
31627
|
"sub",
|
|
31251
31628
|
pad(
|
|
31252
31629
|
"\n" + [...store.$effects$?.entries() || []].map(([key, value]) => `${String(key)}: ${String(value)}`).join(","),
|
|
@@ -31483,13 +31860,13 @@ function preprocessState(data, container) {
|
|
|
31483
31860
|
}
|
|
31484
31861
|
|
|
31485
31862
|
// packages/qwik/src/core/shared/serdes/serdes.public.ts
|
|
31486
|
-
import { isDev as
|
|
31863
|
+
import { isDev as isDev22 } from "@qwik.dev/core/build";
|
|
31487
31864
|
function getObjectById(id, stateData) {
|
|
31488
31865
|
if (typeof id === "string") {
|
|
31489
31866
|
id = parseInt(id, 10);
|
|
31490
31867
|
return stateData[id];
|
|
31491
31868
|
}
|
|
31492
|
-
|
|
31869
|
+
isDev22 && assertTrue(id < stateData.length, `Invalid reference ${id} >= ${stateData.length}`);
|
|
31493
31870
|
return stateData[id];
|
|
31494
31871
|
}
|
|
31495
31872
|
|
|
@@ -31580,15 +31957,15 @@ var shouldSerialize = (obj) => {
|
|
|
31580
31957
|
return true;
|
|
31581
31958
|
};
|
|
31582
31959
|
var fastSkipSerialize = (obj) => {
|
|
31583
|
-
return !!obj && (isObject(obj) || typeof obj === "function") && (
|
|
31960
|
+
return !!obj && (isObject(obj) || typeof obj === "function") && (noSerializeSet.has(obj) || NoSerializeSymbol in obj);
|
|
31584
31961
|
};
|
|
31585
31962
|
var NoSerializeSymbol = /* @__PURE__ */ Symbol("noSerialize");
|
|
31586
31963
|
var SerializerSymbol = /* @__PURE__ */ Symbol("serialize");
|
|
31587
31964
|
|
|
31588
31965
|
// packages/qwik/src/core/reactive-primitives/utils.ts
|
|
31589
|
-
import { isDev as
|
|
31966
|
+
import { isDev as isDev23, isServer as isServer11 } from "@qwik.dev/core/build";
|
|
31590
31967
|
var DEBUG8 = false;
|
|
31591
|
-
var
|
|
31968
|
+
var log7 = (...args) => console.log("SIGNAL", ...args.map(qwikDebugToString));
|
|
31592
31969
|
var throwIfQRLNotResolved = (qrl) => {
|
|
31593
31970
|
const resolved = qrl.resolved;
|
|
31594
31971
|
if (!resolved) {
|
|
@@ -31627,7 +32004,7 @@ var scheduleEffects = (container, signal, effects) => {
|
|
|
31627
32004
|
const scheduleEffect = (effectSubscription) => {
|
|
31628
32005
|
const consumer = effectSubscription.consumer;
|
|
31629
32006
|
const property = effectSubscription.property;
|
|
31630
|
-
|
|
32007
|
+
isDev23 && assertDefined(container, "Container must be defined.");
|
|
31631
32008
|
if (isTask(consumer)) {
|
|
31632
32009
|
consumer.$flags$ |= 4 /* DIRTY */;
|
|
31633
32010
|
markVNodeDirty(container, consumer.$el$, 1 /* TASKS */);
|
|
@@ -31669,7 +32046,7 @@ var scheduleEffects = (container, signal, effects) => {
|
|
|
31669
32046
|
scheduleEffect(effect);
|
|
31670
32047
|
}
|
|
31671
32048
|
}
|
|
31672
|
-
DEBUG8 &&
|
|
32049
|
+
DEBUG8 && log7("done scheduling");
|
|
31673
32050
|
};
|
|
31674
32051
|
var isSerializerObj = (obj) => {
|
|
31675
32052
|
return isObject(obj) && typeof obj[SerializerSymbol] === "function";
|
|
@@ -31799,7 +32176,7 @@ var fastGetter = (prototype, name) => {
|
|
|
31799
32176
|
|
|
31800
32177
|
// packages/qwik/src/core/client/vnode-utils.ts
|
|
31801
32178
|
var vnode_newElement = (element, elementName, key = null) => {
|
|
31802
|
-
|
|
32179
|
+
isDev24 && assertEqual(fastNodeType(element), 1, "Expecting element node.");
|
|
31803
32180
|
const vnode = new ElementVNode(
|
|
31804
32181
|
key,
|
|
31805
32182
|
1 /* Element */ | 8 /* Inflated */ | -1 << 11 /* shift */,
|
|
@@ -31817,7 +32194,7 @@ var vnode_newElement = (element, elementName, key = null) => {
|
|
|
31817
32194
|
return vnode;
|
|
31818
32195
|
};
|
|
31819
32196
|
var vnode_newUnMaterializedElement = (element) => {
|
|
31820
|
-
|
|
32197
|
+
isDev24 && assertEqual(fastNodeType(element), 1, "Expecting element node.");
|
|
31821
32198
|
const vnode = new ElementVNode(
|
|
31822
32199
|
null,
|
|
31823
32200
|
1 /* Element */ | -1 << 11 /* shift */,
|
|
@@ -31835,7 +32212,7 @@ var vnode_newUnMaterializedElement = (element) => {
|
|
|
31835
32212
|
return vnode;
|
|
31836
32213
|
};
|
|
31837
32214
|
var vnode_newSharedText = (previousTextNode, sharedTextNode, textContent) => {
|
|
31838
|
-
|
|
32215
|
+
isDev24 && sharedTextNode && assertEqual(fastNodeType(sharedTextNode), 3, "Expecting text node.");
|
|
31839
32216
|
const vnode = new TextVNode(
|
|
31840
32217
|
4 /* Text */ | -1 << 11 /* shift */,
|
|
31841
32218
|
// Flag
|
|
@@ -31867,10 +32244,10 @@ var vnode_newText = (textNode, textContent) => {
|
|
|
31867
32244
|
textContent
|
|
31868
32245
|
// Text Content
|
|
31869
32246
|
);
|
|
31870
|
-
|
|
31871
|
-
|
|
31872
|
-
|
|
31873
|
-
|
|
32247
|
+
isDev24 && assertEqual(fastNodeType(textNode), 3, "Expecting text node.");
|
|
32248
|
+
isDev24 && assertFalse(vnode_isElementVNode(vnode), "Incorrect format of TextVNode.");
|
|
32249
|
+
isDev24 && assertTrue(vnode_isTextVNode(vnode), "Incorrect format of TextVNode.");
|
|
32250
|
+
isDev24 && assertFalse(vnode_isVirtualVNode(vnode), "Incorrect format of TextVNode.");
|
|
31874
32251
|
return vnode;
|
|
31875
32252
|
};
|
|
31876
32253
|
var vnode_newVirtual = () => {
|
|
@@ -31885,9 +32262,9 @@ var vnode_newVirtual = () => {
|
|
|
31885
32262
|
null,
|
|
31886
32263
|
null
|
|
31887
32264
|
);
|
|
31888
|
-
|
|
31889
|
-
|
|
31890
|
-
|
|
32265
|
+
isDev24 && assertFalse(vnode_isElementVNode(vnode), "Incorrect format of TextVNode.");
|
|
32266
|
+
isDev24 && assertFalse(vnode_isTextVNode(vnode), "Incorrect format of TextVNode.");
|
|
32267
|
+
isDev24 && assertTrue(vnode_isVirtualVNode(vnode), "Incorrect format of TextVNode.");
|
|
31891
32268
|
return vnode;
|
|
31892
32269
|
};
|
|
31893
32270
|
var vnode_isVNode = (vNode) => {
|
|
@@ -31897,12 +32274,12 @@ var vnode_isElementVNode = (vNode) => {
|
|
|
31897
32274
|
return (vNode.flags & 1 /* Element */) === 1 /* Element */;
|
|
31898
32275
|
};
|
|
31899
32276
|
var vnode_isElementOrTextVNode = (vNode) => {
|
|
31900
|
-
|
|
32277
|
+
isDev24 && assertDefined(vNode, "Missing vNode");
|
|
31901
32278
|
const flag = vNode.flags;
|
|
31902
32279
|
return (flag & 5 /* ELEMENT_OR_TEXT_MASK */) !== 0;
|
|
31903
32280
|
};
|
|
31904
32281
|
var vnode_isMaterialized = (vNode) => {
|
|
31905
|
-
|
|
32282
|
+
isDev24 && assertDefined(vNode, "Missing vNode");
|
|
31906
32283
|
const flag = vNode.flags;
|
|
31907
32284
|
return (flag & 1 /* Element */) === 1 /* Element */ && vNode.firstChild !== void 0 && vNode.lastChild !== void 0;
|
|
31908
32285
|
};
|
|
@@ -31913,26 +32290,26 @@ var vnode_isVirtualVNode = (vNode) => {
|
|
|
31913
32290
|
return (vNode.flags & 2 /* Virtual */) === 2 /* Virtual */;
|
|
31914
32291
|
};
|
|
31915
32292
|
var vnode_isProjection = (vNode) => {
|
|
31916
|
-
|
|
32293
|
+
isDev24 && assertDefined(vNode, "Missing vNode");
|
|
31917
32294
|
const flag = vNode.flags;
|
|
31918
32295
|
return (flag & 2 /* Virtual */) === 2 /* Virtual */ && vnode_getProp(vNode, QSlot, null) !== null;
|
|
31919
32296
|
};
|
|
31920
32297
|
var ensureTextVNode = (vNode) => {
|
|
31921
|
-
|
|
32298
|
+
isDev24 && assertTrue(
|
|
31922
32299
|
vnode_isTextVNode(vNode),
|
|
31923
32300
|
"Expecting TextVNode was: " + vnode_getNodeTypeName(vNode)
|
|
31924
32301
|
);
|
|
31925
32302
|
return vNode;
|
|
31926
32303
|
};
|
|
31927
32304
|
var ensureElementOrVirtualVNode = (vNode) => {
|
|
31928
|
-
|
|
31929
|
-
|
|
32305
|
+
isDev24 && assertDefined(vNode, "Missing vNode");
|
|
32306
|
+
isDev24 && assertTrue(
|
|
31930
32307
|
(vNode.flags & 3 /* ELEMENT_OR_VIRTUAL_MASK */) !== 0,
|
|
31931
32308
|
"Expecting ElementVNode or VirtualVNode was: " + vnode_getNodeTypeName(vNode)
|
|
31932
32309
|
);
|
|
31933
32310
|
};
|
|
31934
32311
|
var ensureElementVNode = (vNode) => {
|
|
31935
|
-
|
|
32312
|
+
isDev24 && assertTrue(
|
|
31936
32313
|
vnode_isElementVNode(vNode),
|
|
31937
32314
|
"Expecting ElementVNode was: " + vnode_getNodeTypeName(vNode)
|
|
31938
32315
|
);
|
|
@@ -32168,7 +32545,7 @@ var vnode_ensureTextInflated = (journal, vnode) => {
|
|
|
32168
32545
|
const flags = textVNode.flags;
|
|
32169
32546
|
if ((flags & 8 /* Inflated */) === 0) {
|
|
32170
32547
|
const parentNode = vnode_getDomParent(vnode, true);
|
|
32171
|
-
|
|
32548
|
+
isDev24 && assertDefined(parentNode, "Missing parent node.");
|
|
32172
32549
|
const sharedTextNode = textVNode.node;
|
|
32173
32550
|
const doc2 = fastOwnerDocument(parentNode);
|
|
32174
32551
|
let vCursor = vnode_getDomSibling(vnode, false, true);
|
|
@@ -32217,7 +32594,7 @@ var vnode_locate = (rootVNode, id) => {
|
|
|
32217
32594
|
let elementOffset = -1;
|
|
32218
32595
|
let refElement;
|
|
32219
32596
|
if (typeof id === "string") {
|
|
32220
|
-
|
|
32597
|
+
isDev24 && assertDefined(qVNodeRefs, "Missing qVNodeRefs.");
|
|
32221
32598
|
elementOffset = parseInt(id);
|
|
32222
32599
|
refElement = qVNodeRefs.get(elementOffset);
|
|
32223
32600
|
} else {
|
|
@@ -32227,9 +32604,9 @@ var vnode_locate = (rootVNode, id) => {
|
|
|
32227
32604
|
return vNode2;
|
|
32228
32605
|
}
|
|
32229
32606
|
}
|
|
32230
|
-
|
|
32607
|
+
isDev24 && assertDefined(refElement, "Missing refElement.");
|
|
32231
32608
|
if (!vnode_isVNode(refElement)) {
|
|
32232
|
-
|
|
32609
|
+
isDev24 && assertTrue(
|
|
32233
32610
|
containerElement2.contains(refElement),
|
|
32234
32611
|
`Couldn't find the element inside the container while locating the VNode.`
|
|
32235
32612
|
);
|
|
@@ -32273,10 +32650,10 @@ var vnode_locate = (rootVNode, id) => {
|
|
|
32273
32650
|
};
|
|
32274
32651
|
var vnode_getChildWithIdx = (vNode, childIdx) => {
|
|
32275
32652
|
let child = vnode_getFirstChild(vNode);
|
|
32276
|
-
|
|
32653
|
+
isDev24 && assertDefined(child, "Missing child.");
|
|
32277
32654
|
while (child.flags >>> 11 /* shift */ !== childIdx) {
|
|
32278
32655
|
child = child.nextSibling;
|
|
32279
|
-
|
|
32656
|
+
isDev24 && assertDefined(child, "Missing child.");
|
|
32280
32657
|
}
|
|
32281
32658
|
return child;
|
|
32282
32659
|
};
|
|
@@ -32284,7 +32661,7 @@ var vNodeStack = [];
|
|
|
32284
32661
|
var vnode_getVNodeForChildNode = (vNode, childElement) => {
|
|
32285
32662
|
ensureElementVNode(vNode);
|
|
32286
32663
|
let child = vnode_getFirstChild(vNode);
|
|
32287
|
-
|
|
32664
|
+
isDev24 && assertDefined(child, "Missing child.");
|
|
32288
32665
|
while (child && (child instanceof ElementVNode ? child.node !== childElement : true)) {
|
|
32289
32666
|
if (vnode_isVirtualVNode(child)) {
|
|
32290
32667
|
const next = child.nextSibling;
|
|
@@ -32303,13 +32680,13 @@ var vnode_getVNodeForChildNode = (vNode, childElement) => {
|
|
|
32303
32680
|
child = next || vNodeStack.pop();
|
|
32304
32681
|
}
|
|
32305
32682
|
}
|
|
32306
|
-
|
|
32683
|
+
isDev24 && assertDefined(child, "Missing child.");
|
|
32307
32684
|
}
|
|
32308
32685
|
while (vNodeStack.length) {
|
|
32309
32686
|
vNodeStack.pop();
|
|
32310
32687
|
}
|
|
32311
32688
|
ensureElementVNode(child);
|
|
32312
|
-
|
|
32689
|
+
isDev24 && assertEqual(child.node, childElement, "Child not found.");
|
|
32313
32690
|
return child;
|
|
32314
32691
|
};
|
|
32315
32692
|
var indexOfAlphanumeric = (id, length) => {
|
|
@@ -32551,7 +32928,7 @@ var vnode_getDomParentVNode = (vnode, includeProjection) => {
|
|
|
32551
32928
|
return vnode;
|
|
32552
32929
|
};
|
|
32553
32930
|
var vnode_remove = (journal, vParent, vToRemove, removeDOM) => {
|
|
32554
|
-
|
|
32931
|
+
isDev24 && assertEqual(vParent, vToRemove.parent, "Parent mismatch.");
|
|
32555
32932
|
if (vnode_isTextVNode(vToRemove)) {
|
|
32556
32933
|
vnode_ensureTextInflated(journal, vToRemove);
|
|
32557
32934
|
}
|
|
@@ -32584,7 +32961,7 @@ var vnode_remove = (journal, vParent, vToRemove, removeDOM) => {
|
|
|
32584
32961
|
vToRemove.nextSibling = null;
|
|
32585
32962
|
};
|
|
32586
32963
|
var vnode_truncate = (journal, vParent, vDelete, removeDOM = true) => {
|
|
32587
|
-
|
|
32964
|
+
isDev24 && assertDefined(vDelete, "Missing vDelete.");
|
|
32588
32965
|
const parent = vnode_getDomParent(vParent, true);
|
|
32589
32966
|
if (parent && removeDOM) {
|
|
32590
32967
|
if (vnode_isElementOrTextVNode(vParent)) {
|
|
@@ -32678,8 +33055,8 @@ var ensureMaterialized = (vnode) => {
|
|
|
32678
33055
|
vFirstChild = vnode_materialize(vParent);
|
|
32679
33056
|
}
|
|
32680
33057
|
}
|
|
32681
|
-
|
|
32682
|
-
|
|
33058
|
+
isDev24 && assertTrue(vParent.firstChild !== void 0, "Did not materialize.");
|
|
33059
|
+
isDev24 && assertTrue(vParent.lastChild !== void 0, "Did not materialize.");
|
|
32683
33060
|
return vFirstChild;
|
|
32684
33061
|
};
|
|
32685
33062
|
var _fastHasAttribute = null;
|
|
@@ -32854,7 +33231,7 @@ var materializeFromDOM = (vParent, firstChild, vData) => {
|
|
|
32854
33231
|
}
|
|
32855
33232
|
const id = consumeValue();
|
|
32856
33233
|
container.$setRawState$(parseInt(id), vParent);
|
|
32857
|
-
|
|
33234
|
+
isDev24 && vnode_setProp(vParent, ELEMENT_ID, id);
|
|
32858
33235
|
} else if (peek() === VNodeDataChar.BACK_REFS) {
|
|
32859
33236
|
if (!container) {
|
|
32860
33237
|
container = getDomContainer(vParent.node);
|
|
@@ -33123,7 +33500,7 @@ function materializeFromVNodeData(vParent, vData, element, child) {
|
|
|
33123
33500
|
}
|
|
33124
33501
|
const id = consumeValue();
|
|
33125
33502
|
container.$setRawState$(parseInt(id), vParent);
|
|
33126
|
-
|
|
33503
|
+
isDev24 && vnode_setProp(vParent, ELEMENT_ID, id);
|
|
33127
33504
|
} else if (peek() === VNodeDataChar.PROPS) {
|
|
33128
33505
|
vnode_setProp(vParent, ELEMENT_PROPS, consumeValue());
|
|
33129
33506
|
} else if (peek() === VNodeDataChar.KEY) {
|
|
@@ -34210,7 +34587,7 @@ var ElementFixture = class {
|
|
|
34210
34587
|
}
|
|
34211
34588
|
}
|
|
34212
34589
|
};
|
|
34213
|
-
async function
|
|
34590
|
+
async function trigger2(root, queryOrElement, eventName, eventPayload = {}, options) {
|
|
34214
34591
|
const waitForIdle = options?.waitForIdle ?? true;
|
|
34215
34592
|
let scope;
|
|
34216
34593
|
let kebabName;
|
|
@@ -34273,14 +34650,12 @@ var dispatch = async (element, event, scopedKebabName, kebabName) => {
|
|
|
34273
34650
|
if ("_qDispatch" in element) {
|
|
34274
34651
|
const handlers = element._qDispatch?.[scopedKebabName];
|
|
34275
34652
|
if (handlers) {
|
|
34276
|
-
if (
|
|
34277
|
-
for (const handler of handlers
|
|
34653
|
+
if (handlers.length) {
|
|
34654
|
+
for (const handler of handlers) {
|
|
34278
34655
|
if (handler) {
|
|
34279
34656
|
await handler(event, element);
|
|
34280
34657
|
}
|
|
34281
34658
|
}
|
|
34282
|
-
} else {
|
|
34283
|
-
await handlers(event, element);
|
|
34284
34659
|
}
|
|
34285
34660
|
}
|
|
34286
34661
|
} else if (element.hasAttribute("q-" + scopedKebabName)) {
|
|
@@ -34405,7 +34780,7 @@ var createDOM = async function({ html } = {}) {
|
|
|
34405
34780
|
},
|
|
34406
34781
|
screen: host,
|
|
34407
34782
|
userEvent: async function(queryOrElement, eventNameCamel, eventPayload = {}) {
|
|
34408
|
-
return
|
|
34783
|
+
return trigger2(host, queryOrElement, eventNameCamel, eventPayload);
|
|
34409
34784
|
}
|
|
34410
34785
|
};
|
|
34411
34786
|
};
|
|
@@ -34434,281 +34809,9 @@ import { join } from "path";
|
|
|
34434
34809
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
34435
34810
|
import { expect as expect2 } from "vitest";
|
|
34436
34811
|
|
|
34437
|
-
// packages/qwik/src/core/preloader/queue.ts
|
|
34438
|
-
import { isBrowser as isBrowser4 } from "@qwik.dev/core/build";
|
|
34439
|
-
|
|
34440
|
-
// packages/qwik/src/core/preloader/constants.ts
|
|
34441
|
-
import { isBrowser as isBrowser3 } from "@qwik.dev/core/build";
|
|
34442
|
-
var doc = isBrowser3 ? document : void 0;
|
|
34443
|
-
var config = {
|
|
34444
|
-
$DEBUG$: false,
|
|
34445
|
-
$maxIdlePreloads$: 25,
|
|
34446
|
-
$invPreloadProbability$: 0.65
|
|
34447
|
-
};
|
|
34448
|
-
var rel = isBrowser3 && doc.createElement("link").relList.supports("modulepreload") ? "modulePreload" : "preload";
|
|
34449
|
-
var loadStart = Date.now();
|
|
34450
|
-
var isJSRegex = /\.[mc]?js$/;
|
|
34451
|
-
|
|
34452
|
-
// packages/qwik/src/core/preloader/types.ts
|
|
34453
|
-
var BundleImportState_None = 0;
|
|
34454
|
-
var BundleImportState_Queued = 1;
|
|
34455
|
-
var BundleImportState_Preload = 2;
|
|
34456
|
-
var BundleImportState_Alias = 3;
|
|
34457
|
-
var BundleImportState_Loaded = 4;
|
|
34458
|
-
|
|
34459
|
-
// packages/qwik/src/core/preloader/bundle-graph.ts
|
|
34460
|
-
var base;
|
|
34461
|
-
var graph;
|
|
34462
|
-
var makeBundle = (name, deps) => {
|
|
34463
|
-
return {
|
|
34464
|
-
$name$: name,
|
|
34465
|
-
$state$: isJSRegex.test(name) ? BundleImportState_None : BundleImportState_Alias,
|
|
34466
|
-
$deps$: shouldResetFactor ? deps?.map((d) => ({ ...d, $factor$: 1 })) : deps,
|
|
34467
|
-
$inverseProbability$: 1,
|
|
34468
|
-
$createdTs$: Date.now(),
|
|
34469
|
-
$waitedMs$: 0,
|
|
34470
|
-
$loadedMs$: 0
|
|
34471
|
-
};
|
|
34472
|
-
};
|
|
34473
|
-
var parseBundleGraph = (serialized) => {
|
|
34474
|
-
const graph2 = /* @__PURE__ */ new Map();
|
|
34475
|
-
let i = 0;
|
|
34476
|
-
while (i < serialized.length) {
|
|
34477
|
-
const name = serialized[i++];
|
|
34478
|
-
const deps = [];
|
|
34479
|
-
let idx;
|
|
34480
|
-
let probability = 1;
|
|
34481
|
-
while (idx = serialized[i], typeof idx === "number") {
|
|
34482
|
-
if (idx < 0) {
|
|
34483
|
-
probability = -idx / 10;
|
|
34484
|
-
} else {
|
|
34485
|
-
deps.push({
|
|
34486
|
-
$name$: serialized[idx],
|
|
34487
|
-
$importProbability$: probability,
|
|
34488
|
-
$factor$: 1
|
|
34489
|
-
});
|
|
34490
|
-
}
|
|
34491
|
-
i++;
|
|
34492
|
-
}
|
|
34493
|
-
graph2.set(name, deps);
|
|
34494
|
-
}
|
|
34495
|
-
return graph2;
|
|
34496
|
-
};
|
|
34497
|
-
var getBundle = (name) => {
|
|
34498
|
-
let bundle = bundles.get(name);
|
|
34499
|
-
if (!bundle) {
|
|
34500
|
-
let deps;
|
|
34501
|
-
if (graph) {
|
|
34502
|
-
deps = graph.get(name);
|
|
34503
|
-
if (!deps) {
|
|
34504
|
-
return;
|
|
34505
|
-
}
|
|
34506
|
-
if (!deps.length) {
|
|
34507
|
-
deps = void 0;
|
|
34508
|
-
}
|
|
34509
|
-
}
|
|
34510
|
-
bundle = makeBundle(name, deps);
|
|
34511
|
-
bundles.set(name, bundle);
|
|
34512
|
-
}
|
|
34513
|
-
return bundle;
|
|
34514
|
-
};
|
|
34515
|
-
var initPreloader = (serializedBundleGraph, opts) => {
|
|
34516
|
-
if (opts) {
|
|
34517
|
-
if ("debug" in opts) {
|
|
34518
|
-
config.$DEBUG$ = !!opts.debug;
|
|
34519
|
-
}
|
|
34520
|
-
if (typeof opts.preloadProbability === "number") {
|
|
34521
|
-
config.$invPreloadProbability$ = 1 - opts.preloadProbability;
|
|
34522
|
-
}
|
|
34523
|
-
}
|
|
34524
|
-
if (base != null || !serializedBundleGraph) {
|
|
34525
|
-
return;
|
|
34526
|
-
}
|
|
34527
|
-
base = "";
|
|
34528
|
-
graph = parseBundleGraph(serializedBundleGraph);
|
|
34529
|
-
};
|
|
34530
|
-
|
|
34531
|
-
// packages/qwik/src/core/preloader/queue.ts
|
|
34532
|
-
var bundles = /* @__PURE__ */ new Map();
|
|
34533
|
-
var shouldResetFactor;
|
|
34534
|
-
var queueDirty;
|
|
34535
|
-
var preloadCount = 0;
|
|
34536
|
-
var queue = [];
|
|
34537
|
-
var log7 = (...args) => {
|
|
34538
|
-
console.log(
|
|
34539
|
-
`Preloader ${Date.now() - loadStart}ms ${preloadCount}/${queue.length} queued>`,
|
|
34540
|
-
...args
|
|
34541
|
-
);
|
|
34542
|
-
};
|
|
34543
|
-
var resetQueue = () => {
|
|
34544
|
-
bundles.clear();
|
|
34545
|
-
queueDirty = false;
|
|
34546
|
-
shouldResetFactor = true;
|
|
34547
|
-
preloadCount = 0;
|
|
34548
|
-
queue.length = 0;
|
|
34549
|
-
};
|
|
34550
|
-
var sortQueue = () => {
|
|
34551
|
-
if (queueDirty) {
|
|
34552
|
-
queue.sort((a, b) => a.$inverseProbability$ - b.$inverseProbability$);
|
|
34553
|
-
queueDirty = false;
|
|
34554
|
-
}
|
|
34555
|
-
};
|
|
34556
|
-
var getQueue = () => {
|
|
34557
|
-
sortQueue();
|
|
34558
|
-
let probability = 0.4;
|
|
34559
|
-
const result2 = [];
|
|
34560
|
-
for (const b of queue) {
|
|
34561
|
-
const nextProbability = Math.round((1 - b.$inverseProbability$) * 10);
|
|
34562
|
-
if (nextProbability !== probability) {
|
|
34563
|
-
probability = nextProbability;
|
|
34564
|
-
result2.push(probability);
|
|
34565
|
-
}
|
|
34566
|
-
result2.push(b.$name$);
|
|
34567
|
-
}
|
|
34568
|
-
return result2;
|
|
34569
|
-
};
|
|
34570
|
-
var trigger2 = () => {
|
|
34571
|
-
if (!queue.length) {
|
|
34572
|
-
return;
|
|
34573
|
-
}
|
|
34574
|
-
sortQueue();
|
|
34575
|
-
while (queue.length) {
|
|
34576
|
-
const bundle = queue[0];
|
|
34577
|
-
const inverseProbability = bundle.$inverseProbability$;
|
|
34578
|
-
const probability = 1 - inverseProbability;
|
|
34579
|
-
const allowedPreloads = graph ? config.$maxIdlePreloads$ : (
|
|
34580
|
-
// While the graph is not available, we limit to 5 preloads
|
|
34581
|
-
5
|
|
34582
|
-
);
|
|
34583
|
-
if (probability >= 0.99 || preloadCount < allowedPreloads) {
|
|
34584
|
-
queue.shift();
|
|
34585
|
-
preloadOne(bundle);
|
|
34586
|
-
} else {
|
|
34587
|
-
break;
|
|
34588
|
-
}
|
|
34589
|
-
}
|
|
34590
|
-
if (config.$DEBUG$ && !queue.length) {
|
|
34591
|
-
const loaded = [...bundles.values()].filter((b) => b.$state$ > BundleImportState_None);
|
|
34592
|
-
const waitTime = loaded.reduce((acc, b) => acc + b.$waitedMs$, 0);
|
|
34593
|
-
const loadTime = loaded.reduce((acc, b) => acc + b.$loadedMs$, 0);
|
|
34594
|
-
log7(
|
|
34595
|
-
`>>>> done ${loaded.length}/${bundles.size} total: ${waitTime}ms waited, ${loadTime}ms loaded`
|
|
34596
|
-
);
|
|
34597
|
-
}
|
|
34598
|
-
};
|
|
34599
|
-
var preloadOne = (bundle) => {
|
|
34600
|
-
if (bundle.$state$ >= BundleImportState_Preload) {
|
|
34601
|
-
return;
|
|
34602
|
-
}
|
|
34603
|
-
preloadCount++;
|
|
34604
|
-
const start = Date.now();
|
|
34605
|
-
bundle.$waitedMs$ = start - bundle.$createdTs$;
|
|
34606
|
-
bundle.$state$ = BundleImportState_Preload;
|
|
34607
|
-
config.$DEBUG$ && log7(
|
|
34608
|
-
`<< load ${Math.round((1 - bundle.$inverseProbability$) * 100)}% after ${`${bundle.$waitedMs$}ms`}`,
|
|
34609
|
-
bundle.$name$
|
|
34610
|
-
);
|
|
34611
|
-
const link = doc.createElement("link");
|
|
34612
|
-
link.href = new URL(`${base}${bundle.$name$}`, doc.baseURI).toString();
|
|
34613
|
-
link.rel = rel;
|
|
34614
|
-
link.as = "script";
|
|
34615
|
-
link.onload = link.onerror = () => {
|
|
34616
|
-
preloadCount--;
|
|
34617
|
-
const end = Date.now();
|
|
34618
|
-
bundle.$loadedMs$ = end - start;
|
|
34619
|
-
bundle.$state$ = BundleImportState_Loaded;
|
|
34620
|
-
config.$DEBUG$ && log7(`>> done after ${bundle.$loadedMs$}ms`, bundle.$name$);
|
|
34621
|
-
link.remove();
|
|
34622
|
-
trigger2();
|
|
34623
|
-
};
|
|
34624
|
-
doc.head.appendChild(link);
|
|
34625
|
-
};
|
|
34626
|
-
var adjustProbabilities = (bundle, newInverseProbability, seen) => {
|
|
34627
|
-
if (seen?.has(bundle)) {
|
|
34628
|
-
return;
|
|
34629
|
-
}
|
|
34630
|
-
const previousInverseProbability = bundle.$inverseProbability$;
|
|
34631
|
-
bundle.$inverseProbability$ = newInverseProbability;
|
|
34632
|
-
if (previousInverseProbability - bundle.$inverseProbability$ < 0.01) {
|
|
34633
|
-
return;
|
|
34634
|
-
}
|
|
34635
|
-
if (
|
|
34636
|
-
// don't queue until we have initialized the preloader
|
|
34637
|
-
base != null && bundle.$state$ < BundleImportState_Preload
|
|
34638
|
-
) {
|
|
34639
|
-
if (bundle.$state$ === BundleImportState_None) {
|
|
34640
|
-
bundle.$state$ = BundleImportState_Queued;
|
|
34641
|
-
queue.push(bundle);
|
|
34642
|
-
config.$DEBUG$ && log7(`queued ${Math.round((1 - bundle.$inverseProbability$) * 100)}%`, bundle.$name$);
|
|
34643
|
-
}
|
|
34644
|
-
queueDirty = true;
|
|
34645
|
-
}
|
|
34646
|
-
if (bundle.$deps$) {
|
|
34647
|
-
seen || (seen = /* @__PURE__ */ new Set());
|
|
34648
|
-
seen.add(bundle);
|
|
34649
|
-
const probability = 1 - bundle.$inverseProbability$;
|
|
34650
|
-
for (const dep of bundle.$deps$) {
|
|
34651
|
-
const depBundle = getBundle(dep.$name$);
|
|
34652
|
-
if (depBundle.$inverseProbability$ === 0) {
|
|
34653
|
-
continue;
|
|
34654
|
-
}
|
|
34655
|
-
let newInverseProbability2;
|
|
34656
|
-
if (probability === 1 || probability >= 0.99 && depsCount < 100) {
|
|
34657
|
-
depsCount++;
|
|
34658
|
-
newInverseProbability2 = Math.min(0.01, 1 - dep.$importProbability$);
|
|
34659
|
-
} else {
|
|
34660
|
-
const newInverseImportProbability = 1 - dep.$importProbability$ * probability;
|
|
34661
|
-
const prevAdjust = dep.$factor$;
|
|
34662
|
-
const factor = newInverseImportProbability / prevAdjust;
|
|
34663
|
-
newInverseProbability2 = Math.max(0.02, depBundle.$inverseProbability$ * factor);
|
|
34664
|
-
dep.$factor$ = factor;
|
|
34665
|
-
}
|
|
34666
|
-
adjustProbabilities(depBundle, newInverseProbability2, seen);
|
|
34667
|
-
}
|
|
34668
|
-
}
|
|
34669
|
-
};
|
|
34670
|
-
var handleBundle = (name, inverseProbability) => {
|
|
34671
|
-
const bundle = getBundle(name);
|
|
34672
|
-
if (bundle && bundle.$inverseProbability$ > inverseProbability) {
|
|
34673
|
-
adjustProbabilities(bundle, inverseProbability);
|
|
34674
|
-
}
|
|
34675
|
-
};
|
|
34676
|
-
var depsCount;
|
|
34677
|
-
var preload2 = (name, probability) => {
|
|
34678
|
-
if (!name?.length) {
|
|
34679
|
-
return;
|
|
34680
|
-
}
|
|
34681
|
-
depsCount = 0;
|
|
34682
|
-
let inverseProbability = probability ? 1 - probability : 0.4;
|
|
34683
|
-
if (Array.isArray(name)) {
|
|
34684
|
-
for (let i = name.length - 1; i >= 0; i--) {
|
|
34685
|
-
const item = name[i];
|
|
34686
|
-
if (typeof item === "number") {
|
|
34687
|
-
inverseProbability = 1 - item / 10;
|
|
34688
|
-
} else {
|
|
34689
|
-
handleBundle(item, inverseProbability);
|
|
34690
|
-
}
|
|
34691
|
-
}
|
|
34692
|
-
} else {
|
|
34693
|
-
handleBundle(name, inverseProbability);
|
|
34694
|
-
}
|
|
34695
|
-
if (isBrowser4) {
|
|
34696
|
-
trigger2();
|
|
34697
|
-
}
|
|
34698
|
-
};
|
|
34699
|
-
if (isBrowser4) {
|
|
34700
|
-
document.addEventListener("qsymbol", (ev) => {
|
|
34701
|
-
const { symbol, href } = ev.detail;
|
|
34702
|
-
if (href) {
|
|
34703
|
-
const hash3 = symbol.slice(symbol.lastIndexOf("_") + 1);
|
|
34704
|
-
preload2(hash3, 1);
|
|
34705
|
-
}
|
|
34706
|
-
});
|
|
34707
|
-
}
|
|
34708
|
-
|
|
34709
34812
|
// packages/qwik/src/server/platform.ts
|
|
34710
34813
|
import { setPlatform as setPlatform2 } from "../core.mjs";
|
|
34711
|
-
import { isDev as
|
|
34814
|
+
import { isDev as isDev25 } from "@qwik.dev/core/build";
|
|
34712
34815
|
var getDevSegmentPath = (mapper, hash3, symbolName, parent) => {
|
|
34713
34816
|
const existing = mapper?.[hash3];
|
|
34714
34817
|
if (existing) {
|
|
@@ -34730,9 +34833,9 @@ var getDevSegmentPath = (mapper, hash3, symbolName, parent) => {
|
|
|
34730
34833
|
function createPlatform3(opts, resolvedManifest) {
|
|
34731
34834
|
const mapper = resolvedManifest?.mapper;
|
|
34732
34835
|
const mapperFn = opts.symbolMapper ? opts.symbolMapper : (symbolName, _chunk, parent) => {
|
|
34733
|
-
if (mapper ||
|
|
34836
|
+
if (mapper || isDev25 && import.meta.env.MODE !== "test") {
|
|
34734
34837
|
const hash3 = getSymbolHash2(symbolName);
|
|
34735
|
-
const result2 = !
|
|
34838
|
+
const result2 = !isDev25 ? mapper[hash3] : getDevSegmentPath(mapper, hash3, symbolName, parent);
|
|
34736
34839
|
if (!result2) {
|
|
34737
34840
|
if (hash3 === SYNC_QRL) {
|
|
34738
34841
|
return [hash3, ""];
|
|
@@ -34817,16 +34920,16 @@ var versions = {
|
|
|
34817
34920
|
};
|
|
34818
34921
|
|
|
34819
34922
|
// packages/qwik/src/server/ssr-container.ts
|
|
34820
|
-
import { isDev as
|
|
34923
|
+
import { isDev as isDev27 } from "@qwik.dev/core/build";
|
|
34821
34924
|
import {
|
|
34822
|
-
_createQRL as createQRL2,
|
|
34823
|
-
_qrlToString as qrlToString2,
|
|
34824
|
-
_res,
|
|
34825
34925
|
_SubscriptionData as SubscriptionData2,
|
|
34826
34926
|
_SharedContainer as _SharedContainer2,
|
|
34827
34927
|
_jsxSorted as _jsxSorted2,
|
|
34828
34928
|
_jsxSplit as _jsxSplit2,
|
|
34929
|
+
_res,
|
|
34930
|
+
_setEvent,
|
|
34829
34931
|
_walkJSX,
|
|
34932
|
+
_createQRL as createQRL2,
|
|
34830
34933
|
isSignal as isSignal3
|
|
34831
34934
|
} from "@qwik.dev/core/internal";
|
|
34832
34935
|
|
|
@@ -34957,39 +35060,44 @@ var preloaderPre = (container, options, nonce) => {
|
|
|
34957
35060
|
}
|
|
34958
35061
|
}
|
|
34959
35062
|
const optsStr = opts.length ? `,{${opts.join(",")}}` : "";
|
|
34960
|
-
const preloaderLinkAttrs =
|
|
35063
|
+
const preloaderLinkAttrs = {
|
|
35064
|
+
rel: "modulepreload",
|
|
35065
|
+
href: preloaderBundle
|
|
35066
|
+
};
|
|
34961
35067
|
if (nonce) {
|
|
34962
|
-
preloaderLinkAttrs
|
|
35068
|
+
preloaderLinkAttrs["nonce"] = nonce;
|
|
34963
35069
|
}
|
|
34964
|
-
container.openElement("link", null, preloaderLinkAttrs);
|
|
35070
|
+
container.openElement("link", null, preloaderLinkAttrs, null, null, null);
|
|
34965
35071
|
container.closeElement();
|
|
34966
|
-
container.openElement(
|
|
34967
|
-
"
|
|
34968
|
-
|
|
34969
|
-
"href",
|
|
34970
|
-
|
|
34971
|
-
|
|
34972
|
-
|
|
34973
|
-
|
|
34974
|
-
"anonymous"
|
|
34975
|
-
]);
|
|
35072
|
+
container.openElement(
|
|
35073
|
+
"link",
|
|
35074
|
+
null,
|
|
35075
|
+
{ rel: "preload", href: bundleGraphPath, as: "fetch", crossorigin: "anonymous" },
|
|
35076
|
+
null,
|
|
35077
|
+
null,
|
|
35078
|
+
null
|
|
35079
|
+
);
|
|
34976
35080
|
container.closeElement();
|
|
34977
35081
|
const script2 = `let b=fetch("${bundleGraphPath}");import("${preloaderBundle}").then(({l})=>l(${JSON.stringify(base2)},b${optsStr}));`;
|
|
34978
|
-
const scriptAttrs =
|
|
35082
|
+
const scriptAttrs = {
|
|
35083
|
+
type: "module",
|
|
35084
|
+
async: true,
|
|
35085
|
+
crossorigin: "anonymous"
|
|
35086
|
+
};
|
|
34979
35087
|
if (nonce) {
|
|
34980
|
-
scriptAttrs
|
|
35088
|
+
scriptAttrs["nonce"] = nonce;
|
|
34981
35089
|
}
|
|
34982
|
-
container.openElement("script", null, scriptAttrs);
|
|
35090
|
+
container.openElement("script", null, scriptAttrs, null, null, null);
|
|
34983
35091
|
container.write(script2);
|
|
34984
35092
|
container.closeElement();
|
|
34985
35093
|
}
|
|
34986
35094
|
const corePath = simplifyPath(base2, resolvedManifest?.manifest.core);
|
|
34987
35095
|
if (corePath) {
|
|
34988
|
-
const linkAttrs =
|
|
35096
|
+
const linkAttrs = { rel: "modulepreload", href: corePath };
|
|
34989
35097
|
if (nonce) {
|
|
34990
|
-
linkAttrs
|
|
35098
|
+
linkAttrs["nonce"] = nonce;
|
|
34991
35099
|
}
|
|
34992
|
-
container.openElement("link", null, linkAttrs);
|
|
35100
|
+
container.openElement("link", null, linkAttrs, null, null, null);
|
|
34993
35101
|
container.closeElement();
|
|
34994
35102
|
}
|
|
34995
35103
|
};
|
|
@@ -35041,11 +35149,11 @@ var includePreloader = (container, options, referencedBundles, nonce) => {
|
|
|
35041
35149
|
script2 += `window.addEventListener('load',f=>{f=_=>import("${preloaderBundle}").then(({p})=>p(${JSON.stringify(referencedBundles)}));try{requestIdleCallback(f,{timeout:2000})}catch(e){setTimeout(f,200)}})`;
|
|
35042
35150
|
}
|
|
35043
35151
|
if (script2) {
|
|
35044
|
-
const attrs =
|
|
35152
|
+
const attrs = { type: "module", async: "true", "q:type": "preload" };
|
|
35045
35153
|
if (nonce) {
|
|
35046
|
-
attrs
|
|
35154
|
+
attrs["nonce"] = nonce;
|
|
35047
35155
|
}
|
|
35048
|
-
container.openElement("script", null, attrs);
|
|
35156
|
+
container.openElement("script", null, attrs, null, null, null);
|
|
35049
35157
|
container.write(script2);
|
|
35050
35158
|
container.closeElement();
|
|
35051
35159
|
}
|
|
@@ -35087,8 +35195,12 @@ function getQwikBackpatchExecutorScript(opts = {}) {
|
|
|
35087
35195
|
}
|
|
35088
35196
|
|
|
35089
35197
|
// packages/qwik/src/server/ssr-node.ts
|
|
35090
|
-
import {
|
|
35091
|
-
|
|
35198
|
+
import {
|
|
35199
|
+
_isJSXNode as isJSXNode2,
|
|
35200
|
+
_EMPTY_OBJ,
|
|
35201
|
+
_EFFECT_BACK_REF as _EFFECT_BACK_REF2
|
|
35202
|
+
} from "@qwik.dev/core/internal";
|
|
35203
|
+
import { isDev as isDev26 } from "@qwik.dev/core/build";
|
|
35092
35204
|
var SsrNode = class {
|
|
35093
35205
|
constructor(parentComponent, id, attributesIndex, cleanupQueue, vnodeData, currentFile) {
|
|
35094
35206
|
this.parentComponent = parentComponent;
|
|
@@ -35111,9 +35223,9 @@ var SsrNode = class {
|
|
|
35111
35223
|
__publicField(this, "localProps", null);
|
|
35112
35224
|
this.id = id;
|
|
35113
35225
|
this.flags = 1 /* Updatable */;
|
|
35114
|
-
this.attrs = this.attributesIndex >= 0 ? this.vnodeData[this.attributesIndex] :
|
|
35226
|
+
this.attrs = this.attributesIndex >= 0 ? this.vnodeData[this.attributesIndex] : _EMPTY_OBJ;
|
|
35115
35227
|
this.parentComponent?.addChild(this);
|
|
35116
|
-
if (
|
|
35228
|
+
if (isDev26 && id.indexOf("undefined") != -1) {
|
|
35117
35229
|
throw new Error(`Invalid SSR node id: ${id}`);
|
|
35118
35230
|
}
|
|
35119
35231
|
}
|
|
@@ -35121,13 +35233,13 @@ var SsrNode = class {
|
|
|
35121
35233
|
return this.getProp(QBackRefs);
|
|
35122
35234
|
}
|
|
35123
35235
|
setProp(name, value) {
|
|
35124
|
-
if (this.attrs ===
|
|
35236
|
+
if (this.attrs === _EMPTY_OBJ) {
|
|
35125
35237
|
this.setEmptyArrayAsVNodeDataAttributes();
|
|
35126
35238
|
}
|
|
35127
35239
|
if (name.startsWith(NON_SERIALIZABLE_MARKER_PREFIX)) {
|
|
35128
|
-
|
|
35240
|
+
(this.localProps || (this.localProps = {}))[name] = value;
|
|
35129
35241
|
} else {
|
|
35130
|
-
|
|
35242
|
+
this.attrs[name] = value;
|
|
35131
35243
|
}
|
|
35132
35244
|
if (name == ELEMENT_SEQ && value) {
|
|
35133
35245
|
this.cleanupQueue.push(value);
|
|
@@ -35135,29 +35247,29 @@ var SsrNode = class {
|
|
|
35135
35247
|
}
|
|
35136
35248
|
setEmptyArrayAsVNodeDataAttributes() {
|
|
35137
35249
|
if (this.attributesIndex >= 0) {
|
|
35138
|
-
this.vnodeData[this.attributesIndex] =
|
|
35250
|
+
this.vnodeData[this.attributesIndex] = {};
|
|
35139
35251
|
this.attrs = this.vnodeData[this.attributesIndex];
|
|
35140
35252
|
} else {
|
|
35141
35253
|
const newAttributesIndex = this.vnodeData.length > 1 ? 1 : 0;
|
|
35142
|
-
this.vnodeData.splice(newAttributesIndex, 0,
|
|
35254
|
+
this.vnodeData.splice(newAttributesIndex, 0, {});
|
|
35143
35255
|
this.attributesIndex = newAttributesIndex;
|
|
35144
35256
|
this.attrs = this.vnodeData[this.attributesIndex];
|
|
35145
35257
|
}
|
|
35146
35258
|
}
|
|
35147
35259
|
getProp(name) {
|
|
35148
35260
|
if (name.startsWith(NON_SERIALIZABLE_MARKER_PREFIX)) {
|
|
35149
|
-
return this.localProps ?
|
|
35261
|
+
return this.localProps ? this.localProps[name] ?? null : null;
|
|
35150
35262
|
} else {
|
|
35151
|
-
return
|
|
35263
|
+
return this.attrs[name] ?? null;
|
|
35152
35264
|
}
|
|
35153
35265
|
}
|
|
35154
35266
|
removeProp(name) {
|
|
35155
35267
|
if (name.startsWith(NON_SERIALIZABLE_MARKER_PREFIX)) {
|
|
35156
35268
|
if (this.localProps) {
|
|
35157
|
-
|
|
35269
|
+
delete this.localProps[name];
|
|
35158
35270
|
}
|
|
35159
35271
|
} else {
|
|
35160
|
-
|
|
35272
|
+
delete this.attrs[name];
|
|
35161
35273
|
}
|
|
35162
35274
|
}
|
|
35163
35275
|
addChild(child) {
|
|
@@ -35177,16 +35289,13 @@ var SsrNode = class {
|
|
|
35177
35289
|
}
|
|
35178
35290
|
}
|
|
35179
35291
|
toString() {
|
|
35180
|
-
if (
|
|
35292
|
+
if (isDev26) {
|
|
35181
35293
|
let stringifiedAttrs = "";
|
|
35182
|
-
for (
|
|
35183
|
-
const
|
|
35184
|
-
const value = this.attrs[i + 1];
|
|
35294
|
+
for (const key in this.attrs) {
|
|
35295
|
+
const value = this.attrs[key];
|
|
35185
35296
|
stringifiedAttrs += `${key}=`;
|
|
35186
35297
|
stringifiedAttrs += `${typeof value === "string" || typeof value === "number" ? JSON.stringify(value) : "*"}`;
|
|
35187
|
-
|
|
35188
|
-
stringifiedAttrs += ", ";
|
|
35189
|
-
}
|
|
35298
|
+
stringifiedAttrs += ", ";
|
|
35190
35299
|
}
|
|
35191
35300
|
return `<SSRNode id="${this.id}" ${stringifiedAttrs} />`;
|
|
35192
35301
|
} else {
|
|
@@ -35295,7 +35404,7 @@ function vNodeData_closeFragment(vNodeData) {
|
|
|
35295
35404
|
vNodeData.push(CLOSE_FRAGMENT);
|
|
35296
35405
|
}
|
|
35297
35406
|
function vNodeData_openElement(vNodeData) {
|
|
35298
|
-
vNodeData.push(
|
|
35407
|
+
vNodeData.push({}, WRITE_ELEMENT_ATTRS);
|
|
35299
35408
|
vNodeData[0] |= 4 /* ELEMENT_NODE */;
|
|
35300
35409
|
}
|
|
35301
35410
|
function vNodeData_createSsrNodeReference(currentComponentNode, vNodeData, depthFirstElementIdx, cleanupQueue, currentFile) {
|
|
@@ -35304,7 +35413,7 @@ function vNodeData_createSsrNodeReference(currentComponentNode, vNodeData, depth
|
|
|
35304
35413
|
let attributesIndex = -1;
|
|
35305
35414
|
for (let i = 1; i < vNodeData.length; i++) {
|
|
35306
35415
|
const value = vNodeData[i];
|
|
35307
|
-
if (
|
|
35416
|
+
if (typeof value === "object" && value !== null) {
|
|
35308
35417
|
attributesIndex = i;
|
|
35309
35418
|
i++;
|
|
35310
35419
|
if (vNodeData[i] !== WRITE_ELEMENT_ATTRS) {
|
|
@@ -35320,7 +35429,7 @@ function vNodeData_createSsrNodeReference(currentComponentNode, vNodeData, depth
|
|
|
35320
35429
|
stack2[stack2.length - 1]++;
|
|
35321
35430
|
}
|
|
35322
35431
|
}
|
|
35323
|
-
let refId =
|
|
35432
|
+
let refId = depthFirstElementIdx + "";
|
|
35324
35433
|
if (vNodeData[0] & (2 /* VIRTUAL_NODE */ | 1 /* TEXT_DATA */)) {
|
|
35325
35434
|
for (let i = 0; i < stack2.length; i++) {
|
|
35326
35435
|
const childCount = stack2[i];
|
|
@@ -35364,6 +35473,7 @@ function ssrCreateContainer(opts) {
|
|
|
35364
35473
|
return new SSRContainer({
|
|
35365
35474
|
tagName: opts.tagName || "div",
|
|
35366
35475
|
writer: opts.writer || new StringBufferWriter(),
|
|
35476
|
+
streamHandler: opts.streamHandler,
|
|
35367
35477
|
locale: opts.locale || "",
|
|
35368
35478
|
timing: opts.timing || {
|
|
35369
35479
|
firstFlush: 0,
|
|
@@ -35393,12 +35503,17 @@ var StringBufferWriter = class {
|
|
|
35393
35503
|
}
|
|
35394
35504
|
};
|
|
35395
35505
|
var EMPTY_OBJ2 = {};
|
|
35506
|
+
var QTemplateProps = {
|
|
35507
|
+
hidden: true,
|
|
35508
|
+
"aria-hidden": true
|
|
35509
|
+
};
|
|
35396
35510
|
var SSRContainer = class extends _SharedContainer2 {
|
|
35397
35511
|
constructor(opts) {
|
|
35398
35512
|
super(opts.renderOptions.serverData ?? EMPTY_OBJ2, opts.locale);
|
|
35399
35513
|
__publicField(this, "tag");
|
|
35400
35514
|
__publicField(this, "isHtml");
|
|
35401
35515
|
__publicField(this, "writer");
|
|
35516
|
+
__publicField(this, "streamHandler");
|
|
35402
35517
|
__publicField(this, "timing");
|
|
35403
35518
|
__publicField(this, "size", 0);
|
|
35404
35519
|
__publicField(this, "resolvedManifest");
|
|
@@ -35435,6 +35550,7 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
35435
35550
|
__publicField(this, "vNodeDatas", []);
|
|
35436
35551
|
__publicField(this, "componentStack", []);
|
|
35437
35552
|
__publicField(this, "cleanupQueue", []);
|
|
35553
|
+
__publicField(this, "emitContainerDataFrame", null);
|
|
35438
35554
|
__publicField(this, "$instanceHash$", hash2());
|
|
35439
35555
|
// Temporary flag to find missing roots after the state was serialized
|
|
35440
35556
|
__publicField(this, "$noMoreRoots$", false);
|
|
@@ -35456,6 +35572,7 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
35456
35572
|
this.tag = opts.tagName;
|
|
35457
35573
|
this.isHtml = opts.tagName === "html";
|
|
35458
35574
|
this.writer = opts.writer;
|
|
35575
|
+
this.streamHandler = opts.streamHandler;
|
|
35459
35576
|
this.timing = opts.timing;
|
|
35460
35577
|
this.$buildBase$ = opts.buildBase;
|
|
35461
35578
|
this.resolvedManifest = opts.resolvedManifest;
|
|
@@ -35539,27 +35656,23 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
35539
35656
|
containerAttributes[QContainerAttr] = "paused" /* PAUSED */;
|
|
35540
35657
|
containerAttributes[QRuntimeAttr] = "2";
|
|
35541
35658
|
containerAttributes[QVersionAttr] = this.$version$ ?? "dev";
|
|
35542
|
-
containerAttributes[QRenderAttr] = (qRender ? qRender + "-" : "") + (
|
|
35659
|
+
containerAttributes[QRenderAttr] = (qRender ? qRender + "-" : "") + (isDev27 ? "ssr-dev" : "ssr");
|
|
35543
35660
|
containerAttributes[QBaseAttr] = this.$buildBase$ || "";
|
|
35544
35661
|
containerAttributes[QLocaleAttr] = this.$locale$;
|
|
35545
35662
|
containerAttributes[QManifestHashAttr] = this.resolvedManifest.manifest.manifestHash;
|
|
35546
35663
|
containerAttributes[QInstanceAttr] = this.$instanceHash$;
|
|
35547
35664
|
this.$serverData$.containerAttributes = containerAttributes;
|
|
35548
|
-
|
|
35549
|
-
|
|
35550
|
-
|
|
35551
|
-
|
|
35552
|
-
},
|
|
35553
|
-
[]
|
|
35554
|
-
);
|
|
35555
|
-
this.openElement(this.tag, null, containerAttributeArray);
|
|
35665
|
+
this.openElement(this.tag, null, containerAttributes);
|
|
35666
|
+
if (!this.isHtml) {
|
|
35667
|
+
this.emitContainerDataFrame = this.currentElementFrame;
|
|
35668
|
+
}
|
|
35556
35669
|
}
|
|
35557
35670
|
/** Renders closing tag for current container */
|
|
35558
35671
|
closeContainer() {
|
|
35559
35672
|
return this.closeElement();
|
|
35560
35673
|
}
|
|
35561
35674
|
/** Renders opening tag for DOM element */
|
|
35562
|
-
openElement(elementName, key, varAttrs, constAttrs, currentFile) {
|
|
35675
|
+
openElement(elementName, key, varAttrs, constAttrs = null, styleScopedId = null, currentFile = null) {
|
|
35563
35676
|
const isQwikStyle = isQwikStyleElement(elementName, varAttrs) || isQwikStyleElement(elementName, constAttrs);
|
|
35564
35677
|
if (
|
|
35565
35678
|
// don't append qwik loader before qwik style elements
|
|
@@ -35578,23 +35691,26 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
35578
35691
|
vNodeData_incrementElementCount(this.currentElementFrame.vNodeData);
|
|
35579
35692
|
}
|
|
35580
35693
|
this.createAndPushFrame(elementName, this.depthFirstElementCount++, currentFile);
|
|
35694
|
+
if (this.isHtml && elementName === "body" && this.emitContainerDataFrame === null) {
|
|
35695
|
+
this.emitContainerDataFrame = this.currentElementFrame;
|
|
35696
|
+
}
|
|
35581
35697
|
vNodeData_openElement(this.currentElementFrame.vNodeData);
|
|
35582
|
-
this.write(
|
|
35698
|
+
this.write(LT);
|
|
35583
35699
|
this.write(elementName);
|
|
35584
35700
|
const lastNode = this.getOrCreateLastNode();
|
|
35585
35701
|
if (varAttrs) {
|
|
35586
|
-
innerHTML = this.writeAttrs(elementName, varAttrs, false, currentFile);
|
|
35702
|
+
innerHTML = this.writeAttrs(elementName, varAttrs, false, styleScopedId, currentFile);
|
|
35587
35703
|
}
|
|
35588
35704
|
this.write(" " + Q_PROPS_SEPARATOR);
|
|
35589
35705
|
if (key !== null) {
|
|
35590
35706
|
this.write(`="${key}"`);
|
|
35591
|
-
} else if (
|
|
35592
|
-
this.write(
|
|
35707
|
+
} else if (import.meta.env.TEST) {
|
|
35708
|
+
this.write(EMPTY_ATTR);
|
|
35593
35709
|
}
|
|
35594
|
-
if (constAttrs && constAttrs
|
|
35595
|
-
innerHTML = this.writeAttrs(elementName, constAttrs, true, currentFile) || innerHTML;
|
|
35710
|
+
if (constAttrs && !isObjectEmpty(constAttrs)) {
|
|
35711
|
+
innerHTML = this.writeAttrs(elementName, constAttrs, true, styleScopedId, currentFile) || innerHTML;
|
|
35596
35712
|
}
|
|
35597
|
-
this.write(
|
|
35713
|
+
this.write(GT);
|
|
35598
35714
|
if (lastNode) {
|
|
35599
35715
|
lastNode.setTreeNonUpdatable();
|
|
35600
35716
|
}
|
|
@@ -35602,7 +35718,8 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
35602
35718
|
}
|
|
35603
35719
|
/** Renders closing tag for DOM element */
|
|
35604
35720
|
closeElement() {
|
|
35605
|
-
if (this.
|
|
35721
|
+
if (this.currentElementFrame === this.emitContainerDataFrame) {
|
|
35722
|
+
this.emitContainerDataFrame = null;
|
|
35606
35723
|
this.onRenderDone();
|
|
35607
35724
|
const snapshotTimer = createTimer();
|
|
35608
35725
|
return maybeThen(
|
|
@@ -35614,16 +35731,6 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
35614
35731
|
}
|
|
35615
35732
|
this._closeElement();
|
|
35616
35733
|
}
|
|
35617
|
-
shouldEmitDataBeforeClosingElement() {
|
|
35618
|
-
const currentFrame = this.currentElementFrame;
|
|
35619
|
-
return (
|
|
35620
|
-
/**
|
|
35621
|
-
* - Micro-frontends don't have html tag, emit data before closing custom element
|
|
35622
|
-
* - Regular applications should emit data inside body
|
|
35623
|
-
*/
|
|
35624
|
-
currentFrame.parent === null && currentFrame.elementName !== "html" || currentFrame.elementName === "body"
|
|
35625
|
-
);
|
|
35626
|
-
}
|
|
35627
35734
|
onRenderDone() {
|
|
35628
35735
|
this.drainCleanupQueue();
|
|
35629
35736
|
this.timing.render = this.renderTimer();
|
|
@@ -35645,9 +35752,9 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
35645
35752
|
const currentFrame = this.popFrame();
|
|
35646
35753
|
const elementName = currentFrame.elementName;
|
|
35647
35754
|
if (!isSelfClosingTag(elementName)) {
|
|
35648
|
-
this.write(
|
|
35755
|
+
this.write(CLOSE_TAG);
|
|
35649
35756
|
this.write(elementName);
|
|
35650
|
-
this.write(
|
|
35757
|
+
this.write(GT);
|
|
35651
35758
|
}
|
|
35652
35759
|
this.lastNode = null;
|
|
35653
35760
|
if (this.qlInclude === 1 /* Inline */) {
|
|
@@ -35718,13 +35825,13 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
35718
35825
|
if (componentFrame.slots.length === 0) {
|
|
35719
35826
|
return;
|
|
35720
35827
|
}
|
|
35721
|
-
this.openElement(QTemplate, null,
|
|
35828
|
+
this.openElement(QTemplate, null, QTemplateProps, null);
|
|
35722
35829
|
const scopedStyleId = componentFrame.projectionScopedStyle;
|
|
35723
35830
|
for (let i = 0; i < componentFrame.slots.length; i += 2) {
|
|
35724
35831
|
const slotName = componentFrame.slots[i];
|
|
35725
35832
|
const children = componentFrame.slots[i + 1];
|
|
35726
35833
|
this.openFragment(
|
|
35727
|
-
|
|
35834
|
+
isDev27 ? { [DEBUG_TYPE]: "P" /* Projection */, [QSlotParent]: componentFrame.componentNode.id } : { [QSlotParent]: componentFrame.componentNode.id }
|
|
35728
35835
|
);
|
|
35729
35836
|
const lastNode = this.getOrCreateLastNode();
|
|
35730
35837
|
if (lastNode.vnodeData) {
|
|
@@ -35814,7 +35921,9 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
35814
35921
|
}
|
|
35815
35922
|
}
|
|
35816
35923
|
_styleNode(styleId, content) {
|
|
35817
|
-
this.openElement("style", null,
|
|
35924
|
+
this.openElement("style", null, {
|
|
35925
|
+
[QStyle]: styleId
|
|
35926
|
+
});
|
|
35818
35927
|
this.write(content);
|
|
35819
35928
|
this.closeElement();
|
|
35820
35929
|
}
|
|
@@ -35855,7 +35964,7 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
35855
35964
|
if (!this.serializationCtx.$roots$.length) {
|
|
35856
35965
|
return;
|
|
35857
35966
|
}
|
|
35858
|
-
this.openElement("script", null,
|
|
35967
|
+
this.openElement("script", null, { type: "qwik/vnode" });
|
|
35859
35968
|
const vNodeAttrsStack = [];
|
|
35860
35969
|
const vNodeData = this.vNodeDatas;
|
|
35861
35970
|
let lastSerializedIdx = 0;
|
|
@@ -35872,7 +35981,7 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
35872
35981
|
let depth = 0;
|
|
35873
35982
|
for (let i = 1; i < vNode.length; i++) {
|
|
35874
35983
|
const value = vNode[i];
|
|
35875
|
-
if (
|
|
35984
|
+
if (typeof value === "object" && value !== null) {
|
|
35876
35985
|
vNodeAttrsStack.push(fragmentAttrs);
|
|
35877
35986
|
fragmentAttrs = value;
|
|
35878
35987
|
} else if (value === OPEN_FRAGMENT) {
|
|
@@ -35886,7 +35995,7 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
35886
35995
|
depth--;
|
|
35887
35996
|
this.write(VNodeDataChar.CLOSE_CHAR);
|
|
35888
35997
|
} else if (value === WRITE_ELEMENT_ATTRS) {
|
|
35889
|
-
if (fragmentAttrs && fragmentAttrs
|
|
35998
|
+
if (fragmentAttrs && !isObjectEmpty(fragmentAttrs)) {
|
|
35890
35999
|
this.write(VNodeDataChar.SEPARATOR_CHAR);
|
|
35891
36000
|
this.write(VNodeDataChar.SEPARATOR_CHAR);
|
|
35892
36001
|
this.writeFragmentAttrs(fragmentAttrs);
|
|
@@ -35913,9 +36022,8 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
35913
36022
|
this.closeElement();
|
|
35914
36023
|
}
|
|
35915
36024
|
writeFragmentAttrs(fragmentAttrs) {
|
|
35916
|
-
for (
|
|
35917
|
-
|
|
35918
|
-
let value = fragmentAttrs[i++];
|
|
36025
|
+
for (const key in fragmentAttrs) {
|
|
36026
|
+
let value = fragmentAttrs[key];
|
|
35919
36027
|
let encodeValue = false;
|
|
35920
36028
|
if (typeof value !== "string") {
|
|
35921
36029
|
const rootId = this.addRoot(value);
|
|
@@ -35990,28 +36098,25 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
35990
36098
|
}
|
|
35991
36099
|
/** Add q-d:qidle attribute to eagerly resume some state if needed */
|
|
35992
36100
|
stateScriptAttrs() {
|
|
35993
|
-
const attrs =
|
|
36101
|
+
const attrs = { type: "qwik/state" };
|
|
35994
36102
|
const eagerResume = this.serializationCtx.$eagerResume$;
|
|
35995
36103
|
if (eagerResume.size > 0) {
|
|
35996
|
-
|
|
35997
|
-
const qrlStr = qrlToString2(this.serializationCtx, qrl);
|
|
35998
|
-
attrs.push("q-d:qidle", qrlStr);
|
|
35999
|
-
this.serializationCtx.$eventNames$.add("d:qidle");
|
|
36104
|
+
attrs["q-d:qidle"] = createQRL2(null, "_res", _res, null, [...eagerResume]);
|
|
36000
36105
|
}
|
|
36001
36106
|
return attrs;
|
|
36002
36107
|
}
|
|
36003
36108
|
emitSyncFnsData() {
|
|
36004
36109
|
const fns = this.serializationCtx.$syncFns$;
|
|
36005
36110
|
if (fns.length) {
|
|
36006
|
-
const scriptAttrs =
|
|
36111
|
+
const scriptAttrs = { "q:func": "qwik/json" };
|
|
36007
36112
|
if (this.renderOptions.serverData?.nonce) {
|
|
36008
|
-
scriptAttrs
|
|
36113
|
+
scriptAttrs["nonce"] = this.renderOptions.serverData.nonce;
|
|
36009
36114
|
}
|
|
36010
36115
|
this.openElement("script", null, scriptAttrs);
|
|
36011
36116
|
this.write(Q_FUNCS_PREFIX2.replace("HASH", this.$instanceHash$));
|
|
36012
|
-
this.write(
|
|
36013
|
-
this.writeArray(fns,
|
|
36014
|
-
this.write(
|
|
36117
|
+
this.write(BRACKET_OPEN);
|
|
36118
|
+
this.writeArray(fns, COMMA);
|
|
36119
|
+
this.write(BRACKET_CLOSE);
|
|
36015
36120
|
this.closeElement();
|
|
36016
36121
|
}
|
|
36017
36122
|
}
|
|
@@ -36029,9 +36134,9 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
36029
36134
|
this.backpatchMap.clear();
|
|
36030
36135
|
if (patches.length > 0) {
|
|
36031
36136
|
this.isBackpatchExecutorEmitted = true;
|
|
36032
|
-
const scriptAttrs =
|
|
36137
|
+
const scriptAttrs = { type: ELEMENT_BACKPATCH_DATA };
|
|
36033
36138
|
if (this.renderOptions.serverData?.nonce) {
|
|
36034
|
-
scriptAttrs
|
|
36139
|
+
scriptAttrs["nonce"] = this.renderOptions.serverData.nonce;
|
|
36035
36140
|
}
|
|
36036
36141
|
this.openElement("script", null, scriptAttrs);
|
|
36037
36142
|
this.write(JSON.stringify(patches));
|
|
@@ -36042,12 +36147,12 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
36042
36147
|
if (!this.isBackpatchExecutorEmitted) {
|
|
36043
36148
|
return;
|
|
36044
36149
|
}
|
|
36045
|
-
const scriptAttrs =
|
|
36150
|
+
const scriptAttrs = { type: "text/javascript" };
|
|
36046
36151
|
if (this.renderOptions.serverData?.nonce) {
|
|
36047
|
-
scriptAttrs
|
|
36152
|
+
scriptAttrs["nonce"] = this.renderOptions.serverData.nonce;
|
|
36048
36153
|
}
|
|
36049
36154
|
this.openElement("script", null, scriptAttrs);
|
|
36050
|
-
const backpatchScript = getQwikBackpatchExecutorScript({ debug:
|
|
36155
|
+
const backpatchScript = getQwikBackpatchExecutorScript({ debug: isDev27 });
|
|
36051
36156
|
this.write(backpatchScript);
|
|
36052
36157
|
this.closeElement();
|
|
36053
36158
|
}
|
|
@@ -36061,16 +36166,20 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
36061
36166
|
if (this.qlInclude === 0 /* Module */) {
|
|
36062
36167
|
this.qlInclude = 2 /* Done */;
|
|
36063
36168
|
const qwikLoaderBundle = this.$buildBase$ + this.resolvedManifest.manifest.qwikLoader;
|
|
36064
|
-
const linkAttrs =
|
|
36169
|
+
const linkAttrs = { rel: "modulepreload", href: qwikLoaderBundle };
|
|
36065
36170
|
const nonce = this.renderOptions.serverData?.nonce;
|
|
36066
36171
|
if (nonce) {
|
|
36067
|
-
linkAttrs
|
|
36172
|
+
linkAttrs["nonce"] = nonce;
|
|
36068
36173
|
}
|
|
36069
36174
|
this.openElement("link", null, linkAttrs);
|
|
36070
36175
|
this.closeElement();
|
|
36071
|
-
const scriptAttrs =
|
|
36176
|
+
const scriptAttrs = {
|
|
36177
|
+
async: true,
|
|
36178
|
+
type: "module",
|
|
36179
|
+
src: qwikLoaderBundle
|
|
36180
|
+
};
|
|
36072
36181
|
if (nonce) {
|
|
36073
|
-
scriptAttrs
|
|
36182
|
+
scriptAttrs["nonce"] = nonce;
|
|
36074
36183
|
}
|
|
36075
36184
|
this.openElement("script", null, scriptAttrs);
|
|
36076
36185
|
this.closeElement();
|
|
@@ -36079,9 +36188,13 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
36079
36188
|
emitQwikLoaderInline() {
|
|
36080
36189
|
this.qlInclude = 2 /* Done */;
|
|
36081
36190
|
const qwikLoaderScript = getQwikLoaderScript({ debug: this.renderOptions.debug });
|
|
36082
|
-
const scriptAttrs =
|
|
36191
|
+
const scriptAttrs = {
|
|
36192
|
+
id: "qwikloader",
|
|
36193
|
+
async: true,
|
|
36194
|
+
type: "module"
|
|
36195
|
+
};
|
|
36083
36196
|
if (this.renderOptions.serverData?.nonce) {
|
|
36084
|
-
scriptAttrs
|
|
36197
|
+
scriptAttrs["nonce"] = this.renderOptions.serverData.nonce;
|
|
36085
36198
|
}
|
|
36086
36199
|
this.openElement("script", null, scriptAttrs);
|
|
36087
36200
|
this.write(qwikLoaderScript);
|
|
@@ -36097,15 +36210,15 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
36097
36210
|
}
|
|
36098
36211
|
emitQwikEvents(eventNames) {
|
|
36099
36212
|
if (eventNames.length > 0) {
|
|
36100
|
-
const scriptAttrs =
|
|
36213
|
+
const scriptAttrs = {};
|
|
36101
36214
|
const nonce = this.renderOptions.serverData?.nonce;
|
|
36102
36215
|
if (nonce) {
|
|
36103
|
-
scriptAttrs
|
|
36216
|
+
scriptAttrs["nonce"] = nonce;
|
|
36104
36217
|
}
|
|
36105
36218
|
this.openElement("script", null, scriptAttrs);
|
|
36106
36219
|
this.write(`(window._qwikEv||(window._qwikEv=[])).push(`);
|
|
36107
|
-
this.writeArray(eventNames,
|
|
36108
|
-
this.write(
|
|
36220
|
+
this.writeArray(eventNames, COMMA);
|
|
36221
|
+
this.write(PAREN_CLOSE);
|
|
36109
36222
|
this.closeElement();
|
|
36110
36223
|
}
|
|
36111
36224
|
}
|
|
@@ -36137,7 +36250,7 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
36137
36250
|
}
|
|
36138
36251
|
createAndPushFrame(elementName, depthFirstElementIdx, currentFile) {
|
|
36139
36252
|
let tagNesting = 10 /* ANYTHING */;
|
|
36140
|
-
if (
|
|
36253
|
+
if (isDev27) {
|
|
36141
36254
|
if (!this.currentElementFrame) {
|
|
36142
36255
|
tagNesting = initialTag(elementName);
|
|
36143
36256
|
} else {
|
|
@@ -36183,7 +36296,7 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
36183
36296
|
elementName,
|
|
36184
36297
|
depthFirstElementIdx,
|
|
36185
36298
|
vNodeData: [0 /* NONE */],
|
|
36186
|
-
currentFile:
|
|
36299
|
+
currentFile: isDev27 ? currentFile || null : null
|
|
36187
36300
|
};
|
|
36188
36301
|
this.currentElementFrame = frame;
|
|
36189
36302
|
this.vNodeDatas.push(frame.vNodeData);
|
|
@@ -36207,88 +36320,88 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
36207
36320
|
this.write(element);
|
|
36208
36321
|
}
|
|
36209
36322
|
}
|
|
36210
|
-
writeAttrs(tag, attrs, isConst, currentFile) {
|
|
36323
|
+
writeAttrs(tag, attrs, isConst, styleScopedId, currentFile) {
|
|
36211
36324
|
let innerHTML = void 0;
|
|
36212
|
-
|
|
36213
|
-
|
|
36214
|
-
|
|
36215
|
-
|
|
36216
|
-
|
|
36217
|
-
|
|
36218
|
-
if (isDev26) {
|
|
36219
|
-
throw qError(32 /* unsafeAttr */, [key]);
|
|
36220
|
-
}
|
|
36221
|
-
continue;
|
|
36222
|
-
}
|
|
36223
|
-
if (key === "class" && Array.isArray(value)) {
|
|
36224
|
-
const [signalValue, styleId] = value;
|
|
36225
|
-
value = signalValue;
|
|
36226
|
-
styleScopedId = styleId;
|
|
36325
|
+
let isLoopElement = null;
|
|
36326
|
+
for (let key in attrs) {
|
|
36327
|
+
let value = attrs[key];
|
|
36328
|
+
if (isSSRUnsafeAttr(key)) {
|
|
36329
|
+
if (isDev27) {
|
|
36330
|
+
throw qError(32 /* unsafeAttr */, [key]);
|
|
36227
36331
|
}
|
|
36228
|
-
|
|
36229
|
-
|
|
36230
|
-
|
|
36231
|
-
|
|
36232
|
-
|
|
36233
|
-
} else if (typeof value === "function") {
|
|
36234
|
-
value(new DomRef(lastNode));
|
|
36235
|
-
continue;
|
|
36236
|
-
} else if (value == null) {
|
|
36237
|
-
continue;
|
|
36238
|
-
} else {
|
|
36239
|
-
throw qError(15 /* invalidRefValue */, [currentFile]);
|
|
36240
|
-
}
|
|
36332
|
+
continue;
|
|
36333
|
+
}
|
|
36334
|
+
if (isHtmlAttributeAnEventName(key)) {
|
|
36335
|
+
if (isLoopElement === null) {
|
|
36336
|
+
isLoopElement = attributesContainsIterationProp(attrs);
|
|
36241
36337
|
}
|
|
36338
|
+
value = _setEvent(this.serializationCtx, key, value, isLoopElement);
|
|
36339
|
+
} else if (key === "ref") {
|
|
36340
|
+
const lastNode = this.getOrCreateLastNode();
|
|
36242
36341
|
if (isSignal3(value)) {
|
|
36243
|
-
|
|
36244
|
-
const signalData = new SubscriptionData2({
|
|
36245
|
-
$scopedStyleIdPrefix$: styleScopedId,
|
|
36246
|
-
$isConst$: isConst
|
|
36247
|
-
});
|
|
36248
|
-
const signal = value;
|
|
36249
|
-
value = retryOnPromise(
|
|
36250
|
-
() => this.trackSignalValue(signal, lastNode, key, signalData)
|
|
36251
|
-
);
|
|
36252
|
-
}
|
|
36253
|
-
if (isPromise(value)) {
|
|
36254
|
-
const lastNode = this.getOrCreateLastNode();
|
|
36255
|
-
this.addPromiseAttribute(value);
|
|
36256
|
-
value.then((resolvedValue) => {
|
|
36257
|
-
this.addBackpatchEntry(lastNode.id, key, resolvedValue);
|
|
36258
|
-
});
|
|
36342
|
+
value.$untrackedValue$ = new DomRef(lastNode);
|
|
36259
36343
|
continue;
|
|
36344
|
+
} else if (typeof value === "function") {
|
|
36345
|
+
value(new DomRef(lastNode));
|
|
36346
|
+
continue;
|
|
36347
|
+
} else if (value == null) {
|
|
36348
|
+
continue;
|
|
36349
|
+
} else {
|
|
36350
|
+
throw qError(15 /* invalidRefValue */, [currentFile]);
|
|
36260
36351
|
}
|
|
36261
|
-
|
|
36262
|
-
|
|
36263
|
-
|
|
36264
|
-
|
|
36265
|
-
|
|
36266
|
-
|
|
36267
|
-
|
|
36268
|
-
|
|
36269
|
-
|
|
36270
|
-
|
|
36271
|
-
|
|
36272
|
-
|
|
36273
|
-
|
|
36274
|
-
|
|
36275
|
-
|
|
36276
|
-
|
|
36277
|
-
|
|
36278
|
-
|
|
36352
|
+
} else if (key === ITERATION_ITEM_SINGLE || key === ITERATION_ITEM_MULTI) {
|
|
36353
|
+
value = this.serializationCtx.$addRoot$(value);
|
|
36354
|
+
} else if (isSignal3(value)) {
|
|
36355
|
+
const lastNode = this.getOrCreateLastNode();
|
|
36356
|
+
const signalData = new SubscriptionData2({
|
|
36357
|
+
$scopedStyleIdPrefix$: styleScopedId,
|
|
36358
|
+
$isConst$: isConst
|
|
36359
|
+
});
|
|
36360
|
+
const signal = value;
|
|
36361
|
+
value = retryOnPromise(
|
|
36362
|
+
() => this.trackSignalValue(signal, lastNode, key, signalData)
|
|
36363
|
+
);
|
|
36364
|
+
}
|
|
36365
|
+
if (isPromise(value)) {
|
|
36366
|
+
const lastNode = this.getOrCreateLastNode();
|
|
36367
|
+
this.addPromiseAttribute(value);
|
|
36368
|
+
value.then((resolvedValue) => {
|
|
36369
|
+
this.addBackpatchEntry(lastNode.id, key, resolvedValue);
|
|
36370
|
+
});
|
|
36371
|
+
continue;
|
|
36372
|
+
}
|
|
36373
|
+
if (key === dangerouslySetInnerHTML) {
|
|
36374
|
+
if (value) {
|
|
36375
|
+
innerHTML = String(value);
|
|
36279
36376
|
key = QContainerAttr;
|
|
36280
|
-
value = "
|
|
36377
|
+
value = "html" /* HTML */;
|
|
36378
|
+
}
|
|
36379
|
+
if (tag === "style") {
|
|
36380
|
+
continue;
|
|
36281
36381
|
}
|
|
36282
|
-
|
|
36283
|
-
|
|
36284
|
-
|
|
36285
|
-
|
|
36286
|
-
|
|
36287
|
-
|
|
36288
|
-
|
|
36289
|
-
this.write(strValue);
|
|
36290
|
-
this.write('"');
|
|
36382
|
+
} else if (isPreventDefault(key)) {
|
|
36383
|
+
addPreventDefaultEventToSerializationContext(this.serializationCtx, key);
|
|
36384
|
+
}
|
|
36385
|
+
if (tag === "textarea" && key === "value") {
|
|
36386
|
+
if (value && typeof value !== "string") {
|
|
36387
|
+
if (isDev27) {
|
|
36388
|
+
throw qError(23 /* wrongTextareaValue */, [currentFile, value]);
|
|
36291
36389
|
}
|
|
36390
|
+
continue;
|
|
36391
|
+
}
|
|
36392
|
+
innerHTML = escapeHTML(value || "");
|
|
36393
|
+
key = QContainerAttr;
|
|
36394
|
+
value = "text" /* TEXT */;
|
|
36395
|
+
}
|
|
36396
|
+
const serializedValue = serializeAttribute(key, value, styleScopedId);
|
|
36397
|
+
if (serializedValue != null && serializedValue !== false) {
|
|
36398
|
+
this.write(SPACE);
|
|
36399
|
+
this.write(key);
|
|
36400
|
+
if (serializedValue !== true) {
|
|
36401
|
+
this.write(ATTR_EQUALS_QUOTE);
|
|
36402
|
+
const strValue = escapeHTML(String(serializedValue));
|
|
36403
|
+
this.write(strValue);
|
|
36404
|
+
this.write(QUOTE);
|
|
36292
36405
|
}
|
|
36293
36406
|
}
|
|
36294
36407
|
}
|
|
@@ -36307,15 +36420,13 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
36307
36420
|
};
|
|
36308
36421
|
var isQwikStyleElement = (tag, attrs) => {
|
|
36309
36422
|
if (tag === "style" && attrs != null) {
|
|
36310
|
-
|
|
36311
|
-
const attr = attrs[i];
|
|
36312
|
-
if (attr === QStyle || attr === QScopedStyle) {
|
|
36313
|
-
return true;
|
|
36314
|
-
}
|
|
36315
|
-
}
|
|
36423
|
+
return Object.prototype.hasOwnProperty.call(attrs, QStyle) || Object.prototype.hasOwnProperty.call(attrs, QScopedStyle);
|
|
36316
36424
|
}
|
|
36317
36425
|
return false;
|
|
36318
36426
|
};
|
|
36427
|
+
var attributesContainsIterationProp = (attrs) => {
|
|
36428
|
+
return Object.prototype.hasOwnProperty.call(attrs, ITERATION_ITEM_SINGLE) || Object.prototype.hasOwnProperty.call(attrs, ITERATION_ITEM_MULTI);
|
|
36429
|
+
};
|
|
36319
36430
|
function newTagError(text) {
|
|
36320
36431
|
return qError(12 /* tagError */, [text]);
|
|
36321
36432
|
}
|
|
@@ -36334,9 +36445,125 @@ function isSSRUnsafeAttr(name) {
|
|
|
36334
36445
|
function hash2() {
|
|
36335
36446
|
return Math.random().toString(36).slice(2);
|
|
36336
36447
|
}
|
|
36448
|
+
function addPreventDefaultEventToSerializationContext(serializationCtx, key) {
|
|
36449
|
+
const eventName = "e" + key.substring(14);
|
|
36450
|
+
if (eventName) {
|
|
36451
|
+
serializationCtx.$eventNames$.add(eventName);
|
|
36452
|
+
}
|
|
36453
|
+
}
|
|
36337
36454
|
|
|
36338
36455
|
// packages/qwik/src/server/ssr-render.ts
|
|
36339
36456
|
import { manifest as builtManifest } from "@qwik-client-manifest";
|
|
36457
|
+
|
|
36458
|
+
// packages/qwik/src/server/ssr-stream-handler.ts
|
|
36459
|
+
var StreamHandler = class {
|
|
36460
|
+
constructor(opts, timing) {
|
|
36461
|
+
this.opts = opts;
|
|
36462
|
+
this.timing = timing;
|
|
36463
|
+
__publicField(this, "bufferSize", 0);
|
|
36464
|
+
__publicField(this, "buffer", "");
|
|
36465
|
+
__publicField(this, "networkFlushes", 0);
|
|
36466
|
+
__publicField(this, "inOrderStreaming");
|
|
36467
|
+
__publicField(this, "streamBlockDepth", 0);
|
|
36468
|
+
__publicField(this, "streamBlockBuffer", "");
|
|
36469
|
+
__publicField(this, "streamBlockBufferSize", 0);
|
|
36470
|
+
__publicField(this, "nativeStream");
|
|
36471
|
+
__publicField(this, "firstFlushTimer", createTimer());
|
|
36472
|
+
__publicField(this, "stream");
|
|
36473
|
+
this.inOrderStreaming = opts.streaming?.inOrder ?? {
|
|
36474
|
+
strategy: "auto",
|
|
36475
|
+
maximumInitialChunk: 2e4,
|
|
36476
|
+
maximumChunk: 1e4
|
|
36477
|
+
};
|
|
36478
|
+
this.nativeStream = opts.stream;
|
|
36479
|
+
this.stream = this.setupStreamWriter();
|
|
36480
|
+
}
|
|
36481
|
+
setupStreamWriter() {
|
|
36482
|
+
const handler = this;
|
|
36483
|
+
let stream;
|
|
36484
|
+
switch (this.inOrderStreaming.strategy) {
|
|
36485
|
+
case "disabled":
|
|
36486
|
+
stream = {
|
|
36487
|
+
write(chunk) {
|
|
36488
|
+
if (chunk === void 0 || chunk === null) {
|
|
36489
|
+
return;
|
|
36490
|
+
}
|
|
36491
|
+
handler.enqueue(chunk);
|
|
36492
|
+
}
|
|
36493
|
+
};
|
|
36494
|
+
break;
|
|
36495
|
+
case "direct": {
|
|
36496
|
+
const originalStream = this.nativeStream;
|
|
36497
|
+
stream = {
|
|
36498
|
+
write(chunk) {
|
|
36499
|
+
if (chunk === void 0 || chunk === null) {
|
|
36500
|
+
return;
|
|
36501
|
+
}
|
|
36502
|
+
originalStream.write(chunk);
|
|
36503
|
+
}
|
|
36504
|
+
};
|
|
36505
|
+
break;
|
|
36506
|
+
}
|
|
36507
|
+
default:
|
|
36508
|
+
case "auto": {
|
|
36509
|
+
const minimumChunkSize = this.inOrderStreaming.maximumChunk ?? 0;
|
|
36510
|
+
const initialChunkSize = this.inOrderStreaming.maximumInitialChunk ?? 0;
|
|
36511
|
+
stream = {
|
|
36512
|
+
write(chunk) {
|
|
36513
|
+
if (chunk === void 0 || chunk === null) {
|
|
36514
|
+
return;
|
|
36515
|
+
}
|
|
36516
|
+
handler.enqueue(chunk);
|
|
36517
|
+
if (handler.streamBlockDepth === 0) {
|
|
36518
|
+
const maxBufferSize = handler.networkFlushes === 0 ? initialChunkSize : minimumChunkSize;
|
|
36519
|
+
if (handler.bufferSize >= maxBufferSize) {
|
|
36520
|
+
handler.flush();
|
|
36521
|
+
}
|
|
36522
|
+
}
|
|
36523
|
+
}
|
|
36524
|
+
};
|
|
36525
|
+
break;
|
|
36526
|
+
}
|
|
36527
|
+
}
|
|
36528
|
+
return stream;
|
|
36529
|
+
}
|
|
36530
|
+
enqueue(chunk) {
|
|
36531
|
+
const len = chunk.length;
|
|
36532
|
+
if (this.streamBlockDepth > 0) {
|
|
36533
|
+
this.streamBlockBuffer += chunk;
|
|
36534
|
+
this.streamBlockBufferSize += len;
|
|
36535
|
+
} else {
|
|
36536
|
+
this.bufferSize += len;
|
|
36537
|
+
this.buffer += chunk;
|
|
36538
|
+
}
|
|
36539
|
+
}
|
|
36540
|
+
flush() {
|
|
36541
|
+
if (this.buffer) {
|
|
36542
|
+
this.nativeStream.write(this.buffer);
|
|
36543
|
+
this.buffer = "";
|
|
36544
|
+
this.bufferSize = 0;
|
|
36545
|
+
this.networkFlushes++;
|
|
36546
|
+
if (this.networkFlushes === 1) {
|
|
36547
|
+
this.timing.firstFlush = this.firstFlushTimer();
|
|
36548
|
+
}
|
|
36549
|
+
}
|
|
36550
|
+
}
|
|
36551
|
+
streamBlockStart() {
|
|
36552
|
+
this.streamBlockDepth++;
|
|
36553
|
+
}
|
|
36554
|
+
streamBlockEnd() {
|
|
36555
|
+
this.streamBlockDepth--;
|
|
36556
|
+
if (this.streamBlockDepth === 0 && this.streamBlockBuffer) {
|
|
36557
|
+
this.buffer += this.streamBlockBuffer;
|
|
36558
|
+
this.bufferSize += this.streamBlockBufferSize;
|
|
36559
|
+
this.streamBlockBuffer = "";
|
|
36560
|
+
this.streamBlockBufferSize = 0;
|
|
36561
|
+
this.flush();
|
|
36562
|
+
}
|
|
36563
|
+
}
|
|
36564
|
+
};
|
|
36565
|
+
|
|
36566
|
+
// packages/qwik/src/server/ssr-render.ts
|
|
36340
36567
|
var renderToString = async (jsx2, opts = {}) => {
|
|
36341
36568
|
const chunks = [];
|
|
36342
36569
|
const stream = {
|
|
@@ -36363,11 +36590,12 @@ var renderToStream = async (jsx2, opts) => {
|
|
|
36363
36590
|
const buildBase = getBuildBase(opts);
|
|
36364
36591
|
const resolvedManifest = resolveManifest(opts.manifest);
|
|
36365
36592
|
const locale = typeof opts.locale === "function" ? opts.locale(opts) : opts.serverData?.locale || opts.locale || opts.containerAttributes?.locale || "";
|
|
36366
|
-
const
|
|
36593
|
+
const streamHandler = new StreamHandler(opts, timing);
|
|
36367
36594
|
const ssrContainer = ssrCreateContainer({
|
|
36368
36595
|
tagName: containerTagName,
|
|
36369
36596
|
locale,
|
|
36370
|
-
writer: stream,
|
|
36597
|
+
writer: streamHandler.stream,
|
|
36598
|
+
streamHandler,
|
|
36371
36599
|
timing,
|
|
36372
36600
|
buildBase,
|
|
36373
36601
|
resolvedManifest,
|
|
@@ -36376,11 +36604,9 @@ var renderToStream = async (jsx2, opts) => {
|
|
|
36376
36604
|
await setServerPlatform(opts, resolvedManifest);
|
|
36377
36605
|
await ssrContainer.render(jsx2);
|
|
36378
36606
|
await ssrContainer.$renderPromise$;
|
|
36379
|
-
flush();
|
|
36380
|
-
const snapshotResult = getSnapshotResult(ssrContainer);
|
|
36607
|
+
streamHandler.flush();
|
|
36381
36608
|
const result2 = {
|
|
36382
|
-
|
|
36383
|
-
flushes: networkFlushes,
|
|
36609
|
+
flushes: streamHandler.networkFlushes,
|
|
36384
36610
|
manifest: resolvedManifest?.manifest,
|
|
36385
36611
|
size: ssrContainer.size,
|
|
36386
36612
|
isStatic: false,
|
|
@@ -36388,110 +36614,6 @@ var renderToStream = async (jsx2, opts) => {
|
|
|
36388
36614
|
};
|
|
36389
36615
|
return result2;
|
|
36390
36616
|
};
|
|
36391
|
-
function getSnapshotResult(ssrContainer) {
|
|
36392
|
-
const hasListeners = !ssrContainer.isStatic();
|
|
36393
|
-
const canRender = false;
|
|
36394
|
-
return hasListeners ? {
|
|
36395
|
-
funcs: Array.from(ssrContainer.serializationCtx.$syncFns$),
|
|
36396
|
-
mode: canRender ? "render" : "listeners",
|
|
36397
|
-
qrls: Array.from(ssrContainer.serializationCtx.$eventQrls$),
|
|
36398
|
-
resources: Array.from(ssrContainer.serializationCtx.$resources$)
|
|
36399
|
-
} : {
|
|
36400
|
-
funcs: [],
|
|
36401
|
-
mode: "static",
|
|
36402
|
-
qrls: [],
|
|
36403
|
-
resources: Array.from(ssrContainer.serializationCtx.$resources$)
|
|
36404
|
-
};
|
|
36405
|
-
}
|
|
36406
|
-
function handleStreaming(opts, timing) {
|
|
36407
|
-
const firstFlushTimer = createTimer();
|
|
36408
|
-
let stream = opts.stream;
|
|
36409
|
-
let bufferSize = 0;
|
|
36410
|
-
let buffer = "";
|
|
36411
|
-
let networkFlushes = 0;
|
|
36412
|
-
const inOrderStreaming = opts.streaming?.inOrder ?? {
|
|
36413
|
-
strategy: "auto",
|
|
36414
|
-
maximumInitialChunk: 2e4,
|
|
36415
|
-
maximumChunk: 1e4
|
|
36416
|
-
};
|
|
36417
|
-
const nativeStream = stream;
|
|
36418
|
-
function flush() {
|
|
36419
|
-
if (buffer) {
|
|
36420
|
-
nativeStream.write(buffer);
|
|
36421
|
-
buffer = "";
|
|
36422
|
-
bufferSize = 0;
|
|
36423
|
-
networkFlushes++;
|
|
36424
|
-
if (networkFlushes === 1) {
|
|
36425
|
-
timing.firstFlush = firstFlushTimer();
|
|
36426
|
-
}
|
|
36427
|
-
}
|
|
36428
|
-
}
|
|
36429
|
-
function enqueue(chunk) {
|
|
36430
|
-
const len = chunk.length;
|
|
36431
|
-
bufferSize += len;
|
|
36432
|
-
buffer += chunk;
|
|
36433
|
-
}
|
|
36434
|
-
switch (inOrderStreaming.strategy) {
|
|
36435
|
-
case "disabled":
|
|
36436
|
-
stream = {
|
|
36437
|
-
write(chunk) {
|
|
36438
|
-
if (shouldSkipChunk(chunk)) {
|
|
36439
|
-
return;
|
|
36440
|
-
}
|
|
36441
|
-
enqueue(chunk);
|
|
36442
|
-
}
|
|
36443
|
-
};
|
|
36444
|
-
break;
|
|
36445
|
-
case "direct":
|
|
36446
|
-
stream = {
|
|
36447
|
-
write(chunk) {
|
|
36448
|
-
if (shouldSkipChunk(chunk)) {
|
|
36449
|
-
return;
|
|
36450
|
-
}
|
|
36451
|
-
nativeStream.write(chunk);
|
|
36452
|
-
}
|
|
36453
|
-
};
|
|
36454
|
-
break;
|
|
36455
|
-
case "auto":
|
|
36456
|
-
let openedSSRStreamBlocks = 0;
|
|
36457
|
-
let forceFlush = false;
|
|
36458
|
-
const minimumChunkSize = inOrderStreaming.maximumChunk ?? 0;
|
|
36459
|
-
const initialChunkSize = inOrderStreaming.maximumInitialChunk ?? 0;
|
|
36460
|
-
stream = {
|
|
36461
|
-
write(chunk) {
|
|
36462
|
-
if (chunk === void 0 || chunk === null) {
|
|
36463
|
-
return;
|
|
36464
|
-
}
|
|
36465
|
-
if (chunk === "<!--" + FLUSH_COMMENT + "-->") {
|
|
36466
|
-
forceFlush = true;
|
|
36467
|
-
} else if (chunk === "<!--" + STREAM_BLOCK_START_COMMENT + "-->") {
|
|
36468
|
-
openedSSRStreamBlocks++;
|
|
36469
|
-
} else if (chunk === "<!--" + STREAM_BLOCK_END_COMMENT + "-->") {
|
|
36470
|
-
openedSSRStreamBlocks--;
|
|
36471
|
-
if (openedSSRStreamBlocks === 0) {
|
|
36472
|
-
forceFlush = true;
|
|
36473
|
-
}
|
|
36474
|
-
} else {
|
|
36475
|
-
enqueue(chunk);
|
|
36476
|
-
}
|
|
36477
|
-
const maxBufferSize = networkFlushes === 0 ? initialChunkSize : minimumChunkSize;
|
|
36478
|
-
if (openedSSRStreamBlocks === 0 && (forceFlush || bufferSize >= maxBufferSize)) {
|
|
36479
|
-
forceFlush = false;
|
|
36480
|
-
flush();
|
|
36481
|
-
}
|
|
36482
|
-
}
|
|
36483
|
-
};
|
|
36484
|
-
break;
|
|
36485
|
-
}
|
|
36486
|
-
return {
|
|
36487
|
-
stream,
|
|
36488
|
-
flush,
|
|
36489
|
-
networkFlushes
|
|
36490
|
-
};
|
|
36491
|
-
}
|
|
36492
|
-
function shouldSkipChunk(chunk) {
|
|
36493
|
-
return chunk === void 0 || chunk === null || chunk === "<!--" + FLUSH_COMMENT + "-->" || chunk === "<!--" + STREAM_BLOCK_START_COMMENT + "-->" || chunk === "<!--" + STREAM_BLOCK_END_COMMENT + "-->";
|
|
36494
|
-
}
|
|
36495
36617
|
function resolveManifest(manifest) {
|
|
36496
36618
|
const mergedManifest = manifest ? { ...builtManifest, ...manifest } : builtManifest;
|
|
36497
36619
|
if (!mergedManifest || "mapper" in mergedManifest) {
|
|
@@ -36633,7 +36755,7 @@ async function ssrRenderToDom(jsx2, opts = {}) {
|
|
|
36633
36755
|
}
|
|
36634
36756
|
function isQwikScript(node) {
|
|
36635
36757
|
const element = node.node;
|
|
36636
|
-
return vnode_getElementName(node) === "script" && (vnode_getProp(node, "type", null) === "qwik/state" || vnode_getProp(node, "type", null) === ELEMENT_BACKPATCH_DATA || vnode_getProp(node, "id", null) === "qwikloader" || element.getAttribute("type") === "qwik/state" || element.getAttribute("type") === ELEMENT_BACKPATCH_DATA || element.getAttribute("id") === "qwikloader");
|
|
36758
|
+
return vnode_getElementName(node) === "script" && (vnode_getProp(node, "type", null) === "qwik/state" || vnode_getProp(node, "type", null) === ELEMENT_BACKPATCH_DATA || vnode_getProp(node, "id", null) === "qwikloader" || element.getAttribute("type") === "qwik/state" || element.getAttribute("type") === ELEMENT_BACKPATCH_DATA || element.getAttribute("id") === "qwikloader" || element.innerHTML.includes("window._qwikEv"));
|
|
36637
36759
|
}
|
|
36638
36760
|
function vnode_moveToVirtual(parent, newChild, insertBefore) {
|
|
36639
36761
|
const journal = [];
|
|
@@ -36753,7 +36875,7 @@ export {
|
|
|
36753
36875
|
expectDOM,
|
|
36754
36876
|
getTestPlatform,
|
|
36755
36877
|
ssrRenderToDom,
|
|
36756
|
-
trigger,
|
|
36878
|
+
trigger2 as trigger,
|
|
36757
36879
|
vnode_fromJSX,
|
|
36758
36880
|
waitForDrain,
|
|
36759
36881
|
walkJSX
|