vite 6.3.5 → 7.0.0-beta.1

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.
Files changed (34) hide show
  1. package/LICENSE.md +29 -0
  2. package/bin/vite.js +4 -4
  3. package/dist/client/client.mjs +793 -921
  4. package/dist/client/env.mjs +14 -19
  5. package/dist/node/chunks/dep-3PhSlasG.js +5 -0
  6. package/dist/node/chunks/dep-B4i1tHPo.js +30 -0
  7. package/dist/node/chunks/dep-BO5GbxpL.js +7345 -0
  8. package/dist/node/chunks/dep-BaSfMtGz.js +5 -0
  9. package/dist/node/chunks/dep-Bb92EWrU.js +5 -0
  10. package/dist/node/chunks/dep-C9KS6hrN.js +5 -0
  11. package/dist/node/chunks/dep-Ctugieod.js +150 -0
  12. package/dist/node/chunks/dep-D5HXLrlI.js +378 -0
  13. package/dist/node/chunks/dep-Da5Rc_CS.js +36548 -0
  14. package/dist/node/chunks/dep-Dg4W3IAQ.js +5597 -0
  15. package/dist/node/chunks/dep-uSUFJk9A.js +446 -0
  16. package/dist/node/cli.js +617 -865
  17. package/dist/node/constants.js +3 -148
  18. package/dist/node/index.d.ts +2724 -3124
  19. package/dist/node/index.js +25 -188
  20. package/dist/node/module-runner.d.ts +243 -234
  21. package/dist/node/module-runner.js +1043 -1172
  22. package/dist/node/moduleRunnerTransport-BWUZBVLX.d.ts +88 -0
  23. package/package.json +38 -41
  24. package/types/importGlob.d.ts +4 -0
  25. package/types/internal/cssPreprocessorOptions.d.ts +3 -22
  26. package/dist/node/chunks/dep-3RmXg9uo.js +0 -553
  27. package/dist/node/chunks/dep-AiMcmC_f.js +0 -822
  28. package/dist/node/chunks/dep-CvfTChi5.js +0 -8218
  29. package/dist/node/chunks/dep-DBxKXgDP.js +0 -49496
  30. package/dist/node/chunks/dep-SgSik2vo.js +0 -7113
  31. package/dist/node/moduleRunnerTransport.d-DJ_mE5sf.d.ts +0 -87
  32. package/dist/node-cjs/publicUtils.cjs +0 -3986
  33. package/index.cjs +0 -96
  34. package/index.d.cts +0 -6
@@ -0,0 +1,446 @@
1
+ import { createRequire as ___createRequire } from 'module'; const require = ___createRequire(import.meta.url);
2
+ import { __commonJS } from "./dep-B4i1tHPo.js";
3
+ import { require_lib } from "./dep-D5HXLrlI.js";
4
+
5
+ //#region ../../node_modules/.pnpm/postcss-import@16.1.0_postcss@8.5.4/node_modules/postcss-import/lib/format-import-prelude.js
6
+ var require_format_import_prelude = __commonJS({ "../../node_modules/.pnpm/postcss-import@16.1.0_postcss@8.5.4/node_modules/postcss-import/lib/format-import-prelude.js"(exports, module) {
7
+ module.exports = function formatImportPrelude$2(layer, media, supports) {
8
+ const parts = [];
9
+ if (typeof layer !== "undefined") {
10
+ let layerParams = "layer";
11
+ if (layer) layerParams = `layer(${layer})`;
12
+ parts.push(layerParams);
13
+ }
14
+ if (typeof supports !== "undefined") parts.push(`supports(${supports})`);
15
+ if (typeof media !== "undefined") parts.push(media);
16
+ return parts.join(" ");
17
+ };
18
+ } });
19
+
20
+ //#endregion
21
+ //#region ../../node_modules/.pnpm/postcss-import@16.1.0_postcss@8.5.4/node_modules/postcss-import/lib/base64-encoded-import.js
22
+ var require_base64_encoded_import = __commonJS({ "../../node_modules/.pnpm/postcss-import@16.1.0_postcss@8.5.4/node_modules/postcss-import/lib/base64-encoded-import.js"(exports, module) {
23
+ const formatImportPrelude$1 = require_format_import_prelude();
24
+ module.exports = function base64EncodedConditionalImport$1(prelude, conditions) {
25
+ conditions.reverse();
26
+ const first = conditions.pop();
27
+ let params = `${prelude} ${formatImportPrelude$1(first.layer, first.media, first.supports)}`;
28
+ for (const condition of conditions) params = `'data:text/css;base64,${Buffer.from(`@import ${params}`).toString("base64")}' ${formatImportPrelude$1(condition.layer, condition.media, condition.supports)}`;
29
+ return params;
30
+ };
31
+ } });
32
+
33
+ //#endregion
34
+ //#region ../../node_modules/.pnpm/postcss-import@16.1.0_postcss@8.5.4/node_modules/postcss-import/lib/apply-conditions.js
35
+ var require_apply_conditions = __commonJS({ "../../node_modules/.pnpm/postcss-import@16.1.0_postcss@8.5.4/node_modules/postcss-import/lib/apply-conditions.js"(exports, module) {
36
+ const base64EncodedConditionalImport = require_base64_encoded_import();
37
+ module.exports = function applyConditions$1(bundle, atRule) {
38
+ bundle.forEach((stmt) => {
39
+ if (stmt.type === "charset" || stmt.type === "warning" || !stmt.conditions?.length) return;
40
+ if (stmt.type === "import") {
41
+ stmt.node.params = base64EncodedConditionalImport(stmt.fullUri, stmt.conditions);
42
+ return;
43
+ }
44
+ const { nodes } = stmt;
45
+ const { parent } = nodes[0];
46
+ const atRules = [];
47
+ for (const condition of stmt.conditions) {
48
+ if (typeof condition.media !== "undefined") {
49
+ const mediaNode = atRule({
50
+ name: "media",
51
+ params: condition.media,
52
+ source: parent.source
53
+ });
54
+ atRules.push(mediaNode);
55
+ }
56
+ if (typeof condition.supports !== "undefined") {
57
+ const supportsNode = atRule({
58
+ name: "supports",
59
+ params: `(${condition.supports})`,
60
+ source: parent.source
61
+ });
62
+ atRules.push(supportsNode);
63
+ }
64
+ if (typeof condition.layer !== "undefined") {
65
+ const layerNode = atRule({
66
+ name: "layer",
67
+ params: condition.layer,
68
+ source: parent.source
69
+ });
70
+ atRules.push(layerNode);
71
+ }
72
+ }
73
+ const outerAtRule = atRules.shift();
74
+ const innerAtRule = atRules.reduce((previous, next) => {
75
+ previous.append(next);
76
+ return next;
77
+ }, outerAtRule);
78
+ parent.insertBefore(nodes[0], outerAtRule);
79
+ nodes.forEach((node) => {
80
+ node.parent = void 0;
81
+ });
82
+ nodes[0].raws.before = nodes[0].raws.before || "\n";
83
+ innerAtRule.append(nodes);
84
+ stmt.type = "nodes";
85
+ stmt.nodes = [outerAtRule];
86
+ delete stmt.node;
87
+ });
88
+ };
89
+ } });
90
+
91
+ //#endregion
92
+ //#region ../../node_modules/.pnpm/postcss-import@16.1.0_postcss@8.5.4/node_modules/postcss-import/lib/apply-raws.js
93
+ var require_apply_raws = __commonJS({ "../../node_modules/.pnpm/postcss-import@16.1.0_postcss@8.5.4/node_modules/postcss-import/lib/apply-raws.js"(exports, module) {
94
+ module.exports = function applyRaws$1(bundle) {
95
+ bundle.forEach((stmt, index) => {
96
+ if (index === 0) return;
97
+ if (stmt.parent) {
98
+ const { before } = stmt.parent.node.raws;
99
+ if (stmt.type === "nodes") stmt.nodes[0].raws.before = before;
100
+ else stmt.node.raws.before = before;
101
+ } else if (stmt.type === "nodes") stmt.nodes[0].raws.before = stmt.nodes[0].raws.before || "\n";
102
+ });
103
+ };
104
+ } });
105
+
106
+ //#endregion
107
+ //#region ../../node_modules/.pnpm/postcss-import@16.1.0_postcss@8.5.4/node_modules/postcss-import/lib/apply-styles.js
108
+ var require_apply_styles = __commonJS({ "../../node_modules/.pnpm/postcss-import@16.1.0_postcss@8.5.4/node_modules/postcss-import/lib/apply-styles.js"(exports, module) {
109
+ module.exports = function applyStyles$1(bundle, styles) {
110
+ styles.nodes = [];
111
+ bundle.forEach((stmt) => {
112
+ if (["charset", "import"].includes(stmt.type)) {
113
+ stmt.node.parent = void 0;
114
+ styles.append(stmt.node);
115
+ } else if (stmt.type === "nodes") stmt.nodes.forEach((node) => {
116
+ node.parent = void 0;
117
+ styles.append(node);
118
+ });
119
+ });
120
+ };
121
+ } });
122
+
123
+ //#endregion
124
+ //#region ../../node_modules/.pnpm/postcss-import@16.1.0_postcss@8.5.4/node_modules/postcss-import/lib/data-url.js
125
+ var require_data_url = __commonJS({ "../../node_modules/.pnpm/postcss-import@16.1.0_postcss@8.5.4/node_modules/postcss-import/lib/data-url.js"(exports, module) {
126
+ const anyDataURLRegexp = /^data:text\/css(?:;(base64|plain))?,/i;
127
+ const base64DataURLRegexp = /^data:text\/css;base64,/i;
128
+ const plainDataURLRegexp = /^data:text\/css;plain,/i;
129
+ function isValid(url) {
130
+ return anyDataURLRegexp.test(url);
131
+ }
132
+ function contents(url) {
133
+ if (base64DataURLRegexp.test(url)) return Buffer.from(url.slice(21), "base64").toString();
134
+ if (plainDataURLRegexp.test(url)) return decodeURIComponent(url.slice(20));
135
+ return decodeURIComponent(url.slice(14));
136
+ }
137
+ module.exports = {
138
+ isValid,
139
+ contents
140
+ };
141
+ } });
142
+
143
+ //#endregion
144
+ //#region ../../node_modules/.pnpm/postcss-import@16.1.0_postcss@8.5.4/node_modules/postcss-import/lib/parse-statements.js
145
+ var require_parse_statements = __commonJS({ "../../node_modules/.pnpm/postcss-import@16.1.0_postcss@8.5.4/node_modules/postcss-import/lib/parse-statements.js"(exports, module) {
146
+ const valueParser = require_lib();
147
+ const { stringify } = valueParser;
148
+ module.exports = function parseStatements$1(result, styles, conditions, from) {
149
+ const statements = [];
150
+ let nodes = [];
151
+ styles.each((node) => {
152
+ let stmt;
153
+ if (node.type === "atrule") {
154
+ if (node.name === "import") stmt = parseImport(result, node, conditions, from);
155
+ else if (node.name === "charset") stmt = parseCharset(result, node, conditions, from);
156
+ }
157
+ if (stmt) {
158
+ if (nodes.length) {
159
+ statements.push({
160
+ type: "nodes",
161
+ nodes,
162
+ conditions: [...conditions],
163
+ from
164
+ });
165
+ nodes = [];
166
+ }
167
+ statements.push(stmt);
168
+ } else nodes.push(node);
169
+ });
170
+ if (nodes.length) statements.push({
171
+ type: "nodes",
172
+ nodes,
173
+ conditions: [...conditions],
174
+ from
175
+ });
176
+ return statements;
177
+ };
178
+ function parseCharset(result, atRule, conditions, from) {
179
+ if (atRule.prev()) return result.warn("@charset must precede all other statements", { node: atRule });
180
+ return {
181
+ type: "charset",
182
+ node: atRule,
183
+ conditions: [...conditions],
184
+ from
185
+ };
186
+ }
187
+ function parseImport(result, atRule, conditions, from) {
188
+ let prev = atRule.prev();
189
+ if (prev) do {
190
+ if (prev.type === "comment" || prev.type === "atrule" && prev.name === "import") {
191
+ prev = prev.prev();
192
+ continue;
193
+ }
194
+ break;
195
+ } while (prev);
196
+ if (prev) do {
197
+ if (prev.type === "comment" || prev.type === "atrule" && (prev.name === "charset" || prev.name === "layer" && !prev.nodes)) {
198
+ prev = prev.prev();
199
+ continue;
200
+ }
201
+ return result.warn("@import must precede all other statements (besides @charset or empty @layer)", { node: atRule });
202
+ } while (prev);
203
+ if (atRule.nodes) return result.warn("It looks like you didn't end your @import statement correctly. Child nodes are attached to it.", { node: atRule });
204
+ const params = valueParser(atRule.params).nodes;
205
+ const stmt = {
206
+ type: "import",
207
+ uri: "",
208
+ fullUri: "",
209
+ node: atRule,
210
+ conditions: [...conditions],
211
+ from
212
+ };
213
+ let layer;
214
+ let media;
215
+ let supports;
216
+ for (let i = 0; i < params.length; i++) {
217
+ const node = params[i];
218
+ if (node.type === "space" || node.type === "comment") continue;
219
+ if (node.type === "string") {
220
+ if (stmt.uri) return result.warn(`Multiple url's in '${atRule.toString()}'`, { node: atRule });
221
+ if (!node.value) return result.warn(`Unable to find uri in '${atRule.toString()}'`, { node: atRule });
222
+ stmt.uri = node.value;
223
+ stmt.fullUri = stringify(node);
224
+ continue;
225
+ }
226
+ if (node.type === "function" && /^url$/i.test(node.value)) {
227
+ if (stmt.uri) return result.warn(`Multiple url's in '${atRule.toString()}'`, { node: atRule });
228
+ if (!node.nodes?.[0]?.value) return result.warn(`Unable to find uri in '${atRule.toString()}'`, { node: atRule });
229
+ stmt.uri = node.nodes[0].value;
230
+ stmt.fullUri = stringify(node);
231
+ continue;
232
+ }
233
+ if (!stmt.uri) return result.warn(`Unable to find uri in '${atRule.toString()}'`, { node: atRule });
234
+ if ((node.type === "word" || node.type === "function") && /^layer$/i.test(node.value)) {
235
+ if (typeof layer !== "undefined") return result.warn(`Multiple layers in '${atRule.toString()}'`, { node: atRule });
236
+ if (typeof supports !== "undefined") return result.warn(`layers must be defined before support conditions in '${atRule.toString()}'`, { node: atRule });
237
+ if (node.nodes) layer = stringify(node.nodes);
238
+ else layer = "";
239
+ continue;
240
+ }
241
+ if (node.type === "function" && /^supports$/i.test(node.value)) {
242
+ if (typeof supports !== "undefined") return result.warn(`Multiple support conditions in '${atRule.toString()}'`, { node: atRule });
243
+ supports = stringify(node.nodes);
244
+ continue;
245
+ }
246
+ media = stringify(params.slice(i));
247
+ break;
248
+ }
249
+ if (!stmt.uri) return result.warn(`Unable to find uri in '${atRule.toString()}'`, { node: atRule });
250
+ if (typeof media !== "undefined" || typeof layer !== "undefined" || typeof supports !== "undefined") stmt.conditions.push({
251
+ layer,
252
+ media,
253
+ supports
254
+ });
255
+ return stmt;
256
+ }
257
+ } });
258
+
259
+ //#endregion
260
+ //#region ../../node_modules/.pnpm/postcss-import@16.1.0_postcss@8.5.4/node_modules/postcss-import/lib/process-content.js
261
+ var require_process_content = __commonJS({ "../../node_modules/.pnpm/postcss-import@16.1.0_postcss@8.5.4/node_modules/postcss-import/lib/process-content.js"(exports, module) {
262
+ const path$2 = require("path");
263
+ let sugarss;
264
+ module.exports = function processContent$1(result, content, filename, options, postcss) {
265
+ const { plugins } = options;
266
+ const ext = path$2.extname(filename);
267
+ const parserList = [];
268
+ if (ext === ".sss") {
269
+ if (!sugarss)
270
+ /* c8 ignore next 3 */
271
+ try {
272
+ sugarss = require("sugarss");
273
+ } catch {}
274
+ if (sugarss) return runPostcss(postcss, content, filename, plugins, [sugarss]);
275
+ }
276
+ if (result.opts.syntax?.parse) parserList.push(result.opts.syntax.parse);
277
+ if (result.opts.parser) parserList.push(result.opts.parser);
278
+ parserList.push(null);
279
+ return runPostcss(postcss, content, filename, plugins, parserList);
280
+ };
281
+ function runPostcss(postcss, content, filename, plugins, parsers, index) {
282
+ if (!index) index = 0;
283
+ return postcss(plugins).process(content, {
284
+ from: filename,
285
+ parser: parsers[index]
286
+ }).catch((err) => {
287
+ index++;
288
+ if (index === parsers.length) throw err;
289
+ return runPostcss(postcss, content, filename, plugins, parsers, index);
290
+ });
291
+ }
292
+ } });
293
+
294
+ //#endregion
295
+ //#region ../../node_modules/.pnpm/postcss-import@16.1.0_postcss@8.5.4/node_modules/postcss-import/lib/parse-styles.js
296
+ var require_parse_styles = __commonJS({ "../../node_modules/.pnpm/postcss-import@16.1.0_postcss@8.5.4/node_modules/postcss-import/lib/parse-styles.js"(exports, module) {
297
+ const path$1 = require("path");
298
+ const dataURL = require_data_url();
299
+ const parseStatements = require_parse_statements();
300
+ const processContent = require_process_content();
301
+ const resolveId$1 = (id) => id;
302
+ const formatImportPrelude = require_format_import_prelude();
303
+ async function parseStyles$1(result, styles, options, state, conditions, from, postcss) {
304
+ const statements = parseStatements(result, styles, conditions, from);
305
+ for (const stmt of statements) {
306
+ if (stmt.type !== "import" || !isProcessableURL(stmt.uri)) continue;
307
+ if (options.filter && !options.filter(stmt.uri)) continue;
308
+ await resolveImportId(result, stmt, options, state, postcss);
309
+ }
310
+ let charset;
311
+ const imports = [];
312
+ const bundle = [];
313
+ function handleCharset(stmt) {
314
+ if (!charset) charset = stmt;
315
+ else if (stmt.node.params.toLowerCase() !== charset.node.params.toLowerCase()) throw stmt.node.error(`Incompatible @charset statements:
316
+ ${stmt.node.params} specified in ${stmt.node.source.input.file}
317
+ ${charset.node.params} specified in ${charset.node.source.input.file}`);
318
+ }
319
+ statements.forEach((stmt) => {
320
+ if (stmt.type === "charset") handleCharset(stmt);
321
+ else if (stmt.type === "import") if (stmt.children) stmt.children.forEach((child, index) => {
322
+ if (child.type === "import") imports.push(child);
323
+ else if (child.type === "charset") handleCharset(child);
324
+ else bundle.push(child);
325
+ if (index === 0) child.parent = stmt;
326
+ });
327
+ else imports.push(stmt);
328
+ else if (stmt.type === "nodes") bundle.push(stmt);
329
+ });
330
+ return charset ? [charset, ...imports.concat(bundle)] : imports.concat(bundle);
331
+ }
332
+ async function resolveImportId(result, stmt, options, state, postcss) {
333
+ if (dataURL.isValid(stmt.uri)) {
334
+ stmt.children = await loadImportContent(result, stmt, stmt.uri, options, state, postcss);
335
+ return;
336
+ } else if (dataURL.isValid(stmt.from.slice(-1))) throw stmt.node.error(`Unable to import '${stmt.uri}' from a stylesheet that is embedded in a data url`);
337
+ const atRule = stmt.node;
338
+ let sourceFile;
339
+ if (atRule.source?.input?.file) sourceFile = atRule.source.input.file;
340
+ const base = sourceFile ? path$1.dirname(atRule.source.input.file) : options.root;
341
+ const paths = [await options.resolve(stmt.uri, base, options, atRule)].flat();
342
+ const resolved = await Promise.all(paths.map((file) => {
343
+ return !path$1.isAbsolute(file) ? resolveId$1(file, base, options, atRule) : file;
344
+ }));
345
+ resolved.forEach((file) => {
346
+ result.messages.push({
347
+ type: "dependency",
348
+ plugin: "postcss-import",
349
+ file,
350
+ parent: sourceFile
351
+ });
352
+ });
353
+ const importedContent = await Promise.all(resolved.map((file) => {
354
+ return loadImportContent(result, stmt, file, options, state, postcss);
355
+ }));
356
+ stmt.children = importedContent.flat().filter((x) => !!x);
357
+ }
358
+ async function loadImportContent(result, stmt, filename, options, state, postcss) {
359
+ const atRule = stmt.node;
360
+ const { conditions, from } = stmt;
361
+ const stmtDuplicateCheckKey = conditions.map((condition) => formatImportPrelude(condition.layer, condition.media, condition.supports)).join(":");
362
+ if (options.skipDuplicates) {
363
+ if (state.importedFiles[filename]?.[stmtDuplicateCheckKey]) return;
364
+ if (!state.importedFiles[filename]) state.importedFiles[filename] = {};
365
+ state.importedFiles[filename][stmtDuplicateCheckKey] = true;
366
+ }
367
+ if (from.includes(filename)) return;
368
+ const content = await options.load(filename, options);
369
+ if (content.trim() === "" && options.warnOnEmpty) {
370
+ result.warn(`${filename} is empty`, { node: atRule });
371
+ return;
372
+ }
373
+ if (options.skipDuplicates && state.hashFiles[content]?.[stmtDuplicateCheckKey]) return;
374
+ const importedResult = await processContent(result, content, filename, options, postcss);
375
+ const styles = importedResult.root;
376
+ result.messages = result.messages.concat(importedResult.messages);
377
+ if (options.skipDuplicates) {
378
+ const hasImport = styles.some((child) => {
379
+ return child.type === "atrule" && child.name === "import";
380
+ });
381
+ if (!hasImport) {
382
+ if (!state.hashFiles[content]) state.hashFiles[content] = {};
383
+ state.hashFiles[content][stmtDuplicateCheckKey] = true;
384
+ }
385
+ }
386
+ return parseStyles$1(result, styles, options, state, conditions, [...from, filename], postcss);
387
+ }
388
+ function isProcessableURL(uri) {
389
+ if (/^(?:[a-z]+:)?\/\//i.test(uri)) return false;
390
+ try {
391
+ const url = new URL(uri, "https://example.com");
392
+ if (url.search) return false;
393
+ } catch {}
394
+ return true;
395
+ }
396
+ module.exports = parseStyles$1;
397
+ } });
398
+
399
+ //#endregion
400
+ //#region ../../node_modules/.pnpm/postcss-import@16.1.0_postcss@8.5.4/node_modules/postcss-import/index.js
401
+ var require_postcss_import = __commonJS({ "../../node_modules/.pnpm/postcss-import@16.1.0_postcss@8.5.4/node_modules/postcss-import/index.js"(exports, module) {
402
+ const path = require("path");
403
+ const applyConditions = require_apply_conditions();
404
+ const applyRaws = require_apply_raws();
405
+ const applyStyles = require_apply_styles();
406
+ const loadContent = () => "";
407
+ const parseStyles = require_parse_styles();
408
+ const resolveId = (id) => id;
409
+ function AtImport(options) {
410
+ options = {
411
+ root: process.cwd(),
412
+ path: [],
413
+ skipDuplicates: true,
414
+ resolve: resolveId,
415
+ load: loadContent,
416
+ plugins: [],
417
+ addModulesDirectories: [],
418
+ warnOnEmpty: true,
419
+ ...options
420
+ };
421
+ options.root = path.resolve(options.root);
422
+ if (typeof options.path === "string") options.path = [options.path];
423
+ if (!Array.isArray(options.path)) options.path = [];
424
+ options.path = options.path.map((p) => path.resolve(options.root, p));
425
+ return {
426
+ postcssPlugin: "postcss-import",
427
+ async Once(styles, { result, atRule, postcss }) {
428
+ const state = {
429
+ importedFiles: {},
430
+ hashFiles: {}
431
+ };
432
+ if (styles.source?.input?.file) state.importedFiles[styles.source.input.file] = {};
433
+ if (options.plugins && !Array.isArray(options.plugins)) throw new Error("plugins option must be an array");
434
+ const bundle = await parseStyles(result, styles, options, state, [], [], postcss);
435
+ applyRaws(bundle);
436
+ applyConditions(bundle, atRule);
437
+ applyStyles(bundle, styles);
438
+ }
439
+ };
440
+ }
441
+ AtImport.postcss = true;
442
+ module.exports = AtImport;
443
+ } });
444
+
445
+ //#endregion
446
+ export default require_postcss_import();