@qwik.dev/core 2.0.0-beta.1 → 2.0.0-beta.11
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 +6 -0
- package/dist/backpatch/index.d.ts +2 -0
- package/dist/backpatch/index.mjs +5 -0
- package/dist/backpatch/package.json +8 -0
- package/dist/backpatch-executor.debug.js +34 -0
- package/dist/backpatch-executor.js +1 -0
- package/dist/build/package.json +1 -1
- package/dist/cli.cjs +3031 -763
- package/dist/core-internal.d.ts +285 -156
- package/dist/core.cjs +7546 -6628
- package/dist/core.cjs.map +1 -1
- package/dist/core.min.mjs +1 -1
- package/dist/core.mjs +7524 -6625
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.cjs +3088 -2624
- package/dist/core.prod.mjs +4453 -3916
- package/dist/insights/vite/index.cjs +1 -1
- package/dist/insights/vite/index.mjs +10 -10
- 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 +208 -4016
- package/dist/optimizer.d.ts +13 -38
- package/dist/optimizer.mjs +2592 -3715
- package/dist/preloader.cjs +8 -11
- package/dist/preloader.mjs +8 -11
- package/dist/qwikloader.debug.js +1 -15
- package/dist/qwikloader.js +1 -1
- package/dist/server.cjs +315 -122
- package/dist/server.d.ts +18 -3
- package/dist/server.mjs +294 -110
- 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/src/entry_aws-lambda.tsx +2 -6
- 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/src/entry.azure-swa.tsx +2 -3
- 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 +0 -2
- 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 +1 -3
- 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/src/entry.cloudflare-pages.tsx +2 -3
- 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 +0 -2
- 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 +1 -3
- 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 +1 -1
- package/dist/starters/adapters/fastify/src/plugins/fastify-qwik.ts +1 -2
- package/dist/starters/adapters/firebase/adapters/firebase/vite.config.mts +1 -1
- package/dist/starters/adapters/firebase/package.json +1 -1
- package/dist/starters/adapters/firebase/src/entry-firebase.tsx +2 -3
- 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/src/entry.netlify-edge.tsx +2 -3
- 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 +0 -2
- 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 -3
- package/dist/starters/adapters/vercel-edge/vercel.json +1 -1
- package/dist/starters/features/auth/package.json +1 -1
- 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 -21
- package/dist/starters/features/pandacss/package.json +1 -1
- package/dist/starters/features/playwright/playwright-report/index.html +953 -911
- package/dist/starters/features/postcss/postcss.config.js +1 -1
- package/dist/starters/features/tailwind/package.json +2 -2
- package/dist/starters/features/tailwind/prettier.config.js +10 -0
- package/dist/starters/features/tailwind-v3/package.json +1 -1
- package/dist/starters/features/tailwind-v3/prettier.config.js +10 -0
- package/dist/testing/index.cjs +9898 -7478
- package/dist/testing/index.d.ts +953 -5
- package/dist/testing/index.mjs +10085 -7683
- package/dist/testing/package.json +1 -1
- package/package.json +16 -10
- package/public.d.ts +1 -0
- package/server.d.ts +2 -0
- package/dist/starters/adapters/static/package.json +0 -19
- package/dist/starters/features/tailwind/.prettierrc.js +0 -3
- /package/dist/starters/adapters/{static → ssg}/README.md +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.11-dev+d7daca3
|
|
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
|
|
@@ -50,6 +50,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
50
50
|
// packages/qwik/src/server/index.ts
|
|
51
51
|
var index_exports = {};
|
|
52
52
|
__export(index_exports, {
|
|
53
|
+
getQwikBackpatchExecutorScript: () => getQwikBackpatchExecutorScript,
|
|
53
54
|
getQwikLoaderScript: () => getQwikLoaderScript,
|
|
54
55
|
getQwikPrefetchWorkerScript: () => getQwikPrefetchWorkerScript,
|
|
55
56
|
renderToStream: () => renderToStream,
|
|
@@ -59,10 +60,11 @@ __export(index_exports, {
|
|
|
59
60
|
versions: () => versions
|
|
60
61
|
});
|
|
61
62
|
module.exports = __toCommonJS(index_exports);
|
|
62
|
-
var
|
|
63
|
+
var import_core3 = require("@qwik.dev/core");
|
|
63
64
|
|
|
64
65
|
// packages/qwik/src/server/platform.ts
|
|
65
66
|
var import_core = require("@qwik.dev/core");
|
|
67
|
+
var import_build6 = require("@qwik.dev/core/build");
|
|
66
68
|
|
|
67
69
|
// packages/qwik/src/core/shared/utils/qdev.ts
|
|
68
70
|
var qDev = globalThis.qDev !== false;
|
|
@@ -123,15 +125,15 @@ var mapApp_findIndx = (array, key, start) => {
|
|
|
123
125
|
}
|
|
124
126
|
return bottom << 1 ^ -1;
|
|
125
127
|
};
|
|
126
|
-
var mapArray_set = (array, key, value, start) => {
|
|
128
|
+
var mapArray_set = (array, key, value, start, allowNullValue = false) => {
|
|
127
129
|
const indx = mapApp_findIndx(array, key, start);
|
|
128
130
|
if (indx >= 0) {
|
|
129
|
-
if (value == null) {
|
|
131
|
+
if (value == null && !allowNullValue) {
|
|
130
132
|
array.splice(indx, 2);
|
|
131
133
|
} else {
|
|
132
134
|
array[indx + 1] = value;
|
|
133
135
|
}
|
|
134
|
-
} else if (value != null) {
|
|
136
|
+
} else if (value != null || allowNullValue) {
|
|
135
137
|
array.splice(indx ^ -1, 0, key, value);
|
|
136
138
|
}
|
|
137
139
|
};
|
|
@@ -157,6 +159,17 @@ var mapArray_has = (array, key, start) => {
|
|
|
157
159
|
return mapApp_findIndx(array, key, start) >= 0;
|
|
158
160
|
};
|
|
159
161
|
|
|
162
|
+
// packages/qwik/src/core/shared/utils/types.ts
|
|
163
|
+
var isObject = (v) => {
|
|
164
|
+
return typeof v === "object" && v !== null;
|
|
165
|
+
};
|
|
166
|
+
var isArray = (v) => {
|
|
167
|
+
return Array.isArray(v);
|
|
168
|
+
};
|
|
169
|
+
var isString = (v) => {
|
|
170
|
+
return typeof v === "string";
|
|
171
|
+
};
|
|
172
|
+
|
|
160
173
|
// packages/qwik/src/core/shared/error/error.ts
|
|
161
174
|
var codeToText = (code, ...parts) => {
|
|
162
175
|
if (qDev) {
|
|
@@ -182,7 +195,7 @@ var codeToText = (code, ...parts) => {
|
|
|
182
195
|
"Invoking 'use*()' method outside of invocation context.",
|
|
183
196
|
// 9
|
|
184
197
|
`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.
|
|
185
|
-
See https://qwik.dev/docs/
|
|
198
|
+
See https://qwik.dev/docs/core/tasks/#use-method-rules`,
|
|
186
199
|
// 10
|
|
187
200
|
'The provided Context reference "{{0}}" is not a valid context created by createContextId()',
|
|
188
201
|
// 11
|
|
@@ -237,7 +250,7 @@ See https://qwik.dev/docs/components/tasks/#use-method-rules`,
|
|
|
237
250
|
if (parts.length) {
|
|
238
251
|
text = text.replaceAll(/{{(\d+)}}/g, (_, index) => {
|
|
239
252
|
let v = parts[index];
|
|
240
|
-
if (v &&
|
|
253
|
+
if (v && isObject(v) && v.constructor === Object) {
|
|
241
254
|
v = JSON.stringify(v).slice(0, 50);
|
|
242
255
|
}
|
|
243
256
|
return v;
|
|
@@ -322,6 +335,7 @@ var ELEMENT_KEY = "q:key";
|
|
|
322
335
|
var ELEMENT_PROPS = "q:props";
|
|
323
336
|
var ELEMENT_SEQ = "q:seq";
|
|
324
337
|
var ELEMENT_SEQ_IDX = "q:seqIdx";
|
|
338
|
+
var ELEMENT_BACKPATCH_DATA = "qwik/backpatch";
|
|
325
339
|
var NON_SERIALIZABLE_MARKER_PREFIX = ":";
|
|
326
340
|
var USE_ON_LOCAL = NON_SERIALIZABLE_MARKER_PREFIX + "on";
|
|
327
341
|
var USE_ON_LOCAL_SEQ_IDX = NON_SERIALIZABLE_MARKER_PREFIX + "onIdx";
|
|
@@ -357,14 +371,6 @@ function isPreventDefault(key) {
|
|
|
357
371
|
return key.startsWith("preventdefault:");
|
|
358
372
|
}
|
|
359
373
|
|
|
360
|
-
// packages/qwik/src/core/shared/utils/types.ts
|
|
361
|
-
var isArray = (v) => {
|
|
362
|
-
return Array.isArray(v);
|
|
363
|
-
};
|
|
364
|
-
var isString = (v) => {
|
|
365
|
-
return typeof v === "string";
|
|
366
|
-
};
|
|
367
|
-
|
|
368
374
|
// packages/qwik/src/core/shared/utils/unitless_number.ts
|
|
369
375
|
var unitlessNumbers = /* @__PURE__ */ new Set([
|
|
370
376
|
"animationIterationCount",
|
|
@@ -936,12 +942,9 @@ var trigger = () => {
|
|
|
936
942
|
const bundle = queue[0];
|
|
937
943
|
const inverseProbability = bundle.$inverseProbability$;
|
|
938
944
|
const probability = 1 - inverseProbability;
|
|
939
|
-
const allowedPreloads = graph ? (
|
|
940
|
-
//
|
|
941
|
-
|
|
942
|
-
) : (
|
|
943
|
-
// While the graph is not available, we limit to 2 preloads
|
|
944
|
-
2
|
|
945
|
+
const allowedPreloads = graph ? config.$maxIdlePreloads$ : (
|
|
946
|
+
// While the graph is not available, we limit to 5 preloads
|
|
947
|
+
5
|
|
945
948
|
);
|
|
946
949
|
if (probability >= 0.99 || preloadCount < allowedPreloads) {
|
|
947
950
|
queue.shift();
|
|
@@ -997,7 +1000,7 @@ var adjustProbabilities = (bundle, newInverseProbability, seen) => {
|
|
|
997
1000
|
}
|
|
998
1001
|
if (
|
|
999
1002
|
// don't queue until we have initialized the preloader
|
|
1000
|
-
base != null && bundle.$state$ < BundleImportState_Preload
|
|
1003
|
+
base != null && bundle.$state$ < BundleImportState_Preload
|
|
1001
1004
|
) {
|
|
1002
1005
|
if (bundle.$state$ === BundleImportState_None) {
|
|
1003
1006
|
bundle.$state$ = BundleImportState_Queued;
|
|
@@ -1016,7 +1019,7 @@ var adjustProbabilities = (bundle, newInverseProbability, seen) => {
|
|
|
1016
1019
|
continue;
|
|
1017
1020
|
}
|
|
1018
1021
|
let newInverseProbability2;
|
|
1019
|
-
if (
|
|
1022
|
+
if (probability === 1 || probability >= 0.99 && depsCount < 100) {
|
|
1020
1023
|
depsCount++;
|
|
1021
1024
|
newInverseProbability2 = Math.min(0.01, 1 - dep.$importProbability$);
|
|
1022
1025
|
} else {
|
|
@@ -1070,13 +1073,32 @@ if (import_build5.isBrowser) {
|
|
|
1070
1073
|
}
|
|
1071
1074
|
|
|
1072
1075
|
// packages/qwik/src/server/platform.ts
|
|
1076
|
+
var import_meta = {};
|
|
1077
|
+
var getDevSegmentPath = (mapper, hash2, symbolName, parent) => {
|
|
1078
|
+
const existing = mapper == null ? void 0 : mapper[hash2];
|
|
1079
|
+
if (existing) {
|
|
1080
|
+
return existing;
|
|
1081
|
+
}
|
|
1082
|
+
if (symbolName === SYNC_QRL) {
|
|
1083
|
+
return [symbolName, ""];
|
|
1084
|
+
}
|
|
1085
|
+
if (!parent) {
|
|
1086
|
+
if (symbolName.startsWith("_") && symbolName.length < 6) {
|
|
1087
|
+
return [symbolName, `${globalThis.BASE_URL}@qwik-handlers`];
|
|
1088
|
+
}
|
|
1089
|
+
console.error("qwik symbolMapper: unknown qrl requested without parent:", symbolName);
|
|
1090
|
+
return [symbolName, `${globalThis.BASE_URL}${symbolName}.js`];
|
|
1091
|
+
}
|
|
1092
|
+
const qrlFile = `${globalThis.BASE_URL}${parent.startsWith("/") ? parent.slice(1) : parent}_${symbolName}.js`;
|
|
1093
|
+
return [symbolName, qrlFile];
|
|
1094
|
+
};
|
|
1073
1095
|
function createPlatform(opts, resolvedManifest) {
|
|
1074
1096
|
const mapper = resolvedManifest == null ? void 0 : resolvedManifest.mapper;
|
|
1075
1097
|
const mapperFn = opts.symbolMapper ? opts.symbolMapper : (symbolName, _chunk, parent) => {
|
|
1076
1098
|
var _a;
|
|
1077
|
-
if (mapper) {
|
|
1099
|
+
if (mapper || import_build6.isDev && import_meta.env.MODE !== "test") {
|
|
1078
1100
|
const hash2 = getSymbolHash(symbolName);
|
|
1079
|
-
const result = mapper[hash2];
|
|
1101
|
+
const result = !import_build6.isDev ? mapper[hash2] : getDevSegmentPath(mapper, hash2, symbolName, parent);
|
|
1080
1102
|
if (!result) {
|
|
1081
1103
|
if (hash2 === SYNC_QRL) {
|
|
1082
1104
|
return [hash2, ""];
|
|
@@ -1085,9 +1107,6 @@ function createPlatform(opts, resolvedManifest) {
|
|
|
1085
1107
|
if (isRegistered) {
|
|
1086
1108
|
return [symbolName, "_"];
|
|
1087
1109
|
}
|
|
1088
|
-
if (parent) {
|
|
1089
|
-
return [symbolName, `${parent}?qrl=${symbolName}`];
|
|
1090
|
-
}
|
|
1091
1110
|
console.error("Cannot resolve symbol", symbolName, "in", mapper, parent);
|
|
1092
1111
|
}
|
|
1093
1112
|
return result;
|
|
@@ -1116,13 +1135,6 @@ function createPlatform(opts, resolvedManifest) {
|
|
|
1116
1135
|
console.error("server can not rerender");
|
|
1117
1136
|
return Promise.resolve();
|
|
1118
1137
|
},
|
|
1119
|
-
nextTick: (fn) => {
|
|
1120
|
-
return new Promise((resolve) => {
|
|
1121
|
-
setTimeout(() => {
|
|
1122
|
-
resolve(fn());
|
|
1123
|
-
});
|
|
1124
|
-
});
|
|
1125
|
-
},
|
|
1126
1138
|
chunkForSymbol(symbolName, _chunk, parent) {
|
|
1127
1139
|
return mapperFn(symbolName, mapper, parent);
|
|
1128
1140
|
}
|
|
@@ -1167,17 +1179,52 @@ function getBuildBase(opts) {
|
|
|
1167
1179
|
return `${globalThis.BASE_URL || "/"}build/`;
|
|
1168
1180
|
}
|
|
1169
1181
|
var versions = {
|
|
1170
|
-
qwik: "2.0.0-beta.
|
|
1182
|
+
qwik: "2.0.0-beta.11-dev+d7daca3",
|
|
1171
1183
|
qwikDom: "2.1.19"
|
|
1172
1184
|
};
|
|
1173
1185
|
|
|
1174
1186
|
// packages/qwik/src/server/ssr-container.ts
|
|
1175
|
-
var
|
|
1176
|
-
var
|
|
1187
|
+
var import_internal2 = require("@qwik.dev/core/internal");
|
|
1188
|
+
var import_build8 = require("@qwik.dev/core/build");
|
|
1177
1189
|
|
|
1178
1190
|
// packages/qwik/src/server/scripts.ts
|
|
1179
|
-
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)),
|
|
1180
|
-
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";\
|
|
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 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()}';
|
|
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(\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}';
|
|
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 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))}}}}`;
|
|
1194
|
+
var QWIK_BACKPATCH_EXECUTOR_DEBUG = `const BACKPATCH_DATA_SELECTOR = 'script[type="qwik/backpatch"]';
|
|
1195
|
+
const executorScript = document.currentScript;
|
|
1196
|
+
if (executorScript) {
|
|
1197
|
+
const container = executorScript.closest(
|
|
1198
|
+
"[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])"
|
|
1199
|
+
);
|
|
1200
|
+
if (container) {
|
|
1201
|
+
const script = container.querySelector(BACKPATCH_DATA_SELECTOR);
|
|
1202
|
+
if (script) {
|
|
1203
|
+
const data = JSON.parse(script.textContent || "[]");
|
|
1204
|
+
const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT);
|
|
1205
|
+
let currentNode = walker.currentNode;
|
|
1206
|
+
let currentNodeIdx = 0;
|
|
1207
|
+
for (let i = 0; i < data.length; i += 3) {
|
|
1208
|
+
const elementIdx = data[i];
|
|
1209
|
+
const attrName = data[i + 1];
|
|
1210
|
+
let value = data[i + 2];
|
|
1211
|
+
while (currentNodeIdx < elementIdx) {
|
|
1212
|
+
currentNode = walker.nextNode();
|
|
1213
|
+
currentNodeIdx++;
|
|
1214
|
+
}
|
|
1215
|
+
const element = currentNode;
|
|
1216
|
+
if (value == null || value === false) {
|
|
1217
|
+
element.removeAttribute(attrName);
|
|
1218
|
+
} else {
|
|
1219
|
+
if (typeof value === "boolean") {
|
|
1220
|
+
value = "";
|
|
1221
|
+
}
|
|
1222
|
+
element.setAttribute(attrName, value);
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
}`;
|
|
1181
1228
|
function getQwikLoaderScript(opts = {}) {
|
|
1182
1229
|
return opts.debug ? QWIK_LOADER_DEFAULT_DEBUG : QWIK_LOADER_DEFAULT_MINIFIED;
|
|
1183
1230
|
}
|
|
@@ -1186,20 +1233,26 @@ var QWIK_PREFETCH_DEBUG = globalThis.QWIK_PREFETCH_DEBUG;
|
|
|
1186
1233
|
function getQwikPrefetchWorkerScript(opts = {}) {
|
|
1187
1234
|
return opts.debug ? QWIK_PREFETCH_DEBUG : QWIK_PREFETCH_MINIFIED;
|
|
1188
1235
|
}
|
|
1236
|
+
function getQwikBackpatchExecutorScript(opts = {}) {
|
|
1237
|
+
return opts.debug ? QWIK_BACKPATCH_EXECUTOR_DEBUG : QWIK_BACKPATCH_EXECUTOR_MINIFIED;
|
|
1238
|
+
}
|
|
1189
1239
|
|
|
1190
1240
|
// packages/qwik/src/server/ssr-node.ts
|
|
1191
|
-
var
|
|
1192
|
-
var
|
|
1241
|
+
var import_internal = require("@qwik.dev/core/internal");
|
|
1242
|
+
var import_build7 = require("@qwik.dev/core/build");
|
|
1193
1243
|
var SsrNode = class {
|
|
1194
|
-
constructor(
|
|
1195
|
-
this.
|
|
1244
|
+
constructor(parentComponent, id, attributesIndex, cleanupQueue, vnodeData, currentFile) {
|
|
1245
|
+
this.parentComponent = parentComponent;
|
|
1246
|
+
this.attributesIndex = attributesIndex;
|
|
1196
1247
|
this.cleanupQueue = cleanupQueue;
|
|
1197
1248
|
this.vnodeData = vnodeData;
|
|
1249
|
+
this.currentFile = currentFile;
|
|
1198
1250
|
var _a;
|
|
1199
|
-
this.parentSsrNode = parentSsrNode;
|
|
1200
|
-
(_a = this.parentSsrNode) == null ? void 0 : _a.addChild(this);
|
|
1201
1251
|
this.id = id;
|
|
1202
|
-
|
|
1252
|
+
this.flags = 1 /* Updatable */;
|
|
1253
|
+
this.attrs = this.attributesIndex >= 0 ? this.vnodeData[this.attributesIndex] : import_internal._EMPTY_ARRAY;
|
|
1254
|
+
(_a = this.parentComponent) == null ? void 0 : _a.addChild(this);
|
|
1255
|
+
if (import_build7.isDev && id.indexOf("undefined") != -1) {
|
|
1203
1256
|
throw new Error(`Invalid SSR node id: ${id}`);
|
|
1204
1257
|
}
|
|
1205
1258
|
}
|
|
@@ -1210,16 +1263,17 @@ var SsrNode = class {
|
|
|
1210
1263
|
* @param id - Unique id for the node.
|
|
1211
1264
|
*/
|
|
1212
1265
|
id;
|
|
1213
|
-
|
|
1266
|
+
flags;
|
|
1214
1267
|
children = null;
|
|
1268
|
+
attrs;
|
|
1215
1269
|
/** Local props which don't serialize; */
|
|
1216
1270
|
localProps = null;
|
|
1217
|
-
get [
|
|
1271
|
+
get [import_internal._EFFECT_BACK_REF]() {
|
|
1218
1272
|
return this.getProp(QBackRefs);
|
|
1219
1273
|
}
|
|
1220
1274
|
setProp(name, value) {
|
|
1221
|
-
if (this.attrs ===
|
|
1222
|
-
this.
|
|
1275
|
+
if (this.attrs === import_internal._EMPTY_ARRAY) {
|
|
1276
|
+
this.setEmptyArrayAsVNodeDataAttributes();
|
|
1223
1277
|
}
|
|
1224
1278
|
if (name.startsWith(NON_SERIALIZABLE_MARKER_PREFIX)) {
|
|
1225
1279
|
mapArray_set(this.localProps || (this.localProps = []), name, value, 0);
|
|
@@ -1230,6 +1284,17 @@ var SsrNode = class {
|
|
|
1230
1284
|
this.cleanupQueue.push(value);
|
|
1231
1285
|
}
|
|
1232
1286
|
}
|
|
1287
|
+
setEmptyArrayAsVNodeDataAttributes() {
|
|
1288
|
+
if (this.attributesIndex >= 0) {
|
|
1289
|
+
this.vnodeData[this.attributesIndex] = [];
|
|
1290
|
+
this.attrs = this.vnodeData[this.attributesIndex];
|
|
1291
|
+
} else {
|
|
1292
|
+
const newAttributesIndex = this.vnodeData.length > 1 ? 1 : 0;
|
|
1293
|
+
this.vnodeData.splice(newAttributesIndex, 0, []);
|
|
1294
|
+
this.attributesIndex = newAttributesIndex;
|
|
1295
|
+
this.attrs = this.vnodeData[this.attributesIndex];
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1233
1298
|
getProp(name) {
|
|
1234
1299
|
if (name.startsWith(NON_SERIALIZABLE_MARKER_PREFIX)) {
|
|
1235
1300
|
return this.localProps ? mapArray_get(this.localProps, name, 0) : null;
|
|
@@ -1252,18 +1317,30 @@ var SsrNode = class {
|
|
|
1252
1317
|
}
|
|
1253
1318
|
this.children.push(child);
|
|
1254
1319
|
}
|
|
1320
|
+
setTreeNonUpdatable() {
|
|
1321
|
+
this.flags &= ~1 /* Updatable */;
|
|
1322
|
+
if (this.children) {
|
|
1323
|
+
for (const child of this.children) {
|
|
1324
|
+
child.setTreeNonUpdatable();
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1255
1328
|
toString() {
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1329
|
+
if (import_build7.isDev) {
|
|
1330
|
+
let stringifiedAttrs = "";
|
|
1331
|
+
for (let i = 0; i < this.attrs.length; i += 2) {
|
|
1332
|
+
const key = this.attrs[i];
|
|
1333
|
+
const value = this.attrs[i + 1];
|
|
1334
|
+
stringifiedAttrs += `${key}=`;
|
|
1335
|
+
stringifiedAttrs += `${typeof value === "string" || typeof value === "number" ? JSON.stringify(value) : "*"}`;
|
|
1336
|
+
if (i < this.attrs.length - 2) {
|
|
1337
|
+
stringifiedAttrs += ", ";
|
|
1338
|
+
}
|
|
1264
1339
|
}
|
|
1340
|
+
return `<SSRNode id="${this.id}" ${stringifiedAttrs} />`;
|
|
1341
|
+
} else {
|
|
1342
|
+
return `<SSRNode id="${this.id}" />`;
|
|
1265
1343
|
}
|
|
1266
|
-
return `SSRNode [<${this.id}> ${stringifiedAttrs}]`;
|
|
1267
1344
|
}
|
|
1268
1345
|
};
|
|
1269
1346
|
var DomRef = class {
|
|
@@ -1284,14 +1361,14 @@ var SsrComponentFrame = class {
|
|
|
1284
1361
|
distributeChildrenIntoSlots(children, projectionScopedStyle, projectionComponentFrame) {
|
|
1285
1362
|
this.projectionScopedStyle = projectionScopedStyle;
|
|
1286
1363
|
this.projectionComponentFrame = projectionComponentFrame;
|
|
1287
|
-
if ((0,
|
|
1364
|
+
if ((0, import_internal._isJSXNode)(children)) {
|
|
1288
1365
|
const slotName = this.getSlotName(children);
|
|
1289
1366
|
mapArray_set(this.slots, slotName, children, 0);
|
|
1290
1367
|
} else if (Array.isArray(children) && children.length > 0) {
|
|
1291
1368
|
const defaultSlot = [];
|
|
1292
1369
|
for (let i = 0; i < children.length; i++) {
|
|
1293
1370
|
const child = children[i];
|
|
1294
|
-
if ((0,
|
|
1371
|
+
if ((0, import_internal._isJSXNode)(child)) {
|
|
1295
1372
|
const slotName = this.getSlotName(child);
|
|
1296
1373
|
if (slotName === QDefaultSlot) {
|
|
1297
1374
|
defaultSlot.push(child);
|
|
@@ -1374,6 +1451,10 @@ var allowedContent = (state) => {
|
|
|
1374
1451
|
case 514 /* PHRASING_INSIDE_INPUT */:
|
|
1375
1452
|
case 1026 /* PHRASING_CONTAINER */:
|
|
1376
1453
|
return ["phrasing content", "<a>, <b>, <img>, <input> ... (no <div>, <p> ...)"];
|
|
1454
|
+
case 2050 /* PICTURE */:
|
|
1455
|
+
return ["picture content", "<source>, <img>"];
|
|
1456
|
+
case 4098 /* BUTTON */:
|
|
1457
|
+
return ["button content", "phrasing content except interactive elements"];
|
|
1377
1458
|
case 1 /* DOCUMENT */:
|
|
1378
1459
|
return ["document", "<html>"];
|
|
1379
1460
|
}
|
|
@@ -1415,6 +1496,10 @@ function isTagAllowed(state, tag) {
|
|
|
1415
1496
|
return isInPhrasing(tag, true);
|
|
1416
1497
|
case 514 /* PHRASING_INSIDE_INPUT */:
|
|
1417
1498
|
return isInPhrasing(tag, false);
|
|
1499
|
+
case 2050 /* PICTURE */:
|
|
1500
|
+
return isInPicture(tag);
|
|
1501
|
+
case 4098 /* BUTTON */:
|
|
1502
|
+
return isInButton(tag);
|
|
1418
1503
|
case 1 /* DOCUMENT */:
|
|
1419
1504
|
if (tag === "html") {
|
|
1420
1505
|
return 32 /* HTML */;
|
|
@@ -1494,9 +1579,12 @@ function isInAnything(text) {
|
|
|
1494
1579
|
case "body":
|
|
1495
1580
|
return 0 /* NOT_ALLOWED */;
|
|
1496
1581
|
case "button":
|
|
1582
|
+
return 4098 /* BUTTON */;
|
|
1497
1583
|
case "input":
|
|
1498
1584
|
case "textarea":
|
|
1499
1585
|
return 514 /* PHRASING_INSIDE_INPUT */;
|
|
1586
|
+
case "picture":
|
|
1587
|
+
return 2050 /* PICTURE */;
|
|
1500
1588
|
default:
|
|
1501
1589
|
return 10 /* ANYTHING */;
|
|
1502
1590
|
}
|
|
@@ -1540,12 +1628,35 @@ function isInTableColGroup(text) {
|
|
|
1540
1628
|
return 0 /* NOT_ALLOWED */;
|
|
1541
1629
|
}
|
|
1542
1630
|
}
|
|
1631
|
+
function isInPicture(text) {
|
|
1632
|
+
switch (text) {
|
|
1633
|
+
case "source":
|
|
1634
|
+
return 4 /* EMPTY */;
|
|
1635
|
+
case "img":
|
|
1636
|
+
return 4 /* EMPTY */;
|
|
1637
|
+
default:
|
|
1638
|
+
return 0 /* NOT_ALLOWED */;
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
function isInButton(text) {
|
|
1642
|
+
switch (text) {
|
|
1643
|
+
case "button":
|
|
1644
|
+
case "input":
|
|
1645
|
+
case "textarea":
|
|
1646
|
+
case "select":
|
|
1647
|
+
case "a":
|
|
1648
|
+
return 0 /* NOT_ALLOWED */;
|
|
1649
|
+
case "picture":
|
|
1650
|
+
return 2050 /* PICTURE */;
|
|
1651
|
+
default:
|
|
1652
|
+
return isInPhrasing(text, false);
|
|
1653
|
+
}
|
|
1654
|
+
}
|
|
1543
1655
|
function isInPhrasing(text, allowInput) {
|
|
1544
1656
|
switch (text) {
|
|
1545
1657
|
case "svg":
|
|
1546
1658
|
case "math":
|
|
1547
1659
|
return 1026 /* PHRASING_CONTAINER */;
|
|
1548
|
-
case "button":
|
|
1549
1660
|
case "input":
|
|
1550
1661
|
case "textarea":
|
|
1551
1662
|
return allowInput ? 514 /* PHRASING_INSIDE_INPUT */ : 0 /* NOT_ALLOWED */;
|
|
@@ -1557,6 +1668,7 @@ function isInPhrasing(text, allowInput) {
|
|
|
1557
1668
|
case "bdi":
|
|
1558
1669
|
case "bdo":
|
|
1559
1670
|
case "br":
|
|
1671
|
+
case "button":
|
|
1560
1672
|
case "canvas":
|
|
1561
1673
|
case "cite":
|
|
1562
1674
|
case "code":
|
|
@@ -1584,7 +1696,6 @@ function isInPhrasing(text, allowInput) {
|
|
|
1584
1696
|
case "object":
|
|
1585
1697
|
case "option":
|
|
1586
1698
|
case "output":
|
|
1587
|
-
case "picture":
|
|
1588
1699
|
case "progress":
|
|
1589
1700
|
case "q":
|
|
1590
1701
|
case "ruby":
|
|
@@ -1607,13 +1718,14 @@ function isInPhrasing(text, allowInput) {
|
|
|
1607
1718
|
return allowInput ? 258 /* PHRASING_ANY */ : 514 /* PHRASING_INSIDE_INPUT */;
|
|
1608
1719
|
case "style":
|
|
1609
1720
|
return 2 /* TEXT */;
|
|
1721
|
+
case "picture":
|
|
1722
|
+
return 2050 /* PICTURE */;
|
|
1610
1723
|
default:
|
|
1611
1724
|
return 0 /* NOT_ALLOWED */;
|
|
1612
1725
|
}
|
|
1613
1726
|
}
|
|
1614
1727
|
|
|
1615
1728
|
// packages/qwik/src/server/vnode-data.ts
|
|
1616
|
-
var import_core3 = require("@qwik.dev/core");
|
|
1617
1729
|
var OPEN_FRAGMENT = Number.MAX_SAFE_INTEGER;
|
|
1618
1730
|
var CLOSE_FRAGMENT = Number.MAX_SAFE_INTEGER - 1;
|
|
1619
1731
|
var WRITE_ELEMENT_ATTRS = Number.MAX_SAFE_INTEGER - 2;
|
|
@@ -1648,14 +1760,14 @@ function vNodeData_openElement(vNodeData) {
|
|
|
1648
1760
|
vNodeData.push([], WRITE_ELEMENT_ATTRS);
|
|
1649
1761
|
vNodeData[0] |= 4 /* ELEMENT_NODE */;
|
|
1650
1762
|
}
|
|
1651
|
-
function vNodeData_createSsrNodeReference(currentComponentNode, vNodeData, depthFirstElementIdx, cleanupQueue) {
|
|
1763
|
+
function vNodeData_createSsrNodeReference(currentComponentNode, vNodeData, depthFirstElementIdx, cleanupQueue, currentFile) {
|
|
1652
1764
|
vNodeData[0] |= 8 /* REFERENCE */;
|
|
1653
|
-
let fragmentAttrs = import_core3._EMPTY_ARRAY;
|
|
1654
1765
|
const stack = [-1];
|
|
1766
|
+
let attributesIndex = -1;
|
|
1655
1767
|
for (let i = 1; i < vNodeData.length; i++) {
|
|
1656
1768
|
const value = vNodeData[i];
|
|
1657
1769
|
if (Array.isArray(value)) {
|
|
1658
|
-
|
|
1770
|
+
attributesIndex = i;
|
|
1659
1771
|
i++;
|
|
1660
1772
|
if (vNodeData[i] !== WRITE_ELEMENT_ATTRS) {
|
|
1661
1773
|
stack[stack.length - 1]++;
|
|
@@ -1663,7 +1775,6 @@ function vNodeData_createSsrNodeReference(currentComponentNode, vNodeData, depth
|
|
|
1663
1775
|
}
|
|
1664
1776
|
} else if (value === CLOSE_FRAGMENT) {
|
|
1665
1777
|
stack.pop();
|
|
1666
|
-
fragmentAttrs = import_core3._EMPTY_ARRAY;
|
|
1667
1778
|
} else if (value < 0) {
|
|
1668
1779
|
const numberOfElements = 0 - value;
|
|
1669
1780
|
stack[stack.length - 1] += numberOfElements;
|
|
@@ -1680,7 +1791,14 @@ function vNodeData_createSsrNodeReference(currentComponentNode, vNodeData, depth
|
|
|
1680
1791
|
}
|
|
1681
1792
|
}
|
|
1682
1793
|
}
|
|
1683
|
-
return new SsrNode(
|
|
1794
|
+
return new SsrNode(
|
|
1795
|
+
currentComponentNode,
|
|
1796
|
+
refId,
|
|
1797
|
+
attributesIndex,
|
|
1798
|
+
cleanupQueue,
|
|
1799
|
+
vNodeData,
|
|
1800
|
+
currentFile
|
|
1801
|
+
);
|
|
1684
1802
|
}
|
|
1685
1803
|
var ALPHANUMERIC = [];
|
|
1686
1804
|
function encodeAsAlphanumeric(value) {
|
|
@@ -1703,7 +1821,7 @@ function encodeAsAlphanumeric(value) {
|
|
|
1703
1821
|
}
|
|
1704
1822
|
|
|
1705
1823
|
// packages/qwik/src/server/preload-strategy.ts
|
|
1706
|
-
var
|
|
1824
|
+
var import_core2 = require("@qwik.dev/core");
|
|
1707
1825
|
|
|
1708
1826
|
// packages/qwik/src/server/preload-utils.ts
|
|
1709
1827
|
function flattenPrefetchResources(prefetchResources) {
|
|
@@ -1726,7 +1844,7 @@ function flattenPrefetchResources(prefetchResources) {
|
|
|
1726
1844
|
|
|
1727
1845
|
// packages/qwik/src/server/preload-strategy.ts
|
|
1728
1846
|
var getBundles = (qrls) => {
|
|
1729
|
-
const platform = (0,
|
|
1847
|
+
const platform = (0, import_core2.getPlatform)();
|
|
1730
1848
|
return qrls == null ? void 0 : qrls.map((qrl) => {
|
|
1731
1849
|
var _a;
|
|
1732
1850
|
const symbol = qrl.$symbol$;
|
|
@@ -1830,7 +1948,11 @@ var preloaderPre = (container, options, nonce) => {
|
|
|
1830
1948
|
}
|
|
1831
1949
|
}
|
|
1832
1950
|
const optsStr = opts.length ? `,{${opts.join(",")}}` : "";
|
|
1833
|
-
|
|
1951
|
+
const preloaderLinkAttrs = ["rel", "modulepreload", "href", preloaderBundle];
|
|
1952
|
+
if (nonce) {
|
|
1953
|
+
preloaderLinkAttrs.push("nonce", nonce);
|
|
1954
|
+
}
|
|
1955
|
+
container.openElement("link", null, preloaderLinkAttrs);
|
|
1834
1956
|
container.closeElement();
|
|
1835
1957
|
container.openElement("link", null, [
|
|
1836
1958
|
"rel",
|
|
@@ -1854,7 +1976,11 @@ var preloaderPre = (container, options, nonce) => {
|
|
|
1854
1976
|
}
|
|
1855
1977
|
const corePath = simplifyPath(base2, resolvedManifest == null ? void 0 : resolvedManifest.manifest.core);
|
|
1856
1978
|
if (corePath) {
|
|
1857
|
-
|
|
1979
|
+
const linkAttrs = ["rel", "modulepreload", "href", corePath];
|
|
1980
|
+
if (nonce) {
|
|
1981
|
+
linkAttrs.push("nonce", nonce);
|
|
1982
|
+
}
|
|
1983
|
+
container.openElement("link", null, linkAttrs);
|
|
1858
1984
|
container.closeElement();
|
|
1859
1985
|
}
|
|
1860
1986
|
};
|
|
@@ -1934,6 +2060,7 @@ var preLoaderOptionsDefault = {
|
|
|
1934
2060
|
debug: false,
|
|
1935
2061
|
maxIdlePreloads: 25,
|
|
1936
2062
|
preloadProbability: 0.35
|
|
2063
|
+
// deprecated
|
|
1937
2064
|
};
|
|
1938
2065
|
|
|
1939
2066
|
// packages/qwik/src/server/ssr-container.ts
|
|
@@ -1969,7 +2096,7 @@ var StringBufferWriter = class {
|
|
|
1969
2096
|
}
|
|
1970
2097
|
};
|
|
1971
2098
|
var EMPTY_OBJ = {};
|
|
1972
|
-
var SSRContainer = class extends
|
|
2099
|
+
var SSRContainer = class extends import_internal2._SharedContainer {
|
|
1973
2100
|
tag;
|
|
1974
2101
|
isHtml;
|
|
1975
2102
|
writer;
|
|
@@ -1994,6 +2121,8 @@ var SSRContainer = class extends import_core5._SharedContainer {
|
|
|
1994
2121
|
lastNode = null;
|
|
1995
2122
|
currentComponentNode = null;
|
|
1996
2123
|
styleIds = /* @__PURE__ */ new Set();
|
|
2124
|
+
isBackpatchExecutorEmitted = false;
|
|
2125
|
+
backpatchMap = /* @__PURE__ */ new Map();
|
|
1997
2126
|
currentElementFrame = null;
|
|
1998
2127
|
renderTimer;
|
|
1999
2128
|
/**
|
|
@@ -2012,18 +2141,7 @@ var SSRContainer = class extends import_core5._SharedContainer {
|
|
|
2012
2141
|
// Temporary flag to find missing roots after the state was serialized
|
|
2013
2142
|
$noMoreRoots$ = false;
|
|
2014
2143
|
constructor(opts) {
|
|
2015
|
-
super(
|
|
2016
|
-
() => {
|
|
2017
|
-
try {
|
|
2018
|
-
return this.$scheduler$(255 /* WAIT_FOR_ALL */);
|
|
2019
|
-
} catch (e) {
|
|
2020
|
-
this.handleError(e, null);
|
|
2021
|
-
}
|
|
2022
|
-
},
|
|
2023
|
-
() => null,
|
|
2024
|
-
opts.renderOptions.serverData ?? EMPTY_OBJ,
|
|
2025
|
-
opts.locale
|
|
2026
|
-
);
|
|
2144
|
+
super(() => null, opts.renderOptions.serverData ?? EMPTY_OBJ, opts.locale);
|
|
2027
2145
|
this.symbolToChunkResolver = (symbol) => {
|
|
2028
2146
|
const idx = symbol.lastIndexOf("_");
|
|
2029
2147
|
const chunk = this.resolvedManifest.mapper[idx == -1 ? symbol : symbol.substring(idx + 1)];
|
|
@@ -2050,9 +2168,19 @@ var SSRContainer = class extends import_core5._SharedContainer {
|
|
|
2050
2168
|
handleError(err, _$host$) {
|
|
2051
2169
|
throw err;
|
|
2052
2170
|
}
|
|
2171
|
+
addBackpatchEntry(ssrNodeId, attrName, serializedValue) {
|
|
2172
|
+
const elementIndex = parseInt(ssrNodeId, 10);
|
|
2173
|
+
const entry = {
|
|
2174
|
+
attrName,
|
|
2175
|
+
value: serializedValue
|
|
2176
|
+
};
|
|
2177
|
+
const entries = this.backpatchMap.get(elementIndex) || [];
|
|
2178
|
+
entries.push(entry);
|
|
2179
|
+
this.backpatchMap.set(elementIndex, entries);
|
|
2180
|
+
}
|
|
2053
2181
|
async render(jsx) {
|
|
2054
2182
|
this.openContainer();
|
|
2055
|
-
await (0,
|
|
2183
|
+
await (0, import_internal2._walkJSX)(this, jsx, {
|
|
2056
2184
|
currentStyleScoped: null,
|
|
2057
2185
|
parentComponentFrame: this.getComponentFrame()
|
|
2058
2186
|
});
|
|
@@ -2061,29 +2189,26 @@ var SSRContainer = class extends import_core5._SharedContainer {
|
|
|
2061
2189
|
setContext(host, context, value) {
|
|
2062
2190
|
const ssrNode = host;
|
|
2063
2191
|
let ctx = ssrNode.getProp(QCtxAttr);
|
|
2064
|
-
if (
|
|
2192
|
+
if (ctx == null) {
|
|
2065
2193
|
ssrNode.setProp(QCtxAttr, ctx = []);
|
|
2066
2194
|
}
|
|
2067
|
-
mapArray_set(ctx, context.id, value, 0);
|
|
2195
|
+
mapArray_set(ctx, context.id, value, 0, true);
|
|
2068
2196
|
this.addRoot(ssrNode);
|
|
2069
2197
|
}
|
|
2070
2198
|
resolveContext(host, contextId) {
|
|
2071
2199
|
let ssrNode = host;
|
|
2072
2200
|
while (ssrNode) {
|
|
2073
2201
|
const ctx = ssrNode.getProp(QCtxAttr);
|
|
2074
|
-
if (ctx) {
|
|
2075
|
-
|
|
2076
|
-
if (value) {
|
|
2077
|
-
return value;
|
|
2078
|
-
}
|
|
2202
|
+
if (ctx != null && mapArray_has(ctx, contextId.id, 0)) {
|
|
2203
|
+
return mapArray_get(ctx, contextId.id, 0);
|
|
2079
2204
|
}
|
|
2080
|
-
ssrNode = ssrNode.
|
|
2205
|
+
ssrNode = ssrNode.parentComponent;
|
|
2081
2206
|
}
|
|
2082
2207
|
return void 0;
|
|
2083
2208
|
}
|
|
2084
2209
|
getParentHost(host) {
|
|
2085
2210
|
const ssrNode = host;
|
|
2086
|
-
return ssrNode.
|
|
2211
|
+
return ssrNode.parentComponent;
|
|
2087
2212
|
}
|
|
2088
2213
|
setHostProp(host, name, value) {
|
|
2089
2214
|
const ssrNode = host;
|
|
@@ -2106,7 +2231,7 @@ var SSRContainer = class extends import_core5._SharedContainer {
|
|
|
2106
2231
|
containerAttributes[QContainerAttr] = "paused" /* PAUSED */;
|
|
2107
2232
|
containerAttributes[QRuntimeAttr] = "2";
|
|
2108
2233
|
containerAttributes[QVersionAttr] = this.$version$ ?? "dev";
|
|
2109
|
-
containerAttributes[QRenderAttr] = (qRender ? qRender + "-" : "") + (
|
|
2234
|
+
containerAttributes[QRenderAttr] = (qRender ? qRender + "-" : "") + (import_build8.isDev ? "ssr-dev" : "ssr");
|
|
2110
2235
|
containerAttributes[QBaseAttr] = this.$buildBase$ || "";
|
|
2111
2236
|
containerAttributes[QLocaleAttr] = this.$locale$;
|
|
2112
2237
|
containerAttributes[QManifestHashAttr] = this.resolvedManifest.manifest.manifestHash;
|
|
@@ -2137,16 +2262,19 @@ var SSRContainer = class extends import_core5._SharedContainer {
|
|
|
2137
2262
|
vNodeData_openElement(this.currentElementFrame.vNodeData);
|
|
2138
2263
|
this.write("<");
|
|
2139
2264
|
this.write(elementName);
|
|
2265
|
+
const lastNode = this.getOrCreateLastNode();
|
|
2140
2266
|
if (varAttrs) {
|
|
2141
2267
|
innerHTML = this.writeAttrs(elementName, varAttrs, false, currentFile);
|
|
2142
2268
|
}
|
|
2143
2269
|
this.write(" " + Q_PROPS_SEPARATOR);
|
|
2144
|
-
|
|
2270
|
+
import_build8.isDev && this.write('=""');
|
|
2145
2271
|
if (constAttrs && constAttrs.length) {
|
|
2146
2272
|
innerHTML = this.writeAttrs(elementName, constAttrs, true, currentFile) || innerHTML;
|
|
2147
2273
|
}
|
|
2148
2274
|
this.write(">");
|
|
2149
|
-
|
|
2275
|
+
if (lastNode) {
|
|
2276
|
+
lastNode.setTreeNonUpdatable();
|
|
2277
|
+
}
|
|
2150
2278
|
return innerHTML;
|
|
2151
2279
|
}
|
|
2152
2280
|
/** Renders closing tag for DOM element */
|
|
@@ -2209,6 +2337,9 @@ var SSRContainer = class extends import_core5._SharedContainer {
|
|
|
2209
2337
|
/** Writes closing data to vNodeData for fragment boundaries */
|
|
2210
2338
|
closeFragment() {
|
|
2211
2339
|
vNodeData_closeFragment(this.currentElementFrame.vNodeData);
|
|
2340
|
+
if (this.currentComponentNode) {
|
|
2341
|
+
this.currentComponentNode.setTreeNonUpdatable();
|
|
2342
|
+
}
|
|
2212
2343
|
this.lastNode = null;
|
|
2213
2344
|
}
|
|
2214
2345
|
openProjection(attrs) {
|
|
@@ -2255,7 +2386,7 @@ var SSRContainer = class extends import_core5._SharedContainer {
|
|
|
2255
2386
|
const componentFrame = this.componentStack.pop();
|
|
2256
2387
|
componentFrame.releaseUnclaimedProjections(this.unclaimedProjections);
|
|
2257
2388
|
this.closeFragment();
|
|
2258
|
-
this.currentComponentNode = ((_a = this.currentComponentNode) == null ? void 0 : _a.
|
|
2389
|
+
this.currentComponentNode = ((_a = this.currentComponentNode) == null ? void 0 : _a.parentComponent) || null;
|
|
2259
2390
|
}
|
|
2260
2391
|
/** Write a text node with correct escaping. Save the length of the text node in the vNodeData. */
|
|
2261
2392
|
textNode(text) {
|
|
@@ -2282,7 +2413,8 @@ var SSRContainer = class extends import_core5._SharedContainer {
|
|
|
2282
2413
|
this.currentElementFrame.vNodeData,
|
|
2283
2414
|
// we start at -1, so we need to add +1
|
|
2284
2415
|
this.currentElementFrame.depthFirstElementIdx + 1,
|
|
2285
|
-
this.cleanupQueue
|
|
2416
|
+
this.cleanupQueue,
|
|
2417
|
+
this.currentElementFrame.currentFile
|
|
2286
2418
|
);
|
|
2287
2419
|
}
|
|
2288
2420
|
return this.lastNode;
|
|
@@ -2297,7 +2429,7 @@ var SSRContainer = class extends import_core5._SharedContainer {
|
|
|
2297
2429
|
}
|
|
2298
2430
|
for (let i = 0; i < injections.length; i++) {
|
|
2299
2431
|
const injection = injections[i];
|
|
2300
|
-
const jsxNode = (0,
|
|
2432
|
+
const jsxNode = (0, import_internal2._jsxSplit)(injection.tag, null, injection.attributes || {}, null, 0, null);
|
|
2301
2433
|
if (injection.location === "head") {
|
|
2302
2434
|
this.additionalHeadNodes.push(jsxNode);
|
|
2303
2435
|
} else {
|
|
@@ -2317,7 +2449,7 @@ var SSRContainer = class extends import_core5._SharedContainer {
|
|
|
2317
2449
|
this.styleIds.add(styleId);
|
|
2318
2450
|
if (((_a = this.currentElementFrame) == null ? void 0 : _a.elementName) === "html") {
|
|
2319
2451
|
this.additionalHeadNodes.push(
|
|
2320
|
-
(0,
|
|
2452
|
+
(0, import_internal2._jsxSorted)(
|
|
2321
2453
|
"style",
|
|
2322
2454
|
null,
|
|
2323
2455
|
{ dangerouslySetInnerHTML: content, [QStyle]: styleId },
|
|
@@ -2346,6 +2478,8 @@ var SSRContainer = class extends import_core5._SharedContainer {
|
|
|
2346
2478
|
this.emitVNodeData();
|
|
2347
2479
|
preloaderPost(this, this.renderOptions, (_a = this.$serverData$) == null ? void 0 : _a.nonce);
|
|
2348
2480
|
this.emitSyncFnsData();
|
|
2481
|
+
this.emitPatchDataIfNeeded();
|
|
2482
|
+
this.emitExecutorIfNeeded();
|
|
2349
2483
|
this.emitQwikLoaderAtBottomIfNeeded();
|
|
2350
2484
|
})
|
|
2351
2485
|
);
|
|
@@ -2429,6 +2563,7 @@ var SSRContainer = class extends import_core5._SharedContainer {
|
|
|
2429
2563
|
for (let i = 0; i < fragmentAttrs.length; ) {
|
|
2430
2564
|
const key = fragmentAttrs[i++];
|
|
2431
2565
|
let value = fragmentAttrs[i++];
|
|
2566
|
+
let encodeValue = false;
|
|
2432
2567
|
if (typeof value !== "string") {
|
|
2433
2568
|
const rootId = addRoot(value);
|
|
2434
2569
|
if (rootId === void 0) {
|
|
@@ -2450,6 +2585,7 @@ var SSRContainer = class extends import_core5._SharedContainer {
|
|
|
2450
2585
|
write(VNodeDataChar.PROPS_CHAR);
|
|
2451
2586
|
break;
|
|
2452
2587
|
case ELEMENT_KEY:
|
|
2588
|
+
encodeValue = true;
|
|
2453
2589
|
write(VNodeDataChar.KEY_CHAR);
|
|
2454
2590
|
break;
|
|
2455
2591
|
case ELEMENT_SEQ:
|
|
@@ -2476,7 +2612,15 @@ var SSRContainer = class extends import_core5._SharedContainer {
|
|
|
2476
2612
|
write(key);
|
|
2477
2613
|
write(VNodeDataChar.SEPARATOR_CHAR);
|
|
2478
2614
|
}
|
|
2479
|
-
|
|
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);
|
|
2623
|
+
}
|
|
2480
2624
|
}
|
|
2481
2625
|
}
|
|
2482
2626
|
this.closeElement();
|
|
@@ -2506,6 +2650,40 @@ var SSRContainer = class extends import_core5._SharedContainer {
|
|
|
2506
2650
|
this.closeElement();
|
|
2507
2651
|
}
|
|
2508
2652
|
}
|
|
2653
|
+
emitPatchDataIfNeeded() {
|
|
2654
|
+
var _a;
|
|
2655
|
+
const patches = [];
|
|
2656
|
+
for (const [elementIndex, backpatchEntries] of this.backpatchMap) {
|
|
2657
|
+
for (const backpatchEntry of backpatchEntries) {
|
|
2658
|
+
patches.push(elementIndex, backpatchEntry.attrName, backpatchEntry.value);
|
|
2659
|
+
}
|
|
2660
|
+
}
|
|
2661
|
+
this.backpatchMap.clear();
|
|
2662
|
+
if (patches.length > 0) {
|
|
2663
|
+
this.isBackpatchExecutorEmitted = true;
|
|
2664
|
+
const scriptAttrs = ["type", ELEMENT_BACKPATCH_DATA];
|
|
2665
|
+
if ((_a = this.renderOptions.serverData) == null ? void 0 : _a.nonce) {
|
|
2666
|
+
scriptAttrs.push("nonce", this.renderOptions.serverData.nonce);
|
|
2667
|
+
}
|
|
2668
|
+
this.openElement("script", scriptAttrs);
|
|
2669
|
+
this.write(JSON.stringify(patches));
|
|
2670
|
+
this.closeElement();
|
|
2671
|
+
}
|
|
2672
|
+
}
|
|
2673
|
+
emitExecutorIfNeeded() {
|
|
2674
|
+
var _a;
|
|
2675
|
+
if (!this.isBackpatchExecutorEmitted) {
|
|
2676
|
+
return;
|
|
2677
|
+
}
|
|
2678
|
+
const scriptAttrs = ["type", "text/javascript"];
|
|
2679
|
+
if ((_a = this.renderOptions.serverData) == null ? void 0 : _a.nonce) {
|
|
2680
|
+
scriptAttrs.push("nonce", this.renderOptions.serverData.nonce);
|
|
2681
|
+
}
|
|
2682
|
+
this.openElement("script", scriptAttrs);
|
|
2683
|
+
const backpatchScript = getQwikBackpatchExecutorScript({ debug: import_build8.isDev });
|
|
2684
|
+
this.write(backpatchScript);
|
|
2685
|
+
this.closeElement();
|
|
2686
|
+
}
|
|
2509
2687
|
emitPreloaderPre() {
|
|
2510
2688
|
var _a;
|
|
2511
2689
|
preloaderPre(this, this.renderOptions.preloader, (_a = this.renderOptions.serverData) == null ? void 0 : _a.nonce);
|
|
@@ -2518,15 +2696,25 @@ var SSRContainer = class extends import_core5._SharedContainer {
|
|
|
2518
2696
|
return ((_a = this.renderOptions.qwikLoader) == null ? void 0 : _a.include) ?? "auto";
|
|
2519
2697
|
}
|
|
2520
2698
|
emitQwikLoaderAtTopIfNeeded() {
|
|
2699
|
+
var _a;
|
|
2521
2700
|
const includeMode = this.getQwikLoaderIncludeMode();
|
|
2522
2701
|
const includeLoader = includeMode !== "never";
|
|
2523
2702
|
if (includeLoader) {
|
|
2524
2703
|
let qwikLoaderBundle = this.resolvedManifest.manifest.qwikLoader;
|
|
2525
2704
|
if (qwikLoaderBundle) {
|
|
2526
2705
|
qwikLoaderBundle = this.$buildBase$ + qwikLoaderBundle;
|
|
2527
|
-
|
|
2706
|
+
const linkAttrs = ["rel", "modulepreload", "href", qwikLoaderBundle];
|
|
2707
|
+
const nonce = (_a = this.renderOptions.serverData) == null ? void 0 : _a.nonce;
|
|
2708
|
+
if (nonce) {
|
|
2709
|
+
linkAttrs.push("nonce", nonce);
|
|
2710
|
+
}
|
|
2711
|
+
this.openElement("link", linkAttrs);
|
|
2528
2712
|
this.closeElement();
|
|
2529
|
-
|
|
2713
|
+
const scriptAttrs = ["type", "module", "async", true, "src", qwikLoaderBundle];
|
|
2714
|
+
if (nonce) {
|
|
2715
|
+
scriptAttrs.push("nonce", nonce);
|
|
2716
|
+
}
|
|
2717
|
+
this.openElement("script", scriptAttrs);
|
|
2530
2718
|
this.closeElement();
|
|
2531
2719
|
}
|
|
2532
2720
|
}
|
|
@@ -2542,7 +2730,7 @@ var SSRContainer = class extends import_core5._SharedContainer {
|
|
|
2542
2730
|
const qwikLoaderScript = getQwikLoaderScript({
|
|
2543
2731
|
debug: this.renderOptions.debug
|
|
2544
2732
|
});
|
|
2545
|
-
const scriptAttrs = ["id", "qwikloader", "async", true];
|
|
2733
|
+
const scriptAttrs = ["id", "qwikloader", "async", true, "type", "module"];
|
|
2546
2734
|
const nonce = (_a = this.renderOptions.serverData) == null ? void 0 : _a.nonce;
|
|
2547
2735
|
if (nonce) {
|
|
2548
2736
|
scriptAttrs.push("nonce", nonce);
|
|
@@ -2570,7 +2758,7 @@ var SSRContainer = class extends import_core5._SharedContainer {
|
|
|
2570
2758
|
if (unclaimedProjections.length) {
|
|
2571
2759
|
const previousCurrentComponentNode = this.currentComponentNode;
|
|
2572
2760
|
try {
|
|
2573
|
-
this.openElement(QTemplate, ["
|
|
2761
|
+
this.openElement(QTemplate, ["hidden", true, "aria-hidden", "true"], null);
|
|
2574
2762
|
let idx = 0;
|
|
2575
2763
|
let ssrComponentNode = null;
|
|
2576
2764
|
let ssrComponentFrame = null;
|
|
@@ -2594,14 +2782,14 @@ var SSRContainer = class extends import_core5._SharedContainer {
|
|
|
2594
2782
|
}
|
|
2595
2783
|
this.unclaimedProjectionComponentFrameQueue.shift();
|
|
2596
2784
|
this.openFragment(
|
|
2597
|
-
|
|
2785
|
+
import_build8.isDev ? [DEBUG_TYPE, "P" /* Projection */, QSlotParent, ssrComponentNode.id] : [QSlotParent, ssrComponentNode.id]
|
|
2598
2786
|
);
|
|
2599
2787
|
const lastNode = this.getOrCreateLastNode();
|
|
2600
2788
|
if (lastNode.vnodeData) {
|
|
2601
2789
|
lastNode.vnodeData[0] |= 16 /* SERIALIZE */;
|
|
2602
2790
|
}
|
|
2603
2791
|
ssrComponentNode == null ? void 0 : ssrComponentNode.setProp(value, lastNode.id);
|
|
2604
|
-
await (0,
|
|
2792
|
+
await (0, import_internal2._walkJSX)(this, children, {
|
|
2605
2793
|
currentStyleScoped: scopedStyleId,
|
|
2606
2794
|
parentComponentFrame: null
|
|
2607
2795
|
});
|
|
@@ -2643,7 +2831,7 @@ var SSRContainer = class extends import_core5._SharedContainer {
|
|
|
2643
2831
|
}
|
|
2644
2832
|
createAndPushFrame(elementName, depthFirstElementIdx, currentFile) {
|
|
2645
2833
|
let tagNesting = 10 /* ANYTHING */;
|
|
2646
|
-
if (
|
|
2834
|
+
if (import_build8.isDev) {
|
|
2647
2835
|
if (!this.currentElementFrame) {
|
|
2648
2836
|
tagNesting = initialTag(elementName);
|
|
2649
2837
|
} else {
|
|
@@ -2688,7 +2876,8 @@ var SSRContainer = class extends import_core5._SharedContainer {
|
|
|
2688
2876
|
parent: this.currentElementFrame,
|
|
2689
2877
|
elementName,
|
|
2690
2878
|
depthFirstElementIdx,
|
|
2691
|
-
vNodeData: [0 /* NONE */]
|
|
2879
|
+
vNodeData: [0 /* NONE */],
|
|
2880
|
+
currentFile: import_build8.isDev ? currentFile || null : null
|
|
2692
2881
|
};
|
|
2693
2882
|
this.currentElementFrame = frame;
|
|
2694
2883
|
this.vNodeDatas.push(frame.vNodeData);
|
|
@@ -2719,7 +2908,7 @@ var SSRContainer = class extends import_core5._SharedContainer {
|
|
|
2719
2908
|
let value = attrs[i];
|
|
2720
2909
|
let styleScopedId = null;
|
|
2721
2910
|
if (isSSRUnsafeAttr(key)) {
|
|
2722
|
-
if (
|
|
2911
|
+
if (import_build8.isDev) {
|
|
2723
2912
|
throw qError(32 /* unsafeAttr */);
|
|
2724
2913
|
}
|
|
2725
2914
|
continue;
|
|
@@ -2731,7 +2920,7 @@ var SSRContainer = class extends import_core5._SharedContainer {
|
|
|
2731
2920
|
}
|
|
2732
2921
|
if (key === "ref") {
|
|
2733
2922
|
const lastNode = this.getOrCreateLastNode();
|
|
2734
|
-
if ((0,
|
|
2923
|
+
if ((0, import_internal2.isSignal)(value)) {
|
|
2735
2924
|
value.$untrackedValue$ = new DomRef(lastNode);
|
|
2736
2925
|
continue;
|
|
2737
2926
|
} else if (typeof value === "function") {
|
|
@@ -2743,25 +2932,27 @@ var SSRContainer = class extends import_core5._SharedContainer {
|
|
|
2743
2932
|
throw qError(15 /* invalidRefValue */, [currentFile]);
|
|
2744
2933
|
}
|
|
2745
2934
|
}
|
|
2746
|
-
if ((0,
|
|
2935
|
+
if ((0, import_internal2.isSignal)(value)) {
|
|
2747
2936
|
const lastNode = this.getOrCreateLastNode();
|
|
2748
|
-
const signalData = new
|
|
2937
|
+
const signalData = new import_internal2._SubscriptionData({
|
|
2749
2938
|
$scopedStyleIdPrefix$: styleScopedId,
|
|
2750
2939
|
$isConst$: isConst
|
|
2751
2940
|
});
|
|
2752
2941
|
value = this.trackSignalValue(value, lastNode, key, signalData);
|
|
2753
2942
|
}
|
|
2754
2943
|
if (key === dangerouslySetInnerHTML) {
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2944
|
+
if (value) {
|
|
2945
|
+
innerHTML = String(value);
|
|
2946
|
+
key = QContainerAttr;
|
|
2947
|
+
value = "html" /* HTML */;
|
|
2948
|
+
}
|
|
2758
2949
|
if (tag === "style") {
|
|
2759
2950
|
continue;
|
|
2760
2951
|
}
|
|
2761
2952
|
}
|
|
2762
2953
|
if (tag === "textarea" && key === "value") {
|
|
2763
2954
|
if (value && typeof value !== "string") {
|
|
2764
|
-
if (
|
|
2955
|
+
if (import_build8.isDev) {
|
|
2765
2956
|
throw qError(23 /* wrongTextareaValue */, [currentFile, value]);
|
|
2766
2957
|
}
|
|
2767
2958
|
continue;
|
|
@@ -2857,6 +3048,7 @@ var renderToStream = async (jsx, opts) => {
|
|
|
2857
3048
|
});
|
|
2858
3049
|
await setServerPlatform(opts, resolvedManifest);
|
|
2859
3050
|
await ssrContainer.render(jsx);
|
|
3051
|
+
await ssrContainer.$scheduler$(255 /* WAIT_FOR_QUEUE */).$returnValue$;
|
|
2860
3052
|
flush();
|
|
2861
3053
|
const snapshotResult = getSnapshotResult(ssrContainer);
|
|
2862
3054
|
const isDynamic = snapshotResult.resources.some((r) => r._cache !== Infinity);
|
|
@@ -3001,10 +3193,11 @@ var Q_FUNCS_PREFIX = 'document["qFuncs_HASH"]=';
|
|
|
3001
3193
|
// packages/qwik/src/server/index.ts
|
|
3002
3194
|
async function setServerPlatform2(manifest) {
|
|
3003
3195
|
const platform = createPlatform({ manifest }, resolveManifest(manifest));
|
|
3004
|
-
(0,
|
|
3196
|
+
(0, import_core3.setPlatform)(platform);
|
|
3005
3197
|
}
|
|
3006
3198
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3007
3199
|
0 && (module.exports = {
|
|
3200
|
+
getQwikBackpatchExecutorScript,
|
|
3008
3201
|
getQwikLoaderScript,
|
|
3009
3202
|
getQwikPrefetchWorkerScript,
|
|
3010
3203
|
renderToStream,
|