vite 5.0.0-beta.17 → 5.0.0-beta.19
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/dist/client/client.mjs +16 -2
- package/dist/client/client.mjs.map +1 -1
- package/dist/node/chunks/{dep-zjm7Opl5.js → dep-ZzZNTu4r.js} +1 -1
- package/dist/node/chunks/{dep-pKKs8JVV.js → dep-dkmuXKZ9.js} +1 -1
- package/dist/node/chunks/{dep-3p9Yqpeo.js → dep-uqAlfqPp.js} +566 -456
- package/dist/node/cli.js +7 -7
- package/dist/node/constants.js +1 -2
- package/dist/node/index.d.ts +62 -46
- package/dist/node/index.js +2 -2
- package/index.cjs +0 -1
- package/package.json +7 -7
|
@@ -20,11 +20,11 @@ import require$$1$1 from 'http';
|
|
|
20
20
|
import require$$0$7 from 'stream';
|
|
21
21
|
import require$$2 from 'os';
|
|
22
22
|
import require$$2$1 from 'child_process';
|
|
23
|
-
import { CLIENT_ENTRY, VALID_ID_PREFIX, NULL_BYTE_PLACEHOLDER, OPTIMIZABLE_ENTRY_RE, FS_PREFIX, wildcardHosts, loopbackHosts, CLIENT_PUBLIC_PATH, ENV_PUBLIC_PATH, ENV_ENTRY, DEP_VERSION_RE, SPECIAL_QUERY_RE, DEFAULT_MAIN_FIELDS, DEFAULT_EXTENSIONS, CSS_LANGS_RE, ESBUILD_MODULES_TARGET, KNOWN_ASSET_TYPES, VITE_PACKAGE_DIR, ASYNC_DISPOSE, DEFAULT_DEV_PORT, CLIENT_DIR, JS_TYPES_RE, VERSION as VERSION$1, DEFAULT_PREVIEW_PORT, DEFAULT_ASSETS_RE, DEFAULT_CONFIG_FILES } from '../constants.js';
|
|
24
23
|
import os$4 from 'node:os';
|
|
25
24
|
import { exec } from 'node:child_process';
|
|
26
25
|
import { createHash as createHash$2 } from 'node:crypto';
|
|
27
26
|
import { promises } from 'node:dns';
|
|
27
|
+
import { CLIENT_ENTRY, VALID_ID_PREFIX, NULL_BYTE_PLACEHOLDER, OPTIMIZABLE_ENTRY_RE, FS_PREFIX, wildcardHosts, loopbackHosts, CLIENT_PUBLIC_PATH, ENV_PUBLIC_PATH, ENV_ENTRY, DEP_VERSION_RE, SPECIAL_QUERY_RE, DEFAULT_MAIN_FIELDS, DEFAULT_EXTENSIONS, CSS_LANGS_RE, ESBUILD_MODULES_TARGET, KNOWN_ASSET_TYPES, VITE_PACKAGE_DIR, DEFAULT_DEV_PORT, CLIENT_DIR, JS_TYPES_RE, VERSION as VERSION$1, DEFAULT_PREVIEW_PORT, DEFAULT_ASSETS_RE, DEFAULT_CONFIG_FILES } from '../constants.js';
|
|
28
28
|
import require$$0$a from 'crypto';
|
|
29
29
|
import { Buffer as Buffer$1 } from 'node:buffer';
|
|
30
30
|
import require$$0$8, { createRequire as createRequire$2 } from 'module';
|
|
@@ -12712,9 +12712,6 @@ const requireResolveFromRootWithFallback = (root, id) => {
|
|
|
12712
12712
|
function emptyCssComments(raw) {
|
|
12713
12713
|
return raw.replace(multilineCommentsRE$1, (s) => ' '.repeat(s.length));
|
|
12714
12714
|
}
|
|
12715
|
-
function removeComments(raw) {
|
|
12716
|
-
return raw.replace(multilineCommentsRE$1, '').replace(singlelineCommentsRE$1, '');
|
|
12717
|
-
}
|
|
12718
12715
|
function backwardCompatibleWorkerPlugins(plugins) {
|
|
12719
12716
|
if (Array.isArray(plugins)) {
|
|
12720
12717
|
return plugins;
|
|
@@ -13091,6 +13088,7 @@ function buildReporterPlugin(config) {
|
|
|
13091
13088
|
let chunkCount = 0;
|
|
13092
13089
|
let compressedCount = 0;
|
|
13093
13090
|
let startTime = Date.now();
|
|
13091
|
+
let buildFailed = false;
|
|
13094
13092
|
async function getCompressedSize(code) {
|
|
13095
13093
|
if (config.build.ssr || !config.build.reportCompressedSize) {
|
|
13096
13094
|
return null;
|
|
@@ -13139,10 +13137,11 @@ function buildReporterPlugin(config) {
|
|
|
13139
13137
|
buildStart() {
|
|
13140
13138
|
transformedCount = 0;
|
|
13141
13139
|
},
|
|
13142
|
-
buildEnd() {
|
|
13140
|
+
buildEnd(error) {
|
|
13141
|
+
buildFailed = !!error;
|
|
13143
13142
|
if (shouldLogInfo) {
|
|
13144
13143
|
if (tty) {
|
|
13145
|
-
clearLine();
|
|
13144
|
+
clearLine$1();
|
|
13146
13145
|
}
|
|
13147
13146
|
config.logger.info(`${colors$1.green(`✓`)} ${transformedCount} modules transformed.`);
|
|
13148
13147
|
}
|
|
@@ -13187,7 +13186,7 @@ function buildReporterPlugin(config) {
|
|
|
13187
13186
|
},
|
|
13188
13187
|
generateBundle() {
|
|
13189
13188
|
if (shouldLogInfo && tty)
|
|
13190
|
-
clearLine();
|
|
13189
|
+
clearLine$1();
|
|
13191
13190
|
},
|
|
13192
13191
|
async writeBundle({ dir: outDir }, output) {
|
|
13193
13192
|
let hasLargeChunks = false;
|
|
@@ -13219,7 +13218,7 @@ function buildReporterPlugin(config) {
|
|
|
13219
13218
|
}
|
|
13220
13219
|
}))).filter(isDefined);
|
|
13221
13220
|
if (tty)
|
|
13222
|
-
clearLine();
|
|
13221
|
+
clearLine$1();
|
|
13223
13222
|
let longest = 0;
|
|
13224
13223
|
let biggestSize = 0;
|
|
13225
13224
|
let biggestMap = 0;
|
|
@@ -13287,14 +13286,14 @@ function buildReporterPlugin(config) {
|
|
|
13287
13286
|
}
|
|
13288
13287
|
},
|
|
13289
13288
|
closeBundle() {
|
|
13290
|
-
if (shouldLogInfo && !config.build.watch) {
|
|
13289
|
+
if (shouldLogInfo && !config.build.watch && !buildFailed) {
|
|
13291
13290
|
config.logger.info(`${colors$1.green(`✓ built in ${displayTime(Date.now() - startTime)}`)}`);
|
|
13292
13291
|
}
|
|
13293
13292
|
},
|
|
13294
13293
|
};
|
|
13295
13294
|
}
|
|
13296
13295
|
function writeLine(output) {
|
|
13297
|
-
clearLine();
|
|
13296
|
+
clearLine$1();
|
|
13298
13297
|
if (output.length < process.stdout.columns) {
|
|
13299
13298
|
process.stdout.write(output);
|
|
13300
13299
|
}
|
|
@@ -13302,7 +13301,7 @@ function writeLine(output) {
|
|
|
13302
13301
|
process.stdout.write(output.substring(0, process.stdout.columns - 1));
|
|
13303
13302
|
}
|
|
13304
13303
|
}
|
|
13305
|
-
function clearLine() {
|
|
13304
|
+
function clearLine$1() {
|
|
13306
13305
|
process.stdout.clearLine(0);
|
|
13307
13306
|
process.stdout.cursorTo(0);
|
|
13308
13307
|
}
|
|
@@ -14621,6 +14620,7 @@ function resolveEsbuildTranspileOptions(config, format) {
|
|
|
14621
14620
|
const options = {
|
|
14622
14621
|
charset: 'utf8',
|
|
14623
14622
|
...esbuildOptions,
|
|
14623
|
+
loader: 'js',
|
|
14624
14624
|
target: target || undefined,
|
|
14625
14625
|
format: rollupToEsbuildFormatMap[format],
|
|
14626
14626
|
// the final build should always support dynamic import and import.meta.
|
|
@@ -15745,18 +15745,7 @@ function manifestPlugin(config) {
|
|
|
15745
15745
|
},
|
|
15746
15746
|
generateBundle({ format }, bundle) {
|
|
15747
15747
|
function getChunkName(chunk) {
|
|
15748
|
-
|
|
15749
|
-
let name = normalizePath$3(path$o.relative(config.root, chunk.facadeModuleId));
|
|
15750
|
-
if (format === 'system' && !chunk.name.includes('-legacy')) {
|
|
15751
|
-
const ext = path$o.extname(name);
|
|
15752
|
-
const endPos = ext.length !== 0 ? -ext.length : undefined;
|
|
15753
|
-
name = name.slice(0, endPos) + `-legacy` + ext;
|
|
15754
|
-
}
|
|
15755
|
-
return name.replace(/\0/g, '');
|
|
15756
|
-
}
|
|
15757
|
-
else {
|
|
15758
|
-
return `_` + path$o.basename(chunk.fileName);
|
|
15759
|
-
}
|
|
15748
|
+
return getChunkOriginalFileName(chunk, config.root, format);
|
|
15760
15749
|
}
|
|
15761
15750
|
function getInternalImports(imports) {
|
|
15762
15751
|
const filteredImports = [];
|
|
@@ -15827,6 +15816,10 @@ function manifestPlugin(config) {
|
|
|
15827
15816
|
const assetMeta = fileNameToAssetMeta.get(chunk.fileName);
|
|
15828
15817
|
const src = assetMeta?.originalName ?? chunk.name;
|
|
15829
15818
|
const asset = createAsset(chunk, src, assetMeta?.isEntry);
|
|
15819
|
+
// If JS chunk and asset chunk are both generated from the same source file,
|
|
15820
|
+
// prioritize JS chunk as it contains more information
|
|
15821
|
+
if (manifest[src]?.file.endsWith('.js'))
|
|
15822
|
+
continue;
|
|
15830
15823
|
manifest[src] = asset;
|
|
15831
15824
|
fileNameToAsset.set(chunk.fileName, asset);
|
|
15832
15825
|
}
|
|
@@ -15856,6 +15849,20 @@ function manifestPlugin(config) {
|
|
|
15856
15849
|
},
|
|
15857
15850
|
};
|
|
15858
15851
|
}
|
|
15852
|
+
function getChunkOriginalFileName(chunk, root, format) {
|
|
15853
|
+
if (chunk.facadeModuleId) {
|
|
15854
|
+
let name = normalizePath$3(path$o.relative(root, chunk.facadeModuleId));
|
|
15855
|
+
if (format === 'system' && !chunk.name.includes('-legacy')) {
|
|
15856
|
+
const ext = path$o.extname(name);
|
|
15857
|
+
const endPos = ext.length !== 0 ? -ext.length : undefined;
|
|
15858
|
+
name = name.slice(0, endPos) + `-legacy` + ext;
|
|
15859
|
+
}
|
|
15860
|
+
return name.replace(/\0/g, '');
|
|
15861
|
+
}
|
|
15862
|
+
else {
|
|
15863
|
+
return `_` + path$o.basename(chunk.fileName);
|
|
15864
|
+
}
|
|
15865
|
+
}
|
|
15859
15866
|
|
|
15860
15867
|
// This is based on @rollup/plugin-data-uri
|
|
15861
15868
|
// MIT Licensed https://github.com/rollup/plugins/blob/master/LICENSE
|
|
@@ -15905,8 +15912,8 @@ function dataURIPlugin() {
|
|
|
15905
15912
|
};
|
|
15906
15913
|
}
|
|
15907
15914
|
|
|
15908
|
-
/* es-module-lexer 1.
|
|
15909
|
-
const A=1===new Uint8Array(new Uint16Array([1]).buffer)[0];function parse$e(E,g="@"){if(!C)return init.then((()=>parse$e(E)));const I=E.length+1,o=(C.__heap_base.value||C.__heap_base)+4*I-C.memory.buffer.byteLength;o>0&&C.memory.grow(Math.ceil(o/65536));const K=C.sa(I-1);if((A?B:Q)(E,new Uint16Array(C.memory.buffer,K,I)),!C.parse())throw Object.assign(new Error(`Parse error ${g}:${E.slice(0,C.e()).split("\n").length}:${C.e()-E.lastIndexOf("\n",C.e()-1)}`),{idx:C.e()});const D=[],k=[];for(;C.ri();){const A=C.is(),Q=C.ie(),B=C.ai(),g=C.id(),I=C.ss(),o=C.se();let K;C.ip()&&(K=J(E.slice(-1===g?A-1:A,-1===g?Q+1:Q))),D.push({n:K,s:A,e:Q,ss:I,se:o,d:g,a:B});}for(;C.re();){const A=C.es(),Q=C.ee(),B=C.els(),g=C.ele(),I=E.slice(A,Q),o=I[0],K=B<0?void 0:E.slice(B,g),D=K?K[0]:"";k.push({s:A,e:Q,ls:B,le:g,n:'"'===o||"'"===o?J(I):I,ln:'"'===D||"'"===D?J(K):K});}function J(A){try{return (0, eval)(A)}catch(A){}}return [D,k,!!C.f()]}function Q(A,Q){const B=A.length;let C=0;for(;C<B;){const B=A.charCodeAt(C);Q[C++]=(255&B)<<8|B>>>8;}}function B(A,Q){const B=A.length;let C=0;for(;C<B;)Q[C]=A.charCodeAt(C++);}let C;const init=WebAssembly.compile((E="AGFzbQEAAAABKghgAX8Bf2AEf39/fwBgAAF/YAAAYAF/AGADf39/AX9gAn9/AX9gAn9/AAMvLgABAQICAgICAgICAgICAgICAgIAAwMDBAQAAAADAAAAAAMDAAUGAAAABwAGAgUEBQFwAQEBBQMBAAEGDwJ/AUGw8gALfwBBsPIACwdwEwZtZW1vcnkCAAJzYQAAAWUAAwJpcwAEAmllAAUCc3MABgJzZQAHAmFpAAgCaWQACQJpcAAKAmVzAAsCZWUADANlbHMADQNlbGUADgJyaQAPAnJlABABZgARBXBhcnNlABILX19oZWFwX2Jhc2UDAQqpPS5oAQF/QQAgADYC9AlBACgC0AkiASAAQQF0aiIAQQA7AQBBACAAQQJqIgA2AvgJQQAgADYC/AlBAEEANgLUCUEAQQA2AuQJQQBBADYC3AlBAEEANgLYCUEAQQA2AuwJQQ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AELQQAgAkEEajYCoApBARAnIQJBACgCoAohBQJAAkAgAkEiRg0AIAJBJ0YNACACECoaQQAoAqAKIQQMAQsgAhAYQQBBACgCoApBAmoiBDYCoAoLQQEQJyEDQQAoAqAKIQILAkAgAiAFRg0AIAUgBEEAIAAgACABRiICG0EAIAEgAhsQAgsgAwtyAQR/QQAoAqAKIQBBACgCpAohAQJAAkADQCAAQQJqIQIgACABTw0BAkACQCACLwEAIgNBpH9qDgIBBAALIAIhACADQXZqDgQCAQECAQsgAEEEaiEADAALC0EAIAI2AqAKECJBAA8LQQAgAjYCoApB3QALSQEDf0EAIQMCQCACRQ0AAkADQCAALQAAIgQgAS0AACIFRw0BIAFBAWohASAAQQFqIQAgAkF/aiICDQAMAgsLIAQgBWshAwsgAwsL4gECAEGACAvEAQAAeABwAG8AcgB0AG0AcABvAHIAdABlAHQAYQByAG8AbQB1AG4AYwB0AGkAbwBuAHMAcwBlAHIAdAB2AG8AeQBpAGUAZABlAGwAZQBjAG8AbgB0AGkAbgBpAG4AcwB0AGEAbgB0AHkAYgByAGUAYQByAGUAdAB1AHIAZABlAGIAdQBnAGcAZQBhAHcAYQBpAHQAaAByAHcAaABpAGwAZQBmAG8AcgBpAGYAYwBhAHQAYwBmAGkAbgBhAGwAbABlAGwAcwAAQcQJCxABAAAAAgAAAAAEAAAwOQAA","undefined"!=typeof Buffer?Buffer.from(E,"base64"):Uint8Array.from(atob(E),(A=>A.charCodeAt(0))))).then(WebAssembly.instantiate).then((({exports:A})=>{C=A;}));var E;
|
|
15915
|
+
/* es-module-lexer 1.4.1 */
|
|
15916
|
+
const A=1===new Uint8Array(new Uint16Array([1]).buffer)[0];function parse$e(E,g="@"){if(!C)return init.then((()=>parse$e(E)));const I=E.length+1,k=(C.__heap_base.value||C.__heap_base)+4*I-C.memory.buffer.byteLength;k>0&&C.memory.grow(Math.ceil(k/65536));const K=C.sa(I-1);if((A?B:Q)(E,new Uint16Array(C.memory.buffer,K,I)),!C.parse())throw Object.assign(new Error(`Parse error ${g}:${E.slice(0,C.e()).split("\n").length}:${C.e()-E.lastIndexOf("\n",C.e()-1)}`),{idx:C.e()});const o=[],D=[];for(;C.ri();){const A=C.is(),Q=C.ie(),B=C.ai(),g=C.id(),I=C.ss(),k=C.se();let K;C.ip()&&(K=w(E.slice(-1===g?A-1:A,-1===g?Q+1:Q))),o.push({n:K,s:A,e:Q,ss:I,se:k,d:g,a:B});}for(;C.re();){const A=C.es(),Q=C.ee(),B=C.els(),g=C.ele(),I=E.slice(A,Q),k=I[0],K=B<0?void 0:E.slice(B,g),o=K?K[0]:"";D.push({s:A,e:Q,ls:B,le:g,n:'"'===k||"'"===k?w(I):I,ln:'"'===o||"'"===o?w(K):K});}function w(A){try{return (0, eval)(A)}catch(A){}}return [o,D,!!C.f(),!!C.ms()]}function Q(A,Q){const B=A.length;let C=0;for(;C<B;){const B=A.charCodeAt(C);Q[C++]=(255&B)<<8|B>>>8;}}function B(A,Q){const B=A.length;let C=0;for(;C<B;)Q[C]=A.charCodeAt(C++);}let C;const init=WebAssembly.compile((E="AGFzbQEAAAABKghgAX8Bf2AEf39/fwBgAAF/YAAAYAF/AGADf39/AX9gAn9/AX9gAn9/AAMwLwABAQICAgICAgICAgICAgICAgICAAMDAwQEAAAAAwAAAAADAwAFBgAAAAcABgIFBAUBcAEBAQUDAQABBg8CfwFBsPIAC38AQbDyAAsHdRQGbWVtb3J5AgACc2EAAAFlAAMCaXMABAJpZQAFAnNzAAYCc2UABwJhaQAIAmlkAAkCaXAACgJlcwALAmVlAAwDZWxzAA0DZWxlAA4CcmkADwJyZQAQAWYAEQJtcwASBXBhcnNlABMLX19oZWFwX2Jhc2UDAQryPS9oAQF/QQAgADYC9AlBACgC0AkiASAAQQF0aiIAQQA7AQBBACAAQQJqIgA2AvgJQQAgADYC/AlBAEEANgLUCUEAQQA2AuQJQQBBADYC3AlBAEEANgLYCUEAQQA2AuwJQQBBADYC4AkgAQu+AQEDf0EAKALkCSEEQQBBACgC/AkiBTYC5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iICLwEAIgNB4QBGDQAgASEEIAAhBQwBC0EAIAJBBGo2AqQKQQEQKCECQQAoAqQKIQUCQAJAIAJBIkYNACACQSdGDQAgAhArGkEAKAKkCiEEDAELIAIQGUEAQQAoAqQKQQJqIgQ2AqQKC0EBECghA0EAKAKkCiECCwJAIAIgBUYNACAFIARBACAAIAAgAUYiAhtBACABIAIbEAILIAMLcgEEf0EAKAKkCiEAQQAoAqgKIQECQAJAA0AgAEECaiECIAAgAU8NAQJAAkAgAi8BACIDQaR/ag4CAQQACyACIQAgA0F2ag4EAgEBAgELIABBBGohAAwACwtBACACNgKkChAjQQAPC0EAIAI2AqQKQd0AC0kBA39BACEDAkAgAkUNAAJAA0AgAC0AACIEIAEtAAAiBUcNASABQQFqIQEgAEEBaiEAIAJBf2oiAg0ADAILCyAEIAVrIQMLIAMLC+IBAgBBgAgLxAEAAHgAcABvAHIAdABtAHAAbwByAHQAZQB0AGEAcgBvAG0AdQBuAGMAdABpAG8AbgBzAHMAZQByAHQAdgBvAHkAaQBlAGQAZQBsAGUAYwBvAG4AdABpAG4AaQBuAHMAdABhAG4AdAB5AGIAcgBlAGEAcgBlAHQAdQByAGQAZQBiAHUAZwBnAGUAYQB3AGEAaQB0AGgAcgB3AGgAaQBsAGUAZgBvAHIAaQBmAGMAYQB0AGMAZgBpAG4AYQBsAGwAZQBsAHMAAEHECQsQAQAAAAIAAAAABAAAMDkAAA==","undefined"!=typeof Buffer?Buffer.from(E,"base64"):Uint8Array.from(atob(E),(A=>A.charCodeAt(0))))).then(WebAssembly.instantiate).then((({exports:A})=>{C=A;}));var E;
|
|
15910
15917
|
|
|
15911
15918
|
var convertSourceMap$1 = {};
|
|
15912
15919
|
|
|
@@ -16300,11 +16307,11 @@ const IS_WINDOWS_PLATFORM = os$3.platform() === 'win32';
|
|
|
16300
16307
|
const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2; // ./ or .\\
|
|
16301
16308
|
/**
|
|
16302
16309
|
* All non-escaped special characters.
|
|
16303
|
-
* Posix: ()*?[
|
|
16304
|
-
* Windows: (){}, !+@ before (, ! at the beginning.
|
|
16310
|
+
* Posix: ()*?[]{|}, !+@ before (, ! at the beginning, \\ before non-special characters.
|
|
16311
|
+
* Windows: (){}[], !+@ before (, ! at the beginning.
|
|
16305
16312
|
*/
|
|
16306
16313
|
const POSIX_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g;
|
|
16307
|
-
const WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([(){}]|^!|[!+@](?=\())/g;
|
|
16314
|
+
const WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()[\]{}]|^!|[!+@](?=\())/g;
|
|
16308
16315
|
/**
|
|
16309
16316
|
* The device path (\\.\ or \\?\).
|
|
16310
16317
|
* https://learn.microsoft.com/en-us/dotnet/standard/io/file-path-formats#dos-device-paths
|
|
@@ -16315,7 +16322,7 @@ const DOS_DEVICE_PATH_RE = /^\\\\([.?])/;
|
|
|
16315
16322
|
* Windows: !()+@{}
|
|
16316
16323
|
* https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions
|
|
16317
16324
|
*/
|
|
16318
|
-
const WINDOWS_BACKSLASHES_RE = /\\(?![!()+@{}])/g;
|
|
16325
|
+
const WINDOWS_BACKSLASHES_RE = /\\(?![!()+@[\]{}])/g;
|
|
16319
16326
|
/**
|
|
16320
16327
|
* Designed to work only with simple paths: `dir\\file`.
|
|
16321
16328
|
*/
|
|
@@ -18598,7 +18605,7 @@ function expandPatternsWithBraceExpansion(patterns) {
|
|
|
18598
18605
|
}
|
|
18599
18606
|
pattern$1.expandPatternsWithBraceExpansion = expandPatternsWithBraceExpansion;
|
|
18600
18607
|
function expandBraceExpansion(pattern) {
|
|
18601
|
-
const patterns = micromatch.braces(pattern, { expand: true, nodupes: true });
|
|
18608
|
+
const patterns = micromatch.braces(pattern, { expand: true, nodupes: true, keepEscaping: true });
|
|
18602
18609
|
/**
|
|
18603
18610
|
* Sort the patterns by length so that the same depth patterns are processed side by side.
|
|
18604
18611
|
* `a/{b,}/{c,}/*` – `['a///*', 'a/b//*', 'a//c/*', 'a/b/c/*']`
|
|
@@ -38016,11 +38023,8 @@ function cssPostPlugin(config) {
|
|
|
38016
38023
|
}
|
|
38017
38024
|
if (opts.format === 'es' || opts.format === 'cjs') {
|
|
38018
38025
|
const isEntry = chunk.isEntry && isPureCssChunk;
|
|
38019
|
-
const cssAssetName =
|
|
38020
|
-
|
|
38021
|
-
: chunk.name);
|
|
38022
|
-
const lang = path$o.extname(cssAssetName).slice(1);
|
|
38023
|
-
const cssFileName = ensureFileExt(cssAssetName, '.css');
|
|
38026
|
+
const cssAssetName = ensureFileExt(chunk.name, '.css');
|
|
38027
|
+
const originalFilename = getChunkOriginalFileName(chunk, config.root, opts.format);
|
|
38024
38028
|
chunkCSS = resolveAssetUrlsInCss(chunkCSS, cssAssetName);
|
|
38025
38029
|
const previousTask = emitTasks[emitTasks.length - 1];
|
|
38026
38030
|
// finalizeCss is async which makes `emitFile` non-deterministic, so
|
|
@@ -38037,14 +38041,13 @@ function cssPostPlugin(config) {
|
|
|
38037
38041
|
await thisTask;
|
|
38038
38042
|
// emit corresponding css file
|
|
38039
38043
|
const referenceId = this.emitFile({
|
|
38040
|
-
name:
|
|
38044
|
+
name: cssAssetName,
|
|
38041
38045
|
type: 'asset',
|
|
38042
38046
|
source: chunkCSS,
|
|
38043
38047
|
});
|
|
38044
|
-
const originalName = isPreProcessor(lang) ? cssAssetName : cssFileName;
|
|
38045
38048
|
generatedAssets
|
|
38046
38049
|
.get(config)
|
|
38047
|
-
.set(referenceId, { originalName, isEntry });
|
|
38050
|
+
.set(referenceId, { originalName: originalFilename, isEntry });
|
|
38048
38051
|
chunk.viteMetadata.importedCss.add(this.getFileName(referenceId));
|
|
38049
38052
|
if (emitTasksLength === emitTasks.length) {
|
|
38050
38053
|
// this is the last task, clear `emitTasks` to free up memory
|
|
@@ -38494,8 +38497,8 @@ function createCachedImport(imp) {
|
|
|
38494
38497
|
return cached;
|
|
38495
38498
|
};
|
|
38496
38499
|
}
|
|
38497
|
-
const importPostcssImport = createCachedImport(() => import('./dep-
|
|
38498
|
-
const importPostcssModules = createCachedImport(() => import('./dep-
|
|
38500
|
+
const importPostcssImport = createCachedImport(() => import('./dep-ZzZNTu4r.js').then(function (n) { return n.i; }));
|
|
38501
|
+
const importPostcssModules = createCachedImport(() => import('./dep-dkmuXKZ9.js').then(function (n) { return n.i; }));
|
|
38499
38502
|
const importPostcss = createCachedImport(() => import('postcss'));
|
|
38500
38503
|
/**
|
|
38501
38504
|
* @experimental
|
|
@@ -47421,7 +47424,7 @@ function sirv (dir, opts={}) {
|
|
|
47421
47424
|
}
|
|
47422
47425
|
|
|
47423
47426
|
const knownJavascriptExtensionRE = /\.[tj]sx?$/;
|
|
47424
|
-
const sirvOptions = ({
|
|
47427
|
+
const sirvOptions = ({ getHeaders, shouldServe, }) => {
|
|
47425
47428
|
return {
|
|
47426
47429
|
dev: true,
|
|
47427
47430
|
etag: true,
|
|
@@ -47435,6 +47438,7 @@ const sirvOptions = ({ headers, shouldServe, }) => {
|
|
|
47435
47438
|
if (knownJavascriptExtensionRE.test(pathname)) {
|
|
47436
47439
|
res.setHeader('Content-Type', 'application/javascript');
|
|
47437
47440
|
}
|
|
47441
|
+
const headers = getHeaders();
|
|
47438
47442
|
if (headers) {
|
|
47439
47443
|
for (const name in headers) {
|
|
47440
47444
|
res.setHeader(name, headers[name]);
|
|
@@ -47444,9 +47448,10 @@ const sirvOptions = ({ headers, shouldServe, }) => {
|
|
|
47444
47448
|
shouldServe,
|
|
47445
47449
|
};
|
|
47446
47450
|
};
|
|
47447
|
-
function servePublicMiddleware(
|
|
47451
|
+
function servePublicMiddleware(server) {
|
|
47452
|
+
const dir = server.config.publicDir;
|
|
47448
47453
|
const serve = sirv(dir, sirvOptions({
|
|
47449
|
-
headers,
|
|
47454
|
+
getHeaders: () => server.config.server.headers,
|
|
47450
47455
|
shouldServe: (filePath) => shouldServeFile(filePath, dir),
|
|
47451
47456
|
}));
|
|
47452
47457
|
// Keep the named function. The name is visible in debug logs via `DEBUG=connect:dispatcher ...`
|
|
@@ -47458,9 +47463,10 @@ function servePublicMiddleware(dir, headers) {
|
|
|
47458
47463
|
serve(req, res, next);
|
|
47459
47464
|
};
|
|
47460
47465
|
}
|
|
47461
|
-
function serveStaticMiddleware(
|
|
47466
|
+
function serveStaticMiddleware(server) {
|
|
47467
|
+
const dir = server.config.root;
|
|
47462
47468
|
const serve = sirv(dir, sirvOptions({
|
|
47463
|
-
|
|
47469
|
+
getHeaders: () => server.config.server.headers,
|
|
47464
47470
|
}));
|
|
47465
47471
|
// Keep the named function. The name is visible in debug logs via `DEBUG=connect:dispatcher ...`
|
|
47466
47472
|
return function viteServeStaticMiddleware(req, res, next) {
|
|
@@ -47510,7 +47516,7 @@ function serveStaticMiddleware(dir, server) {
|
|
|
47510
47516
|
};
|
|
47511
47517
|
}
|
|
47512
47518
|
function serveRawFsMiddleware(server) {
|
|
47513
|
-
const serveFromRoot = sirv('/', sirvOptions({
|
|
47519
|
+
const serveFromRoot = sirv('/', sirvOptions({ getHeaders: () => server.config.server.headers }));
|
|
47514
47520
|
// Keep the named function. The name is visible in debug logs via `DEBUG=connect:dispatcher ...`
|
|
47515
47521
|
return function viteServeRawFsMiddleware(req, res, next) {
|
|
47516
47522
|
const url = new URL(req.url.replace(/^\/{2,}/, '/'), 'http://example.com');
|
|
@@ -47721,6 +47727,7 @@ async function loadAndTransform(id, url, server, options, timestamp, mod, resolv
|
|
|
47721
47727
|
throw e;
|
|
47722
47728
|
}
|
|
47723
47729
|
}
|
|
47730
|
+
ensureWatchedFile(server.watcher, file, config.root);
|
|
47724
47731
|
}
|
|
47725
47732
|
if (code) {
|
|
47726
47733
|
try {
|
|
@@ -54930,9 +54937,6 @@ function createWebSocketServer(server, config, httpsOptions) {
|
|
|
54930
54937
|
});
|
|
54931
54938
|
});
|
|
54932
54939
|
},
|
|
54933
|
-
[ASYNC_DISPOSE]() {
|
|
54934
|
-
return this.close();
|
|
54935
|
-
},
|
|
54936
54940
|
};
|
|
54937
54941
|
}
|
|
54938
54942
|
|
|
@@ -57660,9 +57664,6 @@ const devHtmlHook = async (html, { path: htmlPath, filename, server, originalUrl
|
|
|
57660
57664
|
};
|
|
57661
57665
|
function indexHtmlMiddleware(root, server) {
|
|
57662
57666
|
const isDev = isDevServer(server);
|
|
57663
|
-
const headers = isDev
|
|
57664
|
-
? server.config.server.headers
|
|
57665
|
-
: server.config.preview.headers;
|
|
57666
57667
|
// Keep the named function. The name is visible in debug logs via `DEBUG=connect:dispatcher ...`
|
|
57667
57668
|
return async function viteIndexHtmlMiddleware(req, res, next) {
|
|
57668
57669
|
if (res.writableEnded) {
|
|
@@ -57679,6 +57680,9 @@ function indexHtmlMiddleware(root, server) {
|
|
|
57679
57680
|
filePath = path$o.join(root, decodeURIComponent(url));
|
|
57680
57681
|
}
|
|
57681
57682
|
if (fs$l.existsSync(filePath)) {
|
|
57683
|
+
const headers = isDev
|
|
57684
|
+
? server.config.server.headers
|
|
57685
|
+
: server.config.preview.headers;
|
|
57682
57686
|
try {
|
|
57683
57687
|
let html = await fsp.readFile(filePath, 'utf-8');
|
|
57684
57688
|
if (isDev) {
|
|
@@ -57827,8 +57831,6 @@ class ModuleGraph {
|
|
|
57827
57831
|
}
|
|
57828
57832
|
invalidateModule(mod, seen = new Set(), timestamp = Date.now(), isHmr = false,
|
|
57829
57833
|
/** @internal */
|
|
57830
|
-
hmrBoundaries = [],
|
|
57831
|
-
/** @internal */
|
|
57832
57834
|
softInvalidate = false) {
|
|
57833
57835
|
const prevInvalidationState = mod.invalidationState;
|
|
57834
57836
|
const prevSsrInvalidationState = mod.ssrInvalidationState;
|
|
@@ -57866,14 +57868,6 @@ class ModuleGraph {
|
|
|
57866
57868
|
mod.ssrTransformResult = null;
|
|
57867
57869
|
mod.ssrModule = null;
|
|
57868
57870
|
mod.ssrError = null;
|
|
57869
|
-
// https://github.com/vitejs/vite/issues/3033
|
|
57870
|
-
// Given b.js -> c.js -> b.js (arrow means top-level import), if c.js self-accepts
|
|
57871
|
-
// and refetches itself, the execution order becomes c.js -> b.js -> c.js. The import
|
|
57872
|
-
// order matters here as it will fail. The workaround for now is to not hmr invalidate
|
|
57873
|
-
// b.js so that c.js refetches the already cached b.js, skipping the import loop.
|
|
57874
|
-
if (hmrBoundaries.includes(mod)) {
|
|
57875
|
-
return;
|
|
57876
|
-
}
|
|
57877
57871
|
mod.importers.forEach((importer) => {
|
|
57878
57872
|
if (!importer.acceptedHmrDeps.has(mod)) {
|
|
57879
57873
|
// If the importer statically imports the current module, we can soft-invalidate the importer
|
|
@@ -57881,7 +57875,7 @@ class ModuleGraph {
|
|
|
57881
57875
|
// we can only soft invalidate if the current module was also soft-invalidated. A soft-invalidation
|
|
57882
57876
|
// doesn't need to trigger a re-load and re-transform of the importer.
|
|
57883
57877
|
const shouldSoftInvalidateImporter = importer.staticImportedUrls?.has(mod.url) || softInvalidate;
|
|
57884
|
-
this.invalidateModule(importer, seen, timestamp, isHmr,
|
|
57878
|
+
this.invalidateModule(importer, seen, timestamp, isHmr, shouldSoftInvalidateImporter);
|
|
57885
57879
|
}
|
|
57886
57880
|
});
|
|
57887
57881
|
}
|
|
@@ -58469,9 +58463,6 @@ async function _createServer(inlineConfig = {}, options) {
|
|
|
58469
58463
|
}
|
|
58470
58464
|
server.resolvedUrls = null;
|
|
58471
58465
|
},
|
|
58472
|
-
[ASYNC_DISPOSE]() {
|
|
58473
|
-
return this.close();
|
|
58474
|
-
},
|
|
58475
58466
|
printUrls() {
|
|
58476
58467
|
if (server.resolvedUrls) {
|
|
58477
58468
|
printServerUrls(server.resolvedUrls, serverConfig.host, config.logger.info);
|
|
@@ -58606,13 +58597,13 @@ async function _createServer(inlineConfig = {}, options) {
|
|
|
58606
58597
|
// this applies before the transform middleware so that these files are served
|
|
58607
58598
|
// as-is without transforms.
|
|
58608
58599
|
if (config.publicDir) {
|
|
58609
|
-
middlewares.use(servePublicMiddleware(
|
|
58600
|
+
middlewares.use(servePublicMiddleware(server));
|
|
58610
58601
|
}
|
|
58611
58602
|
// main transform middleware
|
|
58612
58603
|
middlewares.use(transformMiddleware(server));
|
|
58613
58604
|
// serve static files
|
|
58614
58605
|
middlewares.use(serveRawFsMiddleware(server));
|
|
58615
|
-
middlewares.use(serveStaticMiddleware(
|
|
58606
|
+
middlewares.use(serveStaticMiddleware(server));
|
|
58616
58607
|
// html fallback
|
|
58617
58608
|
if (config.appType === 'spa' || config.appType === 'mpa') {
|
|
58618
58609
|
middlewares.use(htmlFallbackMiddleware(root, config.appType === 'spa'));
|
|
@@ -58681,14 +58672,22 @@ async function startServer(server, inlinePort) {
|
|
|
58681
58672
|
throw new Error('Cannot call server.listen in middleware mode.');
|
|
58682
58673
|
}
|
|
58683
58674
|
const options = server.config.server;
|
|
58684
|
-
const port = inlinePort ?? options.port ?? DEFAULT_DEV_PORT;
|
|
58685
58675
|
const hostname = await resolveHostname(options.host);
|
|
58686
|
-
|
|
58676
|
+
const configPort = inlinePort ?? options.port;
|
|
58677
|
+
// When using non strict port for the dev server, the running port can be different from the config one.
|
|
58678
|
+
// When restarting, the original port may be available but to avoid a switch of URL for the running
|
|
58679
|
+
// browser tabs, we enforce the previously used port, expect if the config port changed.
|
|
58680
|
+
const port = (!configPort || configPort === server._configServerPort
|
|
58681
|
+
? server._currentServerPort
|
|
58682
|
+
: configPort) ?? DEFAULT_DEV_PORT;
|
|
58683
|
+
server._configServerPort = configPort;
|
|
58684
|
+
const serverPort = await httpServerStart(httpServer, {
|
|
58687
58685
|
port,
|
|
58688
58686
|
strictPort: options.strictPort,
|
|
58689
58687
|
host: hostname.host,
|
|
58690
58688
|
logger: server.config.logger,
|
|
58691
58689
|
});
|
|
58690
|
+
server._currentServerPort = serverPort;
|
|
58692
58691
|
}
|
|
58693
58692
|
function createServerCloseFn(server) {
|
|
58694
58693
|
if (!server) {
|
|
@@ -58781,6 +58780,8 @@ async function restartServer(server) {
|
|
|
58781
58780
|
}
|
|
58782
58781
|
await server.close();
|
|
58783
58782
|
// Assign new server props to existing server instance
|
|
58783
|
+
newServer._configServerPort = server._configServerPort;
|
|
58784
|
+
newServer._currentServerPort = server._currentServerPort;
|
|
58784
58785
|
Object.assign(server, newServer);
|
|
58785
58786
|
// Rebind internal server variable so functions reference the user server
|
|
58786
58787
|
newServer._setInternalServer(server);
|
|
@@ -58911,12 +58912,12 @@ function updateModules(file, modules, timestamp, { config, ws, moduleGraph }, af
|
|
|
58911
58912
|
for (const mod of modules) {
|
|
58912
58913
|
const boundaries = [];
|
|
58913
58914
|
const hasDeadEnd = propagateUpdate(mod, traversedModules, boundaries);
|
|
58914
|
-
moduleGraph.invalidateModule(mod, invalidatedModules, timestamp, true
|
|
58915
|
+
moduleGraph.invalidateModule(mod, invalidatedModules, timestamp, true);
|
|
58915
58916
|
if (needFullReload) {
|
|
58916
58917
|
continue;
|
|
58917
58918
|
}
|
|
58918
58919
|
if (hasDeadEnd) {
|
|
58919
|
-
needFullReload =
|
|
58920
|
+
needFullReload = hasDeadEnd;
|
|
58920
58921
|
continue;
|
|
58921
58922
|
}
|
|
58922
58923
|
updates.push(...boundaries.map(({ boundary, acceptedVia }) => ({
|
|
@@ -58930,10 +58931,10 @@ function updateModules(file, modules, timestamp, { config, ws, moduleGraph }, af
|
|
|
58930
58931
|
})));
|
|
58931
58932
|
}
|
|
58932
58933
|
if (needFullReload) {
|
|
58933
|
-
|
|
58934
|
-
|
|
58935
|
-
|
|
58936
|
-
});
|
|
58934
|
+
const reason = typeof needFullReload === 'string'
|
|
58935
|
+
? colors$1.dim(` (${needFullReload})`)
|
|
58936
|
+
: '';
|
|
58937
|
+
config.logger.info(colors$1.green(`page reload `) + colors$1.dim(file) + reason, { clear: !afterInvalidation, timestamp: true });
|
|
58937
58938
|
ws.send({
|
|
58938
58939
|
type: 'full-reload',
|
|
58939
58940
|
});
|
|
@@ -58986,6 +58987,9 @@ function propagateUpdate(node, traversedModules, boundaries, currentChain = [nod
|
|
|
58986
58987
|
}
|
|
58987
58988
|
if (node.isSelfAccepting) {
|
|
58988
58989
|
boundaries.push({ boundary: node, acceptedVia: node });
|
|
58990
|
+
const result = isNodeWithinCircularImports(node, currentChain);
|
|
58991
|
+
if (result)
|
|
58992
|
+
return result;
|
|
58989
58993
|
// additionally check for CSS importers, since a PostCSS plugin like
|
|
58990
58994
|
// Tailwind JIT may register any file as a dependency to a CSS file.
|
|
58991
58995
|
for (const importer of node.importers) {
|
|
@@ -59002,6 +59006,9 @@ function propagateUpdate(node, traversedModules, boundaries, currentChain = [nod
|
|
|
59002
59006
|
// so that they do get the fresh imported module when/if they are reloaded.
|
|
59003
59007
|
if (node.acceptedHmrExports) {
|
|
59004
59008
|
boundaries.push({ boundary: node, acceptedVia: node });
|
|
59009
|
+
const result = isNodeWithinCircularImports(node, currentChain);
|
|
59010
|
+
if (result)
|
|
59011
|
+
return result;
|
|
59005
59012
|
}
|
|
59006
59013
|
else {
|
|
59007
59014
|
if (!node.importers.size) {
|
|
@@ -59019,6 +59026,9 @@ function propagateUpdate(node, traversedModules, boundaries, currentChain = [nod
|
|
|
59019
59026
|
const subChain = currentChain.concat(importer);
|
|
59020
59027
|
if (importer.acceptedHmrDeps.has(node)) {
|
|
59021
59028
|
boundaries.push({ boundary: importer, acceptedVia: node });
|
|
59029
|
+
const result = isNodeWithinCircularImports(importer, subChain);
|
|
59030
|
+
if (result)
|
|
59031
|
+
return result;
|
|
59022
59032
|
continue;
|
|
59023
59033
|
}
|
|
59024
59034
|
if (node.id && node.acceptedHmrExports && importer.importedBindings) {
|
|
@@ -59028,12 +59038,67 @@ function propagateUpdate(node, traversedModules, boundaries, currentChain = [nod
|
|
|
59028
59038
|
continue;
|
|
59029
59039
|
}
|
|
59030
59040
|
}
|
|
59031
|
-
if (currentChain.includes(importer)
|
|
59032
|
-
|
|
59041
|
+
if (!currentChain.includes(importer) &&
|
|
59042
|
+
propagateUpdate(importer, traversedModules, boundaries, subChain)) {
|
|
59033
59043
|
return true;
|
|
59034
59044
|
}
|
|
59035
|
-
|
|
59036
|
-
|
|
59045
|
+
}
|
|
59046
|
+
return false;
|
|
59047
|
+
}
|
|
59048
|
+
/**
|
|
59049
|
+
* Check importers recursively if it's an import loop. An accepted module within
|
|
59050
|
+
* an import loop cannot recover its execution order and should be reloaded.
|
|
59051
|
+
*
|
|
59052
|
+
* @param node The node that accepts HMR and is a boundary
|
|
59053
|
+
* @param nodeChain The chain of nodes/imports that lead to the node.
|
|
59054
|
+
* (The last node in the chain imports the `node` parameter)
|
|
59055
|
+
* @param currentChain The current chain tracked from the `node` parameter
|
|
59056
|
+
*/
|
|
59057
|
+
function isNodeWithinCircularImports(node, nodeChain, currentChain = [node]) {
|
|
59058
|
+
// To help visualize how each parameters work, imagine this import graph:
|
|
59059
|
+
//
|
|
59060
|
+
// A -> B -> C -> ACCEPTED -> D -> E -> NODE
|
|
59061
|
+
// ^--------------------------|
|
|
59062
|
+
//
|
|
59063
|
+
// ACCEPTED: the node that accepts HMR. the `node` parameter.
|
|
59064
|
+
// NODE : the initial node that triggered this HMR.
|
|
59065
|
+
//
|
|
59066
|
+
// This function will return true in the above graph, which:
|
|
59067
|
+
// `node` : ACCEPTED
|
|
59068
|
+
// `nodeChain` : [NODE, E, D, ACCEPTED]
|
|
59069
|
+
// `currentChain` : [ACCEPTED, C, B]
|
|
59070
|
+
//
|
|
59071
|
+
// It works by checking if any `node` importers are within `nodeChain`, which
|
|
59072
|
+
// means there's an import loop with a HMR-accepted module in it.
|
|
59073
|
+
for (const importer of node.importers) {
|
|
59074
|
+
// Node may import itself which is safe
|
|
59075
|
+
if (importer === node)
|
|
59076
|
+
continue;
|
|
59077
|
+
// Check circular imports
|
|
59078
|
+
const importerIndex = nodeChain.indexOf(importer);
|
|
59079
|
+
if (importerIndex > -1) {
|
|
59080
|
+
// Log extra debug information so users can fix and remove the circular imports
|
|
59081
|
+
if (debugHmr) {
|
|
59082
|
+
// Following explanation above:
|
|
59083
|
+
// `importer` : E
|
|
59084
|
+
// `currentChain` reversed : [B, C, ACCEPTED]
|
|
59085
|
+
// `nodeChain` sliced & reversed : [D, E]
|
|
59086
|
+
// Combined : [E, B, C, ACCEPTED, D, E]
|
|
59087
|
+
const importChain = [
|
|
59088
|
+
importer,
|
|
59089
|
+
...[...currentChain].reverse(),
|
|
59090
|
+
...nodeChain.slice(importerIndex, -1).reverse(),
|
|
59091
|
+
];
|
|
59092
|
+
debugHmr(colors$1.yellow(`circular imports detected: `) +
|
|
59093
|
+
importChain.map((m) => colors$1.dim(m.url)).join(' -> '));
|
|
59094
|
+
}
|
|
59095
|
+
return 'circular imports';
|
|
59096
|
+
}
|
|
59097
|
+
// Continue recursively
|
|
59098
|
+
if (!currentChain.includes(importer)) {
|
|
59099
|
+
const result = isNodeWithinCircularImports(importer, nodeChain, currentChain.concat(importer));
|
|
59100
|
+
if (result)
|
|
59101
|
+
return result;
|
|
59037
59102
|
}
|
|
59038
59103
|
}
|
|
59039
59104
|
return false;
|
|
@@ -59393,6 +59458,324 @@ function canJsonParse(value) {
|
|
|
59393
59458
|
}
|
|
59394
59459
|
}
|
|
59395
59460
|
|
|
59461
|
+
const WORKER_FILE_ID = 'worker_file';
|
|
59462
|
+
const workerCache = new WeakMap();
|
|
59463
|
+
function saveEmitWorkerAsset(config, asset) {
|
|
59464
|
+
const fileName = asset.fileName;
|
|
59465
|
+
const workerMap = workerCache.get(config.mainConfig || config);
|
|
59466
|
+
workerMap.assets.set(fileName, asset);
|
|
59467
|
+
}
|
|
59468
|
+
async function bundleWorkerEntry(config, id, query) {
|
|
59469
|
+
// bundle the file as entry to support imports
|
|
59470
|
+
const { rollup } = await import('rollup');
|
|
59471
|
+
const { plugins, rollupOptions, format } = config.worker;
|
|
59472
|
+
const bundle = await rollup({
|
|
59473
|
+
...rollupOptions,
|
|
59474
|
+
input: cleanUrl(id),
|
|
59475
|
+
plugins: await plugins(),
|
|
59476
|
+
onwarn(warning, warn) {
|
|
59477
|
+
onRollupWarning(warning, warn, config);
|
|
59478
|
+
},
|
|
59479
|
+
preserveEntrySignatures: false,
|
|
59480
|
+
});
|
|
59481
|
+
let chunk;
|
|
59482
|
+
try {
|
|
59483
|
+
const workerOutputConfig = config.worker.rollupOptions.output;
|
|
59484
|
+
const workerConfig = workerOutputConfig
|
|
59485
|
+
? Array.isArray(workerOutputConfig)
|
|
59486
|
+
? workerOutputConfig[0] || {}
|
|
59487
|
+
: workerOutputConfig
|
|
59488
|
+
: {};
|
|
59489
|
+
const { output: [outputChunk, ...outputChunks], } = await bundle.generate({
|
|
59490
|
+
entryFileNames: path$o.posix.join(config.build.assetsDir, '[name]-[hash].js'),
|
|
59491
|
+
chunkFileNames: path$o.posix.join(config.build.assetsDir, '[name]-[hash].js'),
|
|
59492
|
+
assetFileNames: path$o.posix.join(config.build.assetsDir, '[name]-[hash].[ext]'),
|
|
59493
|
+
...workerConfig,
|
|
59494
|
+
format,
|
|
59495
|
+
sourcemap: config.build.sourcemap,
|
|
59496
|
+
});
|
|
59497
|
+
chunk = outputChunk;
|
|
59498
|
+
outputChunks.forEach((outputChunk) => {
|
|
59499
|
+
if (outputChunk.type === 'asset') {
|
|
59500
|
+
saveEmitWorkerAsset(config, outputChunk);
|
|
59501
|
+
}
|
|
59502
|
+
else if (outputChunk.type === 'chunk') {
|
|
59503
|
+
saveEmitWorkerAsset(config, {
|
|
59504
|
+
fileName: outputChunk.fileName,
|
|
59505
|
+
source: outputChunk.code,
|
|
59506
|
+
type: 'asset',
|
|
59507
|
+
});
|
|
59508
|
+
}
|
|
59509
|
+
});
|
|
59510
|
+
}
|
|
59511
|
+
finally {
|
|
59512
|
+
await bundle.close();
|
|
59513
|
+
}
|
|
59514
|
+
return emitSourcemapForWorkerEntry(config, query, chunk);
|
|
59515
|
+
}
|
|
59516
|
+
function emitSourcemapForWorkerEntry(config, query, chunk) {
|
|
59517
|
+
const { map: sourcemap } = chunk;
|
|
59518
|
+
if (sourcemap) {
|
|
59519
|
+
if (config.build.sourcemap === 'hidden' ||
|
|
59520
|
+
config.build.sourcemap === true) {
|
|
59521
|
+
const data = sourcemap.toString();
|
|
59522
|
+
const mapFileName = chunk.fileName + '.map';
|
|
59523
|
+
saveEmitWorkerAsset(config, {
|
|
59524
|
+
fileName: mapFileName,
|
|
59525
|
+
type: 'asset',
|
|
59526
|
+
source: data,
|
|
59527
|
+
});
|
|
59528
|
+
}
|
|
59529
|
+
}
|
|
59530
|
+
return chunk;
|
|
59531
|
+
}
|
|
59532
|
+
const workerAssetUrlRE = /__VITE_WORKER_ASSET__([a-z\d]{8})__/g;
|
|
59533
|
+
function encodeWorkerAssetFileName(fileName, workerCache) {
|
|
59534
|
+
const { fileNameHash } = workerCache;
|
|
59535
|
+
const hash = getHash(fileName);
|
|
59536
|
+
if (!fileNameHash.get(hash)) {
|
|
59537
|
+
fileNameHash.set(hash, fileName);
|
|
59538
|
+
}
|
|
59539
|
+
return `__VITE_WORKER_ASSET__${hash}__`;
|
|
59540
|
+
}
|
|
59541
|
+
async function workerFileToUrl(config, id, query) {
|
|
59542
|
+
const workerMap = workerCache.get(config.mainConfig || config);
|
|
59543
|
+
let fileName = workerMap.bundle.get(id);
|
|
59544
|
+
if (!fileName) {
|
|
59545
|
+
const outputChunk = await bundleWorkerEntry(config, id, query);
|
|
59546
|
+
fileName = outputChunk.fileName;
|
|
59547
|
+
saveEmitWorkerAsset(config, {
|
|
59548
|
+
fileName,
|
|
59549
|
+
source: outputChunk.code,
|
|
59550
|
+
type: 'asset',
|
|
59551
|
+
});
|
|
59552
|
+
workerMap.bundle.set(id, fileName);
|
|
59553
|
+
}
|
|
59554
|
+
return encodeWorkerAssetFileName(fileName, workerMap);
|
|
59555
|
+
}
|
|
59556
|
+
function webWorkerPostPlugin() {
|
|
59557
|
+
return {
|
|
59558
|
+
name: 'vite:worker-post',
|
|
59559
|
+
resolveImportMeta(property, { chunkId, format }) {
|
|
59560
|
+
// document is undefined in the worker, so we need to avoid it in iife
|
|
59561
|
+
if (property === 'url' && format === 'iife') {
|
|
59562
|
+
return 'self.location.href';
|
|
59563
|
+
}
|
|
59564
|
+
return null;
|
|
59565
|
+
},
|
|
59566
|
+
};
|
|
59567
|
+
}
|
|
59568
|
+
function webWorkerPlugin(config) {
|
|
59569
|
+
const isBuild = config.command === 'build';
|
|
59570
|
+
let server;
|
|
59571
|
+
const isWorker = config.isWorker;
|
|
59572
|
+
const isWorkerQueryId = (id) => {
|
|
59573
|
+
const parsedQuery = parseRequest(id);
|
|
59574
|
+
if (parsedQuery &&
|
|
59575
|
+
(parsedQuery.worker ?? parsedQuery.sharedworker) != null) {
|
|
59576
|
+
return true;
|
|
59577
|
+
}
|
|
59578
|
+
return false;
|
|
59579
|
+
};
|
|
59580
|
+
return {
|
|
59581
|
+
name: 'vite:worker',
|
|
59582
|
+
configureServer(_server) {
|
|
59583
|
+
server = _server;
|
|
59584
|
+
},
|
|
59585
|
+
buildStart() {
|
|
59586
|
+
if (isWorker) {
|
|
59587
|
+
return;
|
|
59588
|
+
}
|
|
59589
|
+
workerCache.set(config, {
|
|
59590
|
+
assets: new Map(),
|
|
59591
|
+
bundle: new Map(),
|
|
59592
|
+
fileNameHash: new Map(),
|
|
59593
|
+
});
|
|
59594
|
+
},
|
|
59595
|
+
load(id) {
|
|
59596
|
+
if (isBuild && isWorkerQueryId(id)) {
|
|
59597
|
+
return '';
|
|
59598
|
+
}
|
|
59599
|
+
},
|
|
59600
|
+
shouldTransformCachedModule({ id }) {
|
|
59601
|
+
if (isBuild && config.build.watch && isWorkerQueryId(id)) {
|
|
59602
|
+
return true;
|
|
59603
|
+
}
|
|
59604
|
+
},
|
|
59605
|
+
async transform(raw, id, options) {
|
|
59606
|
+
const ssr = options?.ssr === true;
|
|
59607
|
+
const query = parseRequest(id);
|
|
59608
|
+
if (query && query[WORKER_FILE_ID] != null) {
|
|
59609
|
+
// if import worker by worker constructor will have query.type
|
|
59610
|
+
// other type will be import worker by esm
|
|
59611
|
+
const workerType = query['type'];
|
|
59612
|
+
let injectEnv = '';
|
|
59613
|
+
const scriptPath = JSON.stringify(path$o.posix.join(config.base, ENV_PUBLIC_PATH));
|
|
59614
|
+
if (workerType === 'classic') {
|
|
59615
|
+
injectEnv = `importScripts(${scriptPath})\n`;
|
|
59616
|
+
}
|
|
59617
|
+
else if (workerType === 'module') {
|
|
59618
|
+
injectEnv = `import ${scriptPath}\n`;
|
|
59619
|
+
}
|
|
59620
|
+
else if (workerType === 'ignore') {
|
|
59621
|
+
if (isBuild) {
|
|
59622
|
+
injectEnv = '';
|
|
59623
|
+
}
|
|
59624
|
+
else if (server) {
|
|
59625
|
+
// dynamic worker type we can't know how import the env
|
|
59626
|
+
// so we copy /@vite/env code of server transform result into file header
|
|
59627
|
+
const { moduleGraph } = server;
|
|
59628
|
+
const module = moduleGraph.getModuleById(ENV_ENTRY);
|
|
59629
|
+
injectEnv = module?.transformResult?.code || '';
|
|
59630
|
+
}
|
|
59631
|
+
}
|
|
59632
|
+
if (injectEnv) {
|
|
59633
|
+
const s = new MagicString(raw);
|
|
59634
|
+
s.prepend(injectEnv);
|
|
59635
|
+
return {
|
|
59636
|
+
code: s.toString(),
|
|
59637
|
+
map: s.generateMap({ hires: 'boundary' }),
|
|
59638
|
+
};
|
|
59639
|
+
}
|
|
59640
|
+
return;
|
|
59641
|
+
}
|
|
59642
|
+
if (query == null ||
|
|
59643
|
+
(query && (query.worker ?? query.sharedworker) == null)) {
|
|
59644
|
+
return;
|
|
59645
|
+
}
|
|
59646
|
+
// stringified url or `new URL(...)`
|
|
59647
|
+
let url;
|
|
59648
|
+
const { format } = config.worker;
|
|
59649
|
+
const workerConstructor = query.sharedworker != null ? 'SharedWorker' : 'Worker';
|
|
59650
|
+
const workerType = isBuild
|
|
59651
|
+
? format === 'es'
|
|
59652
|
+
? 'module'
|
|
59653
|
+
: 'classic'
|
|
59654
|
+
: 'module';
|
|
59655
|
+
const workerTypeOption = `{
|
|
59656
|
+
${workerType === 'module' ? `type: "module",` : ''}
|
|
59657
|
+
name: options?.name
|
|
59658
|
+
}`;
|
|
59659
|
+
if (isBuild) {
|
|
59660
|
+
getDepsOptimizer(config, ssr)?.registerWorkersSource(id);
|
|
59661
|
+
if (query.inline != null) {
|
|
59662
|
+
const chunk = await bundleWorkerEntry(config, id, query);
|
|
59663
|
+
const encodedJs = `const encodedJs = "${Buffer.from(chunk.code).toString('base64')}";`;
|
|
59664
|
+
const code =
|
|
59665
|
+
// Using blob URL for SharedWorker results in multiple instances of a same worker
|
|
59666
|
+
workerConstructor === 'Worker'
|
|
59667
|
+
? `${encodedJs}
|
|
59668
|
+
const blob = typeof window !== "undefined" && window.Blob && new Blob([${workerType === 'classic'
|
|
59669
|
+
? ''
|
|
59670
|
+
: // `URL` is always available, in `Worker[type="module"]`
|
|
59671
|
+
`'URL.revokeObjectURL(import.meta.url);'+`}atob(encodedJs)], { type: "text/javascript;charset=utf-8" });
|
|
59672
|
+
export default function WorkerWrapper(options) {
|
|
59673
|
+
let objURL;
|
|
59674
|
+
try {
|
|
59675
|
+
objURL = blob && (window.URL || window.webkitURL).createObjectURL(blob);
|
|
59676
|
+
if (!objURL) throw ''
|
|
59677
|
+
const worker = new ${workerConstructor}(objURL, ${workerTypeOption});
|
|
59678
|
+
worker.addEventListener("error", () => {
|
|
59679
|
+
(window.URL || window.webkitURL).revokeObjectURL(objURL);
|
|
59680
|
+
});
|
|
59681
|
+
return worker;
|
|
59682
|
+
} catch(e) {
|
|
59683
|
+
return new ${workerConstructor}(
|
|
59684
|
+
"data:application/javascript;base64," + encodedJs,
|
|
59685
|
+
${workerTypeOption}
|
|
59686
|
+
);
|
|
59687
|
+
}${
|
|
59688
|
+
// For module workers, we should not revoke the URL until the worker runs,
|
|
59689
|
+
// otherwise the worker fails to run
|
|
59690
|
+
workerType === 'classic'
|
|
59691
|
+
? ` finally {
|
|
59692
|
+
objURL && (window.URL || window.webkitURL).revokeObjectURL(objURL);
|
|
59693
|
+
}`
|
|
59694
|
+
: ''}
|
|
59695
|
+
}`
|
|
59696
|
+
: `${encodedJs}
|
|
59697
|
+
export default function WorkerWrapper(options) {
|
|
59698
|
+
return new ${workerConstructor}(
|
|
59699
|
+
"data:application/javascript;base64," + encodedJs,
|
|
59700
|
+
${workerTypeOption}
|
|
59701
|
+
);
|
|
59702
|
+
}
|
|
59703
|
+
`;
|
|
59704
|
+
return {
|
|
59705
|
+
code,
|
|
59706
|
+
// Empty sourcemap to suppress Rollup warning
|
|
59707
|
+
map: { mappings: '' },
|
|
59708
|
+
};
|
|
59709
|
+
}
|
|
59710
|
+
else {
|
|
59711
|
+
url = await workerFileToUrl(config, id, query);
|
|
59712
|
+
}
|
|
59713
|
+
}
|
|
59714
|
+
else {
|
|
59715
|
+
url = await fileToUrl$1(cleanUrl(id), config, this);
|
|
59716
|
+
url = injectQuery(url, WORKER_FILE_ID);
|
|
59717
|
+
url = injectQuery(url, `type=${workerType}`);
|
|
59718
|
+
}
|
|
59719
|
+
if (query.url != null) {
|
|
59720
|
+
return {
|
|
59721
|
+
code: `export default ${JSON.stringify(url)}`,
|
|
59722
|
+
map: { mappings: '' }, // Empty sourcemap to suppress Rollup warning
|
|
59723
|
+
};
|
|
59724
|
+
}
|
|
59725
|
+
return {
|
|
59726
|
+
code: `export default function WorkerWrapper(options) {
|
|
59727
|
+
return new ${workerConstructor}(
|
|
59728
|
+
${JSON.stringify(url)},
|
|
59729
|
+
${workerTypeOption}
|
|
59730
|
+
);
|
|
59731
|
+
}`,
|
|
59732
|
+
map: { mappings: '' }, // Empty sourcemap to suppress Rollup warning
|
|
59733
|
+
};
|
|
59734
|
+
},
|
|
59735
|
+
renderChunk(code, chunk, outputOptions) {
|
|
59736
|
+
let s;
|
|
59737
|
+
const result = () => {
|
|
59738
|
+
return (s && {
|
|
59739
|
+
code: s.toString(),
|
|
59740
|
+
map: config.build.sourcemap
|
|
59741
|
+
? s.generateMap({ hires: 'boundary' })
|
|
59742
|
+
: null,
|
|
59743
|
+
});
|
|
59744
|
+
};
|
|
59745
|
+
if (code.match(workerAssetUrlRE)) {
|
|
59746
|
+
const toRelativeRuntime = createToImportMetaURLBasedRelativeRuntime(outputOptions.format, config.isWorker);
|
|
59747
|
+
let match;
|
|
59748
|
+
s = new MagicString(code);
|
|
59749
|
+
workerAssetUrlRE.lastIndex = 0;
|
|
59750
|
+
// Replace "__VITE_WORKER_ASSET__5aa0ddc0__" using relative paths
|
|
59751
|
+
const workerMap = workerCache.get(config.mainConfig || config);
|
|
59752
|
+
const { fileNameHash } = workerMap;
|
|
59753
|
+
while ((match = workerAssetUrlRE.exec(code))) {
|
|
59754
|
+
const [full, hash] = match;
|
|
59755
|
+
const filename = fileNameHash.get(hash);
|
|
59756
|
+
const replacement = toOutputFilePathInJS(filename, 'asset', chunk.fileName, 'js', config, toRelativeRuntime);
|
|
59757
|
+
const replacementString = typeof replacement === 'string'
|
|
59758
|
+
? JSON.stringify(replacement).slice(1, -1)
|
|
59759
|
+
: `"+${replacement.runtime}+"`;
|
|
59760
|
+
s.update(match.index, match.index + full.length, replacementString);
|
|
59761
|
+
}
|
|
59762
|
+
}
|
|
59763
|
+
return result();
|
|
59764
|
+
},
|
|
59765
|
+
generateBundle(opts) {
|
|
59766
|
+
// @ts-expect-error asset emits are skipped in legacy bundle
|
|
59767
|
+
if (opts.__vite_skip_asset_emit__ || isWorker) {
|
|
59768
|
+
return;
|
|
59769
|
+
}
|
|
59770
|
+
const workerMap = workerCache.get(config);
|
|
59771
|
+
workerMap.assets.forEach((asset) => {
|
|
59772
|
+
this.emitFile(asset);
|
|
59773
|
+
workerMap.assets.delete(asset.fileName);
|
|
59774
|
+
});
|
|
59775
|
+
},
|
|
59776
|
+
};
|
|
59777
|
+
}
|
|
59778
|
+
|
|
59396
59779
|
const debug$4 = createDebugger('vite:import-analysis');
|
|
59397
59780
|
const clientDir = normalizePath$3(CLIENT_DIR);
|
|
59398
59781
|
const skipRE = /\.(?:map|json)(?:$|\?)/;
|
|
@@ -59401,7 +59784,6 @@ const optimizedDepChunkRE$1 = /\/chunk-[A-Z\d]{8}\.js/;
|
|
|
59401
59784
|
const optimizedDepDynamicRE$1 = /-[A-Z\d]{8}\.js/;
|
|
59402
59785
|
const hasImportInQueryParamsRE = /[?&]import=?\b/;
|
|
59403
59786
|
const hasViteIgnoreRE = /\/\*\s*@vite-ignore\s*\*\//;
|
|
59404
|
-
const cleanUpRawUrlRE = /\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm;
|
|
59405
59787
|
const urlIsStringRE = /^(?:'.*'|".*"|`.*`)$/;
|
|
59406
59788
|
const templateLiteralRE = /^\s*`(.*)`\s*$/;
|
|
59407
59789
|
function isExplicitImportRequired(url) {
|
|
@@ -59531,7 +59913,8 @@ function importAnalysisPlugin(config) {
|
|
|
59531
59913
|
try {
|
|
59532
59914
|
[imports, exports] = parse$e(source);
|
|
59533
59915
|
}
|
|
59534
|
-
catch (
|
|
59916
|
+
catch (_e) {
|
|
59917
|
+
const e = _e;
|
|
59535
59918
|
const { message, showCodeFrame } = createParseErrorInfo(importer, source);
|
|
59536
59919
|
this.error(message, showCodeFrame ? e.idx : undefined);
|
|
59537
59920
|
}
|
|
@@ -59584,7 +59967,7 @@ function importAnalysisPlugin(config) {
|
|
|
59584
59967
|
}
|
|
59585
59968
|
}
|
|
59586
59969
|
const resolved = await this.resolve(url, importerFile);
|
|
59587
|
-
if (!resolved) {
|
|
59970
|
+
if (!resolved || resolved.meta?.['vite:alias']?.noResolved) {
|
|
59588
59971
|
// in ssr, we should let node handle the missing modules
|
|
59589
59972
|
if (ssr) {
|
|
59590
59973
|
return [url, url];
|
|
@@ -59825,11 +60208,10 @@ function importAnalysisPlugin(config) {
|
|
|
59825
60208
|
}
|
|
59826
60209
|
}
|
|
59827
60210
|
if (!ssr) {
|
|
59828
|
-
|
|
59829
|
-
|
|
59830
|
-
isExplicitImportRequired(url.slice(1, -1))) {
|
|
60211
|
+
if (!urlIsStringRE.test(rawUrl) ||
|
|
60212
|
+
isExplicitImportRequired(rawUrl.slice(1, -1))) {
|
|
59831
60213
|
needQueryInjectHelper = true;
|
|
59832
|
-
str().overwrite(start, end, `__vite__injectQuery(${
|
|
60214
|
+
str().overwrite(start, end, `__vite__injectQuery(${rawUrl}, 'import')`, { contentOnly: true });
|
|
59833
60215
|
}
|
|
59834
60216
|
}
|
|
59835
60217
|
}
|
|
@@ -59842,11 +60224,14 @@ function importAnalysisPlugin(config) {
|
|
|
59842
60224
|
const staticImportedUrls = new Set(_orderedImportedUrls);
|
|
59843
60225
|
const acceptedUrls = mergeAcceptedUrls(orderedAcceptedUrls);
|
|
59844
60226
|
const acceptedExports = mergeAcceptedUrls(orderedAcceptedExports);
|
|
59845
|
-
|
|
60227
|
+
// While we always expect to work with ESM, a classic worker is the only
|
|
60228
|
+
// case where it's not ESM and we need to avoid injecting ESM-specific code
|
|
60229
|
+
const isClassicWorker = importer.includes(WORKER_FILE_ID) && importer.includes('type=classic');
|
|
60230
|
+
if (hasEnv && !isClassicWorker) {
|
|
59846
60231
|
// inject import.meta.env
|
|
59847
60232
|
str().prepend(getEnv(ssr));
|
|
59848
60233
|
}
|
|
59849
|
-
if (hasHMR && !ssr) {
|
|
60234
|
+
if (hasHMR && !ssr && !isClassicWorker) {
|
|
59850
60235
|
debugHmr?.(`${isSelfAccepting
|
|
59851
60236
|
? `[self-accepts]`
|
|
59852
60237
|
: isPartiallySelfAccepting
|
|
@@ -59859,7 +60244,12 @@ function importAnalysisPlugin(config) {
|
|
|
59859
60244
|
`import.meta.hot = __vite__createHotContext(${JSON.stringify(normalizeHmrUrl(importerModule.url))});`);
|
|
59860
60245
|
}
|
|
59861
60246
|
if (needQueryInjectHelper) {
|
|
59862
|
-
|
|
60247
|
+
if (isClassicWorker) {
|
|
60248
|
+
str().append('\n' + __vite__injectQuery.toString());
|
|
60249
|
+
}
|
|
60250
|
+
else {
|
|
60251
|
+
str().prepend(`import { injectQuery as __vite__injectQuery } from "${clientPublicPath}";`);
|
|
60252
|
+
}
|
|
59863
60253
|
}
|
|
59864
60254
|
// normalize and rewrite accepted urls
|
|
59865
60255
|
const normalizedAcceptedUrls = new Set();
|
|
@@ -60056,6 +60446,17 @@ function transformCjsImport(importExp, url, rawUrl, importIndex, importer, confi
|
|
|
60056
60446
|
return lines.join('; ');
|
|
60057
60447
|
}
|
|
60058
60448
|
}
|
|
60449
|
+
// Copied from `client/client.ts`. Only needed so we can inline inject this function for classic workers.
|
|
60450
|
+
function __vite__injectQuery(url, queryToInject) {
|
|
60451
|
+
// skip urls that won't be handled by vite
|
|
60452
|
+
if (url[0] !== '.' && url[0] !== '/') {
|
|
60453
|
+
return url;
|
|
60454
|
+
}
|
|
60455
|
+
// can't use pathname from URL since it may be relative like ../
|
|
60456
|
+
const pathname = url.replace(/[?#].*$/s, '');
|
|
60457
|
+
const { search, hash } = new URL(url, 'http://vitejs.dev');
|
|
60458
|
+
return `${pathname}?${queryToInject}${search ? `&` + search.slice(1) : ''}${hash || ''}`;
|
|
60459
|
+
}
|
|
60059
60460
|
|
|
60060
60461
|
// ids in transform are normalized to unix style
|
|
60061
60462
|
const normalizedClientEntry = normalizePath$3(CLIENT_ENTRY);
|
|
@@ -60234,324 +60635,6 @@ const wasmFallbackPlugin = () => {
|
|
|
60234
60635
|
};
|
|
60235
60636
|
};
|
|
60236
60637
|
|
|
60237
|
-
const WORKER_FILE_ID = 'worker_file';
|
|
60238
|
-
const workerCache = new WeakMap();
|
|
60239
|
-
function saveEmitWorkerAsset(config, asset) {
|
|
60240
|
-
const fileName = asset.fileName;
|
|
60241
|
-
const workerMap = workerCache.get(config.mainConfig || config);
|
|
60242
|
-
workerMap.assets.set(fileName, asset);
|
|
60243
|
-
}
|
|
60244
|
-
async function bundleWorkerEntry(config, id, query) {
|
|
60245
|
-
// bundle the file as entry to support imports
|
|
60246
|
-
const { rollup } = await import('rollup');
|
|
60247
|
-
const { plugins, rollupOptions, format } = config.worker;
|
|
60248
|
-
const bundle = await rollup({
|
|
60249
|
-
...rollupOptions,
|
|
60250
|
-
input: cleanUrl(id),
|
|
60251
|
-
plugins: await plugins(),
|
|
60252
|
-
onwarn(warning, warn) {
|
|
60253
|
-
onRollupWarning(warning, warn, config);
|
|
60254
|
-
},
|
|
60255
|
-
preserveEntrySignatures: false,
|
|
60256
|
-
});
|
|
60257
|
-
let chunk;
|
|
60258
|
-
try {
|
|
60259
|
-
const workerOutputConfig = config.worker.rollupOptions.output;
|
|
60260
|
-
const workerConfig = workerOutputConfig
|
|
60261
|
-
? Array.isArray(workerOutputConfig)
|
|
60262
|
-
? workerOutputConfig[0] || {}
|
|
60263
|
-
: workerOutputConfig
|
|
60264
|
-
: {};
|
|
60265
|
-
const { output: [outputChunk, ...outputChunks], } = await bundle.generate({
|
|
60266
|
-
entryFileNames: path$o.posix.join(config.build.assetsDir, '[name]-[hash].js'),
|
|
60267
|
-
chunkFileNames: path$o.posix.join(config.build.assetsDir, '[name]-[hash].js'),
|
|
60268
|
-
assetFileNames: path$o.posix.join(config.build.assetsDir, '[name]-[hash].[ext]'),
|
|
60269
|
-
...workerConfig,
|
|
60270
|
-
format,
|
|
60271
|
-
sourcemap: config.build.sourcemap,
|
|
60272
|
-
});
|
|
60273
|
-
chunk = outputChunk;
|
|
60274
|
-
outputChunks.forEach((outputChunk) => {
|
|
60275
|
-
if (outputChunk.type === 'asset') {
|
|
60276
|
-
saveEmitWorkerAsset(config, outputChunk);
|
|
60277
|
-
}
|
|
60278
|
-
else if (outputChunk.type === 'chunk') {
|
|
60279
|
-
saveEmitWorkerAsset(config, {
|
|
60280
|
-
fileName: outputChunk.fileName,
|
|
60281
|
-
source: outputChunk.code,
|
|
60282
|
-
type: 'asset',
|
|
60283
|
-
});
|
|
60284
|
-
}
|
|
60285
|
-
});
|
|
60286
|
-
}
|
|
60287
|
-
finally {
|
|
60288
|
-
await bundle.close();
|
|
60289
|
-
}
|
|
60290
|
-
return emitSourcemapForWorkerEntry(config, query, chunk);
|
|
60291
|
-
}
|
|
60292
|
-
function emitSourcemapForWorkerEntry(config, query, chunk) {
|
|
60293
|
-
const { map: sourcemap } = chunk;
|
|
60294
|
-
if (sourcemap) {
|
|
60295
|
-
if (config.build.sourcemap === 'hidden' ||
|
|
60296
|
-
config.build.sourcemap === true) {
|
|
60297
|
-
const data = sourcemap.toString();
|
|
60298
|
-
const mapFileName = chunk.fileName + '.map';
|
|
60299
|
-
saveEmitWorkerAsset(config, {
|
|
60300
|
-
fileName: mapFileName,
|
|
60301
|
-
type: 'asset',
|
|
60302
|
-
source: data,
|
|
60303
|
-
});
|
|
60304
|
-
}
|
|
60305
|
-
}
|
|
60306
|
-
return chunk;
|
|
60307
|
-
}
|
|
60308
|
-
const workerAssetUrlRE = /__VITE_WORKER_ASSET__([a-z\d]{8})__/g;
|
|
60309
|
-
function encodeWorkerAssetFileName(fileName, workerCache) {
|
|
60310
|
-
const { fileNameHash } = workerCache;
|
|
60311
|
-
const hash = getHash(fileName);
|
|
60312
|
-
if (!fileNameHash.get(hash)) {
|
|
60313
|
-
fileNameHash.set(hash, fileName);
|
|
60314
|
-
}
|
|
60315
|
-
return `__VITE_WORKER_ASSET__${hash}__`;
|
|
60316
|
-
}
|
|
60317
|
-
async function workerFileToUrl(config, id, query) {
|
|
60318
|
-
const workerMap = workerCache.get(config.mainConfig || config);
|
|
60319
|
-
let fileName = workerMap.bundle.get(id);
|
|
60320
|
-
if (!fileName) {
|
|
60321
|
-
const outputChunk = await bundleWorkerEntry(config, id, query);
|
|
60322
|
-
fileName = outputChunk.fileName;
|
|
60323
|
-
saveEmitWorkerAsset(config, {
|
|
60324
|
-
fileName,
|
|
60325
|
-
source: outputChunk.code,
|
|
60326
|
-
type: 'asset',
|
|
60327
|
-
});
|
|
60328
|
-
workerMap.bundle.set(id, fileName);
|
|
60329
|
-
}
|
|
60330
|
-
return encodeWorkerAssetFileName(fileName, workerMap);
|
|
60331
|
-
}
|
|
60332
|
-
function webWorkerPostPlugin() {
|
|
60333
|
-
return {
|
|
60334
|
-
name: 'vite:worker-post',
|
|
60335
|
-
resolveImportMeta(property, { chunkId, format }) {
|
|
60336
|
-
// document is undefined in the worker, so we need to avoid it in iife
|
|
60337
|
-
if (property === 'url' && format === 'iife') {
|
|
60338
|
-
return 'self.location.href';
|
|
60339
|
-
}
|
|
60340
|
-
return null;
|
|
60341
|
-
},
|
|
60342
|
-
};
|
|
60343
|
-
}
|
|
60344
|
-
function webWorkerPlugin(config) {
|
|
60345
|
-
const isBuild = config.command === 'build';
|
|
60346
|
-
let server;
|
|
60347
|
-
const isWorker = config.isWorker;
|
|
60348
|
-
const isWorkerQueryId = (id) => {
|
|
60349
|
-
const parsedQuery = parseRequest(id);
|
|
60350
|
-
if (parsedQuery &&
|
|
60351
|
-
(parsedQuery.worker ?? parsedQuery.sharedworker) != null) {
|
|
60352
|
-
return true;
|
|
60353
|
-
}
|
|
60354
|
-
return false;
|
|
60355
|
-
};
|
|
60356
|
-
return {
|
|
60357
|
-
name: 'vite:worker',
|
|
60358
|
-
configureServer(_server) {
|
|
60359
|
-
server = _server;
|
|
60360
|
-
},
|
|
60361
|
-
buildStart() {
|
|
60362
|
-
if (isWorker) {
|
|
60363
|
-
return;
|
|
60364
|
-
}
|
|
60365
|
-
workerCache.set(config, {
|
|
60366
|
-
assets: new Map(),
|
|
60367
|
-
bundle: new Map(),
|
|
60368
|
-
fileNameHash: new Map(),
|
|
60369
|
-
});
|
|
60370
|
-
},
|
|
60371
|
-
load(id) {
|
|
60372
|
-
if (isBuild && isWorkerQueryId(id)) {
|
|
60373
|
-
return '';
|
|
60374
|
-
}
|
|
60375
|
-
},
|
|
60376
|
-
shouldTransformCachedModule({ id }) {
|
|
60377
|
-
if (isBuild && config.build.watch && isWorkerQueryId(id)) {
|
|
60378
|
-
return true;
|
|
60379
|
-
}
|
|
60380
|
-
},
|
|
60381
|
-
async transform(raw, id, options) {
|
|
60382
|
-
const ssr = options?.ssr === true;
|
|
60383
|
-
const query = parseRequest(id);
|
|
60384
|
-
if (query && query[WORKER_FILE_ID] != null) {
|
|
60385
|
-
// if import worker by worker constructor will have query.type
|
|
60386
|
-
// other type will be import worker by esm
|
|
60387
|
-
const workerType = query['type'];
|
|
60388
|
-
let injectEnv = '';
|
|
60389
|
-
const scriptPath = JSON.stringify(path$o.posix.join(config.base, ENV_PUBLIC_PATH));
|
|
60390
|
-
if (workerType === 'classic') {
|
|
60391
|
-
injectEnv = `importScripts(${scriptPath})\n`;
|
|
60392
|
-
}
|
|
60393
|
-
else if (workerType === 'module') {
|
|
60394
|
-
injectEnv = `import ${scriptPath}\n`;
|
|
60395
|
-
}
|
|
60396
|
-
else if (workerType === 'ignore') {
|
|
60397
|
-
if (isBuild) {
|
|
60398
|
-
injectEnv = '';
|
|
60399
|
-
}
|
|
60400
|
-
else if (server) {
|
|
60401
|
-
// dynamic worker type we can't know how import the env
|
|
60402
|
-
// so we copy /@vite/env code of server transform result into file header
|
|
60403
|
-
const { moduleGraph } = server;
|
|
60404
|
-
const module = moduleGraph.getModuleById(ENV_ENTRY);
|
|
60405
|
-
injectEnv = module?.transformResult?.code || '';
|
|
60406
|
-
}
|
|
60407
|
-
}
|
|
60408
|
-
if (injectEnv) {
|
|
60409
|
-
const s = new MagicString(raw);
|
|
60410
|
-
s.prepend(injectEnv);
|
|
60411
|
-
return {
|
|
60412
|
-
code: s.toString(),
|
|
60413
|
-
map: s.generateMap({ hires: 'boundary' }),
|
|
60414
|
-
};
|
|
60415
|
-
}
|
|
60416
|
-
return;
|
|
60417
|
-
}
|
|
60418
|
-
if (query == null ||
|
|
60419
|
-
(query && (query.worker ?? query.sharedworker) == null)) {
|
|
60420
|
-
return;
|
|
60421
|
-
}
|
|
60422
|
-
// stringified url or `new URL(...)`
|
|
60423
|
-
let url;
|
|
60424
|
-
const { format } = config.worker;
|
|
60425
|
-
const workerConstructor = query.sharedworker != null ? 'SharedWorker' : 'Worker';
|
|
60426
|
-
const workerType = isBuild
|
|
60427
|
-
? format === 'es'
|
|
60428
|
-
? 'module'
|
|
60429
|
-
: 'classic'
|
|
60430
|
-
: 'module';
|
|
60431
|
-
const workerTypeOption = `{
|
|
60432
|
-
${workerType === 'module' ? `type: "module",` : ''}
|
|
60433
|
-
name: options?.name
|
|
60434
|
-
}`;
|
|
60435
|
-
if (isBuild) {
|
|
60436
|
-
getDepsOptimizer(config, ssr)?.registerWorkersSource(id);
|
|
60437
|
-
if (query.inline != null) {
|
|
60438
|
-
const chunk = await bundleWorkerEntry(config, id, query);
|
|
60439
|
-
const encodedJs = `const encodedJs = "${Buffer.from(chunk.code).toString('base64')}";`;
|
|
60440
|
-
const code =
|
|
60441
|
-
// Using blob URL for SharedWorker results in multiple instances of a same worker
|
|
60442
|
-
workerConstructor === 'Worker'
|
|
60443
|
-
? `${encodedJs}
|
|
60444
|
-
const blob = typeof window !== "undefined" && window.Blob && new Blob([${workerType === 'classic'
|
|
60445
|
-
? ''
|
|
60446
|
-
: // `URL` is always available, in `Worker[type="module"]`
|
|
60447
|
-
`'URL.revokeObjectURL(import.meta.url);'+`}atob(encodedJs)], { type: "text/javascript;charset=utf-8" });
|
|
60448
|
-
export default function WorkerWrapper(options) {
|
|
60449
|
-
let objURL;
|
|
60450
|
-
try {
|
|
60451
|
-
objURL = blob && (window.URL || window.webkitURL).createObjectURL(blob);
|
|
60452
|
-
if (!objURL) throw ''
|
|
60453
|
-
const worker = new ${workerConstructor}(objURL, ${workerTypeOption});
|
|
60454
|
-
worker.addEventListener("error", () => {
|
|
60455
|
-
(window.URL || window.webkitURL).revokeObjectURL(objURL);
|
|
60456
|
-
});
|
|
60457
|
-
return worker;
|
|
60458
|
-
} catch(e) {
|
|
60459
|
-
return new ${workerConstructor}(
|
|
60460
|
-
"data:application/javascript;base64," + encodedJs,
|
|
60461
|
-
${workerTypeOption}
|
|
60462
|
-
);
|
|
60463
|
-
}${
|
|
60464
|
-
// For module workers, we should not revoke the URL until the worker runs,
|
|
60465
|
-
// otherwise the worker fails to run
|
|
60466
|
-
workerType === 'classic'
|
|
60467
|
-
? ` finally {
|
|
60468
|
-
objURL && (window.URL || window.webkitURL).revokeObjectURL(objURL);
|
|
60469
|
-
}`
|
|
60470
|
-
: ''}
|
|
60471
|
-
}`
|
|
60472
|
-
: `${encodedJs}
|
|
60473
|
-
export default function WorkerWrapper(options) {
|
|
60474
|
-
return new ${workerConstructor}(
|
|
60475
|
-
"data:application/javascript;base64," + encodedJs,
|
|
60476
|
-
${workerTypeOption}
|
|
60477
|
-
);
|
|
60478
|
-
}
|
|
60479
|
-
`;
|
|
60480
|
-
return {
|
|
60481
|
-
code,
|
|
60482
|
-
// Empty sourcemap to suppress Rollup warning
|
|
60483
|
-
map: { mappings: '' },
|
|
60484
|
-
};
|
|
60485
|
-
}
|
|
60486
|
-
else {
|
|
60487
|
-
url = await workerFileToUrl(config, id, query);
|
|
60488
|
-
}
|
|
60489
|
-
}
|
|
60490
|
-
else {
|
|
60491
|
-
url = await fileToUrl$1(cleanUrl(id), config, this);
|
|
60492
|
-
url = injectQuery(url, WORKER_FILE_ID);
|
|
60493
|
-
url = injectQuery(url, `type=${workerType}`);
|
|
60494
|
-
}
|
|
60495
|
-
if (query.url != null) {
|
|
60496
|
-
return {
|
|
60497
|
-
code: `export default ${JSON.stringify(url)}`,
|
|
60498
|
-
map: { mappings: '' }, // Empty sourcemap to suppress Rollup warning
|
|
60499
|
-
};
|
|
60500
|
-
}
|
|
60501
|
-
return {
|
|
60502
|
-
code: `export default function WorkerWrapper(options) {
|
|
60503
|
-
return new ${workerConstructor}(
|
|
60504
|
-
${JSON.stringify(url)},
|
|
60505
|
-
${workerTypeOption}
|
|
60506
|
-
);
|
|
60507
|
-
}`,
|
|
60508
|
-
map: { mappings: '' }, // Empty sourcemap to suppress Rollup warning
|
|
60509
|
-
};
|
|
60510
|
-
},
|
|
60511
|
-
renderChunk(code, chunk, outputOptions) {
|
|
60512
|
-
let s;
|
|
60513
|
-
const result = () => {
|
|
60514
|
-
return (s && {
|
|
60515
|
-
code: s.toString(),
|
|
60516
|
-
map: config.build.sourcemap
|
|
60517
|
-
? s.generateMap({ hires: 'boundary' })
|
|
60518
|
-
: null,
|
|
60519
|
-
});
|
|
60520
|
-
};
|
|
60521
|
-
if (code.match(workerAssetUrlRE)) {
|
|
60522
|
-
const toRelativeRuntime = createToImportMetaURLBasedRelativeRuntime(outputOptions.format, config.isWorker);
|
|
60523
|
-
let match;
|
|
60524
|
-
s = new MagicString(code);
|
|
60525
|
-
workerAssetUrlRE.lastIndex = 0;
|
|
60526
|
-
// Replace "__VITE_WORKER_ASSET__5aa0ddc0__" using relative paths
|
|
60527
|
-
const workerMap = workerCache.get(config.mainConfig || config);
|
|
60528
|
-
const { fileNameHash } = workerMap;
|
|
60529
|
-
while ((match = workerAssetUrlRE.exec(code))) {
|
|
60530
|
-
const [full, hash] = match;
|
|
60531
|
-
const filename = fileNameHash.get(hash);
|
|
60532
|
-
const replacement = toOutputFilePathInJS(filename, 'asset', chunk.fileName, 'js', config, toRelativeRuntime);
|
|
60533
|
-
const replacementString = typeof replacement === 'string'
|
|
60534
|
-
? JSON.stringify(replacement).slice(1, -1)
|
|
60535
|
-
: `"+${replacement.runtime}+"`;
|
|
60536
|
-
s.update(match.index, match.index + full.length, replacementString);
|
|
60537
|
-
}
|
|
60538
|
-
}
|
|
60539
|
-
return result();
|
|
60540
|
-
},
|
|
60541
|
-
generateBundle(opts) {
|
|
60542
|
-
// @ts-expect-error asset emits are skipped in legacy bundle
|
|
60543
|
-
if (opts.__vite_skip_asset_emit__ || isWorker) {
|
|
60544
|
-
return;
|
|
60545
|
-
}
|
|
60546
|
-
const workerMap = workerCache.get(config);
|
|
60547
|
-
workerMap.assets.forEach((asset) => {
|
|
60548
|
-
this.emitFile(asset);
|
|
60549
|
-
workerMap.assets.delete(asset.fileName);
|
|
60550
|
-
});
|
|
60551
|
-
},
|
|
60552
|
-
};
|
|
60553
|
-
}
|
|
60554
|
-
|
|
60555
60638
|
/**
|
|
60556
60639
|
* A plugin to avoid an aliased AND optimized dep from being aliased in src
|
|
60557
60640
|
*/
|
|
@@ -61225,13 +61308,7 @@ function dynamicImportVarsPlugin(config) {
|
|
|
61225
61308
|
s ||= new MagicString(source);
|
|
61226
61309
|
let result;
|
|
61227
61310
|
try {
|
|
61228
|
-
|
|
61229
|
-
// until the closing parenthesis, instead of the closing backtick.
|
|
61230
|
-
// There may be inline comments between the backtick and the closing
|
|
61231
|
-
// parenthesis, so we manually remove them for now.
|
|
61232
|
-
// See https://github.com/guybedford/es-module-lexer/issues/118
|
|
61233
|
-
const importSource = removeComments(source.slice(start, end)).trim();
|
|
61234
|
-
result = await transformDynamicImport(importSource, importer, resolve, config.root);
|
|
61311
|
+
result = await transformDynamicImport(source.slice(start, end), importer, resolve, config.root);
|
|
61235
61312
|
}
|
|
61236
61313
|
catch (error) {
|
|
61237
61314
|
if (warnOnError) {
|
|
@@ -61277,7 +61354,10 @@ async function resolvePlugins(config, prePlugins, normalPlugins, postPlugins) {
|
|
|
61277
61354
|
isBuild ? metadataPlugin() : null,
|
|
61278
61355
|
!isWorker ? watchPackageDataPlugin(config.packageCache) : null,
|
|
61279
61356
|
preAliasPlugin(config),
|
|
61280
|
-
alias$1({
|
|
61357
|
+
alias$1({
|
|
61358
|
+
entries: config.resolve.alias,
|
|
61359
|
+
customResolver: viteAliasCustomResolver,
|
|
61360
|
+
}),
|
|
61281
61361
|
...prePlugins,
|
|
61282
61362
|
modulePreload !== false && modulePreload.polyfill
|
|
61283
61363
|
? modulePreloadPolyfillPlugin(config)
|
|
@@ -61367,6 +61447,12 @@ function getSortedPluginsByHook(hookName, plugins) {
|
|
|
61367
61447
|
function getHookHandler(hook) {
|
|
61368
61448
|
return (typeof hook === 'object' ? hook.handler : hook);
|
|
61369
61449
|
}
|
|
61450
|
+
// Same as `@rollup/plugin-alias` default resolver, but we attach additional meta
|
|
61451
|
+
// if we can't resolve to something, which will error in `importAnalysis`
|
|
61452
|
+
const viteAliasCustomResolver = async function (id, importer, options) {
|
|
61453
|
+
const resolved = await this.resolve(id, importer, options);
|
|
61454
|
+
return resolved || { id, meta: { 'vite:alias': { noResolved: true } } };
|
|
61455
|
+
};
|
|
61370
61456
|
|
|
61371
61457
|
/**
|
|
61372
61458
|
* This file is refactored into TypeScript based on
|
|
@@ -61423,6 +61509,8 @@ async function createPluginContainer(config, moduleGraph, watcher) {
|
|
|
61423
61509
|
});
|
|
61424
61510
|
// ---------------------------------------------------------------------------
|
|
61425
61511
|
const watchFiles = new Set();
|
|
61512
|
+
// _addedFiles from the `load()` hook gets saved here so it can be reused in the `transform()` hook
|
|
61513
|
+
const moduleNodeToLoadAddedImports = new WeakMap();
|
|
61426
61514
|
const minimalContext = {
|
|
61427
61515
|
meta: {
|
|
61428
61516
|
rollupVersion: VERSION,
|
|
@@ -61492,6 +61580,12 @@ async function createPluginContainer(config, moduleGraph, watcher) {
|
|
|
61492
61580
|
}
|
|
61493
61581
|
}
|
|
61494
61582
|
}
|
|
61583
|
+
function updateModuleLoadAddedImports(id, ctx) {
|
|
61584
|
+
const module = moduleGraph?.getModuleById(id);
|
|
61585
|
+
if (module) {
|
|
61586
|
+
moduleNodeToLoadAddedImports.set(module, ctx._addedImports);
|
|
61587
|
+
}
|
|
61588
|
+
}
|
|
61495
61589
|
// we should create a new context for each async hook pipeline so that the
|
|
61496
61590
|
// active plugin in that pipeline can be tracked in a concurrency-safe manner.
|
|
61497
61591
|
// using a class to make creating new contexts more efficient
|
|
@@ -61534,7 +61628,11 @@ async function createPluginContainer(config, moduleGraph, watcher) {
|
|
|
61534
61628
|
// Not all options passed to this function make sense in the context of loading individual files,
|
|
61535
61629
|
// but we can at least update the module info properties we support
|
|
61536
61630
|
updateModuleInfo(options.id, options);
|
|
61537
|
-
await container.load(options.id, { ssr: this.ssr });
|
|
61631
|
+
const loadResult = await container.load(options.id, { ssr: this.ssr });
|
|
61632
|
+
const code = typeof loadResult === 'object' ? loadResult?.code : loadResult;
|
|
61633
|
+
if (code != null) {
|
|
61634
|
+
await container.transform(code, options.id, { ssr: this.ssr });
|
|
61635
|
+
}
|
|
61538
61636
|
const moduleInfo = this.getModuleInfo(options.id);
|
|
61539
61637
|
// This shouldn't happen due to calling ensureEntryFromUrl, but 1) our types can't ensure that
|
|
61540
61638
|
// and 2) moduleGraph may not have been provided (though in the situations where that happens,
|
|
@@ -61688,9 +61786,9 @@ async function createPluginContainer(config, moduleGraph, watcher) {
|
|
|
61688
61786
|
originalSourcemap = null;
|
|
61689
61787
|
sourcemapChain = [];
|
|
61690
61788
|
combinedMap = null;
|
|
61691
|
-
constructor(
|
|
61789
|
+
constructor(id, code, inMap) {
|
|
61692
61790
|
super();
|
|
61693
|
-
this.filename =
|
|
61791
|
+
this.filename = id;
|
|
61694
61792
|
this.originalCode = code;
|
|
61695
61793
|
if (inMap) {
|
|
61696
61794
|
if (debugSourcemapCombine) {
|
|
@@ -61699,6 +61797,11 @@ async function createPluginContainer(config, moduleGraph, watcher) {
|
|
|
61699
61797
|
}
|
|
61700
61798
|
this.sourcemapChain.push(inMap);
|
|
61701
61799
|
}
|
|
61800
|
+
// Inherit `_addedImports` from the `load()` hook
|
|
61801
|
+
const node = moduleGraph?.getModuleById(id);
|
|
61802
|
+
if (node) {
|
|
61803
|
+
this._addedImports = moduleNodeToLoadAddedImports.get(node) ?? null;
|
|
61804
|
+
}
|
|
61702
61805
|
}
|
|
61703
61806
|
_getCombinedSourcemap() {
|
|
61704
61807
|
if (debugSourcemapCombine &&
|
|
@@ -61857,9 +61960,11 @@ async function createPluginContainer(config, moduleGraph, watcher) {
|
|
|
61857
61960
|
if (isObject$1(result)) {
|
|
61858
61961
|
updateModuleInfo(id, result);
|
|
61859
61962
|
}
|
|
61963
|
+
updateModuleLoadAddedImports(id, ctx);
|
|
61860
61964
|
return result;
|
|
61861
61965
|
}
|
|
61862
61966
|
}
|
|
61967
|
+
updateModuleLoadAddedImports(id, ctx);
|
|
61863
61968
|
return null;
|
|
61864
61969
|
},
|
|
61865
61970
|
async transform(code, id, options) {
|
|
@@ -61922,9 +62027,6 @@ async function createPluginContainer(config, moduleGraph, watcher) {
|
|
|
61922
62027
|
await hookParallel('buildEnd', () => ctx, () => []);
|
|
61923
62028
|
await hookParallel('closeBundle', () => ctx, () => []);
|
|
61924
62029
|
},
|
|
61925
|
-
[ASYNC_DISPOSE]() {
|
|
61926
|
-
return this.close();
|
|
61927
|
-
},
|
|
61928
62030
|
};
|
|
61929
62031
|
return container;
|
|
61930
62032
|
}
|
|
@@ -62638,9 +62740,6 @@ async function createDepsOptimizer(config, server) {
|
|
|
62638
62740
|
resetRegisteredIds,
|
|
62639
62741
|
ensureFirstRun,
|
|
62640
62742
|
close,
|
|
62641
|
-
[ASYNC_DISPOSE]() {
|
|
62642
|
-
return this.close();
|
|
62643
|
-
},
|
|
62644
62743
|
options: getDepOptimizationConfig(config, ssr),
|
|
62645
62744
|
};
|
|
62646
62745
|
depsOptimizerMap.set(config, depsOptimizer);
|
|
@@ -63175,7 +63274,6 @@ async function createDevSsrDepsOptimizer(config) {
|
|
|
63175
63274
|
resetRegisteredIds: () => { },
|
|
63176
63275
|
ensureFirstRun: () => { },
|
|
63177
63276
|
close: async () => { },
|
|
63178
|
-
[ASYNC_DISPOSE]: async () => { },
|
|
63179
63277
|
options: config.ssr.optimizeDeps,
|
|
63180
63278
|
};
|
|
63181
63279
|
devSsrDepsOptimizerMap.set(config, depsOptimizer);
|
|
@@ -64056,7 +64154,7 @@ const dynamicImportPrefixRE = /import\s*\(/;
|
|
|
64056
64154
|
const optimizedDepChunkRE = /\/chunk-[A-Z\d]{8}\.js/;
|
|
64057
64155
|
const optimizedDepDynamicRE = /-[A-Z\d]{8}\.js/;
|
|
64058
64156
|
function toRelativePath(filename, importer) {
|
|
64059
|
-
const relPath = path$o.relative(path$o.dirname(importer), filename);
|
|
64157
|
+
const relPath = path$o.posix.relative(path$o.posix.dirname(importer), filename);
|
|
64060
64158
|
return relPath[0] === '.' ? relPath : `./${relPath}`;
|
|
64061
64159
|
}
|
|
64062
64160
|
function indexOfMatchInSlice(str, reg, pos = 0) {
|
|
@@ -64191,7 +64289,8 @@ function buildImportAnalysisPlugin(config) {
|
|
|
64191
64289
|
try {
|
|
64192
64290
|
imports = parse$e(source)[0];
|
|
64193
64291
|
}
|
|
64194
|
-
catch (
|
|
64292
|
+
catch (_e) {
|
|
64293
|
+
const e = _e;
|
|
64195
64294
|
const { message, showCodeFrame } = createParseErrorInfo(importer, source);
|
|
64196
64295
|
this.error(message, showCodeFrame ? e.idx : undefined);
|
|
64197
64296
|
}
|
|
@@ -64372,13 +64471,6 @@ function buildImportAnalysisPlugin(config) {
|
|
|
64372
64471
|
return index;
|
|
64373
64472
|
}
|
|
64374
64473
|
};
|
|
64375
|
-
const getFileDep = (index) => {
|
|
64376
|
-
const fileDep = fileDeps[index];
|
|
64377
|
-
if (!fileDep) {
|
|
64378
|
-
throw new Error(`Cannot find file dep at index ${index}`);
|
|
64379
|
-
}
|
|
64380
|
-
return fileDep;
|
|
64381
|
-
};
|
|
64382
64474
|
if (imports.length) {
|
|
64383
64475
|
for (let index = 0; index < imports.length; index++) {
|
|
64384
64476
|
// To handle escape sequences in specifier strings, the .n field will be provided where possible.
|
|
@@ -64406,12 +64498,12 @@ function buildImportAnalysisPlugin(config) {
|
|
|
64406
64498
|
analyzed.add(filename);
|
|
64407
64499
|
const chunk = bundle[filename];
|
|
64408
64500
|
if (chunk) {
|
|
64409
|
-
deps.add(
|
|
64501
|
+
deps.add(chunk.fileName);
|
|
64410
64502
|
chunk.imports.forEach(addDeps);
|
|
64411
64503
|
// Ensure that the css imported by current chunk is loaded after the dependencies.
|
|
64412
64504
|
// So the style of current chunk won't be overwritten unexpectedly.
|
|
64413
64505
|
chunk.viteMetadata.importedCss.forEach((file) => {
|
|
64414
|
-
deps.add(
|
|
64506
|
+
deps.add(file);
|
|
64415
64507
|
});
|
|
64416
64508
|
}
|
|
64417
64509
|
else {
|
|
@@ -64420,7 +64512,7 @@ function buildImportAnalysisPlugin(config) {
|
|
|
64420
64512
|
if (chunk) {
|
|
64421
64513
|
if (chunk.viteMetadata.importedCss.size) {
|
|
64422
64514
|
chunk.viteMetadata.importedCss.forEach((file) => {
|
|
64423
|
-
deps.add(
|
|
64515
|
+
deps.add(file);
|
|
64424
64516
|
});
|
|
64425
64517
|
hasRemovedPureCssChunk = true;
|
|
64426
64518
|
}
|
|
@@ -64443,7 +64535,7 @@ function buildImportAnalysisPlugin(config) {
|
|
|
64443
64535
|
? modulePreload === false
|
|
64444
64536
|
? // CSS deps use the same mechanism as module preloads, so even if disabled,
|
|
64445
64537
|
// we still need to pass these deps to the preload helper in dynamic imports.
|
|
64446
|
-
[...deps].filter((d) =>
|
|
64538
|
+
[...deps].filter((d) => d.endsWith('.css'))
|
|
64447
64539
|
: [...deps]
|
|
64448
64540
|
: [];
|
|
64449
64541
|
let renderedDeps;
|
|
@@ -64459,18 +64551,13 @@ function buildImportAnalysisPlugin(config) {
|
|
|
64459
64551
|
const cssDeps = [];
|
|
64460
64552
|
const otherDeps = [];
|
|
64461
64553
|
for (const dep of depsArray) {
|
|
64462
|
-
|
|
64463
|
-
cssDeps.push(dep);
|
|
64464
|
-
}
|
|
64465
|
-
else {
|
|
64466
|
-
otherDeps.push(dep);
|
|
64467
|
-
}
|
|
64554
|
+
(dep.endsWith('.css') ? cssDeps : otherDeps).push(dep);
|
|
64468
64555
|
}
|
|
64469
64556
|
resolvedDeps = [
|
|
64470
|
-
...resolveDependencies(normalizedFile, otherDeps
|
|
64557
|
+
...resolveDependencies(normalizedFile, otherDeps, {
|
|
64471
64558
|
hostId: file,
|
|
64472
64559
|
hostType: 'js',
|
|
64473
|
-
})
|
|
64560
|
+
}),
|
|
64474
64561
|
...cssDeps,
|
|
64475
64562
|
];
|
|
64476
64563
|
}
|
|
@@ -64478,7 +64565,7 @@ function buildImportAnalysisPlugin(config) {
|
|
|
64478
64565
|
resolvedDeps = depsArray;
|
|
64479
64566
|
}
|
|
64480
64567
|
renderedDeps = resolvedDeps.map((dep) => {
|
|
64481
|
-
const replacement = toOutputFilePathInJS(
|
|
64568
|
+
const replacement = toOutputFilePathInJS(dep, 'asset', chunk.fileName, 'js', config, toRelativePath);
|
|
64482
64569
|
if (typeof replacement === 'string') {
|
|
64483
64570
|
return addFileDep(replacement);
|
|
64484
64571
|
}
|
|
@@ -64490,8 +64577,8 @@ function buildImportAnalysisPlugin(config) {
|
|
|
64490
64577
|
// Don't include the assets dir if the default asset file names
|
|
64491
64578
|
// are used, the path will be reconstructed by the import preload helper
|
|
64492
64579
|
optimizeModulePreloadRelativePaths
|
|
64493
|
-
? addFileDep(toRelativePath(
|
|
64494
|
-
: d);
|
|
64580
|
+
? addFileDep(toRelativePath(d, file))
|
|
64581
|
+
: addFileDep(d));
|
|
64495
64582
|
}
|
|
64496
64583
|
s.update(markerStartPos, markerStartPos + preloadMarker.length + 2, `__vite__mapDeps([${renderedDeps.join(',')}])`);
|
|
64497
64584
|
rewroteMarkerStartPos.add(markerStartPos);
|
|
@@ -64580,7 +64667,8 @@ function ssrManifestPlugin(config) {
|
|
|
64580
64667
|
try {
|
|
64581
64668
|
imports = parse$e(code)[0].filter((i) => i.n && i.d > -1);
|
|
64582
64669
|
}
|
|
64583
|
-
catch (
|
|
64670
|
+
catch (_e) {
|
|
64671
|
+
const e = _e;
|
|
64584
64672
|
const loc = numberToPos(code, e.idx);
|
|
64585
64673
|
this.error({
|
|
64586
64674
|
name: e.name,
|
|
@@ -64830,6 +64918,16 @@ async function build(inlineConfig = {}) {
|
|
|
64830
64918
|
throw new Error(`rollupOptions.input should not be an html file when building for SSR. ` +
|
|
64831
64919
|
`Please specify a dedicated SSR entry.`);
|
|
64832
64920
|
}
|
|
64921
|
+
if (config.build.cssCodeSplit === false) {
|
|
64922
|
+
const inputs = typeof input === 'string'
|
|
64923
|
+
? [input]
|
|
64924
|
+
: Array.isArray(input)
|
|
64925
|
+
? input
|
|
64926
|
+
: Object.values(input);
|
|
64927
|
+
if (inputs.some((input) => input.endsWith('.css'))) {
|
|
64928
|
+
throw new Error(`When "build.cssCodeSplit: false" is set, "rollupOptions.input" should not include CSS files.`);
|
|
64929
|
+
}
|
|
64930
|
+
}
|
|
64833
64931
|
const outDir = resolve(options.outDir);
|
|
64834
64932
|
// inject ssr arg to plugin load/transform hooks
|
|
64835
64933
|
const plugins = (ssr ? config.plugins.map((p) => injectSsrFlagToHooks(p)) : config.plugins);
|
|
@@ -64859,6 +64957,7 @@ async function build(inlineConfig = {}) {
|
|
|
64859
64957
|
if (e.frame) {
|
|
64860
64958
|
msg += `\n` + colors$1.yellow(e.frame);
|
|
64861
64959
|
}
|
|
64960
|
+
clearLine();
|
|
64862
64961
|
config.logger.error(msg, { error: e });
|
|
64863
64962
|
};
|
|
64864
64963
|
let bundle;
|
|
@@ -64870,6 +64969,14 @@ async function build(inlineConfig = {}) {
|
|
|
64870
64969
|
`This is deprecated and will override all Vite.js default output options. ` +
|
|
64871
64970
|
`Please use "rollupOptions.output" instead.`);
|
|
64872
64971
|
}
|
|
64972
|
+
if (output.file) {
|
|
64973
|
+
throw new Error(`Vite does not support "rollupOptions.output.file". ` +
|
|
64974
|
+
`Please use "rollupOptions.output.dir" and "rollupOptions.output.entryFileNames" instead.`);
|
|
64975
|
+
}
|
|
64976
|
+
if (output.sourcemap) {
|
|
64977
|
+
config.logger.warnOnce(colors$1.yellow(`Vite does not support "rollupOptions.output.sourcemap". ` +
|
|
64978
|
+
`Please use "build.sourcemap" instead.`));
|
|
64979
|
+
}
|
|
64873
64980
|
const ssrNodeBuild = ssr && config.ssr.target === 'node';
|
|
64874
64981
|
const ssrWorkerBuild = ssr && config.ssr.target === 'webworker';
|
|
64875
64982
|
const format = output.format || 'es';
|
|
@@ -65072,6 +65179,13 @@ const dynamicImportWarningIgnoreList = [
|
|
|
65072
65179
|
`Unsupported expression`,
|
|
65073
65180
|
`statically analyzed`,
|
|
65074
65181
|
];
|
|
65182
|
+
function clearLine() {
|
|
65183
|
+
const tty = process.stdout.isTTY && !process.env.CI;
|
|
65184
|
+
if (tty) {
|
|
65185
|
+
process.stdout.clearLine(0);
|
|
65186
|
+
process.stdout.cursorTo(0);
|
|
65187
|
+
}
|
|
65188
|
+
}
|
|
65075
65189
|
function onRollupWarning(warning, warn, config) {
|
|
65076
65190
|
const viteWarn = (warnLog) => {
|
|
65077
65191
|
let warning;
|
|
@@ -65109,11 +65223,7 @@ function onRollupWarning(warning, warn, config) {
|
|
|
65109
65223
|
}
|
|
65110
65224
|
warn(warnLog);
|
|
65111
65225
|
};
|
|
65112
|
-
|
|
65113
|
-
if (tty) {
|
|
65114
|
-
process.stdout.clearLine(0);
|
|
65115
|
-
process.stdout.cursorTo(0);
|
|
65116
|
-
}
|
|
65226
|
+
clearLine();
|
|
65117
65227
|
const userOnWarn = config.build.rollupOptions?.onwarn;
|
|
65118
65228
|
if (userOnWarn) {
|
|
65119
65229
|
userOnWarn(warning, viteWarn);
|