weapp-vite 5.4.0 → 5.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auto-routes.cjs +2 -2
- package/dist/auto-routes.mjs +1 -1
- package/dist/{chunk-XEHEGODS.cjs → chunk-5GG5TEGR.cjs} +734 -488
- package/dist/{chunk-LX2OMRQ4.cjs → chunk-OWCDSB6F.cjs} +4 -4
- package/dist/{chunk-KW3QAG67.mjs → chunk-QCLEMTCV.mjs} +1 -1
- package/dist/{chunk-UT7K35VH.mjs → chunk-T4MUKDMP.mjs} +731 -485
- package/dist/cli.cjs +42 -36
- package/dist/cli.mjs +9 -3
- package/dist/{config-DNP6NeTc.d.cts → config-CzCzK7Jh.d.cts} +15 -1
- package/dist/{config-jhY9Idrt.d.ts → config-DepC4j8j.d.ts} +15 -1
- package/dist/config.d.cts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/json.d.cts +1 -1
- package/dist/json.d.ts +1 -1
- package/dist/types.d.cts +1 -1
- package/dist/types.d.ts +1 -1
- package/package.json +9 -9
|
@@ -2951,13 +2951,13 @@ function extractComponentProps(code) {
|
|
|
2951
2951
|
});
|
|
2952
2952
|
let props = /* @__PURE__ */ new Map();
|
|
2953
2953
|
traverse(ast, {
|
|
2954
|
-
CallExpression(
|
|
2954
|
+
CallExpression(path31) {
|
|
2955
2955
|
if (props.size > 0) {
|
|
2956
2956
|
return;
|
|
2957
2957
|
}
|
|
2958
|
-
const callee =
|
|
2958
|
+
const callee = path31.node.callee;
|
|
2959
2959
|
if (callee.type === "Identifier" && callee.name === "Component") {
|
|
2960
|
-
const [options] =
|
|
2960
|
+
const [options] = path31.node.arguments;
|
|
2961
2961
|
if (options && options.type === "ObjectExpression") {
|
|
2962
2962
|
props = extractComponentProperties(options);
|
|
2963
2963
|
}
|
|
@@ -4385,7 +4385,7 @@ var ReaddirpStream = class extends Readable {
|
|
|
4385
4385
|
this._directoryFilter = normalizeFilter(opts.directoryFilter);
|
|
4386
4386
|
const statMethod = opts.lstat ? lstat : stat;
|
|
4387
4387
|
if (wantBigintFsStats) {
|
|
4388
|
-
this._stat = (
|
|
4388
|
+
this._stat = (path31) => statMethod(path31, { bigint: true });
|
|
4389
4389
|
} else {
|
|
4390
4390
|
this._stat = statMethod;
|
|
4391
4391
|
}
|
|
@@ -4410,8 +4410,8 @@ var ReaddirpStream = class extends Readable {
|
|
|
4410
4410
|
const par = this.parent;
|
|
4411
4411
|
const fil = par && par.files;
|
|
4412
4412
|
if (fil && fil.length > 0) {
|
|
4413
|
-
const { path:
|
|
4414
|
-
const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent,
|
|
4413
|
+
const { path: path31, depth } = par;
|
|
4414
|
+
const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path31));
|
|
4415
4415
|
const awaited = await Promise.all(slice);
|
|
4416
4416
|
for (const entry of awaited) {
|
|
4417
4417
|
if (!entry)
|
|
@@ -4451,20 +4451,20 @@ var ReaddirpStream = class extends Readable {
|
|
|
4451
4451
|
this.reading = false;
|
|
4452
4452
|
}
|
|
4453
4453
|
}
|
|
4454
|
-
async _exploreDir(
|
|
4454
|
+
async _exploreDir(path31, depth) {
|
|
4455
4455
|
let files;
|
|
4456
4456
|
try {
|
|
4457
|
-
files = await readdir(
|
|
4457
|
+
files = await readdir(path31, this._rdOptions);
|
|
4458
4458
|
} catch (error) {
|
|
4459
4459
|
this._onError(error);
|
|
4460
4460
|
}
|
|
4461
|
-
return { files, depth, path:
|
|
4461
|
+
return { files, depth, path: path31 };
|
|
4462
4462
|
}
|
|
4463
|
-
async _formatEntry(dirent,
|
|
4463
|
+
async _formatEntry(dirent, path31) {
|
|
4464
4464
|
let entry;
|
|
4465
4465
|
const basename4 = this._isDirent ? dirent.name : dirent;
|
|
4466
4466
|
try {
|
|
4467
|
-
const fullPath = presolve(pjoin(
|
|
4467
|
+
const fullPath = presolve(pjoin(path31, basename4));
|
|
4468
4468
|
entry = { path: prelative(this._root, fullPath), fullPath, basename: basename4 };
|
|
4469
4469
|
entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
|
|
4470
4470
|
} catch (err) {
|
|
@@ -4865,16 +4865,16 @@ var delFromSet = (main, prop, item) => {
|
|
|
4865
4865
|
};
|
|
4866
4866
|
var isEmptySet = (val) => val instanceof Set ? val.size === 0 : !val;
|
|
4867
4867
|
var FsWatchInstances = /* @__PURE__ */ new Map();
|
|
4868
|
-
function createFsWatchInstance(
|
|
4868
|
+
function createFsWatchInstance(path31, options, listener, errHandler, emitRaw) {
|
|
4869
4869
|
const handleEvent = (rawEvent, evPath) => {
|
|
4870
|
-
listener(
|
|
4871
|
-
emitRaw(rawEvent, evPath, { watchedPath:
|
|
4872
|
-
if (evPath &&
|
|
4873
|
-
fsWatchBroadcast(sysPath.resolve(
|
|
4870
|
+
listener(path31);
|
|
4871
|
+
emitRaw(rawEvent, evPath, { watchedPath: path31 });
|
|
4872
|
+
if (evPath && path31 !== evPath) {
|
|
4873
|
+
fsWatchBroadcast(sysPath.resolve(path31, evPath), KEY_LISTENERS, sysPath.join(path31, evPath));
|
|
4874
4874
|
}
|
|
4875
4875
|
};
|
|
4876
4876
|
try {
|
|
4877
|
-
return fs_watch(
|
|
4877
|
+
return fs_watch(path31, {
|
|
4878
4878
|
persistent: options.persistent
|
|
4879
4879
|
}, handleEvent);
|
|
4880
4880
|
} catch (error) {
|
|
@@ -4890,12 +4890,12 @@ var fsWatchBroadcast = (fullPath, listenerType, val1, val2, val3) => {
|
|
|
4890
4890
|
listener(val1, val2, val3);
|
|
4891
4891
|
});
|
|
4892
4892
|
};
|
|
4893
|
-
var setFsWatchListener = (
|
|
4893
|
+
var setFsWatchListener = (path31, fullPath, options, handlers) => {
|
|
4894
4894
|
const { listener, errHandler, rawEmitter } = handlers;
|
|
4895
4895
|
let cont = FsWatchInstances.get(fullPath);
|
|
4896
4896
|
let watcher;
|
|
4897
4897
|
if (!options.persistent) {
|
|
4898
|
-
watcher = createFsWatchInstance(
|
|
4898
|
+
watcher = createFsWatchInstance(path31, options, listener, errHandler, rawEmitter);
|
|
4899
4899
|
if (!watcher)
|
|
4900
4900
|
return;
|
|
4901
4901
|
return watcher.close.bind(watcher);
|
|
@@ -4906,7 +4906,7 @@ var setFsWatchListener = (path30, fullPath, options, handlers) => {
|
|
|
4906
4906
|
addAndConvert(cont, KEY_RAW, rawEmitter);
|
|
4907
4907
|
} else {
|
|
4908
4908
|
watcher = createFsWatchInstance(
|
|
4909
|
-
|
|
4909
|
+
path31,
|
|
4910
4910
|
options,
|
|
4911
4911
|
fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS),
|
|
4912
4912
|
errHandler,
|
|
@@ -4921,7 +4921,7 @@ var setFsWatchListener = (path30, fullPath, options, handlers) => {
|
|
|
4921
4921
|
cont.watcherUnusable = true;
|
|
4922
4922
|
if (isWindows && error.code === "EPERM") {
|
|
4923
4923
|
try {
|
|
4924
|
-
const fd = await open(
|
|
4924
|
+
const fd = await open(path31, "r");
|
|
4925
4925
|
await fd.close();
|
|
4926
4926
|
broadcastErr(error);
|
|
4927
4927
|
} catch (err) {
|
|
@@ -4952,7 +4952,7 @@ var setFsWatchListener = (path30, fullPath, options, handlers) => {
|
|
|
4952
4952
|
};
|
|
4953
4953
|
};
|
|
4954
4954
|
var FsWatchFileInstances = /* @__PURE__ */ new Map();
|
|
4955
|
-
var setFsWatchFileListener = (
|
|
4955
|
+
var setFsWatchFileListener = (path31, fullPath, options, handlers) => {
|
|
4956
4956
|
const { listener, rawEmitter } = handlers;
|
|
4957
4957
|
let cont = FsWatchFileInstances.get(fullPath);
|
|
4958
4958
|
const copts = cont && cont.options;
|
|
@@ -4974,7 +4974,7 @@ var setFsWatchFileListener = (path30, fullPath, options, handlers) => {
|
|
|
4974
4974
|
});
|
|
4975
4975
|
const currmtime = curr.mtimeMs;
|
|
4976
4976
|
if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) {
|
|
4977
|
-
foreach(cont.listeners, (listener2) => listener2(
|
|
4977
|
+
foreach(cont.listeners, (listener2) => listener2(path31, curr));
|
|
4978
4978
|
}
|
|
4979
4979
|
})
|
|
4980
4980
|
};
|
|
@@ -5002,13 +5002,13 @@ var NodeFsHandler = class {
|
|
|
5002
5002
|
* @param listener on fs change
|
|
5003
5003
|
* @returns closer for the watcher instance
|
|
5004
5004
|
*/
|
|
5005
|
-
_watchWithNodeFs(
|
|
5005
|
+
_watchWithNodeFs(path31, listener) {
|
|
5006
5006
|
const opts = this.fsw.options;
|
|
5007
|
-
const directory = sysPath.dirname(
|
|
5008
|
-
const basename4 = sysPath.basename(
|
|
5007
|
+
const directory = sysPath.dirname(path31);
|
|
5008
|
+
const basename4 = sysPath.basename(path31);
|
|
5009
5009
|
const parent = this.fsw._getWatchedDir(directory);
|
|
5010
5010
|
parent.add(basename4);
|
|
5011
|
-
const absolutePath = sysPath.resolve(
|
|
5011
|
+
const absolutePath = sysPath.resolve(path31);
|
|
5012
5012
|
const options = {
|
|
5013
5013
|
persistent: opts.persistent
|
|
5014
5014
|
};
|
|
@@ -5018,12 +5018,12 @@ var NodeFsHandler = class {
|
|
|
5018
5018
|
if (opts.usePolling) {
|
|
5019
5019
|
const enableBin = opts.interval !== opts.binaryInterval;
|
|
5020
5020
|
options.interval = enableBin && isBinaryPath(basename4) ? opts.binaryInterval : opts.interval;
|
|
5021
|
-
closer = setFsWatchFileListener(
|
|
5021
|
+
closer = setFsWatchFileListener(path31, absolutePath, options, {
|
|
5022
5022
|
listener,
|
|
5023
5023
|
rawEmitter: this.fsw._emitRaw
|
|
5024
5024
|
});
|
|
5025
5025
|
} else {
|
|
5026
|
-
closer = setFsWatchListener(
|
|
5026
|
+
closer = setFsWatchListener(path31, absolutePath, options, {
|
|
5027
5027
|
listener,
|
|
5028
5028
|
errHandler: this._boundHandleError,
|
|
5029
5029
|
rawEmitter: this.fsw._emitRaw
|
|
@@ -5045,7 +5045,7 @@ var NodeFsHandler = class {
|
|
|
5045
5045
|
let prevStats = stats;
|
|
5046
5046
|
if (parent.has(basename4))
|
|
5047
5047
|
return;
|
|
5048
|
-
const listener = async (
|
|
5048
|
+
const listener = async (path31, newStats) => {
|
|
5049
5049
|
if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file, 5))
|
|
5050
5050
|
return;
|
|
5051
5051
|
if (!newStats || newStats.mtimeMs === 0) {
|
|
@@ -5059,11 +5059,11 @@ var NodeFsHandler = class {
|
|
|
5059
5059
|
this.fsw._emit(EV.CHANGE, file, newStats2);
|
|
5060
5060
|
}
|
|
5061
5061
|
if ((isMacos || isLinux || isFreeBSD) && prevStats.ino !== newStats2.ino) {
|
|
5062
|
-
this.fsw._closeFile(
|
|
5062
|
+
this.fsw._closeFile(path31);
|
|
5063
5063
|
prevStats = newStats2;
|
|
5064
5064
|
const closer2 = this._watchWithNodeFs(file, listener);
|
|
5065
5065
|
if (closer2)
|
|
5066
|
-
this.fsw._addPathCloser(
|
|
5066
|
+
this.fsw._addPathCloser(path31, closer2);
|
|
5067
5067
|
} else {
|
|
5068
5068
|
prevStats = newStats2;
|
|
5069
5069
|
}
|
|
@@ -5095,7 +5095,7 @@ var NodeFsHandler = class {
|
|
|
5095
5095
|
* @param item basename of this item
|
|
5096
5096
|
* @returns true if no more processing is needed for this entry.
|
|
5097
5097
|
*/
|
|
5098
|
-
async _handleSymlink(entry, directory,
|
|
5098
|
+
async _handleSymlink(entry, directory, path31, item) {
|
|
5099
5099
|
if (this.fsw.closed) {
|
|
5100
5100
|
return;
|
|
5101
5101
|
}
|
|
@@ -5105,7 +5105,7 @@ var NodeFsHandler = class {
|
|
|
5105
5105
|
this.fsw._incrReadyCount();
|
|
5106
5106
|
let linkPath;
|
|
5107
5107
|
try {
|
|
5108
|
-
linkPath = await fsrealpath(
|
|
5108
|
+
linkPath = await fsrealpath(path31);
|
|
5109
5109
|
} catch (e) {
|
|
5110
5110
|
this.fsw._emitReady();
|
|
5111
5111
|
return true;
|
|
@@ -5115,12 +5115,12 @@ var NodeFsHandler = class {
|
|
|
5115
5115
|
if (dir.has(item)) {
|
|
5116
5116
|
if (this.fsw._symlinkPaths.get(full) !== linkPath) {
|
|
5117
5117
|
this.fsw._symlinkPaths.set(full, linkPath);
|
|
5118
|
-
this.fsw._emit(EV.CHANGE,
|
|
5118
|
+
this.fsw._emit(EV.CHANGE, path31, entry.stats);
|
|
5119
5119
|
}
|
|
5120
5120
|
} else {
|
|
5121
5121
|
dir.add(item);
|
|
5122
5122
|
this.fsw._symlinkPaths.set(full, linkPath);
|
|
5123
|
-
this.fsw._emit(EV.ADD,
|
|
5123
|
+
this.fsw._emit(EV.ADD, path31, entry.stats);
|
|
5124
5124
|
}
|
|
5125
5125
|
this.fsw._emitReady();
|
|
5126
5126
|
return true;
|
|
@@ -5149,9 +5149,9 @@ var NodeFsHandler = class {
|
|
|
5149
5149
|
return;
|
|
5150
5150
|
}
|
|
5151
5151
|
const item = entry.path;
|
|
5152
|
-
let
|
|
5152
|
+
let path31 = sysPath.join(directory, item);
|
|
5153
5153
|
current2.add(item);
|
|
5154
|
-
if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory,
|
|
5154
|
+
if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path31, item)) {
|
|
5155
5155
|
return;
|
|
5156
5156
|
}
|
|
5157
5157
|
if (this.fsw.closed) {
|
|
@@ -5160,8 +5160,8 @@ var NodeFsHandler = class {
|
|
|
5160
5160
|
}
|
|
5161
5161
|
if (item === target || !target && !previous.has(item)) {
|
|
5162
5162
|
this.fsw._incrReadyCount();
|
|
5163
|
-
|
|
5164
|
-
this._addToNodeFs(
|
|
5163
|
+
path31 = sysPath.join(dir, sysPath.relative(dir, path31));
|
|
5164
|
+
this._addToNodeFs(path31, initialAdd, wh, depth + 1);
|
|
5165
5165
|
}
|
|
5166
5166
|
}).on(EV.ERROR, this._boundHandleError);
|
|
5167
5167
|
return new Promise((resolve8, reject) => {
|
|
@@ -5230,13 +5230,13 @@ var NodeFsHandler = class {
|
|
|
5230
5230
|
* @param depth Child path actually targeted for watch
|
|
5231
5231
|
* @param target Child path actually targeted for watch
|
|
5232
5232
|
*/
|
|
5233
|
-
async _addToNodeFs(
|
|
5233
|
+
async _addToNodeFs(path31, initialAdd, priorWh, depth, target) {
|
|
5234
5234
|
const ready = this.fsw._emitReady;
|
|
5235
|
-
if (this.fsw._isIgnored(
|
|
5235
|
+
if (this.fsw._isIgnored(path31) || this.fsw.closed) {
|
|
5236
5236
|
ready();
|
|
5237
5237
|
return false;
|
|
5238
5238
|
}
|
|
5239
|
-
const wh = this.fsw._getWatchHelpers(
|
|
5239
|
+
const wh = this.fsw._getWatchHelpers(path31);
|
|
5240
5240
|
if (priorWh) {
|
|
5241
5241
|
wh.filterPath = (entry) => priorWh.filterPath(entry);
|
|
5242
5242
|
wh.filterDir = (entry) => priorWh.filterDir(entry);
|
|
@@ -5252,8 +5252,8 @@ var NodeFsHandler = class {
|
|
|
5252
5252
|
const follow = this.fsw.options.followSymlinks;
|
|
5253
5253
|
let closer;
|
|
5254
5254
|
if (stats.isDirectory()) {
|
|
5255
|
-
const absPath = sysPath.resolve(
|
|
5256
|
-
const targetPath = follow ? await fsrealpath(
|
|
5255
|
+
const absPath = sysPath.resolve(path31);
|
|
5256
|
+
const targetPath = follow ? await fsrealpath(path31) : path31;
|
|
5257
5257
|
if (this.fsw.closed)
|
|
5258
5258
|
return;
|
|
5259
5259
|
closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath);
|
|
@@ -5263,29 +5263,29 @@ var NodeFsHandler = class {
|
|
|
5263
5263
|
this.fsw._symlinkPaths.set(absPath, targetPath);
|
|
5264
5264
|
}
|
|
5265
5265
|
} else if (stats.isSymbolicLink()) {
|
|
5266
|
-
const targetPath = follow ? await fsrealpath(
|
|
5266
|
+
const targetPath = follow ? await fsrealpath(path31) : path31;
|
|
5267
5267
|
if (this.fsw.closed)
|
|
5268
5268
|
return;
|
|
5269
5269
|
const parent = sysPath.dirname(wh.watchPath);
|
|
5270
5270
|
this.fsw._getWatchedDir(parent).add(wh.watchPath);
|
|
5271
5271
|
this.fsw._emit(EV.ADD, wh.watchPath, stats);
|
|
5272
|
-
closer = await this._handleDir(parent, stats, initialAdd, depth,
|
|
5272
|
+
closer = await this._handleDir(parent, stats, initialAdd, depth, path31, wh, targetPath);
|
|
5273
5273
|
if (this.fsw.closed)
|
|
5274
5274
|
return;
|
|
5275
5275
|
if (targetPath !== void 0) {
|
|
5276
|
-
this.fsw._symlinkPaths.set(sysPath.resolve(
|
|
5276
|
+
this.fsw._symlinkPaths.set(sysPath.resolve(path31), targetPath);
|
|
5277
5277
|
}
|
|
5278
5278
|
} else {
|
|
5279
5279
|
closer = this._handleFile(wh.watchPath, stats, initialAdd);
|
|
5280
5280
|
}
|
|
5281
5281
|
ready();
|
|
5282
5282
|
if (closer)
|
|
5283
|
-
this.fsw._addPathCloser(
|
|
5283
|
+
this.fsw._addPathCloser(path31, closer);
|
|
5284
5284
|
return false;
|
|
5285
5285
|
} catch (error) {
|
|
5286
5286
|
if (this.fsw._handleError(error)) {
|
|
5287
5287
|
ready();
|
|
5288
|
-
return
|
|
5288
|
+
return path31;
|
|
5289
5289
|
}
|
|
5290
5290
|
}
|
|
5291
5291
|
}
|
|
@@ -5328,26 +5328,26 @@ function createPattern(matcher) {
|
|
|
5328
5328
|
}
|
|
5329
5329
|
return () => false;
|
|
5330
5330
|
}
|
|
5331
|
-
function normalizePath(
|
|
5332
|
-
if (typeof
|
|
5331
|
+
function normalizePath(path31) {
|
|
5332
|
+
if (typeof path31 !== "string")
|
|
5333
5333
|
throw new Error("string expected");
|
|
5334
|
-
|
|
5335
|
-
|
|
5334
|
+
path31 = sysPath2.normalize(path31);
|
|
5335
|
+
path31 = path31.replace(/\\/g, "/");
|
|
5336
5336
|
let prepend = false;
|
|
5337
|
-
if (
|
|
5337
|
+
if (path31.startsWith("//"))
|
|
5338
5338
|
prepend = true;
|
|
5339
5339
|
const DOUBLE_SLASH_RE2 = /\/\//;
|
|
5340
|
-
while (
|
|
5341
|
-
|
|
5340
|
+
while (path31.match(DOUBLE_SLASH_RE2))
|
|
5341
|
+
path31 = path31.replace(DOUBLE_SLASH_RE2, "/");
|
|
5342
5342
|
if (prepend)
|
|
5343
|
-
|
|
5344
|
-
return
|
|
5343
|
+
path31 = "/" + path31;
|
|
5344
|
+
return path31;
|
|
5345
5345
|
}
|
|
5346
5346
|
function matchPatterns(patterns, testString, stats) {
|
|
5347
|
-
const
|
|
5347
|
+
const path31 = normalizePath(testString);
|
|
5348
5348
|
for (let index = 0; index < patterns.length; index++) {
|
|
5349
5349
|
const pattern = patterns[index];
|
|
5350
|
-
if (pattern(
|
|
5350
|
+
if (pattern(path31, stats)) {
|
|
5351
5351
|
return true;
|
|
5352
5352
|
}
|
|
5353
5353
|
}
|
|
@@ -5387,19 +5387,19 @@ var toUnix = (string) => {
|
|
|
5387
5387
|
}
|
|
5388
5388
|
return str;
|
|
5389
5389
|
};
|
|
5390
|
-
var normalizePathToUnix = (
|
|
5391
|
-
var normalizeIgnored = (cwd = "") => (
|
|
5392
|
-
if (typeof
|
|
5393
|
-
return normalizePathToUnix(sysPath2.isAbsolute(
|
|
5390
|
+
var normalizePathToUnix = (path31) => toUnix(sysPath2.normalize(toUnix(path31)));
|
|
5391
|
+
var normalizeIgnored = (cwd = "") => (path31) => {
|
|
5392
|
+
if (typeof path31 === "string") {
|
|
5393
|
+
return normalizePathToUnix(sysPath2.isAbsolute(path31) ? path31 : sysPath2.join(cwd, path31));
|
|
5394
5394
|
} else {
|
|
5395
|
-
return
|
|
5395
|
+
return path31;
|
|
5396
5396
|
}
|
|
5397
5397
|
};
|
|
5398
|
-
var getAbsolutePath = (
|
|
5399
|
-
if (sysPath2.isAbsolute(
|
|
5400
|
-
return
|
|
5398
|
+
var getAbsolutePath = (path31, cwd) => {
|
|
5399
|
+
if (sysPath2.isAbsolute(path31)) {
|
|
5400
|
+
return path31;
|
|
5401
5401
|
}
|
|
5402
|
-
return sysPath2.join(cwd,
|
|
5402
|
+
return sysPath2.join(cwd, path31);
|
|
5403
5403
|
};
|
|
5404
5404
|
var EMPTY_SET = Object.freeze(/* @__PURE__ */ new Set());
|
|
5405
5405
|
var DirEntry = class {
|
|
@@ -5454,10 +5454,10 @@ var DirEntry = class {
|
|
|
5454
5454
|
var STAT_METHOD_F = "stat";
|
|
5455
5455
|
var STAT_METHOD_L = "lstat";
|
|
5456
5456
|
var WatchHelper = class {
|
|
5457
|
-
constructor(
|
|
5457
|
+
constructor(path31, follow, fsw) {
|
|
5458
5458
|
this.fsw = fsw;
|
|
5459
|
-
const watchPath =
|
|
5460
|
-
this.path =
|
|
5459
|
+
const watchPath = path31;
|
|
5460
|
+
this.path = path31 = path31.replace(REPLACER_RE, "");
|
|
5461
5461
|
this.watchPath = watchPath;
|
|
5462
5462
|
this.fullWatchPath = sysPath2.resolve(watchPath);
|
|
5463
5463
|
this.dirParts = [];
|
|
@@ -5579,20 +5579,20 @@ var FSWatcher = class extends EventEmitter {
|
|
|
5579
5579
|
this._closePromise = void 0;
|
|
5580
5580
|
let paths = unifyPaths(paths_);
|
|
5581
5581
|
if (cwd) {
|
|
5582
|
-
paths = paths.map((
|
|
5583
|
-
const absPath = getAbsolutePath(
|
|
5582
|
+
paths = paths.map((path31) => {
|
|
5583
|
+
const absPath = getAbsolutePath(path31, cwd);
|
|
5584
5584
|
return absPath;
|
|
5585
5585
|
});
|
|
5586
5586
|
}
|
|
5587
|
-
paths.forEach((
|
|
5588
|
-
this._removeIgnoredPath(
|
|
5587
|
+
paths.forEach((path31) => {
|
|
5588
|
+
this._removeIgnoredPath(path31);
|
|
5589
5589
|
});
|
|
5590
5590
|
this._userIgnored = void 0;
|
|
5591
5591
|
if (!this._readyCount)
|
|
5592
5592
|
this._readyCount = 0;
|
|
5593
5593
|
this._readyCount += paths.length;
|
|
5594
|
-
Promise.all(paths.map(async (
|
|
5595
|
-
const res = await this._nodeFsHandler._addToNodeFs(
|
|
5594
|
+
Promise.all(paths.map(async (path31) => {
|
|
5595
|
+
const res = await this._nodeFsHandler._addToNodeFs(path31, !_internal, void 0, 0, _origAdd);
|
|
5596
5596
|
if (res)
|
|
5597
5597
|
this._emitReady();
|
|
5598
5598
|
return res;
|
|
@@ -5614,17 +5614,17 @@ var FSWatcher = class extends EventEmitter {
|
|
|
5614
5614
|
return this;
|
|
5615
5615
|
const paths = unifyPaths(paths_);
|
|
5616
5616
|
const { cwd } = this.options;
|
|
5617
|
-
paths.forEach((
|
|
5618
|
-
if (!sysPath2.isAbsolute(
|
|
5617
|
+
paths.forEach((path31) => {
|
|
5618
|
+
if (!sysPath2.isAbsolute(path31) && !this._closers.has(path31)) {
|
|
5619
5619
|
if (cwd)
|
|
5620
|
-
|
|
5621
|
-
|
|
5620
|
+
path31 = sysPath2.join(cwd, path31);
|
|
5621
|
+
path31 = sysPath2.resolve(path31);
|
|
5622
5622
|
}
|
|
5623
|
-
this._closePath(
|
|
5624
|
-
this._addIgnoredPath(
|
|
5625
|
-
if (this._watched.has(
|
|
5623
|
+
this._closePath(path31);
|
|
5624
|
+
this._addIgnoredPath(path31);
|
|
5625
|
+
if (this._watched.has(path31)) {
|
|
5626
5626
|
this._addIgnoredPath({
|
|
5627
|
-
path:
|
|
5627
|
+
path: path31,
|
|
5628
5628
|
recursive: true
|
|
5629
5629
|
});
|
|
5630
5630
|
}
|
|
@@ -5688,38 +5688,38 @@ var FSWatcher = class extends EventEmitter {
|
|
|
5688
5688
|
* @param stats arguments to be passed with event
|
|
5689
5689
|
* @returns the error if defined, otherwise the value of the FSWatcher instance's `closed` flag
|
|
5690
5690
|
*/
|
|
5691
|
-
async _emit(event,
|
|
5691
|
+
async _emit(event, path31, stats) {
|
|
5692
5692
|
if (this.closed)
|
|
5693
5693
|
return;
|
|
5694
5694
|
const opts = this.options;
|
|
5695
5695
|
if (isWindows)
|
|
5696
|
-
|
|
5696
|
+
path31 = sysPath2.normalize(path31);
|
|
5697
5697
|
if (opts.cwd)
|
|
5698
|
-
|
|
5699
|
-
const args = [
|
|
5698
|
+
path31 = sysPath2.relative(opts.cwd, path31);
|
|
5699
|
+
const args = [path31];
|
|
5700
5700
|
if (stats != null)
|
|
5701
5701
|
args.push(stats);
|
|
5702
5702
|
const awf = opts.awaitWriteFinish;
|
|
5703
5703
|
let pw;
|
|
5704
|
-
if (awf && (pw = this._pendingWrites.get(
|
|
5704
|
+
if (awf && (pw = this._pendingWrites.get(path31))) {
|
|
5705
5705
|
pw.lastChange = /* @__PURE__ */ new Date();
|
|
5706
5706
|
return this;
|
|
5707
5707
|
}
|
|
5708
5708
|
if (opts.atomic) {
|
|
5709
5709
|
if (event === EVENTS.UNLINK) {
|
|
5710
|
-
this._pendingUnlinks.set(
|
|
5710
|
+
this._pendingUnlinks.set(path31, [event, ...args]);
|
|
5711
5711
|
setTimeout(() => {
|
|
5712
|
-
this._pendingUnlinks.forEach((entry,
|
|
5712
|
+
this._pendingUnlinks.forEach((entry, path32) => {
|
|
5713
5713
|
this.emit(...entry);
|
|
5714
5714
|
this.emit(EVENTS.ALL, ...entry);
|
|
5715
|
-
this._pendingUnlinks.delete(
|
|
5715
|
+
this._pendingUnlinks.delete(path32);
|
|
5716
5716
|
});
|
|
5717
5717
|
}, typeof opts.atomic === "number" ? opts.atomic : 100);
|
|
5718
5718
|
return this;
|
|
5719
5719
|
}
|
|
5720
|
-
if (event === EVENTS.ADD && this._pendingUnlinks.has(
|
|
5720
|
+
if (event === EVENTS.ADD && this._pendingUnlinks.has(path31)) {
|
|
5721
5721
|
event = EVENTS.CHANGE;
|
|
5722
|
-
this._pendingUnlinks.delete(
|
|
5722
|
+
this._pendingUnlinks.delete(path31);
|
|
5723
5723
|
}
|
|
5724
5724
|
}
|
|
5725
5725
|
if (awf && (event === EVENTS.ADD || event === EVENTS.CHANGE) && this._readyEmitted) {
|
|
@@ -5737,16 +5737,16 @@ var FSWatcher = class extends EventEmitter {
|
|
|
5737
5737
|
this.emitWithAll(event, args);
|
|
5738
5738
|
}
|
|
5739
5739
|
};
|
|
5740
|
-
this._awaitWriteFinish(
|
|
5740
|
+
this._awaitWriteFinish(path31, awf.stabilityThreshold, event, awfEmit);
|
|
5741
5741
|
return this;
|
|
5742
5742
|
}
|
|
5743
5743
|
if (event === EVENTS.CHANGE) {
|
|
5744
|
-
const isThrottled = !this._throttle(EVENTS.CHANGE,
|
|
5744
|
+
const isThrottled = !this._throttle(EVENTS.CHANGE, path31, 50);
|
|
5745
5745
|
if (isThrottled)
|
|
5746
5746
|
return this;
|
|
5747
5747
|
}
|
|
5748
5748
|
if (opts.alwaysStat && stats === void 0 && (event === EVENTS.ADD || event === EVENTS.ADD_DIR || event === EVENTS.CHANGE)) {
|
|
5749
|
-
const fullPath = opts.cwd ? sysPath2.join(opts.cwd,
|
|
5749
|
+
const fullPath = opts.cwd ? sysPath2.join(opts.cwd, path31) : path31;
|
|
5750
5750
|
let stats2;
|
|
5751
5751
|
try {
|
|
5752
5752
|
stats2 = await stat3(fullPath);
|
|
@@ -5777,23 +5777,23 @@ var FSWatcher = class extends EventEmitter {
|
|
|
5777
5777
|
* @param timeout duration of time to suppress duplicate actions
|
|
5778
5778
|
* @returns tracking object or false if action should be suppressed
|
|
5779
5779
|
*/
|
|
5780
|
-
_throttle(actionType,
|
|
5780
|
+
_throttle(actionType, path31, timeout) {
|
|
5781
5781
|
if (!this._throttled.has(actionType)) {
|
|
5782
5782
|
this._throttled.set(actionType, /* @__PURE__ */ new Map());
|
|
5783
5783
|
}
|
|
5784
5784
|
const action = this._throttled.get(actionType);
|
|
5785
5785
|
if (!action)
|
|
5786
5786
|
throw new Error("invalid throttle");
|
|
5787
|
-
const actionPath = action.get(
|
|
5787
|
+
const actionPath = action.get(path31);
|
|
5788
5788
|
if (actionPath) {
|
|
5789
5789
|
actionPath.count++;
|
|
5790
5790
|
return false;
|
|
5791
5791
|
}
|
|
5792
5792
|
let timeoutObject;
|
|
5793
5793
|
const clear = () => {
|
|
5794
|
-
const item = action.get(
|
|
5794
|
+
const item = action.get(path31);
|
|
5795
5795
|
const count = item ? item.count : 0;
|
|
5796
|
-
action.delete(
|
|
5796
|
+
action.delete(path31);
|
|
5797
5797
|
clearTimeout(timeoutObject);
|
|
5798
5798
|
if (item)
|
|
5799
5799
|
clearTimeout(item.timeoutObject);
|
|
@@ -5801,7 +5801,7 @@ var FSWatcher = class extends EventEmitter {
|
|
|
5801
5801
|
};
|
|
5802
5802
|
timeoutObject = setTimeout(clear, timeout);
|
|
5803
5803
|
const thr = { timeoutObject, clear, count: 0 };
|
|
5804
|
-
action.set(
|
|
5804
|
+
action.set(path31, thr);
|
|
5805
5805
|
return thr;
|
|
5806
5806
|
}
|
|
5807
5807
|
_incrReadyCount() {
|
|
@@ -5815,44 +5815,44 @@ var FSWatcher = class extends EventEmitter {
|
|
|
5815
5815
|
* @param event
|
|
5816
5816
|
* @param awfEmit Callback to be called when ready for event to be emitted.
|
|
5817
5817
|
*/
|
|
5818
|
-
_awaitWriteFinish(
|
|
5818
|
+
_awaitWriteFinish(path31, threshold, event, awfEmit) {
|
|
5819
5819
|
const awf = this.options.awaitWriteFinish;
|
|
5820
5820
|
if (typeof awf !== "object")
|
|
5821
5821
|
return;
|
|
5822
5822
|
const pollInterval = awf.pollInterval;
|
|
5823
5823
|
let timeoutHandler;
|
|
5824
|
-
let fullPath =
|
|
5825
|
-
if (this.options.cwd && !sysPath2.isAbsolute(
|
|
5826
|
-
fullPath = sysPath2.join(this.options.cwd,
|
|
5824
|
+
let fullPath = path31;
|
|
5825
|
+
if (this.options.cwd && !sysPath2.isAbsolute(path31)) {
|
|
5826
|
+
fullPath = sysPath2.join(this.options.cwd, path31);
|
|
5827
5827
|
}
|
|
5828
5828
|
const now = /* @__PURE__ */ new Date();
|
|
5829
5829
|
const writes = this._pendingWrites;
|
|
5830
5830
|
function awaitWriteFinishFn(prevStat) {
|
|
5831
5831
|
statcb(fullPath, (err, curStat) => {
|
|
5832
|
-
if (err || !writes.has(
|
|
5832
|
+
if (err || !writes.has(path31)) {
|
|
5833
5833
|
if (err && err.code !== "ENOENT")
|
|
5834
5834
|
awfEmit(err);
|
|
5835
5835
|
return;
|
|
5836
5836
|
}
|
|
5837
5837
|
const now2 = Number(/* @__PURE__ */ new Date());
|
|
5838
5838
|
if (prevStat && curStat.size !== prevStat.size) {
|
|
5839
|
-
writes.get(
|
|
5839
|
+
writes.get(path31).lastChange = now2;
|
|
5840
5840
|
}
|
|
5841
|
-
const pw = writes.get(
|
|
5841
|
+
const pw = writes.get(path31);
|
|
5842
5842
|
const df = now2 - pw.lastChange;
|
|
5843
5843
|
if (df >= threshold) {
|
|
5844
|
-
writes.delete(
|
|
5844
|
+
writes.delete(path31);
|
|
5845
5845
|
awfEmit(void 0, curStat);
|
|
5846
5846
|
} else {
|
|
5847
5847
|
timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval, curStat);
|
|
5848
5848
|
}
|
|
5849
5849
|
});
|
|
5850
5850
|
}
|
|
5851
|
-
if (!writes.has(
|
|
5852
|
-
writes.set(
|
|
5851
|
+
if (!writes.has(path31)) {
|
|
5852
|
+
writes.set(path31, {
|
|
5853
5853
|
lastChange: now,
|
|
5854
5854
|
cancelWait: () => {
|
|
5855
|
-
writes.delete(
|
|
5855
|
+
writes.delete(path31);
|
|
5856
5856
|
clearTimeout(timeoutHandler);
|
|
5857
5857
|
return event;
|
|
5858
5858
|
}
|
|
@@ -5863,8 +5863,8 @@ var FSWatcher = class extends EventEmitter {
|
|
|
5863
5863
|
/**
|
|
5864
5864
|
* Determines whether user has asked to ignore this path.
|
|
5865
5865
|
*/
|
|
5866
|
-
_isIgnored(
|
|
5867
|
-
if (this.options.atomic && DOT_RE.test(
|
|
5866
|
+
_isIgnored(path31, stats) {
|
|
5867
|
+
if (this.options.atomic && DOT_RE.test(path31))
|
|
5868
5868
|
return true;
|
|
5869
5869
|
if (!this._userIgnored) {
|
|
5870
5870
|
const { cwd } = this.options;
|
|
@@ -5874,17 +5874,17 @@ var FSWatcher = class extends EventEmitter {
|
|
|
5874
5874
|
const list = [...ignoredPaths.map(normalizeIgnored(cwd)), ...ignored];
|
|
5875
5875
|
this._userIgnored = anymatch(list, void 0);
|
|
5876
5876
|
}
|
|
5877
|
-
return this._userIgnored(
|
|
5877
|
+
return this._userIgnored(path31, stats);
|
|
5878
5878
|
}
|
|
5879
|
-
_isntIgnored(
|
|
5880
|
-
return !this._isIgnored(
|
|
5879
|
+
_isntIgnored(path31, stat6) {
|
|
5880
|
+
return !this._isIgnored(path31, stat6);
|
|
5881
5881
|
}
|
|
5882
5882
|
/**
|
|
5883
5883
|
* Provides a set of common helpers and properties relating to symlink handling.
|
|
5884
5884
|
* @param path file or directory pattern being watched
|
|
5885
5885
|
*/
|
|
5886
|
-
_getWatchHelpers(
|
|
5887
|
-
return new WatchHelper(
|
|
5886
|
+
_getWatchHelpers(path31) {
|
|
5887
|
+
return new WatchHelper(path31, this.options.followSymlinks, this);
|
|
5888
5888
|
}
|
|
5889
5889
|
// Directory helpers
|
|
5890
5890
|
// -----------------
|
|
@@ -5916,63 +5916,63 @@ var FSWatcher = class extends EventEmitter {
|
|
|
5916
5916
|
* @param item base path of item/directory
|
|
5917
5917
|
*/
|
|
5918
5918
|
_remove(directory, item, isDirectory) {
|
|
5919
|
-
const
|
|
5920
|
-
const fullPath = sysPath2.resolve(
|
|
5921
|
-
isDirectory = isDirectory != null ? isDirectory : this._watched.has(
|
|
5922
|
-
if (!this._throttle("remove",
|
|
5919
|
+
const path31 = sysPath2.join(directory, item);
|
|
5920
|
+
const fullPath = sysPath2.resolve(path31);
|
|
5921
|
+
isDirectory = isDirectory != null ? isDirectory : this._watched.has(path31) || this._watched.has(fullPath);
|
|
5922
|
+
if (!this._throttle("remove", path31, 100))
|
|
5923
5923
|
return;
|
|
5924
5924
|
if (!isDirectory && this._watched.size === 1) {
|
|
5925
5925
|
this.add(directory, item, true);
|
|
5926
5926
|
}
|
|
5927
|
-
const wp = this._getWatchedDir(
|
|
5927
|
+
const wp = this._getWatchedDir(path31);
|
|
5928
5928
|
const nestedDirectoryChildren = wp.getChildren();
|
|
5929
|
-
nestedDirectoryChildren.forEach((nested) => this._remove(
|
|
5929
|
+
nestedDirectoryChildren.forEach((nested) => this._remove(path31, nested));
|
|
5930
5930
|
const parent = this._getWatchedDir(directory);
|
|
5931
5931
|
const wasTracked = parent.has(item);
|
|
5932
5932
|
parent.remove(item);
|
|
5933
5933
|
if (this._symlinkPaths.has(fullPath)) {
|
|
5934
5934
|
this._symlinkPaths.delete(fullPath);
|
|
5935
5935
|
}
|
|
5936
|
-
let relPath =
|
|
5936
|
+
let relPath = path31;
|
|
5937
5937
|
if (this.options.cwd)
|
|
5938
|
-
relPath = sysPath2.relative(this.options.cwd,
|
|
5938
|
+
relPath = sysPath2.relative(this.options.cwd, path31);
|
|
5939
5939
|
if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
|
|
5940
5940
|
const event = this._pendingWrites.get(relPath).cancelWait();
|
|
5941
5941
|
if (event === EVENTS.ADD)
|
|
5942
5942
|
return;
|
|
5943
5943
|
}
|
|
5944
|
-
this._watched.delete(
|
|
5944
|
+
this._watched.delete(path31);
|
|
5945
5945
|
this._watched.delete(fullPath);
|
|
5946
5946
|
const eventName = isDirectory ? EVENTS.UNLINK_DIR : EVENTS.UNLINK;
|
|
5947
|
-
if (wasTracked && !this._isIgnored(
|
|
5948
|
-
this._emit(eventName,
|
|
5949
|
-
this._closePath(
|
|
5947
|
+
if (wasTracked && !this._isIgnored(path31))
|
|
5948
|
+
this._emit(eventName, path31);
|
|
5949
|
+
this._closePath(path31);
|
|
5950
5950
|
}
|
|
5951
5951
|
/**
|
|
5952
5952
|
* Closes all watchers for a path
|
|
5953
5953
|
*/
|
|
5954
|
-
_closePath(
|
|
5955
|
-
this._closeFile(
|
|
5956
|
-
const dir = sysPath2.dirname(
|
|
5957
|
-
this._getWatchedDir(dir).remove(sysPath2.basename(
|
|
5954
|
+
_closePath(path31) {
|
|
5955
|
+
this._closeFile(path31);
|
|
5956
|
+
const dir = sysPath2.dirname(path31);
|
|
5957
|
+
this._getWatchedDir(dir).remove(sysPath2.basename(path31));
|
|
5958
5958
|
}
|
|
5959
5959
|
/**
|
|
5960
5960
|
* Closes only file-specific watchers
|
|
5961
5961
|
*/
|
|
5962
|
-
_closeFile(
|
|
5963
|
-
const closers = this._closers.get(
|
|
5962
|
+
_closeFile(path31) {
|
|
5963
|
+
const closers = this._closers.get(path31);
|
|
5964
5964
|
if (!closers)
|
|
5965
5965
|
return;
|
|
5966
5966
|
closers.forEach((closer) => closer());
|
|
5967
|
-
this._closers.delete(
|
|
5967
|
+
this._closers.delete(path31);
|
|
5968
5968
|
}
|
|
5969
|
-
_addPathCloser(
|
|
5969
|
+
_addPathCloser(path31, closer) {
|
|
5970
5970
|
if (!closer)
|
|
5971
5971
|
return;
|
|
5972
|
-
let list = this._closers.get(
|
|
5972
|
+
let list = this._closers.get(path31);
|
|
5973
5973
|
if (!list) {
|
|
5974
5974
|
list = [];
|
|
5975
|
-
this._closers.set(
|
|
5975
|
+
this._closers.set(path31, list);
|
|
5976
5976
|
}
|
|
5977
5977
|
list.push(closer);
|
|
5978
5978
|
}
|
|
@@ -6002,7 +6002,7 @@ function watch(paths, options = {}) {
|
|
|
6002
6002
|
var esm_default = { watch, FSWatcher };
|
|
6003
6003
|
|
|
6004
6004
|
// src/runtime/buildPlugin.ts
|
|
6005
|
-
import
|
|
6005
|
+
import path11 from "pathe";
|
|
6006
6006
|
|
|
6007
6007
|
// ../../node_modules/.pnpm/rimraf@6.0.1/node_modules/rimraf/dist/esm/index.js
|
|
6008
6008
|
init_esm_shims();
|
|
@@ -8504,12 +8504,12 @@ var PathBase = class {
|
|
|
8504
8504
|
/**
|
|
8505
8505
|
* Get the Path object referenced by the string path, resolved from this Path
|
|
8506
8506
|
*/
|
|
8507
|
-
resolve(
|
|
8508
|
-
if (!
|
|
8507
|
+
resolve(path31) {
|
|
8508
|
+
if (!path31) {
|
|
8509
8509
|
return this;
|
|
8510
8510
|
}
|
|
8511
|
-
const rootPath = this.getRootString(
|
|
8512
|
-
const dir =
|
|
8511
|
+
const rootPath = this.getRootString(path31);
|
|
8512
|
+
const dir = path31.substring(rootPath.length);
|
|
8513
8513
|
const dirParts = dir.split(this.splitSep);
|
|
8514
8514
|
const result = rootPath ? this.getRoot(rootPath).#resolveParts(dirParts) : this.#resolveParts(dirParts);
|
|
8515
8515
|
return result;
|
|
@@ -9261,8 +9261,8 @@ var PathWin32 = class _PathWin32 extends PathBase {
|
|
|
9261
9261
|
/**
|
|
9262
9262
|
* @internal
|
|
9263
9263
|
*/
|
|
9264
|
-
getRootString(
|
|
9265
|
-
return win32.parse(
|
|
9264
|
+
getRootString(path31) {
|
|
9265
|
+
return win32.parse(path31).root;
|
|
9266
9266
|
}
|
|
9267
9267
|
/**
|
|
9268
9268
|
* @internal
|
|
@@ -9308,8 +9308,8 @@ var PathPosix = class _PathPosix extends PathBase {
|
|
|
9308
9308
|
/**
|
|
9309
9309
|
* @internal
|
|
9310
9310
|
*/
|
|
9311
|
-
getRootString(
|
|
9312
|
-
return
|
|
9311
|
+
getRootString(path31) {
|
|
9312
|
+
return path31.startsWith("/") ? "/" : "";
|
|
9313
9313
|
}
|
|
9314
9314
|
/**
|
|
9315
9315
|
* @internal
|
|
@@ -9398,11 +9398,11 @@ var PathScurryBase = class {
|
|
|
9398
9398
|
/**
|
|
9399
9399
|
* Get the depth of a provided path, string, or the cwd
|
|
9400
9400
|
*/
|
|
9401
|
-
depth(
|
|
9402
|
-
if (typeof
|
|
9403
|
-
|
|
9401
|
+
depth(path31 = this.cwd) {
|
|
9402
|
+
if (typeof path31 === "string") {
|
|
9403
|
+
path31 = this.cwd.resolve(path31);
|
|
9404
9404
|
}
|
|
9405
|
-
return
|
|
9405
|
+
return path31.depth();
|
|
9406
9406
|
}
|
|
9407
9407
|
/**
|
|
9408
9408
|
* Return the cache of child entries. Exposed so subclasses can create
|
|
@@ -9889,9 +9889,9 @@ var PathScurryBase = class {
|
|
|
9889
9889
|
process10();
|
|
9890
9890
|
return results;
|
|
9891
9891
|
}
|
|
9892
|
-
chdir(
|
|
9892
|
+
chdir(path31 = this.cwd) {
|
|
9893
9893
|
const oldCwd = this.cwd;
|
|
9894
|
-
this.cwd = typeof
|
|
9894
|
+
this.cwd = typeof path31 === "string" ? this.cwd.resolve(path31) : path31;
|
|
9895
9895
|
this.cwd[setAsCwd](oldCwd);
|
|
9896
9896
|
}
|
|
9897
9897
|
};
|
|
@@ -10253,8 +10253,8 @@ var MatchRecord = class {
|
|
|
10253
10253
|
}
|
|
10254
10254
|
// match, absolute, ifdir
|
|
10255
10255
|
entries() {
|
|
10256
|
-
return [...this.store.entries()].map(([
|
|
10257
|
-
|
|
10256
|
+
return [...this.store.entries()].map(([path31, n2]) => [
|
|
10257
|
+
path31,
|
|
10258
10258
|
!!(n2 & 2),
|
|
10259
10259
|
!!(n2 & 1)
|
|
10260
10260
|
]);
|
|
@@ -10459,9 +10459,9 @@ var GlobUtil = class {
|
|
|
10459
10459
|
signal;
|
|
10460
10460
|
maxDepth;
|
|
10461
10461
|
includeChildMatches;
|
|
10462
|
-
constructor(patterns,
|
|
10462
|
+
constructor(patterns, path31, opts) {
|
|
10463
10463
|
this.patterns = patterns;
|
|
10464
|
-
this.path =
|
|
10464
|
+
this.path = path31;
|
|
10465
10465
|
this.opts = opts;
|
|
10466
10466
|
this.#sep = !opts.posix && opts.platform === "win32" ? "\\" : "/";
|
|
10467
10467
|
this.includeChildMatches = opts.includeChildMatches !== false;
|
|
@@ -10480,11 +10480,11 @@ var GlobUtil = class {
|
|
|
10480
10480
|
});
|
|
10481
10481
|
}
|
|
10482
10482
|
}
|
|
10483
|
-
#ignored(
|
|
10484
|
-
return this.seen.has(
|
|
10483
|
+
#ignored(path31) {
|
|
10484
|
+
return this.seen.has(path31) || !!this.#ignore?.ignored?.(path31);
|
|
10485
10485
|
}
|
|
10486
|
-
#childrenIgnored(
|
|
10487
|
-
return !!this.#ignore?.childrenIgnored?.(
|
|
10486
|
+
#childrenIgnored(path31) {
|
|
10487
|
+
return !!this.#ignore?.childrenIgnored?.(path31);
|
|
10488
10488
|
}
|
|
10489
10489
|
// backpressure mechanism
|
|
10490
10490
|
pause() {
|
|
@@ -10699,8 +10699,8 @@ var GlobUtil = class {
|
|
|
10699
10699
|
};
|
|
10700
10700
|
var GlobWalker = class extends GlobUtil {
|
|
10701
10701
|
matches = /* @__PURE__ */ new Set();
|
|
10702
|
-
constructor(patterns,
|
|
10703
|
-
super(patterns,
|
|
10702
|
+
constructor(patterns, path31, opts) {
|
|
10703
|
+
super(patterns, path31, opts);
|
|
10704
10704
|
}
|
|
10705
10705
|
matchEmit(e) {
|
|
10706
10706
|
this.matches.add(e);
|
|
@@ -10737,8 +10737,8 @@ var GlobWalker = class extends GlobUtil {
|
|
|
10737
10737
|
};
|
|
10738
10738
|
var GlobStream = class extends GlobUtil {
|
|
10739
10739
|
results;
|
|
10740
|
-
constructor(patterns,
|
|
10741
|
-
super(patterns,
|
|
10740
|
+
constructor(patterns, path31, opts) {
|
|
10741
|
+
super(patterns, path31, opts);
|
|
10742
10742
|
this.results = new Minipass({
|
|
10743
10743
|
signal: this.signal,
|
|
10744
10744
|
objectMode: true
|
|
@@ -11075,44 +11075,44 @@ init_esm_shims();
|
|
|
11075
11075
|
var platform_default = process.env.__TESTING_RIMRAF_PLATFORM__ || process.platform;
|
|
11076
11076
|
|
|
11077
11077
|
// ../../node_modules/.pnpm/rimraf@6.0.1/node_modules/rimraf/dist/esm/path-arg.js
|
|
11078
|
-
var pathArg = (
|
|
11079
|
-
const type = typeof
|
|
11078
|
+
var pathArg = (path31, opt = {}) => {
|
|
11079
|
+
const type = typeof path31;
|
|
11080
11080
|
if (type !== "string") {
|
|
11081
|
-
const ctor =
|
|
11082
|
-
const received = ctor && ctor.name ? `an instance of ${ctor.name}` : type === "object" ? inspect(
|
|
11081
|
+
const ctor = path31 && type === "object" && path31.constructor;
|
|
11082
|
+
const received = ctor && ctor.name ? `an instance of ${ctor.name}` : type === "object" ? inspect(path31) : `type ${type} ${path31}`;
|
|
11083
11083
|
const msg = `The "path" argument must be of type string. Received ${received}`;
|
|
11084
11084
|
throw Object.assign(new TypeError(msg), {
|
|
11085
|
-
path:
|
|
11085
|
+
path: path31,
|
|
11086
11086
|
code: "ERR_INVALID_ARG_TYPE"
|
|
11087
11087
|
});
|
|
11088
11088
|
}
|
|
11089
|
-
if (/\0/.test(
|
|
11089
|
+
if (/\0/.test(path31)) {
|
|
11090
11090
|
const msg = "path must be a string without null bytes";
|
|
11091
11091
|
throw Object.assign(new TypeError(msg), {
|
|
11092
|
-
path:
|
|
11092
|
+
path: path31,
|
|
11093
11093
|
code: "ERR_INVALID_ARG_VALUE"
|
|
11094
11094
|
});
|
|
11095
11095
|
}
|
|
11096
|
-
|
|
11097
|
-
const { root } = parse2(
|
|
11098
|
-
if (
|
|
11096
|
+
path31 = resolve3(path31);
|
|
11097
|
+
const { root } = parse2(path31);
|
|
11098
|
+
if (path31 === root && opt.preserveRoot !== false) {
|
|
11099
11099
|
const msg = "refusing to remove root directory without preserveRoot:false";
|
|
11100
11100
|
throw Object.assign(new Error(msg), {
|
|
11101
|
-
path:
|
|
11101
|
+
path: path31,
|
|
11102
11102
|
code: "ERR_PRESERVE_ROOT"
|
|
11103
11103
|
});
|
|
11104
11104
|
}
|
|
11105
11105
|
if (platform_default === "win32") {
|
|
11106
11106
|
const badWinChars = /[*|"<>?:]/;
|
|
11107
|
-
const { root: root2 } = parse2(
|
|
11108
|
-
if (badWinChars.test(
|
|
11107
|
+
const { root: root2 } = parse2(path31);
|
|
11108
|
+
if (badWinChars.test(path31.substring(root2.length))) {
|
|
11109
11109
|
throw Object.assign(new Error("Illegal characters in path."), {
|
|
11110
|
-
path:
|
|
11110
|
+
path: path31,
|
|
11111
11111
|
code: "EINVAL"
|
|
11112
11112
|
});
|
|
11113
11113
|
}
|
|
11114
11114
|
}
|
|
11115
|
-
return
|
|
11115
|
+
return path31;
|
|
11116
11116
|
};
|
|
11117
11117
|
var path_arg_default = pathArg;
|
|
11118
11118
|
|
|
@@ -11127,16 +11127,16 @@ init_esm_shims();
|
|
|
11127
11127
|
import fs6 from "fs";
|
|
11128
11128
|
import { chmodSync, mkdirSync, renameSync, rmdirSync, rmSync, statSync, lstatSync as lstatSync2, unlinkSync } from "fs";
|
|
11129
11129
|
import { readdirSync as rdSync } from "fs";
|
|
11130
|
-
var readdirSync2 = (
|
|
11131
|
-
var chmod = (
|
|
11132
|
-
var mkdir = (
|
|
11133
|
-
var readdir4 = (
|
|
11130
|
+
var readdirSync2 = (path31) => rdSync(path31, { withFileTypes: true });
|
|
11131
|
+
var chmod = (path31, mode) => new Promise((res, rej) => fs6.chmod(path31, mode, (er, ...d) => er ? rej(er) : res(...d)));
|
|
11132
|
+
var mkdir = (path31, options) => new Promise((res, rej) => fs6.mkdir(path31, options, (er, made) => er ? rej(er) : res(made)));
|
|
11133
|
+
var readdir4 = (path31) => new Promise((res, rej) => fs6.readdir(path31, { withFileTypes: true }, (er, data2) => er ? rej(er) : res(data2)));
|
|
11134
11134
|
var rename = (oldPath, newPath) => new Promise((res, rej) => fs6.rename(oldPath, newPath, (er, ...d) => er ? rej(er) : res(...d)));
|
|
11135
|
-
var rm = (
|
|
11136
|
-
var rmdir = (
|
|
11137
|
-
var stat4 = (
|
|
11138
|
-
var lstat4 = (
|
|
11139
|
-
var unlink = (
|
|
11135
|
+
var rm = (path31, options) => new Promise((res, rej) => fs6.rm(path31, options, (er, ...d) => er ? rej(er) : res(...d)));
|
|
11136
|
+
var rmdir = (path31) => new Promise((res, rej) => fs6.rmdir(path31, (er, ...d) => er ? rej(er) : res(...d)));
|
|
11137
|
+
var stat4 = (path31) => new Promise((res, rej) => fs6.stat(path31, (er, data2) => er ? rej(er) : res(data2)));
|
|
11138
|
+
var lstat4 = (path31) => new Promise((res, rej) => fs6.lstat(path31, (er, data2) => er ? rej(er) : res(data2)));
|
|
11139
|
+
var unlink = (path31) => new Promise((res, rej) => fs6.unlink(path31, (er, ...d) => er ? rej(er) : res(...d)));
|
|
11140
11140
|
var promises = {
|
|
11141
11141
|
chmod,
|
|
11142
11142
|
mkdir,
|
|
@@ -11155,10 +11155,10 @@ import { parse as parse3, resolve as resolve4 } from "path";
|
|
|
11155
11155
|
// ../../node_modules/.pnpm/rimraf@6.0.1/node_modules/rimraf/dist/esm/readdir-or-error.js
|
|
11156
11156
|
init_esm_shims();
|
|
11157
11157
|
var { readdir: readdir5 } = promises;
|
|
11158
|
-
var readdirOrError = (
|
|
11159
|
-
var readdirOrErrorSync = (
|
|
11158
|
+
var readdirOrError = (path31) => readdir5(path31).catch((er) => er);
|
|
11159
|
+
var readdirOrErrorSync = (path31) => {
|
|
11160
11160
|
try {
|
|
11161
|
-
return readdirSync2(
|
|
11161
|
+
return readdirSync2(path31);
|
|
11162
11162
|
} catch (er) {
|
|
11163
11163
|
return er;
|
|
11164
11164
|
}
|
|
@@ -11183,35 +11183,35 @@ var ignoreENOENTSync = (fn) => {
|
|
|
11183
11183
|
|
|
11184
11184
|
// ../../node_modules/.pnpm/rimraf@6.0.1/node_modules/rimraf/dist/esm/rimraf-posix.js
|
|
11185
11185
|
var { lstat: lstat5, rmdir: rmdir2, unlink: unlink2 } = promises;
|
|
11186
|
-
var rimrafPosix = async (
|
|
11186
|
+
var rimrafPosix = async (path31, opt) => {
|
|
11187
11187
|
if (opt?.signal?.aborted) {
|
|
11188
11188
|
throw opt.signal.reason;
|
|
11189
11189
|
}
|
|
11190
11190
|
try {
|
|
11191
|
-
return await rimrafPosixDir(
|
|
11191
|
+
return await rimrafPosixDir(path31, opt, await lstat5(path31));
|
|
11192
11192
|
} catch (er) {
|
|
11193
11193
|
if (er?.code === "ENOENT")
|
|
11194
11194
|
return true;
|
|
11195
11195
|
throw er;
|
|
11196
11196
|
}
|
|
11197
11197
|
};
|
|
11198
|
-
var rimrafPosixSync = (
|
|
11198
|
+
var rimrafPosixSync = (path31, opt) => {
|
|
11199
11199
|
if (opt?.signal?.aborted) {
|
|
11200
11200
|
throw opt.signal.reason;
|
|
11201
11201
|
}
|
|
11202
11202
|
try {
|
|
11203
|
-
return rimrafPosixDirSync(
|
|
11203
|
+
return rimrafPosixDirSync(path31, opt, lstatSync2(path31));
|
|
11204
11204
|
} catch (er) {
|
|
11205
11205
|
if (er?.code === "ENOENT")
|
|
11206
11206
|
return true;
|
|
11207
11207
|
throw er;
|
|
11208
11208
|
}
|
|
11209
11209
|
};
|
|
11210
|
-
var rimrafPosixDir = async (
|
|
11210
|
+
var rimrafPosixDir = async (path31, opt, ent) => {
|
|
11211
11211
|
if (opt?.signal?.aborted) {
|
|
11212
11212
|
throw opt.signal.reason;
|
|
11213
11213
|
}
|
|
11214
|
-
const entries = ent.isDirectory() ? await readdirOrError(
|
|
11214
|
+
const entries = ent.isDirectory() ? await readdirOrError(path31) : null;
|
|
11215
11215
|
if (!Array.isArray(entries)) {
|
|
11216
11216
|
if (entries) {
|
|
11217
11217
|
if (entries.code === "ENOENT") {
|
|
@@ -11221,30 +11221,30 @@ var rimrafPosixDir = async (path30, opt, ent) => {
|
|
|
11221
11221
|
throw entries;
|
|
11222
11222
|
}
|
|
11223
11223
|
}
|
|
11224
|
-
if (opt.filter && !await opt.filter(
|
|
11224
|
+
if (opt.filter && !await opt.filter(path31, ent)) {
|
|
11225
11225
|
return false;
|
|
11226
11226
|
}
|
|
11227
|
-
await ignoreENOENT(unlink2(
|
|
11227
|
+
await ignoreENOENT(unlink2(path31));
|
|
11228
11228
|
return true;
|
|
11229
11229
|
}
|
|
11230
|
-
const removedAll = (await Promise.all(entries.map((ent2) => rimrafPosixDir(resolve4(
|
|
11230
|
+
const removedAll = (await Promise.all(entries.map((ent2) => rimrafPosixDir(resolve4(path31, ent2.name), opt, ent2)))).reduce((a, b) => a && b, true);
|
|
11231
11231
|
if (!removedAll) {
|
|
11232
11232
|
return false;
|
|
11233
11233
|
}
|
|
11234
|
-
if (opt.preserveRoot === false &&
|
|
11234
|
+
if (opt.preserveRoot === false && path31 === parse3(path31).root) {
|
|
11235
11235
|
return false;
|
|
11236
11236
|
}
|
|
11237
|
-
if (opt.filter && !await opt.filter(
|
|
11237
|
+
if (opt.filter && !await opt.filter(path31, ent)) {
|
|
11238
11238
|
return false;
|
|
11239
11239
|
}
|
|
11240
|
-
await ignoreENOENT(rmdir2(
|
|
11240
|
+
await ignoreENOENT(rmdir2(path31));
|
|
11241
11241
|
return true;
|
|
11242
11242
|
};
|
|
11243
|
-
var rimrafPosixDirSync = (
|
|
11243
|
+
var rimrafPosixDirSync = (path31, opt, ent) => {
|
|
11244
11244
|
if (opt?.signal?.aborted) {
|
|
11245
11245
|
throw opt.signal.reason;
|
|
11246
11246
|
}
|
|
11247
|
-
const entries = ent.isDirectory() ? readdirOrErrorSync(
|
|
11247
|
+
const entries = ent.isDirectory() ? readdirOrErrorSync(path31) : null;
|
|
11248
11248
|
if (!Array.isArray(entries)) {
|
|
11249
11249
|
if (entries) {
|
|
11250
11250
|
if (entries.code === "ENOENT") {
|
|
@@ -11254,27 +11254,27 @@ var rimrafPosixDirSync = (path30, opt, ent) => {
|
|
|
11254
11254
|
throw entries;
|
|
11255
11255
|
}
|
|
11256
11256
|
}
|
|
11257
|
-
if (opt.filter && !opt.filter(
|
|
11257
|
+
if (opt.filter && !opt.filter(path31, ent)) {
|
|
11258
11258
|
return false;
|
|
11259
11259
|
}
|
|
11260
|
-
ignoreENOENTSync(() => unlinkSync(
|
|
11260
|
+
ignoreENOENTSync(() => unlinkSync(path31));
|
|
11261
11261
|
return true;
|
|
11262
11262
|
}
|
|
11263
11263
|
let removedAll = true;
|
|
11264
11264
|
for (const ent2 of entries) {
|
|
11265
|
-
const p = resolve4(
|
|
11265
|
+
const p = resolve4(path31, ent2.name);
|
|
11266
11266
|
removedAll = rimrafPosixDirSync(p, opt, ent2) && removedAll;
|
|
11267
11267
|
}
|
|
11268
|
-
if (opt.preserveRoot === false &&
|
|
11268
|
+
if (opt.preserveRoot === false && path31 === parse3(path31).root) {
|
|
11269
11269
|
return false;
|
|
11270
11270
|
}
|
|
11271
11271
|
if (!removedAll) {
|
|
11272
11272
|
return false;
|
|
11273
11273
|
}
|
|
11274
|
-
if (opt.filter && !opt.filter(
|
|
11274
|
+
if (opt.filter && !opt.filter(path31, ent)) {
|
|
11275
11275
|
return false;
|
|
11276
11276
|
}
|
|
11277
|
-
ignoreENOENTSync(() => rmdirSync(
|
|
11277
|
+
ignoreENOENTSync(() => rmdirSync(path31));
|
|
11278
11278
|
return true;
|
|
11279
11279
|
};
|
|
11280
11280
|
|
|
@@ -11285,9 +11285,9 @@ import { parse as parse6, resolve as resolve7 } from "path";
|
|
|
11285
11285
|
// ../../node_modules/.pnpm/rimraf@6.0.1/node_modules/rimraf/dist/esm/fix-eperm.js
|
|
11286
11286
|
init_esm_shims();
|
|
11287
11287
|
var { chmod: chmod2 } = promises;
|
|
11288
|
-
var fixEPERM = (fn) => async (
|
|
11288
|
+
var fixEPERM = (fn) => async (path31) => {
|
|
11289
11289
|
try {
|
|
11290
|
-
return await fn(
|
|
11290
|
+
return await fn(path31);
|
|
11291
11291
|
} catch (er) {
|
|
11292
11292
|
const fer = er;
|
|
11293
11293
|
if (fer?.code === "ENOENT") {
|
|
@@ -11295,7 +11295,7 @@ var fixEPERM = (fn) => async (path30) => {
|
|
|
11295
11295
|
}
|
|
11296
11296
|
if (fer?.code === "EPERM") {
|
|
11297
11297
|
try {
|
|
11298
|
-
await chmod2(
|
|
11298
|
+
await chmod2(path31, 438);
|
|
11299
11299
|
} catch (er2) {
|
|
11300
11300
|
const fer2 = er2;
|
|
11301
11301
|
if (fer2?.code === "ENOENT") {
|
|
@@ -11303,14 +11303,14 @@ var fixEPERM = (fn) => async (path30) => {
|
|
|
11303
11303
|
}
|
|
11304
11304
|
throw er;
|
|
11305
11305
|
}
|
|
11306
|
-
return await fn(
|
|
11306
|
+
return await fn(path31);
|
|
11307
11307
|
}
|
|
11308
11308
|
throw er;
|
|
11309
11309
|
}
|
|
11310
11310
|
};
|
|
11311
|
-
var fixEPERMSync = (fn) => (
|
|
11311
|
+
var fixEPERMSync = (fn) => (path31) => {
|
|
11312
11312
|
try {
|
|
11313
|
-
return fn(
|
|
11313
|
+
return fn(path31);
|
|
11314
11314
|
} catch (er) {
|
|
11315
11315
|
const fer = er;
|
|
11316
11316
|
if (fer?.code === "ENOENT") {
|
|
@@ -11318,7 +11318,7 @@ var fixEPERMSync = (fn) => (path30) => {
|
|
|
11318
11318
|
}
|
|
11319
11319
|
if (fer?.code === "EPERM") {
|
|
11320
11320
|
try {
|
|
11321
|
-
chmodSync(
|
|
11321
|
+
chmodSync(path31, 438);
|
|
11322
11322
|
} catch (er2) {
|
|
11323
11323
|
const fer2 = er2;
|
|
11324
11324
|
if (fer2?.code === "ENOENT") {
|
|
@@ -11326,7 +11326,7 @@ var fixEPERMSync = (fn) => (path30) => {
|
|
|
11326
11326
|
}
|
|
11327
11327
|
throw er;
|
|
11328
11328
|
}
|
|
11329
|
-
return fn(
|
|
11329
|
+
return fn(path31);
|
|
11330
11330
|
}
|
|
11331
11331
|
throw er;
|
|
11332
11332
|
}
|
|
@@ -11339,23 +11339,23 @@ var RATE = 1.2;
|
|
|
11339
11339
|
var MAXRETRIES = 10;
|
|
11340
11340
|
var codes = /* @__PURE__ */ new Set(["EMFILE", "ENFILE", "EBUSY"]);
|
|
11341
11341
|
var retryBusy = (fn) => {
|
|
11342
|
-
const method = async (
|
|
11342
|
+
const method = async (path31, opt, backoff = 1, total = 0) => {
|
|
11343
11343
|
const mbo = opt.maxBackoff || MAXBACKOFF;
|
|
11344
11344
|
const rate = opt.backoff || RATE;
|
|
11345
11345
|
const max = opt.maxRetries || MAXRETRIES;
|
|
11346
11346
|
let retries = 0;
|
|
11347
11347
|
while (true) {
|
|
11348
11348
|
try {
|
|
11349
|
-
return await fn(
|
|
11349
|
+
return await fn(path31);
|
|
11350
11350
|
} catch (er) {
|
|
11351
11351
|
const fer = er;
|
|
11352
|
-
if (fer?.path ===
|
|
11352
|
+
if (fer?.path === path31 && fer?.code && codes.has(fer.code)) {
|
|
11353
11353
|
backoff = Math.ceil(backoff * rate);
|
|
11354
11354
|
total = backoff + total;
|
|
11355
11355
|
if (total < mbo) {
|
|
11356
11356
|
return new Promise((res, rej) => {
|
|
11357
11357
|
setTimeout(() => {
|
|
11358
|
-
method(
|
|
11358
|
+
method(path31, opt, backoff, total).then(res, rej);
|
|
11359
11359
|
}, backoff);
|
|
11360
11360
|
});
|
|
11361
11361
|
}
|
|
@@ -11371,15 +11371,15 @@ var retryBusy = (fn) => {
|
|
|
11371
11371
|
return method;
|
|
11372
11372
|
};
|
|
11373
11373
|
var retryBusySync = (fn) => {
|
|
11374
|
-
const method = (
|
|
11374
|
+
const method = (path31, opt) => {
|
|
11375
11375
|
const max = opt.maxRetries || MAXRETRIES;
|
|
11376
11376
|
let retries = 0;
|
|
11377
11377
|
while (true) {
|
|
11378
11378
|
try {
|
|
11379
|
-
return fn(
|
|
11379
|
+
return fn(path31);
|
|
11380
11380
|
} catch (er) {
|
|
11381
11381
|
const fer = er;
|
|
11382
|
-
if (fer?.path ===
|
|
11382
|
+
if (fer?.path === path31 && fer?.code && codes.has(fer.code) && retries < max) {
|
|
11383
11383
|
retries++;
|
|
11384
11384
|
continue;
|
|
11385
11385
|
}
|
|
@@ -11399,16 +11399,16 @@ init_esm_shims();
|
|
|
11399
11399
|
import { tmpdir } from "os";
|
|
11400
11400
|
import { parse as parse4, resolve as resolve5 } from "path";
|
|
11401
11401
|
var { stat: stat5 } = promises;
|
|
11402
|
-
var isDirSync = (
|
|
11402
|
+
var isDirSync = (path31) => {
|
|
11403
11403
|
try {
|
|
11404
|
-
return statSync(
|
|
11404
|
+
return statSync(path31).isDirectory();
|
|
11405
11405
|
} catch (er) {
|
|
11406
11406
|
return false;
|
|
11407
11407
|
}
|
|
11408
11408
|
};
|
|
11409
|
-
var isDir = (
|
|
11410
|
-
var win32DefaultTmp = async (
|
|
11411
|
-
const { root } = parse4(
|
|
11409
|
+
var isDir = (path31) => stat5(path31).then((st) => st.isDirectory(), () => false);
|
|
11410
|
+
var win32DefaultTmp = async (path31) => {
|
|
11411
|
+
const { root } = parse4(path31);
|
|
11412
11412
|
const tmp = tmpdir();
|
|
11413
11413
|
const { root: tmpRoot } = parse4(tmp);
|
|
11414
11414
|
if (root.toLowerCase() === tmpRoot.toLowerCase()) {
|
|
@@ -11420,8 +11420,8 @@ var win32DefaultTmp = async (path30) => {
|
|
|
11420
11420
|
}
|
|
11421
11421
|
return root;
|
|
11422
11422
|
};
|
|
11423
|
-
var win32DefaultTmpSync = (
|
|
11424
|
-
const { root } = parse4(
|
|
11423
|
+
var win32DefaultTmpSync = (path31) => {
|
|
11424
|
+
const { root } = parse4(path31);
|
|
11425
11425
|
const tmp = tmpdir();
|
|
11426
11426
|
const { root: tmpRoot } = parse4(tmp);
|
|
11427
11427
|
if (root.toLowerCase() === tmpRoot.toLowerCase()) {
|
|
@@ -11440,10 +11440,10 @@ var defaultTmpSync = platform_default === "win32" ? win32DefaultTmpSync : posixD
|
|
|
11440
11440
|
|
|
11441
11441
|
// ../../node_modules/.pnpm/rimraf@6.0.1/node_modules/rimraf/dist/esm/rimraf-move-remove.js
|
|
11442
11442
|
var { lstat: lstat6, rename: rename2, unlink: unlink3, rmdir: rmdir3, chmod: chmod3 } = promises;
|
|
11443
|
-
var uniqueFilename = (
|
|
11444
|
-
var unlinkFixEPERM = async (
|
|
11443
|
+
var uniqueFilename = (path31) => `.${basename3(path31)}.${Math.random()}`;
|
|
11444
|
+
var unlinkFixEPERM = async (path31) => unlink3(path31).catch((er) => {
|
|
11445
11445
|
if (er.code === "EPERM") {
|
|
11446
|
-
return chmod3(
|
|
11446
|
+
return chmod3(path31, 438).then(() => unlink3(path31), (er2) => {
|
|
11447
11447
|
if (er2.code === "ENOENT") {
|
|
11448
11448
|
return;
|
|
11449
11449
|
}
|
|
@@ -11454,13 +11454,13 @@ var unlinkFixEPERM = async (path30) => unlink3(path30).catch((er) => {
|
|
|
11454
11454
|
}
|
|
11455
11455
|
throw er;
|
|
11456
11456
|
});
|
|
11457
|
-
var unlinkFixEPERMSync = (
|
|
11457
|
+
var unlinkFixEPERMSync = (path31) => {
|
|
11458
11458
|
try {
|
|
11459
|
-
unlinkSync(
|
|
11459
|
+
unlinkSync(path31);
|
|
11460
11460
|
} catch (er) {
|
|
11461
11461
|
if (er?.code === "EPERM") {
|
|
11462
11462
|
try {
|
|
11463
|
-
return chmodSync(
|
|
11463
|
+
return chmodSync(path31, 438);
|
|
11464
11464
|
} catch (er2) {
|
|
11465
11465
|
if (er2?.code === "ENOENT") {
|
|
11466
11466
|
return;
|
|
@@ -11473,29 +11473,29 @@ var unlinkFixEPERMSync = (path30) => {
|
|
|
11473
11473
|
throw er;
|
|
11474
11474
|
}
|
|
11475
11475
|
};
|
|
11476
|
-
var rimrafMoveRemove = async (
|
|
11476
|
+
var rimrafMoveRemove = async (path31, opt) => {
|
|
11477
11477
|
if (opt?.signal?.aborted) {
|
|
11478
11478
|
throw opt.signal.reason;
|
|
11479
11479
|
}
|
|
11480
11480
|
try {
|
|
11481
|
-
return await rimrafMoveRemoveDir(
|
|
11481
|
+
return await rimrafMoveRemoveDir(path31, opt, await lstat6(path31));
|
|
11482
11482
|
} catch (er) {
|
|
11483
11483
|
if (er?.code === "ENOENT")
|
|
11484
11484
|
return true;
|
|
11485
11485
|
throw er;
|
|
11486
11486
|
}
|
|
11487
11487
|
};
|
|
11488
|
-
var rimrafMoveRemoveDir = async (
|
|
11488
|
+
var rimrafMoveRemoveDir = async (path31, opt, ent) => {
|
|
11489
11489
|
if (opt?.signal?.aborted) {
|
|
11490
11490
|
throw opt.signal.reason;
|
|
11491
11491
|
}
|
|
11492
11492
|
if (!opt.tmp) {
|
|
11493
|
-
return rimrafMoveRemoveDir(
|
|
11493
|
+
return rimrafMoveRemoveDir(path31, { ...opt, tmp: await defaultTmp(path31) }, ent);
|
|
11494
11494
|
}
|
|
11495
|
-
if (
|
|
11495
|
+
if (path31 === opt.tmp && parse5(path31).root !== path31) {
|
|
11496
11496
|
throw new Error("cannot delete temp directory used for deletion");
|
|
11497
11497
|
}
|
|
11498
|
-
const entries = ent.isDirectory() ? await readdirOrError(
|
|
11498
|
+
const entries = ent.isDirectory() ? await readdirOrError(path31) : null;
|
|
11499
11499
|
if (!Array.isArray(entries)) {
|
|
11500
11500
|
if (entries) {
|
|
11501
11501
|
if (entries.code === "ENOENT") {
|
|
@@ -11505,54 +11505,54 @@ var rimrafMoveRemoveDir = async (path30, opt, ent) => {
|
|
|
11505
11505
|
throw entries;
|
|
11506
11506
|
}
|
|
11507
11507
|
}
|
|
11508
|
-
if (opt.filter && !await opt.filter(
|
|
11508
|
+
if (opt.filter && !await opt.filter(path31, ent)) {
|
|
11509
11509
|
return false;
|
|
11510
11510
|
}
|
|
11511
|
-
await ignoreENOENT(tmpUnlink(
|
|
11511
|
+
await ignoreENOENT(tmpUnlink(path31, opt.tmp, unlinkFixEPERM));
|
|
11512
11512
|
return true;
|
|
11513
11513
|
}
|
|
11514
|
-
const removedAll = (await Promise.all(entries.map((ent2) => rimrafMoveRemoveDir(resolve6(
|
|
11514
|
+
const removedAll = (await Promise.all(entries.map((ent2) => rimrafMoveRemoveDir(resolve6(path31, ent2.name), opt, ent2)))).reduce((a, b) => a && b, true);
|
|
11515
11515
|
if (!removedAll) {
|
|
11516
11516
|
return false;
|
|
11517
11517
|
}
|
|
11518
|
-
if (opt.preserveRoot === false &&
|
|
11518
|
+
if (opt.preserveRoot === false && path31 === parse5(path31).root) {
|
|
11519
11519
|
return false;
|
|
11520
11520
|
}
|
|
11521
|
-
if (opt.filter && !await opt.filter(
|
|
11521
|
+
if (opt.filter && !await opt.filter(path31, ent)) {
|
|
11522
11522
|
return false;
|
|
11523
11523
|
}
|
|
11524
|
-
await ignoreENOENT(tmpUnlink(
|
|
11524
|
+
await ignoreENOENT(tmpUnlink(path31, opt.tmp, rmdir3));
|
|
11525
11525
|
return true;
|
|
11526
11526
|
};
|
|
11527
|
-
var tmpUnlink = async (
|
|
11528
|
-
const tmpFile = resolve6(tmp, uniqueFilename(
|
|
11529
|
-
await rename2(
|
|
11527
|
+
var tmpUnlink = async (path31, tmp, rm3) => {
|
|
11528
|
+
const tmpFile = resolve6(tmp, uniqueFilename(path31));
|
|
11529
|
+
await rename2(path31, tmpFile);
|
|
11530
11530
|
return await rm3(tmpFile);
|
|
11531
11531
|
};
|
|
11532
|
-
var rimrafMoveRemoveSync = (
|
|
11532
|
+
var rimrafMoveRemoveSync = (path31, opt) => {
|
|
11533
11533
|
if (opt?.signal?.aborted) {
|
|
11534
11534
|
throw opt.signal.reason;
|
|
11535
11535
|
}
|
|
11536
11536
|
try {
|
|
11537
|
-
return rimrafMoveRemoveDirSync(
|
|
11537
|
+
return rimrafMoveRemoveDirSync(path31, opt, lstatSync2(path31));
|
|
11538
11538
|
} catch (er) {
|
|
11539
11539
|
if (er?.code === "ENOENT")
|
|
11540
11540
|
return true;
|
|
11541
11541
|
throw er;
|
|
11542
11542
|
}
|
|
11543
11543
|
};
|
|
11544
|
-
var rimrafMoveRemoveDirSync = (
|
|
11544
|
+
var rimrafMoveRemoveDirSync = (path31, opt, ent) => {
|
|
11545
11545
|
if (opt?.signal?.aborted) {
|
|
11546
11546
|
throw opt.signal.reason;
|
|
11547
11547
|
}
|
|
11548
11548
|
if (!opt.tmp) {
|
|
11549
|
-
return rimrafMoveRemoveDirSync(
|
|
11549
|
+
return rimrafMoveRemoveDirSync(path31, { ...opt, tmp: defaultTmpSync(path31) }, ent);
|
|
11550
11550
|
}
|
|
11551
11551
|
const tmp = opt.tmp;
|
|
11552
|
-
if (
|
|
11552
|
+
if (path31 === opt.tmp && parse5(path31).root !== path31) {
|
|
11553
11553
|
throw new Error("cannot delete temp directory used for deletion");
|
|
11554
11554
|
}
|
|
11555
|
-
const entries = ent.isDirectory() ? readdirOrErrorSync(
|
|
11555
|
+
const entries = ent.isDirectory() ? readdirOrErrorSync(path31) : null;
|
|
11556
11556
|
if (!Array.isArray(entries)) {
|
|
11557
11557
|
if (entries) {
|
|
11558
11558
|
if (entries.code === "ENOENT") {
|
|
@@ -11562,32 +11562,32 @@ var rimrafMoveRemoveDirSync = (path30, opt, ent) => {
|
|
|
11562
11562
|
throw entries;
|
|
11563
11563
|
}
|
|
11564
11564
|
}
|
|
11565
|
-
if (opt.filter && !opt.filter(
|
|
11565
|
+
if (opt.filter && !opt.filter(path31, ent)) {
|
|
11566
11566
|
return false;
|
|
11567
11567
|
}
|
|
11568
|
-
ignoreENOENTSync(() => tmpUnlinkSync(
|
|
11568
|
+
ignoreENOENTSync(() => tmpUnlinkSync(path31, tmp, unlinkFixEPERMSync));
|
|
11569
11569
|
return true;
|
|
11570
11570
|
}
|
|
11571
11571
|
let removedAll = true;
|
|
11572
11572
|
for (const ent2 of entries) {
|
|
11573
|
-
const p = resolve6(
|
|
11573
|
+
const p = resolve6(path31, ent2.name);
|
|
11574
11574
|
removedAll = rimrafMoveRemoveDirSync(p, opt, ent2) && removedAll;
|
|
11575
11575
|
}
|
|
11576
11576
|
if (!removedAll) {
|
|
11577
11577
|
return false;
|
|
11578
11578
|
}
|
|
11579
|
-
if (opt.preserveRoot === false &&
|
|
11579
|
+
if (opt.preserveRoot === false && path31 === parse5(path31).root) {
|
|
11580
11580
|
return false;
|
|
11581
11581
|
}
|
|
11582
|
-
if (opt.filter && !opt.filter(
|
|
11582
|
+
if (opt.filter && !opt.filter(path31, ent)) {
|
|
11583
11583
|
return false;
|
|
11584
11584
|
}
|
|
11585
|
-
ignoreENOENTSync(() => tmpUnlinkSync(
|
|
11585
|
+
ignoreENOENTSync(() => tmpUnlinkSync(path31, tmp, rmdirSync));
|
|
11586
11586
|
return true;
|
|
11587
11587
|
};
|
|
11588
|
-
var tmpUnlinkSync = (
|
|
11589
|
-
const tmpFile = resolve6(tmp, uniqueFilename(
|
|
11590
|
-
renameSync(
|
|
11588
|
+
var tmpUnlinkSync = (path31, tmp, rmSync2) => {
|
|
11589
|
+
const tmpFile = resolve6(tmp, uniqueFilename(path31));
|
|
11590
|
+
renameSync(path31, tmpFile);
|
|
11591
11591
|
return rmSync2(tmpFile);
|
|
11592
11592
|
};
|
|
11593
11593
|
|
|
@@ -11597,31 +11597,31 @@ var rimrafWindowsFile = retryBusy(fixEPERM(unlink4));
|
|
|
11597
11597
|
var rimrafWindowsFileSync = retryBusySync(fixEPERMSync(unlinkSync));
|
|
11598
11598
|
var rimrafWindowsDirRetry = retryBusy(fixEPERM(rmdir4));
|
|
11599
11599
|
var rimrafWindowsDirRetrySync = retryBusySync(fixEPERMSync(rmdirSync));
|
|
11600
|
-
var rimrafWindowsDirMoveRemoveFallback = async (
|
|
11600
|
+
var rimrafWindowsDirMoveRemoveFallback = async (path31, opt) => {
|
|
11601
11601
|
if (opt?.signal?.aborted) {
|
|
11602
11602
|
throw opt.signal.reason;
|
|
11603
11603
|
}
|
|
11604
11604
|
const { filter: filter3, ...options } = opt;
|
|
11605
11605
|
try {
|
|
11606
|
-
return await rimrafWindowsDirRetry(
|
|
11606
|
+
return await rimrafWindowsDirRetry(path31, options);
|
|
11607
11607
|
} catch (er) {
|
|
11608
11608
|
if (er?.code === "ENOTEMPTY") {
|
|
11609
|
-
return await rimrafMoveRemove(
|
|
11609
|
+
return await rimrafMoveRemove(path31, options);
|
|
11610
11610
|
}
|
|
11611
11611
|
throw er;
|
|
11612
11612
|
}
|
|
11613
11613
|
};
|
|
11614
|
-
var rimrafWindowsDirMoveRemoveFallbackSync = (
|
|
11614
|
+
var rimrafWindowsDirMoveRemoveFallbackSync = (path31, opt) => {
|
|
11615
11615
|
if (opt?.signal?.aborted) {
|
|
11616
11616
|
throw opt.signal.reason;
|
|
11617
11617
|
}
|
|
11618
11618
|
const { filter: filter3, ...options } = opt;
|
|
11619
11619
|
try {
|
|
11620
|
-
return rimrafWindowsDirRetrySync(
|
|
11620
|
+
return rimrafWindowsDirRetrySync(path31, options);
|
|
11621
11621
|
} catch (er) {
|
|
11622
11622
|
const fer = er;
|
|
11623
11623
|
if (fer?.code === "ENOTEMPTY") {
|
|
11624
|
-
return rimrafMoveRemoveSync(
|
|
11624
|
+
return rimrafMoveRemoveSync(path31, options);
|
|
11625
11625
|
}
|
|
11626
11626
|
throw er;
|
|
11627
11627
|
}
|
|
@@ -11629,35 +11629,35 @@ var rimrafWindowsDirMoveRemoveFallbackSync = (path30, opt) => {
|
|
|
11629
11629
|
var START = Symbol("start");
|
|
11630
11630
|
var CHILD = Symbol("child");
|
|
11631
11631
|
var FINISH = Symbol("finish");
|
|
11632
|
-
var rimrafWindows = async (
|
|
11632
|
+
var rimrafWindows = async (path31, opt) => {
|
|
11633
11633
|
if (opt?.signal?.aborted) {
|
|
11634
11634
|
throw opt.signal.reason;
|
|
11635
11635
|
}
|
|
11636
11636
|
try {
|
|
11637
|
-
return await rimrafWindowsDir(
|
|
11637
|
+
return await rimrafWindowsDir(path31, opt, await lstat7(path31), START);
|
|
11638
11638
|
} catch (er) {
|
|
11639
11639
|
if (er?.code === "ENOENT")
|
|
11640
11640
|
return true;
|
|
11641
11641
|
throw er;
|
|
11642
11642
|
}
|
|
11643
11643
|
};
|
|
11644
|
-
var rimrafWindowsSync = (
|
|
11644
|
+
var rimrafWindowsSync = (path31, opt) => {
|
|
11645
11645
|
if (opt?.signal?.aborted) {
|
|
11646
11646
|
throw opt.signal.reason;
|
|
11647
11647
|
}
|
|
11648
11648
|
try {
|
|
11649
|
-
return rimrafWindowsDirSync(
|
|
11649
|
+
return rimrafWindowsDirSync(path31, opt, lstatSync2(path31), START);
|
|
11650
11650
|
} catch (er) {
|
|
11651
11651
|
if (er?.code === "ENOENT")
|
|
11652
11652
|
return true;
|
|
11653
11653
|
throw er;
|
|
11654
11654
|
}
|
|
11655
11655
|
};
|
|
11656
|
-
var rimrafWindowsDir = async (
|
|
11656
|
+
var rimrafWindowsDir = async (path31, opt, ent, state = START) => {
|
|
11657
11657
|
if (opt?.signal?.aborted) {
|
|
11658
11658
|
throw opt.signal.reason;
|
|
11659
11659
|
}
|
|
11660
|
-
const entries = ent.isDirectory() ? await readdirOrError(
|
|
11660
|
+
const entries = ent.isDirectory() ? await readdirOrError(path31) : null;
|
|
11661
11661
|
if (!Array.isArray(entries)) {
|
|
11662
11662
|
if (entries) {
|
|
11663
11663
|
if (entries.code === "ENOENT") {
|
|
@@ -11667,32 +11667,32 @@ var rimrafWindowsDir = async (path30, opt, ent, state = START) => {
|
|
|
11667
11667
|
throw entries;
|
|
11668
11668
|
}
|
|
11669
11669
|
}
|
|
11670
|
-
if (opt.filter && !await opt.filter(
|
|
11670
|
+
if (opt.filter && !await opt.filter(path31, ent)) {
|
|
11671
11671
|
return false;
|
|
11672
11672
|
}
|
|
11673
|
-
await ignoreENOENT(rimrafWindowsFile(
|
|
11673
|
+
await ignoreENOENT(rimrafWindowsFile(path31, opt));
|
|
11674
11674
|
return true;
|
|
11675
11675
|
}
|
|
11676
11676
|
const s = state === START ? CHILD : state;
|
|
11677
|
-
const removedAll = (await Promise.all(entries.map((ent2) => rimrafWindowsDir(resolve7(
|
|
11677
|
+
const removedAll = (await Promise.all(entries.map((ent2) => rimrafWindowsDir(resolve7(path31, ent2.name), opt, ent2, s)))).reduce((a, b) => a && b, true);
|
|
11678
11678
|
if (state === START) {
|
|
11679
|
-
return rimrafWindowsDir(
|
|
11679
|
+
return rimrafWindowsDir(path31, opt, ent, FINISH);
|
|
11680
11680
|
} else if (state === FINISH) {
|
|
11681
|
-
if (opt.preserveRoot === false &&
|
|
11681
|
+
if (opt.preserveRoot === false && path31 === parse6(path31).root) {
|
|
11682
11682
|
return false;
|
|
11683
11683
|
}
|
|
11684
11684
|
if (!removedAll) {
|
|
11685
11685
|
return false;
|
|
11686
11686
|
}
|
|
11687
|
-
if (opt.filter && !await opt.filter(
|
|
11687
|
+
if (opt.filter && !await opt.filter(path31, ent)) {
|
|
11688
11688
|
return false;
|
|
11689
11689
|
}
|
|
11690
|
-
await ignoreENOENT(rimrafWindowsDirMoveRemoveFallback(
|
|
11690
|
+
await ignoreENOENT(rimrafWindowsDirMoveRemoveFallback(path31, opt));
|
|
11691
11691
|
}
|
|
11692
11692
|
return true;
|
|
11693
11693
|
};
|
|
11694
|
-
var rimrafWindowsDirSync = (
|
|
11695
|
-
const entries = ent.isDirectory() ? readdirOrErrorSync(
|
|
11694
|
+
var rimrafWindowsDirSync = (path31, opt, ent, state = START) => {
|
|
11695
|
+
const entries = ent.isDirectory() ? readdirOrErrorSync(path31) : null;
|
|
11696
11696
|
if (!Array.isArray(entries)) {
|
|
11697
11697
|
if (entries) {
|
|
11698
11698
|
if (entries.code === "ENOENT") {
|
|
@@ -11702,32 +11702,32 @@ var rimrafWindowsDirSync = (path30, opt, ent, state = START) => {
|
|
|
11702
11702
|
throw entries;
|
|
11703
11703
|
}
|
|
11704
11704
|
}
|
|
11705
|
-
if (opt.filter && !opt.filter(
|
|
11705
|
+
if (opt.filter && !opt.filter(path31, ent)) {
|
|
11706
11706
|
return false;
|
|
11707
11707
|
}
|
|
11708
|
-
ignoreENOENTSync(() => rimrafWindowsFileSync(
|
|
11708
|
+
ignoreENOENTSync(() => rimrafWindowsFileSync(path31, opt));
|
|
11709
11709
|
return true;
|
|
11710
11710
|
}
|
|
11711
11711
|
let removedAll = true;
|
|
11712
11712
|
for (const ent2 of entries) {
|
|
11713
11713
|
const s = state === START ? CHILD : state;
|
|
11714
|
-
const p = resolve7(
|
|
11714
|
+
const p = resolve7(path31, ent2.name);
|
|
11715
11715
|
removedAll = rimrafWindowsDirSync(p, opt, ent2, s) && removedAll;
|
|
11716
11716
|
}
|
|
11717
11717
|
if (state === START) {
|
|
11718
|
-
return rimrafWindowsDirSync(
|
|
11718
|
+
return rimrafWindowsDirSync(path31, opt, ent, FINISH);
|
|
11719
11719
|
} else if (state === FINISH) {
|
|
11720
|
-
if (opt.preserveRoot === false &&
|
|
11720
|
+
if (opt.preserveRoot === false && path31 === parse6(path31).root) {
|
|
11721
11721
|
return false;
|
|
11722
11722
|
}
|
|
11723
11723
|
if (!removedAll) {
|
|
11724
11724
|
return false;
|
|
11725
11725
|
}
|
|
11726
|
-
if (opt.filter && !opt.filter(
|
|
11726
|
+
if (opt.filter && !opt.filter(path31, ent)) {
|
|
11727
11727
|
return false;
|
|
11728
11728
|
}
|
|
11729
11729
|
ignoreENOENTSync(() => {
|
|
11730
|
-
rimrafWindowsDirMoveRemoveFallbackSync(
|
|
11730
|
+
rimrafWindowsDirMoveRemoveFallbackSync(path31, opt);
|
|
11731
11731
|
});
|
|
11732
11732
|
}
|
|
11733
11733
|
return true;
|
|
@@ -11740,16 +11740,16 @@ var rimrafManualSync = platform_default === "win32" ? rimrafWindowsSync : rimraf
|
|
|
11740
11740
|
// ../../node_modules/.pnpm/rimraf@6.0.1/node_modules/rimraf/dist/esm/rimraf-native.js
|
|
11741
11741
|
init_esm_shims();
|
|
11742
11742
|
var { rm: rm2 } = promises;
|
|
11743
|
-
var rimrafNative = async (
|
|
11744
|
-
await rm2(
|
|
11743
|
+
var rimrafNative = async (path31, opt) => {
|
|
11744
|
+
await rm2(path31, {
|
|
11745
11745
|
...opt,
|
|
11746
11746
|
force: true,
|
|
11747
11747
|
recursive: true
|
|
11748
11748
|
});
|
|
11749
11749
|
return true;
|
|
11750
11750
|
};
|
|
11751
|
-
var rimrafNativeSync = (
|
|
11752
|
-
rmSync(
|
|
11751
|
+
var rimrafNativeSync = (path31, opt) => {
|
|
11752
|
+
rmSync(path31, {
|
|
11753
11753
|
...opt,
|
|
11754
11754
|
force: true,
|
|
11755
11755
|
recursive: true
|
|
@@ -11767,26 +11767,26 @@ var useNative = !hasNative || platform_default === "win32" ? () => false : (opt)
|
|
|
11767
11767
|
var useNativeSync = !hasNative || platform_default === "win32" ? () => false : (opt) => !opt?.signal && !opt?.filter;
|
|
11768
11768
|
|
|
11769
11769
|
// ../../node_modules/.pnpm/rimraf@6.0.1/node_modules/rimraf/dist/esm/index.js
|
|
11770
|
-
var wrap = (fn) => async (
|
|
11770
|
+
var wrap = (fn) => async (path31, opt) => {
|
|
11771
11771
|
const options = optArg(opt);
|
|
11772
11772
|
if (options.glob) {
|
|
11773
|
-
|
|
11773
|
+
path31 = await glob(path31, options.glob);
|
|
11774
11774
|
}
|
|
11775
|
-
if (Array.isArray(
|
|
11776
|
-
return !!(await Promise.all(
|
|
11775
|
+
if (Array.isArray(path31)) {
|
|
11776
|
+
return !!(await Promise.all(path31.map((p) => fn(path_arg_default(p, options), options)))).reduce((a, b) => a && b, true);
|
|
11777
11777
|
} else {
|
|
11778
|
-
return !!await fn(path_arg_default(
|
|
11778
|
+
return !!await fn(path_arg_default(path31, options), options);
|
|
11779
11779
|
}
|
|
11780
11780
|
};
|
|
11781
|
-
var wrapSync = (fn) => (
|
|
11781
|
+
var wrapSync = (fn) => (path31, opt) => {
|
|
11782
11782
|
const options = optArgSync(opt);
|
|
11783
11783
|
if (options.glob) {
|
|
11784
|
-
|
|
11784
|
+
path31 = globSync(path31, options.glob);
|
|
11785
11785
|
}
|
|
11786
|
-
if (Array.isArray(
|
|
11787
|
-
return !!
|
|
11786
|
+
if (Array.isArray(path31)) {
|
|
11787
|
+
return !!path31.map((p) => fn(path_arg_default(p, options), options)).reduce((a, b) => a && b, true);
|
|
11788
11788
|
} else {
|
|
11789
|
-
return !!fn(path_arg_default(
|
|
11789
|
+
return !!fn(path_arg_default(path31, options), options);
|
|
11790
11790
|
}
|
|
11791
11791
|
};
|
|
11792
11792
|
var nativeSync = wrapSync(rimrafNativeSync);
|
|
@@ -11801,8 +11801,8 @@ var moveRemoveSync = wrapSync(rimrafMoveRemoveSync);
|
|
|
11801
11801
|
var moveRemove = Object.assign(wrap(rimrafMoveRemove), {
|
|
11802
11802
|
sync: moveRemoveSync
|
|
11803
11803
|
});
|
|
11804
|
-
var rimrafSync = wrapSync((
|
|
11805
|
-
var rimraf_ = wrap((
|
|
11804
|
+
var rimrafSync = wrapSync((path31, opt) => useNativeSync(opt) ? rimrafNativeSync(path31, opt) : rimrafManualSync(path31, opt));
|
|
11805
|
+
var rimraf_ = wrap((path31, opt) => useNative(opt) ? rimrafNative(path31, opt) : rimrafManual(path31, opt));
|
|
11806
11806
|
var rimraf = Object.assign(rimraf_, {
|
|
11807
11807
|
rimraf: rimraf_,
|
|
11808
11808
|
sync: rimrafSync,
|
|
@@ -11822,10 +11822,258 @@ rimraf.rimraf = rimraf;
|
|
|
11822
11822
|
|
|
11823
11823
|
// src/runtime/buildPlugin.ts
|
|
11824
11824
|
import { build } from "vite";
|
|
11825
|
-
|
|
11825
|
+
|
|
11826
|
+
// src/runtime/advancedChunks.ts
|
|
11827
|
+
init_esm_shims();
|
|
11828
|
+
|
|
11829
|
+
// src/runtime/chunkStrategy.ts
|
|
11830
|
+
init_esm_shims();
|
|
11831
|
+
import { posix as path10 } from "pathe";
|
|
11832
|
+
var SHARED_CHUNK_VIRTUAL_PREFIX = "__weapp_shared__";
|
|
11833
|
+
var SUB_PACKAGE_SHARED_DIR = "__shared__";
|
|
11834
|
+
var DEFAULT_SHARED_CHUNK_STRATEGY = "duplicate";
|
|
11835
|
+
function resolveSharedChunkName(options) {
|
|
11836
|
+
const {
|
|
11837
|
+
id,
|
|
11838
|
+
ctx,
|
|
11839
|
+
relativeAbsoluteSrcRoot,
|
|
11840
|
+
subPackageRoots,
|
|
11841
|
+
strategy
|
|
11842
|
+
} = options;
|
|
11843
|
+
const moduleInfo = ctx.getModuleInfo(id);
|
|
11844
|
+
if (!moduleInfo?.importers || moduleInfo.importers.length <= 1) {
|
|
11845
|
+
return void 0;
|
|
11846
|
+
}
|
|
11847
|
+
const summary = summarizeImportPrefixes({
|
|
11848
|
+
importers: moduleInfo.importers,
|
|
11849
|
+
relativeAbsoluteSrcRoot,
|
|
11850
|
+
subPackageRoots: Array.from(subPackageRoots)
|
|
11851
|
+
});
|
|
11852
|
+
const keys = Object.keys(summary);
|
|
11853
|
+
if (keys.length === 0) {
|
|
11854
|
+
return void 0;
|
|
11855
|
+
}
|
|
11856
|
+
if (keys.length === 1) {
|
|
11857
|
+
const prefix = keys[0];
|
|
11858
|
+
return prefix ? path10.join(prefix, "common") : "common";
|
|
11859
|
+
}
|
|
11860
|
+
const hasMainImporter = keys.includes("");
|
|
11861
|
+
if (strategy === "duplicate" && !hasMainImporter) {
|
|
11862
|
+
const combination = keys.filter(Boolean).sort().join("+");
|
|
11863
|
+
const combinationSegment = combination ? `${combination}/` : "";
|
|
11864
|
+
return `${SHARED_CHUNK_VIRTUAL_PREFIX}/${combinationSegment}common`;
|
|
11865
|
+
}
|
|
11866
|
+
return "common";
|
|
11867
|
+
}
|
|
11868
|
+
function summarizeImportPrefixes(options) {
|
|
11869
|
+
const { importers, relativeAbsoluteSrcRoot, subPackageRoots } = options;
|
|
11870
|
+
const summary = {};
|
|
11871
|
+
for (const importer of importers) {
|
|
11872
|
+
const relPath = relativeAbsoluteSrcRoot(importer);
|
|
11873
|
+
const prefix = resolveSubPackagePrefix(relPath, subPackageRoots);
|
|
11874
|
+
summary[prefix] = (summary[prefix] || 0) + 1;
|
|
11875
|
+
}
|
|
11876
|
+
return summary;
|
|
11877
|
+
}
|
|
11878
|
+
function resolveSubPackagePrefix(fileName, subPackageRoots) {
|
|
11879
|
+
for (const root of subPackageRoots) {
|
|
11880
|
+
if (!root) {
|
|
11881
|
+
continue;
|
|
11882
|
+
}
|
|
11883
|
+
if (fileName === root || fileName.startsWith(`${root}/`)) {
|
|
11884
|
+
return root;
|
|
11885
|
+
}
|
|
11886
|
+
}
|
|
11887
|
+
return "";
|
|
11888
|
+
}
|
|
11889
|
+
function applySharedChunkStrategy(bundle, options) {
|
|
11890
|
+
if (options.strategy !== "duplicate") {
|
|
11891
|
+
return;
|
|
11892
|
+
}
|
|
11893
|
+
if (!this) {
|
|
11894
|
+
throw new Error("applySharedChunkStrategy requires plugin context");
|
|
11895
|
+
}
|
|
11896
|
+
const subPackageRoots = Array.from(options.subPackageRoots).filter(Boolean);
|
|
11897
|
+
const entries = Object.entries(bundle);
|
|
11898
|
+
for (const [fileName, output] of entries) {
|
|
11899
|
+
if (!isSharedVirtualChunk(fileName, output)) {
|
|
11900
|
+
continue;
|
|
11901
|
+
}
|
|
11902
|
+
const chunk = output;
|
|
11903
|
+
const originalCode = chunk.code;
|
|
11904
|
+
const originalMap = chunk.map;
|
|
11905
|
+
const importers = findChunkImporters(bundle, fileName);
|
|
11906
|
+
if (importers.length === 0) {
|
|
11907
|
+
continue;
|
|
11908
|
+
}
|
|
11909
|
+
const importerMap = /* @__PURE__ */ new Map();
|
|
11910
|
+
let hasMainImporter = false;
|
|
11911
|
+
for (const importerFile of importers) {
|
|
11912
|
+
const root = resolveSubPackagePrefix(importerFile, subPackageRoots);
|
|
11913
|
+
if (!root) {
|
|
11914
|
+
hasMainImporter = true;
|
|
11915
|
+
break;
|
|
11916
|
+
}
|
|
11917
|
+
const duplicateBaseName = path10.basename(fileName);
|
|
11918
|
+
const intendedFileName = path10.join(root, SUB_PACKAGE_SHARED_DIR, duplicateBaseName);
|
|
11919
|
+
const uniqueFileName = ensureUniqueFileName(bundle, intendedFileName);
|
|
11920
|
+
const existing = importerMap.get(root);
|
|
11921
|
+
if (existing) {
|
|
11922
|
+
existing.importers.push(importerFile);
|
|
11923
|
+
} else {
|
|
11924
|
+
importerMap.set(root, {
|
|
11925
|
+
newFileName: uniqueFileName,
|
|
11926
|
+
importers: [importerFile]
|
|
11927
|
+
});
|
|
11928
|
+
}
|
|
11929
|
+
}
|
|
11930
|
+
if (hasMainImporter || importerMap.size === 0) {
|
|
11931
|
+
if (fileName.startsWith(`${SHARED_CHUNK_VIRTUAL_PREFIX}/`)) {
|
|
11932
|
+
const newFileName = fileName.slice(SHARED_CHUNK_VIRTUAL_PREFIX.length + 1);
|
|
11933
|
+
chunk.fileName = newFileName;
|
|
11934
|
+
}
|
|
11935
|
+
continue;
|
|
11936
|
+
}
|
|
11937
|
+
const importerToChunk = /* @__PURE__ */ new Map();
|
|
11938
|
+
for (const { newFileName, importers: importerFiles } of importerMap.values()) {
|
|
11939
|
+
this.emitFile({
|
|
11940
|
+
type: "asset",
|
|
11941
|
+
fileName: newFileName,
|
|
11942
|
+
source: originalCode
|
|
11943
|
+
});
|
|
11944
|
+
if (originalMap) {
|
|
11945
|
+
this.emitFile({
|
|
11946
|
+
type: "asset",
|
|
11947
|
+
fileName: `${newFileName}.map`,
|
|
11948
|
+
source: typeof originalMap === "string" ? originalMap : JSON.stringify(originalMap)
|
|
11949
|
+
});
|
|
11950
|
+
}
|
|
11951
|
+
for (const importerFile of importerFiles) {
|
|
11952
|
+
importerToChunk.set(importerFile, newFileName);
|
|
11953
|
+
}
|
|
11954
|
+
}
|
|
11955
|
+
updateImporters(bundle, importerToChunk, fileName);
|
|
11956
|
+
chunk.code = "// duplicated into sub-packages via weapp-vite chunk strategy\n";
|
|
11957
|
+
chunk.map = null;
|
|
11958
|
+
chunk.sourcemapFileName = null;
|
|
11959
|
+
chunk.imports = [];
|
|
11960
|
+
chunk.dynamicImports = [];
|
|
11961
|
+
chunk.exports = [];
|
|
11962
|
+
chunk.moduleIds = [];
|
|
11963
|
+
chunk.modules = {};
|
|
11964
|
+
}
|
|
11965
|
+
}
|
|
11966
|
+
function isSharedVirtualChunk(fileName, output) {
|
|
11967
|
+
return output?.type === "chunk" && fileName.startsWith(`${SHARED_CHUNK_VIRTUAL_PREFIX}/`);
|
|
11968
|
+
}
|
|
11969
|
+
function findChunkImporters(bundle, target) {
|
|
11970
|
+
const importers = /* @__PURE__ */ new Set();
|
|
11971
|
+
for (const [fileName, output] of Object.entries(bundle)) {
|
|
11972
|
+
if (output?.type !== "chunk") {
|
|
11973
|
+
continue;
|
|
11974
|
+
}
|
|
11975
|
+
const chunk = output;
|
|
11976
|
+
if (chunk.imports.includes(target) || chunk.dynamicImports.includes(target)) {
|
|
11977
|
+
importers.add(fileName);
|
|
11978
|
+
}
|
|
11979
|
+
}
|
|
11980
|
+
return Array.from(importers);
|
|
11981
|
+
}
|
|
11982
|
+
function ensureUniqueFileName(bundle, fileName) {
|
|
11983
|
+
if (!bundle[fileName]) {
|
|
11984
|
+
return fileName;
|
|
11985
|
+
}
|
|
11986
|
+
const { dir, name, ext: ext2 } = path10.parse(fileName);
|
|
11987
|
+
let index = 1;
|
|
11988
|
+
let candidate = fileName;
|
|
11989
|
+
while (bundle[candidate]) {
|
|
11990
|
+
const nextName = `${name}.${index}`;
|
|
11991
|
+
candidate = dir ? path10.join(dir, `${nextName}${ext2}`) : `${nextName}${ext2}`;
|
|
11992
|
+
index++;
|
|
11993
|
+
}
|
|
11994
|
+
return candidate;
|
|
11995
|
+
}
|
|
11996
|
+
function updateImporters(bundle, importerToChunk, originalFileName) {
|
|
11997
|
+
for (const [importerFile, newChunkFile] of importerToChunk.entries()) {
|
|
11998
|
+
const importer = bundle[importerFile];
|
|
11999
|
+
if (!importer || importer.type !== "chunk") {
|
|
12000
|
+
continue;
|
|
12001
|
+
}
|
|
12002
|
+
const importerChunk = importer;
|
|
12003
|
+
const originalImportPath = createRelativeImport(importerFile, originalFileName);
|
|
12004
|
+
const newImportPath = createRelativeImport(importerFile, newChunkFile);
|
|
12005
|
+
if (originalImportPath !== newImportPath) {
|
|
12006
|
+
importerChunk.code = replaceAll(importerChunk.code, originalImportPath, newImportPath);
|
|
12007
|
+
}
|
|
12008
|
+
importerChunk.imports = replaceInArray(importerChunk.imports, originalFileName, newChunkFile);
|
|
12009
|
+
importerChunk.dynamicImports = replaceInArray(importerChunk.dynamicImports, originalFileName, newChunkFile);
|
|
12010
|
+
}
|
|
12011
|
+
}
|
|
12012
|
+
function replaceAll(source, searchValue, replaceValue) {
|
|
12013
|
+
if (!searchValue) {
|
|
12014
|
+
return source;
|
|
12015
|
+
}
|
|
12016
|
+
if (source.includes(searchValue)) {
|
|
12017
|
+
return source.split(searchValue).join(replaceValue);
|
|
12018
|
+
}
|
|
12019
|
+
if (searchValue.startsWith("./") && replaceValue.startsWith("./")) {
|
|
12020
|
+
const trimmedSearch = searchValue.slice(2);
|
|
12021
|
+
const trimmedReplace = replaceValue.slice(2);
|
|
12022
|
+
if (trimmedSearch && source.includes(trimmedSearch)) {
|
|
12023
|
+
return source.split(trimmedSearch).join(trimmedReplace);
|
|
12024
|
+
}
|
|
12025
|
+
}
|
|
12026
|
+
return source;
|
|
12027
|
+
}
|
|
12028
|
+
function replaceInArray(list, searchValue, replaceValue) {
|
|
12029
|
+
return list.map((value) => {
|
|
12030
|
+
return value === searchValue ? replaceValue : value;
|
|
12031
|
+
});
|
|
12032
|
+
}
|
|
12033
|
+
function createRelativeImport(fromFile, toFile) {
|
|
12034
|
+
const relative3 = path10.relative(path10.dirname(fromFile), toFile);
|
|
12035
|
+
if (!relative3 || relative3.startsWith(".")) {
|
|
12036
|
+
return relative3 || "./";
|
|
12037
|
+
}
|
|
12038
|
+
return `./${relative3}`;
|
|
12039
|
+
}
|
|
12040
|
+
|
|
12041
|
+
// src/runtime/advancedChunks.ts
|
|
11826
12042
|
function testByReg2DExpList(reg2DExpList) {
|
|
11827
|
-
return (id) => reg2DExpList.some((regExpList) => regExpList.some((regExp) =>
|
|
12043
|
+
return (id) => reg2DExpList.some((regExpList) => regExpList.some((regExp) => {
|
|
12044
|
+
regExp.lastIndex = 0;
|
|
12045
|
+
return regExp.test(id);
|
|
12046
|
+
}));
|
|
11828
12047
|
}
|
|
12048
|
+
function createAdvancedChunkNameResolver(options) {
|
|
12049
|
+
const {
|
|
12050
|
+
relativeAbsoluteSrcRoot,
|
|
12051
|
+
getSubPackageRoots,
|
|
12052
|
+
strategy,
|
|
12053
|
+
vendorsMatchers
|
|
12054
|
+
} = options;
|
|
12055
|
+
const isVendor = testByReg2DExpList(vendorsMatchers);
|
|
12056
|
+
return (id, ctx) => {
|
|
12057
|
+
const subPackageRoots = Array.from(getSubPackageRoots());
|
|
12058
|
+
const sharedName = resolveSharedChunkName({
|
|
12059
|
+
id,
|
|
12060
|
+
ctx,
|
|
12061
|
+
relativeAbsoluteSrcRoot,
|
|
12062
|
+
subPackageRoots,
|
|
12063
|
+
strategy
|
|
12064
|
+
});
|
|
12065
|
+
if (!isVendor(id)) {
|
|
12066
|
+
return sharedName;
|
|
12067
|
+
}
|
|
12068
|
+
if (strategy === "hoist") {
|
|
12069
|
+
return "vendors";
|
|
12070
|
+
}
|
|
12071
|
+
return sharedName;
|
|
12072
|
+
};
|
|
12073
|
+
}
|
|
12074
|
+
|
|
12075
|
+
// src/runtime/buildPlugin.ts
|
|
12076
|
+
var REG_NODE_MODULES_DIR = /[\\/]node_modules[\\/]/gi;
|
|
11829
12077
|
function createBuildService(ctx) {
|
|
11830
12078
|
function assertRuntimeServices(target) {
|
|
11831
12079
|
if (!target.configService || !target.watcherService || !target.npmService || !target.scanService) {
|
|
@@ -11863,6 +12111,13 @@ function createBuildService(ctx) {
|
|
|
11863
12111
|
function sharedBuildConfig() {
|
|
11864
12112
|
const nodeModulesDeps = [REG_NODE_MODULES_DIR];
|
|
11865
12113
|
const commonjsHelpersDeps = [/commonjsHelpers\.js$/];
|
|
12114
|
+
const sharedStrategy = configService.weappViteConfig?.chunks?.sharedStrategy ?? DEFAULT_SHARED_CHUNK_STRATEGY;
|
|
12115
|
+
const resolveAdvancedChunkName = createAdvancedChunkNameResolver({
|
|
12116
|
+
vendorsMatchers: [nodeModulesDeps, commonjsHelpersDeps],
|
|
12117
|
+
relativeAbsoluteSrcRoot: configService.relativeAbsoluteSrcRoot,
|
|
12118
|
+
getSubPackageRoots: () => scanService.subPackageMap.keys(),
|
|
12119
|
+
strategy: sharedStrategy
|
|
12120
|
+
});
|
|
11866
12121
|
return {
|
|
11867
12122
|
build: {
|
|
11868
12123
|
rolldownOptions: {
|
|
@@ -11870,28 +12125,7 @@ function createBuildService(ctx) {
|
|
|
11870
12125
|
advancedChunks: {
|
|
11871
12126
|
groups: [
|
|
11872
12127
|
{
|
|
11873
|
-
name: (id, ctxPlugin) =>
|
|
11874
|
-
REG_NODE_MODULES_DIR.lastIndex = 0;
|
|
11875
|
-
if (testByReg2DExpList([nodeModulesDeps, commonjsHelpersDeps])(id)) {
|
|
11876
|
-
return "vendors";
|
|
11877
|
-
}
|
|
11878
|
-
const moduleInfo = ctxPlugin.getModuleInfo(id);
|
|
11879
|
-
if (moduleInfo?.importers?.length && moduleInfo.importers.length > 1) {
|
|
11880
|
-
const summary = moduleInfo.importers.reduce((acc, cur) => {
|
|
11881
|
-
const relPath = configService.relativeAbsoluteSrcRoot(cur);
|
|
11882
|
-
const prefix2 = [
|
|
11883
|
-
...scanService.subPackageMap.keys()
|
|
11884
|
-
].find(
|
|
11885
|
-
(x) => relPath.startsWith(x)
|
|
11886
|
-
) ?? "";
|
|
11887
|
-
acc[prefix2] = (acc[prefix2] || 0) + 1;
|
|
11888
|
-
return acc;
|
|
11889
|
-
}, {});
|
|
11890
|
-
const summaryKeys = Object.keys(summary);
|
|
11891
|
-
const prefix = summaryKeys.length === 1 ? summaryKeys[0] : "";
|
|
11892
|
-
return path10.join(prefix, "common");
|
|
11893
|
-
}
|
|
11894
|
-
}
|
|
12128
|
+
name: (id, ctxPlugin) => resolveAdvancedChunkName(id, ctxPlugin)
|
|
11895
12129
|
}
|
|
11896
12130
|
]
|
|
11897
12131
|
},
|
|
@@ -11915,7 +12149,7 @@ function createBuildService(ctx) {
|
|
|
11915
12149
|
if (hasWorkersDir && workersDir) {
|
|
11916
12150
|
devWorkers(workersDir);
|
|
11917
12151
|
if (!isTestEnv) {
|
|
11918
|
-
const absWorkerRoot =
|
|
12152
|
+
const absWorkerRoot = path11.resolve(configService.absoluteSrcRoot, workersDir);
|
|
11919
12153
|
const watcher2 = esm_default.watch(
|
|
11920
12154
|
absWorkerRoot,
|
|
11921
12155
|
{
|
|
@@ -11973,8 +12207,8 @@ function createBuildService(ctx) {
|
|
|
11973
12207
|
if (configService.mpDistRoot) {
|
|
11974
12208
|
const deletedFilePaths = await rimraf(
|
|
11975
12209
|
[
|
|
11976
|
-
|
|
11977
|
-
|
|
12210
|
+
path11.resolve(configService.outDir, "*"),
|
|
12211
|
+
path11.resolve(configService.outDir, ".*")
|
|
11978
12212
|
],
|
|
11979
12213
|
{
|
|
11980
12214
|
glob: true,
|
|
@@ -12045,7 +12279,7 @@ import fs17 from "fs-extra";
|
|
|
12045
12279
|
init_esm_shims();
|
|
12046
12280
|
import fs8 from "fs";
|
|
12047
12281
|
import { createRequire as createRequire2 } from "module";
|
|
12048
|
-
import
|
|
12282
|
+
import path13, { dirname as dirname4, join as join3, win32 as win322 } from "path";
|
|
12049
12283
|
import process4 from "process";
|
|
12050
12284
|
import fsPromises from "fs/promises";
|
|
12051
12285
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
@@ -17685,17 +17919,17 @@ function withTrailingSlash(input = "", respectQueryAndFragment) {
|
|
|
17685
17919
|
if (hasTrailingSlash(input, true)) {
|
|
17686
17920
|
return input || "/";
|
|
17687
17921
|
}
|
|
17688
|
-
let
|
|
17922
|
+
let path31 = input;
|
|
17689
17923
|
let fragment = "";
|
|
17690
17924
|
const fragmentIndex = input.indexOf("#");
|
|
17691
17925
|
if (fragmentIndex !== -1) {
|
|
17692
|
-
|
|
17926
|
+
path31 = input.slice(0, fragmentIndex);
|
|
17693
17927
|
fragment = input.slice(fragmentIndex);
|
|
17694
|
-
if (!
|
|
17928
|
+
if (!path31) {
|
|
17695
17929
|
return fragment;
|
|
17696
17930
|
}
|
|
17697
17931
|
}
|
|
17698
|
-
const [s0, ...s] =
|
|
17932
|
+
const [s0, ...s] = path31.split("?");
|
|
17699
17933
|
return s0 + "/" + (s.length > 0 ? `?${s.join("?")}` : "") + fragment;
|
|
17700
17934
|
}
|
|
17701
17935
|
function isNonEmptyURL(url) {
|
|
@@ -17720,12 +17954,12 @@ import { normalize as normalize3, isAbsolute as isAbsolute2, extname as extname$
|
|
|
17720
17954
|
import { fileURLToPath as fileURLToPath$1, URL as URL$1, pathToFileURL as pathToFileURL$1 } from "url";
|
|
17721
17955
|
import assert from "assert";
|
|
17722
17956
|
import process$1 from "process";
|
|
17723
|
-
import
|
|
17957
|
+
import path12, { dirname as dirname3 } from "path";
|
|
17724
17958
|
import v8 from "v8";
|
|
17725
17959
|
import { format, inspect as inspect2 } from "util";
|
|
17726
17960
|
var BUILTIN_MODULES = new Set(builtinModules);
|
|
17727
|
-
function normalizeSlash(
|
|
17728
|
-
return
|
|
17961
|
+
function normalizeSlash(path31) {
|
|
17962
|
+
return path31.replace(/\\/g, "/");
|
|
17729
17963
|
}
|
|
17730
17964
|
var own$1 = {}.hasOwnProperty;
|
|
17731
17965
|
var classRegExp = /^([A-Z][a-z\d]*)+$/;
|
|
@@ -17838,8 +18072,8 @@ codes2.ERR_INVALID_PACKAGE_CONFIG = createError(
|
|
|
17838
18072
|
* @param {string} [base]
|
|
17839
18073
|
* @param {string} [message]
|
|
17840
18074
|
*/
|
|
17841
|
-
(
|
|
17842
|
-
return `Invalid package config ${
|
|
18075
|
+
(path31, base, message) => {
|
|
18076
|
+
return `Invalid package config ${path31}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
|
|
17843
18077
|
},
|
|
17844
18078
|
Error
|
|
17845
18079
|
);
|
|
@@ -17871,8 +18105,8 @@ codes2.ERR_MODULE_NOT_FOUND = createError(
|
|
|
17871
18105
|
* @param {string} base
|
|
17872
18106
|
* @param {boolean} [exactUrl]
|
|
17873
18107
|
*/
|
|
17874
|
-
(
|
|
17875
|
-
return `Cannot find ${exactUrl ? "module" : "package"} '${
|
|
18108
|
+
(path31, base, exactUrl = false) => {
|
|
18109
|
+
return `Cannot find ${exactUrl ? "module" : "package"} '${path31}' imported from ${base}`;
|
|
17876
18110
|
},
|
|
17877
18111
|
Error
|
|
17878
18112
|
);
|
|
@@ -17923,8 +18157,8 @@ codes2.ERR_UNKNOWN_FILE_EXTENSION = createError(
|
|
|
17923
18157
|
* @param {string} extension
|
|
17924
18158
|
* @param {string} path
|
|
17925
18159
|
*/
|
|
17926
|
-
(extension,
|
|
17927
|
-
return `Unknown file extension "${extension}" for ${
|
|
18160
|
+
(extension, path31) => {
|
|
18161
|
+
return `Unknown file extension "${extension}" for ${path31}`;
|
|
17928
18162
|
},
|
|
17929
18163
|
TypeError
|
|
17930
18164
|
);
|
|
@@ -18069,7 +18303,7 @@ function read(jsonPath, { base, specifier }) {
|
|
|
18069
18303
|
}
|
|
18070
18304
|
let string;
|
|
18071
18305
|
try {
|
|
18072
|
-
string = fs7.readFileSync(
|
|
18306
|
+
string = fs7.readFileSync(path12.toNamespacedPath(jsonPath), "utf8");
|
|
18073
18307
|
} catch (error) {
|
|
18074
18308
|
const exception = (
|
|
18075
18309
|
/** @type {ErrnoException} */
|
|
@@ -18284,7 +18518,7 @@ Default "index" lookups for the main are deprecated for ES modules.`,
|
|
|
18284
18518
|
"DeprecationWarning",
|
|
18285
18519
|
"DEP0151"
|
|
18286
18520
|
);
|
|
18287
|
-
} else if (
|
|
18521
|
+
} else if (path12.resolve(packagePath, main) !== urlPath) {
|
|
18288
18522
|
process$1.emitWarning(
|
|
18289
18523
|
`Package ${packagePath} has a "main" field set to "${main}", excluding the full filename and extension to the resolved file at "${urlPath.slice(
|
|
18290
18524
|
packagePath.length
|
|
@@ -18295,9 +18529,9 @@ Default "index" lookups for the main are deprecated for ES modules.`,
|
|
|
18295
18529
|
);
|
|
18296
18530
|
}
|
|
18297
18531
|
}
|
|
18298
|
-
function tryStatSync(
|
|
18532
|
+
function tryStatSync(path31) {
|
|
18299
18533
|
try {
|
|
18300
|
-
return statSync2(
|
|
18534
|
+
return statSync2(path31);
|
|
18301
18535
|
} catch {
|
|
18302
18536
|
}
|
|
18303
18537
|
}
|
|
@@ -18391,7 +18625,7 @@ function finalizeResolution(resolved, base, preserveSymlinks) {
|
|
|
18391
18625
|
{
|
|
18392
18626
|
const real = realpathSync2(filePath);
|
|
18393
18627
|
const { search, hash } = resolved;
|
|
18394
|
-
resolved = pathToFileURL$1(real + (filePath.endsWith(
|
|
18628
|
+
resolved = pathToFileURL$1(real + (filePath.endsWith(path12.sep) ? "/" : ""));
|
|
18395
18629
|
resolved.search = search;
|
|
18396
18630
|
resolved.hash = hash;
|
|
18397
18631
|
}
|
|
@@ -19173,12 +19407,12 @@ async function findUp$1(name, {
|
|
|
19173
19407
|
type = "file",
|
|
19174
19408
|
stopAt
|
|
19175
19409
|
} = {}) {
|
|
19176
|
-
let directory =
|
|
19177
|
-
const { root } =
|
|
19178
|
-
stopAt =
|
|
19179
|
-
const isAbsoluteName =
|
|
19410
|
+
let directory = path13.resolve(toPath(cwd) ?? "");
|
|
19411
|
+
const { root } = path13.parse(directory);
|
|
19412
|
+
stopAt = path13.resolve(directory, toPath(stopAt ?? root));
|
|
19413
|
+
const isAbsoluteName = path13.isAbsolute(name);
|
|
19180
19414
|
while (directory) {
|
|
19181
|
-
const filePath = isAbsoluteName ? name :
|
|
19415
|
+
const filePath = isAbsoluteName ? name : path13.join(directory, name);
|
|
19182
19416
|
try {
|
|
19183
19417
|
const stats = await fsPromises.stat(filePath);
|
|
19184
19418
|
if (type === "file" && stats.isFile() || type === "directory" && stats.isDirectory()) {
|
|
@@ -19189,7 +19423,7 @@ async function findUp$1(name, {
|
|
|
19189
19423
|
if (directory === stopAt || directory === root) {
|
|
19190
19424
|
break;
|
|
19191
19425
|
}
|
|
19192
|
-
directory =
|
|
19426
|
+
directory = path13.dirname(directory);
|
|
19193
19427
|
}
|
|
19194
19428
|
}
|
|
19195
19429
|
function findUpSync(name, {
|
|
@@ -19197,12 +19431,12 @@ function findUpSync(name, {
|
|
|
19197
19431
|
type = "file",
|
|
19198
19432
|
stopAt
|
|
19199
19433
|
} = {}) {
|
|
19200
|
-
let directory =
|
|
19201
|
-
const { root } =
|
|
19202
|
-
stopAt =
|
|
19203
|
-
const isAbsoluteName =
|
|
19434
|
+
let directory = path13.resolve(toPath(cwd) ?? "");
|
|
19435
|
+
const { root } = path13.parse(directory);
|
|
19436
|
+
stopAt = path13.resolve(directory, toPath(stopAt) ?? root);
|
|
19437
|
+
const isAbsoluteName = path13.isAbsolute(name);
|
|
19204
19438
|
while (directory) {
|
|
19205
|
-
const filePath = isAbsoluteName ? name :
|
|
19439
|
+
const filePath = isAbsoluteName ? name : path13.join(directory, name);
|
|
19206
19440
|
try {
|
|
19207
19441
|
const stats = fs8.statSync(filePath, { throwIfNoEntry: false });
|
|
19208
19442
|
if (type === "file" && stats?.isFile() || type === "directory" && stats?.isDirectory()) {
|
|
@@ -19213,10 +19447,10 @@ function findUpSync(name, {
|
|
|
19213
19447
|
if (directory === stopAt || directory === root) {
|
|
19214
19448
|
break;
|
|
19215
19449
|
}
|
|
19216
|
-
directory =
|
|
19450
|
+
directory = path13.dirname(directory);
|
|
19217
19451
|
}
|
|
19218
19452
|
}
|
|
19219
|
-
function _resolve2(
|
|
19453
|
+
function _resolve2(path31, options = {}) {
|
|
19220
19454
|
if (options.platform === "auto" || !options.platform)
|
|
19221
19455
|
options.platform = process4.platform === "win32" ? "win32" : "posix";
|
|
19222
19456
|
if (process4.versions.pnp) {
|
|
@@ -19225,11 +19459,11 @@ function _resolve2(path30, options = {}) {
|
|
|
19225
19459
|
paths.push(process4.cwd());
|
|
19226
19460
|
const targetRequire = createRequire2(import.meta.url);
|
|
19227
19461
|
try {
|
|
19228
|
-
return targetRequire.resolve(
|
|
19462
|
+
return targetRequire.resolve(path31, { paths });
|
|
19229
19463
|
} catch {
|
|
19230
19464
|
}
|
|
19231
19465
|
}
|
|
19232
|
-
const modulePath = resolvePathSync(
|
|
19466
|
+
const modulePath = resolvePathSync(path31, {
|
|
19233
19467
|
url: options.paths
|
|
19234
19468
|
});
|
|
19235
19469
|
if (options.platform === "win32")
|
|
@@ -19300,10 +19534,10 @@ var findUp = quansync2({
|
|
|
19300
19534
|
async: findUp$1
|
|
19301
19535
|
});
|
|
19302
19536
|
var loadPackageJSON = quansync2(function* (cwd = process4.cwd()) {
|
|
19303
|
-
const
|
|
19304
|
-
if (!
|
|
19537
|
+
const path31 = yield findUp("package.json", { cwd });
|
|
19538
|
+
if (!path31 || !fs8.existsSync(path31))
|
|
19305
19539
|
return null;
|
|
19306
|
-
return JSON.parse(yield readFile(
|
|
19540
|
+
return JSON.parse(yield readFile(path31));
|
|
19307
19541
|
});
|
|
19308
19542
|
var loadPackageJSONSync = loadPackageJSON.sync;
|
|
19309
19543
|
var isPackageListed = quansync2(function* (name, cwd) {
|
|
@@ -19312,13 +19546,13 @@ var isPackageListed = quansync2(function* (name, cwd) {
|
|
|
19312
19546
|
});
|
|
19313
19547
|
var isPackageListedSync = isPackageListed.sync;
|
|
19314
19548
|
|
|
19315
|
-
// ../../node_modules/.pnpm/package-manager-detector@1.
|
|
19549
|
+
// ../../node_modules/.pnpm/package-manager-detector@1.5.0/node_modules/package-manager-detector/dist/detect.mjs
|
|
19316
19550
|
init_esm_shims();
|
|
19317
19551
|
import fs9 from "fs/promises";
|
|
19318
|
-
import
|
|
19552
|
+
import path14 from "path";
|
|
19319
19553
|
import process5 from "process";
|
|
19320
19554
|
|
|
19321
|
-
// ../../node_modules/.pnpm/package-manager-detector@1.
|
|
19555
|
+
// ../../node_modules/.pnpm/package-manager-detector@1.5.0/node_modules/package-manager-detector/dist/constants.mjs
|
|
19322
19556
|
init_esm_shims();
|
|
19323
19557
|
var AGENTS = [
|
|
19324
19558
|
"npm",
|
|
@@ -19355,7 +19589,7 @@ var INSTALL_METADATA = {
|
|
|
19355
19589
|
"bun.lockb": "bun"
|
|
19356
19590
|
};
|
|
19357
19591
|
|
|
19358
|
-
// ../../node_modules/.pnpm/package-manager-detector@1.
|
|
19592
|
+
// ../../node_modules/.pnpm/package-manager-detector@1.5.0/node_modules/package-manager-detector/dist/detect.mjs
|
|
19359
19593
|
async function pathExists(path210, type) {
|
|
19360
19594
|
try {
|
|
19361
19595
|
const stat6 = await fs9.stat(path210);
|
|
@@ -19365,11 +19599,11 @@ async function pathExists(path210, type) {
|
|
|
19365
19599
|
}
|
|
19366
19600
|
}
|
|
19367
19601
|
function* lookup(cwd = process5.cwd()) {
|
|
19368
|
-
let directory =
|
|
19369
|
-
const { root } =
|
|
19602
|
+
let directory = path14.resolve(cwd);
|
|
19603
|
+
const { root } = path14.parse(directory);
|
|
19370
19604
|
while (directory && directory !== root) {
|
|
19371
19605
|
yield directory;
|
|
19372
|
-
directory =
|
|
19606
|
+
directory = path14.dirname(directory);
|
|
19373
19607
|
}
|
|
19374
19608
|
}
|
|
19375
19609
|
async function parsePackageJson(filepath, onUnknown) {
|
|
@@ -19383,7 +19617,7 @@ async function detect(options = {}) {
|
|
|
19383
19617
|
} = options;
|
|
19384
19618
|
let stopDir;
|
|
19385
19619
|
if (typeof options.stopDir === "string") {
|
|
19386
|
-
const resolved =
|
|
19620
|
+
const resolved = path14.resolve(options.stopDir);
|
|
19387
19621
|
stopDir = (dir) => dir === resolved;
|
|
19388
19622
|
} else {
|
|
19389
19623
|
stopDir = options.stopDir;
|
|
@@ -19393,9 +19627,9 @@ async function detect(options = {}) {
|
|
|
19393
19627
|
switch (strategy) {
|
|
19394
19628
|
case "lockfile": {
|
|
19395
19629
|
for (const lock of Object.keys(LOCKS)) {
|
|
19396
|
-
if (await pathExists(
|
|
19630
|
+
if (await pathExists(path14.join(directory, lock), "file")) {
|
|
19397
19631
|
const name = LOCKS[lock];
|
|
19398
|
-
const result = await parsePackageJson(
|
|
19632
|
+
const result = await parsePackageJson(path14.join(directory, "package.json"), onUnknown);
|
|
19399
19633
|
if (result)
|
|
19400
19634
|
return result;
|
|
19401
19635
|
else
|
|
@@ -19406,7 +19640,7 @@ async function detect(options = {}) {
|
|
|
19406
19640
|
}
|
|
19407
19641
|
case "packageManager-field":
|
|
19408
19642
|
case "devEngines-field": {
|
|
19409
|
-
const result = await parsePackageJson(
|
|
19643
|
+
const result = await parsePackageJson(path14.join(directory, "package.json"), onUnknown);
|
|
19410
19644
|
if (result)
|
|
19411
19645
|
return result;
|
|
19412
19646
|
break;
|
|
@@ -19414,7 +19648,7 @@ async function detect(options = {}) {
|
|
|
19414
19648
|
case "install-metadata": {
|
|
19415
19649
|
for (const metadata of Object.keys(INSTALL_METADATA)) {
|
|
19416
19650
|
const fileOrDir = metadata.endsWith("/") ? "dir" : "file";
|
|
19417
|
-
if (await pathExists(
|
|
19651
|
+
if (await pathExists(path14.join(directory, metadata), fileOrDir)) {
|
|
19418
19652
|
const name = INSTALL_METADATA[metadata];
|
|
19419
19653
|
const agent = name === "yarn" ? isMetadataYarnClassic(metadata) ? "yarn" : "yarn@berry" : name;
|
|
19420
19654
|
return { name, agent };
|
|
@@ -19475,7 +19709,7 @@ function isMetadataYarnClassic(metadataPath) {
|
|
|
19475
19709
|
}
|
|
19476
19710
|
|
|
19477
19711
|
// src/runtime/configPlugin.ts
|
|
19478
|
-
import
|
|
19712
|
+
import path27 from "pathe";
|
|
19479
19713
|
import { loadConfigFromFile } from "vite";
|
|
19480
19714
|
import tsconfigPaths from "vite-tsconfig-paths";
|
|
19481
19715
|
|
|
@@ -19510,6 +19744,9 @@ function getWeappViteConfig() {
|
|
|
19510
19744
|
npm: {
|
|
19511
19745
|
enable: true,
|
|
19512
19746
|
cache: true
|
|
19747
|
+
},
|
|
19748
|
+
chunks: {
|
|
19749
|
+
sharedStrategy: "duplicate"
|
|
19513
19750
|
}
|
|
19514
19751
|
};
|
|
19515
19752
|
}
|
|
@@ -19542,7 +19779,7 @@ import { wrapPlugin } from "vite-plugin-performance";
|
|
|
19542
19779
|
init_esm_shims();
|
|
19543
19780
|
import { fdir as Fdir } from "fdir";
|
|
19544
19781
|
import fs10 from "fs-extra";
|
|
19545
|
-
import
|
|
19782
|
+
import path15 from "pathe";
|
|
19546
19783
|
function asset(ctx) {
|
|
19547
19784
|
const state = { ctx };
|
|
19548
19785
|
return [createAssetCollector(state)];
|
|
@@ -19585,7 +19822,7 @@ function scanAssetFiles(configService, config) {
|
|
|
19585
19822
|
const filter3 = weappViteConfig?.copy?.filter ?? (() => true);
|
|
19586
19823
|
const ignore = [
|
|
19587
19824
|
...defaultExcluded,
|
|
19588
|
-
|
|
19825
|
+
path15.resolve(configService.cwd, `${config.build.outDir}/**/*`),
|
|
19589
19826
|
...exclude
|
|
19590
19827
|
];
|
|
19591
19828
|
const fdir = new Fdir({
|
|
@@ -19617,7 +19854,7 @@ function normalizeCopyGlobs(globs) {
|
|
|
19617
19854
|
// src/plugins/autoImport.ts
|
|
19618
19855
|
init_esm_shims();
|
|
19619
19856
|
import { fdir as Fdir2 } from "fdir";
|
|
19620
|
-
import
|
|
19857
|
+
import path16 from "pathe";
|
|
19621
19858
|
function normalizeChangedPath(id) {
|
|
19622
19859
|
if (!id || id.startsWith("\0")) {
|
|
19623
19860
|
return void 0;
|
|
@@ -19630,14 +19867,14 @@ function resolveAbsolutePath(ctx, candidate) {
|
|
|
19630
19867
|
if (!configService) {
|
|
19631
19868
|
return void 0;
|
|
19632
19869
|
}
|
|
19633
|
-
if (
|
|
19870
|
+
if (path16.isAbsolute(candidate)) {
|
|
19634
19871
|
return candidate;
|
|
19635
19872
|
}
|
|
19636
|
-
const resolvedFromSrc =
|
|
19873
|
+
const resolvedFromSrc = path16.resolve(configService.absoluteSrcRoot, candidate);
|
|
19637
19874
|
if (resolvedFromSrc.startsWith(configService.absoluteSrcRoot)) {
|
|
19638
19875
|
return resolvedFromSrc;
|
|
19639
19876
|
}
|
|
19640
|
-
return
|
|
19877
|
+
return path16.resolve(configService.cwd, candidate);
|
|
19641
19878
|
}
|
|
19642
19879
|
function matchesAutoImportGlobs(ctx, candidate) {
|
|
19643
19880
|
const { autoImportService, configService } = ctx;
|
|
@@ -19680,7 +19917,7 @@ async function findTemplateCandidates(state, globs) {
|
|
|
19680
19917
|
],
|
|
19681
19918
|
pathSeparator: "/"
|
|
19682
19919
|
});
|
|
19683
|
-
return await fdir.withFullPaths().globWithOptions(globs.map((pattern) =>
|
|
19920
|
+
return await fdir.withFullPaths().globWithOptions(globs.map((pattern) => path16.resolve(configService.absoluteSrcRoot, pattern)), {
|
|
19684
19921
|
ignore
|
|
19685
19922
|
}).crawl(configService.absoluteSrcRoot).withPromise();
|
|
19686
19923
|
}
|
|
@@ -19820,7 +20057,7 @@ function autoRoutes(ctx) {
|
|
|
19820
20057
|
init_esm_shims();
|
|
19821
20058
|
import { isEmptyObject as isEmptyObject2, isObject as isObject6, removeExtensionDeep as removeExtensionDeep5 } from "@weapp-core/shared";
|
|
19822
20059
|
import fs13 from "fs-extra";
|
|
19823
|
-
import
|
|
20060
|
+
import path21 from "pathe";
|
|
19824
20061
|
import { build as build2 } from "vite";
|
|
19825
20062
|
|
|
19826
20063
|
// src/wxml/handle.ts
|
|
@@ -21221,12 +21458,12 @@ init_esm_shims();
|
|
|
21221
21458
|
import { performance as performance3 } from "perf_hooks";
|
|
21222
21459
|
import { removeExtensionDeep as removeExtensionDeep4 } from "@weapp-core/shared";
|
|
21223
21460
|
import fs11 from "fs-extra";
|
|
21224
|
-
import
|
|
21461
|
+
import path18 from "pathe";
|
|
21225
21462
|
|
|
21226
21463
|
// src/plugins/utils/analyze.ts
|
|
21227
21464
|
init_esm_shims();
|
|
21228
21465
|
import { get as get3, isObject as isObject4, removeExtension } from "@weapp-core/shared";
|
|
21229
|
-
import
|
|
21466
|
+
import path17 from "pathe";
|
|
21230
21467
|
function collectPluginExportEntries(plugins, root) {
|
|
21231
21468
|
if (!isObject4(plugins)) {
|
|
21232
21469
|
return [];
|
|
@@ -21241,7 +21478,7 @@ function collectPluginExportEntries(plugins, root) {
|
|
|
21241
21478
|
continue;
|
|
21242
21479
|
}
|
|
21243
21480
|
const normalized = removeExtension(exportPath);
|
|
21244
|
-
entries.push(root ?
|
|
21481
|
+
entries.push(root ? path17.join(root, normalized) : normalized);
|
|
21245
21482
|
}
|
|
21246
21483
|
return entries;
|
|
21247
21484
|
}
|
|
@@ -21322,7 +21559,7 @@ async function collectAppSideFiles(pluginCtx, id, json, jsonService, registerJso
|
|
|
21322
21559
|
return;
|
|
21323
21560
|
}
|
|
21324
21561
|
const { path: jsonPath, predictions } = await findJsonEntry(
|
|
21325
|
-
|
|
21562
|
+
path18.resolve(path18.dirname(id), location)
|
|
21326
21563
|
);
|
|
21327
21564
|
for (const prediction of predictions) {
|
|
21328
21565
|
await addWatchTarget(pluginCtx, prediction, existsCache);
|
|
@@ -21354,7 +21591,7 @@ async function ensureTemplateScanned(pluginCtx, id, scanTemplateEntry, existsCac
|
|
|
21354
21591
|
async function resolveEntries(entries, absoluteSrcRoot) {
|
|
21355
21592
|
return Promise.all(
|
|
21356
21593
|
entries.filter((entry) => !entry.includes(":")).map(async (entry) => {
|
|
21357
|
-
const absPath =
|
|
21594
|
+
const absPath = path18.resolve(absoluteSrcRoot, entry);
|
|
21358
21595
|
return {
|
|
21359
21596
|
entry,
|
|
21360
21597
|
resolvedId: await this.resolve(absPath)
|
|
@@ -21469,7 +21706,7 @@ function createEntryLoader(options) {
|
|
|
21469
21706
|
// src/plugins/hooks/useLoadEntry/normalizer.ts
|
|
21470
21707
|
init_esm_shims();
|
|
21471
21708
|
import { isObject as isObject5 } from "@weapp-core/shared";
|
|
21472
|
-
import
|
|
21709
|
+
import path19 from "pathe";
|
|
21473
21710
|
function createEntryNormalizer(configService) {
|
|
21474
21711
|
return function normalizeEntry(entry, jsonPath) {
|
|
21475
21712
|
if (/plugin:\/\//.test(entry)) {
|
|
@@ -21494,8 +21731,8 @@ function resolveImportee2(importee, jsonPath, configService) {
|
|
|
21494
21731
|
updated = importee.replace(matchedEntry.find, matchedEntry.replacement);
|
|
21495
21732
|
}
|
|
21496
21733
|
}
|
|
21497
|
-
const baseDir = jsonPath ?
|
|
21498
|
-
return
|
|
21734
|
+
const baseDir = jsonPath ? path19.dirname(jsonPath) : configService.absoluteSrcRoot;
|
|
21735
|
+
return path19.resolve(baseDir, updated);
|
|
21499
21736
|
}
|
|
21500
21737
|
function hasDependencyPrefix(dependencies, tokens) {
|
|
21501
21738
|
return Object.keys(dependencies).some((dep) => {
|
|
@@ -21586,7 +21823,7 @@ function collectRequireTokens(ast) {
|
|
|
21586
21823
|
init_esm_shims();
|
|
21587
21824
|
import fs12 from "fs";
|
|
21588
21825
|
import process6 from "process";
|
|
21589
|
-
import
|
|
21826
|
+
import path20 from "pathe";
|
|
21590
21827
|
var watchedCssExts = new Set(supportedCssLangs.map((ext2) => `.${ext2}`));
|
|
21591
21828
|
var configSuffixes = configExtensions.map((ext2) => `.${ext2}`);
|
|
21592
21829
|
var sidecarSuffixes = [...configSuffixes, ...watchedCssExts];
|
|
@@ -21604,7 +21841,7 @@ function isWatchLimitError(error) {
|
|
|
21604
21841
|
}
|
|
21605
21842
|
async function invalidateEntryForSidecar(filePath) {
|
|
21606
21843
|
const configSuffix = configSuffixes.find((suffix) => filePath.endsWith(suffix));
|
|
21607
|
-
const ext2 =
|
|
21844
|
+
const ext2 = path20.extname(filePath);
|
|
21608
21845
|
let scriptBasePath;
|
|
21609
21846
|
if (configSuffix) {
|
|
21610
21847
|
scriptBasePath = filePath.slice(0, -configSuffix.length);
|
|
@@ -21625,7 +21862,7 @@ function ensureSidecarWatcher(ctx, rootDir) {
|
|
|
21625
21862
|
return;
|
|
21626
21863
|
}
|
|
21627
21864
|
const { sidecarWatcherMap } = ctx.runtimeState.watcher;
|
|
21628
|
-
const absRoot =
|
|
21865
|
+
const absRoot = path20.normalize(rootDir);
|
|
21629
21866
|
if (!fs12.existsSync(absRoot)) {
|
|
21630
21867
|
return;
|
|
21631
21868
|
}
|
|
@@ -21640,8 +21877,8 @@ function ensureSidecarWatcher(ctx, rootDir) {
|
|
|
21640
21877
|
};
|
|
21641
21878
|
const registerChokidarWatcher = () => {
|
|
21642
21879
|
const patterns = [
|
|
21643
|
-
...configExtensions.map((ext2) =>
|
|
21644
|
-
...supportedCssLangs.map((ext2) =>
|
|
21880
|
+
...configExtensions.map((ext2) => path20.join(absRoot, `**/*.${ext2}`)),
|
|
21881
|
+
...supportedCssLangs.map((ext2) => path20.join(absRoot, `**/*.${ext2}`))
|
|
21645
21882
|
];
|
|
21646
21883
|
const watcher = esm_default.watch(patterns, {
|
|
21647
21884
|
ignoreInitial: true,
|
|
@@ -21675,7 +21912,7 @@ function ensureSidecarWatcher(ctx, rootDir) {
|
|
|
21675
21912
|
if (!filename) {
|
|
21676
21913
|
return;
|
|
21677
21914
|
}
|
|
21678
|
-
const resolved =
|
|
21915
|
+
const resolved = path20.join(absRoot, filename.toString());
|
|
21679
21916
|
handleSidecarChange(resolved);
|
|
21680
21917
|
});
|
|
21681
21918
|
let handledWatchLimit = false;
|
|
@@ -21788,7 +22025,7 @@ function createCoreLifecyclePlugin(state) {
|
|
|
21788
22025
|
buildStart() {
|
|
21789
22026
|
loadedEntrySet.clear();
|
|
21790
22027
|
if (configService.isDev) {
|
|
21791
|
-
const rootDir = subPackageMeta ?
|
|
22028
|
+
const rootDir = subPackageMeta ? path21.resolve(configService.absoluteSrcRoot, subPackageMeta.subPackage.root) : configService.absoluteSrcRoot;
|
|
21792
22029
|
ensureSidecarWatcher(ctx, rootDir);
|
|
21793
22030
|
}
|
|
21794
22031
|
},
|
|
@@ -21820,7 +22057,7 @@ function createCoreLifecyclePlugin(state) {
|
|
|
21820
22057
|
let scannedInput;
|
|
21821
22058
|
if (subPackageMeta) {
|
|
21822
22059
|
scannedInput = subPackageMeta.entries.reduce((acc, entry) => {
|
|
21823
|
-
acc[entry] =
|
|
22060
|
+
acc[entry] = path21.resolve(configService.absoluteSrcRoot, entry);
|
|
21824
22061
|
return acc;
|
|
21825
22062
|
}, {});
|
|
21826
22063
|
} else {
|
|
@@ -21889,8 +22126,15 @@ function createCoreLifecyclePlugin(state) {
|
|
|
21889
22126
|
emitJsonAssets.call(this, state);
|
|
21890
22127
|
state.watchFilesSnapshot = emitWxmlAssets.call(this, state);
|
|
21891
22128
|
},
|
|
21892
|
-
async generateBundle() {
|
|
22129
|
+
async generateBundle(_options, bundle) {
|
|
21893
22130
|
await flushIndependentBuilds.call(this, state, watcherService);
|
|
22131
|
+
if (!subPackageMeta) {
|
|
22132
|
+
const sharedStrategy = configService.weappViteConfig?.chunks?.sharedStrategy ?? DEFAULT_SHARED_CHUNK_STRATEGY;
|
|
22133
|
+
applySharedChunkStrategy.call(this, bundle, {
|
|
22134
|
+
strategy: sharedStrategy,
|
|
22135
|
+
subPackageRoots: scanService.subPackageMap.keys()
|
|
22136
|
+
});
|
|
22137
|
+
}
|
|
21894
22138
|
if (configService.weappViteConfig?.debug?.watchFiles) {
|
|
21895
22139
|
const watcherService2 = ctx.watcherService;
|
|
21896
22140
|
const watcherRoot = subPackageMeta?.subPackage.root ?? "/";
|
|
@@ -21943,7 +22187,7 @@ function createRequireAnalysisPlugin(state) {
|
|
|
21943
22187
|
return;
|
|
21944
22188
|
}
|
|
21945
22189
|
for (const requireModule of requireTokens) {
|
|
21946
|
-
const absPath =
|
|
22190
|
+
const absPath = path21.resolve(path21.dirname(moduleInfo.id), requireModule.value);
|
|
21947
22191
|
const resolved = await this.resolve(absPath, moduleInfo.id);
|
|
21948
22192
|
if (!resolved) {
|
|
21949
22193
|
continue;
|
|
@@ -22297,7 +22541,7 @@ init_esm_shims();
|
|
|
22297
22541
|
import { createHash } from "crypto";
|
|
22298
22542
|
import { removeExtension as removeExtension2 } from "@weapp-core/shared";
|
|
22299
22543
|
import fs14 from "fs-extra";
|
|
22300
|
-
import
|
|
22544
|
+
import path22 from "pathe";
|
|
22301
22545
|
function workers(ctx) {
|
|
22302
22546
|
if (!ctx.scanService.workersDir) {
|
|
22303
22547
|
return [];
|
|
@@ -22325,21 +22569,21 @@ function createWorkerBuildPlugin(ctx) {
|
|
|
22325
22569
|
options.chunkFileNames = (chunkInfo) => {
|
|
22326
22570
|
const workersDir = scanService.workersDir ?? "";
|
|
22327
22571
|
if (chunkInfo.isDynamicEntry) {
|
|
22328
|
-
return
|
|
22572
|
+
return path22.join(workersDir, "[name].js");
|
|
22329
22573
|
}
|
|
22330
22574
|
const sourceId = chunkInfo.facadeModuleId ?? chunkInfo.moduleIds[0];
|
|
22331
22575
|
const hashBase = typeof sourceId === "string" ? configService.relativeCwd(sourceId) : chunkInfo.name;
|
|
22332
22576
|
const stableHash = createHash("sha256").update(hashBase).digest("base64url").slice(0, 8);
|
|
22333
|
-
return
|
|
22577
|
+
return path22.join(workersDir, `${chunkInfo.name}-${stableHash}.js`);
|
|
22334
22578
|
};
|
|
22335
22579
|
}
|
|
22336
22580
|
};
|
|
22337
22581
|
}
|
|
22338
22582
|
async function resolveWorkerEntry(ctx, entry) {
|
|
22339
22583
|
const { configService, scanService } = ctx;
|
|
22340
|
-
const relativeEntryPath =
|
|
22584
|
+
const relativeEntryPath = path22.join(scanService.workersDir, entry);
|
|
22341
22585
|
const key = removeExtension2(relativeEntryPath);
|
|
22342
|
-
const absoluteEntry =
|
|
22586
|
+
const absoluteEntry = path22.resolve(configService.absoluteSrcRoot, relativeEntryPath);
|
|
22343
22587
|
if (isJsOrTs(entry)) {
|
|
22344
22588
|
const exists = await fs14.exists(absoluteEntry);
|
|
22345
22589
|
if (!exists) {
|
|
@@ -22360,7 +22604,7 @@ async function resolveWorkerEntry(ctx, entry) {
|
|
|
22360
22604
|
init_esm_shims();
|
|
22361
22605
|
import { removeExtension as removeExtension3 } from "@weapp-core/shared";
|
|
22362
22606
|
import fs15 from "fs-extra";
|
|
22363
|
-
import
|
|
22607
|
+
import path23 from "pathe";
|
|
22364
22608
|
var wxsCodeCache = new LRUCache({
|
|
22365
22609
|
max: 512
|
|
22366
22610
|
});
|
|
@@ -22405,7 +22649,7 @@ async function handleWxsDeps(state, deps, absPath) {
|
|
|
22405
22649
|
if (!jsExtensions.includes(dep.attrs.lang) && !arr) {
|
|
22406
22650
|
return;
|
|
22407
22651
|
}
|
|
22408
|
-
const wxsPath =
|
|
22652
|
+
const wxsPath = path23.resolve(path23.dirname(absPath), dep.value);
|
|
22409
22653
|
await transformWxsFile.call(this, state, wxsPath);
|
|
22410
22654
|
})
|
|
22411
22655
|
);
|
|
@@ -22431,13 +22675,13 @@ async function transformWxsFile(state, wxsPath) {
|
|
|
22431
22675
|
if (typeof result?.code === "string") {
|
|
22432
22676
|
code = result.code;
|
|
22433
22677
|
}
|
|
22434
|
-
const dirname5 =
|
|
22678
|
+
const dirname5 = path23.dirname(wxsPath);
|
|
22435
22679
|
await Promise.all(
|
|
22436
22680
|
importees.map(({ source }) => {
|
|
22437
22681
|
return transformWxsFile.call(
|
|
22438
22682
|
this,
|
|
22439
22683
|
state,
|
|
22440
|
-
|
|
22684
|
+
path23.resolve(dirname5, source)
|
|
22441
22685
|
);
|
|
22442
22686
|
})
|
|
22443
22687
|
);
|
|
@@ -22668,29 +22912,29 @@ function sanitizeBuildTarget(target, options) {
|
|
|
22668
22912
|
|
|
22669
22913
|
// src/runtime/config/web.ts
|
|
22670
22914
|
init_esm_shims();
|
|
22671
|
-
import
|
|
22915
|
+
import path24 from "pathe";
|
|
22672
22916
|
function normalizeSrcDir(root, cwd, srcRoot, config) {
|
|
22673
22917
|
if (!config) {
|
|
22674
|
-
const absoluteSrc2 =
|
|
22675
|
-
return
|
|
22918
|
+
const absoluteSrc2 = path24.resolve(cwd, srcRoot);
|
|
22919
|
+
return path24.relative(root, absoluteSrc2) || "";
|
|
22676
22920
|
}
|
|
22677
22921
|
if (config.srcDir) {
|
|
22678
|
-
if (
|
|
22679
|
-
return
|
|
22922
|
+
if (path24.isAbsolute(config.srcDir)) {
|
|
22923
|
+
return path24.relative(root, config.srcDir);
|
|
22680
22924
|
}
|
|
22681
22925
|
return config.srcDir;
|
|
22682
22926
|
}
|
|
22683
|
-
const absoluteSrc =
|
|
22684
|
-
return
|
|
22927
|
+
const absoluteSrc = path24.resolve(cwd, srcRoot);
|
|
22928
|
+
return path24.relative(root, absoluteSrc) || "";
|
|
22685
22929
|
}
|
|
22686
22930
|
function normalizeOutDir(root, config) {
|
|
22687
22931
|
if (!config?.outDir) {
|
|
22688
|
-
return
|
|
22932
|
+
return path24.resolve(root, "dist-web");
|
|
22689
22933
|
}
|
|
22690
|
-
if (
|
|
22934
|
+
if (path24.isAbsolute(config.outDir)) {
|
|
22691
22935
|
return config.outDir;
|
|
22692
22936
|
}
|
|
22693
|
-
return
|
|
22937
|
+
return path24.resolve(root, config.outDir);
|
|
22694
22938
|
}
|
|
22695
22939
|
function resolveWeappWebConfig(options) {
|
|
22696
22940
|
const { cwd, srcRoot, config } = options;
|
|
@@ -22701,7 +22945,7 @@ function resolveWeappWebConfig(options) {
|
|
|
22701
22945
|
if (!enabled) {
|
|
22702
22946
|
return void 0;
|
|
22703
22947
|
}
|
|
22704
|
-
const root = config.root ?
|
|
22948
|
+
const root = config.root ? path24.resolve(cwd, config.root) : cwd;
|
|
22705
22949
|
const srcDir = normalizeSrcDir(root, cwd, srcRoot, config);
|
|
22706
22950
|
const outDir = normalizeOutDir(root, config);
|
|
22707
22951
|
const pluginOptions = {
|
|
@@ -22723,7 +22967,7 @@ function resolveWeappWebConfig(options) {
|
|
|
22723
22967
|
// src/runtime/oxcRuntime.ts
|
|
22724
22968
|
init_esm_shims();
|
|
22725
22969
|
import fs16 from "fs-extra";
|
|
22726
|
-
import
|
|
22970
|
+
import path25 from "pathe";
|
|
22727
22971
|
var NULL_BYTE = "\0";
|
|
22728
22972
|
var OXC_RUNTIME_HELPER_ALIAS = new RegExp(`^(?:${NULL_BYTE})?@oxc-project(?:/|\\+)runtime(?:@[^/]+)?/helpers/(.+)\\.js$`);
|
|
22729
22973
|
var FALLBACK_HELPER_PREFIX = `${NULL_BYTE}weapp-vite:oxc-helper:`;
|
|
@@ -22791,7 +23035,7 @@ function getOxcHelperName(id) {
|
|
|
22791
23035
|
}
|
|
22792
23036
|
function createOxcRuntimeSupport() {
|
|
22793
23037
|
const oxcRuntimeInfo = getPackageInfoSync("@oxc-project/runtime");
|
|
22794
|
-
const oxcRuntimeHelpersRoot = oxcRuntimeInfo ?
|
|
23038
|
+
const oxcRuntimeHelpersRoot = oxcRuntimeInfo ? path25.resolve(oxcRuntimeInfo.rootPath, "src/helpers/esm") : void 0;
|
|
22795
23039
|
const alias = {
|
|
22796
23040
|
find: OXC_RUNTIME_HELPER_ALIAS,
|
|
22797
23041
|
replacement: "@oxc-project/runtime/src/helpers/esm/$1.js"
|
|
@@ -22818,7 +23062,7 @@ function createOxcRuntimeSupport() {
|
|
|
22818
23062
|
}
|
|
22819
23063
|
return null;
|
|
22820
23064
|
}
|
|
22821
|
-
return
|
|
23065
|
+
return path25.resolve(helpersRoot, `${helperName}.js`);
|
|
22822
23066
|
},
|
|
22823
23067
|
async load(id) {
|
|
22824
23068
|
if (id.startsWith(FALLBACK_HELPER_PREFIX)) {
|
|
@@ -22831,7 +23075,7 @@ function createOxcRuntimeSupport() {
|
|
|
22831
23075
|
}
|
|
22832
23076
|
const helperName = getOxcHelperName(id);
|
|
22833
23077
|
if (helperName) {
|
|
22834
|
-
const helperPath = id.startsWith(NULL_BYTE) ?
|
|
23078
|
+
const helperPath = id.startsWith(NULL_BYTE) ? path25.resolve(oxcRuntimeHelpersRoot, `${helperName}.js`) : id;
|
|
22835
23079
|
if (await fs16.pathExists(helperPath)) {
|
|
22836
23080
|
console.warn("[weapp-vite] resolving oxc helper via Rolldown plugin:", helperName);
|
|
22837
23081
|
return fs16.readFile(helperPath, "utf8");
|
|
@@ -22856,7 +23100,7 @@ function createOxcRuntimeSupport() {
|
|
|
22856
23100
|
}
|
|
22857
23101
|
const helperName = getOxcHelperName(source);
|
|
22858
23102
|
if (helperName) {
|
|
22859
|
-
return
|
|
23103
|
+
return path25.resolve(oxcRuntimeHelpersRoot, `${helperName}.js`);
|
|
22860
23104
|
}
|
|
22861
23105
|
return null;
|
|
22862
23106
|
},
|
|
@@ -22868,7 +23112,7 @@ function createOxcRuntimeSupport() {
|
|
|
22868
23112
|
if (!helperName) {
|
|
22869
23113
|
return null;
|
|
22870
23114
|
}
|
|
22871
|
-
const helperPath =
|
|
23115
|
+
const helperPath = path25.resolve(oxcRuntimeHelpersRoot, `${helperName}.js`);
|
|
22872
23116
|
console.warn("[weapp-vite] resolving oxc helper via Vite plugin:", helperName);
|
|
22873
23117
|
return fs16.readFile(helperPath, "utf8");
|
|
22874
23118
|
}
|
|
@@ -22883,7 +23127,7 @@ function createOxcRuntimeSupport() {
|
|
|
22883
23127
|
// src/runtime/packageAliases.ts
|
|
22884
23128
|
init_esm_shims();
|
|
22885
23129
|
import { existsSync } from "fs";
|
|
22886
|
-
import
|
|
23130
|
+
import path26 from "pathe";
|
|
22887
23131
|
var SPECIAL_PACKAGE_ALIASES = [
|
|
22888
23132
|
{
|
|
22889
23133
|
packageName: "class-variance-authority",
|
|
@@ -22897,7 +23141,7 @@ function resolveBuiltinPackageAliases() {
|
|
|
22897
23141
|
if (!info) {
|
|
22898
23142
|
continue;
|
|
22899
23143
|
}
|
|
22900
|
-
const resolvedEntry =
|
|
23144
|
+
const resolvedEntry = path26.resolve(info.rootPath, distEntry);
|
|
22901
23145
|
if (!existsSync(resolvedEntry)) {
|
|
22902
23146
|
continue;
|
|
22903
23147
|
}
|
|
@@ -22908,7 +23152,7 @@ function resolveBuiltinPackageAliases() {
|
|
|
22908
23152
|
}
|
|
22909
23153
|
const weappViteInfo = getPackageInfoSync("weapp-vite");
|
|
22910
23154
|
if (weappViteInfo) {
|
|
22911
|
-
const autoRoutesSource =
|
|
23155
|
+
const autoRoutesSource = path26.resolve(weappViteInfo.rootPath, "src/auto-routes.ts");
|
|
22912
23156
|
if (existsSync(autoRoutesSource)) {
|
|
22913
23157
|
aliases.push({
|
|
22914
23158
|
find: "weapp-vite/auto-routes",
|
|
@@ -22993,7 +23237,7 @@ function createConfigService(ctx) {
|
|
|
22993
23237
|
if (!mpDistRoot) {
|
|
22994
23238
|
throw new Error("\u8BF7\u5728 `project.config.json` \u91CC\u8BBE\u7F6E `miniprogramRoot`, \u6BD4\u5982\u53EF\u4EE5\u8BBE\u7F6E\u4E3A `dist/` ");
|
|
22995
23239
|
}
|
|
22996
|
-
const packageJsonPath =
|
|
23240
|
+
const packageJsonPath = path27.resolve(cwd, "package.json");
|
|
22997
23241
|
let packageJson = {};
|
|
22998
23242
|
if (await fs17.exists(packageJsonPath)) {
|
|
22999
23243
|
const localPackageJson = await fs17.readJson(packageJsonPath, {
|
|
@@ -23002,8 +23246,8 @@ function createConfigService(ctx) {
|
|
|
23002
23246
|
packageJson = localPackageJson;
|
|
23003
23247
|
}
|
|
23004
23248
|
let resolvedConfigFile = configFile;
|
|
23005
|
-
if (resolvedConfigFile && !
|
|
23006
|
-
resolvedConfigFile =
|
|
23249
|
+
if (resolvedConfigFile && !path27.isAbsolute(resolvedConfigFile)) {
|
|
23250
|
+
resolvedConfigFile = path27.resolve(cwd, resolvedConfigFile);
|
|
23007
23251
|
}
|
|
23008
23252
|
const weappConfigFilePath = await resolveWeappConfigFile({
|
|
23009
23253
|
root: cwd,
|
|
@@ -23016,8 +23260,8 @@ function createConfigService(ctx) {
|
|
|
23016
23260
|
const loadedConfig = loaded?.config;
|
|
23017
23261
|
let weappLoaded;
|
|
23018
23262
|
if (weappConfigFilePath) {
|
|
23019
|
-
const normalizedWeappPath =
|
|
23020
|
-
const normalizedLoadedPath = loaded?.path ?
|
|
23263
|
+
const normalizedWeappPath = path27.resolve(weappConfigFilePath);
|
|
23264
|
+
const normalizedLoadedPath = loaded?.path ? path27.resolve(loaded.path) : void 0;
|
|
23021
23265
|
if (normalizedLoadedPath && normalizedLoadedPath === normalizedWeappPath) {
|
|
23022
23266
|
weappLoaded = loaded;
|
|
23023
23267
|
} else {
|
|
@@ -23126,7 +23370,7 @@ function createConfigService(ctx) {
|
|
|
23126
23370
|
}
|
|
23127
23371
|
function relativeSrcRoot(p) {
|
|
23128
23372
|
if (srcRoot) {
|
|
23129
|
-
return
|
|
23373
|
+
return path27.relative(srcRoot, p);
|
|
23130
23374
|
}
|
|
23131
23375
|
return p;
|
|
23132
23376
|
}
|
|
@@ -23275,12 +23519,13 @@ function createConfigService(ctx) {
|
|
|
23275
23519
|
watch: {
|
|
23276
23520
|
exclude: [
|
|
23277
23521
|
...defaultExcluded,
|
|
23278
|
-
options.mpDistRoot ?
|
|
23522
|
+
options.mpDistRoot ? path27.join(options.cwd, options.mpDistRoot, "**") : path27.join(options.cwd, "dist", "**")
|
|
23279
23523
|
],
|
|
23280
|
-
include: [
|
|
23524
|
+
include: [path27.join(options.cwd, options.srcRoot, "**")]
|
|
23281
23525
|
},
|
|
23282
23526
|
minify: false,
|
|
23283
23527
|
emptyOutDir: false,
|
|
23528
|
+
// @ts-ignore
|
|
23284
23529
|
rolldownOptions: {
|
|
23285
23530
|
...rolldownOptions
|
|
23286
23531
|
},
|
|
@@ -23306,6 +23551,7 @@ function createConfigService(ctx) {
|
|
|
23306
23551
|
define: getDefineImportMetaEnv(),
|
|
23307
23552
|
build: {
|
|
23308
23553
|
emptyOutDir: false,
|
|
23554
|
+
// @ts-ignore
|
|
23309
23555
|
rolldownOptions: {
|
|
23310
23556
|
...rolldownOptions
|
|
23311
23557
|
}
|
|
@@ -23426,7 +23672,7 @@ function createConfigService(ctx) {
|
|
|
23426
23672
|
return options.mpDistRoot;
|
|
23427
23673
|
},
|
|
23428
23674
|
get outDir() {
|
|
23429
|
-
return
|
|
23675
|
+
return path27.resolve(options.cwd, options.mpDistRoot ?? "");
|
|
23430
23676
|
},
|
|
23431
23677
|
get currentSubPackageRoot() {
|
|
23432
23678
|
return options.currentSubPackageRoot;
|
|
@@ -23451,11 +23697,11 @@ function createConfigService(ctx) {
|
|
|
23451
23697
|
},
|
|
23452
23698
|
get absolutePluginRoot() {
|
|
23453
23699
|
if (options.config.weapp?.pluginRoot) {
|
|
23454
|
-
return
|
|
23700
|
+
return path27.resolve(options.cwd, options.config.weapp.pluginRoot);
|
|
23455
23701
|
}
|
|
23456
23702
|
},
|
|
23457
23703
|
get absoluteSrcRoot() {
|
|
23458
|
-
return
|
|
23704
|
+
return path27.resolve(options.cwd, options.srcRoot);
|
|
23459
23705
|
},
|
|
23460
23706
|
get mode() {
|
|
23461
23707
|
return options.mode;
|
|
@@ -23473,13 +23719,13 @@ function createConfigService(ctx) {
|
|
|
23473
23719
|
return options.weappWeb;
|
|
23474
23720
|
},
|
|
23475
23721
|
relativeCwd(p) {
|
|
23476
|
-
return
|
|
23722
|
+
return path27.relative(options.cwd, p);
|
|
23477
23723
|
},
|
|
23478
23724
|
relativeSrcRoot(p) {
|
|
23479
23725
|
return options.relativeSrcRoot(p);
|
|
23480
23726
|
},
|
|
23481
23727
|
relativeAbsoluteSrcRoot(p) {
|
|
23482
|
-
return
|
|
23728
|
+
return path27.relative(path27.resolve(options.cwd, options.srcRoot), p);
|
|
23483
23729
|
}
|
|
23484
23730
|
};
|
|
23485
23731
|
}
|
|
@@ -23595,13 +23841,13 @@ init_esm_shims();
|
|
|
23595
23841
|
import { isBuiltin } from "module";
|
|
23596
23842
|
import { defu as defu4, isObject as isObject8, objectHash as objectHash2 } from "@weapp-core/shared";
|
|
23597
23843
|
import fs19 from "fs-extra";
|
|
23598
|
-
import
|
|
23844
|
+
import path28 from "pathe";
|
|
23599
23845
|
function createNpmService(ctx) {
|
|
23600
23846
|
function getDependenciesCacheFilePath(key = "/") {
|
|
23601
23847
|
if (!ctx.configService) {
|
|
23602
23848
|
throw new Error("configService must be initialized before generating npm cache path");
|
|
23603
23849
|
}
|
|
23604
|
-
return
|
|
23850
|
+
return path28.resolve(ctx.configService.cwd, `node_modules/weapp-vite/.cache/${key.replaceAll("/", "-")}.json`);
|
|
23605
23851
|
}
|
|
23606
23852
|
function dependenciesCacheHash() {
|
|
23607
23853
|
if (!ctx.configService) {
|
|
@@ -23694,14 +23940,14 @@ function createNpmService(ctx) {
|
|
|
23694
23940
|
const { packageJson: targetJson, rootPath } = packageInfo;
|
|
23695
23941
|
const dependencies = targetJson.dependencies ?? {};
|
|
23696
23942
|
const keys = Object.keys(dependencies);
|
|
23697
|
-
const destOutDir =
|
|
23943
|
+
const destOutDir = path28.resolve(outDir, dep);
|
|
23698
23944
|
if (await shouldSkipBuild(destOutDir, isDependenciesCacheOutdate)) {
|
|
23699
23945
|
logger_default.info(`[npm] \u4F9D\u8D56 \`${dep}\` \u672A\u53D1\u751F\u53D8\u5316\uFF0C\u8DF3\u8FC7\u5904\u7406!`);
|
|
23700
23946
|
return;
|
|
23701
23947
|
}
|
|
23702
23948
|
if (isMiniprogramPackage(targetJson)) {
|
|
23703
23949
|
await copyBuild({
|
|
23704
|
-
from:
|
|
23950
|
+
from: path28.resolve(
|
|
23705
23951
|
rootPath,
|
|
23706
23952
|
targetJson.miniprogram
|
|
23707
23953
|
),
|
|
@@ -23773,10 +24019,10 @@ function createNpmService(ctx) {
|
|
|
23773
24019
|
debug?.("buildNpm start");
|
|
23774
24020
|
const packNpmRelationList = getPackNpmRelationList();
|
|
23775
24021
|
const [mainRelation, ...subRelations] = packNpmRelationList;
|
|
23776
|
-
const packageJsonPath =
|
|
24022
|
+
const packageJsonPath = path28.resolve(ctx.configService.cwd, mainRelation.packageJsonPath);
|
|
23777
24023
|
if (await fs19.exists(packageJsonPath)) {
|
|
23778
24024
|
const pkgJson = await fs19.readJson(packageJsonPath);
|
|
23779
|
-
const outDir =
|
|
24025
|
+
const outDir = path28.resolve(ctx.configService.cwd, mainRelation.miniprogramNpmDistDir, "miniprogram_npm");
|
|
23780
24026
|
if (pkgJson.dependencies) {
|
|
23781
24027
|
const dependencies = Object.keys(pkgJson.dependencies);
|
|
23782
24028
|
if (dependencies.length > 0) {
|
|
@@ -23795,7 +24041,7 @@ function createNpmService(ctx) {
|
|
|
23795
24041
|
const targetDirs = [
|
|
23796
24042
|
...subRelations.map((x) => {
|
|
23797
24043
|
return {
|
|
23798
|
-
npmDistDir:
|
|
24044
|
+
npmDistDir: path28.resolve(ctx.configService.cwd, x.miniprogramNpmDistDir, "miniprogram_npm")
|
|
23799
24045
|
};
|
|
23800
24046
|
}),
|
|
23801
24047
|
...[...ctx.scanService.independentSubPackageMap.values()].map((x) => {
|
|
@@ -23803,7 +24049,7 @@ function createNpmService(ctx) {
|
|
|
23803
24049
|
return {
|
|
23804
24050
|
root: x.subPackage.root,
|
|
23805
24051
|
dependencies: dependencies2,
|
|
23806
|
-
npmDistDir:
|
|
24052
|
+
npmDistDir: path28.resolve(ctx.configService.cwd, mainRelation.miniprogramNpmDistDir, x.subPackage.root, "miniprogram_npm")
|
|
23807
24053
|
};
|
|
23808
24054
|
})
|
|
23809
24055
|
];
|
|
@@ -23815,7 +24061,7 @@ function createNpmService(ctx) {
|
|
|
23815
24061
|
overwrite: true,
|
|
23816
24062
|
filter: (src) => {
|
|
23817
24063
|
if (Array.isArray(x.dependencies)) {
|
|
23818
|
-
const relPath =
|
|
24064
|
+
const relPath = path28.relative(outDir, src);
|
|
23819
24065
|
if (relPath === "") {
|
|
23820
24066
|
return true;
|
|
23821
24067
|
}
|
|
@@ -23831,7 +24077,7 @@ function createNpmService(ctx) {
|
|
|
23831
24077
|
overwrite: true,
|
|
23832
24078
|
filter: (src) => {
|
|
23833
24079
|
if (Array.isArray(x.dependencies)) {
|
|
23834
|
-
const relPath =
|
|
24080
|
+
const relPath = path28.relative(outDir, src);
|
|
23835
24081
|
if (relPath === "") {
|
|
23836
24082
|
return true;
|
|
23837
24083
|
}
|
|
@@ -24785,7 +25031,7 @@ function createRuntimeState() {
|
|
|
24785
25031
|
// src/runtime/scanPlugin.ts
|
|
24786
25032
|
init_esm_shims();
|
|
24787
25033
|
import { isObject as isObject9, removeExtensionDeep as removeExtensionDeep6 } from "@weapp-core/shared";
|
|
24788
|
-
import
|
|
25034
|
+
import path29 from "pathe";
|
|
24789
25035
|
function resolveSubPackageEntries(subPackage) {
|
|
24790
25036
|
const entries = [];
|
|
24791
25037
|
const root = subPackage.root ?? "";
|
|
@@ -24809,11 +25055,11 @@ function createScanService(ctx) {
|
|
|
24809
25055
|
return scanState.appEntry;
|
|
24810
25056
|
}
|
|
24811
25057
|
const appDirname = ctx.configService.absoluteSrcRoot;
|
|
24812
|
-
const appBasename =
|
|
25058
|
+
const appBasename = path29.resolve(appDirname, "app");
|
|
24813
25059
|
const { path: appConfigFile } = await findJsonEntry(appBasename);
|
|
24814
25060
|
const { path: appEntryPath } = await findJsEntry(appBasename);
|
|
24815
25061
|
if (ctx.configService.absolutePluginRoot) {
|
|
24816
|
-
const pluginBasename =
|
|
25062
|
+
const pluginBasename = path29.resolve(ctx.configService.absolutePluginRoot, "plugin");
|
|
24817
25063
|
const { path: pluginConfigFile } = await findJsonEntry(pluginBasename);
|
|
24818
25064
|
if (pluginConfigFile) {
|
|
24819
25065
|
const pluginConfig = await ctx.jsonService.read(pluginConfigFile);
|
|
@@ -24832,14 +25078,14 @@ function createScanService(ctx) {
|
|
|
24832
25078
|
scanState.appEntry = resolvedAppEntry;
|
|
24833
25079
|
const { sitemapLocation = "sitemap.json", themeLocation = "theme.json" } = config;
|
|
24834
25080
|
if (sitemapLocation) {
|
|
24835
|
-
const { path: sitemapJsonPath } = await findJsonEntry(
|
|
25081
|
+
const { path: sitemapJsonPath } = await findJsonEntry(path29.resolve(appDirname, sitemapLocation));
|
|
24836
25082
|
if (sitemapJsonPath) {
|
|
24837
25083
|
resolvedAppEntry.sitemapJsonPath = sitemapJsonPath;
|
|
24838
25084
|
resolvedAppEntry.sitemapJson = await ctx.jsonService.read(sitemapJsonPath);
|
|
24839
25085
|
}
|
|
24840
25086
|
}
|
|
24841
25087
|
if (themeLocation) {
|
|
24842
|
-
const { path: themeJsonPath } = await findJsonEntry(
|
|
25088
|
+
const { path: themeJsonPath } = await findJsonEntry(path29.resolve(appDirname, themeLocation));
|
|
24843
25089
|
if (themeJsonPath) {
|
|
24844
25090
|
resolvedAppEntry.themeJsonPath = themeJsonPath;
|
|
24845
25091
|
resolvedAppEntry.themeJson = await ctx.jsonService.read(themeJsonPath);
|
|
@@ -25101,7 +25347,7 @@ function createWebServicePlugin(ctx) {
|
|
|
25101
25347
|
init_esm_shims();
|
|
25102
25348
|
import { removeExtensionDeep as removeExtensionDeep7 } from "@weapp-core/shared";
|
|
25103
25349
|
import fs21 from "fs-extra";
|
|
25104
|
-
import
|
|
25350
|
+
import path30 from "pathe";
|
|
25105
25351
|
|
|
25106
25352
|
// src/wxml/index.ts
|
|
25107
25353
|
init_esm_shims();
|
|
@@ -27803,7 +28049,7 @@ function createWxmlService(ctx) {
|
|
|
27803
28049
|
throw new Error("configService must be initialized before scanning wxml");
|
|
27804
28050
|
}
|
|
27805
28051
|
if (await fs21.exists(filepath)) {
|
|
27806
|
-
const dirname5 =
|
|
28052
|
+
const dirname5 = path30.dirname(filepath);
|
|
27807
28053
|
const wxml = await fs21.readFile(filepath, "utf8");
|
|
27808
28054
|
const shouldRescan = await cache2.isInvalidate(filepath, { content: wxml });
|
|
27809
28055
|
if (!shouldRescan) {
|
|
@@ -27820,9 +28066,9 @@ function createWxmlService(ctx) {
|
|
|
27820
28066
|
filepath,
|
|
27821
28067
|
res.deps.filter((x) => isImportTag(x.tagName) && isTemplate(x.value)).map((x) => {
|
|
27822
28068
|
if (x.value.startsWith("/")) {
|
|
27823
|
-
return
|
|
28069
|
+
return path30.resolve(ctx.configService.absoluteSrcRoot, x.value.slice(1));
|
|
27824
28070
|
} else {
|
|
27825
|
-
return
|
|
28071
|
+
return path30.resolve(dirname5, x.value);
|
|
27826
28072
|
}
|
|
27827
28073
|
})
|
|
27828
28074
|
);
|