vite 6.0.0-beta.0 → 6.0.0-beta.2
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 +4 -6
- package/dist/node/chunks/{dep-Bv1xMYNy.js → dep-BHXIdTzn.js} +290 -180
- package/dist/node/chunks/{dep-CSD_20z-.js → dep-BabmomGK.js} +1 -1
- package/dist/node/chunks/{dep-D9t7igss.js → dep-DTHr9Se7.js} +1 -1
- package/dist/node/cli.js +7 -7
- package/dist/node/constants.js +7 -2
- package/dist/node/index.d.ts +42 -20
- package/dist/node/index.js +7 -115
- package/dist/node/module-runner.d.ts +71 -49
- package/dist/node/module-runner.js +141 -149
- package/dist/node-cjs/publicUtils.cjs +137 -12
- package/package.json +13 -13
@@ -1,15 +1,15 @@
|
|
1
1
|
import * as fs$j from 'node:fs';
|
2
|
-
import fs__default, { promises as promises$1 } from 'node:fs';
|
2
|
+
import fs__default, { promises as promises$1, existsSync as existsSync$1, readFileSync as readFileSync$1 } from 'node:fs';
|
3
3
|
import fsp, { lstat as lstat$3, readdir as readdir$5, readlink, realpath as realpath$2 } from 'node:fs/promises';
|
4
4
|
import path$n, { win32 as win32$1, posix as posix$1, isAbsolute as isAbsolute$1, join as join$2, dirname as dirname$2, relative as relative$2, basename as basename$2, extname as extname$1 } from 'node:path';
|
5
|
-
import { fileURLToPath, URL as URL$3,
|
5
|
+
import { fileURLToPath, URL as URL$3, pathToFileURL } from 'node:url';
|
6
6
|
import { promisify as promisify$4, format as format$2, inspect } from 'node:util';
|
7
7
|
import { performance as performance$1 } from 'node:perf_hooks';
|
8
8
|
import { createRequire as createRequire$1, builtinModules } from 'node:module';
|
9
9
|
import require$$0$3 from 'tty';
|
10
10
|
import esbuild, { transform as transform$1, formatMessages, build as build$3 } from 'esbuild';
|
11
|
-
import require$$0$4, {
|
12
|
-
import { CLIENT_ENTRY, OPTIMIZABLE_ENTRY_RE, wildcardHosts, loopbackHosts, FS_PREFIX, CLIENT_PUBLIC_PATH, ENV_PUBLIC_PATH, DEFAULT_ASSETS_INLINE_LIMIT, ENV_ENTRY, SPECIAL_QUERY_RE, DEP_VERSION_RE, DEFAULT_MAIN_FIELDS, DEFAULT_EXTENSIONS, KNOWN_ASSET_TYPES, JS_TYPES_RE, CSS_LANGS_RE, METADATA_FILENAME, ESBUILD_MODULES_TARGET, VITE_PACKAGE_DIR, CLIENT_DIR, DEFAULT_DEV_PORT, VERSION, ROLLUP_HOOKS, DEFAULT_PREVIEW_PORT, DEFAULT_ASSETS_RE, DEFAULT_CONFIG_FILES } from '../constants.js';
|
11
|
+
import require$$0$4, { posix, win32, isAbsolute, resolve as resolve$3, relative as relative$1, basename as basename$1, extname, dirname as dirname$1, join as join$1, sep as sep$1, normalize as normalize$1 } from 'path';
|
12
|
+
import { CLIENT_ENTRY, OPTIMIZABLE_ENTRY_RE, wildcardHosts, loopbackHosts, FS_PREFIX, CLIENT_PUBLIC_PATH, ENV_PUBLIC_PATH, DEFAULT_ASSETS_INLINE_LIMIT, ENV_ENTRY, SPECIAL_QUERY_RE, DEP_VERSION_RE, DEFAULT_MAIN_FIELDS, DEFAULT_EXTENSIONS, KNOWN_ASSET_TYPES, JS_TYPES_RE, CSS_LANGS_RE, METADATA_FILENAME, ESBUILD_MODULES_TARGET, ERR_OPTIMIZE_DEPS_PROCESSING_ERROR, ERR_OUTDATED_OPTIMIZED_DEP, ERR_FILE_NOT_FOUND_IN_OPTIMIZED_DEP_DIR, VITE_PACKAGE_DIR, CLIENT_DIR, DEFAULT_DEV_PORT, VERSION, ROLLUP_HOOKS, DEFAULT_PREVIEW_PORT, DEFAULT_ASSETS_RE, DEFAULT_CONFIG_FILES } from '../constants.js';
|
13
13
|
import * as require$$0$2 from 'fs';
|
14
14
|
import require$$0__default, { lstatSync, readdir as readdir$4, readdirSync, readlinkSync, realpathSync as realpathSync$1, existsSync, readFileSync, statSync as statSync$1 } from 'fs';
|
15
15
|
import { EventEmitter as EventEmitter$4 } from 'node:events';
|
@@ -31,13 +31,13 @@ import { createHash as createHash$2 } from 'node:crypto';
|
|
31
31
|
import { promises } from 'node:dns';
|
32
32
|
import { ModuleRunner, ESModulesEvaluator } from 'vite/module-runner';
|
33
33
|
import { parseAstAsync, parseAst } from 'rollup/parseAst';
|
34
|
+
import readline from 'node:readline';
|
35
|
+
import require$$3$1 from 'crypto';
|
34
36
|
import require$$0$8, { createRequire as createRequire$2 } from 'module';
|
35
37
|
import assert$1 from 'node:assert';
|
36
38
|
import v8 from 'node:v8';
|
37
39
|
import { Worker as Worker$1 } from 'node:worker_threads';
|
38
|
-
import require$$3$1 from 'crypto';
|
39
40
|
import { Buffer as Buffer$1 } from 'node:buffer';
|
40
|
-
import readline from 'node:readline';
|
41
41
|
import zlib$1 from 'zlib';
|
42
42
|
import require$$0$a from 'buffer';
|
43
43
|
import require$$1$1 from 'https';
|
@@ -2265,19 +2265,16 @@ const postfixRE = /[?#].*$/;
|
|
2265
2265
|
function cleanUrl(url) {
|
2266
2266
|
return url.replace(postfixRE, "");
|
2267
2267
|
}
|
2268
|
+
function splitFileAndPostfix(path) {
|
2269
|
+
const file = cleanUrl(path);
|
2270
|
+
return { file, postfix: path.slice(file.length) };
|
2271
|
+
}
|
2268
2272
|
function withTrailingSlash(path) {
|
2269
2273
|
if (path[path.length - 1] !== "/") {
|
2270
2274
|
return `${path}/`;
|
2271
2275
|
}
|
2272
2276
|
return path;
|
2273
2277
|
}
|
2274
|
-
const AsyncFunction = async function() {
|
2275
|
-
}.constructor;
|
2276
|
-
const asyncFunctionDeclarationPaddingLineCount = /* @__PURE__ */ (() => {
|
2277
|
-
const body = "/*code*/";
|
2278
|
-
const source = new AsyncFunction("a", "b", body).toString();
|
2279
|
-
return source.slice(0, source.indexOf(body)).split("\n").length - 1;
|
2280
|
-
})();
|
2281
2278
|
|
2282
2279
|
// @ts-check
|
2283
2280
|
/** @typedef { import('estree').BaseNode} BaseNode */
|
@@ -2554,7 +2551,7 @@ const attachScopes = function attachScopes(ast, propertyName = 'scope') {
|
|
2554
2551
|
const node = n;
|
2555
2552
|
// function foo () {...}
|
2556
2553
|
// class Foo {...}
|
2557
|
-
if (/(Function|Class)Declaration/.test(node.type)) {
|
2554
|
+
if (/(?:Function|Class)Declaration/.test(node.type)) {
|
2558
2555
|
scope.addDeclaration(node, false, false);
|
2559
2556
|
}
|
2560
2557
|
// var foo = 1
|
@@ -2581,7 +2578,7 @@ const attachScopes = function attachScopes(ast, propertyName = 'scope') {
|
|
2581
2578
|
}
|
2582
2579
|
}
|
2583
2580
|
// create new for scope
|
2584
|
-
if (/For(In|Of)?Statement/.test(node.type)) {
|
2581
|
+
if (/For(?:In|Of)?Statement/.test(node.type)) {
|
2585
2582
|
newScope = new Scope({
|
2586
2583
|
parent: scope,
|
2587
2584
|
block: true
|
@@ -2631,8 +2628,9 @@ function ensureArray(thing) {
|
|
2631
2628
|
return [thing];
|
2632
2629
|
}
|
2633
2630
|
|
2631
|
+
const normalizePathRegExp = new RegExp(`\\${win32.sep}`, 'g');
|
2634
2632
|
const normalizePath$5 = function normalizePath(filename) {
|
2635
|
-
return filename.
|
2633
|
+
return filename.replace(normalizePathRegExp, posix.sep);
|
2636
2634
|
};
|
2637
2635
|
|
2638
2636
|
function getMatcherString(id, resolutionBase) {
|
@@ -2664,10 +2662,12 @@ const createFilter$1 = function createFilter(include, exclude, options) {
|
|
2664
2662
|
};
|
2665
2663
|
const includeMatchers = ensureArray(include).map(getMatcher);
|
2666
2664
|
const excludeMatchers = ensureArray(exclude).map(getMatcher);
|
2665
|
+
if (!includeMatchers.length && !excludeMatchers.length)
|
2666
|
+
return (id) => typeof id === 'string' && !id.includes('\0');
|
2667
2667
|
return function result(id) {
|
2668
2668
|
if (typeof id !== 'string')
|
2669
2669
|
return false;
|
2670
|
-
if (
|
2670
|
+
if (id.includes('\0'))
|
2671
2671
|
return false;
|
2672
2672
|
const pathId = normalizePath$5(id);
|
2673
2673
|
for (let i = 0; i < excludeMatchers.length; ++i) {
|
@@ -2778,7 +2778,7 @@ const dataToEsm = function dataToEsm(data, options = {}) {
|
|
2778
2778
|
}
|
2779
2779
|
let maxUnderbarPrefixLength = 0;
|
2780
2780
|
for (const key of Object.keys(data)) {
|
2781
|
-
const underbarPrefixLength = (_b = (_a =
|
2781
|
+
const underbarPrefixLength = (_b = (_a = /^(_+)/.exec(key)) === null || _a === void 0 ? void 0 : _a[0].length) !== null && _b !== void 0 ? _b : 0;
|
2782
2782
|
if (underbarPrefixLength > maxUnderbarPrefixLength) {
|
2783
2783
|
maxUnderbarPrefixLength = underbarPrefixLength;
|
2784
2784
|
}
|
@@ -12185,7 +12185,7 @@ function isReference(node, parent) {
|
|
12185
12185
|
return false;
|
12186
12186
|
}
|
12187
12187
|
|
12188
|
-
var version$2 = "26.0.
|
12188
|
+
var version$2 = "26.0.3";
|
12189
12189
|
var peerDependencies = {
|
12190
12190
|
rollup: "^2.68.0||^3.0.0||^4.0.0"
|
12191
12191
|
};
|
@@ -16706,11 +16706,8 @@ function isOptimizable(id, optimizeDeps) {
|
|
16706
16706
|
const bareImportRE = /^(?![a-zA-Z]:)[\w@](?!.*:\/\/)/;
|
16707
16707
|
const deepImportRE = /^([^@][^/]*)\/|^(@[^/]+\/[^/]+)\//;
|
16708
16708
|
const _require$1 = createRequire$1(import.meta.url);
|
16709
|
-
|
16710
|
-
|
16711
|
-
return JSON.parse(fs__default.readFileSync(pkgPath, "utf-8")).version;
|
16712
|
-
}
|
16713
|
-
const rollupVersion = resolveDependencyVersion("rollup");
|
16709
|
+
const _dirname = path$n.dirname(fileURLToPath(import.meta.url));
|
16710
|
+
const rollupVersion = resolvePackageData("rollup", _dirname, true)?.data.version ?? "";
|
16714
16711
|
const filter = process.env.VITE_DEBUG_FILTER;
|
16715
16712
|
const DEBUG = process.env.DEBUG;
|
16716
16713
|
function createDebugger(namespace, options = {}) {
|
@@ -17329,7 +17326,6 @@ function getHash(text, length = 8) {
|
|
17329
17326
|
if (length <= 64) return h;
|
17330
17327
|
return h.padEnd(length, "_");
|
17331
17328
|
}
|
17332
|
-
const _dirname = path$n.dirname(fileURLToPath(import.meta.url));
|
17333
17329
|
const requireResolveFromRootWithFallback = (root, id) => {
|
17334
17330
|
const found = resolvePackageData(id, root) || resolvePackageData(id, _dirname);
|
17335
17331
|
if (!found) {
|
@@ -17797,7 +17793,7 @@ function buildReporterPlugin(config) {
|
|
17797
17793
|
let chunkCount = 0;
|
17798
17794
|
let compressedCount = 0;
|
17799
17795
|
async function getCompressedSize(code) {
|
17800
|
-
if (environment.config.
|
17796
|
+
if (environment.config.consumer !== "client" || !environment.config.build.reportCompressedSize) {
|
17801
17797
|
return null;
|
17802
17798
|
}
|
17803
17799
|
if (shouldLogInfo && !hasCompressChunk) {
|
@@ -17928,7 +17924,7 @@ function buildReporterPlugin(config) {
|
|
17928
17924
|
return chunk.type === "chunk" && chunk.code.length / 1e3 > chunkLimit;
|
17929
17925
|
});
|
17930
17926
|
}
|
17931
|
-
if (hasLargeChunks && environment.config.build.minify && !config.build.lib &&
|
17927
|
+
if (hasLargeChunks && environment.config.build.minify && !config.build.lib && environment.config.consumer === "client") {
|
17932
17928
|
environment.logger.warn(
|
17933
17929
|
colors$1.yellow(
|
17934
17930
|
`
|
@@ -20383,7 +20379,7 @@ async function fileToBuiltUrl(pluginContext, id, skipPublicCheck = false, forceI
|
|
20383
20379
|
if (cached) {
|
20384
20380
|
return cached;
|
20385
20381
|
}
|
20386
|
-
const file =
|
20382
|
+
const { file, postfix } = splitFileAndPostfix(id);
|
20387
20383
|
const content = await fsp.readFile(file);
|
20388
20384
|
let url;
|
20389
20385
|
if (shouldInline(pluginContext, file, id, content, forceInline)) {
|
@@ -20399,8 +20395,6 @@ async function fileToBuiltUrl(pluginContext, id, skipPublicCheck = false, forceI
|
|
20399
20395
|
url = `data:${mimeType};base64,${content.toString("base64")}`;
|
20400
20396
|
}
|
20401
20397
|
} else {
|
20402
|
-
const { search, hash } = parse$h(id);
|
20403
|
-
const postfix = (search || "") + (hash || "");
|
20404
20398
|
const originalFileName = normalizePath$3(
|
20405
20399
|
path$n.relative(environment.config.root, file)
|
20406
20400
|
);
|
@@ -20613,7 +20607,7 @@ function dataURIPlugin() {
|
|
20613
20607
|
resolved = /* @__PURE__ */ new Map();
|
20614
20608
|
},
|
20615
20609
|
resolveId(id) {
|
20616
|
-
if (!
|
20610
|
+
if (!id.trimStart().startsWith("data:")) {
|
20617
20611
|
return;
|
20618
20612
|
}
|
20619
20613
|
const uri = new URL$3(id);
|
@@ -32478,6 +32472,9 @@ function getFirstKeyStartProps(prev) {
|
|
32478
32472
|
break loop;
|
32479
32473
|
}
|
32480
32474
|
}
|
32475
|
+
while (prev[++i]?.type === 'space') {
|
32476
|
+
/* loop */
|
32477
|
+
}
|
32481
32478
|
return prev.splice(i, prev.length);
|
32482
32479
|
}
|
32483
32480
|
function fixFlowSeqItems(fc) {
|
@@ -35153,10 +35150,6 @@ function ensureVersionQuery(resolved, id, options, ssr, depsOptimizer) {
|
|
35153
35150
|
}
|
35154
35151
|
return resolved;
|
35155
35152
|
}
|
35156
|
-
function splitFileAndPostfix(path2) {
|
35157
|
-
const file = cleanUrl(path2);
|
35158
|
-
return { file, postfix: path2.slice(file.length) };
|
35159
|
-
}
|
35160
35153
|
function tryFsResolve(fsPath, options, tryIndex = true, skipPackageJson = false) {
|
35161
35154
|
const hashIndex = fsPath.indexOf("#");
|
35162
35155
|
if (hashIndex >= 0 && isInNodeModules$1(fsPath)) {
|
@@ -35897,6 +35890,16 @@ const environmentColors = [
|
|
35897
35890
|
colors$1.green,
|
35898
35891
|
colors$1.gray
|
35899
35892
|
];
|
35893
|
+
function getDefaultResolvedEnvironmentOptions(config) {
|
35894
|
+
return {
|
35895
|
+
define: config.define,
|
35896
|
+
resolve: config.resolve,
|
35897
|
+
consumer: "server",
|
35898
|
+
webCompatible: false,
|
35899
|
+
dev: config.dev,
|
35900
|
+
build: config.build
|
35901
|
+
};
|
35902
|
+
}
|
35900
35903
|
class PartialEnvironment {
|
35901
35904
|
name;
|
35902
35905
|
getTopLevelConfig() {
|
@@ -38188,7 +38191,8 @@ function getConfigHash(environment) {
|
|
38188
38191
|
...optimizeDeps2?.esbuildOptions,
|
38189
38192
|
plugins: optimizeDeps2?.esbuildOptions?.plugins?.map((p) => p.name)
|
38190
38193
|
}
|
38191
|
-
}
|
38194
|
+
},
|
38195
|
+
webCompatible: config.webCompatible
|
38192
38196
|
},
|
38193
38197
|
(_, value) => {
|
38194
38198
|
if (typeof value === "function" || value instanceof RegExp) {
|
@@ -38371,9 +38375,6 @@ function extractJsonErrorPosition(errorMessage, inputLength) {
|
|
38371
38375
|
return errorMessageList ? Math.max(parseInt(errorMessageList[1], 10) - 1, 0) : void 0;
|
38372
38376
|
}
|
38373
38377
|
|
38374
|
-
const ERR_OPTIMIZE_DEPS_PROCESSING_ERROR = "ERR_OPTIMIZE_DEPS_PROCESSING_ERROR";
|
38375
|
-
const ERR_OUTDATED_OPTIMIZED_DEP = "ERR_OUTDATED_OPTIMIZED_DEP";
|
38376
|
-
const ERR_FILE_NOT_FOUND_IN_OPTIMIZED_DEP_DIR = "ERR_FILE_NOT_FOUND_IN_OPTIMIZED_DEP_DIR";
|
38377
38378
|
const debug$b = createDebugger("vite:optimize-deps");
|
38378
38379
|
function optimizedDepsPlugin() {
|
38379
38380
|
return {
|
@@ -45814,17 +45815,17 @@ function ssrFixStacktrace(e, moduleGraph) {
|
|
45814
45815
|
}
|
45815
45816
|
|
45816
45817
|
async function ssrLoadModule(url, server, fixStacktrace) {
|
45817
|
-
|
45818
|
+
const environment = server.environments.ssr;
|
45819
|
+
server._ssrCompatModuleRunner ||= new SSRCompatModuleRunner(environment);
|
45818
45820
|
url = unwrapId$1(url);
|
45819
45821
|
return instantiateModule(
|
45820
45822
|
url,
|
45821
45823
|
server._ssrCompatModuleRunner,
|
45822
|
-
|
45824
|
+
environment,
|
45823
45825
|
fixStacktrace
|
45824
45826
|
);
|
45825
45827
|
}
|
45826
|
-
async function instantiateModule(url, runner,
|
45827
|
-
const environment = server.environments.ssr;
|
45828
|
+
async function instantiateModule(url, runner, environment, fixStacktrace) {
|
45828
45829
|
const mod = await environment.moduleGraph.ensureEntryFromUrl(url);
|
45829
45830
|
if (mod.ssrError) {
|
45830
45831
|
throw mod.ssrError;
|
@@ -45841,7 +45842,7 @@ async function instantiateModule(url, runner, server, fixStacktrace) {
|
|
45841
45842
|
`),
|
45842
45843
|
{
|
45843
45844
|
timestamp: true,
|
45844
|
-
clear:
|
45845
|
+
clear: environment.config.clearScreen,
|
45845
45846
|
error: e
|
45846
45847
|
}
|
45847
45848
|
);
|
@@ -45849,31 +45850,31 @@ async function instantiateModule(url, runner, server, fixStacktrace) {
|
|
45849
45850
|
}
|
45850
45851
|
}
|
45851
45852
|
class SSRCompatModuleRunner extends ModuleRunner {
|
45852
|
-
constructor(
|
45853
|
+
constructor(environment) {
|
45853
45854
|
super(
|
45854
45855
|
{
|
45855
|
-
root:
|
45856
|
+
root: environment.config.root,
|
45856
45857
|
transport: {
|
45857
|
-
fetchModule: (id, importer, options) =>
|
45858
|
+
fetchModule: (id, importer, options) => environment.fetchModule(id, importer, options)
|
45858
45859
|
},
|
45859
45860
|
sourcemapInterceptor: false,
|
45860
45861
|
hmr: false
|
45861
45862
|
},
|
45862
45863
|
new ESModulesEvaluator()
|
45863
45864
|
);
|
45864
|
-
this.
|
45865
|
+
this.environment = environment;
|
45865
45866
|
}
|
45866
|
-
async directRequest(
|
45867
|
-
const
|
45868
|
-
if (!
|
45869
|
-
return super.directRequest(
|
45867
|
+
async directRequest(url, mod, callstack) {
|
45868
|
+
const id = mod.meta && "id" in mod.meta && mod.meta.id;
|
45869
|
+
if (!id) {
|
45870
|
+
return super.directRequest(url, mod, callstack);
|
45870
45871
|
}
|
45871
|
-
const viteMod = this.
|
45872
|
+
const viteMod = this.environment.moduleGraph.getModuleById(id);
|
45872
45873
|
if (!viteMod) {
|
45873
|
-
return super.directRequest(id, mod,
|
45874
|
+
return super.directRequest(id, mod, callstack);
|
45874
45875
|
}
|
45875
45876
|
try {
|
45876
|
-
const exports = await super.directRequest(id, mod,
|
45877
|
+
const exports = await super.directRequest(id, mod, callstack);
|
45877
45878
|
viteMod.ssrModule = exports;
|
45878
45879
|
return exports;
|
45879
45880
|
} catch (err) {
|
@@ -46233,7 +46234,7 @@ Contents of line ${line}: ${code.split("\n")[line - 1]}`
|
|
46233
46234
|
s.appendLeft(
|
46234
46235
|
position,
|
46235
46236
|
`
|
46236
|
-
Object.defineProperty(${ssrModuleExportsKey},
|
46237
|
+
Object.defineProperty(${ssrModuleExportsKey}, ${JSON.stringify(name)}, { enumerable: true, configurable: true, get(){ return ${local} }});`
|
46237
46238
|
);
|
46238
46239
|
}
|
46239
46240
|
const imports = [];
|
@@ -46249,10 +46250,7 @@ Object.defineProperty(${ssrModuleExportsKey}, "${name}", { enumerable: true, con
|
|
46249
46250
|
const importId = defineImport(hoistIndex, node.source.value, {
|
46250
46251
|
importedNames: node.specifiers.map((s2) => {
|
46251
46252
|
if (s2.type === "ImportSpecifier")
|
46252
|
-
return s2.imported
|
46253
|
-
// @ts-expect-error TODO: Estree types don't consider arbitrary module namespace specifiers yet
|
46254
|
-
s2.imported.value
|
46255
|
-
);
|
46253
|
+
return getIdentifierNameOrLiteralValue(s2.imported);
|
46256
46254
|
else if (s2.type === "ImportDefaultSpecifier") return "default";
|
46257
46255
|
}).filter(isDefined)
|
46258
46256
|
});
|
@@ -46267,8 +46265,7 @@ Object.defineProperty(${ssrModuleExportsKey}, "${name}", { enumerable: true, con
|
|
46267
46265
|
} else {
|
46268
46266
|
idToImportMap.set(
|
46269
46267
|
spec.local.name,
|
46270
|
-
`${importId}[${
|
46271
|
-
JSON.stringify(spec.imported.value)}]`
|
46268
|
+
`${importId}[${JSON.stringify(spec.imported.value)}]`
|
46272
46269
|
);
|
46273
46270
|
}
|
46274
46271
|
} else if (spec.type === "ImportDefaultSpecifier") {
|
@@ -46299,27 +46296,35 @@ Object.defineProperty(${ssrModuleExportsKey}, "${name}", { enumerable: true, con
|
|
46299
46296
|
node.start,
|
46300
46297
|
node.source.value,
|
46301
46298
|
{
|
46302
|
-
importedNames: node.specifiers.map(
|
46299
|
+
importedNames: node.specifiers.map(
|
46300
|
+
(s2) => getIdentifierNameOrLiteralValue(s2.local)
|
46301
|
+
)
|
46303
46302
|
}
|
46304
46303
|
);
|
46305
46304
|
for (const spec of node.specifiers) {
|
46306
|
-
const exportedAs =
|
46307
|
-
|
46308
|
-
spec.exported.value
|
46309
|
-
);
|
46310
|
-
defineExport(
|
46311
|
-
node.start,
|
46312
|
-
exportedAs,
|
46313
|
-
`${importId}.${spec.local.name}`
|
46305
|
+
const exportedAs = getIdentifierNameOrLiteralValue(
|
46306
|
+
spec.exported
|
46314
46307
|
);
|
46308
|
+
if (spec.local.type === "Identifier") {
|
46309
|
+
defineExport(
|
46310
|
+
node.start,
|
46311
|
+
exportedAs,
|
46312
|
+
`${importId}.${spec.local.name}`
|
46313
|
+
);
|
46314
|
+
} else {
|
46315
|
+
defineExport(
|
46316
|
+
node.start,
|
46317
|
+
exportedAs,
|
46318
|
+
`${importId}[${JSON.stringify(spec.local.value)}]`
|
46319
|
+
);
|
46320
|
+
}
|
46315
46321
|
}
|
46316
46322
|
} else {
|
46317
46323
|
for (const spec of node.specifiers) {
|
46318
46324
|
const local = spec.local.name;
|
46319
46325
|
const binding = idToImportMap.get(local);
|
46320
|
-
const exportedAs =
|
46321
|
-
|
46322
|
-
spec.exported.value
|
46326
|
+
const exportedAs = getIdentifierNameOrLiteralValue(
|
46327
|
+
spec.exported
|
46323
46328
|
);
|
46324
46329
|
defineExport(node.end, exportedAs, binding || local);
|
46325
46330
|
}
|
@@ -46351,7 +46356,10 @@ Object.defineProperty(${ssrModuleExportsKey}, "default", { enumerable: true, con
|
|
46351
46356
|
s.remove(node.start, node.end);
|
46352
46357
|
const importId = defineImport(node.start, node.source.value);
|
46353
46358
|
if (node.exported) {
|
46354
|
-
|
46359
|
+
const exportedAs = getIdentifierNameOrLiteralValue(
|
46360
|
+
node.exported
|
46361
|
+
);
|
46362
|
+
defineExport(node.start, exportedAs, `${importId}`);
|
46355
46363
|
} else {
|
46356
46364
|
s.appendLeft(node.start, `${ssrExportAllKey}(${importId});
|
46357
46365
|
`);
|
@@ -46394,18 +46402,13 @@ Object.defineProperty(${ssrModuleExportsKey}, "default", { enumerable: true, con
|
|
46394
46402
|
}
|
46395
46403
|
});
|
46396
46404
|
let map = s.generateMap({ hires: "boundary" });
|
46405
|
+
map.sources = [path$n.basename(url)];
|
46406
|
+
map.sourcesContent = [originalCode];
|
46397
46407
|
if (inMap && inMap.mappings && "sources" in inMap && inMap.sources.length > 0) {
|
46398
46408
|
map = combineSourcemaps(url, [
|
46399
|
-
|
46400
|
-
...map,
|
46401
|
-
sources: inMap.sources,
|
46402
|
-
sourcesContent: inMap.sourcesContent
|
46403
|
-
},
|
46409
|
+
map,
|
46404
46410
|
inMap
|
46405
46411
|
]);
|
46406
|
-
} else {
|
46407
|
-
map.sources = [path$n.basename(url)];
|
46408
|
-
map.sourcesContent = [originalCode];
|
46409
46412
|
}
|
46410
46413
|
return {
|
46411
46414
|
code: s.toString(),
|
@@ -46415,6 +46418,9 @@ Object.defineProperty(${ssrModuleExportsKey}, "default", { enumerable: true, con
|
|
46415
46418
|
dynamicDeps: [...dynamicDeps]
|
46416
46419
|
};
|
46417
46420
|
}
|
46421
|
+
function getIdentifierNameOrLiteralValue(node) {
|
46422
|
+
return node.type === "Identifier" ? node.name : node.value;
|
46423
|
+
}
|
46418
46424
|
const isNodeInPatternWeakSet = /* @__PURE__ */ new WeakSet();
|
46419
46425
|
const setIsNodeInPattern = (node) => isNodeInPatternWeakSet.add(node);
|
46420
46426
|
const isNodeInPattern = (node) => isNodeInPatternWeakSet.has(node);
|
@@ -52594,6 +52600,7 @@ const WebSocketServerRaw = process.versions.bun ? (
|
|
52594
52600
|
import.meta.require("ws").WebSocketServer
|
52595
52601
|
) : WebSocketServerRaw_;
|
52596
52602
|
const HMR_HEADER = "vite-hmr";
|
52603
|
+
const isWebSocketServer = Symbol("isWebSocketServer");
|
52597
52604
|
const wsServerEvents = [
|
52598
52605
|
"connection",
|
52599
52606
|
"error",
|
@@ -52606,6 +52613,7 @@ function noop$3() {
|
|
52606
52613
|
function createWebSocketServer(server, config, httpsOptions) {
|
52607
52614
|
if (config.server.ws === false) {
|
52608
52615
|
return {
|
52616
|
+
[isWebSocketServer]: true,
|
52609
52617
|
get clients() {
|
52610
52618
|
return /* @__PURE__ */ new Set();
|
52611
52619
|
},
|
@@ -52727,6 +52735,7 @@ ${e.stack || e.message}`),
|
|
52727
52735
|
}
|
52728
52736
|
let bufferedError = null;
|
52729
52737
|
return {
|
52738
|
+
[isWebSocketServer]: true,
|
52730
52739
|
listen: () => {
|
52731
52740
|
wsHttpServer?.listen(port, host);
|
52732
52741
|
},
|
@@ -56026,7 +56035,6 @@ async function handleModuleSoftInvalidation(environment, mod, timestamp) {
|
|
56026
56035
|
const modulePreloadPolyfillId = "vite/modulepreload-polyfill";
|
56027
56036
|
const resolvedModulePreloadPolyfillId = "\0" + modulePreloadPolyfillId + ".js";
|
56028
56037
|
function modulePreloadPolyfillPlugin(config) {
|
56029
|
-
const skip = config.command !== "build" || config.build.ssr;
|
56030
56038
|
let polyfillString;
|
56031
56039
|
return {
|
56032
56040
|
name: "vite:modulepreload-polyfill",
|
@@ -56037,7 +56045,7 @@ function modulePreloadPolyfillPlugin(config) {
|
|
56037
56045
|
},
|
56038
56046
|
load(id) {
|
56039
56047
|
if (id === resolvedModulePreloadPolyfillId) {
|
56040
|
-
if (
|
56048
|
+
if (config.command !== "build" || this.environment.config.consumer !== "client") {
|
56041
56049
|
return "";
|
56042
56050
|
}
|
56043
56051
|
if (!polyfillString) {
|
@@ -56265,7 +56273,7 @@ function buildHtmlPlugin(config) {
|
|
56265
56273
|
preHooks.push(htmlEnvHook(config));
|
56266
56274
|
postHooks.push(injectNonceAttributeTagHook(config));
|
56267
56275
|
postHooks.push(postImportMapHook());
|
56268
|
-
const processedHtml = /* @__PURE__ */ new Map();
|
56276
|
+
const processedHtml = usePerEnvironmentState(() => /* @__PURE__ */ new Map());
|
56269
56277
|
const isExcludedUrl = (url) => url[0] === "#" || isExternalUrl(url) || isDataUrl(url);
|
56270
56278
|
isAsyncScriptMap.set(config, /* @__PURE__ */ new Map());
|
56271
56279
|
return {
|
@@ -56533,7 +56541,7 @@ import ${JSON.stringify(url)}`;
|
|
56533
56541
|
s.remove(start, end);
|
56534
56542
|
}
|
56535
56543
|
}
|
56536
|
-
processedHtml.set(id, s.toString());
|
56544
|
+
processedHtml(this).set(id, s.toString());
|
56537
56545
|
const { modulePreload } = this.environment.config.build;
|
56538
56546
|
if (modulePreload !== false && modulePreload.polyfill && (someScriptsAreAsync || someScriptsAreDefer)) {
|
56539
56547
|
js = `import "${modulePreloadPolyfillId}";
|
@@ -56606,7 +56614,7 @@ ${js}`;
|
|
56606
56614
|
});
|
56607
56615
|
return tags;
|
56608
56616
|
};
|
56609
|
-
for (const [normalizedId, html] of processedHtml) {
|
56617
|
+
for (const [normalizedId, html] of processedHtml(this)) {
|
56610
56618
|
const relativeUrlPath = normalizePath$3(
|
56611
56619
|
path$n.relative(config.root, normalizedId)
|
56612
56620
|
);
|
@@ -57211,6 +57219,9 @@ function transformMiddleware(server) {
|
|
57211
57219
|
if (publicDirInRoot && url.startsWith(publicPath)) {
|
57212
57220
|
warnAboutExplicitPublicPathInUrl(url);
|
57213
57221
|
}
|
57222
|
+
if ((rawRE.test(url) || urlRE.test(url)) && !ensureServingAccess(url, server, res, next)) {
|
57223
|
+
return;
|
57224
|
+
}
|
57214
57225
|
if (isJSRequest(url) || isImportRequest(url) || isCSSRequest(url) || isHTMLProxy(url)) {
|
57215
57226
|
url = removeImportQuery(url);
|
57216
57227
|
url = unwrapId$1(url);
|
@@ -57875,7 +57886,7 @@ class ModuleGraph {
|
|
57875
57886
|
}
|
57876
57887
|
if (ssrModules) {
|
57877
57888
|
for (const mod of ssrModules) {
|
57878
|
-
if (!this._client.getModuleById(mod.id)) {
|
57889
|
+
if (mod.id == null || !this._client.getModuleById(mod.id)) {
|
57879
57890
|
result.add(this.getBackwardCompatibleBrowserModuleNode(mod));
|
57880
57891
|
}
|
57881
57892
|
}
|
@@ -59987,7 +59998,7 @@ function preAliasPlugin(config) {
|
|
59987
59998
|
name: "vite:pre-alias",
|
59988
59999
|
async resolveId(id, importer, options) {
|
59989
60000
|
const { environment } = this;
|
59990
|
-
const ssr =
|
60001
|
+
const ssr = environment.config.consumer === "server";
|
59991
60002
|
const depsOptimizer = environment.mode === "dev" ? environment.depsOptimizer : void 0;
|
59992
60003
|
if (importer && depsOptimizer && bareImportRE.test(id) && !options?.scan && id !== "@vite/client" && id !== "@vite/env") {
|
59993
60004
|
if (findPatterns.find((pattern) => matches(pattern, id))) {
|
@@ -61011,6 +61022,9 @@ function assetImportMetaUrlPlugin(config) {
|
|
61011
61022
|
}
|
61012
61023
|
}
|
61013
61024
|
const url = rawUrl.slice(1, -1);
|
61025
|
+
if (isDataUrl(url)) {
|
61026
|
+
continue;
|
61027
|
+
}
|
61014
61028
|
let file;
|
61015
61029
|
if (url[0] === ".") {
|
61016
61030
|
file = slash$1(path$n.resolve(path$n.dirname(id), url));
|
@@ -61236,7 +61250,7 @@ function dynamicImportToGlob(node, sourceString) {
|
|
61236
61250
|
}
|
61237
61251
|
|
61238
61252
|
// Disallow ./*.ext
|
61239
|
-
const ownDirectoryStarExtension =
|
61253
|
+
const ownDirectoryStarExtension = /^\.\/\*\.\w+$/;
|
61240
61254
|
if (ownDirectoryStarExtension.test(glob)) {
|
61241
61255
|
throw new VariableDynamicImportError(
|
61242
61256
|
`${
|
@@ -61593,7 +61607,8 @@ class EnvironmentPluginContainer {
|
|
61593
61607
|
info: noop,
|
61594
61608
|
warn: noop,
|
61595
61609
|
// @ts-expect-error noop
|
61596
|
-
error: noop
|
61610
|
+
error: noop,
|
61611
|
+
environment
|
61597
61612
|
};
|
61598
61613
|
const utils = createPluginHookUtils(plugins);
|
61599
61614
|
this.getSortedPlugins = utils.getSortedPlugins;
|
@@ -62465,7 +62480,7 @@ function cssPostPlugin(config) {
|
|
62465
62480
|
chunkCSSMap = /* @__PURE__ */ new Map();
|
62466
62481
|
codeSplitEmitQueue = createSerialPromiseQueue();
|
62467
62482
|
},
|
62468
|
-
async transform(css, id
|
62483
|
+
async transform(css, id) {
|
62469
62484
|
if (!isCSSRequest(id) || commonjsProxyRE.test(id) || SPECIAL_QUERY_RE.test(id)) {
|
62470
62485
|
return;
|
62471
62486
|
}
|
@@ -62503,7 +62518,7 @@ function cssPostPlugin(config) {
|
|
62503
62518
|
if (isDirectCSSRequest(id)) {
|
62504
62519
|
return null;
|
62505
62520
|
}
|
62506
|
-
if (
|
62521
|
+
if (this.environment.config.consumer !== "client") {
|
62507
62522
|
return modulesCode || `export default ${JSON.stringify(css)}`;
|
62508
62523
|
}
|
62509
62524
|
if (inlined) {
|
@@ -62710,7 +62725,7 @@ function cssPostPlugin(config) {
|
|
62710
62725
|
});
|
62711
62726
|
generatedAssets.set(referenceId, { originalFileName, isEntry });
|
62712
62727
|
chunk.viteMetadata.importedCss.add(this.getFileName(referenceId));
|
62713
|
-
} else if (
|
62728
|
+
} else if (this.environment.config.consumer === "client") {
|
62714
62729
|
chunkCSS = await finalizeCss(chunkCSS, true, config);
|
62715
62730
|
let cssString = JSON.stringify(chunkCSS);
|
62716
62731
|
cssString = renderAssetUrlInJS(this, chunk, opts, cssString)?.toString() || cssString;
|
@@ -63229,8 +63244,8 @@ function createCachedImport(imp) {
|
|
63229
63244
|
return cached;
|
63230
63245
|
};
|
63231
63246
|
}
|
63232
|
-
const importPostcssImport = createCachedImport(() => import('./dep-
|
63233
|
-
const importPostcssModules = createCachedImport(() => import('./dep-
|
63247
|
+
const importPostcssImport = createCachedImport(() => import('./dep-BabmomGK.js').then(function (n) { return n.i; }));
|
63248
|
+
const importPostcssModules = createCachedImport(() => import('./dep-DTHr9Se7.js').then(function (n) { return n.i; }));
|
63234
63249
|
const importPostcss = createCachedImport(() => import('postcss'));
|
63235
63250
|
const preprocessorWorkerControllerCache = /* @__PURE__ */ new WeakMap();
|
63236
63251
|
let alwaysFakeWorkerWorkerControllerCache;
|
@@ -63708,7 +63723,7 @@ const makeModernScssWorker = (environment, resolvers, alias, maxWorkers) => {
|
|
63708
63723
|
fileURLToPath2(canonicalUrl),
|
63709
63724
|
options.filename
|
63710
63725
|
);
|
63711
|
-
return { contents, syntax };
|
63726
|
+
return { contents, syntax, sourceMapUrl: canonicalUrl };
|
63712
63727
|
}
|
63713
63728
|
};
|
63714
63729
|
sassOptions.importers = [
|
@@ -63738,11 +63753,12 @@ const makeModernScssWorker = (environment, resolvers, alias, maxWorkers) => {
|
|
63738
63753
|
return worker;
|
63739
63754
|
};
|
63740
63755
|
const makeModernCompilerScssWorker = (environment, resolvers, alias, _maxWorkers) => {
|
63741
|
-
let
|
63756
|
+
let compilerPromise;
|
63742
63757
|
const worker = {
|
63743
63758
|
async run(sassPath, data, options) {
|
63744
63759
|
const sass = (await import(pathToFileURL(sassPath).href)).default;
|
63745
|
-
|
63760
|
+
compilerPromise ??= sass.initAsyncCompiler();
|
63761
|
+
const compiler = await compilerPromise;
|
63746
63762
|
const sassOptions = { ...options };
|
63747
63763
|
sassOptions.url = pathToFileURL(options.filename);
|
63748
63764
|
sassOptions.sourceMap = options.enableSourcemap;
|
@@ -63773,7 +63789,7 @@ const makeModernCompilerScssWorker = (environment, resolvers, alias, _maxWorkers
|
|
63773
63789
|
resolvers.sass
|
63774
63790
|
);
|
63775
63791
|
const contents = result2.contents ?? await fsp.readFile(result2.file, "utf-8");
|
63776
|
-
return { contents, syntax };
|
63792
|
+
return { contents, syntax, sourceMapUrl: canonicalUrl };
|
63777
63793
|
}
|
63778
63794
|
};
|
63779
63795
|
sassOptions.importers = [
|
@@ -63790,8 +63806,8 @@ const makeModernCompilerScssWorker = (environment, resolvers, alias, _maxWorkers
|
|
63790
63806
|
};
|
63791
63807
|
},
|
63792
63808
|
async stop() {
|
63793
|
-
|
63794
|
-
|
63809
|
+
(await compilerPromise)?.dispose();
|
63810
|
+
compilerPromise = void 0;
|
63795
63811
|
}
|
63796
63812
|
};
|
63797
63813
|
return worker;
|
@@ -64277,7 +64293,10 @@ async function compileLightningCSS(id, src, environment, urlReplacer) {
|
|
64277
64293
|
}
|
64278
64294
|
deps.add(dep.url);
|
64279
64295
|
if (urlReplacer) {
|
64280
|
-
const replaceUrl = await urlReplacer(
|
64296
|
+
const replaceUrl = await urlReplacer(
|
64297
|
+
dep.url,
|
64298
|
+
toAbsolute(dep.loc.filePath)
|
64299
|
+
);
|
64281
64300
|
css = css.replace(dep.placeholder, () => replaceUrl);
|
64282
64301
|
} else {
|
64283
64302
|
css = css.replace(dep.placeholder, () => dep.url);
|
@@ -64446,25 +64465,26 @@ function preload(baseModule, deps, importerUrl) {
|
|
64446
64465
|
})
|
64447
64466
|
);
|
64448
64467
|
}
|
64468
|
+
function handlePreloadError(err) {
|
64469
|
+
const e = new Event("vite:preloadError", {
|
64470
|
+
cancelable: true
|
64471
|
+
});
|
64472
|
+
e.payload = err;
|
64473
|
+
window.dispatchEvent(e);
|
64474
|
+
if (!e.defaultPrevented) {
|
64475
|
+
throw err;
|
64476
|
+
}
|
64477
|
+
}
|
64449
64478
|
return promise.then((res) => {
|
64450
64479
|
for (const item of res || []) {
|
64451
64480
|
if (item.status !== "rejected") continue;
|
64452
|
-
|
64453
|
-
cancelable: true
|
64454
|
-
});
|
64455
|
-
e.payload = item.reason;
|
64456
|
-
window.dispatchEvent(e);
|
64457
|
-
if (!e.defaultPrevented) {
|
64458
|
-
throw item.reason;
|
64459
|
-
}
|
64481
|
+
handlePreloadError(item.reason);
|
64460
64482
|
}
|
64461
|
-
return baseModule();
|
64483
|
+
return baseModule().catch(handlePreloadError);
|
64462
64484
|
});
|
64463
64485
|
}
|
64464
64486
|
function buildImportAnalysisPlugin(config) {
|
64465
|
-
const
|
64466
|
-
const isWorker = config.isWorker;
|
64467
|
-
const insertPreload = !(ssr || !!config.build.lib || isWorker);
|
64487
|
+
const getInsertPreload = (environment) => environment.config.consumer === "client" && !config.isWorker && !config.build.lib;
|
64468
64488
|
const renderBuiltUrl = config.experimental.renderBuiltUrl;
|
64469
64489
|
const isRelativeBase = config.base === "./" || config.base === "";
|
64470
64490
|
return {
|
@@ -64511,6 +64531,7 @@ function buildImportAnalysisPlugin(config) {
|
|
64511
64531
|
if (!imports.length) {
|
64512
64532
|
return null;
|
64513
64533
|
}
|
64534
|
+
const insertPreload = getInsertPreload(this.environment);
|
64514
64535
|
const dynamicImports = {};
|
64515
64536
|
if (insertPreload) {
|
64516
64537
|
let match;
|
@@ -64603,7 +64624,7 @@ function buildImportAnalysisPlugin(config) {
|
|
64603
64624
|
if (format !== "es") {
|
64604
64625
|
return;
|
64605
64626
|
}
|
64606
|
-
if (!
|
64627
|
+
if (!getInsertPreload(this.environment)) {
|
64607
64628
|
const removedPureCssFiles = removedPureCssFilesCache.get(config);
|
64608
64629
|
if (removedPureCssFiles && removedPureCssFiles.size > 0) {
|
64609
64630
|
for (const file in bundle) {
|
@@ -65655,7 +65676,7 @@ function escapeId(id) {
|
|
65655
65676
|
}
|
65656
65677
|
const getResolveUrl = (path2, URL = "URL") => `new ${URL}(${path2}).href`;
|
65657
65678
|
const getRelativeUrlFromDocument = (relativePath, umd = false) => getResolveUrl(
|
65658
|
-
`'${escapeId(partialEncodeURIPath(relativePath))}', ${umd ? `typeof document === 'undefined' ? location.href : ` : ""}document.currentScript && document.currentScript.src || document.baseURI`
|
65679
|
+
`'${escapeId(partialEncodeURIPath(relativePath))}', ${umd ? `typeof document === 'undefined' ? location.href : ` : ""}document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT' && document.currentScript.src || document.baseURI`
|
65659
65680
|
);
|
65660
65681
|
const getFileUrlFromFullPath = (path2) => `require('u' + 'rl').pathToFileURL(${path2}).href`;
|
65661
65682
|
const getFileUrlFromRelativePath = (path2) => getFileUrlFromFullPath(`__dirname + '/${escapeId(path2)}'`);
|
@@ -65952,14 +65973,15 @@ async function fetchModule(environment, url, importer, options = {}) {
|
|
65952
65973
|
);
|
65953
65974
|
}
|
65954
65975
|
if (options.inlineSourceMap !== false) {
|
65955
|
-
result = inlineSourceMap(mod, result, options.
|
65976
|
+
result = inlineSourceMap(mod, result, options.startOffset);
|
65956
65977
|
}
|
65957
65978
|
if (result.code[0] === "#")
|
65958
65979
|
result.code = result.code.replace(/^#!.*/, (s) => " ".repeat(s.length));
|
65959
65980
|
return {
|
65960
65981
|
code: result.code,
|
65961
65982
|
file: mod.file,
|
65962
|
-
|
65983
|
+
id: mod.id,
|
65984
|
+
url: mod.url,
|
65963
65985
|
invalidate: !cached
|
65964
65986
|
};
|
65965
65987
|
}
|
@@ -65967,7 +65989,7 @@ const OTHER_SOURCE_MAP_REGEXP = new RegExp(
|
|
65967
65989
|
`//# ${SOURCEMAPPING_URL}=data:application/json[^,]+base64,([A-Za-z0-9+/=]+)$`,
|
65968
65990
|
"gm"
|
65969
65991
|
);
|
65970
|
-
function inlineSourceMap(mod, result,
|
65992
|
+
function inlineSourceMap(mod, result, startOffset) {
|
65971
65993
|
const map = result.map;
|
65972
65994
|
let code = result.code;
|
65973
65995
|
if (!map || !("version" in map) || code.includes(MODULE_RUNNER_SOURCEMAPPING_SOURCE))
|
@@ -65975,7 +65997,9 @@ function inlineSourceMap(mod, result, processSourceMap) {
|
|
65975
65997
|
OTHER_SOURCE_MAP_REGEXP.lastIndex = 0;
|
65976
65998
|
if (OTHER_SOURCE_MAP_REGEXP.test(code))
|
65977
65999
|
code = code.replace(OTHER_SOURCE_MAP_REGEXP, "");
|
65978
|
-
const sourceMap =
|
66000
|
+
const sourceMap = startOffset ? Object.assign({}, map, {
|
66001
|
+
mappings: ";".repeat(startOffset) + map.mappings
|
66002
|
+
}) : map;
|
65979
66003
|
result.code = `${code.trimEnd()}
|
65980
66004
|
//# sourceURL=${mod.id}
|
65981
66005
|
${MODULE_RUNNER_SOURCEMAPPING_SOURCE}
|
@@ -66071,7 +66095,7 @@ function createDepsOptimizer(environment) {
|
|
66071
66095
|
firstRunCalled = !!cachedMetadata;
|
66072
66096
|
metadata = depsOptimizer.metadata = cachedMetadata || initDepsOptimizerMetadata(environment, sessionTimestamp);
|
66073
66097
|
if (!cachedMetadata) {
|
66074
|
-
environment.
|
66098
|
+
environment.waitForRequestsIdle().then(onCrawlEnd);
|
66075
66099
|
waitingForCrawlEnd = true;
|
66076
66100
|
currentlyProcessing = true;
|
66077
66101
|
const manuallyIncludedDeps = {};
|
@@ -66848,7 +66872,7 @@ class DevEnvironment extends BaseEnvironment {
|
|
66848
66872
|
/**
|
66849
66873
|
* @internal
|
66850
66874
|
*/
|
66851
|
-
|
66875
|
+
_remoteRunnerOptions;
|
66852
66876
|
get pluginContainer() {
|
66853
66877
|
if (!this._pluginContainer)
|
66854
66878
|
throw new Error(
|
@@ -66868,10 +66892,6 @@ class DevEnvironment extends BaseEnvironment {
|
|
66868
66892
|
* @internal
|
66869
66893
|
*/
|
66870
66894
|
_pendingRequests;
|
66871
|
-
/**
|
66872
|
-
* @internal
|
66873
|
-
*/
|
66874
|
-
_onCrawlEndCallbacks;
|
66875
66895
|
/**
|
66876
66896
|
* @internal
|
66877
66897
|
*/
|
@@ -66899,12 +66919,9 @@ class DevEnvironment extends BaseEnvironment {
|
|
66899
66919
|
(url) => this.pluginContainer.resolveId(url, void 0)
|
66900
66920
|
);
|
66901
66921
|
this.hot = context.hot || createNoopHotChannel();
|
66902
|
-
this.
|
66903
|
-
this.
|
66904
|
-
|
66905
|
-
});
|
66906
|
-
this._ssrRunnerOptions = context.runner ?? {};
|
66907
|
-
context.runner?.transport?.register(this);
|
66922
|
+
this._crawlEndFinder = setupOnCrawlEnd();
|
66923
|
+
this._remoteRunnerOptions = context.remoteRunner ?? {};
|
66924
|
+
context.remoteRunner?.transport?.register(this);
|
66908
66925
|
this.hot.on("vite:invalidate", async ({ path, message }) => {
|
66909
66926
|
invalidateModule(this, {
|
66910
66927
|
path,
|
@@ -66934,7 +66951,7 @@ class DevEnvironment extends BaseEnvironment {
|
|
66934
66951
|
}
|
66935
66952
|
fetchModule(id, importer, options) {
|
66936
66953
|
return fetchModule(this, id, importer, {
|
66937
|
-
...this.
|
66954
|
+
...this._remoteRunnerOptions,
|
66938
66955
|
...options
|
66939
66956
|
});
|
66940
66957
|
}
|
@@ -66965,6 +66982,8 @@ class DevEnvironment extends BaseEnvironment {
|
|
66965
66982
|
await Promise.allSettled([
|
66966
66983
|
this.pluginContainer.close(),
|
66967
66984
|
this.depsOptimizer?.close(),
|
66985
|
+
// WebSocketServer is independent of HotChannel and should not be closed on environment close
|
66986
|
+
isWebSocketServer in this.hot ? Promise.resolve() : this.hot.close(),
|
66968
66987
|
(async () => {
|
66969
66988
|
while (this._pendingRequests.size > 0) {
|
66970
66989
|
await Promise.allSettled(
|
@@ -66993,13 +67012,6 @@ class DevEnvironment extends BaseEnvironment {
|
|
66993
67012
|
_registerRequestProcessing(id, done) {
|
66994
67013
|
this._crawlEndFinder.registerRequestProcessing(id, done);
|
66995
67014
|
}
|
66996
|
-
/**
|
66997
|
-
* @internal
|
66998
|
-
* TODO: use waitForRequestsIdle in the optimizer instead of this function
|
66999
|
-
*/
|
67000
|
-
_onCrawlEnd(cb) {
|
67001
|
-
this._onCrawlEndCallbacks.push(cb);
|
67002
|
-
}
|
67003
67015
|
}
|
67004
67016
|
function invalidateModule(environment, m) {
|
67005
67017
|
const mod = environment.moduleGraph.urlToModuleMap.get(m.path);
|
@@ -67020,7 +67032,7 @@ function invalidateModule(environment, m) {
|
|
67020
67032
|
}
|
67021
67033
|
}
|
67022
67034
|
const callCrawlEndIfIdleAfterMs = 50;
|
67023
|
-
function setupOnCrawlEnd(
|
67035
|
+
function setupOnCrawlEnd() {
|
67024
67036
|
const registeredIds = /* @__PURE__ */ new Set();
|
67025
67037
|
const seenIds = /* @__PURE__ */ new Set();
|
67026
67038
|
const onCrawlEndPromiseWithResolvers = promiseWithResolvers();
|
@@ -67029,14 +67041,6 @@ function setupOnCrawlEnd(onCrawlEnd) {
|
|
67029
67041
|
function cancel() {
|
67030
67042
|
cancelled = true;
|
67031
67043
|
}
|
67032
|
-
let crawlEndCalled = false;
|
67033
|
-
function callOnCrawlEnd() {
|
67034
|
-
if (!cancelled && !crawlEndCalled) {
|
67035
|
-
crawlEndCalled = true;
|
67036
|
-
onCrawlEnd();
|
67037
|
-
}
|
67038
|
-
onCrawlEndPromiseWithResolvers.resolve();
|
67039
|
-
}
|
67040
67044
|
function registerRequestProcessing(id, done) {
|
67041
67045
|
if (!seenIds.has(id)) {
|
67042
67046
|
seenIds.add(id);
|
@@ -67068,7 +67072,7 @@ function setupOnCrawlEnd(onCrawlEnd) {
|
|
67068
67072
|
}
|
67069
67073
|
async function callOnCrawlEndWhenIdle() {
|
67070
67074
|
if (cancelled || registeredIds.size > 0) return;
|
67071
|
-
|
67075
|
+
onCrawlEndPromiseWithResolvers.resolve();
|
67072
67076
|
}
|
67073
67077
|
return {
|
67074
67078
|
registerRequestProcessing,
|
@@ -67077,23 +67081,141 @@ function setupOnCrawlEnd(onCrawlEnd) {
|
|
67077
67081
|
};
|
67078
67082
|
}
|
67079
67083
|
|
67080
|
-
|
67081
|
-
|
67082
|
-
|
67083
|
-
|
67084
|
+
class ServerHMRBroadcasterClient {
|
67085
|
+
constructor(hotChannel) {
|
67086
|
+
this.hotChannel = hotChannel;
|
67087
|
+
}
|
67088
|
+
send(...args) {
|
67089
|
+
let payload;
|
67090
|
+
if (typeof args[0] === "string") {
|
67091
|
+
payload = {
|
67092
|
+
type: "custom",
|
67093
|
+
event: args[0],
|
67094
|
+
data: args[1]
|
67095
|
+
};
|
67096
|
+
} else {
|
67097
|
+
payload = args[0];
|
67098
|
+
}
|
67099
|
+
if (payload.type !== "custom") {
|
67100
|
+
throw new Error(
|
67101
|
+
"Cannot send non-custom events from the client to the server."
|
67102
|
+
);
|
67103
|
+
}
|
67104
|
+
this.hotChannel.send(payload);
|
67105
|
+
}
|
67106
|
+
}
|
67107
|
+
class ServerHMRConnector {
|
67108
|
+
constructor(hotChannel) {
|
67109
|
+
this.hotChannel = hotChannel;
|
67110
|
+
this.hmrClient = new ServerHMRBroadcasterClient(hotChannel);
|
67111
|
+
hotChannel.api.outsideEmitter.on("send", (payload) => {
|
67112
|
+
this.handlers.forEach((listener) => listener(payload));
|
67113
|
+
});
|
67114
|
+
this.hotChannel = hotChannel;
|
67115
|
+
}
|
67116
|
+
handlers = [];
|
67117
|
+
hmrClient;
|
67118
|
+
connected = false;
|
67119
|
+
isReady() {
|
67120
|
+
return this.connected;
|
67121
|
+
}
|
67122
|
+
send(payload_) {
|
67123
|
+
const payload = payload_;
|
67124
|
+
this.hotChannel.api.innerEmitter.emit(
|
67125
|
+
payload.event,
|
67126
|
+
payload.data,
|
67127
|
+
this.hmrClient
|
67084
67128
|
);
|
67085
67129
|
}
|
67086
|
-
|
67087
|
-
|
67088
|
-
|
67089
|
-
|
67090
|
-
|
67091
|
-
|
67092
|
-
|
67130
|
+
onUpdate(handler) {
|
67131
|
+
this.handlers.push(handler);
|
67132
|
+
handler({ type: "connected" });
|
67133
|
+
this.connected = true;
|
67134
|
+
}
|
67135
|
+
}
|
67136
|
+
|
67137
|
+
function createHMROptions(environment, options) {
|
67138
|
+
if (environment.config.server.hmr === false || options.hmr === false) {
|
67139
|
+
return false;
|
67140
|
+
}
|
67141
|
+
if (options.hmr?.connection) {
|
67142
|
+
return {
|
67143
|
+
connection: options.hmr.connection,
|
67144
|
+
logger: options.hmr.logger
|
67145
|
+
};
|
67146
|
+
}
|
67147
|
+
if (!("api" in environment.hot)) return false;
|
67148
|
+
const connection = new ServerHMRConnector(environment.hot);
|
67149
|
+
return {
|
67150
|
+
connection,
|
67151
|
+
logger: options.hmr?.logger
|
67152
|
+
};
|
67153
|
+
}
|
67154
|
+
const prepareStackTrace = {
|
67155
|
+
retrieveFile(id) {
|
67156
|
+
if (existsSync$1(id)) {
|
67157
|
+
return readFileSync$1(id, "utf-8");
|
67158
|
+
}
|
67159
|
+
}
|
67160
|
+
};
|
67161
|
+
function resolveSourceMapOptions(options) {
|
67162
|
+
if (options.sourcemapInterceptor != null) {
|
67163
|
+
if (options.sourcemapInterceptor === "prepareStackTrace") {
|
67164
|
+
return prepareStackTrace;
|
67165
|
+
}
|
67166
|
+
if (typeof options.sourcemapInterceptor === "object") {
|
67167
|
+
return { ...prepareStackTrace, ...options.sourcemapInterceptor };
|
67168
|
+
}
|
67169
|
+
return options.sourcemapInterceptor;
|
67170
|
+
}
|
67171
|
+
if (typeof process !== "undefined" && "setSourceMapsEnabled" in process) {
|
67172
|
+
return "node";
|
67173
|
+
}
|
67174
|
+
return prepareStackTrace;
|
67175
|
+
}
|
67176
|
+
function createServerModuleRunner(environment, options = {}) {
|
67177
|
+
const hmr = createHMROptions(environment, options);
|
67178
|
+
return new ModuleRunner(
|
67179
|
+
{
|
67180
|
+
...options,
|
67181
|
+
root: environment.config.root,
|
67182
|
+
transport: {
|
67183
|
+
fetchModule: (id, importer, options2) => environment.fetchModule(id, importer, options2)
|
67093
67184
|
},
|
67094
|
-
|
67185
|
+
hmr,
|
67186
|
+
sourcemapInterceptor: resolveSourceMapOptions(options)
|
67187
|
+
},
|
67188
|
+
options.evaluator || new ESModulesEvaluator()
|
67189
|
+
);
|
67190
|
+
}
|
67191
|
+
|
67192
|
+
function createRunnableDevEnvironment(name, config, context = {}) {
|
67193
|
+
if (context.hot == null) {
|
67194
|
+
context.hot = createServerHotChannel();
|
67195
|
+
}
|
67196
|
+
return new RunnableDevEnvironment(name, config, context);
|
67197
|
+
}
|
67198
|
+
function isRunnableDevEnvironment(environment) {
|
67199
|
+
return environment instanceof RunnableDevEnvironment;
|
67200
|
+
}
|
67201
|
+
class RunnableDevEnvironment extends DevEnvironment {
|
67202
|
+
_runner;
|
67203
|
+
_runnerFactory;
|
67204
|
+
constructor(name, config, context) {
|
67205
|
+
super(name, config, context);
|
67206
|
+
this._runnerFactory = context.runner;
|
67207
|
+
}
|
67208
|
+
get runner() {
|
67209
|
+
if (this._runner) {
|
67210
|
+
return this._runner;
|
67095
67211
|
}
|
67096
|
-
|
67212
|
+
if (this._runnerFactory) {
|
67213
|
+
this._runner = this._runnerFactory(this);
|
67214
|
+
return this._runner;
|
67215
|
+
}
|
67216
|
+
this._runner = createServerModuleRunner(this);
|
67217
|
+
return this._runner;
|
67218
|
+
}
|
67097
67219
|
}
|
67098
67220
|
|
67099
67221
|
// NOTE: supports Node 6.x
|
@@ -67380,9 +67502,7 @@ function defaultCreateClientDevEnvironment(name, config, context) {
|
|
67380
67502
|
});
|
67381
67503
|
}
|
67382
67504
|
function defaultCreateSsrDevEnvironment(name, config) {
|
67383
|
-
return
|
67384
|
-
hot: createServerHotChannel()
|
67385
|
-
});
|
67505
|
+
return createRunnableDevEnvironment(name, config);
|
67386
67506
|
}
|
67387
67507
|
function defaultCreateDevEnvironment(name, config) {
|
67388
67508
|
return new DevEnvironment(name, config, {
|
@@ -67441,16 +67561,6 @@ function getDefaultEnvironmentOptions(config) {
|
|
67441
67561
|
build: config.build
|
67442
67562
|
};
|
67443
67563
|
}
|
67444
|
-
function getDefaultResolvedEnvironmentOptions(config) {
|
67445
|
-
return {
|
67446
|
-
define: config.define,
|
67447
|
-
resolve: config.resolve,
|
67448
|
-
consumer: "server",
|
67449
|
-
webCompatible: false,
|
67450
|
-
dev: config.dev,
|
67451
|
-
build: config.build
|
67452
|
-
};
|
67453
|
-
}
|
67454
67564
|
function checkBadCharactersInPath(path2, logger) {
|
67455
67565
|
const badChars = [];
|
67456
67566
|
if (path2.includes("#")) {
|
@@ -67998,7 +68108,7 @@ async function loadConfigFromFile(configEnv, configFile, configRoot = process.cw
|
|
67998
68108
|
debug?.("no config file found.");
|
67999
68109
|
return null;
|
68000
68110
|
}
|
68001
|
-
const isESM = isFilePathESM(resolvedPath);
|
68111
|
+
const isESM = typeof process.versions.deno === "string" || isFilePathESM(resolvedPath);
|
68002
68112
|
try {
|
68003
68113
|
const bundled = await bundleConfigFile(resolvedPath, isESM);
|
68004
68114
|
const userConfig = await loadConfigFromBundledFile(
|
@@ -68240,4 +68350,4 @@ function optimizeDepsDisabledBackwardCompatibility(resolved, optimizeDeps, optim
|
|
68240
68350
|
}
|
68241
68351
|
}
|
68242
68352
|
|
68243
|
-
export {
|
68353
|
+
export { rollupVersion as A, BuildEnvironment as B, send$1 as C, DevEnvironment as D, createLogger as E, searchForWorkspaceRoot as F, isFileServingAllowed as G, isFileLoadingAllowed as H, loadEnv as I, resolveEnvPrefix as J, colors$1 as K, getDefaultExportFromCjs as L, commonjsGlobal as M, index$1 as N, index as O, build$1 as P, preview$1 as Q, ServerHMRConnector as S, arraify as a, build as b, createServer as c, defineConfig as d, createBuilder as e, createIdResolver as f, formatPostcssSourceMap as g, preprocessCSS as h, isInNodeModules$1 as i, buildErrorMessage as j, createRunnableDevEnvironment as k, loadConfigFromFile as l, isRunnableDevEnvironment as m, fetchModule as n, optimizeDeps as o, preview as p, createServerModuleRunner as q, resolveConfig as r, sortUserPlugins as s, transformWithEsbuild as t, createServerHotChannel as u, ssrTransform as v, normalizePath$3 as w, mergeConfig as x, mergeAlias as y, createFilter as z };
|