@qwik.dev/core 2.0.0-alpha.9 → 2.0.0-beta.10
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.darwin-x64.node +0 -0
- package/bindings/qwik.linux-x64-gnu.node +0 -0
- package/bindings/qwik.wasm.cjs +27 -27
- package/bindings/qwik.wasm.mjs +27 -27
- package/bindings/qwik.win32-x64-msvc.node +0 -0
- package/bindings/qwik_wasm_bg.wasm +0 -0
- package/dist/backpatch/index.cjs +6 -0
- package/dist/backpatch/index.d.ts +2 -0
- package/dist/backpatch/index.mjs +5 -0
- package/dist/{prefetch → backpatch}/package.json +2 -2
- package/dist/backpatch-executor.debug.js +34 -0
- package/dist/backpatch-executor.js +1 -0
- package/dist/build/index.cjs +3 -3
- package/dist/build/index.d.ts +22 -22
- package/dist/build/package.json +1 -1
- package/dist/cli.cjs +3035 -767
- package/dist/core-internal.d.ts +4622 -4153
- package/dist/core.cjs +7327 -6169
- package/dist/core.cjs.map +1 -1
- package/dist/core.min.mjs +1 -1
- package/dist/core.mjs +7294 -6163
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.cjs +3209 -2612
- package/dist/core.prod.mjs +3932 -3294
- package/dist/insights/index.qwik.cjs +1 -4142
- package/dist/insights/index.qwik.mjs +63 -4133
- package/dist/insights/vite/index.cjs +1 -82
- package/dist/insights/vite/index.mjs +65 -37
- package/dist/insights/vite.d.ts +22 -0
- package/dist/{insights/insights.d.ts → insights.d.ts} +33 -22
- package/dist/loader/index.cjs +2 -2
- package/dist/loader/index.mjs +2 -2
- package/dist/loader/package.json +1 -1
- package/dist/optimizer.cjs +201 -3817
- package/dist/optimizer.d.ts +754 -707
- package/dist/optimizer.mjs +2605 -3628
- package/dist/preloader.cjs +266 -0
- package/dist/preloader.mjs +195 -0
- package/dist/qwikloader.debug.js +228 -222
- package/dist/qwikloader.js +1 -3
- package/dist/server.cjs +915 -621
- package/dist/server.d.ts +519 -402
- package/dist/server.mjs +900 -615
- package/dist/starters/adapters/aws-lambda/adapters/aws-lambda/vite.config.mts +1 -1
- package/dist/starters/adapters/aws-lambda/package.json +1 -1
- package/dist/starters/adapters/aws-lambda/serverless.yml +15 -0
- package/dist/starters/adapters/aws-lambda/src/entry_aws-lambda.tsx +2 -8
- package/dist/starters/adapters/azure-swa/adapters/azure-swa/vite.config.mts +1 -1
- package/dist/starters/adapters/azure-swa/package.json +1 -1
- package/dist/starters/adapters/azure-swa/public/staticwebapp.config.json +7 -0
- package/dist/starters/adapters/azure-swa/src/entry.azure-swa.tsx +2 -4
- package/dist/starters/adapters/bun/adapters/bun/vite.config.mts +2 -2
- package/dist/starters/adapters/bun/package.json +1 -1
- package/dist/starters/adapters/bun/src/entry.bun.ts +3 -4
- package/dist/starters/adapters/cloud-run/adapters/cloud-run/vite.config.mts +1 -1
- package/dist/starters/adapters/cloud-run/package.json +1 -1
- package/dist/starters/adapters/cloud-run/src/entry.cloud-run.tsx +2 -6
- package/dist/starters/adapters/cloudflare-pages/adapters/cloudflare-pages/vite.config.mts +1 -1
- package/dist/starters/adapters/cloudflare-pages/package.json +1 -1
- package/dist/starters/adapters/cloudflare-pages/public/_headers +2 -0
- package/dist/starters/adapters/cloudflare-pages/src/entry.cloudflare-pages.tsx +2 -4
- package/dist/starters/adapters/deno/adapters/deno/vite.config.mts +1 -1
- package/dist/starters/adapters/deno/package.json +1 -1
- package/dist/starters/adapters/deno/src/entry.deno.ts +3 -4
- package/dist/starters/adapters/express/adapters/express/vite.config.mts +1 -1
- package/dist/starters/adapters/express/package.json +1 -1
- package/dist/starters/adapters/express/src/entry.express.tsx +6 -5
- package/dist/starters/adapters/fastify/adapters/fastify/vite.config.mts +1 -1
- package/dist/starters/adapters/fastify/package.json +1 -1
- package/dist/starters/adapters/fastify/src/entry.fastify.tsx +3 -2
- package/dist/starters/adapters/fastify/src/plugins/fastify-qwik.ts +10 -3
- package/dist/starters/adapters/firebase/adapters/firebase/vite.config.mts +1 -1
- package/dist/starters/adapters/firebase/firebase.json +12 -1
- package/dist/starters/adapters/firebase/functions/index.js +2 -3
- package/dist/starters/adapters/firebase/package.json +1 -1
- package/dist/starters/adapters/firebase/src/entry-firebase.tsx +2 -4
- package/dist/starters/adapters/netlify-edge/adapters/netlify-edge/vite.config.mts +1 -1
- package/dist/starters/adapters/netlify-edge/package.json +1 -1
- package/dist/starters/adapters/netlify-edge/public/_headers +2 -0
- package/dist/starters/adapters/netlify-edge/src/entry.netlify-edge.tsx +2 -4
- package/dist/starters/adapters/node-server/adapters/node-server/vite.config.mts +1 -1
- package/dist/starters/adapters/node-server/package.json +1 -1
- package/dist/starters/adapters/node-server/src/entry.node-server.tsx +3 -4
- package/dist/starters/adapters/ssg/README.md +9 -0
- package/dist/starters/adapters/{static/adapters/static → ssg/adapters/ssg}/vite.config.mts +2 -2
- package/dist/starters/adapters/ssg/package.json +19 -0
- package/dist/starters/adapters/vercel-edge/adapters/vercel-edge/vite.config.mts +1 -1
- package/dist/starters/adapters/vercel-edge/package.json +1 -1
- package/dist/starters/adapters/vercel-edge/src/entry.vercel-edge.tsx +2 -4
- package/dist/starters/adapters/vercel-edge/vercel.json +1 -1
- package/dist/starters/features/auth/package.json +1 -1
- package/dist/starters/features/bootstrap/src/routes/bootstrap/layout.tsx +0 -11
- package/dist/starters/features/csr/index.html +23 -0
- package/dist/starters/features/csr/package.json +29 -0
- package/dist/starters/features/csr/src/root.tsx +15 -0
- package/dist/starters/features/csr/vite.config.mts +13 -0
- package/dist/starters/features/localize/package.json +3 -3
- package/dist/starters/features/localize/src/entry.ssr.tsx +17 -23
- package/dist/starters/features/localize/src/routes/[locale]/i18n-utils.ts +1 -1
- package/dist/starters/features/pandacss/package.json +1 -1
- package/dist/starters/features/partytown/package.json +4 -4
- package/dist/starters/features/partytown/src/components/partytown/partytown.tsx +2 -2
- package/dist/starters/features/playwright/playwright-report/index.html +953 -911
- package/dist/starters/features/postcss/postcss.config.js +2 -2
- package/dist/starters/features/service-worker/package.json +13 -0
- package/dist/starters/features/service-worker/src/routes/service-worker.ts +14 -0
- package/dist/starters/features/styled-vanilla-extract/package.json +2 -1
- package/dist/starters/features/tailwind/package.json +4 -3
- package/dist/starters/features/tailwind/prettier.config.js +10 -0
- package/dist/starters/features/tailwind/src/global.css +1 -1
- package/dist/starters/features/tailwind-v3/package.json +1 -1
- package/dist/starters/features/tailwind-v3/prettier.config.js +10 -0
- package/dist/starters/features/tailwind-v3/tailwind.config.js +2 -2
- package/dist/testing/index.cjs +14313 -11732
- package/dist/testing/index.d.ts +1112 -141
- package/dist/testing/index.mjs +14225 -11661
- package/dist/testing/package.json +1 -1
- package/package.json +28 -14
- package/public.d.ts +5 -0
- package/server.d.ts +1 -0
- package/dist/insights/index.d.ts +0 -1
- package/dist/insights/vite/index.d.ts +0 -1
- package/dist/insights/vite/insights-plugin.d.ts +0 -10
- package/dist/prefetch/index.cjs +0 -4
- package/dist/prefetch/index.d.ts +0 -2
- package/dist/prefetch/index.mjs +0 -3
- package/dist/qwik-prefetch.debug.js +0 -244
- package/dist/qwik-prefetch.js +0 -1
- package/dist/starters/adapters/static/README.md +0 -5
- package/dist/starters/adapters/static/package.json +0 -19
- package/dist/starters/features/tailwind/.prettierrc.js +0 -3
package/dist/server.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* @qwik.dev/core/server 2.0.0-
|
|
3
|
+
* @qwik.dev/core/server 2.0.0-beta.10-dev+4669425
|
|
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
|
|
@@ -20,6 +20,7 @@ import { setPlatform as setPlatform2 } from "@qwik.dev/core";
|
|
|
20
20
|
|
|
21
21
|
// packages/qwik/src/server/platform.ts
|
|
22
22
|
import { setPlatform } from "@qwik.dev/core";
|
|
23
|
+
import { isDev as isDev3 } from "@qwik.dev/core/build";
|
|
23
24
|
|
|
24
25
|
// packages/qwik/src/core/shared/utils/qdev.ts
|
|
25
26
|
var qDev = globalThis.qDev !== false;
|
|
@@ -37,7 +38,7 @@ var throwErrorAndStop = (message, ...optionalParams) => {
|
|
|
37
38
|
throw error;
|
|
38
39
|
};
|
|
39
40
|
var logErrorAndStop = (message, ...optionalParams) => {
|
|
40
|
-
const err = createAndLogError(
|
|
41
|
+
const err = createAndLogError(qDev, message, ...optionalParams);
|
|
41
42
|
debugger;
|
|
42
43
|
return err;
|
|
43
44
|
};
|
|
@@ -80,15 +81,15 @@ var mapApp_findIndx = (array, key, start) => {
|
|
|
80
81
|
}
|
|
81
82
|
return bottom << 1 ^ -1;
|
|
82
83
|
};
|
|
83
|
-
var mapArray_set = (array, key, value, start) => {
|
|
84
|
+
var mapArray_set = (array, key, value, start, allowNullValue = false) => {
|
|
84
85
|
const indx = mapApp_findIndx(array, key, start);
|
|
85
86
|
if (indx >= 0) {
|
|
86
|
-
if (value == null) {
|
|
87
|
+
if (value == null && !allowNullValue) {
|
|
87
88
|
array.splice(indx, 2);
|
|
88
89
|
} else {
|
|
89
90
|
array[indx + 1] = value;
|
|
90
91
|
}
|
|
91
|
-
} else if (value != null) {
|
|
92
|
+
} else if (value != null || allowNullValue) {
|
|
92
93
|
array.splice(indx ^ -1, 0, key, value);
|
|
93
94
|
}
|
|
94
95
|
};
|
|
@@ -114,6 +115,17 @@ var mapArray_has = (array, key, start) => {
|
|
|
114
115
|
return mapApp_findIndx(array, key, start) >= 0;
|
|
115
116
|
};
|
|
116
117
|
|
|
118
|
+
// packages/qwik/src/core/shared/utils/types.ts
|
|
119
|
+
var isObject = (v) => {
|
|
120
|
+
return typeof v === "object" && v !== null;
|
|
121
|
+
};
|
|
122
|
+
var isArray = (v) => {
|
|
123
|
+
return Array.isArray(v);
|
|
124
|
+
};
|
|
125
|
+
var isString = (v) => {
|
|
126
|
+
return typeof v === "string";
|
|
127
|
+
};
|
|
128
|
+
|
|
117
129
|
// packages/qwik/src/core/shared/error/error.ts
|
|
118
130
|
var codeToText = (code, ...parts) => {
|
|
119
131
|
if (qDev) {
|
|
@@ -126,107 +138,75 @@ var codeToText = (code, ...parts) => {
|
|
|
126
138
|
// 2
|
|
127
139
|
"Only primitive and object literals can be serialized. {{0}}",
|
|
128
140
|
// 3
|
|
129
|
-
"",
|
|
130
|
-
// 4 unused
|
|
131
141
|
"You can render over a existing q:container. Skipping render().",
|
|
132
|
-
//
|
|
133
|
-
"",
|
|
134
|
-
// 6 unused
|
|
135
|
-
"",
|
|
136
|
-
// 7 unused
|
|
137
|
-
"",
|
|
138
|
-
// 8 unused
|
|
139
|
-
"",
|
|
140
|
-
// 9 unused
|
|
142
|
+
// 4
|
|
141
143
|
"QRL is not a function",
|
|
142
|
-
//
|
|
144
|
+
// 5
|
|
143
145
|
"Dynamic import not found",
|
|
144
|
-
//
|
|
146
|
+
// 6
|
|
145
147
|
"Unknown type argument",
|
|
146
|
-
//
|
|
148
|
+
// 7
|
|
147
149
|
`Actual value for useContext({{0}}) can not be found, make sure some ancestor component has set a value using useContextProvider(). In the browser make sure that the context was used during SSR so its state was serialized.`,
|
|
148
|
-
//
|
|
150
|
+
// 8
|
|
149
151
|
"Invoking 'use*()' method outside of invocation context.",
|
|
150
|
-
//
|
|
151
|
-
"",
|
|
152
|
-
// 15 unused
|
|
153
|
-
"",
|
|
154
|
-
// 16 unused
|
|
155
|
-
"",
|
|
156
|
-
// 17 unused
|
|
157
|
-
"",
|
|
158
|
-
// 18 unused
|
|
159
|
-
"",
|
|
160
|
-
// 19 unused
|
|
152
|
+
// 9
|
|
161
153
|
`Calling a 'use*()' method outside 'component$(() => { HERE })' is not allowed. 'use*()' methods provide hooks to the 'component$' state and lifecycle, ie 'use' hooks can only be called synchronously within the 'component$' function or another 'use' method.
|
|
162
154
|
See https://qwik.dev/docs/components/tasks/#use-method-rules`,
|
|
163
|
-
//
|
|
164
|
-
"",
|
|
165
|
-
// 21 unused
|
|
166
|
-
"",
|
|
167
|
-
// 22 unused
|
|
168
|
-
"",
|
|
169
|
-
// 23 unused
|
|
170
|
-
"",
|
|
171
|
-
// 24 unused
|
|
172
|
-
"",
|
|
173
|
-
// 25 unused
|
|
174
|
-
"",
|
|
175
|
-
// 26 unused
|
|
176
|
-
"",
|
|
177
|
-
// 27 unused
|
|
155
|
+
// 10
|
|
178
156
|
'The provided Context reference "{{0}}" is not a valid context created by createContextId()',
|
|
179
|
-
//
|
|
157
|
+
// 11
|
|
180
158
|
"SsrError(tag): {{0}}",
|
|
181
|
-
//
|
|
159
|
+
// 12
|
|
182
160
|
"QRLs can not be resolved because it does not have an attached container. This means that the QRL does not know where it belongs inside the DOM, so it cant dynamically import() from a relative path.",
|
|
183
|
-
//
|
|
161
|
+
// 13
|
|
184
162
|
"QRLs can not be dynamically resolved, because it does not have a chunk path",
|
|
185
|
-
//
|
|
163
|
+
// 14
|
|
186
164
|
"{{0}}\nThe JSX ref attribute must be a Signal",
|
|
187
|
-
//
|
|
165
|
+
// 15
|
|
188
166
|
"Serialization Error: Deserialization of data type {{0}} is not implemented",
|
|
189
|
-
//
|
|
167
|
+
// 16
|
|
190
168
|
"Serialization Error: Expected vnode for ref prop, but got {{0}}",
|
|
191
|
-
//
|
|
169
|
+
// 17
|
|
192
170
|
"Serialization Error: Cannot allocate data type {{0}}",
|
|
193
|
-
//
|
|
171
|
+
// 18
|
|
194
172
|
"Serialization Error: Missing root id for {{0}}",
|
|
195
|
-
//
|
|
173
|
+
// 19
|
|
196
174
|
"Serialization Error: Serialization of data type {{0}} is not implemented",
|
|
197
|
-
//
|
|
175
|
+
// 20
|
|
198
176
|
"Serialization Error: Unvisited {{0}}",
|
|
199
|
-
//
|
|
177
|
+
// 21
|
|
200
178
|
"Serialization Error: Missing QRL chunk for {{0}}",
|
|
201
|
-
//
|
|
179
|
+
// 22
|
|
202
180
|
"{{0}}\nThe value of the textarea must be a string found {{1}}",
|
|
203
|
-
//
|
|
181
|
+
// 23
|
|
204
182
|
"Unable to find q:container",
|
|
205
|
-
//
|
|
183
|
+
// 24
|
|
206
184
|
"Element must have 'q:container' attribute.",
|
|
207
|
-
//
|
|
185
|
+
// 25
|
|
208
186
|
"Unknown vnode type {{0}}.",
|
|
209
|
-
//
|
|
187
|
+
// 26
|
|
210
188
|
"Materialize error: missing element: {{0}} {{1}} {{2}}",
|
|
211
|
-
//
|
|
189
|
+
// 27
|
|
212
190
|
"Cannot coerce a Signal, use `.value` instead",
|
|
213
|
-
//
|
|
214
|
-
"
|
|
215
|
-
//
|
|
191
|
+
// 28
|
|
192
|
+
"useComputed$ QRL {{0}} {{1}} cannot return a Promise",
|
|
193
|
+
// 29
|
|
216
194
|
"ComputedSignal is read-only",
|
|
217
|
-
//
|
|
195
|
+
// 30
|
|
218
196
|
"WrappedSignal is read-only",
|
|
219
|
-
//
|
|
197
|
+
// 31
|
|
220
198
|
"Attribute value is unsafe for SSR",
|
|
221
|
-
//
|
|
222
|
-
"SerializerSymbol function returned rejected promise"
|
|
223
|
-
//
|
|
199
|
+
// 32
|
|
200
|
+
"SerializerSymbol function returned rejected promise",
|
|
201
|
+
// 33
|
|
202
|
+
"Serialization Error: Cannot serialize function: {{0}}"
|
|
203
|
+
// 34
|
|
224
204
|
];
|
|
225
205
|
let text = MAP[code] ?? "";
|
|
226
206
|
if (parts.length) {
|
|
227
207
|
text = text.replaceAll(/{{(\d+)}}/g, (_, index) => {
|
|
228
208
|
let v = parts[index];
|
|
229
|
-
if (v &&
|
|
209
|
+
if (v && isObject(v) && v.constructor === Object) {
|
|
230
210
|
v = JSON.stringify(v).slice(0, 50);
|
|
231
211
|
}
|
|
232
212
|
return v;
|
|
@@ -248,45 +228,6 @@ var SYNC_QRL = "<sync>";
|
|
|
248
228
|
|
|
249
229
|
// packages/qwik/src/core/shared/types.ts
|
|
250
230
|
var DEBUG_TYPE = "q:type";
|
|
251
|
-
var START = "\x1B[34m";
|
|
252
|
-
var END = "\x1B[0m";
|
|
253
|
-
var VirtualTypeName = {
|
|
254
|
-
["V" /* Virtual */]: (
|
|
255
|
-
/* ********* */
|
|
256
|
-
START + "Virtual" + END
|
|
257
|
-
),
|
|
258
|
-
//
|
|
259
|
-
["F" /* Fragment */]: (
|
|
260
|
-
/* ******** */
|
|
261
|
-
START + "Fragment" + END
|
|
262
|
-
),
|
|
263
|
-
//
|
|
264
|
-
["S" /* WrappedSignal */]: (
|
|
265
|
-
/* *** */
|
|
266
|
-
START + "Signal" + END
|
|
267
|
-
),
|
|
268
|
-
//
|
|
269
|
-
["A" /* Awaited */]: (
|
|
270
|
-
/* ********* */
|
|
271
|
-
START + "Awaited" + END
|
|
272
|
-
),
|
|
273
|
-
//
|
|
274
|
-
["C" /* Component */]: (
|
|
275
|
-
/* ******* */
|
|
276
|
-
START + "Component" + END
|
|
277
|
-
),
|
|
278
|
-
//
|
|
279
|
-
["I" /* InlineComponent */]: (
|
|
280
|
-
/* * */
|
|
281
|
-
START + "InlineComponent" + END
|
|
282
|
-
),
|
|
283
|
-
//
|
|
284
|
-
["P" /* Projection */]: (
|
|
285
|
-
/* ****** */
|
|
286
|
-
START + "Projection" + END
|
|
287
|
-
)
|
|
288
|
-
//
|
|
289
|
-
};
|
|
290
231
|
|
|
291
232
|
// packages/qwik/src/core/shared/utils/character-escaping.ts
|
|
292
233
|
function escapeHTML(html) {
|
|
@@ -350,6 +291,7 @@ var ELEMENT_KEY = "q:key";
|
|
|
350
291
|
var ELEMENT_PROPS = "q:props";
|
|
351
292
|
var ELEMENT_SEQ = "q:seq";
|
|
352
293
|
var ELEMENT_SEQ_IDX = "q:seqIdx";
|
|
294
|
+
var ELEMENT_BACKPATCH_DATA = "qwik/backpatch";
|
|
353
295
|
var NON_SERIALIZABLE_MARKER_PREFIX = ":";
|
|
354
296
|
var USE_ON_LOCAL = NON_SERIALIZABLE_MARKER_PREFIX + "on";
|
|
355
297
|
var USE_ON_LOCAL_SEQ_IDX = NON_SERIALIZABLE_MARKER_PREFIX + "onIdx";
|
|
@@ -361,6 +303,7 @@ var Q_PROPS_SEPARATOR = ":";
|
|
|
361
303
|
var dangerouslySetInnerHTML = "dangerouslySetInnerHTML";
|
|
362
304
|
|
|
363
305
|
// packages/qwik/src/core/shared/utils/promises.ts
|
|
306
|
+
import { isDev as isDev2, isServer } from "@qwik.dev/core/build";
|
|
364
307
|
var isPromise = (value) => {
|
|
365
308
|
return !!value && typeof value == "object" && typeof value.then === "function";
|
|
366
309
|
};
|
|
@@ -384,14 +327,6 @@ function isPreventDefault(key) {
|
|
|
384
327
|
return key.startsWith("preventdefault:");
|
|
385
328
|
}
|
|
386
329
|
|
|
387
|
-
// packages/qwik/src/core/shared/utils/types.ts
|
|
388
|
-
var isArray = (v) => {
|
|
389
|
-
return Array.isArray(v);
|
|
390
|
-
};
|
|
391
|
-
var isString = (v) => {
|
|
392
|
-
return typeof v === "string";
|
|
393
|
-
};
|
|
394
|
-
|
|
395
330
|
// packages/qwik/src/core/shared/utils/unitless_number.ts
|
|
396
331
|
var unitlessNumbers = /* @__PURE__ */ new Set([
|
|
397
332
|
"animationIterationCount",
|
|
@@ -818,21 +753,306 @@ var VNodeDataChar = {
|
|
|
818
753
|
)
|
|
819
754
|
};
|
|
820
755
|
|
|
821
|
-
// packages/qwik/src/
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
756
|
+
// packages/qwik/src/core/preloader/queue.ts
|
|
757
|
+
import { isBrowser as isBrowser3 } from "@qwik.dev/core/build";
|
|
758
|
+
|
|
759
|
+
// packages/qwik/src/core/preloader/bundle-graph.ts
|
|
760
|
+
import { isBrowser as isBrowser2 } from "@qwik.dev/core/build";
|
|
761
|
+
|
|
762
|
+
// packages/qwik/src/core/preloader/constants.ts
|
|
763
|
+
import { isBrowser } from "@qwik.dev/core/build";
|
|
764
|
+
var doc = isBrowser ? document : void 0;
|
|
765
|
+
var config = {
|
|
766
|
+
$DEBUG$: false,
|
|
767
|
+
$maxIdlePreloads$: 25,
|
|
768
|
+
$invPreloadProbability$: 0.65
|
|
769
|
+
};
|
|
770
|
+
var rel = isBrowser && doc.createElement("link").relList.supports("modulepreload") ? "modulePreload" : "preload";
|
|
771
|
+
var loadStart = Date.now();
|
|
772
|
+
var isJSRegex = /\.[mc]?js$/;
|
|
773
|
+
|
|
774
|
+
// packages/qwik/src/core/preloader/types.ts
|
|
775
|
+
var BundleImportState_None = 0;
|
|
776
|
+
var BundleImportState_Queued = 1;
|
|
777
|
+
var BundleImportState_Preload = 2;
|
|
778
|
+
var BundleImportState_Alias = 3;
|
|
779
|
+
var BundleImportState_Loaded = 4;
|
|
780
|
+
|
|
781
|
+
// packages/qwik/src/core/preloader/bundle-graph.ts
|
|
782
|
+
var base;
|
|
783
|
+
var graph;
|
|
784
|
+
var makeBundle = (name, deps) => {
|
|
785
|
+
return {
|
|
786
|
+
$name$: name,
|
|
787
|
+
$state$: isJSRegex.test(name) ? BundleImportState_None : BundleImportState_Alias,
|
|
788
|
+
$deps$: shouldResetFactor ? deps?.map((d) => ({ ...d, $factor$: 1 })) : deps,
|
|
789
|
+
$inverseProbability$: 1,
|
|
790
|
+
$createdTs$: Date.now(),
|
|
791
|
+
$waitedMs$: 0,
|
|
792
|
+
$loadedMs$: 0
|
|
793
|
+
};
|
|
794
|
+
};
|
|
795
|
+
var parseBundleGraph = (serialized) => {
|
|
796
|
+
const graph2 = /* @__PURE__ */ new Map();
|
|
797
|
+
let i = 0;
|
|
798
|
+
while (i < serialized.length) {
|
|
799
|
+
const name = serialized[i++];
|
|
800
|
+
const deps = [];
|
|
801
|
+
let idx;
|
|
802
|
+
let probability = 1;
|
|
803
|
+
while (idx = serialized[i], typeof idx === "number") {
|
|
804
|
+
if (idx < 0) {
|
|
805
|
+
probability = -idx / 10;
|
|
806
|
+
} else {
|
|
807
|
+
deps.push({
|
|
808
|
+
$name$: serialized[idx],
|
|
809
|
+
$importProbability$: probability,
|
|
810
|
+
$factor$: 1
|
|
811
|
+
});
|
|
812
|
+
}
|
|
813
|
+
i++;
|
|
814
|
+
}
|
|
815
|
+
graph2.set(name, deps);
|
|
825
816
|
}
|
|
826
|
-
return
|
|
817
|
+
return graph2;
|
|
818
|
+
};
|
|
819
|
+
var getBundle = (name) => {
|
|
820
|
+
let bundle = bundles.get(name);
|
|
821
|
+
if (!bundle) {
|
|
822
|
+
let deps;
|
|
823
|
+
if (graph) {
|
|
824
|
+
deps = graph.get(name);
|
|
825
|
+
if (!deps) {
|
|
826
|
+
return;
|
|
827
|
+
}
|
|
828
|
+
if (!deps.length) {
|
|
829
|
+
deps = void 0;
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
bundle = makeBundle(name, deps);
|
|
833
|
+
bundles.set(name, bundle);
|
|
834
|
+
}
|
|
835
|
+
return bundle;
|
|
836
|
+
};
|
|
837
|
+
var initPreloader = (serializedBundleGraph, opts) => {
|
|
838
|
+
if (opts) {
|
|
839
|
+
if ("debug" in opts) {
|
|
840
|
+
config.$DEBUG$ = !!opts.debug;
|
|
841
|
+
}
|
|
842
|
+
if (typeof opts.preloadProbability === "number") {
|
|
843
|
+
config.$invPreloadProbability$ = 1 - opts.preloadProbability;
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
if (base != null || !serializedBundleGraph) {
|
|
847
|
+
return;
|
|
848
|
+
}
|
|
849
|
+
base = "";
|
|
850
|
+
graph = parseBundleGraph(serializedBundleGraph);
|
|
851
|
+
};
|
|
852
|
+
|
|
853
|
+
// packages/qwik/src/core/preloader/queue.ts
|
|
854
|
+
var bundles = /* @__PURE__ */ new Map();
|
|
855
|
+
var shouldResetFactor;
|
|
856
|
+
var queueDirty;
|
|
857
|
+
var preloadCount = 0;
|
|
858
|
+
var queue = [];
|
|
859
|
+
var log = (...args) => {
|
|
860
|
+
console.log(
|
|
861
|
+
`Preloader ${Date.now() - loadStart}ms ${preloadCount}/${queue.length} queued>`,
|
|
862
|
+
...args
|
|
863
|
+
);
|
|
864
|
+
};
|
|
865
|
+
var resetQueue = () => {
|
|
866
|
+
bundles.clear();
|
|
867
|
+
queueDirty = false;
|
|
868
|
+
shouldResetFactor = true;
|
|
869
|
+
preloadCount = 0;
|
|
870
|
+
queue.length = 0;
|
|
871
|
+
};
|
|
872
|
+
var sortQueue = () => {
|
|
873
|
+
if (queueDirty) {
|
|
874
|
+
queue.sort((a, b) => a.$inverseProbability$ - b.$inverseProbability$);
|
|
875
|
+
queueDirty = false;
|
|
876
|
+
}
|
|
877
|
+
};
|
|
878
|
+
var getQueue = () => {
|
|
879
|
+
sortQueue();
|
|
880
|
+
let probability = 0.4;
|
|
881
|
+
const result = [];
|
|
882
|
+
for (const b of queue) {
|
|
883
|
+
const nextProbability = Math.round((1 - b.$inverseProbability$) * 10);
|
|
884
|
+
if (nextProbability !== probability) {
|
|
885
|
+
probability = nextProbability;
|
|
886
|
+
result.push(probability);
|
|
887
|
+
}
|
|
888
|
+
result.push(b.$name$);
|
|
889
|
+
}
|
|
890
|
+
return result;
|
|
891
|
+
};
|
|
892
|
+
var trigger = () => {
|
|
893
|
+
if (!queue.length) {
|
|
894
|
+
return;
|
|
895
|
+
}
|
|
896
|
+
sortQueue();
|
|
897
|
+
while (queue.length) {
|
|
898
|
+
const bundle = queue[0];
|
|
899
|
+
const inverseProbability = bundle.$inverseProbability$;
|
|
900
|
+
const probability = 1 - inverseProbability;
|
|
901
|
+
const allowedPreloads = graph ? config.$maxIdlePreloads$ : (
|
|
902
|
+
// While the graph is not available, we limit to 5 preloads
|
|
903
|
+
5
|
|
904
|
+
);
|
|
905
|
+
if (probability >= 0.99 || preloadCount < allowedPreloads) {
|
|
906
|
+
queue.shift();
|
|
907
|
+
preloadOne(bundle);
|
|
908
|
+
} else {
|
|
909
|
+
break;
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
if (config.$DEBUG$ && !queue.length) {
|
|
913
|
+
const loaded = [...bundles.values()].filter((b) => b.$state$ > BundleImportState_None);
|
|
914
|
+
const waitTime = loaded.reduce((acc, b) => acc + b.$waitedMs$, 0);
|
|
915
|
+
const loadTime = loaded.reduce((acc, b) => acc + b.$loadedMs$, 0);
|
|
916
|
+
log(
|
|
917
|
+
`>>>> done ${loaded.length}/${bundles.size} total: ${waitTime}ms waited, ${loadTime}ms loaded`
|
|
918
|
+
);
|
|
919
|
+
}
|
|
920
|
+
};
|
|
921
|
+
var preloadOne = (bundle) => {
|
|
922
|
+
if (bundle.$state$ >= BundleImportState_Preload) {
|
|
923
|
+
return;
|
|
924
|
+
}
|
|
925
|
+
preloadCount++;
|
|
926
|
+
const start = Date.now();
|
|
927
|
+
bundle.$waitedMs$ = start - bundle.$createdTs$;
|
|
928
|
+
bundle.$state$ = BundleImportState_Preload;
|
|
929
|
+
config.$DEBUG$ && log(
|
|
930
|
+
`<< load ${Math.round((1 - bundle.$inverseProbability$) * 100)}% after ${`${bundle.$waitedMs$}ms`}`,
|
|
931
|
+
bundle.$name$
|
|
932
|
+
);
|
|
933
|
+
const link = doc.createElement("link");
|
|
934
|
+
link.href = new URL(`${base}${bundle.$name$}`, doc.baseURI).toString();
|
|
935
|
+
link.rel = rel;
|
|
936
|
+
link.as = "script";
|
|
937
|
+
link.onload = link.onerror = () => {
|
|
938
|
+
preloadCount--;
|
|
939
|
+
const end = Date.now();
|
|
940
|
+
bundle.$loadedMs$ = end - start;
|
|
941
|
+
bundle.$state$ = BundleImportState_Loaded;
|
|
942
|
+
config.$DEBUG$ && log(`>> done after ${bundle.$loadedMs$}ms`, bundle.$name$);
|
|
943
|
+
link.remove();
|
|
944
|
+
trigger();
|
|
945
|
+
};
|
|
946
|
+
doc.head.appendChild(link);
|
|
947
|
+
};
|
|
948
|
+
var adjustProbabilities = (bundle, newInverseProbability, seen) => {
|
|
949
|
+
if (seen?.has(bundle)) {
|
|
950
|
+
return;
|
|
951
|
+
}
|
|
952
|
+
const previousInverseProbability = bundle.$inverseProbability$;
|
|
953
|
+
bundle.$inverseProbability$ = newInverseProbability;
|
|
954
|
+
if (previousInverseProbability - bundle.$inverseProbability$ < 0.01) {
|
|
955
|
+
return;
|
|
956
|
+
}
|
|
957
|
+
if (
|
|
958
|
+
// don't queue until we have initialized the preloader
|
|
959
|
+
base != null && bundle.$state$ < BundleImportState_Preload
|
|
960
|
+
) {
|
|
961
|
+
if (bundle.$state$ === BundleImportState_None) {
|
|
962
|
+
bundle.$state$ = BundleImportState_Queued;
|
|
963
|
+
queue.push(bundle);
|
|
964
|
+
config.$DEBUG$ && log(`queued ${Math.round((1 - bundle.$inverseProbability$) * 100)}%`, bundle.$name$);
|
|
965
|
+
}
|
|
966
|
+
queueDirty = true;
|
|
967
|
+
}
|
|
968
|
+
if (bundle.$deps$) {
|
|
969
|
+
seen || (seen = /* @__PURE__ */ new Set());
|
|
970
|
+
seen.add(bundle);
|
|
971
|
+
const probability = 1 - bundle.$inverseProbability$;
|
|
972
|
+
for (const dep of bundle.$deps$) {
|
|
973
|
+
const depBundle = getBundle(dep.$name$);
|
|
974
|
+
if (depBundle.$inverseProbability$ === 0) {
|
|
975
|
+
continue;
|
|
976
|
+
}
|
|
977
|
+
let newInverseProbability2;
|
|
978
|
+
if (probability === 1 || probability >= 0.99 && depsCount < 100) {
|
|
979
|
+
depsCount++;
|
|
980
|
+
newInverseProbability2 = Math.min(0.01, 1 - dep.$importProbability$);
|
|
981
|
+
} else {
|
|
982
|
+
const newInverseImportProbability = 1 - dep.$importProbability$ * probability;
|
|
983
|
+
const prevAdjust = dep.$factor$;
|
|
984
|
+
const factor = newInverseImportProbability / prevAdjust;
|
|
985
|
+
newInverseProbability2 = Math.max(0.02, depBundle.$inverseProbability$ * factor);
|
|
986
|
+
dep.$factor$ = factor;
|
|
987
|
+
}
|
|
988
|
+
adjustProbabilities(depBundle, newInverseProbability2, seen);
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
};
|
|
992
|
+
var handleBundle = (name, inverseProbability) => {
|
|
993
|
+
const bundle = getBundle(name);
|
|
994
|
+
if (bundle && bundle.$inverseProbability$ > inverseProbability) {
|
|
995
|
+
adjustProbabilities(bundle, inverseProbability);
|
|
996
|
+
}
|
|
997
|
+
};
|
|
998
|
+
var depsCount;
|
|
999
|
+
var preload = (name, probability) => {
|
|
1000
|
+
if (!name?.length) {
|
|
1001
|
+
return;
|
|
1002
|
+
}
|
|
1003
|
+
depsCount = 0;
|
|
1004
|
+
let inverseProbability = probability ? 1 - probability : 0.4;
|
|
1005
|
+
if (Array.isArray(name)) {
|
|
1006
|
+
for (let i = name.length - 1; i >= 0; i--) {
|
|
1007
|
+
const item = name[i];
|
|
1008
|
+
if (typeof item === "number") {
|
|
1009
|
+
inverseProbability = 1 - item / 10;
|
|
1010
|
+
} else {
|
|
1011
|
+
handleBundle(item, inverseProbability);
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
} else {
|
|
1015
|
+
handleBundle(name, inverseProbability);
|
|
1016
|
+
}
|
|
1017
|
+
if (isBrowser3) {
|
|
1018
|
+
trigger();
|
|
1019
|
+
}
|
|
1020
|
+
};
|
|
1021
|
+
if (isBrowser3) {
|
|
1022
|
+
document.addEventListener("qsymbol", (ev) => {
|
|
1023
|
+
const { symbol, href } = ev.detail;
|
|
1024
|
+
if (href) {
|
|
1025
|
+
const hash2 = symbol.slice(symbol.lastIndexOf("_") + 1);
|
|
1026
|
+
preload(hash2, 1);
|
|
1027
|
+
}
|
|
1028
|
+
});
|
|
827
1029
|
}
|
|
828
1030
|
|
|
829
1031
|
// packages/qwik/src/server/platform.ts
|
|
1032
|
+
var getDevSegmentPath = (mapper, hash2, symbolName, parent) => {
|
|
1033
|
+
const existing = mapper?.[hash2];
|
|
1034
|
+
if (existing) {
|
|
1035
|
+
return existing;
|
|
1036
|
+
}
|
|
1037
|
+
if (symbolName === SYNC_QRL) {
|
|
1038
|
+
return [symbolName, ""];
|
|
1039
|
+
}
|
|
1040
|
+
if (!parent) {
|
|
1041
|
+
if (symbolName.startsWith("_") && symbolName.length < 6) {
|
|
1042
|
+
return [symbolName, `${import.meta.env.BASE_URL}@qwik-handlers`];
|
|
1043
|
+
}
|
|
1044
|
+
console.error("qwik symbolMapper: unknown qrl requested without parent:", symbolName);
|
|
1045
|
+
return [symbolName, `${import.meta.env.BASE_URL}${symbolName}.js`];
|
|
1046
|
+
}
|
|
1047
|
+
const qrlFile = `${import.meta.env.BASE_URL}${parent.startsWith("/") ? parent.slice(1) : parent}_${symbolName}.js`;
|
|
1048
|
+
return [symbolName, qrlFile];
|
|
1049
|
+
};
|
|
830
1050
|
function createPlatform(opts, resolvedManifest) {
|
|
831
1051
|
const mapper = resolvedManifest?.mapper;
|
|
832
1052
|
const mapperFn = opts.symbolMapper ? opts.symbolMapper : (symbolName, _chunk, parent) => {
|
|
833
|
-
if (mapper) {
|
|
1053
|
+
if (mapper || isDev3 && import.meta.env.MODE !== "test") {
|
|
834
1054
|
const hash2 = getSymbolHash(symbolName);
|
|
835
|
-
const result = mapper[hash2];
|
|
1055
|
+
const result = !isDev3 ? mapper[hash2] : getDevSegmentPath(mapper, hash2, symbolName, parent);
|
|
836
1056
|
if (!result) {
|
|
837
1057
|
if (hash2 === SYNC_QRL) {
|
|
838
1058
|
return [hash2, ""];
|
|
@@ -841,9 +1061,6 @@ function createPlatform(opts, resolvedManifest) {
|
|
|
841
1061
|
if (isRegistered) {
|
|
842
1062
|
return [symbolName, "_"];
|
|
843
1063
|
}
|
|
844
|
-
if (parent) {
|
|
845
|
-
return [symbolName, `${parent}?qrl=${symbolName}`];
|
|
846
|
-
}
|
|
847
1064
|
console.error("Cannot resolve symbol", symbolName, "in", mapper, parent);
|
|
848
1065
|
}
|
|
849
1066
|
return result;
|
|
@@ -871,13 +1088,6 @@ function createPlatform(opts, resolvedManifest) {
|
|
|
871
1088
|
console.error("server can not rerender");
|
|
872
1089
|
return Promise.resolve();
|
|
873
1090
|
},
|
|
874
|
-
nextTick: (fn) => {
|
|
875
|
-
return new Promise((resolve) => {
|
|
876
|
-
setTimeout(() => {
|
|
877
|
-
resolve(fn());
|
|
878
|
-
});
|
|
879
|
-
});
|
|
880
|
-
},
|
|
881
1091
|
chunkForSymbol(symbolName, _chunk, parent) {
|
|
882
1092
|
return mapperFn(symbolName, mapper, parent);
|
|
883
1093
|
}
|
|
@@ -909,265 +1119,82 @@ function createTimer() {
|
|
|
909
1119
|
};
|
|
910
1120
|
}
|
|
911
1121
|
function getBuildBase(opts) {
|
|
912
|
-
let
|
|
1122
|
+
let base2 = opts.base;
|
|
913
1123
|
if (typeof opts.base === "function") {
|
|
914
|
-
|
|
1124
|
+
base2 = opts.base(opts);
|
|
915
1125
|
}
|
|
916
|
-
if (typeof
|
|
917
|
-
if (!
|
|
918
|
-
|
|
1126
|
+
if (typeof base2 === "string") {
|
|
1127
|
+
if (!base2.endsWith("/")) {
|
|
1128
|
+
base2 += "/";
|
|
919
1129
|
}
|
|
920
|
-
return
|
|
1130
|
+
return base2;
|
|
921
1131
|
}
|
|
922
|
-
return `${import.meta.env.BASE_URL}build/`;
|
|
1132
|
+
return `${import.meta.env.BASE_URL || "/"}build/`;
|
|
923
1133
|
}
|
|
924
1134
|
var versions = {
|
|
925
|
-
qwik: "2.0.0-
|
|
1135
|
+
qwik: "2.0.0-beta.10-dev+4669425",
|
|
926
1136
|
qwikDom: "2.1.19"
|
|
927
1137
|
};
|
|
928
1138
|
|
|
929
1139
|
// packages/qwik/src/server/ssr-container.ts
|
|
930
1140
|
import {
|
|
931
|
-
|
|
1141
|
+
_SubscriptionData as SubscriptionData,
|
|
932
1142
|
_SharedContainer,
|
|
933
1143
|
_jsxSorted,
|
|
934
1144
|
_jsxSplit,
|
|
935
1145
|
_walkJSX,
|
|
936
1146
|
isSignal
|
|
937
1147
|
} from "@qwik.dev/core";
|
|
938
|
-
import { isDev as
|
|
1148
|
+
import { isDev as isDev5 } from "@qwik.dev/core/build";
|
|
939
1149
|
|
|
940
|
-
// packages/qwik/src/server/
|
|
941
|
-
function
|
|
942
|
-
const
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
if (!urls.includes(prefetchResource.url)) {
|
|
965
|
-
urls.push(prefetchResource.url);
|
|
966
|
-
addPrefetchResource(prefetchResource.imports);
|
|
1150
|
+
// packages/qwik/src/server/scripts.ts
|
|
1151
|
+
var QWIK_LOADER_DEFAULT_MINIFIED = 'const t=document,e=window,n=new Set,o=new Set([t]);let r;const s=(t,e)=>Array.from(t.querySelectorAll(e)),a=t=>{const e=[];return o.forEach(n=>e.push(...s(n,t))),e},i=t=>{m(t),s(t,"[q\\\\:shadowroot]").forEach(t=>{const e=t.shadowRoot;e&&i(e)})},c=t=>t&&"function"==typeof t.then,l=(t,e,n=e.type)=>{a("[on"+t+"\\\\:"+n+"]").forEach(o=>{u(o,t,e,n)})},f=e=>{if(void 0===e._qwikjson_){let n=(e===t.documentElement?t.body:e).lastElementChild;for(;n;){if("SCRIPT"===n.tagName&&"qwik/json"===n.getAttribute("type")){e._qwikjson_=JSON.parse(n.textContent.replace(/\\\\x3C(\\/?script)/gi,"<$1"));break}n=n.previousElementSibling}}},p=(t,e)=>new CustomEvent(t,{detail:e}),u=async(e,n,o,r=o.type)=>{const s="on"+n+":"+r;e.hasAttribute("preventdefault:"+r)&&o.preventDefault(),e.hasAttribute("stoppropagation:"+r)&&o.stopPropagation();const a=e._qc_,i=a&&a.li.filter(t=>t[0]===s);if(i&&i.length>0){for(const t of i){const n=t[1].getFn([e,o],()=>e.isConnected)(o,e),r=o.cancelBubble;c(n)&&await n,r&&o.stopPropagation()}return}const l=e.getAttribute(s),p=e.qDispatchEvent;if(p)return p(o,n);if(l){const n=e.closest("[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])"),r=n.getAttribute("q:base"),s=n.getAttribute("q:version")||"unknown",a=n.getAttribute("q:manifest-hash")||"dev",i=new URL(r,t.baseURI);for(const p of l.split("\\n")){const l=new URL(p,i),u=l.href,q=l.hash.replace(/^#?([^?[|]*).*$/,"$1")||"default",h=performance.now();let _,d,y;const m=p.startsWith("#"),w={qBase:r,qManifest:a,qVersion:s,href:u,symbol:q,element:e,reqTime:h};if(m){const e=n.getAttribute("q:instance");_=(t["qFuncs_"+e]||[])[Number.parseInt(q)],_||(d="sync",y=Error("sym:"+q))}else{b("qsymbol",w);const t=l.href.split("#")[0];try{const e=import(t);f(n),_=(await e)[q],_||(d="no-symbol",y=Error(`${q} not in ${t}`))}catch(t){d||(d="async"),y=t}}if(!_){b("qerror",{importError:d,error:y,...w}),console.error(y);break}const g=t.__q_context__;if(e.isConnected)try{t.__q_context__=[e,o,l];const n=_(o,e);c(n)&&await n}catch(t){b("qerror",{error:t,...w})}finally{t.__q_context__=g}}}},b=(e,n)=>{t.dispatchEvent(p(e,n))},q=t=>t.replace(/([A-Z])/g,t=>"-"+t.toLowerCase()),h=async t=>{let e=q(t.type),n=t.target;for(l("-document",t,e);n&&n.getAttribute;){const o=u(n,"",t,e);let r=t.cancelBubble;c(o)&&await o,r||(r=r||t.cancelBubble||n.hasAttribute("stoppropagation:"+t.type)),n=t.bubbles&&!0!==r?n.parentElement:null}},_=t=>{l("-window",t,q(t.type))},d=()=>{const s=t.readyState;if(!r&&("interactive"==s||"complete"==s)&&(o.forEach(i),r=1,b("qinit"),(e.requestIdleCallback??e.setTimeout).bind(e)(()=>b("qidle")),n.has("qvisible"))){const t=a("[on\\\\:qvisible]"),e=new IntersectionObserver(t=>{for(const n of t)n.isIntersecting&&(e.unobserve(n.target),u(n.target,"",p("qvisible",n)))});t.forEach(t=>e.observe(t))}},y=(t,e,n,o=!1)=>{t.addEventListener(e,n,{capture:o,passive:!1})},m=(...t)=>{for(const r of t)"string"==typeof r?n.has(r)||(o.forEach(t=>y(t,r,h,!0)),y(e,r,_,!0),n.add(r)):o.has(r)||(n.forEach(t=>y(r,t,h,!0)),o.add(r))};if(!("__q_context__"in t)){t.__q_context__=0;const r=e.qwikevents;r&&(Array.isArray(r)?m(...r):m("click","input")),e.qwikevents={events:n,roots:o,push:m},y(t,"readystatechange",d),d()}';
|
|
1152
|
+
var QWIK_LOADER_DEFAULT_DEBUG = 'const doc = document;\nconst win = window;\nconst events = /* @__PURE__ */ new Set();\nconst roots = /* @__PURE__ */ new Set([doc]);\nlet hasInitialized;\nconst nativeQuerySelectorAll = (root, selector) => Array.from(root.querySelectorAll(selector));\nconst querySelectorAll = (query) => {\n const elements = [];\n roots.forEach((root) => elements.push(...nativeQuerySelectorAll(root, query)));\n return elements;\n};\nconst findShadowRoots = (fragment) => {\n processEventOrNode(fragment);\n nativeQuerySelectorAll(fragment, "[q\\\\:shadowroot]").forEach((parent) => {\n const shadowRoot = parent.shadowRoot;\n shadowRoot && findShadowRoots(shadowRoot);\n });\n};\nconst isPromise = (promise) => promise && typeof promise.then === "function";\nconst broadcast = (infix, ev, type = ev.type) => {\n querySelectorAll("[on" + infix + "\\\\:" + type + "]").forEach((el) => {\n dispatch(el, infix, ev, type);\n });\n};\nconst resolveContainer = (containerEl) => {\n if (containerEl._qwikjson_ === void 0) {\n const parentJSON = containerEl === doc.documentElement ? doc.body : containerEl;\n let script = parentJSON.lastElementChild;\n while (script) {\n if (script.tagName === "SCRIPT" && script.getAttribute("type") === "qwik/json") {\n containerEl._qwikjson_ = JSON.parse(\n script.textContent.replace(/\\\\x3C(\\/?script)/gi, "<$1")\n );\n break;\n }\n script = script.previousElementSibling;\n }\n }\n};\nconst createEvent = (eventName, detail) => new CustomEvent(eventName, {\n detail\n});\nconst dispatch = async (element, scope, ev, eventName = ev.type) => {\n const attrName = "on" + scope + ":" + eventName;\n if (element.hasAttribute("preventdefault:" + eventName)) {\n ev.preventDefault();\n }\n if (element.hasAttribute("stoppropagation:" + eventName)) {\n ev.stopPropagation();\n }\n const ctx = element._qc_;\n const relevantListeners = ctx && ctx.li.filter((li) => li[0] === attrName);\n if (relevantListeners && relevantListeners.length > 0) {\n for (const listener of relevantListeners) {\n const results = listener[1].getFn([element, ev], () => element.isConnected)(ev, element);\n const cancelBubble = ev.cancelBubble;\n if (isPromise(results)) {\n await results;\n }\n if (cancelBubble) {\n ev.stopPropagation();\n }\n }\n return;\n }\n const attrValue = element.getAttribute(attrName);\n const qDispatchEvent = element.qDispatchEvent;\n if (qDispatchEvent) {\n return qDispatchEvent(ev, scope);\n }\n if (attrValue) {\n const container = element.closest(\n "[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])"\n );\n const qBase = container.getAttribute("q:base");\n const qVersion = container.getAttribute("q:version") || "unknown";\n const qManifest = container.getAttribute("q:manifest-hash") || "dev";\n const base = new URL(qBase, doc.baseURI);\n for (const qrl of attrValue.split("\\n")) {\n const url = new URL(qrl, base);\n const href = url.href;\n const symbol = url.hash.replace(/^#?([^?[|]*).*$/, "$1") || "default";\n const reqTime = performance.now();\n let handler;\n let importError;\n let error;\n const isSync = qrl.startsWith("#");\n const eventData = {\n qBase,\n qManifest,\n qVersion,\n href,\n symbol,\n element,\n reqTime\n };\n if (isSync) {\n const hash = container.getAttribute("q:instance");\n handler = (doc["qFuncs_" + hash] || [])[Number.parseInt(symbol)];\n if (!handler) {\n importError = "sync";\n error = new Error("sym:" + symbol);\n }\n } else {\n emitEvent("qsymbol", eventData);\n const uri = url.href.split("#")[0];\n try {\n const module = import(\n uri\n );\n resolveContainer(container);\n handler = (await module)[symbol];\n if (!handler) {\n importError = "no-symbol";\n error = new Error(`${symbol} not in ${uri}`);\n }\n } catch (err) {\n importError || (importError = "async");\n error = err;\n }\n }\n if (!handler) {\n emitEvent("qerror", {\n importError,\n error,\n ...eventData\n });\n console.error(error);\n break;\n }\n const previousCtx = doc.__q_context__;\n if (element.isConnected) {\n try {\n doc.__q_context__ = [element, ev, url];\n const results = handler(ev, element);\n if (isPromise(results)) {\n await results;\n }\n } catch (error2) {\n emitEvent("qerror", { error: error2, ...eventData });\n } finally {\n doc.__q_context__ = previousCtx;\n }\n }\n }\n }\n};\nconst emitEvent = (eventName, detail) => {\n doc.dispatchEvent(createEvent(eventName, detail));\n};\nconst camelToKebab = (str) => str.replace(/([A-Z])/g, (a) => "-" + a.toLowerCase());\nconst processDocumentEvent = async (ev) => {\n let type = camelToKebab(ev.type);\n let element = ev.target;\n broadcast("-document", ev, type);\n while (element && element.getAttribute) {\n const results = dispatch(element, "", ev, type);\n let cancelBubble = ev.cancelBubble;\n if (isPromise(results)) {\n await results;\n }\n cancelBubble || (cancelBubble = cancelBubble || ev.cancelBubble || element.hasAttribute("stoppropagation:" + ev.type));\n element = ev.bubbles && cancelBubble !== true ? element.parentElement : null;\n }\n};\nconst processWindowEvent = (ev) => {\n broadcast("-window", ev, camelToKebab(ev.type));\n};\nconst processReadyStateChange = () => {\n const readyState = doc.readyState;\n if (!hasInitialized && (readyState == "interactive" || readyState == "complete")) {\n roots.forEach(findShadowRoots);\n hasInitialized = 1;\n emitEvent("qinit");\n const riC = win.requestIdleCallback ?? win.setTimeout;\n riC.bind(win)(() => emitEvent("qidle"));\n if (events.has("qvisible")) {\n const results = querySelectorAll("[on\\\\:qvisible]");\n const observer = new IntersectionObserver((entries) => {\n for (const entry of entries) {\n if (entry.isIntersecting) {\n observer.unobserve(entry.target);\n dispatch(entry.target, "", createEvent("qvisible", entry));\n }\n }\n });\n results.forEach((el) => observer.observe(el));\n }\n }\n};\nconst addEventListener = (el, eventName, handler, capture = false) => {\n el.addEventListener(eventName, handler, { capture, passive: false });\n};\nconst processEventOrNode = (...eventNames) => {\n for (const eventNameOrNode of eventNames) {\n if (typeof eventNameOrNode === "string") {\n if (!events.has(eventNameOrNode)) {\n roots.forEach(\n (root) => addEventListener(root, eventNameOrNode, processDocumentEvent, true)\n );\n addEventListener(win, eventNameOrNode, processWindowEvent, true);\n events.add(eventNameOrNode);\n }\n } else {\n if (!roots.has(eventNameOrNode)) {\n events.forEach(\n (eventName) => addEventListener(eventNameOrNode, eventName, processDocumentEvent, true)\n );\n roots.add(eventNameOrNode);\n }\n }\n }\n};\nif (!("__q_context__" in doc)) {\n doc.__q_context__ = 0;\n const qwikevents = win.qwikevents;\n if (qwikevents) {\n if (Array.isArray(qwikevents)) {\n processEventOrNode(...qwikevents);\n } else {\n processEventOrNode("click", "input");\n }\n }\n win.qwikevents = {\n events,\n roots,\n push: processEventOrNode\n };\n addEventListener(doc, "readystatechange", processReadyStateChange);\n processReadyStateChange();\n}';
|
|
1153
|
+
var QWIK_BACKPATCH_EXECUTOR_MINIFIED = `const t='script[type="qwik/backpatch"]',e=document.currentScript;if(e){const o=e.closest("[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])");if(o){const e=o.querySelector(t);if(e){const t=JSON.parse(e.textContent||"[]"),n=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT);let r=n.currentNode,c=0;for(let e=0;e<t.length;e+=3){const o=t[e],i=t[e+1];let l=t[e+2];for(;c<o;)r=n.nextNode(),c++;const s=r;null==l||!1===l?s.removeAttribute(i):("boolean"==typeof l&&(l=""),s.setAttribute(i,l))}}}}`;
|
|
1154
|
+
var QWIK_BACKPATCH_EXECUTOR_DEBUG = `const BACKPATCH_DATA_SELECTOR = 'script[type="qwik/backpatch"]';
|
|
1155
|
+
const executorScript = document.currentScript;
|
|
1156
|
+
if (executorScript) {
|
|
1157
|
+
const container = executorScript.closest(
|
|
1158
|
+
"[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])"
|
|
1159
|
+
);
|
|
1160
|
+
if (container) {
|
|
1161
|
+
const script = container.querySelector(BACKPATCH_DATA_SELECTOR);
|
|
1162
|
+
if (script) {
|
|
1163
|
+
const data = JSON.parse(script.textContent || "[]");
|
|
1164
|
+
const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT);
|
|
1165
|
+
let currentNode = walker.currentNode;
|
|
1166
|
+
let currentNodeIdx = 0;
|
|
1167
|
+
for (let i = 0; i < data.length; i += 3) {
|
|
1168
|
+
const elementIdx = data[i];
|
|
1169
|
+
const attrName = data[i + 1];
|
|
1170
|
+
let value = data[i + 2];
|
|
1171
|
+
while (currentNodeIdx < elementIdx) {
|
|
1172
|
+
currentNode = walker.nextNode();
|
|
1173
|
+
currentNodeIdx++;
|
|
967
1174
|
}
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
let total = 0;
|
|
977
|
-
const addPrefetchResource = (prefetchResources2, visited2) => {
|
|
978
|
-
if (Array.isArray(prefetchResources2)) {
|
|
979
|
-
for (const prefetchResource of prefetchResources2) {
|
|
980
|
-
const count = common.get(prefetchResource.url) || 0;
|
|
981
|
-
common.set(prefetchResource.url, count + 1);
|
|
982
|
-
total++;
|
|
983
|
-
if (!visited2.has(prefetchResource.url)) {
|
|
984
|
-
visited2.add(prefetchResource.url);
|
|
985
|
-
addPrefetchResource(prefetchResource.imports, visited2);
|
|
1175
|
+
const element = currentNode;
|
|
1176
|
+
if (value == null || value === false) {
|
|
1177
|
+
element.removeAttribute(attrName);
|
|
1178
|
+
} else {
|
|
1179
|
+
if (typeof value === "boolean") {
|
|
1180
|
+
value = "";
|
|
1181
|
+
}
|
|
1182
|
+
element.setAttribute(attrName, value);
|
|
986
1183
|
}
|
|
987
1184
|
}
|
|
988
1185
|
}
|
|
989
|
-
};
|
|
990
|
-
const visited = /* @__PURE__ */ new Set();
|
|
991
|
-
for (const resource of prefetchResources) {
|
|
992
|
-
visited.clear();
|
|
993
|
-
addPrefetchResource(resource.imports, visited);
|
|
994
|
-
}
|
|
995
|
-
const threshold = total / common.size * 2;
|
|
996
|
-
const urls = Array.from(common.entries());
|
|
997
|
-
urls.sort((a, b) => b[1] - a[1]);
|
|
998
|
-
return urls.slice(0, 5).filter((e) => e[1] > threshold).map((e) => e[0]);
|
|
999
|
-
}
|
|
1000
|
-
|
|
1001
|
-
// packages/qwik/src/server/prefetch-implementation.ts
|
|
1002
|
-
function applyPrefetchImplementation2(container, prefetchStrategy, prefetchResources, nonce) {
|
|
1003
|
-
const prefetchImpl = normalizePrefetchImplementation(prefetchStrategy?.implementation);
|
|
1004
|
-
if (prefetchImpl.prefetchEvent === "always") {
|
|
1005
|
-
prefetchUrlsEvent2(container, prefetchResources, nonce);
|
|
1006
1186
|
}
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
if (prefetchImpl.linkInsert === "js-append") {
|
|
1011
|
-
linkJsImplementation2(container, prefetchResources, prefetchImpl, nonce);
|
|
1012
|
-
} else if (prefetchImpl.workerFetchInsert === "always") {
|
|
1013
|
-
workerFetchImplementation2(container, prefetchResources, nonce);
|
|
1014
|
-
}
|
|
1015
|
-
}
|
|
1016
|
-
function prefetchUrlsEvent2(container, prefetchResources, nonce) {
|
|
1017
|
-
const mostReferenced = getMostReferenced(prefetchResources);
|
|
1018
|
-
for (const url of mostReferenced) {
|
|
1019
|
-
const attrs = ["rel", "modulepreload", "href", url];
|
|
1020
|
-
if (nonce) {
|
|
1021
|
-
attrs.push("nonce", nonce);
|
|
1022
|
-
}
|
|
1023
|
-
container.openElement("link", null, attrs);
|
|
1024
|
-
container.closeElement();
|
|
1025
|
-
}
|
|
1026
|
-
const scriptAttrs = ["q:type", "prefetch-bundles"];
|
|
1027
|
-
if (nonce) {
|
|
1028
|
-
scriptAttrs.push("nonce", nonce);
|
|
1029
|
-
}
|
|
1030
|
-
container.openElement("script", null, scriptAttrs);
|
|
1031
|
-
container.writer.write(prefetchUrlsEventScript(container.$buildBase$ || "", prefetchResources));
|
|
1032
|
-
container.writer.write(
|
|
1033
|
-
`;document.dispatchEvent(new CustomEvent('qprefetch', {detail:{links: [location.pathname]}}))`
|
|
1034
|
-
);
|
|
1035
|
-
container.closeElement();
|
|
1036
|
-
}
|
|
1037
|
-
function linkHtmlImplementation2(container, prefetchResources, prefetchImpl) {
|
|
1038
|
-
const urls = flattenPrefetchResources(prefetchResources);
|
|
1039
|
-
const rel = prefetchImpl.linkRel || "prefetch";
|
|
1040
|
-
const priority = prefetchImpl.linkFetchPriority;
|
|
1041
|
-
for (const url of urls) {
|
|
1042
|
-
const attributes = ["href", url, "rel", rel];
|
|
1043
|
-
if (priority) {
|
|
1044
|
-
attributes.push("fetchpriority", priority);
|
|
1045
|
-
}
|
|
1046
|
-
if (rel === "prefetch" || rel === "preload") {
|
|
1047
|
-
if (url.endsWith(".js")) {
|
|
1048
|
-
attributes.push("as", "script");
|
|
1049
|
-
}
|
|
1050
|
-
}
|
|
1051
|
-
container.openElement("link", null, attributes);
|
|
1052
|
-
container.closeElement();
|
|
1053
|
-
}
|
|
1054
|
-
}
|
|
1055
|
-
function linkJsImplementation2(container, prefetchResources, prefetchImpl, nonce) {
|
|
1056
|
-
const scriptAttrs = ["type", "module", "q:type", "link-js"];
|
|
1057
|
-
if (nonce) {
|
|
1058
|
-
scriptAttrs.push("nonce", nonce);
|
|
1059
|
-
}
|
|
1060
|
-
container.openElement("script", null, scriptAttrs);
|
|
1061
|
-
const rel = prefetchImpl.linkRel || "prefetch";
|
|
1062
|
-
const priority = prefetchImpl.linkFetchPriority;
|
|
1063
|
-
if (prefetchImpl.workerFetchInsert === "no-link-support") {
|
|
1064
|
-
container.writer.write(`let supportsLinkRel = true;`);
|
|
1065
|
-
}
|
|
1066
|
-
container.writer.write(`const u=${JSON.stringify(flattenPrefetchResources(prefetchResources))};`);
|
|
1067
|
-
container.writer.write(`u.map((u,i)=>{`);
|
|
1068
|
-
container.writer.write(`const l=document.createElement('link');`);
|
|
1069
|
-
container.writer.write(`l.setAttribute("href",u);`);
|
|
1070
|
-
container.writer.write(`l.setAttribute("rel","${rel}");`);
|
|
1071
|
-
if (priority) {
|
|
1072
|
-
container.writer.write(`l.setAttribute("fetchpriority","${priority}");`);
|
|
1073
|
-
}
|
|
1074
|
-
if (prefetchImpl.workerFetchInsert === "no-link-support") {
|
|
1075
|
-
container.writer.write(`if(i===0){`);
|
|
1076
|
-
container.writer.write(`try{`);
|
|
1077
|
-
container.writer.write(`supportsLinkRel=l.relList.supports("${rel}");`);
|
|
1078
|
-
container.writer.write(`}catch(e){}`);
|
|
1079
|
-
container.writer.write(`}`);
|
|
1080
|
-
}
|
|
1081
|
-
container.writer.write(`document.body.appendChild(l);`);
|
|
1082
|
-
container.writer.write(`});`);
|
|
1083
|
-
if (prefetchImpl.workerFetchInsert === "no-link-support") {
|
|
1084
|
-
container.writer.write(`if(!supportsLinkRel){`);
|
|
1085
|
-
container.writer.write(workerFetchScript());
|
|
1086
|
-
container.writer.write(`}`);
|
|
1087
|
-
}
|
|
1088
|
-
if (prefetchImpl.workerFetchInsert === "always") {
|
|
1089
|
-
container.writer.write(workerFetchScript());
|
|
1090
|
-
}
|
|
1091
|
-
container.closeElement();
|
|
1092
|
-
}
|
|
1093
|
-
function workerFetchImplementation2(container, prefetchResources, nonce) {
|
|
1094
|
-
const scriptAttrs = ["type", "module", "q:type", "prefetch-worker"];
|
|
1095
|
-
if (nonce) {
|
|
1096
|
-
scriptAttrs.push(nonce, "nonce");
|
|
1097
|
-
}
|
|
1098
|
-
container.openElement("script", null, scriptAttrs);
|
|
1099
|
-
container.writer.write(`const u=${JSON.stringify(flattenPrefetchResources(prefetchResources))};`);
|
|
1100
|
-
container.writer.write(workerFetchScript());
|
|
1101
|
-
container.closeElement();
|
|
1102
|
-
}
|
|
1103
|
-
function normalizePrefetchImplementation(input) {
|
|
1104
|
-
return { ...PrefetchImplementationDefault, ...input };
|
|
1105
|
-
}
|
|
1106
|
-
var PrefetchImplementationDefault = {
|
|
1107
|
-
linkInsert: null,
|
|
1108
|
-
linkRel: null,
|
|
1109
|
-
linkFetchPriority: null,
|
|
1110
|
-
workerFetchInsert: null,
|
|
1111
|
-
prefetchEvent: "always"
|
|
1112
|
-
};
|
|
1113
|
-
|
|
1114
|
-
// packages/qwik/src/server/prefetch-strategy.ts
|
|
1115
|
-
import { isDev as isDev2 } from "@qwik.dev/core/build";
|
|
1116
|
-
function getPrefetchResources(qrls, opts, resolvedManifest) {
|
|
1117
|
-
if (!resolvedManifest) {
|
|
1118
|
-
return [];
|
|
1119
|
-
}
|
|
1120
|
-
const prefetchStrategy = opts.prefetchStrategy;
|
|
1121
|
-
const buildBase = getBuildBase(opts);
|
|
1122
|
-
if (prefetchStrategy !== null) {
|
|
1123
|
-
if (!prefetchStrategy || !prefetchStrategy.symbolsToPrefetch || prefetchStrategy.symbolsToPrefetch === "auto") {
|
|
1124
|
-
return getAutoPrefetch(qrls, resolvedManifest, buildBase);
|
|
1125
|
-
}
|
|
1126
|
-
if (typeof prefetchStrategy.symbolsToPrefetch === "function") {
|
|
1127
|
-
try {
|
|
1128
|
-
return prefetchStrategy.symbolsToPrefetch({ manifest: resolvedManifest.manifest });
|
|
1129
|
-
} catch (e) {
|
|
1130
|
-
console.error("getPrefetchUrls, symbolsToPrefetch()", e);
|
|
1131
|
-
}
|
|
1132
|
-
}
|
|
1133
|
-
}
|
|
1134
|
-
return [];
|
|
1187
|
+
}`;
|
|
1188
|
+
function getQwikLoaderScript(opts = {}) {
|
|
1189
|
+
return opts.debug ? QWIK_LOADER_DEFAULT_DEBUG : QWIK_LOADER_DEFAULT_MINIFIED;
|
|
1135
1190
|
}
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
if (mapper && manifest) {
|
|
1141
|
-
for (const qrl of qrls) {
|
|
1142
|
-
const qrlSymbolName = qrl.getHash();
|
|
1143
|
-
const resolvedSymbol = mapper[qrlSymbolName];
|
|
1144
|
-
if (resolvedSymbol) {
|
|
1145
|
-
const bundleFileName = resolvedSymbol[1];
|
|
1146
|
-
addBundle(manifest, urls, prefetchResources, buildBase, bundleFileName);
|
|
1147
|
-
}
|
|
1148
|
-
}
|
|
1149
|
-
}
|
|
1150
|
-
return prefetchResources;
|
|
1191
|
+
var QWIK_PREFETCH_MINIFIED = globalThis.QWIK_PREFETCH_MINIFIED;
|
|
1192
|
+
var QWIK_PREFETCH_DEBUG = globalThis.QWIK_PREFETCH_DEBUG;
|
|
1193
|
+
function getQwikPrefetchWorkerScript(opts = {}) {
|
|
1194
|
+
return opts.debug ? QWIK_PREFETCH_DEBUG : QWIK_PREFETCH_MINIFIED;
|
|
1151
1195
|
}
|
|
1152
|
-
function
|
|
1153
|
-
|
|
1154
|
-
let prefetchResource = urls.get(url);
|
|
1155
|
-
if (!prefetchResource) {
|
|
1156
|
-
prefetchResource = {
|
|
1157
|
-
url,
|
|
1158
|
-
imports: []
|
|
1159
|
-
};
|
|
1160
|
-
urls.set(url, prefetchResource);
|
|
1161
|
-
const bundle = manifest.bundles[bundleFileName];
|
|
1162
|
-
if (bundle) {
|
|
1163
|
-
if (Array.isArray(bundle.imports)) {
|
|
1164
|
-
for (const importedFilename of bundle.imports) {
|
|
1165
|
-
addBundle(manifest, urls, prefetchResource.imports, buildBase, importedFilename);
|
|
1166
|
-
}
|
|
1167
|
-
}
|
|
1168
|
-
}
|
|
1169
|
-
}
|
|
1170
|
-
prefetchResources.push(prefetchResource);
|
|
1196
|
+
function getQwikBackpatchExecutorScript(opts = {}) {
|
|
1197
|
+
return opts.debug ? QWIK_BACKPATCH_EXECUTOR_DEBUG : QWIK_BACKPATCH_EXECUTOR_MINIFIED;
|
|
1171
1198
|
}
|
|
1172
1199
|
|
|
1173
1200
|
// packages/qwik/src/server/ssr-node.ts
|
|
@@ -1176,30 +1203,31 @@ import {
|
|
|
1176
1203
|
_EMPTY_ARRAY,
|
|
1177
1204
|
_EFFECT_BACK_REF
|
|
1178
1205
|
} from "@qwik.dev/core";
|
|
1179
|
-
import { isDev as
|
|
1206
|
+
import { isDev as isDev4 } from "@qwik.dev/core/build";
|
|
1180
1207
|
var SsrNode = class {
|
|
1181
|
-
constructor(
|
|
1182
|
-
this.
|
|
1208
|
+
constructor(parentComponent, id, attributesIndex, cleanupQueue, vnodeData, currentFile) {
|
|
1209
|
+
this.parentComponent = parentComponent;
|
|
1210
|
+
this.attributesIndex = attributesIndex;
|
|
1183
1211
|
this.cleanupQueue = cleanupQueue;
|
|
1184
1212
|
this.vnodeData = vnodeData;
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
__publicField(this, "nodeType");
|
|
1213
|
+
this.currentFile = currentFile;
|
|
1214
|
+
__publicField(this, "__brand__", "SsrNode");
|
|
1188
1215
|
/**
|
|
1189
1216
|
* ID which the deserialize will use to retrieve the node.
|
|
1190
1217
|
*
|
|
1191
|
-
* @param
|
|
1218
|
+
* @param id - Unique id for the node.
|
|
1192
1219
|
*/
|
|
1193
1220
|
__publicField(this, "id");
|
|
1221
|
+
__publicField(this, "flags");
|
|
1222
|
+
__publicField(this, "children", null);
|
|
1223
|
+
__publicField(this, "attrs");
|
|
1194
1224
|
/** Local props which don't serialize; */
|
|
1195
|
-
__publicField(this, "
|
|
1196
|
-
__publicField(this, "currentComponentNode");
|
|
1197
|
-
__publicField(this, "childrenVNodeData", null);
|
|
1198
|
-
this.currentComponentNode = currentComponentNode;
|
|
1199
|
-
this.currentComponentNode?.addChildVNodeData(this.vnodeData);
|
|
1200
|
-
this.nodeType = nodeType;
|
|
1225
|
+
__publicField(this, "localProps", null);
|
|
1201
1226
|
this.id = id;
|
|
1202
|
-
|
|
1227
|
+
this.flags = 1 /* Updatable */;
|
|
1228
|
+
this.attrs = this.attributesIndex >= 0 ? this.vnodeData[this.attributesIndex] : _EMPTY_ARRAY;
|
|
1229
|
+
this.parentComponent?.addChild(this);
|
|
1230
|
+
if (isDev4 && id.indexOf("undefined") != -1) {
|
|
1203
1231
|
throw new Error(`Invalid SSR node id: ${id}`);
|
|
1204
1232
|
}
|
|
1205
1233
|
}
|
|
@@ -1208,10 +1236,10 @@ var SsrNode = class {
|
|
|
1208
1236
|
}
|
|
1209
1237
|
setProp(name, value) {
|
|
1210
1238
|
if (this.attrs === _EMPTY_ARRAY) {
|
|
1211
|
-
this.
|
|
1239
|
+
this.setEmptyArrayAsVNodeDataAttributes();
|
|
1212
1240
|
}
|
|
1213
1241
|
if (name.startsWith(NON_SERIALIZABLE_MARKER_PREFIX)) {
|
|
1214
|
-
mapArray_set(this.
|
|
1242
|
+
mapArray_set(this.localProps || (this.localProps = []), name, value, 0);
|
|
1215
1243
|
} else {
|
|
1216
1244
|
mapArray_set(this.attrs, name, value, 0);
|
|
1217
1245
|
}
|
|
@@ -1219,49 +1247,69 @@ var SsrNode = class {
|
|
|
1219
1247
|
this.cleanupQueue.push(value);
|
|
1220
1248
|
}
|
|
1221
1249
|
}
|
|
1250
|
+
setEmptyArrayAsVNodeDataAttributes() {
|
|
1251
|
+
if (this.attributesIndex >= 0) {
|
|
1252
|
+
this.vnodeData[this.attributesIndex] = [];
|
|
1253
|
+
this.attrs = this.vnodeData[this.attributesIndex];
|
|
1254
|
+
} else {
|
|
1255
|
+
const newAttributesIndex = this.vnodeData.length > 1 ? 1 : 0;
|
|
1256
|
+
this.vnodeData.splice(newAttributesIndex, 0, []);
|
|
1257
|
+
this.attributesIndex = newAttributesIndex;
|
|
1258
|
+
this.attrs = this.vnodeData[this.attributesIndex];
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1222
1261
|
getProp(name) {
|
|
1223
1262
|
if (name.startsWith(NON_SERIALIZABLE_MARKER_PREFIX)) {
|
|
1224
|
-
return this.
|
|
1263
|
+
return this.localProps ? mapArray_get(this.localProps, name, 0) : null;
|
|
1225
1264
|
} else {
|
|
1226
1265
|
return mapArray_get(this.attrs, name, 0);
|
|
1227
1266
|
}
|
|
1228
1267
|
}
|
|
1229
1268
|
removeProp(name) {
|
|
1230
1269
|
if (name.startsWith(NON_SERIALIZABLE_MARKER_PREFIX)) {
|
|
1231
|
-
if (this.
|
|
1232
|
-
mapApp_remove(this.
|
|
1270
|
+
if (this.localProps) {
|
|
1271
|
+
mapApp_remove(this.localProps, name, 0);
|
|
1233
1272
|
}
|
|
1234
1273
|
} else {
|
|
1235
1274
|
mapApp_remove(this.attrs, name, 0);
|
|
1236
1275
|
}
|
|
1237
1276
|
}
|
|
1238
|
-
|
|
1239
|
-
if (!this.
|
|
1240
|
-
this.
|
|
1277
|
+
addChild(child) {
|
|
1278
|
+
if (!this.children) {
|
|
1279
|
+
this.children = [];
|
|
1280
|
+
}
|
|
1281
|
+
this.children.push(child);
|
|
1282
|
+
}
|
|
1283
|
+
setTreeNonUpdatable() {
|
|
1284
|
+
this.flags &= ~1 /* Updatable */;
|
|
1285
|
+
if (this.children) {
|
|
1286
|
+
for (const child of this.children) {
|
|
1287
|
+
child.setTreeNonUpdatable();
|
|
1288
|
+
}
|
|
1241
1289
|
}
|
|
1242
|
-
this.childrenVNodeData.push(child);
|
|
1243
1290
|
}
|
|
1244
1291
|
toString() {
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1292
|
+
if (isDev4) {
|
|
1293
|
+
let stringifiedAttrs = "";
|
|
1294
|
+
for (let i = 0; i < this.attrs.length; i += 2) {
|
|
1295
|
+
const key = this.attrs[i];
|
|
1296
|
+
const value = this.attrs[i + 1];
|
|
1297
|
+
stringifiedAttrs += `${key}=`;
|
|
1298
|
+
stringifiedAttrs += `${typeof value === "string" || typeof value === "number" ? JSON.stringify(value) : "*"}`;
|
|
1299
|
+
if (i < this.attrs.length - 2) {
|
|
1300
|
+
stringifiedAttrs += ", ";
|
|
1301
|
+
}
|
|
1253
1302
|
}
|
|
1303
|
+
return `<SSRNode id="${this.id}" ${stringifiedAttrs} />`;
|
|
1304
|
+
} else {
|
|
1305
|
+
return `<SSRNode id="${this.id}" />`;
|
|
1254
1306
|
}
|
|
1255
|
-
return `SSRNode [<${this.id}> ${stringifiedAttrs}]`;
|
|
1256
1307
|
}
|
|
1257
1308
|
};
|
|
1258
|
-
__publicField(SsrNode, "ELEMENT_NODE", 1);
|
|
1259
|
-
__publicField(SsrNode, "TEXT_NODE", 3);
|
|
1260
|
-
__publicField(SsrNode, "DOCUMENT_NODE", 9);
|
|
1261
|
-
__publicField(SsrNode, "DOCUMENT_FRAGMENT_NODE", 11);
|
|
1262
1309
|
var DomRef = class {
|
|
1263
1310
|
constructor($ssrNode$) {
|
|
1264
1311
|
this.$ssrNode$ = $ssrNode$;
|
|
1312
|
+
__publicField(this, "__brand__", "DomRef");
|
|
1265
1313
|
}
|
|
1266
1314
|
};
|
|
1267
1315
|
var SsrComponentFrame = class {
|
|
@@ -1366,6 +1414,10 @@ var allowedContent = (state) => {
|
|
|
1366
1414
|
case 514 /* PHRASING_INSIDE_INPUT */:
|
|
1367
1415
|
case 1026 /* PHRASING_CONTAINER */:
|
|
1368
1416
|
return ["phrasing content", "<a>, <b>, <img>, <input> ... (no <div>, <p> ...)"];
|
|
1417
|
+
case 2050 /* PICTURE */:
|
|
1418
|
+
return ["picture content", "<source>, <img>"];
|
|
1419
|
+
case 4098 /* BUTTON */:
|
|
1420
|
+
return ["button content", "phrasing content except interactive elements"];
|
|
1369
1421
|
case 1 /* DOCUMENT */:
|
|
1370
1422
|
return ["document", "<html>"];
|
|
1371
1423
|
}
|
|
@@ -1407,6 +1459,10 @@ function isTagAllowed(state, tag) {
|
|
|
1407
1459
|
return isInPhrasing(tag, true);
|
|
1408
1460
|
case 514 /* PHRASING_INSIDE_INPUT */:
|
|
1409
1461
|
return isInPhrasing(tag, false);
|
|
1462
|
+
case 2050 /* PICTURE */:
|
|
1463
|
+
return isInPicture(tag);
|
|
1464
|
+
case 4098 /* BUTTON */:
|
|
1465
|
+
return isInButton(tag);
|
|
1410
1466
|
case 1 /* DOCUMENT */:
|
|
1411
1467
|
if (tag === "html") {
|
|
1412
1468
|
return 32 /* HTML */;
|
|
@@ -1486,9 +1542,12 @@ function isInAnything(text) {
|
|
|
1486
1542
|
case "body":
|
|
1487
1543
|
return 0 /* NOT_ALLOWED */;
|
|
1488
1544
|
case "button":
|
|
1545
|
+
return 4098 /* BUTTON */;
|
|
1489
1546
|
case "input":
|
|
1490
1547
|
case "textarea":
|
|
1491
1548
|
return 514 /* PHRASING_INSIDE_INPUT */;
|
|
1549
|
+
case "picture":
|
|
1550
|
+
return 2050 /* PICTURE */;
|
|
1492
1551
|
default:
|
|
1493
1552
|
return 10 /* ANYTHING */;
|
|
1494
1553
|
}
|
|
@@ -1532,12 +1591,35 @@ function isInTableColGroup(text) {
|
|
|
1532
1591
|
return 0 /* NOT_ALLOWED */;
|
|
1533
1592
|
}
|
|
1534
1593
|
}
|
|
1594
|
+
function isInPicture(text) {
|
|
1595
|
+
switch (text) {
|
|
1596
|
+
case "source":
|
|
1597
|
+
return 4 /* EMPTY */;
|
|
1598
|
+
case "img":
|
|
1599
|
+
return 4 /* EMPTY */;
|
|
1600
|
+
default:
|
|
1601
|
+
return 0 /* NOT_ALLOWED */;
|
|
1602
|
+
}
|
|
1603
|
+
}
|
|
1604
|
+
function isInButton(text) {
|
|
1605
|
+
switch (text) {
|
|
1606
|
+
case "button":
|
|
1607
|
+
case "input":
|
|
1608
|
+
case "textarea":
|
|
1609
|
+
case "select":
|
|
1610
|
+
case "a":
|
|
1611
|
+
return 0 /* NOT_ALLOWED */;
|
|
1612
|
+
case "picture":
|
|
1613
|
+
return 2050 /* PICTURE */;
|
|
1614
|
+
default:
|
|
1615
|
+
return isInPhrasing(text, false);
|
|
1616
|
+
}
|
|
1617
|
+
}
|
|
1535
1618
|
function isInPhrasing(text, allowInput) {
|
|
1536
1619
|
switch (text) {
|
|
1537
1620
|
case "svg":
|
|
1538
1621
|
case "math":
|
|
1539
1622
|
return 1026 /* PHRASING_CONTAINER */;
|
|
1540
|
-
case "button":
|
|
1541
1623
|
case "input":
|
|
1542
1624
|
case "textarea":
|
|
1543
1625
|
return allowInput ? 514 /* PHRASING_INSIDE_INPUT */ : 0 /* NOT_ALLOWED */;
|
|
@@ -1549,6 +1631,7 @@ function isInPhrasing(text, allowInput) {
|
|
|
1549
1631
|
case "bdi":
|
|
1550
1632
|
case "bdo":
|
|
1551
1633
|
case "br":
|
|
1634
|
+
case "button":
|
|
1552
1635
|
case "canvas":
|
|
1553
1636
|
case "cite":
|
|
1554
1637
|
case "code":
|
|
@@ -1576,7 +1659,6 @@ function isInPhrasing(text, allowInput) {
|
|
|
1576
1659
|
case "object":
|
|
1577
1660
|
case "option":
|
|
1578
1661
|
case "output":
|
|
1579
|
-
case "picture":
|
|
1580
1662
|
case "progress":
|
|
1581
1663
|
case "q":
|
|
1582
1664
|
case "ruby":
|
|
@@ -1599,13 +1681,14 @@ function isInPhrasing(text, allowInput) {
|
|
|
1599
1681
|
return allowInput ? 258 /* PHRASING_ANY */ : 514 /* PHRASING_INSIDE_INPUT */;
|
|
1600
1682
|
case "style":
|
|
1601
1683
|
return 2 /* TEXT */;
|
|
1684
|
+
case "picture":
|
|
1685
|
+
return 2050 /* PICTURE */;
|
|
1602
1686
|
default:
|
|
1603
1687
|
return 0 /* NOT_ALLOWED */;
|
|
1604
1688
|
}
|
|
1605
1689
|
}
|
|
1606
1690
|
|
|
1607
1691
|
// packages/qwik/src/server/vnode-data.ts
|
|
1608
|
-
import { _EMPTY_ARRAY as _EMPTY_ARRAY2 } from "@qwik.dev/core";
|
|
1609
1692
|
var OPEN_FRAGMENT = Number.MAX_SAFE_INTEGER;
|
|
1610
1693
|
var CLOSE_FRAGMENT = Number.MAX_SAFE_INTEGER - 1;
|
|
1611
1694
|
var WRITE_ELEMENT_ATTRS = Number.MAX_SAFE_INTEGER - 2;
|
|
@@ -1640,23 +1723,21 @@ function vNodeData_openElement(vNodeData) {
|
|
|
1640
1723
|
vNodeData.push([], WRITE_ELEMENT_ATTRS);
|
|
1641
1724
|
vNodeData[0] |= 4 /* ELEMENT_NODE */;
|
|
1642
1725
|
}
|
|
1643
|
-
function vNodeData_createSsrNodeReference(currentComponentNode, vNodeData, depthFirstElementIdx, cleanupQueue) {
|
|
1726
|
+
function vNodeData_createSsrNodeReference(currentComponentNode, vNodeData, depthFirstElementIdx, cleanupQueue, currentFile) {
|
|
1644
1727
|
vNodeData[0] |= 8 /* REFERENCE */;
|
|
1645
|
-
|
|
1646
|
-
|
|
1728
|
+
const stack = [-1];
|
|
1729
|
+
let attributesIndex = -1;
|
|
1647
1730
|
for (let i = 1; i < vNodeData.length; i++) {
|
|
1648
1731
|
const value = vNodeData[i];
|
|
1649
1732
|
if (Array.isArray(value)) {
|
|
1650
|
-
|
|
1733
|
+
attributesIndex = i;
|
|
1651
1734
|
i++;
|
|
1652
1735
|
if (vNodeData[i] !== WRITE_ELEMENT_ATTRS) {
|
|
1653
1736
|
stack[stack.length - 1]++;
|
|
1654
|
-
stack.push(
|
|
1737
|
+
stack.push(-1);
|
|
1655
1738
|
}
|
|
1656
1739
|
} else if (value === CLOSE_FRAGMENT) {
|
|
1657
1740
|
stack.pop();
|
|
1658
|
-
stack.pop();
|
|
1659
|
-
fragmentAttrs = _EMPTY_ARRAY2;
|
|
1660
1741
|
} else if (value < 0) {
|
|
1661
1742
|
const numberOfElements = 0 - value;
|
|
1662
1743
|
stack[stack.length - 1] += numberOfElements;
|
|
@@ -1666,15 +1747,21 @@ function vNodeData_createSsrNodeReference(currentComponentNode, vNodeData, depth
|
|
|
1666
1747
|
}
|
|
1667
1748
|
let refId = String(depthFirstElementIdx);
|
|
1668
1749
|
if (vNodeData[0] & (2 /* VIRTUAL_NODE */ | 1 /* TEXT_DATA */)) {
|
|
1669
|
-
for (let i =
|
|
1750
|
+
for (let i = 0; i < stack.length; i++) {
|
|
1670
1751
|
const childCount = stack[i];
|
|
1671
1752
|
if (childCount >= 0) {
|
|
1672
1753
|
refId += encodeAsAlphanumeric(childCount);
|
|
1673
1754
|
}
|
|
1674
1755
|
}
|
|
1675
1756
|
}
|
|
1676
|
-
|
|
1677
|
-
|
|
1757
|
+
return new SsrNode(
|
|
1758
|
+
currentComponentNode,
|
|
1759
|
+
refId,
|
|
1760
|
+
attributesIndex,
|
|
1761
|
+
cleanupQueue,
|
|
1762
|
+
vNodeData,
|
|
1763
|
+
currentFile
|
|
1764
|
+
);
|
|
1678
1765
|
}
|
|
1679
1766
|
var ALPHANUMERIC = [];
|
|
1680
1767
|
function encodeAsAlphanumeric(value) {
|
|
@@ -1696,17 +1783,246 @@ function encodeAsAlphanumeric(value) {
|
|
|
1696
1783
|
return ALPHANUMERIC[value];
|
|
1697
1784
|
}
|
|
1698
1785
|
|
|
1699
|
-
// packages/qwik/src/server/
|
|
1700
|
-
|
|
1701
|
-
var QWIK_LOADER_DEFAULT_DEBUG = '(() => {\n var __defProp = Object.defineProperty;\n var __getOwnPropSymbols = Object.getOwnPropertySymbols;\n var __hasOwnProp = Object.prototype.hasOwnProperty;\n var __propIsEnum = Object.prototype.propertyIsEnumerable;\n var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {\n enumerable: !0,\n configurable: !0,\n writable: !0,\n value: value\n }) : obj[key] = value;\n var __spreadValues = (a, b) => {\n for (var prop in b || (b = {})) {\n __hasOwnProp.call(b, prop) && __defNormalProp(a, prop, b[prop]);\n }\n if (__getOwnPropSymbols) {\n for (var prop of __getOwnPropSymbols(b)) {\n __propIsEnum.call(b, prop) && __defNormalProp(a, prop, b[prop]);\n }\n }\n return a;\n };\n ((doc, hasInitialized) => {\n const Q_CONTEXT = "__q_context__";\n const win = window;\n const events = new Set;\n const roots = new Set([ doc ]);\n const nativeQuerySelectorAll = (root, selector) => Array.from(root.querySelectorAll(selector));\n const querySelectorAll = query => {\n const elements = [];\n roots.forEach((root => elements.push(...nativeQuerySelectorAll(root, query))));\n return elements;\n };\n const findShadowRoots = fragment => {\n processEventOrNode(fragment);\n nativeQuerySelectorAll(fragment, "[q\\\\:shadowroot]").forEach((parent => {\n const shadowRoot = parent.shadowRoot;\n shadowRoot && findShadowRoots(shadowRoot);\n }));\n };\n const isPromise = promise => promise && "function" == typeof promise.then;\n const broadcast = (infix, ev, type = ev.type) => {\n querySelectorAll("[on" + infix + "\\\\:" + type + "]").forEach((el => dispatch(el, infix, ev, type)));\n };\n const resolveContainer = containerEl => {\n if (void 0 === containerEl._qwikjson_) {\n let script = (containerEl === doc.documentElement ? doc.body : containerEl).lastElementChild;\n while (script) {\n if ("SCRIPT" === script.tagName && "qwik/json" === script.getAttribute("type")) {\n containerEl._qwikjson_ = JSON.parse(script.textContent.replace(/\\\\x3C(\\/?script)/gi, "<$1"));\n break;\n }\n script = script.previousElementSibling;\n }\n }\n };\n const createEvent = (eventName, detail) => new CustomEvent(eventName, {\n detail: detail\n });\n const dispatch = async (element, scope, ev, eventName = ev.type) => {\n const attrName = "on" + scope + ":" + eventName;\n element.hasAttribute("preventdefault:" + eventName) && ev.preventDefault();\n element.hasAttribute("stoppropagation:" + eventName) && ev.stopPropagation();\n const ctx = element._qc_;\n const relevantListeners = ctx && ctx.li.filter((li => li[0] === attrName));\n if (relevantListeners && relevantListeners.length > 0) {\n for (const listener of relevantListeners) {\n const results = listener[1].getFn([ element, ev ], (() => element.isConnected))(ev, element);\n const cancelBubble = ev.cancelBubble;\n isPromise(results) && await results;\n cancelBubble && ev.stopPropagation();\n }\n return;\n }\n const qDispatchEvent = element.qDispatchEvent;\n if (qDispatchEvent) {\n return qDispatchEvent(ev, scope);\n }\n const attrValue = element.getAttribute(attrName);\n if (attrValue) {\n const container = element.closest("[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])");\n const qBase = container.getAttribute("q:base");\n const qVersion = container.getAttribute("q:version") || "unknown";\n const qManifest = container.getAttribute("q:manifest-hash") || "dev";\n const base = new URL(qBase, doc.baseURI);\n for (const qrl of attrValue.split("\\n")) {\n const url = new URL(qrl, base);\n const href = url.href;\n const symbol = url.hash.replace(/^#?([^?[|]*).*$/, "$1") || "default";\n const reqTime = performance.now();\n let handler;\n let importError;\n let error;\n const isSync = qrl.startsWith("#");\n const eventData = {\n qBase: qBase,\n qManifest: qManifest,\n qVersion: qVersion,\n href: href,\n symbol: symbol,\n element: element,\n reqTime: reqTime\n };\n if (isSync) {\n const hash = container.getAttribute("q:instance");\n handler = (doc["qFuncs_" + hash] || [])[Number.parseInt(symbol)];\n if (!handler) {\n importError = "sync";\n error = new Error("sync handler error for symbol: " + symbol);\n }\n } else {\n const uri = url.href.split("#")[0];\n try {\n const module = import(\n uri);\n resolveContainer(container);\n handler = (await module)[symbol];\n if (!handler) {\n importError = "no-symbol";\n error = new Error(`${symbol} not in ${uri}`);\n }\n } catch (err) {\n importError || (importError = "async");\n error = err;\n }\n }\n if (!handler) {\n emitEvent("qerror", __spreadValues({\n importError: importError,\n error: error\n }, eventData));\n console.error(error);\n break;\n }\n const previousCtx = doc[Q_CONTEXT];\n if (element.isConnected) {\n try {\n doc[Q_CONTEXT] = [ element, ev, url ];\n isSync || emitEvent("qsymbol", __spreadValues({}, eventData));\n const results = handler(ev, element);\n isPromise(results) && await results;\n } catch (error2) {\n emitEvent("qerror", __spreadValues({\n error: error2\n }, eventData));\n } finally {\n doc[Q_CONTEXT] = previousCtx;\n }\n }\n }\n }\n };\n const emitEvent = (eventName, detail) => {\n doc.dispatchEvent(createEvent(eventName, detail));\n };\n const camelToKebab = str => str.replace(/([A-Z])/g, (a => "-" + a.toLowerCase()));\n const processDocumentEvent = async ev => {\n let type = camelToKebab(ev.type);\n let element = ev.target;\n broadcast("-document", ev, type);\n while (element && element.getAttribute) {\n const results = dispatch(element, "", ev, type);\n let cancelBubble = ev.cancelBubble;\n isPromise(results) && await results;\n cancelBubble = cancelBubble || ev.cancelBubble || element.hasAttribute("stoppropagation:" + ev.type);\n element = ev.bubbles && !0 !== cancelBubble ? element.parentElement : null;\n }\n };\n const processWindowEvent = ev => {\n broadcast("-window", ev, camelToKebab(ev.type));\n };\n const processReadyStateChange = () => {\n var _a;\n const readyState = doc.readyState;\n if (!hasInitialized && ("interactive" == readyState || "complete" == readyState)) {\n roots.forEach(findShadowRoots);\n hasInitialized = 1;\n emitEvent("qinit");\n (null != (_a = win.requestIdleCallback) ? _a : win.setTimeout).bind(win)((() => emitEvent("qidle")));\n if (events.has("qvisible")) {\n const results = querySelectorAll("[on\\\\:qvisible]");\n const observer = new IntersectionObserver((entries => {\n for (const entry of entries) {\n if (entry.isIntersecting) {\n observer.unobserve(entry.target);\n dispatch(entry.target, "", createEvent("qvisible", entry));\n }\n }\n }));\n results.forEach((el => observer.observe(el)));\n }\n }\n };\n const addEventListener = (el, eventName, handler, capture = !1) => el.addEventListener(eventName, handler, {\n capture: capture,\n passive: !1\n });\n const processEventOrNode = (...eventNames) => {\n for (const eventNameOrNode of eventNames) {\n if ("string" == typeof eventNameOrNode) {\n if (!events.has(eventNameOrNode)) {\n roots.forEach((root => addEventListener(root, eventNameOrNode, processDocumentEvent, !0)));\n addEventListener(win, eventNameOrNode, processWindowEvent, !0);\n events.add(eventNameOrNode);\n }\n } else if (!roots.has(eventNameOrNode)) {\n events.forEach((eventName => addEventListener(eventNameOrNode, eventName, processDocumentEvent, !0)));\n roots.add(eventNameOrNode);\n }\n }\n };\n if (!(Q_CONTEXT in doc)) {\n doc[Q_CONTEXT] = 0;\n const qwikevents = win.qwikevents;\n Array.isArray(qwikevents) && processEventOrNode(...qwikevents);\n win.qwikevents = {\n events: events,\n roots: roots,\n push: processEventOrNode\n };\n addEventListener(doc, "readystatechange", processReadyStateChange);\n processReadyStateChange();\n }\n })(document);\n})()';
|
|
1702
|
-
|
|
1703
|
-
|
|
1786
|
+
// packages/qwik/src/server/preload-strategy.ts
|
|
1787
|
+
import { getPlatform } from "@qwik.dev/core";
|
|
1788
|
+
|
|
1789
|
+
// packages/qwik/src/server/preload-utils.ts
|
|
1790
|
+
function flattenPrefetchResources(prefetchResources) {
|
|
1791
|
+
const urls = [];
|
|
1792
|
+
const addPrefetchResource = (prefetchResources2) => {
|
|
1793
|
+
if (prefetchResources2) {
|
|
1794
|
+
for (const prefetchResource of prefetchResources2) {
|
|
1795
|
+
if (!urls.includes(prefetchResource.url)) {
|
|
1796
|
+
urls.push(prefetchResource.url);
|
|
1797
|
+
if (prefetchResource.imports) {
|
|
1798
|
+
addPrefetchResource(prefetchResource.imports);
|
|
1799
|
+
}
|
|
1800
|
+
}
|
|
1801
|
+
}
|
|
1802
|
+
}
|
|
1803
|
+
};
|
|
1804
|
+
addPrefetchResource(prefetchResources);
|
|
1805
|
+
return urls;
|
|
1704
1806
|
}
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1807
|
+
|
|
1808
|
+
// packages/qwik/src/server/preload-strategy.ts
|
|
1809
|
+
var getBundles = (qrls) => {
|
|
1810
|
+
const platform = getPlatform();
|
|
1811
|
+
return qrls?.map((qrl) => {
|
|
1812
|
+
const symbol = qrl.$symbol$;
|
|
1813
|
+
const chunk = qrl.$chunk$;
|
|
1814
|
+
const result = platform.chunkForSymbol(symbol, chunk, qrl.dev?.file);
|
|
1815
|
+
if (result) {
|
|
1816
|
+
return result[1];
|
|
1817
|
+
}
|
|
1818
|
+
return chunk;
|
|
1819
|
+
}).filter(Boolean);
|
|
1820
|
+
};
|
|
1821
|
+
function getPreloadPaths(qrls, opts, resolvedManifest) {
|
|
1822
|
+
const prefetchStrategy = opts.prefetchStrategy;
|
|
1823
|
+
if (prefetchStrategy === null) {
|
|
1824
|
+
return [];
|
|
1825
|
+
}
|
|
1826
|
+
if (!resolvedManifest?.manifest.bundleGraph) {
|
|
1827
|
+
return getBundles(qrls);
|
|
1828
|
+
}
|
|
1829
|
+
if (typeof prefetchStrategy?.symbolsToPrefetch === "function") {
|
|
1830
|
+
try {
|
|
1831
|
+
const prefetchResources = prefetchStrategy.symbolsToPrefetch({
|
|
1832
|
+
manifest: resolvedManifest.manifest
|
|
1833
|
+
});
|
|
1834
|
+
return flattenPrefetchResources(prefetchResources);
|
|
1835
|
+
} catch (e) {
|
|
1836
|
+
console.error("getPrefetchUrls, symbolsToPrefetch()", e);
|
|
1837
|
+
}
|
|
1838
|
+
}
|
|
1839
|
+
const symbols = /* @__PURE__ */ new Set();
|
|
1840
|
+
for (const qrl of qrls) {
|
|
1841
|
+
const symbol = getSymbolHash(qrl.$symbol$);
|
|
1842
|
+
if (symbol && symbol.length >= 10) {
|
|
1843
|
+
symbols.add(symbol);
|
|
1844
|
+
}
|
|
1845
|
+
}
|
|
1846
|
+
return [...symbols];
|
|
1709
1847
|
}
|
|
1848
|
+
var expandBundles = (names, resolvedManifest) => {
|
|
1849
|
+
if (!resolvedManifest?.manifest.bundleGraph) {
|
|
1850
|
+
return [...new Set(names)];
|
|
1851
|
+
}
|
|
1852
|
+
resetQueue();
|
|
1853
|
+
let probability = 0.99;
|
|
1854
|
+
for (const name of names) {
|
|
1855
|
+
preload(name, probability);
|
|
1856
|
+
probability *= 0.95;
|
|
1857
|
+
}
|
|
1858
|
+
return getQueue();
|
|
1859
|
+
};
|
|
1860
|
+
|
|
1861
|
+
// packages/qwik/src/server/preload-impl.ts
|
|
1862
|
+
var simplifyPath = (base2, path) => {
|
|
1863
|
+
if (path == null) {
|
|
1864
|
+
return null;
|
|
1865
|
+
}
|
|
1866
|
+
const segments = `${base2}${path}`.split("/");
|
|
1867
|
+
const simplified = [];
|
|
1868
|
+
for (const segment of segments) {
|
|
1869
|
+
if (segment === ".." && simplified.length > 0) {
|
|
1870
|
+
simplified.pop();
|
|
1871
|
+
} else {
|
|
1872
|
+
simplified.push(segment);
|
|
1873
|
+
}
|
|
1874
|
+
}
|
|
1875
|
+
return simplified.join("/");
|
|
1876
|
+
};
|
|
1877
|
+
var getBase = (container) => {
|
|
1878
|
+
let base2 = container.$buildBase$;
|
|
1879
|
+
if (import.meta.env.DEV && !import.meta.env.TEST) {
|
|
1880
|
+
base2 = import.meta.env.BASE_URL;
|
|
1881
|
+
}
|
|
1882
|
+
return base2;
|
|
1883
|
+
};
|
|
1884
|
+
var preloaderPre = (container, options, nonce) => {
|
|
1885
|
+
const { resolvedManifest } = container;
|
|
1886
|
+
const base2 = getBase(container);
|
|
1887
|
+
const preloaderBundle = simplifyPath(base2, resolvedManifest?.manifest?.preloader);
|
|
1888
|
+
let bundleGraphPath = resolvedManifest?.manifest.bundleGraphAsset;
|
|
1889
|
+
if (bundleGraphPath) {
|
|
1890
|
+
bundleGraphPath = (import.meta.env.BASE_URL || "/") + bundleGraphPath;
|
|
1891
|
+
}
|
|
1892
|
+
if (preloaderBundle && bundleGraphPath && options !== false) {
|
|
1893
|
+
const preloaderOpts = typeof options === "object" ? {
|
|
1894
|
+
debug: options.debug,
|
|
1895
|
+
preloadProbability: options.ssrPreloadProbability
|
|
1896
|
+
} : void 0;
|
|
1897
|
+
const bundleGraph = container.resolvedManifest?.manifest.bundleGraph;
|
|
1898
|
+
initPreloader(bundleGraph, preloaderOpts);
|
|
1899
|
+
const opts = [];
|
|
1900
|
+
if (options) {
|
|
1901
|
+
if (options.debug) {
|
|
1902
|
+
opts.push("d:1");
|
|
1903
|
+
}
|
|
1904
|
+
if (options.maxIdlePreloads) {
|
|
1905
|
+
opts.push(`P:${options.maxIdlePreloads}`);
|
|
1906
|
+
}
|
|
1907
|
+
if (options.preloadProbability) {
|
|
1908
|
+
opts.push(`Q:${options.preloadProbability}`);
|
|
1909
|
+
}
|
|
1910
|
+
}
|
|
1911
|
+
const optsStr = opts.length ? `,{${opts.join(",")}}` : "";
|
|
1912
|
+
const preloaderLinkAttrs = ["rel", "modulepreload", "href", preloaderBundle];
|
|
1913
|
+
if (nonce) {
|
|
1914
|
+
preloaderLinkAttrs.push("nonce", nonce);
|
|
1915
|
+
}
|
|
1916
|
+
container.openElement("link", null, preloaderLinkAttrs);
|
|
1917
|
+
container.closeElement();
|
|
1918
|
+
container.openElement("link", null, [
|
|
1919
|
+
"rel",
|
|
1920
|
+
"preload",
|
|
1921
|
+
"href",
|
|
1922
|
+
bundleGraphPath,
|
|
1923
|
+
"as",
|
|
1924
|
+
"fetch",
|
|
1925
|
+
"crossorigin",
|
|
1926
|
+
"anonymous"
|
|
1927
|
+
]);
|
|
1928
|
+
container.closeElement();
|
|
1929
|
+
const script = `let b=fetch("${bundleGraphPath}");import("${preloaderBundle}").then(({l})=>l(${JSON.stringify(base2)},b${optsStr}));`;
|
|
1930
|
+
const scriptAttrs = ["type", "module", "async", true];
|
|
1931
|
+
if (nonce) {
|
|
1932
|
+
scriptAttrs.push("nonce", nonce);
|
|
1933
|
+
}
|
|
1934
|
+
container.openElement("script", null, scriptAttrs);
|
|
1935
|
+
container.writer.write(script);
|
|
1936
|
+
container.closeElement();
|
|
1937
|
+
}
|
|
1938
|
+
const corePath = simplifyPath(base2, resolvedManifest?.manifest.core);
|
|
1939
|
+
if (corePath) {
|
|
1940
|
+
const linkAttrs = ["rel", "modulepreload", "href", corePath];
|
|
1941
|
+
if (nonce) {
|
|
1942
|
+
linkAttrs.push("nonce", nonce);
|
|
1943
|
+
}
|
|
1944
|
+
container.openElement("link", null, linkAttrs);
|
|
1945
|
+
container.closeElement();
|
|
1946
|
+
}
|
|
1947
|
+
};
|
|
1948
|
+
var includePreloader = (container, options, referencedBundles, nonce) => {
|
|
1949
|
+
if (referencedBundles.length === 0 || options === false) {
|
|
1950
|
+
return null;
|
|
1951
|
+
}
|
|
1952
|
+
const { ssrPreloads, ssrPreloadProbability } = normalizePreLoaderOptions(
|
|
1953
|
+
typeof options === "boolean" ? void 0 : options
|
|
1954
|
+
);
|
|
1955
|
+
let allowed = ssrPreloads;
|
|
1956
|
+
const base2 = getBase(container);
|
|
1957
|
+
const links = [];
|
|
1958
|
+
const { resolvedManifest } = container;
|
|
1959
|
+
if (allowed) {
|
|
1960
|
+
const preloaderBundle2 = resolvedManifest?.manifest.preloader;
|
|
1961
|
+
const coreBundle = resolvedManifest?.manifest.core;
|
|
1962
|
+
const expandedBundles = expandBundles(referencedBundles, resolvedManifest);
|
|
1963
|
+
let probability = 4;
|
|
1964
|
+
const tenXMinProbability = ssrPreloadProbability * 10;
|
|
1965
|
+
for (const hrefOrProbability of expandedBundles) {
|
|
1966
|
+
if (typeof hrefOrProbability === "string") {
|
|
1967
|
+
if (probability < tenXMinProbability) {
|
|
1968
|
+
break;
|
|
1969
|
+
}
|
|
1970
|
+
if (hrefOrProbability === preloaderBundle2 || hrefOrProbability === coreBundle) {
|
|
1971
|
+
continue;
|
|
1972
|
+
}
|
|
1973
|
+
links.push(hrefOrProbability);
|
|
1974
|
+
if (--allowed === 0) {
|
|
1975
|
+
break;
|
|
1976
|
+
}
|
|
1977
|
+
} else {
|
|
1978
|
+
probability = hrefOrProbability;
|
|
1979
|
+
}
|
|
1980
|
+
}
|
|
1981
|
+
}
|
|
1982
|
+
const preloaderBundle = simplifyPath(base2, resolvedManifest?.manifest.preloader);
|
|
1983
|
+
const insertLinks = links.length ? (
|
|
1984
|
+
/**
|
|
1985
|
+
* We only use modulepreload links because they behave best. Older browsers can rely on the
|
|
1986
|
+
* preloader which does feature detection and which will be available soon after inserting these
|
|
1987
|
+
* links.
|
|
1988
|
+
*/
|
|
1989
|
+
`${JSON.stringify(links)}.map((l,e)=>{e=document.createElement('link');e.rel='modulepreload';e.href=${JSON.stringify(base2)}+l;document.head.appendChild(e)});`
|
|
1990
|
+
) : "";
|
|
1991
|
+
let script = insertLinks;
|
|
1992
|
+
if (preloaderBundle) {
|
|
1993
|
+
script += `window.addEventListener('load',f=>{f=_=>import("${preloaderBundle}").then(({p})=>p(${JSON.stringify(referencedBundles)}));try{requestIdleCallback(f,{timeout:2000})}catch(e){setTimeout(f,200)}})`;
|
|
1994
|
+
}
|
|
1995
|
+
if (script) {
|
|
1996
|
+
const attrs = ["type", "module", "async", true, "q:type", "preload"];
|
|
1997
|
+
if (nonce) {
|
|
1998
|
+
attrs.push("nonce", nonce);
|
|
1999
|
+
}
|
|
2000
|
+
container.openElement("script", null, attrs);
|
|
2001
|
+
container.writer.write(script);
|
|
2002
|
+
container.closeElement();
|
|
2003
|
+
}
|
|
2004
|
+
return null;
|
|
2005
|
+
};
|
|
2006
|
+
var preloaderPost = (ssrContainer, opts, nonce) => {
|
|
2007
|
+
if (opts.preloader !== false) {
|
|
2008
|
+
const qrls = Array.from(ssrContainer.serializationCtx.$eventQrls$);
|
|
2009
|
+
const preloadBundles = getPreloadPaths(qrls, opts, ssrContainer.resolvedManifest);
|
|
2010
|
+
if (preloadBundles.length > 0) {
|
|
2011
|
+
includePreloader(ssrContainer, opts.preloader, preloadBundles, nonce);
|
|
2012
|
+
}
|
|
2013
|
+
}
|
|
2014
|
+
};
|
|
2015
|
+
function normalizePreLoaderOptions(input) {
|
|
2016
|
+
return { ...preLoaderOptionsDefault, ...input };
|
|
2017
|
+
}
|
|
2018
|
+
var preLoaderOptionsDefault = {
|
|
2019
|
+
ssrPreloads: 7,
|
|
2020
|
+
ssrPreloadProbability: 0.5,
|
|
2021
|
+
debug: false,
|
|
2022
|
+
maxIdlePreloads: 25,
|
|
2023
|
+
preloadProbability: 0.35
|
|
2024
|
+
// deprecated
|
|
2025
|
+
};
|
|
1710
2026
|
|
|
1711
2027
|
// packages/qwik/src/server/ssr-container.ts
|
|
1712
2028
|
function ssrCreateContainer(opts) {
|
|
@@ -1725,10 +2041,7 @@ function ssrCreateContainer(opts) {
|
|
|
1725
2041
|
mapper: {},
|
|
1726
2042
|
manifest: {
|
|
1727
2043
|
manifestHash: "dev",
|
|
1728
|
-
mapping: {}
|
|
1729
|
-
bundles: {},
|
|
1730
|
-
symbols: {},
|
|
1731
|
-
version: "dev-mode"
|
|
2044
|
+
mapping: {}
|
|
1732
2045
|
}
|
|
1733
2046
|
},
|
|
1734
2047
|
renderOptions: opts.renderOptions
|
|
@@ -1748,25 +2061,14 @@ var StringBufferWriter = class {
|
|
|
1748
2061
|
var EMPTY_OBJ = {};
|
|
1749
2062
|
var SSRContainer = class extends _SharedContainer {
|
|
1750
2063
|
constructor(opts) {
|
|
1751
|
-
super(
|
|
1752
|
-
() => {
|
|
1753
|
-
try {
|
|
1754
|
-
return this.$scheduler$(255 /* WAIT_FOR_ALL */);
|
|
1755
|
-
} catch (e) {
|
|
1756
|
-
this.handleError(e, null);
|
|
1757
|
-
}
|
|
1758
|
-
},
|
|
1759
|
-
() => null,
|
|
1760
|
-
opts.renderOptions.serverData ?? EMPTY_OBJ,
|
|
1761
|
-
opts.locale
|
|
1762
|
-
);
|
|
2064
|
+
super(() => null, opts.renderOptions.serverData ?? EMPTY_OBJ, opts.locale);
|
|
1763
2065
|
__publicField(this, "tag");
|
|
2066
|
+
__publicField(this, "isHtml");
|
|
1764
2067
|
__publicField(this, "writer");
|
|
1765
2068
|
__publicField(this, "timing");
|
|
1766
2069
|
__publicField(this, "resolvedManifest");
|
|
1767
2070
|
__publicField(this, "symbolToChunkResolver");
|
|
1768
2071
|
__publicField(this, "renderOptions");
|
|
1769
|
-
__publicField(this, "prefetchResources", []);
|
|
1770
2072
|
__publicField(this, "serializationCtx");
|
|
1771
2073
|
/**
|
|
1772
2074
|
* We use this to append additional nodes in the head node
|
|
@@ -1784,6 +2086,8 @@ var SSRContainer = class extends _SharedContainer {
|
|
|
1784
2086
|
__publicField(this, "lastNode", null);
|
|
1785
2087
|
__publicField(this, "currentComponentNode", null);
|
|
1786
2088
|
__publicField(this, "styleIds", /* @__PURE__ */ new Set());
|
|
2089
|
+
__publicField(this, "isBackpatchExecutorEmitted", false);
|
|
2090
|
+
__publicField(this, "backpatchMap", /* @__PURE__ */ new Map());
|
|
1787
2091
|
__publicField(this, "currentElementFrame", null);
|
|
1788
2092
|
__publicField(this, "renderTimer");
|
|
1789
2093
|
/**
|
|
@@ -1810,11 +2114,11 @@ var SSRContainer = class extends _SharedContainer {
|
|
|
1810
2114
|
SsrNode,
|
|
1811
2115
|
DomRef,
|
|
1812
2116
|
this.symbolToChunkResolver,
|
|
1813
|
-
opts.writer
|
|
1814
|
-
(vNodeData) => this.addVNodeToSerializationRoots(vNodeData)
|
|
2117
|
+
opts.writer
|
|
1815
2118
|
);
|
|
1816
2119
|
this.renderTimer = createTimer();
|
|
1817
2120
|
this.tag = opts.tagName;
|
|
2121
|
+
this.isHtml = opts.tagName === "html";
|
|
1818
2122
|
this.writer = opts.writer;
|
|
1819
2123
|
this.timing = opts.timing;
|
|
1820
2124
|
this.$buildBase$ = opts.buildBase;
|
|
@@ -1827,6 +2131,16 @@ var SSRContainer = class extends _SharedContainer {
|
|
|
1827
2131
|
handleError(err, _$host$) {
|
|
1828
2132
|
throw err;
|
|
1829
2133
|
}
|
|
2134
|
+
addBackpatchEntry(ssrNodeId, attrName, serializedValue) {
|
|
2135
|
+
const elementIndex = parseInt(ssrNodeId, 10);
|
|
2136
|
+
const entry = {
|
|
2137
|
+
attrName,
|
|
2138
|
+
value: serializedValue
|
|
2139
|
+
};
|
|
2140
|
+
const entries = this.backpatchMap.get(elementIndex) || [];
|
|
2141
|
+
entries.push(entry);
|
|
2142
|
+
this.backpatchMap.set(elementIndex, entries);
|
|
2143
|
+
}
|
|
1830
2144
|
async render(jsx) {
|
|
1831
2145
|
this.openContainer();
|
|
1832
2146
|
await _walkJSX(this, jsx, {
|
|
@@ -1838,29 +2152,26 @@ var SSRContainer = class extends _SharedContainer {
|
|
|
1838
2152
|
setContext(host, context, value) {
|
|
1839
2153
|
const ssrNode = host;
|
|
1840
2154
|
let ctx = ssrNode.getProp(QCtxAttr);
|
|
1841
|
-
if (
|
|
2155
|
+
if (ctx == null) {
|
|
1842
2156
|
ssrNode.setProp(QCtxAttr, ctx = []);
|
|
1843
2157
|
}
|
|
1844
|
-
mapArray_set(ctx, context.id, value, 0);
|
|
2158
|
+
mapArray_set(ctx, context.id, value, 0, true);
|
|
1845
2159
|
this.addRoot(ssrNode);
|
|
1846
2160
|
}
|
|
1847
2161
|
resolveContext(host, contextId) {
|
|
1848
2162
|
let ssrNode = host;
|
|
1849
2163
|
while (ssrNode) {
|
|
1850
2164
|
const ctx = ssrNode.getProp(QCtxAttr);
|
|
1851
|
-
if (ctx) {
|
|
1852
|
-
|
|
1853
|
-
if (value) {
|
|
1854
|
-
return value;
|
|
1855
|
-
}
|
|
2165
|
+
if (ctx != null && mapArray_has(ctx, contextId.id, 0)) {
|
|
2166
|
+
return mapArray_get(ctx, contextId.id, 0);
|
|
1856
2167
|
}
|
|
1857
|
-
ssrNode = ssrNode.
|
|
2168
|
+
ssrNode = ssrNode.parentComponent;
|
|
1858
2169
|
}
|
|
1859
2170
|
return void 0;
|
|
1860
2171
|
}
|
|
1861
2172
|
getParentHost(host) {
|
|
1862
2173
|
const ssrNode = host;
|
|
1863
|
-
return ssrNode.
|
|
2174
|
+
return ssrNode.parentComponent;
|
|
1864
2175
|
}
|
|
1865
2176
|
setHostProp(host, name, value) {
|
|
1866
2177
|
const ssrNode = host;
|
|
@@ -1883,7 +2194,7 @@ var SSRContainer = class extends _SharedContainer {
|
|
|
1883
2194
|
containerAttributes[QContainerAttr] = "paused" /* PAUSED */;
|
|
1884
2195
|
containerAttributes[QRuntimeAttr] = "2";
|
|
1885
2196
|
containerAttributes[QVersionAttr] = this.$version$ ?? "dev";
|
|
1886
|
-
containerAttributes[QRenderAttr] = (qRender ? qRender + "-" : "") + (
|
|
2197
|
+
containerAttributes[QRenderAttr] = (qRender ? qRender + "-" : "") + (isDev5 ? "ssr-dev" : "ssr");
|
|
1887
2198
|
containerAttributes[QBaseAttr] = this.$buildBase$ || "";
|
|
1888
2199
|
containerAttributes[QLocaleAttr] = this.$locale$;
|
|
1889
2200
|
containerAttributes[QManifestHashAttr] = this.resolvedManifest.manifest.manifestHash;
|
|
@@ -1914,16 +2225,19 @@ var SSRContainer = class extends _SharedContainer {
|
|
|
1914
2225
|
vNodeData_openElement(this.currentElementFrame.vNodeData);
|
|
1915
2226
|
this.write("<");
|
|
1916
2227
|
this.write(elementName);
|
|
2228
|
+
const lastNode = this.getOrCreateLastNode();
|
|
1917
2229
|
if (varAttrs) {
|
|
1918
2230
|
innerHTML = this.writeAttrs(elementName, varAttrs, false, currentFile);
|
|
1919
2231
|
}
|
|
1920
2232
|
this.write(" " + Q_PROPS_SEPARATOR);
|
|
1921
|
-
|
|
2233
|
+
isDev5 && this.write('=""');
|
|
1922
2234
|
if (constAttrs && constAttrs.length) {
|
|
1923
2235
|
innerHTML = this.writeAttrs(elementName, constAttrs, true, currentFile) || innerHTML;
|
|
1924
2236
|
}
|
|
1925
2237
|
this.write(">");
|
|
1926
|
-
|
|
2238
|
+
if (lastNode) {
|
|
2239
|
+
lastNode.setTreeNonUpdatable();
|
|
2240
|
+
}
|
|
1927
2241
|
return innerHTML;
|
|
1928
2242
|
}
|
|
1929
2243
|
/** Renders closing tag for DOM element */
|
|
@@ -1981,17 +2295,15 @@ var SSRContainer = class extends _SharedContainer {
|
|
|
1981
2295
|
openFragment(attrs) {
|
|
1982
2296
|
this.lastNode = null;
|
|
1983
2297
|
vNodeData_openFragment(this.currentElementFrame.vNodeData, attrs);
|
|
2298
|
+
this.getOrCreateLastNode();
|
|
1984
2299
|
}
|
|
1985
2300
|
/** Writes closing data to vNodeData for fragment boundaries */
|
|
1986
2301
|
closeFragment() {
|
|
1987
2302
|
vNodeData_closeFragment(this.currentElementFrame.vNodeData);
|
|
1988
|
-
this.
|
|
1989
|
-
|
|
1990
|
-
addCurrentElementFrameAsComponentChild() {
|
|
1991
|
-
const vNode = this.currentElementFrame?.vNodeData;
|
|
1992
|
-
if (vNode) {
|
|
1993
|
-
this.currentComponentNode?.addChildVNodeData(vNode);
|
|
2303
|
+
if (this.currentComponentNode) {
|
|
2304
|
+
this.currentComponentNode.setTreeNonUpdatable();
|
|
1994
2305
|
}
|
|
2306
|
+
this.lastNode = null;
|
|
1995
2307
|
}
|
|
1996
2308
|
openProjection(attrs) {
|
|
1997
2309
|
this.openFragment(attrs);
|
|
@@ -2011,7 +2323,7 @@ var SSRContainer = class extends _SharedContainer {
|
|
|
2011
2323
|
/** Writes opening data to vNodeData for component boundaries */
|
|
2012
2324
|
openComponent(attrs) {
|
|
2013
2325
|
this.openFragment(attrs);
|
|
2014
|
-
this.currentComponentNode = this.
|
|
2326
|
+
this.currentComponentNode = this.getOrCreateLastNode();
|
|
2015
2327
|
this.componentStack.push(new SsrComponentFrame(this.currentComponentNode));
|
|
2016
2328
|
}
|
|
2017
2329
|
/**
|
|
@@ -2035,7 +2347,7 @@ var SSRContainer = class extends _SharedContainer {
|
|
|
2035
2347
|
const componentFrame = this.componentStack.pop();
|
|
2036
2348
|
componentFrame.releaseUnclaimedProjections(this.unclaimedProjections);
|
|
2037
2349
|
this.closeFragment();
|
|
2038
|
-
this.currentComponentNode = this.currentComponentNode?.
|
|
2350
|
+
this.currentComponentNode = this.currentComponentNode?.parentComponent || null;
|
|
2039
2351
|
}
|
|
2040
2352
|
/** Write a text node with correct escaping. Save the length of the text node in the vNodeData. */
|
|
2041
2353
|
textNode(text) {
|
|
@@ -2055,14 +2367,15 @@ var SSRContainer = class extends _SharedContainer {
|
|
|
2055
2367
|
}
|
|
2056
2368
|
return this.serializationCtx.$addRoot$(obj);
|
|
2057
2369
|
}
|
|
2058
|
-
|
|
2370
|
+
getOrCreateLastNode() {
|
|
2059
2371
|
if (!this.lastNode) {
|
|
2060
2372
|
this.lastNode = vNodeData_createSsrNodeReference(
|
|
2061
2373
|
this.currentComponentNode,
|
|
2062
2374
|
this.currentElementFrame.vNodeData,
|
|
2063
2375
|
// we start at -1, so we need to add +1
|
|
2064
2376
|
this.currentElementFrame.depthFirstElementIdx + 1,
|
|
2065
|
-
this.cleanupQueue
|
|
2377
|
+
this.cleanupQueue,
|
|
2378
|
+
this.currentElementFrame.currentFile
|
|
2066
2379
|
);
|
|
2067
2380
|
}
|
|
2068
2381
|
return this.lastNode;
|
|
@@ -2122,8 +2435,10 @@ var SSRContainer = class extends _SharedContainer {
|
|
|
2122
2435
|
() => maybeThen(this.emitStateData(), () => {
|
|
2123
2436
|
this.$noMoreRoots$ = true;
|
|
2124
2437
|
this.emitVNodeData();
|
|
2125
|
-
this.
|
|
2438
|
+
preloaderPost(this, this.renderOptions, this.$serverData$?.nonce);
|
|
2126
2439
|
this.emitSyncFnsData();
|
|
2440
|
+
this.emitPatchDataIfNeeded();
|
|
2441
|
+
this.emitExecutorIfNeeded();
|
|
2127
2442
|
this.emitQwikLoaderAtBottomIfNeeded();
|
|
2128
2443
|
})
|
|
2129
2444
|
);
|
|
@@ -2207,6 +2522,7 @@ var SSRContainer = class extends _SharedContainer {
|
|
|
2207
2522
|
for (let i = 0; i < fragmentAttrs.length; ) {
|
|
2208
2523
|
const key = fragmentAttrs[i++];
|
|
2209
2524
|
let value = fragmentAttrs[i++];
|
|
2525
|
+
let encodeValue = false;
|
|
2210
2526
|
if (typeof value !== "string") {
|
|
2211
2527
|
const rootId = addRoot(value);
|
|
2212
2528
|
if (rootId === void 0) {
|
|
@@ -2228,6 +2544,7 @@ var SSRContainer = class extends _SharedContainer {
|
|
|
2228
2544
|
write(VNodeDataChar.PROPS_CHAR);
|
|
2229
2545
|
break;
|
|
2230
2546
|
case ELEMENT_KEY:
|
|
2547
|
+
encodeValue = true;
|
|
2231
2548
|
write(VNodeDataChar.KEY_CHAR);
|
|
2232
2549
|
break;
|
|
2233
2550
|
case ELEMENT_SEQ:
|
|
@@ -2254,60 +2571,25 @@ var SSRContainer = class extends _SharedContainer {
|
|
|
2254
2571
|
write(key);
|
|
2255
2572
|
write(VNodeDataChar.SEPARATOR_CHAR);
|
|
2256
2573
|
}
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
const flag = vNodeData[0];
|
|
2266
|
-
if (flag !== 0 /* NONE */) {
|
|
2267
|
-
if (flag & (1 /* TEXT_DATA */ | 2 /* VIRTUAL_NODE */)) {
|
|
2268
|
-
let fragmentAttrs = null;
|
|
2269
|
-
let depth = 0;
|
|
2270
|
-
for (let i = 1; i < vNodeData.length; i++) {
|
|
2271
|
-
const value = vNodeData[i];
|
|
2272
|
-
if (Array.isArray(value)) {
|
|
2273
|
-
vNodeAttrsStack.push(fragmentAttrs);
|
|
2274
|
-
fragmentAttrs = value;
|
|
2275
|
-
} else if (value === OPEN_FRAGMENT) {
|
|
2276
|
-
depth++;
|
|
2277
|
-
} else if (value === CLOSE_FRAGMENT) {
|
|
2278
|
-
if (fragmentAttrs) {
|
|
2279
|
-
for (let i2 = 1; i2 < fragmentAttrs.length; i2 += 2) {
|
|
2280
|
-
const value2 = fragmentAttrs[i2];
|
|
2281
|
-
if (typeof value2 !== "string") {
|
|
2282
|
-
fragmentAttrs[i2] = String(this.addRoot(value2));
|
|
2283
|
-
}
|
|
2284
|
-
}
|
|
2285
|
-
fragmentAttrs = vNodeAttrsStack.pop();
|
|
2286
|
-
}
|
|
2287
|
-
depth--;
|
|
2288
|
-
}
|
|
2289
|
-
}
|
|
2290
|
-
while (depth-- > 0) {
|
|
2291
|
-
if (fragmentAttrs) {
|
|
2292
|
-
for (let i = 0; i < fragmentAttrs.length; i++) {
|
|
2293
|
-
const value = fragmentAttrs[i];
|
|
2294
|
-
if (typeof value !== "string") {
|
|
2295
|
-
fragmentAttrs[i] = String(this.addRoot(value));
|
|
2296
|
-
}
|
|
2297
|
-
}
|
|
2298
|
-
fragmentAttrs = vNodeAttrsStack.pop();
|
|
2299
|
-
}
|
|
2574
|
+
const encodedValue = encodeValue ? encodeURI(value) : value;
|
|
2575
|
+
const isEncoded = encodeValue ? encodedValue !== value : false;
|
|
2576
|
+
if (isEncoded) {
|
|
2577
|
+
write(VNodeDataChar.SEPARATOR_CHAR);
|
|
2578
|
+
write(encodedValue);
|
|
2579
|
+
write(VNodeDataChar.SEPARATOR_CHAR);
|
|
2580
|
+
} else {
|
|
2581
|
+
write(value);
|
|
2300
2582
|
}
|
|
2301
2583
|
}
|
|
2302
2584
|
}
|
|
2585
|
+
this.closeElement();
|
|
2303
2586
|
}
|
|
2304
2587
|
emitStateData() {
|
|
2305
2588
|
if (!this.serializationCtx.$roots$.length) {
|
|
2306
2589
|
return;
|
|
2307
2590
|
}
|
|
2308
2591
|
this.openElement("script", ["type", "qwik/state"]);
|
|
2309
|
-
return maybeThen(this.serializationCtx.$
|
|
2310
|
-
this.serializationCtx.$serialize$();
|
|
2592
|
+
return maybeThen(this.serializationCtx.$serialize$(), () => {
|
|
2311
2593
|
this.closeElement();
|
|
2312
2594
|
});
|
|
2313
2595
|
}
|
|
@@ -2326,83 +2608,97 @@ var SSRContainer = class extends _SharedContainer {
|
|
|
2326
2608
|
this.closeElement();
|
|
2327
2609
|
}
|
|
2328
2610
|
}
|
|
2329
|
-
|
|
2330
|
-
const
|
|
2331
|
-
|
|
2332
|
-
const
|
|
2333
|
-
|
|
2334
|
-
this.renderOptions,
|
|
2335
|
-
this.resolvedManifest
|
|
2336
|
-
);
|
|
2337
|
-
if (prefetchResources.length > 0) {
|
|
2338
|
-
applyPrefetchImplementation2(this, this.renderOptions.prefetchStrategy, prefetchResources);
|
|
2339
|
-
this.prefetchResources = prefetchResources;
|
|
2611
|
+
emitPatchDataIfNeeded() {
|
|
2612
|
+
const patches = [];
|
|
2613
|
+
for (const [elementIndex, backpatchEntries] of this.backpatchMap) {
|
|
2614
|
+
for (const backpatchEntry of backpatchEntries) {
|
|
2615
|
+
patches.push(elementIndex, backpatchEntry.attrName, backpatchEntry.value);
|
|
2340
2616
|
}
|
|
2341
2617
|
}
|
|
2618
|
+
this.backpatchMap.clear();
|
|
2619
|
+
if (patches.length > 0) {
|
|
2620
|
+
this.isBackpatchExecutorEmitted = true;
|
|
2621
|
+
const scriptAttrs = ["type", ELEMENT_BACKPATCH_DATA];
|
|
2622
|
+
if (this.renderOptions.serverData?.nonce) {
|
|
2623
|
+
scriptAttrs.push("nonce", this.renderOptions.serverData.nonce);
|
|
2624
|
+
}
|
|
2625
|
+
this.openElement("script", scriptAttrs);
|
|
2626
|
+
this.write(JSON.stringify(patches));
|
|
2627
|
+
this.closeElement();
|
|
2628
|
+
}
|
|
2629
|
+
}
|
|
2630
|
+
emitExecutorIfNeeded() {
|
|
2631
|
+
if (!this.isBackpatchExecutorEmitted) {
|
|
2632
|
+
return;
|
|
2633
|
+
}
|
|
2634
|
+
const scriptAttrs = ["type", "text/javascript"];
|
|
2635
|
+
if (this.renderOptions.serverData?.nonce) {
|
|
2636
|
+
scriptAttrs.push("nonce", this.renderOptions.serverData.nonce);
|
|
2637
|
+
}
|
|
2638
|
+
this.openElement("script", scriptAttrs);
|
|
2639
|
+
const backpatchScript = getQwikBackpatchExecutorScript({ debug: isDev5 });
|
|
2640
|
+
this.write(backpatchScript);
|
|
2641
|
+
this.closeElement();
|
|
2642
|
+
}
|
|
2643
|
+
emitPreloaderPre() {
|
|
2644
|
+
preloaderPre(this, this.renderOptions.preloader, this.renderOptions.serverData?.nonce);
|
|
2342
2645
|
}
|
|
2343
2646
|
isStatic() {
|
|
2344
2647
|
return this.serializationCtx.$eventQrls$.size === 0;
|
|
2345
2648
|
}
|
|
2346
|
-
getQwikLoaderPositionMode() {
|
|
2347
|
-
return this.renderOptions.qwikLoader?.position ?? "bottom";
|
|
2348
|
-
}
|
|
2349
2649
|
getQwikLoaderIncludeMode() {
|
|
2350
2650
|
return this.renderOptions.qwikLoader?.include ?? "auto";
|
|
2351
2651
|
}
|
|
2352
2652
|
emitQwikLoaderAtTopIfNeeded() {
|
|
2353
|
-
const
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
if (
|
|
2358
|
-
this
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2653
|
+
const includeMode = this.getQwikLoaderIncludeMode();
|
|
2654
|
+
const includeLoader = includeMode !== "never";
|
|
2655
|
+
if (includeLoader) {
|
|
2656
|
+
let qwikLoaderBundle = this.resolvedManifest.manifest.qwikLoader;
|
|
2657
|
+
if (qwikLoaderBundle) {
|
|
2658
|
+
qwikLoaderBundle = this.$buildBase$ + qwikLoaderBundle;
|
|
2659
|
+
const linkAttrs = ["rel", "modulepreload", "href", qwikLoaderBundle];
|
|
2660
|
+
const nonce = this.renderOptions.serverData?.nonce;
|
|
2661
|
+
if (nonce) {
|
|
2662
|
+
linkAttrs.push("nonce", nonce);
|
|
2663
|
+
}
|
|
2664
|
+
this.openElement("link", linkAttrs);
|
|
2665
|
+
this.closeElement();
|
|
2666
|
+
const scriptAttrs = ["type", "module", "async", true, "src", qwikLoaderBundle];
|
|
2667
|
+
if (nonce) {
|
|
2668
|
+
scriptAttrs.push("nonce", nonce);
|
|
2669
|
+
}
|
|
2670
|
+
this.openElement("script", scriptAttrs);
|
|
2671
|
+
this.closeElement();
|
|
2363
2672
|
}
|
|
2364
2673
|
}
|
|
2365
2674
|
}
|
|
2366
2675
|
emitQwikLoaderAtBottomIfNeeded() {
|
|
2367
|
-
const
|
|
2368
|
-
|
|
2369
|
-
if (positionMode === "bottom") {
|
|
2676
|
+
const qwikLoaderBundle = this.resolvedManifest.manifest.qwikLoader;
|
|
2677
|
+
if (!qwikLoaderBundle) {
|
|
2370
2678
|
const needLoader = !this.isStatic();
|
|
2371
2679
|
const includeMode = this.getQwikLoaderIncludeMode();
|
|
2372
|
-
includeLoader = includeMode === "always" || includeMode === "auto" && needLoader;
|
|
2680
|
+
const includeLoader = includeMode === "always" || includeMode === "auto" && needLoader;
|
|
2373
2681
|
if (includeLoader) {
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2682
|
+
const qwikLoaderScript = getQwikLoaderScript({
|
|
2683
|
+
debug: this.renderOptions.debug
|
|
2684
|
+
});
|
|
2685
|
+
const scriptAttrs = ["id", "qwikloader", "async", true, "type", "module"];
|
|
2686
|
+
const nonce = this.renderOptions.serverData?.nonce;
|
|
2687
|
+
if (nonce) {
|
|
2688
|
+
scriptAttrs.push("nonce", nonce);
|
|
2689
|
+
}
|
|
2690
|
+
this.openElement("script", scriptAttrs);
|
|
2691
|
+
this.write(qwikLoaderScript);
|
|
2692
|
+
this.closeElement();
|
|
2382
2693
|
}
|
|
2383
|
-
);
|
|
2384
|
-
}
|
|
2385
|
-
emitQwikLoader() {
|
|
2386
|
-
const qwikLoaderScript = getQwikLoaderScript({
|
|
2387
|
-
debug: this.renderOptions.debug
|
|
2388
|
-
});
|
|
2389
|
-
const scriptAttrs = ["id", "qwikloader"];
|
|
2390
|
-
if (this.renderOptions.serverData?.nonce) {
|
|
2391
|
-
scriptAttrs.push("nonce", this.renderOptions.serverData.nonce);
|
|
2392
2694
|
}
|
|
2393
|
-
this.
|
|
2394
|
-
this.write(qwikLoaderScript);
|
|
2395
|
-
this.closeElement();
|
|
2695
|
+
this.emitQwikEvents(Array.from(this.serializationCtx.$eventNames$, (s) => JSON.stringify(s)));
|
|
2396
2696
|
}
|
|
2397
|
-
emitQwikEvents(eventNames
|
|
2697
|
+
emitQwikEvents(eventNames) {
|
|
2398
2698
|
if (eventNames.length > 0) {
|
|
2399
|
-
const scriptAttrs = [];
|
|
2400
|
-
if (this.renderOptions.serverData?.nonce && opts.includeNonce) {
|
|
2401
|
-
scriptAttrs.push("nonce", this.renderOptions.serverData.nonce);
|
|
2402
|
-
}
|
|
2699
|
+
const scriptAttrs = this.renderOptions.serverData?.nonce ? ["nonce", this.renderOptions.serverData.nonce] : null;
|
|
2403
2700
|
this.openElement("script", scriptAttrs);
|
|
2404
|
-
this.write(
|
|
2405
|
-
this.write(".push(");
|
|
2701
|
+
this.write(`(window.qwikevents||(window.qwikevents=[])).push(`);
|
|
2406
2702
|
this.writeArray(eventNames, ", ");
|
|
2407
2703
|
this.write(")");
|
|
2408
2704
|
this.closeElement();
|
|
@@ -2413,7 +2709,7 @@ var SSRContainer = class extends _SharedContainer {
|
|
|
2413
2709
|
if (unclaimedProjections.length) {
|
|
2414
2710
|
const previousCurrentComponentNode = this.currentComponentNode;
|
|
2415
2711
|
try {
|
|
2416
|
-
this.openElement(QTemplate, ["
|
|
2712
|
+
this.openElement(QTemplate, ["hidden", true, "aria-hidden", "true"], null);
|
|
2417
2713
|
let idx = 0;
|
|
2418
2714
|
let ssrComponentNode = null;
|
|
2419
2715
|
let ssrComponentFrame = null;
|
|
@@ -2437,9 +2733,9 @@ var SSRContainer = class extends _SharedContainer {
|
|
|
2437
2733
|
}
|
|
2438
2734
|
this.unclaimedProjectionComponentFrameQueue.shift();
|
|
2439
2735
|
this.openFragment(
|
|
2440
|
-
|
|
2736
|
+
isDev5 ? [DEBUG_TYPE, "P" /* Projection */, QSlotParent, ssrComponentNode.id] : [QSlotParent, ssrComponentNode.id]
|
|
2441
2737
|
);
|
|
2442
|
-
const lastNode = this.
|
|
2738
|
+
const lastNode = this.getOrCreateLastNode();
|
|
2443
2739
|
if (lastNode.vnodeData) {
|
|
2444
2740
|
lastNode.vnodeData[0] |= 16 /* SERIALIZE */;
|
|
2445
2741
|
}
|
|
@@ -2486,7 +2782,7 @@ var SSRContainer = class extends _SharedContainer {
|
|
|
2486
2782
|
}
|
|
2487
2783
|
createAndPushFrame(elementName, depthFirstElementIdx, currentFile) {
|
|
2488
2784
|
let tagNesting = 10 /* ANYTHING */;
|
|
2489
|
-
if (
|
|
2785
|
+
if (isDev5) {
|
|
2490
2786
|
if (!this.currentElementFrame) {
|
|
2491
2787
|
tagNesting = initialTag(elementName);
|
|
2492
2788
|
} else {
|
|
@@ -2531,7 +2827,8 @@ var SSRContainer = class extends _SharedContainer {
|
|
|
2531
2827
|
parent: this.currentElementFrame,
|
|
2532
2828
|
elementName,
|
|
2533
2829
|
depthFirstElementIdx,
|
|
2534
|
-
vNodeData: [0 /* NONE */]
|
|
2830
|
+
vNodeData: [0 /* NONE */],
|
|
2831
|
+
currentFile: isDev5 ? currentFile || null : null
|
|
2535
2832
|
};
|
|
2536
2833
|
this.currentElementFrame = frame;
|
|
2537
2834
|
this.vNodeDatas.push(frame.vNodeData);
|
|
@@ -2562,8 +2859,8 @@ var SSRContainer = class extends _SharedContainer {
|
|
|
2562
2859
|
let value = attrs[i];
|
|
2563
2860
|
let styleScopedId = null;
|
|
2564
2861
|
if (isSSRUnsafeAttr(key)) {
|
|
2565
|
-
if (
|
|
2566
|
-
throw qError(
|
|
2862
|
+
if (isDev5) {
|
|
2863
|
+
throw qError(32 /* unsafeAttr */);
|
|
2567
2864
|
}
|
|
2568
2865
|
continue;
|
|
2569
2866
|
}
|
|
@@ -2573,9 +2870,9 @@ var SSRContainer = class extends _SharedContainer {
|
|
|
2573
2870
|
styleScopedId = styleId;
|
|
2574
2871
|
}
|
|
2575
2872
|
if (key === "ref") {
|
|
2576
|
-
const lastNode = this.
|
|
2873
|
+
const lastNode = this.getOrCreateLastNode();
|
|
2577
2874
|
if (isSignal(value)) {
|
|
2578
|
-
value
|
|
2875
|
+
value.$untrackedValue$ = new DomRef(lastNode);
|
|
2579
2876
|
continue;
|
|
2580
2877
|
} else if (typeof value === "function") {
|
|
2581
2878
|
value(new DomRef(lastNode));
|
|
@@ -2583,29 +2880,31 @@ var SSRContainer = class extends _SharedContainer {
|
|
|
2583
2880
|
} else if (value == null) {
|
|
2584
2881
|
continue;
|
|
2585
2882
|
} else {
|
|
2586
|
-
throw qError(
|
|
2883
|
+
throw qError(15 /* invalidRefValue */, [currentFile]);
|
|
2587
2884
|
}
|
|
2588
2885
|
}
|
|
2589
2886
|
if (isSignal(value)) {
|
|
2590
|
-
const lastNode = this.
|
|
2591
|
-
const signalData = new
|
|
2887
|
+
const lastNode = this.getOrCreateLastNode();
|
|
2888
|
+
const signalData = new SubscriptionData({
|
|
2592
2889
|
$scopedStyleIdPrefix$: styleScopedId,
|
|
2593
2890
|
$isConst$: isConst
|
|
2594
2891
|
});
|
|
2595
2892
|
value = this.trackSignalValue(value, lastNode, key, signalData);
|
|
2596
2893
|
}
|
|
2597
2894
|
if (key === dangerouslySetInnerHTML) {
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2895
|
+
if (value) {
|
|
2896
|
+
innerHTML = String(value);
|
|
2897
|
+
key = QContainerAttr;
|
|
2898
|
+
value = "html" /* HTML */;
|
|
2899
|
+
}
|
|
2601
2900
|
if (tag === "style") {
|
|
2602
2901
|
continue;
|
|
2603
2902
|
}
|
|
2604
2903
|
}
|
|
2605
2904
|
if (tag === "textarea" && key === "value") {
|
|
2606
2905
|
if (value && typeof value !== "string") {
|
|
2607
|
-
if (
|
|
2608
|
-
throw qError(
|
|
2906
|
+
if (isDev5) {
|
|
2907
|
+
throw qError(23 /* wrongTextareaValue */, [currentFile, value]);
|
|
2609
2908
|
}
|
|
2610
2909
|
continue;
|
|
2611
2910
|
}
|
|
@@ -2641,7 +2940,7 @@ var isQwikStyleElement = (tag, attrs) => {
|
|
|
2641
2940
|
return false;
|
|
2642
2941
|
};
|
|
2643
2942
|
function newTagError(text) {
|
|
2644
|
-
return qError(
|
|
2943
|
+
return qError(12 /* tagError */, [text]);
|
|
2645
2944
|
}
|
|
2646
2945
|
function hasDestroy(obj) {
|
|
2647
2946
|
return obj && typeof obj === "object" && typeof obj.$destroy$ === "function";
|
|
@@ -2660,6 +2959,7 @@ function hash() {
|
|
|
2660
2959
|
}
|
|
2661
2960
|
|
|
2662
2961
|
// packages/qwik/src/server/ssr-render.ts
|
|
2962
|
+
import { manifest as builtManifest } from "@qwik-client-manifest";
|
|
2663
2963
|
var renderToString = async (jsx, opts = {}) => {
|
|
2664
2964
|
const chunks = [];
|
|
2665
2965
|
const stream = {
|
|
@@ -2667,22 +2967,9 @@ var renderToString = async (jsx, opts = {}) => {
|
|
|
2667
2967
|
chunks.push(chunk);
|
|
2668
2968
|
}
|
|
2669
2969
|
};
|
|
2670
|
-
const result = await renderToStream(jsx, {
|
|
2671
|
-
base: opts.base,
|
|
2672
|
-
containerAttributes: opts.containerAttributes,
|
|
2673
|
-
containerTagName: opts.containerTagName,
|
|
2674
|
-
locale: opts.locale,
|
|
2675
|
-
manifest: opts.manifest,
|
|
2676
|
-
symbolMapper: opts.symbolMapper,
|
|
2677
|
-
qwikLoader: opts.qwikLoader,
|
|
2678
|
-
serverData: opts.serverData,
|
|
2679
|
-
prefetchStrategy: opts.prefetchStrategy,
|
|
2680
|
-
debug: opts.debug,
|
|
2681
|
-
stream
|
|
2682
|
-
});
|
|
2970
|
+
const result = await renderToStream(jsx, { ...opts, stream });
|
|
2683
2971
|
return {
|
|
2684
2972
|
isStatic: result.isStatic,
|
|
2685
|
-
prefetchResources: result.prefetchResources,
|
|
2686
2973
|
timing: result.timing,
|
|
2687
2974
|
manifest: result.manifest,
|
|
2688
2975
|
snapshotResult: result.snapshotResult,
|
|
@@ -2711,18 +2998,17 @@ var renderToStream = async (jsx, opts) => {
|
|
|
2711
2998
|
});
|
|
2712
2999
|
await setServerPlatform(opts, resolvedManifest);
|
|
2713
3000
|
await ssrContainer.render(jsx);
|
|
3001
|
+
await ssrContainer.$scheduler$(255 /* WAIT_FOR_QUEUE */).$returnValue$;
|
|
2714
3002
|
flush();
|
|
2715
3003
|
const snapshotResult = getSnapshotResult(ssrContainer);
|
|
2716
3004
|
const isDynamic = snapshotResult.resources.some((r) => r._cache !== Infinity);
|
|
2717
3005
|
const result = {
|
|
2718
|
-
prefetchResources: ssrContainer.prefetchResources,
|
|
2719
3006
|
snapshotResult,
|
|
2720
3007
|
flushes: networkFlushes,
|
|
2721
3008
|
manifest: resolvedManifest?.manifest,
|
|
2722
3009
|
size: totalSize,
|
|
2723
3010
|
isStatic: !isDynamic,
|
|
2724
|
-
timing
|
|
2725
|
-
_symbols: Array.from(ssrContainer.serializationCtx.$renderSymbols$)
|
|
3011
|
+
timing
|
|
2726
3012
|
};
|
|
2727
3013
|
return result;
|
|
2728
3014
|
};
|
|
@@ -2834,21 +3120,19 @@ function shouldSkipChunk(chunk) {
|
|
|
2834
3120
|
return chunk === void 0 || chunk === null || chunk === "<!--" + FLUSH_COMMENT + "-->" || chunk === "<!--" + STREAM_BLOCK_START_COMMENT + "-->" || chunk === "<!--" + STREAM_BLOCK_END_COMMENT + "-->";
|
|
2835
3121
|
}
|
|
2836
3122
|
function resolveManifest(manifest) {
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
if ("mapper" in manifest) {
|
|
2841
|
-
return manifest;
|
|
3123
|
+
const mergedManifest = manifest ? { ...builtManifest, ...manifest } : builtManifest;
|
|
3124
|
+
if (!mergedManifest || "mapper" in mergedManifest) {
|
|
3125
|
+
return mergedManifest;
|
|
2842
3126
|
}
|
|
2843
|
-
|
|
2844
|
-
if (manifest) {
|
|
3127
|
+
if (mergedManifest.mapping) {
|
|
2845
3128
|
const mapper = {};
|
|
2846
|
-
Object.entries(
|
|
2847
|
-
mapper[getSymbolHash(
|
|
3129
|
+
Object.entries(mergedManifest.mapping).forEach(([symbol, bundleFilename]) => {
|
|
3130
|
+
mapper[getSymbolHash(symbol)] = [symbol, bundleFilename];
|
|
2848
3131
|
});
|
|
2849
3132
|
return {
|
|
2850
3133
|
mapper,
|
|
2851
|
-
manifest
|
|
3134
|
+
manifest: mergedManifest,
|
|
3135
|
+
injections: mergedManifest.injections || []
|
|
2852
3136
|
};
|
|
2853
3137
|
}
|
|
2854
3138
|
return void 0;
|
|
@@ -2861,6 +3145,7 @@ async function setServerPlatform2(manifest) {
|
|
|
2861
3145
|
setPlatform2(platform);
|
|
2862
3146
|
}
|
|
2863
3147
|
export {
|
|
3148
|
+
getQwikBackpatchExecutorScript,
|
|
2864
3149
|
getQwikLoaderScript,
|
|
2865
3150
|
getQwikPrefetchWorkerScript,
|
|
2866
3151
|
renderToStream,
|