vite 6.4.2 → 6.4.4
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/LICENSE.md +1 -1
- package/dist/node/chunks/{dep-Dq2t6Dq0.js → dep-3O3b9SCF.js} +856 -563
- package/dist/node/chunks/{dep-4-IQbZQm.js → dep-D2Nv_XqQ.js} +1 -1
- package/dist/node/chunks/{dep-lpEPC2f9.js → dep-nQZNP8DK.js} +1 -1
- package/dist/node/cli.js +5 -5
- package/dist/node/index.js +2 -2
- package/dist/node-cjs/publicUtils.cjs +9 -0
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as fs$8 from 'node:fs';
|
|
2
2
|
import fs__default, { promises as promises$1, existsSync as existsSync$1, readFileSync as readFileSync$1 } from 'node:fs';
|
|
3
|
-
import path$
|
|
3
|
+
import path$c, { posix as posix$1, isAbsolute as isAbsolute$1, join as join$1, resolve as resolve$4, sep as sep$1, normalize, dirname as dirname$2, relative as relative$2, basename as basename$2, extname as extname$1 } from 'node:path';
|
|
4
4
|
import fsp, { constants as constants$3 } from 'node:fs/promises';
|
|
5
5
|
import require$$1$1, { fileURLToPath as fileURLToPath$1, URL as URL$3, pathToFileURL as pathToFileURL$1 } from 'node:url';
|
|
6
6
|
import { promisify as promisify$4, format as format$2, inspect, stripVTControlCharacters } from 'node:util';
|
|
@@ -721,12 +721,12 @@ const dataToEsm = function dataToEsm(data, options = {}) {
|
|
|
721
721
|
return `${namedExportCode}${arbitraryExportCode}${defaultExportCode}`;
|
|
722
722
|
};
|
|
723
723
|
|
|
724
|
-
var path$
|
|
724
|
+
var path$b = require$$0$2;
|
|
725
725
|
|
|
726
726
|
var commondir = function (basedir, relfiles) {
|
|
727
727
|
if (relfiles) {
|
|
728
728
|
var files = relfiles.map(function (r) {
|
|
729
|
-
return path$
|
|
729
|
+
return path$b.resolve(basedir, r);
|
|
730
730
|
});
|
|
731
731
|
}
|
|
732
732
|
else {
|
|
@@ -6240,7 +6240,7 @@ if (process.versions.pnp) {
|
|
|
6240
6240
|
}
|
|
6241
6241
|
}
|
|
6242
6242
|
function invalidatePackageData(packageCache, pkgPath) {
|
|
6243
|
-
const pkgDir = normalizePath$3(path$
|
|
6243
|
+
const pkgDir = normalizePath$3(path$c.dirname(pkgPath));
|
|
6244
6244
|
packageCache.forEach((pkg, cacheKey) => {
|
|
6245
6245
|
if (pkg.dir === pkgDir) {
|
|
6246
6246
|
packageCache.delete(cacheKey);
|
|
@@ -6256,7 +6256,7 @@ function resolvePackageData(pkgName, basedir, preserveSymlinks = false, packageC
|
|
|
6256
6256
|
considerBuiltins: false
|
|
6257
6257
|
});
|
|
6258
6258
|
if (!pkg) return null;
|
|
6259
|
-
const pkgData = loadPackageData(path$
|
|
6259
|
+
const pkgData = loadPackageData(path$c.join(pkg, "package.json"));
|
|
6260
6260
|
packageCache?.set(cacheKey, pkgData);
|
|
6261
6261
|
return pkgData;
|
|
6262
6262
|
} catch {
|
|
@@ -6275,7 +6275,7 @@ function resolvePackageData(pkgName, basedir, preserveSymlinks = false, packageC
|
|
|
6275
6275
|
);
|
|
6276
6276
|
if (cached) return cached;
|
|
6277
6277
|
}
|
|
6278
|
-
const pkg = path$
|
|
6278
|
+
const pkg = path$c.join(basedir, "node_modules", pkgName, "package.json");
|
|
6279
6279
|
try {
|
|
6280
6280
|
if (fs__default.existsSync(pkg)) {
|
|
6281
6281
|
const pkgPath = preserveSymlinks ? pkg : safeRealpathSync(pkg);
|
|
@@ -6294,7 +6294,7 @@ function resolvePackageData(pkgName, basedir, preserveSymlinks = false, packageC
|
|
|
6294
6294
|
}
|
|
6295
6295
|
} catch {
|
|
6296
6296
|
}
|
|
6297
|
-
const nextBasedir = path$
|
|
6297
|
+
const nextBasedir = path$c.dirname(basedir);
|
|
6298
6298
|
if (nextBasedir === basedir) break;
|
|
6299
6299
|
basedir = nextBasedir;
|
|
6300
6300
|
}
|
|
@@ -6307,7 +6307,7 @@ function findNearestPackageData(basedir, packageCache) {
|
|
|
6307
6307
|
const cached = getFnpdCache(packageCache, basedir, originalBasedir);
|
|
6308
6308
|
if (cached) return cached;
|
|
6309
6309
|
}
|
|
6310
|
-
const pkgPath = path$
|
|
6310
|
+
const pkgPath = path$c.join(basedir, "package.json");
|
|
6311
6311
|
if (tryStatSync(pkgPath)?.isFile()) {
|
|
6312
6312
|
try {
|
|
6313
6313
|
const pkgData = loadPackageData(pkgPath);
|
|
@@ -6318,7 +6318,7 @@ function findNearestPackageData(basedir, packageCache) {
|
|
|
6318
6318
|
} catch {
|
|
6319
6319
|
}
|
|
6320
6320
|
}
|
|
6321
|
-
const nextBasedir = path$
|
|
6321
|
+
const nextBasedir = path$c.dirname(basedir);
|
|
6322
6322
|
if (nextBasedir === basedir) break;
|
|
6323
6323
|
basedir = nextBasedir;
|
|
6324
6324
|
}
|
|
@@ -6327,13 +6327,13 @@ function findNearestPackageData(basedir, packageCache) {
|
|
|
6327
6327
|
function findNearestMainPackageData(basedir, packageCache) {
|
|
6328
6328
|
const nearestPackage = findNearestPackageData(basedir, packageCache);
|
|
6329
6329
|
return nearestPackage && (nearestPackage.data.name ? nearestPackage : findNearestMainPackageData(
|
|
6330
|
-
path$
|
|
6330
|
+
path$c.dirname(nearestPackage.dir),
|
|
6331
6331
|
packageCache
|
|
6332
6332
|
));
|
|
6333
6333
|
}
|
|
6334
6334
|
function loadPackageData(pkgPath) {
|
|
6335
6335
|
const data = JSON.parse(stripBomTag(fs__default.readFileSync(pkgPath, "utf-8")));
|
|
6336
|
-
const pkgDir = normalizePath$3(path$
|
|
6336
|
+
const pkgDir = normalizePath$3(path$c.dirname(pkgPath));
|
|
6337
6337
|
const { sideEffects } = data;
|
|
6338
6338
|
let hasSideEffects;
|
|
6339
6339
|
if (typeof sideEffects === "boolean") {
|
|
@@ -6380,11 +6380,11 @@ function getResolveCacheKey(key, options) {
|
|
|
6380
6380
|
}
|
|
6381
6381
|
function findNearestNodeModules(basedir) {
|
|
6382
6382
|
while (basedir) {
|
|
6383
|
-
const pkgPath = path$
|
|
6383
|
+
const pkgPath = path$c.join(basedir, "node_modules");
|
|
6384
6384
|
if (tryStatSync(pkgPath)?.isDirectory()) {
|
|
6385
6385
|
return pkgPath;
|
|
6386
6386
|
}
|
|
6387
|
-
const nextBasedir = path$
|
|
6387
|
+
const nextBasedir = path$c.dirname(basedir);
|
|
6388
6388
|
if (nextBasedir === basedir) break;
|
|
6389
6389
|
basedir = nextBasedir;
|
|
6390
6390
|
}
|
|
@@ -6401,7 +6401,7 @@ function watchPackageDataPlugin(packageCache) {
|
|
|
6401
6401
|
packageCache.set = (id, pkg) => {
|
|
6402
6402
|
if (!isInNodeModules$1(pkg.dir) && !watchedDirs.has(pkg.dir)) {
|
|
6403
6403
|
watchedDirs.add(pkg.dir);
|
|
6404
|
-
watchFile(path$
|
|
6404
|
+
watchFile(path$c.join(pkg.dir, "package.json"));
|
|
6405
6405
|
}
|
|
6406
6406
|
return setPackageData(id, pkg);
|
|
6407
6407
|
};
|
|
@@ -6417,7 +6417,7 @@ function watchPackageDataPlugin(packageCache) {
|
|
|
6417
6417
|
},
|
|
6418
6418
|
watchChange(id) {
|
|
6419
6419
|
if (id.endsWith("/package.json")) {
|
|
6420
|
-
invalidatePackageData(packageCache, path$
|
|
6420
|
+
invalidatePackageData(packageCache, path$c.normalize(id));
|
|
6421
6421
|
}
|
|
6422
6422
|
}
|
|
6423
6423
|
};
|
|
@@ -6463,7 +6463,7 @@ function getFnpdCacheKey(basedir) {
|
|
|
6463
6463
|
function traverseBetweenDirs(longerDir, shorterDir, cb) {
|
|
6464
6464
|
while (longerDir !== shorterDir) {
|
|
6465
6465
|
cb(longerDir);
|
|
6466
|
-
longerDir = path$
|
|
6466
|
+
longerDir = path$c.dirname(longerDir);
|
|
6467
6467
|
}
|
|
6468
6468
|
}
|
|
6469
6469
|
|
|
@@ -6537,7 +6537,7 @@ function isOptimizable(id, optimizeDeps) {
|
|
|
6537
6537
|
const bareImportRE = /^(?![a-zA-Z]:)[\w@](?!.*:\/\/)/;
|
|
6538
6538
|
const deepImportRE = /^([^@][^/]*)\/|^(@[^/]+\/[^/]+)\//;
|
|
6539
6539
|
const _require$1 = createRequire$1(import.meta.url);
|
|
6540
|
-
const _dirname = path$
|
|
6540
|
+
const _dirname = path$c.dirname(fileURLToPath$1(import.meta.url));
|
|
6541
6541
|
const rollupVersion = resolvePackageData("rollup", _dirname, true)?.data.version ?? "";
|
|
6542
6542
|
const filter = process.env.VITE_DEBUG_FILTER;
|
|
6543
6543
|
const DEBUG = process.env.DEBUG;
|
|
@@ -6588,7 +6588,7 @@ const urlCanParse = (
|
|
|
6588
6588
|
const isCaseInsensitiveFS = testCaseInsensitiveFS();
|
|
6589
6589
|
const VOLUME_RE = /^[A-Z]:/i;
|
|
6590
6590
|
function normalizePath$3(id) {
|
|
6591
|
-
return path$
|
|
6591
|
+
return path$c.posix.normalize(isWindows$3 ? slash$1(id) : id);
|
|
6592
6592
|
}
|
|
6593
6593
|
function fsPathFromId(id) {
|
|
6594
6594
|
const fsPath = normalizePath$3(
|
|
@@ -6618,7 +6618,7 @@ const isJSRequest = (url) => {
|
|
|
6618
6618
|
if (knownJsSrcRE.test(url)) {
|
|
6619
6619
|
return true;
|
|
6620
6620
|
}
|
|
6621
|
-
if (!path$
|
|
6621
|
+
if (!path$c.extname(url) && url[url.length - 1] !== "/") {
|
|
6622
6622
|
return true;
|
|
6623
6623
|
}
|
|
6624
6624
|
return false;
|
|
@@ -6685,7 +6685,7 @@ function prettifyUrl(url, root) {
|
|
|
6685
6685
|
url = removeTimestampQuery(url);
|
|
6686
6686
|
const isAbsoluteFile = url.startsWith(root);
|
|
6687
6687
|
if (isAbsoluteFile || url.startsWith(FS_PREFIX)) {
|
|
6688
|
-
const file = path$
|
|
6688
|
+
const file = path$c.posix.relative(
|
|
6689
6689
|
root,
|
|
6690
6690
|
isAbsoluteFile ? url : fsPathFromId(url)
|
|
6691
6691
|
);
|
|
@@ -6709,10 +6709,10 @@ function tryStatSync(file) {
|
|
|
6709
6709
|
function lookupFile(dir, fileNames) {
|
|
6710
6710
|
while (dir) {
|
|
6711
6711
|
for (const fileName of fileNames) {
|
|
6712
|
-
const fullPath = path$
|
|
6712
|
+
const fullPath = path$c.join(dir, fileName);
|
|
6713
6713
|
if (tryStatSync(fullPath)?.isFile()) return fullPath;
|
|
6714
6714
|
}
|
|
6715
|
-
const parentDir = path$
|
|
6715
|
+
const parentDir = path$c.dirname(dir);
|
|
6716
6716
|
if (parentDir === dir) return;
|
|
6717
6717
|
dir = parentDir;
|
|
6718
6718
|
}
|
|
@@ -6724,7 +6724,7 @@ function isFilePathESM(filePath, packageCache) {
|
|
|
6724
6724
|
return false;
|
|
6725
6725
|
} else {
|
|
6726
6726
|
try {
|
|
6727
|
-
const pkg = findNearestPackageData(path$
|
|
6727
|
+
const pkg = findNearestPackageData(path$c.dirname(filePath), packageCache);
|
|
6728
6728
|
return pkg?.data.type === "module";
|
|
6729
6729
|
} catch {
|
|
6730
6730
|
return false;
|
|
@@ -6826,7 +6826,7 @@ function emptyDir(dir, skip) {
|
|
|
6826
6826
|
let nested = null;
|
|
6827
6827
|
if (skip?.length) {
|
|
6828
6828
|
for (const file of skip) {
|
|
6829
|
-
if (path$
|
|
6829
|
+
if (path$c.dirname(file) !== ".") {
|
|
6830
6830
|
const matched = splitFirstDirRE.exec(file);
|
|
6831
6831
|
if (matched) {
|
|
6832
6832
|
nested ??= /* @__PURE__ */ new Map();
|
|
@@ -6850,20 +6850,20 @@ function emptyDir(dir, skip) {
|
|
|
6850
6850
|
continue;
|
|
6851
6851
|
}
|
|
6852
6852
|
if (nested?.has(file)) {
|
|
6853
|
-
emptyDir(path$
|
|
6853
|
+
emptyDir(path$c.resolve(dir, file), nested.get(file));
|
|
6854
6854
|
} else {
|
|
6855
|
-
fs__default.rmSync(path$
|
|
6855
|
+
fs__default.rmSync(path$c.resolve(dir, file), { recursive: true, force: true });
|
|
6856
6856
|
}
|
|
6857
6857
|
}
|
|
6858
6858
|
}
|
|
6859
6859
|
function copyDir(srcDir, destDir) {
|
|
6860
6860
|
fs__default.mkdirSync(destDir, { recursive: true });
|
|
6861
6861
|
for (const file of fs__default.readdirSync(srcDir)) {
|
|
6862
|
-
const srcFile = path$
|
|
6862
|
+
const srcFile = path$c.resolve(srcDir, file);
|
|
6863
6863
|
if (srcFile === destDir) {
|
|
6864
6864
|
continue;
|
|
6865
6865
|
}
|
|
6866
|
-
const destFile = path$
|
|
6866
|
+
const destFile = path$c.resolve(destDir, file);
|
|
6867
6867
|
const stat = fs__default.statSync(srcFile);
|
|
6868
6868
|
if (stat.isDirectory()) {
|
|
6869
6869
|
copyDir(srcFile, destFile);
|
|
@@ -6895,7 +6895,7 @@ async function recursiveReaddir(dir) {
|
|
|
6895
6895
|
}
|
|
6896
6896
|
const files = await Promise.all(
|
|
6897
6897
|
dirents.map((dirent) => {
|
|
6898
|
-
const res = path$
|
|
6898
|
+
const res = path$c.resolve(dir, dirent.name);
|
|
6899
6899
|
return dirent.isDirectory() ? recursiveReaddir(res) : normalizePath$3(res);
|
|
6900
6900
|
})
|
|
6901
6901
|
);
|
|
@@ -6928,7 +6928,7 @@ function optimizeSafeRealPathSync() {
|
|
|
6928
6928
|
return;
|
|
6929
6929
|
}
|
|
6930
6930
|
try {
|
|
6931
|
-
fs__default.realpathSync.native(path$
|
|
6931
|
+
fs__default.realpathSync.native(path$c.resolve("./"));
|
|
6932
6932
|
} catch (error) {
|
|
6933
6933
|
if (error.message.includes("EISDIR: illegal operation on a directory")) {
|
|
6934
6934
|
safeRealpathSync = fs__default.realpathSync;
|
|
@@ -6953,7 +6953,7 @@ function ensureWatchedFile(watcher, file, root) {
|
|
|
6953
6953
|
if (file && // only need to watch if out of root
|
|
6954
6954
|
!file.startsWith(withTrailingSlash(root)) && // some rollup plugins use null bytes for private resolved Ids
|
|
6955
6955
|
!file.includes("\0") && fs__default.existsSync(file)) {
|
|
6956
|
-
watcher.add(path$
|
|
6956
|
+
watcher.add(path$c.resolve(file));
|
|
6957
6957
|
}
|
|
6958
6958
|
}
|
|
6959
6959
|
function joinSrcset(ret) {
|
|
@@ -6984,11 +6984,11 @@ function processSrcSetSync(srcs, replacer) {
|
|
|
6984
6984
|
}))
|
|
6985
6985
|
);
|
|
6986
6986
|
}
|
|
6987
|
-
const windowsDriveRE = /^[A-Z]:/;
|
|
6987
|
+
const windowsDriveRE$1 = /^[A-Z]:/;
|
|
6988
6988
|
const replaceWindowsDriveRE = /^([A-Z]):\//;
|
|
6989
6989
|
const linuxAbsolutePathRE = /^\/[^/]/;
|
|
6990
6990
|
function escapeToLinuxLikePath(path2) {
|
|
6991
|
-
if (windowsDriveRE.test(path2)) {
|
|
6991
|
+
if (windowsDriveRE$1.test(path2)) {
|
|
6992
6992
|
return path2.replace(replaceWindowsDriveRE, "/windows/$1/");
|
|
6993
6993
|
}
|
|
6994
6994
|
if (linuxAbsolutePathRE.test(path2)) {
|
|
@@ -7362,8 +7362,8 @@ function shouldServeFile(filePath, root) {
|
|
|
7362
7362
|
}
|
|
7363
7363
|
function hasCorrectCase(file, assets) {
|
|
7364
7364
|
if (file === assets) return true;
|
|
7365
|
-
const parent = path$
|
|
7366
|
-
if (fs__default.readdirSync(parent).includes(path$
|
|
7365
|
+
const parent = path$c.dirname(file);
|
|
7366
|
+
if (fs__default.readdirSync(parent).includes(path$c.basename(file))) {
|
|
7367
7367
|
return hasCorrectCase(parent, assets);
|
|
7368
7368
|
}
|
|
7369
7369
|
return false;
|
|
@@ -7675,7 +7675,7 @@ function buildReporterPlugin(config) {
|
|
|
7675
7675
|
const logTransform = throttle((id) => {
|
|
7676
7676
|
writeLine(
|
|
7677
7677
|
`transforming (${transformedCount}) ${colors$1.dim(
|
|
7678
|
-
path$
|
|
7678
|
+
path$c.relative(config.root, id)
|
|
7679
7679
|
)}`
|
|
7680
7680
|
);
|
|
7681
7681
|
});
|
|
@@ -7799,15 +7799,15 @@ function buildReporterPlugin(config) {
|
|
|
7799
7799
|
const mapPad = displaySize(biggestMap).length;
|
|
7800
7800
|
const compressPad = displaySize(biggestCompressSize).length;
|
|
7801
7801
|
const relativeOutDir = normalizePath$3(
|
|
7802
|
-
path$
|
|
7802
|
+
path$c.relative(
|
|
7803
7803
|
config.root,
|
|
7804
|
-
path$
|
|
7804
|
+
path$c.resolve(
|
|
7805
7805
|
config.root,
|
|
7806
7806
|
outDir ?? environment.config.build.outDir
|
|
7807
7807
|
)
|
|
7808
7808
|
)
|
|
7809
7809
|
);
|
|
7810
|
-
const assetsDir = path$
|
|
7810
|
+
const assetsDir = path$c.join(environment.config.build.assetsDir, "/");
|
|
7811
7811
|
for (const group of groups) {
|
|
7812
7812
|
const filtered = entries.filter((e) => e.group === group.name);
|
|
7813
7813
|
if (!filtered.length) continue;
|
|
@@ -7930,8 +7930,8 @@ function throttle(fn) {
|
|
|
7930
7930
|
};
|
|
7931
7931
|
}
|
|
7932
7932
|
|
|
7933
|
-
const POSIX_SEP_RE = new RegExp('\\' + path$
|
|
7934
|
-
const NATIVE_SEP_RE = new RegExp('\\' + path$
|
|
7933
|
+
const POSIX_SEP_RE = new RegExp('\\' + path$c.posix.sep, 'g');
|
|
7934
|
+
const NATIVE_SEP_RE = new RegExp('\\' + path$c.sep, 'g');
|
|
7935
7935
|
/** @type {Map<string,RegExp>}*/
|
|
7936
7936
|
const PATTERN_REGEX_CACHE = new Map();
|
|
7937
7937
|
const GLOB_ALL_PATTERN = `**/*`;
|
|
@@ -7942,7 +7942,7 @@ const TS_EXTENSIONS_RE_GROUP = `\\.(?:${TS_EXTENSIONS.map((ext) => ext.substring
|
|
|
7942
7942
|
const TSJS_EXTENSIONS_RE_GROUP = `\\.(?:${TSJS_EXTENSIONS.map((ext) => ext.substring(1)).join(
|
|
7943
7943
|
'|'
|
|
7944
7944
|
)})`;
|
|
7945
|
-
const IS_POSIX = path$
|
|
7945
|
+
const IS_POSIX = path$c.posix.sep === path$c.sep;
|
|
7946
7946
|
|
|
7947
7947
|
/**
|
|
7948
7948
|
* @template T
|
|
@@ -7963,10 +7963,10 @@ function makePromise() {
|
|
|
7963
7963
|
* @returns {Promise<string|void>}
|
|
7964
7964
|
*/
|
|
7965
7965
|
async function resolveTSConfigJson(filename, cache) {
|
|
7966
|
-
if (path$
|
|
7966
|
+
if (path$c.extname(filename) !== '.json') {
|
|
7967
7967
|
return; // ignore files that are not json
|
|
7968
7968
|
}
|
|
7969
|
-
const tsconfig = path$
|
|
7969
|
+
const tsconfig = path$c.resolve(filename);
|
|
7970
7970
|
if (cache && (cache.hasParseResult(tsconfig) || cache.hasParseResult(filename))) {
|
|
7971
7971
|
return tsconfig;
|
|
7972
7972
|
}
|
|
@@ -8000,7 +8000,7 @@ const isInNodeModules = IS_POSIX
|
|
|
8000
8000
|
*/
|
|
8001
8001
|
const posix2native = IS_POSIX
|
|
8002
8002
|
? (filename) => filename
|
|
8003
|
-
: (filename) => filename.replace(POSIX_SEP_RE, path$
|
|
8003
|
+
: (filename) => filename.replace(POSIX_SEP_RE, path$c.sep);
|
|
8004
8004
|
|
|
8005
8005
|
/**
|
|
8006
8006
|
* convert native separator to posix separator
|
|
@@ -8014,7 +8014,7 @@ const posix2native = IS_POSIX
|
|
|
8014
8014
|
*/
|
|
8015
8015
|
const native2posix = IS_POSIX
|
|
8016
8016
|
? (filename) => filename
|
|
8017
|
-
: (filename) => filename.replace(NATIVE_SEP_RE, path$
|
|
8017
|
+
: (filename) => filename.replace(NATIVE_SEP_RE, path$c.posix.sep);
|
|
8018
8018
|
|
|
8019
8019
|
/**
|
|
8020
8020
|
* converts params to native separator, resolves path and converts native back to posix
|
|
@@ -8026,12 +8026,12 @@ const native2posix = IS_POSIX
|
|
|
8026
8026
|
* @returns string
|
|
8027
8027
|
*/
|
|
8028
8028
|
const resolve2posix = IS_POSIX
|
|
8029
|
-
? (dir, filename) => (dir ? path$
|
|
8029
|
+
? (dir, filename) => (dir ? path$c.resolve(dir, filename) : path$c.resolve(filename))
|
|
8030
8030
|
: (dir, filename) =>
|
|
8031
8031
|
native2posix(
|
|
8032
8032
|
dir
|
|
8033
|
-
? path$
|
|
8034
|
-
: path$
|
|
8033
|
+
? path$c.resolve(posix2native(dir), posix2native(filename))
|
|
8034
|
+
: path$c.resolve(posix2native(filename))
|
|
8035
8035
|
);
|
|
8036
8036
|
|
|
8037
8037
|
/**
|
|
@@ -8041,11 +8041,11 @@ const resolve2posix = IS_POSIX
|
|
|
8041
8041
|
* @returns {string[]}
|
|
8042
8042
|
*/
|
|
8043
8043
|
function resolveReferencedTSConfigFiles(result, options) {
|
|
8044
|
-
const dir = path$
|
|
8044
|
+
const dir = path$c.dirname(result.tsconfigFile);
|
|
8045
8045
|
return result.tsconfig.references.map((ref) => {
|
|
8046
8046
|
const refPath = ref.path.endsWith('.json')
|
|
8047
8047
|
? ref.path
|
|
8048
|
-
: path$
|
|
8048
|
+
: path$c.join(ref.path, options?.configName ?? 'tsconfig.json');
|
|
8049
8049
|
return resolve2posix(dir, refPath);
|
|
8050
8050
|
});
|
|
8051
8051
|
}
|
|
@@ -8080,7 +8080,7 @@ function resolveSolutionTSConfig(filename, result) {
|
|
|
8080
8080
|
* @returns {boolean}
|
|
8081
8081
|
*/
|
|
8082
8082
|
function isIncluded(filename, result) {
|
|
8083
|
-
const dir = native2posix(path$
|
|
8083
|
+
const dir = native2posix(path$c.dirname(result.tsconfigFile));
|
|
8084
8084
|
const files = (result.tsconfig.files || []).map((file) => resolve2posix(dir, file));
|
|
8085
8085
|
const absoluteFilename = resolve2posix(null, filename);
|
|
8086
8086
|
if (files.includes(filename)) {
|
|
@@ -8249,7 +8249,7 @@ function replaceTokens(result) {
|
|
|
8249
8249
|
result.tsconfig = JSON.parse(
|
|
8250
8250
|
JSON.stringify(result.tsconfig)
|
|
8251
8251
|
// replace ${configDir}
|
|
8252
|
-
.replaceAll(/"\${configDir}/g, `"${native2posix(path$
|
|
8252
|
+
.replaceAll(/"\${configDir}/g, `"${native2posix(path$c.dirname(result.tsconfigFile))}`)
|
|
8253
8253
|
);
|
|
8254
8254
|
}
|
|
8255
8255
|
}
|
|
@@ -8262,7 +8262,7 @@ function replaceTokens(result) {
|
|
|
8262
8262
|
* @returns {Promise<string|null>} absolute path to closest tsconfig.json or null if not found
|
|
8263
8263
|
*/
|
|
8264
8264
|
async function find(filename, options) {
|
|
8265
|
-
let dir = path$
|
|
8265
|
+
let dir = path$c.dirname(path$c.resolve(filename));
|
|
8266
8266
|
if (isInNodeModules(dir)) {
|
|
8267
8267
|
return null;
|
|
8268
8268
|
}
|
|
@@ -8272,8 +8272,8 @@ async function find(filename, options) {
|
|
|
8272
8272
|
return cache.getConfigPath(dir, configName);
|
|
8273
8273
|
}
|
|
8274
8274
|
const { /** @type {Promise<string|null>} */ promise, resolve, reject } = makePromise();
|
|
8275
|
-
if (options?.root && !path$
|
|
8276
|
-
options.root = path$
|
|
8275
|
+
if (options?.root && !path$c.isAbsolute(options.root)) {
|
|
8276
|
+
options.root = path$c.resolve(options.root);
|
|
8277
8277
|
}
|
|
8278
8278
|
findUp(dir, { promise, resolve, reject }, options);
|
|
8279
8279
|
return promise;
|
|
@@ -8305,7 +8305,7 @@ function findUp(dir, { resolve, reject, promise }, options) {
|
|
|
8305
8305
|
cache.setConfigPath(dir, promise, configName);
|
|
8306
8306
|
}
|
|
8307
8307
|
}
|
|
8308
|
-
const tsconfig = path$
|
|
8308
|
+
const tsconfig = path$c.join(dir, options?.configName ?? 'tsconfig.json');
|
|
8309
8309
|
fs__default.stat(tsconfig, (err, stats) => {
|
|
8310
8310
|
if (stats && (stats.isFile() || stats.isFIFO())) {
|
|
8311
8311
|
resolve(tsconfig);
|
|
@@ -8313,7 +8313,7 @@ function findUp(dir, { resolve, reject, promise }, options) {
|
|
|
8313
8313
|
reject(err);
|
|
8314
8314
|
} else {
|
|
8315
8315
|
let parent;
|
|
8316
|
-
if (root === dir || (parent = path$
|
|
8316
|
+
if (root === dir || (parent = path$c.dirname(dir)) === dir) {
|
|
8317
8317
|
resolve(null);
|
|
8318
8318
|
} else {
|
|
8319
8319
|
findUp(parent, { promise, resolve, reject }, options);
|
|
@@ -8527,7 +8527,7 @@ async function parse$e(filename, options) {
|
|
|
8527
8527
|
if (filename !== tsconfigFile && cache?.hasParseResult(tsconfigFile)) {
|
|
8528
8528
|
result = await getParsedDeep(tsconfigFile, cache, options);
|
|
8529
8529
|
} else {
|
|
8530
|
-
result = await parseFile$
|
|
8530
|
+
result = await parseFile$2(tsconfigFile, cache, filename === tsconfigFile);
|
|
8531
8531
|
await Promise.all([parseExtends(result, cache), parseReferences(result, options)]);
|
|
8532
8532
|
}
|
|
8533
8533
|
replaceTokens(result);
|
|
@@ -8568,7 +8568,7 @@ async function getParsedDeep(filename, cache, options) {
|
|
|
8568
8568
|
* @param {boolean} [skipCache] - skip cache
|
|
8569
8569
|
* @returns {Promise<import('./public.d.ts').TSConfckParseResult>}
|
|
8570
8570
|
*/
|
|
8571
|
-
async function parseFile$
|
|
8571
|
+
async function parseFile$2(tsconfigFile, cache, skipCache) {
|
|
8572
8572
|
if (
|
|
8573
8573
|
!skipCache &&
|
|
8574
8574
|
cache?.hasParseResult(tsconfigFile) &&
|
|
@@ -8584,7 +8584,7 @@ async function parseFile$1(tsconfigFile, cache, skipCache) {
|
|
|
8584
8584
|
applyDefaults(parsed, tsconfigFile);
|
|
8585
8585
|
return {
|
|
8586
8586
|
tsconfigFile,
|
|
8587
|
-
tsconfig: normalizeTSConfig(parsed, path$
|
|
8587
|
+
tsconfig: normalizeTSConfig(parsed, path$c.dirname(tsconfigFile))
|
|
8588
8588
|
};
|
|
8589
8589
|
})
|
|
8590
8590
|
.catch((e) => {
|
|
@@ -8613,7 +8613,7 @@ async function parseFile$1(tsconfigFile, cache, skipCache) {
|
|
|
8613
8613
|
function normalizeTSConfig(tsconfig, dir) {
|
|
8614
8614
|
// set baseUrl to absolute path
|
|
8615
8615
|
const baseUrl = tsconfig.compilerOptions?.baseUrl;
|
|
8616
|
-
if (baseUrl && !baseUrl.startsWith('${') && !path$
|
|
8616
|
+
if (baseUrl && !baseUrl.startsWith('${') && !path$c.isAbsolute(baseUrl)) {
|
|
8617
8617
|
tsconfig.compilerOptions.baseUrl = resolve2posix(dir, baseUrl);
|
|
8618
8618
|
}
|
|
8619
8619
|
return tsconfig;
|
|
@@ -8631,7 +8631,7 @@ async function parseReferences(result, options) {
|
|
|
8631
8631
|
}
|
|
8632
8632
|
const referencedFiles = resolveReferencedTSConfigFiles(result, options);
|
|
8633
8633
|
const referenced = await Promise.all(
|
|
8634
|
-
referencedFiles.map((file) => parseFile$
|
|
8634
|
+
referencedFiles.map((file) => parseFile$2(file, options?.cache))
|
|
8635
8635
|
);
|
|
8636
8636
|
await Promise.all(referenced.map((ref) => parseExtends(ref, options?.cache)));
|
|
8637
8637
|
referenced.forEach((ref) => {
|
|
@@ -8694,7 +8694,7 @@ async function parseExtends(result, cache) {
|
|
|
8694
8694
|
extended.splice(
|
|
8695
8695
|
pos + 1,
|
|
8696
8696
|
0,
|
|
8697
|
-
...(await Promise.all(resolvedExtends.map((file) => parseFile$
|
|
8697
|
+
...(await Promise.all(resolvedExtends.map((file) => parseFile$2(file, cache))))
|
|
8698
8698
|
);
|
|
8699
8699
|
} else {
|
|
8700
8700
|
// reached a leaf, backtrack to the last branching point and continue
|
|
@@ -8728,7 +8728,7 @@ function resolveExtends(extended, from) {
|
|
|
8728
8728
|
} catch (e) {
|
|
8729
8729
|
error = e;
|
|
8730
8730
|
}
|
|
8731
|
-
if (extended[0] !== '.' && !path$
|
|
8731
|
+
if (extended[0] !== '.' && !path$c.isAbsolute(extended)) {
|
|
8732
8732
|
try {
|
|
8733
8733
|
return req.resolve(`${extended}/tsconfig.json`);
|
|
8734
8734
|
} catch (e) {
|
|
@@ -8766,7 +8766,7 @@ function extendTSConfig(extending, extended) {
|
|
|
8766
8766
|
const extendingConfig = extending.tsconfig;
|
|
8767
8767
|
const extendedConfig = extended.tsconfig;
|
|
8768
8768
|
const relativePath = native2posix(
|
|
8769
|
-
path$
|
|
8769
|
+
path$c.relative(path$c.dirname(extending.tsconfigFile), path$c.dirname(extended.tsconfigFile))
|
|
8770
8770
|
);
|
|
8771
8771
|
for (const key of Object.keys(extendedConfig).filter((key) => EXTENDABLE_KEYS.includes(key))) {
|
|
8772
8772
|
if (key === 'compilerOptions') {
|
|
@@ -8845,11 +8845,11 @@ function rebaseRelative(key, value, prependPath) {
|
|
|
8845
8845
|
* @returns {string}
|
|
8846
8846
|
*/
|
|
8847
8847
|
function rebasePath(value, prependPath) {
|
|
8848
|
-
if (path$
|
|
8848
|
+
if (path$c.isAbsolute(value) || value.startsWith('${configDir}')) {
|
|
8849
8849
|
return value;
|
|
8850
8850
|
} else {
|
|
8851
8851
|
// relative paths use posix syntax in tsconfig
|
|
8852
|
-
return path$
|
|
8852
|
+
return path$c.posix.normalize(path$c.posix.join(prependPath, value));
|
|
8853
8853
|
}
|
|
8854
8854
|
}
|
|
8855
8855
|
|
|
@@ -8914,7 +8914,7 @@ const DEFAULT_JSCONFIG_COMPILER_OPTIONS = {
|
|
|
8914
8914
|
* @param {string} configFileName
|
|
8915
8915
|
*/
|
|
8916
8916
|
function isJSConfig(configFileName) {
|
|
8917
|
-
return path$
|
|
8917
|
+
return path$c.basename(configFileName) === 'jsconfig.json';
|
|
8918
8918
|
}
|
|
8919
8919
|
|
|
8920
8920
|
/** @template T */
|
|
@@ -9058,7 +9058,7 @@ const defaultEsbuildSupported = {
|
|
|
9058
9058
|
async function transformWithEsbuild(code, filename, options, inMap, config, watcher) {
|
|
9059
9059
|
let loader = options?.loader;
|
|
9060
9060
|
if (!loader) {
|
|
9061
|
-
const ext = path$
|
|
9061
|
+
const ext = path$c.extname(validExtensionRE.test(filename) ? filename : cleanUrl(filename)).slice(1);
|
|
9062
9062
|
if (ext === "cjs" || ext === "mjs") {
|
|
9063
9063
|
loader = "js";
|
|
9064
9064
|
} else if (ext === "cts" || ext === "mts") {
|
|
@@ -10312,9 +10312,9 @@ function checkPublicFile(url, config) {
|
|
|
10312
10312
|
const fileName = cleanUrl(url);
|
|
10313
10313
|
const publicFiles = getPublicFiles(config);
|
|
10314
10314
|
if (publicFiles) {
|
|
10315
|
-
return publicFiles.has(fileName) ? normalizePath$3(path$
|
|
10315
|
+
return publicFiles.has(fileName) ? normalizePath$3(path$c.join(publicDir, fileName)) : void 0;
|
|
10316
10316
|
}
|
|
10317
|
-
const publicFile = normalizePath$3(path$
|
|
10317
|
+
const publicFile = normalizePath$3(path$c.join(publicDir, fileName));
|
|
10318
10318
|
if (!publicFile.startsWith(withTrailingSlash(publicDir))) {
|
|
10319
10319
|
return;
|
|
10320
10320
|
}
|
|
@@ -10506,9 +10506,9 @@ async function fileToDevUrl(environment, id, skipBase = false) {
|
|
|
10506
10506
|
if (publicFile) {
|
|
10507
10507
|
rtn = id;
|
|
10508
10508
|
} else if (id.startsWith(withTrailingSlash(config.root))) {
|
|
10509
|
-
rtn = "/" + path$
|
|
10509
|
+
rtn = "/" + path$c.posix.relative(config.root, id);
|
|
10510
10510
|
} else {
|
|
10511
|
-
rtn = path$
|
|
10511
|
+
rtn = path$c.posix.join(FS_PREFIX, id);
|
|
10512
10512
|
}
|
|
10513
10513
|
if (skipBase) {
|
|
10514
10514
|
return rtn;
|
|
@@ -10566,12 +10566,12 @@ async function fileToBuiltUrl(pluginContext, id, skipPublicCheck = false, forceI
|
|
|
10566
10566
|
url = assetToDataURL(environment, file, content);
|
|
10567
10567
|
} else {
|
|
10568
10568
|
const originalFileName = normalizePath$3(
|
|
10569
|
-
path$
|
|
10569
|
+
path$c.relative(environment.config.root, file)
|
|
10570
10570
|
);
|
|
10571
10571
|
const referenceId = pluginContext.emitFile({
|
|
10572
10572
|
type: "asset",
|
|
10573
10573
|
// Ignore directory structure for asset file names
|
|
10574
|
-
name: path$
|
|
10574
|
+
name: path$c.basename(file),
|
|
10575
10575
|
originalFileName,
|
|
10576
10576
|
source: content
|
|
10577
10577
|
});
|
|
@@ -10588,7 +10588,7 @@ async function urlToBuiltUrl(pluginContext, url, importer, forceInline) {
|
|
|
10588
10588
|
if (checkPublicFile(url, topLevelConfig)) {
|
|
10589
10589
|
return publicFileToBuiltUrl(url, topLevelConfig);
|
|
10590
10590
|
}
|
|
10591
|
-
const file = url[0] === "/" ? path$
|
|
10591
|
+
const file = url[0] === "/" ? path$c.join(topLevelConfig.root, url) : path$c.join(path$c.dirname(importer), url);
|
|
10592
10592
|
return fileToBuiltUrl(
|
|
10593
10593
|
pluginContext,
|
|
10594
10594
|
file,
|
|
@@ -10668,7 +10668,7 @@ function manifestPlugin() {
|
|
|
10668
10668
|
const { root } = this.environment.config;
|
|
10669
10669
|
const buildOptions = this.environment.config.build;
|
|
10670
10670
|
function getChunkName(chunk) {
|
|
10671
|
-
return getChunkOriginalFileName(chunk, root, format) ?? `_${path$
|
|
10671
|
+
return getChunkOriginalFileName(chunk, root, format) ?? `_${path$c.basename(chunk.fileName)}`;
|
|
10672
10672
|
}
|
|
10673
10673
|
function getInternalImports(imports) {
|
|
10674
10674
|
const filteredImports = [];
|
|
@@ -10736,7 +10736,7 @@ function manifestPlugin() {
|
|
|
10736
10736
|
if (chunk.type === "chunk") {
|
|
10737
10737
|
manifest[getChunkName(chunk)] = createChunk(chunk);
|
|
10738
10738
|
} else if (chunk.type === "asset" && chunk.names.length > 0) {
|
|
10739
|
-
const src = chunk.originalFileNames.length > 0 ? chunk.originalFileNames[0] : `_${path$
|
|
10739
|
+
const src = chunk.originalFileNames.length > 0 ? chunk.originalFileNames[0] : `_${path$c.basename(chunk.fileName)}`;
|
|
10740
10740
|
const isEntry = entryCssAssetFileNames.has(chunk.fileName);
|
|
10741
10741
|
const asset = createAsset(chunk, src, isEntry);
|
|
10742
10742
|
const file2 = manifest[src]?.file;
|
|
@@ -10766,9 +10766,9 @@ function manifestPlugin() {
|
|
|
10766
10766
|
}
|
|
10767
10767
|
function getChunkOriginalFileName(chunk, root, format) {
|
|
10768
10768
|
if (chunk.facadeModuleId) {
|
|
10769
|
-
let name = normalizePath$3(path$
|
|
10769
|
+
let name = normalizePath$3(path$c.relative(root, chunk.facadeModuleId));
|
|
10770
10770
|
if (format === "system" && !chunk.name.includes("-legacy")) {
|
|
10771
|
-
const ext = path$
|
|
10771
|
+
const ext = path$c.extname(name);
|
|
10772
10772
|
const endPos = ext.length !== 0 ? -ext.length : void 0;
|
|
10773
10773
|
name = `${name.slice(0, endPos)}-legacy${ext}`;
|
|
10774
10774
|
}
|
|
@@ -11067,7 +11067,7 @@ async function computeSourceRoute(map, file) {
|
|
|
11067
11067
|
let sourceRoot;
|
|
11068
11068
|
try {
|
|
11069
11069
|
sourceRoot = await fsp.realpath(
|
|
11070
|
-
path$
|
|
11070
|
+
path$c.resolve(path$c.dirname(file), map.sourceRoot || "")
|
|
11071
11071
|
);
|
|
11072
11072
|
} catch {
|
|
11073
11073
|
}
|
|
@@ -11087,7 +11087,7 @@ async function injectSourcesContent(map, file, logger) {
|
|
|
11087
11087
|
const sourceRoot = await sourceRootPromise;
|
|
11088
11088
|
let resolvedSourcePath = cleanUrl(decodeURI(sourcePath));
|
|
11089
11089
|
if (sourceRoot) {
|
|
11090
|
-
resolvedSourcePath = path$
|
|
11090
|
+
resolvedSourcePath = path$c.resolve(sourceRoot, resolvedSourcePath);
|
|
11091
11091
|
}
|
|
11092
11092
|
sourcesContent[index] = await fsp.readFile(resolvedSourcePath, "utf-8").catch(() => {
|
|
11093
11093
|
missingSources.push(resolvedSourcePath);
|
|
@@ -11136,7 +11136,7 @@ function applySourcemapIgnoreList(map, sourcemapPath, sourcemapIgnoreList, logge
|
|
|
11136
11136
|
const sourcePath = map.sources[sourcesIndex];
|
|
11137
11137
|
if (!sourcePath) continue;
|
|
11138
11138
|
const ignoreList = sourcemapIgnoreList(
|
|
11139
|
-
path$
|
|
11139
|
+
path$c.isAbsolute(sourcePath) ? sourcePath : path$c.resolve(path$c.dirname(sourcemapPath), sourcePath),
|
|
11140
11140
|
sourcemapPath
|
|
11141
11141
|
);
|
|
11142
11142
|
if (logger && typeof ignoreList !== "boolean") {
|
|
@@ -11165,7 +11165,7 @@ async function extractSourcemapFromFile(code, filePath) {
|
|
|
11165
11165
|
function createConvertSourceMapReadMap(originalFileName) {
|
|
11166
11166
|
return (filename) => {
|
|
11167
11167
|
return fsp.readFile(
|
|
11168
|
-
path$
|
|
11168
|
+
path$c.resolve(path$c.dirname(originalFileName), filename),
|
|
11169
11169
|
"utf-8"
|
|
11170
11170
|
);
|
|
11171
11171
|
};
|
|
@@ -11174,10 +11174,10 @@ function createConvertSourceMapReadMap(originalFileName) {
|
|
|
11174
11174
|
var src$1 = {};
|
|
11175
11175
|
|
|
11176
11176
|
// @ts-check
|
|
11177
|
-
const path$
|
|
11177
|
+
const path$a = require$$0$2;
|
|
11178
11178
|
const fs$7 = require$$0$4;
|
|
11179
11179
|
const os$2 = require$$2;
|
|
11180
|
-
const url$
|
|
11180
|
+
const url$3 = require$$0$5;
|
|
11181
11181
|
|
|
11182
11182
|
const fsReadFileAsync = fs$7.promises.readFile;
|
|
11183
11183
|
|
|
@@ -11210,7 +11210,7 @@ function getDefaultSearchPlaces(name, sync) {
|
|
|
11210
11210
|
* And on Windows, this will never happen. ('C:\build' -> 'C:')
|
|
11211
11211
|
*/
|
|
11212
11212
|
function parentDir(p) {
|
|
11213
|
-
return path$
|
|
11213
|
+
return path$a.dirname(p) || path$a.sep;
|
|
11214
11214
|
}
|
|
11215
11215
|
|
|
11216
11216
|
/** @type {import('./index').LoaderSync} */
|
|
@@ -11230,7 +11230,7 @@ src$1.defaultLoadersSync = defaultLoadersSync;
|
|
|
11230
11230
|
/** @type {import('./index').Loader} */
|
|
11231
11231
|
const dynamicImport = async id => {
|
|
11232
11232
|
try {
|
|
11233
|
-
const fileUrl = url$
|
|
11233
|
+
const fileUrl = url$3.pathToFileURL(id).href;
|
|
11234
11234
|
const mod = await import(/* webpackIgnore: true */ fileUrl);
|
|
11235
11235
|
|
|
11236
11236
|
return mod.default;
|
|
@@ -11284,7 +11284,7 @@ function getOptions(name, options, sync) {
|
|
|
11284
11284
|
},
|
|
11285
11285
|
};
|
|
11286
11286
|
conf.searchPlaces.forEach(place => {
|
|
11287
|
-
const key = path$
|
|
11287
|
+
const key = path$a.extname(place) || 'noExt';
|
|
11288
11288
|
const loader = conf.loaders[key];
|
|
11289
11289
|
if (!loader) {
|
|
11290
11290
|
throw new Error(`Missing loader for extension "${place}"`);
|
|
@@ -11365,14 +11365,14 @@ src$1.lilconfig = function lilconfig(name, options) {
|
|
|
11365
11365
|
}
|
|
11366
11366
|
|
|
11367
11367
|
for (const searchPlace of searchPlaces) {
|
|
11368
|
-
const filepath = path$
|
|
11368
|
+
const filepath = path$a.join(dir, searchPlace);
|
|
11369
11369
|
try {
|
|
11370
11370
|
await fs$7.promises.access(filepath);
|
|
11371
11371
|
} catch {
|
|
11372
11372
|
continue;
|
|
11373
11373
|
}
|
|
11374
11374
|
const content = String(await fsReadFileAsync(filepath));
|
|
11375
|
-
const loaderKey = path$
|
|
11375
|
+
const loaderKey = path$a.extname(searchPlace) || 'noExt';
|
|
11376
11376
|
const loader = loaders[loaderKey];
|
|
11377
11377
|
|
|
11378
11378
|
// handle package.json
|
|
@@ -11420,11 +11420,11 @@ src$1.lilconfig = function lilconfig(name, options) {
|
|
|
11420
11420
|
},
|
|
11421
11421
|
async load(filepath) {
|
|
11422
11422
|
validateFilePath(filepath);
|
|
11423
|
-
const absPath = path$
|
|
11423
|
+
const absPath = path$a.resolve(process.cwd(), filepath);
|
|
11424
11424
|
if (cache && loadCache.has(absPath)) {
|
|
11425
11425
|
return loadCache.get(absPath);
|
|
11426
11426
|
}
|
|
11427
|
-
const {base, ext} = path$
|
|
11427
|
+
const {base, ext} = path$a.parse(absPath);
|
|
11428
11428
|
const loaderKey = ext || 'noExt';
|
|
11429
11429
|
const loader = loaders[loaderKey];
|
|
11430
11430
|
validateLoader(loader, loaderKey);
|
|
@@ -11520,13 +11520,13 @@ src$1.lilconfigSync = function lilconfigSync(name, options) {
|
|
|
11520
11520
|
}
|
|
11521
11521
|
|
|
11522
11522
|
for (const searchPlace of searchPlaces) {
|
|
11523
|
-
const filepath = path$
|
|
11523
|
+
const filepath = path$a.join(dir, searchPlace);
|
|
11524
11524
|
try {
|
|
11525
11525
|
fs$7.accessSync(filepath);
|
|
11526
11526
|
} catch {
|
|
11527
11527
|
continue;
|
|
11528
11528
|
}
|
|
11529
|
-
const loaderKey = path$
|
|
11529
|
+
const loaderKey = path$a.extname(searchPlace) || 'noExt';
|
|
11530
11530
|
const loader = loaders[loaderKey];
|
|
11531
11531
|
const content = String(fs$7.readFileSync(filepath));
|
|
11532
11532
|
|
|
@@ -11575,11 +11575,11 @@ src$1.lilconfigSync = function lilconfigSync(name, options) {
|
|
|
11575
11575
|
},
|
|
11576
11576
|
load(filepath) {
|
|
11577
11577
|
validateFilePath(filepath);
|
|
11578
|
-
const absPath = path$
|
|
11578
|
+
const absPath = path$a.resolve(process.cwd(), filepath);
|
|
11579
11579
|
if (cache && loadCache.has(absPath)) {
|
|
11580
11580
|
return loadCache.get(absPath);
|
|
11581
11581
|
}
|
|
11582
|
-
const {base, ext} = path$
|
|
11582
|
+
const {base, ext} = path$a.parse(absPath);
|
|
11583
11583
|
const loaderKey = ext || 'noExt';
|
|
11584
11584
|
const loader = loaders[loaderKey];
|
|
11585
11585
|
validateLoader(loader, loaderKey);
|
|
@@ -11837,7 +11837,7 @@ async function plugins(config, file) {
|
|
|
11837
11837
|
var plugins_1 = plugins;
|
|
11838
11838
|
|
|
11839
11839
|
// @ts-check
|
|
11840
|
-
const { resolve } = path$
|
|
11840
|
+
const { resolve } = path$c;
|
|
11841
11841
|
|
|
11842
11842
|
const config$1 = src$1;
|
|
11843
11843
|
|
|
@@ -12853,7 +12853,7 @@ function esbuildDepPlugin(environment, qualified, external) {
|
|
|
12853
12853
|
};
|
|
12854
12854
|
}
|
|
12855
12855
|
return {
|
|
12856
|
-
path: path$
|
|
12856
|
+
path: path$c.resolve(resolved)
|
|
12857
12857
|
};
|
|
12858
12858
|
};
|
|
12859
12859
|
return {
|
|
@@ -14257,7 +14257,7 @@ async function prepareEsbuildScanner(environment, entries, deps, missing, scanCo
|
|
|
14257
14257
|
let tsconfigRaw = esbuildOptions.tsconfigRaw;
|
|
14258
14258
|
if (!tsconfigRaw && !esbuildOptions.tsconfig) {
|
|
14259
14259
|
const { tsconfig } = await loadTsconfigJsonForFile(
|
|
14260
|
-
path$
|
|
14260
|
+
path$c.join(environment.config.root, "_dummy.js")
|
|
14261
14261
|
);
|
|
14262
14262
|
if (tsconfig.compilerOptions?.experimentalDecorators) {
|
|
14263
14263
|
tsconfigRaw = { compilerOptions: { experimentalDecorators: true } };
|
|
@@ -14287,7 +14287,7 @@ function globEntries(pattern, environment) {
|
|
|
14287
14287
|
const resolvedPatterns = arraify(pattern);
|
|
14288
14288
|
if (resolvedPatterns.every((str) => !isDynamicPattern(str))) {
|
|
14289
14289
|
return resolvedPatterns.map(
|
|
14290
|
-
(p) => normalizePath$3(path$
|
|
14290
|
+
(p) => normalizePath$3(path$c.resolve(environment.config.root, p))
|
|
14291
14291
|
);
|
|
14292
14292
|
}
|
|
14293
14293
|
return glob(pattern, {
|
|
@@ -14318,7 +14318,7 @@ function esbuildScanPlugin(environment, depImports, missing, entries) {
|
|
|
14318
14318
|
);
|
|
14319
14319
|
}
|
|
14320
14320
|
const resolve = async (id, importer) => {
|
|
14321
|
-
const key = id + (importer && path$
|
|
14321
|
+
const key = id + (importer && path$c.dirname(importer));
|
|
14322
14322
|
if (seen.has(key)) {
|
|
14323
14323
|
return seen.get(key);
|
|
14324
14324
|
}
|
|
@@ -14423,7 +14423,7 @@ function esbuildScanPlugin(environment, depImports, missing, entries) {
|
|
|
14423
14423
|
loader: "js",
|
|
14424
14424
|
// since it is transpiled
|
|
14425
14425
|
contents: await doTransformGlobImport(contents, p, loader),
|
|
14426
|
-
resolveDir: normalizePath$3(path$
|
|
14426
|
+
resolveDir: normalizePath$3(path$c.dirname(p)),
|
|
14427
14427
|
pluginData: {
|
|
14428
14428
|
htmlType: { loader }
|
|
14429
14429
|
}
|
|
@@ -14432,7 +14432,7 @@ function esbuildScanPlugin(environment, depImports, missing, entries) {
|
|
|
14432
14432
|
scripts[key] = {
|
|
14433
14433
|
loader,
|
|
14434
14434
|
contents,
|
|
14435
|
-
resolveDir: normalizePath$3(path$
|
|
14435
|
+
resolveDir: normalizePath$3(path$c.dirname(p)),
|
|
14436
14436
|
pluginData: {
|
|
14437
14437
|
htmlType: { loader }
|
|
14438
14438
|
}
|
|
@@ -14500,7 +14500,7 @@ function esbuildScanPlugin(environment, depImports, missing, entries) {
|
|
|
14500
14500
|
} else if (isScannable(resolved, optimizeDepsOptions.extensions)) {
|
|
14501
14501
|
const namespace = htmlTypesRE.test(resolved) ? "html" : void 0;
|
|
14502
14502
|
return {
|
|
14503
|
-
path: path$
|
|
14503
|
+
path: path$c.resolve(resolved),
|
|
14504
14504
|
namespace
|
|
14505
14505
|
};
|
|
14506
14506
|
} else {
|
|
@@ -14538,7 +14538,7 @@ function esbuildScanPlugin(environment, depImports, missing, entries) {
|
|
|
14538
14538
|
}
|
|
14539
14539
|
const namespace = htmlTypesRE.test(resolved) ? "html" : void 0;
|
|
14540
14540
|
return {
|
|
14541
|
-
path: path$
|
|
14541
|
+
path: path$c.resolve(cleanUrl(resolved)),
|
|
14542
14542
|
namespace
|
|
14543
14543
|
};
|
|
14544
14544
|
} else {
|
|
@@ -14547,7 +14547,7 @@ function esbuildScanPlugin(environment, depImports, missing, entries) {
|
|
|
14547
14547
|
}
|
|
14548
14548
|
);
|
|
14549
14549
|
build.onLoad({ filter: JS_TYPES_RE }, async ({ path: id }) => {
|
|
14550
|
-
let ext = path$
|
|
14550
|
+
let ext = path$c.extname(id).slice(1);
|
|
14551
14551
|
if (ext === "mjs") ext = "js";
|
|
14552
14552
|
const esbuildConfig = environment.config.esbuild;
|
|
14553
14553
|
let contents = await fsp.readFile(id, "utf-8");
|
|
@@ -14589,7 +14589,7 @@ import ${m[1]}`;
|
|
|
14589
14589
|
return js;
|
|
14590
14590
|
}
|
|
14591
14591
|
function shouldExternalizeDep(resolvedId, rawId) {
|
|
14592
|
-
if (!path$
|
|
14592
|
+
if (!path$c.isAbsolute(resolvedId)) {
|
|
14593
14593
|
return true;
|
|
14594
14594
|
}
|
|
14595
14595
|
if (resolvedId === rawId || resolvedId.includes("\0")) {
|
|
@@ -14598,7 +14598,7 @@ function shouldExternalizeDep(resolvedId, rawId) {
|
|
|
14598
14598
|
return false;
|
|
14599
14599
|
}
|
|
14600
14600
|
function isScannable(id, extensions) {
|
|
14601
|
-
return JS_TYPES_RE.test(id) || htmlTypesRE.test(id) || extensions?.includes(path$
|
|
14601
|
+
return JS_TYPES_RE.test(id) || htmlTypesRE.test(id) || extensions?.includes(path$c.extname(id)) || false;
|
|
14602
14602
|
}
|
|
14603
14603
|
|
|
14604
14604
|
function createOptimizeDepsIncludeResolver(environment) {
|
|
@@ -14623,7 +14623,7 @@ function createOptimizeDepsIncludeResolver(environment) {
|
|
|
14623
14623
|
return await resolve(
|
|
14624
14624
|
environment,
|
|
14625
14625
|
nestedPath,
|
|
14626
|
-
path$
|
|
14626
|
+
path$c.resolve(basedir, "package.json")
|
|
14627
14627
|
);
|
|
14628
14628
|
};
|
|
14629
14629
|
}
|
|
@@ -14687,7 +14687,7 @@ function expandGlobIds(id, config) {
|
|
|
14687
14687
|
}
|
|
14688
14688
|
}
|
|
14689
14689
|
const isMatch = picomatch$2(pattern);
|
|
14690
|
-
const matched = possibleExportPaths.filter((p) => isMatch(p)).map((match) => path$
|
|
14690
|
+
const matched = possibleExportPaths.filter((p) => isMatch(p)).map((match) => path$c.posix.join(pkgName, match));
|
|
14691
14691
|
matched.unshift(pkgName);
|
|
14692
14692
|
return matched;
|
|
14693
14693
|
} else {
|
|
@@ -14695,7 +14695,7 @@ function expandGlobIds(id, config) {
|
|
|
14695
14695
|
cwd: pkgData.dir,
|
|
14696
14696
|
expandDirectories: false,
|
|
14697
14697
|
ignore: ["node_modules"]
|
|
14698
|
-
}).map((match) => path$
|
|
14698
|
+
}).map((match) => path$c.posix.join(pkgName, slash$1(match)));
|
|
14699
14699
|
matched.unshift(pkgName);
|
|
14700
14700
|
return matched;
|
|
14701
14701
|
}
|
|
@@ -14800,7 +14800,7 @@ async function loadCachedDepOptimizationMetadata(environment, force = environmen
|
|
|
14800
14800
|
if (!force) {
|
|
14801
14801
|
let cachedMetadata;
|
|
14802
14802
|
try {
|
|
14803
|
-
const cachedMetadataPath = path$
|
|
14803
|
+
const cachedMetadataPath = path$c.join(depsCacheDir, METADATA_FILENAME);
|
|
14804
14804
|
cachedMetadata = parseDepsOptimizerMetadata(
|
|
14805
14805
|
await fsp.readFile(cachedMetadataPath, "utf-8"),
|
|
14806
14806
|
depsCacheDir
|
|
@@ -14892,7 +14892,7 @@ function runOptimizeDeps(environment, depsInfo) {
|
|
|
14892
14892
|
fs__default.mkdirSync(processingCacheDir, { recursive: true });
|
|
14893
14893
|
debug$f?.(colors$1.green(`creating package.json in ${processingCacheDir}`));
|
|
14894
14894
|
fs__default.writeFileSync(
|
|
14895
|
-
path$
|
|
14895
|
+
path$c.resolve(processingCacheDir, "package.json"),
|
|
14896
14896
|
`{
|
|
14897
14897
|
"type": "module"
|
|
14898
14898
|
}
|
|
@@ -14926,7 +14926,7 @@ function runOptimizeDeps(environment, depsInfo) {
|
|
|
14926
14926
|
);
|
|
14927
14927
|
}
|
|
14928
14928
|
committed = true;
|
|
14929
|
-
const dataPath = path$
|
|
14929
|
+
const dataPath = path$c.join(processingCacheDir, METADATA_FILENAME);
|
|
14930
14930
|
debug$f?.(
|
|
14931
14931
|
colors$1.green(`creating ${METADATA_FILENAME} in ${processingCacheDir}`)
|
|
14932
14932
|
);
|
|
@@ -14993,7 +14993,7 @@ function runOptimizeDeps(environment, depsInfo) {
|
|
|
14993
14993
|
}
|
|
14994
14994
|
return context.rebuild().then((result) => {
|
|
14995
14995
|
const meta = result.metafile;
|
|
14996
|
-
const processingCacheDirOutputPath = path$
|
|
14996
|
+
const processingCacheDirOutputPath = path$c.relative(
|
|
14997
14997
|
process.cwd(),
|
|
14998
14998
|
processingCacheDir
|
|
14999
14999
|
);
|
|
@@ -15024,7 +15024,7 @@ function runOptimizeDeps(environment, depsInfo) {
|
|
|
15024
15024
|
}
|
|
15025
15025
|
for (const o of Object.keys(meta.outputs)) {
|
|
15026
15026
|
if (!jsMapExtensionRE.test(o)) {
|
|
15027
|
-
const id = path$
|
|
15027
|
+
const id = path$c.relative(processingCacheDirOutputPath, o).replace(jsExtensionRE, "");
|
|
15028
15028
|
const file = getOptimizedDepPath(environment, id);
|
|
15029
15029
|
if (!findOptimizedDepInfoInRecord(
|
|
15030
15030
|
metadata.optimized,
|
|
@@ -15040,7 +15040,7 @@ function runOptimizeDeps(environment, depsInfo) {
|
|
|
15040
15040
|
} else {
|
|
15041
15041
|
const output = meta.outputs[o];
|
|
15042
15042
|
if (output.bytes === 93) {
|
|
15043
|
-
const jsMapPath = path$
|
|
15043
|
+
const jsMapPath = path$c.resolve(o);
|
|
15044
15044
|
const jsPath = jsMapPath.slice(0, -4);
|
|
15045
15045
|
if (fs__default.existsSync(jsPath) && fs__default.existsSync(jsMapPath)) {
|
|
15046
15046
|
const map = JSON.parse(fs__default.readFileSync(jsMapPath, "utf-8"));
|
|
@@ -15196,7 +15196,7 @@ function depsFromOptimizedDepInfo(depsInfo) {
|
|
|
15196
15196
|
}
|
|
15197
15197
|
function getOptimizedDepPath(environment, id) {
|
|
15198
15198
|
return normalizePath$3(
|
|
15199
|
-
path$
|
|
15199
|
+
path$c.resolve(getDepsCacheDir(environment), flattenId(id) + ".js")
|
|
15200
15200
|
);
|
|
15201
15201
|
}
|
|
15202
15202
|
function getDepsCacheSuffix(environment) {
|
|
@@ -15214,7 +15214,7 @@ function getTempSuffix() {
|
|
|
15214
15214
|
);
|
|
15215
15215
|
}
|
|
15216
15216
|
function getDepsCacheDirPrefix(environment) {
|
|
15217
|
-
return normalizePath$3(path$
|
|
15217
|
+
return normalizePath$3(path$c.resolve(environment.config.cacheDir, "deps"));
|
|
15218
15218
|
}
|
|
15219
15219
|
function createIsOptimizedDepFile(environment) {
|
|
15220
15220
|
const depsCacheDirPrefix = getDepsCacheDirPrefix(environment);
|
|
@@ -15223,7 +15223,7 @@ function createIsOptimizedDepFile(environment) {
|
|
|
15223
15223
|
function createIsOptimizedDepUrl(environment) {
|
|
15224
15224
|
const { root } = environment.config;
|
|
15225
15225
|
const depsCacheDir = getDepsCacheDirPrefix(environment);
|
|
15226
|
-
const depsCacheDirRelative = normalizePath$3(path$
|
|
15226
|
+
const depsCacheDirRelative = normalizePath$3(path$c.relative(root, depsCacheDir));
|
|
15227
15227
|
const depsCacheDirPrefix = depsCacheDirRelative.startsWith("../") ? (
|
|
15228
15228
|
// if the cache directory is outside root, the url prefix would be something
|
|
15229
15229
|
// like '/@fs/absolute/path/to/node_modules/.vite'
|
|
@@ -15240,7 +15240,7 @@ function createIsOptimizedDepUrl(environment) {
|
|
|
15240
15240
|
function parseDepsOptimizerMetadata(jsonMetadata, depsCacheDir) {
|
|
15241
15241
|
const { hash, lockfileHash, configHash, browserHash, optimized, chunks } = JSON.parse(jsonMetadata, (key, value) => {
|
|
15242
15242
|
if (key === "file" || key === "src") {
|
|
15243
|
-
return normalizePath$3(path$
|
|
15243
|
+
return normalizePath$3(path$c.resolve(depsCacheDir, value));
|
|
15244
15244
|
}
|
|
15245
15245
|
return value;
|
|
15246
15246
|
});
|
|
@@ -15301,7 +15301,7 @@ function stringifyDepsOptimizerMetadata(metadata, depsCacheDir) {
|
|
|
15301
15301
|
},
|
|
15302
15302
|
(key, value) => {
|
|
15303
15303
|
if (key === "file" || key === "src") {
|
|
15304
|
-
return normalizePath$3(path$
|
|
15304
|
+
return normalizePath$3(path$c.relative(depsCacheDir, value));
|
|
15305
15305
|
}
|
|
15306
15306
|
return value;
|
|
15307
15307
|
},
|
|
@@ -15312,14 +15312,14 @@ function esbuildOutputFromId(outputs, id, cacheDirOutputPath) {
|
|
|
15312
15312
|
const cwd = process.cwd();
|
|
15313
15313
|
const flatId = flattenId(id) + ".js";
|
|
15314
15314
|
const normalizedOutputPath = normalizePath$3(
|
|
15315
|
-
path$
|
|
15315
|
+
path$c.relative(cwd, path$c.join(cacheDirOutputPath, flatId))
|
|
15316
15316
|
);
|
|
15317
15317
|
const output = outputs[normalizedOutputPath];
|
|
15318
15318
|
if (output) {
|
|
15319
15319
|
return output;
|
|
15320
15320
|
}
|
|
15321
15321
|
for (const [key, value] of Object.entries(outputs)) {
|
|
15322
|
-
if (normalizePath$3(path$
|
|
15322
|
+
if (normalizePath$3(path$c.relative(cwd, key)) === normalizedOutputPath) {
|
|
15323
15323
|
return value;
|
|
15324
15324
|
}
|
|
15325
15325
|
}
|
|
@@ -15347,7 +15347,7 @@ async function extractExportsData(environment, filePath) {
|
|
|
15347
15347
|
try {
|
|
15348
15348
|
parseResult = parse$d(entryContent);
|
|
15349
15349
|
} catch {
|
|
15350
|
-
const loader = esbuildOptions.loader?.[path$
|
|
15350
|
+
const loader = esbuildOptions.loader?.[path$c.extname(filePath)] || "jsx";
|
|
15351
15351
|
debug$f?.(
|
|
15352
15352
|
`Unable to parse: ${filePath}.
|
|
15353
15353
|
Trying again with a ${loader} transform.`
|
|
@@ -15477,7 +15477,7 @@ function getLockfileHash(environment) {
|
|
|
15477
15477
|
);
|
|
15478
15478
|
if (lockfileFormat.checkPatchesDir) {
|
|
15479
15479
|
const baseDir = lockfilePath.slice(0, -lockfileFormat.path.length);
|
|
15480
|
-
const fullPath = path$
|
|
15480
|
+
const fullPath = path$c.join(
|
|
15481
15481
|
baseDir,
|
|
15482
15482
|
lockfileFormat.checkPatchesDir
|
|
15483
15483
|
);
|
|
@@ -15531,12 +15531,12 @@ async function optimizedDepNeedsInterop(environment, metadata, file) {
|
|
|
15531
15531
|
const MAX_TEMP_DIR_AGE_MS = 24 * 60 * 60 * 1e3;
|
|
15532
15532
|
async function cleanupDepsCacheStaleDirs(config) {
|
|
15533
15533
|
try {
|
|
15534
|
-
const cacheDir = path$
|
|
15534
|
+
const cacheDir = path$c.resolve(config.cacheDir);
|
|
15535
15535
|
if (fs__default.existsSync(cacheDir)) {
|
|
15536
15536
|
const dirents = await fsp.readdir(cacheDir, { withFileTypes: true });
|
|
15537
15537
|
for (const dirent of dirents) {
|
|
15538
15538
|
if (dirent.isDirectory() && dirent.name.includes("_temp_")) {
|
|
15539
|
-
const tempDirPath = path$
|
|
15539
|
+
const tempDirPath = path$c.resolve(config.cacheDir, dirent.name);
|
|
15540
15540
|
const stats = await fsp.stat(tempDirPath).catch(() => null);
|
|
15541
15541
|
if (stats?.mtime && Date.now() - stats.mtime.getTime() > MAX_TEMP_DIR_AGE_MS) {
|
|
15542
15542
|
debug$f?.(`removing stale cache temp dir ${tempDirPath}`);
|
|
@@ -15680,7 +15680,7 @@ function createIsExternal(environment) {
|
|
|
15680
15680
|
return processedIds.get(id);
|
|
15681
15681
|
}
|
|
15682
15682
|
let isExternal = false;
|
|
15683
|
-
if (id[0] !== "." && !path$
|
|
15683
|
+
if (id[0] !== "." && !path$c.isAbsolute(id)) {
|
|
15684
15684
|
isExternal = isBuiltin(environment.config.resolve.builtins, id) || isConfiguredAsExternal(id, importer);
|
|
15685
15685
|
}
|
|
15686
15686
|
processedIds.set(id, isExternal);
|
|
@@ -15688,7 +15688,7 @@ function createIsExternal(environment) {
|
|
|
15688
15688
|
};
|
|
15689
15689
|
}
|
|
15690
15690
|
function canExternalizeFile(filePath) {
|
|
15691
|
-
const ext = path$
|
|
15691
|
+
const ext = path$c.extname(filePath);
|
|
15692
15692
|
return !ext || ext === ".js" || ext === ".mjs" || ext === ".cjs";
|
|
15693
15693
|
}
|
|
15694
15694
|
|
|
@@ -15704,7 +15704,7 @@ const debug$d = createDebugger("vite:resolve-details", {
|
|
|
15704
15704
|
});
|
|
15705
15705
|
function resolvePlugin(resolveOptions) {
|
|
15706
15706
|
const { root, isProduction, asSrc, preferRelative = false } = resolveOptions;
|
|
15707
|
-
const rootInRoot = tryStatSync(path$
|
|
15707
|
+
const rootInRoot = tryStatSync(path$c.join(root, root))?.isDirectory() ?? false;
|
|
15708
15708
|
return {
|
|
15709
15709
|
name: "vite:resolve",
|
|
15710
15710
|
async resolveId(id, importer, resolveOpts) {
|
|
@@ -15729,12 +15729,12 @@ function resolvePlugin(resolveOptions) {
|
|
|
15729
15729
|
if (resolvedImports) {
|
|
15730
15730
|
id = resolvedImports;
|
|
15731
15731
|
if (resolveOpts.custom?.["vite:import-glob"]?.isSubImportsPattern) {
|
|
15732
|
-
return normalizePath$3(path$
|
|
15732
|
+
return normalizePath$3(path$c.join(root, id));
|
|
15733
15733
|
}
|
|
15734
15734
|
}
|
|
15735
15735
|
let res;
|
|
15736
15736
|
if (asSrc && depsOptimizer?.isOptimizedDepUrl(id)) {
|
|
15737
|
-
const optimizedPath = id.startsWith(FS_PREFIX) ? fsPathFromId(id) : normalizePath$3(path$
|
|
15737
|
+
const optimizedPath = id.startsWith(FS_PREFIX) ? fsPathFromId(id) : normalizePath$3(path$c.resolve(root, id.slice(1)));
|
|
15738
15738
|
return optimizedPath;
|
|
15739
15739
|
}
|
|
15740
15740
|
if (asSrc && id.startsWith(FS_PREFIX)) {
|
|
@@ -15743,15 +15743,15 @@ function resolvePlugin(resolveOptions) {
|
|
|
15743
15743
|
return ensureVersionQuery(res, id, options, depsOptimizer);
|
|
15744
15744
|
}
|
|
15745
15745
|
if (asSrc && id[0] === "/" && (rootInRoot || !id.startsWith(withTrailingSlash(root)))) {
|
|
15746
|
-
const fsPath = path$
|
|
15746
|
+
const fsPath = path$c.resolve(root, id.slice(1));
|
|
15747
15747
|
if (res = tryFsResolve(fsPath, options)) {
|
|
15748
15748
|
debug$d?.(`[url] ${colors$1.cyan(id)} -> ${colors$1.dim(res)}`);
|
|
15749
15749
|
return ensureVersionQuery(res, id, options, depsOptimizer);
|
|
15750
15750
|
}
|
|
15751
15751
|
}
|
|
15752
15752
|
if (id[0] === "." || (preferRelative || importer?.endsWith(".html")) && startsWithWordCharRE.test(id)) {
|
|
15753
|
-
const basedir = importer ? path$
|
|
15754
|
-
const fsPath = path$
|
|
15753
|
+
const basedir = importer ? path$c.dirname(importer) : process.cwd();
|
|
15754
|
+
const fsPath = path$c.resolve(basedir, id);
|
|
15755
15755
|
const normalizedFsPath = normalizePath$3(fsPath);
|
|
15756
15756
|
if (depsOptimizer?.isOptimizedDepFile(normalizedFsPath)) {
|
|
15757
15757
|
if (!options.isBuild && !DEP_VERSION_RE.test(normalizedFsPath)) {
|
|
@@ -15773,7 +15773,7 @@ function resolvePlugin(resolveOptions) {
|
|
|
15773
15773
|
debug$d?.(`[relative] ${colors$1.cyan(id)} -> ${colors$1.dim(res)}`);
|
|
15774
15774
|
if (!options.idOnly && !options.scan && options.isBuild) {
|
|
15775
15775
|
const resPkg = findNearestPackageData(
|
|
15776
|
-
path$
|
|
15776
|
+
path$c.dirname(res),
|
|
15777
15777
|
options.packageCache
|
|
15778
15778
|
);
|
|
15779
15779
|
if (resPkg) {
|
|
@@ -15791,8 +15791,8 @@ function resolvePlugin(resolveOptions) {
|
|
|
15791
15791
|
id = fileURLToPath$1(file) + postfix;
|
|
15792
15792
|
}
|
|
15793
15793
|
if (isWindows$3 && id[0] === "/") {
|
|
15794
|
-
const basedir = importer ? path$
|
|
15795
|
-
const fsPath = path$
|
|
15794
|
+
const basedir = importer ? path$c.dirname(importer) : process.cwd();
|
|
15795
|
+
const fsPath = path$c.resolve(basedir, id);
|
|
15796
15796
|
if (res = tryFsResolve(fsPath, options)) {
|
|
15797
15797
|
debug$d?.(`[drive-relative] ${colors$1.cyan(id)} -> ${colors$1.dim(res)}`);
|
|
15798
15798
|
return ensureVersionQuery(res, id, options, depsOptimizer);
|
|
@@ -15837,7 +15837,7 @@ function resolvePlugin(resolveOptions) {
|
|
|
15837
15837
|
if (!(options.external === true || options.external.includes(id))) {
|
|
15838
15838
|
let message = `Automatically externalized node built-in module "${id}"`;
|
|
15839
15839
|
if (importer) {
|
|
15840
|
-
message += ` imported from "${path$
|
|
15840
|
+
message += ` imported from "${path$c.relative(
|
|
15841
15841
|
process.cwd(),
|
|
15842
15842
|
importer
|
|
15843
15843
|
)}"`;
|
|
@@ -15852,7 +15852,7 @@ function resolvePlugin(resolveOptions) {
|
|
|
15852
15852
|
(options.external === true || !options.external.includes(id))) {
|
|
15853
15853
|
let message = `Cannot bundle built-in module "${id}"`;
|
|
15854
15854
|
if (importer) {
|
|
15855
|
-
message += ` imported from "${path$
|
|
15855
|
+
message += ` imported from "${path$c.relative(
|
|
15856
15856
|
process.cwd(),
|
|
15857
15857
|
importer
|
|
15858
15858
|
)}"`;
|
|
@@ -15902,7 +15902,7 @@ function resolvePlugin(resolveOptions) {
|
|
|
15902
15902
|
}
|
|
15903
15903
|
function resolveSubpathImports(id, importer, options) {
|
|
15904
15904
|
if (!importer || !id.startsWith(subpathImportsPrefix)) return;
|
|
15905
|
-
const basedir = path$
|
|
15905
|
+
const basedir = path$c.dirname(importer);
|
|
15906
15906
|
const pkgData = findNearestPackageData(basedir, options.packageCache);
|
|
15907
15907
|
if (!pkgData) return;
|
|
15908
15908
|
let { file: idWithoutPostfix, postfix } = splitFileAndPostfix(id.slice(1));
|
|
@@ -15914,7 +15914,7 @@ function resolveSubpathImports(id, importer, options) {
|
|
|
15914
15914
|
"imports"
|
|
15915
15915
|
);
|
|
15916
15916
|
if (importsPath?.[0] === ".") {
|
|
15917
|
-
importsPath = path$
|
|
15917
|
+
importsPath = path$c.relative(basedir, path$c.join(pkgData.dir, importsPath));
|
|
15918
15918
|
if (importsPath[0] !== ".") {
|
|
15919
15919
|
importsPath = `./${importsPath}`;
|
|
15920
15920
|
}
|
|
@@ -15956,10 +15956,10 @@ function tryCleanFsResolve(file, options, tryIndex = true, skipPackageJson = fal
|
|
|
15956
15956
|
let res;
|
|
15957
15957
|
const possibleJsToTs = isPossibleTsOutput(file);
|
|
15958
15958
|
if (possibleJsToTs || options.extensions.length || tryPrefix) {
|
|
15959
|
-
const dirPath = path$
|
|
15959
|
+
const dirPath = path$c.dirname(file);
|
|
15960
15960
|
if (isDirectory(dirPath)) {
|
|
15961
15961
|
if (possibleJsToTs) {
|
|
15962
|
-
const fileExt = path$
|
|
15962
|
+
const fileExt = path$c.extname(file);
|
|
15963
15963
|
const fileName = file.slice(0, -fileExt.length);
|
|
15964
15964
|
if (res = tryResolveRealFile(
|
|
15965
15965
|
fileName + fileExt.replace("js", "ts"),
|
|
@@ -15976,7 +15976,7 @@ function tryCleanFsResolve(file, options, tryIndex = true, skipPackageJson = fal
|
|
|
15976
15976
|
))
|
|
15977
15977
|
return res;
|
|
15978
15978
|
if (tryPrefix) {
|
|
15979
|
-
const prefixed = `${dirPath}/${options.tryPrefix}${path$
|
|
15979
|
+
const prefixed = `${dirPath}/${options.tryPrefix}${path$c.basename(file)}`;
|
|
15980
15980
|
if (res = tryResolveRealFile(prefixed, preserveSymlinks)) return res;
|
|
15981
15981
|
if (res = tryResolveRealFileWithExtensions(
|
|
15982
15982
|
prefixed,
|
|
@@ -16027,9 +16027,9 @@ function tryNodeResolve(id, importer, options, depsOptimizer, externalize) {
|
|
|
16027
16027
|
let basedir;
|
|
16028
16028
|
if (dedupe.includes(pkgId)) {
|
|
16029
16029
|
basedir = root;
|
|
16030
|
-
} else if (importer && path$
|
|
16030
|
+
} else if (importer && path$c.isAbsolute(importer) && // css processing appends `*` for importer
|
|
16031
16031
|
(importer.endsWith("*") || fs__default.existsSync(cleanUrl(importer)))) {
|
|
16032
|
-
basedir = path$
|
|
16032
|
+
basedir = path$c.dirname(importer);
|
|
16033
16033
|
} else {
|
|
16034
16034
|
basedir = root;
|
|
16035
16035
|
}
|
|
@@ -16069,7 +16069,7 @@ function tryNodeResolve(id, importer, options, depsOptimizer, externalize) {
|
|
|
16069
16069
|
return resolved2;
|
|
16070
16070
|
}
|
|
16071
16071
|
let resolvedId = id;
|
|
16072
|
-
if (deepMatch && !pkg.data.exports && path$
|
|
16072
|
+
if (deepMatch && !pkg.data.exports && path$c.extname(id) !== path$c.extname(resolved2.id)) {
|
|
16073
16073
|
const index = resolved2.id.indexOf(id);
|
|
16074
16074
|
if (index > -1) {
|
|
16075
16075
|
resolvedId = resolved2.id.slice(index);
|
|
@@ -16163,7 +16163,7 @@ function resolvePackageEntry(id, { dir, data, setResolvedCache, getResolvedCache
|
|
|
16163
16163
|
const entryPoints = entryPoint ? [entryPoint] : ["index.js", "index.json", "index.node"];
|
|
16164
16164
|
for (let entry of entryPoints) {
|
|
16165
16165
|
let skipPackageJson = false;
|
|
16166
|
-
if (options.mainFields[0] === "sass" && !options.extensions.includes(path$
|
|
16166
|
+
if (options.mainFields[0] === "sass" && !options.extensions.includes(path$c.extname(entry))) {
|
|
16167
16167
|
entry = "";
|
|
16168
16168
|
skipPackageJson = true;
|
|
16169
16169
|
} else {
|
|
@@ -16172,7 +16172,7 @@ function resolvePackageEntry(id, { dir, data, setResolvedCache, getResolvedCache
|
|
|
16172
16172
|
entry = mapWithBrowserField(entry, browserField) || entry;
|
|
16173
16173
|
}
|
|
16174
16174
|
}
|
|
16175
|
-
const entryPointPath = path$
|
|
16175
|
+
const entryPointPath = path$c.join(dir, entry);
|
|
16176
16176
|
const resolvedEntryPoint = tryFsResolve(
|
|
16177
16177
|
entryPointPath,
|
|
16178
16178
|
options,
|
|
@@ -16238,7 +16238,7 @@ function resolveDeepImport(id, { setResolvedCache, getResolvedCache, dir, data }
|
|
|
16238
16238
|
}
|
|
16239
16239
|
if (!relativeId) {
|
|
16240
16240
|
throw new Error(
|
|
16241
|
-
`Package subpath '${relativeId}' is not defined by "exports" in ${path$
|
|
16241
|
+
`Package subpath '${relativeId}' is not defined by "exports" in ${path$c.join(dir, "package.json")}.`
|
|
16242
16242
|
);
|
|
16243
16243
|
}
|
|
16244
16244
|
} else if (options.mainFields.includes("browser") && isObject$1(browserField)) {
|
|
@@ -16253,7 +16253,7 @@ function resolveDeepImport(id, { setResolvedCache, getResolvedCache, dir, data }
|
|
|
16253
16253
|
}
|
|
16254
16254
|
if (relativeId) {
|
|
16255
16255
|
const resolved = tryFsResolve(
|
|
16256
|
-
path$
|
|
16256
|
+
path$c.join(dir, relativeId),
|
|
16257
16257
|
options,
|
|
16258
16258
|
!exportsField
|
|
16259
16259
|
// try index only if no exports field
|
|
@@ -16269,9 +16269,9 @@ function resolveDeepImport(id, { setResolvedCache, getResolvedCache, dir, data }
|
|
|
16269
16269
|
}
|
|
16270
16270
|
function tryResolveBrowserMapping(id, importer, options, isFilePath, externalize) {
|
|
16271
16271
|
let res;
|
|
16272
|
-
const pkg = importer && findNearestPackageData(path$
|
|
16272
|
+
const pkg = importer && findNearestPackageData(path$c.dirname(importer), options.packageCache);
|
|
16273
16273
|
if (pkg && isObject$1(pkg.data.browser)) {
|
|
16274
|
-
const mapId = isFilePath ? "./" + slash$1(path$
|
|
16274
|
+
const mapId = isFilePath ? "./" + slash$1(path$c.relative(pkg.dir, id)) : id;
|
|
16275
16275
|
const browserMappedPath = mapWithBrowserField(mapId, pkg.data.browser);
|
|
16276
16276
|
if (browserMappedPath) {
|
|
16277
16277
|
if (res = bareImportRE.test(browserMappedPath) ? tryNodeResolve(
|
|
@@ -16280,7 +16280,7 @@ function tryResolveBrowserMapping(id, importer, options, isFilePath, externalize
|
|
|
16280
16280
|
options,
|
|
16281
16281
|
void 0,
|
|
16282
16282
|
void 0
|
|
16283
|
-
)?.id : tryFsResolve(path$
|
|
16283
|
+
)?.id : tryFsResolve(path$c.join(pkg.dir, browserMappedPath), options)) {
|
|
16284
16284
|
debug$d?.(`[browser mapped] ${colors$1.cyan(id)} -> ${colors$1.dim(res)}`);
|
|
16285
16285
|
let result = { id: res };
|
|
16286
16286
|
if (options.idOnly) {
|
|
@@ -16288,7 +16288,7 @@ function tryResolveBrowserMapping(id, importer, options, isFilePath, externalize
|
|
|
16288
16288
|
}
|
|
16289
16289
|
if (!options.scan && options.isBuild) {
|
|
16290
16290
|
const resPkg = findNearestPackageData(
|
|
16291
|
-
path$
|
|
16291
|
+
path$c.dirname(res),
|
|
16292
16292
|
options.packageCache
|
|
16293
16293
|
);
|
|
16294
16294
|
if (resPkg) {
|
|
@@ -16310,7 +16310,7 @@ function tryResolveBrowserEntry(dir, data, options) {
|
|
|
16310
16310
|
if (browserEntry) {
|
|
16311
16311
|
if (!options.isRequire && options.mainFields.includes("module") && typeof data.module === "string" && data.module !== browserEntry) {
|
|
16312
16312
|
const resolvedBrowserEntry = tryFsResolve(
|
|
16313
|
-
path$
|
|
16313
|
+
path$c.join(dir, browserEntry),
|
|
16314
16314
|
options
|
|
16315
16315
|
);
|
|
16316
16316
|
if (resolvedBrowserEntry) {
|
|
@@ -16327,9 +16327,9 @@ function tryResolveBrowserEntry(dir, data, options) {
|
|
|
16327
16327
|
}
|
|
16328
16328
|
}
|
|
16329
16329
|
function mapWithBrowserField(relativePathInPkgDir, map) {
|
|
16330
|
-
const normalizedPath = path$
|
|
16330
|
+
const normalizedPath = path$c.posix.normalize(relativePathInPkgDir);
|
|
16331
16331
|
for (const key in map) {
|
|
16332
|
-
const normalizedKey = path$
|
|
16332
|
+
const normalizedKey = path$c.posix.normalize(key);
|
|
16333
16333
|
if (normalizedPath === normalizedKey || equalWithoutSuffix(normalizedPath, normalizedKey, ".js") || equalWithoutSuffix(normalizedPath, normalizedKey, "/index.js")) {
|
|
16334
16334
|
return map[key];
|
|
16335
16335
|
}
|
|
@@ -16454,7 +16454,7 @@ var require$$4 = {
|
|
|
16454
16454
|
version: version$1};
|
|
16455
16455
|
|
|
16456
16456
|
const fs$6 = require$$0$4;
|
|
16457
|
-
const path$
|
|
16457
|
+
const path$9 = require$$0$2;
|
|
16458
16458
|
const os$1 = require$$2;
|
|
16459
16459
|
const crypto$1 = require$$3;
|
|
16460
16460
|
const packageJson = require$$4;
|
|
@@ -16624,7 +16624,7 @@ function _vaultPath (options) {
|
|
|
16624
16624
|
possibleVaultPath = options.path.endsWith('.vault') ? options.path : `${options.path}.vault`;
|
|
16625
16625
|
}
|
|
16626
16626
|
} else {
|
|
16627
|
-
possibleVaultPath = path$
|
|
16627
|
+
possibleVaultPath = path$9.resolve(process.cwd(), '.env.vault');
|
|
16628
16628
|
}
|
|
16629
16629
|
|
|
16630
16630
|
if (fs$6.existsSync(possibleVaultPath)) {
|
|
@@ -16635,7 +16635,7 @@ function _vaultPath (options) {
|
|
|
16635
16635
|
}
|
|
16636
16636
|
|
|
16637
16637
|
function _resolveHome (envPath) {
|
|
16638
|
-
return envPath[0] === '~' ? path$
|
|
16638
|
+
return envPath[0] === '~' ? path$9.join(os$1.homedir(), envPath.slice(1)) : envPath
|
|
16639
16639
|
}
|
|
16640
16640
|
|
|
16641
16641
|
function _configVault (options) {
|
|
@@ -16657,7 +16657,7 @@ function _configVault (options) {
|
|
|
16657
16657
|
}
|
|
16658
16658
|
|
|
16659
16659
|
function configDotenv (options) {
|
|
16660
|
-
const dotenvPath = path$
|
|
16660
|
+
const dotenvPath = path$9.resolve(process.cwd(), '.env');
|
|
16661
16661
|
let encoding = 'utf8';
|
|
16662
16662
|
const debug = Boolean(options && options.debug);
|
|
16663
16663
|
|
|
@@ -16925,7 +16925,7 @@ function getEnvFilesForMode(mode, envDir) {
|
|
|
16925
16925
|
`.env.${mode}`,
|
|
16926
16926
|
/** mode local file */
|
|
16927
16927
|
`.env.${mode}.local`
|
|
16928
|
-
].map((file) => normalizePath$3(path$
|
|
16928
|
+
].map((file) => normalizePath$3(path$c.join(envDir, file)));
|
|
16929
16929
|
}
|
|
16930
16930
|
return [];
|
|
16931
16931
|
}
|
|
@@ -17091,7 +17091,7 @@ function errorMiddleware(server, allowNext = false) {
|
|
|
17091
17091
|
"\\u003c"
|
|
17092
17092
|
)}
|
|
17093
17093
|
try {
|
|
17094
|
-
const { ErrorOverlay } = await import(${JSON.stringify(path$
|
|
17094
|
+
const { ErrorOverlay } = await import(${JSON.stringify(path$c.posix.join(server.config.base, CLIENT_PUBLIC_PATH))})
|
|
17095
17095
|
document.body.appendChild(new ErrorOverlay(error))
|
|
17096
17096
|
} catch {
|
|
17097
17097
|
const h = (tag, text) => {
|
|
@@ -18175,9 +18175,9 @@ var parseurl$1 = {exports: {}};
|
|
|
18175
18175
|
* @private
|
|
18176
18176
|
*/
|
|
18177
18177
|
|
|
18178
|
-
var url$
|
|
18179
|
-
var parse$a = url$
|
|
18180
|
-
var Url = url$
|
|
18178
|
+
var url$2 = require$$0$5;
|
|
18179
|
+
var parse$a = url$2.parse;
|
|
18180
|
+
var Url = url$2.Url;
|
|
18181
18181
|
|
|
18182
18182
|
/**
|
|
18183
18183
|
* Module exports.
|
|
@@ -21999,12 +21999,12 @@ var require$$0 = [
|
|
|
21999
21999
|
|
|
22000
22000
|
var binaryExtensions$1 = require$$0;
|
|
22001
22001
|
|
|
22002
|
-
const path$
|
|
22002
|
+
const path$8 = require$$0$2;
|
|
22003
22003
|
const binaryExtensions = binaryExtensions$1;
|
|
22004
22004
|
|
|
22005
22005
|
const extensions = new Set(binaryExtensions);
|
|
22006
22006
|
|
|
22007
|
-
var isBinaryPath$1 = filePath => extensions.has(path$
|
|
22007
|
+
var isBinaryPath$1 = filePath => extensions.has(path$8.extname(filePath).slice(1).toLowerCase());
|
|
22008
22008
|
|
|
22009
22009
|
var constants$1 = {};
|
|
22010
22010
|
|
|
@@ -24221,57 +24221,144 @@ const watch = (paths, options) => {
|
|
|
24221
24221
|
|
|
24222
24222
|
chokidar.watch = watch;
|
|
24223
24223
|
|
|
24224
|
+
var guess = {exports: {}};
|
|
24225
|
+
|
|
24224
24226
|
var shellQuote$1 = {};
|
|
24225
24227
|
|
|
24228
|
+
/** @import { ControlOperator } from './parse' */
|
|
24229
|
+
|
|
24230
|
+
/** @type {ControlOperator['op'][]} */
|
|
24231
|
+
var OPS = /** @type {const} */ ([
|
|
24232
|
+
'||',
|
|
24233
|
+
'&&',
|
|
24234
|
+
';;&',
|
|
24235
|
+
';;',
|
|
24236
|
+
';&',
|
|
24237
|
+
'|&',
|
|
24238
|
+
'<(',
|
|
24239
|
+
'>(',
|
|
24240
|
+
'<<<',
|
|
24241
|
+
'<<-',
|
|
24242
|
+
'<<',
|
|
24243
|
+
'>>',
|
|
24244
|
+
'>&',
|
|
24245
|
+
'>|',
|
|
24246
|
+
'&>>',
|
|
24247
|
+
'&>',
|
|
24248
|
+
'<&',
|
|
24249
|
+
'<>',
|
|
24250
|
+
'&',
|
|
24251
|
+
';',
|
|
24252
|
+
'(',
|
|
24253
|
+
')',
|
|
24254
|
+
'|',
|
|
24255
|
+
'<',
|
|
24256
|
+
'>'
|
|
24257
|
+
]);
|
|
24258
|
+
var LINE_TERMINATORS = /[\n\r\u2028\u2029]/;
|
|
24259
|
+
var GLOB_SHELL_SPECIAL = /[\s#!"$&'():;<=>@\\^`|~]/g;
|
|
24260
|
+
|
|
24261
|
+
/** @type {typeof import('./quote')} */
|
|
24226
24262
|
var quote = function quote(xs) {
|
|
24263
|
+
var sawComment = false;
|
|
24227
24264
|
return xs.map(function (s) {
|
|
24265
|
+
if (sawComment && typeof s === 'string' && LINE_TERMINATORS.test(s)) {
|
|
24266
|
+
throw new TypeError('a token after a `comment` must not contain line terminators');
|
|
24267
|
+
}
|
|
24228
24268
|
if (s === '') {
|
|
24229
|
-
return '\'\'';
|
|
24269
|
+
return /** @type {const} */ ('\'\'');
|
|
24230
24270
|
}
|
|
24231
24271
|
if (s && typeof s === 'object') {
|
|
24232
|
-
|
|
24272
|
+
if ('op' in s && s.op === 'glob') {
|
|
24273
|
+
if (typeof s.pattern !== 'string') {
|
|
24274
|
+
throw new TypeError('glob token requires a string `pattern`');
|
|
24275
|
+
}
|
|
24276
|
+
if (LINE_TERMINATORS.test(s.pattern)) {
|
|
24277
|
+
throw new TypeError('glob `pattern` must not contain line terminators');
|
|
24278
|
+
}
|
|
24279
|
+
if (s.pattern === '') {
|
|
24280
|
+
return /** @type {const} */ ('\'\'');
|
|
24281
|
+
}
|
|
24282
|
+
return s.pattern.replace(GLOB_SHELL_SPECIAL, '\\$&');
|
|
24283
|
+
}
|
|
24284
|
+
if ('op' in s && typeof s.op === 'string') {
|
|
24285
|
+
if (OPS.indexOf(s.op) < 0) {
|
|
24286
|
+
throw new TypeError('invalid `op` value: ' + JSON.stringify(s.op));
|
|
24287
|
+
}
|
|
24288
|
+
return s.op.replace(/[\s\S]/g, '\\$&');
|
|
24289
|
+
}
|
|
24290
|
+
if ('comment' in s && typeof s.comment === 'string') {
|
|
24291
|
+
if (LINE_TERMINATORS.test(s.comment)) {
|
|
24292
|
+
throw new TypeError('`comment` must not contain line terminators');
|
|
24293
|
+
}
|
|
24294
|
+
sawComment = true;
|
|
24295
|
+
return '#' + s.comment;
|
|
24296
|
+
}
|
|
24297
|
+
throw new TypeError('unrecognized object token shape');
|
|
24298
|
+
}
|
|
24299
|
+
if ((/'/).test(s) && (/!/).test(s)) {
|
|
24300
|
+
return "'" + s.replace(/'/g, "'\"'\"'") + "'";
|
|
24233
24301
|
}
|
|
24234
|
-
if ((/["\s]/).test(s) && !(/'/).test(s)) {
|
|
24235
|
-
return "'" + s
|
|
24302
|
+
if ((/["\s\\]/).test(s) && !(/'/).test(s)) {
|
|
24303
|
+
return "'" + s + "'";
|
|
24236
24304
|
}
|
|
24237
24305
|
if ((/["'\s]/).test(s)) {
|
|
24238
|
-
return '"' + s.replace(/(["
|
|
24306
|
+
return '"' + s.replace(/(["\\$`])/g, '\\$1') + '"';
|
|
24239
24307
|
}
|
|
24240
|
-
return String(s).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}])/g, '$1\\$2');
|
|
24308
|
+
return String(s).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}~])/g, '$1\\$2');
|
|
24241
24309
|
}).join(' ');
|
|
24242
24310
|
};
|
|
24243
24311
|
|
|
24244
|
-
|
|
24312
|
+
/**
|
|
24313
|
+
* @import {
|
|
24314
|
+
* ControlOperator,
|
|
24315
|
+
* Env,
|
|
24316
|
+
* GlobPattern,
|
|
24317
|
+
* ParseEntry,
|
|
24318
|
+
* } from './parse' */
|
|
24319
|
+
|
|
24320
|
+
// '<(' and '>(' are process substitution operators and
|
|
24245
24321
|
// can be parsed the same as control operator
|
|
24246
|
-
var CONTROL = '(?:' + [
|
|
24322
|
+
var CONTROL = /** @type {const} */ ('(?:') + /** @type {const} */ ([
|
|
24247
24323
|
'\\|\\|',
|
|
24248
|
-
'
|
|
24249
|
-
'
|
|
24250
|
-
'
|
|
24324
|
+
'\\&(?:\\&|>>?)', // `&&`, `&>`, and `&>>`
|
|
24325
|
+
';;\\&?', // `;;` and `;;&`
|
|
24326
|
+
'[;|]\\&', // `;&` and `|&`
|
|
24251
24327
|
'\\<\\(',
|
|
24252
24328
|
'\\<\\<\\<',
|
|
24329
|
+
'\\<\\<-',
|
|
24330
|
+
'\\<\\<(?!\\()', // `<<(` stays `<` and `<(`, as zsh reads it; other shells reject it
|
|
24253
24331
|
'>>',
|
|
24254
|
-
'
|
|
24255
|
-
'
|
|
24332
|
+
'>[&|(]', // `>&`, `>|`, and `>(`
|
|
24333
|
+
'<[&>]', // `<&` and `<>`
|
|
24256
24334
|
'[&;()|<>]'
|
|
24257
|
-
].join('|') + ')';
|
|
24335
|
+
]).join(/** @type {const} */ ('|')) + /** @type {const} */ (')');
|
|
24258
24336
|
var controlRE = new RegExp('^' + CONTROL + '$');
|
|
24259
|
-
var META = '|&;()<> \\t';
|
|
24260
|
-
var SINGLE_QUOTE = '
|
|
24261
|
-
|
|
24337
|
+
var META = /** @type {const} */ ('|&;()<> \\t');
|
|
24338
|
+
var SINGLE_QUOTE = /** @type {const} */ ('\'([^\']*?)\'');
|
|
24339
|
+
// bash ANSI-C quoting, `$'...'`: a backslash escapes the next character, including `'`
|
|
24340
|
+
var ANSI_C_BODY = '(?:\\\\[\\s\\S]|[^\\\\\'])*?';
|
|
24341
|
+
var ANSI_C_QUOTE = '\\$\'' + ANSI_C_BODY + '\'';
|
|
24342
|
+
var ansiCAt = new RegExp('\\$\'' + ANSI_C_BODY + '(?:(\')|\\\\?$)', 'g');
|
|
24343
|
+
var ANSI_C_LETTERS = 'abeEfnrtv';
|
|
24344
|
+
var ANSI_C_CHARS = '\x07\b\x1B\x1B\f\n\r\t\v';
|
|
24262
24345
|
var hash = /^#$/;
|
|
24263
24346
|
|
|
24264
|
-
var SQ = "'";
|
|
24265
|
-
var DQ = '"';
|
|
24266
|
-
var DS = '$';
|
|
24347
|
+
var SQ = /** @type {const} */ ("'");
|
|
24348
|
+
var DQ = /** @type {const} */ ('"');
|
|
24349
|
+
var DS = /** @type {const} */ ('$');
|
|
24267
24350
|
|
|
24268
24351
|
var TOKEN = '';
|
|
24269
|
-
var mult = 0x100000000; // Math.pow(16, 8);
|
|
24352
|
+
var mult = /** @type {const} */ (0x100000000); // Math.pow(16, 8);
|
|
24270
24353
|
for (var i = 0; i < 4; i++) {
|
|
24271
24354
|
TOKEN += (mult * Math.random()).toString(16);
|
|
24272
24355
|
}
|
|
24273
24356
|
var startsWithToken = new RegExp('^' + TOKEN);
|
|
24274
24357
|
|
|
24358
|
+
/**
|
|
24359
|
+
* @param {string} s
|
|
24360
|
+
* @param {RegExp} r
|
|
24361
|
+
*/
|
|
24275
24362
|
function matchAll(s, r) {
|
|
24276
24363
|
var origIndex = r.lastIndex;
|
|
24277
24364
|
|
|
@@ -24279,7 +24366,7 @@ function matchAll(s, r) {
|
|
|
24279
24366
|
var matchObj;
|
|
24280
24367
|
|
|
24281
24368
|
while ((matchObj = r.exec(s))) {
|
|
24282
|
-
matches.
|
|
24369
|
+
matches[matches.length] = matchObj;
|
|
24283
24370
|
if (r.lastIndex === matchObj.index) {
|
|
24284
24371
|
r.lastIndex += 1;
|
|
24285
24372
|
}
|
|
@@ -24290,6 +24377,11 @@ function matchAll(s, r) {
|
|
|
24290
24377
|
return matches;
|
|
24291
24378
|
}
|
|
24292
24379
|
|
|
24380
|
+
/**
|
|
24381
|
+
* @param {Env} env
|
|
24382
|
+
* @param {string} pre
|
|
24383
|
+
* @param {string} key
|
|
24384
|
+
*/
|
|
24293
24385
|
function getVar(env, pre, key) {
|
|
24294
24386
|
var r = typeof env === 'function' ? env(key) : env[key];
|
|
24295
24387
|
if (typeof r === 'undefined' && key != '') {
|
|
@@ -24304,16 +24396,64 @@ function getVar(env, pre, key) {
|
|
|
24304
24396
|
return pre + r;
|
|
24305
24397
|
}
|
|
24306
24398
|
|
|
24399
|
+
var ansiCEscape = /\\([0-7]{1,3}|x[\dA-Fa-f]{1,2}|u[\dA-Fa-f]{1,4}|U[\dA-Fa-f]{1,8}|c(?:\\\\|[\s\S])|[abeEfnrtv\\'"?])/g;
|
|
24400
|
+
|
|
24401
|
+
/**
|
|
24402
|
+
* @param {string} m
|
|
24403
|
+
* @param {string} escape
|
|
24404
|
+
*/
|
|
24405
|
+
function expandAnsiCEscape(m, escape) {
|
|
24406
|
+
var kind = escape.charAt(0);
|
|
24407
|
+
if (kind === 'c') {
|
|
24408
|
+
var ctrl = escape.charAt(1);
|
|
24409
|
+
return ctrl === '?' ? '\x7F' : String.fromCharCode(ctrl.charCodeAt(0) & 0x1F);
|
|
24410
|
+
}
|
|
24411
|
+
if (kind === 'x' || kind === 'u' || kind === 'U') {
|
|
24412
|
+
var cp = parseInt(escape.slice(1), 16);
|
|
24413
|
+
if (cp > 0x10FFFF) {
|
|
24414
|
+
return m;
|
|
24415
|
+
}
|
|
24416
|
+
return String.fromCharCode.apply(null, cp > 0xFFFF ? [0xD7C0 + (cp >> 10), 0xDC00 + (cp & 0x3FF)] : [cp]);
|
|
24417
|
+
}
|
|
24418
|
+
if (kind >= '0' && kind <= '7') {
|
|
24419
|
+
return String.fromCharCode(parseInt(escape, 8) & 0xFF);
|
|
24420
|
+
}
|
|
24421
|
+
var letter = ANSI_C_LETTERS.indexOf(escape);
|
|
24422
|
+
return letter < 0 ? escape : ANSI_C_CHARS.charAt(letter);
|
|
24423
|
+
}
|
|
24424
|
+
|
|
24425
|
+
/** @param {string} body */
|
|
24426
|
+
function expandAnsiC(body) {
|
|
24427
|
+
return body.replace(ansiCEscape, expandAnsiCEscape).split('\0')[0]; // like bash, a NUL ends the string
|
|
24428
|
+
}
|
|
24429
|
+
|
|
24430
|
+
/**
|
|
24431
|
+
* @param {string} s
|
|
24432
|
+
* @param {number} i
|
|
24433
|
+
*/
|
|
24434
|
+
function closesAnsiC(s, i) {
|
|
24435
|
+
ansiCAt.lastIndex = i;
|
|
24436
|
+
return !!(/** @type {RegExpExecArray} */ (ansiCAt.exec(s)))[1];
|
|
24437
|
+
}
|
|
24438
|
+
|
|
24439
|
+
/**
|
|
24440
|
+
* @param {string} string
|
|
24441
|
+
* @param {Env} [env]
|
|
24442
|
+
* @param {{ escape?: string, splitUnquoted?: boolean | string }} [opts]
|
|
24443
|
+
* @returns {ParseEntry[]}
|
|
24444
|
+
*/
|
|
24307
24445
|
function parseInternal(string, env, opts) {
|
|
24308
24446
|
if (!opts) {
|
|
24309
24447
|
opts = {};
|
|
24310
24448
|
}
|
|
24311
24449
|
var BS = opts.escape || '\\';
|
|
24312
|
-
var
|
|
24450
|
+
var ifs = opts.splitUnquoted === true ? ' \t\n' : (typeof opts.splitUnquoted === 'string' ? opts.splitUnquoted : '');
|
|
24451
|
+
var BAREWORD = '(\\' + BS + '[\'"$\\' + BS + META + ']|\\$\\$|\\$(?!' + ANSI_C_QUOTE.slice(2) + ')|[^\\s\'"$' + META + '])+';
|
|
24452
|
+
var DOUBLE_QUOTE = '"(?:\\' + BS + '[\\s\\S]|[^"\\' + BS + '])*"';
|
|
24313
24453
|
|
|
24314
24454
|
var chunker = new RegExp([
|
|
24315
24455
|
'(' + CONTROL + ')', // control chars
|
|
24316
|
-
'(' +
|
|
24456
|
+
'(' + ANSI_C_QUOTE + '|' + BAREWORD + '|' + DOUBLE_QUOTE + '|' + SINGLE_QUOTE + ')+'
|
|
24317
24457
|
].join('|'), 'g');
|
|
24318
24458
|
|
|
24319
24459
|
var matches = matchAll(string, chunker);
|
|
@@ -24333,7 +24473,7 @@ function parseInternal(string, env, opts) {
|
|
|
24333
24473
|
return void 0;
|
|
24334
24474
|
}
|
|
24335
24475
|
if (controlRE.test(s)) {
|
|
24336
|
-
return { op: s };
|
|
24476
|
+
return /** @type {ControlOperator} */ ({ op: s });
|
|
24337
24477
|
}
|
|
24338
24478
|
|
|
24339
24479
|
// Hand-written scanner/parser for Bash quoting rules:
|
|
@@ -24347,15 +24487,24 @@ function parseInternal(string, env, opts) {
|
|
|
24347
24487
|
// 4. quote context can switch mid-token if there is no whitespace
|
|
24348
24488
|
// between the two quote contexts (e.g. all'one'"token" parses as
|
|
24349
24489
|
// "allonetoken")
|
|
24490
|
+
/** @type {string | boolean} */
|
|
24350
24491
|
var quote = false;
|
|
24351
24492
|
var esc = false;
|
|
24352
24493
|
var out = '';
|
|
24494
|
+
/** @type {string[]} */
|
|
24495
|
+
var words = [];
|
|
24496
|
+
var sawQuote = false;
|
|
24497
|
+
/** @type {number | null} */
|
|
24498
|
+
var pendingNw = null;
|
|
24353
24499
|
var isGlob = false;
|
|
24500
|
+
/** @type {number} */
|
|
24354
24501
|
var i;
|
|
24355
24502
|
|
|
24356
24503
|
function parseEnvVar() {
|
|
24357
24504
|
i += 1;
|
|
24505
|
+
/** @type {number | RegExpMatchArray | null} */
|
|
24358
24506
|
var varend;
|
|
24507
|
+
/** @type {string} */
|
|
24359
24508
|
var varname;
|
|
24360
24509
|
var char = s.charAt(i);
|
|
24361
24510
|
|
|
@@ -24364,15 +24513,25 @@ function parseInternal(string, env, opts) {
|
|
|
24364
24513
|
if (s.charAt(i) === '}') {
|
|
24365
24514
|
throw new Error('Bad substitution: ' + s.slice(i - 2, i + 1));
|
|
24366
24515
|
}
|
|
24367
|
-
|
|
24368
|
-
|
|
24516
|
+
// match braces by depth so a nested `${` keeps its inner `}` from ending the outer substitution
|
|
24517
|
+
var depth = 1;
|
|
24518
|
+
varend = i;
|
|
24519
|
+
while (depth > 0 && varend < s.length) {
|
|
24520
|
+
if (s.charAt(varend) === '{' && s.charAt(varend - 1) === '$') {
|
|
24521
|
+
depth += 1;
|
|
24522
|
+
} else if (s.charAt(varend) === '}') {
|
|
24523
|
+
depth -= 1;
|
|
24524
|
+
}
|
|
24525
|
+
varend += 1;
|
|
24526
|
+
}
|
|
24527
|
+
if (depth !== 0) {
|
|
24369
24528
|
throw new Error('Bad substitution: ' + s.slice(i));
|
|
24370
24529
|
}
|
|
24530
|
+
varend -= 1;
|
|
24371
24531
|
varname = s.slice(i, varend);
|
|
24372
24532
|
i = varend;
|
|
24373
|
-
} else if ((/[
|
|
24533
|
+
} else if ((/[*@#?$!-]/).test(char)) {
|
|
24374
24534
|
varname = char;
|
|
24375
|
-
i += 1;
|
|
24376
24535
|
} else {
|
|
24377
24536
|
var slicedFromI = s.slice(i);
|
|
24378
24537
|
varend = slicedFromI.match(/[^\w\d_]/);
|
|
@@ -24381,14 +24540,36 @@ function parseInternal(string, env, opts) {
|
|
|
24381
24540
|
i = s.length;
|
|
24382
24541
|
} else {
|
|
24383
24542
|
varname = slicedFromI.slice(0, varend.index);
|
|
24384
|
-
i += varend.index - 1;
|
|
24543
|
+
i += /** @type {number} */ (varend.index) - 1;
|
|
24385
24544
|
}
|
|
24386
24545
|
}
|
|
24387
|
-
return getVar(env, '', varname);
|
|
24546
|
+
return getVar(/** @type {NonNullable<typeof env>} */ (env), '', varname);
|
|
24547
|
+
}
|
|
24548
|
+
|
|
24549
|
+
function flushRun() {
|
|
24550
|
+
if (pendingNw === null) {
|
|
24551
|
+
return;
|
|
24552
|
+
}
|
|
24553
|
+
if (pendingNw === 0) {
|
|
24554
|
+
if (out !== '') {
|
|
24555
|
+
words[words.length] = out;
|
|
24556
|
+
out = '';
|
|
24557
|
+
}
|
|
24558
|
+
} else {
|
|
24559
|
+
words[words.length] = out;
|
|
24560
|
+
out = '';
|
|
24561
|
+
for (var fe = 1; fe < pendingNw; fe += 1) {
|
|
24562
|
+
words[words.length] = '';
|
|
24563
|
+
}
|
|
24564
|
+
}
|
|
24565
|
+
pendingNw = null;
|
|
24388
24566
|
}
|
|
24389
24567
|
|
|
24390
24568
|
for (i = 0; i < s.length; i++) {
|
|
24391
24569
|
var c = s.charAt(i);
|
|
24570
|
+
if (ifs && c !== DS) {
|
|
24571
|
+
flushRun();
|
|
24572
|
+
}
|
|
24392
24573
|
isGlob = isGlob || (!quote && (c === '*' || c === '?'));
|
|
24393
24574
|
if (esc) {
|
|
24394
24575
|
out += c;
|
|
@@ -24415,35 +24596,76 @@ function parseInternal(string, env, opts) {
|
|
|
24415
24596
|
}
|
|
24416
24597
|
} else if (c === DQ || c === SQ) {
|
|
24417
24598
|
quote = c;
|
|
24599
|
+
sawQuote = true;
|
|
24418
24600
|
} else if (controlRE.test(c)) {
|
|
24419
|
-
return { op: s };
|
|
24601
|
+
return /** @type {ControlOperator} */ ({ op: s });
|
|
24420
24602
|
} else if (hash.test(c)) {
|
|
24421
24603
|
commented = true;
|
|
24422
24604
|
var commentObj = { comment: string.slice(match.index + i + 1) };
|
|
24423
24605
|
if (out.length) {
|
|
24424
|
-
return [out, commentObj];
|
|
24606
|
+
return /** @type {const} */ ([out, commentObj]);
|
|
24425
24607
|
}
|
|
24426
|
-
return [commentObj];
|
|
24608
|
+
return /** @type {const} */ ([commentObj]);
|
|
24427
24609
|
} else if (c === BS) {
|
|
24428
24610
|
esc = true;
|
|
24611
|
+
} else if (c === DS && s.charAt(i + 1) === SQ && closesAnsiC(s, i)) {
|
|
24612
|
+
flushRun();
|
|
24613
|
+
sawQuote = true;
|
|
24614
|
+
out += expandAnsiC(s.slice(i + 2, ansiCAt.lastIndex - 1));
|
|
24615
|
+
i = ansiCAt.lastIndex - 1;
|
|
24429
24616
|
} else if (c === DS) {
|
|
24430
|
-
|
|
24617
|
+
var value = parseEnvVar();
|
|
24618
|
+
if (!ifs) {
|
|
24619
|
+
out += value;
|
|
24620
|
+
} else {
|
|
24621
|
+
for (var vi = 0; vi < value.length; vi += 1) {
|
|
24622
|
+
var vc = value.charAt(vi);
|
|
24623
|
+
if (ifs.indexOf(vc) < 0) {
|
|
24624
|
+
flushRun();
|
|
24625
|
+
out += vc;
|
|
24626
|
+
} else if (pendingNw === null) {
|
|
24627
|
+
pendingNw = vc === ' ' || vc === '\t' || vc === '\n' ? 0 : 1;
|
|
24628
|
+
} else if (vc !== ' ' && vc !== '\t' && vc !== '\n') {
|
|
24629
|
+
pendingNw += 1;
|
|
24630
|
+
}
|
|
24631
|
+
}
|
|
24632
|
+
}
|
|
24431
24633
|
} else {
|
|
24432
24634
|
out += c;
|
|
24433
24635
|
}
|
|
24434
24636
|
}
|
|
24435
24637
|
|
|
24436
24638
|
if (isGlob) {
|
|
24437
|
-
return { op: 'glob', pattern: out };
|
|
24639
|
+
return /** @type {GlobPattern} */ ({ op: 'glob', pattern: out });
|
|
24640
|
+
}
|
|
24641
|
+
|
|
24642
|
+
if (ifs) {
|
|
24643
|
+
if (pendingNw !== null && pendingNw > 0) {
|
|
24644
|
+
words[words.length] = out;
|
|
24645
|
+
out = '';
|
|
24646
|
+
for (var te = 1; te < pendingNw; te += 1) {
|
|
24647
|
+
words[words.length] = '';
|
|
24648
|
+
}
|
|
24649
|
+
}
|
|
24650
|
+
if (out !== '' || (sawQuote && words.length === 0)) {
|
|
24651
|
+
words[words.length] = out;
|
|
24652
|
+
}
|
|
24653
|
+
return words;
|
|
24438
24654
|
}
|
|
24439
24655
|
|
|
24440
24656
|
return out;
|
|
24441
24657
|
}).reduce(function (prev, arg) { // finalize parsed arguments
|
|
24442
|
-
|
|
24443
|
-
|
|
24444
|
-
|
|
24658
|
+
if (typeof arg === 'undefined') {
|
|
24659
|
+
return prev;
|
|
24660
|
+
}
|
|
24661
|
+
/** @type {ParseEntry[]} */ ([]).concat(arg).forEach(function (entry) {
|
|
24662
|
+
prev[prev.length] = entry;
|
|
24663
|
+
});
|
|
24664
|
+
return prev;
|
|
24665
|
+
}, /** @type {ParseEntry[]} */ ([]));
|
|
24445
24666
|
}
|
|
24446
24667
|
|
|
24668
|
+
/** @type {typeof import('./parse')} */
|
|
24447
24669
|
var parse$6 = function parse(s, env, opts) {
|
|
24448
24670
|
var mapped = parseInternal(s, env, opts);
|
|
24449
24671
|
if (typeof env !== 'function') {
|
|
@@ -24451,19 +24673,21 @@ var parse$6 = function parse(s, env, opts) {
|
|
|
24451
24673
|
}
|
|
24452
24674
|
return mapped.reduce(function (acc, s) {
|
|
24453
24675
|
if (typeof s === 'object') {
|
|
24454
|
-
|
|
24676
|
+
acc[acc.length] = s;
|
|
24677
|
+
return acc;
|
|
24455
24678
|
}
|
|
24456
24679
|
var xs = s.split(RegExp('(' + TOKEN + '.*?' + TOKEN + ')', 'g'));
|
|
24457
24680
|
if (xs.length === 1) {
|
|
24458
|
-
|
|
24681
|
+
acc[acc.length] = xs[0];
|
|
24682
|
+
return acc;
|
|
24459
24683
|
}
|
|
24460
|
-
|
|
24461
|
-
|
|
24462
|
-
|
|
24463
|
-
|
|
24464
|
-
|
|
24465
|
-
|
|
24466
|
-
}, []);
|
|
24684
|
+
xs.filter(Boolean).forEach(function (x) {
|
|
24685
|
+
acc[acc.length] = startsWithToken.test(x)
|
|
24686
|
+
? JSON.parse(x.split(TOKEN)[1])
|
|
24687
|
+
: x;
|
|
24688
|
+
});
|
|
24689
|
+
return acc;
|
|
24690
|
+
}, /** @type {ParseEntry[]} */ ([]));
|
|
24467
24691
|
};
|
|
24468
24692
|
|
|
24469
24693
|
shellQuote$1.quote = quote;
|
|
@@ -24482,15 +24706,17 @@ var macos = {
|
|
|
24482
24706
|
'/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl',
|
|
24483
24707
|
'/Applications/Sublime Text Dev.app/Contents/MacOS/Sublime Text':
|
|
24484
24708
|
'/Applications/Sublime Text Dev.app/Contents/SharedSupport/bin/subl',
|
|
24709
|
+
'/Applications/Visual Studio Code.app/Contents/MacOS/Code': 'code',
|
|
24485
24710
|
'/Applications/Visual Studio Code.app/Contents/MacOS/Electron': 'code',
|
|
24486
|
-
'/Applications/Visual Studio Code - Insiders.app/Contents/MacOS/
|
|
24487
|
-
|
|
24711
|
+
'/Applications/Visual Studio Code - Insiders.app/Contents/MacOS/Code - Insiders': 'code-insiders',
|
|
24712
|
+
'/Applications/Visual Studio Code - Insiders.app/Contents/MacOS/Electron': 'code-insiders',
|
|
24488
24713
|
'/Applications/VSCodium.app/Contents/MacOS/Electron': 'codium',
|
|
24489
24714
|
'/Applications/Cursor.app/Contents/MacOS/Cursor': 'cursor',
|
|
24715
|
+
'/Applications/Trae.app/Contents/MacOS/Electron': 'trae',
|
|
24716
|
+
'/Applications/Antigravity.app/Contents/MacOS/Electron': 'antigravity',
|
|
24490
24717
|
'/Applications/AppCode.app/Contents/MacOS/appcode':
|
|
24491
24718
|
'/Applications/AppCode.app/Contents/MacOS/appcode',
|
|
24492
|
-
'/Applications/CLion.app/Contents/MacOS/clion':
|
|
24493
|
-
'/Applications/CLion.app/Contents/MacOS/clion',
|
|
24719
|
+
'/Applications/CLion.app/Contents/MacOS/clion': '/Applications/CLion.app/Contents/MacOS/clion',
|
|
24494
24720
|
'/Applications/IntelliJ IDEA.app/Contents/MacOS/idea':
|
|
24495
24721
|
'/Applications/IntelliJ IDEA.app/Contents/MacOS/idea',
|
|
24496
24722
|
'/Applications/IntelliJ IDEA Ultimate.app/Contents/MacOS/idea':
|
|
@@ -24510,9 +24736,8 @@ var macos = {
|
|
|
24510
24736
|
'/Applications/MacVim.app/Contents/MacOS/MacVim': 'mvim',
|
|
24511
24737
|
'/Applications/GoLand.app/Contents/MacOS/goland':
|
|
24512
24738
|
'/Applications/GoLand.app/Contents/MacOS/goland',
|
|
24513
|
-
'/Applications/Rider.app/Contents/MacOS/rider':
|
|
24514
|
-
|
|
24515
|
-
'/Applications/Zed.app/Contents/MacOS/zed': 'zed'
|
|
24739
|
+
'/Applications/Rider.app/Contents/MacOS/rider': '/Applications/Rider.app/Contents/MacOS/rider',
|
|
24740
|
+
'/Applications/Zed.app/Contents/MacOS/zed': 'zed',
|
|
24516
24741
|
};
|
|
24517
24742
|
|
|
24518
24743
|
var linux = {
|
|
@@ -24522,6 +24747,9 @@ var linux = {
|
|
|
24522
24747
|
code: 'code',
|
|
24523
24748
|
vscodium: 'vscodium',
|
|
24524
24749
|
codium: 'codium',
|
|
24750
|
+
cursor: 'cursor',
|
|
24751
|
+
trae: 'trae',
|
|
24752
|
+
antigravity: 'antigravity',
|
|
24525
24753
|
emacs: 'emacs',
|
|
24526
24754
|
gvim: 'gvim',
|
|
24527
24755
|
idea: 'idea',
|
|
@@ -24539,7 +24767,8 @@ var linux = {
|
|
|
24539
24767
|
goland: 'goland',
|
|
24540
24768
|
'goland.sh': 'goland',
|
|
24541
24769
|
rider: 'rider',
|
|
24542
|
-
'rider.sh': 'rider'
|
|
24770
|
+
'rider.sh': 'rider',
|
|
24771
|
+
zed: 'zed',
|
|
24543
24772
|
};
|
|
24544
24773
|
|
|
24545
24774
|
var windows$1 = [
|
|
@@ -24566,10 +24795,13 @@ var windows$1 = [
|
|
|
24566
24795
|
'goland.exe',
|
|
24567
24796
|
'goland64.exe',
|
|
24568
24797
|
'rider.exe',
|
|
24569
|
-
'rider64.exe'
|
|
24798
|
+
'rider64.exe',
|
|
24799
|
+
'Trae.exe',
|
|
24800
|
+
'zed.exe',
|
|
24801
|
+
'Antigravity.exe',
|
|
24570
24802
|
];
|
|
24571
24803
|
|
|
24572
|
-
const path$
|
|
24804
|
+
const path$7 = require$$0$2;
|
|
24573
24805
|
const shellQuote = shellQuote$1;
|
|
24574
24806
|
const childProcess$1 = require$$2$1;
|
|
24575
24807
|
|
|
@@ -24580,7 +24812,60 @@ const COMMON_EDITORS_MACOS = macos;
|
|
|
24580
24812
|
const COMMON_EDITORS_LINUX = linux;
|
|
24581
24813
|
const COMMON_EDITORS_WIN = windows$1;
|
|
24582
24814
|
|
|
24583
|
-
|
|
24815
|
+
function getEditorFromMacProcesses(output) {
|
|
24816
|
+
const processNames = Object.keys(COMMON_EDITORS_MACOS);
|
|
24817
|
+
const processList = output.split('\n');
|
|
24818
|
+
for (let i = 0; i < processNames.length; i++) {
|
|
24819
|
+
const processName = processNames[i];
|
|
24820
|
+
// Find editor by exact match.
|
|
24821
|
+
if (processList.includes(processName)) {
|
|
24822
|
+
return COMMON_EDITORS_MACOS[processName]
|
|
24823
|
+
}
|
|
24824
|
+
const processNameWithoutApplications = processName.replace('/Applications', '');
|
|
24825
|
+
// Find editor installation not in /Applications.
|
|
24826
|
+
if (output.indexOf(processNameWithoutApplications) !== -1) {
|
|
24827
|
+
// Use the CLI command if one is specified
|
|
24828
|
+
if (processName !== COMMON_EDITORS_MACOS[processName]) {
|
|
24829
|
+
return COMMON_EDITORS_MACOS[processName]
|
|
24830
|
+
}
|
|
24831
|
+
// Use a partial match to find the running process path. If one is found, use the
|
|
24832
|
+
// existing path since it can be running from anywhere.
|
|
24833
|
+
const runningProcess = processList.find((procName) =>
|
|
24834
|
+
procName.endsWith(processNameWithoutApplications),
|
|
24835
|
+
);
|
|
24836
|
+
if (runningProcess !== undefined) {
|
|
24837
|
+
return runningProcess
|
|
24838
|
+
}
|
|
24839
|
+
}
|
|
24840
|
+
}
|
|
24841
|
+
return undefined
|
|
24842
|
+
}
|
|
24843
|
+
|
|
24844
|
+
function getEditorFromWindowsProcesses(output) {
|
|
24845
|
+
const runningProcesses = output.split('\r\n');
|
|
24846
|
+
for (let i = 0; i < runningProcesses.length; i++) {
|
|
24847
|
+
const fullProcessPath = runningProcesses[i].trim();
|
|
24848
|
+
const shortProcessName = path$7.win32.basename(fullProcessPath);
|
|
24849
|
+
|
|
24850
|
+
if (COMMON_EDITORS_WIN.indexOf(shortProcessName) !== -1) {
|
|
24851
|
+
return fullProcessPath
|
|
24852
|
+
}
|
|
24853
|
+
}
|
|
24854
|
+
return undefined
|
|
24855
|
+
}
|
|
24856
|
+
|
|
24857
|
+
function getEditorFromLinuxProcesses(output) {
|
|
24858
|
+
const processNames = Object.keys(COMMON_EDITORS_LINUX);
|
|
24859
|
+
for (let i = 0; i < processNames.length; i++) {
|
|
24860
|
+
const processName = processNames[i];
|
|
24861
|
+
if (output.indexOf(processName) !== -1) {
|
|
24862
|
+
return COMMON_EDITORS_LINUX[processName]
|
|
24863
|
+
}
|
|
24864
|
+
}
|
|
24865
|
+
return undefined
|
|
24866
|
+
}
|
|
24867
|
+
|
|
24868
|
+
function guessEditor$1(specifiedEditor) {
|
|
24584
24869
|
if (specifiedEditor) {
|
|
24585
24870
|
return shellQuote.parse(specifiedEditor)
|
|
24586
24871
|
}
|
|
@@ -24600,31 +24885,12 @@ var guess = function guessEditor (specifiedEditor) {
|
|
|
24600
24885
|
if (process.platform === 'darwin') {
|
|
24601
24886
|
const output = childProcess$1
|
|
24602
24887
|
.execSync('ps x -o comm=', {
|
|
24603
|
-
stdio: ['pipe', 'pipe', 'ignore']
|
|
24888
|
+
stdio: ['pipe', 'pipe', 'ignore'],
|
|
24604
24889
|
})
|
|
24605
24890
|
.toString();
|
|
24606
|
-
const
|
|
24607
|
-
|
|
24608
|
-
|
|
24609
|
-
const processName = processNames[i];
|
|
24610
|
-
// Find editor by exact match.
|
|
24611
|
-
if (processList.includes(processName)) {
|
|
24612
|
-
return [COMMON_EDITORS_MACOS[processName]]
|
|
24613
|
-
}
|
|
24614
|
-
const processNameWithoutApplications = processName.replace('/Applications', '');
|
|
24615
|
-
// Find editor installation not in /Applications.
|
|
24616
|
-
if (output.indexOf(processNameWithoutApplications) !== -1) {
|
|
24617
|
-
// Use the CLI command if one is specified
|
|
24618
|
-
if (processName !== COMMON_EDITORS_MACOS[processName]) {
|
|
24619
|
-
return [COMMON_EDITORS_MACOS[processName]]
|
|
24620
|
-
}
|
|
24621
|
-
// Use a partial match to find the running process path. If one is found, use the
|
|
24622
|
-
// existing path since it can be running from anywhere.
|
|
24623
|
-
const runningProcess = processList.find((procName) => procName.endsWith(processNameWithoutApplications));
|
|
24624
|
-
if (runningProcess !== undefined) {
|
|
24625
|
-
return [runningProcess]
|
|
24626
|
-
}
|
|
24627
|
-
}
|
|
24891
|
+
const editor = getEditorFromMacProcesses(output);
|
|
24892
|
+
if (editor !== undefined) {
|
|
24893
|
+
return [editor]
|
|
24628
24894
|
}
|
|
24629
24895
|
} else if (process.platform === 'win32') {
|
|
24630
24896
|
const output = childProcess$1
|
|
@@ -24634,18 +24900,13 @@ var guess = function guessEditor (specifiedEditor) {
|
|
|
24634
24900
|
'Get-CimInstance -Query \\"select executablepath from win32_process where executablepath is not null\\" | % { $_.ExecutablePath }' +
|
|
24635
24901
|
'"',
|
|
24636
24902
|
{
|
|
24637
|
-
stdio: ['pipe', 'pipe', 'ignore']
|
|
24638
|
-
}
|
|
24903
|
+
stdio: ['pipe', 'pipe', 'ignore'],
|
|
24904
|
+
},
|
|
24639
24905
|
)
|
|
24640
24906
|
.toString();
|
|
24641
|
-
const
|
|
24642
|
-
|
|
24643
|
-
|
|
24644
|
-
const shortProcessName = path$6.basename(fullProcessPath);
|
|
24645
|
-
|
|
24646
|
-
if (COMMON_EDITORS_WIN.indexOf(shortProcessName) !== -1) {
|
|
24647
|
-
return [fullProcessPath]
|
|
24648
|
-
}
|
|
24907
|
+
const editor = getEditorFromWindowsProcesses(output);
|
|
24908
|
+
if (editor !== undefined) {
|
|
24909
|
+
return [editor]
|
|
24649
24910
|
}
|
|
24650
24911
|
} else if (process.platform === 'linux') {
|
|
24651
24912
|
// --no-heading No header line
|
|
@@ -24653,15 +24914,12 @@ var guess = function guessEditor (specifiedEditor) {
|
|
|
24653
24914
|
// -o comm Need only names column
|
|
24654
24915
|
const output = childProcess$1
|
|
24655
24916
|
.execSync('ps x --no-heading -o comm --sort=comm', {
|
|
24656
|
-
stdio: ['pipe', 'pipe', 'ignore']
|
|
24917
|
+
stdio: ['pipe', 'pipe', 'ignore'],
|
|
24657
24918
|
})
|
|
24658
24919
|
.toString();
|
|
24659
|
-
const
|
|
24660
|
-
|
|
24661
|
-
|
|
24662
|
-
if (output.indexOf(processName) !== -1) {
|
|
24663
|
-
return [COMMON_EDITORS_LINUX[processName]]
|
|
24664
|
-
}
|
|
24920
|
+
const editor = getEditorFromLinuxProcesses(output);
|
|
24921
|
+
if (editor !== undefined) {
|
|
24922
|
+
return [editor]
|
|
24665
24923
|
}
|
|
24666
24924
|
}
|
|
24667
24925
|
} catch (ignoreError) {
|
|
@@ -24676,18 +24934,41 @@ var guess = function guessEditor (specifiedEditor) {
|
|
|
24676
24934
|
}
|
|
24677
24935
|
|
|
24678
24936
|
return [null]
|
|
24679
|
-
}
|
|
24937
|
+
}
|
|
24680
24938
|
|
|
24681
|
-
|
|
24939
|
+
guess.exports = guessEditor$1;
|
|
24940
|
+
guess.exports.getEditorFromMacProcesses = getEditorFromMacProcesses;
|
|
24941
|
+
guess.exports.getEditorFromWindowsProcesses = getEditorFromWindowsProcesses;
|
|
24942
|
+
guess.exports.getEditorFromLinuxProcesses = getEditorFromLinuxProcesses;
|
|
24682
24943
|
|
|
24683
|
-
|
|
24684
|
-
|
|
24685
|
-
|
|
24686
|
-
|
|
24687
|
-
|
|
24688
|
-
|
|
24689
|
-
) {
|
|
24690
|
-
|
|
24944
|
+
var guessExports = guess.exports;
|
|
24945
|
+
|
|
24946
|
+
const os = require$$2;
|
|
24947
|
+
const path$6 = require$$0$2;
|
|
24948
|
+
|
|
24949
|
+
// normalize a file and optional line/column numbers into command line args for specific editors
|
|
24950
|
+
var getArgs = function getArgumentsForFile(editor, fileName, lineNumber, columnNumber = 1) {
|
|
24951
|
+
fileName = path$6.resolve(fileName);
|
|
24952
|
+
|
|
24953
|
+
if (
|
|
24954
|
+
process.platform === 'linux' &&
|
|
24955
|
+
fileName.startsWith('/mnt/') &&
|
|
24956
|
+
/Microsoft/i.test(os.release())
|
|
24957
|
+
) {
|
|
24958
|
+
// Assume WSL / "Bash on Ubuntu on Windows" is being used, and
|
|
24959
|
+
// that the file exists on the Windows file system.
|
|
24960
|
+
// `os.release()` is "4.4.0-43-Microsoft" in the current release
|
|
24961
|
+
// build of WSL, see: https://github.com/Microsoft/BashOnWindows/issues/423#issuecomment-221627364
|
|
24962
|
+
// When a Windows editor is specified, interop functionality can
|
|
24963
|
+
// handle the path translation, but only if a relative path is used.
|
|
24964
|
+
fileName = `./${path$6.relative('', fileName)}`;
|
|
24965
|
+
}
|
|
24966
|
+
|
|
24967
|
+
if (!lineNumber) {
|
|
24968
|
+
return [fileName]
|
|
24969
|
+
}
|
|
24970
|
+
|
|
24971
|
+
const editorBasename = path$6.basename(editor).replace(/\.(exe|cmd|bat)$/i, '');
|
|
24691
24972
|
switch (editorBasename) {
|
|
24692
24973
|
case 'atom':
|
|
24693
24974
|
case 'Atom':
|
|
@@ -24706,7 +24987,7 @@ var getArgs = function getArgumentsForPosition (
|
|
|
24706
24987
|
return [`+call cursor(${lineNumber}, ${columnNumber})`, fileName]
|
|
24707
24988
|
case 'joe':
|
|
24708
24989
|
case 'gvim':
|
|
24709
|
-
return [
|
|
24990
|
+
return [`+${lineNumber}`, fileName]
|
|
24710
24991
|
case 'emacs':
|
|
24711
24992
|
case 'emacsclient':
|
|
24712
24993
|
return [`+${lineNumber}:${columnNumber}`, fileName]
|
|
@@ -24719,6 +25000,8 @@ var getArgs = function getArgumentsForPosition (
|
|
|
24719
25000
|
case 'code-insiders':
|
|
24720
25001
|
case 'Code - Insiders':
|
|
24721
25002
|
case 'codium':
|
|
25003
|
+
case 'trae':
|
|
25004
|
+
case 'antigravity':
|
|
24722
25005
|
case 'cursor':
|
|
24723
25006
|
case 'vscodium':
|
|
24724
25007
|
case 'VSCodium':
|
|
@@ -24753,6 +25036,92 @@ var getArgs = function getArgumentsForPosition (
|
|
|
24753
25036
|
return [fileName]
|
|
24754
25037
|
};
|
|
24755
25038
|
|
|
25039
|
+
// On Windows, we need to use `exec` with the `shell: true` option,
|
|
25040
|
+
// and some more sanitization is required.
|
|
25041
|
+
|
|
25042
|
+
// However, CMD.exe on Windows is vulnerable to RCE attacks given a file name of the
|
|
25043
|
+
// form "C:\Users\myusername\Downloads\& curl 172.21.93.52".
|
|
25044
|
+
// `create-react-app` used a safe file name pattern to validate user-provided file names:
|
|
25045
|
+
// - https://github.com/facebook/create-react-app/pull/4866
|
|
25046
|
+
// - https://github.com/facebook/create-react-app/pull/5431
|
|
25047
|
+
// But that's not a viable solution for this package because
|
|
25048
|
+
// it's depended on by so many meta frameworks that heavily rely on
|
|
25049
|
+
// special characters in file names for filesystem-based routing.
|
|
25050
|
+
// We need to at least:
|
|
25051
|
+
// - Support `+` because it's used in SvelteKit and Vike
|
|
25052
|
+
// - Support `$` because it's used in Remix
|
|
25053
|
+
// - Support `(` and `)` because they are used in Analog, SolidStart, and Vike
|
|
25054
|
+
// - Support `@` because it's used in Vike
|
|
25055
|
+
// - Support `[` and `]` because they are widely used for [slug]
|
|
25056
|
+
// So here we choose to use `^` to escape special characters instead.
|
|
25057
|
+
|
|
25058
|
+
// According to https://ss64.com/nt/syntax-esc.html,
|
|
25059
|
+
// we can use `^` to escape `&`, `<`, `>`, `|`, `%`, and `^`
|
|
25060
|
+
//
|
|
25061
|
+
// `"` cannot appear in Windows paths, so it is outside the untrusted path input
|
|
25062
|
+
// this sanitization protects.
|
|
25063
|
+
function escapeCmdArgs(cmdArgs) {
|
|
25064
|
+
return cmdArgs.replace(/([&|<>,;=^])/g, '^$1')
|
|
25065
|
+
}
|
|
25066
|
+
|
|
25067
|
+
// Need to double quote the editor path in case it contains spaces;
|
|
25068
|
+
// If the fileName contains spaces, we also need to double quote it in the arguments
|
|
25069
|
+
// However, there's a case that it's concatenated with line number and column number
|
|
25070
|
+
// which is separated by `:`. We need to double quote the whole string in this case.
|
|
25071
|
+
// Also, if the string contains the escape character `^`, it needs to be quoted, too.
|
|
25072
|
+
function doubleQuoteIfNeeded(str) {
|
|
25073
|
+
if (str.includes('^')) {
|
|
25074
|
+
// If a string includes an escaped character, not only does it need to be quoted,
|
|
25075
|
+
// but the quotes need to be escaped too.
|
|
25076
|
+
return `^"${str}^"`
|
|
25077
|
+
} else if (str.includes(' ')) {
|
|
25078
|
+
return `"${str}"`
|
|
25079
|
+
}
|
|
25080
|
+
return str
|
|
25081
|
+
}
|
|
25082
|
+
|
|
25083
|
+
function constructWindowsLaunchCommand$1(editor, args) {
|
|
25084
|
+
// CMD treats line breaks as command separators. They cannot appear in regular Windows
|
|
25085
|
+
// file names, but NTFS alternate data stream names may contain control characters.
|
|
25086
|
+
if (args.some((arg) => /[\r\n]/.test(arg))) {
|
|
25087
|
+
throw new Error('Cannot launch an editor with an argument containing a line break')
|
|
25088
|
+
}
|
|
25089
|
+
|
|
25090
|
+
// CMD expands expressions such as `%VAR:old=new%` before consuming caret escapes, so
|
|
25091
|
+
// percent signs in arguments cannot be preserved safely and are rejected.
|
|
25092
|
+
if (args.some((arg) => arg.includes('%'))) {
|
|
25093
|
+
throw new Error('Cannot launch an editor with an argument containing "%"')
|
|
25094
|
+
}
|
|
25095
|
+
|
|
25096
|
+
return [editor, ...args.map(escapeCmdArgs)].map(doubleQuoteIfNeeded).join(' ')
|
|
25097
|
+
}
|
|
25098
|
+
|
|
25099
|
+
var constructWindowsLaunchCommand_1 = constructWindowsLaunchCommand$1;
|
|
25100
|
+
|
|
25101
|
+
const path$5 = require$$0$2;
|
|
25102
|
+
|
|
25103
|
+
const positionRE = /:(\d+)(:(\d+))?$/;
|
|
25104
|
+
|
|
25105
|
+
var parseFile$1 = function parseFile(file) {
|
|
25106
|
+
// support `file://` protocol
|
|
25107
|
+
if (file.startsWith('file://')) {
|
|
25108
|
+
file = require$$0$5.fileURLToPath(file);
|
|
25109
|
+
}
|
|
25110
|
+
|
|
25111
|
+
const unresolvedFileName = file.replace(positionRE, '');
|
|
25112
|
+
const fileName = unresolvedFileName ? path$5.resolve(unresolvedFileName) : '';
|
|
25113
|
+
|
|
25114
|
+
const match = file.match(positionRE);
|
|
25115
|
+
const lineNumber = match && match[1];
|
|
25116
|
+
const columnNumber = match && match[3];
|
|
25117
|
+
|
|
25118
|
+
return {
|
|
25119
|
+
fileName,
|
|
25120
|
+
lineNumber,
|
|
25121
|
+
columnNumber,
|
|
25122
|
+
}
|
|
25123
|
+
};
|
|
25124
|
+
|
|
24756
25125
|
/**
|
|
24757
25126
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
24758
25127
|
*
|
|
@@ -24764,34 +25133,31 @@ var getArgs = function getArgumentsForPosition (
|
|
|
24764
25133
|
*/
|
|
24765
25134
|
|
|
24766
25135
|
const fs$1 = require$$0$4;
|
|
24767
|
-
const os = require$$2;
|
|
24768
25136
|
const path$4 = require$$0$2;
|
|
24769
25137
|
const colors = picocolorsExports;
|
|
24770
25138
|
const childProcess = require$$2$1;
|
|
24771
25139
|
|
|
24772
|
-
const guessEditor =
|
|
24773
|
-
const
|
|
25140
|
+
const guessEditor = guessExports;
|
|
25141
|
+
const getArgumentsForFile = getArgs;
|
|
25142
|
+
const constructWindowsLaunchCommand = constructWindowsLaunchCommand_1;
|
|
25143
|
+
const parseFile = parseFile$1;
|
|
24774
25144
|
|
|
24775
|
-
function wrapErrorCallback
|
|
25145
|
+
function wrapErrorCallback(cb) {
|
|
24776
25146
|
return (fileName, errorMessage) => {
|
|
24777
25147
|
console.log();
|
|
24778
|
-
console.log(
|
|
24779
|
-
colors.red('Could not open ' + path$4.basename(fileName) + ' in the editor.')
|
|
24780
|
-
);
|
|
25148
|
+
console.log(colors.red('Could not open ' + path$4.basename(fileName) + ' in the editor.'));
|
|
24781
25149
|
if (errorMessage) {
|
|
24782
25150
|
if (errorMessage[errorMessage.length - 1] !== '.') {
|
|
24783
25151
|
errorMessage += '.';
|
|
24784
25152
|
}
|
|
24785
|
-
console.log(
|
|
24786
|
-
colors.red('The editor process exited with an error: ' + errorMessage)
|
|
24787
|
-
);
|
|
25153
|
+
console.log(colors.red('The editor process exited with an error: ' + errorMessage));
|
|
24788
25154
|
}
|
|
24789
25155
|
console.log();
|
|
24790
25156
|
if (cb) cb(fileName, errorMessage);
|
|
24791
25157
|
}
|
|
24792
25158
|
}
|
|
24793
25159
|
|
|
24794
|
-
function isTerminalEditor
|
|
25160
|
+
function isTerminalEditor(editor) {
|
|
24795
25161
|
switch (editor) {
|
|
24796
25162
|
case 'vim':
|
|
24797
25163
|
case 'emacs':
|
|
@@ -24801,34 +25167,10 @@ function isTerminalEditor (editor) {
|
|
|
24801
25167
|
return false
|
|
24802
25168
|
}
|
|
24803
25169
|
|
|
24804
|
-
|
|
24805
|
-
function parseFile (file) {
|
|
24806
|
-
// support `file://` protocol
|
|
24807
|
-
if (file.startsWith('file://')) {
|
|
24808
|
-
file = require$$0$5.fileURLToPath(file);
|
|
24809
|
-
}
|
|
24810
|
-
|
|
24811
|
-
const fileName = file.replace(positionRE, '');
|
|
24812
|
-
const match = file.match(positionRE);
|
|
24813
|
-
const lineNumber = match && match[1];
|
|
24814
|
-
const columnNumber = match && match[3];
|
|
24815
|
-
return {
|
|
24816
|
-
fileName,
|
|
24817
|
-
lineNumber,
|
|
24818
|
-
columnNumber
|
|
24819
|
-
}
|
|
24820
|
-
}
|
|
24821
|
-
|
|
24822
|
-
let _childProcess = null;
|
|
24823
|
-
|
|
24824
|
-
function launchEditor (file, specifiedEditor, onErrorCallback) {
|
|
24825
|
-
const parsed = parseFile(file);
|
|
24826
|
-
let { fileName } = parsed;
|
|
24827
|
-
const { lineNumber, columnNumber } = parsed;
|
|
25170
|
+
let currentChildProcess = null;
|
|
24828
25171
|
|
|
24829
|
-
|
|
24830
|
-
|
|
24831
|
-
}
|
|
25172
|
+
function launchEditor(file, specifiedEditor, onErrorCallback) {
|
|
25173
|
+
const { fileName, lineNumber, columnNumber } = parseFile(file);
|
|
24832
25174
|
|
|
24833
25175
|
if (typeof specifiedEditor === 'function') {
|
|
24834
25176
|
onErrorCallback = specifiedEditor;
|
|
@@ -24837,102 +25179,61 @@ function launchEditor (file, specifiedEditor, onErrorCallback) {
|
|
|
24837
25179
|
|
|
24838
25180
|
onErrorCallback = wrapErrorCallback(onErrorCallback);
|
|
24839
25181
|
|
|
25182
|
+
if (process.platform === 'win32' && fileName.startsWith('\\\\')) {
|
|
25183
|
+
return onErrorCallback(
|
|
25184
|
+
fileName,
|
|
25185
|
+
'UNC paths are not supported on Windows to avoid security issues. ' +
|
|
25186
|
+
'See https://github.com/vitejs/launch-editor/tree/main/packages/launch-editor#unc-paths-on-windows for details.',
|
|
25187
|
+
)
|
|
25188
|
+
}
|
|
25189
|
+
|
|
25190
|
+
if (!fs$1.existsSync(fileName)) {
|
|
25191
|
+
return
|
|
25192
|
+
}
|
|
25193
|
+
|
|
24840
25194
|
const [editor, ...args] = guessEditor(specifiedEditor);
|
|
24841
25195
|
if (!editor) {
|
|
24842
25196
|
onErrorCallback(fileName, null);
|
|
24843
25197
|
return
|
|
24844
25198
|
}
|
|
24845
25199
|
|
|
24846
|
-
|
|
24847
|
-
|
|
24848
|
-
fileName.startsWith('/mnt/') &&
|
|
24849
|
-
/Microsoft/i.test(os.release())
|
|
24850
|
-
) {
|
|
24851
|
-
// Assume WSL / "Bash on Ubuntu on Windows" is being used, and
|
|
24852
|
-
// that the file exists on the Windows file system.
|
|
24853
|
-
// `os.release()` is "4.4.0-43-Microsoft" in the current release
|
|
24854
|
-
// build of WSL, see: https://github.com/Microsoft/BashOnWindows/issues/423#issuecomment-221627364
|
|
24855
|
-
// When a Windows editor is specified, interop functionality can
|
|
24856
|
-
// handle the path translation, but only if a relative path is used.
|
|
24857
|
-
fileName = path$4.relative('', fileName);
|
|
24858
|
-
}
|
|
25200
|
+
const extraArgs = getArgumentsForFile(editor, fileName, lineNumber, columnNumber);
|
|
25201
|
+
args.push.apply(args, extraArgs);
|
|
24859
25202
|
|
|
24860
|
-
|
|
24861
|
-
|
|
24862
|
-
|
|
24863
|
-
|
|
24864
|
-
|
|
25203
|
+
let launchCommand;
|
|
25204
|
+
if (process.platform === 'win32') {
|
|
25205
|
+
try {
|
|
25206
|
+
launchCommand = constructWindowsLaunchCommand(editor, args);
|
|
25207
|
+
} catch (error) {
|
|
25208
|
+
onErrorCallback(fileName, error.message);
|
|
25209
|
+
return
|
|
25210
|
+
}
|
|
24865
25211
|
}
|
|
24866
25212
|
|
|
24867
|
-
if (
|
|
25213
|
+
if (currentChildProcess && isTerminalEditor(editor)) {
|
|
24868
25214
|
// There's an existing editor process already and it's attached
|
|
24869
25215
|
// to the terminal, so go kill it. Otherwise two separate editor
|
|
24870
25216
|
// instances attach to the stdin/stdout which gets confusing.
|
|
24871
|
-
|
|
25217
|
+
currentChildProcess.kill('SIGKILL');
|
|
24872
25218
|
}
|
|
24873
25219
|
|
|
24874
25220
|
if (process.platform === 'win32') {
|
|
24875
|
-
|
|
24876
|
-
// and some more sanitization is required.
|
|
24877
|
-
|
|
24878
|
-
// However, CMD.exe on Windows is vulnerable to RCE attacks given a file name of the
|
|
24879
|
-
// form "C:\Users\myusername\Downloads\& curl 172.21.93.52".
|
|
24880
|
-
// `create-react-app` used a safe file name pattern to validate user-provided file names:
|
|
24881
|
-
// - https://github.com/facebook/create-react-app/pull/4866
|
|
24882
|
-
// - https://github.com/facebook/create-react-app/pull/5431
|
|
24883
|
-
// But that's not a viable solution for this package because
|
|
24884
|
-
// it's depended on by so many meta frameworks that heavily rely on
|
|
24885
|
-
// special characters in file names for filesystem-based routing.
|
|
24886
|
-
// We need to at least:
|
|
24887
|
-
// - Support `+` because it's used in SvelteKit and Vike
|
|
24888
|
-
// - Support `$` because it's used in Remix
|
|
24889
|
-
// - Support `(` and `)` because they are used in Analog, SolidStart, and Vike
|
|
24890
|
-
// - Support `@` because it's used in Vike
|
|
24891
|
-
// - Support `[` and `]` because they are widely used for [slug]
|
|
24892
|
-
// So here we choose to use `^` to escape special characters instead.
|
|
24893
|
-
|
|
24894
|
-
// According to https://ss64.com/nt/syntax-esc.html,
|
|
24895
|
-
// we can use `^` to escape `&`, `<`, `>`, `|`, `%`, and `^`
|
|
24896
|
-
// I'm not sure if we have to escape all of these, but let's do it anyway
|
|
24897
|
-
function escapeCmdArgs (cmdArgs) {
|
|
24898
|
-
return cmdArgs.replace(/([&|<>,;=^])/g, '^$1')
|
|
24899
|
-
}
|
|
24900
|
-
|
|
24901
|
-
// Need to double quote the editor path in case it contains spaces;
|
|
24902
|
-
// If the fileName contains spaces, we also need to double quote it in the arguments
|
|
24903
|
-
// However, there's a case that it's concatenated with line number and column number
|
|
24904
|
-
// which is separated by `:`. We need to double quote the whole string in this case.
|
|
24905
|
-
// Also, if the string contains the escape character `^`, it needs to be quoted, too.
|
|
24906
|
-
function doubleQuoteIfNeeded(str) {
|
|
24907
|
-
if (str.includes('^')) {
|
|
24908
|
-
// If a string includes an escaped character, not only does it need to be quoted,
|
|
24909
|
-
// but the quotes need to be escaped too.
|
|
24910
|
-
return `^"${str}^"`
|
|
24911
|
-
} else if (str.includes(' ')) {
|
|
24912
|
-
return `"${str}"`
|
|
24913
|
-
}
|
|
24914
|
-
return str
|
|
24915
|
-
}
|
|
24916
|
-
const launchCommand = [editor, ...args.map(escapeCmdArgs)]
|
|
24917
|
-
.map(doubleQuoteIfNeeded)
|
|
24918
|
-
.join(' ');
|
|
24919
|
-
|
|
24920
|
-
_childProcess = childProcess.exec(launchCommand, {
|
|
25221
|
+
currentChildProcess = childProcess.exec(launchCommand, {
|
|
24921
25222
|
stdio: 'inherit',
|
|
24922
|
-
shell: true
|
|
25223
|
+
shell: true,
|
|
24923
25224
|
});
|
|
24924
25225
|
} else {
|
|
24925
|
-
|
|
25226
|
+
currentChildProcess = childProcess.spawn(editor, args, { stdio: 'inherit' });
|
|
24926
25227
|
}
|
|
24927
|
-
|
|
24928
|
-
|
|
25228
|
+
currentChildProcess.on('exit', function (errorCode) {
|
|
25229
|
+
currentChildProcess = null;
|
|
24929
25230
|
|
|
24930
25231
|
if (errorCode) {
|
|
24931
25232
|
onErrorCallback(fileName, '(code ' + errorCode + ')');
|
|
24932
25233
|
}
|
|
24933
25234
|
});
|
|
24934
25235
|
|
|
24935
|
-
|
|
25236
|
+
currentChildProcess.on('error', function (error) {
|
|
24936
25237
|
let { code, message } = error;
|
|
24937
25238
|
if ('ENOENT' === code) {
|
|
24938
25239
|
message = `${message} ('${editor}' command does not exist in 'PATH')`;
|
|
@@ -24943,7 +25244,6 @@ function launchEditor (file, specifiedEditor, onErrorCallback) {
|
|
|
24943
25244
|
|
|
24944
25245
|
var launchEditor_1 = launchEditor;
|
|
24945
25246
|
|
|
24946
|
-
const url$2 = require$$0$5;
|
|
24947
25247
|
const path$3 = require$$0$2;
|
|
24948
25248
|
const launch = launchEditor_1;
|
|
24949
25249
|
|
|
@@ -24960,13 +25260,26 @@ var launchEditorMiddleware = (specifiedEditor, srcRoot, onErrorCallback) => {
|
|
|
24960
25260
|
|
|
24961
25261
|
srcRoot = srcRoot || process.cwd();
|
|
24962
25262
|
|
|
24963
|
-
return function launchEditorMiddleware
|
|
24964
|
-
|
|
25263
|
+
return function launchEditorMiddleware(req, res) {
|
|
25264
|
+
let url;
|
|
25265
|
+
|
|
25266
|
+
try {
|
|
25267
|
+
const fullUrl = req.url.startsWith('http') ? req.url : `http://localhost${req.url}`;
|
|
25268
|
+
url = new URL(fullUrl);
|
|
25269
|
+
// eslint-disable-next-line no-unused-vars
|
|
25270
|
+
} catch (_err) {
|
|
25271
|
+
res.statusCode = 500;
|
|
25272
|
+
res.end(`launch-editor-middleware: invalid URL.`);
|
|
25273
|
+
return
|
|
25274
|
+
}
|
|
25275
|
+
|
|
25276
|
+
const file = url.searchParams.get('file');
|
|
24965
25277
|
if (!file) {
|
|
24966
25278
|
res.statusCode = 500;
|
|
24967
25279
|
res.end(`launch-editor-middleware: required query param "file" is missing.`);
|
|
24968
25280
|
} else {
|
|
24969
|
-
|
|
25281
|
+
const resolved = file.startsWith('file://') ? file : path$3.resolve(srcRoot, file);
|
|
25282
|
+
launch(resolved, specifiedEditor, onErrorCallback);
|
|
24970
25283
|
res.end();
|
|
24971
25284
|
}
|
|
24972
25285
|
}
|
|
@@ -25009,7 +25322,7 @@ async function resolveHttpsConfig(https) {
|
|
|
25009
25322
|
}
|
|
25010
25323
|
async function readFileIfExists(value) {
|
|
25011
25324
|
if (typeof value === "string") {
|
|
25012
|
-
return fsp.readFile(path$
|
|
25325
|
+
return fsp.readFile(path$c.resolve(value)).catch(() => value);
|
|
25013
25326
|
}
|
|
25014
25327
|
return value;
|
|
25015
25328
|
}
|
|
@@ -25091,7 +25404,7 @@ function ssrRewriteStacktrace(stack, moduleGraph) {
|
|
|
25091
25404
|
return input;
|
|
25092
25405
|
}
|
|
25093
25406
|
const trimmedVarName = varName?.trim();
|
|
25094
|
-
const sourceFile = path$
|
|
25407
|
+
const sourceFile = path$c.resolve(path$c.dirname(id), pos.source);
|
|
25095
25408
|
const source = `${sourceFile}:${pos.line}:${pos.column + 1}`;
|
|
25096
25409
|
if (!trimmedVarName || trimmedVarName === "eval") {
|
|
25097
25410
|
return ` at ${source}`;
|
|
@@ -25845,7 +26158,7 @@ async function ssrTransformScript(code, inMap, url, originalCode) {
|
|
|
25845
26158
|
map = inMap;
|
|
25846
26159
|
} else {
|
|
25847
26160
|
map = s.generateMap({ hires: "boundary" });
|
|
25848
|
-
map.sources = [path$
|
|
26161
|
+
map.sources = [path$c.basename(url)];
|
|
25849
26162
|
map.sourcesContent = [originalCode];
|
|
25850
26163
|
if (inMap && inMap.mappings && "sources" in inMap && inMap.sources.length > 0) {
|
|
25851
26164
|
map = combineSourcemaps(url, [
|
|
@@ -26246,8 +26559,8 @@ async function defaultBrowser() {
|
|
|
26246
26559
|
}
|
|
26247
26560
|
|
|
26248
26561
|
// Path to included `xdg-open`.
|
|
26249
|
-
const __dirname = path$
|
|
26250
|
-
const localXdgOpenPath = path$
|
|
26562
|
+
const __dirname = path$c.dirname(fileURLToPath$1(import.meta.url));
|
|
26563
|
+
const localXdgOpenPath = path$c.join(__dirname, 'xdg-open');
|
|
26251
26564
|
|
|
26252
26565
|
const {platform, arch} = process$1;
|
|
26253
26566
|
|
|
@@ -27411,11 +27724,11 @@ const BASE_PREVIEW_SHORTCUTS = [
|
|
|
27411
27724
|
];
|
|
27412
27725
|
|
|
27413
27726
|
function getResolvedOutDirs(root, outDir, outputOptions) {
|
|
27414
|
-
const resolvedOutDir = path$
|
|
27727
|
+
const resolvedOutDir = path$c.resolve(root, outDir);
|
|
27415
27728
|
if (!outputOptions) return /* @__PURE__ */ new Set([resolvedOutDir]);
|
|
27416
27729
|
return new Set(
|
|
27417
27730
|
arraify(outputOptions).map(
|
|
27418
|
-
({ dir }) => dir ? path$
|
|
27731
|
+
({ dir }) => dir ? path$c.resolve(root, dir) : resolvedOutDir
|
|
27419
27732
|
)
|
|
27420
27733
|
);
|
|
27421
27734
|
}
|
|
@@ -32337,7 +32650,7 @@ function createWebSocketServer(server, config, httpsOptions) {
|
|
|
32337
32650
|
let hmrBase = config.base;
|
|
32338
32651
|
const hmrPath = hmr ? hmr.path : void 0;
|
|
32339
32652
|
if (hmrPath) {
|
|
32340
|
-
hmrBase = path$
|
|
32653
|
+
hmrBase = path$c.posix.join(hmrBase, hmrPath);
|
|
32341
32654
|
}
|
|
32342
32655
|
hmrServerWsListener = (req, socket, head) => {
|
|
32343
32656
|
const protocol = req.headers["sec-websocket-protocol"];
|
|
@@ -34883,14 +35196,14 @@ function htmlFallbackMiddleware(root, spaFallback) {
|
|
|
34883
35196
|
const url = cleanUrl(req.url);
|
|
34884
35197
|
const pathname = decodeURIComponent(url);
|
|
34885
35198
|
if (pathname.endsWith(".html")) {
|
|
34886
|
-
const filePath = path$
|
|
35199
|
+
const filePath = path$c.join(root, pathname);
|
|
34887
35200
|
if (fs__default.existsSync(filePath)) {
|
|
34888
35201
|
debug$4?.(`Rewriting ${req.method} ${req.url} to ${url}`);
|
|
34889
35202
|
req.url = url;
|
|
34890
35203
|
return next();
|
|
34891
35204
|
}
|
|
34892
35205
|
} else if (pathname.endsWith("/")) {
|
|
34893
|
-
const filePath = path$
|
|
35206
|
+
const filePath = path$c.join(root, pathname, "index.html");
|
|
34894
35207
|
if (fs__default.existsSync(filePath)) {
|
|
34895
35208
|
const newUrl = url + "index.html";
|
|
34896
35209
|
debug$4?.(`Rewriting ${req.method} ${req.url} to ${newUrl}`);
|
|
@@ -34898,7 +35211,7 @@ function htmlFallbackMiddleware(root, spaFallback) {
|
|
|
34898
35211
|
return next();
|
|
34899
35212
|
}
|
|
34900
35213
|
} else {
|
|
34901
|
-
const filePath = path$
|
|
35214
|
+
const filePath = path$c.join(root, pathname + ".html");
|
|
34902
35215
|
if (fs__default.existsSync(filePath)) {
|
|
34903
35216
|
const newUrl = url + ".html";
|
|
34904
35217
|
debug$4?.(`Rewriting ${req.method} ${req.url} to ${newUrl}`);
|
|
@@ -35093,7 +35406,7 @@ function send$1(req, res, content, type, options) {
|
|
|
35093
35406
|
type,
|
|
35094
35407
|
code,
|
|
35095
35408
|
ms.generateMap({
|
|
35096
|
-
source: path$
|
|
35409
|
+
source: path$c.basename(urlWithoutTimestamp),
|
|
35097
35410
|
hires: "boundary",
|
|
35098
35411
|
includeContent: true
|
|
35099
35412
|
})
|
|
@@ -35426,7 +35739,7 @@ function serveStaticMiddleware(server) {
|
|
|
35426
35739
|
);
|
|
35427
35740
|
return function viteServeStaticMiddleware(req, res, next) {
|
|
35428
35741
|
const cleanedUrl = cleanUrl(req.url);
|
|
35429
|
-
if (cleanedUrl.endsWith("/") || path$
|
|
35742
|
+
if (cleanedUrl.endsWith("/") || path$c.extname(cleanedUrl) === ".html" || isInternalRequest(req.url) || // skip url starting with // as these will be interpreted as
|
|
35430
35743
|
// scheme relative URLs by new URL() and will not be a valid file path
|
|
35431
35744
|
req.url?.startsWith("//")) {
|
|
35432
35745
|
return next();
|
|
@@ -35447,7 +35760,7 @@ function serveStaticMiddleware(server) {
|
|
|
35447
35760
|
}
|
|
35448
35761
|
}
|
|
35449
35762
|
const resolvedPathname = redirectedPathname || pathname;
|
|
35450
|
-
let fileUrl = path$
|
|
35763
|
+
let fileUrl = path$c.resolve(dir, removeLeadingSlash(resolvedPathname));
|
|
35451
35764
|
if (resolvedPathname.endsWith("/") && fileUrl[fileUrl.length - 1] !== "/") {
|
|
35452
35765
|
fileUrl = withTrailingSlash(fileUrl);
|
|
35453
35766
|
}
|
|
@@ -35506,9 +35819,18 @@ function isFileServingAllowed(configOrUrl, urlOrServer) {
|
|
|
35506
35819
|
function isUriInFilePath(uri, filePath) {
|
|
35507
35820
|
return isSameFileUri(uri, filePath) || isParentDirectory(uri, filePath);
|
|
35508
35821
|
}
|
|
35822
|
+
const windowsDriveRE = /^[A-Z]:/i;
|
|
35509
35823
|
function isFileLoadingAllowed(config, filePath) {
|
|
35510
35824
|
const { fs } = config.server;
|
|
35511
35825
|
if (!fs.strict) return true;
|
|
35826
|
+
if (isWindows$3 && filePath.includes("~")) {
|
|
35827
|
+
return false;
|
|
35828
|
+
}
|
|
35829
|
+
const hasDriveLetter = isWindows$3 && windowsDriveRE.test(filePath);
|
|
35830
|
+
const hasColon = (hasDriveLetter ? filePath.slice(2) : filePath).includes(":");
|
|
35831
|
+
if (hasColon) {
|
|
35832
|
+
return false;
|
|
35833
|
+
}
|
|
35512
35834
|
const filePathWithoutTrailingSlash = filePath.endsWith("/") ? filePath.slice(0, -1) : filePath;
|
|
35513
35835
|
if (config.fsDenyGlob(filePathWithoutTrailingSlash)) return false;
|
|
35514
35836
|
if (config.safeModulePaths.has(filePath)) return true;
|
|
@@ -35524,15 +35846,6 @@ function checkLoadingAccess(config, path2) {
|
|
|
35524
35846
|
}
|
|
35525
35847
|
return "fallback";
|
|
35526
35848
|
}
|
|
35527
|
-
function checkServingAccess(url, server) {
|
|
35528
|
-
if (isFileServingAllowed(url, server)) {
|
|
35529
|
-
return "allowed";
|
|
35530
|
-
}
|
|
35531
|
-
if (isFileReadable(cleanUrl(url))) {
|
|
35532
|
-
return "denied";
|
|
35533
|
-
}
|
|
35534
|
-
return "fallback";
|
|
35535
|
-
}
|
|
35536
35849
|
function respondWithAccessDenied(url, server, res) {
|
|
35537
35850
|
const urlMessage = `The request url "${url}" is outside of Vite serving allow list.`;
|
|
35538
35851
|
const hintMessage = `
|
|
@@ -35722,7 +36035,7 @@ ${e}`, {
|
|
|
35722
36035
|
}
|
|
35723
36036
|
if (code == null) {
|
|
35724
36037
|
const isPublicFile = checkPublicFile(url, environment.getTopLevelConfig());
|
|
35725
|
-
let publicDirName = path$
|
|
36038
|
+
let publicDirName = path$c.relative(config.root, config.publicDir);
|
|
35726
36039
|
if (publicDirName[0] !== ".") publicDirName = "/" + publicDirName;
|
|
35727
36040
|
const msg = isPublicFile ? `This file is in ${publicDirName} and will be copied as-is during build without going through the plugin transforms, and therefore should not be imported from source code. It can only be referenced via HTML tags.` : `Does the file exist?`;
|
|
35728
36041
|
const importerMod = moduleGraph.idToModuleMap.get(id)?.importers.values().next().value;
|
|
@@ -35769,14 +36082,14 @@ ${e}`, {
|
|
|
35769
36082
|
config.server.sourcemapIgnoreList,
|
|
35770
36083
|
logger
|
|
35771
36084
|
);
|
|
35772
|
-
if (path$
|
|
36085
|
+
if (path$c.isAbsolute(mod.file)) {
|
|
35773
36086
|
let modDirname;
|
|
35774
36087
|
for (let sourcesIndex = 0; sourcesIndex < normalizedMap.sources.length; ++sourcesIndex) {
|
|
35775
36088
|
const sourcePath = normalizedMap.sources[sourcesIndex];
|
|
35776
36089
|
if (sourcePath) {
|
|
35777
|
-
if (path$
|
|
35778
|
-
modDirname ??= path$
|
|
35779
|
-
normalizedMap.sources[sourcesIndex] = path$
|
|
36090
|
+
if (path$c.isAbsolute(sourcePath)) {
|
|
36091
|
+
modDirname ??= path$c.dirname(mod.file);
|
|
36092
|
+
normalizedMap.sources[sourcesIndex] = path$c.relative(
|
|
35780
36093
|
modDirname,
|
|
35781
36094
|
sourcePath
|
|
35782
36095
|
);
|
|
@@ -36225,7 +36538,7 @@ function buildHtmlPlugin(config) {
|
|
|
36225
36538
|
async handler(html, id) {
|
|
36226
36539
|
if (id.endsWith(".html")) {
|
|
36227
36540
|
id = normalizePath$3(id);
|
|
36228
|
-
const relativeUrlPath = normalizePath$3(path$
|
|
36541
|
+
const relativeUrlPath = normalizePath$3(path$c.relative(config.root, id));
|
|
36229
36542
|
const publicPath = `/${relativeUrlPath}`;
|
|
36230
36543
|
const publicBase = getBaseInHTML(relativeUrlPath, config);
|
|
36231
36544
|
const publicToRelative = (filename) => publicBase + filename;
|
|
@@ -36596,7 +36909,7 @@ ${js}`;
|
|
|
36596
36909
|
);
|
|
36597
36910
|
for (const [normalizedId, html] of processedHtml(this)) {
|
|
36598
36911
|
const relativeUrlPath = normalizePath$3(
|
|
36599
|
-
path$
|
|
36912
|
+
path$c.relative(config.root, normalizedId)
|
|
36600
36913
|
);
|
|
36601
36914
|
const assetsBase = getBaseInHTML(relativeUrlPath, config);
|
|
36602
36915
|
const toOutputFilePath = (filename, type) => {
|
|
@@ -36710,7 +37023,7 @@ ${js}`;
|
|
|
36710
37023
|
inlineEntryChunk.add(chunk.fileName);
|
|
36711
37024
|
}
|
|
36712
37025
|
const shortEmitName = normalizePath$3(
|
|
36713
|
-
path$
|
|
37026
|
+
path$c.relative(config.root, normalizedId)
|
|
36714
37027
|
);
|
|
36715
37028
|
this.emitFile({
|
|
36716
37029
|
type: "asset",
|
|
@@ -36763,7 +37076,7 @@ function preImportMapHook(config) {
|
|
|
36763
37076
|
if (importMapAppendIndex < 0) return;
|
|
36764
37077
|
if (importMapAppendIndex < importMapIndex) {
|
|
36765
37078
|
const relativeHtml = normalizePath$3(
|
|
36766
|
-
path$
|
|
37079
|
+
path$c.relative(config.root, ctx.filename)
|
|
36767
37080
|
);
|
|
36768
37081
|
config.logger.warnOnce(
|
|
36769
37082
|
colors$1.yellow(
|
|
@@ -36833,7 +37146,7 @@ function htmlEnvHook(config) {
|
|
|
36833
37146
|
} else {
|
|
36834
37147
|
if (envPrefix.some((prefix) => key.startsWith(prefix))) {
|
|
36835
37148
|
const relativeHtml = normalizePath$3(
|
|
36836
|
-
path$
|
|
37149
|
+
path$c.relative(config.root, ctx.filename)
|
|
36837
37150
|
);
|
|
36838
37151
|
config.logger.warn(
|
|
36839
37152
|
colors$1.yellow(
|
|
@@ -36989,8 +37302,8 @@ function isEntirelyImport(code) {
|
|
|
36989
37302
|
return !code.replace(importRE, "").replace(commentRE, "").trim().length;
|
|
36990
37303
|
}
|
|
36991
37304
|
function getBaseInHTML(urlRelativePath, config) {
|
|
36992
|
-
return config.base === "./" || config.base === "" ? path$
|
|
36993
|
-
path$
|
|
37305
|
+
return config.base === "./" || config.base === "" ? path$c.posix.join(
|
|
37306
|
+
path$c.posix.relative(urlRelativePath, "").slice(0, -2),
|
|
36994
37307
|
"./"
|
|
36995
37308
|
) : config.base;
|
|
36996
37309
|
}
|
|
@@ -37116,25 +37429,10 @@ function decodeURIIfPossible(input) {
|
|
|
37116
37429
|
|
|
37117
37430
|
const debugCache = createDebugger("vite:cache");
|
|
37118
37431
|
const knownIgnoreList = /* @__PURE__ */ new Set(["/", "/favicon.ico"]);
|
|
37119
|
-
const trailingQuerySeparatorsRE = /[?&]+$/;
|
|
37120
37432
|
const urlRE = /[?&]url\b/;
|
|
37121
37433
|
const rawRE = /[?&]raw\b/;
|
|
37122
37434
|
const inlineRE$2 = /[?&]inline\b/;
|
|
37123
37435
|
const svgRE = /\.svg\b/;
|
|
37124
|
-
function deniedServingAccessForTransform(url, server, res, next) {
|
|
37125
|
-
if (rawRE.test(url) || urlRE.test(url) || inlineRE$2.test(url) || svgRE.test(url)) {
|
|
37126
|
-
const servingAccessResult = checkServingAccess(url, server);
|
|
37127
|
-
if (servingAccessResult === "denied") {
|
|
37128
|
-
respondWithAccessDenied(url, server, res);
|
|
37129
|
-
return true;
|
|
37130
|
-
}
|
|
37131
|
-
if (servingAccessResult === "fallback") {
|
|
37132
|
-
next();
|
|
37133
|
-
return true;
|
|
37134
|
-
}
|
|
37135
|
-
}
|
|
37136
|
-
return false;
|
|
37137
|
-
}
|
|
37138
37436
|
function isServerAccessDeniedForTransform(config, id) {
|
|
37139
37437
|
if (rawRE.test(id) || urlRE.test(id) || inlineRE$2.test(id) || svgRE.test(id)) {
|
|
37140
37438
|
return checkLoadingAccess(config, id) !== "allowed";
|
|
@@ -37189,7 +37487,7 @@ function transformMiddleware(server) {
|
|
|
37189
37487
|
if (isSourceMap) {
|
|
37190
37488
|
const depsOptimizer = environment.depsOptimizer;
|
|
37191
37489
|
if (depsOptimizer?.isOptimizedDepUrl(url)) {
|
|
37192
|
-
const sourcemapPath = url.startsWith(FS_PREFIX) ? fsPathFromId(url) : normalizePath$3(path$
|
|
37490
|
+
const sourcemapPath = url.startsWith(FS_PREFIX) ? fsPathFromId(url) : normalizePath$3(path$c.resolve(server.config.root, url.slice(1)));
|
|
37193
37491
|
if (!depsOptimizer.isOptimizedDepFile(sourcemapPath)) {
|
|
37194
37492
|
return next();
|
|
37195
37493
|
}
|
|
@@ -37235,18 +37533,6 @@ function transformMiddleware(server) {
|
|
|
37235
37533
|
if (publicDirInRoot && url.startsWith(publicPath)) {
|
|
37236
37534
|
warnAboutExplicitPublicPathInUrl(url);
|
|
37237
37535
|
}
|
|
37238
|
-
const urlWithoutTrailingQuerySeparators = url.replace(
|
|
37239
|
-
trailingQuerySeparatorsRE,
|
|
37240
|
-
""
|
|
37241
|
-
);
|
|
37242
|
-
if (deniedServingAccessForTransform(
|
|
37243
|
-
urlWithoutTrailingQuerySeparators,
|
|
37244
|
-
server,
|
|
37245
|
-
res,
|
|
37246
|
-
next
|
|
37247
|
-
)) {
|
|
37248
|
-
return;
|
|
37249
|
-
}
|
|
37250
37536
|
if (req.headers["sec-fetch-dest"] === "script" || isJSRequest(url) || isImportRequest(url) || isCSSRequest(url) || isHTMLProxy(url)) {
|
|
37251
37537
|
url = removeImportQuery(url);
|
|
37252
37538
|
url = unwrapId$1(url);
|
|
@@ -37392,11 +37678,12 @@ function createDevHtmlTransformFn(config) {
|
|
|
37392
37678
|
};
|
|
37393
37679
|
}
|
|
37394
37680
|
function getHtmlFilename(url, server) {
|
|
37395
|
-
|
|
37396
|
-
|
|
37681
|
+
const urlPath = cleanUrl(url);
|
|
37682
|
+
if (urlPath.startsWith(FS_PREFIX)) {
|
|
37683
|
+
return decodeURIComponent(fsPathFromId(urlPath));
|
|
37397
37684
|
} else {
|
|
37398
37685
|
return decodeURIComponent(
|
|
37399
|
-
normalizePath$3(path$
|
|
37686
|
+
normalizePath$3(path$c.join(server.config.root, urlPath.slice(1)))
|
|
37400
37687
|
);
|
|
37401
37688
|
}
|
|
37402
37689
|
}
|
|
@@ -37407,6 +37694,7 @@ const wordCharRE = /\w/;
|
|
|
37407
37694
|
function isBareRelative(url) {
|
|
37408
37695
|
return wordCharRE.test(url[0]) && !url.includes(":");
|
|
37409
37696
|
}
|
|
37697
|
+
const multipleLeadingSlashesRE = /^\/{2,}/g;
|
|
37410
37698
|
const processNodeUrl = (url, useSrcSetReplacer, config, htmlPath, originalUrl, server, isClassicScriptLink) => {
|
|
37411
37699
|
const replacer = (url2) => {
|
|
37412
37700
|
if (url2[0] === "/" && url2[1] !== "/" || // #3230 if some request url (localhost:3000/a/b) return to fallback html, the relative assets
|
|
@@ -37418,16 +37706,16 @@ const processNodeUrl = (url, useSrcSetReplacer, config, htmlPath, originalUrl, s
|
|
|
37418
37706
|
// rewrite `../index.js` -> `localhost:5173/index.js`.
|
|
37419
37707
|
// rewrite `relative/index.js` -> `localhost:5173/a/relative/index.js`.
|
|
37420
37708
|
(url2[0] === "." || isBareRelative(url2)) && originalUrl && originalUrl !== "/" && htmlPath === "/index.html") {
|
|
37421
|
-
url2 = path$
|
|
37709
|
+
url2 = path$c.posix.join(config.base, url2);
|
|
37422
37710
|
}
|
|
37423
37711
|
let preTransformUrl;
|
|
37424
37712
|
if (!isClassicScriptLink && shouldPreTransform(url2, config)) {
|
|
37425
37713
|
if (url2[0] === "/" && url2[1] !== "/") {
|
|
37426
37714
|
preTransformUrl = url2;
|
|
37427
37715
|
} else if (url2[0] === "." || isBareRelative(url2)) {
|
|
37428
|
-
preTransformUrl = path$
|
|
37716
|
+
preTransformUrl = path$c.posix.join(
|
|
37429
37717
|
config.base,
|
|
37430
|
-
path$
|
|
37718
|
+
path$c.posix.dirname(htmlPath),
|
|
37431
37719
|
url2
|
|
37432
37720
|
);
|
|
37433
37721
|
}
|
|
@@ -37454,6 +37742,9 @@ const processNodeUrl = (url, useSrcSetReplacer, config, htmlPath, originalUrl, s
|
|
|
37454
37742
|
return processedUrl;
|
|
37455
37743
|
};
|
|
37456
37744
|
const devHtmlHook = async (html, { path: htmlPath, filename, server, originalUrl }) => {
|
|
37745
|
+
if (htmlPath.startsWith("//")) {
|
|
37746
|
+
htmlPath = htmlPath.replace(multipleLeadingSlashesRE, "/");
|
|
37747
|
+
}
|
|
37457
37748
|
const { config, watcher } = server;
|
|
37458
37749
|
const base = config.base || "/";
|
|
37459
37750
|
const decodedBase = config.decodedBase || "/";
|
|
@@ -37635,7 +37926,7 @@ const devHtmlHook = async (html, { path: htmlPath, filename, server, originalUrl
|
|
|
37635
37926
|
tag: "script",
|
|
37636
37927
|
attrs: {
|
|
37637
37928
|
type: "module",
|
|
37638
|
-
src: path$
|
|
37929
|
+
src: path$c.posix.join(base, CLIENT_PUBLIC_PATH)
|
|
37639
37930
|
},
|
|
37640
37931
|
injectTo: "head-prepend"
|
|
37641
37932
|
}
|
|
@@ -37655,7 +37946,7 @@ function indexHtmlMiddleware(root, server) {
|
|
|
37655
37946
|
filePath = decodeURIComponent(fsPathFromId(url));
|
|
37656
37947
|
} else {
|
|
37657
37948
|
filePath = normalizePath$3(
|
|
37658
|
-
path$
|
|
37949
|
+
path$c.resolve(path$c.join(root, decodeURIComponent(url)))
|
|
37659
37950
|
);
|
|
37660
37951
|
}
|
|
37661
37952
|
if (isDev) {
|
|
@@ -38835,7 +39126,7 @@ function createServerCloseFn(server) {
|
|
|
38835
39126
|
});
|
|
38836
39127
|
}
|
|
38837
39128
|
function resolvedAllowDir(root, dir) {
|
|
38838
|
-
return normalizePath$3(path$
|
|
39129
|
+
return normalizePath$3(path$c.resolve(root, dir));
|
|
38839
39130
|
}
|
|
38840
39131
|
const serverConfigDefaults = Object.freeze({
|
|
38841
39132
|
port: DEFAULT_DEV_PORT,
|
|
@@ -39002,7 +39293,7 @@ const debugHmr = createDebugger("vite:hmr");
|
|
|
39002
39293
|
const whitespaceRE = /\s/;
|
|
39003
39294
|
const normalizedClientDir = normalizePath$3(CLIENT_DIR);
|
|
39004
39295
|
function getShortName(file, root) {
|
|
39005
|
-
return file.startsWith(withTrailingSlash(root)) ? path$
|
|
39296
|
+
return file.startsWith(withTrailingSlash(root)) ? path$c.posix.relative(root, file) : file;
|
|
39006
39297
|
}
|
|
39007
39298
|
const normalizeHotChannel = (channel, enableHmr, normalizeClient = true) => {
|
|
39008
39299
|
const normalizedListenerMap = /* @__PURE__ */ new WeakMap();
|
|
@@ -39173,7 +39464,7 @@ async function handleHMRUpdate(type, file, server) {
|
|
|
39173
39464
|
config.logger.info(
|
|
39174
39465
|
colors$1.green(
|
|
39175
39466
|
`${normalizePath$3(
|
|
39176
|
-
path$
|
|
39467
|
+
path$c.relative(process.cwd(), file)
|
|
39177
39468
|
)} changed, restarting server...`
|
|
39178
39469
|
),
|
|
39179
39470
|
{ clear: true, timestamp: true }
|
|
@@ -39191,7 +39482,7 @@ async function handleHMRUpdate(type, file, server) {
|
|
|
39191
39482
|
({ hot }) => hot.send({
|
|
39192
39483
|
type: "full-reload",
|
|
39193
39484
|
path: "*",
|
|
39194
|
-
triggeredBy: path$
|
|
39485
|
+
triggeredBy: path$c.resolve(config.root, file)
|
|
39195
39486
|
})
|
|
39196
39487
|
);
|
|
39197
39488
|
return;
|
|
@@ -39333,7 +39624,7 @@ async function handleHMRUpdate(type, file, server) {
|
|
|
39333
39624
|
);
|
|
39334
39625
|
environment.hot.send({
|
|
39335
39626
|
type: "full-reload",
|
|
39336
|
-
path: config.server.middlewareMode ? "*" : "/" + normalizePath$3(path$
|
|
39627
|
+
path: config.server.middlewareMode ? "*" : "/" + normalizePath$3(path$c.relative(config.root, file))
|
|
39337
39628
|
});
|
|
39338
39629
|
} else {
|
|
39339
39630
|
debugHmr?.(
|
|
@@ -39409,7 +39700,7 @@ function updateModules(environment, file, modules, timestamp, firstInvalidatedBy
|
|
|
39409
39700
|
);
|
|
39410
39701
|
hot.send({
|
|
39411
39702
|
type: "full-reload",
|
|
39412
|
-
triggeredBy: path$
|
|
39703
|
+
triggeredBy: path$c.resolve(environment.config.root, file)
|
|
39413
39704
|
});
|
|
39414
39705
|
return;
|
|
39415
39706
|
}
|
|
@@ -39967,15 +40258,15 @@ async function bundleWorkerEntry(config, id) {
|
|
|
39967
40258
|
const {
|
|
39968
40259
|
output: [outputChunk, ...outputChunks]
|
|
39969
40260
|
} = await bundle.generate({
|
|
39970
|
-
entryFileNames: path$
|
|
40261
|
+
entryFileNames: path$c.posix.join(
|
|
39971
40262
|
config.build.assetsDir,
|
|
39972
40263
|
"[name]-[hash].js"
|
|
39973
40264
|
),
|
|
39974
|
-
chunkFileNames: path$
|
|
40265
|
+
chunkFileNames: path$c.posix.join(
|
|
39975
40266
|
config.build.assetsDir,
|
|
39976
40267
|
"[name]-[hash].js"
|
|
39977
40268
|
),
|
|
39978
|
-
assetFileNames: path$
|
|
40269
|
+
assetFileNames: path$c.posix.join(
|
|
39979
40270
|
config.build.assetsDir,
|
|
39980
40271
|
"[name]-[hash].[ext]"
|
|
39981
40272
|
),
|
|
@@ -40099,7 +40390,7 @@ function webWorkerPlugin(config) {
|
|
|
40099
40390
|
const workerType2 = workerFileMatch[1];
|
|
40100
40391
|
let injectEnv = "";
|
|
40101
40392
|
const scriptPath = JSON.stringify(
|
|
40102
|
-
path$
|
|
40393
|
+
path$c.posix.join(config.base, ENV_PUBLIC_PATH)
|
|
40103
40394
|
);
|
|
40104
40395
|
if (workerType2 === "classic") {
|
|
40105
40396
|
injectEnv = `importScripts(${scriptPath})
|
|
@@ -40313,7 +40604,7 @@ function preAliasPlugin(config) {
|
|
|
40313
40604
|
const optimizeDeps = depsOptimizer.options;
|
|
40314
40605
|
const resolvedId = cleanUrl(resolved.id);
|
|
40315
40606
|
const isVirtual = resolvedId === id || resolvedId.includes("\0");
|
|
40316
|
-
if (!isVirtual && fs__default.existsSync(resolvedId) && !moduleListContains(optimizeDeps.exclude, id) && path$
|
|
40607
|
+
if (!isVirtual && fs__default.existsSync(resolvedId) && !moduleListContains(optimizeDeps.exclude, id) && path$c.isAbsolute(resolvedId) && (isInNodeModules$1(resolvedId) || optimizeDeps.include?.includes(id)) && isOptimizable(resolvedId, optimizeDeps) && (!ssr || optimizeAliasReplacementForSSR(resolvedId, optimizeDeps))) {
|
|
40317
40608
|
const optimizedInfo = depsOptimizer.registerMissingImport(
|
|
40318
40609
|
id,
|
|
40319
40610
|
resolvedId
|
|
@@ -40376,8 +40667,8 @@ function normalizeResolvedIdToUrl(environment, url, resolved) {
|
|
|
40376
40667
|
} else if (depsOptimizer?.isOptimizedDepFile(resolved.id) || // vite-plugin-react isn't following the leading \0 virtual module convention.
|
|
40377
40668
|
// This is a temporary hack to avoid expensive fs checks for React apps.
|
|
40378
40669
|
// We'll remove this as soon we're able to fix the react plugins.
|
|
40379
|
-
resolved.id !== "/@react-refresh" && path$
|
|
40380
|
-
url = path$
|
|
40670
|
+
resolved.id !== "/@react-refresh" && path$c.isAbsolute(resolved.id) && fs__default.existsSync(cleanUrl(resolved.id))) {
|
|
40671
|
+
url = path$c.posix.join(FS_PREFIX, resolved.id);
|
|
40381
40672
|
} else {
|
|
40382
40673
|
url = resolved.id;
|
|
40383
40674
|
}
|
|
@@ -40427,7 +40718,7 @@ function extractImportedBindings(id, source, importSpec, importedBindings) {
|
|
|
40427
40718
|
}
|
|
40428
40719
|
function importAnalysisPlugin(config) {
|
|
40429
40720
|
const { root, base } = config;
|
|
40430
|
-
const clientPublicPath = path$
|
|
40721
|
+
const clientPublicPath = path$c.posix.join(base, CLIENT_PUBLIC_PATH);
|
|
40431
40722
|
const enablePartialAccept = config.experimental.hmrPartialAccept;
|
|
40432
40723
|
const matchAlias = getAliasPatternMatcher(config.resolve.alias);
|
|
40433
40724
|
let _env;
|
|
@@ -40501,7 +40792,7 @@ function importAnalysisPlugin(config) {
|
|
|
40501
40792
|
const str = () => s || (s = new MagicString(source));
|
|
40502
40793
|
let isPartiallySelfAccepting = false;
|
|
40503
40794
|
const importedBindings = enablePartialAccept ? /* @__PURE__ */ new Map() : null;
|
|
40504
|
-
const toAbsoluteUrl = (url) => path$
|
|
40795
|
+
const toAbsoluteUrl = (url) => path$c.posix.resolve(path$c.posix.dirname(importerModule.url), url);
|
|
40505
40796
|
const normalizeUrl = async (url, pos, forceSkipImportAnalysis = false) => {
|
|
40506
40797
|
url = stripBase(url, base);
|
|
40507
40798
|
let importerFile = importer;
|
|
@@ -40528,7 +40819,7 @@ function importAnalysisPlugin(config) {
|
|
|
40528
40819
|
moduleGraph._hasResolveFailedErrorModules.add(importerModule);
|
|
40529
40820
|
return this.error(
|
|
40530
40821
|
`Failed to resolve import "${url}" from "${normalizePath$3(
|
|
40531
|
-
path$
|
|
40822
|
+
path$c.relative(process.cwd(), importerFile)
|
|
40532
40823
|
)}". Does the file exist?`,
|
|
40533
40824
|
pos
|
|
40534
40825
|
);
|
|
@@ -40646,8 +40937,10 @@ function importAnalysisPlugin(config) {
|
|
|
40646
40937
|
);
|
|
40647
40938
|
}
|
|
40648
40939
|
let [url, resolvedId] = await normalizeUrl(specifier, start);
|
|
40940
|
+
if (resolvedId) {
|
|
40941
|
+
config.safeModulePaths.add(cleanUrl(resolvedId));
|
|
40942
|
+
}
|
|
40649
40943
|
resolvedId = resolvedId || url;
|
|
40650
|
-
config.safeModulePaths.add(fsPathFromUrl(stripBase(url, base)));
|
|
40651
40944
|
if (url !== specifier) {
|
|
40652
40945
|
let rewriteDone = false;
|
|
40653
40946
|
if (depsOptimizer?.isOptimizedDepFile(resolvedId) && !optimizedDepChunkRE.test(resolvedId)) {
|
|
@@ -40872,9 +41165,9 @@ function createParseErrorInfo(importer, source) {
|
|
|
40872
41165
|
const probablyBinary = source.includes(
|
|
40873
41166
|
"\uFFFD"
|
|
40874
41167
|
);
|
|
40875
|
-
const msg = isVue ? `Install @vitejs/plugin-vue to handle .vue files.` : maybeJSX ? isJsx ? `If you use tsconfig.json, make sure to not set jsx to preserve.` : `If you are using JSX, make sure to name the file with the .jsx or .tsx extension.` : `You may need to install appropriate plugins to handle the ${path$
|
|
41168
|
+
const msg = isVue ? `Install @vitejs/plugin-vue to handle .vue files.` : maybeJSX ? isJsx ? `If you use tsconfig.json, make sure to not set jsx to preserve.` : `If you are using JSX, make sure to name the file with the .jsx or .tsx extension.` : `You may need to install appropriate plugins to handle the ${path$c.extname(
|
|
40876
41169
|
importer
|
|
40877
|
-
)} file format, or if it's an asset, add "**/*${path$
|
|
41170
|
+
)} file format, or if it's an asset, add "**/*${path$c.extname(
|
|
40878
41171
|
importer
|
|
40879
41172
|
)}" to \`assetsInclude\` in your configuration.`;
|
|
40880
41173
|
return {
|
|
@@ -41047,7 +41340,7 @@ function clientInjectionsPlugin(config) {
|
|
|
41047
41340
|
const timeout = hmrConfig?.timeout || 3e4;
|
|
41048
41341
|
const overlay = hmrConfig?.overlay !== false;
|
|
41049
41342
|
const isHmrServerSpecified = !!hmrConfig?.server;
|
|
41050
|
-
const hmrConfigName = path$
|
|
41343
|
+
const hmrConfigName = path$c.basename(config.configFile || "vite.config.js");
|
|
41051
41344
|
let port = hmrConfig?.clientPort || hmrConfig?.port || null;
|
|
41052
41345
|
if (config.server.middlewareMode && !isHmrServerSpecified) {
|
|
41053
41346
|
port ||= 24678;
|
|
@@ -41057,7 +41350,7 @@ function clientInjectionsPlugin(config) {
|
|
|
41057
41350
|
directTarget += devBase;
|
|
41058
41351
|
let hmrBase = devBase;
|
|
41059
41352
|
if (hmrConfig?.path) {
|
|
41060
|
-
hmrBase = path$
|
|
41353
|
+
hmrBase = path$c.posix.join(hmrBase, hmrConfig.path);
|
|
41061
41354
|
}
|
|
41062
41355
|
const modeReplacement = escapeReplacement(config.mode);
|
|
41063
41356
|
const baseReplacement = escapeReplacement(devBase);
|
|
@@ -41327,7 +41620,7 @@ function workerImportMetaUrlPlugin(config) {
|
|
|
41327
41620
|
const url = rawUrl.slice(1, -1);
|
|
41328
41621
|
let file;
|
|
41329
41622
|
if (url[0] === ".") {
|
|
41330
|
-
file = path$
|
|
41623
|
+
file = path$c.resolve(path$c.dirname(id), url);
|
|
41331
41624
|
file = slash$1(tryFsResolve(file, fsResolveOptions) ?? file);
|
|
41332
41625
|
} else {
|
|
41333
41626
|
workerResolver ??= createBackCompatIdResolver(config, {
|
|
@@ -41336,7 +41629,7 @@ function workerImportMetaUrlPlugin(config) {
|
|
|
41336
41629
|
preferRelative: true
|
|
41337
41630
|
});
|
|
41338
41631
|
file = await workerResolver(this.environment, url, id);
|
|
41339
|
-
file ??= url[0] === "/" ? slash$1(path$
|
|
41632
|
+
file ??= url[0] === "/" ? slash$1(path$c.join(config.publicDir, url)) : slash$1(path$c.resolve(path$c.dirname(id), url));
|
|
41340
41633
|
}
|
|
41341
41634
|
if (isBuild && config.isWorker && config.bundleChain.at(-1) === cleanUrl(file)) {
|
|
41342
41635
|
s.update(expStart, expEnd, "self.location.href");
|
|
@@ -41432,7 +41725,7 @@ function assetImportMetaUrlPlugin(config) {
|
|
|
41432
41725
|
}
|
|
41433
41726
|
let file;
|
|
41434
41727
|
if (url[0] === ".") {
|
|
41435
|
-
file = slash$1(path$
|
|
41728
|
+
file = slash$1(path$c.resolve(path$c.dirname(id), url));
|
|
41436
41729
|
file = tryFsResolve(file, fsResolveOptions) ?? file;
|
|
41437
41730
|
} else {
|
|
41438
41731
|
assetResolver ??= createBackCompatIdResolver(config, {
|
|
@@ -41442,13 +41735,13 @@ function assetImportMetaUrlPlugin(config) {
|
|
|
41442
41735
|
preferRelative: true
|
|
41443
41736
|
});
|
|
41444
41737
|
file = await assetResolver(this.environment, url, id);
|
|
41445
|
-
file ??= url[0] === "/" ? slash$1(path$
|
|
41738
|
+
file ??= url[0] === "/" ? slash$1(path$c.join(publicDir, url)) : slash$1(path$c.resolve(path$c.dirname(id), url));
|
|
41446
41739
|
}
|
|
41447
41740
|
let builtUrl;
|
|
41448
41741
|
if (file) {
|
|
41449
41742
|
try {
|
|
41450
41743
|
if (publicDir && isParentDirectory(publicDir, file)) {
|
|
41451
|
-
const publicPath = "/" + path$
|
|
41744
|
+
const publicPath = "/" + path$c.posix.relative(publicDir, file);
|
|
41452
41745
|
builtUrl = await fileToUrl$1(this, publicPath);
|
|
41453
41746
|
} else {
|
|
41454
41747
|
builtUrl = await fileToUrl$1(this, file);
|
|
@@ -41830,10 +42123,10 @@ function dynamicImportVarsPlugin(config) {
|
|
|
41830
42123
|
}
|
|
41831
42124
|
|
|
41832
42125
|
function getMatcherString(glob, cwd) {
|
|
41833
|
-
if (glob.startsWith("**") || path$
|
|
42126
|
+
if (glob.startsWith("**") || path$c.isAbsolute(glob)) {
|
|
41834
42127
|
return slash$1(glob);
|
|
41835
42128
|
}
|
|
41836
|
-
const resolved = path$
|
|
42129
|
+
const resolved = path$c.join(cwd, glob);
|
|
41837
42130
|
return slash$1(resolved);
|
|
41838
42131
|
}
|
|
41839
42132
|
function patternToIdFilter(pattern, cwd) {
|
|
@@ -43051,13 +43344,13 @@ function cssPostPlugin(config) {
|
|
|
43051
43344
|
const rollupOptionsOutput = config.build.rollupOptions.output;
|
|
43052
43345
|
const assetFileNames = (Array.isArray(rollupOptionsOutput) ? rollupOptionsOutput[0] : rollupOptionsOutput)?.assetFileNames;
|
|
43053
43346
|
const getCssAssetDirname = (cssAssetName) => {
|
|
43054
|
-
const cssAssetNameDir = path$
|
|
43347
|
+
const cssAssetNameDir = path$c.dirname(cssAssetName);
|
|
43055
43348
|
if (!assetFileNames) {
|
|
43056
|
-
return path$
|
|
43349
|
+
return path$c.join(config.build.assetsDir, cssAssetNameDir);
|
|
43057
43350
|
} else if (typeof assetFileNames === "string") {
|
|
43058
|
-
return path$
|
|
43351
|
+
return path$c.join(path$c.dirname(assetFileNames), cssAssetNameDir);
|
|
43059
43352
|
} else {
|
|
43060
|
-
return path$
|
|
43353
|
+
return path$c.dirname(
|
|
43061
43354
|
assetFileNames({
|
|
43062
43355
|
type: "asset",
|
|
43063
43356
|
name: cssAssetName,
|
|
@@ -43140,7 +43433,7 @@ function cssPostPlugin(config) {
|
|
|
43140
43433
|
const cssContent = await getContentWithSourcemap(css);
|
|
43141
43434
|
const code2 = [
|
|
43142
43435
|
`import { updateStyle as __vite__updateStyle, removeStyle as __vite__removeStyle } from ${JSON.stringify(
|
|
43143
|
-
path$
|
|
43436
|
+
path$c.posix.join(config.base, CLIENT_PUBLIC_PATH)
|
|
43144
43437
|
)}`,
|
|
43145
43438
|
`const __vite__id = ${JSON.stringify(id)}`,
|
|
43146
43439
|
`const __vite__css = ${JSON.stringify(cssContent)}`,
|
|
@@ -43218,7 +43511,7 @@ function cssPostPlugin(config) {
|
|
|
43218
43511
|
const cssAssetDirname = encodedPublicUrls || relative ? slash$1(getCssAssetDirname(cssAssetName)) : void 0;
|
|
43219
43512
|
const toRelative = (filename) => {
|
|
43220
43513
|
const relativePath = normalizePath$3(
|
|
43221
|
-
path$
|
|
43514
|
+
path$c.relative(cssAssetDirname, filename)
|
|
43222
43515
|
);
|
|
43223
43516
|
return relativePath[0] === "." ? relativePath : "./" + relativePath;
|
|
43224
43517
|
};
|
|
@@ -43238,7 +43531,7 @@ function cssPostPlugin(config) {
|
|
|
43238
43531
|
});
|
|
43239
43532
|
if (encodedPublicUrls) {
|
|
43240
43533
|
const relativePathToPublicFromCSS = normalizePath$3(
|
|
43241
|
-
path$
|
|
43534
|
+
path$c.relative(cssAssetDirname, "")
|
|
43242
43535
|
);
|
|
43243
43536
|
chunkCSS2 = chunkCSS2.replace(publicAssetUrlRE, (_, hash) => {
|
|
43244
43537
|
const publicUrl = publicAssetUrlMap.get(hash).slice(1);
|
|
@@ -43258,7 +43551,7 @@ function cssPostPlugin(config) {
|
|
|
43258
43551
|
};
|
|
43259
43552
|
function ensureFileExt(name, ext) {
|
|
43260
43553
|
return normalizePath$3(
|
|
43261
|
-
path$
|
|
43554
|
+
path$c.format({ ...path$c.parse(name), base: void 0, ext })
|
|
43262
43555
|
);
|
|
43263
43556
|
}
|
|
43264
43557
|
let s;
|
|
@@ -43271,7 +43564,7 @@ function cssPostPlugin(config) {
|
|
|
43271
43564
|
const id = Buffer.from(idHex, "hex").toString();
|
|
43272
43565
|
const originalFileName = cleanUrl(id);
|
|
43273
43566
|
const cssAssetName = ensureFileExt(
|
|
43274
|
-
path$
|
|
43567
|
+
path$c.basename(originalFileName),
|
|
43275
43568
|
".css"
|
|
43276
43569
|
);
|
|
43277
43570
|
if (!styles.has(id)) {
|
|
@@ -43338,7 +43631,7 @@ function cssPostPlugin(config) {
|
|
|
43338
43631
|
if (opts.format === "es" || opts.format === "cjs") {
|
|
43339
43632
|
const isEntry = chunk.isEntry && isPureCssChunk;
|
|
43340
43633
|
const cssFullAssetName = ensureFileExt(chunk.name, ".css");
|
|
43341
|
-
const cssAssetName = chunk.isEntry && (!chunk.facadeModuleId || !isCSSRequest(chunk.facadeModuleId)) ? path$
|
|
43634
|
+
const cssAssetName = chunk.isEntry && (!chunk.facadeModuleId || !isCSSRequest(chunk.facadeModuleId)) ? path$c.basename(cssFullAssetName) : cssFullAssetName;
|
|
43342
43635
|
const originalFileName = getChunkOriginalFileName(
|
|
43343
43636
|
chunk,
|
|
43344
43637
|
config.root,
|
|
@@ -43555,7 +43848,7 @@ function isCssScopeToRendered(cssScopeTo, renderedModules) {
|
|
|
43555
43848
|
return importer && (exp === void 0 || importer.renderedExports.includes(exp));
|
|
43556
43849
|
}
|
|
43557
43850
|
function getEmptyChunkReplacer(pureCssChunkNames, outputFormat) {
|
|
43558
|
-
const emptyChunkFiles = pureCssChunkNames.map((file) => escapeRegex(path$
|
|
43851
|
+
const emptyChunkFiles = pureCssChunkNames.map((file) => escapeRegex(path$c.basename(file))).join("|");
|
|
43559
43852
|
const emptyChunkRE = new RegExp(
|
|
43560
43853
|
outputFormat === "es" ? `\\bimport\\s*["'][^"']*(?:${emptyChunkFiles})["'];` : `(\\b|,\\s*)require\\(\\s*["'][^"']*(?:${emptyChunkFiles})["']\\)(;|,)`,
|
|
43561
43854
|
"g"
|
|
@@ -43763,12 +44056,12 @@ async function compilePostCSS(environment, id, code, deps, lang, workerControlle
|
|
|
43763
44056
|
const resolved = await atImportResolvers.css(
|
|
43764
44057
|
environment,
|
|
43765
44058
|
id2,
|
|
43766
|
-
path$
|
|
44059
|
+
path$c.join(basedir, "*")
|
|
43767
44060
|
);
|
|
43768
44061
|
if (resolved) {
|
|
43769
|
-
return path$
|
|
44062
|
+
return path$c.resolve(resolved);
|
|
43770
44063
|
}
|
|
43771
|
-
if (!path$
|
|
44064
|
+
if (!path$c.isAbsolute(id2)) {
|
|
43772
44065
|
environment.logger.error(
|
|
43773
44066
|
colors$1.red(
|
|
43774
44067
|
`Unable to resolve \`@import "${id2}"\` from ${basedir}`
|
|
@@ -43832,7 +44125,7 @@ async function compilePostCSS(environment, id, code, deps, lang, workerControlle
|
|
|
43832
44125
|
importer
|
|
43833
44126
|
);
|
|
43834
44127
|
if (resolved) {
|
|
43835
|
-
return path$
|
|
44128
|
+
return path$c.resolve(resolved);
|
|
43836
44129
|
}
|
|
43837
44130
|
}
|
|
43838
44131
|
return id2;
|
|
@@ -43898,7 +44191,7 @@ async function runPostCSS(id, code, plugins, options, deps, logger, enableSource
|
|
|
43898
44191
|
const { dir, glob: globPattern = "**" } = message;
|
|
43899
44192
|
const files = globSync(globPattern, {
|
|
43900
44193
|
absolute: true,
|
|
43901
|
-
cwd: path$
|
|
44194
|
+
cwd: path$c.resolve(path$c.dirname(id), dir),
|
|
43902
44195
|
expandDirectories: false,
|
|
43903
44196
|
ignore: ["**/node_modules/**"]
|
|
43904
44197
|
});
|
|
@@ -43966,8 +44259,8 @@ function createCachedImport(imp) {
|
|
|
43966
44259
|
return cached;
|
|
43967
44260
|
};
|
|
43968
44261
|
}
|
|
43969
|
-
const importPostcssImport = createCachedImport(() => import('./dep-
|
|
43970
|
-
const importPostcssModules = createCachedImport(() => import('./dep-
|
|
44262
|
+
const importPostcssImport = createCachedImport(() => import('./dep-D2Nv_XqQ.js').then(function (n) { return n.i; }));
|
|
44263
|
+
const importPostcssModules = createCachedImport(() => import('./dep-nQZNP8DK.js').then(function (n) { return n.i; }));
|
|
43971
44264
|
const importPostcss = createCachedImport(() => import('postcss'));
|
|
43972
44265
|
const preprocessorWorkerControllerCache = /* @__PURE__ */ new WeakMap();
|
|
43973
44266
|
let alwaysFakeWorkerWorkerControllerCache;
|
|
@@ -43984,13 +44277,13 @@ async function preprocessCSS(code, filename, config) {
|
|
|
43984
44277
|
return await compileCSS(environment, filename, code, workerController);
|
|
43985
44278
|
}
|
|
43986
44279
|
async function formatPostcssSourceMap(rawMap, file) {
|
|
43987
|
-
const inputFileDir = path$
|
|
44280
|
+
const inputFileDir = path$c.dirname(file);
|
|
43988
44281
|
const sources = rawMap.sources.map((source) => {
|
|
43989
44282
|
const cleanSource = cleanUrl(decodeURIComponent(source));
|
|
43990
44283
|
if (cleanSource[0] === "<" && cleanSource.endsWith(">")) {
|
|
43991
44284
|
return `\0${cleanSource}`;
|
|
43992
44285
|
}
|
|
43993
|
-
return normalizePath$3(path$
|
|
44286
|
+
return normalizePath$3(path$c.resolve(inputFileDir, cleanSource));
|
|
43994
44287
|
});
|
|
43995
44288
|
return {
|
|
43996
44289
|
file,
|
|
@@ -44556,7 +44849,7 @@ const makeModernCompilerScssWorker = (environment, resolvers, alias, _maxWorkers
|
|
|
44556
44849
|
return null;
|
|
44557
44850
|
},
|
|
44558
44851
|
async load(canonicalUrl) {
|
|
44559
|
-
const ext = path$
|
|
44852
|
+
const ext = path$c.extname(canonicalUrl.pathname);
|
|
44560
44853
|
let syntax = "scss";
|
|
44561
44854
|
if (ext === ".sass") {
|
|
44562
44855
|
syntax = "indented";
|
|
@@ -44672,9 +44965,9 @@ const scssProcessor = (maxWorkers) => {
|
|
|
44672
44965
|
};
|
|
44673
44966
|
};
|
|
44674
44967
|
async function rebaseUrls(environment, file, rootFile, alias, variablePrefix, resolver) {
|
|
44675
|
-
file = path$
|
|
44676
|
-
const fileDir = path$
|
|
44677
|
-
const rootDir = path$
|
|
44968
|
+
file = path$c.resolve(file);
|
|
44969
|
+
const fileDir = path$c.dirname(file);
|
|
44970
|
+
const rootDir = path$c.dirname(rootFile);
|
|
44678
44971
|
if (fileDir === rootDir) {
|
|
44679
44972
|
return { file };
|
|
44680
44973
|
}
|
|
@@ -44695,8 +44988,8 @@ async function rebaseUrls(environment, file, rootFile, alias, variablePrefix, re
|
|
|
44695
44988
|
return url;
|
|
44696
44989
|
}
|
|
44697
44990
|
}
|
|
44698
|
-
const absolute = await resolver(environment, url, file) || path$
|
|
44699
|
-
const relative = path$
|
|
44991
|
+
const absolute = await resolver(environment, url, file) || path$c.resolve(fileDir, url);
|
|
44992
|
+
const relative = path$c.relative(rootDir, absolute);
|
|
44700
44993
|
return normalizePath$3(relative);
|
|
44701
44994
|
};
|
|
44702
44995
|
if (hasImportCss) {
|
|
@@ -44718,11 +45011,11 @@ const makeLessWorker = (environment, resolvers, alias, maxWorkers) => {
|
|
|
44718
45011
|
const resolved = await resolvers.less(
|
|
44719
45012
|
environment,
|
|
44720
45013
|
filename,
|
|
44721
|
-
path$
|
|
45014
|
+
path$c.join(dir, "*")
|
|
44722
45015
|
);
|
|
44723
45016
|
if (!resolved) return void 0;
|
|
44724
45017
|
if (mime === "application/javascript") {
|
|
44725
|
-
const file = path$
|
|
45018
|
+
const file = path$c.resolve(resolved);
|
|
44726
45019
|
return { resolved: file };
|
|
44727
45020
|
}
|
|
44728
45021
|
const result = await rebaseUrls(
|
|
@@ -44932,7 +45225,7 @@ const stylProcessor = (maxWorkers) => {
|
|
|
44932
45225
|
"\n"
|
|
44933
45226
|
);
|
|
44934
45227
|
const importsDeps = (options.imports ?? []).map(
|
|
44935
|
-
(dep) => path$
|
|
45228
|
+
(dep) => path$c.resolve(dep)
|
|
44936
45229
|
);
|
|
44937
45230
|
const optionsWithoutAdditionalData = {
|
|
44938
45231
|
...options,
|
|
@@ -44964,7 +45257,7 @@ const stylProcessor = (maxWorkers) => {
|
|
|
44964
45257
|
function formatStylusSourceMap(mapBefore, root) {
|
|
44965
45258
|
if (!mapBefore) return void 0;
|
|
44966
45259
|
const map2 = { ...mapBefore };
|
|
44967
|
-
const resolveFromRoot = (p) => normalizePath$3(path$
|
|
45260
|
+
const resolveFromRoot = (p) => normalizePath$3(path$c.resolve(root, p));
|
|
44968
45261
|
if (map2.file) {
|
|
44969
45262
|
map2.file = resolveFromRoot(map2.file);
|
|
44970
45263
|
}
|
|
@@ -45303,7 +45596,7 @@ const preloadMarkerRE = new RegExp(preloadMarker, "g");
|
|
|
45303
45596
|
const dynamicImportPrefixRE = /import\s*\(/;
|
|
45304
45597
|
const dynamicImportTreeshakenRE = /((?:\bconst\s+|\blet\s+|\bvar\s+|,\s*)(\{[^{}.=]+\})\s*=\s*await\s+import\([^)]+\))|(\(\s*await\s+import\([^)]+\)\s*\)(\??\.[\w$]+))|\bimport\([^)]+\)(\s*\.then\(\s*(?:function\s*)?\(\s*\{([^{}.=]+)\}\))/g;
|
|
45305
45598
|
function toRelativePath(filename, importer) {
|
|
45306
|
-
const relPath = path$
|
|
45599
|
+
const relPath = path$c.posix.relative(path$c.posix.dirname(importer), filename);
|
|
45307
45600
|
return relPath[0] === "." ? relPath : `./${relPath}`;
|
|
45308
45601
|
}
|
|
45309
45602
|
function indexOfMatchInSlice(str, reg, pos = 0) {
|
|
@@ -45570,8 +45863,8 @@ function buildImportAnalysisPlugin(config) {
|
|
|
45570
45863
|
url = rawUrl.slice(1, -1);
|
|
45571
45864
|
}
|
|
45572
45865
|
if (!url) continue;
|
|
45573
|
-
const normalizedFile = path$
|
|
45574
|
-
path$
|
|
45866
|
+
const normalizedFile = path$c.posix.join(
|
|
45867
|
+
path$c.posix.dirname(chunk.fileName),
|
|
45575
45868
|
url
|
|
45576
45869
|
);
|
|
45577
45870
|
if (removedPureCssFiles.has(normalizedFile)) {
|
|
@@ -45634,8 +45927,8 @@ function buildImportAnalysisPlugin(config) {
|
|
|
45634
45927
|
let hasRemovedPureCssChunk = false;
|
|
45635
45928
|
let normalizedFile = void 0;
|
|
45636
45929
|
if (url) {
|
|
45637
|
-
normalizedFile = path$
|
|
45638
|
-
path$
|
|
45930
|
+
normalizedFile = path$c.posix.join(
|
|
45931
|
+
path$c.posix.dirname(chunk.fileName),
|
|
45639
45932
|
url
|
|
45640
45933
|
);
|
|
45641
45934
|
const ownerFilename = chunk.fileName;
|
|
@@ -46061,7 +46354,7 @@ async function buildEnvironment(environment) {
|
|
|
46061
46354
|
)}`
|
|
46062
46355
|
)
|
|
46063
46356
|
);
|
|
46064
|
-
const resolve = (p) => path$
|
|
46357
|
+
const resolve = (p) => path$c.resolve(root, p);
|
|
46065
46358
|
const input = libOptions ? options.rollupOptions.input || (typeof libOptions.entry === "string" ? resolve(libOptions.entry) : Array.isArray(libOptions.entry) ? libOptions.entry.map(resolve) : Object.fromEntries(
|
|
46066
46359
|
Object.entries(libOptions.entry).map(([alias, file]) => [
|
|
46067
46360
|
alias,
|
|
@@ -46190,9 +46483,9 @@ ${stackOnly}`;
|
|
|
46190
46483
|
root,
|
|
46191
46484
|
jsExt,
|
|
46192
46485
|
packageCache
|
|
46193
|
-
) : path$
|
|
46194
|
-
chunkFileNames: libOptions ? `[name]-[hash].${jsExt}` : path$
|
|
46195
|
-
assetFileNames: libOptions ? `[name].[ext]` : path$
|
|
46486
|
+
) : path$c.posix.join(options.assetsDir, `[name]-[hash].${jsExt}`),
|
|
46487
|
+
chunkFileNames: libOptions ? `[name]-[hash].${jsExt}` : path$c.posix.join(options.assetsDir, `[name]-[hash].${jsExt}`),
|
|
46488
|
+
assetFileNames: libOptions ? `[name].[ext]` : path$c.posix.join(options.assetsDir, `[name]-[hash].[ext]`),
|
|
46196
46489
|
inlineDynamicImports: output.format === "umd" || output.format === "iife" || isSsrTargetWebworkerEnvironment && (typeof input === "string" || Object.keys(input).length === 1),
|
|
46197
46490
|
...output
|
|
46198
46491
|
};
|
|
@@ -46289,8 +46582,8 @@ function prepareOutDir(outDirs, emptyOutDir, environment) {
|
|
|
46289
46582
|
for (const outDir of outDirs) {
|
|
46290
46583
|
if (emptyOutDir !== false && fs__default.existsSync(outDir)) {
|
|
46291
46584
|
const skipDirs = outDirsArray.map((dir) => {
|
|
46292
|
-
const relative = path$
|
|
46293
|
-
if (relative && !relative.startsWith("..") && !path$
|
|
46585
|
+
const relative = path$c.relative(outDir, dir);
|
|
46586
|
+
if (relative && !relative.startsWith("..") && !path$c.isAbsolute(relative)) {
|
|
46294
46587
|
return relative;
|
|
46295
46588
|
}
|
|
46296
46589
|
return "";
|
|
@@ -46673,7 +46966,7 @@ function createToImportMetaURLBasedRelativeRuntime(format, isWorker) {
|
|
|
46673
46966
|
const toRelativePath = customRelativeUrlMechanisms[formatLong];
|
|
46674
46967
|
return (filename, importer) => ({
|
|
46675
46968
|
runtime: toRelativePath(
|
|
46676
|
-
path$
|
|
46969
|
+
path$c.posix.relative(path$c.dirname(importer), filename)
|
|
46677
46970
|
)
|
|
46678
46971
|
});
|
|
46679
46972
|
}
|
|
@@ -47812,14 +48105,14 @@ async function warmupFile(server, environment, file) {
|
|
|
47812
48105
|
}
|
|
47813
48106
|
}
|
|
47814
48107
|
function htmlFileToUrl(file, root) {
|
|
47815
|
-
const url = path$
|
|
48108
|
+
const url = path$c.relative(root, file);
|
|
47816
48109
|
if (url[0] === ".") return;
|
|
47817
48110
|
return "/" + normalizePath$3(url);
|
|
47818
48111
|
}
|
|
47819
48112
|
function fileToUrl(file, root) {
|
|
47820
|
-
const url = path$
|
|
48113
|
+
const url = path$c.relative(root, file);
|
|
47821
48114
|
if (url[0] === ".") {
|
|
47822
|
-
return path$
|
|
48115
|
+
return path$c.posix.join(FS_PREFIX, normalizePath$3(file));
|
|
47823
48116
|
}
|
|
47824
48117
|
return "/" + normalizePath$3(url);
|
|
47825
48118
|
}
|
|
@@ -47831,10 +48124,10 @@ async function mapFiles(files, root) {
|
|
|
47831
48124
|
if (isDynamicPattern(file)) {
|
|
47832
48125
|
globs.push(file);
|
|
47833
48126
|
} else {
|
|
47834
|
-
if (path$
|
|
48127
|
+
if (path$c.isAbsolute(file)) {
|
|
47835
48128
|
result.push(file);
|
|
47836
48129
|
} else {
|
|
47837
|
-
result.push(path$
|
|
48130
|
+
result.push(path$c.resolve(root, file));
|
|
47838
48131
|
}
|
|
47839
48132
|
}
|
|
47840
48133
|
}
|
|
@@ -48271,11 +48564,11 @@ async function preview(inlineConfig = {}) {
|
|
|
48271
48564
|
true
|
|
48272
48565
|
);
|
|
48273
48566
|
const clientOutDir = config.environments.client.build.outDir;
|
|
48274
|
-
const distDir = path$
|
|
48567
|
+
const distDir = path$c.resolve(config.root, clientOutDir);
|
|
48275
48568
|
if (!fs__default.existsSync(distDir) && // error if no plugins implement `configurePreviewServer`
|
|
48276
48569
|
config.plugins.every((plugin) => !plugin.configurePreviewServer) && // error if called in CLI only. programmatic usage could access `httpServer`
|
|
48277
48570
|
// and affect file serving
|
|
48278
|
-
process.argv[1]?.endsWith(path$
|
|
48571
|
+
process.argv[1]?.endsWith(path$c.normalize("bin/vite.js")) && process.argv[2] === "preview") {
|
|
48279
48572
|
throw new Error(
|
|
48280
48573
|
`The directory "${clientOutDir}" does not exist. Did you build your project?`
|
|
48281
48574
|
);
|
|
@@ -48697,11 +48990,11 @@ function checkBadCharactersInPath(name, path2, logger) {
|
|
|
48697
48990
|
const clientAlias = [
|
|
48698
48991
|
{
|
|
48699
48992
|
find: /^\/?@vite\/env/,
|
|
48700
|
-
replacement: path$
|
|
48993
|
+
replacement: path$c.posix.join(FS_PREFIX, normalizePath$3(ENV_ENTRY))
|
|
48701
48994
|
},
|
|
48702
48995
|
{
|
|
48703
48996
|
find: /^\/?@vite\/client/,
|
|
48704
|
-
replacement: path$
|
|
48997
|
+
replacement: path$c.posix.join(FS_PREFIX, normalizePath$3(CLIENT_ENTRY))
|
|
48705
48998
|
}
|
|
48706
48999
|
];
|
|
48707
49000
|
function resolveEnvironmentResolveOptions(resolve, alias, preserveSymlinks, logger, consumer, isSsrTargetWebworkerEnvironment) {
|
|
@@ -48829,7 +49122,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
|
|
|
48829
49122
|
customLogger: config.customLogger
|
|
48830
49123
|
});
|
|
48831
49124
|
const resolvedRoot = normalizePath$3(
|
|
48832
|
-
config.root ? path$
|
|
49125
|
+
config.root ? path$c.resolve(config.root) : process.cwd()
|
|
48833
49126
|
);
|
|
48834
49127
|
checkBadCharactersInPath("The project root", resolvedRoot, logger);
|
|
48835
49128
|
const configEnvironmentsClient = config.environments.client;
|
|
@@ -48949,7 +49242,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
|
|
|
48949
49242
|
);
|
|
48950
49243
|
let envDir = config.envFile === false ? false : config.envDir;
|
|
48951
49244
|
if (envDir !== false) {
|
|
48952
|
-
envDir = config.envDir ? normalizePath$3(path$
|
|
49245
|
+
envDir = config.envDir ? normalizePath$3(path$c.resolve(resolvedRoot, config.envDir)) : resolvedRoot;
|
|
48953
49246
|
}
|
|
48954
49247
|
const userEnv = loadEnv(mode, envDir, resolveEnvPrefix(config));
|
|
48955
49248
|
const userNodeEnv = process.env.VITE_USER_NODE_ENV;
|
|
@@ -48967,12 +49260,12 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
|
|
|
48967
49260
|
const resolvedBase = relativeBaseShortcut ? !isBuild || config.build?.ssr ? "/" : "./" : resolveBaseUrl(config.base, isBuild, logger);
|
|
48968
49261
|
const pkgDir = findNearestPackageData(resolvedRoot, packageCache)?.dir;
|
|
48969
49262
|
const cacheDir = normalizePath$3(
|
|
48970
|
-
config.cacheDir ? path$
|
|
49263
|
+
config.cacheDir ? path$c.resolve(resolvedRoot, config.cacheDir) : pkgDir ? path$c.join(pkgDir, `node_modules/.vite`) : path$c.join(resolvedRoot, `.vite`)
|
|
48971
49264
|
);
|
|
48972
49265
|
const assetsFilter = config.assetsInclude && (!Array.isArray(config.assetsInclude) || config.assetsInclude.length) ? createFilter$1(config.assetsInclude) : () => false;
|
|
48973
49266
|
const { publicDir } = config;
|
|
48974
49267
|
const resolvedPublicDir = publicDir !== false && publicDir !== "" ? normalizePath$3(
|
|
48975
|
-
path$
|
|
49268
|
+
path$c.resolve(
|
|
48976
49269
|
resolvedRoot,
|
|
48977
49270
|
typeof publicDir === "string" ? publicDir : configDefaults.publicDir
|
|
48978
49271
|
)
|
|
@@ -49036,7 +49329,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
|
|
|
49036
49329
|
resolved = {
|
|
49037
49330
|
configFile: configFile ? normalizePath$3(configFile) : void 0,
|
|
49038
49331
|
configFileDependencies: configFileDependencies.map(
|
|
49039
|
-
(name) => normalizePath$3(path$
|
|
49332
|
+
(name) => normalizePath$3(path$c.resolve(name))
|
|
49040
49333
|
),
|
|
49041
49334
|
inlineConfig,
|
|
49042
49335
|
root: resolvedRoot,
|
|
@@ -49203,7 +49496,7 @@ assetFileNames isn't equal for every build.rollupOptions.output. A single patter
|
|
|
49203
49496
|
);
|
|
49204
49497
|
}
|
|
49205
49498
|
const resolvedBuildOutDir = normalizePath$3(
|
|
49206
|
-
path$
|
|
49499
|
+
path$c.resolve(resolved.root, resolved.build.outDir)
|
|
49207
49500
|
);
|
|
49208
49501
|
if (isParentDirectory(resolvedBuildOutDir, resolved.root) || resolvedBuildOutDir === resolved.root) {
|
|
49209
49502
|
resolved.logger.warn(
|
|
@@ -49273,10 +49566,10 @@ async function loadConfigFromFile(configEnv, configFile, configRoot = process.cw
|
|
|
49273
49566
|
const getTime = () => `${(performance$1.now() - start).toFixed(2)}ms`;
|
|
49274
49567
|
let resolvedPath;
|
|
49275
49568
|
if (configFile) {
|
|
49276
|
-
resolvedPath = path$
|
|
49569
|
+
resolvedPath = path$c.resolve(configFile);
|
|
49277
49570
|
} else {
|
|
49278
49571
|
for (const filename of DEFAULT_CONFIG_FILES) {
|
|
49279
|
-
const filePath = path$
|
|
49572
|
+
const filePath = path$c.resolve(configRoot, filename);
|
|
49280
49573
|
if (!fs__default.existsSync(filePath)) continue;
|
|
49281
49574
|
resolvedPath = filePath;
|
|
49282
49575
|
break;
|
|
@@ -49351,7 +49644,7 @@ async function bundleConfigFile(fileName, isESM) {
|
|
|
49351
49644
|
mainFields: ["main"],
|
|
49352
49645
|
sourcemap: "inline",
|
|
49353
49646
|
// the last slash is needed to make the path correct
|
|
49354
|
-
sourceRoot: path$
|
|
49647
|
+
sourceRoot: path$c.dirname(fileName) + path$c.sep,
|
|
49355
49648
|
metafile: true,
|
|
49356
49649
|
define: {
|
|
49357
49650
|
__dirname: dirnameVarName,
|
|
@@ -49367,7 +49660,7 @@ async function bundleConfigFile(fileName, isESM) {
|
|
|
49367
49660
|
const packageCache = /* @__PURE__ */ new Map();
|
|
49368
49661
|
const resolveByViteResolver = (id, importer, isRequire) => {
|
|
49369
49662
|
return tryNodeResolve(id, importer, {
|
|
49370
|
-
root: path$
|
|
49663
|
+
root: path$c.dirname(fileName),
|
|
49371
49664
|
isBuild: true,
|
|
49372
49665
|
isProduction: true,
|
|
49373
49666
|
preferRelative: false,
|
|
@@ -49391,7 +49684,7 @@ async function bundleConfigFile(fileName, isESM) {
|
|
|
49391
49684
|
build2.onResolve(
|
|
49392
49685
|
{ filter: /^[^.#].*/ },
|
|
49393
49686
|
async ({ path: id, importer, kind }) => {
|
|
49394
|
-
if (kind === "entry-point" || path$
|
|
49687
|
+
if (kind === "entry-point" || path$c.isAbsolute(id) || isNodeBuiltin(id)) {
|
|
49395
49688
|
return;
|
|
49396
49689
|
}
|
|
49397
49690
|
if (isNodeLikeBuiltin(id)) {
|
|
@@ -49439,7 +49732,7 @@ async function bundleConfigFile(fileName, isESM) {
|
|
|
49439
49732
|
build2.onLoad({ filter: /\.[cm]?[jt]s$/ }, async (args) => {
|
|
49440
49733
|
const contents = await fsp.readFile(args.path, "utf-8");
|
|
49441
49734
|
const injectValues = `const ${dirnameVarName} = ${JSON.stringify(
|
|
49442
|
-
path$
|
|
49735
|
+
path$c.dirname(args.path)
|
|
49443
49736
|
)};const ${filenameVarName} = ${JSON.stringify(args.path)};const ${importMetaUrlVarName} = ${JSON.stringify(
|
|
49444
49737
|
pathToFileURL$1(args.path).href
|
|
49445
49738
|
)};`;
|
|
@@ -49461,10 +49754,10 @@ async function bundleConfigFile(fileName, isESM) {
|
|
|
49461
49754
|
const _require = createRequire$1(import.meta.url);
|
|
49462
49755
|
async function loadConfigFromBundledFile(fileName, bundledCode, isESM) {
|
|
49463
49756
|
if (isESM) {
|
|
49464
|
-
let nodeModulesDir = typeof process.versions.deno === "string" ? void 0 : findNearestNodeModules(path$
|
|
49757
|
+
let nodeModulesDir = typeof process.versions.deno === "string" ? void 0 : findNearestNodeModules(path$c.dirname(fileName));
|
|
49465
49758
|
if (nodeModulesDir) {
|
|
49466
49759
|
try {
|
|
49467
|
-
await fsp.mkdir(path$
|
|
49760
|
+
await fsp.mkdir(path$c.resolve(nodeModulesDir, ".vite-temp/"), {
|
|
49468
49761
|
recursive: true
|
|
49469
49762
|
});
|
|
49470
49763
|
} catch (e) {
|
|
@@ -49476,9 +49769,9 @@ async function loadConfigFromBundledFile(fileName, bundledCode, isESM) {
|
|
|
49476
49769
|
}
|
|
49477
49770
|
}
|
|
49478
49771
|
const hash = `timestamp-${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
49479
|
-
const tempFileName = nodeModulesDir ? path$
|
|
49772
|
+
const tempFileName = nodeModulesDir ? path$c.resolve(
|
|
49480
49773
|
nodeModulesDir,
|
|
49481
|
-
`.vite-temp/${path$
|
|
49774
|
+
`.vite-temp/${path$c.basename(fileName)}.${hash}.mjs`
|
|
49482
49775
|
) : `${fileName}.${hash}.mjs`;
|
|
49483
49776
|
await fsp.writeFile(tempFileName, bundledCode);
|
|
49484
49777
|
try {
|
|
@@ -49488,7 +49781,7 @@ async function loadConfigFromBundledFile(fileName, bundledCode, isESM) {
|
|
|
49488
49781
|
});
|
|
49489
49782
|
}
|
|
49490
49783
|
} else {
|
|
49491
|
-
const extension = path$
|
|
49784
|
+
const extension = path$c.extname(fileName);
|
|
49492
49785
|
const realFileName = await promisifiedRealpath(fileName);
|
|
49493
49786
|
const loaderExt = extension in _require.extensions ? extension : ".js";
|
|
49494
49787
|
const defaultLoader = _require.extensions[loaderExt];
|