@qwik.dev/core 2.0.0-alpha.9 → 2.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bindings/qwik.darwin-arm64.node +0 -0
- package/bindings/qwik.darwin-x64.node +0 -0
- package/bindings/qwik.linux-x64-gnu.node +0 -0
- package/bindings/qwik.wasm.cjs +27 -27
- package/bindings/qwik.wasm.mjs +27 -27
- package/bindings/qwik.win32-x64-msvc.node +0 -0
- package/bindings/qwik_wasm_bg.wasm +0 -0
- package/dist/backpatch/index.cjs +6 -0
- package/dist/backpatch/index.d.ts +2 -0
- package/dist/backpatch/index.mjs +5 -0
- package/dist/{prefetch → backpatch}/package.json +2 -2
- package/dist/backpatch-executor.debug.js +34 -0
- package/dist/backpatch-executor.js +1 -0
- package/dist/build/index.cjs +3 -3
- package/dist/build/index.d.ts +22 -22
- package/dist/build/package.json +1 -1
- package/dist/cli.cjs +3035 -767
- package/dist/core-internal.d.ts +4622 -4153
- package/dist/core.cjs +7327 -6169
- package/dist/core.cjs.map +1 -1
- package/dist/core.min.mjs +1 -1
- package/dist/core.mjs +7294 -6163
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.cjs +3209 -2612
- package/dist/core.prod.mjs +3932 -3294
- package/dist/insights/index.qwik.cjs +1 -4142
- package/dist/insights/index.qwik.mjs +63 -4133
- package/dist/insights/vite/index.cjs +1 -82
- package/dist/insights/vite/index.mjs +65 -37
- package/dist/insights/vite.d.ts +22 -0
- package/dist/{insights/insights.d.ts → insights.d.ts} +33 -22
- package/dist/loader/index.cjs +2 -2
- package/dist/loader/index.mjs +2 -2
- package/dist/loader/package.json +1 -1
- package/dist/optimizer.cjs +201 -3817
- package/dist/optimizer.d.ts +754 -707
- package/dist/optimizer.mjs +2605 -3628
- package/dist/preloader.cjs +266 -0
- package/dist/preloader.mjs +195 -0
- package/dist/qwikloader.debug.js +228 -222
- package/dist/qwikloader.js +1 -3
- package/dist/server.cjs +915 -621
- package/dist/server.d.ts +519 -402
- package/dist/server.mjs +900 -615
- package/dist/starters/adapters/aws-lambda/adapters/aws-lambda/vite.config.mts +1 -1
- package/dist/starters/adapters/aws-lambda/package.json +1 -1
- package/dist/starters/adapters/aws-lambda/serverless.yml +15 -0
- package/dist/starters/adapters/aws-lambda/src/entry_aws-lambda.tsx +2 -8
- package/dist/starters/adapters/azure-swa/adapters/azure-swa/vite.config.mts +1 -1
- package/dist/starters/adapters/azure-swa/package.json +1 -1
- package/dist/starters/adapters/azure-swa/public/staticwebapp.config.json +7 -0
- package/dist/starters/adapters/azure-swa/src/entry.azure-swa.tsx +2 -4
- package/dist/starters/adapters/bun/adapters/bun/vite.config.mts +2 -2
- package/dist/starters/adapters/bun/package.json +1 -1
- package/dist/starters/adapters/bun/src/entry.bun.ts +3 -4
- package/dist/starters/adapters/cloud-run/adapters/cloud-run/vite.config.mts +1 -1
- package/dist/starters/adapters/cloud-run/package.json +1 -1
- package/dist/starters/adapters/cloud-run/src/entry.cloud-run.tsx +2 -6
- package/dist/starters/adapters/cloudflare-pages/adapters/cloudflare-pages/vite.config.mts +1 -1
- package/dist/starters/adapters/cloudflare-pages/package.json +1 -1
- package/dist/starters/adapters/cloudflare-pages/public/_headers +2 -0
- package/dist/starters/adapters/cloudflare-pages/src/entry.cloudflare-pages.tsx +2 -4
- package/dist/starters/adapters/deno/adapters/deno/vite.config.mts +1 -1
- package/dist/starters/adapters/deno/package.json +1 -1
- package/dist/starters/adapters/deno/src/entry.deno.ts +3 -4
- package/dist/starters/adapters/express/adapters/express/vite.config.mts +1 -1
- package/dist/starters/adapters/express/package.json +1 -1
- package/dist/starters/adapters/express/src/entry.express.tsx +6 -5
- package/dist/starters/adapters/fastify/adapters/fastify/vite.config.mts +1 -1
- package/dist/starters/adapters/fastify/package.json +1 -1
- package/dist/starters/adapters/fastify/src/entry.fastify.tsx +3 -2
- package/dist/starters/adapters/fastify/src/plugins/fastify-qwik.ts +10 -3
- package/dist/starters/adapters/firebase/adapters/firebase/vite.config.mts +1 -1
- package/dist/starters/adapters/firebase/firebase.json +12 -1
- package/dist/starters/adapters/firebase/functions/index.js +2 -3
- package/dist/starters/adapters/firebase/package.json +1 -1
- package/dist/starters/adapters/firebase/src/entry-firebase.tsx +2 -4
- package/dist/starters/adapters/netlify-edge/adapters/netlify-edge/vite.config.mts +1 -1
- package/dist/starters/adapters/netlify-edge/package.json +1 -1
- package/dist/starters/adapters/netlify-edge/public/_headers +2 -0
- package/dist/starters/adapters/netlify-edge/src/entry.netlify-edge.tsx +2 -4
- package/dist/starters/adapters/node-server/adapters/node-server/vite.config.mts +1 -1
- package/dist/starters/adapters/node-server/package.json +1 -1
- package/dist/starters/adapters/node-server/src/entry.node-server.tsx +3 -4
- package/dist/starters/adapters/ssg/README.md +9 -0
- package/dist/starters/adapters/{static/adapters/static → ssg/adapters/ssg}/vite.config.mts +2 -2
- package/dist/starters/adapters/ssg/package.json +19 -0
- package/dist/starters/adapters/vercel-edge/adapters/vercel-edge/vite.config.mts +1 -1
- package/dist/starters/adapters/vercel-edge/package.json +1 -1
- package/dist/starters/adapters/vercel-edge/src/entry.vercel-edge.tsx +2 -4
- package/dist/starters/adapters/vercel-edge/vercel.json +1 -1
- package/dist/starters/features/auth/package.json +1 -1
- package/dist/starters/features/bootstrap/src/routes/bootstrap/layout.tsx +0 -11
- package/dist/starters/features/csr/index.html +23 -0
- package/dist/starters/features/csr/package.json +29 -0
- package/dist/starters/features/csr/src/root.tsx +15 -0
- package/dist/starters/features/csr/vite.config.mts +13 -0
- package/dist/starters/features/localize/package.json +3 -3
- package/dist/starters/features/localize/src/entry.ssr.tsx +17 -23
- package/dist/starters/features/localize/src/routes/[locale]/i18n-utils.ts +1 -1
- package/dist/starters/features/pandacss/package.json +1 -1
- package/dist/starters/features/partytown/package.json +4 -4
- package/dist/starters/features/partytown/src/components/partytown/partytown.tsx +2 -2
- package/dist/starters/features/playwright/playwright-report/index.html +953 -911
- package/dist/starters/features/postcss/postcss.config.js +2 -2
- package/dist/starters/features/service-worker/package.json +13 -0
- package/dist/starters/features/service-worker/src/routes/service-worker.ts +14 -0
- package/dist/starters/features/styled-vanilla-extract/package.json +2 -1
- package/dist/starters/features/tailwind/package.json +4 -3
- package/dist/starters/features/tailwind/prettier.config.js +10 -0
- package/dist/starters/features/tailwind/src/global.css +1 -1
- package/dist/starters/features/tailwind-v3/package.json +1 -1
- package/dist/starters/features/tailwind-v3/prettier.config.js +10 -0
- package/dist/starters/features/tailwind-v3/tailwind.config.js +2 -2
- package/dist/testing/index.cjs +14313 -11732
- package/dist/testing/index.d.ts +1112 -141
- package/dist/testing/index.mjs +14225 -11661
- package/dist/testing/package.json +1 -1
- package/package.json +28 -14
- package/public.d.ts +5 -0
- package/server.d.ts +1 -0
- package/dist/insights/index.d.ts +0 -1
- package/dist/insights/vite/index.d.ts +0 -1
- package/dist/insights/vite/insights-plugin.d.ts +0 -10
- package/dist/prefetch/index.cjs +0 -4
- package/dist/prefetch/index.d.ts +0 -2
- package/dist/prefetch/index.mjs +0 -3
- package/dist/qwik-prefetch.debug.js +0 -244
- package/dist/qwik-prefetch.js +0 -1
- package/dist/starters/adapters/static/README.md +0 -5
- package/dist/starters/adapters/static/package.json +0 -19
- package/dist/starters/features/tailwind/.prettierrc.js +0 -3
package/dist/optimizer.cjs
CHANGED
|
@@ -1,3821 +1,205 @@
|
|
|
1
|
-
/**
|
|
1
|
+
var Gr=Object.create;var $t=Object.defineProperty;var Kr=Object.getOwnPropertyDescriptor;var Qr=Object.getOwnPropertyNames;var Jr=Object.getPrototypeOf,Yr=Object.prototype.hasOwnProperty;var Xr=(J,Z,se,ue)=>{if(Z&&typeof Z=="object"||typeof Z=="function")for(let ae of Qr(Z))!Yr.call(J,ae)&&ae!==se&&$t(J,ae,{get:()=>Z[ae],enumerable:!(ue=Kr(Z,ae))||ue.enumerable});return J};var tt=(J,Z,se)=>(se=J!=null?Gr(Jr(J)):{},Xr(Z||!J||!J.__esModule?$t(se,"default",{value:J,enumerable:!0}):se,J));globalThis.qwikOptimizer=(function(J){/**
|
|
2
2
|
* @license
|
|
3
|
-
* @qwik.dev/core/optimizer 2.0.0-
|
|
3
|
+
* @qwik.dev/core/optimizer 2.0.0-beta.10-dev+4669425
|
|
4
4
|
* Copyright QwikDev. All Rights Reserved.
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://github.com/QwikDev/qwik/blob/main/LICENSE
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
"use strict";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
for (var name in all) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
"
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
});
|
|
207
|
-
var require_dds = __commonJS({
|
|
208
|
-
"node_modules/.pnpm/image-size@1.1.1/node_modules/image-size/dist/types/dds.js"(exports2) {
|
|
209
|
-
Object.defineProperty(exports2, "__esModule", {
|
|
210
|
-
value: true
|
|
211
|
-
});
|
|
212
|
-
exports2.DDS = void 0;
|
|
213
|
-
var utils_1 = require_utils();
|
|
214
|
-
exports2.DDS = {
|
|
215
|
-
validate: input => 542327876 === (0, utils_1.readUInt32LE)(input, 0),
|
|
216
|
-
calculate: input => ({
|
|
217
|
-
height: (0, utils_1.readUInt32LE)(input, 12),
|
|
218
|
-
width: (0, utils_1.readUInt32LE)(input, 16)
|
|
219
|
-
})
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
|
-
});
|
|
223
|
-
var require_gif = __commonJS({
|
|
224
|
-
"node_modules/.pnpm/image-size@1.1.1/node_modules/image-size/dist/types/gif.js"(exports2) {
|
|
225
|
-
Object.defineProperty(exports2, "__esModule", {
|
|
226
|
-
value: true
|
|
227
|
-
});
|
|
228
|
-
exports2.GIF = void 0;
|
|
229
|
-
var utils_1 = require_utils();
|
|
230
|
-
var gifRegexp = /^GIF8[79]a/;
|
|
231
|
-
exports2.GIF = {
|
|
232
|
-
validate: input => gifRegexp.test((0, utils_1.toUTF8String)(input, 0, 6)),
|
|
233
|
-
calculate: input => ({
|
|
234
|
-
height: (0, utils_1.readUInt16LE)(input, 8),
|
|
235
|
-
width: (0, utils_1.readUInt16LE)(input, 6)
|
|
236
|
-
})
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
});
|
|
240
|
-
var require_icns = __commonJS({
|
|
241
|
-
"node_modules/.pnpm/image-size@1.1.1/node_modules/image-size/dist/types/icns.js"(exports2) {
|
|
242
|
-
Object.defineProperty(exports2, "__esModule", {
|
|
243
|
-
value: true
|
|
244
|
-
});
|
|
245
|
-
exports2.ICNS = void 0;
|
|
246
|
-
var utils_1 = require_utils();
|
|
247
|
-
var SIZE_HEADER = 8;
|
|
248
|
-
var FILE_LENGTH_OFFSET = 4;
|
|
249
|
-
var ENTRY_LENGTH_OFFSET = 4;
|
|
250
|
-
var ICON_TYPE_SIZE = {
|
|
251
|
-
ICON: 32,
|
|
252
|
-
"ICN#": 32,
|
|
253
|
-
"icm#": 16,
|
|
254
|
-
icm4: 16,
|
|
255
|
-
icm8: 16,
|
|
256
|
-
"ics#": 16,
|
|
257
|
-
ics4: 16,
|
|
258
|
-
ics8: 16,
|
|
259
|
-
is32: 16,
|
|
260
|
-
s8mk: 16,
|
|
261
|
-
icp4: 16,
|
|
262
|
-
icl4: 32,
|
|
263
|
-
icl8: 32,
|
|
264
|
-
il32: 32,
|
|
265
|
-
l8mk: 32,
|
|
266
|
-
icp5: 32,
|
|
267
|
-
ic11: 32,
|
|
268
|
-
ich4: 48,
|
|
269
|
-
ich8: 48,
|
|
270
|
-
ih32: 48,
|
|
271
|
-
h8mk: 48,
|
|
272
|
-
icp6: 64,
|
|
273
|
-
ic12: 32,
|
|
274
|
-
it32: 128,
|
|
275
|
-
t8mk: 128,
|
|
276
|
-
ic07: 128,
|
|
277
|
-
ic08: 256,
|
|
278
|
-
ic13: 256,
|
|
279
|
-
ic09: 512,
|
|
280
|
-
ic14: 512,
|
|
281
|
-
ic10: 1024
|
|
282
|
-
};
|
|
283
|
-
function readImageHeader(input, imageOffset) {
|
|
284
|
-
const imageLengthOffset = imageOffset + ENTRY_LENGTH_OFFSET;
|
|
285
|
-
return [ (0, utils_1.toUTF8String)(input, imageOffset, imageLengthOffset), (0, utils_1.readUInt32BE)(input, imageLengthOffset) ];
|
|
286
|
-
}
|
|
287
|
-
function getImageSize(type) {
|
|
288
|
-
const size = ICON_TYPE_SIZE[type];
|
|
289
|
-
return {
|
|
290
|
-
width: size,
|
|
291
|
-
height: size,
|
|
292
|
-
type: type
|
|
293
|
-
};
|
|
294
|
-
}
|
|
295
|
-
exports2.ICNS = {
|
|
296
|
-
validate: input => "icns" === (0, utils_1.toUTF8String)(input, 0, 4),
|
|
297
|
-
calculate(input) {
|
|
298
|
-
const inputLength = input.length;
|
|
299
|
-
const fileLength = (0, utils_1.readUInt32BE)(input, FILE_LENGTH_OFFSET);
|
|
300
|
-
let imageOffset = SIZE_HEADER;
|
|
301
|
-
let imageHeader = readImageHeader(input, imageOffset);
|
|
302
|
-
let imageSize = getImageSize(imageHeader[0]);
|
|
303
|
-
imageOffset += imageHeader[1];
|
|
304
|
-
if (imageOffset === fileLength) {
|
|
305
|
-
return imageSize;
|
|
306
|
-
}
|
|
307
|
-
const result = {
|
|
308
|
-
height: imageSize.height,
|
|
309
|
-
images: [ imageSize ],
|
|
310
|
-
width: imageSize.width
|
|
311
|
-
};
|
|
312
|
-
while (imageOffset < fileLength && imageOffset < inputLength) {
|
|
313
|
-
imageHeader = readImageHeader(input, imageOffset);
|
|
314
|
-
imageSize = getImageSize(imageHeader[0]);
|
|
315
|
-
imageOffset += imageHeader[1];
|
|
316
|
-
result.images.push(imageSize);
|
|
317
|
-
}
|
|
318
|
-
return result;
|
|
319
|
-
}
|
|
320
|
-
};
|
|
321
|
-
}
|
|
322
|
-
});
|
|
323
|
-
var require_j2c = __commonJS({
|
|
324
|
-
"node_modules/.pnpm/image-size@1.1.1/node_modules/image-size/dist/types/j2c.js"(exports2) {
|
|
325
|
-
Object.defineProperty(exports2, "__esModule", {
|
|
326
|
-
value: true
|
|
327
|
-
});
|
|
328
|
-
exports2.J2C = void 0;
|
|
329
|
-
var utils_1 = require_utils();
|
|
330
|
-
exports2.J2C = {
|
|
331
|
-
validate: input => "ff4fff51" === (0, utils_1.toHexString)(input, 0, 4),
|
|
332
|
-
calculate: input => ({
|
|
333
|
-
height: (0, utils_1.readUInt32BE)(input, 12),
|
|
334
|
-
width: (0, utils_1.readUInt32BE)(input, 8)
|
|
335
|
-
})
|
|
336
|
-
};
|
|
337
|
-
}
|
|
338
|
-
});
|
|
339
|
-
var require_jp2 = __commonJS({
|
|
340
|
-
"node_modules/.pnpm/image-size@1.1.1/node_modules/image-size/dist/types/jp2.js"(exports2) {
|
|
341
|
-
Object.defineProperty(exports2, "__esModule", {
|
|
342
|
-
value: true
|
|
343
|
-
});
|
|
344
|
-
exports2.JP2 = void 0;
|
|
345
|
-
var utils_1 = require_utils();
|
|
346
|
-
exports2.JP2 = {
|
|
347
|
-
validate(input) {
|
|
348
|
-
if (1783636e3 !== (0, utils_1.readUInt32BE)(input, 4) || (0, utils_1.readUInt32BE)(input, 0) < 1) {
|
|
349
|
-
return false;
|
|
350
|
-
}
|
|
351
|
-
const ftypBox = (0, utils_1.findBox)(input, "ftyp", 0);
|
|
352
|
-
if (!ftypBox) {
|
|
353
|
-
return false;
|
|
354
|
-
}
|
|
355
|
-
return 1718909296 === (0, utils_1.readUInt32BE)(input, ftypBox.offset + 4);
|
|
356
|
-
},
|
|
357
|
-
calculate(input) {
|
|
358
|
-
const jp2hBox = (0, utils_1.findBox)(input, "jp2h", 0);
|
|
359
|
-
const ihdrBox = jp2hBox && (0, utils_1.findBox)(input, "ihdr", jp2hBox.offset + 8);
|
|
360
|
-
if (ihdrBox) {
|
|
361
|
-
return {
|
|
362
|
-
height: (0, utils_1.readUInt32BE)(input, ihdrBox.offset + 8),
|
|
363
|
-
width: (0, utils_1.readUInt32BE)(input, ihdrBox.offset + 12)
|
|
364
|
-
};
|
|
365
|
-
}
|
|
366
|
-
throw new TypeError("Unsupported JPEG 2000 format");
|
|
367
|
-
}
|
|
368
|
-
};
|
|
369
|
-
}
|
|
370
|
-
});
|
|
371
|
-
var require_jpg = __commonJS({
|
|
372
|
-
"node_modules/.pnpm/image-size@1.1.1/node_modules/image-size/dist/types/jpg.js"(exports2) {
|
|
373
|
-
Object.defineProperty(exports2, "__esModule", {
|
|
374
|
-
value: true
|
|
375
|
-
});
|
|
376
|
-
exports2.JPG = void 0;
|
|
377
|
-
var utils_1 = require_utils();
|
|
378
|
-
var EXIF_MARKER = "45786966";
|
|
379
|
-
var APP1_DATA_SIZE_BYTES = 2;
|
|
380
|
-
var EXIF_HEADER_BYTES = 6;
|
|
381
|
-
var TIFF_BYTE_ALIGN_BYTES = 2;
|
|
382
|
-
var BIG_ENDIAN_BYTE_ALIGN = "4d4d";
|
|
383
|
-
var LITTLE_ENDIAN_BYTE_ALIGN = "4949";
|
|
384
|
-
var IDF_ENTRY_BYTES = 12;
|
|
385
|
-
var NUM_DIRECTORY_ENTRIES_BYTES = 2;
|
|
386
|
-
function isEXIF(input) {
|
|
387
|
-
return (0, utils_1.toHexString)(input, 2, 6) === EXIF_MARKER;
|
|
388
|
-
}
|
|
389
|
-
function extractSize(input, index) {
|
|
390
|
-
return {
|
|
391
|
-
height: (0, utils_1.readUInt16BE)(input, index),
|
|
392
|
-
width: (0, utils_1.readUInt16BE)(input, index + 2)
|
|
393
|
-
};
|
|
394
|
-
}
|
|
395
|
-
function extractOrientation(exifBlock, isBigEndian) {
|
|
396
|
-
const idfOffset = 8;
|
|
397
|
-
const offset = EXIF_HEADER_BYTES + idfOffset;
|
|
398
|
-
const idfDirectoryEntries = (0, utils_1.readUInt)(exifBlock, 16, offset, isBigEndian);
|
|
399
|
-
for (let directoryEntryNumber = 0; directoryEntryNumber < idfDirectoryEntries; directoryEntryNumber++) {
|
|
400
|
-
const start = offset + NUM_DIRECTORY_ENTRIES_BYTES + directoryEntryNumber * IDF_ENTRY_BYTES;
|
|
401
|
-
const end = start + IDF_ENTRY_BYTES;
|
|
402
|
-
if (start > exifBlock.length) {
|
|
403
|
-
return;
|
|
404
|
-
}
|
|
405
|
-
const block = exifBlock.slice(start, end);
|
|
406
|
-
const tagNumber = (0, utils_1.readUInt)(block, 16, 0, isBigEndian);
|
|
407
|
-
if (274 === tagNumber) {
|
|
408
|
-
const dataFormat = (0, utils_1.readUInt)(block, 16, 2, isBigEndian);
|
|
409
|
-
if (3 !== dataFormat) {
|
|
410
|
-
return;
|
|
411
|
-
}
|
|
412
|
-
const numberOfComponents = (0, utils_1.readUInt)(block, 32, 4, isBigEndian);
|
|
413
|
-
if (1 !== numberOfComponents) {
|
|
414
|
-
return;
|
|
415
|
-
}
|
|
416
|
-
return (0, utils_1.readUInt)(block, 16, 8, isBigEndian);
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
function validateExifBlock(input, index) {
|
|
421
|
-
const exifBlock = input.slice(APP1_DATA_SIZE_BYTES, index);
|
|
422
|
-
const byteAlign = (0, utils_1.toHexString)(exifBlock, EXIF_HEADER_BYTES, EXIF_HEADER_BYTES + TIFF_BYTE_ALIGN_BYTES);
|
|
423
|
-
const isBigEndian = byteAlign === BIG_ENDIAN_BYTE_ALIGN;
|
|
424
|
-
const isLittleEndian = byteAlign === LITTLE_ENDIAN_BYTE_ALIGN;
|
|
425
|
-
if (isBigEndian || isLittleEndian) {
|
|
426
|
-
return extractOrientation(exifBlock, isBigEndian);
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
function validateInput(input, index) {
|
|
430
|
-
if (index > input.length) {
|
|
431
|
-
throw new TypeError("Corrupt JPG, exceeded buffer limits");
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
exports2.JPG = {
|
|
435
|
-
validate: input => "ffd8" === (0, utils_1.toHexString)(input, 0, 2),
|
|
436
|
-
calculate(input) {
|
|
437
|
-
input = input.slice(4);
|
|
438
|
-
let orientation;
|
|
439
|
-
let next;
|
|
440
|
-
while (input.length) {
|
|
441
|
-
const i = (0, utils_1.readUInt16BE)(input, 0);
|
|
442
|
-
if (255 !== input[i]) {
|
|
443
|
-
input = input.slice(1);
|
|
444
|
-
continue;
|
|
445
|
-
}
|
|
446
|
-
isEXIF(input) && (orientation = validateExifBlock(input, i));
|
|
447
|
-
validateInput(input, i);
|
|
448
|
-
next = input[i + 1];
|
|
449
|
-
if (192 === next || 193 === next || 194 === next) {
|
|
450
|
-
const size = extractSize(input, i + 5);
|
|
451
|
-
if (!orientation) {
|
|
452
|
-
return size;
|
|
453
|
-
}
|
|
454
|
-
return {
|
|
455
|
-
height: size.height,
|
|
456
|
-
orientation: orientation,
|
|
457
|
-
width: size.width
|
|
458
|
-
};
|
|
459
|
-
}
|
|
460
|
-
input = input.slice(i + 2);
|
|
461
|
-
}
|
|
462
|
-
throw new TypeError("Invalid JPG, no size found");
|
|
463
|
-
}
|
|
464
|
-
};
|
|
465
|
-
}
|
|
466
|
-
});
|
|
467
|
-
var require_ktx = __commonJS({
|
|
468
|
-
"node_modules/.pnpm/image-size@1.1.1/node_modules/image-size/dist/types/ktx.js"(exports2) {
|
|
469
|
-
Object.defineProperty(exports2, "__esModule", {
|
|
470
|
-
value: true
|
|
471
|
-
});
|
|
472
|
-
exports2.KTX = void 0;
|
|
473
|
-
var utils_1 = require_utils();
|
|
474
|
-
exports2.KTX = {
|
|
475
|
-
validate: input => {
|
|
476
|
-
const signature = (0, utils_1.toUTF8String)(input, 1, 7);
|
|
477
|
-
return [ "KTX 11", "KTX 20" ].includes(signature);
|
|
478
|
-
},
|
|
479
|
-
calculate: input => {
|
|
480
|
-
const type = 49 === input[5] ? "ktx" : "ktx2";
|
|
481
|
-
const offset = "ktx" === type ? 36 : 20;
|
|
482
|
-
return {
|
|
483
|
-
height: (0, utils_1.readUInt32LE)(input, offset + 4),
|
|
484
|
-
width: (0, utils_1.readUInt32LE)(input, offset),
|
|
485
|
-
type: type
|
|
486
|
-
};
|
|
487
|
-
}
|
|
488
|
-
};
|
|
489
|
-
}
|
|
490
|
-
});
|
|
491
|
-
var require_png = __commonJS({
|
|
492
|
-
"node_modules/.pnpm/image-size@1.1.1/node_modules/image-size/dist/types/png.js"(exports2) {
|
|
493
|
-
Object.defineProperty(exports2, "__esModule", {
|
|
494
|
-
value: true
|
|
495
|
-
});
|
|
496
|
-
exports2.PNG = void 0;
|
|
497
|
-
var utils_1 = require_utils();
|
|
498
|
-
var pngSignature = "PNG\r\n\n";
|
|
499
|
-
var pngImageHeaderChunkName = "IHDR";
|
|
500
|
-
var pngFriedChunkName = "CgBI";
|
|
501
|
-
exports2.PNG = {
|
|
502
|
-
validate(input) {
|
|
503
|
-
if (pngSignature === (0, utils_1.toUTF8String)(input, 1, 8)) {
|
|
504
|
-
let chunkName = (0, utils_1.toUTF8String)(input, 12, 16);
|
|
505
|
-
chunkName === pngFriedChunkName && (chunkName = (0, utils_1.toUTF8String)(input, 28, 32));
|
|
506
|
-
if (chunkName !== pngImageHeaderChunkName) {
|
|
507
|
-
throw new TypeError("Invalid PNG");
|
|
508
|
-
}
|
|
509
|
-
return true;
|
|
510
|
-
}
|
|
511
|
-
return false;
|
|
512
|
-
},
|
|
513
|
-
calculate(input) {
|
|
514
|
-
if ((0, utils_1.toUTF8String)(input, 12, 16) === pngFriedChunkName) {
|
|
515
|
-
return {
|
|
516
|
-
height: (0, utils_1.readUInt32BE)(input, 36),
|
|
517
|
-
width: (0, utils_1.readUInt32BE)(input, 32)
|
|
518
|
-
};
|
|
519
|
-
}
|
|
520
|
-
return {
|
|
521
|
-
height: (0, utils_1.readUInt32BE)(input, 20),
|
|
522
|
-
width: (0, utils_1.readUInt32BE)(input, 16)
|
|
523
|
-
};
|
|
524
|
-
}
|
|
525
|
-
};
|
|
526
|
-
}
|
|
527
|
-
});
|
|
528
|
-
var require_pnm = __commonJS({
|
|
529
|
-
"node_modules/.pnpm/image-size@1.1.1/node_modules/image-size/dist/types/pnm.js"(exports2) {
|
|
530
|
-
Object.defineProperty(exports2, "__esModule", {
|
|
531
|
-
value: true
|
|
532
|
-
});
|
|
533
|
-
exports2.PNM = void 0;
|
|
534
|
-
var utils_1 = require_utils();
|
|
535
|
-
var PNMTypes = {
|
|
536
|
-
P1: "pbm/ascii",
|
|
537
|
-
P2: "pgm/ascii",
|
|
538
|
-
P3: "ppm/ascii",
|
|
539
|
-
P4: "pbm",
|
|
540
|
-
P5: "pgm",
|
|
541
|
-
P6: "ppm",
|
|
542
|
-
P7: "pam",
|
|
543
|
-
PF: "pfm"
|
|
544
|
-
};
|
|
545
|
-
var handlers = {
|
|
546
|
-
default: lines => {
|
|
547
|
-
let dimensions = [];
|
|
548
|
-
while (lines.length > 0) {
|
|
549
|
-
const line = lines.shift();
|
|
550
|
-
if ("#" === line[0]) {
|
|
551
|
-
continue;
|
|
552
|
-
}
|
|
553
|
-
dimensions = line.split(" ");
|
|
554
|
-
break;
|
|
555
|
-
}
|
|
556
|
-
if (2 === dimensions.length) {
|
|
557
|
-
return {
|
|
558
|
-
height: parseInt(dimensions[1], 10),
|
|
559
|
-
width: parseInt(dimensions[0], 10)
|
|
560
|
-
};
|
|
561
|
-
}
|
|
562
|
-
throw new TypeError("Invalid PNM");
|
|
563
|
-
},
|
|
564
|
-
pam: lines => {
|
|
565
|
-
const size = {};
|
|
566
|
-
while (lines.length > 0) {
|
|
567
|
-
const line = lines.shift();
|
|
568
|
-
if (line.length > 16 || line.charCodeAt(0) > 128) {
|
|
569
|
-
continue;
|
|
570
|
-
}
|
|
571
|
-
const [key, value] = line.split(" ");
|
|
572
|
-
key && value && (size[key.toLowerCase()] = parseInt(value, 10));
|
|
573
|
-
if (size.height && size.width) {
|
|
574
|
-
break;
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
if (size.height && size.width) {
|
|
578
|
-
return {
|
|
579
|
-
height: size.height,
|
|
580
|
-
width: size.width
|
|
581
|
-
};
|
|
582
|
-
}
|
|
583
|
-
throw new TypeError("Invalid PAM");
|
|
584
|
-
}
|
|
585
|
-
};
|
|
586
|
-
exports2.PNM = {
|
|
587
|
-
validate: input => (0, utils_1.toUTF8String)(input, 0, 2) in PNMTypes,
|
|
588
|
-
calculate(input) {
|
|
589
|
-
const signature = (0, utils_1.toUTF8String)(input, 0, 2);
|
|
590
|
-
const type = PNMTypes[signature];
|
|
591
|
-
const lines = (0, utils_1.toUTF8String)(input, 3).split(/[\r\n]+/);
|
|
592
|
-
const handler = handlers[type] || handlers.default;
|
|
593
|
-
return handler(lines);
|
|
594
|
-
}
|
|
595
|
-
};
|
|
596
|
-
}
|
|
597
|
-
});
|
|
598
|
-
var require_psd = __commonJS({
|
|
599
|
-
"node_modules/.pnpm/image-size@1.1.1/node_modules/image-size/dist/types/psd.js"(exports2) {
|
|
600
|
-
Object.defineProperty(exports2, "__esModule", {
|
|
601
|
-
value: true
|
|
602
|
-
});
|
|
603
|
-
exports2.PSD = void 0;
|
|
604
|
-
var utils_1 = require_utils();
|
|
605
|
-
exports2.PSD = {
|
|
606
|
-
validate: input => "8BPS" === (0, utils_1.toUTF8String)(input, 0, 4),
|
|
607
|
-
calculate: input => ({
|
|
608
|
-
height: (0, utils_1.readUInt32BE)(input, 14),
|
|
609
|
-
width: (0, utils_1.readUInt32BE)(input, 18)
|
|
610
|
-
})
|
|
611
|
-
};
|
|
612
|
-
}
|
|
613
|
-
});
|
|
614
|
-
var require_svg = __commonJS({
|
|
615
|
-
"node_modules/.pnpm/image-size@1.1.1/node_modules/image-size/dist/types/svg.js"(exports2) {
|
|
616
|
-
Object.defineProperty(exports2, "__esModule", {
|
|
617
|
-
value: true
|
|
618
|
-
});
|
|
619
|
-
exports2.SVG = void 0;
|
|
620
|
-
var utils_1 = require_utils();
|
|
621
|
-
var svgReg = /<svg\s([^>"']|"[^"]*"|'[^']*')*>/;
|
|
622
|
-
var extractorRegExps = {
|
|
623
|
-
height: /\sheight=(['"])([^%]+?)\1/,
|
|
624
|
-
root: svgReg,
|
|
625
|
-
viewbox: /\sviewBox=(['"])(.+?)\1/i,
|
|
626
|
-
width: /\swidth=(['"])([^%]+?)\1/
|
|
627
|
-
};
|
|
628
|
-
var INCH_CM = 2.54;
|
|
629
|
-
var units = {
|
|
630
|
-
in: 96,
|
|
631
|
-
cm: 96 / INCH_CM,
|
|
632
|
-
em: 16,
|
|
633
|
-
ex: 8,
|
|
634
|
-
m: 96 / INCH_CM * 100,
|
|
635
|
-
mm: 96 / INCH_CM / 10,
|
|
636
|
-
pc: 96 / 72 / 12,
|
|
637
|
-
pt: 96 / 72,
|
|
638
|
-
px: 1
|
|
639
|
-
};
|
|
640
|
-
var unitsReg = new RegExp(`^([0-9.]+(?:e\\d+)?)(${Object.keys(units).join("|")})?$`);
|
|
641
|
-
function parseLength(len) {
|
|
642
|
-
const m = unitsReg.exec(len);
|
|
643
|
-
if (!m) {
|
|
644
|
-
return;
|
|
645
|
-
}
|
|
646
|
-
return Math.round(Number(m[1]) * (units[m[2]] || 1));
|
|
647
|
-
}
|
|
648
|
-
function parseViewbox(viewbox) {
|
|
649
|
-
const bounds = viewbox.split(" ");
|
|
650
|
-
return {
|
|
651
|
-
height: parseLength(bounds[3]),
|
|
652
|
-
width: parseLength(bounds[2])
|
|
653
|
-
};
|
|
654
|
-
}
|
|
655
|
-
function parseAttributes(root) {
|
|
656
|
-
const width = root.match(extractorRegExps.width);
|
|
657
|
-
const height = root.match(extractorRegExps.height);
|
|
658
|
-
const viewbox = root.match(extractorRegExps.viewbox);
|
|
659
|
-
return {
|
|
660
|
-
height: height && parseLength(height[2]),
|
|
661
|
-
viewbox: viewbox && parseViewbox(viewbox[2]),
|
|
662
|
-
width: width && parseLength(width[2])
|
|
663
|
-
};
|
|
664
|
-
}
|
|
665
|
-
function calculateByDimensions(attrs) {
|
|
666
|
-
return {
|
|
667
|
-
height: attrs.height,
|
|
668
|
-
width: attrs.width
|
|
669
|
-
};
|
|
670
|
-
}
|
|
671
|
-
function calculateByViewbox(attrs, viewbox) {
|
|
672
|
-
const ratio = viewbox.width / viewbox.height;
|
|
673
|
-
if (attrs.width) {
|
|
674
|
-
return {
|
|
675
|
-
height: Math.floor(attrs.width / ratio),
|
|
676
|
-
width: attrs.width
|
|
677
|
-
};
|
|
678
|
-
}
|
|
679
|
-
if (attrs.height) {
|
|
680
|
-
return {
|
|
681
|
-
height: attrs.height,
|
|
682
|
-
width: Math.floor(attrs.height * ratio)
|
|
683
|
-
};
|
|
684
|
-
}
|
|
685
|
-
return {
|
|
686
|
-
height: viewbox.height,
|
|
687
|
-
width: viewbox.width
|
|
688
|
-
};
|
|
689
|
-
}
|
|
690
|
-
exports2.SVG = {
|
|
691
|
-
validate: input => svgReg.test((0, utils_1.toUTF8String)(input, 0, 1e3)),
|
|
692
|
-
calculate(input) {
|
|
693
|
-
const root = (0, utils_1.toUTF8String)(input).match(extractorRegExps.root);
|
|
694
|
-
if (root) {
|
|
695
|
-
const attrs = parseAttributes(root[0]);
|
|
696
|
-
if (attrs.width && attrs.height) {
|
|
697
|
-
return calculateByDimensions(attrs);
|
|
698
|
-
}
|
|
699
|
-
if (attrs.viewbox) {
|
|
700
|
-
return calculateByViewbox(attrs, attrs.viewbox);
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
throw new TypeError("Invalid SVG");
|
|
704
|
-
}
|
|
705
|
-
};
|
|
706
|
-
}
|
|
707
|
-
});
|
|
708
|
-
var require_tga = __commonJS({
|
|
709
|
-
"node_modules/.pnpm/image-size@1.1.1/node_modules/image-size/dist/types/tga.js"(exports2) {
|
|
710
|
-
Object.defineProperty(exports2, "__esModule", {
|
|
711
|
-
value: true
|
|
712
|
-
});
|
|
713
|
-
exports2.TGA = void 0;
|
|
714
|
-
var utils_1 = require_utils();
|
|
715
|
-
exports2.TGA = {
|
|
716
|
-
validate: input => 0 === (0, utils_1.readUInt16LE)(input, 0) && 0 === (0, utils_1.readUInt16LE)(input, 4),
|
|
717
|
-
calculate: input => ({
|
|
718
|
-
height: (0, utils_1.readUInt16LE)(input, 14),
|
|
719
|
-
width: (0, utils_1.readUInt16LE)(input, 12)
|
|
720
|
-
})
|
|
721
|
-
};
|
|
722
|
-
}
|
|
723
|
-
});
|
|
724
|
-
var require_webp = __commonJS({
|
|
725
|
-
"node_modules/.pnpm/image-size@1.1.1/node_modules/image-size/dist/types/webp.js"(exports2) {
|
|
726
|
-
Object.defineProperty(exports2, "__esModule", {
|
|
727
|
-
value: true
|
|
728
|
-
});
|
|
729
|
-
exports2.WEBP = void 0;
|
|
730
|
-
var utils_1 = require_utils();
|
|
731
|
-
function calculateExtended(input) {
|
|
732
|
-
return {
|
|
733
|
-
height: 1 + (0, utils_1.readUInt24LE)(input, 7),
|
|
734
|
-
width: 1 + (0, utils_1.readUInt24LE)(input, 4)
|
|
735
|
-
};
|
|
736
|
-
}
|
|
737
|
-
function calculateLossless(input) {
|
|
738
|
-
return {
|
|
739
|
-
height: 1 + ((15 & input[4]) << 10 | input[3] << 2 | (192 & input[2]) >> 6),
|
|
740
|
-
width: 1 + ((63 & input[2]) << 8 | input[1])
|
|
741
|
-
};
|
|
742
|
-
}
|
|
743
|
-
function calculateLossy(input) {
|
|
744
|
-
return {
|
|
745
|
-
height: 16383 & (0, utils_1.readInt16LE)(input, 8),
|
|
746
|
-
width: 16383 & (0, utils_1.readInt16LE)(input, 6)
|
|
747
|
-
};
|
|
748
|
-
}
|
|
749
|
-
exports2.WEBP = {
|
|
750
|
-
validate(input) {
|
|
751
|
-
const riffHeader = "RIFF" === (0, utils_1.toUTF8String)(input, 0, 4);
|
|
752
|
-
const webpHeader = "WEBP" === (0, utils_1.toUTF8String)(input, 8, 12);
|
|
753
|
-
const vp8Header = "VP8" === (0, utils_1.toUTF8String)(input, 12, 15);
|
|
754
|
-
return riffHeader && webpHeader && vp8Header;
|
|
755
|
-
},
|
|
756
|
-
calculate(input) {
|
|
757
|
-
const chunkHeader = (0, utils_1.toUTF8String)(input, 12, 16);
|
|
758
|
-
input = input.slice(20, 30);
|
|
759
|
-
if ("VP8X" === chunkHeader) {
|
|
760
|
-
const extendedHeader = input[0];
|
|
761
|
-
const validStart = 0 === (192 & extendedHeader);
|
|
762
|
-
const validEnd = 0 === (1 & extendedHeader);
|
|
763
|
-
if (validStart && validEnd) {
|
|
764
|
-
return calculateExtended(input);
|
|
765
|
-
}
|
|
766
|
-
throw new TypeError("Invalid WebP");
|
|
767
|
-
}
|
|
768
|
-
if ("VP8 " === chunkHeader && 47 !== input[0]) {
|
|
769
|
-
return calculateLossy(input);
|
|
770
|
-
}
|
|
771
|
-
const signature = (0, utils_1.toHexString)(input, 3, 6);
|
|
772
|
-
if ("VP8L" === chunkHeader && "9d012a" !== signature) {
|
|
773
|
-
return calculateLossless(input);
|
|
774
|
-
}
|
|
775
|
-
throw new TypeError("Invalid WebP");
|
|
776
|
-
}
|
|
777
|
-
};
|
|
778
|
-
}
|
|
779
|
-
});
|
|
780
|
-
var require_heif = __commonJS({
|
|
781
|
-
"node_modules/.pnpm/image-size@1.1.1/node_modules/image-size/dist/types/heif.js"(exports2) {
|
|
782
|
-
Object.defineProperty(exports2, "__esModule", {
|
|
783
|
-
value: true
|
|
784
|
-
});
|
|
785
|
-
exports2.HEIF = void 0;
|
|
786
|
-
var utils_1 = require_utils();
|
|
787
|
-
var brandMap = {
|
|
788
|
-
avif: "avif",
|
|
789
|
-
mif1: "heif",
|
|
790
|
-
msf1: "heif",
|
|
791
|
-
heic: "heic",
|
|
792
|
-
heix: "heic",
|
|
793
|
-
hevc: "heic",
|
|
794
|
-
hevx: "heic"
|
|
795
|
-
};
|
|
796
|
-
exports2.HEIF = {
|
|
797
|
-
validate(buffer) {
|
|
798
|
-
const ftype = (0, utils_1.toUTF8String)(buffer, 4, 8);
|
|
799
|
-
const brand = (0, utils_1.toUTF8String)(buffer, 8, 12);
|
|
800
|
-
return "ftyp" === ftype && brand in brandMap;
|
|
801
|
-
},
|
|
802
|
-
calculate(buffer) {
|
|
803
|
-
const metaBox = (0, utils_1.findBox)(buffer, "meta", 0);
|
|
804
|
-
const iprpBox = metaBox && (0, utils_1.findBox)(buffer, "iprp", metaBox.offset + 12);
|
|
805
|
-
const ipcoBox = iprpBox && (0, utils_1.findBox)(buffer, "ipco", iprpBox.offset + 8);
|
|
806
|
-
const ispeBox = ipcoBox && (0, utils_1.findBox)(buffer, "ispe", ipcoBox.offset + 8);
|
|
807
|
-
if (ispeBox) {
|
|
808
|
-
return {
|
|
809
|
-
height: (0, utils_1.readUInt32BE)(buffer, ispeBox.offset + 16),
|
|
810
|
-
width: (0, utils_1.readUInt32BE)(buffer, ispeBox.offset + 12),
|
|
811
|
-
type: (0, utils_1.toUTF8String)(buffer, 8, 12)
|
|
812
|
-
};
|
|
813
|
-
}
|
|
814
|
-
throw new TypeError("Invalid HEIF, no size found");
|
|
815
|
-
}
|
|
816
|
-
};
|
|
817
|
-
}
|
|
818
|
-
});
|
|
819
|
-
var src_exports = {};
|
|
820
|
-
__export(src_exports, {
|
|
821
|
-
createOptimizer: () => createOptimizer,
|
|
822
|
-
qwikRollup: () => qwikRollup,
|
|
823
|
-
qwikVite: () => qwikVite,
|
|
824
|
-
symbolMapper: () => symbolMapper,
|
|
825
|
-
versions: () => versions
|
|
826
|
-
});
|
|
827
|
-
module.exports = __toCommonJS(src_exports);
|
|
828
|
-
function createPath(opts = {}) {
|
|
829
|
-
function assertPath(path) {
|
|
830
|
-
if ("string" !== typeof path) {
|
|
831
|
-
throw new TypeError("Path must be a string. Received " + JSON.stringify(path));
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
function normalizeStringPosix(path, allowAboveRoot) {
|
|
835
|
-
let res = "";
|
|
836
|
-
let lastSegmentLength = 0;
|
|
837
|
-
let lastSlash = -1;
|
|
838
|
-
let dots = 0;
|
|
839
|
-
let code;
|
|
840
|
-
for (let i = 0; i <= path.length; ++i) {
|
|
841
|
-
if (i < path.length) {
|
|
842
|
-
code = path.charCodeAt(i);
|
|
843
|
-
} else {
|
|
844
|
-
if (47 === code) {
|
|
845
|
-
break;
|
|
846
|
-
}
|
|
847
|
-
code = 47;
|
|
848
|
-
}
|
|
849
|
-
if (47 === code) {
|
|
850
|
-
if (lastSlash === i - 1 || 1 === dots) {} else if (lastSlash !== i - 1 && 2 === dots) {
|
|
851
|
-
if (res.length < 2 || 2 !== lastSegmentLength || 46 !== res.charCodeAt(res.length - 1) || 46 !== res.charCodeAt(res.length - 2)) {
|
|
852
|
-
if (res.length > 2) {
|
|
853
|
-
const lastSlashIndex = res.lastIndexOf("/");
|
|
854
|
-
if (lastSlashIndex !== res.length - 1) {
|
|
855
|
-
if (-1 === lastSlashIndex) {
|
|
856
|
-
res = "";
|
|
857
|
-
lastSegmentLength = 0;
|
|
858
|
-
} else {
|
|
859
|
-
res = res.slice(0, lastSlashIndex);
|
|
860
|
-
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
861
|
-
}
|
|
862
|
-
lastSlash = i;
|
|
863
|
-
dots = 0;
|
|
864
|
-
continue;
|
|
865
|
-
}
|
|
866
|
-
} else if (2 === res.length || 1 === res.length) {
|
|
867
|
-
res = "";
|
|
868
|
-
lastSegmentLength = 0;
|
|
869
|
-
lastSlash = i;
|
|
870
|
-
dots = 0;
|
|
871
|
-
continue;
|
|
872
|
-
}
|
|
873
|
-
}
|
|
874
|
-
if (allowAboveRoot) {
|
|
875
|
-
res.length > 0 ? res += "/.." : res = "..";
|
|
876
|
-
lastSegmentLength = 2;
|
|
877
|
-
}
|
|
878
|
-
} else {
|
|
879
|
-
res.length > 0 ? res += "/" + path.slice(lastSlash + 1, i) : res = path.slice(lastSlash + 1, i);
|
|
880
|
-
lastSegmentLength = i - lastSlash - 1;
|
|
881
|
-
}
|
|
882
|
-
lastSlash = i;
|
|
883
|
-
dots = 0;
|
|
884
|
-
} else {
|
|
885
|
-
46 === code && -1 !== dots ? ++dots : dots = -1;
|
|
886
|
-
}
|
|
887
|
-
}
|
|
888
|
-
return res;
|
|
889
|
-
}
|
|
890
|
-
function _format(sep2, pathObject) {
|
|
891
|
-
const dir = pathObject.dir || pathObject.root;
|
|
892
|
-
const base = pathObject.base || (pathObject.name || "") + (pathObject.ext || "");
|
|
893
|
-
if (!dir) {
|
|
894
|
-
return base;
|
|
895
|
-
}
|
|
896
|
-
if (dir === pathObject.root) {
|
|
897
|
-
return dir + base;
|
|
898
|
-
}
|
|
899
|
-
return dir + sep2 + base;
|
|
900
|
-
}
|
|
901
|
-
const resolve = function(...paths) {
|
|
902
|
-
let resolvedPath = "";
|
|
903
|
-
let resolvedAbsolute = false;
|
|
904
|
-
let cwd;
|
|
905
|
-
for (let i = paths.length - 1; i >= -1 && !resolvedAbsolute; i--) {
|
|
906
|
-
let path;
|
|
907
|
-
if (i >= 0) {
|
|
908
|
-
path = paths[i];
|
|
909
|
-
} else {
|
|
910
|
-
void 0 === cwd && (cwd = opts && "function" === typeof opts.cwd ? opts.cwd() : "undefined" !== typeof process && "function" === typeof process.cwd ? process.cwd() : "/");
|
|
911
|
-
path = cwd;
|
|
912
|
-
}
|
|
913
|
-
assertPath(path);
|
|
914
|
-
if (0 === path.length) {
|
|
915
|
-
continue;
|
|
916
|
-
}
|
|
917
|
-
resolvedPath = path + "/" + resolvedPath;
|
|
918
|
-
resolvedAbsolute = 47 === path.charCodeAt(0);
|
|
919
|
-
}
|
|
920
|
-
resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute);
|
|
921
|
-
return resolvedAbsolute ? resolvedPath.length > 0 ? "/" + resolvedPath : "/" : resolvedPath.length > 0 ? resolvedPath : ".";
|
|
922
|
-
};
|
|
923
|
-
const normalize = function(path) {
|
|
924
|
-
assertPath(path);
|
|
925
|
-
if (0 === path.length) {
|
|
926
|
-
return ".";
|
|
927
|
-
}
|
|
928
|
-
const isAbsolute2 = 47 === path.charCodeAt(0);
|
|
929
|
-
const trailingSeparator = 47 === path.charCodeAt(path.length - 1);
|
|
930
|
-
path = normalizeStringPosix(path, !isAbsolute2);
|
|
931
|
-
0 !== path.length || isAbsolute2 || (path = ".");
|
|
932
|
-
path.length > 0 && trailingSeparator && (path += "/");
|
|
933
|
-
if (isAbsolute2) {
|
|
934
|
-
return "/" + path;
|
|
935
|
-
}
|
|
936
|
-
return path;
|
|
937
|
-
};
|
|
938
|
-
const isAbsolute = function(path) {
|
|
939
|
-
assertPath(path);
|
|
940
|
-
return path.length > 0 && 47 === path.charCodeAt(0);
|
|
941
|
-
};
|
|
942
|
-
const join = function(...paths) {
|
|
943
|
-
if (0 === paths.length) {
|
|
944
|
-
return ".";
|
|
945
|
-
}
|
|
946
|
-
let joined;
|
|
947
|
-
for (let i = 0; i < paths.length; ++i) {
|
|
948
|
-
const arg = paths[i];
|
|
949
|
-
assertPath(arg);
|
|
950
|
-
arg.length > 0 && (void 0 === joined ? joined = arg : joined += "/" + arg);
|
|
951
|
-
}
|
|
952
|
-
if (void 0 === joined) {
|
|
953
|
-
return ".";
|
|
954
|
-
}
|
|
955
|
-
return normalize(joined);
|
|
956
|
-
};
|
|
957
|
-
const relative = function(from, to) {
|
|
958
|
-
assertPath(from);
|
|
959
|
-
assertPath(to);
|
|
960
|
-
if (from === to) {
|
|
961
|
-
return "";
|
|
962
|
-
}
|
|
963
|
-
from = resolve(from);
|
|
964
|
-
to = resolve(to);
|
|
965
|
-
if (from === to) {
|
|
966
|
-
return "";
|
|
967
|
-
}
|
|
968
|
-
let fromStart = 1;
|
|
969
|
-
for (;fromStart < from.length; ++fromStart) {
|
|
970
|
-
if (47 !== from.charCodeAt(fromStart)) {
|
|
971
|
-
break;
|
|
972
|
-
}
|
|
973
|
-
}
|
|
974
|
-
const fromEnd = from.length;
|
|
975
|
-
const fromLen = fromEnd - fromStart;
|
|
976
|
-
let toStart = 1;
|
|
977
|
-
for (;toStart < to.length; ++toStart) {
|
|
978
|
-
if (47 !== to.charCodeAt(toStart)) {
|
|
979
|
-
break;
|
|
980
|
-
}
|
|
981
|
-
}
|
|
982
|
-
const toEnd = to.length;
|
|
983
|
-
const toLen = toEnd - toStart;
|
|
984
|
-
const length = fromLen < toLen ? fromLen : toLen;
|
|
985
|
-
let lastCommonSep = -1;
|
|
986
|
-
let i = 0;
|
|
987
|
-
for (;i <= length; ++i) {
|
|
988
|
-
if (i === length) {
|
|
989
|
-
if (toLen > length) {
|
|
990
|
-
if (47 === to.charCodeAt(toStart + i)) {
|
|
991
|
-
return to.slice(toStart + i + 1);
|
|
992
|
-
}
|
|
993
|
-
if (0 === i) {
|
|
994
|
-
return to.slice(toStart + i);
|
|
995
|
-
}
|
|
996
|
-
} else {
|
|
997
|
-
fromLen > length && (47 === from.charCodeAt(fromStart + i) ? lastCommonSep = i : 0 === i && (lastCommonSep = 0));
|
|
998
|
-
}
|
|
999
|
-
break;
|
|
1000
|
-
}
|
|
1001
|
-
const fromCode = from.charCodeAt(fromStart + i);
|
|
1002
|
-
const toCode = to.charCodeAt(toStart + i);
|
|
1003
|
-
if (fromCode !== toCode) {
|
|
1004
|
-
break;
|
|
1005
|
-
}
|
|
1006
|
-
47 === fromCode && (lastCommonSep = i);
|
|
1007
|
-
}
|
|
1008
|
-
let out = "";
|
|
1009
|
-
for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {
|
|
1010
|
-
i !== fromEnd && 47 !== from.charCodeAt(i) || (0 === out.length ? out += ".." : out += "/..");
|
|
1011
|
-
}
|
|
1012
|
-
if (out.length > 0) {
|
|
1013
|
-
return out + to.slice(toStart + lastCommonSep);
|
|
1014
|
-
}
|
|
1015
|
-
toStart += lastCommonSep;
|
|
1016
|
-
47 === to.charCodeAt(toStart) && ++toStart;
|
|
1017
|
-
return to.slice(toStart);
|
|
1018
|
-
};
|
|
1019
|
-
const dirname = function(path) {
|
|
1020
|
-
assertPath(path);
|
|
1021
|
-
if (0 === path.length) {
|
|
1022
|
-
return ".";
|
|
1023
|
-
}
|
|
1024
|
-
let code = path.charCodeAt(0);
|
|
1025
|
-
const hasRoot = 47 === code;
|
|
1026
|
-
let end = -1;
|
|
1027
|
-
let matchedSlash = true;
|
|
1028
|
-
for (let i = path.length - 1; i >= 1; --i) {
|
|
1029
|
-
code = path.charCodeAt(i);
|
|
1030
|
-
if (47 === code) {
|
|
1031
|
-
if (!matchedSlash) {
|
|
1032
|
-
end = i;
|
|
1033
|
-
break;
|
|
1034
|
-
}
|
|
1035
|
-
} else {
|
|
1036
|
-
matchedSlash = false;
|
|
1037
|
-
}
|
|
1038
|
-
}
|
|
1039
|
-
if (-1 === end) {
|
|
1040
|
-
return hasRoot ? "/" : ".";
|
|
1041
|
-
}
|
|
1042
|
-
if (hasRoot && 1 === end) {
|
|
1043
|
-
return "//";
|
|
1044
|
-
}
|
|
1045
|
-
return path.slice(0, end);
|
|
1046
|
-
};
|
|
1047
|
-
const basename = function(path, ext) {
|
|
1048
|
-
if (void 0 !== ext && "string" !== typeof ext) {
|
|
1049
|
-
throw new TypeError('"ext" argument must be a string');
|
|
1050
|
-
}
|
|
1051
|
-
assertPath(path);
|
|
1052
|
-
let start = 0;
|
|
1053
|
-
let end = -1;
|
|
1054
|
-
let matchedSlash = true;
|
|
1055
|
-
let i;
|
|
1056
|
-
if (void 0 !== ext && ext.length > 0 && ext.length <= path.length) {
|
|
1057
|
-
if (ext.length === path.length && ext === path) {
|
|
1058
|
-
return "";
|
|
1059
|
-
}
|
|
1060
|
-
let extIdx = ext.length - 1;
|
|
1061
|
-
let firstNonSlashEnd = -1;
|
|
1062
|
-
for (i = path.length - 1; i >= 0; --i) {
|
|
1063
|
-
const code = path.charCodeAt(i);
|
|
1064
|
-
if (47 === code) {
|
|
1065
|
-
if (!matchedSlash) {
|
|
1066
|
-
start = i + 1;
|
|
1067
|
-
break;
|
|
1068
|
-
}
|
|
1069
|
-
} else {
|
|
1070
|
-
if (-1 === firstNonSlashEnd) {
|
|
1071
|
-
matchedSlash = false;
|
|
1072
|
-
firstNonSlashEnd = i + 1;
|
|
1073
|
-
}
|
|
1074
|
-
if (extIdx >= 0) {
|
|
1075
|
-
if (code === ext.charCodeAt(extIdx)) {
|
|
1076
|
-
-1 === --extIdx && (end = i);
|
|
1077
|
-
} else {
|
|
1078
|
-
extIdx = -1;
|
|
1079
|
-
end = firstNonSlashEnd;
|
|
1080
|
-
}
|
|
1081
|
-
}
|
|
1082
|
-
}
|
|
1083
|
-
}
|
|
1084
|
-
start === end ? end = firstNonSlashEnd : -1 === end && (end = path.length);
|
|
1085
|
-
return path.slice(start, end);
|
|
1086
|
-
}
|
|
1087
|
-
for (i = path.length - 1; i >= 0; --i) {
|
|
1088
|
-
if (47 === path.charCodeAt(i)) {
|
|
1089
|
-
if (!matchedSlash) {
|
|
1090
|
-
start = i + 1;
|
|
1091
|
-
break;
|
|
1092
|
-
}
|
|
1093
|
-
} else if (-1 === end) {
|
|
1094
|
-
matchedSlash = false;
|
|
1095
|
-
end = i + 1;
|
|
1096
|
-
}
|
|
1097
|
-
}
|
|
1098
|
-
if (-1 === end) {
|
|
1099
|
-
return "";
|
|
1100
|
-
}
|
|
1101
|
-
return path.slice(start, end);
|
|
1102
|
-
};
|
|
1103
|
-
const extname = function(path) {
|
|
1104
|
-
assertPath(path);
|
|
1105
|
-
let startDot = -1;
|
|
1106
|
-
let startPart = 0;
|
|
1107
|
-
let end = -1;
|
|
1108
|
-
let matchedSlash = true;
|
|
1109
|
-
let preDotState = 0;
|
|
1110
|
-
for (let i = path.length - 1; i >= 0; --i) {
|
|
1111
|
-
const code = path.charCodeAt(i);
|
|
1112
|
-
if (47 === code) {
|
|
1113
|
-
if (!matchedSlash) {
|
|
1114
|
-
startPart = i + 1;
|
|
1115
|
-
break;
|
|
1116
|
-
}
|
|
1117
|
-
continue;
|
|
1118
|
-
}
|
|
1119
|
-
if (-1 === end) {
|
|
1120
|
-
matchedSlash = false;
|
|
1121
|
-
end = i + 1;
|
|
1122
|
-
}
|
|
1123
|
-
46 === code ? -1 === startDot ? startDot = i : 1 !== preDotState && (preDotState = 1) : -1 !== startDot && (preDotState = -1);
|
|
1124
|
-
}
|
|
1125
|
-
if (-1 === startDot || -1 === end || 0 === preDotState || 1 === preDotState && startDot === end - 1 && startDot === startPart + 1) {
|
|
1126
|
-
return "";
|
|
1127
|
-
}
|
|
1128
|
-
return path.slice(startDot, end);
|
|
1129
|
-
};
|
|
1130
|
-
const format = function(pathObject) {
|
|
1131
|
-
if (null === pathObject || "object" !== typeof pathObject) {
|
|
1132
|
-
throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof pathObject);
|
|
1133
|
-
}
|
|
1134
|
-
return _format("/", pathObject);
|
|
1135
|
-
};
|
|
1136
|
-
const parse = function(path) {
|
|
1137
|
-
assertPath(path);
|
|
1138
|
-
const ret = {
|
|
1139
|
-
root: "",
|
|
1140
|
-
dir: "",
|
|
1141
|
-
base: "",
|
|
1142
|
-
ext: "",
|
|
1143
|
-
name: ""
|
|
1144
|
-
};
|
|
1145
|
-
if (0 === path.length) {
|
|
1146
|
-
return ret;
|
|
1147
|
-
}
|
|
1148
|
-
let code = path.charCodeAt(0);
|
|
1149
|
-
let start;
|
|
1150
|
-
const isAbsolute2 = 47 === code;
|
|
1151
|
-
if (isAbsolute2) {
|
|
1152
|
-
ret.root = "/";
|
|
1153
|
-
start = 1;
|
|
1154
|
-
} else {
|
|
1155
|
-
start = 0;
|
|
1156
|
-
}
|
|
1157
|
-
let startDot = -1;
|
|
1158
|
-
let startPart = 0;
|
|
1159
|
-
let end = -1;
|
|
1160
|
-
let matchedSlash = true;
|
|
1161
|
-
let i = path.length - 1;
|
|
1162
|
-
let preDotState = 0;
|
|
1163
|
-
for (;i >= start; --i) {
|
|
1164
|
-
code = path.charCodeAt(i);
|
|
1165
|
-
if (47 === code) {
|
|
1166
|
-
if (!matchedSlash) {
|
|
1167
|
-
startPart = i + 1;
|
|
1168
|
-
break;
|
|
1169
|
-
}
|
|
1170
|
-
continue;
|
|
1171
|
-
}
|
|
1172
|
-
if (-1 === end) {
|
|
1173
|
-
matchedSlash = false;
|
|
1174
|
-
end = i + 1;
|
|
1175
|
-
}
|
|
1176
|
-
46 === code ? -1 === startDot ? startDot = i : 1 !== preDotState && (preDotState = 1) : -1 !== startDot && (preDotState = -1);
|
|
1177
|
-
}
|
|
1178
|
-
if (-1 === startDot || -1 === end || 0 === preDotState || 1 === preDotState && startDot === end - 1 && startDot === startPart + 1) {
|
|
1179
|
-
-1 !== end && (ret.base = ret.name = 0 === startPart && isAbsolute2 ? path.slice(1, end) : path.slice(startPart, end));
|
|
1180
|
-
} else {
|
|
1181
|
-
if (0 === startPart && isAbsolute2) {
|
|
1182
|
-
ret.name = path.slice(1, startDot);
|
|
1183
|
-
ret.base = path.slice(1, end);
|
|
1184
|
-
} else {
|
|
1185
|
-
ret.name = path.slice(startPart, startDot);
|
|
1186
|
-
ret.base = path.slice(startPart, end);
|
|
1187
|
-
}
|
|
1188
|
-
ret.ext = path.slice(startDot, end);
|
|
1189
|
-
}
|
|
1190
|
-
startPart > 0 ? ret.dir = path.slice(0, startPart - 1) : isAbsolute2 && (ret.dir = "/");
|
|
1191
|
-
return ret;
|
|
1192
|
-
};
|
|
1193
|
-
const sep = "/";
|
|
1194
|
-
const delimiter = ":";
|
|
1195
|
-
return {
|
|
1196
|
-
relative: relative,
|
|
1197
|
-
resolve: resolve,
|
|
1198
|
-
parse: parse,
|
|
1199
|
-
format: format,
|
|
1200
|
-
join: join,
|
|
1201
|
-
isAbsolute: isAbsolute,
|
|
1202
|
-
basename: basename,
|
|
1203
|
-
normalize: normalize,
|
|
1204
|
-
dirname: dirname,
|
|
1205
|
-
extname: extname,
|
|
1206
|
-
delimiter: delimiter,
|
|
1207
|
-
sep: sep,
|
|
1208
|
-
win32: null,
|
|
1209
|
-
posix: {
|
|
1210
|
-
relative: relative,
|
|
1211
|
-
resolve: resolve,
|
|
1212
|
-
parse: parse,
|
|
1213
|
-
format: format,
|
|
1214
|
-
join: join,
|
|
1215
|
-
isAbsolute: isAbsolute,
|
|
1216
|
-
basename: basename,
|
|
1217
|
-
normalize: normalize,
|
|
1218
|
-
dirname: dirname,
|
|
1219
|
-
extname: extname,
|
|
1220
|
-
delimiter: delimiter,
|
|
1221
|
-
sep: sep,
|
|
1222
|
-
win32: null,
|
|
1223
|
-
posix: null
|
|
1224
|
-
}
|
|
1225
|
-
};
|
|
1226
|
-
}
|
|
1227
|
-
var QWIK_BINDING_MAP = {
|
|
1228
|
-
win32: {
|
|
1229
|
-
x64: [ {
|
|
1230
|
-
platform: "win32",
|
|
1231
|
-
arch: "x64",
|
|
1232
|
-
abi: "msvc",
|
|
1233
|
-
platformArchABI: "qwik.win32-x64-msvc.node"
|
|
1234
|
-
} ]
|
|
1235
|
-
}
|
|
1236
|
-
};
|
|
1237
|
-
var versions = {
|
|
1238
|
-
qwik: "2.0.0-alpha.9-dev+56ed5bd"
|
|
1239
|
-
};
|
|
1240
|
-
async function getSystem() {
|
|
1241
|
-
const sysEnv = getEnv();
|
|
1242
|
-
const sys = {
|
|
1243
|
-
dynamicImport: path => {
|
|
1244
|
-
throw new Error(`Qwik Optimizer sys.dynamicImport() not implemented, trying to import: "${path}"`);
|
|
1245
|
-
},
|
|
1246
|
-
strictDynamicImport: path => {
|
|
1247
|
-
throw new Error(`Qwik Optimizer sys.strictDynamicImport() not implemented, trying to import: "${path}"`);
|
|
1248
|
-
},
|
|
1249
|
-
path: null,
|
|
1250
|
-
cwd: () => "/",
|
|
1251
|
-
os: "unknown",
|
|
1252
|
-
env: sysEnv
|
|
1253
|
-
};
|
|
1254
|
-
sys.path = createPath(sys);
|
|
1255
|
-
false;
|
|
1256
|
-
if ("node" === sysEnv || "bun" === sysEnv) {
|
|
1257
|
-
sys.dynamicImport = path => require(path);
|
|
1258
|
-
sys.strictDynamicImport = path => import(path);
|
|
1259
|
-
if ("undefined" === typeof TextEncoder) {
|
|
1260
|
-
const nodeUtil = await sys.dynamicImport("node:util");
|
|
1261
|
-
globalThis.TextEncoder = nodeUtil.TextEncoder;
|
|
1262
|
-
globalThis.TextDecoder = nodeUtil.TextDecoder;
|
|
1263
|
-
}
|
|
1264
|
-
} else if ("webworker" === sysEnv || "browsermain" === sysEnv) {
|
|
1265
|
-
sys.strictDynamicImport = path => import(path);
|
|
1266
|
-
sys.dynamicImport = async path => {
|
|
1267
|
-
const cjsRsp = await fetch(path);
|
|
1268
|
-
const cjsCode = await cjsRsp.text();
|
|
1269
|
-
const cjsModule = {
|
|
1270
|
-
exports: {}
|
|
1271
|
-
};
|
|
1272
|
-
const cjsRun = new Function("module", "exports", cjsCode);
|
|
1273
|
-
cjsRun(cjsModule, cjsModule.exports);
|
|
1274
|
-
return cjsModule.exports;
|
|
1275
|
-
};
|
|
1276
|
-
}
|
|
1277
|
-
if ("node" === sysEnv || "bun" === sysEnv) {
|
|
1278
|
-
sys.path = await sys.dynamicImport("node:path");
|
|
1279
|
-
sys.cwd = () => process.cwd();
|
|
1280
|
-
sys.os = process.platform;
|
|
1281
|
-
}
|
|
1282
|
-
return sys;
|
|
1283
|
-
}
|
|
1284
|
-
async function loadPlatformBinding(sys) {
|
|
1285
|
-
const sysEnv = getEnv();
|
|
1286
|
-
if ("node" === sysEnv || "bun" === sysEnv) {
|
|
1287
|
-
const platform = QWIK_BINDING_MAP[process.platform];
|
|
1288
|
-
if (platform) {
|
|
1289
|
-
const triples = platform[process.arch];
|
|
1290
|
-
if (triples) {
|
|
1291
|
-
for (const triple of triples) {
|
|
1292
|
-
try {
|
|
1293
|
-
false;
|
|
1294
|
-
const mod = await sys.dynamicImport(`../bindings/${triple.platformArchABI}`);
|
|
1295
|
-
return mod;
|
|
1296
|
-
} catch (e) {
|
|
1297
|
-
console.warn(`Unable to load native binding ${triple.platformArchABI}. Falling back to wasm build.`, null == e ? void 0 : e.message);
|
|
1298
|
-
}
|
|
1299
|
-
}
|
|
1300
|
-
}
|
|
1301
|
-
}
|
|
1302
|
-
}
|
|
1303
|
-
if ("node" === sysEnv || "bun" === sysEnv) {
|
|
1304
|
-
const wasmPath = sys.path.join(__dirname, "..", "bindings", "qwik_wasm_bg.wasm");
|
|
1305
|
-
const mod = await sys.dynamicImport("../bindings/qwik.wasm.cjs");
|
|
1306
|
-
const fs = await sys.dynamicImport("node:fs");
|
|
1307
|
-
return new Promise(((resolve, reject) => {
|
|
1308
|
-
fs.readFile(wasmPath, ((err, buf) => {
|
|
1309
|
-
null != err ? reject(err) : resolve(buf);
|
|
1310
|
-
}));
|
|
1311
|
-
})).then((buf => WebAssembly.compile(buf))).then((wasm => mod.default(wasm))).then((() => mod));
|
|
1312
|
-
}
|
|
1313
|
-
if ("webworker" === sysEnv || "browsermain" === sysEnv) {
|
|
1314
|
-
let version = versions.qwik;
|
|
1315
|
-
const cachedCjsCode = `qwikWasmCjs${version}`;
|
|
1316
|
-
const cachedWasmRsp = `qwikWasmRsp${version}`;
|
|
1317
|
-
let cjsCode = globalThis[cachedCjsCode];
|
|
1318
|
-
let wasmRsp = globalThis[cachedWasmRsp];
|
|
1319
|
-
if (!cjsCode || !wasmRsp) {
|
|
1320
|
-
version = versions.qwik.split("-dev")[0];
|
|
1321
|
-
const cdnUrl = `https://cdn.jsdelivr.net/npm/@qwik.dev/core@${version}/bindings/`;
|
|
1322
|
-
const cjsModuleUrl = new URL("./qwik.wasm.cjs", cdnUrl).href;
|
|
1323
|
-
const wasmUrl = new URL("./qwik_wasm_bg.wasm", cdnUrl).href;
|
|
1324
|
-
const rsps = await Promise.all([ fetch(cjsModuleUrl), fetch(wasmUrl) ]);
|
|
1325
|
-
for (const rsp of rsps) {
|
|
1326
|
-
if (!rsp.ok) {
|
|
1327
|
-
throw new Error(`Unable to fetch Qwik WASM binding from ${rsp.url}`);
|
|
1328
|
-
}
|
|
1329
|
-
}
|
|
1330
|
-
const cjsRsp = rsps[0];
|
|
1331
|
-
globalThis[cachedCjsCode] = cjsCode = await cjsRsp.text();
|
|
1332
|
-
globalThis[cachedWasmRsp] = wasmRsp = rsps[1];
|
|
1333
|
-
}
|
|
1334
|
-
const cjsModule = {
|
|
1335
|
-
exports: {}
|
|
1336
|
-
};
|
|
1337
|
-
const cjsRun = new Function("module", "exports", cjsCode);
|
|
1338
|
-
cjsRun(cjsModule, cjsModule.exports);
|
|
1339
|
-
const mod = cjsModule.exports;
|
|
1340
|
-
await mod.default(wasmRsp.clone());
|
|
1341
|
-
return mod;
|
|
1342
|
-
}
|
|
1343
|
-
false;
|
|
1344
|
-
throw new Error("Platform not supported");
|
|
1345
|
-
}
|
|
1346
|
-
var getEnv = () => {
|
|
1347
|
-
if ("undefined" !== typeof Deno) {
|
|
1348
|
-
return "deno";
|
|
1349
|
-
}
|
|
1350
|
-
if ("undefined" !== typeof Bun) {
|
|
1351
|
-
return "bun";
|
|
1352
|
-
}
|
|
1353
|
-
if ("undefined" !== typeof process && "undefined" !== typeof global && process.versions && process.versions.node) {
|
|
1354
|
-
return "node";
|
|
1355
|
-
}
|
|
1356
|
-
if ("undefined" !== typeof self && "undefined" !== typeof location && "undefined" !== typeof navigator && "function" === typeof fetch && "function" === typeof WorkerGlobalScope && "function" === typeof self.importScripts) {
|
|
1357
|
-
return "webworker";
|
|
1358
|
-
}
|
|
1359
|
-
if ("undefined" !== typeof window && "undefined" !== typeof document && "undefined" !== typeof location && "undefined" !== typeof navigator && "function" === typeof Window && "function" === typeof fetch) {
|
|
1360
|
-
return "browsermain";
|
|
1361
|
-
}
|
|
1362
|
-
return "unknown";
|
|
1363
|
-
};
|
|
1364
|
-
var createOptimizer = async (optimizerOptions = {}) => {
|
|
1365
|
-
const sys = (null == optimizerOptions ? void 0 : optimizerOptions.sys) || await getSystem();
|
|
1366
|
-
const binding = (null == optimizerOptions ? void 0 : optimizerOptions.binding) || await loadPlatformBinding(sys);
|
|
1367
|
-
const optimizer = {
|
|
1368
|
-
transformModules: async opts => transformModules(binding, opts),
|
|
1369
|
-
sys: sys
|
|
1370
|
-
};
|
|
1371
|
-
return optimizer;
|
|
1372
|
-
};
|
|
1373
|
-
var transformModules = (binding, opts) => binding.transform_modules(convertOptions(opts));
|
|
1374
|
-
var convertOptions = opts => {
|
|
1375
|
-
var _a, _b;
|
|
1376
|
-
const output = {
|
|
1377
|
-
minify: "simplify",
|
|
1378
|
-
sourceMaps: false,
|
|
1379
|
-
transpileTs: false,
|
|
1380
|
-
transpileJsx: false,
|
|
1381
|
-
preserveFilenames: false,
|
|
1382
|
-
explicitExtensions: false,
|
|
1383
|
-
mode: "lib",
|
|
1384
|
-
manualChunks: void 0,
|
|
1385
|
-
scope: void 0,
|
|
1386
|
-
regCtxName: void 0,
|
|
1387
|
-
stripEventHandlers: false,
|
|
1388
|
-
rootDir: void 0,
|
|
1389
|
-
stripExports: void 0,
|
|
1390
|
-
stripCtxName: void 0,
|
|
1391
|
-
isServer: void 0
|
|
1392
|
-
};
|
|
1393
|
-
Object.entries(opts).forEach((([key, value]) => {
|
|
1394
|
-
null != value && (output[key] = value);
|
|
1395
|
-
}));
|
|
1396
|
-
output.entryStrategy = (null == (_a = opts.entryStrategy) ? void 0 : _a.type) ?? "smart";
|
|
1397
|
-
output.manualChunks = (null == (_b = opts.entryStrategy) ? void 0 : _b.manual) ?? void 0;
|
|
1398
|
-
return output;
|
|
1399
|
-
};
|
|
1400
|
-
var hashCode = (text, hash = 0) => {
|
|
1401
|
-
for (let i = 0; i < text.length; i++) {
|
|
1402
|
-
const chr = text.charCodeAt(i);
|
|
1403
|
-
hash = (hash << 5) - hash + chr;
|
|
1404
|
-
hash |= 0;
|
|
1405
|
-
}
|
|
1406
|
-
return Number(Math.abs(hash)).toString(36);
|
|
1407
|
-
};
|
|
1408
|
-
var extraSymbols = new Set([ "_run", "_task" ]);
|
|
1409
|
-
function prioritizeSymbolNames(manifest) {
|
|
1410
|
-
const symbols = manifest.symbols;
|
|
1411
|
-
return Object.keys(symbols).sort(((symbolNameA, symbolNameB) => {
|
|
1412
|
-
const a = symbols[symbolNameA];
|
|
1413
|
-
const b = symbols[symbolNameB];
|
|
1414
|
-
if ("event" === a.ctxKind && "event" !== b.ctxKind) {
|
|
1415
|
-
return -1;
|
|
1416
|
-
}
|
|
1417
|
-
if ("event" !== a.ctxKind && "event" === b.ctxKind) {
|
|
1418
|
-
return 1;
|
|
1419
|
-
}
|
|
1420
|
-
if ("event" === a.ctxKind && "event" === b.ctxKind) {
|
|
1421
|
-
const aIndex = EVENT_PRIORITY.indexOf(a.ctxName.toLowerCase());
|
|
1422
|
-
const bIndex = EVENT_PRIORITY.indexOf(b.ctxName.toLowerCase());
|
|
1423
|
-
if (aIndex > -1 && bIndex > -1) {
|
|
1424
|
-
if (aIndex < bIndex) {
|
|
1425
|
-
return -1;
|
|
1426
|
-
}
|
|
1427
|
-
if (aIndex > bIndex) {
|
|
1428
|
-
return 1;
|
|
1429
|
-
}
|
|
1430
|
-
} else {
|
|
1431
|
-
if (aIndex > -1) {
|
|
1432
|
-
return -1;
|
|
1433
|
-
}
|
|
1434
|
-
if (bIndex > -1) {
|
|
1435
|
-
return 1;
|
|
1436
|
-
}
|
|
1437
|
-
}
|
|
1438
|
-
} else if ("function" === a.ctxKind && "function" === b.ctxKind) {
|
|
1439
|
-
const aIndex = FUNCTION_PRIORITY.indexOf(a.ctxName.toLowerCase());
|
|
1440
|
-
const bIndex = FUNCTION_PRIORITY.indexOf(b.ctxName.toLowerCase());
|
|
1441
|
-
if (aIndex > -1 && bIndex > -1) {
|
|
1442
|
-
if (aIndex < bIndex) {
|
|
1443
|
-
return -1;
|
|
1444
|
-
}
|
|
1445
|
-
if (aIndex > bIndex) {
|
|
1446
|
-
return 1;
|
|
1447
|
-
}
|
|
1448
|
-
} else {
|
|
1449
|
-
if (aIndex > -1) {
|
|
1450
|
-
return -1;
|
|
1451
|
-
}
|
|
1452
|
-
if (bIndex > -1) {
|
|
1453
|
-
return 1;
|
|
1454
|
-
}
|
|
1455
|
-
}
|
|
1456
|
-
}
|
|
1457
|
-
if (!a.parent && b.parent) {
|
|
1458
|
-
return -1;
|
|
1459
|
-
}
|
|
1460
|
-
if (a.parent && !b.parent) {
|
|
1461
|
-
return 1;
|
|
1462
|
-
}
|
|
1463
|
-
if (a.hash < b.hash) {
|
|
1464
|
-
return -1;
|
|
1465
|
-
}
|
|
1466
|
-
if (a.hash > b.hash) {
|
|
1467
|
-
return 1;
|
|
1468
|
-
}
|
|
1469
|
-
return 0;
|
|
1470
|
-
}));
|
|
1471
|
-
}
|
|
1472
|
-
var EVENT_PRIORITY = (() => [ "click", "dblclick", "contextmenu", "auxclick", "pointerdown", "pointerup", "pointermove", "pointerover", "pointerenter", "pointerleave", "pointerout", "pointercancel", "gotpointercapture", "lostpointercapture", "touchstart", "touchend", "touchmove", "touchcancel", "mousedown", "mouseup", "mousemove", "mouseenter", "mouseleave", "mouseover", "mouseout", "wheel", "gesturestart", "gesturechange", "gestureend", "keydown", "keyup", "keypress", "input", "change", "search", "invalid", "beforeinput", "select", "focusin", "focusout", "focus", "blur", "submit", "reset", "scroll" ].map((n => `on${n.toLowerCase()}$`)))();
|
|
1473
|
-
var FUNCTION_PRIORITY = (() => [ "useTask$", "useVisibleTask$", "component$", "useStyles$", "useStylesScoped$" ].map((n => n.toLowerCase())))();
|
|
1474
|
-
function sortBundleNames(manifest) {
|
|
1475
|
-
return Object.keys(manifest.bundles).sort(sortAlphabetical);
|
|
1476
|
-
}
|
|
1477
|
-
function updateSortAndPriorities(manifest) {
|
|
1478
|
-
const prioritizedSymbolNames = prioritizeSymbolNames(manifest);
|
|
1479
|
-
const prioritizedSymbols = {};
|
|
1480
|
-
const prioritizedMapping = {};
|
|
1481
|
-
for (const symbolName of prioritizedSymbolNames) {
|
|
1482
|
-
prioritizedSymbols[symbolName] = manifest.symbols[symbolName];
|
|
1483
|
-
prioritizedMapping[symbolName] = manifest.mapping[symbolName];
|
|
1484
|
-
}
|
|
1485
|
-
const sortedBundleNames = sortBundleNames(manifest);
|
|
1486
|
-
const sortedBundles = {};
|
|
1487
|
-
for (const bundleName of sortedBundleNames) {
|
|
1488
|
-
sortedBundles[bundleName] = manifest.bundles[bundleName];
|
|
1489
|
-
const bundle = manifest.bundles[bundleName];
|
|
1490
|
-
Array.isArray(bundle.imports) && bundle.imports.sort(sortAlphabetical);
|
|
1491
|
-
Array.isArray(bundle.dynamicImports) && bundle.dynamicImports.sort(sortAlphabetical);
|
|
1492
|
-
const symbols = [];
|
|
1493
|
-
for (const symbolName of prioritizedSymbolNames) {
|
|
1494
|
-
bundleName === prioritizedMapping[symbolName] && symbols.push(symbolName);
|
|
1495
|
-
}
|
|
1496
|
-
if (symbols.length > 0) {
|
|
1497
|
-
symbols.sort(sortAlphabetical);
|
|
1498
|
-
bundle.symbols = symbols;
|
|
1499
|
-
}
|
|
1500
|
-
}
|
|
1501
|
-
manifest.symbols = prioritizedSymbols;
|
|
1502
|
-
manifest.mapping = prioritizedMapping;
|
|
1503
|
-
manifest.bundles = sortedBundles;
|
|
1504
|
-
return manifest;
|
|
1505
|
-
}
|
|
1506
|
-
function sortAlphabetical(a, b) {
|
|
1507
|
-
a = a.toLocaleLowerCase();
|
|
1508
|
-
b = b.toLocaleLowerCase();
|
|
1509
|
-
if (a < b) {
|
|
1510
|
-
return -1;
|
|
1511
|
-
}
|
|
1512
|
-
if (a > b) {
|
|
1513
|
-
return 1;
|
|
1514
|
-
}
|
|
1515
|
-
return 0;
|
|
1516
|
-
}
|
|
1517
|
-
function getValidManifest(manifest) {
|
|
1518
|
-
if (null != manifest && null != manifest.mapping && "object" === typeof manifest.mapping && null != manifest.symbols && "object" === typeof manifest.symbols && null != manifest.bundles && "object" === typeof manifest.bundles) {
|
|
1519
|
-
return manifest;
|
|
1520
|
-
}
|
|
1521
|
-
return;
|
|
1522
|
-
}
|
|
1523
|
-
function generateManifestFromBundles(path, segments, injections, outputBundles, opts, debug) {
|
|
1524
|
-
const manifest = {
|
|
1525
|
-
manifestHash: "",
|
|
1526
|
-
symbols: {},
|
|
1527
|
-
mapping: {},
|
|
1528
|
-
bundles: {},
|
|
1529
|
-
injections: injections,
|
|
1530
|
-
version: "1",
|
|
1531
|
-
options: {
|
|
1532
|
-
target: opts.target,
|
|
1533
|
-
buildMode: opts.buildMode,
|
|
1534
|
-
entryStrategy: opts.entryStrategy
|
|
1535
|
-
}
|
|
1536
|
-
};
|
|
1537
|
-
const buildPath = path.resolve(opts.rootDir, opts.outDir, "build");
|
|
1538
|
-
const canonPath = p => path.relative(buildPath, path.resolve(opts.rootDir, opts.outDir, p));
|
|
1539
|
-
const getBundleName = name => {
|
|
1540
|
-
const bundle = outputBundles[name];
|
|
1541
|
-
if (!bundle) {
|
|
1542
|
-
console.warn(`Client manifest generation: skipping external import "${name}"`);
|
|
1543
|
-
return;
|
|
1544
|
-
}
|
|
1545
|
-
return canonPath(bundle.fileName);
|
|
1546
|
-
};
|
|
1547
|
-
const qrlNames = new Set(segments.map((h => h.name)));
|
|
1548
|
-
for (const symbol of extraSymbols) {
|
|
1549
|
-
qrlNames.add(symbol);
|
|
1550
|
-
}
|
|
1551
|
-
const taskNames = new Set(segments.filter((h => /use[a-zA-Z]*Task(_\d+)?$/.test(h.displayName))).map((h => h.name)));
|
|
1552
|
-
for (const outputBundle of Object.values(outputBundles)) {
|
|
1553
|
-
if ("chunk" !== outputBundle.type) {
|
|
1554
|
-
continue;
|
|
1555
|
-
}
|
|
1556
|
-
const bundleFileName = canonPath(outputBundle.fileName);
|
|
1557
|
-
const bundle = {
|
|
1558
|
-
size: outputBundle.code.length
|
|
1559
|
-
};
|
|
1560
|
-
for (const symbol of outputBundle.exports) {
|
|
1561
|
-
if (qrlNames.has(symbol) && (!manifest.mapping[symbol] || 1 !== outputBundle.exports.length)) {
|
|
1562
|
-
taskNames.has(symbol) && (bundle.isTask = true);
|
|
1563
|
-
manifest.mapping[symbol] = bundleFileName;
|
|
1564
|
-
}
|
|
1565
|
-
}
|
|
1566
|
-
const bundleImports = outputBundle.imports.filter((i => outputBundle.code.includes(path.basename(i)))).map((i => getBundleName(i))).filter(Boolean);
|
|
1567
|
-
bundleImports.length > 0 && (bundle.imports = bundleImports);
|
|
1568
|
-
const bundleDynamicImports = outputBundle.dynamicImports.filter((i => outputBundle.code.includes(path.basename(i)))).map((i => getBundleName(i))).filter(Boolean);
|
|
1569
|
-
bundleDynamicImports.length > 0 && (bundle.dynamicImports = bundleDynamicImports);
|
|
1570
|
-
const ids = outputBundle.moduleIds || Object.keys(outputBundle.modules);
|
|
1571
|
-
const modulePaths = ids.filter((m => !m.startsWith("\0"))).map((m => path.relative(opts.rootDir, m)));
|
|
1572
|
-
modulePaths.length > 0 && (bundle.origins = modulePaths);
|
|
1573
|
-
manifest.bundles[bundleFileName] = bundle;
|
|
1574
|
-
}
|
|
1575
|
-
for (const segment of segments) {
|
|
1576
|
-
const symbol = segment.name;
|
|
1577
|
-
const bundle = manifest.mapping[symbol];
|
|
1578
|
-
if (!bundle) {
|
|
1579
|
-
debug(`Note: qrl ${segment.name} is not in the bundle, likely tree shaken`, manifest);
|
|
1580
|
-
continue;
|
|
1581
|
-
}
|
|
1582
|
-
(manifest.bundles[bundle].symbols ||= []).push(symbol);
|
|
1583
|
-
manifest.symbols[symbol] = {
|
|
1584
|
-
origin: segment.origin,
|
|
1585
|
-
displayName: segment.displayName,
|
|
1586
|
-
canonicalFilename: segment.canonicalFilename,
|
|
1587
|
-
hash: segment.hash,
|
|
1588
|
-
ctxKind: segment.ctxKind,
|
|
1589
|
-
ctxName: segment.ctxName,
|
|
1590
|
-
captures: segment.captures,
|
|
1591
|
-
parent: segment.parent,
|
|
1592
|
-
loc: segment.loc
|
|
1593
|
-
};
|
|
1594
|
-
}
|
|
1595
|
-
for (const symbol of extraSymbols) {
|
|
1596
|
-
manifest.symbols[symbol] = {
|
|
1597
|
-
origin: "Qwik core",
|
|
1598
|
-
displayName: symbol,
|
|
1599
|
-
canonicalFilename: "",
|
|
1600
|
-
hash: symbol,
|
|
1601
|
-
ctxKind: "function",
|
|
1602
|
-
ctxName: symbol,
|
|
1603
|
-
captures: false,
|
|
1604
|
-
parent: null,
|
|
1605
|
-
loc: [ 0, 0 ]
|
|
1606
|
-
};
|
|
1607
|
-
}
|
|
1608
|
-
return updateSortAndPriorities(manifest);
|
|
1609
|
-
}
|
|
1610
|
-
async function createLinter(sys, rootDir, tsconfigFileNames) {
|
|
1611
|
-
const module2 = await sys.dynamicImport("eslint");
|
|
1612
|
-
let eslint = new module2.ESLint({
|
|
1613
|
-
cache: true
|
|
1614
|
-
});
|
|
1615
|
-
const eslintConfig = await eslint.calculateConfigForFile("no-real-file.tsx");
|
|
1616
|
-
const invalidEslintConfig = null === eslintConfig.parser;
|
|
1617
|
-
if (invalidEslintConfig) {
|
|
1618
|
-
const options = {
|
|
1619
|
-
cache: true,
|
|
1620
|
-
useEslintrc: false,
|
|
1621
|
-
overrideConfig: {
|
|
1622
|
-
root: true,
|
|
1623
|
-
env: {
|
|
1624
|
-
browser: true,
|
|
1625
|
-
es2021: true,
|
|
1626
|
-
node: true
|
|
1627
|
-
},
|
|
1628
|
-
extends: [ "plugin:qwik/recommended" ],
|
|
1629
|
-
parser: "@typescript-eslint/parser",
|
|
1630
|
-
parserOptions: {
|
|
1631
|
-
tsconfigRootDir: rootDir,
|
|
1632
|
-
project: tsconfigFileNames,
|
|
1633
|
-
ecmaVersion: 2021,
|
|
1634
|
-
sourceType: "module",
|
|
1635
|
-
ecmaFeatures: {
|
|
1636
|
-
jsx: true
|
|
1637
|
-
}
|
|
1638
|
-
}
|
|
1639
|
-
}
|
|
1640
|
-
};
|
|
1641
|
-
eslint = new module2.ESLint(options);
|
|
1642
|
-
}
|
|
1643
|
-
return {
|
|
1644
|
-
async lint(ctx, code, id) {
|
|
1645
|
-
try {
|
|
1646
|
-
const filePath = parseRequest(id);
|
|
1647
|
-
if (await eslint.isPathIgnored(filePath)) {
|
|
1648
|
-
return null;
|
|
1649
|
-
}
|
|
1650
|
-
const report = await eslint.lintText(code, {
|
|
1651
|
-
filePath: filePath
|
|
1652
|
-
});
|
|
1653
|
-
report.forEach((file => {
|
|
1654
|
-
for (const message of file.messages) {
|
|
1655
|
-
if (null != message.ruleId && !message.ruleId.startsWith("qwik/")) {
|
|
1656
|
-
continue;
|
|
1657
|
-
}
|
|
1658
|
-
const err = createRollupError(file.filePath, message);
|
|
1659
|
-
ctx.warn(err);
|
|
1660
|
-
}
|
|
1661
|
-
}));
|
|
1662
|
-
} catch (err) {
|
|
1663
|
-
console.warn(err);
|
|
1664
|
-
}
|
|
1665
|
-
}
|
|
1666
|
-
};
|
|
1667
|
-
}
|
|
1668
|
-
function parseRequest(id) {
|
|
1669
|
-
return id.split("?", 2)[0];
|
|
1670
|
-
}
|
|
1671
|
-
function createRollupError(id, reportMessage) {
|
|
1672
|
-
const err = Object.assign(new Error(reportMessage.message), {
|
|
1673
|
-
id: id,
|
|
1674
|
-
plugin: "vite-plugin-eslint",
|
|
1675
|
-
loc: {
|
|
1676
|
-
file: id,
|
|
1677
|
-
column: reportMessage.column,
|
|
1678
|
-
line: reportMessage.line
|
|
1679
|
-
},
|
|
1680
|
-
stack: ""
|
|
1681
|
-
});
|
|
1682
|
-
return err;
|
|
1683
|
-
}
|
|
1684
|
-
async function formatError(sys, e) {
|
|
1685
|
-
const err = e;
|
|
1686
|
-
let loc = err.loc;
|
|
1687
|
-
if (!err.frame && !err.plugin) {
|
|
1688
|
-
loc || (loc = findLocation(err));
|
|
1689
|
-
if (loc) {
|
|
1690
|
-
err.loc = loc;
|
|
1691
|
-
if (loc.file) {
|
|
1692
|
-
const fs = await sys.dynamicImport("node:fs");
|
|
1693
|
-
const {normalizePath: normalizePath} = await sys.dynamicImport("vite");
|
|
1694
|
-
err.id = normalizePath(err.loc.file);
|
|
1695
|
-
try {
|
|
1696
|
-
const code = fs.readFileSync(err.loc.file, "utf-8");
|
|
1697
|
-
err.frame = generateCodeFrame(code, err.loc);
|
|
1698
|
-
} catch {}
|
|
1699
|
-
}
|
|
1700
|
-
}
|
|
1701
|
-
}
|
|
1702
|
-
return e;
|
|
1703
|
-
}
|
|
1704
|
-
var findLocation = e => {
|
|
1705
|
-
const stack = e.stack;
|
|
1706
|
-
if ("string" === typeof stack) {
|
|
1707
|
-
const lines = stack.split("\n").filter((l => !l.includes("/node_modules/") && !l.includes("(node:")));
|
|
1708
|
-
for (let i = 1; i < lines.length; i++) {
|
|
1709
|
-
const line = lines[i].replace("file:///", "/");
|
|
1710
|
-
if (/^\s+at/.test(line)) {
|
|
1711
|
-
const start = line.indexOf("/");
|
|
1712
|
-
const end = line.lastIndexOf(")", start);
|
|
1713
|
-
if (start > 0) {
|
|
1714
|
-
const path = line.slice(start, end);
|
|
1715
|
-
const parts = path.split(":");
|
|
1716
|
-
const nu0 = safeParseInt(parts[parts.length - 1]);
|
|
1717
|
-
const nu1 = safeParseInt(parts[parts.length - 2]);
|
|
1718
|
-
if ("number" === typeof nu0 && "number" === typeof nu1) {
|
|
1719
|
-
parts.length -= 2;
|
|
1720
|
-
return {
|
|
1721
|
-
file: parts.join(":"),
|
|
1722
|
-
line: nu1,
|
|
1723
|
-
column: nu0
|
|
1724
|
-
};
|
|
1725
|
-
}
|
|
1726
|
-
if ("number" === typeof nu0) {
|
|
1727
|
-
parts.length -= 1;
|
|
1728
|
-
return {
|
|
1729
|
-
file: parts.join(":"),
|
|
1730
|
-
line: nu0,
|
|
1731
|
-
column: void 0
|
|
1732
|
-
};
|
|
1733
|
-
}
|
|
1734
|
-
return {
|
|
1735
|
-
file: parts.join(":"),
|
|
1736
|
-
line: void 0,
|
|
1737
|
-
column: void 0
|
|
1738
|
-
};
|
|
1739
|
-
}
|
|
1740
|
-
}
|
|
1741
|
-
}
|
|
1742
|
-
}
|
|
1743
|
-
return;
|
|
1744
|
-
};
|
|
1745
|
-
var safeParseInt = nu => {
|
|
1746
|
-
try {
|
|
1747
|
-
return parseInt(nu, 10);
|
|
1748
|
-
} catch {
|
|
1749
|
-
return;
|
|
1750
|
-
}
|
|
1751
|
-
};
|
|
1752
|
-
var splitRE = /\r?\n/;
|
|
1753
|
-
var range = 2;
|
|
1754
|
-
function posToNumber(source, pos) {
|
|
1755
|
-
if ("number" === typeof pos) {
|
|
1756
|
-
return pos;
|
|
1757
|
-
}
|
|
1758
|
-
if (null != pos.lo) {
|
|
1759
|
-
return pos.lo;
|
|
1760
|
-
}
|
|
1761
|
-
const lines = source.split(splitRE);
|
|
1762
|
-
const {line: line, column: column} = pos;
|
|
1763
|
-
let start = 0;
|
|
1764
|
-
for (let i = 0; i < line - 1 && i < lines.length; i++) {
|
|
1765
|
-
start += lines[i].length + 1;
|
|
1766
|
-
}
|
|
1767
|
-
return start + column;
|
|
1768
|
-
}
|
|
1769
|
-
function generateCodeFrame(source, start = 0, end) {
|
|
1770
|
-
start = posToNumber(source, start);
|
|
1771
|
-
end = end || start;
|
|
1772
|
-
const lines = source.split(splitRE);
|
|
1773
|
-
let count = 0;
|
|
1774
|
-
const res = [];
|
|
1775
|
-
for (let i = 0; i < lines.length; i++) {
|
|
1776
|
-
count += lines[i].length + 1;
|
|
1777
|
-
if (count >= start) {
|
|
1778
|
-
for (let j = i - range; j <= i + range || end > count; j++) {
|
|
1779
|
-
if (j < 0 || j >= lines.length) {
|
|
1780
|
-
continue;
|
|
1781
|
-
}
|
|
1782
|
-
const line = j + 1;
|
|
1783
|
-
res.push(`${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`);
|
|
1784
|
-
const lineLength = lines[j].length;
|
|
1785
|
-
if (j === i) {
|
|
1786
|
-
const pad = Math.max(start - (count - lineLength) + 1, 0);
|
|
1787
|
-
const length = Math.max(1, end > count ? lineLength - pad : end - start);
|
|
1788
|
-
res.push(" | " + " ".repeat(pad) + "^".repeat(length));
|
|
1789
|
-
} else if (j > i) {
|
|
1790
|
-
if (end > count) {
|
|
1791
|
-
const length = Math.max(Math.min(end - count, lineLength), 1);
|
|
1792
|
-
res.push(" | " + "^".repeat(length));
|
|
1793
|
-
}
|
|
1794
|
-
count += lineLength + 1;
|
|
1795
|
-
}
|
|
1796
|
-
}
|
|
1797
|
-
break;
|
|
1798
|
-
}
|
|
1799
|
-
}
|
|
1800
|
-
return res.join("\n");
|
|
1801
|
-
}
|
|
1802
|
-
function isWin(os) {
|
|
1803
|
-
return "win32" === os;
|
|
1804
|
-
}
|
|
1805
|
-
var REG_CTX_NAME = [ "server" ];
|
|
1806
|
-
var SERVER_STRIP_EXPORTS = [ "onGet", "onPost", "onPut", "onRequest", "onDelete", "onHead", "onOptions", "onPatch", "onStaticGenerate" ];
|
|
1807
|
-
var SERVER_STRIP_CTX_NAME = [ "useServer", "route", "server", "action$", "loader$", "zod$", "validator$", "globalAction$" ];
|
|
1808
|
-
var CLIENT_STRIP_CTX_NAME = [ "useClient", "useBrowser", "useVisibleTask", "client", "browser", "event$" ];
|
|
1809
|
-
var ExperimentalFeatures = (ExperimentalFeatures2 => {
|
|
1810
|
-
ExperimentalFeatures2.preventNavigate = "preventNavigate";
|
|
1811
|
-
ExperimentalFeatures2.valibot = "valibot";
|
|
1812
|
-
ExperimentalFeatures2.noSPA = "noSPA";
|
|
1813
|
-
ExperimentalFeatures2.webWorker = "webWorker";
|
|
1814
|
-
ExperimentalFeatures2.insights = "insights";
|
|
1815
|
-
return ExperimentalFeatures2;
|
|
1816
|
-
})(ExperimentalFeatures || {});
|
|
1817
|
-
function createQwikPlugin(optimizerOptions = {}) {
|
|
1818
|
-
const id = `${Math.round(899 * Math.random()) + 100}`;
|
|
1819
|
-
const clientResults = new Map;
|
|
1820
|
-
const clientTransformedOutputs = new Map;
|
|
1821
|
-
const serverTransformedOutputs = new Map;
|
|
1822
|
-
const parentIds = new Map;
|
|
1823
|
-
const npmChunks = new Map;
|
|
1824
|
-
let internalOptimizer = null;
|
|
1825
|
-
let linter;
|
|
1826
|
-
let diagnosticsCallback = () => {};
|
|
1827
|
-
const opts = {
|
|
1828
|
-
csr: false,
|
|
1829
|
-
target: "client",
|
|
1830
|
-
buildMode: "development",
|
|
1831
|
-
debug: false,
|
|
1832
|
-
rootDir: null,
|
|
1833
|
-
tsconfigFileNames: [ "./tsconfig.json" ],
|
|
1834
|
-
input: null,
|
|
1835
|
-
outDir: "",
|
|
1836
|
-
assetsDir: null,
|
|
1837
|
-
resolveQwikBuild: true,
|
|
1838
|
-
entryStrategy: null,
|
|
1839
|
-
srcDir: null,
|
|
1840
|
-
srcInputs: null,
|
|
1841
|
-
sourcemap: !!optimizerOptions.sourcemap,
|
|
1842
|
-
manifestInput: null,
|
|
1843
|
-
insightsManifest: null,
|
|
1844
|
-
manifestOutput: null,
|
|
1845
|
-
transformedModuleOutput: null,
|
|
1846
|
-
scope: null,
|
|
1847
|
-
devTools: {
|
|
1848
|
-
imageDevTools: true,
|
|
1849
|
-
clickToSource: [ "Alt" ]
|
|
1850
|
-
},
|
|
1851
|
-
inlineStylesUpToBytes: null,
|
|
1852
|
-
lint: true,
|
|
1853
|
-
experimental: void 0
|
|
1854
|
-
};
|
|
1855
|
-
let lazyNormalizePath;
|
|
1856
|
-
const init2 = async () => {
|
|
1857
|
-
if (!internalOptimizer) {
|
|
1858
|
-
internalOptimizer = await createOptimizer(optimizerOptions);
|
|
1859
|
-
lazyNormalizePath = makeNormalizePath(internalOptimizer.sys);
|
|
1860
|
-
}
|
|
1861
|
-
};
|
|
1862
|
-
const getOptimizer = () => {
|
|
1863
|
-
if (!internalOptimizer) {
|
|
1864
|
-
throw new Error("Qwik plugin has not been initialized");
|
|
1865
|
-
}
|
|
1866
|
-
return internalOptimizer;
|
|
1867
|
-
};
|
|
1868
|
-
const getSys = () => {
|
|
1869
|
-
const optimizer2 = getOptimizer();
|
|
1870
|
-
return optimizer2.sys;
|
|
1871
|
-
};
|
|
1872
|
-
const getPath = () => {
|
|
1873
|
-
const optimizer2 = getOptimizer();
|
|
1874
|
-
return optimizer2.sys.path;
|
|
1875
|
-
};
|
|
1876
|
-
let devServer;
|
|
1877
|
-
const configureServer = server => {
|
|
1878
|
-
devServer = server;
|
|
1879
|
-
};
|
|
1880
|
-
const normalizeOptions = inputOpts => {
|
|
1881
|
-
const updatedOpts = Object.assign({}, inputOpts);
|
|
1882
|
-
const optimizer2 = getOptimizer();
|
|
1883
|
-
const path = optimizer2.sys.path;
|
|
1884
|
-
opts.debug = !!updatedOpts.debug;
|
|
1885
|
-
updatedOpts.assetsDir && (opts.assetsDir = updatedOpts.assetsDir);
|
|
1886
|
-
"ssr" === updatedOpts.target || "client" === updatedOpts.target || "lib" === updatedOpts.target || "test" === updatedOpts.target ? opts.target = updatedOpts.target : opts.target = "client";
|
|
1887
|
-
"lib" === opts.target ? opts.buildMode = "development" : "production" === updatedOpts.buildMode || "development" === updatedOpts.buildMode ? opts.buildMode = updatedOpts.buildMode : opts.buildMode = "development";
|
|
1888
|
-
updatedOpts.entryStrategy && "object" === typeof updatedOpts.entryStrategy && (opts.entryStrategy = {
|
|
1889
|
-
...updatedOpts.entryStrategy
|
|
1890
|
-
});
|
|
1891
|
-
opts.entryStrategy || ("ssr" === opts.target || "test" === opts.target ? opts.entryStrategy = {
|
|
1892
|
-
type: "hoist"
|
|
1893
|
-
} : "lib" === opts.target ? opts.entryStrategy = {
|
|
1894
|
-
type: "inline"
|
|
1895
|
-
} : "production" === opts.buildMode ? opts.entryStrategy = {
|
|
1896
|
-
type: "smart"
|
|
1897
|
-
} : opts.entryStrategy = {
|
|
1898
|
-
type: "segment"
|
|
1899
|
-
});
|
|
1900
|
-
"string" === typeof updatedOpts.rootDir && (opts.rootDir = updatedOpts.rootDir);
|
|
1901
|
-
"string" !== typeof opts.rootDir && (opts.rootDir = optimizer2.sys.cwd());
|
|
1902
|
-
opts.rootDir = normalizePath(path.resolve(optimizer2.sys.cwd(), opts.rootDir));
|
|
1903
|
-
let srcDir = normalizePath(path.resolve(opts.rootDir, SRC_DIR_DEFAULT));
|
|
1904
|
-
if ("string" === typeof updatedOpts.srcDir) {
|
|
1905
|
-
opts.srcDir = normalizePath(path.resolve(opts.rootDir, updatedOpts.srcDir));
|
|
1906
|
-
srcDir = opts.srcDir;
|
|
1907
|
-
opts.srcInputs = null;
|
|
1908
|
-
} else if (Array.isArray(updatedOpts.srcInputs)) {
|
|
1909
|
-
opts.srcInputs = [ ...updatedOpts.srcInputs ];
|
|
1910
|
-
opts.srcDir = null;
|
|
1911
|
-
} else {
|
|
1912
|
-
opts.srcDir = srcDir;
|
|
1913
|
-
}
|
|
1914
|
-
Array.isArray(updatedOpts.tsconfigFileNames) && updatedOpts.tsconfigFileNames.length > 0 && (opts.tsconfigFileNames = updatedOpts.tsconfigFileNames);
|
|
1915
|
-
Array.isArray(opts.srcInputs) ? opts.srcInputs.forEach((i => {
|
|
1916
|
-
i.path = normalizePath(path.resolve(opts.rootDir, i.path));
|
|
1917
|
-
})) : "string" === typeof opts.srcDir && (opts.srcDir = normalizePath(path.resolve(opts.rootDir, normalizePath(opts.srcDir))));
|
|
1918
|
-
if (!updatedOpts.csr) {
|
|
1919
|
-
if (Array.isArray(updatedOpts.input)) {
|
|
1920
|
-
opts.input = [ ...updatedOpts.input ];
|
|
1921
|
-
} else if ("string" === typeof updatedOpts.input) {
|
|
1922
|
-
opts.input = [ updatedOpts.input ];
|
|
1923
|
-
} else if ("ssr" === opts.target) {
|
|
1924
|
-
opts.input = [ path.resolve(srcDir, "entry.ssr") ];
|
|
1925
|
-
} else if ("client" === opts.target) {
|
|
1926
|
-
opts.input = [ path.resolve(srcDir, "root") ];
|
|
1927
|
-
} else if ("lib" === opts.target) {
|
|
1928
|
-
if ("object" === typeof updatedOpts.input) {
|
|
1929
|
-
for (const key in updatedOpts.input) {
|
|
1930
|
-
const resolvedPaths = {};
|
|
1931
|
-
if (Object.hasOwnProperty.call(updatedOpts.input, key)) {
|
|
1932
|
-
const relativePath = updatedOpts.input[key];
|
|
1933
|
-
const absolutePath = path.resolve(opts.rootDir, relativePath);
|
|
1934
|
-
resolvedPaths[key] = absolutePath;
|
|
1935
|
-
}
|
|
1936
|
-
opts.input = {
|
|
1937
|
-
...opts.input,
|
|
1938
|
-
...resolvedPaths
|
|
1939
|
-
};
|
|
1940
|
-
}
|
|
1941
|
-
} else {
|
|
1942
|
-
opts.input = [ path.resolve(srcDir, "index.ts") ];
|
|
1943
|
-
}
|
|
1944
|
-
} else {
|
|
1945
|
-
opts.input = [];
|
|
1946
|
-
}
|
|
1947
|
-
opts.input = Array.isArray(opts.input) ? opts.input.reduce(((inputs, i) => {
|
|
1948
|
-
let input = i;
|
|
1949
|
-
i.startsWith("@") || i.startsWith("~") || i.startsWith("#") || (input = normalizePath(path.resolve(opts.rootDir, i)));
|
|
1950
|
-
inputs.includes(input) || inputs.push(input);
|
|
1951
|
-
return inputs;
|
|
1952
|
-
}), []) : opts.input;
|
|
1953
|
-
"string" === typeof updatedOpts.outDir ? opts.outDir = normalizePath(path.resolve(opts.rootDir, normalizePath(updatedOpts.outDir))) : "ssr" === opts.target ? opts.outDir = normalizePath(path.resolve(opts.rootDir, SSR_OUT_DIR)) : "lib" === opts.target ? opts.outDir = normalizePath(path.resolve(opts.rootDir, LIB_OUT_DIR)) : opts.outDir = normalizePath(path.resolve(opts.rootDir, CLIENT_OUT_DIR));
|
|
1954
|
-
}
|
|
1955
|
-
"function" === typeof updatedOpts.manifestOutput && (opts.manifestOutput = updatedOpts.manifestOutput);
|
|
1956
|
-
const clientManifest = getValidManifest(updatedOpts.manifestInput);
|
|
1957
|
-
clientManifest && (opts.manifestInput = clientManifest);
|
|
1958
|
-
"function" === typeof updatedOpts.transformedModuleOutput && (opts.transformedModuleOutput = updatedOpts.transformedModuleOutput);
|
|
1959
|
-
opts.scope = updatedOpts.scope ?? null;
|
|
1960
|
-
"boolean" === typeof updatedOpts.resolveQwikBuild && (opts.resolveQwikBuild = updatedOpts.resolveQwikBuild);
|
|
1961
|
-
if ("object" === typeof updatedOpts.devTools) {
|
|
1962
|
-
"imageDevTools" in updatedOpts.devTools && (opts.devTools.imageDevTools = updatedOpts.devTools.imageDevTools);
|
|
1963
|
-
"clickToSource" in updatedOpts.devTools && (opts.devTools.clickToSource = updatedOpts.devTools.clickToSource);
|
|
1964
|
-
}
|
|
1965
|
-
opts.csr = !!updatedOpts.csr;
|
|
1966
|
-
opts.inlineStylesUpToBytes = optimizerOptions.inlineStylesUpToBytes ?? 2e4;
|
|
1967
|
-
("number" !== typeof opts.inlineStylesUpToBytes || opts.inlineStylesUpToBytes < 0) && (opts.inlineStylesUpToBytes = 0);
|
|
1968
|
-
"boolean" === typeof updatedOpts.lint ? opts.lint = updatedOpts.lint : opts.lint = "development" === updatedOpts.buildMode;
|
|
1969
|
-
opts.experimental = void 0;
|
|
1970
|
-
for (const feature of updatedOpts.experimental ?? []) {
|
|
1971
|
-
ExperimentalFeatures[feature] ? (opts.experimental ||= {})[feature] = true : console.error(`Qwik plugin: Unknown experimental feature: ${feature}`);
|
|
1972
|
-
}
|
|
1973
|
-
return {
|
|
1974
|
-
...opts
|
|
1975
|
-
};
|
|
1976
|
-
};
|
|
1977
|
-
let hasValidatedSource = false;
|
|
1978
|
-
const validateSource = async resolver => {
|
|
1979
|
-
if (!hasValidatedSource) {
|
|
1980
|
-
hasValidatedSource = true;
|
|
1981
|
-
const sys = getSys();
|
|
1982
|
-
if ("node" === sys.env) {
|
|
1983
|
-
const fs = await sys.dynamicImport("node:fs");
|
|
1984
|
-
if (!fs.existsSync(opts.rootDir)) {
|
|
1985
|
-
throw new Error(`Qwik rootDir "${opts.rootDir}" not found.`);
|
|
1986
|
-
}
|
|
1987
|
-
if ("string" === typeof opts.srcDir && !fs.existsSync(opts.srcDir)) {
|
|
1988
|
-
throw new Error(`Qwik srcDir "${opts.srcDir}" not found.`);
|
|
1989
|
-
}
|
|
1990
|
-
for (const [_, input] of Object.entries(opts.input || {})) {
|
|
1991
|
-
const resolved = await resolver(input);
|
|
1992
|
-
if (!resolved) {
|
|
1993
|
-
throw new Error(`Qwik input "${input}" not found.`);
|
|
1994
|
-
}
|
|
1995
|
-
}
|
|
1996
|
-
}
|
|
1997
|
-
}
|
|
1998
|
-
};
|
|
1999
|
-
let optimizer;
|
|
2000
|
-
let shouldAddHandlers = false;
|
|
2001
|
-
const buildStart = async _ctx => {
|
|
2002
|
-
debug("buildStart()", opts.buildMode, opts.scope, opts.target, opts.rootDir, opts.srcDir);
|
|
2003
|
-
optimizer = getOptimizer();
|
|
2004
|
-
shouldAddHandlers = !devServer;
|
|
2005
|
-
if ("node" === optimizer.sys.env && "ssr" === opts.target && opts.lint) {
|
|
2006
|
-
try {
|
|
2007
|
-
linter = await createLinter(optimizer.sys, opts.rootDir, opts.tsconfigFileNames);
|
|
2008
|
-
} catch {}
|
|
2009
|
-
}
|
|
2010
|
-
const path = getPath();
|
|
2011
|
-
if (Array.isArray(opts.srcInputs)) {
|
|
2012
|
-
optimizer.sys.getInputFiles = async rootDir => opts.srcInputs.map((i => {
|
|
2013
|
-
const relInput = {
|
|
2014
|
-
path: normalizePath(path.relative(rootDir, i.path)),
|
|
2015
|
-
code: i.code
|
|
2016
|
-
};
|
|
2017
|
-
return relInput;
|
|
2018
|
-
}));
|
|
2019
|
-
debug(`buildStart() opts.srcInputs (${opts.srcInputs.length} files)`);
|
|
2020
|
-
}
|
|
2021
|
-
debug("transformedOutputs.clear()");
|
|
2022
|
-
clientTransformedOutputs.clear();
|
|
2023
|
-
serverTransformedOutputs.clear();
|
|
2024
|
-
npmChunks.clear();
|
|
2025
|
-
};
|
|
2026
|
-
const getIsServer = viteOpts => devServer ? !!(null == viteOpts ? void 0 : viteOpts.ssr) : "ssr" === opts.target || "test" === opts.target;
|
|
2027
|
-
let resolveIdCount = 0;
|
|
2028
|
-
const resolveId = async (ctx, id2, importerId, resolveOpts) => {
|
|
2029
|
-
var _a;
|
|
2030
|
-
if (id2.startsWith("\0")) {
|
|
2031
|
-
return;
|
|
2032
|
-
}
|
|
2033
|
-
const count = resolveIdCount++;
|
|
2034
|
-
const isServer = getIsServer(resolveOpts);
|
|
2035
|
-
debug(`resolveId(${count})`, `begin ${id2} | ${isServer ? "server" : "client"} | ${importerId}`);
|
|
2036
|
-
const parsedImporterId = importerId && parseId(importerId);
|
|
2037
|
-
importerId = parsedImporterId && normalizePath(parsedImporterId.pathId);
|
|
2038
|
-
if (id2.startsWith(".") && parsedImporterId) {
|
|
2039
|
-
const path = getPath();
|
|
2040
|
-
const importerDir = path.dirname(parsedImporterId.pathId);
|
|
2041
|
-
importerDir && (id2 = path.resolve(importerDir, id2));
|
|
2042
|
-
}
|
|
2043
|
-
const parsedId = parseId(id2);
|
|
2044
|
-
const pathId = normalizePath(parsedId.pathId);
|
|
2045
|
-
let result;
|
|
2046
|
-
if (parentIds.get(pathId)) {
|
|
2047
|
-
debug(`resolveId(${count}) Resolved already known ${pathId}`);
|
|
2048
|
-
result = {
|
|
2049
|
-
id: pathId + parsedId.query,
|
|
2050
|
-
moduleSideEffects: false
|
|
2051
|
-
};
|
|
2052
|
-
} else if (pathId.endsWith(QWIK_BUILD_ID)) {
|
|
2053
|
-
if (opts.resolveQwikBuild) {
|
|
2054
|
-
debug(`resolveId(${count})`, "Resolved", QWIK_BUILD_ID);
|
|
2055
|
-
result = {
|
|
2056
|
-
id: QWIK_BUILD_ID,
|
|
2057
|
-
moduleSideEffects: false
|
|
2058
|
-
};
|
|
2059
|
-
}
|
|
2060
|
-
} else if (pathId.endsWith(QWIK_CLIENT_MANIFEST_ID)) {
|
|
2061
|
-
debug(`resolveId(${count})`, "Resolved", QWIK_CLIENT_MANIFEST_ID);
|
|
2062
|
-
result = {
|
|
2063
|
-
id: QWIK_CLIENT_MANIFEST_ID,
|
|
2064
|
-
moduleSideEffects: false
|
|
2065
|
-
};
|
|
2066
|
-
} else if (pathId.endsWith(QWIK_HANDLERS_ID)) {
|
|
2067
|
-
debug(`resolveId(${count})`, "Resolved", QWIK_HANDLERS_ID);
|
|
2068
|
-
result = {
|
|
2069
|
-
id: QWIK_HANDLERS_ID,
|
|
2070
|
-
moduleSideEffects: false
|
|
2071
|
-
};
|
|
2072
|
-
} else {
|
|
2073
|
-
if (!isServer && shouldAddHandlers && id2.endsWith("@qwik.dev/core")) {
|
|
2074
|
-
shouldAddHandlers = false;
|
|
2075
|
-
const key = await ctx.resolve("@qwik.dev/core/handlers.mjs", importerId, {
|
|
2076
|
-
skipSelf: true
|
|
2077
|
-
});
|
|
2078
|
-
if (!key) {
|
|
2079
|
-
throw new Error("Failed to resolve @qwik.dev/core/handlers.mjs");
|
|
2080
|
-
}
|
|
2081
|
-
ctx.emitFile({
|
|
2082
|
-
id: key.id,
|
|
2083
|
-
type: "chunk",
|
|
2084
|
-
preserveSignature: "allow-extension"
|
|
2085
|
-
});
|
|
2086
|
-
}
|
|
2087
|
-
const qrlMatch = null == (_a = /^(?<parent>.*\.[mc]?[jt]sx?)_(?<name>[^/]+)\.js(?<query>$|\?.*$)/.exec(id2)) ? void 0 : _a.groups;
|
|
2088
|
-
if (qrlMatch) {
|
|
2089
|
-
const {parent: parent, name: name, query: query} = qrlMatch;
|
|
2090
|
-
const resolvedParent = await ctx.resolve(parent, importerId, {
|
|
2091
|
-
skipSelf: true
|
|
2092
|
-
});
|
|
2093
|
-
if (resolvedParent) {
|
|
2094
|
-
const parentId = resolvedParent.id.split("?")[0];
|
|
2095
|
-
const isDevUrl = devServer && (null == importerId ? void 0 : importerId.endsWith(".html"));
|
|
2096
|
-
const resolvedId = isDevUrl ? `${parentId}_${name}.js` : pathId;
|
|
2097
|
-
debug(`resolveId(${count})`, `resolved to QRL ${name} of ${parentId}`);
|
|
2098
|
-
parentIds.set(resolvedId, parentId);
|
|
2099
|
-
result = {
|
|
2100
|
-
id: resolvedId + query,
|
|
2101
|
-
moduleSideEffects: false
|
|
2102
|
-
};
|
|
2103
|
-
} else {
|
|
2104
|
-
console.error(`resolveId(${count})`, `QRL parent ${parent} does not exist!`);
|
|
2105
|
-
}
|
|
2106
|
-
} else if (importerId) {
|
|
2107
|
-
const importerParentId = parentIds.get(importerId);
|
|
2108
|
-
if (importerParentId) {
|
|
2109
|
-
debug(`resolveId(${count}) end`, `resolving via ${importerParentId}`);
|
|
2110
|
-
return ctx.resolve(id2, importerParentId, {
|
|
2111
|
-
skipSelf: true
|
|
2112
|
-
});
|
|
2113
|
-
}
|
|
2114
|
-
}
|
|
2115
|
-
}
|
|
2116
|
-
debug(`resolveId(${count}) end`, (null == result ? void 0 : result.id) || result);
|
|
2117
|
-
return result;
|
|
2118
|
-
};
|
|
2119
|
-
let loadCount = 0;
|
|
2120
|
-
const load = async (ctx, id2, loadOpts) => {
|
|
2121
|
-
if (id2.startsWith("\0") || id2.startsWith("/@fs/")) {
|
|
2122
|
-
return;
|
|
2123
|
-
}
|
|
2124
|
-
const count = loadCount++;
|
|
2125
|
-
const isServer = getIsServer(loadOpts);
|
|
2126
|
-
if (opts.resolveQwikBuild && id2 === QWIK_BUILD_ID) {
|
|
2127
|
-
debug(`load(${count})`, QWIK_BUILD_ID, opts.buildMode);
|
|
2128
|
-
return {
|
|
2129
|
-
moduleSideEffects: false,
|
|
2130
|
-
code: getQwikBuildModule(isServer, opts.target)
|
|
2131
|
-
};
|
|
2132
|
-
}
|
|
2133
|
-
if (id2 === QWIK_CLIENT_MANIFEST_ID) {
|
|
2134
|
-
debug(`load(${count})`, QWIK_CLIENT_MANIFEST_ID, opts.buildMode);
|
|
2135
|
-
return {
|
|
2136
|
-
moduleSideEffects: false,
|
|
2137
|
-
code: await getQwikServerManifestModule(isServer)
|
|
2138
|
-
};
|
|
2139
|
-
}
|
|
2140
|
-
if (id2 === QWIK_HANDLERS_ID) {
|
|
2141
|
-
debug(`load(${count})`, QWIK_HANDLERS_ID, opts.buildMode);
|
|
2142
|
-
return {
|
|
2143
|
-
moduleSideEffects: false,
|
|
2144
|
-
code: "export * from '@qwik.dev/core';"
|
|
2145
|
-
};
|
|
2146
|
-
}
|
|
2147
|
-
const parsedId = parseId(id2);
|
|
2148
|
-
id2 = normalizePath(parsedId.pathId);
|
|
2149
|
-
const outputs = isServer ? serverTransformedOutputs : clientTransformedOutputs;
|
|
2150
|
-
if (devServer && !outputs.has(id2)) {
|
|
2151
|
-
const parentId = parentIds.get(id2);
|
|
2152
|
-
if (parentId) {
|
|
2153
|
-
const parentModule = devServer.moduleGraph.getModuleById(parentId);
|
|
2154
|
-
if (parentModule) {
|
|
2155
|
-
debug(`load(${count})`, "transforming QRL parent", parentId);
|
|
2156
|
-
await devServer.transformRequest(parentModule.url);
|
|
2157
|
-
if (!outputs.has(id2)) {
|
|
2158
|
-
debug(`load(${count})`, `QRL segment ${id2} not found in ${parentId}`);
|
|
2159
|
-
return null;
|
|
2160
|
-
}
|
|
2161
|
-
} else {
|
|
2162
|
-
console.error(`load(${count})`, `${parentModule} does not exist!`);
|
|
2163
|
-
}
|
|
2164
|
-
}
|
|
2165
|
-
}
|
|
2166
|
-
const transformedModule = outputs.get(id2);
|
|
2167
|
-
if (transformedModule) {
|
|
2168
|
-
debug(`load(${count})`, "Found", id2);
|
|
2169
|
-
const {code: code, map: map, segment: segment} = transformedModule[0];
|
|
2170
|
-
return {
|
|
2171
|
-
code: code,
|
|
2172
|
-
map: map,
|
|
2173
|
-
meta: {
|
|
2174
|
-
segment: segment
|
|
2175
|
-
}
|
|
2176
|
-
};
|
|
2177
|
-
}
|
|
2178
|
-
debug(`load(${count})`, "Not a QRL or virtual module", id2);
|
|
2179
|
-
return null;
|
|
2180
|
-
};
|
|
2181
|
-
let transformCount = 0;
|
|
2182
|
-
const transform = async function(ctx, code, id2, transformOpts = {}) {
|
|
2183
|
-
var _a;
|
|
2184
|
-
if (id2.startsWith("\0")) {
|
|
2185
|
-
return;
|
|
2186
|
-
}
|
|
2187
|
-
const count = transformCount++;
|
|
2188
|
-
const isServer = getIsServer(transformOpts);
|
|
2189
|
-
const currentOutputs = isServer ? serverTransformedOutputs : clientTransformedOutputs;
|
|
2190
|
-
if (currentOutputs.has(id2)) {
|
|
2191
|
-
return;
|
|
2192
|
-
}
|
|
2193
|
-
const optimizer2 = getOptimizer();
|
|
2194
|
-
const path = getPath();
|
|
2195
|
-
const {pathId: pathId} = parseId(id2);
|
|
2196
|
-
const parsedPathId = path.parse(pathId);
|
|
2197
|
-
const dir = parsedPathId.dir;
|
|
2198
|
-
const base = parsedPathId.base;
|
|
2199
|
-
const ext = parsedPathId.ext.toLowerCase();
|
|
2200
|
-
if (ext in TRANSFORM_EXTS || TRANSFORM_REGEX.test(pathId)) {
|
|
2201
|
-
const strip = "client" === opts.target || "ssr" === opts.target;
|
|
2202
|
-
debug(`transform(${count})`, `Transforming ${id2} (for: ${isServer ? "server" : "client"}${strip ? ", strip" : ""})`);
|
|
2203
|
-
const mode = "lib" === opts.target ? "lib" : "development" === opts.buildMode ? "dev" : "prod";
|
|
2204
|
-
"lib" !== mode && (code = code.replaceAll(/__EXPERIMENTAL__\.(\w+)/g, ((_, feature) => {
|
|
2205
|
-
var _a2;
|
|
2206
|
-
if (null == (_a2 = opts.experimental) ? void 0 : _a2[feature]) {
|
|
2207
|
-
return "true";
|
|
2208
|
-
}
|
|
2209
|
-
return "false";
|
|
2210
|
-
})));
|
|
2211
|
-
let filePath = base;
|
|
2212
|
-
opts.srcDir && (filePath = path.relative(opts.srcDir, pathId));
|
|
2213
|
-
filePath = normalizePath(filePath);
|
|
2214
|
-
const srcDir = opts.srcDir ? opts.srcDir : normalizePath(dir);
|
|
2215
|
-
const entryStrategy = opts.entryStrategy;
|
|
2216
|
-
let devPath;
|
|
2217
|
-
devServer && (devPath = null == (_a = devServer.moduleGraph.getModuleById(pathId)) ? void 0 : _a.url);
|
|
2218
|
-
const transformOpts2 = {
|
|
2219
|
-
input: [ {
|
|
2220
|
-
code: code,
|
|
2221
|
-
path: filePath,
|
|
2222
|
-
devPath: devPath
|
|
2223
|
-
} ],
|
|
2224
|
-
entryStrategy: isServer ? {
|
|
2225
|
-
type: "hoist"
|
|
2226
|
-
} : entryStrategy,
|
|
2227
|
-
minify: "simplify",
|
|
2228
|
-
sourceMaps: opts.sourcemap || "development" === opts.buildMode,
|
|
2229
|
-
transpileTs: true,
|
|
2230
|
-
transpileJsx: true,
|
|
2231
|
-
explicitExtensions: true,
|
|
2232
|
-
preserveFilenames: true,
|
|
2233
|
-
srcDir: srcDir,
|
|
2234
|
-
rootDir: opts.rootDir,
|
|
2235
|
-
mode: mode,
|
|
2236
|
-
scope: opts.scope || void 0,
|
|
2237
|
-
isServer: isServer
|
|
2238
|
-
};
|
|
2239
|
-
if (strip) {
|
|
2240
|
-
if (isServer) {
|
|
2241
|
-
transformOpts2.stripCtxName = CLIENT_STRIP_CTX_NAME;
|
|
2242
|
-
transformOpts2.stripEventHandlers = true;
|
|
2243
|
-
transformOpts2.regCtxName = REG_CTX_NAME;
|
|
2244
|
-
} else {
|
|
2245
|
-
transformOpts2.stripCtxName = SERVER_STRIP_CTX_NAME;
|
|
2246
|
-
transformOpts2.stripExports = SERVER_STRIP_EXPORTS;
|
|
2247
|
-
}
|
|
2248
|
-
}
|
|
2249
|
-
const now = Date.now();
|
|
2250
|
-
const newOutput = await optimizer2.transformModules(transformOpts2);
|
|
2251
|
-
debug(`transform(${count})`, `done in ${Date.now() - now}ms`);
|
|
2252
|
-
const module2 = newOutput.modules.find((mod => !isAdditionalFile(mod)));
|
|
2253
|
-
diagnosticsCallback(newOutput.diagnostics, optimizer2, srcDir);
|
|
2254
|
-
isServer ? 0 === newOutput.diagnostics.length && linter && linter.lint(ctx, code, id2) : clientResults.set(id2, newOutput);
|
|
2255
|
-
const deps = new Set;
|
|
2256
|
-
for (const mod of newOutput.modules) {
|
|
2257
|
-
if (mod !== module2) {
|
|
2258
|
-
const key = normalizePath(path.join(srcDir, mod.path));
|
|
2259
|
-
debug(`transform(${count})`, `segment ${key}`, mod.segment.displayName);
|
|
2260
|
-
parentIds.set(key, id2);
|
|
2261
|
-
currentOutputs.set(key, [ mod, id2 ]);
|
|
2262
|
-
deps.add(key);
|
|
2263
|
-
if ("client" === opts.target) {
|
|
2264
|
-
if (devServer) {
|
|
2265
|
-
const rollupModule = devServer.moduleGraph.getModuleById(key);
|
|
2266
|
-
rollupModule && devServer.moduleGraph.invalidateModule(rollupModule);
|
|
2267
|
-
} else {
|
|
2268
|
-
ctx.emitFile({
|
|
2269
|
-
id: key,
|
|
2270
|
-
type: "chunk",
|
|
2271
|
-
preserveSignature: "allow-extension"
|
|
2272
|
-
});
|
|
2273
|
-
}
|
|
2274
|
-
}
|
|
2275
|
-
}
|
|
2276
|
-
}
|
|
2277
|
-
for (const id3 of deps.values()) {
|
|
2278
|
-
await ctx.load({
|
|
2279
|
-
id: id3
|
|
2280
|
-
});
|
|
2281
|
-
}
|
|
2282
|
-
ctx.addWatchFile(id2);
|
|
2283
|
-
return {
|
|
2284
|
-
code: module2.code,
|
|
2285
|
-
map: module2.map,
|
|
2286
|
-
meta: {
|
|
2287
|
-
segment: module2.segment,
|
|
2288
|
-
qwikdeps: Array.from(deps)
|
|
2289
|
-
}
|
|
2290
|
-
};
|
|
2291
|
-
}
|
|
2292
|
-
debug(`transform(${count})`, "Not transforming", id2);
|
|
2293
|
-
return null;
|
|
2294
|
-
};
|
|
2295
|
-
const createOutputAnalyzer = rollupBundle => {
|
|
2296
|
-
const injections = [];
|
|
2297
|
-
const addInjection = b => injections.push(b);
|
|
2298
|
-
const generateManifest = async () => {
|
|
2299
|
-
const optimizer2 = getOptimizer();
|
|
2300
|
-
const path = optimizer2.sys.path;
|
|
2301
|
-
const segments = Array.from(clientResults.values()).flatMap((r => r.modules)).map((mod => mod.segment)).filter((h => !!h));
|
|
2302
|
-
const manifest = generateManifestFromBundles(path, segments, injections, rollupBundle, opts, debug);
|
|
2303
|
-
for (const symbol of Object.values(manifest.symbols)) {
|
|
2304
|
-
symbol.origin && (symbol.origin = normalizePath(symbol.origin));
|
|
2305
|
-
}
|
|
2306
|
-
for (const bundle of Object.values(manifest.bundles)) {
|
|
2307
|
-
bundle.origins && (bundle.origins = bundle.origins.map((abs => {
|
|
2308
|
-
const relPath = path.relative(opts.rootDir, abs);
|
|
2309
|
-
return normalizePath(relPath);
|
|
2310
|
-
})).sort());
|
|
2311
|
-
}
|
|
2312
|
-
manifest.manifestHash = hashCode(JSON.stringify(manifest));
|
|
2313
|
-
return manifest;
|
|
2314
|
-
};
|
|
2315
|
-
return {
|
|
2316
|
-
addInjection: addInjection,
|
|
2317
|
-
generateManifest: generateManifest
|
|
2318
|
-
};
|
|
2319
|
-
};
|
|
2320
|
-
const getOptions = () => opts;
|
|
2321
|
-
const getTransformedOutputs = () => Array.from(clientTransformedOutputs.values()).map((t => t[0]));
|
|
2322
|
-
const debug = (...str) => {
|
|
2323
|
-
opts.debug && console.debug(`[QWIK PLUGIN: ${id}]`, ...str);
|
|
2324
|
-
};
|
|
2325
|
-
const log = (...str) => {
|
|
2326
|
-
console.log(`[QWIK PLUGIN: ${id}]`, ...str);
|
|
2327
|
-
};
|
|
2328
|
-
const onDiagnostics = cb => {
|
|
2329
|
-
diagnosticsCallback = cb;
|
|
2330
|
-
};
|
|
2331
|
-
const normalizePath = id2 => lazyNormalizePath(id2);
|
|
2332
|
-
function getQwikBuildModule(isServer, _target) {
|
|
2333
|
-
const isDev2 = "development" === opts.buildMode;
|
|
2334
|
-
return `// @qwik.dev/core/build\nexport const isServer = ${JSON.stringify(isServer)};\nexport const isBrowser = ${JSON.stringify(!isServer)};\nexport const isDev = ${JSON.stringify(isDev2)};\n`;
|
|
2335
|
-
}
|
|
2336
|
-
async function getQwikServerManifestModule(isServer) {
|
|
2337
|
-
const manifest = isServer ? opts.manifestInput : null;
|
|
2338
|
-
return `// @qwik-client-manifest\nexport const manifest = ${JSON.stringify(manifest)};\n`;
|
|
2339
|
-
}
|
|
2340
|
-
function setSourceMapSupport(sourcemap) {
|
|
2341
|
-
opts.sourcemap = sourcemap;
|
|
2342
|
-
}
|
|
2343
|
-
function handleHotUpdate(ctx) {
|
|
2344
|
-
debug("handleHotUpdate()", ctx.file);
|
|
2345
|
-
for (const mod of ctx.modules) {
|
|
2346
|
-
const {id: id2} = mod;
|
|
2347
|
-
if (id2) {
|
|
2348
|
-
debug("handleHotUpdate()", `invalidate ${id2}`);
|
|
2349
|
-
clientResults.delete(id2);
|
|
2350
|
-
for (const outputs of [ clientTransformedOutputs, serverTransformedOutputs ]) {
|
|
2351
|
-
for (const [key, [_, parentId]] of outputs) {
|
|
2352
|
-
if (parentId === id2) {
|
|
2353
|
-
debug("handleHotUpdate()", `invalidate ${id2} segment ${key}`);
|
|
2354
|
-
outputs.delete(key);
|
|
2355
|
-
const mod2 = ctx.server.moduleGraph.getModuleById(key);
|
|
2356
|
-
mod2 && ctx.server.moduleGraph.invalidateModule(mod2);
|
|
2357
|
-
}
|
|
2358
|
-
}
|
|
2359
|
-
}
|
|
2360
|
-
}
|
|
2361
|
-
}
|
|
2362
|
-
}
|
|
2363
|
-
function manualChunks(id2, {getModuleInfo: getModuleInfo}) {
|
|
2364
|
-
var _a;
|
|
2365
|
-
const module2 = getModuleInfo(id2);
|
|
2366
|
-
const segment = module2.meta.segment;
|
|
2367
|
-
if (segment) {
|
|
2368
|
-
return segment.entry;
|
|
2369
|
-
}
|
|
2370
|
-
const moduleIndex = id2.indexOf("node_modules");
|
|
2371
|
-
if (-1 === moduleIndex) {
|
|
2372
|
-
return;
|
|
2373
|
-
}
|
|
2374
|
-
const modulePath = id2.slice(moduleIndex + 12);
|
|
2375
|
-
const moduleName = id2.startsWith("@") ? modulePath.split("/").slice(0, 2).join("_") : modulePath.slice(0, modulePath.indexOf("/"));
|
|
2376
|
-
let size = (null == (_a = module2.code) ? void 0 : _a.length) || 0;
|
|
2377
|
-
size += npmChunks.get(moduleName) || 0;
|
|
2378
|
-
npmChunks.set(moduleName, size);
|
|
2379
|
-
if (size > 1e4) {
|
|
2380
|
-
return moduleName;
|
|
2381
|
-
}
|
|
2382
|
-
}
|
|
2383
|
-
return {
|
|
2384
|
-
buildStart: buildStart,
|
|
2385
|
-
createOutputAnalyzer: createOutputAnalyzer,
|
|
2386
|
-
getQwikBuildModule: getQwikBuildModule,
|
|
2387
|
-
getOptimizer: getOptimizer,
|
|
2388
|
-
getOptions: getOptions,
|
|
2389
|
-
getPath: getPath,
|
|
2390
|
-
getSys: getSys,
|
|
2391
|
-
getTransformedOutputs: getTransformedOutputs,
|
|
2392
|
-
init: init2,
|
|
2393
|
-
load: load,
|
|
2394
|
-
debug: debug,
|
|
2395
|
-
log: log,
|
|
2396
|
-
normalizeOptions: normalizeOptions,
|
|
2397
|
-
normalizePath: normalizePath,
|
|
2398
|
-
onDiagnostics: onDiagnostics,
|
|
2399
|
-
resolveId: resolveId,
|
|
2400
|
-
transform: transform,
|
|
2401
|
-
validateSource: validateSource,
|
|
2402
|
-
setSourceMapSupport: setSourceMapSupport,
|
|
2403
|
-
configureServer: configureServer,
|
|
2404
|
-
handleHotUpdate: handleHotUpdate,
|
|
2405
|
-
manualChunks: manualChunks
|
|
2406
|
-
};
|
|
2407
|
-
}
|
|
2408
|
-
var makeNormalizePath = sys => id => {
|
|
2409
|
-
if ("string" === typeof id) {
|
|
2410
|
-
if (isWin(sys.os)) {
|
|
2411
|
-
const isExtendedLengthPath = /^\\\\\?\\/.test(id);
|
|
2412
|
-
if (!isExtendedLengthPath) {
|
|
2413
|
-
const hasNonAscii = /[^\u0000-\u0080]+/.test(id);
|
|
2414
|
-
hasNonAscii || (id = id.replace(/\\/g, "/"));
|
|
2415
|
-
}
|
|
2416
|
-
return sys.path.posix.normalize(id);
|
|
2417
|
-
}
|
|
2418
|
-
return sys.path.normalize(id);
|
|
2419
|
-
}
|
|
2420
|
-
return id;
|
|
2421
|
-
};
|
|
2422
|
-
function isAdditionalFile(mod) {
|
|
2423
|
-
return mod.isEntry || mod.segment;
|
|
2424
|
-
}
|
|
2425
|
-
function parseId(originalId) {
|
|
2426
|
-
const [pathId, query] = originalId.split("?");
|
|
2427
|
-
const queryStr = query || "";
|
|
2428
|
-
return {
|
|
2429
|
-
originalId: originalId,
|
|
2430
|
-
pathId: pathId,
|
|
2431
|
-
query: queryStr ? `?${query}` : "",
|
|
2432
|
-
params: new URLSearchParams(queryStr)
|
|
2433
|
-
};
|
|
2434
|
-
}
|
|
2435
|
-
var TRANSFORM_EXTS = {
|
|
2436
|
-
".jsx": true,
|
|
2437
|
-
".ts": true,
|
|
2438
|
-
".tsx": true
|
|
2439
|
-
};
|
|
2440
|
-
var TRANSFORM_REGEX = /\.qwik\.[mc]?js$/;
|
|
2441
|
-
var QWIK_CORE_ID = "@qwik.dev/core";
|
|
2442
|
-
var QWIK_CORE_INTERNAL_ID = "@qwik.dev/core/internal";
|
|
2443
|
-
var QWIK_BUILD_ID = "@qwik.dev/core/build";
|
|
2444
|
-
var QWIK_JSX_RUNTIME_ID = "@qwik.dev/core/jsx-runtime";
|
|
2445
|
-
var QWIK_JSX_DEV_RUNTIME_ID = "@qwik.dev/core/jsx-dev-runtime";
|
|
2446
|
-
var QWIK_CORE_SERVER = "@qwik.dev/core/server";
|
|
2447
|
-
var QWIK_CLIENT_MANIFEST_ID = "@qwik-client-manifest";
|
|
2448
|
-
var QWIK_HANDLERS_ID = "@qwik-handlers";
|
|
2449
|
-
var SRC_DIR_DEFAULT = "src";
|
|
2450
|
-
var CLIENT_OUT_DIR = "dist";
|
|
2451
|
-
var SSR_OUT_DIR = "server";
|
|
2452
|
-
var LIB_OUT_DIR = "lib";
|
|
2453
|
-
var Q_MANIFEST_FILENAME = "q-manifest.json";
|
|
2454
|
-
function qwikRollup(qwikRollupOpts = {}) {
|
|
2455
|
-
const qwikPlugin = createQwikPlugin(qwikRollupOpts.optimizerOptions);
|
|
2456
|
-
const rollupPlugin = {
|
|
2457
|
-
name: "rollup-plugin-qwik",
|
|
2458
|
-
api: {
|
|
2459
|
-
getOptimizer: () => qwikPlugin.getOptimizer(),
|
|
2460
|
-
getOptions: () => qwikPlugin.getOptions()
|
|
2461
|
-
},
|
|
2462
|
-
async options(inputOpts) {
|
|
2463
|
-
var _a;
|
|
2464
|
-
await qwikPlugin.init();
|
|
2465
|
-
const origOnwarn = inputOpts.onwarn;
|
|
2466
|
-
inputOpts.onwarn = (warning, warn) => {
|
|
2467
|
-
if ("typescript" === warning.plugin && warning.message.includes("outputToFilesystem")) {
|
|
2468
|
-
return;
|
|
2469
|
-
}
|
|
2470
|
-
origOnwarn ? origOnwarn(warning, warn) : warn(warning);
|
|
2471
|
-
};
|
|
2472
|
-
const pluginOpts = {
|
|
2473
|
-
csr: qwikRollupOpts.csr,
|
|
2474
|
-
target: qwikRollupOpts.target,
|
|
2475
|
-
buildMode: qwikRollupOpts.buildMode,
|
|
2476
|
-
debug: qwikRollupOpts.debug,
|
|
2477
|
-
entryStrategy: qwikRollupOpts.entryStrategy,
|
|
2478
|
-
rootDir: qwikRollupOpts.rootDir,
|
|
2479
|
-
srcDir: qwikRollupOpts.srcDir,
|
|
2480
|
-
srcInputs: qwikRollupOpts.srcInputs,
|
|
2481
|
-
input: inputOpts.input,
|
|
2482
|
-
resolveQwikBuild: true,
|
|
2483
|
-
manifestOutput: qwikRollupOpts.manifestOutput,
|
|
2484
|
-
manifestInput: qwikRollupOpts.manifestInput,
|
|
2485
|
-
transformedModuleOutput: qwikRollupOpts.transformedModuleOutput,
|
|
2486
|
-
inlineStylesUpToBytes: null == (_a = qwikRollupOpts.optimizerOptions) ? void 0 : _a.inlineStylesUpToBytes,
|
|
2487
|
-
lint: qwikRollupOpts.lint,
|
|
2488
|
-
experimental: qwikRollupOpts.experimental
|
|
2489
|
-
};
|
|
2490
|
-
const opts = qwikPlugin.normalizeOptions(pluginOpts);
|
|
2491
|
-
inputOpts.input || (inputOpts.input = opts.input);
|
|
2492
|
-
return inputOpts;
|
|
2493
|
-
},
|
|
2494
|
-
outputOptions: rollupOutputOpts => normalizeRollupOutputOptionsObject(qwikPlugin, rollupOutputOpts, false),
|
|
2495
|
-
async buildStart() {
|
|
2496
|
-
qwikPlugin.onDiagnostics(((diagnostics, optimizer, srcDir) => {
|
|
2497
|
-
diagnostics.forEach((d => {
|
|
2498
|
-
const id = qwikPlugin.normalizePath(optimizer.sys.path.join(srcDir, d.file));
|
|
2499
|
-
"error" === d.category ? this.error(createRollupError2(id, d)) : this.warn(createRollupError2(id, d));
|
|
2500
|
-
}));
|
|
2501
|
-
}));
|
|
2502
|
-
await qwikPlugin.buildStart(this);
|
|
2503
|
-
},
|
|
2504
|
-
resolveId(id, importer) {
|
|
2505
|
-
if (id.startsWith("\0")) {
|
|
2506
|
-
return null;
|
|
2507
|
-
}
|
|
2508
|
-
return qwikPlugin.resolveId(this, id, importer);
|
|
2509
|
-
},
|
|
2510
|
-
load(id) {
|
|
2511
|
-
if (id.startsWith("\0")) {
|
|
2512
|
-
return null;
|
|
2513
|
-
}
|
|
2514
|
-
return qwikPlugin.load(this, id);
|
|
2515
|
-
},
|
|
2516
|
-
transform(code, id) {
|
|
2517
|
-
if (id.startsWith("\0")) {
|
|
2518
|
-
return null;
|
|
2519
|
-
}
|
|
2520
|
-
return qwikPlugin.transform(this, code, id);
|
|
2521
|
-
},
|
|
2522
|
-
async generateBundle(_, rollupBundle) {
|
|
2523
|
-
var _a;
|
|
2524
|
-
const opts = qwikPlugin.getOptions();
|
|
2525
|
-
if ("client" === opts.target) {
|
|
2526
|
-
const optimizer = qwikPlugin.getOptimizer();
|
|
2527
|
-
const outputAnalyzer = qwikPlugin.createOutputAnalyzer(rollupBundle);
|
|
2528
|
-
const manifest = await outputAnalyzer.generateManifest();
|
|
2529
|
-
manifest.platform = {
|
|
2530
|
-
...versions,
|
|
2531
|
-
rollup: (null == (_a = this.meta) ? void 0 : _a.rollupVersion) || "",
|
|
2532
|
-
env: optimizer.sys.env,
|
|
2533
|
-
os: optimizer.sys.os
|
|
2534
|
-
};
|
|
2535
|
-
"node" === optimizer.sys.env && (manifest.platform.node = process.versions.node);
|
|
2536
|
-
"function" === typeof opts.manifestOutput && await opts.manifestOutput(manifest);
|
|
2537
|
-
"function" === typeof opts.transformedModuleOutput && await opts.transformedModuleOutput(qwikPlugin.getTransformedOutputs());
|
|
2538
|
-
this.emitFile({
|
|
2539
|
-
type: "asset",
|
|
2540
|
-
fileName: Q_MANIFEST_FILENAME,
|
|
2541
|
-
source: JSON.stringify(manifest, null, 2)
|
|
2542
|
-
});
|
|
2543
|
-
}
|
|
2544
|
-
}
|
|
2545
|
-
};
|
|
2546
|
-
return rollupPlugin;
|
|
2547
|
-
}
|
|
2548
|
-
function normalizeRollupOutputOptions(qwikPlugin, rollupOutputOpts, useAssetsDir, outDir) {
|
|
2549
|
-
if (Array.isArray(rollupOutputOpts)) {
|
|
2550
|
-
rollupOutputOpts.length || rollupOutputOpts.push({});
|
|
2551
|
-
return rollupOutputOpts.map((outputOptsObj => ({
|
|
2552
|
-
...normalizeRollupOutputOptionsObject(qwikPlugin, outputOptsObj, useAssetsDir),
|
|
2553
|
-
dir: outDir || outputOptsObj.dir
|
|
2554
|
-
})));
|
|
2555
|
-
}
|
|
2556
|
-
return {
|
|
2557
|
-
...normalizeRollupOutputOptionsObject(qwikPlugin, rollupOutputOpts, useAssetsDir),
|
|
2558
|
-
dir: outDir || (null == rollupOutputOpts ? void 0 : rollupOutputOpts.dir)
|
|
2559
|
-
};
|
|
2560
|
-
}
|
|
2561
|
-
function normalizeRollupOutputOptionsObject(qwikPlugin, rollupOutputOptsObj, useAssetsDir) {
|
|
2562
|
-
const outputOpts = {
|
|
2563
|
-
...rollupOutputOptsObj
|
|
2564
|
-
};
|
|
2565
|
-
const opts = qwikPlugin.getOptions();
|
|
2566
|
-
const optimizer = qwikPlugin.getOptimizer();
|
|
2567
|
-
const manualChunks = qwikPlugin.manualChunks;
|
|
2568
|
-
if ("client" === opts.target) {
|
|
2569
|
-
if (!outputOpts.assetFileNames) {
|
|
2570
|
-
const assetFileNames = "assets/[hash]-[name].[ext]";
|
|
2571
|
-
outputOpts.assetFileNames = useAssetsDir ? `${opts.assetsDir}/${assetFileNames}` : assetFileNames;
|
|
2572
|
-
}
|
|
2573
|
-
let fileName;
|
|
2574
|
-
fileName = "production" !== opts.buildMode || opts.debug ? chunkInfo => {
|
|
2575
|
-
var _a, _b;
|
|
2576
|
-
if (null == (_a = chunkInfo.moduleIds) ? void 0 : _a.some((id => id.endsWith("core.prod.mjs")))) {
|
|
2577
|
-
return "build/core.js";
|
|
2578
|
-
}
|
|
2579
|
-
if (null == (_b = chunkInfo.moduleIds) ? void 0 : _b.some((id => id.endsWith("qwik-router/lib/index.qwik.mjs")))) {
|
|
2580
|
-
return "build/qwik-router.js";
|
|
2581
|
-
}
|
|
2582
|
-
const path = optimizer.sys.path;
|
|
2583
|
-
const relativePath = path.relative(optimizer.sys.cwd(), chunkInfo.name);
|
|
2584
|
-
const sanitized = relativePath.replace(/^(\.\.\/)+/, "").replace(/^\/+/, "").replace(/\//g, "-");
|
|
2585
|
-
return `build/${sanitized}.js`;
|
|
2586
|
-
} : "build/q-[hash].js";
|
|
2587
|
-
outputOpts.entryFileNames || (outputOpts.entryFileNames = useAssetsDir ? `${opts.assetsDir}/${fileName}` : fileName);
|
|
2588
|
-
outputOpts.chunkFileNames || (outputOpts.chunkFileNames = useAssetsDir ? `${opts.assetsDir}/${fileName}` : fileName);
|
|
2589
|
-
} else {
|
|
2590
|
-
"production" === opts.buildMode && (outputOpts.chunkFileNames || (outputOpts.chunkFileNames = "q-[hash].js"));
|
|
2591
|
-
}
|
|
2592
|
-
outputOpts.assetFileNames || (outputOpts.assetFileNames = "assets/[hash]-[name].[ext]");
|
|
2593
|
-
if ("client" === opts.target) {
|
|
2594
|
-
outputOpts.format = "es";
|
|
2595
|
-
const prevManualChunks = outputOpts.manualChunks;
|
|
2596
|
-
if (prevManualChunks && "function" !== typeof prevManualChunks) {
|
|
2597
|
-
throw new Error("manualChunks must be a function");
|
|
2598
|
-
}
|
|
2599
|
-
outputOpts.manualChunks = prevManualChunks ? (id, meta) => prevManualChunks(id, meta) || manualChunks(id, meta) : manualChunks;
|
|
2600
|
-
}
|
|
2601
|
-
outputOpts.dir || (outputOpts.dir = opts.outDir);
|
|
2602
|
-
"cjs" === outputOpts.format && "string" !== typeof outputOpts.exports && (outputOpts.exports = "auto");
|
|
2603
|
-
return outputOpts;
|
|
2604
|
-
}
|
|
2605
|
-
function createRollupError2(id, diagnostic) {
|
|
2606
|
-
var _a;
|
|
2607
|
-
const loc = null == (_a = diagnostic.highlights) ? void 0 : _a[0];
|
|
2608
|
-
const err = Object.assign(new Error(diagnostic.message), {
|
|
2609
|
-
id: id,
|
|
2610
|
-
plugin: "qwik",
|
|
2611
|
-
loc: loc && {
|
|
2612
|
-
column: loc.startCol,
|
|
2613
|
-
line: loc.startLine
|
|
2614
|
-
},
|
|
2615
|
-
stack: ""
|
|
2616
|
-
});
|
|
2617
|
-
return err;
|
|
2618
|
-
}
|
|
2619
|
-
var QWIK_LOADER_DEFAULT_MINIFIED = '(()=>{var e=Object.defineProperty,t=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable,r=(t,o,n)=>o in t?e(t,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[o]=n,s=(e,s)=>{for(var a in s||(s={}))o.call(s,a)&&r(e,a,s[a]);if(t)for(var a of t(s))n.call(s,a)&&r(e,a,s[a]);return e};((e,t)=>{const o="__q_context__",n=window,r=new Set,a=new Set([e]),i="replace",c="forEach",l="target",f="getAttribute",p="isConnected",b="qvisible",u="_qwikjson_",h=(e,t)=>Array.from(e.querySelectorAll(t)),y=e=>{const t=[];return a.forEach((o=>t.push(...h(o,e)))),t},d=e=>{S(e),h(e,"[q\\\\:shadowroot]").forEach((e=>{const t=e.shadowRoot;t&&d(t)}))},q=e=>e&&"function"==typeof e.then,m=(e,t,o=t.type)=>{y("[on"+e+"\\\\:"+o+"]")[c]((n=>g(n,e,t,o)))},w=t=>{if(void 0===t[u]){let o=(t===e.documentElement?e.body:t).lastElementChild;for(;o;){if("SCRIPT"===o.tagName&&"qwik/json"===o[f]("type")){t[u]=JSON.parse(o.textContent[i](/\\\\x3C(\\/?script)/gi,"<$1"));break}o=o.previousElementSibling}}},v=(e,t)=>new CustomEvent(e,{detail:t}),g=async(t,n,r,a=r.type)=>{const c="on"+n+":"+a;t.hasAttribute("preventdefault:"+a)&&r.preventDefault(),t.hasAttribute("stoppropagation:"+a)&&r.stopPropagation();const l=t._qc_,b=l&&l.li.filter((e=>e[0]===c));if(b&&b.length>0){for(const e of b){const o=e[1].getFn([t,r],(()=>t[p]))(r,t),n=r.cancelBubble;q(o)&&await o,n&&r.stopPropagation()}return}const u=t.qDispatchEvent;if(u)return u(r,n);const h=t[f](c);if(h){const n=t.closest("[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])"),a=n[f]("q:base"),c=n[f]("q:version")||"unknown",l=n[f]("q:manifest-hash")||"dev",b=new URL(a,e.baseURI);for(const f of h.split("\\n")){const u=new URL(f,b),h=u.href,y=u.hash[i](/^#?([^?[|]*).*$/,"$1")||"default",d=performance.now();let m,v,g;const A=f.startsWith("#"),_={qBase:a,qManifest:l,qVersion:c,href:h,symbol:y,element:t,reqTime:d};if(A){const t=n.getAttribute("q:instance");m=(e["qFuncs_"+t]||[])[Number.parseInt(y)],m||(v="sync",g=Error("sync handler error for symbol: "+y))}else{const e=u.href.split("#")[0];try{const t=import(e);w(n),m=(await t)[y],m||(v="no-symbol",g=Error(`${y} not in ${e}`))}catch(e){v||(v="async"),g=e}}if(!m){E("qerror",s({importError:v,error:g},_)),console.error(g);break}const k=e[o];if(t[p])try{e[o]=[t,r,u],A||E("qsymbol",s({},_));const n=m(r,t);q(n)&&await n}catch(e){E("qerror",s({error:e},_))}finally{e[o]=k}}}},E=(t,o)=>{e.dispatchEvent(v(t,o))},A=e=>e[i](/([A-Z])/g,(e=>"-"+e.toLowerCase())),_=async e=>{let t=A(e.type),o=e[l];for(m("-document",e,t);o&&o[f];){const n=g(o,"",e,t);let r=e.cancelBubble;q(n)&&await n,r=r||e.cancelBubble||o.hasAttribute("stoppropagation:"+e.type),o=e.bubbles&&!0!==r?o.parentElement:null}},k=e=>{m("-window",e,A(e.type))},C=()=>{var o;const s=e.readyState;if(!t&&("interactive"==s||"complete"==s)&&(a.forEach(d),t=1,E("qinit"),(null!=(o=n.requestIdleCallback)?o:n.setTimeout).bind(n)((()=>E("qidle"))),r.has(b))){const e=y("[on\\\\:"+b+"]"),t=new IntersectionObserver((e=>{for(const o of e)o.isIntersecting&&(t.unobserve(o[l]),g(o[l],"",v(b,o)))}));e[c]((e=>t.observe(e)))}},O=(e,t,o,n=!1)=>e.addEventListener(t,o,{capture:n,passive:!1}),S=(...e)=>{for(const t of e)"string"==typeof t?r.has(t)||(a.forEach((e=>O(e,t,_,!0))),O(n,t,k,!0),r.add(t)):a.has(t)||(r.forEach((e=>O(t,e,_,!0))),a.add(t))};if(!(o in e)){e[o]=0;const t=n.qwikevents;Array.isArray(t)&&S(...t),n.qwikevents={events:r,roots:a,push:S},O(e,"readystatechange",C),C()}})(document)})()';
|
|
2620
|
-
var QWIK_LOADER_DEFAULT_DEBUG = '(() => {\n var __defProp = Object.defineProperty;\n var __getOwnPropSymbols = Object.getOwnPropertySymbols;\n var __hasOwnProp = Object.prototype.hasOwnProperty;\n var __propIsEnum = Object.prototype.propertyIsEnumerable;\n var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {\n enumerable: !0,\n configurable: !0,\n writable: !0,\n value: value\n }) : obj[key] = value;\n var __spreadValues = (a, b) => {\n for (var prop in b || (b = {})) {\n __hasOwnProp.call(b, prop) && __defNormalProp(a, prop, b[prop]);\n }\n if (__getOwnPropSymbols) {\n for (var prop of __getOwnPropSymbols(b)) {\n __propIsEnum.call(b, prop) && __defNormalProp(a, prop, b[prop]);\n }\n }\n return a;\n };\n ((doc, hasInitialized) => {\n const Q_CONTEXT = "__q_context__";\n const win = window;\n const events = new Set;\n const roots = new Set([ doc ]);\n const nativeQuerySelectorAll = (root, selector) => Array.from(root.querySelectorAll(selector));\n const querySelectorAll = query => {\n const elements = [];\n roots.forEach((root => elements.push(...nativeQuerySelectorAll(root, query))));\n return elements;\n };\n const findShadowRoots = fragment => {\n processEventOrNode(fragment);\n nativeQuerySelectorAll(fragment, "[q\\\\:shadowroot]").forEach((parent => {\n const shadowRoot = parent.shadowRoot;\n shadowRoot && findShadowRoots(shadowRoot);\n }));\n };\n const isPromise = promise => promise && "function" == typeof promise.then;\n const broadcast = (infix, ev, type = ev.type) => {\n querySelectorAll("[on" + infix + "\\\\:" + type + "]").forEach((el => dispatch(el, infix, ev, type)));\n };\n const resolveContainer = containerEl => {\n if (void 0 === containerEl._qwikjson_) {\n let script = (containerEl === doc.documentElement ? doc.body : containerEl).lastElementChild;\n while (script) {\n if ("SCRIPT" === script.tagName && "qwik/json" === script.getAttribute("type")) {\n containerEl._qwikjson_ = JSON.parse(script.textContent.replace(/\\\\x3C(\\/?script)/gi, "<$1"));\n break;\n }\n script = script.previousElementSibling;\n }\n }\n };\n const createEvent = (eventName, detail) => new CustomEvent(eventName, {\n detail: detail\n });\n const dispatch = async (element, scope, ev, eventName = ev.type) => {\n const attrName = "on" + scope + ":" + eventName;\n element.hasAttribute("preventdefault:" + eventName) && ev.preventDefault();\n element.hasAttribute("stoppropagation:" + eventName) && ev.stopPropagation();\n const ctx = element._qc_;\n const relevantListeners = ctx && ctx.li.filter((li => li[0] === attrName));\n if (relevantListeners && relevantListeners.length > 0) {\n for (const listener of relevantListeners) {\n const results = listener[1].getFn([ element, ev ], (() => element.isConnected))(ev, element);\n const cancelBubble = ev.cancelBubble;\n isPromise(results) && await results;\n cancelBubble && ev.stopPropagation();\n }\n return;\n }\n const qDispatchEvent = element.qDispatchEvent;\n if (qDispatchEvent) {\n return qDispatchEvent(ev, scope);\n }\n const attrValue = element.getAttribute(attrName);\n if (attrValue) {\n const container = element.closest("[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])");\n const qBase = container.getAttribute("q:base");\n const qVersion = container.getAttribute("q:version") || "unknown";\n const qManifest = container.getAttribute("q:manifest-hash") || "dev";\n const base = new URL(qBase, doc.baseURI);\n for (const qrl of attrValue.split("\\n")) {\n const url = new URL(qrl, base);\n const href = url.href;\n const symbol = url.hash.replace(/^#?([^?[|]*).*$/, "$1") || "default";\n const reqTime = performance.now();\n let handler;\n let importError;\n let error;\n const isSync = qrl.startsWith("#");\n const eventData = {\n qBase: qBase,\n qManifest: qManifest,\n qVersion: qVersion,\n href: href,\n symbol: symbol,\n element: element,\n reqTime: reqTime\n };\n if (isSync) {\n const hash = container.getAttribute("q:instance");\n handler = (doc["qFuncs_" + hash] || [])[Number.parseInt(symbol)];\n if (!handler) {\n importError = "sync";\n error = new Error("sync handler error for symbol: " + symbol);\n }\n } else {\n const uri = url.href.split("#")[0];\n try {\n const module = import(\n uri);\n resolveContainer(container);\n handler = (await module)[symbol];\n if (!handler) {\n importError = "no-symbol";\n error = new Error(`${symbol} not in ${uri}`);\n }\n } catch (err) {\n importError || (importError = "async");\n error = err;\n }\n }\n if (!handler) {\n emitEvent("qerror", __spreadValues({\n importError: importError,\n error: error\n }, eventData));\n console.error(error);\n break;\n }\n const previousCtx = doc[Q_CONTEXT];\n if (element.isConnected) {\n try {\n doc[Q_CONTEXT] = [ element, ev, url ];\n isSync || emitEvent("qsymbol", __spreadValues({}, eventData));\n const results = handler(ev, element);\n isPromise(results) && await results;\n } catch (error2) {\n emitEvent("qerror", __spreadValues({\n error: error2\n }, eventData));\n } finally {\n doc[Q_CONTEXT] = previousCtx;\n }\n }\n }\n }\n };\n const emitEvent = (eventName, detail) => {\n doc.dispatchEvent(createEvent(eventName, detail));\n };\n const camelToKebab = str => str.replace(/([A-Z])/g, (a => "-" + a.toLowerCase()));\n const processDocumentEvent = async ev => {\n let type = camelToKebab(ev.type);\n let element = ev.target;\n broadcast("-document", ev, type);\n while (element && element.getAttribute) {\n const results = dispatch(element, "", ev, type);\n let cancelBubble = ev.cancelBubble;\n isPromise(results) && await results;\n cancelBubble = cancelBubble || ev.cancelBubble || element.hasAttribute("stoppropagation:" + ev.type);\n element = ev.bubbles && !0 !== cancelBubble ? element.parentElement : null;\n }\n };\n const processWindowEvent = ev => {\n broadcast("-window", ev, camelToKebab(ev.type));\n };\n const processReadyStateChange = () => {\n var _a;\n const readyState = doc.readyState;\n if (!hasInitialized && ("interactive" == readyState || "complete" == readyState)) {\n roots.forEach(findShadowRoots);\n hasInitialized = 1;\n emitEvent("qinit");\n (null != (_a = win.requestIdleCallback) ? _a : win.setTimeout).bind(win)((() => emitEvent("qidle")));\n if (events.has("qvisible")) {\n const results = querySelectorAll("[on\\\\:qvisible]");\n const observer = new IntersectionObserver((entries => {\n for (const entry of entries) {\n if (entry.isIntersecting) {\n observer.unobserve(entry.target);\n dispatch(entry.target, "", createEvent("qvisible", entry));\n }\n }\n }));\n results.forEach((el => observer.observe(el)));\n }\n }\n };\n const addEventListener = (el, eventName, handler, capture = !1) => el.addEventListener(eventName, handler, {\n capture: capture,\n passive: !1\n });\n const processEventOrNode = (...eventNames) => {\n for (const eventNameOrNode of eventNames) {\n if ("string" == typeof eventNameOrNode) {\n if (!events.has(eventNameOrNode)) {\n roots.forEach((root => addEventListener(root, eventNameOrNode, processDocumentEvent, !0)));\n addEventListener(win, eventNameOrNode, processWindowEvent, !0);\n events.add(eventNameOrNode);\n }\n } else if (!roots.has(eventNameOrNode)) {\n events.forEach((eventName => addEventListener(eventNameOrNode, eventName, processDocumentEvent, !0)));\n roots.add(eventNameOrNode);\n }\n }\n };\n if (!(Q_CONTEXT in doc)) {\n doc[Q_CONTEXT] = 0;\n const qwikevents = win.qwikevents;\n Array.isArray(qwikevents) && processEventOrNode(...qwikevents);\n win.qwikevents = {\n events: events,\n roots: roots,\n push: processEventOrNode\n };\n addEventListener(doc, "readystatechange", processReadyStateChange);\n processReadyStateChange();\n }\n })(document);\n})()';
|
|
2621
|
-
var import_bmp = __toESM(require_bmp(), 1);
|
|
2622
|
-
var import_cur = __toESM(require_cur(), 1);
|
|
2623
|
-
var import_dds = __toESM(require_dds(), 1);
|
|
2624
|
-
var import_gif = __toESM(require_gif(), 1);
|
|
2625
|
-
var import_icns = __toESM(require_icns(), 1);
|
|
2626
|
-
var import_ico = __toESM(require_ico(), 1);
|
|
2627
|
-
var import_j2c = __toESM(require_j2c(), 1);
|
|
2628
|
-
var import_jp2 = __toESM(require_jp2(), 1);
|
|
2629
|
-
var import_jpg = __toESM(require_jpg(), 1);
|
|
2630
|
-
var import_ktx = __toESM(require_ktx(), 1);
|
|
2631
|
-
var import_png = __toESM(require_png(), 1);
|
|
2632
|
-
var import_pnm = __toESM(require_pnm(), 1);
|
|
2633
|
-
var import_psd = __toESM(require_psd(), 1);
|
|
2634
|
-
var import_svg = __toESM(require_svg(), 1);
|
|
2635
|
-
var import_tga = __toESM(require_tga(), 1);
|
|
2636
|
-
var import_webp = __toESM(require_webp(), 1);
|
|
2637
|
-
var import_heif = __toESM(require_heif(), 1);
|
|
2638
|
-
var firstBytes = {
|
|
2639
|
-
56: "psd",
|
|
2640
|
-
66: "bmp",
|
|
2641
|
-
68: "dds",
|
|
2642
|
-
71: "gif",
|
|
2643
|
-
82: "webp",
|
|
2644
|
-
105: "icns",
|
|
2645
|
-
137: "png",
|
|
2646
|
-
255: "jpg"
|
|
2647
|
-
};
|
|
2648
|
-
var types = {
|
|
2649
|
-
webp: import_webp.default.WEBP,
|
|
2650
|
-
jpg: import_jpg.default.JPG,
|
|
2651
|
-
png: import_png.default.PNG,
|
|
2652
|
-
svg: import_svg.default.SVG,
|
|
2653
|
-
gif: import_gif.default.GIF,
|
|
2654
|
-
avif: import_heif.default.HEIF,
|
|
2655
|
-
bmp: import_bmp.default.BMP,
|
|
2656
|
-
cur: import_cur.default.CUR,
|
|
2657
|
-
dds: import_dds.default.DDS,
|
|
2658
|
-
icns: import_icns.default.ICNS,
|
|
2659
|
-
ico: import_ico.default.ICO,
|
|
2660
|
-
j2c: import_j2c.default.J2C,
|
|
2661
|
-
jp2: import_jp2.default.JP2,
|
|
2662
|
-
ktx: import_ktx.default.KTX,
|
|
2663
|
-
pnm: import_pnm.default.PNM,
|
|
2664
|
-
psd: import_psd.default.PSD,
|
|
2665
|
-
tga: import_tga.default.TGA
|
|
2666
|
-
};
|
|
2667
|
-
var keys = Object.keys(types);
|
|
2668
|
-
function detector(buffer) {
|
|
2669
|
-
const byte = buffer[0];
|
|
2670
|
-
const type = firstBytes[byte];
|
|
2671
|
-
if (type && types[type].validate(buffer)) {
|
|
2672
|
-
return type;
|
|
2673
|
-
}
|
|
2674
|
-
return keys.find((key => types[key].validate(buffer)));
|
|
2675
|
-
}
|
|
2676
|
-
function lookup(buffer) {
|
|
2677
|
-
const type = detector(buffer);
|
|
2678
|
-
if ("undefined" !== typeof type) {
|
|
2679
|
-
const size = types[type].calculate(buffer);
|
|
2680
|
-
if (void 0 !== size) {
|
|
2681
|
-
size.type = type;
|
|
2682
|
-
return size;
|
|
2683
|
-
}
|
|
2684
|
-
}
|
|
2685
|
-
}
|
|
2686
|
-
async function getInfoForSrc(src) {
|
|
2687
|
-
if (!/^(https?|file|capacitor):/.test(src)) {
|
|
2688
|
-
return;
|
|
2689
|
-
}
|
|
2690
|
-
try {
|
|
2691
|
-
const res = await fetch(src, {
|
|
2692
|
-
headers: {
|
|
2693
|
-
Accept: "image/*,*/*"
|
|
2694
|
-
}
|
|
2695
|
-
});
|
|
2696
|
-
if (!res.ok) {
|
|
2697
|
-
console.error("can not fetch", src);
|
|
2698
|
-
return;
|
|
2699
|
-
}
|
|
2700
|
-
const buffer = await res.arrayBuffer();
|
|
2701
|
-
const size = lookup(Buffer.from(buffer));
|
|
2702
|
-
if (size) {
|
|
2703
|
-
return {
|
|
2704
|
-
width: size.width,
|
|
2705
|
-
height: size.height,
|
|
2706
|
-
type: size.type,
|
|
2707
|
-
size: buffer.byteLength
|
|
2708
|
-
};
|
|
2709
|
-
}
|
|
2710
|
-
} catch (err) {
|
|
2711
|
-
console.error(err);
|
|
2712
|
-
return;
|
|
2713
|
-
}
|
|
2714
|
-
}
|
|
2715
|
-
var getImageSizeServer = (sys, rootDir, srcDir) => async (req, res, next) => {
|
|
2716
|
-
try {
|
|
2717
|
-
const fs = await sys.dynamicImport("node:fs");
|
|
2718
|
-
const path = await sys.dynamicImport("node:path");
|
|
2719
|
-
const url = new URL(req.url, "http://localhost:3000/");
|
|
2720
|
-
if ("GET" === req.method && "/__image_info" === url.pathname) {
|
|
2721
|
-
const imageURL = url.searchParams.get("url");
|
|
2722
|
-
res.setHeader("content-type", "application/json");
|
|
2723
|
-
if (imageURL) {
|
|
2724
|
-
const info = await getInfoForSrc(imageURL);
|
|
2725
|
-
res.setHeader("cache-control", "public, max-age=31536000, immutable");
|
|
2726
|
-
info ? res.write(JSON.stringify(info)) : res.statusCode = 404;
|
|
2727
|
-
} else {
|
|
2728
|
-
res.statusCode = 500;
|
|
2729
|
-
const info = {
|
|
2730
|
-
message: "error"
|
|
2731
|
-
};
|
|
2732
|
-
res.write(JSON.stringify(info));
|
|
2733
|
-
}
|
|
2734
|
-
res.end();
|
|
2735
|
-
return;
|
|
2736
|
-
}
|
|
2737
|
-
if ("POST" === req.method && "/__image_fix" === url.pathname) {
|
|
2738
|
-
const loc = url.searchParams.get("loc");
|
|
2739
|
-
const width = url.searchParams.get("width");
|
|
2740
|
-
const height = url.searchParams.get("height");
|
|
2741
|
-
const src = url.searchParams.get("src");
|
|
2742
|
-
const currentHref = url.searchParams.get("currentHref");
|
|
2743
|
-
const locParts = loc.split(":");
|
|
2744
|
-
const column = parseInt(locParts[locParts.length - 1], 10) - 1;
|
|
2745
|
-
let line = parseInt(locParts[locParts.length - 2], 10) - 1;
|
|
2746
|
-
const filePath = path.resolve(srcDir, locParts.slice(0, locParts.length - 2).join(":"));
|
|
2747
|
-
const extension = path.extname(filePath).toLowerCase();
|
|
2748
|
-
const buffer = fs.readFileSync(filePath);
|
|
2749
|
-
let text = buffer.toString("utf-8");
|
|
2750
|
-
let offset = 0;
|
|
2751
|
-
for (;offset < text.length; offset++) {
|
|
2752
|
-
if (0 === line) {
|
|
2753
|
-
offset += column;
|
|
2754
|
-
break;
|
|
2755
|
-
}
|
|
2756
|
-
if ("\n" === text[offset]) {
|
|
2757
|
-
line--;
|
|
2758
|
-
continue;
|
|
2759
|
-
}
|
|
2760
|
-
}
|
|
2761
|
-
if ("<img" !== text.slice(offset, offset + 4)) {
|
|
2762
|
-
console.error("Could not apply auto fix, because it was not possible to find the original <img> tag");
|
|
2763
|
-
res.statusCode = 500;
|
|
2764
|
-
return;
|
|
2765
|
-
}
|
|
2766
|
-
const end = text.indexOf(">", offset) + 1;
|
|
2767
|
-
if (end < offset) {
|
|
2768
|
-
console.error("Could not apply auto fix, because it was not possible to find the original <img> tag");
|
|
2769
|
-
res.statusCode = 500;
|
|
2770
|
-
return;
|
|
2771
|
-
}
|
|
2772
|
-
const extensionSupportsImport = [ ".ts", ".tsx", ".js", ".jsx", ".mdx" ].includes(extension);
|
|
2773
|
-
let imgTag = text.slice(offset, end);
|
|
2774
|
-
if (src && currentHref && extensionSupportsImport) {
|
|
2775
|
-
const urlSrc = new URL(src);
|
|
2776
|
-
const urlCurrent = new URL(currentHref);
|
|
2777
|
-
if (urlSrc.origin === urlCurrent.origin) {
|
|
2778
|
-
const publicImagePath = path.join(rootDir, "public", urlSrc.pathname);
|
|
2779
|
-
const rootImagePath = path.join(rootDir, urlSrc.pathname);
|
|
2780
|
-
let relativeLocation;
|
|
2781
|
-
if (fs.existsSync(publicImagePath)) {
|
|
2782
|
-
const mediaSrc = path.join(srcDir, "media", path.dirname(urlSrc.pathname));
|
|
2783
|
-
await fs.promises.mkdir(mediaSrc, {
|
|
2784
|
-
recursive: true
|
|
2785
|
-
});
|
|
2786
|
-
await fs.promises.copyFile(publicImagePath, path.join(srcDir, "media", urlSrc.pathname));
|
|
2787
|
-
relativeLocation = "~/media" + urlSrc.pathname;
|
|
2788
|
-
} else {
|
|
2789
|
-
if (!fs.existsSync(rootImagePath)) {
|
|
2790
|
-
return;
|
|
2791
|
-
}
|
|
2792
|
-
relativeLocation = urlSrc.pathname.replace("/src/", "~/");
|
|
2793
|
-
}
|
|
2794
|
-
const importIdent = imgImportName(urlSrc.pathname);
|
|
2795
|
-
const importSrc = `${relativeLocation}?jsx`;
|
|
2796
|
-
imgTag = imgTag.replace(/^<img/, `<${importIdent}`);
|
|
2797
|
-
imgTag = imgTag.replace(/\bwidth=(({[^}]*})|('[^']*')|("[^"]*"))\s*/, "");
|
|
2798
|
-
imgTag = imgTag.replace(/\bheight=(({[^}]*})|('[^']*')|("[^"]*"))\s*/, "");
|
|
2799
|
-
imgTag = imgTag.replace(/\bsrc=(({[^}]*})|('[^']*')|("[^"]*"))\s*/, "");
|
|
2800
|
-
let insertImport = 0;
|
|
2801
|
-
if (".mdx" === extension && text.startsWith("---")) {
|
|
2802
|
-
insertImport = text.indexOf("---", 4) + 3;
|
|
2803
|
-
if (-1 === insertImport) {
|
|
2804
|
-
return;
|
|
2805
|
-
}
|
|
2806
|
-
}
|
|
2807
|
-
const newImport = `\nimport ${importIdent} from '${importSrc}';`;
|
|
2808
|
-
text = `${text.slice(0, insertImport)}${newImport}${text.slice(insertImport, offset)}${imgTag}${text.slice(end)}`;
|
|
2809
|
-
fs.writeFileSync(filePath, text);
|
|
2810
|
-
return;
|
|
2811
|
-
}
|
|
2812
|
-
}
|
|
2813
|
-
imgTag = imgTag.replace(/\bwidth=(({[^}]*})|('[^']*')|("[^"]*"))/, `width="${width}"`);
|
|
2814
|
-
imgTag = imgTag.replace(/\bheight=(({[^}]*})|('[^']*')|("[^"]*"))/, `height="${height}"`);
|
|
2815
|
-
imgTag.includes("height=") || (imgTag = imgTag.replace(/<img/, `<img height="${height}"`));
|
|
2816
|
-
imgTag.includes("width=") || (imgTag = imgTag.replace(/<img/, `<img width="${width}"`));
|
|
2817
|
-
text = text.slice(0, offset) + imgTag + text.slice(end);
|
|
2818
|
-
fs.writeFileSync(filePath, text);
|
|
2819
|
-
} else {
|
|
2820
|
-
next();
|
|
2821
|
-
}
|
|
2822
|
-
} catch (e) {
|
|
2823
|
-
e instanceof Error && await formatError(sys, e);
|
|
2824
|
-
next(e);
|
|
2825
|
-
}
|
|
2826
|
-
};
|
|
2827
|
-
function imgImportName(value) {
|
|
2828
|
-
const dot = value.lastIndexOf(".");
|
|
2829
|
-
const slash = value.lastIndexOf("/");
|
|
2830
|
-
value = value.substring(slash + 1, dot);
|
|
2831
|
-
return `Img${toPascalCase(value)}`;
|
|
2832
|
-
}
|
|
2833
|
-
function toPascalCase(string) {
|
|
2834
|
-
return `${string}`.toLowerCase().replace(new RegExp(/[-_]+/, "g"), " ").replace(new RegExp(/[^\w\s]/, "g"), "").replace(new RegExp(/\s+(.)(\w*)/, "g"), (($1, $2, $3) => `${$2.toUpperCase() + $3}`)).replace(new RegExp(/\w/), (s => s.toUpperCase()));
|
|
2835
|
-
}
|
|
2836
|
-
var FORCE_COLOR;
|
|
2837
|
-
var NODE_DISABLE_COLORS;
|
|
2838
|
-
var NO_COLOR;
|
|
2839
|
-
var TERM;
|
|
2840
|
-
var isTTY = true;
|
|
2841
|
-
if ("undefined" !== typeof process) {
|
|
2842
|
-
({FORCE_COLOR: FORCE_COLOR, NODE_DISABLE_COLORS: NODE_DISABLE_COLORS, NO_COLOR: NO_COLOR, TERM: TERM} = process.env || {});
|
|
2843
|
-
isTTY = process.stdout && process.stdout.isTTY;
|
|
2844
|
-
}
|
|
2845
|
-
var $ = {
|
|
2846
|
-
enabled: !NODE_DISABLE_COLORS && null == NO_COLOR && "dumb" !== TERM && (null != FORCE_COLOR && "0" !== FORCE_COLOR || isTTY)
|
|
2847
|
-
};
|
|
2848
|
-
function init(x, y) {
|
|
2849
|
-
let rgx = new RegExp(`\\x1b\\[${y}m`, "g");
|
|
2850
|
-
let open = `[${x}m`, close = `[${y}m`;
|
|
2851
|
-
return function(txt) {
|
|
2852
|
-
if (!$.enabled || null == txt) {
|
|
2853
|
-
return txt;
|
|
2854
|
-
}
|
|
2855
|
-
return open + (!~("" + txt).indexOf(close) ? txt : txt.replace(rgx, close + open)) + close;
|
|
2856
|
-
};
|
|
2857
|
-
}
|
|
2858
|
-
init(0, 0);
|
|
2859
|
-
init(1, 22);
|
|
2860
|
-
init(2, 22);
|
|
2861
|
-
init(3, 23);
|
|
2862
|
-
init(4, 24);
|
|
2863
|
-
init(7, 27);
|
|
2864
|
-
init(8, 28);
|
|
2865
|
-
init(9, 29);
|
|
2866
|
-
init(30, 39);
|
|
2867
|
-
init(31, 39);
|
|
2868
|
-
init(32, 39);
|
|
2869
|
-
init(33, 39);
|
|
2870
|
-
init(34, 39);
|
|
2871
|
-
var magenta = init(35, 39);
|
|
2872
|
-
init(36, 39);
|
|
2873
|
-
init(37, 39);
|
|
2874
|
-
init(90, 39);
|
|
2875
|
-
init(90, 39);
|
|
2876
|
-
init(40, 49);
|
|
2877
|
-
init(41, 49);
|
|
2878
|
-
init(42, 49);
|
|
2879
|
-
init(43, 49);
|
|
2880
|
-
init(44, 49);
|
|
2881
|
-
init(45, 49);
|
|
2882
|
-
init(46, 49);
|
|
2883
|
-
init(47, 49);
|
|
2884
|
-
var click_to_component_default = "<style>\n #qwik-inspector-overlay {\n position: fixed;\n background: rgba(24, 182, 246, 0.27);\n pointer-events: none;\n box-sizing: border-box;\n border: 2px solid rgba(172, 126, 244, 0.46);\n border-radius: 4px;\n contain: strict;\n cursor: pointer;\n z-index: 999999;\n }\n #qwik-inspector-info-popup {\n position: fixed;\n bottom: 10px;\n right: 10px;\n font-family: monospace;\n background: #000000c2;\n color: white;\n padding: 10px 20px;\n border-radius: 8px;\n box-shadow:\n 0 20px 25px -5px rgb(0 0 0 / 34%),\n 0 8px 10px -6px rgb(0 0 0 / 24%);\n backdrop-filter: blur(4px);\n -webkit-animation: fadeOut 0.3s 3s ease-in-out forwards;\n animation: fadeOut 0.3s 3s ease-in-out forwards;\n z-index: 999999;\n contain: layout;\n }\n #qwik-inspector-info-popup p {\n margin: 0px;\n }\n @-webkit-keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n\n @keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n visibility: hidden;\n }\n }\n</style>\n<div id=\"qwik-inspector-info-popup\" aria-hidden=\"true\">Click-to-Source</div>\n<script>\n (function () {\n const inspectAttribute = 'data-qwik-inspector';\n const hotKeys = globalThis.qwikdevtools.hotKeys;\n const srcDir = globalThis.qwikdevtools.srcDir;\n document.querySelector('#qwik-inspector-info-popup').textContent =\n `Click-to-Source: ${hotKeys.join(' + ')}`;\n console.debug(\n '%c🔍 Qwik Click-To-Source',\n 'background: #564CE0; color: white; padding: 2px 3px; border-radius: 2px; font-size: 0.8em;',\n `Hold-press the '${hotKeys.join(' + ')}' key${\n (hotKeys.length > 1 && 's') || ''\n } and click a component to jump directly to the source code in your IDE!`\n );\n window.__qwik_inspector_state = {\n pressedKeys: new Set(),\n };\n const origin = 'http://local.local';\n const body = document.body;\n const overlay = document.createElement('div');\n overlay.id = 'qwik-inspector-overlay';\n overlay.setAttribute('aria-hidden', 'true');\n body.appendChild(overlay);\n\n function findContainer(el) {\n if (el && el instanceof Element) {\n return el.closest(`[${inspectAttribute}]`);\n }\n return null;\n }\n\n document.addEventListener(\n 'keydown',\n (event) => {\n window.__qwik_inspector_state.pressedKeys.add(event.code);\n updateOverlay();\n },\n { capture: true }\n );\n\n document.addEventListener(\n 'keyup',\n (event) => {\n window.__qwik_inspector_state.pressedKeys.delete(event.code);\n updateOverlay();\n },\n { capture: true }\n );\n\n window.addEventListener(\n 'blur',\n (event) => {\n window.__qwik_inspector_state.pressedKeys.clear();\n updateOverlay();\n },\n { capture: true }\n );\n\n document.addEventListener(\n 'mouseover',\n (event) => {\n const target = findContainer(event.target);\n if (target) {\n window.__qwik_inspector_state.hoveredElement = target;\n } else {\n window.__qwik_inspector_state.hoveredElement = undefined;\n }\n updateOverlay();\n },\n { capture: true }\n );\n\n document.addEventListener(\n 'click',\n (event) => {\n if (isActive()) {\n window.__qwik_inspector_state.pressedKeys.clear();\n const target = findContainer(event.target);\n if (target) {\n event.preventDefault();\n const inspectUrl = target.getAttribute(inspectAttribute);\n if (inspectUrl !== 'false') {\n body.style.setProperty('cursor', 'progress');\n qwikOpenInEditor(inspectUrl);\n }\n }\n }\n },\n { capture: true }\n );\n\n globalThis.qwikOpenInEditor = function (path) {\n const isWindows = navigator.platform.includes('Win');\n const resolvedURL = new URL(path, isWindows ? origin : srcDir);\n if (resolvedURL.origin === origin) {\n const params = new URLSearchParams();\n const prefix = isWindows ? srcDir : '';\n params.set('file', prefix + resolvedURL.pathname);\n fetch('/__open-in-editor?' + params.toString());\n } else {\n location.href = resolvedURL.href;\n }\n };\n document.addEventListener(\n 'contextmenu',\n (event) => {\n if (isActive()) {\n window.__qwik_inspector_state.pressedKeys.clear();\n const target = findContainer(event.target);\n if (target) {\n event.preventDefault();\n }\n }\n },\n { capture: true }\n );\n\n function updateOverlay() {\n const hoverElement = window.__qwik_inspector_state.hoveredElement;\n if (hoverElement && isActive()) {\n const rect = hoverElement.getBoundingClientRect();\n overlay.style.setProperty('height', rect.height + 'px');\n overlay.style.setProperty('width', rect.width + 'px');\n overlay.style.setProperty('top', rect.top + 'px');\n overlay.style.setProperty('left', rect.left + 'px');\n overlay.style.setProperty('visibility', 'visible');\n body.style.setProperty('cursor', 'pointer');\n } else {\n overlay.style.setProperty('height', '0px');\n overlay.style.setProperty('width', '0px');\n overlay.style.setProperty('visibility', 'hidden');\n body.style.removeProperty('cursor');\n }\n }\n\n function checkKeysArePressed() {\n const activeKeys = Array.from(window.__qwik_inspector_state.pressedKeys).map((key) =>\n key ? key.replace(/(Left|Right)$/g, '') : undefined\n );\n return hotKeys.every((key) => activeKeys.includes(key));\n }\n\n function isActive() {\n return checkKeysArePressed();\n }\n window.addEventListener('resize', updateOverlay);\n document.addEventListener('scroll', updateOverlay);\n })();\n<\/script>\n";
|
|
2885
|
-
var error_host_default = "<script>\n document.addEventListener('qerror', (ev) => {\n const ErrorOverlay = customElements.get('vite-error-overlay');\n if (!ErrorOverlay) {\n return;\n }\n const err = ev.detail.error;\n const overlay = new ErrorOverlay(err);\n document.body.appendChild(overlay);\n });\n<\/script>\n<script>\n /**\n * Usage:\n *\n * <errored-host></errored-host>\n */\n class ErroredHost extends HTMLElement {\n get _root() {\n return this.shadowRoot || this;\n }\n\n constructor() {\n super();\n const self = this;\n\n this.state = {};\n if (!this.props) {\n this.props = {};\n }\n\n this.componentProps = ['children', 'error'];\n\n // used to keep track of all nodes created by show/for\n this.nodesToDestroy = [];\n // batch updates\n this.pendingUpdate = false;\n\n this.attachShadow({ mode: 'open' });\n }\n\n destroyAnyNodes() {\n // destroy current view template refs before rendering again\n this.nodesToDestroy.forEach((el) => el.remove());\n this.nodesToDestroy = [];\n }\n\n connectedCallback() {\n this.getAttributeNames().forEach((attr) => {\n const jsVar = attr.replace(/-/g, '');\n const regexp = new RegExp(jsVar, 'i');\n this.componentProps.forEach((prop) => {\n if (regexp.test(prop)) {\n const attrValue = this.getAttribute(attr);\n if (this.props[prop] !== attrValue) {\n this.props[prop] = attrValue;\n }\n }\n });\n });\n\n this._root.innerHTML = `\n\n <template data-el=\"show-errored-host\">\n <div class=\"error\">\n <template data-el=\"div-errored-host-2\">\n \x3c!-- String(props.error) --\x3e\n </template>\n </div>\n </template>\n\n <div class=\"arrow\">👇 Uncaught error happened here 👇\n <span class=\"dev-tools\">DevTools: Cmd+Alt+I</span>\n </div>\n <div class=\"div\">\n <slot></slot>\n </div>\n\n <style>\n .error {\n border-radius: 5px 5px 0px 0;\n background: black;\n color: white;\n font-family: monospace;\n font-size: 12px;\n margin: 0;\n padding: 10px;\n }\n .arrow {\n background: #f47e81;\n color: black;\n font-size: 14px;\n padding: 10px;\n text-align: center;\n font-family: sans-serif;\n }\n .dev-tools {\n background: red;\n padding: 2px 5px;\n border-radius: 3px;\n font-weight: 800;\n }\n .div {\n outline: 5px solid red;\n border-radius: 10px;\n }\n </style>`;\n this.pendingUpdate = true;\n\n this.render();\n this.onMount();\n this.pendingUpdate = false;\n this.update();\n }\n\n showContent(el) {\n // https://developer.mozilla.org/en-US/docs/Web/API/HTMLTemplateElement/content\n // grabs the content of a node that is between <template> tags\n // iterates through child nodes to register all content including text elements\n // attaches the content after the template\n\n const elementFragment = el.content.cloneNode(true);\n const children = Array.from(elementFragment.childNodes);\n children.forEach((child) => {\n if (el?.scope) {\n child.scope = el.scope;\n }\n if (el?.context) {\n child.context = el.context;\n }\n this.nodesToDestroy.push(child);\n });\n el.after(elementFragment);\n }\n\n onMount() {}\n\n onUpdate() {}\n\n update() {\n if (this.pendingUpdate === true) {\n return;\n }\n this.pendingUpdate = true;\n this.render();\n this.onUpdate();\n this.pendingUpdate = false;\n }\n\n render() {\n // re-rendering needs to ensure that all nodes generated by for/show are refreshed\n this.destroyAnyNodes();\n this.updateBindings();\n }\n\n updateBindings() {\n this._root.querySelectorAll(\"[data-el='show-errored-host']\").forEach((el) => {\n const whenCondition = this.props.error;\n if (whenCondition) {\n this.showContent(el);\n }\n });\n\n this._root.querySelectorAll(\"[data-el='div-errored-host-2']\").forEach((el) => {\n this.renderTextNode(el, String(this.props.error));\n });\n }\n\n // Helper to render content\n renderTextNode(el, text) {\n const textNode = document.createTextNode(text);\n if (el?.scope) {\n textNode.scope = el.scope;\n }\n if (el?.context) {\n textNode.context = el.context;\n }\n el.after(textNode);\n this.nodesToDestroy.push(el.nextSibling);\n }\n }\n\n customElements.define('errored-host', ErroredHost);\n<\/script>\n";
|
|
2886
|
-
var image_size_runtime_default = "<style>\n [data-qwik-cls] {\n outline: 2px solid red;\n }\n [data-qwik-cls]::after {\n position: absolute;\n font-size: 12px;\n content: 'CLS ' attr(data-qwik-cls);\n font-family: monospace;\n font-weight: bold;\n background: red;\n color: white;\n margin: -2px;\n padding: 1px;\n line-height: 1;\n pointer-events: none;\n }\n #qwik-image-warning-container {\n position: absolute !important;\n top: 0 !important;\n left: 0 !important;\n width: 0 !important;\n overflow: visible !important;\n height: 0 !important;\n pointer-events: none !important;\n contain: size layout style content;\n z-index: 1;\n }\n</style>\n<template id=\"qwik-image-warning-template\">\n <style>\n :host {\n position: absolute;\n border: 1px solid red;\n pointer-events: none;\n z-index: 1;\n contain: layout size;\n }\n\n #icon {\n border: 0;\n margin: 5px;\n color: black;\n max-width: 100%;\n width: 20px;\n background: yellow;\n border-radius: 100%;\n height: 20px;\n padding: 3px;\n pointer-events: all;\n cursor: pointer;\n }\n\n #icon svg {\n width: 100%;\n height: auto;\n pointer-events: none;\n }\n\n dialog {\n padding: 0;\n border: 0;\n margin: 0 5px;\n background: #ffffe8;\n color: black;\n width: 250px;\n font-size: 11px;\n position: absolute;\n inset-inline-start: unset;\n inset-inline-end: unset;\n border-radius: 5px;\n pointer-events: all;\n overflow: hidden;\n box-shadow: 0px -2px 20px 0px #0000002e;\n z-index: 10000;\n }\n\n .top {\n bottom: calc(100% + 5px);\n }\n .bottom {\n top: 40px;\n }\n .right {\n inset-inline-start: 0;\n inset-inline-end: unset;\n }\n .left {\n inset-inline-start: unset;\n inset-inline-end: calc(100% - 40px);\n }\n\n .content {\n padding: 5px;\n }\n\n #loc {\n background: #2e3801;\n color: #d2d2d2;\n font-family: monospace;\n padding: 3px 5px;\n pointer-events: all;\n margin: 0;\n border: 0;\n cursor: pointer;\n font-size: 11px;\n width: calc(100% - 24px);\n text-overflow: ellipsis;\n overflow: hidden;\n display: block;\n direction: rtl;\n text-align: right;\n }\n #loc:hover {\n background: #3a4a01;\n }\n\n pre {\n background: #f1fb8e;\n padding: 5px;\n margin: 5px 0;\n border-radius: 3px;\n user-select: none;\n }\n\n pre span {\n user-select: all;\n }\n\n a {\n text-decoration: underline;\n }\n\n #close {\n border: 0;\n width: 25px;\n height: 25px;\n position: absolute;\n right: 0;\n top: 0;\n background: #ffe14f;\n color: black;\n font-weight: 900;\n padding: 0;\n margin: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n line-height: 1;\n cursor: pointer;\n }\n #close:hover {\n background: #ffeb6f;\n }\n\n #action-btn {\n border: 2px solid #18ae00;\n padding: 2px 4px;\n background: #50ff50;\n border-radius: 5px;\n color: #0c5500;\n font-weight: 800;\n font-size: 10px;\n cursor: pointer;\n }\n\n p {\n margin: 5px 0;\n }\n\n h2 {\n font-weight: 900;\n margin: 10px 0;\n }\n </style>\n <button id=\"icon\" type=\"button\" aria-label=\"Open image dev dialog\">\n <svg width=\"32\" height=\"32\" viewBox=\"0 0 24 24\">\n <path\n fill=\"currentColor\"\n d=\"M2.725 21q-.275 0-.5-.138t-.35-.362q-.125-.225-.138-.488t.138-.512l9.25-16q.15-.25.388-.375T12 3q.25 0 .488.125t.387.375l9.25 16q.15.25.138.513t-.138.487q-.125.225-.35.363t-.5.137H2.725ZM12 18q.425 0 .713-.288T13 17q0-.425-.288-.713T12 16q-.425 0-.713.288T11 17q0 .425.288.713T12 18Zm0-3q.425 0 .713-.288T13 14v-3q0-.425-.288-.713T12 10q-.425 0-.713.288T11 11v3q0 .425.288.713T12 15Z\"\n />\n </svg>\n </button>\n <dialog>\n <form method=\"dialog\">\n <button id=\"close\" type=\"submit\" aria-label=\"Close\">X</button>\n </form>\n <button id=\"loc\"></button>\n <div class=\"content\">\n <h2 id=\"title\"></h2>\n <p id=\"message\"></p>\n <p class=\"action-container\"></p>\n </div>\n </dialog>\n</template>\n<div id=\"qwik-image-warning-container\"></div>\n<script>\n (function () {\n function getPositionClasses(target) {\n const { x, y } = target.getBoundingClientRect();\n const windowWidth = window.innerWidth;\n let horizontal = 'right';\n let vertical = 'bottom';\n if (x > windowWidth - 260) {\n horizontal = 'left';\n }\n return `${vertical} ${horizontal}`;\n }\n class ImageWarning extends HTMLElement {\n #actionFn = null;\n constructor() {\n super();\n this.attachShadow({ mode: 'open' });\n this.shadowRoot.appendChild(\n document.importNode(document.getElementById('qwik-image-warning-template').content, true)\n );\n const dialog = this.shadowRoot.querySelector('dialog');\n\n this.shadowRoot.addEventListener('click', async (ev) => {\n const target = ev.target;\n if (target.nodeName === 'BUTTON') {\n if (target.id === 'action-btn') {\n if (this.#actionFn) {\n this.#actionFn();\n dialog.close();\n }\n } else if (target.id === 'icon') {\n if (dialog.open) {\n dialog.close();\n } else {\n dialog.className = getPositionClasses(target);\n dialog.show();\n }\n } else if (target.id === 'loc' && target.dataset.url) {\n globalThis.qwikOpenInEditor(target.dataset.url);\n }\n }\n });\n }\n\n set loc(value) {\n const anchor = this.shadowRoot.querySelector('#loc');\n anchor.textContent = value;\n if (globalThis.qwikOpenInEditor) {\n anchor.dataset.url = value;\n }\n }\n\n set header(value) {\n this.shadowRoot.querySelector('#title').textContent = value;\n }\n\n set message(value) {\n this.shadowRoot.querySelector('#message').innerHTML = value;\n }\n\n set actionFn(value) {\n this.#actionFn = value;\n }\n set actionName(value) {\n if (value) {\n this.shadowRoot.querySelector('.action-container').innerHTML =\n `<button id=\"action-btn\" type=\"button\">${value}</button>`;\n }\n }\n }\n customElements.define('image-warning', ImageWarning);\n\n const shiftsMap = new Map();\n const visibleNodes = new Map();\n const imageContainer = document.querySelector('#qwik-image-warning-container');\n let skip = false;\n\n async function _getInfo(originalSrc) {\n // Put all supported protocols here, see also packages/qwik/src/optimizer/src/plugins/image-size-server.ts\n if (!/^(https?|file|capacitor):/.test(originalSrc)) {\n return undefined;\n }\n const url = new URL('/__image_info', location.href);\n url.searchParams.set('url', originalSrc);\n const res = await fetch(url);\n if (res.ok) {\n return await res.json();\n } else {\n return null;\n }\n }\n\n const map = new Map();\n function getInfo(originalSrc) {\n let p = map.get(originalSrc);\n if (typeof p === 'undefined') {\n p = _getInfo(originalSrc);\n map.set(originalSrc, p);\n }\n return p;\n }\n function isDefinedUnit(value) {\n return value.endsWith('px');\n }\n async function doImg(node) {\n const scrollX = window.scrollX;\n const scrollY = window.scrollY;\n const rect = node.getBoundingClientRect();\n const originalSrc = node.currentSrc;\n const info = await getInfo(originalSrc);\n let overlay = visibleNodes.get(node);\n const wideScreen = window.innerWidth > 500;\n if (info && wideScreen) {\n let layoutInvalidation = false;\n const loc = node.getAttribute('data-qwik-inspector');\n const browserArea = rect.width * rect.height;\n if (!node.hasAttribute('width') || !node.hasAttribute('height')) {\n skip = true;\n const computedStyles = getComputedStyle(node);\n const hasAspect = computedStyles.getPropertyValue('aspect-ratio').toString() !== 'auto';\n const hasWidth = isDefinedUnit(computedStyles.getPropertyValue('width').toString());\n const hasHeight = isDefinedUnit(computedStyles.getPropertyValue('height').toString());\n const isAbsolute = computedStyles.getPropertyValue('position').toString() === 'absolute';\n layoutInvalidation =\n browserArea > 1000 && !isAbsolute && !hasAspect && (!hasWidth || !hasHeight);\n }\n const realArea = info.width && info.height;\n const threshholdArea = realArea * 0.5;\n const tooBig = browserArea < threshholdArea && info.type !== 'svg';\n skip = false;\n if (layoutInvalidation || tooBig) {\n if (!overlay) {\n overlay = document.createElement('image-warning');\n imageContainer.appendChild(overlay);\n visibleNodes.set(node, overlay);\n }\n overlay.style.top = rect.top + scrollY + 'px';\n overlay.style.left = rect.left + scrollX + 'px';\n overlay.style.width = rect.width + 'px';\n overlay.style.height = rect.height + 'px';\n overlay.info = info;\n overlay.loc = loc;\n if (layoutInvalidation) {\n const clipBoard = `width=\"${info.width}\" height=\"${info.height}\"`;\n overlay.header = 'Perf: layout shift';\n overlay.message = `Image\\'s size is unknown until it\\'s loaded, <a href=\"https://web.dev/cls/\" target=\"_blank\" rel=\"noopener noreferrer\">causing layout shift</a>.</p><p>To solve this problem set the width/height in the img tag:</p><pre><img <span>${clipBoard}</span></pre>`;\n const uniqueLoc =\n document.querySelectorAll('[data-qwik-inspector=\"' + loc + '\"]').length === 1;\n if (loc) {\n if (uniqueLoc) {\n overlay.actionName = 'Auto fix';\n overlay.actionFn = async () => {\n const url = new URL('/__image_fix', location.href);\n url.searchParams.set('loc', loc);\n url.searchParams.set('width', info.width);\n url.searchParams.set('height', info.height);\n if (!node.srcset) {\n url.searchParams.set('src', node.currentSrc);\n url.searchParams.set('currentHref', location.href);\n }\n await fetch(url, {\n method: 'POST',\n });\n };\n } else {\n overlay.actionName = 'Open in editor';\n overlay.actionFn = async () => {\n await navigator.clipboard.writeText(clipBoard);\n globalThis.qwikOpenInEditor(loc);\n };\n }\n }\n } else if (tooBig) {\n overlay.header = 'Perf: properly size image';\n overlay.message = `The image is too big, <a href=\"https://developer.chrome.com/en/docs/lighthouse/performance/uses-responsive-images/\" target=\"_blank\" rel=\"noopener noreferrer\">hurting performance</a>, it should be resized to the size it\\'s displayed at. The image dimensions are ${info.width} x ${info.height} but it\\'s displayed at ${rect.width}x${rect.height}.</p>`;\n }\n return;\n }\n }\n\n if (overlay) {\n overlay.remove();\n visibleNodes.delete(node);\n }\n }\n\n async function updateImg(node) {\n const overlay = visibleNodes.get(node);\n if (!node.isConnected) {\n if (overlay) {\n overlay.remove();\n visibleNodes.delete(node);\n }\n } else if (node.complete) {\n doImg(node);\n }\n }\n\n const resizeObserver = new ResizeObserver((entries) => {\n if (!skip) {\n for (const entry of entries) {\n updateImg(entry.target);\n }\n }\n });\n\n const observer = new MutationObserver((entry) => {\n for (const mutation of entry) {\n for (const node of mutation.addedNodes) {\n if (node.nodeName === 'IMG') {\n resizeObserver.observe(node);\n } else if (node.nodeType === 1) {\n node.querySelectorAll('img').forEach((img) => {\n resizeObserver.observe(img);\n });\n }\n }\n for (const node of mutation.removedNodes) {\n if (node.nodeName === 'IMG') {\n updateImg(node);\n resizeObserver.unobserve(node);\n } else if (node.nodeType === 1) {\n node.querySelectorAll('img').forEach((img) => {\n updateImg(img);\n resizeObserver.unobserve(img);\n });\n }\n }\n }\n });\n let perfObserver;\n let DCLS = 0;\n const activate = () => {\n setTimeout(() => {\n if (perfObserver) {\n perfObserver.disconnect();\n if (DCLS > 0.005) {\n console.error('Detected Layout Shift during page load', DCLS);\n }\n }\n observer.observe(document.body, {\n childList: true,\n subtree: true,\n });\n document.body.querySelectorAll('img').forEach((node) => {\n resizeObserver.observe(node);\n });\n }, 100);\n };\n if (document.readyState === 'complete') {\n activate();\n } else {\n window.addEventListener('load', activate);\n }\n const pageAccessedByReload =\n performance?.navigation.type === 1 ||\n performance\n .getEntriesByType('navigation')\n .map((nav) => nav.type)\n .includes('reload');\n if (typeof PerformanceObserver !== 'undefined' && !pageAccessedByReload) {\n const shiftsMap = new Map();\n perfObserver = new PerformanceObserver((list) => {\n list.getEntries().forEach((entry) => {\n if (entry.hadRecentInput) {\n return; // Ignore shifts after recent input.\n }\n if (entry.value > 0.006) {\n for (const source of entry.sources) {\n if (\n source.node &&\n source.node.nodeType === 1 &&\n source.node.nodeName !== 'IMAGE-WARNING'\n ) {\n source.node.setAttribute('data-qwik-cls', Number(entry.value).toFixed(3));\n }\n }\n }\n DCLS += entry.value;\n });\n });\n perfObserver.observe({ type: 'layout-shift', buffered: true });\n }\n })();\n<\/script>\n";
|
|
2887
|
-
var perf_warning_default = "<script>\n if (!window.__qwikViteLog) {\n window.__qwikViteLog = true;\n console.debug(\n '%c⭐️ Qwik Dev SSR Mode',\n 'background: #0c75d2; color: white; padding: 2px 3px; border-radius: 2px; font-size: 0.8em;',\n \"App is running in SSR development mode!\\n - Additional JS is loaded by Vite for debugging and live reloading\\n - Rendering performance might not be optimal\\n - Delayed interactivity because prefetching is disabled\\n - Vite dev bundles do not represent production output\\n\\nProduction build can be tested running 'npm run preview'\"\n );\n }\n<\/script>\n";
|
|
2888
|
-
var VITE_ERROR_OVERLAY_STYLES = "\nvite-error-overlay {\n --color-bright: rgba(255, 255, 255, 0.8);\n --color-yellow: rgba(255,246,85,0.8);\n --qwik-dark-blue: #006ce9;\n --qwik-light-blue: #3ec2f7;\n --qwik-light-purple: #ac7ff4;\n --qwik-dark-purple: #713fc2;\n --yellow: #fff; /* override vite yellow */\n --purple: var(--color-bright); /* override vite purple */\n --red: var(--qwik-light-blue); /* override vite red */\n\n --vertical-box-spacing: 15px;\n --box-padding: 20px;\n --box-margin: 0 0 var(--vertical-box-spacing) 0;\n --box-background: rgba(0, 0, 0, 0.5);\n --box-border-radius: 8px;\n}\n\nvite-error-overlay::part(backdrop) {\n background: rgb(2 11 17 / 60%);\n backdrop-filter: blur(20px) brightness(0.4) saturate(3);\n}\n\nvite-error-overlay::part(window) {\n background: transparent;\n border: none;\n box-shadow: none;\n box-sizing: border-box;\n margin: 50px auto;\n max-width: 1200px;\n padding: var(--box-padding);\n width: 90%;\n}\n\nvite-error-overlay::part(message) {\n display: flex;\n flex-direction: column;\n font-size: 1.6rem;\n line-height: 1.7;\n margin-bottom: 30px;\n}\n\nvite-error-overlay::part(plugin) {\n font-size: 0.8rem;\n font-weight: 100;\n}\n\nvite-error-overlay::part(file),\nvite-error-overlay::part(frame),\nvite-error-overlay::part(stack),\nvite-error-overlay::part(tip) {\n background: var(--box-background);\n border-left: 5px solid transparent;\n border-radius: var(--box-border-radius);\n margin: var(--box-margin);\n min-height: 50px;\n padding: var(--box-padding);\n position: relative;\n}\n\nvite-error-overlay::part(file) {\n border-left-color: rgb(25 182 246);\n color: var(--color-bright);\n}\n\nvite-error-overlay::part(frame) {\n border-left-color: var(--color-yellow);\n color: var(--color-yellow);\n}\n\nvite-error-overlay::part(stack) {\n border-left-color: #FF5722;\n}\n\n\nvite-error-overlay::part(tip) {\n border-top: none;\n border-left-color: rgb(172, 127, 244);\n}\n\nvite-error-overlay::part(file):before,\nvite-error-overlay::part(frame):before,\nvite-error-overlay::part(stack):before {\n border-bottom: 1px solid #222;\n color: var(--color-bright);\n display: block;\n margin-bottom: 15px;\n padding-bottom: 5px;\n padding-left: 30px; /* space for icon */\n font-size: .8rem;\n}\n\nvite-error-overlay::part(file):before {\n content: 'File';\n}\n\nvite-error-overlay::part(frame):before {\n content: 'Frame';\n}\n\nvite-error-overlay::part(stack):before {\n content: 'Stack Trace';\n}\n\nvite-error-overlay::part(file):after,\nvite-error-overlay::part(frame):after,\nvite-error-overlay::part(stack):after {\n content: '';\n display: block;\n height: 20px;\n position: absolute;\n left: var(--box-padding);\n top: var(--box-padding);\n width: 20px;\n}\n\nvite-error-overlay::part(file):after {\n background-image: url(\"data:image/svg+xml,%3Csvg width='20px' height='20px' viewBox='0 0 24 24' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Ctitle%3EFile-Generic%3C/title%3E%3Cg id='Page-1' stroke='none' stroke-width='1' fill='none' fill-rule='evenodd'%3E%3Cg id='File-Generic'%3E%3Crect id='Rectangle' fill-rule='nonzero' x='0' y='0' width='24' height='24'%3E%3C/rect%3E%3Cpath d='M4 5 C4 3.89543 4.89543 3 6 3 L15.1716 3 C15.702 3 16.2107 3.21071 16.5858 3.58579 L19.4142 6.41421 C19.7893 6.78929 20 7.29799 20 7.82843 L20 19 C20 20.1046 19.1046 21 18 21 L6 21 C4.89543 21 4 20.1046 4 19 L4 5 Z' id='Path' stroke='rgba(255,255,255,0.7)' stroke-width='1' stroke-linecap='round'%3E%3C/path%3E%3Cpath d='M15 4 L15 6 C15 7.10457 15.8954 8 17 8 L19 8' id='Path' stroke='rgba(255,255,255,0.7)' stroke-width='1' stroke-linecap='round'%3E%3C/path%3E%3C/g%3E%3C/g%3E%3C/svg%3E\");\n}\n\nvite-error-overlay::part(frame):after {\n background-image: url(\"data:image/svg+xml,%3Csvg width='20px' height='20px' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M15.6602 2.84952H19.1516C20.2555 2.84952 21.1504 3.74444 21.1504 4.84839V8.3398' stroke='rgba(255,255,255,0.7)' stroke-width='1.69904' stroke-linecap='round'/%3E%3Cpath d='M2.84949 8.33981L2.84949 4.8484C2.84949 3.74446 3.74441 2.84953 4.84836 2.84953L8.33977 2.84953' stroke='rgba(255,255,255,0.7)' stroke-width='1.69904' stroke-linecap='round'/%3E%3Cpath d='M21.1505 15.6602L21.1505 19.1516C21.1505 20.2555 20.2556 21.1505 19.1516 21.1505L15.6602 21.1505' stroke='rgba(255,255,255,0.7)' stroke-width='1.69904' stroke-linecap='round'/%3E%3Cpath d='M8.33984 21.1505L4.84843 21.1505C3.74449 21.1505 2.84956 20.2555 2.84956 19.1516L2.84956 15.6602' stroke='rgba(255,255,255,0.7)' stroke-width='1.69904' stroke-linecap='round'/%3E%3C/svg%3E\");\n}\n\nvite-error-overlay::part(stack):after {\n background-image: url(\"data:image/svg+xml,%3Csvg width='20px' height='20px' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M14.78 20H9.78C7.98 20 4.58 19.09 4.58 15.64C4.58 12.19 7.98 11.28 9.78 11.28H14.22C14.37 11.28 17.92 11.23 17.92 8.42C17.92 5.61 14.37 5.56 14.22 5.56H9.22C9.02109 5.56 8.83032 5.48098 8.68967 5.34033C8.54902 5.19968 8.47 5.00891 8.47 4.81C8.47 4.61109 8.54902 4.42032 8.68967 4.27967C8.83032 4.13902 9.02109 4.06 9.22 4.06H14.22C16.02 4.06 19.42 4.97 19.42 8.42C19.42 11.87 16.02 12.78 14.22 12.78H9.78C9.63 12.78 6.08 12.83 6.08 15.64C6.08 18.45 9.63 18.5 9.78 18.5H14.78C14.9789 18.5 15.1697 18.579 15.3103 18.7197C15.451 18.8603 15.53 19.0511 15.53 19.25C15.53 19.4489 15.451 19.6397 15.3103 19.7803C15.1697 19.921 14.9789 20 14.78 20Z' fill='rgba(255,255,255,0.7)'/%3E%3Cpath d='M6.44 8.31C5.74314 8.30407 5.06363 8.09202 4.48708 7.70056C3.91054 7.30909 3.46276 6.75573 3.20018 6.11021C2.93759 5.46469 2.87195 4.75589 3.01153 4.07312C3.1511 3.39036 3.48965 2.76418 3.9845 2.2735C4.47935 1.78281 5.10837 1.44958 5.79229 1.31579C6.47622 1.182 7.18444 1.25363 7.82771 1.52167C8.47099 1.78971 9.02054 2.24215 9.40711 2.82199C9.79368 3.40182 9.99998 4.08311 10 4.78C10 5.2461 9.90773 5.70759 9.72846 6.13783C9.54919 6.56808 9.28648 6.95856 8.95551 7.28675C8.62453 7.61494 8.23184 7.87433 7.80009 8.04995C7.36834 8.22558 6.90609 8.31396 6.44 8.31ZM6.44 2.75C6.04444 2.75 5.65776 2.86729 5.32886 3.08706C4.99996 3.30682 4.74362 3.61918 4.59224 3.98463C4.44087 4.35008 4.40126 4.75221 4.47843 5.14018C4.5556 5.52814 4.74609 5.8845 5.02579 6.16421C5.3055 6.44391 5.66186 6.6344 6.04982 6.71157C6.43779 6.78874 6.83992 6.74913 7.20537 6.59776C7.57082 6.44638 7.88318 6.19003 8.10294 5.86114C8.32271 5.53224 8.44 5.14556 8.44 4.75C8.44 4.48735 8.38827 4.22728 8.28776 3.98463C8.18725 3.74198 8.03993 3.5215 7.85422 3.33578C7.6685 3.15007 7.44802 3.00275 7.20537 2.90224C6.96272 2.80173 6.70265 2.75 6.44 2.75Z' fill='rgba(255,255,255,0.7)'/%3E%3Cpath d='M17.56 22.75C16.8614 22.752 16.1779 22.5466 15.5961 22.1599C15.0143 21.7733 14.5603 21.2227 14.2916 20.5778C14.0229 19.933 13.9515 19.2229 14.0866 18.5375C14.2217 17.8521 14.5571 17.2221 15.0504 16.7275C15.5437 16.2328 16.1726 15.8956 16.8577 15.7586C17.5427 15.6215 18.253 15.6909 18.8986 15.9577C19.5442 16.2246 20.0961 16.6771 20.4844 17.2578C20.8727 17.8385 21.08 18.5214 21.08 19.22C21.08 20.1545 20.7095 21.0508 20.0496 21.7125C19.3898 22.3743 18.4945 22.7473 17.56 22.75ZM17.56 17.19C17.1644 17.19 16.7778 17.3073 16.4489 17.5271C16.12 17.7468 15.8636 18.0592 15.7122 18.4246C15.5609 18.7901 15.5213 19.1922 15.5984 19.5802C15.6756 19.9681 15.8661 20.3245 16.1458 20.6042C16.4255 20.8839 16.7819 21.0744 17.1698 21.1516C17.5578 21.2287 17.9599 21.1891 18.3254 21.0377C18.6908 20.8864 19.0032 20.63 19.2229 20.3011C19.4427 19.9722 19.56 19.5856 19.56 19.19C19.56 18.6596 19.3493 18.1508 18.9742 17.7758C18.5991 17.4007 18.0904 17.19 17.56 17.19Z' fill='rgba(255,255,255,0.7)'/%3E%3C/svg%3E\");\n}\n\nvite-error-overlay::part(tip):before {\n content: \"Not sure how to solve this? Visit https://qwik.dev or connect with the community on Discord.\";\n display: block;\n margin-bottom: 1em;\n}\n";
|
|
2889
|
-
globalThis.qDev;
|
|
2890
|
-
globalThis.qInspector;
|
|
2891
|
-
globalThis.qSerialize;
|
|
2892
|
-
globalThis.qDynamicPlatform;
|
|
2893
|
-
globalThis.qTest;
|
|
2894
|
-
globalThis.qRuntimeQrl;
|
|
2895
|
-
var SYNC_QRL = "<sync>";
|
|
2896
|
-
function getOrigin(req) {
|
|
2897
|
-
const {PROTOCOL_HEADER: PROTOCOL_HEADER, HOST_HEADER: HOST_HEADER} = process.env;
|
|
2898
|
-
const headers = req.headers;
|
|
2899
|
-
const protocol = PROTOCOL_HEADER && headers[PROTOCOL_HEADER.toLowerCase()] || (req.socket.encrypted || req.connection.encrypted ? "https" : "http");
|
|
2900
|
-
const host = HOST_HEADER && headers[HOST_HEADER.toLowerCase()] || headers[":authority"] || headers.host;
|
|
2901
|
-
return `${protocol}://${host}`;
|
|
2902
|
-
}
|
|
2903
|
-
function createSymbolMapper(base) {
|
|
2904
|
-
return (symbolName, _mapper, parent) => {
|
|
2905
|
-
if (symbolName === SYNC_QRL) {
|
|
2906
|
-
return [ symbolName, "" ];
|
|
2907
|
-
}
|
|
2908
|
-
if (!parent) {
|
|
2909
|
-
if (symbolName.startsWith("_")) {
|
|
2910
|
-
return [ symbolName, `${base}${QWIK_HANDLERS_ID}` ];
|
|
2911
|
-
}
|
|
2912
|
-
console.error("qwik vite-dev-server symbolMapper: unknown qrl requested without parent:", symbolName);
|
|
2913
|
-
return [ symbolName, `${base}${symbolName}.js` ];
|
|
2914
|
-
}
|
|
2915
|
-
const qrlFile = `${base}${parent.startsWith("/") ? parent.slice(1) : parent}_${symbolName}.js`;
|
|
2916
|
-
return [ symbolName, qrlFile ];
|
|
2917
|
-
};
|
|
2918
|
-
}
|
|
2919
|
-
var lazySymbolMapper = null;
|
|
2920
|
-
var symbolMapper = (symbolName, mapper, parent) => {
|
|
2921
|
-
if (lazySymbolMapper) {
|
|
2922
|
-
return lazySymbolMapper(symbolName, mapper, parent);
|
|
2923
|
-
}
|
|
2924
|
-
throw new Error("symbolMapper not initialized");
|
|
2925
|
-
};
|
|
2926
|
-
async function configureDevServer(base, server, opts, sys, path, isClientDevOnly, clientDevInput, devSsrServer) {
|
|
2927
|
-
var _a;
|
|
2928
|
-
symbolMapper = lazySymbolMapper = createSymbolMapper(base);
|
|
2929
|
-
if (!devSsrServer) {
|
|
2930
|
-
return;
|
|
2931
|
-
}
|
|
2932
|
-
const hasQwikRouter = null == (_a = server.config.plugins) ? void 0 : _a.some((plugin => "vite-plugin-qwik-router" === plugin.name));
|
|
2933
|
-
const cssImportedByCSS = new Set;
|
|
2934
|
-
server.middlewares.use((async (req, res, next) => {
|
|
2935
|
-
try {
|
|
2936
|
-
const {ORIGIN: ORIGIN} = process.env;
|
|
2937
|
-
const domain = ORIGIN ?? getOrigin(req);
|
|
2938
|
-
const url = new URL(req.originalUrl, domain);
|
|
2939
|
-
if (shouldSsrRender(req, url)) {
|
|
2940
|
-
const {_qwikEnvData: _qwikEnvData} = res;
|
|
2941
|
-
if (!_qwikEnvData && hasQwikRouter) {
|
|
2942
|
-
console.error(`not SSR rendering ${url} because Qwik Router Env data did not populate`);
|
|
2943
|
-
res.statusCode ||= 404;
|
|
2944
|
-
res.setHeader("Content-Type", "text/plain");
|
|
2945
|
-
res.writeHead(res.statusCode);
|
|
2946
|
-
res.end("Not a SSR URL according to Qwik Router");
|
|
2947
|
-
return;
|
|
2948
|
-
}
|
|
2949
|
-
const serverData = {
|
|
2950
|
-
..._qwikEnvData,
|
|
2951
|
-
url: url.href
|
|
2952
|
-
};
|
|
2953
|
-
const status = "number" === typeof res.statusCode ? res.statusCode : 200;
|
|
2954
|
-
if (isClientDevOnly) {
|
|
2955
|
-
const relPath = path.relative(opts.rootDir, clientDevInput);
|
|
2956
|
-
const entryUrl = "/" + relPath.replace(/\\/g, "/");
|
|
2957
|
-
let html = getViteDevIndexHtml(entryUrl, serverData);
|
|
2958
|
-
html = await server.transformIndexHtml(url.pathname, html);
|
|
2959
|
-
res.setHeader("Content-Type", "text/html; charset=utf-8");
|
|
2960
|
-
res.setHeader("Cache-Control", "no-cache, no-store, max-age=0");
|
|
2961
|
-
res.setHeader("Access-Control-Allow-Origin", "*");
|
|
2962
|
-
res.setHeader("X-Powered-By", "Qwik Vite Dev Server");
|
|
2963
|
-
res.writeHead(status);
|
|
2964
|
-
res.end(html);
|
|
2965
|
-
return;
|
|
2966
|
-
}
|
|
2967
|
-
const firstInput = opts.input && Object.values(opts.input)[0];
|
|
2968
|
-
const ssrModule = await server.ssrLoadModule(firstInput);
|
|
2969
|
-
const render = ssrModule.default ?? ssrModule.render;
|
|
2970
|
-
if ("function" === typeof render) {
|
|
2971
|
-
const manifest = {
|
|
2972
|
-
manifestHash: "",
|
|
2973
|
-
symbols: {},
|
|
2974
|
-
mapping: {},
|
|
2975
|
-
bundles: {},
|
|
2976
|
-
injections: [],
|
|
2977
|
-
version: "1"
|
|
2978
|
-
};
|
|
2979
|
-
const added = new Set;
|
|
2980
|
-
const CSS_EXTENSIONS = [ ".css", ".scss", ".sass", ".less", ".styl", ".stylus" ];
|
|
2981
|
-
const JS_EXTENSIONS = /\.[mc]?[tj]sx?$/;
|
|
2982
|
-
Array.from(server.moduleGraph.fileToModulesMap.entries()).forEach((entry => {
|
|
2983
|
-
entry[1].forEach((v => {
|
|
2984
|
-
var _a2, _b;
|
|
2985
|
-
const segment = null == (_b = null == (_a2 = v.info) ? void 0 : _a2.meta) ? void 0 : _b.segment;
|
|
2986
|
-
let url2 = v.url;
|
|
2987
|
-
v.lastHMRTimestamp && (url2 += `?t=${v.lastHMRTimestamp}`);
|
|
2988
|
-
segment && (manifest.mapping[segment.name] = relativeURL(url2, opts.rootDir));
|
|
2989
|
-
const {pathId: pathId, query: query} = parseId(v.url);
|
|
2990
|
-
if ("" === query && CSS_EXTENSIONS.some((ext => pathId.endsWith(ext)))) {
|
|
2991
|
-
const isEntryCSS = 0 === v.importers.size;
|
|
2992
|
-
const hasCSSImporter = Array.from(v.importers).some((importer => {
|
|
2993
|
-
const importerPath = importer.url || importer.file;
|
|
2994
|
-
const isCSS = importerPath && CSS_EXTENSIONS.some((ext => importerPath.endsWith(ext)));
|
|
2995
|
-
isCSS && v.url && cssImportedByCSS.add(v.url);
|
|
2996
|
-
return isCSS;
|
|
2997
|
-
}));
|
|
2998
|
-
const hasJSImporter = Array.from(v.importers).some((importer => {
|
|
2999
|
-
const importerPath = importer.url || importer.file;
|
|
3000
|
-
return importerPath && JS_EXTENSIONS.test(importerPath);
|
|
3001
|
-
}));
|
|
3002
|
-
if ((isEntryCSS || hasJSImporter) && !hasCSSImporter && !cssImportedByCSS.has(v.url) && !added.has(v.url)) {
|
|
3003
|
-
added.add(v.url);
|
|
3004
|
-
manifest.injections.push({
|
|
3005
|
-
tag: "link",
|
|
3006
|
-
location: "head",
|
|
3007
|
-
attributes: {
|
|
3008
|
-
rel: "stylesheet",
|
|
3009
|
-
href: `${base}${url2.slice(1)}`
|
|
3010
|
-
}
|
|
3011
|
-
});
|
|
3012
|
-
}
|
|
3013
|
-
}
|
|
3014
|
-
}));
|
|
3015
|
-
}));
|
|
3016
|
-
const renderOpts = {
|
|
3017
|
-
debug: true,
|
|
3018
|
-
locale: serverData.locale,
|
|
3019
|
-
stream: res,
|
|
3020
|
-
snapshot: !isClientDevOnly,
|
|
3021
|
-
manifest: isClientDevOnly ? void 0 : manifest,
|
|
3022
|
-
symbolMapper: isClientDevOnly ? void 0 : symbolMapper,
|
|
3023
|
-
prefetchStrategy: null,
|
|
3024
|
-
serverData: serverData,
|
|
3025
|
-
containerAttributes: {
|
|
3026
|
-
...serverData.containerAttributes
|
|
3027
|
-
}
|
|
3028
|
-
};
|
|
3029
|
-
res.setHeader("Content-Type", "text/html; charset=utf-8");
|
|
3030
|
-
res.setHeader("Cache-Control", "no-cache, no-store, max-age=0");
|
|
3031
|
-
res.setHeader("Access-Control-Allow-Origin", "*");
|
|
3032
|
-
res.setHeader("X-Powered-By", "Qwik Vite Dev Server");
|
|
3033
|
-
res.writeHead(status);
|
|
3034
|
-
const result = await render(renderOpts);
|
|
3035
|
-
"html" in result && res.write(result.html);
|
|
3036
|
-
Array.from(server.moduleGraph.fileToModulesMap.entries()).forEach((entry => {
|
|
3037
|
-
entry[1].forEach((v => {
|
|
3038
|
-
const {pathId: pathId, query: query} = parseId(v.url);
|
|
3039
|
-
if (!added.has(v.url) && "" === query && CSS_EXTENSIONS.some((ext => pathId.endsWith(ext)))) {
|
|
3040
|
-
const isEntryCSS = 0 === v.importers.size;
|
|
3041
|
-
const hasCSSImporter = Array.from(v.importers).some((importer => {
|
|
3042
|
-
const importerPath = importer.url || importer.file;
|
|
3043
|
-
const isCSS = importerPath && CSS_EXTENSIONS.some((ext => importerPath.endsWith(ext)));
|
|
3044
|
-
isCSS && v.url && cssImportedByCSS.add(v.url);
|
|
3045
|
-
return isCSS;
|
|
3046
|
-
}));
|
|
3047
|
-
const hasJSImporter = Array.from(v.importers).some((importer => {
|
|
3048
|
-
const importerPath = importer.url || importer.file;
|
|
3049
|
-
return importerPath && JS_EXTENSIONS.test(importerPath);
|
|
3050
|
-
}));
|
|
3051
|
-
if ((isEntryCSS || hasJSImporter) && !hasCSSImporter && !cssImportedByCSS.has(v.url)) {
|
|
3052
|
-
res.write(`<link rel="stylesheet" href="${base}${v.url.slice(1)}">`);
|
|
3053
|
-
added.add(v.url);
|
|
3054
|
-
}
|
|
3055
|
-
}
|
|
3056
|
-
}));
|
|
3057
|
-
}));
|
|
3058
|
-
res.write(END_SSR_SCRIPT(opts, opts.srcDir ? opts.srcDir : path.join(opts.rootDir, "src")));
|
|
3059
|
-
res.end();
|
|
3060
|
-
} else {
|
|
3061
|
-
next();
|
|
3062
|
-
}
|
|
3063
|
-
} else {
|
|
3064
|
-
next();
|
|
3065
|
-
}
|
|
3066
|
-
} catch (e) {
|
|
3067
|
-
if (e instanceof Error) {
|
|
3068
|
-
server.ssrFixStacktrace(e);
|
|
3069
|
-
await formatError(sys, e);
|
|
3070
|
-
}
|
|
3071
|
-
next(e);
|
|
3072
|
-
} finally {
|
|
3073
|
-
"function" === typeof res._qwikRenderResolve && res._qwikRenderResolve();
|
|
3074
|
-
}
|
|
3075
|
-
}));
|
|
3076
|
-
server.middlewares.use((function(err, _req, res, next) {
|
|
3077
|
-
res.writableEnded || res.write(`<style>${VITE_ERROR_OVERLAY_STYLES}</style>`);
|
|
3078
|
-
return next(err);
|
|
3079
|
-
}));
|
|
3080
|
-
setTimeout((() => {
|
|
3081
|
-
console.log(`\n 🚧 ${magenta("Please note that development mode is slower than production.")}`);
|
|
3082
|
-
}), 1e3);
|
|
3083
|
-
}
|
|
3084
|
-
async function configurePreviewServer(middlewares, ssrOutDir, sys, path) {
|
|
3085
|
-
const fs = await sys.dynamicImport("node:fs");
|
|
3086
|
-
const url = await sys.dynamicImport("node:url");
|
|
3087
|
-
const entryPreviewPaths = [ "mjs", "cjs", "js" ].map((ext => path.join(ssrOutDir, `entry.preview.${ext}`)));
|
|
3088
|
-
const entryPreviewModulePath = entryPreviewPaths.find((p => fs.existsSync(p)));
|
|
3089
|
-
if (!entryPreviewModulePath) {
|
|
3090
|
-
return invalidPreviewMessage(middlewares, `Unable to find output "${ssrOutDir}/entry.preview" module.\n\nPlease ensure "src/entry.preview.tsx" has been built before the "preview" command.`);
|
|
3091
|
-
}
|
|
3092
|
-
try {
|
|
3093
|
-
const entryPreviewImportPath = url.pathToFileURL(entryPreviewModulePath).href;
|
|
3094
|
-
const previewModuleImport = await sys.strictDynamicImport(entryPreviewImportPath);
|
|
3095
|
-
let previewMiddleware = null;
|
|
3096
|
-
let preview404Middleware = null;
|
|
3097
|
-
if (previewModuleImport.default) {
|
|
3098
|
-
if ("function" === typeof previewModuleImport.default) {
|
|
3099
|
-
previewMiddleware = previewModuleImport.default;
|
|
3100
|
-
} else if ("object" === typeof previewModuleImport.default) {
|
|
3101
|
-
previewMiddleware = previewModuleImport.default.router;
|
|
3102
|
-
preview404Middleware = previewModuleImport.default.notFound;
|
|
3103
|
-
}
|
|
3104
|
-
}
|
|
3105
|
-
if ("function" !== typeof previewMiddleware) {
|
|
3106
|
-
return invalidPreviewMessage(middlewares, `Entry preview module "${entryPreviewModulePath}" does not export a default middleware function`);
|
|
3107
|
-
}
|
|
3108
|
-
middlewares.use(previewMiddleware);
|
|
3109
|
-
"function" === typeof preview404Middleware && middlewares.use(preview404Middleware);
|
|
3110
|
-
} catch (e) {
|
|
3111
|
-
return invalidPreviewMessage(middlewares, String(e));
|
|
3112
|
-
}
|
|
3113
|
-
}
|
|
3114
|
-
function invalidPreviewMessage(middlewares, msg) {
|
|
3115
|
-
console.log(`\n❌ ${msg}\n`);
|
|
3116
|
-
middlewares.use(((_, res) => {
|
|
3117
|
-
res.writeHead(400, {
|
|
3118
|
-
"Content-Type": "text/plain"
|
|
3119
|
-
});
|
|
3120
|
-
res.end(msg);
|
|
3121
|
-
}));
|
|
3122
|
-
}
|
|
3123
|
-
var CYPRESS_DEV_SERVER_PATH = "/__cypress/src";
|
|
3124
|
-
var FS_PREFIX = "/@fs/";
|
|
3125
|
-
var VALID_ID_PREFIX = "/@id/";
|
|
3126
|
-
var VITE_PUBLIC_PATH = "/@vite/";
|
|
3127
|
-
var internalPrefixes = [ FS_PREFIX, VALID_ID_PREFIX, VITE_PUBLIC_PATH ];
|
|
3128
|
-
var InternalPrefixRE = new RegExp(`^(${CYPRESS_DEV_SERVER_PATH})?(?:${internalPrefixes.join("|")})`);
|
|
3129
|
-
var shouldSsrRender = (req, url) => {
|
|
3130
|
-
const pathname = url.pathname;
|
|
3131
|
-
if (/\.[\w?=&]+$/.test(pathname) && !pathname.endsWith(".html")) {
|
|
3132
|
-
return false;
|
|
3133
|
-
}
|
|
3134
|
-
if (pathname.includes("_-vite-ping")) {
|
|
3135
|
-
return false;
|
|
3136
|
-
}
|
|
3137
|
-
if (pathname.includes("__open-in-editor")) {
|
|
3138
|
-
return false;
|
|
3139
|
-
}
|
|
3140
|
-
if (url.searchParams.has("html-proxy")) {
|
|
3141
|
-
return false;
|
|
3142
|
-
}
|
|
3143
|
-
if ("false" === url.searchParams.get("ssr")) {
|
|
3144
|
-
return false;
|
|
3145
|
-
}
|
|
3146
|
-
if (InternalPrefixRE.test(url.pathname)) {
|
|
3147
|
-
return false;
|
|
3148
|
-
}
|
|
3149
|
-
if (pathname.includes("@qwik.dev/core/build")) {
|
|
3150
|
-
return false;
|
|
3151
|
-
}
|
|
3152
|
-
const acceptHeader = req.headers.accept || "";
|
|
3153
|
-
const accepts = acceptHeader.split(",").map((accept => accept.split(";")[0]));
|
|
3154
|
-
if (1 == accepts.length && accepts.includes("*/*")) {
|
|
3155
|
-
return true;
|
|
3156
|
-
}
|
|
3157
|
-
if (!accepts.includes("text/html")) {
|
|
3158
|
-
return false;
|
|
3159
|
-
}
|
|
3160
|
-
return true;
|
|
3161
|
-
};
|
|
3162
|
-
function relativeURL(url, base) {
|
|
3163
|
-
if (url.startsWith(base)) {
|
|
3164
|
-
url = url.slice(base.length);
|
|
3165
|
-
url.startsWith("/") || (url = "/" + url);
|
|
3166
|
-
}
|
|
3167
|
-
return url;
|
|
3168
|
-
}
|
|
3169
|
-
var DEV_QWIK_INSPECTOR = (opts, srcDir) => {
|
|
3170
|
-
const qwikdevtools = {
|
|
3171
|
-
hotKeys: opts.clickToSource ?? [],
|
|
3172
|
-
srcDir: new URL(srcDir + "/", "http://local.local").href
|
|
3173
|
-
};
|
|
3174
|
-
return `<script>\n globalThis.qwikdevtools = ${JSON.stringify(qwikdevtools)};\n <\/script>` + (opts.imageDevTools ? image_size_runtime_default : "") + (opts.clickToSource ? click_to_component_default : "");
|
|
3175
|
-
};
|
|
3176
|
-
var END_SSR_SCRIPT = (opts, srcDir) => `\n<style>${VITE_ERROR_OVERLAY_STYLES}</style>\n<script type="module" src="/@vite/client"><\/script>\n${error_host_default}\n${perf_warning_default}\n${DEV_QWIK_INSPECTOR(opts.devTools, srcDir)}\n`;
|
|
3177
|
-
function getViteDevIndexHtml(entryUrl, serverData) {
|
|
3178
|
-
return `<!DOCTYPE html>\n<html lang="en">\n <head>\n </head>\n <body>\n <script type="module">\n async function main() {\n const mod = await import("${entryUrl}?${VITE_DEV_CLIENT_QS}=");\n if (mod.default) {\n const serverData = JSON.parse(${JSON.stringify(JSON.stringify(serverData))})\n mod.default({\n serverData,\n });\n }\n }\n main();\n <\/script>\n ${error_host_default}\n </body>\n</html>`;
|
|
3179
|
-
}
|
|
3180
|
-
var VITE_DEV_CLIENT_QS = "qwik-vite-dev-client";
|
|
3181
|
-
var DEDUPE = [ QWIK_CORE_ID, QWIK_JSX_RUNTIME_ID, QWIK_JSX_DEV_RUNTIME_ID ];
|
|
3182
|
-
var STYLING = [ ".css", ".scss", ".sass", ".less", ".styl", ".stylus" ];
|
|
3183
|
-
var FONTS = [ ".woff", ".woff2", ".ttf" ];
|
|
3184
|
-
function qwikVite(qwikViteOpts = {}) {
|
|
3185
|
-
let isClientDevOnly = false;
|
|
3186
|
-
let clientDevInput;
|
|
3187
|
-
let tmpClientManifestPath;
|
|
3188
|
-
let viteCommand = "serve";
|
|
3189
|
-
let manifestInput = null;
|
|
3190
|
-
let clientOutDir = null;
|
|
3191
|
-
let basePathname = "/";
|
|
3192
|
-
let clientPublicOutDir = null;
|
|
3193
|
-
let viteAssetsDir;
|
|
3194
|
-
let srcDir = null;
|
|
3195
|
-
let rootDir = null;
|
|
3196
|
-
let ssrOutDir = null;
|
|
3197
|
-
const fileFilter = qwikViteOpts.fileFilter ? (id, type) => TRANSFORM_REGEX.test(id) || qwikViteOpts.fileFilter(id, type) : () => true;
|
|
3198
|
-
const injections = [];
|
|
3199
|
-
const qwikPlugin = createQwikPlugin(qwikViteOpts.optimizerOptions);
|
|
3200
|
-
async function loadQwikInsights(clientOutDir2 = "") {
|
|
3201
|
-
const sys = qwikPlugin.getSys();
|
|
3202
|
-
const cwdRelativePath = absolutePathAwareJoin(sys.path, rootDir || ".", clientOutDir2, "q-insights.json");
|
|
3203
|
-
const path = absolutePathAwareJoin(sys.path, process.cwd(), cwdRelativePath);
|
|
3204
|
-
const fs = await sys.dynamicImport("node:fs");
|
|
3205
|
-
if (fs.existsSync(path)) {
|
|
3206
|
-
qwikPlugin.log("Reading Qwik Insight data from: " + cwdRelativePath);
|
|
3207
|
-
return JSON.parse(await fs.promises.readFile(path, "utf-8"));
|
|
3208
|
-
}
|
|
3209
|
-
return null;
|
|
3210
|
-
}
|
|
3211
|
-
const api = {
|
|
3212
|
-
getOptimizer: () => qwikPlugin.getOptimizer(),
|
|
3213
|
-
getOptions: () => qwikPlugin.getOptions(),
|
|
3214
|
-
getManifest: () => manifestInput,
|
|
3215
|
-
getInsightsManifest: (clientOutDir2 = "") => loadQwikInsights(clientOutDir2),
|
|
3216
|
-
getRootDir: () => qwikPlugin.getOptions().rootDir,
|
|
3217
|
-
getClientOutDir: () => clientOutDir,
|
|
3218
|
-
getClientPublicOutDir: () => clientPublicOutDir,
|
|
3219
|
-
getAssetsDir: () => viteAssetsDir
|
|
3220
|
-
};
|
|
3221
|
-
const vitePluginPre = {
|
|
3222
|
-
name: "vite-plugin-qwik",
|
|
3223
|
-
enforce: "pre",
|
|
3224
|
-
api: api,
|
|
3225
|
-
async config(viteConfig, viteEnv) {
|
|
3226
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
3227
|
-
await qwikPlugin.init();
|
|
3228
|
-
const sys = qwikPlugin.getSys();
|
|
3229
|
-
const path = qwikPlugin.getPath();
|
|
3230
|
-
let target;
|
|
3231
|
-
target = (null == (_a = viteConfig.build) ? void 0 : _a.ssr) || "ssr" === viteEnv.mode ? "ssr" : "lib" === viteEnv.mode ? "lib" : "test" === viteEnv.mode ? "test" : "client";
|
|
3232
|
-
let buildMode;
|
|
3233
|
-
buildMode = "production" === viteEnv.mode ? "production" : "development" === viteEnv.mode ? "development" : "build" === viteCommand && "client" === target ? "production" : "development";
|
|
3234
|
-
viteCommand = viteEnv.command;
|
|
3235
|
-
isClientDevOnly = "serve" === viteCommand && "ssr" !== viteEnv.mode;
|
|
3236
|
-
qwikPlugin.debug(`vite config(), command: ${viteCommand}, env.mode: ${viteEnv.mode}`);
|
|
3237
|
-
"serve" === viteCommand ? qwikViteOpts.entryStrategy = {
|
|
3238
|
-
type: "segment"
|
|
3239
|
-
} : "ssr" === target ? qwikViteOpts.entryStrategy = {
|
|
3240
|
-
type: "hoist"
|
|
3241
|
-
} : "lib" === target && (qwikViteOpts.entryStrategy = {
|
|
3242
|
-
type: "inline"
|
|
3243
|
-
});
|
|
3244
|
-
const shouldFindVendors = !qwikViteOpts.disableVendorScan && ("lib" !== target || "serve" === viteCommand);
|
|
3245
|
-
viteAssetsDir = null == (_b = viteConfig.build) ? void 0 : _b.assetsDir;
|
|
3246
|
-
const useAssetsDir = "client" === target && !!viteAssetsDir && "_astro" !== viteAssetsDir;
|
|
3247
|
-
const pluginOpts = {
|
|
3248
|
-
target: target,
|
|
3249
|
-
buildMode: buildMode,
|
|
3250
|
-
csr: qwikViteOpts.csr,
|
|
3251
|
-
debug: qwikViteOpts.debug,
|
|
3252
|
-
entryStrategy: qwikViteOpts.entryStrategy,
|
|
3253
|
-
srcDir: qwikViteOpts.srcDir,
|
|
3254
|
-
rootDir: viteConfig.root,
|
|
3255
|
-
tsconfigFileNames: qwikViteOpts.tsconfigFileNames,
|
|
3256
|
-
resolveQwikBuild: true,
|
|
3257
|
-
transformedModuleOutput: qwikViteOpts.transformedModuleOutput,
|
|
3258
|
-
outDir: null == (_c = viteConfig.build) ? void 0 : _c.outDir,
|
|
3259
|
-
assetsDir: useAssetsDir ? viteAssetsDir : void 0,
|
|
3260
|
-
devTools: qwikViteOpts.devTools,
|
|
3261
|
-
sourcemap: !!(null == (_d = viteConfig.build) ? void 0 : _d.sourcemap),
|
|
3262
|
-
lint: qwikViteOpts.lint,
|
|
3263
|
-
experimental: qwikViteOpts.experimental
|
|
3264
|
-
};
|
|
3265
|
-
if (!qwikViteOpts.csr) {
|
|
3266
|
-
if ("ssr" === target) {
|
|
3267
|
-
"string" === typeof (null == (_e = viteConfig.build) ? void 0 : _e.ssr) ? pluginOpts.input = viteConfig.build.ssr : "string" === typeof (null == (_f = qwikViteOpts.ssr) ? void 0 : _f.input) && (pluginOpts.input = qwikViteOpts.ssr.input);
|
|
3268
|
-
(null == (_g = qwikViteOpts.ssr) ? void 0 : _g.outDir) && (pluginOpts.outDir = qwikViteOpts.ssr.outDir);
|
|
3269
|
-
pluginOpts.manifestInput = null == (_h = qwikViteOpts.ssr) ? void 0 : _h.manifestInput;
|
|
3270
|
-
} else if ("client" === target) {
|
|
3271
|
-
pluginOpts.input = null == (_i = qwikViteOpts.client) ? void 0 : _i.input;
|
|
3272
|
-
(null == (_j = qwikViteOpts.client) ? void 0 : _j.outDir) && (pluginOpts.outDir = qwikViteOpts.client.outDir);
|
|
3273
|
-
pluginOpts.manifestOutput = null == (_k = qwikViteOpts.client) ? void 0 : _k.manifestOutput;
|
|
3274
|
-
} else {
|
|
3275
|
-
"object" === typeof (null == (_l = viteConfig.build) ? void 0 : _l.lib) && (pluginOpts.input = null == (_m = viteConfig.build) ? void 0 : _m.lib.entry);
|
|
3276
|
-
}
|
|
3277
|
-
if ("node" === sys.env) {
|
|
3278
|
-
const fs = await sys.dynamicImport("node:fs");
|
|
3279
|
-
try {
|
|
3280
|
-
const rootDir2 = pluginOpts.rootDir ?? sys.cwd();
|
|
3281
|
-
const packageJsonPath = sys.path.join(rootDir2, "package.json");
|
|
3282
|
-
const pkgString = await fs.promises.readFile(packageJsonPath, "utf-8");
|
|
3283
|
-
try {
|
|
3284
|
-
const data = JSON.parse(pkgString);
|
|
3285
|
-
"string" === typeof data.name && (pluginOpts.scope = data.name);
|
|
3286
|
-
} catch (e) {
|
|
3287
|
-
console.error(e);
|
|
3288
|
-
}
|
|
3289
|
-
} catch {}
|
|
3290
|
-
const nodeOs = await sys.dynamicImport("node:os");
|
|
3291
|
-
const scopeSuffix = pluginOpts.scope ? `-${pluginOpts.scope.replace(/\//g, "--")}` : "";
|
|
3292
|
-
tmpClientManifestPath = path.join(nodeOs.tmpdir(), `vite-plugin-qwik-q-manifest${scopeSuffix}.json`);
|
|
3293
|
-
if ("ssr" === target && !pluginOpts.manifestInput) {
|
|
3294
|
-
try {
|
|
3295
|
-
const clientManifestStr = await fs.promises.readFile(tmpClientManifestPath, "utf-8");
|
|
3296
|
-
pluginOpts.manifestInput = JSON.parse(clientManifestStr);
|
|
3297
|
-
} catch {}
|
|
3298
|
-
}
|
|
3299
|
-
}
|
|
3300
|
-
}
|
|
3301
|
-
const opts = qwikPlugin.normalizeOptions(pluginOpts);
|
|
3302
|
-
manifestInput = pluginOpts.manifestInput || null;
|
|
3303
|
-
srcDir = opts.srcDir;
|
|
3304
|
-
rootDir = opts.rootDir;
|
|
3305
|
-
if (!qwikViteOpts.csr) {
|
|
3306
|
-
clientOutDir = qwikPlugin.normalizePath(sys.path.resolve(opts.rootDir, (null == (_n = qwikViteOpts.client) ? void 0 : _n.outDir) || CLIENT_OUT_DIR));
|
|
3307
|
-
clientPublicOutDir = viteConfig.base ? path.join(clientOutDir, viteConfig.base) : clientOutDir;
|
|
3308
|
-
ssrOutDir = qwikPlugin.normalizePath(sys.path.resolve(opts.rootDir, (null == (_o = qwikViteOpts.ssr) ? void 0 : _o.outDir) || SSR_OUT_DIR));
|
|
3309
|
-
clientDevInput = "string" === typeof (null == (_p = qwikViteOpts.client) ? void 0 : _p.devInput) ? path.resolve(opts.rootDir, qwikViteOpts.client.devInput) : opts.srcDir ? path.resolve(opts.srcDir, CLIENT_DEV_INPUT) : path.resolve(opts.rootDir, "src", CLIENT_DEV_INPUT);
|
|
3310
|
-
clientDevInput = qwikPlugin.normalizePath(clientDevInput);
|
|
3311
|
-
}
|
|
3312
|
-
const vendorRoots = shouldFindVendors ? await findQwikRoots(sys, sys.cwd()) : [];
|
|
3313
|
-
const vendorIds = vendorRoots.map((v => v.id));
|
|
3314
|
-
const isDevelopment = "development" === buildMode;
|
|
3315
|
-
const qDevKey = "globalThis.qDev";
|
|
3316
|
-
const qTestKey = "globalThis.qTest";
|
|
3317
|
-
const qInspectorKey = "globalThis.qInspector";
|
|
3318
|
-
const qSerializeKey = "globalThis.qSerialize";
|
|
3319
|
-
const qDev2 = (null == (_q = null == viteConfig ? void 0 : viteConfig.define) ? void 0 : _q[qDevKey]) ?? isDevelopment;
|
|
3320
|
-
const qInspector2 = (null == (_r = null == viteConfig ? void 0 : viteConfig.define) ? void 0 : _r[qInspectorKey]) ?? isDevelopment;
|
|
3321
|
-
const qSerialize2 = (null == (_s = null == viteConfig ? void 0 : viteConfig.define) ? void 0 : _s[qSerializeKey]) ?? isDevelopment;
|
|
3322
|
-
const updatedViteConfig = {
|
|
3323
|
-
ssr: {
|
|
3324
|
-
noExternal: [ QWIK_CORE_ID, QWIK_CORE_INTERNAL_ID, QWIK_CORE_SERVER, QWIK_BUILD_ID, ...vendorIds ]
|
|
3325
|
-
},
|
|
3326
|
-
envPrefix: [ "VITE_", "PUBLIC_" ],
|
|
3327
|
-
resolve: {
|
|
3328
|
-
dedupe: [ ...DEDUPE, ...vendorIds ],
|
|
3329
|
-
conditions: "production" === buildMode && "client" === target ? [ "min" ] : [],
|
|
3330
|
-
alias: {
|
|
3331
|
-
"@builder.io/qwik": "@qwik.dev/core",
|
|
3332
|
-
"@builder.io/qwik/build": "@qwik.dev/core/build",
|
|
3333
|
-
"@builder.io/qwik/server": "@qwik.dev/core/server",
|
|
3334
|
-
"@builder.io/qwik/jsx-runtime": "@qwik.dev/core/jsx-runtime",
|
|
3335
|
-
"@builder.io/qwik/jsx-dev-runtime": "@qwik.dev/core/jsx-dev-runtime",
|
|
3336
|
-
"@builder.io/qwik/optimizer": "@qwik.dev/core/optimizer",
|
|
3337
|
-
"@builder.io/qwik/loader": "@qwik.dev/core/loader",
|
|
3338
|
-
"@builder.io/qwik/cli": "@qwik.dev/core/cli",
|
|
3339
|
-
"@builder.io/qwik/testing": "@qwik.dev/core/testing"
|
|
3340
|
-
}
|
|
3341
|
-
},
|
|
3342
|
-
esbuild: "serve" !== viteCommand && {
|
|
3343
|
-
logLevel: "error",
|
|
3344
|
-
jsx: "automatic"
|
|
3345
|
-
},
|
|
3346
|
-
optimizeDeps: {
|
|
3347
|
-
exclude: [ QWIK_CORE_ID, QWIK_CORE_INTERNAL_ID, QWIK_CORE_SERVER, QWIK_JSX_RUNTIME_ID, QWIK_JSX_DEV_RUNTIME_ID, QWIK_BUILD_ID, QWIK_CLIENT_MANIFEST_ID, ...vendorIds, "@builder.io/qwik", "@builder.io/qwik-city" ]
|
|
3348
|
-
},
|
|
3349
|
-
build: {
|
|
3350
|
-
modulePreload: false,
|
|
3351
|
-
dynamicImportVarsOptions: {
|
|
3352
|
-
exclude: [ /./ ]
|
|
3353
|
-
},
|
|
3354
|
-
rollupOptions: {
|
|
3355
|
-
output: {
|
|
3356
|
-
manualChunks: qwikPlugin.manualChunks
|
|
3357
|
-
}
|
|
3358
|
-
}
|
|
3359
|
-
},
|
|
3360
|
-
define: {
|
|
3361
|
-
[qDevKey]: qDev2,
|
|
3362
|
-
[qInspectorKey]: qInspector2,
|
|
3363
|
-
[qSerializeKey]: qSerialize2,
|
|
3364
|
-
[qTestKey]: JSON.stringify("test" === process.env.NODE_ENV)
|
|
3365
|
-
}
|
|
3366
|
-
};
|
|
3367
|
-
if (!qwikViteOpts.csr) {
|
|
3368
|
-
const buildOutputDir = "client" === target && viteConfig.base ? path.join(opts.outDir, viteConfig.base) : opts.outDir;
|
|
3369
|
-
updatedViteConfig.build.cssCodeSplit = false;
|
|
3370
|
-
updatedViteConfig.build.outDir = buildOutputDir;
|
|
3371
|
-
const origOnwarn = null == (_t = updatedViteConfig.build.rollupOptions) ? void 0 : _t.onwarn;
|
|
3372
|
-
updatedViteConfig.build.rollupOptions = {
|
|
3373
|
-
input: opts.input,
|
|
3374
|
-
output: normalizeRollupOutputOptions(qwikPlugin, null == (_v = null == (_u = viteConfig.build) ? void 0 : _u.rollupOptions) ? void 0 : _v.output, useAssetsDir, buildOutputDir),
|
|
3375
|
-
preserveEntrySignatures: "exports-only",
|
|
3376
|
-
onwarn: (warning, warn) => {
|
|
3377
|
-
if ("typescript" === warning.plugin && warning.message.includes("outputToFilesystem")) {
|
|
3378
|
-
return;
|
|
3379
|
-
}
|
|
3380
|
-
origOnwarn ? origOnwarn(warning, warn) : warn(warning);
|
|
3381
|
-
}
|
|
3382
|
-
};
|
|
3383
|
-
if ("ssr" === opts.target) {
|
|
3384
|
-
if ("build" === viteCommand) {
|
|
3385
|
-
updatedViteConfig.publicDir = false;
|
|
3386
|
-
updatedViteConfig.build.ssr = true;
|
|
3387
|
-
null == (null == (_w = viteConfig.build) ? void 0 : _w.minify) && "production" === buildMode && (updatedViteConfig.build.minify = "esbuild");
|
|
3388
|
-
}
|
|
3389
|
-
} else if ("client" === opts.target) {
|
|
3390
|
-
isClientDevOnly && !opts.csr && (updatedViteConfig.build.rollupOptions.input = clientDevInput);
|
|
3391
|
-
} else if ("lib" === opts.target) {
|
|
3392
|
-
updatedViteConfig.build.minify = false;
|
|
3393
|
-
updatedViteConfig.build.rollupOptions.external = [ QWIK_CORE_ID, QWIK_CORE_INTERNAL_ID, QWIK_CORE_SERVER, QWIK_JSX_RUNTIME_ID, QWIK_JSX_DEV_RUNTIME_ID, QWIK_BUILD_ID, QWIK_CLIENT_MANIFEST_ID ];
|
|
3394
|
-
} else {
|
|
3395
|
-
updatedViteConfig.define = {
|
|
3396
|
-
[qDevKey]: true,
|
|
3397
|
-
[qTestKey]: true,
|
|
3398
|
-
[qInspectorKey]: false
|
|
3399
|
-
};
|
|
3400
|
-
}
|
|
3401
|
-
globalThis.qDev = qDev2;
|
|
3402
|
-
globalThis.qTest = true;
|
|
3403
|
-
globalThis.qInspector = qInspector2;
|
|
3404
|
-
}
|
|
3405
|
-
return updatedViteConfig;
|
|
3406
|
-
},
|
|
3407
|
-
async configResolved(config) {
|
|
3408
|
-
var _a, _b;
|
|
3409
|
-
basePathname = config.base;
|
|
3410
|
-
if (!(basePathname.startsWith("/") && basePathname.endsWith("/"))) {
|
|
3411
|
-
throw new Error("Vite's config.base must begin and end with /");
|
|
3412
|
-
}
|
|
3413
|
-
const sys = qwikPlugin.getSys();
|
|
3414
|
-
if ("node" === sys.env && !qwikViteOpts.entryStrategy) {
|
|
3415
|
-
try {
|
|
3416
|
-
const entryStrategy = await loadQwikInsights(qwikViteOpts.csr || null == (_a = qwikViteOpts.client) ? void 0 : _a.outDir);
|
|
3417
|
-
entryStrategy && (qwikViteOpts.entryStrategy = entryStrategy);
|
|
3418
|
-
} catch {}
|
|
3419
|
-
}
|
|
3420
|
-
const useSourcemap = !!config.build.sourcemap;
|
|
3421
|
-
useSourcemap && void 0 === (null == (_b = qwikViteOpts.optimizerOptions) ? void 0 : _b.sourcemap) && qwikPlugin.setSourceMapSupport(true);
|
|
3422
|
-
},
|
|
3423
|
-
async buildStart() {
|
|
3424
|
-
const resolver = this.resolve.bind(this);
|
|
3425
|
-
await qwikPlugin.validateSource(resolver);
|
|
3426
|
-
qwikPlugin.onDiagnostics(((diagnostics, optimizer, srcDir2) => {
|
|
3427
|
-
diagnostics.forEach((d => {
|
|
3428
|
-
const id = qwikPlugin.normalizePath(optimizer.sys.path.join(srcDir2, d.file));
|
|
3429
|
-
"error" === d.category ? this.error(createRollupError2(id, d)) : this.warn(createRollupError2(id, d));
|
|
3430
|
-
}));
|
|
3431
|
-
}));
|
|
3432
|
-
await qwikPlugin.buildStart(this);
|
|
3433
|
-
},
|
|
3434
|
-
resolveId(id, importer, resolveIdOpts) {
|
|
3435
|
-
if (id.startsWith("\0") || !fileFilter(id, "resolveId")) {
|
|
3436
|
-
return null;
|
|
3437
|
-
}
|
|
3438
|
-
if (isClientDevOnly && id === VITE_CLIENT_MODULE) {
|
|
3439
|
-
return id;
|
|
3440
|
-
}
|
|
3441
|
-
return qwikPlugin.resolveId(this, id, importer, resolveIdOpts);
|
|
3442
|
-
},
|
|
3443
|
-
load(id, loadOpts) {
|
|
3444
|
-
if (id.startsWith("\0") || !fileFilter(id, "load")) {
|
|
3445
|
-
return null;
|
|
3446
|
-
}
|
|
3447
|
-
id = qwikPlugin.normalizePath(id);
|
|
3448
|
-
const opts = qwikPlugin.getOptions();
|
|
3449
|
-
if (isClientDevOnly && id === VITE_CLIENT_MODULE) {
|
|
3450
|
-
return getViteDevModule(opts);
|
|
3451
|
-
}
|
|
3452
|
-
if ("serve" === viteCommand && id.endsWith(QWIK_CLIENT_MANIFEST_ID)) {
|
|
3453
|
-
return {
|
|
3454
|
-
code: "export const manifest = undefined;"
|
|
3455
|
-
};
|
|
3456
|
-
}
|
|
3457
|
-
return qwikPlugin.load(this, id, loadOpts);
|
|
3458
|
-
},
|
|
3459
|
-
transform(code, id, transformOpts) {
|
|
3460
|
-
if (id.startsWith("\0") || !fileFilter(id, "transform") || id.includes("?raw")) {
|
|
3461
|
-
return null;
|
|
3462
|
-
}
|
|
3463
|
-
if (isClientDevOnly) {
|
|
3464
|
-
const parsedId = parseId(id);
|
|
3465
|
-
parsedId.params.has(VITE_DEV_CLIENT_QS) && (code = updateEntryDev(code));
|
|
3466
|
-
}
|
|
3467
|
-
return qwikPlugin.transform(this, code, id, transformOpts);
|
|
3468
|
-
}
|
|
3469
|
-
};
|
|
3470
|
-
const vitePluginPost = {
|
|
3471
|
-
name: "vite-plugin-qwik-post",
|
|
3472
|
-
enforce: "post",
|
|
3473
|
-
generateBundle: {
|
|
3474
|
-
order: "post",
|
|
3475
|
-
async handler(_, rollupBundle) {
|
|
3476
|
-
var _a;
|
|
3477
|
-
const opts = qwikPlugin.getOptions();
|
|
3478
|
-
if ("client" === opts.target) {
|
|
3479
|
-
const outputAnalyzer = qwikPlugin.createOutputAnalyzer(rollupBundle);
|
|
3480
|
-
for (const [fileName, b] of Object.entries(rollupBundle)) {
|
|
3481
|
-
if ("asset" === b.type) {
|
|
3482
|
-
const baseFilename = basePathname + fileName;
|
|
3483
|
-
if (STYLING.some((ext => fileName.endsWith(ext)))) {
|
|
3484
|
-
"string" === typeof b.source && b.source.length < opts.inlineStylesUpToBytes ? injections.push({
|
|
3485
|
-
tag: "style",
|
|
3486
|
-
location: "head",
|
|
3487
|
-
attributes: {
|
|
3488
|
-
"data-src": baseFilename,
|
|
3489
|
-
dangerouslySetInnerHTML: b.source
|
|
3490
|
-
}
|
|
3491
|
-
}) : injections.push({
|
|
3492
|
-
tag: "link",
|
|
3493
|
-
location: "head",
|
|
3494
|
-
attributes: {
|
|
3495
|
-
rel: "stylesheet",
|
|
3496
|
-
href: baseFilename
|
|
3497
|
-
}
|
|
3498
|
-
});
|
|
3499
|
-
} else {
|
|
3500
|
-
const selectedFont = FONTS.find((ext => fileName.endsWith(ext)));
|
|
3501
|
-
selectedFont && injections.unshift({
|
|
3502
|
-
tag: "link",
|
|
3503
|
-
location: "head",
|
|
3504
|
-
attributes: {
|
|
3505
|
-
rel: "preload",
|
|
3506
|
-
href: baseFilename,
|
|
3507
|
-
as: "font",
|
|
3508
|
-
type: `font/${selectedFont.slice(1)}`,
|
|
3509
|
-
crossorigin: ""
|
|
3510
|
-
}
|
|
3511
|
-
});
|
|
3512
|
-
}
|
|
3513
|
-
}
|
|
3514
|
-
}
|
|
3515
|
-
for (const i of injections) {
|
|
3516
|
-
outputAnalyzer.addInjection(i);
|
|
3517
|
-
}
|
|
3518
|
-
const optimizer = qwikPlugin.getOptimizer();
|
|
3519
|
-
const manifest = await outputAnalyzer.generateManifest();
|
|
3520
|
-
manifest.platform = {
|
|
3521
|
-
...versions,
|
|
3522
|
-
vite: "",
|
|
3523
|
-
rollup: (null == (_a = this.meta) ? void 0 : _a.rollupVersion) || "",
|
|
3524
|
-
env: optimizer.sys.env,
|
|
3525
|
-
os: optimizer.sys.os
|
|
3526
|
-
};
|
|
3527
|
-
"node" === optimizer.sys.env && (manifest.platform.node = process.versions.node);
|
|
3528
|
-
const clientManifestStr = JSON.stringify(manifest, null, 2);
|
|
3529
|
-
this.emitFile({
|
|
3530
|
-
type: "asset",
|
|
3531
|
-
fileName: Q_MANIFEST_FILENAME,
|
|
3532
|
-
source: clientManifestStr
|
|
3533
|
-
});
|
|
3534
|
-
const assetsDir = qwikPlugin.getOptions().assetsDir || "";
|
|
3535
|
-
const useAssetsDir = !!assetsDir && "_astro" !== assetsDir;
|
|
3536
|
-
const sys = qwikPlugin.getSys();
|
|
3537
|
-
this.emitFile({
|
|
3538
|
-
type: "asset",
|
|
3539
|
-
fileName: sys.path.join(useAssetsDir ? assetsDir : "", "build", `q-bundle-graph-${manifest.manifestHash}.json`),
|
|
3540
|
-
source: JSON.stringify(convertManifestToBundleGraph(manifest))
|
|
3541
|
-
});
|
|
3542
|
-
const fs = await sys.dynamicImport("node:fs");
|
|
3543
|
-
const workerScriptPath = (await this.resolve("@qwik.dev/core/qwik-prefetch.js")).id;
|
|
3544
|
-
const workerScript = await fs.promises.readFile(workerScriptPath, "utf-8");
|
|
3545
|
-
const qwikPrefetchServiceWorkerFile = "qwik-prefetch-service-worker.js";
|
|
3546
|
-
this.emitFile({
|
|
3547
|
-
type: "asset",
|
|
3548
|
-
fileName: useAssetsDir ? sys.path.join(assetsDir, "build", qwikPrefetchServiceWorkerFile) : qwikPrefetchServiceWorkerFile,
|
|
3549
|
-
source: workerScript
|
|
3550
|
-
});
|
|
3551
|
-
"function" === typeof opts.manifestOutput && await opts.manifestOutput(manifest);
|
|
3552
|
-
"function" === typeof opts.transformedModuleOutput && await opts.transformedModuleOutput(qwikPlugin.getTransformedOutputs());
|
|
3553
|
-
if (tmpClientManifestPath && "node" === sys.env) {
|
|
3554
|
-
const fs2 = await sys.dynamicImport("node:fs");
|
|
3555
|
-
await fs2.promises.writeFile(tmpClientManifestPath, clientManifestStr);
|
|
3556
|
-
}
|
|
3557
|
-
}
|
|
3558
|
-
}
|
|
3559
|
-
},
|
|
3560
|
-
async writeBundle(_, rollupBundle) {
|
|
3561
|
-
const opts = qwikPlugin.getOptions();
|
|
3562
|
-
if ("ssr" === opts.target) {
|
|
3563
|
-
const sys = qwikPlugin.getSys();
|
|
3564
|
-
if ("node" === sys.env) {
|
|
3565
|
-
const outputs = Object.keys(rollupBundle);
|
|
3566
|
-
const patchModuleFormat = async bundeName => {
|
|
3567
|
-
try {
|
|
3568
|
-
const bundleFileName = sys.path.basename(bundeName);
|
|
3569
|
-
const ext = sys.path.extname(bundleFileName);
|
|
3570
|
-
const isEntryFile = bundleFileName.startsWith("entry.") || bundleFileName.startsWith("entry_");
|
|
3571
|
-
if (isEntryFile && !bundleFileName.includes("preview") && (".mjs" === ext || ".cjs" === ext)) {
|
|
3572
|
-
const extlessName = sys.path.basename(bundleFileName, ext);
|
|
3573
|
-
const js = `${extlessName}.js`;
|
|
3574
|
-
const moduleName = extlessName + ext;
|
|
3575
|
-
const hasJsScript = outputs.some((f => sys.path.basename(f) === js));
|
|
3576
|
-
if (!hasJsScript) {
|
|
3577
|
-
const bundleOutDir = sys.path.dirname(bundeName);
|
|
3578
|
-
const fs = await sys.dynamicImport("node:fs");
|
|
3579
|
-
const folder = sys.path.join(opts.outDir, bundleOutDir);
|
|
3580
|
-
await fs.promises.mkdir(folder, {
|
|
3581
|
-
recursive: true
|
|
3582
|
-
});
|
|
3583
|
-
await fs.promises.writeFile(sys.path.join(folder, js), `export * from "./${moduleName}";`);
|
|
3584
|
-
}
|
|
3585
|
-
}
|
|
3586
|
-
} catch (e) {
|
|
3587
|
-
console.error("patchModuleFormat", e);
|
|
3588
|
-
}
|
|
3589
|
-
};
|
|
3590
|
-
await Promise.all(outputs.map(patchModuleFormat));
|
|
3591
|
-
}
|
|
3592
|
-
}
|
|
3593
|
-
},
|
|
3594
|
-
configureServer(server) {
|
|
3595
|
-
qwikPlugin.configureServer(server);
|
|
3596
|
-
const devSsrServer = !("devSsrServer" in qwikViteOpts) || !!qwikViteOpts.devSsrServer;
|
|
3597
|
-
const imageDevTools = !qwikViteOpts.devTools || !("imageDevTools" in qwikViteOpts.devTools) || qwikViteOpts.devTools.imageDevTools;
|
|
3598
|
-
imageDevTools && server.middlewares.use(getImageSizeServer(qwikPlugin.getSys(), rootDir, srcDir));
|
|
3599
|
-
if (!qwikViteOpts.csr) {
|
|
3600
|
-
const plugin = async () => {
|
|
3601
|
-
const opts = qwikPlugin.getOptions();
|
|
3602
|
-
const sys = qwikPlugin.getSys();
|
|
3603
|
-
const path = qwikPlugin.getPath();
|
|
3604
|
-
await configureDevServer(basePathname, server, opts, sys, path, isClientDevOnly, clientDevInput, devSsrServer);
|
|
3605
|
-
};
|
|
3606
|
-
const isNEW = true === globalThis.__qwikRouterNew || true === globalThis.__qwikCityNew;
|
|
3607
|
-
return isNEW ? plugin : plugin();
|
|
3608
|
-
}
|
|
3609
|
-
},
|
|
3610
|
-
configurePreviewServer: server => async () => {
|
|
3611
|
-
const sys = qwikPlugin.getSys();
|
|
3612
|
-
const path = qwikPlugin.getPath();
|
|
3613
|
-
await configurePreviewServer(server.middlewares, ssrOutDir, sys, path);
|
|
3614
|
-
},
|
|
3615
|
-
handleHotUpdate(ctx) {
|
|
3616
|
-
qwikPlugin.handleHotUpdate(ctx);
|
|
3617
|
-
ctx.modules.length && ctx.server.hot.send({
|
|
3618
|
-
type: "full-reload"
|
|
3619
|
-
});
|
|
3620
|
-
},
|
|
3621
|
-
onLog(level, log) {
|
|
3622
|
-
var _a, _b, _c;
|
|
3623
|
-
if ("vite-plugin-qwik" == log.plugin) {
|
|
3624
|
-
const color = LOG_COLOR[level] || ANSI_COLOR.White;
|
|
3625
|
-
const frames = (log.frame || "").split("\n").map((line => (line.match(/^\s*\^\s*$/) ? ANSI_COLOR.BrightWhite : ANSI_COLOR.BrightBlack) + line));
|
|
3626
|
-
console[level](`${color}%s\n${ANSI_COLOR.BrightWhite}%s\n%s${ANSI_COLOR.RESET}`, `[${log.plugin}](${level}): ${log.message}\n`, ` ${null == (_a = null == log ? void 0 : log.loc) ? void 0 : _a.file}:${null == (_b = null == log ? void 0 : log.loc) ? void 0 : _b.line}:${null == (_c = null == log ? void 0 : log.loc) ? void 0 : _c.column}\n`, ` ${frames.join("\n ")}\n`);
|
|
3627
|
-
return false;
|
|
3628
|
-
}
|
|
3629
|
-
}
|
|
3630
|
-
};
|
|
3631
|
-
return [ vitePluginPre, vitePluginPost ];
|
|
3632
|
-
}
|
|
3633
|
-
var ANSI_COLOR = {
|
|
3634
|
-
Black: "[30m",
|
|
3635
|
-
Red: "[31m",
|
|
3636
|
-
Green: "[32m",
|
|
3637
|
-
Yellow: "[33m",
|
|
3638
|
-
Blue: "[34m",
|
|
3639
|
-
Magenta: "[35m",
|
|
3640
|
-
Cyan: "[36m",
|
|
3641
|
-
White: "[37m",
|
|
3642
|
-
BrightBlack: "[90m",
|
|
3643
|
-
BrightRed: "[91m",
|
|
3644
|
-
BrightGreen: "[92m",
|
|
3645
|
-
BrightYellow: "[93m",
|
|
3646
|
-
BrightBlue: "[94m",
|
|
3647
|
-
BrightMagenta: "[95m",
|
|
3648
|
-
BrightCyan: "[96m",
|
|
3649
|
-
BrightWhite: "[97m",
|
|
3650
|
-
RESET: "[0m"
|
|
3651
|
-
};
|
|
3652
|
-
var LOG_COLOR = {
|
|
3653
|
-
warn: ANSI_COLOR.Yellow,
|
|
3654
|
-
info: ANSI_COLOR.Cyan,
|
|
3655
|
-
debug: ANSI_COLOR.BrightBlack
|
|
3656
|
-
};
|
|
3657
|
-
function updateEntryDev(code) {
|
|
3658
|
-
code = code.replace(/["']@builder.io\/qwik["']/g, `'${VITE_CLIENT_MODULE}'`);
|
|
3659
|
-
return code;
|
|
3660
|
-
}
|
|
3661
|
-
function getViteDevModule(opts) {
|
|
3662
|
-
const qwikLoader = JSON.stringify(opts.debug ? QWIK_LOADER_DEFAULT_DEBUG : QWIK_LOADER_DEFAULT_MINIFIED);
|
|
3663
|
-
return `// Qwik Vite Dev Module\nimport { render as qwikRender } from '@qwik.dev/core';\n\nexport async function render(document, rootNode, opts) {\n\n await qwikRender(document, rootNode, opts);\n\n let qwikLoader = document.getElementById('qwikloader');\n if (!qwikLoader) {\n qwikLoader = document.createElement('script');\n qwikLoader.id = 'qwikloader';\n qwikLoader.innerHTML = ${qwikLoader};\n const parent = document.head ?? document.body ?? document.documentElement;\n parent.appendChild(qwikLoader);\n }\n\n if (!window.__qwikViteLog) {\n window.__qwikViteLog = true;\n console.debug("%c⭐️ Qwik Client Mode","background: #0c75d2; color: white; padding: 2px 3px; border-radius: 2px; font-size: 0.8em;","Do not use this mode in production!\\n - No portion of the application is pre-rendered on the server\\n - All of the application is running eagerly in the browser\\n - Optimizer/Serialization/Deserialization code is not exercised!");\n }\n}`;
|
|
3664
|
-
}
|
|
3665
|
-
async function findDepPkgJsonPath(sys, dep, parent) {
|
|
3666
|
-
const fs = await sys.dynamicImport("node:fs");
|
|
3667
|
-
let root = parent;
|
|
3668
|
-
while (root) {
|
|
3669
|
-
const pkg = sys.path.join(root, "node_modules", dep, "package.json");
|
|
3670
|
-
try {
|
|
3671
|
-
await fs.promises.access(pkg);
|
|
3672
|
-
return fs.promises.realpath(pkg);
|
|
3673
|
-
} catch {}
|
|
3674
|
-
const nextRoot = sys.path.dirname(root);
|
|
3675
|
-
if (nextRoot === root) {
|
|
3676
|
-
break;
|
|
3677
|
-
}
|
|
3678
|
-
root = nextRoot;
|
|
3679
|
-
}
|
|
3680
|
-
return;
|
|
3681
|
-
}
|
|
3682
|
-
var findQwikRoots = async (sys, packageJsonDir) => {
|
|
3683
|
-
const paths = new Map;
|
|
3684
|
-
if ("node" === sys.env) {
|
|
3685
|
-
const fs = await sys.dynamicImport("node:fs");
|
|
3686
|
-
let prevPackageJsonDir;
|
|
3687
|
-
do {
|
|
3688
|
-
try {
|
|
3689
|
-
const data = await fs.promises.readFile(sys.path.join(packageJsonDir, "package.json"), {
|
|
3690
|
-
encoding: "utf-8"
|
|
3691
|
-
});
|
|
3692
|
-
try {
|
|
3693
|
-
const packageJson = JSON.parse(data);
|
|
3694
|
-
const dependencies = packageJson.dependencies;
|
|
3695
|
-
const devDependencies = packageJson.devDependencies;
|
|
3696
|
-
const packages = [];
|
|
3697
|
-
"object" === typeof dependencies && packages.push(...Object.keys(dependencies));
|
|
3698
|
-
"object" === typeof devDependencies && packages.push(...Object.keys(devDependencies));
|
|
3699
|
-
const basedir = sys.cwd();
|
|
3700
|
-
await Promise.all(packages.map((async id => {
|
|
3701
|
-
const pkgJsonPath = await findDepPkgJsonPath(sys, id, basedir);
|
|
3702
|
-
if (pkgJsonPath) {
|
|
3703
|
-
const pkgJsonContent = await fs.promises.readFile(pkgJsonPath, "utf-8");
|
|
3704
|
-
const pkgJson = JSON.parse(pkgJsonContent);
|
|
3705
|
-
const qwikPath = pkgJson.qwik;
|
|
3706
|
-
if (!qwikPath) {
|
|
3707
|
-
return;
|
|
3708
|
-
}
|
|
3709
|
-
const allPaths = Array.isArray(qwikPath) ? qwikPath : [ qwikPath ];
|
|
3710
|
-
for (const p of allPaths) {
|
|
3711
|
-
paths.set(await fs.promises.realpath(sys.path.resolve(sys.path.dirname(pkgJsonPath), p)), id);
|
|
3712
|
-
}
|
|
3713
|
-
}
|
|
3714
|
-
})));
|
|
3715
|
-
} catch (e) {
|
|
3716
|
-
console.error(e);
|
|
3717
|
-
}
|
|
3718
|
-
} catch (e) {}
|
|
3719
|
-
prevPackageJsonDir = packageJsonDir;
|
|
3720
|
-
packageJsonDir = sys.path.dirname(packageJsonDir);
|
|
3721
|
-
} while (packageJsonDir !== prevPackageJsonDir);
|
|
3722
|
-
}
|
|
3723
|
-
return Array.from(paths).map((([path, id]) => ({
|
|
3724
|
-
path: path,
|
|
3725
|
-
id: id
|
|
3726
|
-
})));
|
|
3727
|
-
};
|
|
3728
|
-
var VITE_CLIENT_MODULE = "@qwik.dev/core/vite-client";
|
|
3729
|
-
var CLIENT_DEV_INPUT = "entry.dev";
|
|
3730
|
-
function absolutePathAwareJoin(path, ...segments) {
|
|
3731
|
-
for (let i = segments.length - 1; i >= 0; --i) {
|
|
3732
|
-
const segment = segments[i];
|
|
3733
|
-
if (segment.startsWith(path.sep) || -1 !== segment.indexOf(path.delimiter)) {
|
|
3734
|
-
segments.splice(0, i);
|
|
3735
|
-
break;
|
|
3736
|
-
}
|
|
3737
|
-
}
|
|
3738
|
-
return path.join(...segments);
|
|
3739
|
-
}
|
|
3740
|
-
function convertManifestToBundleGraph(manifest) {
|
|
3741
|
-
const bundleGraph = [];
|
|
3742
|
-
const graph = manifest.bundles;
|
|
3743
|
-
if (!graph) {
|
|
3744
|
-
return [];
|
|
3745
|
-
}
|
|
3746
|
-
const names = Object.keys(graph).sort();
|
|
3747
|
-
const map = new Map;
|
|
3748
|
-
const clearTransitiveDeps = (parentDeps, seen, bundleName) => {
|
|
3749
|
-
const bundle = graph[bundleName];
|
|
3750
|
-
if (!bundle) {
|
|
3751
|
-
return;
|
|
3752
|
-
}
|
|
3753
|
-
for (const dep of bundle.imports || []) {
|
|
3754
|
-
parentDeps.has(dep) && parentDeps.delete(dep);
|
|
3755
|
-
if (!seen.has(dep)) {
|
|
3756
|
-
seen.add(dep);
|
|
3757
|
-
clearTransitiveDeps(parentDeps, seen, dep);
|
|
3758
|
-
}
|
|
3759
|
-
}
|
|
3760
|
-
};
|
|
3761
|
-
for (const bundleName of names) {
|
|
3762
|
-
const bundle = graph[bundleName];
|
|
3763
|
-
const index = bundleGraph.length;
|
|
3764
|
-
const deps = new Set(bundle.imports);
|
|
3765
|
-
for (const depName of deps) {
|
|
3766
|
-
if (!graph[depName]) {
|
|
3767
|
-
continue;
|
|
3768
|
-
}
|
|
3769
|
-
clearTransitiveDeps(deps, new Set, depName);
|
|
3770
|
-
}
|
|
3771
|
-
let didAdd = false;
|
|
3772
|
-
for (const depName of bundle.dynamicImports || []) {
|
|
3773
|
-
const dep = graph[depName];
|
|
3774
|
-
if (!graph[depName]) {
|
|
3775
|
-
continue;
|
|
3776
|
-
}
|
|
3777
|
-
if (dep.isTask) {
|
|
3778
|
-
if (!didAdd) {
|
|
3779
|
-
deps.add("<dynamic>");
|
|
3780
|
-
didAdd = true;
|
|
3781
|
-
}
|
|
3782
|
-
deps.add(depName);
|
|
3783
|
-
}
|
|
3784
|
-
}
|
|
3785
|
-
map.set(bundleName, {
|
|
3786
|
-
index: index,
|
|
3787
|
-
deps: deps
|
|
3788
|
-
});
|
|
3789
|
-
bundleGraph.push(bundleName);
|
|
3790
|
-
while (index + deps.size >= bundleGraph.length) {
|
|
3791
|
-
bundleGraph.push(null);
|
|
3792
|
-
}
|
|
3793
|
-
}
|
|
3794
|
-
for (const bundleName of names) {
|
|
3795
|
-
const bundle = map.get(bundleName);
|
|
3796
|
-
if (!bundle) {
|
|
3797
|
-
console.warn(`Bundle ${bundleName} not found in the bundle graph.`);
|
|
3798
|
-
continue;
|
|
3799
|
-
}
|
|
3800
|
-
let {index: index, deps: deps} = bundle;
|
|
3801
|
-
index++;
|
|
3802
|
-
for (const depName of deps) {
|
|
3803
|
-
if ("<dynamic>" === depName) {
|
|
3804
|
-
bundleGraph[index++] = -1;
|
|
3805
|
-
continue;
|
|
3806
|
-
}
|
|
3807
|
-
const dep = map.get(depName);
|
|
3808
|
-
if (!dep) {
|
|
3809
|
-
console.warn(`Dependency ${depName} of ${bundleName} not found in the bundle graph.`);
|
|
3810
|
-
continue;
|
|
3811
|
-
}
|
|
3812
|
-
const depIndex = dep.index;
|
|
3813
|
-
bundleGraph[index++] = depIndex;
|
|
3814
|
-
}
|
|
3815
|
-
}
|
|
3816
|
-
return bundleGraph;
|
|
3817
|
-
}
|
|
3818
|
-
return module.exports;
|
|
3819
|
-
}("object" === typeof module && module.exports ? module : {
|
|
3820
|
-
exports: {}
|
|
3821
|
-
});
|
|
7
|
+
*/"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function Z(e={}){function n(p){if(typeof p!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(p))}function i(p,l){let s="",b=0,h=-1,I=0,w;for(let T=0;T<=p.length;++T){if(T<p.length)w=p.charCodeAt(T);else{if(w===47)break;w=47}if(w===47){if(!(h===T-1||I===1))if(h!==T-1&&I===2){if(s.length<2||b!==2||s.charCodeAt(s.length-1)!==46||s.charCodeAt(s.length-2)!==46){if(s.length>2){const E=s.lastIndexOf("/");if(E!==s.length-1){E===-1?(s="",b=0):(s=s.slice(0,E),b=s.length-1-s.lastIndexOf("/")),h=T,I=0;continue}}else if(s.length===2||s.length===1){s="",b=0,h=T,I=0;continue}}l&&(s.length>0?s+="/..":s="..",b=2)}else s.length>0?s+="/"+p.slice(h+1,T):s=p.slice(h+1,T),b=T-h-1;h=T,I=0}else w===46&&I!==-1?++I:I=-1}return s}function r(p,l){const s=l.dir||l.root,b=l.base||(l.name||"")+(l.ext||"");return s?s===l.root?s+b:s+p+b:b}const o=function(...l){let s="",b=!1,h;for(let I=l.length-1;I>=-1&&!b;I--){let w;I>=0?w=l[I]:(h===void 0&&(e&&typeof e.cwd=="function"?h=e.cwd():typeof process<"u"&&typeof process.cwd=="function"?h=process.cwd():h="/"),w=h),n(w),w.length!==0&&(s=w+"/"+s,b=w.charCodeAt(0)===47)}return s=i(s,!b),b?s.length>0?"/"+s:"/":s.length>0?s:"."},d=function(l){if(n(l),l.length===0)return".";const s=l.charCodeAt(0)===47,b=l.charCodeAt(l.length-1)===47;return l=i(l,!s),l.length===0&&!s&&(l="."),l.length>0&&b&&(l+="/"),s?"/"+l:l},c=function(l){return n(l),l.length>0&&l.charCodeAt(0)===47},a=function(...l){if(l.length===0)return".";let s;for(let b=0;b<l.length;++b){const h=l[b];n(h),h.length>0&&(s===void 0?s=h:s+="/"+h)}return s===void 0?".":d(s)},f=function(l,s){if(n(l),n(s),l===s||(l=o(l),s=o(s),l===s))return"";let b=1;for(;b<l.length&&l.charCodeAt(b)===47;++b);const h=l.length,I=h-b;let w=1;for(;w<s.length&&s.charCodeAt(w)===47;++w);const E=s.length-w,P=I<E?I:E;let U=-1,j=0;for(;j<=P;++j){if(j===P){if(E>P){if(s.charCodeAt(w+j)===47)return s.slice(w+j+1);if(j===0)return s.slice(w+j)}else I>P&&(l.charCodeAt(b+j)===47?U=j:j===0&&(U=0));break}const H=l.charCodeAt(b+j),Y=s.charCodeAt(w+j);if(H!==Y)break;H===47&&(U=j)}let R="";for(j=b+U+1;j<=h;++j)(j===h||l.charCodeAt(j)===47)&&(R.length===0?R+="..":R+="/..");return R.length>0?R+s.slice(w+U):(w+=U,s.charCodeAt(w)===47&&++w,s.slice(w))},t=function(l){if(n(l),l.length===0)return".";let s=l.charCodeAt(0);const b=s===47;let h=-1,I=!0;for(let w=l.length-1;w>=1;--w)if(s=l.charCodeAt(w),s===47){if(!I){h=w;break}}else I=!1;return h===-1?b?"/":".":b&&h===1?"//":l.slice(0,h)},x=function(l,s){if(s!==void 0&&typeof s!="string")throw new TypeError('"ext" argument must be a string');n(l);let b=0,h=-1,I=!0,w;if(s!==void 0&&s.length>0&&s.length<=l.length){if(s.length===l.length&&s===l)return"";let T=s.length-1,E=-1;for(w=l.length-1;w>=0;--w){const P=l.charCodeAt(w);if(P===47){if(!I){b=w+1;break}}else E===-1&&(I=!1,E=w+1),T>=0&&(P===s.charCodeAt(T)?--T===-1&&(h=w):(T=-1,h=E))}return b===h?h=E:h===-1&&(h=l.length),l.slice(b,h)}else{for(w=l.length-1;w>=0;--w)if(l.charCodeAt(w)===47){if(!I){b=w+1;break}}else h===-1&&(I=!1,h=w+1);return h===-1?"":l.slice(b,h)}},S=function(l){n(l);let s=-1,b=0,h=-1,I=!0,w=0;for(let T=l.length-1;T>=0;--T){const E=l.charCodeAt(T);if(E===47){if(!I){b=T+1;break}continue}h===-1&&(I=!1,h=T+1),E===46?s===-1?s=T:w!==1&&(w=1):s!==-1&&(w=-1)}return s===-1||h===-1||w===0||w===1&&s===h-1&&s===b+1?"":l.slice(s,h)},u=function(l){if(l===null||typeof l!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof l);return r("/",l)},v=function(l){n(l);const s={root:"",dir:"",base:"",ext:"",name:""};if(l.length===0)return s;let b=l.charCodeAt(0),h;const I=b===47;I?(s.root="/",h=1):h=0;let w=-1,T=0,E=-1,P=!0,U=l.length-1,j=0;for(;U>=h;--U){if(b=l.charCodeAt(U),b===47){if(!P){T=U+1;break}continue}E===-1&&(P=!1,E=U+1),b===46?w===-1?w=U:j!==1&&(j=1):w!==-1&&(j=-1)}return w===-1||E===-1||j===0||j===1&&w===E-1&&w===T+1?E!==-1&&(T===0&&I?s.base=s.name=l.slice(1,E):s.base=s.name=l.slice(T,E)):(T===0&&I?(s.name=l.slice(1,w),s.base=l.slice(1,E)):(s.name=l.slice(T,w),s.base=l.slice(T,E)),s.ext=l.slice(w,E)),T>0?s.dir=l.slice(0,T-1):I&&(s.dir="/"),s},m="/",g=":";return{relative:f,resolve:o,parse:v,format:u,join:a,isAbsolute:c,basename:x,normalize:d,dirname:t,extname:S,delimiter:g,sep:m,win32:null,posix:{relative:f,resolve:o,parse:v,format:u,join:a,isAbsolute:c,basename:x,normalize:d,dirname:t,extname:S,delimiter:g,sep:m,win32:null,posix:null}}}const se={darwin:{arm64:[{platform:"darwin",arch:"arm64",abi:null,platformArchABI:"qwik.darwin-arm64.node"}],x64:[{platform:"darwin",arch:"x64",abi:null,platformArchABI:"qwik.darwin-x64.node"}]},win32:{x64:[{platform:"win32",arch:"x64",abi:"msvc",platformArchABI:"qwik.win32-x64-msvc.node"}]},linux:{x64:[{platform:"linux",arch:"x64",abi:"gnu",platformArchABI:"qwik.linux-x64-gnu.node"}]}},ue={qwik:"2.0.0-beta.10-dev+4669425"};async function ae(){const e=nt(),n={dynamicImport:i=>{throw new Error(`Qwik Optimizer sys.dynamicImport() not implemented, trying to import: "${i}"`)},strictDynamicImport:i=>{throw new Error(`Qwik Optimizer sys.strictDynamicImport() not implemented, trying to import: "${i}"`)},path:null,cwd:()=>"/",os:"unknown",env:e};if(n.path=Z(n),e==="node"||e==="bun"){if(n.dynamicImport=i=>require(i),n.strictDynamicImport=i=>import(i),typeof TextEncoder>"u"){const i=await n.dynamicImport("node:util");globalThis.TextEncoder=i.TextEncoder,globalThis.TextDecoder=i.TextDecoder}}else(e==="webworker"||e==="browsermain")&&(n.strictDynamicImport=i=>import(i),n.dynamicImport=async i=>{const o=await(await fetch(i)).text(),d={exports:{}};return new Function("module","exports",o)(d,d.exports),d.exports});if(e!=="webworker"&&e!=="browsermain")try{n.path=await n.dynamicImport("node:path"),n.cwd=()=>process.cwd(),n.os=process.platform}catch{}return n}async function Rt(e){const n=nt();if(n==="node"||n==="bun"){const i=se[process.platform];if(i){const r=i[process.arch];if(r)for(const o of r)try{return await e.dynamicImport(`../bindings/${o.platformArchABI}`)}catch(d){console.warn(`Unable to load native binding ${o.platformArchABI}. Falling back to wasm build.`,d?.message)}}}{if(n==="node"||n==="bun"){const i=e.path.join(__dirname,"..","bindings","qwik_wasm_bg.wasm"),r=await e.dynamicImport("../bindings/qwik.wasm.cjs"),d=await(await e.dynamicImport("node:fs")).promises.readFile(i),c=await WebAssembly.compile(d);return await r.default(c),r}if(n==="webworker"||n==="browsermain"){let i=ue.qwik;const r=`qwikWasmCjs${i}`,o=`qwikWasmRsp${i}`;let d=globalThis[r],c=globalThis[o];if(!d||!c){i=ue.qwik.split("-dev")[0];const x=`https://cdn.jsdelivr.net/npm/@qwik.dev/core@${i}/bindings/`,S=new URL("./qwik.wasm.cjs",x).href,u=new URL("./qwik_wasm_bg.wasm",x).href,v=await Promise.all([fetch(S),fetch(u)]);for(const g of v)if(!g.ok)throw new Error(`Unable to fetch Qwik WASM binding from ${g.url}`);const m=v[0];globalThis[r]=d=await m.text(),globalThis[o]=c=v[1]}const a={exports:{}};new Function("module","exports",d)(a,a.exports);const t=a.exports;return await t.default(c.clone()),t}}throw new Error("Platform not supported")}const nt=()=>typeof Deno<"u"?"deno":typeof Bun<"u"?"bun":typeof process<"u"&&typeof global<"u"&&process.versions&&process.versions.node?"node":typeof self<"u"&&typeof location<"u"&&typeof navigator<"u"&&typeof fetch=="function"&&typeof WorkerGlobalScope=="function"&&typeof self.importScripts=="function"?"webworker":typeof window<"u"&&typeof document<"u"&&typeof location<"u"&&typeof navigator<"u"&&typeof Window=="function"&&typeof fetch=="function"?"browsermain":"unknown",rt=async(e={})=>{const n=e?.sys||await ae(),i=e?.binding||await Rt(n);return{async transformModules(o){return Bt(i,o)},sys:n}},Bt=(e,n)=>e.transform_modules(At(n)),At=e=>{const n={minify:"simplify",sourceMaps:!1,transpileTs:!1,transpileJsx:!1,preserveFilenames:!1,explicitExtensions:!1,mode:"lib",manualChunks:void 0,scope:void 0,regCtxName:void 0,stripEventHandlers:!1,rootDir:void 0,stripExports:void 0,stripCtxName:void 0,isServer:void 0};return Object.entries(e).forEach(([i,r])=>{r!=null&&(n[i]=r)}),n.entryStrategy=e.entryStrategy?.type??"smart",n.manualChunks=e.entryStrategy?.manual??void 0,n},Ft=(e,n=0)=>{for(let i=0;i<e.length;i++){const r=e.charCodeAt(i);n=(n<<5)-n+r,n|=0}return Number(Math.abs(n)).toString(36)},zt=new Set(["_run","_task"]);function Ht(e){const n=e.symbols;return Object.keys(n).sort((i,r)=>{const o=n[i],d=n[r];if(o.ctxKind==="eventHandler"&&d.ctxKind!=="eventHandler")return-1;if(o.ctxKind!=="eventHandler"&&d.ctxKind==="eventHandler")return 1;if(o.ctxKind==="eventHandler"&&d.ctxKind==="eventHandler"){const c=ot.indexOf(o.ctxName.toLowerCase()),a=ot.indexOf(d.ctxName.toLowerCase());if(c>-1&&a>-1){if(c<a)return-1;if(c>a)return 1}else{if(c>-1)return-1;if(a>-1)return 1}}else if(o.ctxKind==="function"&&d.ctxKind==="function"){const c=it.indexOf(o.ctxName.toLowerCase()),a=it.indexOf(d.ctxName.toLowerCase());if(c>-1&&a>-1){if(c<a)return-1;if(c>a)return 1}else{if(c>-1)return-1;if(a>-1)return 1}}return!o.parent&&d.parent?-1:o.parent&&!d.parent?1:o.hash<d.hash?-1:o.hash>d.hash?1:0})}const ot=["click","dblclick","contextmenu","auxclick","pointerdown","pointerup","pointermove","pointerover","pointerenter","pointerleave","pointerout","pointercancel","gotpointercapture","lostpointercapture","touchstart","touchend","touchmove","touchcancel","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","wheel","gesturestart","gesturechange","gestureend","keydown","keyup","keypress","input","change","search","invalid","beforeinput","select","focusin","focusout","focus","blur","submit","reset","scroll"].map(e=>`on${e.toLowerCase()}$`),it=["useTask$","useVisibleTask$","component$","useStyles$","useStylesScoped$"].map(e=>e.toLowerCase());function Wt(e){return Object.keys(e.bundles).sort(Le)}function Gt(e){const n=Ht(e),i={},r={};for(const c of n)i[c]=e.symbols[c],r[c]=e.mapping[c];const o=Wt(e),d={};for(const c of o){d[c]=e.bundles[c];const a=e.bundles[c];Array.isArray(a.imports)&&a.imports.sort(Le),Array.isArray(a.dynamicImports)&&a.dynamicImports.sort(Le);const f=[];for(const t of n)c===r[t]&&f.push(t);f.length>0&&(f.sort(Le),a.symbols=f)}return e.symbols=i,e.mapping=r,e.bundles=d,e}function Le(e,n){return e=e.toLocaleLowerCase(),n=n.toLocaleLowerCase(),e<n?-1:e>n?1:0}function st(e){if(e!=null&&e.mapping!=null&&typeof e.mapping=="object"&&e.symbols!=null&&typeof e.symbols=="object"&&e.bundles!=null&&typeof e.bundles=="object")return e}const Kt=(e,n)=>{let i=0;if(e.symbols)for(const r of e.symbols){let o=1;const d=n.symbols[r];d&&(d.ctxKind==="function"?/(component|useStyles|useStylesScoped)/i.test(d.ctxName)?o+=1:/(useComputed|useTask|useVisibleTask|useOn)/i.test(d.ctxName)&&(o+=2):(o+=1,/(click|mouse|pointer|touch|key|scroll|gesture|wheel)/i.test(d.ctxName)&&(o+=3))),i=Math.max(i,o)}return i};function Qt(e){let n=0;const i=[],r=[],o=new Map,d=new Map,c=new Set;function a(m){o.set(m,n),d.set(m,n),n++,i.push(m),c.add(m);const g=e[m].imports||[];for(const p of g)o.has(p)?c.has(p)&&d.set(m,Math.min(d.get(m),o.get(p))):(a(p),d.set(m,Math.min(d.get(m),d.get(p))));if(d.get(m)===o.get(m)){const p=[];let l;do l=i.pop(),c.delete(l),p.push(l);while(l!==m);r.push(p)}}for(const m of Object.keys(e))o.has(m)||a(m);const f=new Map;r.forEach((m,g)=>{for(const p of m)f.set(p,g)});const t=Array.from({length:r.length},()=>new Set);for(const m of Object.keys(e)){const g=f.get(m);for(const p of e[m].imports||[]){const l=f.get(p);g!==l&&t[g].add(l)}}const x=new Set,S=[];function u(m){x.add(m);for(const g of t[m])x.has(g)||u(g);S.push(m)}for(let m=0;m<r.length;m++)x.has(m)||u(m);S.reverse();const v=new Array(r.length).fill(0);for(let m=0;m<r.length;m++){let g=0;for(const p of r[m])g+=e[p].size;v[m]=g}for(let m=S.length-1;m>=0;m--){const g=S[m];let p=v[g];for(const l of t[g])p+=v[l];v[g]=p}for(let m=0;m<r.length;m++){const g=v[m];for(const p of r[m])e[p].total=g}}const at=/[/\\](core|qwik)[/\\]dist[/\\]preloader\.(|c|m)js$/,lt=/[/\\](core|qwik)[/\\]dist[/\\]core(\.min|\.prod)?\.(|c|m)js$/,ct=/[/\\](core|qwik)[/\\](dist[/\\])?qwikloader(\.debug)?\.[^/]*js$/,dt=/[/\\](core|qwik)[/\\]handlers\.(|c|m)js$/;function Jt(e,n,i,r,o,d,c){var S;const a={version:"1",manifestHash:"",options:{target:o.target,buildMode:o.buildMode,entryStrategy:o.entryStrategy&&{type:o.entryStrategy.type}},core:void 0,preloader:void 0,qwikLoader:void 0,bundleGraphAsset:void 0,injections:i,mapping:{},bundles:{},assets:{},symbols:{},bundleGraph:void 0},f=u=>{const v=r[u];if(!v){console.warn(`Client manifest generation: skipping external import "${u}"`);return}return c(v.fileName)};let t;const x=new Set(n.map(u=>u.name));for(const u of Object.values(r)){if(u.type==="asset"){u.fileName.endsWith("js.map")||(a.assets[u.fileName]={name:u.names[0],size:u.source.length});continue}const v=c(u.fileName),g={size:u.code.length,total:-1};for(const h of u.exports)x.has(h)&&(!a.mapping[h]||u.exports.length!==1)&&(a.mapping[h]=v);const p=u.imports.filter(h=>u.code.includes(e.basename(h))).map(h=>f(h)).filter(Boolean);p.length>0&&(g.imports=p);const l=u.dynamicImports.filter(h=>u.code.includes(e.basename(h))).map(h=>f(h)).filter(Boolean);l.length>0&&(g.dynamicImports=l),u.facadeModuleId&&(at.test(u.facadeModuleId)?a.preloader=v:lt.test(u.facadeModuleId)?a.core=v:ct.test(u.facadeModuleId)?a.qwikLoader=v:dt.test(u.facadeModuleId)&&(t=v));const b=(u.moduleIds||Object.keys(u.modules)).filter(h=>!h.startsWith("\0")).map(h=>e.relative(o.rootDir,h));b.length>0&&(g.origins=b,!a.preloader&&b.some(h=>at.test(h))&&(a.preloader=v),!a.core&&b.some(h=>lt.test(h))&&(a.core=v),!a.qwikLoader&&b.some(h=>ct.test(h))&&(a.qwikLoader=v),!t&&b.some(h=>dt.test(h))&&(t=v)),a.bundles[v]=g}for(const u of n){const v=u.name,m=a.mapping[v];if(!m){d(`Note: qrl ${u.name} is not in the bundle, likely tree shaken`,a);continue}((S=a.bundles[m]).symbols||(S.symbols=[])).push(v),a.symbols[v]={displayName:u.displayName,hash:u.hash,ctxKind:u.ctxKind,ctxName:u.ctxName,captures:u.captures,canonicalFilename:u.canonicalFilename,parent:u.parent,origin:u.origin,loc:u.loc,paramNames:u.paramNames,captureNames:u.captureNames}}if(t)for(const u of zt)a.symbols[u]={origin:"Qwik core",displayName:u,canonicalFilename:"",hash:u,ctxKind:"function",ctxName:u,captures:!1,parent:null,loc:[0,0]},a.mapping[u]=t;else console.error("Qwik core bundle not found, is Qwik actually used in this project?");for(const u of Object.values(a.bundles)){const v=Kt(u,a);u.interactivity=v}return Qt(a.bundles),Gt(a)}const Yt=.5/(300*1024/8),Xt=e=>{const n=e.lastIndexOf("_");return n>-1?e.slice(n+1):e};function Zt(e,n){const i=[];if(!e.bundles)return[];const r={...e.bundles};for(const[f,t]of Object.entries(e.mapping)){if(f.startsWith("_")&&f.length<10)continue;const x=Xt(f);x&&(r[x]={dynamicImports:[t]})}if(n){const f={...e,bundles:r};for(const t of n){const x=t(f);x&&Object.assign(r,x)}}for(const f of Object.keys(r)){const t=r[f],x=t.imports?.filter(u=>r[u])||[],S=t.dynamicImports?.filter(u=>r[u]&&(r[u].symbols||r[u].origins?.some(v=>!v.includes("node_modules"))))||[];r[f]={...t,imports:x,dynamicImports:S}}const o=new Set(Object.keys(r));for(const f of Object.keys(r)){for(const t of r[f].imports)o.delete(t);for(const t of r[f].dynamicImports)o.delete(t)}for(const f of o){const t=r[f];!t.imports?.length&&!t.dynamicImports?.length&&delete r[f]}const d=Object.keys(r),c=new Map,a=(f,t,x=new Set)=>{const S=r[t];for(const u of S.imports)f.has(u)&&f.delete(u),x.has(u)||(x.add(u),a(f,u,x))};for(const f of d){const t=r[f],x=new Set(t.imports);for(const m of x)a(x,m);const S=new Set(t.dynamicImports),u=new Map;for(const m of S){a(S,m);const g=r[m];let p=.5;if(p+=(g.interactivity||0)*.08,t.origins&&g.origins){for(const l of t.origins)if(g.origins.some(s=>s.startsWith(l))){p+=.25;break}}g.total>Yt&&(p+=p>.5?.02:-.02),g.total<1e3&&(p+=.15),u.set(m,Math.min(p,.99))}if(S.size>0){const m=Array.from(S).sort((p,l)=>u.get(l)-u.get(p));let g=-1;for(const p of m)u.get(p)!==g&&(g=u.get(p),x.add(-Math.round(g*10))),x.add(p)}const v=i.length;i.push(f);for(let m=0;m<x.size;m++)i.push(null);c.set(f,{index:v,deps:x})}for(const f of d){const t=c.get(f);let{index:x,deps:S}=t;x++;for(const u of S){if(typeof u=="number"){i[x++]=u;continue}const m=c.get(u).index;i[x++]=m}}return i}async function Vt(e,n,i){const r=await e.dynamicImport("eslint");let o=new r.ESLint({cache:!0});if((await o.calculateConfigForFile("no-real-file.tsx")).parser===null){const a={cache:!0,overrideConfig:{languageOptions:{parserOptions:{tsconfigRootDir:n,project:i,ecmaVersion:2021,sourceType:"module",ecmaFeatures:{jsx:!0}}}}};o=new r.ESLint(a)}return{async lint(a,f,t){try{const x=en(t);if(await o.isPathIgnored(x))return null;(await o.lintText(f,{filePath:x})).forEach(u=>{for(const v of u.messages){if(v.ruleId!=null&&!v.ruleId.startsWith("qwik/"))continue;const m=tn(u.filePath,v);a.warn(m)}})}catch(x){console.warn(x)}}}}function en(e){return e.split("?",2)[0]}function tn(e,n){return Object.assign(new Error(n.message),{id:e,plugin:"vite-plugin-eslint",loc:{file:e,column:n.column,line:n.line},stack:""})}async function nn(e,n){const i=n;let r=i.loc;if(!i.frame&&!i.plugin&&(r||(r=rn(i)),r&&(i.loc=r,r.file))){const o=await e.dynamicImport("node:fs"),{normalizePath:d}=await e.dynamicImport("vite");i.id=d(i.loc.file);try{const c=o.readFileSync(i.loc.file,"utf-8");i.frame=sn(c,i.loc)}catch{}}return n}const rn=e=>{const n=e.stack;if(typeof n=="string"){const i=n.split(`
|
|
8
|
+
`).filter(r=>!r.includes("/node_modules/")&&!r.includes("(node:"));for(let r=1;r<i.length;r++){const o=i[r].replace("file:///","/");if(/^\s+at/.test(o)){const d=o.indexOf("/"),c=o.lastIndexOf(")",d);if(d>0){const f=o.slice(d,c).split(":"),t=ut(f[f.length-1]),x=ut(f[f.length-2]);return typeof t=="number"&&typeof x=="number"?(f.length-=2,{file:f.join(":"),line:x,column:t}):typeof t=="number"?(f.length-=1,{file:f.join(":"),line:t,column:void 0}):{file:f.join(":"),line:void 0,column:void 0}}}}}},ut=e=>{try{return parseInt(e,10)}catch{return}},ft=/\r?\n/,pt=2;function on(e,n){if(typeof n=="number")return n;if(n.lo!=null)return n.lo;const i=e.split(ft),{line:r,column:o}=n;let d=0;for(let c=0;c<r-1&&c<i.length;c++)d+=i[c].length+1;return d+o}function sn(e,n=0,i){n=on(e,n),i=i||n;const r=e.split(ft);let o=0;const d=[];for(let c=0;c<r.length;c++)if(o+=r[c].length+1,o>=n){for(let a=c-pt;a<=c+pt||i>o;a++){if(a<0||a>=r.length)continue;const f=a+1;d.push(`${f}${" ".repeat(Math.max(3-String(f).length,0))}| ${r[a]}`);const t=r[a].length;if(a===c){const x=Math.max(n-(o-t)+1,0),S=Math.max(1,i>o?t-x:i-n);d.push(" | "+" ".repeat(x)+"^".repeat(S))}else if(a>c){if(i>o){const x=Math.max(Math.min(i-o,t),1);d.push(" | "+"^".repeat(x))}o+=t+1}}break}return d.join(`
|
|
9
|
+
`)}function an(e){return e==="win32"}function Oe(e){const[n,i]=e.split("?"),r=i||"";return{originalId:e,pathId:n,query:r?`?${i}`:"",params:new URLSearchParams(r)}}const ln=["server"],cn=["onGet","onPost","onPut","onRequest","onDelete","onHead","onOptions","onPatch","onStaticGenerate"],dn=["useServer","route","server","action$","loader$","zod$","validator$","globalAction$"],un=["useClient","useBrowser","useVisibleTask","client","browser","event$"];var ht=(e=>(e.preventNavigate="preventNavigate",e.valibot="valibot",e.noSPA="noSPA",e.enableRequestRewrite="enableRequestRewrite",e.webWorker="webWorker",e.insights="insights",e))(ht||{});function mt(e={}){const n=`${Math.round(Math.random()*899)+100}`,i=new Map,r=new Map,o=new Map,d=new Map;let c=null,a,f=()=>{};const t={csr:!1,target:"client",buildMode:"development",debug:!1,rootDir:void 0,tsconfigFileNames:["./tsconfig.json"],input:void 0,outDir:void 0,assetsDir:void 0,resolveQwikBuild:!0,entryStrategy:void 0,srcDir:void 0,ssrOutDir:void 0,clientOutDir:void 0,sourcemap:!!e.sourcemap,manifestInput:null,manifestOutput:null,transformedModuleOutput:null,scope:null,devTools:{imageDevTools:!0,clickToSource:["Alt"]},inlineStylesUpToBytes:2e4,lint:!1,experimental:void 0};let x,S;const u=async()=>{if(!c){c=await rt(e),x=fn(c.sys);try{S===void 0&&(S=await c.sys.dynamicImport("node:fs"))}catch{console.log("node:fs not available, disabling automatic manifest reading"),S=null}}},v=()=>{if(!c)throw new Error("Qwik plugin has not been initialized");return c},m=()=>v().sys,g=()=>v().sys.path;let p;const l=k=>{p=k},s=async k=>{const y=Object.assign({},k),_=v(),N=_.sys.path,D=(...L)=>K(N.resolve(...L));t.debug=!!y.debug,y.assetsDir&&(t.assetsDir=y.assetsDir),y.target==="ssr"||y.target==="client"||y.target==="lib"||y.target==="test"?t.target=y.target:t.target||(t.target="client"),t.target==="lib"?t.buildMode="development":y.buildMode==="production"||y.buildMode==="development"?t.buildMode=y.buildMode:t.buildMode||(t.buildMode="development"),t.csr=!!y.csr,y.entryStrategy&&typeof y.entryStrategy=="object"&&(t.entryStrategy={...y.entryStrategy}),t.entryStrategy||(t.target==="ssr"||t.target==="test"?t.entryStrategy={type:"hoist"}:t.target==="lib"?t.entryStrategy={type:"inline"}:t.buildMode==="production"?t.entryStrategy={type:"smart"}:t.entryStrategy={type:"segment"}),typeof y.rootDir=="string"&&(t.rootDir=y.rootDir),typeof t.rootDir!="string"&&(t.rootDir||(t.rootDir=_.sys.cwd())),t.rootDir=D(_.sys.cwd(),t.rootDir);let C=D(t.rootDir,mn);if(typeof y.srcDir=="string"?(t.srcDir=D(t.rootDir,y.srcDir),C=t.srcDir):t.srcDir||(t.srcDir=C),t.srcDir=D(t.rootDir,t.srcDir),Array.isArray(y.tsconfigFileNames)&&y.tsconfigFileNames.length>0&&(t.tsconfigFileNames=y.tsconfigFileNames),!t.csr&&!y.input&&!t.input&&(t.target==="ssr"?t.input=[D(C,"entry.ssr")]:t.target==="client"?t.input=[D(C,"root")]:t.input=void 0),y.outDir&&(t.outDir=D(t.rootDir,y.outDir)),t.clientOutDir=D(t.rootDir,y.clientOutDir||yt),t.ssrOutDir=D(t.rootDir,y.ssrOutDir||gn),t.target==="ssr"?t.outDir||(t.outDir=t.ssrOutDir):t.target==="lib"?t.outDir||(t.outDir=D(t.rootDir,yn)):t.outDir||(t.outDir=t.clientOutDir),typeof y.manifestOutput=="function"&&(t.manifestOutput=y.manifestOutput),y.manifestInput&&(t.manifestInput=st(y.manifestInput)||null),typeof y.transformedModuleOutput=="function"&&(t.transformedModuleOutput=y.transformedModuleOutput),y.scope!==void 0)t.scope=y.scope;else if(!t.scope&&S){let L="";try{let $=t.rootDir;for(;L=N.resolve($,"package.json"),!await S.promises.stat(L).catch(()=>!1);){const M=N.resolve($,"..");if(M===$)break;$=M,L=""}if(L){const M=await S.promises.readFile(L,"utf-8"),q=JSON.parse(M);typeof q.name=="string"&&(t.scope=q.name)}}catch($){console.warn(`could not read ${L||"package.json"} to determine package name, ignoring. (${$})`)}}if(typeof y.resolveQwikBuild=="boolean"&&(t.resolveQwikBuild=y.resolveQwikBuild),typeof y.devTools=="object"&&("imageDevTools"in y.devTools&&(t.devTools.imageDevTools=y.devTools.imageDevTools),"clickToSource"in y.devTools&&(t.devTools.clickToSource=y.devTools.clickToSource)),"inlineStylesUpToBytes"in e&&(typeof e.inlineStylesUpToBytes=="number"?t.inlineStylesUpToBytes=e.inlineStylesUpToBytes:(typeof t.inlineStylesUpToBytes!="number"||t.inlineStylesUpToBytes<0)&&(t.inlineStylesUpToBytes=0)),typeof y.lint=="boolean"&&(t.lint=y.lint),"experimental"in y){t.experimental=void 0;for(const L of y.experimental??[])ht[L]?(t.experimental||(t.experimental={}))[L]=!0:console.error(`Qwik plugin: Unknown experimental feature: ${L}`)}const B={...t};return t.input||(t.input=y.input),t.input&&typeof t.input=="string"&&(t.input=[t.input]),B};let b=!1;const h=async k=>{if(!b){b=!0;const y=m();if(y.env==="node"){const _=await y.dynamicImport("node:fs");if(!_.existsSync(t.rootDir))throw new Error(`Qwik rootDir "${t.rootDir}" not found.`);if(typeof t.srcDir=="string"&&!_.existsSync(t.srcDir))throw new Error(`Qwik srcDir "${t.srcDir}" not found.`);for(const[N,D]of Object.entries(t.input||{}))if(!await k(D))throw new Error(`Qwik input "${D}" not found.`)}}};let I,w=!1;const T=async k=>{if(O("buildStart()",t.buildMode,t.scope,t.target,t.rootDir,t.srcDir),I=v(),w=!p,I.sys.env==="node"&&t.target==="ssr"&&t.lint)try{a=await Vt(I.sys,t.rootDir,t.tsconfigFileNames)}catch{}if(O("transformedOutputs.clear()"),r.clear(),o.clear(),t.target==="client"){const y=await k.resolve("@qwik.dev/core/qwikloader.js",void 0,{skipSelf:!0});y&&k.emitFile({id:y.id,type:"chunk",preserveSignature:"allow-extension"})}},E=k=>p?!!k?.ssr:t.target==="ssr"||t.target==="test";let P=0,U=!1;const j=async(k,y,_,N)=>{if(y.startsWith("\0"))return;const D=p&&/^(.*)\?editor(:(\d+)(:\d+)?)?$/.exec(y);if(D){if(!U){U=!0,setTimeout(()=>U=!1,500);const[,Q,z]=D,pe=await k.resolve(Q,_);if(pe){const ce=p.moduleGraph.getModuleById(pe.id)?.file;if(ce){const ie=`${ce}${z}`;try{console.warn(`Opening in editor: ${ie}`);const X=(await import("launch-editor")).default;X(ie)}catch(X){console.error(`Failed to open editor: ${X.message}`)}}}}return{id:"\0editor"}}const C=P++,B=E(N);O(`resolveId(${C})`,`begin ${y} | ${B?"server":"client"} | ${_}`);const L=_&&Oe(_);if(_=L&&K(L.pathId),y.startsWith(".")&&L){const Q=g(),z=Q.dirname(L.pathId);z&&(y=Q.resolve(z,y))}const $=Oe(y),M=K($.pathId);let q;if(d.get(M))O(`resolveId(${C}) Resolved already known ${M}`),q={id:M+$.query,moduleSideEffects:!1};else if(M.endsWith(ne))t.resolveQwikBuild&&(O(`resolveId(${C})`,"Resolved",ne),q={id:ne,moduleSideEffects:!1});else if(M.endsWith(re))O(`resolveId(${C})`,"Resolved",re),q={id:re,moduleSideEffects:!1};else if(!p&&!B&&M.endsWith(Qe)){O(`resolveId(${C})`,"Resolved",Qe);const Q=await k.resolve(Qe,_,{skipSelf:!0});if(Q)return k.emitFile({id:Q.id,type:"chunk",preserveSignature:"allow-extension"}),Q}else if(M.endsWith(me))O(`resolveId(${C})`,"Resolved",me),q={id:me,moduleSideEffects:!1};else{if(!B&&w&&y.endsWith("@qwik.dev/core")){w=!1;const z=await k.resolve("@qwik.dev/core/handlers.mjs",_,{skipSelf:!0});if(!z)throw new Error("Failed to resolve @qwik.dev/core/handlers.mjs");k.emitFile({id:z.id,type:"chunk",preserveSignature:"allow-extension"})}const Q=/^(?<parent>.*\.[mc]?[jt]sx?)_(?<name>[^/]+)\.js(?<query>$|\?.*$)/.exec(y)?.groups;if(Q){const{parent:z,name:pe,query:ce}=Q,ie=await k.resolve(z,_,{skipSelf:!0});if(ie){const X=ie.id.split("?")[0],Fe=p&&_?.endsWith(".html")?`${X}_${pe}.js`:M;O(`resolveId(${C})`,`resolved to QRL ${pe} of ${X}`),d.set(Fe,X),q={id:Fe+ce,moduleSideEffects:!1}}else console.error(`resolveId(${C})`,`QRL parent ${z} does not exist!`)}else if(_){const z=d.get(_);if(z)return O(`resolveId(${C}) end`,`resolving via ${z}`),k.resolve(y,z,{skipSelf:!0})}}return O(`resolveId(${C}) end`,q?.id||q),q};let R=0;const H=async(k,y,_)=>{if(y==="\0editor")return'"opening in editor"';if(y.startsWith("\0")||y.startsWith("/@fs/"))return;const N=R++,D=E(_);if(t.resolveQwikBuild&&y===ne)return O(`load(${N})`,ne,t.buildMode),{moduleSideEffects:!1,code:qe(D,t.target)};if(y===re)return O(`load(${N})`,re,t.buildMode),{moduleSideEffects:!1,code:await fe(D)};if(y===me)return O(`load(${N})`,me,t.buildMode),{moduleSideEffects:!1,code:"export * from '@qwik.dev/core';"};const C=Oe(y);y=K(C.pathId);const B=D?o:r;if(p&&!B.has(y)){const $=d.get(y);if($){const M=p.moduleGraph.getModuleById($);if(M){if(O(`load(${N})`,"transforming QRL parent",$),await p.transformRequest(M.url),!B.has(y))return O(`load(${N})`,`QRL segment ${y} not found in ${$}`),null}else console.error(`load(${N})`,`${M} does not exist!`)}}const L=B.get(y);if(L){O(`load(${N})`,"Found",y);const{code:$,map:M,segment:q}=L[0];return{code:$,map:M,meta:{segment:q}}}return O(`load(${N})`,"Not a QRL or virtual module",y),null};let Y=0;const le=async function(k,y,_,N={}){if(_.startsWith("\0"))return;const D=Y++,C=E(N),B=C?o:r;if(B.has(_))return;const L=v(),$=g(),{pathId:M}=Oe(_),q=$.parse(M),Q=q.dir,z=q.base;if(q.ext.toLowerCase()in hn||gt.test(M)){const ce=t.target==="client"||t.target==="ssr";O(`transform(${D})`,`Transforming ${_} (for: ${C?"server":"client"}${ce?", strip":""})`);const ie=t.target==="lib"?"lib":t.buildMode==="development"?"dev":"prod";ie!=="lib"&&(y=y.replaceAll(/__EXPERIMENTAL__\.(\w+)/g,(te,de)=>t.experimental?.[de]?"true":"false"));let X=z;t.srcDir&&(X=$.relative(t.srcDir,M)),X=K(X);const Ae=t.srcDir?t.srcDir:K(Q),Fe=t.entryStrategy;let Ut;p&&(Ut=p.moduleGraph.getModuleById(M)?.url);const he={input:[{code:y,path:X,devPath:Ut}],entryStrategy:C?{type:"hoist"}:Fe,minify:"simplify",sourceMaps:t.sourcemap||t.buildMode==="development",transpileTs:!0,transpileJsx:!0,explicitExtensions:!0,preserveFilenames:!0,srcDir:Ae,rootDir:t.rootDir,mode:ie,scope:t.scope||void 0,isServer:C};ce&&(C?(he.stripCtxName=un,he.stripEventHandlers=!0,he.regCtxName=ln):(he.stripCtxName=dn,he.stripExports=cn));const Wr=Date.now(),je=await L.transformModules(he);O(`transform(${D})`,`done in ${Date.now()-Wr}ms`);const ze=je.modules.find(te=>!pn(te));f(je.diagnostics,L,Ae),C?je.diagnostics.length===0&&a&&a.lint(k,y,_):i.set(_,je);const et=new Set;for(const te of je.modules)if(te!==ze){const de=K($.join(Ae,te.path));O(`transform(${D})`,`segment ${de}`,te.segment.displayName),d.set(de,_),B.set(de,[te,_]),et.add(de),t.target==="client"&&!p&&k.emitFile({id:de,type:"chunk",preserveSignature:"allow-extension"})}return await Promise.all([...et.values()].map(te=>k.load({id:te}))),k.addWatchFile(_),{code:ze.code,map:ze.map,meta:{segment:ze.segment,qwikdeps:Array.from(et)}}}return O(`transform(${D})`,"Not transforming",_),null},W=k=>{const y=[],_={addInjection:N=>y.push(N)};return _.generateManifest=async N=>{const C=v().sys.path,B=C.resolve(t.rootDir,t.outDir,"build"),L=q=>C.relative(B,C.resolve(t.rootDir,t.outDir,q));_.canonPath=L;const $=Array.from(i.values()).flatMap(q=>q.modules).map(q=>q.segment).filter(q=>!!q),M=Jt(C,$,y,k,t,O,L);N&&Object.assign(M,N);for(const q of Object.values(M.symbols))q.origin&&(q.origin=K(q.origin));for(const q of Object.values(M.bundles))q.origins&&(q.origins=q.origins.sort());return M.manifestHash=Ft(JSON.stringify(M)),M},_},ee=()=>t,V=()=>Array.from(r.values()).map(k=>k[0]),O=(...k)=>{t.debug&&console.debug(`[QWIK PLUGIN: ${n}]`,...k)},Ve=(...k)=>{console.log(`[QWIK PLUGIN: ${n}]`,...k)},G=k=>{f=k},K=k=>x(k);function qe(k,y){const _=t.buildMode==="development";return`// @qwik.dev/core/build
|
|
10
|
+
export const isServer = ${JSON.stringify(k)};
|
|
11
|
+
export const isBrowser = ${JSON.stringify(!k)};
|
|
12
|
+
export const isDev = ${JSON.stringify(_)};
|
|
13
|
+
`}async function fe(k){if(!t.manifestInput&&t.target==="ssr"&&t.buildMode==="production"&&S){const N=g();let D=N.resolve(t.clientOutDir,Je);await S.promises.stat(D).catch(()=>!1)||(D=N.resolve(t.rootDir,yt,Je));try{const C=await S.promises.readFile(D,"utf-8");t.manifestInput=st(JSON.parse(C))||null,console.info("Read client manifest from",D)}catch(C){console.warn(`
|
|
14
|
+
==========
|
|
15
|
+
Could not read Qwik client manifest ${D}.
|
|
16
|
+
Make sure you provide it to the SSR renderer via the \`manifest\` argument, or define it in \`globalThis.__QWIK_MANIFEST__\` before the server bundle is loaded, or embed it in the server bundle by replacing \`globalThis.__QWIK_MANIFEST__\`.
|
|
17
|
+
Without the manifest, the SSR renderer will not be able to generate event handlers.
|
|
18
|
+
(${C})
|
|
19
|
+
==========
|
|
20
|
+
`)}}const y=k?t.manifestInput:null;let _=null;return y?.manifestHash&&(_={manifestHash:y.manifestHash,core:y.core,preloader:y.preloader,qwikLoader:y.qwikLoader,bundleGraphAsset:y.bundleGraphAsset,injections:y.injections,mapping:y.mapping,bundleGraph:y.bundleGraph}),`// @qwik-client-manifest
|
|
21
|
+
export const manifest = ${_?JSON.stringify(_):"globalThis.__QWIK_MANIFEST__"};
|
|
22
|
+
`}function Be(k){t.sourcemap=k}function Fr(k){O("handleHotUpdate()",k.file);for(const y of k.modules){const{id:_}=y;if(_){O("handleHotUpdate()",`invalidate ${_}`),i.delete(_);for(const N of[r,o])for(const[D,[C,B]]of N)if(B===_){O("handleHotUpdate()",`invalidate ${_} segment ${D}`),N.delete(D);const L=k.server.moduleGraph.getModuleById(D);L&&k.server.moduleGraph.invalidateModule(L)}}}}const zr=(k,{getModuleInfo:y})=>{if(t.target==="client"){if(k.endsWith("@qwik.dev/core/build")||/[/\\](core|qwik)[/\\]dist[/\\]preloader\.[cm]js$/.test(k)||k==="\0vite/preload-helper.js")return"qwik-preloader";if(/[/\\](core|qwik)[/\\](handlers|dist[/\\]core(\.prod|\.min)?)\.[cm]js$/.test(k))return"qwik-core";if(/[/\\](core|qwik)[/\\]dist[/\\]qwikloader\.js$/.test(k))return"qwik-loader"}const _=y(k);if(_){const N=_.meta.segment;if(N){const{hash:D}=N,C=t.entryStrategy.manual?.[D]||N.entry;if(C)return C}if(_.meta.qwikdeps?.length===0){if(k.includes("node_modules")){const D=k.lastIndexOf("node_modules");if(D>=0)return k.slice(D+13)}else if(t.srcDir&&k.includes(t.srcDir)){const D=g();return K(D.relative(t.srcDir,k))}}}return null};async function Hr(k,y,_,N){const C=await W(y).generateManifest(N);C.platform={...N?.platform,rollup:k.meta?.rollupVersion||"",env:I.sys.env,os:I.sys.os},I.sys.env==="node"&&(C.platform.node=process.versions.node);const B=Zt(C,_),L=k.emitFile({type:"asset",name:"bundle-graph.json",source:JSON.stringify(B)}),$=k.getFileName(L);C.bundleGraphAsset=$,C.assets[$]={name:"bundle-graph.json",size:B.length};const M=JSON.stringify(C,null," ");k.emitFile({fileName:Je,type:"asset",source:M}),typeof t.manifestOutput=="function"&&await t.manifestOutput(C),typeof t.transformedModuleOutput=="function"&&await t.transformedModuleOutput(V())}return{buildStart:T,createOutputAnalyzer:W,getQwikBuildModule:qe,getOptimizer:v,getOptions:ee,getPath:g,getSys:m,getTransformedOutputs:V,init:u,load:H,debug:O,log:Ve,normalizeOptions:s,normalizePath:K,onDiagnostics:G,resolveId:j,transform:le,validateSource:h,setSourceMapSupport:Be,configureServer:l,handleHotUpdate:Fr,manualChunks:zr,generateManifest:Hr}}const fn=e=>n=>typeof n=="string"?an(e.os)?(n.startsWith("\\\\?\\")||/[^\u0000-\u0080]+/.test(n)||(n=n.replace(/\\/g,"/")),e.path.posix.normalize(n)):e.path.normalize(n):n;function pn(e){return e.isEntry||e.segment}const hn={".jsx":!0,".ts":!0,".tsx":!0},gt=/\.qwik\.[mc]?js$/,Ue="@qwik.dev/core",He="@qwik.dev/core/internal",ne="@qwik.dev/core/build",We="@qwik.dev/core/jsx-runtime",Ge="@qwik.dev/core/jsx-dev-runtime",Ke="@qwik.dev/core/server",re="@qwik-client-manifest",Qe="@qwik.dev/core/preloader",me="@qwik-handlers",mn="src",yt="dist",gn="server",yn="lib",Je="q-manifest.json";function bn(e={}){const n=mt(e.optimizerOptions);return{name:"rollup-plugin-qwik",api:{getOptimizer:()=>n.getOptimizer(),getOptions:()=>n.getOptions()},async options(r){await n.init();const o=r.onwarn;r.onwarn=(a,f)=>{a.plugin==="typescript"&&a.message.includes("outputToFilesystem")||(o?o(a,f):f(a))};const d={csr:e.csr,target:e.target,buildMode:e.buildMode,debug:e.debug,entryStrategy:e.entryStrategy,rootDir:e.rootDir,srcDir:e.srcDir,srcInputs:e.srcInputs,input:r.input,resolveQwikBuild:!0,manifestOutput:e.manifestOutput,manifestInput:e.manifestInput,transformedModuleOutput:e.transformedModuleOutput,inlineStylesUpToBytes:e.optimizerOptions?.inlineStylesUpToBytes,lint:e.lint,experimental:e.experimental};await n.normalizeOptions(d);const{input:c}=n.getOptions();return r.input=c,r},outputOptions(r){return Ye(n,r,!1)},async buildStart(){n.onDiagnostics((r,o,d)=>{r.forEach(c=>{const a=n.normalizePath(o.sys.path.join(d,c.file));c.category==="error"?this.error($e(a,c)):this.warn($e(a,c))})}),await n.buildStart(this)},resolveId(r,o){return r.startsWith("\0")?null:n.resolveId(this,r,o)},load(r){return r.startsWith("\0")?null:n.load(this,r)},transform(r,o){return o.startsWith("\0")?null:n.transform(this,r,o)},async generateBundle(r,o){n.getOptions().target==="client"&&await n.generateManifest(this,o)}}}function vn(e,n,i,r){return Array.isArray(n)?(n.length||n.push({}),n.map(o=>({...Ye(e,o,i),dir:r||o.dir}))):{...Ye(e,n,i),dir:r||n?.dir}}const wn=(e,n,i)=>n.buildMode==="production"&&!n.debug?`${e}build/q-[hash].js`:r=>{if(r.moduleIds?.some(c=>/core\.(prod|min)\.mjs$/.test(c)))return`${e}build/core.js`;if(r.moduleIds?.some(c=>/qwik-router\/lib\/index\.qwik\.mjs$/.test(c)))return`${e}build/qwik-router.js`;const d=i.sys.path.relative(i.sys.cwd(),r.name).replace(/^(\.\.\/)+/,"").replace(/^\/+/,"").replace(/\//g,"-");return`${e}build/${d}.js`};function Ye(e,n,i){const r={...n},o=e.getOptions(),d=e.getOptimizer(),c=e.manualChunks;r.assetFileNames||(r.assetFileNames=`${i?`${o.assetsDir}/`:""}assets/[hash]-[name].[ext]`);const a=wn(i?`${o.assetsDir}`:"",o,d);if(o.target==="client"){r.entryFileNames||(r.entryFileNames=a),r.chunkFileNames||(r.chunkFileNames=a),r.format="es";const f=r.manualChunks;if(f&&typeof f!="function")throw new Error("manualChunks must be a function");r.manualChunks=f?(t,x)=>f(t,x)||c(t,x):c}else r.chunkFileNames||(r.chunkFileNames=a);return r.dir||(r.dir=o.outDir),r.format==="cjs"&&typeof r.exports!="string"&&(r.exports="auto"),r.hoistTransitiveImports=!1,r}function $e(e,n){const i=n.highlights?.[0];return Object.assign(new Error(n.message),{id:e,plugin:"qwik",loc:i&&{column:i.startCol,line:i.startLine},stack:""})}function A(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ge={},Xe={},bt;function F(){return bt||(bt=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.findBox=e.readUInt=e.readUInt32LE=e.readUInt32BE=e.readInt32LE=e.readUInt24LE=e.readUInt16LE=e.readUInt16BE=e.readInt16LE=e.toHexString=e.toUTF8String=void 0;const n=new TextDecoder,i=(g,p=0,l=g.length)=>n.decode(g.slice(p,l));e.toUTF8String=i;const r=(g,p=0,l=g.length)=>g.slice(p,l).reduce((s,b)=>s+("0"+b.toString(16)).slice(-2),"");e.toHexString=r;const o=(g,p=0)=>{const l=g[p]+g[p+1]*256;return l|(l&2**15)*131070};e.readInt16LE=o;const d=(g,p=0)=>g[p]*2**8+g[p+1];e.readUInt16BE=d;const c=(g,p=0)=>g[p]+g[p+1]*2**8;e.readUInt16LE=c;const a=(g,p=0)=>g[p]+g[p+1]*2**8+g[p+2]*2**16;e.readUInt24LE=a;const f=(g,p=0)=>g[p]+g[p+1]*2**8+g[p+2]*2**16+(g[p+3]<<24);e.readInt32LE=f;const t=(g,p=0)=>g[p]*2**24+g[p+1]*2**16+g[p+2]*2**8+g[p+3];e.readUInt32BE=t;const x=(g,p=0)=>g[p]+g[p+1]*2**8+g[p+2]*2**16+g[p+3]*2**24;e.readUInt32LE=x;const S={readUInt16BE:e.readUInt16BE,readUInt16LE:e.readUInt16LE,readUInt32BE:e.readUInt32BE,readUInt32LE:e.readUInt32LE};function u(g,p,l,s){l=l||0;const b=s?"BE":"LE",h="readUInt"+p+b;return S[h](g,l)}e.readUInt=u;function v(g,p){if(g.length-p<4)return;const l=(0,e.readUInt32BE)(g,p);if(!(g.length-p<l))return{name:(0,e.toUTF8String)(g,4+p,8+p),offset:p,size:l}}function m(g,p,l){for(;l<g.length;){const s=v(g,l);if(!s)break;if(s.name===p)return s;l+=s.size>0?s.size:8}}e.findBox=m})(Xe)),Xe}var vt;function xn(){if(vt)return ge;vt=1,Object.defineProperty(ge,"__esModule",{value:!0}),ge.BMP=void 0;const e=F();return ge.BMP={validate:n=>(0,e.toUTF8String)(n,0,2)==="BM",calculate:n=>({height:Math.abs((0,e.readInt32LE)(n,22)),width:(0,e.readUInt32LE)(n,18)})},ge}var In=xn();const Sn=A(In);var ye={},be={},wt;function xt(){if(wt)return be;wt=1,Object.defineProperty(be,"__esModule",{value:!0}),be.ICO=void 0;const e=F(),n=1,i=6,r=16;function o(c,a){const f=c[a];return f===0?256:f}function d(c,a){const f=i+a*r;return{height:o(c,f+1),width:o(c,f)}}return be.ICO={validate(c){const a=(0,e.readUInt16LE)(c,0),f=(0,e.readUInt16LE)(c,4);return a!==0||f===0?!1:(0,e.readUInt16LE)(c,2)===n},calculate(c){const a=(0,e.readUInt16LE)(c,4),f=d(c,0);if(a===1)return f;const t=[f];for(let x=1;x<a;x+=1)t.push(d(c,x));return{height:f.height,images:t,width:f.width}}},be}var It;function kn(){if(It)return ye;It=1,Object.defineProperty(ye,"__esModule",{value:!0}),ye.CUR=void 0;const e=xt(),n=F(),i=2;return ye.CUR={validate(r){const o=(0,n.readUInt16LE)(r,0),d=(0,n.readUInt16LE)(r,4);return o!==0||d===0?!1:(0,n.readUInt16LE)(r,2)===i},calculate:r=>e.ICO.calculate(r)},ye}var En=kn();const _n=A(En);var ve={},St;function Tn(){if(St)return ve;St=1,Object.defineProperty(ve,"__esModule",{value:!0}),ve.DDS=void 0;const e=F();return ve.DDS={validate:n=>(0,e.readUInt32LE)(n,0)===542327876,calculate:n=>({height:(0,e.readUInt32LE)(n,12),width:(0,e.readUInt32LE)(n,16)})},ve}var Cn=Tn();const Dn=A(Cn);var we={},kt;function Pn(){if(kt)return we;kt=1,Object.defineProperty(we,"__esModule",{value:!0}),we.GIF=void 0;const e=F(),n=/^GIF8[79]a/;return we.GIF={validate:i=>n.test((0,e.toUTF8String)(i,0,6)),calculate:i=>({height:(0,e.readUInt16LE)(i,8),width:(0,e.readUInt16LE)(i,6)})},we}var Nn=Pn();const Mn=A(Nn);var xe={},Et;function qn(){if(Et)return xe;Et=1,Object.defineProperty(xe,"__esModule",{value:!0}),xe.ICNS=void 0;const e=F(),n=8,i=4,r=4,o={ICON:32,"ICN#":32,"icm#":16,icm4:16,icm8:16,"ics#":16,ics4:16,ics8:16,is32:16,s8mk:16,icp4:16,icl4:32,icl8:32,il32:32,l8mk:32,icp5:32,ic11:32,ich4:48,ich8:48,ih32:48,h8mk:48,icp6:64,ic12:32,it32:128,t8mk:128,ic07:128,ic08:256,ic13:256,ic09:512,ic14:512,ic10:1024};function d(a,f){const t=f+r;return[(0,e.toUTF8String)(a,f,t),(0,e.readUInt32BE)(a,t)]}function c(a){const f=o[a];return{width:f,height:f,type:a}}return xe.ICNS={validate:a=>(0,e.toUTF8String)(a,0,4)==="icns",calculate(a){const f=a.length,t=(0,e.readUInt32BE)(a,i);let x=n,S=d(a,x),u=c(S[0]);if(x+=S[1],x===t)return u;const v={height:u.height,images:[u],width:u.width};for(;x<t&&x<f;)S=d(a,x),u=c(S[0]),x+=S[1],v.images.push(u);return v}},xe}var jn=qn();const Ln=A(jn);var On=xt();const Un=A(On);var Ie={},_t;function $n(){if(_t)return Ie;_t=1,Object.defineProperty(Ie,"__esModule",{value:!0}),Ie.J2C=void 0;const e=F();return Ie.J2C={validate:n=>(0,e.readUInt32BE)(n,0)===4283432785,calculate:n=>({height:(0,e.readUInt32BE)(n,12),width:(0,e.readUInt32BE)(n,8)})},Ie}var Rn=$n();const Bn=A(Rn);var Se={},Tt;function An(){if(Tt)return Se;Tt=1,Object.defineProperty(Se,"__esModule",{value:!0}),Se.JP2=void 0;const e=F();return Se.JP2={validate(n){if((0,e.toUTF8String)(n,4,8)!=="jP ")return!1;const r=(0,e.findBox)(n,"ftyp",0);return r?(0,e.toUTF8String)(n,r.offset+8,r.offset+12)==="jp2 ":!1},calculate(n){const i=(0,e.findBox)(n,"jp2h",0),r=i&&(0,e.findBox)(n,"ihdr",i.offset+8);if(r)return{height:(0,e.readUInt32BE)(n,r.offset+8),width:(0,e.readUInt32BE)(n,r.offset+12)};throw new TypeError("Unsupported JPEG 2000 format")}},Se}var Fn=An();const zn=A(Fn);var ke={},Ct;function Hn(){if(Ct)return ke;Ct=1,Object.defineProperty(ke,"__esModule",{value:!0}),ke.JPG=void 0;const e=F(),n="45786966",i=2,r=6,o=2,d="4d4d",c="4949",a=12,f=2;function t(m){return(0,e.toHexString)(m,2,6)===n}function x(m,g){return{height:(0,e.readUInt16BE)(m,g),width:(0,e.readUInt16BE)(m,g+2)}}function S(m,g){const l=r+8,s=(0,e.readUInt)(m,16,l,g);for(let b=0;b<s;b++){const h=l+f+b*a,I=h+a;if(h>m.length)return;const w=m.slice(h,I);if((0,e.readUInt)(w,16,0,g)===274)return(0,e.readUInt)(w,16,2,g)!==3||(0,e.readUInt)(w,32,4,g)!==1?void 0:(0,e.readUInt)(w,16,8,g)}}function u(m,g){const p=m.slice(i,g),l=(0,e.toHexString)(p,r,r+o),s=l===d;if(s||l===c)return S(p,s)}function v(m,g){if(g>m.length)throw new TypeError("Corrupt JPG, exceeded buffer limits")}return ke.JPG={validate:m=>(0,e.toHexString)(m,0,2)==="ffd8",calculate(m){m=m.slice(4);let g,p;for(;m.length;){const l=(0,e.readUInt16BE)(m,0);if(m[l]!==255){m=m.slice(1);continue}if(t(m)&&(g=u(m,l)),v(m,l),p=m[l+1],p===192||p===193||p===194){const s=x(m,l+5);return g?{height:s.height,orientation:g,width:s.width}:s}m=m.slice(l+2)}throw new TypeError("Invalid JPG, no size found")}},ke}var Wn=Hn();const Gn=A(Wn);var Ee={},Dt;function Kn(){if(Dt)return Ee;Dt=1,Object.defineProperty(Ee,"__esModule",{value:!0}),Ee.KTX=void 0;const e=F();return Ee.KTX={validate:n=>{const i=(0,e.toUTF8String)(n,1,7);return["KTX 11","KTX 20"].includes(i)},calculate:n=>{const i=n[5]===49?"ktx":"ktx2",r=i==="ktx"?36:20;return{height:(0,e.readUInt32LE)(n,r+4),width:(0,e.readUInt32LE)(n,r),type:i}}},Ee}var Qn=Kn();const Jn=A(Qn);var _e={},Pt;function Yn(){if(Pt)return _e;Pt=1,Object.defineProperty(_e,"__esModule",{value:!0}),_e.PNG=void 0;const e=F(),n=`PNG\r
|
|
23
|
+
|
|
24
|
+
`,i="IHDR",r="CgBI";return _e.PNG={validate(o){if(n===(0,e.toUTF8String)(o,1,8)){let d=(0,e.toUTF8String)(o,12,16);if(d===r&&(d=(0,e.toUTF8String)(o,28,32)),d!==i)throw new TypeError("Invalid PNG");return!0}return!1},calculate(o){return(0,e.toUTF8String)(o,12,16)===r?{height:(0,e.readUInt32BE)(o,36),width:(0,e.readUInt32BE)(o,32)}:{height:(0,e.readUInt32BE)(o,20),width:(0,e.readUInt32BE)(o,16)}}},_e}var Xn=Yn();const Zn=A(Xn);var Te={},Nt;function Vn(){if(Nt)return Te;Nt=1,Object.defineProperty(Te,"__esModule",{value:!0}),Te.PNM=void 0;const e=F(),n={P1:"pbm/ascii",P2:"pgm/ascii",P3:"ppm/ascii",P4:"pbm",P5:"pgm",P6:"ppm",P7:"pam",PF:"pfm"},i={default:r=>{let o=[];for(;r.length>0;){const d=r.shift();if(d[0]!=="#"){o=d.split(" ");break}}if(o.length===2)return{height:parseInt(o[1],10),width:parseInt(o[0],10)};throw new TypeError("Invalid PNM")},pam:r=>{const o={};for(;r.length>0;){const d=r.shift();if(d.length>16||d.charCodeAt(0)>128)continue;const[c,a]=d.split(" ");if(c&&a&&(o[c.toLowerCase()]=parseInt(a,10)),o.height&&o.width)break}if(o.height&&o.width)return{height:o.height,width:o.width};throw new TypeError("Invalid PAM")}};return Te.PNM={validate:r=>(0,e.toUTF8String)(r,0,2)in n,calculate(r){const o=(0,e.toUTF8String)(r,0,2),d=n[o],c=(0,e.toUTF8String)(r,3).split(/[\r\n]+/);return(i[d]||i.default)(c)}},Te}var er=Vn();const tr=A(er);var Ce={},Mt;function nr(){if(Mt)return Ce;Mt=1,Object.defineProperty(Ce,"__esModule",{value:!0}),Ce.PSD=void 0;const e=F();return Ce.PSD={validate:n=>(0,e.toUTF8String)(n,0,4)==="8BPS",calculate:n=>({height:(0,e.readUInt32BE)(n,14),width:(0,e.readUInt32BE)(n,18)})},Ce}var rr=nr();const or=A(rr);var De={},qt;function ir(){if(qt)return De;qt=1,Object.defineProperty(De,"__esModule",{value:!0}),De.SVG=void 0;const e=F(),n=/<svg\s([^>"']|"[^"]*"|'[^']*')*>/,i={height:/\sheight=(['"])([^%]+?)\1/,root:n,viewbox:/\sviewBox=(['"])(.+?)\1/i,width:/\swidth=(['"])([^%]+?)\1/},r=2.54,o={in:96,cm:96/r,em:16,ex:8,m:96/r*100,mm:96/r/10,pc:96/72/12,pt:96/72,px:1},d=new RegExp(`^([0-9.]+(?:e\\d+)?)(${Object.keys(o).join("|")})?$`);function c(S){const u=d.exec(S);if(u)return Math.round(Number(u[1])*(o[u[2]]||1))}function a(S){const u=S.split(" ");return{height:c(u[3]),width:c(u[2])}}function f(S){const u=S.match(i.width),v=S.match(i.height),m=S.match(i.viewbox);return{height:v&&c(v[2]),viewbox:m&&a(m[2]),width:u&&c(u[2])}}function t(S){return{height:S.height,width:S.width}}function x(S,u){const v=u.width/u.height;return S.width?{height:Math.floor(S.width/v),width:S.width}:S.height?{height:S.height,width:Math.floor(S.height*v)}:{height:u.height,width:u.width}}return De.SVG={validate:S=>n.test((0,e.toUTF8String)(S,0,1e3)),calculate(S){const u=(0,e.toUTF8String)(S).match(i.root);if(u){const v=f(u[0]);if(v.width&&v.height)return t(v);if(v.viewbox)return x(v,v.viewbox)}throw new TypeError("Invalid SVG")}},De}var sr=ir();const ar=A(sr);var Pe={},jt;function lr(){if(jt)return Pe;jt=1,Object.defineProperty(Pe,"__esModule",{value:!0}),Pe.TGA=void 0;const e=F();return Pe.TGA={validate(n){return(0,e.readUInt16LE)(n,0)===0&&(0,e.readUInt16LE)(n,4)===0},calculate(n){return{height:(0,e.readUInt16LE)(n,14),width:(0,e.readUInt16LE)(n,12)}}},Pe}var cr=lr();const dr=A(cr);var Ne={},Lt;function ur(){if(Lt)return Ne;Lt=1,Object.defineProperty(Ne,"__esModule",{value:!0}),Ne.WEBP=void 0;const e=F();function n(o){return{height:1+(0,e.readUInt24LE)(o,7),width:1+(0,e.readUInt24LE)(o,4)}}function i(o){return{height:1+((o[4]&15)<<10|o[3]<<2|(o[2]&192)>>6),width:1+((o[2]&63)<<8|o[1])}}function r(o){return{height:(0,e.readInt16LE)(o,8)&16383,width:(0,e.readInt16LE)(o,6)&16383}}return Ne.WEBP={validate(o){const d=(0,e.toUTF8String)(o,0,4)==="RIFF",c=(0,e.toUTF8String)(o,8,12)==="WEBP",a=(0,e.toUTF8String)(o,12,15)==="VP8";return d&&c&&a},calculate(o){const d=(0,e.toUTF8String)(o,12,16);if(o=o.slice(20,30),d==="VP8X"){const a=o[0],f=(a&192)===0,t=(a&1)===0;if(f&&t)return n(o);throw new TypeError("Invalid WebP")}if(d==="VP8 "&&o[0]!==47)return r(o);const c=(0,e.toHexString)(o,3,6);if(d==="VP8L"&&c!=="9d012a")return i(o);throw new TypeError("Invalid WebP")}},Ne}var fr=ur();const pr=A(fr);var Me={},Ot;function hr(){if(Ot)return Me;Ot=1,Object.defineProperty(Me,"__esModule",{value:!0}),Me.HEIF=void 0;const e=F(),n={avif:"avif",mif1:"heif",msf1:"heif",heic:"heic",heix:"heic",hevc:"heic",hevx:"heic"};return Me.HEIF={validate(i){if((0,e.toUTF8String)(i,4,8)!=="ftyp")return!1;const o=(0,e.findBox)(i,"ftyp",0);return o?(0,e.toUTF8String)(i,o.offset+8,o.offset+12)in n:!1},calculate(i){const r=(0,e.findBox)(i,"meta",0),o=r&&(0,e.findBox)(i,"iprp",r.offset+12),d=o&&(0,e.findBox)(i,"ipco",o.offset+8),c=d&&(0,e.findBox)(i,"ispe",d.offset+8);if(c)return{height:(0,e.readUInt32BE)(i,c.offset+16),width:(0,e.readUInt32BE)(i,c.offset+12),type:(0,e.toUTF8String)(i,8,12)};throw new TypeError("Invalid HEIF, no size found")}},Me}var mr=hr();const gr=A(mr),yr={56:"psd",66:"bmp",68:"dds",71:"gif",82:"webp",105:"icns",137:"png",255:"jpg"},Re={webp:pr.WEBP,jpg:Gn.JPG,png:Zn.PNG,svg:ar.SVG,gif:Mn.GIF,avif:gr.HEIF,bmp:Sn.BMP,cur:_n.CUR,dds:Dn.DDS,icns:Ln.ICNS,ico:Un.ICO,j2c:Bn.J2C,jp2:zn.JP2,ktx:Jn.KTX,pnm:tr.PNM,psd:or.PSD,tga:dr.TGA},br=Object.keys(Re);function vr(e){const n=e[0],i=yr[n];return i&&Re[i].validate(e)?i:br.find(r=>Re[r].validate(e))}function wr(e){const n=vr(e);if(typeof n<"u"){const i=Re[n].calculate(e);if(i!==void 0)return i.type=n,i}}async function xr(e){if(/^(https?|file|capacitor):/.test(e))try{const n=await fetch(e,{headers:{Accept:"image/*,*/*"}});if(!n.ok){console.error("can not fetch",e);return}const i=await n.arrayBuffer(),r=wr(Buffer.from(i));if(r)return{width:r.width,height:r.height,type:r.type,size:i.byteLength}}catch(n){console.error(n);return}}const Ir=(e,n,i)=>async(r,o,d)=>{try{const c=await e.dynamicImport("node:fs"),a=await e.dynamicImport("node:path");let f;try{f=new URL(r.url,"http://localhost:3000/")}catch{o.statusCode=404,o.end();return}if(r.method==="GET"&&f.pathname==="/__image_info"){const t=f.searchParams.get("url");if(o.setHeader("content-type","application/json"),t){const x=await xr(t);o.setHeader("cache-control","public, max-age=31536000, immutable"),x?o.write(JSON.stringify(x)):o.statusCode=404}else{o.statusCode=500;const x={message:"error"};o.write(JSON.stringify(x))}o.end();return}else if(r.method==="POST"&&f.pathname==="/__image_fix"){const t=f.searchParams.get("loc"),x=f.searchParams.get("width"),S=f.searchParams.get("height"),u=f.searchParams.get("src"),v=f.searchParams.get("currentHref"),m=t.split(":"),g=parseInt(m[m.length-1],10)-1;let p=parseInt(m[m.length-2],10)-1;const l=a.resolve(i,m.slice(0,m.length-2).join(":")),s=a.extname(l).toLowerCase();let h=c.readFileSync(l).toString("utf-8"),I=0;for(;I<h.length;I++)if(p===0){I+=g;break}else if(h[I]===`
|
|
25
|
+
`){p--;continue}if(h.slice(I,I+4)!=="<img"){console.error("Could not apply auto fix, because it was not possible to find the original <img> tag"),o.statusCode=500;return}const w=h.indexOf(">",I)+1;if(w<I){console.error("Could not apply auto fix, because it was not possible to find the original <img> tag"),o.statusCode=500;return}const T=[".ts",".tsx",".js",".jsx",".mdx"].includes(s);let E=h.slice(I,w);if(u&&v&&T){const P=new URL(u),U=new URL(v);if(P.origin===U.origin){const j=a.join(n,"public",P.pathname),R=a.join(n,P.pathname);let H;if(c.existsSync(j)){const V=a.join(i,"media",a.dirname(P.pathname));await c.promises.mkdir(V,{recursive:!0}),await c.promises.copyFile(j,a.join(i,"media",P.pathname)),H="~/media"+P.pathname}else if(c.existsSync(R))H=P.pathname.replace("/src/","~/");else return;const Y=Sr(P.pathname),le=`${H}?jsx`;E=E.replace(/^<img/,`<${Y}`),E=E.replace(/\bwidth=(({[^}]*})|('[^']*')|("[^"]*"))\s*/,""),E=E.replace(/\bheight=(({[^}]*})|('[^']*')|("[^"]*"))\s*/,""),E=E.replace(/\bsrc=(({[^}]*})|('[^']*')|("[^"]*"))\s*/,"");let W=0;if(s===".mdx"&&h.startsWith("---")&&(W=h.indexOf("---",4)+3,W===-1))return;const ee=`
|
|
26
|
+
import ${Y} from '${le}';`;h=`${h.slice(0,W)}${ee}${h.slice(W,I)}${E}${h.slice(w)}`,c.writeFileSync(l,h);return}}E=E.replace(/\bwidth=(({[^}]*})|('[^']*')|("[^"]*"))/,`width="${x}"`),E=E.replace(/\bheight=(({[^}]*})|('[^']*')|("[^"]*"))/,`height="${S}"`),E.includes("height=")||(E=E.replace(/<img/,`<img height="${S}"`)),E.includes("width=")||(E=E.replace(/<img/,`<img width="${x}"`)),h=h.slice(0,I)+E+h.slice(w),c.writeFileSync(l,h)}else d()}catch(c){c instanceof Error&&await nn(e,c),d(c)}};function Sr(e){const n=e.lastIndexOf("."),i=e.lastIndexOf("/");return e=e.substring(i+1,n),`Img${kr(e)}`}function kr(e){return`${e}`.toLowerCase().replace(new RegExp(/[-_]+/,"g")," ").replace(new RegExp(/[^\w\s]/,"g"),"").replace(new RegExp(/\s+(.)(\w*)/,"g"),(n,i,r)=>`${i.toUpperCase()+r}`).replace(new RegExp(/\w/),n=>n.toUpperCase())}const Er=`"undefined"==typeof window||window.__qwikViteLog||(window.__qwikViteLog=!0,console.debug("%c⭐️ Qwik Dev SSR Mode","background: #0c75d2; color: white; padding: 2px 3px; border-radius: 2px; font-size: 0.8em;","App is running in SSR development mode!\\n - Additional JS is loaded by Vite for debugging and live reloading\\n - Rendering performance might not be optimal\\n - Delayed interactivity because prefetching is disabled\\n - Vite dev bundles do not represent production output\\n\\nProduction build can be tested running 'npm run preview'"))`,_r='if("undefined"!=typeof document){const e=()=>{const e="data-qwik-inspector",t=globalThis.__HOTKEYS__;globalThis.__SRC_DIR__;let o=document.querySelector("#qwik-inspector-info-popup");o||(o=document.createElement("div"),o.id="qwik-inspector-info-popup",o["aria-hidden"]="true",document.body.appendChild(o)),o.textContent=`Click-to-Source: ${t.join(" + ")}`,console.debug("%c🔍 Qwik Click-To-Source","background: #564CE0; color: white; padding: 2px 3px; border-radius: 2px; font-size: 0.8em;",`Hold-press the \'${t.join(" + ")}\' key${t.length>1?"s":""} and click a component to jump directly to the source code in your IDE!`),window.__qwik_inspector_state={pressedKeys:new Set};const n=document.body,r=document.createElement("div");function i(t){return t&&t instanceof Element?t.closest(`[${e}]`):null}function s(){const e=window.__qwik_inspector_state.hoveredElement;if(e&&d()){const t=e.getBoundingClientRect();r.style.setProperty("height",t.height+"px"),r.style.setProperty("width",t.width+"px"),r.style.setProperty("top",t.top+"px"),r.style.setProperty("left",t.left+"px"),r.style.setProperty("visibility","visible"),n.style.setProperty("cursor","pointer")}else r.style.setProperty("height","0px"),r.style.setProperty("width","0px"),r.style.setProperty("visibility","hidden"),n.style.removeProperty("cursor")}function d(){return function(){const e=Array.from(window.__qwik_inspector_state.pressedKeys).map(e=>e?e.replace(/(Left|Right)$/g,""):void 0);return t.every(t=>e.includes(t))}()}r.id="qwik-inspector-overlay",r.setAttribute("aria-hidden","true"),n.appendChild(r),document.addEventListener("keydown",e=>{window.__qwik_inspector_state.pressedKeys.add(e.code),s()},{capture:!0}),document.addEventListener("keyup",e=>{window.__qwik_inspector_state.pressedKeys.delete(e.code),s()},{capture:!0}),window.addEventListener("blur",()=>{window.__qwik_inspector_state.pressedKeys.clear(),s()},{capture:!0}),document.addEventListener("mouseover",e=>{const t=i(e.target);window.__qwik_inspector_state.hoveredElement=t||void 0,s()},{capture:!0}),document.addEventListener("click",t=>{if(d()){window.__qwik_inspector_state.pressedKeys.clear();const o=i(t.target);if(o){t.preventDefault(),t.stopPropagation();const r=o.getAttribute(e);if("false"!==r){n.style.setProperty("cursor","progress");const e=r.match(/^(.*?)(:\\d+(:\\d+)?)?$/);if(e){const[,t,o]=e;fetch(`${t}?editor${o}`).then(()=>{n.style.removeProperty("cursor")})}}}}},{capture:!0}),document.addEventListener("contextmenu",e=>{if(d()){window.__qwik_inspector_state.pressedKeys.clear();i(e.target)&&e.preventDefault()}},{capture:!0}),window.addEventListener("resize",s),document.addEventListener("scroll",s)};document.addEventListener("DOMContentLoaded",e)}',Tr=`if("undefined"!=typeof HTMLElement){class e extends HTMLElement{get _root(){return this.shadowRoot||this}constructor(){super(),this.state={},this.props||(this.props={}),this.componentProps=["children","error"],this.nodesToDestroy=[],this.pendingUpdate=!1,this.attachShadow({mode:"open"})}destroyAnyNodes(){this.nodesToDestroy.forEach(e=>e.remove()),this.nodesToDestroy=[]}connectedCallback(){this.getAttributeNames().forEach(e=>{const t=e.replace(/-/g,""),o=new RegExp(t,"i");this.componentProps.forEach(t=>{if(o.test(t)){const o=this.getAttribute(e);this.props[t]!==o&&(this.props[t]=o)}})}),this._root.innerHTML='\\n\\n <template data-el="show-errored-host">\\n <div class="error">\\n <template data-el="div-errored-host-2">\\n \\x3c!-- String(props.error) --\\x3e\\n </template>\\n </div>\\n </template>\\n\\n <div class="arrow">👇 Uncaught error happened here 👇\\n <span class="dev-tools">DevTools: Cmd+Alt+I</span>\\n </div>\\n <div class="div">\\n <slot></slot>\\n </div>\\n\\n <style>\\n .error {\\n border-radius: 5px 5px 0px 0;\\n background: black;\\n color: white;\\n font-family: monospace;\\n font-size: 12px;\\n margin: 0;\\n padding: 10px;\\n }\\n .arrow {\\n background: #f47e81;\\n color: black;\\n font-size: 14px;\\n padding: 10px;\\n text-align: center;\\n font-family: sans-serif;\\n }\\n .dev-tools {\\n background: red;\\n padding: 2px 5px;\\n border-radius: 3px;\\n font-weight: 800;\\n }\\n .div {\\n outline: 5px solid red;\\n border-radius: 10px;\\n }\\n </style>',this.pendingUpdate=!0,this.render(),this.onMount(),this.pendingUpdate=!1,this.update()}showContent(e){const t=e.content.cloneNode(!0);Array.from(t.childNodes).forEach(t=>{e?.scope&&(t.scope=e.scope),e?.context&&(t.context=e.context),this.nodesToDestroy.push(t)}),e.after(t)}onMount(){}onUpdate(){}update(){!0!==this.pendingUpdate&&(this.pendingUpdate=!0,this.render(),this.onUpdate(),this.pendingUpdate=!1)}render(){this.destroyAnyNodes(),this.updateBindings()}updateBindings(){this._root.querySelectorAll("[data-el='show-errored-host']").forEach(e=>{this.props.error&&this.showContent(e)}),this._root.querySelectorAll("[data-el='div-errored-host-2']").forEach(e=>{this.renderTextNode(e,String(this.props.error))})}renderTextNode(e,t){const o=document.createTextNode(t);e?.scope&&(o.scope=e.scope),e?.context&&(o.context=e.context),e.after(o),this.nodesToDestroy.push(e.nextSibling)}}customElements.define("errored-host",e),document.addEventListener("qerror",e=>{const t=customElements.get("vite-error-overlay");if(!t)return;const o=new t(e.detail.error);document.body.appendChild(o)})}`,Cr='[data-qwik-cls]{outline:2px solid red}[data-qwik-cls]:after{position:absolute;font-size:12px;content:"CLS " attr(data-qwik-cls);font-family:monospace;font-weight:700;background:red;color:#fff;margin:-2px;padding:1px;line-height:1;pointer-events:none}#qwik-image-warning-container{position:absolute!important;top:0!important;left:0!important;width:0!important;overflow:visible!important;height:0!important;pointer-events:none!important;contain:size layout style content;z-index:1}',Dr='if("undefined"!=typeof document){const e=()=>{class e extends HTMLElement{#e=null;constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(document.createElement("template").innerHTML=globalThis.__TEMPLATE__);const e=this.shadowRoot.querySelector("dialog");this.shadowRoot.addEventListener("click",async t=>{const o=t.target;"BUTTON"===o.nodeName&&("action-btn"===o.id?this.#e&&(this.#e(),e.close()):"icon"===o.id?e.open?e.close():(e.className=function(e){const{x:t}=e.getBoundingClientRect();let o="right";return t>window.innerWidth-260&&(o="left"),`bottom ${o}`}(o),e.show()):"loc"===o.id&&o.dataset.url&&globalThis.qwikOpenInEditor(o.dataset.url))})}set loc(e){const t=this.shadowRoot.querySelector("#loc");t.textContent=e,globalThis.qwikOpenInEditor&&(t.dataset.url=e)}set header(e){this.shadowRoot.querySelector("#title").textContent=e}set message(e){this.shadowRoot.querySelector("#message").innerHTML=e}set actionFn(e){this.#e=e}set actionName(e){e&&(this.shadowRoot.querySelector(".action-container").innerHTML=`<button id="action-btn" type="button">${e}</button>`)}}customElements.define("image-warning",e);const t=new Map;let o=document.querySelector("#qwik-image-warning-container");o||(o=document.createElement("div"),o.id="qwik-image-warning-container",document.body.appendChild(o));let n=!1;const i=new Map;function r(e){let t=i.get(e);return void 0===t&&(t=async function(e){if(!/^(https?|file|capacitor):/.test(e))return;const t=new URL("/__image_info",location.href);return t.searchParams.set("url",e),fetch(t).then(e=>e.json()).catch(()=>null)}(e),i.set(e,t)),t}function a(e){return e.endsWith("px")}async function s(e){const i=t.get(e);e.isConnected?e.complete&&async function(e){const i=window.scrollX,s=window.scrollY,c=e.getBoundingClientRect(),d=e.currentSrc,l=await r(d);let h=t.get(e);const u=window.innerWidth>500;if(l&&u){let r=!1;const d=e.getAttribute("data-qwik-inspector"),u=c.width*c.height;if(!e.hasAttribute("width")||!e.hasAttribute("height")){n=!0;const t=getComputedStyle(e),o="auto"!==t.getPropertyValue("aspect-ratio").toString(),i=a(t.getPropertyValue("width").toString()),s=a(t.getPropertyValue("height").toString()),c="absolute"===t.getPropertyValue("position").toString();r=u>1e3&&!c&&!o&&(!i||!s)}const g=u<.5*(l.width&&l.height)&&"svg"!==l.type;if(n=!1,r||g){if(h||(h=document.createElement("image-warning"),o.appendChild(h),t.set(e,h)),h.style.top=c.top+s+"px",h.style.left=c.left+i+"px",h.style.width=c.width+"px",h.style.height=c.height+"px",h.info=l,h.loc=d,r){const t=`width="${l.width}" height="${l.height}"`;h.header="Perf: layout shift",h.message=`Image\'s size is unknown until it\'s loaded, <a href="https://web.dev/cls/" target="_blank" rel="noopener noreferrer">causing layout shift</a>.</p><p>To solve this problem set the width/height in the img tag:</p><pre><img <span>${t}</span></pre>`;const o=1===document.querySelectorAll(\'[data-qwik-inspector="\'+d+\'"]\').length;d&&(o?(h.actionName="Auto fix",h.actionFn=async()=>{const t=new URL("/__image_fix",location.href);t.searchParams.set("loc",d),t.searchParams.set("width",l.width),t.searchParams.set("height",l.height),e.srcset||(t.searchParams.set("src",e.currentSrc),t.searchParams.set("currentHref",location.href)),await fetch(t,{method:"POST"})}):(h.actionName="Open in editor",h.actionFn=async()=>{await navigator.clipboard.writeText(t),globalThis.qwikOpenInEditor(d)}))}else g&&(h.header="Perf: properly size image",h.message=`The image is too big, <a href="https://developer.chrome.com/en/docs/lighthouse/performance/uses-responsive-images/" target="_blank" rel="noopener noreferrer">hurting performance</a>, it should be resized to the size it\'s displayed at. The image dimensions are ${l.width} x ${l.height} but it\'s displayed at ${c.width}x${c.height}.</p>`);return}}h&&(h.remove(),t.delete(e))}(e):i&&(i.remove(),t.delete(e))}const c=new ResizeObserver(e=>{if(!n)for(const t of e)s(t.target)}),d=new MutationObserver(e=>{for(const t of e){for(const e of t.addedNodes)"IMG"===e.nodeName?c.observe(e):1===e.nodeType&&e.querySelectorAll("img").forEach(e=>{c.observe(e)});for(const e of t.removedNodes)"IMG"===e.nodeName?(s(e),c.unobserve(e)):1===e.nodeType&&e.querySelectorAll("img").forEach(e=>{s(e),c.unobserve(e)})}});let l,h=0;const u=()=>{setTimeout(()=>{l&&(l.disconnect(),h>.005&&console.error("Detected Layout Shift during page load",h)),d.observe(document.body,{childList:!0,subtree:!0}),document.body.querySelectorAll("img").forEach(e=>{c.observe(e)})},100)};"complete"===document.readyState?u():window.addEventListener("load",u);const g=1===performance?.navigation.type||performance.getEntriesByType("navigation").map(e=>e.type).includes("reload");"undefined"==typeof PerformanceObserver||g||(l=new PerformanceObserver(e=>{e.getEntries().forEach(e=>{if(!e.hadRecentInput){if(e.value>.006)for(const t of e.sources)t.node&&1===t.node.nodeType&&"IMAGE-WARNING"!==t.node.nodeName&&t.node.setAttribute("data-qwik-cls",Number(e.value).toFixed(3));h+=e.value}})}),l.observe({type:"layout-shift",buffered:!0}))};document.addEventListener("load",e)}',Pr=`<style>
|
|
27
|
+
:host {
|
|
28
|
+
position: absolute;
|
|
29
|
+
border: 1px solid red;
|
|
30
|
+
pointer-events: none;
|
|
31
|
+
z-index: 1;
|
|
32
|
+
contain: layout size;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
#icon {
|
|
36
|
+
border: 0;
|
|
37
|
+
margin: 5px;
|
|
38
|
+
color: black;
|
|
39
|
+
max-width: 100%;
|
|
40
|
+
width: 20px;
|
|
41
|
+
background: yellow;
|
|
42
|
+
border-radius: 100%;
|
|
43
|
+
height: 20px;
|
|
44
|
+
padding: 3px;
|
|
45
|
+
pointer-events: all;
|
|
46
|
+
cursor: pointer;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
#icon svg {
|
|
50
|
+
width: 100%;
|
|
51
|
+
height: auto;
|
|
52
|
+
pointer-events: none;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
dialog {
|
|
56
|
+
padding: 0;
|
|
57
|
+
border: 0;
|
|
58
|
+
margin: 0 5px;
|
|
59
|
+
background: #ffffe8;
|
|
60
|
+
color: black;
|
|
61
|
+
width: 250px;
|
|
62
|
+
font-size: 11px;
|
|
63
|
+
position: absolute;
|
|
64
|
+
inset-inline-start: unset;
|
|
65
|
+
inset-inline-end: unset;
|
|
66
|
+
border-radius: 5px;
|
|
67
|
+
pointer-events: all;
|
|
68
|
+
overflow: hidden;
|
|
69
|
+
box-shadow: 0px -2px 20px 0px #0000002e;
|
|
70
|
+
z-index: 10000;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.top {
|
|
74
|
+
bottom: calc(100% + 5px);
|
|
75
|
+
}
|
|
76
|
+
.bottom {
|
|
77
|
+
top: 40px;
|
|
78
|
+
}
|
|
79
|
+
.right {
|
|
80
|
+
inset-inline-start: 0;
|
|
81
|
+
inset-inline-end: unset;
|
|
82
|
+
}
|
|
83
|
+
.left {
|
|
84
|
+
inset-inline-start: unset;
|
|
85
|
+
inset-inline-end: calc(100% - 40px);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.content {
|
|
89
|
+
padding: 5px;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
#loc {
|
|
93
|
+
background: #2e3801;
|
|
94
|
+
color: #d2d2d2;
|
|
95
|
+
font-family: monospace;
|
|
96
|
+
padding: 3px 5px;
|
|
97
|
+
pointer-events: all;
|
|
98
|
+
margin: 0;
|
|
99
|
+
border: 0;
|
|
100
|
+
cursor: pointer;
|
|
101
|
+
font-size: 11px;
|
|
102
|
+
width: calc(100% - 24px);
|
|
103
|
+
text-overflow: ellipsis;
|
|
104
|
+
overflow: hidden;
|
|
105
|
+
display: block;
|
|
106
|
+
direction: rtl;
|
|
107
|
+
text-align: right;
|
|
108
|
+
}
|
|
109
|
+
#loc:hover {
|
|
110
|
+
background: #3a4a01;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
pre {
|
|
114
|
+
background: #f1fb8e;
|
|
115
|
+
padding: 5px;
|
|
116
|
+
margin: 5px 0;
|
|
117
|
+
border-radius: 3px;
|
|
118
|
+
user-select: none;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
pre span {
|
|
122
|
+
user-select: all;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
a {
|
|
126
|
+
text-decoration: underline;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
#close {
|
|
130
|
+
border: 0;
|
|
131
|
+
width: 25px;
|
|
132
|
+
height: 25px;
|
|
133
|
+
position: absolute;
|
|
134
|
+
right: 0;
|
|
135
|
+
top: 0;
|
|
136
|
+
background: #ffe14f;
|
|
137
|
+
color: black;
|
|
138
|
+
font-weight: 900;
|
|
139
|
+
padding: 0;
|
|
140
|
+
margin: 0;
|
|
141
|
+
display: flex;
|
|
142
|
+
align-items: center;
|
|
143
|
+
justify-content: center;
|
|
144
|
+
line-height: 1;
|
|
145
|
+
cursor: pointer;
|
|
146
|
+
}
|
|
147
|
+
#close:hover {
|
|
148
|
+
background: #ffeb6f;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
#action-btn {
|
|
152
|
+
border: 2px solid #18ae00;
|
|
153
|
+
padding: 2px 4px;
|
|
154
|
+
background: #50ff50;
|
|
155
|
+
border-radius: 5px;
|
|
156
|
+
color: #0c5500;
|
|
157
|
+
font-weight: 800;
|
|
158
|
+
font-size: 10px;
|
|
159
|
+
cursor: pointer;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
p {
|
|
163
|
+
margin: 5px 0;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
h2 {
|
|
167
|
+
font-weight: 900;
|
|
168
|
+
margin: 10px 0;
|
|
169
|
+
}
|
|
170
|
+
</style>
|
|
171
|
+
<button id="icon" type="button" aria-label="Open image dev dialog">
|
|
172
|
+
<svg width="32" height="32" viewBox="0 0 24 24">
|
|
173
|
+
<path
|
|
174
|
+
fill="currentColor"
|
|
175
|
+
d="M2.725 21q-.275 0-.5-.138t-.35-.362q-.125-.225-.138-.488t.138-.512l9.25-16q.15-.25.388-.375T12 3q.25 0 .488.125t.387.375l9.25 16q.15.25.138.513t-.138.487q-.125.225-.35.363t-.5.137H2.725ZM12 18q.425 0 .713-.288T13 17q0-.425-.288-.713T12 16q-.425 0-.713.288T11 17q0 .425.288.713T12 18Zm0-3q.425 0 .713-.288T13 14v-3q0-.425-.288-.713T12 10q-.425 0-.713.288T11 11v3q0 .425.288.713T12 15Z"
|
|
176
|
+
/>
|
|
177
|
+
</svg>
|
|
178
|
+
</button>
|
|
179
|
+
<dialog>
|
|
180
|
+
<form method="dialog">
|
|
181
|
+
<button id="close" type="submit" aria-label="Close">X</button>
|
|
182
|
+
</form>
|
|
183
|
+
<button id="loc"></button>
|
|
184
|
+
<div class="content">
|
|
185
|
+
<h2 id="title"></h2>
|
|
186
|
+
<p id="message"></p>
|
|
187
|
+
<p class="action-container"></p>
|
|
188
|
+
</div>
|
|
189
|
+
</dialog>
|
|
190
|
+
`,Nr=`vite-error-overlay{--color-bright: rgba(255, 255, 255, .8);--color-yellow: rgba(255, 246, 85, .8);--qwik-dark-blue: #006ce9;--qwik-light-blue: #3ec2f7;--qwik-light-purple: #ac7ff4;--qwik-dark-purple: #713fc2;--yellow: #fff;--purple: var(--color-bright);--red: var(--qwik-light-blue);--vertical-box-spacing: 15px;--box-padding: 20px;--box-margin: 0 0 var(--vertical-box-spacing) 0;--box-background: rgba(0, 0, 0, .5);--box-border-radius: 8px}vite-error-overlay::part(backdrop){background:#020b1199}vite-error-overlay::part(window){background:transparent;border:none;box-shadow:none;box-sizing:border-box;margin:50px auto;max-width:1200px;padding:var(--box-padding);width:90%}vite-error-overlay::part(message){display:flex;flex-direction:column;font-size:1.6rem;line-height:1.7;margin-bottom:30px}vite-error-overlay::part(plugin){font-size:.8rem;font-weight:100}vite-error-overlay::part(file),vite-error-overlay::part(frame),vite-error-overlay::part(stack),vite-error-overlay::part(tip){background:var(--box-background);border-left:5px solid transparent;border-radius:var(--box-border-radius);margin:var(--box-margin);min-height:50px;padding:var(--box-padding);position:relative}vite-error-overlay::part(file){border-left-color:#19b6f6;color:var(--color-bright)}vite-error-overlay::part(frame){border-left-color:var(--color-yellow);color:var(--color-yellow)}vite-error-overlay::part(stack){border-left-color:#ff5722}vite-error-overlay::part(tip){border-top:none;border-left-color:#ac7ff4}vite-error-overlay::part(file):before,vite-error-overlay::part(frame):before,vite-error-overlay::part(stack):before{border-bottom:1px solid #222;color:var(--color-bright);display:block;margin-bottom:15px;padding-bottom:5px;padding-left:30px;font-size:.8rem}vite-error-overlay::part(file):before{content:"File"}vite-error-overlay::part(frame):before{content:"Frame"}vite-error-overlay::part(stack):before{content:"Stack Trace"}vite-error-overlay::part(file):after,vite-error-overlay::part(frame):after,vite-error-overlay::part(stack):after{content:"";display:block;height:20px;position:absolute;left:var(--box-padding);top:var(--box-padding);width:20px}vite-error-overlay::part(file):after{background-image:url("data:image/svg+xml,%3Csvg width='20px' height='20px' viewBox='0 0 24 24' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Ctitle%3EFile-Generic%3C/title%3E%3Cg id='Page-1' stroke='none' stroke-width='1' fill='none' fill-rule='evenodd'%3E%3Cg id='File-Generic'%3E%3Crect id='Rectangle' fill-rule='nonzero' x='0' y='0' width='24' height='24'%3E%3C/rect%3E%3Cpath d='M4 5 C4 3.89543 4.89543 3 6 3 L15.1716 3 C15.702 3 16.2107 3.21071 16.5858 3.58579 L19.4142 6.41421 C19.7893 6.78929 20 7.29799 20 7.82843 L20 19 C20 20.1046 19.1046 21 18 21 L6 21 C4.89543 21 4 20.1046 4 19 L4 5 Z' id='Path' stroke='rgba(255,255,255,0.7)' stroke-width='1' stroke-linecap='round'%3E%3C/path%3E%3Cpath d='M15 4 L15 6 C15 7.10457 15.8954 8 17 8 L19 8' id='Path' stroke='rgba(255,255,255,0.7)' stroke-width='1' stroke-linecap='round'%3E%3C/path%3E%3C/g%3E%3C/g%3E%3C/svg%3E")}vite-error-overlay::part(frame):after{background-image:url("data:image/svg+xml,%3Csvg width='20px' height='20px' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M15.6602 2.84952H19.1516C20.2555 2.84952 21.1504 3.74444 21.1504 4.84839V8.3398' stroke='rgba(255,255,255,0.7)' stroke-width='1.69904' stroke-linecap='round'/%3E%3Cpath d='M2.84949 8.33981L2.84949 4.8484C2.84949 3.74446 3.74441 2.84953 4.84836 2.84953L8.33977 2.84953' stroke='rgba(255,255,255,0.7)' stroke-width='1.69904' stroke-linecap='round'/%3E%3Cpath d='M21.1505 15.6602L21.1505 19.1516C21.1505 20.2555 20.2556 21.1505 19.1516 21.1505L15.6602 21.1505' stroke='rgba(255,255,255,0.7)' stroke-width='1.69904' stroke-linecap='round'/%3E%3Cpath d='M8.33984 21.1505L4.84843 21.1505C3.74449 21.1505 2.84956 20.2555 2.84956 19.1516L2.84956 15.6602' stroke='rgba(255,255,255,0.7)' stroke-width='1.69904' stroke-linecap='round'/%3E%3C/svg%3E")}vite-error-overlay::part(stack):after{background-image:url("data:image/svg+xml,%3Csvg width='20px' height='20px' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M14.78 20H9.78C7.98 20 4.58 19.09 4.58 15.64C4.58 12.19 7.98 11.28 9.78 11.28H14.22C14.37 11.28 17.92 11.23 17.92 8.42C17.92 5.61 14.37 5.56 14.22 5.56H9.22C9.02109 5.56 8.83032 5.48098 8.68967 5.34033C8.54902 5.19968 8.47 5.00891 8.47 4.81C8.47 4.61109 8.54902 4.42032 8.68967 4.27967C8.83032 4.13902 9.02109 4.06 9.22 4.06H14.22C16.02 4.06 19.42 4.97 19.42 8.42C19.42 11.87 16.02 12.78 14.22 12.78H9.78C9.63 12.78 6.08 12.83 6.08 15.64C6.08 18.45 9.63 18.5 9.78 18.5H14.78C14.9789 18.5 15.1697 18.579 15.3103 18.7197C15.451 18.8603 15.53 19.0511 15.53 19.25C15.53 19.4489 15.451 19.6397 15.3103 19.7803C15.1697 19.921 14.9789 20 14.78 20Z' fill='rgba(255,255,255,0.7)'/%3E%3Cpath d='M6.44 8.31C5.74314 8.30407 5.06363 8.09202 4.48708 7.70056C3.91054 7.30909 3.46276 6.75573 3.20018 6.11021C2.93759 5.46469 2.87195 4.75589 3.01153 4.07312C3.1511 3.39036 3.48965 2.76418 3.9845 2.2735C4.47935 1.78281 5.10837 1.44958 5.79229 1.31579C6.47622 1.182 7.18444 1.25363 7.82771 1.52167C8.47099 1.78971 9.02054 2.24215 9.40711 2.82199C9.79368 3.40182 9.99998 4.08311 10 4.78C10 5.2461 9.90773 5.70759 9.72846 6.13783C9.54919 6.56808 9.28648 6.95856 8.95551 7.28675C8.62453 7.61494 8.23184 7.87433 7.80009 8.04995C7.36834 8.22558 6.90609 8.31396 6.44 8.31ZM6.44 2.75C6.04444 2.75 5.65776 2.86729 5.32886 3.08706C4.99996 3.30682 4.74362 3.61918 4.59224 3.98463C4.44087 4.35008 4.40126 4.75221 4.47843 5.14018C4.5556 5.52814 4.74609 5.8845 5.02579 6.16421C5.3055 6.44391 5.66186 6.6344 6.04982 6.71157C6.43779 6.78874 6.83992 6.74913 7.20537 6.59776C7.57082 6.44638 7.88318 6.19003 8.10294 5.86114C8.32271 5.53224 8.44 5.14556 8.44 4.75C8.44 4.48735 8.38827 4.22728 8.28776 3.98463C8.18725 3.74198 8.03993 3.5215 7.85422 3.33578C7.6685 3.15007 7.44802 3.00275 7.20537 2.90224C6.96272 2.80173 6.70265 2.75 6.44 2.75Z' fill='rgba(255,255,255,0.7)'/%3E%3Cpath d='M17.56 22.75C16.8614 22.752 16.1779 22.5466 15.5961 22.1599C15.0143 21.7733 14.5603 21.2227 14.2916 20.5778C14.0229 19.933 13.9515 19.2229 14.0866 18.5375C14.2217 17.8521 14.5571 17.2221 15.0504 16.7275C15.5437 16.2328 16.1726 15.8956 16.8577 15.7586C17.5427 15.6215 18.253 15.6909 18.8986 15.9577C19.5442 16.2246 20.0961 16.6771 20.4844 17.2578C20.8727 17.8385 21.08 18.5214 21.08 19.22C21.08 20.1545 20.7095 21.0508 20.0496 21.7125C19.3898 22.3743 18.4945 22.7473 17.56 22.75ZM17.56 17.19C17.1644 17.19 16.7778 17.3073 16.4489 17.5271C16.12 17.7468 15.8636 18.0592 15.7122 18.4246C15.5609 18.7901 15.5213 19.1922 15.5984 19.5802C15.6756 19.9681 15.8661 20.3245 16.1458 20.6042C16.4255 20.8839 16.7819 21.0744 17.1698 21.1516C17.5578 21.2287 17.9599 21.1891 18.3254 21.0377C18.6908 20.8864 19.0032 20.63 19.2229 20.3011C19.4427 19.9722 19.56 19.5856 19.56 19.19C19.56 18.6596 19.3493 18.1508 18.9742 17.7758C18.5991 17.4007 18.0904 17.19 17.56 17.19Z' fill='rgba(255,255,255,0.7)'/%3E%3C/svg%3E")}vite-error-overlay::part(tip):before{content:"Not sure how to solve this? Visit https://qwik.dev or connect with the community on Discord.";display:block;margin-bottom:1em}`,Mr="#qwik-inspector-overlay{position:fixed;background:#18b6f645;pointer-events:none;box-sizing:border-box;border:2px solid rgba(172,126,244,.46);border-radius:4px;contain:strict;cursor:pointer;z-index:999999}#qwik-inspector-info-popup{position:fixed;bottom:10px;right:10px;font-family:monospace;background:#000000c2;color:#fff;padding:10px 20px;border-radius:8px;box-shadow:0 20px 25px -5px #00000057,0 8px 10px -6px #0000003d;backdrop-filter:blur(4px);-webkit-animation:fadeOut .3s 3s ease-in-out forwards;animation:fadeOut .3s 3s ease-in-out forwards;z-index:999999;contain:layout}#qwik-inspector-info-popup p{margin:0}@-webkit-keyframes fadeOut{0%{opacity:1}to{opacity:0}}@keyframes fadeOut{0%{opacity:1}to{opacity:0;visibility:hidden}}";async function qr(e,n,i,r){const o=await i.dynamicImport("node:fs"),d=await i.dynamicImport("node:url"),a=["mjs","cjs","js"].map(f=>r.join(n,`entry.preview.${f}`)).find(f=>o.existsSync(f));if(!a)return Ze(e,`Unable to find output "${n}/entry.preview" module.
|
|
191
|
+
|
|
192
|
+
Please ensure "src/entry.preview.tsx" has been built before the "preview" command.`);try{const f=d.pathToFileURL(a).href,t=await i.strictDynamicImport(f);let x=null,S=null;if(t.default&&(typeof t.default=="function"?x=t.default:typeof t.default=="object"&&(x=t.default.router,S=t.default.notFound)),typeof x!="function")return Ze(e,`Entry preview module "${a}" does not export a default middleware function`);e.use(x),typeof S=="function"&&e.use(S)}catch(f){return Ze(e,String(f))}}function Ze(e,n){console.log(`
|
|
193
|
+
❌ ${n}
|
|
194
|
+
`),e.use((i,r)=>{r.writeHead(400,{"Content-Type":"text/plain"}),r.end(n)})}const jr=(e,n)=>{const i=[{tag:"style",children:Nr,injectTo:"body"},{tag:"style",children:Mr,injectTo:"body"},{tag:"script",attrs:{type:"module"},children:Tr,injectTo:"body"},{tag:"script",attrs:{type:"module"},children:Er,injectTo:"body"}];if((e.devTools?.imageDevTools??!0)&&i.push({tag:"style",children:Cr,injectTo:"body"},{tag:"script",attrs:{type:"module"},children:Dr.replace("globalThis.__TEMPLATE__",JSON.stringify(Pr)),injectTo:"body"}),e.devTools?.clickToSource??!0){const r=e.devTools.clickToSource??[],o=new URL(n+"/","http://local.local").href;i.push({tag:"script",attrs:{type:"module"},children:_r.replace("globalThis.__HOTKEYS__",JSON.stringify(r)).replace("globalThis.__SRC_DIR__",JSON.stringify(o)),injectTo:"body"})}return i},Lr=[Ue,We,Ge],Or=[".css",".scss",".sass",".less",".styl",".stylus"],Ur=[".woff",".woff2",".ttf"];function $r(e={}){let n="serve",i=null,r=null,o="/",d=null,c,a=null,f=null,t=null;const x=e.fileFilter?(s,b)=>gt.test(s)||e.fileFilter(s,b):()=>!0,S=e.disableFontPreload??!1,u=[],v=mt(e.optimizerOptions),m=new Set;return[{name:"vite-plugin-qwik",enforce:"pre",api:{getOptimizer:()=>v.getOptimizer(),getOptions:()=>v.getOptions(),getManifest:()=>i,getRootDir:()=>v.getOptions().rootDir,getClientOutDir:()=>r,getClientPublicOutDir:()=>d,getAssetsDir:()=>c,registerBundleGraphAdder:s=>m.add(s),_oldDevSsrServer:()=>e.devSsrServer},async config(s,b){await v.init();const h=v.getPath();let I;s.build?.ssr||b.mode==="ssr"?I="ssr":b.mode==="lib"?I="lib":b.mode==="test"?I="test":I="client",n=b.command;let w;b.mode==="production"?w="production":b.mode==="development"?w="development":n==="build"&&I==="client"?w="production":w="development",v.debug(`vite config(), command: ${n}, env.mode: ${b.mode}`),n==="serve"?e.entryStrategy={type:"segment"}:I==="ssr"?e.entryStrategy={type:"hoist"}:I==="lib"&&(e.entryStrategy={type:"inline"});const T=I==="ssr"?typeof s.build?.ssr=="string"?s.build.ssr:e.ssr?.input:void 0,E=I==="client"?e.client?.input:void 0;let P=s.build?.rollupOptions?.input||E||T;P&&typeof P=="string"&&(P=[P]),c=s.build?.assetsDir;const U=I==="client"&&!!c&&c!=="_astro",j={target:I,buildMode:w,csr:e.csr,debug:e.debug,entryStrategy:e.entryStrategy,srcDir:e.srcDir,rootDir:s.root,tsconfigFileNames:e.tsconfigFileNames,resolveQwikBuild:!0,transformedModuleOutput:e.transformedModuleOutput,outDir:s.build?.outDir,ssrOutDir:e.ssr?.outDir||s.build?.outDir,clientOutDir:e.client?.outDir||(s.build?.ssr?void 0:s.build?.outDir),assetsDir:U?c:void 0,devTools:e.devTools,sourcemap:!!s.build?.sourcemap,lint:e.lint,experimental:e.experimental,input:P,manifestInput:e.ssr?.manifestInput,manifestOutput:e.client?.manifestOutput},R=await v.normalizeOptions(j);P||(P=R.input),i=R.manifestInput,a=R.srcDir,f=R.rootDir,e.csr||(r=R.clientOutDir,d=s.base?h.join(r,s.base):r,t=R.ssrOutDir);const H=w==="development",Y="globalThis.qDev",le="globalThis.qTest",W="globalThis.qInspector",ee="globalThis.qSerialize",V=s?.define?.[Y]??H,O=s?.define?.[W]??H,Ve=s?.define?.[ee]??H,G={ssr:{noExternal:[Ue,He,Ke,ne]},envPrefix:["VITE_","PUBLIC_"],resolve:{dedupe:[...Lr],conditions:w==="production"&&I==="client"?["min"]:[],alias:{"@builder.io/qwik":"@qwik.dev/core","@builder.io/qwik/build":"@qwik.dev/core/build","@builder.io/qwik/server":"@qwik.dev/core/server","@builder.io/qwik/preloader":"@qwik.dev/core/preloader","@builder.io/qwik/jsx-runtime":"@qwik.dev/core/jsx-runtime","@builder.io/qwik/jsx-dev-runtime":"@qwik.dev/core/jsx-dev-runtime","@builder.io/qwik/optimizer":"@qwik.dev/core/optimizer","@builder.io/qwik/loader":"@qwik.dev/core/loader","@builder.io/qwik/backpatch":"@qwik.dev/core/backpatch","@builder.io/qwik/cli":"@qwik.dev/core/cli","@builder.io/qwik/testing":"@qwik.dev/core/testing"}},esbuild:n==="serve"?!1:{logLevel:"error",jsx:"automatic"},optimizeDeps:{exclude:[Ue,He,Ke,We,Ge,ne,re,"@builder.io/qwik","@builder.io/qwik-city"]},build:{modulePreload:!1,dynamicImportVarsOptions:{exclude:[/./]},rollupOptions:{maxParallelFileOps:1,input:P}},define:{[Y]:V,[W]:O,[ee]:Ve,[le]:JSON.stringify(process.env.NODE_ENV==="test")}};if(!e.csr){const K=I==="client"&&s.base?h.join(R.outDir,s.base):R.outDir;G.build.cssCodeSplit=!1,G.build.outDir=K;const qe=G.build.rollupOptions?.onwarn;G.build.rollupOptions={...G.build.rollupOptions,output:vn(v,s.build?.rollupOptions?.output,U,K),preserveEntrySignatures:"exports-only",onwarn:(fe,Be)=>{fe.plugin==="typescript"&&fe.message.includes("outputToFilesystem")||(qe?qe(fe,Be):Be(fe))}},R.target==="ssr"?n==="build"&&(G.publicDir=!1,G.build.ssr=!0,s.build?.minify==null&&w==="production"&&(G.build.minify=!0)):R.target==="client"||(R.target==="lib"?(G.build.minify=!1,G.build.rollupOptions.external=[Ue,He,Ke,We,Ge,ne,re]):G.define={[Y]:!0,[le]:!0,[W]:!1}),globalThis.qDev=V,globalThis.qTest=!0,globalThis.qInspector=O}return G},async configResolved(s){if(o=s.base,!(o.startsWith("/")&&o.endsWith("/")))throw new Error("vite's config.base must begin and end with /");!!s.build.sourcemap&&e.optimizerOptions?.sourcemap===void 0&&v.setSourceMapSupport(!0),v.normalizeOptions(e)},async buildStart(){u.length=0;const s=this.resolve.bind(this);await v.validateSource(s),v.onDiagnostics((b,h,I)=>{b.forEach(w=>{const T=v.normalizePath(h.sys.path.join(I,w.file));w.category==="error"?this.error($e(T,w)):this.warn($e(T,w))})}),await v.buildStart(this)},resolveId(s,b,h){return s.startsWith("\0")||!x(s,"resolveId")?null:v.resolveId(this,s,b,h)},load(s,b){return s.startsWith("\0")||!x(s,"load")?null:(s=v.normalizePath(s),n==="serve"&&s.endsWith(re)?{code:"export const manifest = undefined;"}:v.load(this,s,b))},transform(s,b,h){return b.startsWith("\0")||!x(b,"transform")||b.includes("?raw")?null:v.transform(this,s,b,h)}},{name:"vite-plugin-qwik-post",enforce:"post",generateBundle:{order:"post",async handler(s,b){const h=v.getOptions();if(h.target==="client"){for(const[I,w]of Object.entries(b))if(w.type==="asset"){const T=o+I;if(Or.some(E=>I.endsWith(E)))typeof w.source=="string"&&w.source.length<h.inlineStylesUpToBytes?u.push({tag:"style",location:"head",attributes:{"data-src":T,dangerouslySetInnerHTML:w.source}}):u.push({tag:"link",location:"head",attributes:{rel:"stylesheet",href:T}});else{const E=Ur.find(P=>I.endsWith(P));E&&!S&&u.unshift({tag:"link",location:"head",attributes:{rel:"preload",href:T,as:"font",type:`font/${E.slice(1)}`,crossorigin:""}})}}await v.generateManifest(this,b,m,{injections:u,platform:{vite:""}})}}},async writeBundle(s,b){const h=v.getOptions();if(h.target==="ssr"){const I=v.getSys();if(I.env==="node"||I.env==="bun"){const w=Object.keys(b),T=async E=>{try{const P=I.path.basename(E),U=I.path.extname(P);if((P.startsWith("entry.")||P.startsWith("entry_"))&&!P.includes("preview")&&(U===".mjs"||U===".cjs")){const R=I.path.basename(P,U),H=`${R}.js`,Y=R+U;if(!w.some(W=>I.path.basename(W)===H)){const W=I.path.dirname(E),ee=await I.dynamicImport("node:fs"),V=I.path.join(h.outDir,W);await ee.promises.mkdir(V,{recursive:!0}),await ee.promises.writeFile(I.path.join(V,H),`export * from "./${Y}";`)}}}catch(P){console.error("patchModuleFormat",P)}};await Promise.all(w.map(T))}}},transformIndexHtml(){if(n==="serve")return jr(v.getOptions(),a)},configureServer(s){v.configureServer(s),(e?.devTools?.imageDevTools??!0)&&s.middlewares.use(Ir(v.getSys(),f,a))},configurePreviewServer(s){return async()=>{const b=v.getSys(),h=v.getPath();await qr(s.middlewares,t,b,h)}},handleHotUpdate(s){v.handleHotUpdate(s),s.modules.length&&s.server.hot.send({type:"full-reload"})},onLog(s,b){if(b.plugin=="vite-plugin-qwik"){const h=Br[s]||oe.White,I=(b.frame||"").split(`
|
|
195
|
+
`).map(w=>(w.match(/^\s*\^\s*$/)?oe.BrightWhite:oe.BrightBlack)+w);return console[s](`${h}%s
|
|
196
|
+
${oe.BrightWhite}%s
|
|
197
|
+
%s${oe.RESET}`,`[${b.plugin}](${s}): ${b.message}
|
|
198
|
+
`,` ${b?.loc?.file}:${b?.loc?.line}:${b?.loc?.column}
|
|
199
|
+
`,` ${I.join(`
|
|
200
|
+
`)}
|
|
201
|
+
`),!1}}},Rr()]}async function Rr(){let e,n;try{e=await import("node:fs").then(a=>a.promises),n=await import("node:path")}catch{return}const i=new Set;let r;const o="@qwik-dev/core",d="@builder.io/qwik";async function c(a,f){for(;f;){const t=n.join(f,"node_modules",a,"package.json");try{await e.access(t);const S=await e.readFile(t,{encoding:"utf-8"}),u=JSON.parse(S);return!!(u.qwik||u.dependencies?.[o]||u.peerDependencies?.[o]||u.dependencies?.[d]||u.peerDependencies?.[d])}catch{}const x=n.dirname(f);if(x===f)break;f=x}return!1}return{name:"checkQwikExternals",enforce:"pre",configResolved:a=>{r=a.root},resolveId:{order:"pre",async handler(a,f,t){if(!t.ssr||/^([./]|node:|[^a-z])/.test(a)||i.has(a))return;const x=(a.startsWith("@")?a.split("/").slice(0,2).join("/"):a.split("/")[0]).split("?")[0];if(i.has(x))return;i.add(a),i.add(x);const S=await this.resolve(x,f,{...t,skipSelf:!0});if(S?.external&&await c(x,f?n.dirname(f):r))throw new Error(`
|
|
202
|
+
==============
|
|
203
|
+
${x} is being treated as an external dependency, but it should be included in the server bundle, because it uses Qwik.
|
|
204
|
+
Please add the package to "ssr.noExternal" in the Vite config.
|
|
205
|
+
==============`);if(x===a)return S}}}}const oe={Yellow:"\x1B[33m",Cyan:"\x1B[36m",White:"\x1B[37m",BrightBlack:"\x1B[90m",BrightWhite:"\x1B[97m",RESET:"\x1B[0m"},Br={warn:oe.Yellow,info:oe.Cyan,debug:oe.BrightBlack},Ar=void 0;return exports.createOptimizer=rt,exports.qwikRollup=bn,exports.qwikVite=$r,exports.symbolMapper=Ar,exports.versions=ue,J.exports})(typeof module=="object"&&module.exports?module:{exports:{}});
|