@qwik.dev/core 2.0.0-beta.11 → 2.0.0-beta.13
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.win32-x64-msvc.node +0 -0
- package/bindings/qwik_wasm_bg.wasm +0 -0
- package/dist/backpatch/index.cjs +2 -2
- package/dist/backpatch/index.mjs +2 -2
- package/dist/backpatch/package.json +1 -1
- package/dist/backpatch-executor.debug.js +7 -2
- package/dist/backpatch-executor.js +1 -1
- package/dist/build/package.json +1 -1
- package/dist/cli.cjs +6484 -1341
- package/dist/core-internal.d.ts +147 -77
- package/dist/core.cjs +9358 -8994
- package/dist/core.cjs.map +1 -1
- package/dist/core.min.mjs +1 -1
- package/dist/core.mjs +9356 -8994
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.cjs +4738 -4472
- package/dist/core.prod.mjs +5143 -4862
- 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 +34 -29
- package/dist/optimizer.d.ts +3 -0
- package/dist/optimizer.mjs +945 -935
- package/dist/qwikloader.debug.js +9 -8
- package/dist/qwikloader.js +1 -1
- package/dist/server.cjs +471 -386
- package/dist/server.d.ts +20 -12
- package/dist/server.mjs +466 -381
- package/dist/starters/adapters/aws-lambda/adapters/aws-lambda/{vite.config.mts → vite.config.ts} +1 -1
- package/dist/starters/adapters/aws-lambda/package.json +1 -1
- package/dist/starters/adapters/azure-swa/adapters/azure-swa/{vite.config.mts → vite.config.ts} +1 -1
- package/dist/starters/adapters/azure-swa/package.json +1 -1
- package/dist/starters/adapters/bun/adapters/bun/{vite.config.mts → vite.config.ts} +1 -1
- package/dist/starters/adapters/bun/package.json +1 -1
- package/dist/starters/adapters/cloud-run/adapters/cloud-run/{vite.config.mts → vite.config.ts} +1 -1
- package/dist/starters/adapters/cloud-run/package.json +1 -1
- package/dist/starters/adapters/cloudflare-pages/adapters/cloudflare-pages/{vite.config.mts → vite.config.ts} +1 -1
- package/dist/starters/adapters/cloudflare-pages/package.json +1 -1
- package/dist/starters/adapters/deno/adapters/deno/{vite.config.mts → vite.config.ts} +1 -1
- package/dist/starters/adapters/deno/package.json +1 -1
- package/dist/starters/adapters/express/adapters/express/{vite.config.mts → vite.config.ts} +1 -1
- package/dist/starters/adapters/express/package.json +1 -1
- package/dist/starters/adapters/fastify/adapters/fastify/{vite.config.mts → vite.config.ts} +1 -1
- package/dist/starters/adapters/fastify/package.json +1 -1
- package/dist/starters/adapters/firebase/adapters/firebase/{vite.config.mts → vite.config.ts} +1 -1
- package/dist/starters/adapters/firebase/package.json +1 -1
- package/dist/starters/adapters/netlify-edge/adapters/netlify-edge/{vite.config.mts → vite.config.ts} +1 -1
- package/dist/starters/adapters/netlify-edge/package.json +1 -1
- package/dist/starters/adapters/node-server/adapters/node-server/{vite.config.mts → vite.config.ts} +1 -1
- package/dist/starters/adapters/node-server/package.json +1 -1
- package/dist/starters/adapters/ssg/adapters/ssg/{vite.config.mts → vite.config.ts} +1 -1
- package/dist/starters/adapters/ssg/package.json +2 -2
- package/dist/starters/adapters/vercel-edge/README.md +2 -2
- package/dist/starters/adapters/vercel-edge/adapters/vercel-edge/{vite.config.mts → vite.config.ts} +1 -1
- package/dist/starters/adapters/vercel-edge/package.json +1 -1
- package/dist/starters/features/csr/package.json +1 -1
- package/dist/testing/index.cjs +2730 -2201
- package/dist/testing/index.d.ts +74 -25
- package/dist/testing/index.mjs +2664 -2139
- package/dist/testing/package.json +1 -1
- package/handlers.mjs +1 -1
- package/package.json +5 -5
- package/public.d.ts +1 -0
- /package/dist/starters/features/csr/{vite.config.mts → vite.config.ts} +0 -0
package/dist/server.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* @qwik.dev/core/server 2.0.0-beta.
|
|
3
|
+
* @qwik.dev/core/server 2.0.0-beta.13-dev+cb19ff7
|
|
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
|
|
@@ -348,6 +348,7 @@ var dangerouslySetInnerHTML = "dangerouslySetInnerHTML";
|
|
|
348
348
|
|
|
349
349
|
// packages/qwik/src/core/shared/utils/promises.ts
|
|
350
350
|
var import_build2 = require("@qwik.dev/core/build");
|
|
351
|
+
var MAX_RETRY_ON_PROMISE_COUNT = 100;
|
|
351
352
|
var isPromise = (value) => {
|
|
352
353
|
return !!value && typeof value == "object" && typeof value.then === "function";
|
|
353
354
|
};
|
|
@@ -357,6 +358,27 @@ var maybeThen = (valueOrPromise, thenFn) => {
|
|
|
357
358
|
var shouldNotError = (reason) => {
|
|
358
359
|
throwErrorAndStop(reason);
|
|
359
360
|
};
|
|
361
|
+
function retryOnPromise(fn, retryCount = 0) {
|
|
362
|
+
const retryOrThrow = (e) => {
|
|
363
|
+
if (isPromise(e) && retryCount < MAX_RETRY_ON_PROMISE_COUNT) {
|
|
364
|
+
return e.then(retryOnPromise.bind(null, fn, retryCount++));
|
|
365
|
+
}
|
|
366
|
+
throw e;
|
|
367
|
+
};
|
|
368
|
+
try {
|
|
369
|
+
const result = fn();
|
|
370
|
+
if (isPromise(result)) {
|
|
371
|
+
return result.catch((e) => retryOrThrow(e));
|
|
372
|
+
}
|
|
373
|
+
return result;
|
|
374
|
+
} catch (e) {
|
|
375
|
+
if (import_build2.isDev && import_build2.isServer && e instanceof ReferenceError && e.message.includes("window")) {
|
|
376
|
+
e.message = 'It seems like you forgot to add "if (isBrowser) {...}" here:' + e.message;
|
|
377
|
+
throw e;
|
|
378
|
+
}
|
|
379
|
+
return retryOrThrow(e);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
360
382
|
|
|
361
383
|
// packages/qwik/src/core/shared/utils/scoped-styles.ts
|
|
362
384
|
function isClassAttr(key) {
|
|
@@ -1179,18 +1201,261 @@ function getBuildBase(opts) {
|
|
|
1179
1201
|
return `${globalThis.BASE_URL || "/"}build/`;
|
|
1180
1202
|
}
|
|
1181
1203
|
var versions = {
|
|
1182
|
-
qwik: "2.0.0-beta.
|
|
1204
|
+
qwik: "2.0.0-beta.13-dev+cb19ff7",
|
|
1183
1205
|
qwikDom: "2.1.19"
|
|
1184
1206
|
};
|
|
1185
1207
|
|
|
1186
1208
|
// packages/qwik/src/server/ssr-container.ts
|
|
1187
|
-
var import_internal2 = require("@qwik.dev/core/internal");
|
|
1188
1209
|
var import_build8 = require("@qwik.dev/core/build");
|
|
1210
|
+
var import_internal2 = require("@qwik.dev/core/internal");
|
|
1211
|
+
|
|
1212
|
+
// packages/qwik/src/server/preload-strategy.ts
|
|
1213
|
+
var import_core2 = require("@qwik.dev/core");
|
|
1214
|
+
|
|
1215
|
+
// packages/qwik/src/server/preload-utils.ts
|
|
1216
|
+
function flattenPrefetchResources(prefetchResources) {
|
|
1217
|
+
const urls = [];
|
|
1218
|
+
const addPrefetchResource = (prefetchResources2) => {
|
|
1219
|
+
if (prefetchResources2) {
|
|
1220
|
+
for (const prefetchResource of prefetchResources2) {
|
|
1221
|
+
if (!urls.includes(prefetchResource.url)) {
|
|
1222
|
+
urls.push(prefetchResource.url);
|
|
1223
|
+
if (prefetchResource.imports) {
|
|
1224
|
+
addPrefetchResource(prefetchResource.imports);
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
};
|
|
1230
|
+
addPrefetchResource(prefetchResources);
|
|
1231
|
+
return urls;
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
// packages/qwik/src/server/preload-strategy.ts
|
|
1235
|
+
var getBundles = (qrls) => {
|
|
1236
|
+
const platform = (0, import_core2.getPlatform)();
|
|
1237
|
+
return qrls == null ? void 0 : qrls.map((qrl) => {
|
|
1238
|
+
var _a;
|
|
1239
|
+
const symbol = qrl.$symbol$;
|
|
1240
|
+
const chunk = qrl.$chunk$;
|
|
1241
|
+
const result = platform.chunkForSymbol(symbol, chunk, (_a = qrl.dev) == null ? void 0 : _a.file);
|
|
1242
|
+
if (result) {
|
|
1243
|
+
return result[1];
|
|
1244
|
+
}
|
|
1245
|
+
return chunk;
|
|
1246
|
+
}).filter(Boolean);
|
|
1247
|
+
};
|
|
1248
|
+
function getPreloadPaths(qrls, opts, resolvedManifest) {
|
|
1249
|
+
const prefetchStrategy = opts.prefetchStrategy;
|
|
1250
|
+
if (prefetchStrategy === null) {
|
|
1251
|
+
return [];
|
|
1252
|
+
}
|
|
1253
|
+
if (!(resolvedManifest == null ? void 0 : resolvedManifest.manifest.bundleGraph)) {
|
|
1254
|
+
return getBundles(qrls);
|
|
1255
|
+
}
|
|
1256
|
+
if (typeof (prefetchStrategy == null ? void 0 : prefetchStrategy.symbolsToPrefetch) === "function") {
|
|
1257
|
+
try {
|
|
1258
|
+
const prefetchResources = prefetchStrategy.symbolsToPrefetch({
|
|
1259
|
+
manifest: resolvedManifest.manifest
|
|
1260
|
+
});
|
|
1261
|
+
return flattenPrefetchResources(prefetchResources);
|
|
1262
|
+
} catch (e) {
|
|
1263
|
+
console.error("getPrefetchUrls, symbolsToPrefetch()", e);
|
|
1264
|
+
}
|
|
1265
|
+
}
|
|
1266
|
+
const symbols = /* @__PURE__ */ new Set();
|
|
1267
|
+
for (const qrl of qrls) {
|
|
1268
|
+
const symbol = getSymbolHash(qrl.$symbol$);
|
|
1269
|
+
if (symbol && symbol.length >= 10) {
|
|
1270
|
+
symbols.add(symbol);
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
return [...symbols];
|
|
1274
|
+
}
|
|
1275
|
+
var expandBundles = (names, resolvedManifest) => {
|
|
1276
|
+
if (!(resolvedManifest == null ? void 0 : resolvedManifest.manifest.bundleGraph)) {
|
|
1277
|
+
return [...new Set(names)];
|
|
1278
|
+
}
|
|
1279
|
+
resetQueue();
|
|
1280
|
+
let probability = 0.99;
|
|
1281
|
+
for (const name of names) {
|
|
1282
|
+
preload(name, probability);
|
|
1283
|
+
probability *= 0.95;
|
|
1284
|
+
}
|
|
1285
|
+
return getQueue();
|
|
1286
|
+
};
|
|
1287
|
+
|
|
1288
|
+
// packages/qwik/src/server/preload-impl.ts
|
|
1289
|
+
var simplifyPath = (base2, path) => {
|
|
1290
|
+
if (path == null) {
|
|
1291
|
+
return null;
|
|
1292
|
+
}
|
|
1293
|
+
const segments = `${base2}${path}`.split("/");
|
|
1294
|
+
const simplified = [];
|
|
1295
|
+
for (const segment of segments) {
|
|
1296
|
+
if (segment === ".." && simplified.length > 0) {
|
|
1297
|
+
simplified.pop();
|
|
1298
|
+
} else {
|
|
1299
|
+
simplified.push(segment);
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
return simplified.join("/");
|
|
1303
|
+
};
|
|
1304
|
+
var getBase = (container) => {
|
|
1305
|
+
let base2 = container.$buildBase$;
|
|
1306
|
+
if (false) {
|
|
1307
|
+
base2 = globalThis.BASE_URL;
|
|
1308
|
+
}
|
|
1309
|
+
return base2;
|
|
1310
|
+
};
|
|
1311
|
+
var preloaderPre = (container, options, nonce) => {
|
|
1312
|
+
var _a, _b;
|
|
1313
|
+
const { resolvedManifest } = container;
|
|
1314
|
+
const base2 = getBase(container);
|
|
1315
|
+
const preloaderBundle = simplifyPath(base2, (_a = resolvedManifest == null ? void 0 : resolvedManifest.manifest) == null ? void 0 : _a.preloader);
|
|
1316
|
+
let bundleGraphPath = resolvedManifest == null ? void 0 : resolvedManifest.manifest.bundleGraphAsset;
|
|
1317
|
+
if (bundleGraphPath) {
|
|
1318
|
+
bundleGraphPath = (globalThis.BASE_URL || "/") + bundleGraphPath;
|
|
1319
|
+
}
|
|
1320
|
+
if (preloaderBundle && bundleGraphPath && options !== false) {
|
|
1321
|
+
const preloaderOpts = typeof options === "object" ? {
|
|
1322
|
+
debug: options.debug,
|
|
1323
|
+
preloadProbability: options.ssrPreloadProbability
|
|
1324
|
+
} : void 0;
|
|
1325
|
+
const bundleGraph = (_b = container.resolvedManifest) == null ? void 0 : _b.manifest.bundleGraph;
|
|
1326
|
+
initPreloader(bundleGraph, preloaderOpts);
|
|
1327
|
+
const opts = [];
|
|
1328
|
+
if (options) {
|
|
1329
|
+
if (options.debug) {
|
|
1330
|
+
opts.push("d:1");
|
|
1331
|
+
}
|
|
1332
|
+
if (options.maxIdlePreloads) {
|
|
1333
|
+
opts.push(`P:${options.maxIdlePreloads}`);
|
|
1334
|
+
}
|
|
1335
|
+
if (options.preloadProbability) {
|
|
1336
|
+
opts.push(`Q:${options.preloadProbability}`);
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
const optsStr = opts.length ? `,{${opts.join(",")}}` : "";
|
|
1340
|
+
const preloaderLinkAttrs = ["rel", "modulepreload", "href", preloaderBundle];
|
|
1341
|
+
if (nonce) {
|
|
1342
|
+
preloaderLinkAttrs.push("nonce", nonce);
|
|
1343
|
+
}
|
|
1344
|
+
container.openElement("link", null, preloaderLinkAttrs);
|
|
1345
|
+
container.closeElement();
|
|
1346
|
+
container.openElement("link", null, [
|
|
1347
|
+
"rel",
|
|
1348
|
+
"preload",
|
|
1349
|
+
"href",
|
|
1350
|
+
bundleGraphPath,
|
|
1351
|
+
"as",
|
|
1352
|
+
"fetch",
|
|
1353
|
+
"crossorigin",
|
|
1354
|
+
"anonymous"
|
|
1355
|
+
]);
|
|
1356
|
+
container.closeElement();
|
|
1357
|
+
const script = `let b=fetch("${bundleGraphPath}");import("${preloaderBundle}").then(({l})=>l(${JSON.stringify(base2)},b${optsStr}));`;
|
|
1358
|
+
const scriptAttrs = ["type", "module", "async", true];
|
|
1359
|
+
if (nonce) {
|
|
1360
|
+
scriptAttrs.push("nonce", nonce);
|
|
1361
|
+
}
|
|
1362
|
+
container.openElement("script", null, scriptAttrs);
|
|
1363
|
+
container.write(script);
|
|
1364
|
+
container.closeElement();
|
|
1365
|
+
}
|
|
1366
|
+
const corePath = simplifyPath(base2, resolvedManifest == null ? void 0 : resolvedManifest.manifest.core);
|
|
1367
|
+
if (corePath) {
|
|
1368
|
+
const linkAttrs = ["rel", "modulepreload", "href", corePath];
|
|
1369
|
+
if (nonce) {
|
|
1370
|
+
linkAttrs.push("nonce", nonce);
|
|
1371
|
+
}
|
|
1372
|
+
container.openElement("link", null, linkAttrs);
|
|
1373
|
+
container.closeElement();
|
|
1374
|
+
}
|
|
1375
|
+
};
|
|
1376
|
+
var includePreloader = (container, options, referencedBundles, nonce) => {
|
|
1377
|
+
if (referencedBundles.length === 0 || options === false) {
|
|
1378
|
+
return null;
|
|
1379
|
+
}
|
|
1380
|
+
const { ssrPreloads, ssrPreloadProbability } = normalizePreLoaderOptions(
|
|
1381
|
+
typeof options === "boolean" ? void 0 : options
|
|
1382
|
+
);
|
|
1383
|
+
let allowed = ssrPreloads;
|
|
1384
|
+
const base2 = getBase(container);
|
|
1385
|
+
const links = [];
|
|
1386
|
+
const { resolvedManifest } = container;
|
|
1387
|
+
if (allowed) {
|
|
1388
|
+
const preloaderBundle2 = resolvedManifest == null ? void 0 : resolvedManifest.manifest.preloader;
|
|
1389
|
+
const coreBundle = resolvedManifest == null ? void 0 : resolvedManifest.manifest.core;
|
|
1390
|
+
const expandedBundles = expandBundles(referencedBundles, resolvedManifest);
|
|
1391
|
+
let probability = 4;
|
|
1392
|
+
const tenXMinProbability = ssrPreloadProbability * 10;
|
|
1393
|
+
for (const hrefOrProbability of expandedBundles) {
|
|
1394
|
+
if (typeof hrefOrProbability === "string") {
|
|
1395
|
+
if (probability < tenXMinProbability) {
|
|
1396
|
+
break;
|
|
1397
|
+
}
|
|
1398
|
+
if (hrefOrProbability === preloaderBundle2 || hrefOrProbability === coreBundle) {
|
|
1399
|
+
continue;
|
|
1400
|
+
}
|
|
1401
|
+
links.push(hrefOrProbability);
|
|
1402
|
+
if (--allowed === 0) {
|
|
1403
|
+
break;
|
|
1404
|
+
}
|
|
1405
|
+
} else {
|
|
1406
|
+
probability = hrefOrProbability;
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1409
|
+
}
|
|
1410
|
+
const preloaderBundle = simplifyPath(base2, resolvedManifest == null ? void 0 : resolvedManifest.manifest.preloader);
|
|
1411
|
+
const insertLinks = links.length ? (
|
|
1412
|
+
/**
|
|
1413
|
+
* We only use modulepreload links because they behave best. Older browsers can rely on the
|
|
1414
|
+
* preloader which does feature detection and which will be available soon after inserting these
|
|
1415
|
+
* links.
|
|
1416
|
+
*/
|
|
1417
|
+
`${JSON.stringify(links)}.map((l,e)=>{e=document.createElement('link');e.rel='modulepreload';e.href=${JSON.stringify(base2)}+l;document.head.appendChild(e)});`
|
|
1418
|
+
) : "";
|
|
1419
|
+
let script = insertLinks;
|
|
1420
|
+
if (preloaderBundle) {
|
|
1421
|
+
script += `window.addEventListener('load',f=>{f=_=>import("${preloaderBundle}").then(({p})=>p(${JSON.stringify(referencedBundles)}));try{requestIdleCallback(f,{timeout:2000})}catch(e){setTimeout(f,200)}})`;
|
|
1422
|
+
}
|
|
1423
|
+
if (script) {
|
|
1424
|
+
const attrs = ["type", "module", "async", true, "q:type", "preload"];
|
|
1425
|
+
if (nonce) {
|
|
1426
|
+
attrs.push("nonce", nonce);
|
|
1427
|
+
}
|
|
1428
|
+
container.openElement("script", null, attrs);
|
|
1429
|
+
container.write(script);
|
|
1430
|
+
container.closeElement();
|
|
1431
|
+
}
|
|
1432
|
+
return null;
|
|
1433
|
+
};
|
|
1434
|
+
var preloaderPost = (ssrContainer, opts, nonce) => {
|
|
1435
|
+
if (opts.preloader !== false) {
|
|
1436
|
+
const qrls = Array.from(ssrContainer.serializationCtx.$eventQrls$);
|
|
1437
|
+
const preloadBundles = getPreloadPaths(qrls, opts, ssrContainer.resolvedManifest);
|
|
1438
|
+
if (preloadBundles.length > 0) {
|
|
1439
|
+
includePreloader(ssrContainer, opts.preloader, preloadBundles, nonce);
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1442
|
+
};
|
|
1443
|
+
function normalizePreLoaderOptions(input) {
|
|
1444
|
+
return { ...preLoaderOptionsDefault, ...input };
|
|
1445
|
+
}
|
|
1446
|
+
var preLoaderOptionsDefault = {
|
|
1447
|
+
ssrPreloads: 7,
|
|
1448
|
+
ssrPreloadProbability: 0.5,
|
|
1449
|
+
debug: false,
|
|
1450
|
+
maxIdlePreloads: 25,
|
|
1451
|
+
preloadProbability: 0.35
|
|
1452
|
+
// deprecated
|
|
1453
|
+
};
|
|
1189
1454
|
|
|
1190
1455
|
// packages/qwik/src/server/scripts.ts
|
|
1191
|
-
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
|
|
1192
|
-
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(
|
|
1193
|
-
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
|
|
1456
|
+
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 g=p.startsWith("#"),m={qBase:r,qManifest:a,qVersion:s,href:u,symbol:q,element:e,reqTime:h};if(g){const e=n.getAttribute("q:instance");_=(t["qFuncs_"+e]||[])[Number.parseInt(q)],_||(d="sync",y=Error("sym:"+q))}else{b("qsymbol",m);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,...m}),console.error(y);break}const w=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,...m})}finally{t.__q_context__=w}}}},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})},g=t=>t.replace(/-./g,t=>t[1].toUpperCase()),m=(...t)=>{for(const r of t)if("string"==typeof r){if(!n.has(r)){n.add(r);const t=g(r);o.forEach(e=>y(e,t,h,!0)),y(e,t,_,!0)}}else o.has(r)||(n.forEach(t=>{const e=g(t);y(r,e,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()}';
|
|
1457
|
+
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 kebabToCamel = (eventName) => eventName.replace(/-./g, (a) => a[1].toUpperCase());\nconst processEventOrNode = (...eventNames) => {\n for (const eventNameOrNode of eventNames) {\n if (typeof eventNameOrNode === "string") {\n if (!events.has(eventNameOrNode)) {\n events.add(eventNameOrNode);\n const eventName = kebabToCamel(eventNameOrNode);\n roots.forEach((root) => addEventListener(root, eventName, processDocumentEvent, true));\n addEventListener(win, eventName, processWindowEvent, true);\n }\n } else {\n if (!roots.has(eventNameOrNode)) {\n events.forEach((kebabEventName) => {\n const eventName = kebabToCamel(kebabEventName);\n 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}';
|
|
1458
|
+
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=r.hasAttribute(":")?0:-1;for(let e=0;e<t.length;e+=3){const o=t[e],i=t[e+1];let s=t[e+2];for(;c<o&&(r=n.nextNode(),r);)r.hasAttribute(":")&&c++;const l=r;null==s||!1===s?l.removeAttribute(i):("boolean"==typeof s&&(s=""),l.setAttribute(i,s))}}}}`;
|
|
1194
1459
|
var QWIK_BACKPATCH_EXECUTOR_DEBUG = `const BACKPATCH_DATA_SELECTOR = 'script[type="qwik/backpatch"]';
|
|
1195
1460
|
const executorScript = document.currentScript;
|
|
1196
1461
|
if (executorScript) {
|
|
@@ -1203,14 +1468,19 @@ if (executorScript) {
|
|
|
1203
1468
|
const data = JSON.parse(script.textContent || "[]");
|
|
1204
1469
|
const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT);
|
|
1205
1470
|
let currentNode = walker.currentNode;
|
|
1206
|
-
let currentNodeIdx = 0;
|
|
1471
|
+
let currentNodeIdx = currentNode.hasAttribute(":") ? 0 : -1;
|
|
1207
1472
|
for (let i = 0; i < data.length; i += 3) {
|
|
1208
1473
|
const elementIdx = data[i];
|
|
1209
1474
|
const attrName = data[i + 1];
|
|
1210
1475
|
let value = data[i + 2];
|
|
1211
1476
|
while (currentNodeIdx < elementIdx) {
|
|
1212
1477
|
currentNode = walker.nextNode();
|
|
1213
|
-
|
|
1478
|
+
if (!currentNode) {
|
|
1479
|
+
break;
|
|
1480
|
+
}
|
|
1481
|
+
if (currentNode.hasAttribute(":")) {
|
|
1482
|
+
currentNodeIdx++;
|
|
1483
|
+
}
|
|
1214
1484
|
}
|
|
1215
1485
|
const element = currentNode;
|
|
1216
1486
|
if (value == null || value === false) {
|
|
@@ -1318,10 +1588,12 @@ var SsrNode = class {
|
|
|
1318
1588
|
this.children.push(child);
|
|
1319
1589
|
}
|
|
1320
1590
|
setTreeNonUpdatable() {
|
|
1321
|
-
this.flags
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
child.
|
|
1591
|
+
if (this.flags & 1 /* Updatable */) {
|
|
1592
|
+
this.flags &= ~1 /* Updatable */;
|
|
1593
|
+
if (this.children) {
|
|
1594
|
+
for (const child of this.children) {
|
|
1595
|
+
child.setTreeNonUpdatable();
|
|
1596
|
+
}
|
|
1325
1597
|
}
|
|
1326
1598
|
}
|
|
1327
1599
|
}
|
|
@@ -1599,6 +1871,8 @@ function isInTable(text) {
|
|
|
1599
1871
|
case "tbody":
|
|
1600
1872
|
case "tfoot":
|
|
1601
1873
|
return 8192 /* TABLE_BODY */;
|
|
1874
|
+
case "script":
|
|
1875
|
+
return 2 /* TEXT */;
|
|
1602
1876
|
default:
|
|
1603
1877
|
return 0 /* NOT_ALLOWED */;
|
|
1604
1878
|
}
|
|
@@ -1607,7 +1881,9 @@ function isInTableBody(text) {
|
|
|
1607
1881
|
switch (text) {
|
|
1608
1882
|
case "tr":
|
|
1609
1883
|
return 16384 /* TABLE_ROW */;
|
|
1610
|
-
|
|
1884
|
+
case "script":
|
|
1885
|
+
return 2 /* TEXT */;
|
|
1886
|
+
default:
|
|
1611
1887
|
return 0 /* NOT_ALLOWED */;
|
|
1612
1888
|
}
|
|
1613
1889
|
}
|
|
@@ -1616,6 +1892,8 @@ function isInTableRow(text) {
|
|
|
1616
1892
|
case "td":
|
|
1617
1893
|
case "th":
|
|
1618
1894
|
return 10 /* ANYTHING */;
|
|
1895
|
+
case "script":
|
|
1896
|
+
return 2 /* TEXT */;
|
|
1619
1897
|
default:
|
|
1620
1898
|
return 0 /* NOT_ALLOWED */;
|
|
1621
1899
|
}
|
|
@@ -1624,6 +1902,8 @@ function isInTableColGroup(text) {
|
|
|
1624
1902
|
switch (text) {
|
|
1625
1903
|
case "col":
|
|
1626
1904
|
return 4 /* EMPTY */;
|
|
1905
|
+
case "script":
|
|
1906
|
+
return 2 /* TEXT */;
|
|
1627
1907
|
default:
|
|
1628
1908
|
return 0 /* NOT_ALLOWED */;
|
|
1629
1909
|
}
|
|
@@ -1634,6 +1914,8 @@ function isInPicture(text) {
|
|
|
1634
1914
|
return 4 /* EMPTY */;
|
|
1635
1915
|
case "img":
|
|
1636
1916
|
return 4 /* EMPTY */;
|
|
1917
|
+
case "script":
|
|
1918
|
+
return 2 /* TEXT */;
|
|
1637
1919
|
default:
|
|
1638
1920
|
return 0 /* NOT_ALLOWED */;
|
|
1639
1921
|
}
|
|
@@ -1701,7 +1983,6 @@ function isInPhrasing(text, allowInput) {
|
|
|
1701
1983
|
case "ruby":
|
|
1702
1984
|
case "s":
|
|
1703
1985
|
case "samp":
|
|
1704
|
-
case "script":
|
|
1705
1986
|
case "select":
|
|
1706
1987
|
case "slot":
|
|
1707
1988
|
case "small":
|
|
@@ -1716,6 +1997,7 @@ function isInPhrasing(text, allowInput) {
|
|
|
1716
1997
|
case "video":
|
|
1717
1998
|
case "wbr":
|
|
1718
1999
|
return allowInput ? 258 /* PHRASING_ANY */ : 514 /* PHRASING_INSIDE_INPUT */;
|
|
2000
|
+
case "script":
|
|
1719
2001
|
case "style":
|
|
1720
2002
|
return 2 /* TEXT */;
|
|
1721
2003
|
case "picture":
|
|
@@ -1820,249 +2102,6 @@ function encodeAsAlphanumeric(value) {
|
|
|
1820
2102
|
return ALPHANUMERIC[value];
|
|
1821
2103
|
}
|
|
1822
2104
|
|
|
1823
|
-
// packages/qwik/src/server/preload-strategy.ts
|
|
1824
|
-
var import_core2 = require("@qwik.dev/core");
|
|
1825
|
-
|
|
1826
|
-
// packages/qwik/src/server/preload-utils.ts
|
|
1827
|
-
function flattenPrefetchResources(prefetchResources) {
|
|
1828
|
-
const urls = [];
|
|
1829
|
-
const addPrefetchResource = (prefetchResources2) => {
|
|
1830
|
-
if (prefetchResources2) {
|
|
1831
|
-
for (const prefetchResource of prefetchResources2) {
|
|
1832
|
-
if (!urls.includes(prefetchResource.url)) {
|
|
1833
|
-
urls.push(prefetchResource.url);
|
|
1834
|
-
if (prefetchResource.imports) {
|
|
1835
|
-
addPrefetchResource(prefetchResource.imports);
|
|
1836
|
-
}
|
|
1837
|
-
}
|
|
1838
|
-
}
|
|
1839
|
-
}
|
|
1840
|
-
};
|
|
1841
|
-
addPrefetchResource(prefetchResources);
|
|
1842
|
-
return urls;
|
|
1843
|
-
}
|
|
1844
|
-
|
|
1845
|
-
// packages/qwik/src/server/preload-strategy.ts
|
|
1846
|
-
var getBundles = (qrls) => {
|
|
1847
|
-
const platform = (0, import_core2.getPlatform)();
|
|
1848
|
-
return qrls == null ? void 0 : qrls.map((qrl) => {
|
|
1849
|
-
var _a;
|
|
1850
|
-
const symbol = qrl.$symbol$;
|
|
1851
|
-
const chunk = qrl.$chunk$;
|
|
1852
|
-
const result = platform.chunkForSymbol(symbol, chunk, (_a = qrl.dev) == null ? void 0 : _a.file);
|
|
1853
|
-
if (result) {
|
|
1854
|
-
return result[1];
|
|
1855
|
-
}
|
|
1856
|
-
return chunk;
|
|
1857
|
-
}).filter(Boolean);
|
|
1858
|
-
};
|
|
1859
|
-
function getPreloadPaths(qrls, opts, resolvedManifest) {
|
|
1860
|
-
const prefetchStrategy = opts.prefetchStrategy;
|
|
1861
|
-
if (prefetchStrategy === null) {
|
|
1862
|
-
return [];
|
|
1863
|
-
}
|
|
1864
|
-
if (!(resolvedManifest == null ? void 0 : resolvedManifest.manifest.bundleGraph)) {
|
|
1865
|
-
return getBundles(qrls);
|
|
1866
|
-
}
|
|
1867
|
-
if (typeof (prefetchStrategy == null ? void 0 : prefetchStrategy.symbolsToPrefetch) === "function") {
|
|
1868
|
-
try {
|
|
1869
|
-
const prefetchResources = prefetchStrategy.symbolsToPrefetch({
|
|
1870
|
-
manifest: resolvedManifest.manifest
|
|
1871
|
-
});
|
|
1872
|
-
return flattenPrefetchResources(prefetchResources);
|
|
1873
|
-
} catch (e) {
|
|
1874
|
-
console.error("getPrefetchUrls, symbolsToPrefetch()", e);
|
|
1875
|
-
}
|
|
1876
|
-
}
|
|
1877
|
-
const symbols = /* @__PURE__ */ new Set();
|
|
1878
|
-
for (const qrl of qrls) {
|
|
1879
|
-
const symbol = getSymbolHash(qrl.$symbol$);
|
|
1880
|
-
if (symbol && symbol.length >= 10) {
|
|
1881
|
-
symbols.add(symbol);
|
|
1882
|
-
}
|
|
1883
|
-
}
|
|
1884
|
-
return [...symbols];
|
|
1885
|
-
}
|
|
1886
|
-
var expandBundles = (names, resolvedManifest) => {
|
|
1887
|
-
if (!(resolvedManifest == null ? void 0 : resolvedManifest.manifest.bundleGraph)) {
|
|
1888
|
-
return [...new Set(names)];
|
|
1889
|
-
}
|
|
1890
|
-
resetQueue();
|
|
1891
|
-
let probability = 0.99;
|
|
1892
|
-
for (const name of names) {
|
|
1893
|
-
preload(name, probability);
|
|
1894
|
-
probability *= 0.95;
|
|
1895
|
-
}
|
|
1896
|
-
return getQueue();
|
|
1897
|
-
};
|
|
1898
|
-
|
|
1899
|
-
// packages/qwik/src/server/preload-impl.ts
|
|
1900
|
-
var simplifyPath = (base2, path) => {
|
|
1901
|
-
if (path == null) {
|
|
1902
|
-
return null;
|
|
1903
|
-
}
|
|
1904
|
-
const segments = `${base2}${path}`.split("/");
|
|
1905
|
-
const simplified = [];
|
|
1906
|
-
for (const segment of segments) {
|
|
1907
|
-
if (segment === ".." && simplified.length > 0) {
|
|
1908
|
-
simplified.pop();
|
|
1909
|
-
} else {
|
|
1910
|
-
simplified.push(segment);
|
|
1911
|
-
}
|
|
1912
|
-
}
|
|
1913
|
-
return simplified.join("/");
|
|
1914
|
-
};
|
|
1915
|
-
var getBase = (container) => {
|
|
1916
|
-
let base2 = container.$buildBase$;
|
|
1917
|
-
if (false) {
|
|
1918
|
-
base2 = globalThis.BASE_URL;
|
|
1919
|
-
}
|
|
1920
|
-
return base2;
|
|
1921
|
-
};
|
|
1922
|
-
var preloaderPre = (container, options, nonce) => {
|
|
1923
|
-
var _a, _b;
|
|
1924
|
-
const { resolvedManifest } = container;
|
|
1925
|
-
const base2 = getBase(container);
|
|
1926
|
-
const preloaderBundle = simplifyPath(base2, (_a = resolvedManifest == null ? void 0 : resolvedManifest.manifest) == null ? void 0 : _a.preloader);
|
|
1927
|
-
let bundleGraphPath = resolvedManifest == null ? void 0 : resolvedManifest.manifest.bundleGraphAsset;
|
|
1928
|
-
if (bundleGraphPath) {
|
|
1929
|
-
bundleGraphPath = (globalThis.BASE_URL || "/") + bundleGraphPath;
|
|
1930
|
-
}
|
|
1931
|
-
if (preloaderBundle && bundleGraphPath && options !== false) {
|
|
1932
|
-
const preloaderOpts = typeof options === "object" ? {
|
|
1933
|
-
debug: options.debug,
|
|
1934
|
-
preloadProbability: options.ssrPreloadProbability
|
|
1935
|
-
} : void 0;
|
|
1936
|
-
const bundleGraph = (_b = container.resolvedManifest) == null ? void 0 : _b.manifest.bundleGraph;
|
|
1937
|
-
initPreloader(bundleGraph, preloaderOpts);
|
|
1938
|
-
const opts = [];
|
|
1939
|
-
if (options) {
|
|
1940
|
-
if (options.debug) {
|
|
1941
|
-
opts.push("d:1");
|
|
1942
|
-
}
|
|
1943
|
-
if (options.maxIdlePreloads) {
|
|
1944
|
-
opts.push(`P:${options.maxIdlePreloads}`);
|
|
1945
|
-
}
|
|
1946
|
-
if (options.preloadProbability) {
|
|
1947
|
-
opts.push(`Q:${options.preloadProbability}`);
|
|
1948
|
-
}
|
|
1949
|
-
}
|
|
1950
|
-
const optsStr = opts.length ? `,{${opts.join(",")}}` : "";
|
|
1951
|
-
const preloaderLinkAttrs = ["rel", "modulepreload", "href", preloaderBundle];
|
|
1952
|
-
if (nonce) {
|
|
1953
|
-
preloaderLinkAttrs.push("nonce", nonce);
|
|
1954
|
-
}
|
|
1955
|
-
container.openElement("link", null, preloaderLinkAttrs);
|
|
1956
|
-
container.closeElement();
|
|
1957
|
-
container.openElement("link", null, [
|
|
1958
|
-
"rel",
|
|
1959
|
-
"preload",
|
|
1960
|
-
"href",
|
|
1961
|
-
bundleGraphPath,
|
|
1962
|
-
"as",
|
|
1963
|
-
"fetch",
|
|
1964
|
-
"crossorigin",
|
|
1965
|
-
"anonymous"
|
|
1966
|
-
]);
|
|
1967
|
-
container.closeElement();
|
|
1968
|
-
const script = `let b=fetch("${bundleGraphPath}");import("${preloaderBundle}").then(({l})=>l(${JSON.stringify(base2)},b${optsStr}));`;
|
|
1969
|
-
const scriptAttrs = ["type", "module", "async", true];
|
|
1970
|
-
if (nonce) {
|
|
1971
|
-
scriptAttrs.push("nonce", nonce);
|
|
1972
|
-
}
|
|
1973
|
-
container.openElement("script", null, scriptAttrs);
|
|
1974
|
-
container.writer.write(script);
|
|
1975
|
-
container.closeElement();
|
|
1976
|
-
}
|
|
1977
|
-
const corePath = simplifyPath(base2, resolvedManifest == null ? void 0 : resolvedManifest.manifest.core);
|
|
1978
|
-
if (corePath) {
|
|
1979
|
-
const linkAttrs = ["rel", "modulepreload", "href", corePath];
|
|
1980
|
-
if (nonce) {
|
|
1981
|
-
linkAttrs.push("nonce", nonce);
|
|
1982
|
-
}
|
|
1983
|
-
container.openElement("link", null, linkAttrs);
|
|
1984
|
-
container.closeElement();
|
|
1985
|
-
}
|
|
1986
|
-
};
|
|
1987
|
-
var includePreloader = (container, options, referencedBundles, nonce) => {
|
|
1988
|
-
if (referencedBundles.length === 0 || options === false) {
|
|
1989
|
-
return null;
|
|
1990
|
-
}
|
|
1991
|
-
const { ssrPreloads, ssrPreloadProbability } = normalizePreLoaderOptions(
|
|
1992
|
-
typeof options === "boolean" ? void 0 : options
|
|
1993
|
-
);
|
|
1994
|
-
let allowed = ssrPreloads;
|
|
1995
|
-
const base2 = getBase(container);
|
|
1996
|
-
const links = [];
|
|
1997
|
-
const { resolvedManifest } = container;
|
|
1998
|
-
if (allowed) {
|
|
1999
|
-
const preloaderBundle2 = resolvedManifest == null ? void 0 : resolvedManifest.manifest.preloader;
|
|
2000
|
-
const coreBundle = resolvedManifest == null ? void 0 : resolvedManifest.manifest.core;
|
|
2001
|
-
const expandedBundles = expandBundles(referencedBundles, resolvedManifest);
|
|
2002
|
-
let probability = 4;
|
|
2003
|
-
const tenXMinProbability = ssrPreloadProbability * 10;
|
|
2004
|
-
for (const hrefOrProbability of expandedBundles) {
|
|
2005
|
-
if (typeof hrefOrProbability === "string") {
|
|
2006
|
-
if (probability < tenXMinProbability) {
|
|
2007
|
-
break;
|
|
2008
|
-
}
|
|
2009
|
-
if (hrefOrProbability === preloaderBundle2 || hrefOrProbability === coreBundle) {
|
|
2010
|
-
continue;
|
|
2011
|
-
}
|
|
2012
|
-
links.push(hrefOrProbability);
|
|
2013
|
-
if (--allowed === 0) {
|
|
2014
|
-
break;
|
|
2015
|
-
}
|
|
2016
|
-
} else {
|
|
2017
|
-
probability = hrefOrProbability;
|
|
2018
|
-
}
|
|
2019
|
-
}
|
|
2020
|
-
}
|
|
2021
|
-
const preloaderBundle = simplifyPath(base2, resolvedManifest == null ? void 0 : resolvedManifest.manifest.preloader);
|
|
2022
|
-
const insertLinks = links.length ? (
|
|
2023
|
-
/**
|
|
2024
|
-
* We only use modulepreload links because they behave best. Older browsers can rely on the
|
|
2025
|
-
* preloader which does feature detection and which will be available soon after inserting these
|
|
2026
|
-
* links.
|
|
2027
|
-
*/
|
|
2028
|
-
`${JSON.stringify(links)}.map((l,e)=>{e=document.createElement('link');e.rel='modulepreload';e.href=${JSON.stringify(base2)}+l;document.head.appendChild(e)});`
|
|
2029
|
-
) : "";
|
|
2030
|
-
let script = insertLinks;
|
|
2031
|
-
if (preloaderBundle) {
|
|
2032
|
-
script += `window.addEventListener('load',f=>{f=_=>import("${preloaderBundle}").then(({p})=>p(${JSON.stringify(referencedBundles)}));try{requestIdleCallback(f,{timeout:2000})}catch(e){setTimeout(f,200)}})`;
|
|
2033
|
-
}
|
|
2034
|
-
if (script) {
|
|
2035
|
-
const attrs = ["type", "module", "async", true, "q:type", "preload"];
|
|
2036
|
-
if (nonce) {
|
|
2037
|
-
attrs.push("nonce", nonce);
|
|
2038
|
-
}
|
|
2039
|
-
container.openElement("script", null, attrs);
|
|
2040
|
-
container.writer.write(script);
|
|
2041
|
-
container.closeElement();
|
|
2042
|
-
}
|
|
2043
|
-
return null;
|
|
2044
|
-
};
|
|
2045
|
-
var preloaderPost = (ssrContainer, opts, nonce) => {
|
|
2046
|
-
if (opts.preloader !== false) {
|
|
2047
|
-
const qrls = Array.from(ssrContainer.serializationCtx.$eventQrls$);
|
|
2048
|
-
const preloadBundles = getPreloadPaths(qrls, opts, ssrContainer.resolvedManifest);
|
|
2049
|
-
if (preloadBundles.length > 0) {
|
|
2050
|
-
includePreloader(ssrContainer, opts.preloader, preloadBundles, nonce);
|
|
2051
|
-
}
|
|
2052
|
-
}
|
|
2053
|
-
};
|
|
2054
|
-
function normalizePreLoaderOptions(input) {
|
|
2055
|
-
return { ...preLoaderOptionsDefault, ...input };
|
|
2056
|
-
}
|
|
2057
|
-
var preLoaderOptionsDefault = {
|
|
2058
|
-
ssrPreloads: 7,
|
|
2059
|
-
ssrPreloadProbability: 0.5,
|
|
2060
|
-
debug: false,
|
|
2061
|
-
maxIdlePreloads: 25,
|
|
2062
|
-
preloadProbability: 0.35
|
|
2063
|
-
// deprecated
|
|
2064
|
-
};
|
|
2065
|
-
|
|
2066
2105
|
// packages/qwik/src/server/ssr-container.ts
|
|
2067
2106
|
function ssrCreateContainer(opts) {
|
|
2068
2107
|
opts.renderOptions ||= {};
|
|
@@ -2101,6 +2140,7 @@ var SSRContainer = class extends import_internal2._SharedContainer {
|
|
|
2101
2140
|
isHtml;
|
|
2102
2141
|
writer;
|
|
2103
2142
|
timing;
|
|
2143
|
+
size = 0;
|
|
2104
2144
|
resolvedManifest;
|
|
2105
2145
|
symbolToChunkResolver;
|
|
2106
2146
|
renderOptions;
|
|
@@ -2140,7 +2180,10 @@ var SSRContainer = class extends import_internal2._SharedContainer {
|
|
|
2140
2180
|
$instanceHash$ = hash();
|
|
2141
2181
|
// Temporary flag to find missing roots after the state was serialized
|
|
2142
2182
|
$noMoreRoots$ = false;
|
|
2183
|
+
qlInclude;
|
|
2184
|
+
promiseAttributes = null;
|
|
2143
2185
|
constructor(opts) {
|
|
2186
|
+
var _a;
|
|
2144
2187
|
super(() => null, opts.renderOptions.serverData ?? EMPTY_OBJ, opts.locale);
|
|
2145
2188
|
this.symbolToChunkResolver = (symbol) => {
|
|
2146
2189
|
const idx = symbol.lastIndexOf("_");
|
|
@@ -2161,6 +2204,15 @@ var SSRContainer = class extends import_internal2._SharedContainer {
|
|
|
2161
2204
|
this.$buildBase$ = opts.buildBase;
|
|
2162
2205
|
this.resolvedManifest = opts.resolvedManifest;
|
|
2163
2206
|
this.renderOptions = opts.renderOptions;
|
|
2207
|
+
this.$currentUniqueId$ = 1e5;
|
|
2208
|
+
const qlOpt = this.renderOptions.qwikLoader;
|
|
2209
|
+
this.qlInclude = qlOpt ? typeof qlOpt === "object" ? qlOpt.include === "never" ? 2 /* Done */ : 0 /* Module */ : qlOpt === "inline" ? 1 /* Inline */ : qlOpt === "never" ? 2 /* Done */ : 0 /* Module */ : 0 /* Module */;
|
|
2210
|
+
if (this.qlInclude === 0 /* Module */) {
|
|
2211
|
+
const qwikLoaderChunk = (_a = this.resolvedManifest) == null ? void 0 : _a.manifest.qwikLoader;
|
|
2212
|
+
if (!qwikLoaderChunk) {
|
|
2213
|
+
this.qlInclude = 1 /* Inline */;
|
|
2214
|
+
}
|
|
2215
|
+
}
|
|
2164
2216
|
this.$processInjectionsFromManifest$();
|
|
2165
2217
|
}
|
|
2166
2218
|
ensureProjectionResolved(_host) {
|
|
@@ -2250,11 +2302,23 @@ var SSRContainer = class extends import_internal2._SharedContainer {
|
|
|
2250
2302
|
closeContainer() {
|
|
2251
2303
|
return this.closeElement();
|
|
2252
2304
|
}
|
|
2305
|
+
$noScriptHere$ = 0;
|
|
2253
2306
|
/** Renders opening tag for DOM element */
|
|
2254
2307
|
openElement(elementName, varAttrs, constAttrs, currentFile) {
|
|
2308
|
+
const isQwikStyle = isQwikStyleElement(elementName, varAttrs) || isQwikStyleElement(elementName, constAttrs);
|
|
2309
|
+
if (
|
|
2310
|
+
// don't append qwik loader before qwik style elements
|
|
2311
|
+
// it will confuse the resuming, because styles are expected to be the first nodes in subtree
|
|
2312
|
+
!isQwikStyle && this.qlInclude === 1 /* Inline */
|
|
2313
|
+
) {
|
|
2314
|
+
if (this.$noScriptHere$ === 0 && this.size > 30 * 1024 && elementName !== "body") {
|
|
2315
|
+
this.emitQwikLoaderInline();
|
|
2316
|
+
} else if (elementName === "noscript" || elementName === "template") {
|
|
2317
|
+
this.$noScriptHere$++;
|
|
2318
|
+
}
|
|
2319
|
+
}
|
|
2255
2320
|
let innerHTML = void 0;
|
|
2256
2321
|
this.lastNode = null;
|
|
2257
|
-
const isQwikStyle = isQwikStyleElement(elementName, varAttrs) || isQwikStyleElement(elementName, constAttrs);
|
|
2258
2322
|
if (!isQwikStyle && this.currentElementFrame) {
|
|
2259
2323
|
vNodeData_incrementElementCount(this.currentElementFrame.vNodeData);
|
|
2260
2324
|
}
|
|
@@ -2327,6 +2391,11 @@ var SSRContainer = class extends import_internal2._SharedContainer {
|
|
|
2327
2391
|
this.write(">");
|
|
2328
2392
|
}
|
|
2329
2393
|
this.lastNode = null;
|
|
2394
|
+
if (this.qlInclude === 1 /* Inline */) {
|
|
2395
|
+
if (elementName === "noscript" || elementName === "template") {
|
|
2396
|
+
this.$noScriptHere$--;
|
|
2397
|
+
}
|
|
2398
|
+
}
|
|
2330
2399
|
}
|
|
2331
2400
|
/** Writes opening data to vNodeData for fragment boundaries */
|
|
2332
2401
|
openFragment(attrs) {
|
|
@@ -2471,17 +2540,20 @@ var SSRContainer = class extends import_internal2._SharedContainer {
|
|
|
2471
2540
|
////////////////////////////////////
|
|
2472
2541
|
emitContainerData() {
|
|
2473
2542
|
return maybeThen(
|
|
2474
|
-
this.
|
|
2475
|
-
() => maybeThen(
|
|
2476
|
-
|
|
2477
|
-
this
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2543
|
+
this.resolvePromiseAttributes(),
|
|
2544
|
+
() => maybeThen(
|
|
2545
|
+
this.emitUnclaimedProjection(),
|
|
2546
|
+
() => maybeThen(this.emitStateData(), () => {
|
|
2547
|
+
var _a;
|
|
2548
|
+
this.$noMoreRoots$ = true;
|
|
2549
|
+
this.emitVNodeData();
|
|
2550
|
+
preloaderPost(this, this.renderOptions, (_a = this.$serverData$) == null ? void 0 : _a.nonce);
|
|
2551
|
+
this.emitSyncFnsData();
|
|
2552
|
+
this.emitPatchDataIfNeeded();
|
|
2553
|
+
this.emitExecutorIfNeeded();
|
|
2554
|
+
this.emitQwikLoaderAtBottomIfNeeded();
|
|
2555
|
+
})
|
|
2556
|
+
)
|
|
2485
2557
|
);
|
|
2486
2558
|
}
|
|
2487
2559
|
/**
|
|
@@ -2531,7 +2603,7 @@ var SSRContainer = class extends import_internal2._SharedContainer {
|
|
|
2531
2603
|
this.write(VNodeDataChar.OPEN_CHAR);
|
|
2532
2604
|
} else if (value === CLOSE_FRAGMENT) {
|
|
2533
2605
|
if (fragmentAttrs) {
|
|
2534
|
-
|
|
2606
|
+
this.writeFragmentAttrs(fragmentAttrs);
|
|
2535
2607
|
fragmentAttrs = vNodeAttrsStack.pop();
|
|
2536
2608
|
}
|
|
2537
2609
|
depth--;
|
|
@@ -2539,7 +2611,7 @@ var SSRContainer = class extends import_internal2._SharedContainer {
|
|
|
2539
2611
|
} else if (value === WRITE_ELEMENT_ATTRS) {
|
|
2540
2612
|
if (fragmentAttrs && fragmentAttrs.length) {
|
|
2541
2613
|
this.write(VNodeDataChar.SEPARATOR_CHAR);
|
|
2542
|
-
|
|
2614
|
+
this.writeFragmentAttrs(fragmentAttrs);
|
|
2543
2615
|
this.write(VNodeDataChar.SEPARATOR_CHAR);
|
|
2544
2616
|
fragmentAttrs = vNodeAttrsStack.pop();
|
|
2545
2617
|
}
|
|
@@ -2551,7 +2623,7 @@ var SSRContainer = class extends import_internal2._SharedContainer {
|
|
|
2551
2623
|
}
|
|
2552
2624
|
while (depth-- > 0) {
|
|
2553
2625
|
if (fragmentAttrs) {
|
|
2554
|
-
|
|
2626
|
+
this.writeFragmentAttrs(fragmentAttrs);
|
|
2555
2627
|
fragmentAttrs = vNodeAttrsStack.pop();
|
|
2556
2628
|
}
|
|
2557
2629
|
this.write(VNodeDataChar.CLOSE_CHAR);
|
|
@@ -2559,71 +2631,71 @@ var SSRContainer = class extends import_internal2._SharedContainer {
|
|
|
2559
2631
|
}
|
|
2560
2632
|
}
|
|
2561
2633
|
}
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
}
|
|
2574
|
-
switch (key) {
|
|
2575
|
-
case QScopedStyle:
|
|
2576
|
-
write(VNodeDataChar.SCOPED_STYLE_CHAR);
|
|
2577
|
-
break;
|
|
2578
|
-
case OnRenderProp:
|
|
2579
|
-
write(VNodeDataChar.RENDER_FN_CHAR);
|
|
2580
|
-
break;
|
|
2581
|
-
case ELEMENT_ID:
|
|
2582
|
-
write(VNodeDataChar.ID_CHAR);
|
|
2583
|
-
break;
|
|
2584
|
-
case ELEMENT_PROPS:
|
|
2585
|
-
write(VNodeDataChar.PROPS_CHAR);
|
|
2586
|
-
break;
|
|
2587
|
-
case ELEMENT_KEY:
|
|
2588
|
-
encodeValue = true;
|
|
2589
|
-
write(VNodeDataChar.KEY_CHAR);
|
|
2590
|
-
break;
|
|
2591
|
-
case ELEMENT_SEQ:
|
|
2592
|
-
write(VNodeDataChar.SEQ_CHAR);
|
|
2593
|
-
break;
|
|
2594
|
-
case ELEMENT_SEQ_IDX:
|
|
2595
|
-
write(VNodeDataChar.SEQ_IDX_CHAR);
|
|
2596
|
-
break;
|
|
2597
|
-
case QBackRefs:
|
|
2598
|
-
write(VNodeDataChar.BACK_REFS_CHAR);
|
|
2599
|
-
break;
|
|
2600
|
-
case QSlotParent:
|
|
2601
|
-
write(VNodeDataChar.SLOT_PARENT_CHAR);
|
|
2602
|
-
break;
|
|
2603
|
-
// Skipping `\` character for now because it is used for escaping.
|
|
2604
|
-
case QCtxAttr:
|
|
2605
|
-
write(VNodeDataChar.CONTEXT_CHAR);
|
|
2606
|
-
break;
|
|
2607
|
-
case QSlot:
|
|
2608
|
-
write(VNodeDataChar.SLOT_CHAR);
|
|
2609
|
-
break;
|
|
2610
|
-
default:
|
|
2611
|
-
write(VNodeDataChar.SEPARATOR_CHAR);
|
|
2612
|
-
write(key);
|
|
2613
|
-
write(VNodeDataChar.SEPARATOR_CHAR);
|
|
2614
|
-
}
|
|
2615
|
-
const encodedValue = encodeValue ? encodeURI(value) : value;
|
|
2616
|
-
const isEncoded = encodeValue ? encodedValue !== value : false;
|
|
2617
|
-
if (isEncoded) {
|
|
2618
|
-
write(VNodeDataChar.SEPARATOR_CHAR);
|
|
2619
|
-
write(encodedValue);
|
|
2620
|
-
write(VNodeDataChar.SEPARATOR_CHAR);
|
|
2621
|
-
} else {
|
|
2622
|
-
write(value);
|
|
2634
|
+
this.closeElement();
|
|
2635
|
+
}
|
|
2636
|
+
writeFragmentAttrs(fragmentAttrs) {
|
|
2637
|
+
for (let i = 0; i < fragmentAttrs.length; ) {
|
|
2638
|
+
const key = fragmentAttrs[i++];
|
|
2639
|
+
let value = fragmentAttrs[i++];
|
|
2640
|
+
let encodeValue = false;
|
|
2641
|
+
if (typeof value !== "string") {
|
|
2642
|
+
const rootId = this.addRoot(value);
|
|
2643
|
+
if (rootId === void 0) {
|
|
2644
|
+
continue;
|
|
2623
2645
|
}
|
|
2646
|
+
value = String(rootId);
|
|
2647
|
+
}
|
|
2648
|
+
switch (key) {
|
|
2649
|
+
case QScopedStyle:
|
|
2650
|
+
this.write(VNodeDataChar.SCOPED_STYLE_CHAR);
|
|
2651
|
+
break;
|
|
2652
|
+
case OnRenderProp:
|
|
2653
|
+
this.write(VNodeDataChar.RENDER_FN_CHAR);
|
|
2654
|
+
break;
|
|
2655
|
+
case ELEMENT_ID:
|
|
2656
|
+
this.write(VNodeDataChar.ID_CHAR);
|
|
2657
|
+
break;
|
|
2658
|
+
case ELEMENT_PROPS:
|
|
2659
|
+
this.write(VNodeDataChar.PROPS_CHAR);
|
|
2660
|
+
break;
|
|
2661
|
+
case ELEMENT_KEY:
|
|
2662
|
+
encodeValue = true;
|
|
2663
|
+
this.write(VNodeDataChar.KEY_CHAR);
|
|
2664
|
+
break;
|
|
2665
|
+
case ELEMENT_SEQ:
|
|
2666
|
+
this.write(VNodeDataChar.SEQ_CHAR);
|
|
2667
|
+
break;
|
|
2668
|
+
case ELEMENT_SEQ_IDX:
|
|
2669
|
+
this.write(VNodeDataChar.SEQ_IDX_CHAR);
|
|
2670
|
+
break;
|
|
2671
|
+
case QBackRefs:
|
|
2672
|
+
this.write(VNodeDataChar.BACK_REFS_CHAR);
|
|
2673
|
+
break;
|
|
2674
|
+
case QSlotParent:
|
|
2675
|
+
this.write(VNodeDataChar.SLOT_PARENT_CHAR);
|
|
2676
|
+
break;
|
|
2677
|
+
// Skipping `\` character for now because it is used for escaping.
|
|
2678
|
+
case QCtxAttr:
|
|
2679
|
+
this.write(VNodeDataChar.CONTEXT_CHAR);
|
|
2680
|
+
break;
|
|
2681
|
+
case QSlot:
|
|
2682
|
+
this.write(VNodeDataChar.SLOT_CHAR);
|
|
2683
|
+
break;
|
|
2684
|
+
default:
|
|
2685
|
+
this.write(VNodeDataChar.SEPARATOR_CHAR);
|
|
2686
|
+
this.write(key);
|
|
2687
|
+
this.write(VNodeDataChar.SEPARATOR_CHAR);
|
|
2688
|
+
}
|
|
2689
|
+
const encodedValue = encodeValue ? encodeURI(value) : value;
|
|
2690
|
+
const isEncoded = encodeValue ? encodedValue !== value : false;
|
|
2691
|
+
if (isEncoded) {
|
|
2692
|
+
this.write(VNodeDataChar.SEPARATOR_CHAR);
|
|
2693
|
+
this.write(encodedValue);
|
|
2694
|
+
this.write(VNodeDataChar.SEPARATOR_CHAR);
|
|
2695
|
+
} else {
|
|
2696
|
+
this.write(value);
|
|
2624
2697
|
}
|
|
2625
2698
|
}
|
|
2626
|
-
this.closeElement();
|
|
2627
2699
|
}
|
|
2628
2700
|
emitStateData() {
|
|
2629
2701
|
if (!this.serializationCtx.$roots$.length) {
|
|
@@ -2691,61 +2763,54 @@ var SSRContainer = class extends import_internal2._SharedContainer {
|
|
|
2691
2763
|
isStatic() {
|
|
2692
2764
|
return this.serializationCtx.$eventQrls$.size === 0;
|
|
2693
2765
|
}
|
|
2694
|
-
getQwikLoaderIncludeMode() {
|
|
2695
|
-
var _a;
|
|
2696
|
-
return ((_a = this.renderOptions.qwikLoader) == null ? void 0 : _a.include) ?? "auto";
|
|
2697
|
-
}
|
|
2698
2766
|
emitQwikLoaderAtTopIfNeeded() {
|
|
2699
2767
|
var _a;
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
const scriptAttrs = ["type", "module", "async", true, "src", qwikLoaderBundle];
|
|
2714
|
-
if (nonce) {
|
|
2715
|
-
scriptAttrs.push("nonce", nonce);
|
|
2716
|
-
}
|
|
2717
|
-
this.openElement("script", scriptAttrs);
|
|
2718
|
-
this.closeElement();
|
|
2768
|
+
if (this.qlInclude === 0 /* Module */) {
|
|
2769
|
+
this.qlInclude = 2 /* Done */;
|
|
2770
|
+
const qwikLoaderBundle = this.$buildBase$ + this.resolvedManifest.manifest.qwikLoader;
|
|
2771
|
+
const linkAttrs = ["rel", "modulepreload", "href", qwikLoaderBundle];
|
|
2772
|
+
const nonce = (_a = this.renderOptions.serverData) == null ? void 0 : _a.nonce;
|
|
2773
|
+
if (nonce) {
|
|
2774
|
+
linkAttrs.push("nonce", nonce);
|
|
2775
|
+
}
|
|
2776
|
+
this.openElement("link", linkAttrs);
|
|
2777
|
+
this.closeElement();
|
|
2778
|
+
const scriptAttrs = ["async", true, "type", "module", "src", qwikLoaderBundle];
|
|
2779
|
+
if (nonce) {
|
|
2780
|
+
scriptAttrs.push("nonce", nonce);
|
|
2719
2781
|
}
|
|
2782
|
+
this.openElement("script", scriptAttrs);
|
|
2783
|
+
this.closeElement();
|
|
2720
2784
|
}
|
|
2721
2785
|
}
|
|
2722
|
-
|
|
2786
|
+
emitQwikLoaderInline() {
|
|
2723
2787
|
var _a;
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
this.openElement("script", scriptAttrs);
|
|
2739
|
-
this.write(qwikLoaderScript);
|
|
2740
|
-
this.closeElement();
|
|
2788
|
+
this.qlInclude = 2 /* Done */;
|
|
2789
|
+
const qwikLoaderScript = getQwikLoaderScript({ debug: this.renderOptions.debug });
|
|
2790
|
+
const scriptAttrs = ["id", "qwikloader", "async", true, "type", "module"];
|
|
2791
|
+
if ((_a = this.renderOptions.serverData) == null ? void 0 : _a.nonce) {
|
|
2792
|
+
scriptAttrs.push("nonce", this.renderOptions.serverData.nonce);
|
|
2793
|
+
}
|
|
2794
|
+
this.openElement("script", scriptAttrs);
|
|
2795
|
+
this.write(qwikLoaderScript);
|
|
2796
|
+
this.closeElement();
|
|
2797
|
+
}
|
|
2798
|
+
emitQwikLoaderAtBottomIfNeeded() {
|
|
2799
|
+
if (!this.isStatic()) {
|
|
2800
|
+
if (this.qlInclude !== 2 /* Done */) {
|
|
2801
|
+
this.emitQwikLoaderInline();
|
|
2741
2802
|
}
|
|
2803
|
+
this.emitQwikEvents(Array.from(this.serializationCtx.$eventNames$, (s) => JSON.stringify(s)));
|
|
2742
2804
|
}
|
|
2743
|
-
this.emitQwikEvents(Array.from(this.serializationCtx.$eventNames$, (s) => JSON.stringify(s)));
|
|
2744
2805
|
}
|
|
2745
2806
|
emitQwikEvents(eventNames) {
|
|
2746
2807
|
var _a;
|
|
2747
2808
|
if (eventNames.length > 0) {
|
|
2748
|
-
const scriptAttrs =
|
|
2809
|
+
const scriptAttrs = [];
|
|
2810
|
+
const nonce = (_a = this.renderOptions.serverData) == null ? void 0 : _a.nonce;
|
|
2811
|
+
if (nonce) {
|
|
2812
|
+
scriptAttrs.push("nonce", nonce);
|
|
2813
|
+
}
|
|
2749
2814
|
this.openElement("script", scriptAttrs);
|
|
2750
2815
|
this.write(`(window.qwikevents||(window.qwikevents=[])).push(`);
|
|
2751
2816
|
this.writeArray(eventNames, ", ");
|
|
@@ -2804,10 +2869,11 @@ var SSRContainer = class extends import_internal2._SharedContainer {
|
|
|
2804
2869
|
}
|
|
2805
2870
|
}
|
|
2806
2871
|
}
|
|
2872
|
+
// Keep in sync with process-vnode-data.unit.ts
|
|
2807
2873
|
emitVNodeSeparators(lastSerializedIdx, elementIdx) {
|
|
2808
2874
|
let skipCount = elementIdx - lastSerializedIdx;
|
|
2809
2875
|
while (skipCount != 0) {
|
|
2810
|
-
if (skipCount
|
|
2876
|
+
if (skipCount >= 8192) {
|
|
2811
2877
|
this.write(VNodeDataSeparator.ADVANCE_8192_CH);
|
|
2812
2878
|
skipCount -= 8192;
|
|
2813
2879
|
} else {
|
|
@@ -2889,6 +2955,7 @@ var SSRContainer = class extends import_internal2._SharedContainer {
|
|
|
2889
2955
|
}
|
|
2890
2956
|
////////////////////////////////////
|
|
2891
2957
|
write(text) {
|
|
2958
|
+
this.size += text.length;
|
|
2892
2959
|
this.writer.write(text);
|
|
2893
2960
|
}
|
|
2894
2961
|
writeArray(array, separator) {
|
|
@@ -2913,7 +2980,7 @@ var SSRContainer = class extends import_internal2._SharedContainer {
|
|
|
2913
2980
|
}
|
|
2914
2981
|
continue;
|
|
2915
2982
|
}
|
|
2916
|
-
if (
|
|
2983
|
+
if (key === "class" && Array.isArray(value)) {
|
|
2917
2984
|
const [signalValue, styleId] = value;
|
|
2918
2985
|
value = signalValue;
|
|
2919
2986
|
styleScopedId = styleId;
|
|
@@ -2938,7 +3005,18 @@ var SSRContainer = class extends import_internal2._SharedContainer {
|
|
|
2938
3005
|
$scopedStyleIdPrefix$: styleScopedId,
|
|
2939
3006
|
$isConst$: isConst
|
|
2940
3007
|
});
|
|
2941
|
-
|
|
3008
|
+
const signal = value;
|
|
3009
|
+
value = retryOnPromise(
|
|
3010
|
+
() => this.trackSignalValue(signal, lastNode, key, signalData)
|
|
3011
|
+
);
|
|
3012
|
+
}
|
|
3013
|
+
if (isPromise(value)) {
|
|
3014
|
+
const lastNode = this.getOrCreateLastNode();
|
|
3015
|
+
this.addPromiseAttribute(value);
|
|
3016
|
+
value.then((resolvedValue) => {
|
|
3017
|
+
this.addBackpatchEntry(lastNode.id, key, resolvedValue);
|
|
3018
|
+
});
|
|
3019
|
+
continue;
|
|
2942
3020
|
}
|
|
2943
3021
|
if (key === dangerouslySetInnerHTML) {
|
|
2944
3022
|
if (value) {
|
|
@@ -2976,6 +3054,16 @@ var SSRContainer = class extends import_internal2._SharedContainer {
|
|
|
2976
3054
|
}
|
|
2977
3055
|
return innerHTML;
|
|
2978
3056
|
}
|
|
3057
|
+
addPromiseAttribute(promise) {
|
|
3058
|
+
this.promiseAttributes ||= [];
|
|
3059
|
+
this.promiseAttributes.push(promise);
|
|
3060
|
+
}
|
|
3061
|
+
async resolvePromiseAttributes() {
|
|
3062
|
+
if (this.promiseAttributes) {
|
|
3063
|
+
await Promise.all(this.promiseAttributes);
|
|
3064
|
+
this.promiseAttributes = null;
|
|
3065
|
+
}
|
|
3066
|
+
}
|
|
2979
3067
|
};
|
|
2980
3068
|
var isQwikStyleElement = (tag, attrs) => {
|
|
2981
3069
|
if (tag === "style" && attrs != null) {
|
|
@@ -3036,7 +3124,7 @@ var renderToStream = async (jsx, opts) => {
|
|
|
3036
3124
|
const buildBase = getBuildBase(opts);
|
|
3037
3125
|
const resolvedManifest = resolveManifest(opts.manifest);
|
|
3038
3126
|
const locale = typeof opts.locale === "function" ? opts.locale(opts) : ((_a = opts.serverData) == null ? void 0 : _a.locale) || opts.locale || ((_b = opts.containerAttributes) == null ? void 0 : _b.locale) || "";
|
|
3039
|
-
const { stream, flush, networkFlushes
|
|
3127
|
+
const { stream, flush, networkFlushes } = handleStreaming(opts, timing);
|
|
3040
3128
|
const ssrContainer = ssrCreateContainer({
|
|
3041
3129
|
tagName: containerTagName,
|
|
3042
3130
|
locale,
|
|
@@ -3056,7 +3144,7 @@ var renderToStream = async (jsx, opts) => {
|
|
|
3056
3144
|
snapshotResult,
|
|
3057
3145
|
flushes: networkFlushes,
|
|
3058
3146
|
manifest: resolvedManifest == null ? void 0 : resolvedManifest.manifest,
|
|
3059
|
-
size:
|
|
3147
|
+
size: ssrContainer.size,
|
|
3060
3148
|
isStatic: !isDynamic,
|
|
3061
3149
|
timing
|
|
3062
3150
|
};
|
|
@@ -3083,7 +3171,6 @@ function handleStreaming(opts, timing) {
|
|
|
3083
3171
|
let stream = opts.stream;
|
|
3084
3172
|
let bufferSize = 0;
|
|
3085
3173
|
let buffer = "";
|
|
3086
|
-
let totalSize = 0;
|
|
3087
3174
|
let networkFlushes = 0;
|
|
3088
3175
|
const inOrderStreaming = ((_a = opts.streaming) == null ? void 0 : _a.inOrder) ?? {
|
|
3089
3176
|
strategy: "auto",
|
|
@@ -3105,7 +3192,6 @@ function handleStreaming(opts, timing) {
|
|
|
3105
3192
|
function enqueue(chunk) {
|
|
3106
3193
|
const len = chunk.length;
|
|
3107
3194
|
bufferSize += len;
|
|
3108
|
-
totalSize += len;
|
|
3109
3195
|
buffer += chunk;
|
|
3110
3196
|
}
|
|
3111
3197
|
switch (inOrderStreaming.strategy) {
|
|
@@ -3163,8 +3249,7 @@ function handleStreaming(opts, timing) {
|
|
|
3163
3249
|
return {
|
|
3164
3250
|
stream,
|
|
3165
3251
|
flush,
|
|
3166
|
-
networkFlushes
|
|
3167
|
-
totalSize
|
|
3252
|
+
networkFlushes
|
|
3168
3253
|
};
|
|
3169
3254
|
}
|
|
3170
3255
|
function shouldSkipChunk(chunk) {
|