weapp-vite 6.2.0 → 6.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auto-import-components/resolvers.mjs +1 -0
- package/dist/auto-routes.mjs +3 -3
- package/dist/{chunk-PMMR7HIQ.mjs → chunk-MEQD2OQV.mjs} +1 -1
- package/dist/{chunk-FC2MZYU3.mjs → chunk-NZGKD6UN.mjs} +1 -1
- package/dist/{chunk-SGNL4SVW.mjs → chunk-R6PSILQG.mjs} +1193 -812
- package/dist/{chunk-2GIOG6RC.mjs → chunk-WH5NEVYM.mjs} +19 -12
- package/dist/cli.mjs +4 -4
- package/dist/{file-JVATZEJQ.mjs → file-XQ5KCZRI.mjs} +1 -1
- package/dist/index.mjs +4 -4
- package/dist/{jsonMacros-VSJW5D23.mjs → jsonMacros-QLL2W47I.mjs} +2 -2
- package/package.json +8 -6
- package/volar.cjs +3 -0
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
traverse,
|
|
36
36
|
usingComponentFromResolvedFile,
|
|
37
37
|
withTempDirLock
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-WH5NEVYM.mjs";
|
|
39
39
|
import {
|
|
40
40
|
changeFileExtension,
|
|
41
41
|
configExtensions,
|
|
@@ -54,7 +54,7 @@ import {
|
|
|
54
54
|
templateExtensions,
|
|
55
55
|
touch,
|
|
56
56
|
vueExtensions
|
|
57
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-NZGKD6UN.mjs";
|
|
58
58
|
import {
|
|
59
59
|
__commonJS,
|
|
60
60
|
__toESM,
|
|
@@ -629,15 +629,15 @@ var LRUCache = class _LRUCache {
|
|
|
629
629
|
purgeTimers[index] = void 0;
|
|
630
630
|
}
|
|
631
631
|
if (ttl !== 0 && purgeTimers) {
|
|
632
|
-
const
|
|
632
|
+
const t33 = setTimeout(() => {
|
|
633
633
|
if (this.#isStale(index)) {
|
|
634
634
|
this.#delete(this.#keyList[index], "expire");
|
|
635
635
|
}
|
|
636
636
|
}, ttl + 1);
|
|
637
|
-
if (
|
|
638
|
-
|
|
637
|
+
if (t33.unref) {
|
|
638
|
+
t33.unref();
|
|
639
639
|
}
|
|
640
|
-
purgeTimers[index] =
|
|
640
|
+
purgeTimers[index] = t33;
|
|
641
641
|
}
|
|
642
642
|
};
|
|
643
643
|
this.#updateItemAge = (index) => {
|
|
@@ -661,9 +661,9 @@ var LRUCache = class _LRUCache {
|
|
|
661
661
|
const n = this.#perf.now();
|
|
662
662
|
if (this.ttlResolution > 0) {
|
|
663
663
|
cachedNow = n;
|
|
664
|
-
const
|
|
665
|
-
if (
|
|
666
|
-
|
|
664
|
+
const t33 = setTimeout(() => cachedNow = 0, this.ttlResolution);
|
|
665
|
+
if (t33.unref) {
|
|
666
|
+
t33.unref();
|
|
667
667
|
}
|
|
668
668
|
}
|
|
669
669
|
return n;
|
|
@@ -683,8 +683,8 @@ var LRUCache = class _LRUCache {
|
|
|
683
683
|
};
|
|
684
684
|
this.#isStale = (index) => {
|
|
685
685
|
const s = starts[index];
|
|
686
|
-
const
|
|
687
|
-
return !!
|
|
686
|
+
const t33 = ttls[index];
|
|
687
|
+
return !!t33 && !!s && (cachedNow || getNow()) - s > t33;
|
|
688
688
|
};
|
|
689
689
|
}
|
|
690
690
|
// conditionally set private methods related to TTL
|
|
@@ -1636,9 +1636,9 @@ var LRUCache = class _LRUCache {
|
|
|
1636
1636
|
if (this.#ttls && this.#starts) {
|
|
1637
1637
|
this.#ttls.fill(0);
|
|
1638
1638
|
this.#starts.fill(0);
|
|
1639
|
-
for (const
|
|
1640
|
-
if (
|
|
1641
|
-
clearTimeout(
|
|
1639
|
+
for (const t33 of this.#autopurgeTimers ?? []) {
|
|
1640
|
+
if (t33 !== void 0)
|
|
1641
|
+
clearTimeout(t33);
|
|
1642
1642
|
}
|
|
1643
1643
|
this.#autopurgeTimers?.fill(void 0);
|
|
1644
1644
|
}
|
|
@@ -2178,11 +2178,11 @@ function extractComponentProps(code) {
|
|
|
2178
2178
|
const ast = parse(code, BABEL_TS_MODULE_PARSER_OPTIONS);
|
|
2179
2179
|
let props = /* @__PURE__ */ new Map();
|
|
2180
2180
|
traverse(ast, {
|
|
2181
|
-
CallExpression(
|
|
2181
|
+
CallExpression(path71) {
|
|
2182
2182
|
if (props.size > 0) {
|
|
2183
2183
|
return;
|
|
2184
2184
|
}
|
|
2185
|
-
const [options] =
|
|
2185
|
+
const [options] = path71.node.arguments;
|
|
2186
2186
|
if (!options || options.type !== "ObjectExpression") {
|
|
2187
2187
|
return;
|
|
2188
2188
|
}
|
|
@@ -2353,12 +2353,12 @@ function extractComponentPropsFromDts(code) {
|
|
|
2353
2353
|
errorRecovery: true
|
|
2354
2354
|
});
|
|
2355
2355
|
traverse(ast, {
|
|
2356
|
-
TSInterfaceDeclaration(
|
|
2356
|
+
TSInterfaceDeclaration(path71) {
|
|
2357
2357
|
if (props.size > 0) {
|
|
2358
|
-
|
|
2358
|
+
path71.stop();
|
|
2359
2359
|
return;
|
|
2360
2360
|
}
|
|
2361
|
-
for (const member of
|
|
2361
|
+
for (const member of path71.node.body.body) {
|
|
2362
2362
|
if (member.type !== "TSPropertySignature") {
|
|
2363
2363
|
continue;
|
|
2364
2364
|
}
|
|
@@ -2369,22 +2369,22 @@ function extractComponentPropsFromDts(code) {
|
|
|
2369
2369
|
const typeNode = unwrapTypeAnnotation(member.typeAnnotation);
|
|
2370
2370
|
if (typeNode?.type === "TSTypeLiteral") {
|
|
2371
2371
|
props = extractFromPropertiesTypeLiteral(typeNode);
|
|
2372
|
-
|
|
2372
|
+
path71.stop();
|
|
2373
2373
|
return;
|
|
2374
2374
|
}
|
|
2375
2375
|
}
|
|
2376
|
-
const extracted = extractFromPropsInterfaceMembers(
|
|
2376
|
+
const extracted = extractFromPropsInterfaceMembers(path71.node);
|
|
2377
2377
|
if (extracted.size > 0) {
|
|
2378
2378
|
props = extracted;
|
|
2379
|
-
|
|
2379
|
+
path71.stop();
|
|
2380
2380
|
}
|
|
2381
2381
|
},
|
|
2382
|
-
ClassDeclaration(
|
|
2382
|
+
ClassDeclaration(path71) {
|
|
2383
2383
|
if (props.size > 0) {
|
|
2384
|
-
|
|
2384
|
+
path71.stop();
|
|
2385
2385
|
return;
|
|
2386
2386
|
}
|
|
2387
|
-
for (const member of
|
|
2387
|
+
for (const member of path71.node.body.body) {
|
|
2388
2388
|
if (member.type !== "ClassProperty" && member.type !== "ClassAccessorProperty") {
|
|
2389
2389
|
continue;
|
|
2390
2390
|
}
|
|
@@ -2395,7 +2395,7 @@ function extractComponentPropsFromDts(code) {
|
|
|
2395
2395
|
const typeNode = unwrapTypeAnnotation(member.typeAnnotation);
|
|
2396
2396
|
if (typeNode?.type === "TSTypeLiteral") {
|
|
2397
2397
|
props = extractFromPropertiesTypeLiteral(typeNode);
|
|
2398
|
-
|
|
2398
|
+
path71.stop();
|
|
2399
2399
|
return;
|
|
2400
2400
|
}
|
|
2401
2401
|
}
|
|
@@ -8366,7 +8366,7 @@ function createSharedBuildConfig(configService, scanService) {
|
|
|
8366
8366
|
build: {
|
|
8367
8367
|
rolldownOptions: {
|
|
8368
8368
|
output: {
|
|
8369
|
-
|
|
8369
|
+
codeSplitting: {
|
|
8370
8370
|
groups: [
|
|
8371
8371
|
{
|
|
8372
8372
|
name: (id, ctx) => resolveAdvancedChunkName(id, ctx)
|
|
@@ -11310,12 +11310,12 @@ var PathBase = class {
|
|
|
11310
11310
|
/**
|
|
11311
11311
|
* Get the Path object referenced by the string path, resolved from this Path
|
|
11312
11312
|
*/
|
|
11313
|
-
resolve(
|
|
11314
|
-
if (!
|
|
11313
|
+
resolve(path71) {
|
|
11314
|
+
if (!path71) {
|
|
11315
11315
|
return this;
|
|
11316
11316
|
}
|
|
11317
|
-
const rootPath = this.getRootString(
|
|
11318
|
-
const dir =
|
|
11317
|
+
const rootPath = this.getRootString(path71);
|
|
11318
|
+
const dir = path71.substring(rootPath.length);
|
|
11319
11319
|
const dirParts = dir.split(this.splitSep);
|
|
11320
11320
|
const result = rootPath ? this.getRoot(rootPath).#resolveParts(dirParts) : this.#resolveParts(dirParts);
|
|
11321
11321
|
return result;
|
|
@@ -11697,10 +11697,10 @@ var PathBase = class {
|
|
|
11697
11697
|
#markENOTDIR() {
|
|
11698
11698
|
if (this.#type & ENOTDIR)
|
|
11699
11699
|
return;
|
|
11700
|
-
let
|
|
11701
|
-
if ((
|
|
11702
|
-
|
|
11703
|
-
this.#type =
|
|
11700
|
+
let t33 = this.#type;
|
|
11701
|
+
if ((t33 & IFMT) === IFDIR)
|
|
11702
|
+
t33 &= IFMT_UNKNOWN;
|
|
11703
|
+
this.#type = t33 | ENOTDIR;
|
|
11704
11704
|
this.#markChildrenENOENT();
|
|
11705
11705
|
}
|
|
11706
11706
|
#readdirFail(code = "") {
|
|
@@ -12067,8 +12067,8 @@ var PathWin32 = class _PathWin32 extends PathBase {
|
|
|
12067
12067
|
/**
|
|
12068
12068
|
* @internal
|
|
12069
12069
|
*/
|
|
12070
|
-
getRootString(
|
|
12071
|
-
return win32.parse(
|
|
12070
|
+
getRootString(path71) {
|
|
12071
|
+
return win32.parse(path71).root;
|
|
12072
12072
|
}
|
|
12073
12073
|
/**
|
|
12074
12074
|
* @internal
|
|
@@ -12114,8 +12114,8 @@ var PathPosix = class _PathPosix extends PathBase {
|
|
|
12114
12114
|
/**
|
|
12115
12115
|
* @internal
|
|
12116
12116
|
*/
|
|
12117
|
-
getRootString(
|
|
12118
|
-
return
|
|
12117
|
+
getRootString(path71) {
|
|
12118
|
+
return path71.startsWith("/") ? "/" : "";
|
|
12119
12119
|
}
|
|
12120
12120
|
/**
|
|
12121
12121
|
* @internal
|
|
@@ -12204,11 +12204,11 @@ var PathScurryBase = class {
|
|
|
12204
12204
|
/**
|
|
12205
12205
|
* Get the depth of a provided path, string, or the cwd
|
|
12206
12206
|
*/
|
|
12207
|
-
depth(
|
|
12208
|
-
if (typeof
|
|
12209
|
-
|
|
12207
|
+
depth(path71 = this.cwd) {
|
|
12208
|
+
if (typeof path71 === "string") {
|
|
12209
|
+
path71 = this.cwd.resolve(path71);
|
|
12210
12210
|
}
|
|
12211
|
-
return
|
|
12211
|
+
return path71.depth();
|
|
12212
12212
|
}
|
|
12213
12213
|
/**
|
|
12214
12214
|
* Return the cache of child entries. Exposed so subclasses can create
|
|
@@ -12695,9 +12695,9 @@ var PathScurryBase = class {
|
|
|
12695
12695
|
process11();
|
|
12696
12696
|
return results;
|
|
12697
12697
|
}
|
|
12698
|
-
chdir(
|
|
12698
|
+
chdir(path71 = this.cwd) {
|
|
12699
12699
|
const oldCwd = this.cwd;
|
|
12700
|
-
this.cwd = typeof
|
|
12700
|
+
this.cwd = typeof path71 === "string" ? this.cwd.resolve(path71) : path71;
|
|
12701
12701
|
this.cwd[setAsCwd](oldCwd);
|
|
12702
12702
|
}
|
|
12703
12703
|
};
|
|
@@ -13059,8 +13059,8 @@ var MatchRecord = class {
|
|
|
13059
13059
|
}
|
|
13060
13060
|
// match, absolute, ifdir
|
|
13061
13061
|
entries() {
|
|
13062
|
-
return [...this.store.entries()].map(([
|
|
13063
|
-
|
|
13062
|
+
return [...this.store.entries()].map(([path71, n]) => [
|
|
13063
|
+
path71,
|
|
13064
13064
|
!!(n & 2),
|
|
13065
13065
|
!!(n & 1)
|
|
13066
13066
|
]);
|
|
@@ -13091,7 +13091,7 @@ var SubWalks = class {
|
|
|
13091
13091
|
return this.keys().map((k) => [k, this.store.get(k)]);
|
|
13092
13092
|
}
|
|
13093
13093
|
keys() {
|
|
13094
|
-
return [...this.store.keys()].filter((
|
|
13094
|
+
return [...this.store.keys()].filter((t33) => t33.canReaddir());
|
|
13095
13095
|
}
|
|
13096
13096
|
};
|
|
13097
13097
|
var Processor = class _Processor {
|
|
@@ -13111,53 +13111,53 @@ var Processor = class _Processor {
|
|
|
13111
13111
|
processPatterns(target, patterns) {
|
|
13112
13112
|
this.patterns = patterns;
|
|
13113
13113
|
const processingSet = patterns.map((p) => [target, p]);
|
|
13114
|
-
for (let [
|
|
13115
|
-
this.hasWalkedCache.storeWalked(
|
|
13114
|
+
for (let [t33, pattern] of processingSet) {
|
|
13115
|
+
this.hasWalkedCache.storeWalked(t33, pattern);
|
|
13116
13116
|
const root = pattern.root();
|
|
13117
13117
|
const absolute = pattern.isAbsolute() && this.opts.absolute !== false;
|
|
13118
13118
|
if (root) {
|
|
13119
|
-
|
|
13119
|
+
t33 = t33.resolve(root === "/" && this.opts.root !== void 0 ? this.opts.root : root);
|
|
13120
13120
|
const rest2 = pattern.rest();
|
|
13121
13121
|
if (!rest2) {
|
|
13122
|
-
this.matches.add(
|
|
13122
|
+
this.matches.add(t33, true, false);
|
|
13123
13123
|
continue;
|
|
13124
13124
|
} else {
|
|
13125
13125
|
pattern = rest2;
|
|
13126
13126
|
}
|
|
13127
13127
|
}
|
|
13128
|
-
if (
|
|
13128
|
+
if (t33.isENOENT())
|
|
13129
13129
|
continue;
|
|
13130
13130
|
let p;
|
|
13131
13131
|
let rest;
|
|
13132
13132
|
let changed = false;
|
|
13133
13133
|
while (typeof (p = pattern.pattern()) === "string" && (rest = pattern.rest())) {
|
|
13134
|
-
const c =
|
|
13135
|
-
|
|
13134
|
+
const c = t33.resolve(p);
|
|
13135
|
+
t33 = c;
|
|
13136
13136
|
pattern = rest;
|
|
13137
13137
|
changed = true;
|
|
13138
13138
|
}
|
|
13139
13139
|
p = pattern.pattern();
|
|
13140
13140
|
rest = pattern.rest();
|
|
13141
13141
|
if (changed) {
|
|
13142
|
-
if (this.hasWalkedCache.hasWalked(
|
|
13142
|
+
if (this.hasWalkedCache.hasWalked(t33, pattern))
|
|
13143
13143
|
continue;
|
|
13144
|
-
this.hasWalkedCache.storeWalked(
|
|
13144
|
+
this.hasWalkedCache.storeWalked(t33, pattern);
|
|
13145
13145
|
}
|
|
13146
13146
|
if (typeof p === "string") {
|
|
13147
13147
|
const ifDir = p === ".." || p === "" || p === ".";
|
|
13148
|
-
this.matches.add(
|
|
13148
|
+
this.matches.add(t33.resolve(p), absolute, ifDir);
|
|
13149
13149
|
continue;
|
|
13150
13150
|
} else if (p === GLOBSTAR) {
|
|
13151
|
-
if (!
|
|
13152
|
-
this.subwalks.add(
|
|
13151
|
+
if (!t33.isSymbolicLink() || this.follow || pattern.checkFollowGlobstar()) {
|
|
13152
|
+
this.subwalks.add(t33, pattern);
|
|
13153
13153
|
}
|
|
13154
13154
|
const rp = rest?.pattern();
|
|
13155
13155
|
const rrest = rest?.rest();
|
|
13156
13156
|
if (!rest || (rp === "" || rp === ".") && !rrest) {
|
|
13157
|
-
this.matches.add(
|
|
13157
|
+
this.matches.add(t33, absolute, rp === "" || rp === ".");
|
|
13158
13158
|
} else {
|
|
13159
13159
|
if (rp === "..") {
|
|
13160
|
-
const tp =
|
|
13160
|
+
const tp = t33.parent || t33;
|
|
13161
13161
|
if (!rrest)
|
|
13162
13162
|
this.matches.add(tp, absolute, true);
|
|
13163
13163
|
else if (!this.hasWalkedCache.hasWalked(tp, rrest)) {
|
|
@@ -13166,7 +13166,7 @@ var Processor = class _Processor {
|
|
|
13166
13166
|
}
|
|
13167
13167
|
}
|
|
13168
13168
|
} else if (p instanceof RegExp) {
|
|
13169
|
-
this.subwalks.add(
|
|
13169
|
+
this.subwalks.add(t33, pattern);
|
|
13170
13170
|
}
|
|
13171
13171
|
}
|
|
13172
13172
|
return this;
|
|
@@ -13265,9 +13265,9 @@ var GlobUtil = class {
|
|
|
13265
13265
|
signal;
|
|
13266
13266
|
maxDepth;
|
|
13267
13267
|
includeChildMatches;
|
|
13268
|
-
constructor(patterns,
|
|
13268
|
+
constructor(patterns, path71, opts) {
|
|
13269
13269
|
this.patterns = patterns;
|
|
13270
|
-
this.path =
|
|
13270
|
+
this.path = path71;
|
|
13271
13271
|
this.opts = opts;
|
|
13272
13272
|
this.#sep = !opts.posix && opts.platform === "win32" ? "\\" : "/";
|
|
13273
13273
|
this.includeChildMatches = opts.includeChildMatches !== false;
|
|
@@ -13286,11 +13286,11 @@ var GlobUtil = class {
|
|
|
13286
13286
|
});
|
|
13287
13287
|
}
|
|
13288
13288
|
}
|
|
13289
|
-
#ignored(
|
|
13290
|
-
return this.seen.has(
|
|
13289
|
+
#ignored(path71) {
|
|
13290
|
+
return this.seen.has(path71) || !!this.#ignore?.ignored?.(path71);
|
|
13291
13291
|
}
|
|
13292
|
-
#childrenIgnored(
|
|
13293
|
-
return !!this.#ignore?.childrenIgnored?.(
|
|
13292
|
+
#childrenIgnored(path71) {
|
|
13293
|
+
return !!this.#ignore?.childrenIgnored?.(path71);
|
|
13294
13294
|
}
|
|
13295
13295
|
// backpressure mechanism
|
|
13296
13296
|
pause() {
|
|
@@ -13416,16 +13416,16 @@ var GlobUtil = class {
|
|
|
13416
13416
|
tasks++;
|
|
13417
13417
|
this.match(m, absolute, ifDir).then(() => next());
|
|
13418
13418
|
}
|
|
13419
|
-
for (const
|
|
13420
|
-
if (this.maxDepth !== Infinity &&
|
|
13419
|
+
for (const t33 of processor.subwalkTargets()) {
|
|
13420
|
+
if (this.maxDepth !== Infinity && t33.depth() >= this.maxDepth) {
|
|
13421
13421
|
continue;
|
|
13422
13422
|
}
|
|
13423
13423
|
tasks++;
|
|
13424
|
-
const childrenCached =
|
|
13425
|
-
if (
|
|
13426
|
-
this.walkCB3(
|
|
13424
|
+
const childrenCached = t33.readdirCached();
|
|
13425
|
+
if (t33.calledReaddir())
|
|
13426
|
+
this.walkCB3(t33, childrenCached, processor, next);
|
|
13427
13427
|
else {
|
|
13428
|
-
|
|
13428
|
+
t33.readdirCB((_, entries) => this.walkCB3(t33, entries, processor, next), true);
|
|
13429
13429
|
}
|
|
13430
13430
|
}
|
|
13431
13431
|
next();
|
|
@@ -13474,13 +13474,13 @@ var GlobUtil = class {
|
|
|
13474
13474
|
continue;
|
|
13475
13475
|
this.matchSync(m, absolute, ifDir);
|
|
13476
13476
|
}
|
|
13477
|
-
for (const
|
|
13478
|
-
if (this.maxDepth !== Infinity &&
|
|
13477
|
+
for (const t33 of processor.subwalkTargets()) {
|
|
13478
|
+
if (this.maxDepth !== Infinity && t33.depth() >= this.maxDepth) {
|
|
13479
13479
|
continue;
|
|
13480
13480
|
}
|
|
13481
13481
|
tasks++;
|
|
13482
|
-
const children =
|
|
13483
|
-
this.walkCB3Sync(
|
|
13482
|
+
const children = t33.readdirSync();
|
|
13483
|
+
this.walkCB3Sync(t33, children, processor, next);
|
|
13484
13484
|
}
|
|
13485
13485
|
next();
|
|
13486
13486
|
}
|
|
@@ -13505,8 +13505,8 @@ var GlobUtil = class {
|
|
|
13505
13505
|
};
|
|
13506
13506
|
var GlobWalker = class extends GlobUtil {
|
|
13507
13507
|
matches = /* @__PURE__ */ new Set();
|
|
13508
|
-
constructor(patterns,
|
|
13509
|
-
super(patterns,
|
|
13508
|
+
constructor(patterns, path71, opts) {
|
|
13509
|
+
super(patterns, path71, opts);
|
|
13510
13510
|
}
|
|
13511
13511
|
matchEmit(e) {
|
|
13512
13512
|
this.matches.add(e);
|
|
@@ -13543,8 +13543,8 @@ var GlobWalker = class extends GlobUtil {
|
|
|
13543
13543
|
};
|
|
13544
13544
|
var GlobStream = class extends GlobUtil {
|
|
13545
13545
|
results;
|
|
13546
|
-
constructor(patterns,
|
|
13547
|
-
super(patterns,
|
|
13546
|
+
constructor(patterns, path71, opts) {
|
|
13547
|
+
super(patterns, path71, opts);
|
|
13548
13548
|
this.results = new Minipass({
|
|
13549
13549
|
signal: this.signal,
|
|
13550
13550
|
objectMode: true
|
|
@@ -13840,7 +13840,7 @@ glob.glob = glob;
|
|
|
13840
13840
|
|
|
13841
13841
|
// ../../node_modules/.pnpm/rimraf@6.1.2/node_modules/rimraf/dist/esm/opt-arg.js
|
|
13842
13842
|
init_esm_shims();
|
|
13843
|
-
var typeOrUndef = (val,
|
|
13843
|
+
var typeOrUndef = (val, t33) => typeof val === "undefined" || typeof val === t33;
|
|
13844
13844
|
var isRimrafOptions = (o) => !!o && typeof o === "object" && typeOrUndef(o.preserveRoot, "boolean") && typeOrUndef(o.tmp, "string") && typeOrUndef(o.maxRetries, "number") && typeOrUndef(o.retryDelay, "number") && typeOrUndef(o.backoff, "number") && typeOrUndef(o.maxBackoff, "number") && (typeOrUndef(o.glob, "boolean") || o.glob && typeof o.glob === "object") && typeOrUndef(o.filter, "function");
|
|
13845
13845
|
var assertRimrafOptions = (o) => {
|
|
13846
13846
|
if (!isRimrafOptions(o)) {
|
|
@@ -13875,44 +13875,44 @@ var optArgSync = (opt = {}) => optArgT(opt);
|
|
|
13875
13875
|
init_esm_shims();
|
|
13876
13876
|
import { parse as parse2, resolve } from "path";
|
|
13877
13877
|
import { inspect } from "util";
|
|
13878
|
-
var pathArg = (
|
|
13879
|
-
const type = typeof
|
|
13878
|
+
var pathArg = (path71, opt = {}) => {
|
|
13879
|
+
const type = typeof path71;
|
|
13880
13880
|
if (type !== "string") {
|
|
13881
|
-
const ctor =
|
|
13882
|
-
const received = ctor && ctor.name ? `an instance of ${ctor.name}` : type === "object" ? inspect(
|
|
13881
|
+
const ctor = path71 && type === "object" && path71.constructor;
|
|
13882
|
+
const received = ctor && ctor.name ? `an instance of ${ctor.name}` : type === "object" ? inspect(path71) : `type ${type} ${path71}`;
|
|
13883
13883
|
const msg = `The "path" argument must be of type string. Received ${received}`;
|
|
13884
13884
|
throw Object.assign(new TypeError(msg), {
|
|
13885
|
-
path:
|
|
13885
|
+
path: path71,
|
|
13886
13886
|
code: "ERR_INVALID_ARG_TYPE"
|
|
13887
13887
|
});
|
|
13888
13888
|
}
|
|
13889
|
-
if (/\0/.test(
|
|
13889
|
+
if (/\0/.test(path71)) {
|
|
13890
13890
|
const msg = "path must be a string without null bytes";
|
|
13891
13891
|
throw Object.assign(new TypeError(msg), {
|
|
13892
|
-
path:
|
|
13892
|
+
path: path71,
|
|
13893
13893
|
code: "ERR_INVALID_ARG_VALUE"
|
|
13894
13894
|
});
|
|
13895
13895
|
}
|
|
13896
|
-
|
|
13897
|
-
const { root } = parse2(
|
|
13898
|
-
if (
|
|
13896
|
+
path71 = resolve(path71);
|
|
13897
|
+
const { root } = parse2(path71);
|
|
13898
|
+
if (path71 === root && opt.preserveRoot !== false) {
|
|
13899
13899
|
const msg = "refusing to remove root directory without preserveRoot:false";
|
|
13900
13900
|
throw Object.assign(new Error(msg), {
|
|
13901
|
-
path:
|
|
13901
|
+
path: path71,
|
|
13902
13902
|
code: "ERR_PRESERVE_ROOT"
|
|
13903
13903
|
});
|
|
13904
13904
|
}
|
|
13905
13905
|
if (process.platform === "win32") {
|
|
13906
13906
|
const badWinChars = /[*|"<>?:]/;
|
|
13907
|
-
const { root: root2 } = parse2(
|
|
13908
|
-
if (badWinChars.test(
|
|
13907
|
+
const { root: root2 } = parse2(path71);
|
|
13908
|
+
if (badWinChars.test(path71.substring(root2.length))) {
|
|
13909
13909
|
throw Object.assign(new Error("Illegal characters in path."), {
|
|
13910
|
-
path:
|
|
13910
|
+
path: path71,
|
|
13911
13911
|
code: "EINVAL"
|
|
13912
13912
|
});
|
|
13913
13913
|
}
|
|
13914
13914
|
}
|
|
13915
|
-
return
|
|
13915
|
+
return path71;
|
|
13916
13916
|
};
|
|
13917
13917
|
var path_arg_default = pathArg;
|
|
13918
13918
|
|
|
@@ -13927,11 +13927,11 @@ init_esm_shims();
|
|
|
13927
13927
|
import { readdirSync as rdSync } from "fs";
|
|
13928
13928
|
import fsPromises from "fs/promises";
|
|
13929
13929
|
import { chmodSync, mkdirSync, renameSync, rmdirSync, rmSync, statSync, lstatSync as lstatSync2, unlinkSync } from "fs";
|
|
13930
|
-
var readdirSync2 = (
|
|
13930
|
+
var readdirSync2 = (path71) => rdSync(path71, { withFileTypes: true });
|
|
13931
13931
|
var promises = {
|
|
13932
13932
|
chmod: fsPromises.chmod,
|
|
13933
13933
|
mkdir: fsPromises.mkdir,
|
|
13934
|
-
readdir: (
|
|
13934
|
+
readdir: (path71) => fsPromises.readdir(path71, { withFileTypes: true }),
|
|
13935
13935
|
rename: fsPromises.rename,
|
|
13936
13936
|
rm: fsPromises.rm,
|
|
13937
13937
|
rmdir: fsPromises.rmdir,
|
|
@@ -13946,10 +13946,10 @@ import { parse as parse3, resolve as resolve2 } from "path";
|
|
|
13946
13946
|
// ../../node_modules/.pnpm/rimraf@6.1.2/node_modules/rimraf/dist/esm/readdir-or-error.js
|
|
13947
13947
|
init_esm_shims();
|
|
13948
13948
|
var { readdir: readdir2 } = promises;
|
|
13949
|
-
var readdirOrError = (
|
|
13950
|
-
var readdirOrErrorSync = (
|
|
13949
|
+
var readdirOrError = (path71) => readdir2(path71).catch((er) => er);
|
|
13950
|
+
var readdirOrErrorSync = (path71) => {
|
|
13951
13951
|
try {
|
|
13952
|
-
return readdirSync2(
|
|
13952
|
+
return readdirSync2(path71);
|
|
13953
13953
|
} catch (er) {
|
|
13954
13954
|
return er;
|
|
13955
13955
|
}
|
|
@@ -13985,17 +13985,17 @@ var ignoreENOENTSync = (fn, rethrow) => {
|
|
|
13985
13985
|
|
|
13986
13986
|
// ../../node_modules/.pnpm/rimraf@6.1.2/node_modules/rimraf/dist/esm/rimraf-posix.js
|
|
13987
13987
|
var { lstat: lstat2, rmdir, unlink } = promises;
|
|
13988
|
-
var rimrafPosix = async (
|
|
13988
|
+
var rimrafPosix = async (path71, opt) => {
|
|
13989
13989
|
opt?.signal?.throwIfAborted();
|
|
13990
|
-
return await ignoreENOENT(lstat2(
|
|
13990
|
+
return await ignoreENOENT(lstat2(path71).then((stat5) => rimrafPosixDir(path71, opt, stat5))) ?? true;
|
|
13991
13991
|
};
|
|
13992
|
-
var rimrafPosixSync = (
|
|
13992
|
+
var rimrafPosixSync = (path71, opt) => {
|
|
13993
13993
|
opt?.signal?.throwIfAborted();
|
|
13994
|
-
return ignoreENOENTSync(() => rimrafPosixDirSync(
|
|
13994
|
+
return ignoreENOENTSync(() => rimrafPosixDirSync(path71, opt, lstatSync2(path71))) ?? true;
|
|
13995
13995
|
};
|
|
13996
|
-
var rimrafPosixDir = async (
|
|
13996
|
+
var rimrafPosixDir = async (path71, opt, ent) => {
|
|
13997
13997
|
opt?.signal?.throwIfAborted();
|
|
13998
|
-
const entries = ent.isDirectory() ? await readdirOrError(
|
|
13998
|
+
const entries = ent.isDirectory() ? await readdirOrError(path71) : null;
|
|
13999
13999
|
if (!Array.isArray(entries)) {
|
|
14000
14000
|
if (entries) {
|
|
14001
14001
|
if (errorCode(entries) === "ENOENT") {
|
|
@@ -14005,28 +14005,28 @@ var rimrafPosixDir = async (path70, opt, ent) => {
|
|
|
14005
14005
|
throw entries;
|
|
14006
14006
|
}
|
|
14007
14007
|
}
|
|
14008
|
-
if (opt.filter && !await opt.filter(
|
|
14008
|
+
if (opt.filter && !await opt.filter(path71, ent)) {
|
|
14009
14009
|
return false;
|
|
14010
14010
|
}
|
|
14011
|
-
await ignoreENOENT(unlink(
|
|
14011
|
+
await ignoreENOENT(unlink(path71));
|
|
14012
14012
|
return true;
|
|
14013
14013
|
}
|
|
14014
|
-
const removedAll = (await Promise.all(entries.map((ent2) => rimrafPosixDir(resolve2(
|
|
14014
|
+
const removedAll = (await Promise.all(entries.map((ent2) => rimrafPosixDir(resolve2(path71, ent2.name), opt, ent2)))).every((v) => v === true);
|
|
14015
14015
|
if (!removedAll) {
|
|
14016
14016
|
return false;
|
|
14017
14017
|
}
|
|
14018
|
-
if (opt.preserveRoot === false &&
|
|
14018
|
+
if (opt.preserveRoot === false && path71 === parse3(path71).root) {
|
|
14019
14019
|
return false;
|
|
14020
14020
|
}
|
|
14021
|
-
if (opt.filter && !await opt.filter(
|
|
14021
|
+
if (opt.filter && !await opt.filter(path71, ent)) {
|
|
14022
14022
|
return false;
|
|
14023
14023
|
}
|
|
14024
|
-
await ignoreENOENT(rmdir(
|
|
14024
|
+
await ignoreENOENT(rmdir(path71));
|
|
14025
14025
|
return true;
|
|
14026
14026
|
};
|
|
14027
|
-
var rimrafPosixDirSync = (
|
|
14027
|
+
var rimrafPosixDirSync = (path71, opt, ent) => {
|
|
14028
14028
|
opt?.signal?.throwIfAborted();
|
|
14029
|
-
const entries = ent.isDirectory() ? readdirOrErrorSync(
|
|
14029
|
+
const entries = ent.isDirectory() ? readdirOrErrorSync(path71) : null;
|
|
14030
14030
|
if (!Array.isArray(entries)) {
|
|
14031
14031
|
if (entries) {
|
|
14032
14032
|
if (errorCode(entries) === "ENOENT") {
|
|
@@ -14036,27 +14036,27 @@ var rimrafPosixDirSync = (path70, opt, ent) => {
|
|
|
14036
14036
|
throw entries;
|
|
14037
14037
|
}
|
|
14038
14038
|
}
|
|
14039
|
-
if (opt.filter && !opt.filter(
|
|
14039
|
+
if (opt.filter && !opt.filter(path71, ent)) {
|
|
14040
14040
|
return false;
|
|
14041
14041
|
}
|
|
14042
|
-
ignoreENOENTSync(() => unlinkSync(
|
|
14042
|
+
ignoreENOENTSync(() => unlinkSync(path71));
|
|
14043
14043
|
return true;
|
|
14044
14044
|
}
|
|
14045
14045
|
let removedAll = true;
|
|
14046
14046
|
for (const ent2 of entries) {
|
|
14047
|
-
const p = resolve2(
|
|
14047
|
+
const p = resolve2(path71, ent2.name);
|
|
14048
14048
|
removedAll = rimrafPosixDirSync(p, opt, ent2) && removedAll;
|
|
14049
14049
|
}
|
|
14050
|
-
if (opt.preserveRoot === false &&
|
|
14050
|
+
if (opt.preserveRoot === false && path71 === parse3(path71).root) {
|
|
14051
14051
|
return false;
|
|
14052
14052
|
}
|
|
14053
14053
|
if (!removedAll) {
|
|
14054
14054
|
return false;
|
|
14055
14055
|
}
|
|
14056
|
-
if (opt.filter && !opt.filter(
|
|
14056
|
+
if (opt.filter && !opt.filter(path71, ent)) {
|
|
14057
14057
|
return false;
|
|
14058
14058
|
}
|
|
14059
|
-
ignoreENOENTSync(() => rmdirSync(
|
|
14059
|
+
ignoreENOENTSync(() => rmdirSync(path71));
|
|
14060
14060
|
return true;
|
|
14061
14061
|
};
|
|
14062
14062
|
|
|
@@ -14067,28 +14067,28 @@ import { parse as parse6, resolve as resolve5 } from "path";
|
|
|
14067
14067
|
// ../../node_modules/.pnpm/rimraf@6.1.2/node_modules/rimraf/dist/esm/fix-eperm.js
|
|
14068
14068
|
init_esm_shims();
|
|
14069
14069
|
var { chmod } = promises;
|
|
14070
|
-
var fixEPERM = (fn) => async (
|
|
14070
|
+
var fixEPERM = (fn) => async (path71) => {
|
|
14071
14071
|
try {
|
|
14072
|
-
return void await ignoreENOENT(fn(
|
|
14072
|
+
return void await ignoreENOENT(fn(path71));
|
|
14073
14073
|
} catch (er) {
|
|
14074
14074
|
if (errorCode(er) === "EPERM") {
|
|
14075
|
-
if (!await ignoreENOENT(chmod(
|
|
14075
|
+
if (!await ignoreENOENT(chmod(path71, 438).then(() => true), er)) {
|
|
14076
14076
|
return;
|
|
14077
14077
|
}
|
|
14078
|
-
return void await fn(
|
|
14078
|
+
return void await fn(path71);
|
|
14079
14079
|
}
|
|
14080
14080
|
throw er;
|
|
14081
14081
|
}
|
|
14082
14082
|
};
|
|
14083
|
-
var fixEPERMSync = (fn) => (
|
|
14083
|
+
var fixEPERMSync = (fn) => (path71) => {
|
|
14084
14084
|
try {
|
|
14085
|
-
return void ignoreENOENTSync(() => fn(
|
|
14085
|
+
return void ignoreENOENTSync(() => fn(path71));
|
|
14086
14086
|
} catch (er) {
|
|
14087
14087
|
if (errorCode(er) === "EPERM") {
|
|
14088
|
-
if (!ignoreENOENTSync(() => (chmodSync(
|
|
14088
|
+
if (!ignoreENOENTSync(() => (chmodSync(path71, 438), true), er)) {
|
|
14089
14089
|
return;
|
|
14090
14090
|
}
|
|
14091
|
-
return void fn(
|
|
14091
|
+
return void fn(path71);
|
|
14092
14092
|
}
|
|
14093
14093
|
throw er;
|
|
14094
14094
|
}
|
|
@@ -14102,21 +14102,21 @@ var RATE = 1.2;
|
|
|
14102
14102
|
var MAXRETRIES = 10;
|
|
14103
14103
|
var codes = /* @__PURE__ */ new Set(["EMFILE", "ENFILE", "EBUSY"]);
|
|
14104
14104
|
var retryBusy = (fn) => {
|
|
14105
|
-
const method = async (
|
|
14105
|
+
const method = async (path71, opt, backoff = 1, total = 0) => {
|
|
14106
14106
|
const mbo = opt.maxBackoff || MAXBACKOFF;
|
|
14107
14107
|
const rate = opt.backoff || RATE;
|
|
14108
14108
|
const max = opt.maxRetries || MAXRETRIES;
|
|
14109
14109
|
let retries = 0;
|
|
14110
14110
|
while (true) {
|
|
14111
14111
|
try {
|
|
14112
|
-
return await fn(
|
|
14112
|
+
return await fn(path71);
|
|
14113
14113
|
} catch (er) {
|
|
14114
|
-
if (isFsError(er) && er.path ===
|
|
14114
|
+
if (isFsError(er) && er.path === path71 && codes.has(er.code)) {
|
|
14115
14115
|
backoff = Math.ceil(backoff * rate);
|
|
14116
14116
|
total = backoff + total;
|
|
14117
14117
|
if (total < mbo) {
|
|
14118
14118
|
await setTimeout2(backoff);
|
|
14119
|
-
return method(
|
|
14119
|
+
return method(path71, opt, backoff, total);
|
|
14120
14120
|
}
|
|
14121
14121
|
if (retries < max) {
|
|
14122
14122
|
retries++;
|
|
@@ -14130,14 +14130,14 @@ var retryBusy = (fn) => {
|
|
|
14130
14130
|
return method;
|
|
14131
14131
|
};
|
|
14132
14132
|
var retryBusySync = (fn) => {
|
|
14133
|
-
const method = (
|
|
14133
|
+
const method = (path71, opt) => {
|
|
14134
14134
|
const max = opt.maxRetries || MAXRETRIES;
|
|
14135
14135
|
let retries = 0;
|
|
14136
14136
|
while (true) {
|
|
14137
14137
|
try {
|
|
14138
|
-
return fn(
|
|
14138
|
+
return fn(path71);
|
|
14139
14139
|
} catch (er) {
|
|
14140
|
-
if (isFsError(er) && er.path ===
|
|
14140
|
+
if (isFsError(er) && er.path === path71 && codes.has(er.code) && retries < max) {
|
|
14141
14141
|
retries++;
|
|
14142
14142
|
continue;
|
|
14143
14143
|
}
|
|
@@ -14157,16 +14157,16 @@ init_esm_shims();
|
|
|
14157
14157
|
import { tmpdir } from "os";
|
|
14158
14158
|
import { parse as parse4, resolve as resolve3 } from "path";
|
|
14159
14159
|
var { stat } = promises;
|
|
14160
|
-
var isDirSync = (
|
|
14160
|
+
var isDirSync = (path71) => {
|
|
14161
14161
|
try {
|
|
14162
|
-
return statSync(
|
|
14162
|
+
return statSync(path71).isDirectory();
|
|
14163
14163
|
} catch {
|
|
14164
14164
|
return false;
|
|
14165
14165
|
}
|
|
14166
14166
|
};
|
|
14167
|
-
var isDir = (
|
|
14168
|
-
var win32DefaultTmp = async (
|
|
14169
|
-
const { root } = parse4(
|
|
14167
|
+
var isDir = (path71) => stat(path71).then((st) => st.isDirectory(), () => false);
|
|
14168
|
+
var win32DefaultTmp = async (path71) => {
|
|
14169
|
+
const { root } = parse4(path71);
|
|
14170
14170
|
const tmp = tmpdir();
|
|
14171
14171
|
const { root: tmpRoot } = parse4(tmp);
|
|
14172
14172
|
if (root.toLowerCase() === tmpRoot.toLowerCase()) {
|
|
@@ -14178,8 +14178,8 @@ var win32DefaultTmp = async (path70) => {
|
|
|
14178
14178
|
}
|
|
14179
14179
|
return root;
|
|
14180
14180
|
};
|
|
14181
|
-
var win32DefaultTmpSync = (
|
|
14182
|
-
const { root } = parse4(
|
|
14181
|
+
var win32DefaultTmpSync = (path71) => {
|
|
14182
|
+
const { root } = parse4(path71);
|
|
14183
14183
|
const tmp = tmpdir();
|
|
14184
14184
|
const { root: tmpRoot } = parse4(tmp);
|
|
14185
14185
|
if (root.toLowerCase() === tmpRoot.toLowerCase()) {
|
|
@@ -14198,22 +14198,22 @@ var defaultTmpSync = process.platform === "win32" ? win32DefaultTmpSync : posixD
|
|
|
14198
14198
|
|
|
14199
14199
|
// ../../node_modules/.pnpm/rimraf@6.1.2/node_modules/rimraf/dist/esm/rimraf-move-remove.js
|
|
14200
14200
|
var { lstat: lstat3, rename, unlink: unlink2, rmdir: rmdir2 } = promises;
|
|
14201
|
-
var uniqueFilename = (
|
|
14201
|
+
var uniqueFilename = (path71) => `.${basename(path71)}.${Math.random()}`;
|
|
14202
14202
|
var unlinkFixEPERM = fixEPERM(unlink2);
|
|
14203
14203
|
var unlinkFixEPERMSync = fixEPERMSync(unlinkSync);
|
|
14204
|
-
var rimrafMoveRemove = async (
|
|
14204
|
+
var rimrafMoveRemove = async (path71, opt) => {
|
|
14205
14205
|
opt?.signal?.throwIfAborted();
|
|
14206
|
-
return await ignoreENOENT(lstat3(
|
|
14206
|
+
return await ignoreENOENT(lstat3(path71).then((stat5) => rimrafMoveRemoveDir(path71, opt, stat5))) ?? true;
|
|
14207
14207
|
};
|
|
14208
|
-
var rimrafMoveRemoveDir = async (
|
|
14208
|
+
var rimrafMoveRemoveDir = async (path71, opt, ent) => {
|
|
14209
14209
|
opt?.signal?.throwIfAborted();
|
|
14210
14210
|
if (!opt.tmp) {
|
|
14211
|
-
return rimrafMoveRemoveDir(
|
|
14211
|
+
return rimrafMoveRemoveDir(path71, { ...opt, tmp: await defaultTmp(path71) }, ent);
|
|
14212
14212
|
}
|
|
14213
|
-
if (
|
|
14213
|
+
if (path71 === opt.tmp && parse5(path71).root !== path71) {
|
|
14214
14214
|
throw new Error("cannot delete temp directory used for deletion");
|
|
14215
14215
|
}
|
|
14216
|
-
const entries = ent.isDirectory() ? await readdirOrError(
|
|
14216
|
+
const entries = ent.isDirectory() ? await readdirOrError(path71) : null;
|
|
14217
14217
|
if (!Array.isArray(entries)) {
|
|
14218
14218
|
if (entries) {
|
|
14219
14219
|
if (errorCode(entries) === "ENOENT") {
|
|
@@ -14223,44 +14223,44 @@ var rimrafMoveRemoveDir = async (path70, opt, ent) => {
|
|
|
14223
14223
|
throw entries;
|
|
14224
14224
|
}
|
|
14225
14225
|
}
|
|
14226
|
-
if (opt.filter && !await opt.filter(
|
|
14226
|
+
if (opt.filter && !await opt.filter(path71, ent)) {
|
|
14227
14227
|
return false;
|
|
14228
14228
|
}
|
|
14229
|
-
await ignoreENOENT(tmpUnlink(
|
|
14229
|
+
await ignoreENOENT(tmpUnlink(path71, opt.tmp, unlinkFixEPERM));
|
|
14230
14230
|
return true;
|
|
14231
14231
|
}
|
|
14232
|
-
const removedAll = (await Promise.all(entries.map((ent2) => rimrafMoveRemoveDir(resolve4(
|
|
14232
|
+
const removedAll = (await Promise.all(entries.map((ent2) => rimrafMoveRemoveDir(resolve4(path71, ent2.name), opt, ent2)))).every((v) => v === true);
|
|
14233
14233
|
if (!removedAll) {
|
|
14234
14234
|
return false;
|
|
14235
14235
|
}
|
|
14236
|
-
if (opt.preserveRoot === false &&
|
|
14236
|
+
if (opt.preserveRoot === false && path71 === parse5(path71).root) {
|
|
14237
14237
|
return false;
|
|
14238
14238
|
}
|
|
14239
|
-
if (opt.filter && !await opt.filter(
|
|
14239
|
+
if (opt.filter && !await opt.filter(path71, ent)) {
|
|
14240
14240
|
return false;
|
|
14241
14241
|
}
|
|
14242
|
-
await ignoreENOENT(tmpUnlink(
|
|
14242
|
+
await ignoreENOENT(tmpUnlink(path71, opt.tmp, rmdir2));
|
|
14243
14243
|
return true;
|
|
14244
14244
|
};
|
|
14245
|
-
var tmpUnlink = async (
|
|
14246
|
-
const tmpFile = resolve4(tmp, uniqueFilename(
|
|
14247
|
-
await rename(
|
|
14245
|
+
var tmpUnlink = async (path71, tmp, rm2) => {
|
|
14246
|
+
const tmpFile = resolve4(tmp, uniqueFilename(path71));
|
|
14247
|
+
await rename(path71, tmpFile);
|
|
14248
14248
|
return await rm2(tmpFile);
|
|
14249
14249
|
};
|
|
14250
|
-
var rimrafMoveRemoveSync = (
|
|
14250
|
+
var rimrafMoveRemoveSync = (path71, opt) => {
|
|
14251
14251
|
opt?.signal?.throwIfAborted();
|
|
14252
|
-
return ignoreENOENTSync(() => rimrafMoveRemoveDirSync(
|
|
14252
|
+
return ignoreENOENTSync(() => rimrafMoveRemoveDirSync(path71, opt, lstatSync2(path71))) ?? true;
|
|
14253
14253
|
};
|
|
14254
|
-
var rimrafMoveRemoveDirSync = (
|
|
14254
|
+
var rimrafMoveRemoveDirSync = (path71, opt, ent) => {
|
|
14255
14255
|
opt?.signal?.throwIfAborted();
|
|
14256
14256
|
if (!opt.tmp) {
|
|
14257
|
-
return rimrafMoveRemoveDirSync(
|
|
14257
|
+
return rimrafMoveRemoveDirSync(path71, { ...opt, tmp: defaultTmpSync(path71) }, ent);
|
|
14258
14258
|
}
|
|
14259
14259
|
const tmp = opt.tmp;
|
|
14260
|
-
if (
|
|
14260
|
+
if (path71 === opt.tmp && parse5(path71).root !== path71) {
|
|
14261
14261
|
throw new Error("cannot delete temp directory used for deletion");
|
|
14262
14262
|
}
|
|
14263
|
-
const entries = ent.isDirectory() ? readdirOrErrorSync(
|
|
14263
|
+
const entries = ent.isDirectory() ? readdirOrErrorSync(path71) : null;
|
|
14264
14264
|
if (!Array.isArray(entries)) {
|
|
14265
14265
|
if (entries) {
|
|
14266
14266
|
if (errorCode(entries) === "ENOENT") {
|
|
@@ -14270,32 +14270,32 @@ var rimrafMoveRemoveDirSync = (path70, opt, ent) => {
|
|
|
14270
14270
|
throw entries;
|
|
14271
14271
|
}
|
|
14272
14272
|
}
|
|
14273
|
-
if (opt.filter && !opt.filter(
|
|
14273
|
+
if (opt.filter && !opt.filter(path71, ent)) {
|
|
14274
14274
|
return false;
|
|
14275
14275
|
}
|
|
14276
|
-
ignoreENOENTSync(() => tmpUnlinkSync(
|
|
14276
|
+
ignoreENOENTSync(() => tmpUnlinkSync(path71, tmp, unlinkFixEPERMSync));
|
|
14277
14277
|
return true;
|
|
14278
14278
|
}
|
|
14279
14279
|
let removedAll = true;
|
|
14280
14280
|
for (const ent2 of entries) {
|
|
14281
|
-
const p = resolve4(
|
|
14281
|
+
const p = resolve4(path71, ent2.name);
|
|
14282
14282
|
removedAll = rimrafMoveRemoveDirSync(p, opt, ent2) && removedAll;
|
|
14283
14283
|
}
|
|
14284
14284
|
if (!removedAll) {
|
|
14285
14285
|
return false;
|
|
14286
14286
|
}
|
|
14287
|
-
if (opt.preserveRoot === false &&
|
|
14287
|
+
if (opt.preserveRoot === false && path71 === parse5(path71).root) {
|
|
14288
14288
|
return false;
|
|
14289
14289
|
}
|
|
14290
|
-
if (opt.filter && !opt.filter(
|
|
14290
|
+
if (opt.filter && !opt.filter(path71, ent)) {
|
|
14291
14291
|
return false;
|
|
14292
14292
|
}
|
|
14293
|
-
ignoreENOENTSync(() => tmpUnlinkSync(
|
|
14293
|
+
ignoreENOENTSync(() => tmpUnlinkSync(path71, tmp, rmdirSync));
|
|
14294
14294
|
return true;
|
|
14295
14295
|
};
|
|
14296
|
-
var tmpUnlinkSync = (
|
|
14297
|
-
const tmpFile = resolve4(tmp, uniqueFilename(
|
|
14298
|
-
renameSync(
|
|
14296
|
+
var tmpUnlinkSync = (path71, tmp, rmSync2) => {
|
|
14297
|
+
const tmpFile = resolve4(tmp, uniqueFilename(path71));
|
|
14298
|
+
renameSync(path71, tmpFile);
|
|
14299
14299
|
return rmSync2(tmpFile);
|
|
14300
14300
|
};
|
|
14301
14301
|
|
|
@@ -14305,26 +14305,26 @@ var rimrafWindowsFile = retryBusy(fixEPERM(unlink3));
|
|
|
14305
14305
|
var rimrafWindowsFileSync = retryBusySync(fixEPERMSync(unlinkSync));
|
|
14306
14306
|
var rimrafWindowsDirRetry = retryBusy(fixEPERM(rmdir3));
|
|
14307
14307
|
var rimrafWindowsDirRetrySync = retryBusySync(fixEPERMSync(rmdirSync));
|
|
14308
|
-
var rimrafWindowsDirMoveRemoveFallback = async (
|
|
14308
|
+
var rimrafWindowsDirMoveRemoveFallback = async (path71, { filter: filter3, ...opt }) => {
|
|
14309
14309
|
opt?.signal?.throwIfAborted();
|
|
14310
14310
|
try {
|
|
14311
|
-
await rimrafWindowsDirRetry(
|
|
14311
|
+
await rimrafWindowsDirRetry(path71, opt);
|
|
14312
14312
|
return true;
|
|
14313
14313
|
} catch (er) {
|
|
14314
14314
|
if (errorCode(er) === "ENOTEMPTY") {
|
|
14315
|
-
return rimrafMoveRemove(
|
|
14315
|
+
return rimrafMoveRemove(path71, opt);
|
|
14316
14316
|
}
|
|
14317
14317
|
throw er;
|
|
14318
14318
|
}
|
|
14319
14319
|
};
|
|
14320
|
-
var rimrafWindowsDirMoveRemoveFallbackSync = (
|
|
14320
|
+
var rimrafWindowsDirMoveRemoveFallbackSync = (path71, { filter: filter3, ...opt }) => {
|
|
14321
14321
|
opt?.signal?.throwIfAborted();
|
|
14322
14322
|
try {
|
|
14323
|
-
rimrafWindowsDirRetrySync(
|
|
14323
|
+
rimrafWindowsDirRetrySync(path71, opt);
|
|
14324
14324
|
return true;
|
|
14325
14325
|
} catch (er) {
|
|
14326
14326
|
if (errorCode(er) === "ENOTEMPTY") {
|
|
14327
|
-
return rimrafMoveRemoveSync(
|
|
14327
|
+
return rimrafMoveRemoveSync(path71, opt);
|
|
14328
14328
|
}
|
|
14329
14329
|
throw er;
|
|
14330
14330
|
}
|
|
@@ -14332,17 +14332,17 @@ var rimrafWindowsDirMoveRemoveFallbackSync = (path70, { filter: filter3, ...opt
|
|
|
14332
14332
|
var START = /* @__PURE__ */ Symbol("start");
|
|
14333
14333
|
var CHILD = /* @__PURE__ */ Symbol("child");
|
|
14334
14334
|
var FINISH = /* @__PURE__ */ Symbol("finish");
|
|
14335
|
-
var rimrafWindows = async (
|
|
14335
|
+
var rimrafWindows = async (path71, opt) => {
|
|
14336
14336
|
opt?.signal?.throwIfAborted();
|
|
14337
|
-
return await ignoreENOENT(lstat4(
|
|
14337
|
+
return await ignoreENOENT(lstat4(path71).then((stat5) => rimrafWindowsDir(path71, opt, stat5, START))) ?? true;
|
|
14338
14338
|
};
|
|
14339
|
-
var rimrafWindowsSync = (
|
|
14339
|
+
var rimrafWindowsSync = (path71, opt) => {
|
|
14340
14340
|
opt?.signal?.throwIfAborted();
|
|
14341
|
-
return ignoreENOENTSync(() => rimrafWindowsDirSync(
|
|
14341
|
+
return ignoreENOENTSync(() => rimrafWindowsDirSync(path71, opt, lstatSync2(path71), START)) ?? true;
|
|
14342
14342
|
};
|
|
14343
|
-
var rimrafWindowsDir = async (
|
|
14343
|
+
var rimrafWindowsDir = async (path71, opt, ent, state = START) => {
|
|
14344
14344
|
opt?.signal?.throwIfAborted();
|
|
14345
|
-
const entries = ent.isDirectory() ? await readdirOrError(
|
|
14345
|
+
const entries = ent.isDirectory() ? await readdirOrError(path71) : null;
|
|
14346
14346
|
if (!Array.isArray(entries)) {
|
|
14347
14347
|
if (entries) {
|
|
14348
14348
|
if (errorCode(entries) === "ENOENT") {
|
|
@@ -14352,32 +14352,32 @@ var rimrafWindowsDir = async (path70, opt, ent, state = START) => {
|
|
|
14352
14352
|
throw entries;
|
|
14353
14353
|
}
|
|
14354
14354
|
}
|
|
14355
|
-
if (opt.filter && !await opt.filter(
|
|
14355
|
+
if (opt.filter && !await opt.filter(path71, ent)) {
|
|
14356
14356
|
return false;
|
|
14357
14357
|
}
|
|
14358
|
-
await ignoreENOENT(rimrafWindowsFile(
|
|
14358
|
+
await ignoreENOENT(rimrafWindowsFile(path71, opt));
|
|
14359
14359
|
return true;
|
|
14360
14360
|
}
|
|
14361
14361
|
const s = state === START ? CHILD : state;
|
|
14362
|
-
const removedAll = (await Promise.all(entries.map((ent2) => rimrafWindowsDir(resolve5(
|
|
14362
|
+
const removedAll = (await Promise.all(entries.map((ent2) => rimrafWindowsDir(resolve5(path71, ent2.name), opt, ent2, s)))).every((v) => v === true);
|
|
14363
14363
|
if (state === START) {
|
|
14364
|
-
return rimrafWindowsDir(
|
|
14364
|
+
return rimrafWindowsDir(path71, opt, ent, FINISH);
|
|
14365
14365
|
} else if (state === FINISH) {
|
|
14366
|
-
if (opt.preserveRoot === false &&
|
|
14366
|
+
if (opt.preserveRoot === false && path71 === parse6(path71).root) {
|
|
14367
14367
|
return false;
|
|
14368
14368
|
}
|
|
14369
14369
|
if (!removedAll) {
|
|
14370
14370
|
return false;
|
|
14371
14371
|
}
|
|
14372
|
-
if (opt.filter && !await opt.filter(
|
|
14372
|
+
if (opt.filter && !await opt.filter(path71, ent)) {
|
|
14373
14373
|
return false;
|
|
14374
14374
|
}
|
|
14375
|
-
await ignoreENOENT(rimrafWindowsDirMoveRemoveFallback(
|
|
14375
|
+
await ignoreENOENT(rimrafWindowsDirMoveRemoveFallback(path71, opt));
|
|
14376
14376
|
}
|
|
14377
14377
|
return true;
|
|
14378
14378
|
};
|
|
14379
|
-
var rimrafWindowsDirSync = (
|
|
14380
|
-
const entries = ent.isDirectory() ? readdirOrErrorSync(
|
|
14379
|
+
var rimrafWindowsDirSync = (path71, opt, ent, state = START) => {
|
|
14380
|
+
const entries = ent.isDirectory() ? readdirOrErrorSync(path71) : null;
|
|
14381
14381
|
if (!Array.isArray(entries)) {
|
|
14382
14382
|
if (entries) {
|
|
14383
14383
|
if (errorCode(entries) === "ENOENT") {
|
|
@@ -14387,31 +14387,31 @@ var rimrafWindowsDirSync = (path70, opt, ent, state = START) => {
|
|
|
14387
14387
|
throw entries;
|
|
14388
14388
|
}
|
|
14389
14389
|
}
|
|
14390
|
-
if (opt.filter && !opt.filter(
|
|
14390
|
+
if (opt.filter && !opt.filter(path71, ent)) {
|
|
14391
14391
|
return false;
|
|
14392
14392
|
}
|
|
14393
|
-
ignoreENOENTSync(() => rimrafWindowsFileSync(
|
|
14393
|
+
ignoreENOENTSync(() => rimrafWindowsFileSync(path71, opt));
|
|
14394
14394
|
return true;
|
|
14395
14395
|
}
|
|
14396
14396
|
let removedAll = true;
|
|
14397
14397
|
for (const ent2 of entries) {
|
|
14398
14398
|
const s = state === START ? CHILD : state;
|
|
14399
|
-
const p = resolve5(
|
|
14399
|
+
const p = resolve5(path71, ent2.name);
|
|
14400
14400
|
removedAll = rimrafWindowsDirSync(p, opt, ent2, s) && removedAll;
|
|
14401
14401
|
}
|
|
14402
14402
|
if (state === START) {
|
|
14403
|
-
return rimrafWindowsDirSync(
|
|
14403
|
+
return rimrafWindowsDirSync(path71, opt, ent, FINISH);
|
|
14404
14404
|
} else if (state === FINISH) {
|
|
14405
|
-
if (opt.preserveRoot === false &&
|
|
14405
|
+
if (opt.preserveRoot === false && path71 === parse6(path71).root) {
|
|
14406
14406
|
return false;
|
|
14407
14407
|
}
|
|
14408
14408
|
if (!removedAll) {
|
|
14409
14409
|
return false;
|
|
14410
14410
|
}
|
|
14411
|
-
if (opt.filter && !opt.filter(
|
|
14411
|
+
if (opt.filter && !opt.filter(path71, ent)) {
|
|
14412
14412
|
return false;
|
|
14413
14413
|
}
|
|
14414
|
-
ignoreENOENTSync(() => rimrafWindowsDirMoveRemoveFallbackSync(
|
|
14414
|
+
ignoreENOENTSync(() => rimrafWindowsDirMoveRemoveFallbackSync(path71, opt));
|
|
14415
14415
|
}
|
|
14416
14416
|
return true;
|
|
14417
14417
|
};
|
|
@@ -14423,16 +14423,16 @@ var rimrafManualSync = process.platform === "win32" ? rimrafWindowsSync : rimraf
|
|
|
14423
14423
|
// ../../node_modules/.pnpm/rimraf@6.1.2/node_modules/rimraf/dist/esm/rimraf-native.js
|
|
14424
14424
|
init_esm_shims();
|
|
14425
14425
|
var { rm } = promises;
|
|
14426
|
-
var rimrafNative = async (
|
|
14427
|
-
await rm(
|
|
14426
|
+
var rimrafNative = async (path71, opt) => {
|
|
14427
|
+
await rm(path71, {
|
|
14428
14428
|
...opt,
|
|
14429
14429
|
force: true,
|
|
14430
14430
|
recursive: true
|
|
14431
14431
|
});
|
|
14432
14432
|
return true;
|
|
14433
14433
|
};
|
|
14434
|
-
var rimrafNativeSync = (
|
|
14435
|
-
rmSync(
|
|
14434
|
+
var rimrafNativeSync = (path71, opt) => {
|
|
14435
|
+
rmSync(path71, {
|
|
14436
14436
|
...opt,
|
|
14437
14437
|
force: true,
|
|
14438
14438
|
recursive: true
|
|
@@ -14448,26 +14448,26 @@ var useNative = !hasNative || process.platform === "win32" ? () => false : (opt)
|
|
|
14448
14448
|
var useNativeSync = !hasNative || process.platform === "win32" ? () => false : (opt) => !opt?.signal && !opt?.filter;
|
|
14449
14449
|
|
|
14450
14450
|
// ../../node_modules/.pnpm/rimraf@6.1.2/node_modules/rimraf/dist/esm/index.js
|
|
14451
|
-
var wrap = (fn) => async (
|
|
14451
|
+
var wrap = (fn) => async (path71, opt) => {
|
|
14452
14452
|
const options = optArg(opt);
|
|
14453
14453
|
if (options.glob) {
|
|
14454
|
-
|
|
14454
|
+
path71 = await glob(path71, options.glob);
|
|
14455
14455
|
}
|
|
14456
|
-
if (Array.isArray(
|
|
14457
|
-
return !!(await Promise.all(
|
|
14456
|
+
if (Array.isArray(path71)) {
|
|
14457
|
+
return !!(await Promise.all(path71.map((p) => fn(path_arg_default(p, options), options)))).reduce((a, b) => a && b, true);
|
|
14458
14458
|
} else {
|
|
14459
|
-
return !!await fn(path_arg_default(
|
|
14459
|
+
return !!await fn(path_arg_default(path71, options), options);
|
|
14460
14460
|
}
|
|
14461
14461
|
};
|
|
14462
|
-
var wrapSync = (fn) => (
|
|
14462
|
+
var wrapSync = (fn) => (path71, opt) => {
|
|
14463
14463
|
const options = optArgSync(opt);
|
|
14464
14464
|
if (options.glob) {
|
|
14465
|
-
|
|
14465
|
+
path71 = globSync(path71, options.glob);
|
|
14466
14466
|
}
|
|
14467
|
-
if (Array.isArray(
|
|
14468
|
-
return !!
|
|
14467
|
+
if (Array.isArray(path71)) {
|
|
14468
|
+
return !!path71.map((p) => fn(path_arg_default(p, options), options)).reduce((a, b) => a && b, true);
|
|
14469
14469
|
} else {
|
|
14470
|
-
return !!fn(path_arg_default(
|
|
14470
|
+
return !!fn(path_arg_default(path71, options), options);
|
|
14471
14471
|
}
|
|
14472
14472
|
};
|
|
14473
14473
|
var nativeSync = wrapSync(rimrafNativeSync);
|
|
@@ -14482,8 +14482,8 @@ var moveRemoveSync = wrapSync(rimrafMoveRemoveSync);
|
|
|
14482
14482
|
var moveRemove = Object.assign(wrap(rimrafMoveRemove), {
|
|
14483
14483
|
sync: moveRemoveSync
|
|
14484
14484
|
});
|
|
14485
|
-
var rimrafSync = wrapSync((
|
|
14486
|
-
var rimraf_ = wrap((
|
|
14485
|
+
var rimrafSync = wrapSync((path71, opt) => useNativeSync(opt) ? rimrafNativeSync(path71, opt) : rimrafManualSync(path71, opt));
|
|
14486
|
+
var rimraf_ = wrap((path71, opt) => useNative(opt) ? rimrafNative(path71, opt) : rimrafManual(path71, opt));
|
|
14487
14487
|
var rimraf = Object.assign(rimraf_, {
|
|
14488
14488
|
rimraf: rimraf_,
|
|
14489
14489
|
sync: rimrafSync,
|
|
@@ -14635,7 +14635,7 @@ var ReaddirpStream = class extends Readable {
|
|
|
14635
14635
|
this._directoryFilter = normalizeFilter(opts.directoryFilter);
|
|
14636
14636
|
const statMethod = opts.lstat ? lstat5 : stat2;
|
|
14637
14637
|
if (wantBigintFsStats) {
|
|
14638
|
-
this._stat = (
|
|
14638
|
+
this._stat = (path71) => statMethod(path71, { bigint: true });
|
|
14639
14639
|
} else {
|
|
14640
14640
|
this._stat = statMethod;
|
|
14641
14641
|
}
|
|
@@ -14660,8 +14660,8 @@ var ReaddirpStream = class extends Readable {
|
|
|
14660
14660
|
const par = this.parent;
|
|
14661
14661
|
const fil = par && par.files;
|
|
14662
14662
|
if (fil && fil.length > 0) {
|
|
14663
|
-
const { path:
|
|
14664
|
-
const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent,
|
|
14663
|
+
const { path: path71, depth } = par;
|
|
14664
|
+
const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path71));
|
|
14665
14665
|
const awaited = await Promise.all(slice);
|
|
14666
14666
|
for (const entry of awaited) {
|
|
14667
14667
|
if (!entry)
|
|
@@ -14701,20 +14701,20 @@ var ReaddirpStream = class extends Readable {
|
|
|
14701
14701
|
this.reading = false;
|
|
14702
14702
|
}
|
|
14703
14703
|
}
|
|
14704
|
-
async _exploreDir(
|
|
14704
|
+
async _exploreDir(path71, depth) {
|
|
14705
14705
|
let files;
|
|
14706
14706
|
try {
|
|
14707
|
-
files = await readdir3(
|
|
14707
|
+
files = await readdir3(path71, this._rdOptions);
|
|
14708
14708
|
} catch (error) {
|
|
14709
14709
|
this._onError(error);
|
|
14710
14710
|
}
|
|
14711
|
-
return { files, depth, path:
|
|
14711
|
+
return { files, depth, path: path71 };
|
|
14712
14712
|
}
|
|
14713
|
-
async _formatEntry(dirent,
|
|
14713
|
+
async _formatEntry(dirent, path71) {
|
|
14714
14714
|
let entry;
|
|
14715
14715
|
const basename4 = this._isDirent ? dirent.name : dirent;
|
|
14716
14716
|
try {
|
|
14717
|
-
const fullPath = presolve(pjoin(
|
|
14717
|
+
const fullPath = presolve(pjoin(path71, basename4));
|
|
14718
14718
|
entry = { path: prelative(this._root, fullPath), fullPath, basename: basename4 };
|
|
14719
14719
|
entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
|
|
14720
14720
|
} catch (err) {
|
|
@@ -15115,16 +15115,16 @@ var delFromSet = (main, prop, item) => {
|
|
|
15115
15115
|
};
|
|
15116
15116
|
var isEmptySet = (val) => val instanceof Set ? val.size === 0 : !val;
|
|
15117
15117
|
var FsWatchInstances = /* @__PURE__ */ new Map();
|
|
15118
|
-
function createFsWatchInstance(
|
|
15118
|
+
function createFsWatchInstance(path71, options, listener, errHandler, emitRaw) {
|
|
15119
15119
|
const handleEvent = (rawEvent, evPath) => {
|
|
15120
|
-
listener(
|
|
15121
|
-
emitRaw(rawEvent, evPath, { watchedPath:
|
|
15122
|
-
if (evPath &&
|
|
15123
|
-
fsWatchBroadcast(sp.resolve(
|
|
15120
|
+
listener(path71);
|
|
15121
|
+
emitRaw(rawEvent, evPath, { watchedPath: path71 });
|
|
15122
|
+
if (evPath && path71 !== evPath) {
|
|
15123
|
+
fsWatchBroadcast(sp.resolve(path71, evPath), KEY_LISTENERS, sp.join(path71, evPath));
|
|
15124
15124
|
}
|
|
15125
15125
|
};
|
|
15126
15126
|
try {
|
|
15127
|
-
return fs_watch(
|
|
15127
|
+
return fs_watch(path71, {
|
|
15128
15128
|
persistent: options.persistent
|
|
15129
15129
|
}, handleEvent);
|
|
15130
15130
|
} catch (error) {
|
|
@@ -15140,12 +15140,12 @@ var fsWatchBroadcast = (fullPath, listenerType, val1, val2, val3) => {
|
|
|
15140
15140
|
listener(val1, val2, val3);
|
|
15141
15141
|
});
|
|
15142
15142
|
};
|
|
15143
|
-
var setFsWatchListener = (
|
|
15143
|
+
var setFsWatchListener = (path71, fullPath, options, handlers) => {
|
|
15144
15144
|
const { listener, errHandler, rawEmitter } = handlers;
|
|
15145
15145
|
let cont = FsWatchInstances.get(fullPath);
|
|
15146
15146
|
let watcher;
|
|
15147
15147
|
if (!options.persistent) {
|
|
15148
|
-
watcher = createFsWatchInstance(
|
|
15148
|
+
watcher = createFsWatchInstance(path71, options, listener, errHandler, rawEmitter);
|
|
15149
15149
|
if (!watcher)
|
|
15150
15150
|
return;
|
|
15151
15151
|
return watcher.close.bind(watcher);
|
|
@@ -15156,7 +15156,7 @@ var setFsWatchListener = (path70, fullPath, options, handlers) => {
|
|
|
15156
15156
|
addAndConvert(cont, KEY_RAW, rawEmitter);
|
|
15157
15157
|
} else {
|
|
15158
15158
|
watcher = createFsWatchInstance(
|
|
15159
|
-
|
|
15159
|
+
path71,
|
|
15160
15160
|
options,
|
|
15161
15161
|
fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS),
|
|
15162
15162
|
errHandler,
|
|
@@ -15171,7 +15171,7 @@ var setFsWatchListener = (path70, fullPath, options, handlers) => {
|
|
|
15171
15171
|
cont.watcherUnusable = true;
|
|
15172
15172
|
if (isWindows && error.code === "EPERM") {
|
|
15173
15173
|
try {
|
|
15174
|
-
const fd = await open(
|
|
15174
|
+
const fd = await open(path71, "r");
|
|
15175
15175
|
await fd.close();
|
|
15176
15176
|
broadcastErr(error);
|
|
15177
15177
|
} catch (err) {
|
|
@@ -15202,7 +15202,7 @@ var setFsWatchListener = (path70, fullPath, options, handlers) => {
|
|
|
15202
15202
|
};
|
|
15203
15203
|
};
|
|
15204
15204
|
var FsWatchFileInstances = /* @__PURE__ */ new Map();
|
|
15205
|
-
var setFsWatchFileListener = (
|
|
15205
|
+
var setFsWatchFileListener = (path71, fullPath, options, handlers) => {
|
|
15206
15206
|
const { listener, rawEmitter } = handlers;
|
|
15207
15207
|
let cont = FsWatchFileInstances.get(fullPath);
|
|
15208
15208
|
const copts = cont && cont.options;
|
|
@@ -15224,7 +15224,7 @@ var setFsWatchFileListener = (path70, fullPath, options, handlers) => {
|
|
|
15224
15224
|
});
|
|
15225
15225
|
const currmtime = curr.mtimeMs;
|
|
15226
15226
|
if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) {
|
|
15227
|
-
foreach(cont.listeners, (listener2) => listener2(
|
|
15227
|
+
foreach(cont.listeners, (listener2) => listener2(path71, curr));
|
|
15228
15228
|
}
|
|
15229
15229
|
})
|
|
15230
15230
|
};
|
|
@@ -15254,13 +15254,13 @@ var NodeFsHandler = class {
|
|
|
15254
15254
|
* @param listener on fs change
|
|
15255
15255
|
* @returns closer for the watcher instance
|
|
15256
15256
|
*/
|
|
15257
|
-
_watchWithNodeFs(
|
|
15257
|
+
_watchWithNodeFs(path71, listener) {
|
|
15258
15258
|
const opts = this.fsw.options;
|
|
15259
|
-
const directory = sp.dirname(
|
|
15260
|
-
const basename4 = sp.basename(
|
|
15259
|
+
const directory = sp.dirname(path71);
|
|
15260
|
+
const basename4 = sp.basename(path71);
|
|
15261
15261
|
const parent = this.fsw._getWatchedDir(directory);
|
|
15262
15262
|
parent.add(basename4);
|
|
15263
|
-
const absolutePath = sp.resolve(
|
|
15263
|
+
const absolutePath = sp.resolve(path71);
|
|
15264
15264
|
const options = {
|
|
15265
15265
|
persistent: opts.persistent
|
|
15266
15266
|
};
|
|
@@ -15270,12 +15270,12 @@ var NodeFsHandler = class {
|
|
|
15270
15270
|
if (opts.usePolling) {
|
|
15271
15271
|
const enableBin = opts.interval !== opts.binaryInterval;
|
|
15272
15272
|
options.interval = enableBin && isBinaryPath(basename4) ? opts.binaryInterval : opts.interval;
|
|
15273
|
-
closer = setFsWatchFileListener(
|
|
15273
|
+
closer = setFsWatchFileListener(path71, absolutePath, options, {
|
|
15274
15274
|
listener,
|
|
15275
15275
|
rawEmitter: this.fsw._emitRaw
|
|
15276
15276
|
});
|
|
15277
15277
|
} else {
|
|
15278
|
-
closer = setFsWatchListener(
|
|
15278
|
+
closer = setFsWatchListener(path71, absolutePath, options, {
|
|
15279
15279
|
listener,
|
|
15280
15280
|
errHandler: this._boundHandleError,
|
|
15281
15281
|
rawEmitter: this.fsw._emitRaw
|
|
@@ -15297,7 +15297,7 @@ var NodeFsHandler = class {
|
|
|
15297
15297
|
let prevStats = stats;
|
|
15298
15298
|
if (parent.has(basename4))
|
|
15299
15299
|
return;
|
|
15300
|
-
const listener = async (
|
|
15300
|
+
const listener = async (path71, newStats) => {
|
|
15301
15301
|
if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file, 5))
|
|
15302
15302
|
return;
|
|
15303
15303
|
if (!newStats || newStats.mtimeMs === 0) {
|
|
@@ -15311,11 +15311,11 @@ var NodeFsHandler = class {
|
|
|
15311
15311
|
this.fsw._emit(EV.CHANGE, file, newStats2);
|
|
15312
15312
|
}
|
|
15313
15313
|
if ((isMacos || isLinux || isFreeBSD) && prevStats.ino !== newStats2.ino) {
|
|
15314
|
-
this.fsw._closeFile(
|
|
15314
|
+
this.fsw._closeFile(path71);
|
|
15315
15315
|
prevStats = newStats2;
|
|
15316
15316
|
const closer2 = this._watchWithNodeFs(file, listener);
|
|
15317
15317
|
if (closer2)
|
|
15318
|
-
this.fsw._addPathCloser(
|
|
15318
|
+
this.fsw._addPathCloser(path71, closer2);
|
|
15319
15319
|
} else {
|
|
15320
15320
|
prevStats = newStats2;
|
|
15321
15321
|
}
|
|
@@ -15347,7 +15347,7 @@ var NodeFsHandler = class {
|
|
|
15347
15347
|
* @param item basename of this item
|
|
15348
15348
|
* @returns true if no more processing is needed for this entry.
|
|
15349
15349
|
*/
|
|
15350
|
-
async _handleSymlink(entry, directory,
|
|
15350
|
+
async _handleSymlink(entry, directory, path71, item) {
|
|
15351
15351
|
if (this.fsw.closed) {
|
|
15352
15352
|
return;
|
|
15353
15353
|
}
|
|
@@ -15357,7 +15357,7 @@ var NodeFsHandler = class {
|
|
|
15357
15357
|
this.fsw._incrReadyCount();
|
|
15358
15358
|
let linkPath;
|
|
15359
15359
|
try {
|
|
15360
|
-
linkPath = await fsrealpath(
|
|
15360
|
+
linkPath = await fsrealpath(path71);
|
|
15361
15361
|
} catch (e) {
|
|
15362
15362
|
this.fsw._emitReady();
|
|
15363
15363
|
return true;
|
|
@@ -15367,12 +15367,12 @@ var NodeFsHandler = class {
|
|
|
15367
15367
|
if (dir.has(item)) {
|
|
15368
15368
|
if (this.fsw._symlinkPaths.get(full) !== linkPath) {
|
|
15369
15369
|
this.fsw._symlinkPaths.set(full, linkPath);
|
|
15370
|
-
this.fsw._emit(EV.CHANGE,
|
|
15370
|
+
this.fsw._emit(EV.CHANGE, path71, entry.stats);
|
|
15371
15371
|
}
|
|
15372
15372
|
} else {
|
|
15373
15373
|
dir.add(item);
|
|
15374
15374
|
this.fsw._symlinkPaths.set(full, linkPath);
|
|
15375
|
-
this.fsw._emit(EV.ADD,
|
|
15375
|
+
this.fsw._emit(EV.ADD, path71, entry.stats);
|
|
15376
15376
|
}
|
|
15377
15377
|
this.fsw._emitReady();
|
|
15378
15378
|
return true;
|
|
@@ -15402,9 +15402,9 @@ var NodeFsHandler = class {
|
|
|
15402
15402
|
return;
|
|
15403
15403
|
}
|
|
15404
15404
|
const item = entry.path;
|
|
15405
|
-
let
|
|
15405
|
+
let path71 = sp.join(directory, item);
|
|
15406
15406
|
current2.add(item);
|
|
15407
|
-
if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory,
|
|
15407
|
+
if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path71, item)) {
|
|
15408
15408
|
return;
|
|
15409
15409
|
}
|
|
15410
15410
|
if (this.fsw.closed) {
|
|
@@ -15413,8 +15413,8 @@ var NodeFsHandler = class {
|
|
|
15413
15413
|
}
|
|
15414
15414
|
if (item === target || !target && !previous.has(item)) {
|
|
15415
15415
|
this.fsw._incrReadyCount();
|
|
15416
|
-
|
|
15417
|
-
this._addToNodeFs(
|
|
15416
|
+
path71 = sp.join(dir, sp.relative(dir, path71));
|
|
15417
|
+
this._addToNodeFs(path71, initialAdd, wh, depth + 1);
|
|
15418
15418
|
}
|
|
15419
15419
|
}).on(EV.ERROR, this._boundHandleError);
|
|
15420
15420
|
return new Promise((resolve8, reject) => {
|
|
@@ -15483,13 +15483,13 @@ var NodeFsHandler = class {
|
|
|
15483
15483
|
* @param depth Child path actually targeted for watch
|
|
15484
15484
|
* @param target Child path actually targeted for watch
|
|
15485
15485
|
*/
|
|
15486
|
-
async _addToNodeFs(
|
|
15486
|
+
async _addToNodeFs(path71, initialAdd, priorWh, depth, target) {
|
|
15487
15487
|
const ready = this.fsw._emitReady;
|
|
15488
|
-
if (this.fsw._isIgnored(
|
|
15488
|
+
if (this.fsw._isIgnored(path71) || this.fsw.closed) {
|
|
15489
15489
|
ready();
|
|
15490
15490
|
return false;
|
|
15491
15491
|
}
|
|
15492
|
-
const wh = this.fsw._getWatchHelpers(
|
|
15492
|
+
const wh = this.fsw._getWatchHelpers(path71);
|
|
15493
15493
|
if (priorWh) {
|
|
15494
15494
|
wh.filterPath = (entry) => priorWh.filterPath(entry);
|
|
15495
15495
|
wh.filterDir = (entry) => priorWh.filterDir(entry);
|
|
@@ -15505,8 +15505,8 @@ var NodeFsHandler = class {
|
|
|
15505
15505
|
const follow = this.fsw.options.followSymlinks;
|
|
15506
15506
|
let closer;
|
|
15507
15507
|
if (stats.isDirectory()) {
|
|
15508
|
-
const absPath = sp.resolve(
|
|
15509
|
-
const targetPath = follow ? await fsrealpath(
|
|
15508
|
+
const absPath = sp.resolve(path71);
|
|
15509
|
+
const targetPath = follow ? await fsrealpath(path71) : path71;
|
|
15510
15510
|
if (this.fsw.closed)
|
|
15511
15511
|
return;
|
|
15512
15512
|
closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath);
|
|
@@ -15516,29 +15516,29 @@ var NodeFsHandler = class {
|
|
|
15516
15516
|
this.fsw._symlinkPaths.set(absPath, targetPath);
|
|
15517
15517
|
}
|
|
15518
15518
|
} else if (stats.isSymbolicLink()) {
|
|
15519
|
-
const targetPath = follow ? await fsrealpath(
|
|
15519
|
+
const targetPath = follow ? await fsrealpath(path71) : path71;
|
|
15520
15520
|
if (this.fsw.closed)
|
|
15521
15521
|
return;
|
|
15522
15522
|
const parent = sp.dirname(wh.watchPath);
|
|
15523
15523
|
this.fsw._getWatchedDir(parent).add(wh.watchPath);
|
|
15524
15524
|
this.fsw._emit(EV.ADD, wh.watchPath, stats);
|
|
15525
|
-
closer = await this._handleDir(parent, stats, initialAdd, depth,
|
|
15525
|
+
closer = await this._handleDir(parent, stats, initialAdd, depth, path71, wh, targetPath);
|
|
15526
15526
|
if (this.fsw.closed)
|
|
15527
15527
|
return;
|
|
15528
15528
|
if (targetPath !== void 0) {
|
|
15529
|
-
this.fsw._symlinkPaths.set(sp.resolve(
|
|
15529
|
+
this.fsw._symlinkPaths.set(sp.resolve(path71), targetPath);
|
|
15530
15530
|
}
|
|
15531
15531
|
} else {
|
|
15532
15532
|
closer = this._handleFile(wh.watchPath, stats, initialAdd);
|
|
15533
15533
|
}
|
|
15534
15534
|
ready();
|
|
15535
15535
|
if (closer)
|
|
15536
|
-
this.fsw._addPathCloser(
|
|
15536
|
+
this.fsw._addPathCloser(path71, closer);
|
|
15537
15537
|
return false;
|
|
15538
15538
|
} catch (error) {
|
|
15539
15539
|
if (this.fsw._handleError(error)) {
|
|
15540
15540
|
ready();
|
|
15541
|
-
return
|
|
15541
|
+
return path71;
|
|
15542
15542
|
}
|
|
15543
15543
|
}
|
|
15544
15544
|
}
|
|
@@ -15581,24 +15581,24 @@ function createPattern(matcher) {
|
|
|
15581
15581
|
}
|
|
15582
15582
|
return () => false;
|
|
15583
15583
|
}
|
|
15584
|
-
function normalizePath(
|
|
15585
|
-
if (typeof
|
|
15584
|
+
function normalizePath(path71) {
|
|
15585
|
+
if (typeof path71 !== "string")
|
|
15586
15586
|
throw new Error("string expected");
|
|
15587
|
-
|
|
15588
|
-
|
|
15587
|
+
path71 = sp2.normalize(path71);
|
|
15588
|
+
path71 = path71.replace(/\\/g, "/");
|
|
15589
15589
|
let prepend = false;
|
|
15590
|
-
if (
|
|
15590
|
+
if (path71.startsWith("//"))
|
|
15591
15591
|
prepend = true;
|
|
15592
|
-
|
|
15592
|
+
path71 = path71.replace(DOUBLE_SLASH_RE, "/");
|
|
15593
15593
|
if (prepend)
|
|
15594
|
-
|
|
15595
|
-
return
|
|
15594
|
+
path71 = "/" + path71;
|
|
15595
|
+
return path71;
|
|
15596
15596
|
}
|
|
15597
15597
|
function matchPatterns(patterns, testString, stats) {
|
|
15598
|
-
const
|
|
15598
|
+
const path71 = normalizePath(testString);
|
|
15599
15599
|
for (let index = 0; index < patterns.length; index++) {
|
|
15600
15600
|
const pattern = patterns[index];
|
|
15601
|
-
if (pattern(
|
|
15601
|
+
if (pattern(path71, stats)) {
|
|
15602
15602
|
return true;
|
|
15603
15603
|
}
|
|
15604
15604
|
}
|
|
@@ -15636,19 +15636,19 @@ var toUnix = (string) => {
|
|
|
15636
15636
|
}
|
|
15637
15637
|
return str;
|
|
15638
15638
|
};
|
|
15639
|
-
var normalizePathToUnix = (
|
|
15640
|
-
var normalizeIgnored = (cwd = "") => (
|
|
15641
|
-
if (typeof
|
|
15642
|
-
return normalizePathToUnix(sp2.isAbsolute(
|
|
15639
|
+
var normalizePathToUnix = (path71) => toUnix(sp2.normalize(toUnix(path71)));
|
|
15640
|
+
var normalizeIgnored = (cwd = "") => (path71) => {
|
|
15641
|
+
if (typeof path71 === "string") {
|
|
15642
|
+
return normalizePathToUnix(sp2.isAbsolute(path71) ? path71 : sp2.join(cwd, path71));
|
|
15643
15643
|
} else {
|
|
15644
|
-
return
|
|
15644
|
+
return path71;
|
|
15645
15645
|
}
|
|
15646
15646
|
};
|
|
15647
|
-
var getAbsolutePath = (
|
|
15648
|
-
if (sp2.isAbsolute(
|
|
15649
|
-
return
|
|
15647
|
+
var getAbsolutePath = (path71, cwd) => {
|
|
15648
|
+
if (sp2.isAbsolute(path71)) {
|
|
15649
|
+
return path71;
|
|
15650
15650
|
}
|
|
15651
|
-
return sp2.join(cwd,
|
|
15651
|
+
return sp2.join(cwd, path71);
|
|
15652
15652
|
};
|
|
15653
15653
|
var EMPTY_SET = Object.freeze(/* @__PURE__ */ new Set());
|
|
15654
15654
|
var DirEntry = class {
|
|
@@ -15713,10 +15713,10 @@ var WatchHelper = class {
|
|
|
15713
15713
|
dirParts;
|
|
15714
15714
|
followSymlinks;
|
|
15715
15715
|
statMethod;
|
|
15716
|
-
constructor(
|
|
15716
|
+
constructor(path71, follow, fsw) {
|
|
15717
15717
|
this.fsw = fsw;
|
|
15718
|
-
const watchPath =
|
|
15719
|
-
this.path =
|
|
15718
|
+
const watchPath = path71;
|
|
15719
|
+
this.path = path71 = path71.replace(REPLACER_RE, "");
|
|
15720
15720
|
this.watchPath = watchPath;
|
|
15721
15721
|
this.fullWatchPath = sp2.resolve(watchPath);
|
|
15722
15722
|
this.dirParts = [];
|
|
@@ -15856,20 +15856,20 @@ var FSWatcher = class extends EventEmitter2 {
|
|
|
15856
15856
|
this._closePromise = void 0;
|
|
15857
15857
|
let paths = unifyPaths(paths_);
|
|
15858
15858
|
if (cwd) {
|
|
15859
|
-
paths = paths.map((
|
|
15860
|
-
const absPath = getAbsolutePath(
|
|
15859
|
+
paths = paths.map((path71) => {
|
|
15860
|
+
const absPath = getAbsolutePath(path71, cwd);
|
|
15861
15861
|
return absPath;
|
|
15862
15862
|
});
|
|
15863
15863
|
}
|
|
15864
|
-
paths.forEach((
|
|
15865
|
-
this._removeIgnoredPath(
|
|
15864
|
+
paths.forEach((path71) => {
|
|
15865
|
+
this._removeIgnoredPath(path71);
|
|
15866
15866
|
});
|
|
15867
15867
|
this._userIgnored = void 0;
|
|
15868
15868
|
if (!this._readyCount)
|
|
15869
15869
|
this._readyCount = 0;
|
|
15870
15870
|
this._readyCount += paths.length;
|
|
15871
|
-
Promise.all(paths.map(async (
|
|
15872
|
-
const res = await this._nodeFsHandler._addToNodeFs(
|
|
15871
|
+
Promise.all(paths.map(async (path71) => {
|
|
15872
|
+
const res = await this._nodeFsHandler._addToNodeFs(path71, !_internal, void 0, 0, _origAdd);
|
|
15873
15873
|
if (res)
|
|
15874
15874
|
this._emitReady();
|
|
15875
15875
|
return res;
|
|
@@ -15891,17 +15891,17 @@ var FSWatcher = class extends EventEmitter2 {
|
|
|
15891
15891
|
return this;
|
|
15892
15892
|
const paths = unifyPaths(paths_);
|
|
15893
15893
|
const { cwd } = this.options;
|
|
15894
|
-
paths.forEach((
|
|
15895
|
-
if (!sp2.isAbsolute(
|
|
15894
|
+
paths.forEach((path71) => {
|
|
15895
|
+
if (!sp2.isAbsolute(path71) && !this._closers.has(path71)) {
|
|
15896
15896
|
if (cwd)
|
|
15897
|
-
|
|
15898
|
-
|
|
15897
|
+
path71 = sp2.join(cwd, path71);
|
|
15898
|
+
path71 = sp2.resolve(path71);
|
|
15899
15899
|
}
|
|
15900
|
-
this._closePath(
|
|
15901
|
-
this._addIgnoredPath(
|
|
15902
|
-
if (this._watched.has(
|
|
15900
|
+
this._closePath(path71);
|
|
15901
|
+
this._addIgnoredPath(path71);
|
|
15902
|
+
if (this._watched.has(path71)) {
|
|
15903
15903
|
this._addIgnoredPath({
|
|
15904
|
-
path:
|
|
15904
|
+
path: path71,
|
|
15905
15905
|
recursive: true
|
|
15906
15906
|
});
|
|
15907
15907
|
}
|
|
@@ -15965,38 +15965,38 @@ var FSWatcher = class extends EventEmitter2 {
|
|
|
15965
15965
|
* @param stats arguments to be passed with event
|
|
15966
15966
|
* @returns the error if defined, otherwise the value of the FSWatcher instance's `closed` flag
|
|
15967
15967
|
*/
|
|
15968
|
-
async _emit(event,
|
|
15968
|
+
async _emit(event, path71, stats) {
|
|
15969
15969
|
if (this.closed)
|
|
15970
15970
|
return;
|
|
15971
15971
|
const opts = this.options;
|
|
15972
15972
|
if (isWindows)
|
|
15973
|
-
|
|
15973
|
+
path71 = sp2.normalize(path71);
|
|
15974
15974
|
if (opts.cwd)
|
|
15975
|
-
|
|
15976
|
-
const args = [
|
|
15975
|
+
path71 = sp2.relative(opts.cwd, path71);
|
|
15976
|
+
const args = [path71];
|
|
15977
15977
|
if (stats != null)
|
|
15978
15978
|
args.push(stats);
|
|
15979
15979
|
const awf = opts.awaitWriteFinish;
|
|
15980
15980
|
let pw;
|
|
15981
|
-
if (awf && (pw = this._pendingWrites.get(
|
|
15981
|
+
if (awf && (pw = this._pendingWrites.get(path71))) {
|
|
15982
15982
|
pw.lastChange = /* @__PURE__ */ new Date();
|
|
15983
15983
|
return this;
|
|
15984
15984
|
}
|
|
15985
15985
|
if (opts.atomic) {
|
|
15986
15986
|
if (event === EVENTS.UNLINK) {
|
|
15987
|
-
this._pendingUnlinks.set(
|
|
15987
|
+
this._pendingUnlinks.set(path71, [event, ...args]);
|
|
15988
15988
|
setTimeout(() => {
|
|
15989
|
-
this._pendingUnlinks.forEach((entry,
|
|
15989
|
+
this._pendingUnlinks.forEach((entry, path72) => {
|
|
15990
15990
|
this.emit(...entry);
|
|
15991
15991
|
this.emit(EVENTS.ALL, ...entry);
|
|
15992
|
-
this._pendingUnlinks.delete(
|
|
15992
|
+
this._pendingUnlinks.delete(path72);
|
|
15993
15993
|
});
|
|
15994
15994
|
}, typeof opts.atomic === "number" ? opts.atomic : 100);
|
|
15995
15995
|
return this;
|
|
15996
15996
|
}
|
|
15997
|
-
if (event === EVENTS.ADD && this._pendingUnlinks.has(
|
|
15997
|
+
if (event === EVENTS.ADD && this._pendingUnlinks.has(path71)) {
|
|
15998
15998
|
event = EVENTS.CHANGE;
|
|
15999
|
-
this._pendingUnlinks.delete(
|
|
15999
|
+
this._pendingUnlinks.delete(path71);
|
|
16000
16000
|
}
|
|
16001
16001
|
}
|
|
16002
16002
|
if (awf && (event === EVENTS.ADD || event === EVENTS.CHANGE) && this._readyEmitted) {
|
|
@@ -16014,16 +16014,16 @@ var FSWatcher = class extends EventEmitter2 {
|
|
|
16014
16014
|
this.emitWithAll(event, args);
|
|
16015
16015
|
}
|
|
16016
16016
|
};
|
|
16017
|
-
this._awaitWriteFinish(
|
|
16017
|
+
this._awaitWriteFinish(path71, awf.stabilityThreshold, event, awfEmit);
|
|
16018
16018
|
return this;
|
|
16019
16019
|
}
|
|
16020
16020
|
if (event === EVENTS.CHANGE) {
|
|
16021
|
-
const isThrottled = !this._throttle(EVENTS.CHANGE,
|
|
16021
|
+
const isThrottled = !this._throttle(EVENTS.CHANGE, path71, 50);
|
|
16022
16022
|
if (isThrottled)
|
|
16023
16023
|
return this;
|
|
16024
16024
|
}
|
|
16025
16025
|
if (opts.alwaysStat && stats === void 0 && (event === EVENTS.ADD || event === EVENTS.ADD_DIR || event === EVENTS.CHANGE)) {
|
|
16026
|
-
const fullPath = opts.cwd ? sp2.join(opts.cwd,
|
|
16026
|
+
const fullPath = opts.cwd ? sp2.join(opts.cwd, path71) : path71;
|
|
16027
16027
|
let stats2;
|
|
16028
16028
|
try {
|
|
16029
16029
|
stats2 = await stat4(fullPath);
|
|
@@ -16054,23 +16054,23 @@ var FSWatcher = class extends EventEmitter2 {
|
|
|
16054
16054
|
* @param timeout duration of time to suppress duplicate actions
|
|
16055
16055
|
* @returns tracking object or false if action should be suppressed
|
|
16056
16056
|
*/
|
|
16057
|
-
_throttle(actionType,
|
|
16057
|
+
_throttle(actionType, path71, timeout) {
|
|
16058
16058
|
if (!this._throttled.has(actionType)) {
|
|
16059
16059
|
this._throttled.set(actionType, /* @__PURE__ */ new Map());
|
|
16060
16060
|
}
|
|
16061
16061
|
const action = this._throttled.get(actionType);
|
|
16062
16062
|
if (!action)
|
|
16063
16063
|
throw new Error("invalid throttle");
|
|
16064
|
-
const actionPath = action.get(
|
|
16064
|
+
const actionPath = action.get(path71);
|
|
16065
16065
|
if (actionPath) {
|
|
16066
16066
|
actionPath.count++;
|
|
16067
16067
|
return false;
|
|
16068
16068
|
}
|
|
16069
16069
|
let timeoutObject;
|
|
16070
16070
|
const clear = () => {
|
|
16071
|
-
const item = action.get(
|
|
16071
|
+
const item = action.get(path71);
|
|
16072
16072
|
const count = item ? item.count : 0;
|
|
16073
|
-
action.delete(
|
|
16073
|
+
action.delete(path71);
|
|
16074
16074
|
clearTimeout(timeoutObject);
|
|
16075
16075
|
if (item)
|
|
16076
16076
|
clearTimeout(item.timeoutObject);
|
|
@@ -16078,7 +16078,7 @@ var FSWatcher = class extends EventEmitter2 {
|
|
|
16078
16078
|
};
|
|
16079
16079
|
timeoutObject = setTimeout(clear, timeout);
|
|
16080
16080
|
const thr = { timeoutObject, clear, count: 0 };
|
|
16081
|
-
action.set(
|
|
16081
|
+
action.set(path71, thr);
|
|
16082
16082
|
return thr;
|
|
16083
16083
|
}
|
|
16084
16084
|
_incrReadyCount() {
|
|
@@ -16092,44 +16092,44 @@ var FSWatcher = class extends EventEmitter2 {
|
|
|
16092
16092
|
* @param event
|
|
16093
16093
|
* @param awfEmit Callback to be called when ready for event to be emitted.
|
|
16094
16094
|
*/
|
|
16095
|
-
_awaitWriteFinish(
|
|
16095
|
+
_awaitWriteFinish(path71, threshold, event, awfEmit) {
|
|
16096
16096
|
const awf = this.options.awaitWriteFinish;
|
|
16097
16097
|
if (typeof awf !== "object")
|
|
16098
16098
|
return;
|
|
16099
16099
|
const pollInterval = awf.pollInterval;
|
|
16100
16100
|
let timeoutHandler;
|
|
16101
|
-
let fullPath =
|
|
16102
|
-
if (this.options.cwd && !sp2.isAbsolute(
|
|
16103
|
-
fullPath = sp2.join(this.options.cwd,
|
|
16101
|
+
let fullPath = path71;
|
|
16102
|
+
if (this.options.cwd && !sp2.isAbsolute(path71)) {
|
|
16103
|
+
fullPath = sp2.join(this.options.cwd, path71);
|
|
16104
16104
|
}
|
|
16105
16105
|
const now = /* @__PURE__ */ new Date();
|
|
16106
16106
|
const writes = this._pendingWrites;
|
|
16107
16107
|
function awaitWriteFinishFn(prevStat) {
|
|
16108
16108
|
statcb(fullPath, (err, curStat) => {
|
|
16109
|
-
if (err || !writes.has(
|
|
16109
|
+
if (err || !writes.has(path71)) {
|
|
16110
16110
|
if (err && err.code !== "ENOENT")
|
|
16111
16111
|
awfEmit(err);
|
|
16112
16112
|
return;
|
|
16113
16113
|
}
|
|
16114
16114
|
const now2 = Number(/* @__PURE__ */ new Date());
|
|
16115
16115
|
if (prevStat && curStat.size !== prevStat.size) {
|
|
16116
|
-
writes.get(
|
|
16116
|
+
writes.get(path71).lastChange = now2;
|
|
16117
16117
|
}
|
|
16118
|
-
const pw = writes.get(
|
|
16118
|
+
const pw = writes.get(path71);
|
|
16119
16119
|
const df = now2 - pw.lastChange;
|
|
16120
16120
|
if (df >= threshold) {
|
|
16121
|
-
writes.delete(
|
|
16121
|
+
writes.delete(path71);
|
|
16122
16122
|
awfEmit(void 0, curStat);
|
|
16123
16123
|
} else {
|
|
16124
16124
|
timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval, curStat);
|
|
16125
16125
|
}
|
|
16126
16126
|
});
|
|
16127
16127
|
}
|
|
16128
|
-
if (!writes.has(
|
|
16129
|
-
writes.set(
|
|
16128
|
+
if (!writes.has(path71)) {
|
|
16129
|
+
writes.set(path71, {
|
|
16130
16130
|
lastChange: now,
|
|
16131
16131
|
cancelWait: () => {
|
|
16132
|
-
writes.delete(
|
|
16132
|
+
writes.delete(path71);
|
|
16133
16133
|
clearTimeout(timeoutHandler);
|
|
16134
16134
|
return event;
|
|
16135
16135
|
}
|
|
@@ -16140,8 +16140,8 @@ var FSWatcher = class extends EventEmitter2 {
|
|
|
16140
16140
|
/**
|
|
16141
16141
|
* Determines whether user has asked to ignore this path.
|
|
16142
16142
|
*/
|
|
16143
|
-
_isIgnored(
|
|
16144
|
-
if (this.options.atomic && DOT_RE.test(
|
|
16143
|
+
_isIgnored(path71, stats) {
|
|
16144
|
+
if (this.options.atomic && DOT_RE.test(path71))
|
|
16145
16145
|
return true;
|
|
16146
16146
|
if (!this._userIgnored) {
|
|
16147
16147
|
const { cwd } = this.options;
|
|
@@ -16151,17 +16151,17 @@ var FSWatcher = class extends EventEmitter2 {
|
|
|
16151
16151
|
const list = [...ignoredPaths.map(normalizeIgnored(cwd)), ...ignored];
|
|
16152
16152
|
this._userIgnored = anymatch(list, void 0);
|
|
16153
16153
|
}
|
|
16154
|
-
return this._userIgnored(
|
|
16154
|
+
return this._userIgnored(path71, stats);
|
|
16155
16155
|
}
|
|
16156
|
-
_isntIgnored(
|
|
16157
|
-
return !this._isIgnored(
|
|
16156
|
+
_isntIgnored(path71, stat5) {
|
|
16157
|
+
return !this._isIgnored(path71, stat5);
|
|
16158
16158
|
}
|
|
16159
16159
|
/**
|
|
16160
16160
|
* Provides a set of common helpers and properties relating to symlink handling.
|
|
16161
16161
|
* @param path file or directory pattern being watched
|
|
16162
16162
|
*/
|
|
16163
|
-
_getWatchHelpers(
|
|
16164
|
-
return new WatchHelper(
|
|
16163
|
+
_getWatchHelpers(path71) {
|
|
16164
|
+
return new WatchHelper(path71, this.options.followSymlinks, this);
|
|
16165
16165
|
}
|
|
16166
16166
|
// Directory helpers
|
|
16167
16167
|
// -----------------
|
|
@@ -16193,63 +16193,63 @@ var FSWatcher = class extends EventEmitter2 {
|
|
|
16193
16193
|
* @param item base path of item/directory
|
|
16194
16194
|
*/
|
|
16195
16195
|
_remove(directory, item, isDirectory) {
|
|
16196
|
-
const
|
|
16197
|
-
const fullPath = sp2.resolve(
|
|
16198
|
-
isDirectory = isDirectory != null ? isDirectory : this._watched.has(
|
|
16199
|
-
if (!this._throttle("remove",
|
|
16196
|
+
const path71 = sp2.join(directory, item);
|
|
16197
|
+
const fullPath = sp2.resolve(path71);
|
|
16198
|
+
isDirectory = isDirectory != null ? isDirectory : this._watched.has(path71) || this._watched.has(fullPath);
|
|
16199
|
+
if (!this._throttle("remove", path71, 100))
|
|
16200
16200
|
return;
|
|
16201
16201
|
if (!isDirectory && this._watched.size === 1) {
|
|
16202
16202
|
this.add(directory, item, true);
|
|
16203
16203
|
}
|
|
16204
|
-
const wp = this._getWatchedDir(
|
|
16204
|
+
const wp = this._getWatchedDir(path71);
|
|
16205
16205
|
const nestedDirectoryChildren = wp.getChildren();
|
|
16206
|
-
nestedDirectoryChildren.forEach((nested) => this._remove(
|
|
16206
|
+
nestedDirectoryChildren.forEach((nested) => this._remove(path71, nested));
|
|
16207
16207
|
const parent = this._getWatchedDir(directory);
|
|
16208
16208
|
const wasTracked = parent.has(item);
|
|
16209
16209
|
parent.remove(item);
|
|
16210
16210
|
if (this._symlinkPaths.has(fullPath)) {
|
|
16211
16211
|
this._symlinkPaths.delete(fullPath);
|
|
16212
16212
|
}
|
|
16213
|
-
let relPath =
|
|
16213
|
+
let relPath = path71;
|
|
16214
16214
|
if (this.options.cwd)
|
|
16215
|
-
relPath = sp2.relative(this.options.cwd,
|
|
16215
|
+
relPath = sp2.relative(this.options.cwd, path71);
|
|
16216
16216
|
if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
|
|
16217
16217
|
const event = this._pendingWrites.get(relPath).cancelWait();
|
|
16218
16218
|
if (event === EVENTS.ADD)
|
|
16219
16219
|
return;
|
|
16220
16220
|
}
|
|
16221
|
-
this._watched.delete(
|
|
16221
|
+
this._watched.delete(path71);
|
|
16222
16222
|
this._watched.delete(fullPath);
|
|
16223
16223
|
const eventName = isDirectory ? EVENTS.UNLINK_DIR : EVENTS.UNLINK;
|
|
16224
|
-
if (wasTracked && !this._isIgnored(
|
|
16225
|
-
this._emit(eventName,
|
|
16226
|
-
this._closePath(
|
|
16224
|
+
if (wasTracked && !this._isIgnored(path71))
|
|
16225
|
+
this._emit(eventName, path71);
|
|
16226
|
+
this._closePath(path71);
|
|
16227
16227
|
}
|
|
16228
16228
|
/**
|
|
16229
16229
|
* Closes all watchers for a path
|
|
16230
16230
|
*/
|
|
16231
|
-
_closePath(
|
|
16232
|
-
this._closeFile(
|
|
16233
|
-
const dir = sp2.dirname(
|
|
16234
|
-
this._getWatchedDir(dir).remove(sp2.basename(
|
|
16231
|
+
_closePath(path71) {
|
|
16232
|
+
this._closeFile(path71);
|
|
16233
|
+
const dir = sp2.dirname(path71);
|
|
16234
|
+
this._getWatchedDir(dir).remove(sp2.basename(path71));
|
|
16235
16235
|
}
|
|
16236
16236
|
/**
|
|
16237
16237
|
* Closes only file-specific watchers
|
|
16238
16238
|
*/
|
|
16239
|
-
_closeFile(
|
|
16240
|
-
const closers = this._closers.get(
|
|
16239
|
+
_closeFile(path71) {
|
|
16240
|
+
const closers = this._closers.get(path71);
|
|
16241
16241
|
if (!closers)
|
|
16242
16242
|
return;
|
|
16243
16243
|
closers.forEach((closer) => closer());
|
|
16244
|
-
this._closers.delete(
|
|
16244
|
+
this._closers.delete(path71);
|
|
16245
16245
|
}
|
|
16246
|
-
_addPathCloser(
|
|
16246
|
+
_addPathCloser(path71, closer) {
|
|
16247
16247
|
if (!closer)
|
|
16248
16248
|
return;
|
|
16249
|
-
let list = this._closers.get(
|
|
16249
|
+
let list = this._closers.get(path71);
|
|
16250
16250
|
if (!list) {
|
|
16251
16251
|
list = [];
|
|
16252
|
-
this._closers.set(
|
|
16252
|
+
this._closers.set(path71, list);
|
|
16253
16253
|
}
|
|
16254
16254
|
list.push(closer);
|
|
16255
16255
|
}
|
|
@@ -18319,11 +18319,11 @@ pp$8.parseImportAttribute = function() {
|
|
|
18319
18319
|
};
|
|
18320
18320
|
pp$8.parseModuleExportName = function() {
|
|
18321
18321
|
if (this.options.ecmaVersion >= 13 && this.type === types$1.string) {
|
|
18322
|
-
var
|
|
18323
|
-
if (loneSurrogate.test(
|
|
18324
|
-
this.raise(
|
|
18322
|
+
var stringLiteral12 = this.parseLiteral(this.value);
|
|
18323
|
+
if (loneSurrogate.test(stringLiteral12.value)) {
|
|
18324
|
+
this.raise(stringLiteral12.start, "An export name cannot include a lone surrogate.");
|
|
18325
18325
|
}
|
|
18326
|
-
return
|
|
18326
|
+
return stringLiteral12;
|
|
18327
18327
|
}
|
|
18328
18328
|
return this.parseIdent(true);
|
|
18329
18329
|
};
|
|
@@ -22151,17 +22151,17 @@ function withTrailingSlash(input = "", respectQueryAndFragment) {
|
|
|
22151
22151
|
if (hasTrailingSlash(input, true)) {
|
|
22152
22152
|
return input || "/";
|
|
22153
22153
|
}
|
|
22154
|
-
let
|
|
22154
|
+
let path71 = input;
|
|
22155
22155
|
let fragment = "";
|
|
22156
22156
|
const fragmentIndex = input.indexOf("#");
|
|
22157
22157
|
if (fragmentIndex !== -1) {
|
|
22158
|
-
|
|
22158
|
+
path71 = input.slice(0, fragmentIndex);
|
|
22159
22159
|
fragment = input.slice(fragmentIndex);
|
|
22160
|
-
if (!
|
|
22160
|
+
if (!path71) {
|
|
22161
22161
|
return fragment;
|
|
22162
22162
|
}
|
|
22163
22163
|
}
|
|
22164
|
-
const [s0, ...s] =
|
|
22164
|
+
const [s0, ...s] = path71.split("?");
|
|
22165
22165
|
return s0 + "/" + (s.length > 0 ? `?${s.join("?")}` : "") + fragment;
|
|
22166
22166
|
}
|
|
22167
22167
|
function isNonEmptyURL(url) {
|
|
@@ -22189,8 +22189,8 @@ import path20, { dirname as dirname3 } from "path";
|
|
|
22189
22189
|
import v8 from "v8";
|
|
22190
22190
|
import { format, inspect as inspect2 } from "util";
|
|
22191
22191
|
var BUILTIN_MODULES = new Set(builtinModules);
|
|
22192
|
-
function normalizeSlash(
|
|
22193
|
-
return
|
|
22192
|
+
function normalizeSlash(path71) {
|
|
22193
|
+
return path71.replace(/\\/g, "/");
|
|
22194
22194
|
}
|
|
22195
22195
|
var own$1 = {}.hasOwnProperty;
|
|
22196
22196
|
var classRegExp = /^([A-Z][a-z\d]*)+$/;
|
|
@@ -22303,8 +22303,8 @@ codes2.ERR_INVALID_PACKAGE_CONFIG = createError(
|
|
|
22303
22303
|
* @param {string} [base]
|
|
22304
22304
|
* @param {string} [message]
|
|
22305
22305
|
*/
|
|
22306
|
-
(
|
|
22307
|
-
return `Invalid package config ${
|
|
22306
|
+
(path71, base, message) => {
|
|
22307
|
+
return `Invalid package config ${path71}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
|
|
22308
22308
|
},
|
|
22309
22309
|
Error
|
|
22310
22310
|
);
|
|
@@ -22336,8 +22336,8 @@ codes2.ERR_MODULE_NOT_FOUND = createError(
|
|
|
22336
22336
|
* @param {string} base
|
|
22337
22337
|
* @param {boolean} [exactUrl]
|
|
22338
22338
|
*/
|
|
22339
|
-
(
|
|
22340
|
-
return `Cannot find ${exactUrl ? "module" : "package"} '${
|
|
22339
|
+
(path71, base, exactUrl = false) => {
|
|
22340
|
+
return `Cannot find ${exactUrl ? "module" : "package"} '${path71}' imported from ${base}`;
|
|
22341
22341
|
},
|
|
22342
22342
|
Error
|
|
22343
22343
|
);
|
|
@@ -22388,8 +22388,8 @@ codes2.ERR_UNKNOWN_FILE_EXTENSION = createError(
|
|
|
22388
22388
|
* @param {string} extension
|
|
22389
22389
|
* @param {string} path
|
|
22390
22390
|
*/
|
|
22391
|
-
(extension,
|
|
22392
|
-
return `Unknown file extension "${extension}" for ${
|
|
22391
|
+
(extension, path71) => {
|
|
22392
|
+
return `Unknown file extension "${extension}" for ${path71}`;
|
|
22393
22393
|
},
|
|
22394
22394
|
TypeError
|
|
22395
22395
|
);
|
|
@@ -22760,9 +22760,9 @@ Default "index" lookups for the main are deprecated for ES modules.`,
|
|
|
22760
22760
|
);
|
|
22761
22761
|
}
|
|
22762
22762
|
}
|
|
22763
|
-
function tryStatSync(
|
|
22763
|
+
function tryStatSync(path71) {
|
|
22764
22764
|
try {
|
|
22765
|
-
return statSync2(
|
|
22765
|
+
return statSync2(path71);
|
|
22766
22766
|
} catch {
|
|
22767
22767
|
}
|
|
22768
22768
|
}
|
|
@@ -23681,7 +23681,7 @@ function findUpSync(name, {
|
|
|
23681
23681
|
directory = path21.dirname(directory);
|
|
23682
23682
|
}
|
|
23683
23683
|
}
|
|
23684
|
-
function _resolve2(
|
|
23684
|
+
function _resolve2(path71, options = {}) {
|
|
23685
23685
|
if (options.platform === "auto" || !options.platform)
|
|
23686
23686
|
options.platform = process3.platform === "win32" ? "win32" : "posix";
|
|
23687
23687
|
if (process3.versions.pnp) {
|
|
@@ -23690,11 +23690,11 @@ function _resolve2(path70, options = {}) {
|
|
|
23690
23690
|
paths.push(process3.cwd());
|
|
23691
23691
|
const targetRequire = createRequire4(import.meta.url);
|
|
23692
23692
|
try {
|
|
23693
|
-
return targetRequire.resolve(
|
|
23693
|
+
return targetRequire.resolve(path71, { paths });
|
|
23694
23694
|
} catch {
|
|
23695
23695
|
}
|
|
23696
23696
|
}
|
|
23697
|
-
const modulePath = resolvePathSync(
|
|
23697
|
+
const modulePath = resolvePathSync(path71, {
|
|
23698
23698
|
url: options.paths
|
|
23699
23699
|
});
|
|
23700
23700
|
if (options.platform === "win32")
|
|
@@ -23765,10 +23765,10 @@ var findUp = quansync2({
|
|
|
23765
23765
|
async: findUp$1
|
|
23766
23766
|
});
|
|
23767
23767
|
var loadPackageJSON = quansync2(function* (cwd = process3.cwd()) {
|
|
23768
|
-
const
|
|
23769
|
-
if (!
|
|
23768
|
+
const path71 = yield findUp("package.json", { cwd });
|
|
23769
|
+
if (!path71 || !fs11.existsSync(path71))
|
|
23770
23770
|
return null;
|
|
23771
|
-
return JSON.parse(yield readFile(
|
|
23771
|
+
return JSON.parse(yield readFile(path71));
|
|
23772
23772
|
});
|
|
23773
23773
|
var loadPackageJSONSync = loadPackageJSON.sync;
|
|
23774
23774
|
var isPackageListed = quansync2(function* (name, cwd) {
|
|
@@ -23942,7 +23942,7 @@ function isMetadataYarnClassic(metadataPath) {
|
|
|
23942
23942
|
}
|
|
23943
23943
|
|
|
23944
23944
|
// src/runtime/config/createConfigService.ts
|
|
23945
|
-
import
|
|
23945
|
+
import path62 from "pathe";
|
|
23946
23946
|
|
|
23947
23947
|
// src/platform.ts
|
|
23948
23948
|
init_esm_shims();
|
|
@@ -24950,7 +24950,7 @@ function mergeInlineConfig(config, injectBuiltinAliases, ...configs) {
|
|
|
24950
24950
|
// src/runtime/config/internal/merge/miniprogram.ts
|
|
24951
24951
|
init_esm_shims();
|
|
24952
24952
|
import { defu as defu4 } from "@weapp-core/shared";
|
|
24953
|
-
import
|
|
24953
|
+
import path61 from "pathe";
|
|
24954
24954
|
|
|
24955
24955
|
// src/runtime/config/internal/merge/plugins.ts
|
|
24956
24956
|
init_esm_shims();
|
|
@@ -25938,7 +25938,7 @@ function createEntryResolver() {
|
|
|
25938
25938
|
init_esm_shims();
|
|
25939
25939
|
import { removeExtensionDeep as removeExtensionDeep5 } from "@weapp-core/shared";
|
|
25940
25940
|
import fs18 from "fs-extra";
|
|
25941
|
-
import
|
|
25941
|
+
import path36 from "pathe";
|
|
25942
25942
|
|
|
25943
25943
|
// src/utils/vueTemplateTags.ts
|
|
25944
25944
|
init_esm_shims();
|
|
@@ -26107,13 +26107,184 @@ function collectVueTemplateTags(template, options) {
|
|
|
26107
26107
|
|
|
26108
26108
|
// src/plugins/utils/vueSfc.ts
|
|
26109
26109
|
init_esm_shims();
|
|
26110
|
+
import path35 from "pathe";
|
|
26110
26111
|
import { parse as parseSfc } from "vue/compiler-sfc";
|
|
26111
26112
|
var sfcParseCache = new LRUCache({
|
|
26112
26113
|
max: 512
|
|
26113
26114
|
});
|
|
26115
|
+
var SCRIPT_SETUP_SRC_ATTR = "data-weapp-vite-src";
|
|
26116
|
+
var SCRIPT_SRC_ATTR = "data-weapp-vite-script-src";
|
|
26117
|
+
var SCRIPT_SETUP_TAG_RE = /<script\b([^>]*)>/gi;
|
|
26118
|
+
var SCRIPT_LANG_EXT = /* @__PURE__ */ new Map([
|
|
26119
|
+
[".ts", "ts"],
|
|
26120
|
+
[".tsx", "tsx"],
|
|
26121
|
+
[".js", "js"],
|
|
26122
|
+
[".jsx", "jsx"],
|
|
26123
|
+
[".mjs", "js"],
|
|
26124
|
+
[".cjs", "js"]
|
|
26125
|
+
]);
|
|
26126
|
+
var STYLE_LANG_EXT = /* @__PURE__ */ new Map([
|
|
26127
|
+
[".css", "css"],
|
|
26128
|
+
[".scss", "scss"],
|
|
26129
|
+
[".sass", "sass"],
|
|
26130
|
+
[".less", "less"],
|
|
26131
|
+
[".styl", "styl"],
|
|
26132
|
+
[".stylus", "styl"]
|
|
26133
|
+
]);
|
|
26134
|
+
var TEMPLATE_LANG_EXT = /* @__PURE__ */ new Map([
|
|
26135
|
+
[".html", "html"],
|
|
26136
|
+
[".htm", "html"],
|
|
26137
|
+
[".pug", "pug"],
|
|
26138
|
+
[".jade", "pug"]
|
|
26139
|
+
]);
|
|
26140
|
+
function inferLangFromSrc(src, kind) {
|
|
26141
|
+
const ext2 = path35.extname(src).toLowerCase();
|
|
26142
|
+
if (!ext2) {
|
|
26143
|
+
return void 0;
|
|
26144
|
+
}
|
|
26145
|
+
if (kind === "style") {
|
|
26146
|
+
return STYLE_LANG_EXT.get(ext2);
|
|
26147
|
+
}
|
|
26148
|
+
if (kind === "template") {
|
|
26149
|
+
return TEMPLATE_LANG_EXT.get(ext2);
|
|
26150
|
+
}
|
|
26151
|
+
return SCRIPT_LANG_EXT.get(ext2);
|
|
26152
|
+
}
|
|
26153
|
+
function getBlockLabel(kind) {
|
|
26154
|
+
if (kind === "script setup") {
|
|
26155
|
+
return "script setup";
|
|
26156
|
+
}
|
|
26157
|
+
return kind;
|
|
26158
|
+
}
|
|
26159
|
+
function preprocessScriptSetupSrc(source) {
|
|
26160
|
+
if (!source.includes("<script") || !source.includes("setup") || !source.includes("src")) {
|
|
26161
|
+
return source;
|
|
26162
|
+
}
|
|
26163
|
+
return source.replace(SCRIPT_SETUP_TAG_RE, (full, attrs) => {
|
|
26164
|
+
if (!/\bsetup\b/i.test(attrs) || !/\bsrc\b/i.test(attrs)) {
|
|
26165
|
+
return full;
|
|
26166
|
+
}
|
|
26167
|
+
const nextAttrs = attrs.replace(
|
|
26168
|
+
/\bsrc(\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+))/i,
|
|
26169
|
+
`${SCRIPT_SETUP_SRC_ATTR}$1`
|
|
26170
|
+
);
|
|
26171
|
+
return `<script${nextAttrs}>`;
|
|
26172
|
+
});
|
|
26173
|
+
}
|
|
26174
|
+
function preprocessScriptSrc(source) {
|
|
26175
|
+
if (!source.includes("<script") || !source.includes("src")) {
|
|
26176
|
+
return source;
|
|
26177
|
+
}
|
|
26178
|
+
return source.replace(SCRIPT_SETUP_TAG_RE, (full, attrs) => {
|
|
26179
|
+
if (/\bsetup\b/i.test(attrs) || !/\bsrc\b/i.test(attrs)) {
|
|
26180
|
+
return full;
|
|
26181
|
+
}
|
|
26182
|
+
const nextAttrs = attrs.replace(
|
|
26183
|
+
/\bsrc(\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+))/i,
|
|
26184
|
+
`${SCRIPT_SRC_ATTR}$1`
|
|
26185
|
+
);
|
|
26186
|
+
return `<script${nextAttrs}>`;
|
|
26187
|
+
});
|
|
26188
|
+
}
|
|
26189
|
+
function restoreScriptSetupSrc(descriptor) {
|
|
26190
|
+
const scriptSetup = descriptor.scriptSetup;
|
|
26191
|
+
if (!scriptSetup?.attrs || !(SCRIPT_SETUP_SRC_ATTR in scriptSetup.attrs)) {
|
|
26192
|
+
return;
|
|
26193
|
+
}
|
|
26194
|
+
const raw = scriptSetup.attrs[SCRIPT_SETUP_SRC_ATTR];
|
|
26195
|
+
if (typeof raw === "string") {
|
|
26196
|
+
scriptSetup.src = raw;
|
|
26197
|
+
}
|
|
26198
|
+
delete scriptSetup.attrs[SCRIPT_SETUP_SRC_ATTR];
|
|
26199
|
+
}
|
|
26200
|
+
function restoreScriptSrc(descriptor) {
|
|
26201
|
+
const script = descriptor.script;
|
|
26202
|
+
if (!script?.attrs || !(SCRIPT_SRC_ATTR in script.attrs)) {
|
|
26203
|
+
return;
|
|
26204
|
+
}
|
|
26205
|
+
const raw = script.attrs[SCRIPT_SRC_ATTR];
|
|
26206
|
+
if (typeof raw === "string") {
|
|
26207
|
+
script.src = raw;
|
|
26208
|
+
}
|
|
26209
|
+
delete script.attrs[SCRIPT_SRC_ATTR];
|
|
26210
|
+
}
|
|
26211
|
+
async function resolveBlockSrcPath(src, filename, options) {
|
|
26212
|
+
const normalizedSrc = normalizeFsResolvedId(src);
|
|
26213
|
+
if (normalizedSrc && isSkippableResolvedId(normalizedSrc)) {
|
|
26214
|
+
throw new Error(`\u89E3\u6790 ${filename} \u5931\u8D25\uFF1A\u4E0D\u652F\u6301 <src> \u5F15\u7528\u865A\u62DF\u6A21\u5757 ${src}`);
|
|
26215
|
+
}
|
|
26216
|
+
let resolvedId;
|
|
26217
|
+
if (options?.resolveId) {
|
|
26218
|
+
const resolved = await options.resolveId(src, filename);
|
|
26219
|
+
if (resolved) {
|
|
26220
|
+
const normalized = normalizeFsResolvedId(resolved);
|
|
26221
|
+
if (normalized && isSkippableResolvedId(normalized)) {
|
|
26222
|
+
throw new Error(`\u89E3\u6790 ${filename} \u5931\u8D25\uFF1A\u4E0D\u652F\u6301 <src> \u5F15\u7528\u865A\u62DF\u6A21\u5757 ${src}`);
|
|
26223
|
+
}
|
|
26224
|
+
resolvedId = normalized || resolved;
|
|
26225
|
+
}
|
|
26226
|
+
}
|
|
26227
|
+
if (resolvedId) {
|
|
26228
|
+
if (!path35.isAbsolute(resolvedId)) {
|
|
26229
|
+
resolvedId = path35.resolve(path35.dirname(filename), resolvedId);
|
|
26230
|
+
}
|
|
26231
|
+
return resolvedId;
|
|
26232
|
+
}
|
|
26233
|
+
if (normalizedSrc && path35.isAbsolute(normalizedSrc)) {
|
|
26234
|
+
return normalizedSrc;
|
|
26235
|
+
}
|
|
26236
|
+
return path35.resolve(path35.dirname(filename), normalizedSrc || src);
|
|
26237
|
+
}
|
|
26238
|
+
async function readBlockContent(resolvedId, filename, options) {
|
|
26239
|
+
const reader = options?.readFile ?? readFile2;
|
|
26240
|
+
const checkMtime = options?.checkMtime;
|
|
26241
|
+
try {
|
|
26242
|
+
return await reader(resolvedId, { checkMtime });
|
|
26243
|
+
} catch (error) {
|
|
26244
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
26245
|
+
throw new Error(`\u89E3\u6790 ${filename} \u5931\u8D25\uFF1A\u8BFB\u53D6 ${resolvedId} \u5931\u8D25\uFF1A${message}`);
|
|
26246
|
+
}
|
|
26247
|
+
}
|
|
26248
|
+
async function resolveSfcBlockSrc(descriptor, filename, options) {
|
|
26249
|
+
if (!options) {
|
|
26250
|
+
return { descriptor, deps: [] };
|
|
26251
|
+
}
|
|
26252
|
+
const deps = /* @__PURE__ */ new Set();
|
|
26253
|
+
const nextDescriptor = {
|
|
26254
|
+
...descriptor,
|
|
26255
|
+
styles: descriptor.styles.slice()
|
|
26256
|
+
};
|
|
26257
|
+
const resolveBlock = async (block, kind) => {
|
|
26258
|
+
if (!block || !block.src) {
|
|
26259
|
+
return block;
|
|
26260
|
+
}
|
|
26261
|
+
if (block.content.trim().length > 0) {
|
|
26262
|
+
throw new Error(`\u89E3\u6790 ${filename} \u5931\u8D25\uFF1A<${getBlockLabel(kind)}> \u540C\u65F6\u5B58\u5728 src \u4E0E\u5185\u8054\u5185\u5BB9`);
|
|
26263
|
+
}
|
|
26264
|
+
const resolvedId = await resolveBlockSrcPath(block.src, filename, options);
|
|
26265
|
+
const content = await readBlockContent(resolvedId, filename, options);
|
|
26266
|
+
deps.add(resolvedId);
|
|
26267
|
+
const inferredLang = block.lang ?? inferLangFromSrc(resolvedId, kind);
|
|
26268
|
+
return {
|
|
26269
|
+
...block,
|
|
26270
|
+
content,
|
|
26271
|
+
lang: inferredLang ?? block.lang
|
|
26272
|
+
};
|
|
26273
|
+
};
|
|
26274
|
+
nextDescriptor.template = await resolveBlock(descriptor.template, "template");
|
|
26275
|
+
nextDescriptor.script = await resolveBlock(descriptor.script, "script");
|
|
26276
|
+
nextDescriptor.scriptSetup = await resolveBlock(descriptor.scriptSetup, "script setup");
|
|
26277
|
+
if (nextDescriptor.styles.length) {
|
|
26278
|
+
nextDescriptor.styles = await Promise.all(
|
|
26279
|
+
nextDescriptor.styles.map((style) => resolveBlock(style, "style"))
|
|
26280
|
+
);
|
|
26281
|
+
}
|
|
26282
|
+
return { descriptor: nextDescriptor, deps: Array.from(deps) };
|
|
26283
|
+
}
|
|
26114
26284
|
async function readAndParseSfc(filename, options) {
|
|
26115
26285
|
const checkMtime = options?.checkMtime ?? true;
|
|
26116
26286
|
const source = options?.source ?? await readFile2(filename, { checkMtime });
|
|
26287
|
+
const normalizedSource = preprocessScriptSrc(preprocessScriptSetupSrc(source));
|
|
26117
26288
|
const signature = checkMtime ? (() => {
|
|
26118
26289
|
const cached2 = mtimeCache.get(filename);
|
|
26119
26290
|
if (!cached2) {
|
|
@@ -26125,6 +26296,14 @@ async function readAndParseSfc(filename, options) {
|
|
|
26125
26296
|
if (cached) {
|
|
26126
26297
|
const hit = signature ? cached.signature === signature : cached.source === source;
|
|
26127
26298
|
if (hit) {
|
|
26299
|
+
if (options?.resolveSrc) {
|
|
26300
|
+
const resolved = await resolveSfcBlockSrc(cached.descriptor, filename, options.resolveSrc);
|
|
26301
|
+
return {
|
|
26302
|
+
source,
|
|
26303
|
+
descriptor: resolved.descriptor,
|
|
26304
|
+
errors: cached.errors
|
|
26305
|
+
};
|
|
26306
|
+
}
|
|
26128
26307
|
return {
|
|
26129
26308
|
source,
|
|
26130
26309
|
descriptor: cached.descriptor,
|
|
@@ -26132,13 +26311,22 @@ async function readAndParseSfc(filename, options) {
|
|
|
26132
26311
|
};
|
|
26133
26312
|
}
|
|
26134
26313
|
}
|
|
26135
|
-
const parsed = parseSfc(
|
|
26314
|
+
const parsed = parseSfc(normalizedSource, {
|
|
26315
|
+
filename,
|
|
26316
|
+
ignoreEmpty: normalizedSource === source
|
|
26317
|
+
});
|
|
26318
|
+
restoreScriptSetupSrc(parsed.descriptor);
|
|
26319
|
+
restoreScriptSrc(parsed.descriptor);
|
|
26136
26320
|
sfcParseCache.set(filename, {
|
|
26137
26321
|
signature,
|
|
26138
26322
|
source,
|
|
26139
26323
|
descriptor: parsed.descriptor,
|
|
26140
26324
|
errors: parsed.errors
|
|
26141
26325
|
});
|
|
26326
|
+
if (options?.resolveSrc) {
|
|
26327
|
+
const resolved = await resolveSfcBlockSrc(parsed.descriptor, filename, options.resolveSrc);
|
|
26328
|
+
return { source, descriptor: resolved.descriptor, errors: parsed.errors };
|
|
26329
|
+
}
|
|
26142
26330
|
return { source, descriptor: parsed.descriptor, errors: parsed.errors };
|
|
26143
26331
|
}
|
|
26144
26332
|
function getSfcCheckMtime(config) {
|
|
@@ -26205,7 +26393,19 @@ async function applyScriptSetupUsingComponents(options) {
|
|
|
26205
26393
|
reExportResolutionCache
|
|
26206
26394
|
} = options;
|
|
26207
26395
|
try {
|
|
26208
|
-
const { descriptor, errors } = await readAndParseSfc(vueEntryPath, {
|
|
26396
|
+
const { descriptor, errors } = await readAndParseSfc(vueEntryPath, {
|
|
26397
|
+
checkMtime: getSfcCheckMtime(configService),
|
|
26398
|
+
resolveSrc: {
|
|
26399
|
+
resolveId: async (source, importer) => {
|
|
26400
|
+
if (typeof pluginCtx.resolve !== "function") {
|
|
26401
|
+
return void 0;
|
|
26402
|
+
}
|
|
26403
|
+
const resolved = await pluginCtx.resolve(source, importer);
|
|
26404
|
+
return resolved?.id;
|
|
26405
|
+
},
|
|
26406
|
+
checkMtime: getSfcCheckMtime(configService)
|
|
26407
|
+
}
|
|
26408
|
+
});
|
|
26209
26409
|
if (!errors?.length && descriptor?.template && !templatePath) {
|
|
26210
26410
|
const tags = collectVueTemplateAutoImportTags(descriptor.template.content, vueEntryPath);
|
|
26211
26411
|
if (tags.size) {
|
|
@@ -26224,12 +26424,12 @@ async function applyScriptSetupUsingComponents(options) {
|
|
|
26224
26424
|
for (const { localName, importSource, importedName, kind } of imports) {
|
|
26225
26425
|
const resolved = await pluginCtx.resolve(importSource, vueEntryPath);
|
|
26226
26426
|
let resolvedId = resolved?.id ? normalizeFsResolvedId(resolved.id) : void 0;
|
|
26227
|
-
if (!resolvedId || !
|
|
26427
|
+
if (!resolvedId || !path36.isAbsolute(resolvedId)) {
|
|
26228
26428
|
if (importSource.startsWith(".")) {
|
|
26229
|
-
resolvedId =
|
|
26429
|
+
resolvedId = path36.resolve(path36.dirname(vueEntryPath), importSource);
|
|
26230
26430
|
}
|
|
26231
26431
|
}
|
|
26232
|
-
if (resolvedId &&
|
|
26432
|
+
if (resolvedId && path36.isAbsolute(resolvedId) && !path36.extname(resolvedId)) {
|
|
26233
26433
|
const matched = await resolveEntryPath(resolvedId, {
|
|
26234
26434
|
kind,
|
|
26235
26435
|
exists: (p) => pathExists2(p, { ttlMs: getPathExistsTtlMs(configService) }),
|
|
@@ -26239,7 +26439,7 @@ async function applyScriptSetupUsingComponents(options) {
|
|
|
26239
26439
|
resolvedId = matched;
|
|
26240
26440
|
}
|
|
26241
26441
|
}
|
|
26242
|
-
if (kind === "named" && importedName && resolvedId &&
|
|
26442
|
+
if (kind === "named" && importedName && resolvedId && path36.isAbsolute(resolvedId) && /\.(?:[cm]?ts|[cm]?js)$/.test(resolvedId)) {
|
|
26243
26443
|
const mapped = await resolveReExportedName(resolvedId, importedName, {
|
|
26244
26444
|
cache: reExportResolutionCache,
|
|
26245
26445
|
maxDepth: 4,
|
|
@@ -26447,7 +26647,7 @@ function createEntryLoader(options) {
|
|
|
26447
26647
|
// src/plugins/hooks/useLoadEntry/normalizer.ts
|
|
26448
26648
|
init_esm_shims();
|
|
26449
26649
|
import { isObject as isObject4 } from "@weapp-core/shared";
|
|
26450
|
-
import
|
|
26650
|
+
import path37 from "pathe";
|
|
26451
26651
|
function resolveImportee(importee, jsonPath, configService) {
|
|
26452
26652
|
let updated = importee;
|
|
26453
26653
|
if (jsonPath && Array.isArray(configService.aliasEntries)) {
|
|
@@ -26456,8 +26656,8 @@ function resolveImportee(importee, jsonPath, configService) {
|
|
|
26456
26656
|
updated = importee.replace(matchedEntry.find, matchedEntry.replacement);
|
|
26457
26657
|
}
|
|
26458
26658
|
}
|
|
26459
|
-
const baseDir = jsonPath ?
|
|
26460
|
-
return
|
|
26659
|
+
const baseDir = jsonPath ? path37.dirname(jsonPath) : configService.absoluteSrcRoot;
|
|
26660
|
+
return path37.resolve(baseDir, updated);
|
|
26461
26661
|
}
|
|
26462
26662
|
function hasDependencyPrefix(dependencies, tokens) {
|
|
26463
26663
|
return Object.keys(dependencies).some((dep) => {
|
|
@@ -26634,11 +26834,11 @@ init_esm_shims();
|
|
|
26634
26834
|
init_esm_shims();
|
|
26635
26835
|
import { isEmptyObject as isEmptyObject2, isObject as isObject5 } from "@weapp-core/shared";
|
|
26636
26836
|
import MagicString3 from "magic-string";
|
|
26637
|
-
import
|
|
26837
|
+
import path39 from "pathe";
|
|
26638
26838
|
|
|
26639
26839
|
// src/plugins/utils/wxmlEmit.ts
|
|
26640
26840
|
init_esm_shims();
|
|
26641
|
-
import
|
|
26841
|
+
import path38 from "pathe";
|
|
26642
26842
|
|
|
26643
26843
|
// src/wxml/handle.ts
|
|
26644
26844
|
init_esm_shims();
|
|
@@ -26667,8 +26867,8 @@ function transformWxsCode(code, options) {
|
|
|
26667
26867
|
}
|
|
26668
26868
|
importees.push({ source: value });
|
|
26669
26869
|
};
|
|
26670
|
-
const tryCollectArgument = (
|
|
26671
|
-
const node =
|
|
26870
|
+
const tryCollectArgument = (path71) => {
|
|
26871
|
+
const node = path71.node;
|
|
26672
26872
|
if (t.isStringLiteral(node)) {
|
|
26673
26873
|
maybePushImportee(node.value);
|
|
26674
26874
|
return;
|
|
@@ -26679,7 +26879,7 @@ function transformWxsCode(code, options) {
|
|
|
26679
26879
|
return;
|
|
26680
26880
|
}
|
|
26681
26881
|
try {
|
|
26682
|
-
const evaluated =
|
|
26882
|
+
const evaluated = path71.evaluate();
|
|
26683
26883
|
if (evaluated.confident) {
|
|
26684
26884
|
maybePushImportee(evaluated.value);
|
|
26685
26885
|
}
|
|
@@ -26924,7 +27124,7 @@ function emitWxmlAssetsWithCache(options) {
|
|
|
26924
27124
|
if (!pluginRoot) {
|
|
26925
27125
|
return false;
|
|
26926
27126
|
}
|
|
26927
|
-
const pluginBase =
|
|
27127
|
+
const pluginBase = path38.basename(pluginRoot);
|
|
26928
27128
|
return fileName.startsWith(pluginBase);
|
|
26929
27129
|
}
|
|
26930
27130
|
return scanService.isMainPackageFileName(fileName);
|
|
@@ -26965,9 +27165,9 @@ function emitJsonAsset(runtime, fileName, source) {
|
|
|
26965
27165
|
function filterPluginBundleOutputs(bundle, configService) {
|
|
26966
27166
|
const pluginOutputRoot = configService.absolutePluginOutputRoot;
|
|
26967
27167
|
for (const [fileName] of Object.entries(bundle)) {
|
|
26968
|
-
const absolute =
|
|
26969
|
-
const relative3 = pluginOutputRoot ?
|
|
26970
|
-
const isPluginFile = pluginOutputRoot ? !relative3.startsWith("..") && !
|
|
27168
|
+
const absolute = path39.resolve(configService.outDir, fileName);
|
|
27169
|
+
const relative3 = pluginOutputRoot ? path39.relative(pluginOutputRoot, absolute) : "";
|
|
27170
|
+
const isPluginFile = pluginOutputRoot ? !relative3.startsWith("..") && !path39.isAbsolute(relative3) : fileName.startsWith(path39.basename(configService.absolutePluginRoot ?? "plugin"));
|
|
26971
27171
|
if (!isPluginFile) {
|
|
26972
27172
|
delete bundle[fileName];
|
|
26973
27173
|
}
|
|
@@ -27082,8 +27282,8 @@ function resolveRelativeImport(fromFile, specifier) {
|
|
|
27082
27282
|
if (!specifier) {
|
|
27083
27283
|
return "";
|
|
27084
27284
|
}
|
|
27085
|
-
const dir =
|
|
27086
|
-
const absolute =
|
|
27285
|
+
const dir = path39.posix.dirname(fromFile);
|
|
27286
|
+
const absolute = path39.posix.resolve("/", dir, specifier);
|
|
27087
27287
|
return absolute.startsWith("/") ? absolute.slice(1) : absolute;
|
|
27088
27288
|
}
|
|
27089
27289
|
|
|
@@ -27454,7 +27654,7 @@ function createBuildEndHook(state) {
|
|
|
27454
27654
|
// src/plugins/core/lifecycle/load.ts
|
|
27455
27655
|
init_esm_shims();
|
|
27456
27656
|
import { removeExtensionDeep as removeExtensionDeep8 } from "@weapp-core/shared";
|
|
27457
|
-
import
|
|
27657
|
+
import path40 from "pathe";
|
|
27458
27658
|
|
|
27459
27659
|
// src/plugins/utils/parse.ts
|
|
27460
27660
|
init_esm_shims();
|
|
@@ -27491,7 +27691,7 @@ function createOptionsHook(state) {
|
|
|
27491
27691
|
let scannedInput;
|
|
27492
27692
|
if (subPackageMeta) {
|
|
27493
27693
|
scannedInput = subPackageMeta.entries.reduce((acc, entry) => {
|
|
27494
|
-
acc[entry] =
|
|
27694
|
+
acc[entry] = path40.resolve(configService.absoluteSrcRoot, entry);
|
|
27495
27695
|
return acc;
|
|
27496
27696
|
}, {});
|
|
27497
27697
|
} else {
|
|
@@ -27565,14 +27765,14 @@ function createLoadHook(state) {
|
|
|
27565
27765
|
|
|
27566
27766
|
// src/plugins/core/lifecycle/watch.ts
|
|
27567
27767
|
init_esm_shims();
|
|
27568
|
-
import
|
|
27768
|
+
import path46 from "pathe";
|
|
27569
27769
|
|
|
27570
27770
|
// src/plugins/css/shared/preprocessor.ts
|
|
27571
27771
|
init_esm_shims();
|
|
27572
27772
|
import { createHash as createHash2 } from "crypto";
|
|
27573
27773
|
import { createRequire as createRequire5 } from "module";
|
|
27574
27774
|
import fs19 from "fs-extra";
|
|
27575
|
-
import
|
|
27775
|
+
import path41 from "pathe";
|
|
27576
27776
|
import { preprocessCSS } from "vite";
|
|
27577
27777
|
|
|
27578
27778
|
// src/postcss/index.ts
|
|
@@ -27733,12 +27933,12 @@ async function processCssWithCache(code, configService) {
|
|
|
27733
27933
|
}
|
|
27734
27934
|
function dedupeAndNormalizeDependencies(base, dependencies) {
|
|
27735
27935
|
const seen = /* @__PURE__ */ new Set();
|
|
27736
|
-
const baseDir =
|
|
27936
|
+
const baseDir = path41.dirname(base);
|
|
27737
27937
|
for (const dep of dependencies) {
|
|
27738
27938
|
if (!dep) {
|
|
27739
27939
|
continue;
|
|
27740
27940
|
}
|
|
27741
|
-
const normalized =
|
|
27941
|
+
const normalized = path41.isAbsolute(dep) ? dep : path41.resolve(baseDir, dep);
|
|
27742
27942
|
seen.add(normalized);
|
|
27743
27943
|
}
|
|
27744
27944
|
return Array.from(seen);
|
|
@@ -27836,11 +28036,11 @@ init_esm_shims();
|
|
|
27836
28036
|
// src/plugins/utils/invalidateEntry/cssGraph.ts
|
|
27837
28037
|
init_esm_shims();
|
|
27838
28038
|
import fs20 from "fs";
|
|
27839
|
-
import
|
|
28039
|
+
import path43 from "pathe";
|
|
27840
28040
|
|
|
27841
28041
|
// src/plugins/utils/invalidateEntry/shared.ts
|
|
27842
28042
|
init_esm_shims();
|
|
27843
|
-
import
|
|
28043
|
+
import path42 from "pathe";
|
|
27844
28044
|
var watchedCssExts = new Set(supportedCssLangs.map((ext2) => `.${ext2}`));
|
|
27845
28045
|
var watchedTemplateExts = new Set(templateExtensions.map((ext2) => `.${ext2}`));
|
|
27846
28046
|
var configSuffixes = configExtensions.map((ext2) => `.${ext2}`);
|
|
@@ -27861,7 +28061,7 @@ function isWatchLimitError(error) {
|
|
|
27861
28061
|
return watchLimitErrorCodes.has(maybeError.code);
|
|
27862
28062
|
}
|
|
27863
28063
|
function normalizePath2(p) {
|
|
27864
|
-
return
|
|
28064
|
+
return path42.normalize(p);
|
|
27865
28065
|
}
|
|
27866
28066
|
|
|
27867
28067
|
// src/plugins/utils/invalidateEntry/cssGraph.ts
|
|
@@ -27945,7 +28145,7 @@ async function extractCssImportDependencies(ctx, importer) {
|
|
|
27945
28145
|
}
|
|
27946
28146
|
cssImportRE.lastIndex = 0;
|
|
27947
28147
|
const dependencies = /* @__PURE__ */ new Set();
|
|
27948
|
-
const dir =
|
|
28148
|
+
const dir = path43.dirname(importer);
|
|
27949
28149
|
while (true) {
|
|
27950
28150
|
const match2 = cssImportRE.exec(cssContent);
|
|
27951
28151
|
if (!match2) {
|
|
@@ -27957,9 +28157,9 @@ async function extractCssImportDependencies(ctx, importer) {
|
|
|
27957
28157
|
}
|
|
27958
28158
|
if (importProtocols.test(rawSpecifier)) {
|
|
27959
28159
|
if (rawSpecifier.startsWith("/")) {
|
|
27960
|
-
const absolute =
|
|
28160
|
+
const absolute = path43.resolve(ctx.configService.absoluteSrcRoot, rawSpecifier.slice(1));
|
|
27961
28161
|
dependencies.add(absolute);
|
|
27962
|
-
const ext3 =
|
|
28162
|
+
const ext3 = path43.extname(absolute);
|
|
27963
28163
|
if (ext3) {
|
|
27964
28164
|
dependencies.add(absolute.slice(0, -ext3.length));
|
|
27965
28165
|
}
|
|
@@ -27968,7 +28168,7 @@ async function extractCssImportDependencies(ctx, importer) {
|
|
|
27968
28168
|
}
|
|
27969
28169
|
let specifier = rawSpecifier;
|
|
27970
28170
|
if (specifier.startsWith("@/")) {
|
|
27971
|
-
specifier =
|
|
28171
|
+
specifier = path43.join(ctx.configService.absoluteSrcRoot, specifier.slice(2));
|
|
27972
28172
|
} else if (specifier === "@") {
|
|
27973
28173
|
specifier = ctx.configService.absoluteSrcRoot;
|
|
27974
28174
|
}
|
|
@@ -27976,9 +28176,9 @@ async function extractCssImportDependencies(ctx, importer) {
|
|
|
27976
28176
|
specifier = specifier.slice(1);
|
|
27977
28177
|
}
|
|
27978
28178
|
const cleaned = specifier.replace(/[?#].*$/, "");
|
|
27979
|
-
const resolved =
|
|
28179
|
+
const resolved = path43.resolve(dir, cleaned);
|
|
27980
28180
|
dependencies.add(resolved);
|
|
27981
|
-
const ext2 =
|
|
28181
|
+
const ext2 = path43.extname(resolved);
|
|
27982
28182
|
if (!ext2) {
|
|
27983
28183
|
dependencies.add(resolved);
|
|
27984
28184
|
} else {
|
|
@@ -27997,7 +28197,7 @@ function collectCssImporters(ctx, dependency) {
|
|
|
27997
28197
|
matches2.add(importer);
|
|
27998
28198
|
}
|
|
27999
28199
|
}
|
|
28000
|
-
const ext2 =
|
|
28200
|
+
const ext2 = path43.extname(normalizedDependency);
|
|
28001
28201
|
if (ext2) {
|
|
28002
28202
|
const base = normalizedDependency.slice(0, -ext2.length);
|
|
28003
28203
|
const baseMatches = graph.dependencyToImporters.get(base);
|
|
@@ -28031,7 +28231,7 @@ async function collectAffectedScriptsAndImporters(ctx, startCssFile) {
|
|
|
28031
28231
|
continue;
|
|
28032
28232
|
}
|
|
28033
28233
|
visitedCss.add(current2);
|
|
28034
|
-
const ext2 =
|
|
28234
|
+
const ext2 = path43.extname(current2);
|
|
28035
28235
|
if (ext2) {
|
|
28036
28236
|
const base = current2.slice(0, -ext2.length);
|
|
28037
28237
|
const script = await resolveScriptForCss(scriptCache, base);
|
|
@@ -28058,10 +28258,10 @@ function cleanupCssImporterGraph(ctx, importer) {
|
|
|
28058
28258
|
|
|
28059
28259
|
// src/plugins/utils/invalidateEntry/sidecar.ts
|
|
28060
28260
|
init_esm_shims();
|
|
28061
|
-
import
|
|
28261
|
+
import path44 from "pathe";
|
|
28062
28262
|
async function invalidateEntryForSidecar(ctx, filePath, event = "update") {
|
|
28063
28263
|
const configSuffix = configSuffixes.find((suffix) => filePath.endsWith(suffix));
|
|
28064
|
-
const ext2 =
|
|
28264
|
+
const ext2 = path44.extname(filePath);
|
|
28065
28265
|
const normalizedPath = normalizePath2(filePath);
|
|
28066
28266
|
let scriptBasePath;
|
|
28067
28267
|
if (configSuffix) {
|
|
@@ -28126,13 +28326,13 @@ async function invalidateEntryForSidecar(ctx, filePath, event = "update") {
|
|
|
28126
28326
|
init_esm_shims();
|
|
28127
28327
|
import fs21 from "fs";
|
|
28128
28328
|
import process5 from "process";
|
|
28129
|
-
import
|
|
28329
|
+
import path45 from "pathe";
|
|
28130
28330
|
function ensureSidecarWatcher(ctx, rootDir) {
|
|
28131
28331
|
if (!ctx.configService.isDev || !rootDir || process5.env.VITEST === "true" || process5.env.NODE_ENV === "test") {
|
|
28132
28332
|
return;
|
|
28133
28333
|
}
|
|
28134
28334
|
const { sidecarWatcherMap } = ctx.runtimeState.watcher;
|
|
28135
|
-
const absRoot =
|
|
28335
|
+
const absRoot = path45.normalize(rootDir);
|
|
28136
28336
|
if (!fs21.existsSync(absRoot)) {
|
|
28137
28337
|
return;
|
|
28138
28338
|
}
|
|
@@ -28144,7 +28344,7 @@ function ensureSidecarWatcher(ctx, rootDir) {
|
|
|
28144
28344
|
if (!isSidecarFile(filePath)) {
|
|
28145
28345
|
return;
|
|
28146
28346
|
}
|
|
28147
|
-
const ext2 =
|
|
28347
|
+
const ext2 = path45.extname(filePath);
|
|
28148
28348
|
const isCssFile = Boolean(ext2 && watchedCssExts.has(ext2));
|
|
28149
28349
|
if (isCssFile && (event === "create" || event === "update")) {
|
|
28150
28350
|
void extractCssImportDependencies(ctx, filePath);
|
|
@@ -28165,9 +28365,9 @@ function ensureSidecarWatcher(ctx, rootDir) {
|
|
|
28165
28365
|
}
|
|
28166
28366
|
};
|
|
28167
28367
|
const patterns = [
|
|
28168
|
-
...configExtensions.map((ext2) =>
|
|
28169
|
-
...supportedCssLangs.map((ext2) =>
|
|
28170
|
-
...templateExtensions.map((ext2) =>
|
|
28368
|
+
...configExtensions.map((ext2) => path45.join(absRoot, `**/*.${ext2}`)),
|
|
28369
|
+
...supportedCssLangs.map((ext2) => path45.join(absRoot, `**/*.${ext2}`)),
|
|
28370
|
+
...templateExtensions.map((ext2) => path45.join(absRoot, `**/*.${ext2}`))
|
|
28171
28371
|
];
|
|
28172
28372
|
const ignoredMatcher = createSidecarIgnoredMatcher(ctx, absRoot);
|
|
28173
28373
|
const watcher = chokidar_default.watch(patterns, {
|
|
@@ -28183,15 +28383,15 @@ function ensureSidecarWatcher(ctx, rootDir) {
|
|
|
28183
28383
|
if (!input) {
|
|
28184
28384
|
return;
|
|
28185
28385
|
}
|
|
28186
|
-
const normalizedPath =
|
|
28386
|
+
const normalizedPath = path45.normalize(input);
|
|
28187
28387
|
if (!options?.silent) {
|
|
28188
28388
|
logger_default.info(`[watch:${event}] ${ctx.configService.relativeCwd(normalizedPath)}`);
|
|
28189
28389
|
}
|
|
28190
28390
|
handleSidecarChange(event, normalizedPath, isReady);
|
|
28191
28391
|
};
|
|
28192
|
-
watcher.on("add", (
|
|
28193
|
-
watcher.on("change", (
|
|
28194
|
-
watcher.on("unlink", (
|
|
28392
|
+
watcher.on("add", (path71) => forwardChange("create", path71));
|
|
28393
|
+
watcher.on("change", (path71) => forwardChange("update", path71));
|
|
28394
|
+
watcher.on("unlink", (path71) => forwardChange("delete", path71));
|
|
28195
28395
|
watcher.on("raw", (eventName, rawPath, details) => {
|
|
28196
28396
|
if (eventName !== "rename") {
|
|
28197
28397
|
return;
|
|
@@ -28201,7 +28401,7 @@ function ensureSidecarWatcher(ctx, rootDir) {
|
|
|
28201
28401
|
return;
|
|
28202
28402
|
}
|
|
28203
28403
|
const baseDir = typeof details === "object" && details && "watchedPath" in details ? details.watchedPath ?? absRoot : absRoot;
|
|
28204
|
-
const resolved =
|
|
28404
|
+
const resolved = path45.isAbsolute(candidate) ? candidate : path45.resolve(baseDir, candidate);
|
|
28205
28405
|
if (ignoredMatcher(resolved)) {
|
|
28206
28406
|
return;
|
|
28207
28407
|
}
|
|
@@ -28229,22 +28429,22 @@ function ensureSidecarWatcher(ctx, rootDir) {
|
|
|
28229
28429
|
function createSidecarIgnoredMatcher(ctx, rootDir) {
|
|
28230
28430
|
const configService = ctx.configService;
|
|
28231
28431
|
const ignoredRoots = /* @__PURE__ */ new Set();
|
|
28232
|
-
const normalizedRoot =
|
|
28432
|
+
const normalizedRoot = path45.normalize(rootDir);
|
|
28233
28433
|
for (const dirName of defaultIgnoredDirNames) {
|
|
28234
|
-
ignoredRoots.add(
|
|
28434
|
+
ignoredRoots.add(path45.join(normalizedRoot, dirName));
|
|
28235
28435
|
}
|
|
28236
28436
|
if (configService?.mpDistRoot) {
|
|
28237
|
-
ignoredRoots.add(
|
|
28437
|
+
ignoredRoots.add(path45.resolve(configService.cwd, configService.mpDistRoot));
|
|
28238
28438
|
} else {
|
|
28239
|
-
ignoredRoots.add(
|
|
28439
|
+
ignoredRoots.add(path45.join(normalizedRoot, "dist"));
|
|
28240
28440
|
}
|
|
28241
28441
|
if (configService?.outDir) {
|
|
28242
|
-
ignoredRoots.add(
|
|
28442
|
+
ignoredRoots.add(path45.resolve(configService.cwd, configService.outDir));
|
|
28243
28443
|
}
|
|
28244
28444
|
return (candidate) => {
|
|
28245
|
-
const normalized =
|
|
28445
|
+
const normalized = path45.normalize(candidate);
|
|
28246
28446
|
for (const ignored of ignoredRoots) {
|
|
28247
|
-
if (normalized === ignored || normalized.startsWith(`${ignored}${
|
|
28447
|
+
if (normalized === ignored || normalized.startsWith(`${ignored}${path45.sep}`)) {
|
|
28248
28448
|
return true;
|
|
28249
28449
|
}
|
|
28250
28450
|
}
|
|
@@ -28267,7 +28467,7 @@ function createBuildStartHook(state) {
|
|
|
28267
28467
|
ensureSidecarWatcher(ctx, configService.absolutePluginRoot);
|
|
28268
28468
|
}
|
|
28269
28469
|
} else {
|
|
28270
|
-
const rootDir = subPackageMeta ?
|
|
28470
|
+
const rootDir = subPackageMeta ? path46.resolve(configService.absoluteSrcRoot, subPackageMeta.subPackage.root) : configService.absoluteSrcRoot;
|
|
28271
28471
|
ensureSidecarWatcher(ctx, rootDir);
|
|
28272
28472
|
if (!subPackageMeta && configService.absolutePluginRoot) {
|
|
28273
28473
|
ensureSidecarWatcher(ctx, configService.absolutePluginRoot);
|
|
@@ -28298,7 +28498,7 @@ function createWatchChangeHook(state) {
|
|
|
28298
28498
|
}
|
|
28299
28499
|
if (isTemplateFile2 || configSuffix || isStyleFile2) {
|
|
28300
28500
|
const basePath = configSuffix ? normalizedId.slice(0, -configSuffix.length) : (() => {
|
|
28301
|
-
const ext2 =
|
|
28501
|
+
const ext2 = path46.extname(normalizedId);
|
|
28302
28502
|
return ext2 ? normalizedId.slice(0, -ext2.length) : normalizedId;
|
|
28303
28503
|
})();
|
|
28304
28504
|
const primaryScript = await findJsEntry(basePath);
|
|
@@ -28372,7 +28572,7 @@ function createCoreLifecyclePlugin(state) {
|
|
|
28372
28572
|
|
|
28373
28573
|
// src/plugins/core/requireAnalysis.ts
|
|
28374
28574
|
init_esm_shims();
|
|
28375
|
-
import
|
|
28575
|
+
import path47 from "pathe";
|
|
28376
28576
|
|
|
28377
28577
|
// src/plugins/utils/ast.ts
|
|
28378
28578
|
init_esm_shims();
|
|
@@ -28433,7 +28633,7 @@ function createRequireAnalysisPlugin(state) {
|
|
|
28433
28633
|
return;
|
|
28434
28634
|
}
|
|
28435
28635
|
for (const requireModule of requireTokens) {
|
|
28436
|
-
const absPath =
|
|
28636
|
+
const absPath = path47.resolve(path47.dirname(moduleInfo.id), requireModule.value);
|
|
28437
28637
|
const resolved = await this.resolve(absPath, moduleInfo.id);
|
|
28438
28638
|
if (!resolved) {
|
|
28439
28639
|
continue;
|
|
@@ -28527,11 +28727,11 @@ function weappVite(ctx, subPackageMeta) {
|
|
|
28527
28727
|
// src/plugins/css.ts
|
|
28528
28728
|
init_esm_shims();
|
|
28529
28729
|
import fs22 from "fs-extra";
|
|
28530
|
-
import
|
|
28730
|
+
import path49 from "pathe";
|
|
28531
28731
|
|
|
28532
28732
|
// src/plugins/css/shared/sharedStyles.ts
|
|
28533
28733
|
init_esm_shims();
|
|
28534
|
-
import
|
|
28734
|
+
import path48 from "pathe";
|
|
28535
28735
|
import picomatch2 from "picomatch";
|
|
28536
28736
|
var styleMatcherCache = /* @__PURE__ */ new WeakMap();
|
|
28537
28737
|
function collectSharedStyleEntries(ctx, configService) {
|
|
@@ -28640,7 +28840,7 @@ function findSharedStylesForModule(modulePath, fileName, sharedStyles) {
|
|
|
28640
28840
|
}
|
|
28641
28841
|
function resolveImportSpecifiers(fileName, entries) {
|
|
28642
28842
|
const posixFileName = toPosixPath(fileName);
|
|
28643
|
-
const dir =
|
|
28843
|
+
const dir = path48.posix.dirname(posixFileName);
|
|
28644
28844
|
const seen = /* @__PURE__ */ new Set();
|
|
28645
28845
|
const specifiers = [];
|
|
28646
28846
|
for (const entry of entries) {
|
|
@@ -28648,8 +28848,8 @@ function resolveImportSpecifiers(fileName, entries) {
|
|
|
28648
28848
|
if (target === posixFileName) {
|
|
28649
28849
|
continue;
|
|
28650
28850
|
}
|
|
28651
|
-
const relative3 =
|
|
28652
|
-
let specifier = relative3 ||
|
|
28851
|
+
const relative3 = path48.posix.relative(dir, target);
|
|
28852
|
+
let specifier = relative3 || path48.posix.basename(target);
|
|
28653
28853
|
if (!specifier || specifier === ".") {
|
|
28654
28854
|
continue;
|
|
28655
28855
|
}
|
|
@@ -28750,7 +28950,7 @@ async function handleBundleEntry(bundle, bundleKey, asset2, configService, share
|
|
|
28750
28950
|
};
|
|
28751
28951
|
if (bundleKey.endsWith(".wxss")) {
|
|
28752
28952
|
const [rawOriginal] = asset2.originalFileNames ?? [];
|
|
28753
|
-
const absOriginal = rawOriginal ? toAbsolute(rawOriginal) :
|
|
28953
|
+
const absOriginal = rawOriginal ? toAbsolute(rawOriginal) : path49.resolve(configService.absoluteSrcRoot, bundleKey);
|
|
28754
28954
|
const fileName = configService.relativeOutputPath(absOriginal);
|
|
28755
28955
|
if (fileName) {
|
|
28756
28956
|
emitted.add(toPosixPath(fileName));
|
|
@@ -28965,7 +29165,7 @@ init_esm_shims();
|
|
|
28965
29165
|
init_esm_shims();
|
|
28966
29166
|
import { createRequire as createRequire6 } from "module";
|
|
28967
29167
|
import process6 from "process";
|
|
28968
|
-
import
|
|
29168
|
+
import path50 from "pathe";
|
|
28969
29169
|
var VUE_VIRTUAL_MODULE_PREFIX = "\0vue:";
|
|
28970
29170
|
var warnedMissingWevu = false;
|
|
28971
29171
|
var wevuInstallState = "unknown";
|
|
@@ -28992,7 +29192,7 @@ function ensureWevuInstalled(ctx) {
|
|
|
28992
29192
|
}
|
|
28993
29193
|
const configService = ctx.configService;
|
|
28994
29194
|
const cwd = configService?.cwd ?? process6.cwd();
|
|
28995
|
-
const require3 = createRequire6(
|
|
29195
|
+
const require3 = createRequire6(path50.join(cwd, "package.json"));
|
|
28996
29196
|
try {
|
|
28997
29197
|
require3.resolve("wevu");
|
|
28998
29198
|
wevuInstallState = "present";
|
|
@@ -29073,7 +29273,7 @@ init_esm_shims();
|
|
|
29073
29273
|
var import_merge2 = __toESM(require_src(), 1);
|
|
29074
29274
|
import { parse as parseJson2 } from "comment-json";
|
|
29075
29275
|
import fs23 from "fs-extra";
|
|
29076
|
-
import
|
|
29276
|
+
import path51 from "pathe";
|
|
29077
29277
|
import { bundleRequire } from "rolldown-require";
|
|
29078
29278
|
function normalizeConfigLang(lang) {
|
|
29079
29279
|
if (!lang) {
|
|
@@ -29095,14 +29295,14 @@ function resolveJsLikeLang(lang) {
|
|
|
29095
29295
|
return "js";
|
|
29096
29296
|
}
|
|
29097
29297
|
async function evaluateJsLikeConfig(source, filename, lang) {
|
|
29098
|
-
const dir =
|
|
29298
|
+
const dir = path51.dirname(filename);
|
|
29099
29299
|
const extension = resolveJsLikeLang(lang) === "ts" ? "ts" : "js";
|
|
29100
29300
|
const tempDir = resolveWevuConfigTempDir(dir);
|
|
29101
29301
|
return await withTempDirLock(tempDir, async () => {
|
|
29102
29302
|
await fs23.ensureDir(tempDir);
|
|
29103
|
-
const basename4 =
|
|
29303
|
+
const basename4 = path51.basename(filename, path51.extname(filename));
|
|
29104
29304
|
const unique = `${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
29105
|
-
const tempFile =
|
|
29305
|
+
const tempFile = path51.join(tempDir, `${basename4}.${unique}.${extension}`);
|
|
29106
29306
|
const rewritten = rewriteJsLikeImportsForTempDir(source, dir, tempDir);
|
|
29107
29307
|
await fs23.writeFile(tempFile, rewritten, "utf8");
|
|
29108
29308
|
try {
|
|
@@ -29346,16 +29546,16 @@ function extractDefineOptionsHash(content) {
|
|
|
29346
29546
|
}
|
|
29347
29547
|
const macroSources = [];
|
|
29348
29548
|
traverse(ast, {
|
|
29349
|
-
CallExpression(
|
|
29350
|
-
const callee =
|
|
29549
|
+
CallExpression(path71) {
|
|
29550
|
+
const callee = path71.node.callee;
|
|
29351
29551
|
if (!t2.isIdentifier(callee, { name: "defineOptions" })) {
|
|
29352
29552
|
return;
|
|
29353
29553
|
}
|
|
29354
|
-
const isTopLevelStatement =
|
|
29554
|
+
const isTopLevelStatement = path71.parentPath?.isExpressionStatement() && path71.parentPath.parentPath?.isProgram();
|
|
29355
29555
|
if (!isTopLevelStatement) {
|
|
29356
29556
|
return;
|
|
29357
29557
|
}
|
|
29358
|
-
const statement =
|
|
29558
|
+
const statement = path71.parentPath?.node;
|
|
29359
29559
|
if (statement && typeof statement.start === "number" && typeof statement.end === "number") {
|
|
29360
29560
|
macroSources.push(content.slice(statement.start, statement.end));
|
|
29361
29561
|
}
|
|
@@ -29367,15 +29567,31 @@ function extractDefineOptionsHash(content) {
|
|
|
29367
29567
|
return createHash3("sha256").update(macroSources.join("\n")).digest("hex").slice(0, 12);
|
|
29368
29568
|
}
|
|
29369
29569
|
async function parseVueFile(source, filename, options) {
|
|
29370
|
-
const
|
|
29570
|
+
const normalizedSource = preprocessScriptSrc(preprocessScriptSetupSrc(source));
|
|
29571
|
+
const { descriptor, errors } = parse9(normalizedSource, {
|
|
29572
|
+
filename,
|
|
29573
|
+
ignoreEmpty: normalizedSource === source
|
|
29574
|
+
});
|
|
29575
|
+
restoreScriptSetupSrc(descriptor);
|
|
29576
|
+
restoreScriptSrc(descriptor);
|
|
29371
29577
|
if (errors.length > 0) {
|
|
29372
29578
|
const error = errors[0];
|
|
29373
29579
|
throw new Error(`\u89E3\u6790 ${filename} \u5931\u8D25\uFF1A${error.message}`);
|
|
29374
29580
|
}
|
|
29375
|
-
let
|
|
29581
|
+
let resolvedDescriptor = descriptor;
|
|
29582
|
+
let sfcSrcDeps;
|
|
29583
|
+
if (options?.sfcSrc) {
|
|
29584
|
+
const resolved = await resolveSfcBlockSrc(descriptor, filename, options.sfcSrc);
|
|
29585
|
+
resolvedDescriptor = resolved.descriptor;
|
|
29586
|
+
if (resolved.deps.length) {
|
|
29587
|
+
sfcSrcDeps = resolved.deps;
|
|
29588
|
+
}
|
|
29589
|
+
}
|
|
29590
|
+
let descriptorForCompile = resolvedDescriptor;
|
|
29376
29591
|
const meta = {
|
|
29377
|
-
hasScriptSetup: !!
|
|
29378
|
-
hasSetupOption: !!
|
|
29592
|
+
hasScriptSetup: !!resolvedDescriptor.scriptSetup,
|
|
29593
|
+
hasSetupOption: !!resolvedDescriptor.script && /\bsetup\s*\(/.test(resolvedDescriptor.script.content),
|
|
29594
|
+
sfcSrcDeps
|
|
29379
29595
|
};
|
|
29380
29596
|
let scriptSetupMacroConfig;
|
|
29381
29597
|
let scriptSetupMacroHash;
|
|
@@ -29383,7 +29599,7 @@ async function parseVueFile(source, filename, options) {
|
|
|
29383
29599
|
const jsonKind = options?.json?.kind ?? (options?.isApp ? "app" : options?.isPage ? "page" : "component");
|
|
29384
29600
|
const jsonDefaults = options?.json?.defaults?.[jsonKind];
|
|
29385
29601
|
const mergeJson = createJsonMerger(options?.json?.mergeStrategy, { filename, kind: jsonKind });
|
|
29386
|
-
const scriptSetup =
|
|
29602
|
+
const scriptSetup = resolvedDescriptor.scriptSetup;
|
|
29387
29603
|
if (scriptSetup?.content) {
|
|
29388
29604
|
const extracted = await extractJsonMacroFromScriptSetup(
|
|
29389
29605
|
scriptSetup.content,
|
|
@@ -29394,19 +29610,41 @@ async function parseVueFile(source, filename, options) {
|
|
|
29394
29610
|
}
|
|
29395
29611
|
);
|
|
29396
29612
|
if (extracted.stripped !== scriptSetup.content) {
|
|
29397
|
-
|
|
29398
|
-
|
|
29399
|
-
|
|
29400
|
-
|
|
29401
|
-
|
|
29402
|
-
|
|
29403
|
-
|
|
29404
|
-
|
|
29405
|
-
|
|
29406
|
-
const
|
|
29407
|
-
|
|
29613
|
+
if (scriptSetup.src) {
|
|
29614
|
+
descriptorForCompile = {
|
|
29615
|
+
...descriptorForCompile,
|
|
29616
|
+
scriptSetup: {
|
|
29617
|
+
...descriptorForCompile.scriptSetup,
|
|
29618
|
+
content: extracted.stripped
|
|
29619
|
+
}
|
|
29620
|
+
};
|
|
29621
|
+
} else {
|
|
29622
|
+
const setupLoc = scriptSetup.loc;
|
|
29623
|
+
const startOffset = setupLoc.start.offset;
|
|
29624
|
+
const endOffset = setupLoc.end.offset;
|
|
29625
|
+
const nextSource = normalizedSource.slice(0, startOffset) + extracted.stripped + normalizedSource.slice(endOffset);
|
|
29626
|
+
const { descriptor: nextDescriptor, errors: nextErrors } = parse9(nextSource, {
|
|
29627
|
+
filename,
|
|
29628
|
+
ignoreEmpty: false
|
|
29629
|
+
});
|
|
29630
|
+
restoreScriptSetupSrc(nextDescriptor);
|
|
29631
|
+
restoreScriptSrc(nextDescriptor);
|
|
29632
|
+
if (nextErrors.length > 0) {
|
|
29633
|
+
const error = nextErrors[0];
|
|
29634
|
+
throw new Error(`\u89E3\u6790 ${filename} \u5931\u8D25\uFF1A${error.message}`);
|
|
29635
|
+
}
|
|
29636
|
+
if (options?.sfcSrc) {
|
|
29637
|
+
const resolvedNext = await resolveSfcBlockSrc(nextDescriptor, filename, options.sfcSrc);
|
|
29638
|
+
descriptorForCompile = resolvedNext.descriptor;
|
|
29639
|
+
if (resolvedNext.deps.length) {
|
|
29640
|
+
const deps = /* @__PURE__ */ new Set([...sfcSrcDeps ?? [], ...resolvedNext.deps]);
|
|
29641
|
+
sfcSrcDeps = Array.from(deps);
|
|
29642
|
+
meta.sfcSrcDeps = sfcSrcDeps;
|
|
29643
|
+
}
|
|
29644
|
+
} else {
|
|
29645
|
+
descriptorForCompile = nextDescriptor;
|
|
29646
|
+
}
|
|
29408
29647
|
}
|
|
29409
|
-
descriptorForCompile = nextDescriptor;
|
|
29410
29648
|
}
|
|
29411
29649
|
scriptSetupMacroConfig = extracted.config;
|
|
29412
29650
|
scriptSetupMacroHash = extracted.macroHash;
|
|
@@ -29414,7 +29652,7 @@ async function parseVueFile(source, filename, options) {
|
|
|
29414
29652
|
}
|
|
29415
29653
|
const isAppFile = /[\\/]app\.vue$/.test(filename);
|
|
29416
29654
|
return {
|
|
29417
|
-
descriptor,
|
|
29655
|
+
descriptor: resolvedDescriptor,
|
|
29418
29656
|
descriptorForCompile,
|
|
29419
29657
|
meta,
|
|
29420
29658
|
scriptSetupMacroConfig,
|
|
@@ -29429,7 +29667,7 @@ async function parseVueFile(source, filename, options) {
|
|
|
29429
29667
|
|
|
29430
29668
|
// src/plugins/vue/transform/compileVueFile/script.ts
|
|
29431
29669
|
init_esm_shims();
|
|
29432
|
-
import * as
|
|
29670
|
+
import * as t25 from "@babel/types";
|
|
29433
29671
|
import { removeExtensionDeep as removeExtensionDeep10 } from "@weapp-core/shared";
|
|
29434
29672
|
import { compileScript } from "vue/compiler-sfc";
|
|
29435
29673
|
|
|
@@ -29489,8 +29727,8 @@ function getObjectMemberIndexByKey(node, key) {
|
|
|
29489
29727
|
return false;
|
|
29490
29728
|
});
|
|
29491
29729
|
}
|
|
29492
|
-
function isTopLevel(
|
|
29493
|
-
return
|
|
29730
|
+
function isTopLevel(path71) {
|
|
29731
|
+
return path71.getFunctionParent() == null;
|
|
29494
29732
|
}
|
|
29495
29733
|
|
|
29496
29734
|
// src/plugins/wevu/pageFeatures/flags.ts
|
|
@@ -29533,8 +29771,8 @@ function collectWevuPageFeatureFlags(ast) {
|
|
|
29533
29771
|
}
|
|
29534
29772
|
}
|
|
29535
29773
|
traverse(ast, {
|
|
29536
|
-
CallExpression(
|
|
29537
|
-
const callee =
|
|
29774
|
+
CallExpression(path71) {
|
|
29775
|
+
const callee = path71.node.callee;
|
|
29538
29776
|
if (t4.isIdentifier(callee)) {
|
|
29539
29777
|
consumeHookCallByName(callee.name);
|
|
29540
29778
|
return;
|
|
@@ -29546,8 +29784,8 @@ function collectWevuPageFeatureFlags(ast) {
|
|
|
29546
29784
|
}
|
|
29547
29785
|
}
|
|
29548
29786
|
},
|
|
29549
|
-
OptionalCallExpression(
|
|
29550
|
-
const callee =
|
|
29787
|
+
OptionalCallExpression(path71) {
|
|
29788
|
+
const callee = path71.node.callee;
|
|
29551
29789
|
if (t4.isIdentifier(callee)) {
|
|
29552
29790
|
consumeHookCallByName(callee.name);
|
|
29553
29791
|
return;
|
|
@@ -29797,23 +30035,23 @@ function collectTargetOptionsObjects(ast, moduleId) {
|
|
|
29797
30035
|
const constObjectBindings = /* @__PURE__ */ new Map();
|
|
29798
30036
|
const pendingConstObjectRefs = [];
|
|
29799
30037
|
traverse(ast, {
|
|
29800
|
-
VariableDeclarator(
|
|
29801
|
-
if (!isTopLevel(
|
|
30038
|
+
VariableDeclarator(path71) {
|
|
30039
|
+
if (!isTopLevel(path71)) {
|
|
29802
30040
|
return;
|
|
29803
30041
|
}
|
|
29804
|
-
if (!t6.isIdentifier(
|
|
30042
|
+
if (!t6.isIdentifier(path71.node.id)) {
|
|
29805
30043
|
return;
|
|
29806
30044
|
}
|
|
29807
|
-
const init =
|
|
30045
|
+
const init = path71.node.init;
|
|
29808
30046
|
if (t6.isObjectExpression(init)) {
|
|
29809
|
-
constObjectBindings.set(
|
|
30047
|
+
constObjectBindings.set(path71.node.id.name, init);
|
|
29810
30048
|
}
|
|
29811
30049
|
},
|
|
29812
|
-
CallExpression(
|
|
29813
|
-
if (!isTopLevel(
|
|
30050
|
+
CallExpression(path71) {
|
|
30051
|
+
if (!isTopLevel(path71)) {
|
|
29814
30052
|
return;
|
|
29815
30053
|
}
|
|
29816
|
-
const node =
|
|
30054
|
+
const node = path71.node;
|
|
29817
30055
|
if (t6.isV8IntrinsicIdentifier(node.callee)) {
|
|
29818
30056
|
return;
|
|
29819
30057
|
}
|
|
@@ -29851,11 +30089,11 @@ function collectTargetOptionsObjects(ast, moduleId) {
|
|
|
29851
30089
|
}
|
|
29852
30090
|
}
|
|
29853
30091
|
},
|
|
29854
|
-
OptionalCallExpression(
|
|
29855
|
-
if (!isTopLevel(
|
|
30092
|
+
OptionalCallExpression(path71) {
|
|
30093
|
+
if (!isTopLevel(path71)) {
|
|
29856
30094
|
return;
|
|
29857
30095
|
}
|
|
29858
|
-
const node =
|
|
30096
|
+
const node = path71.node;
|
|
29859
30097
|
const callee = node.callee;
|
|
29860
30098
|
if (t6.isV8IntrinsicIdentifier(callee)) {
|
|
29861
30099
|
return;
|
|
@@ -30211,7 +30449,7 @@ async function injectWevuPageFeaturesInJsWithResolver(source, options) {
|
|
|
30211
30449
|
// src/plugins/wevu/pageFeatures/matcher.ts
|
|
30212
30450
|
init_esm_shims();
|
|
30213
30451
|
import { removeExtensionDeep as removeExtensionDeep9 } from "@weapp-core/shared";
|
|
30214
|
-
import
|
|
30452
|
+
import path52 from "pathe";
|
|
30215
30453
|
function createPageEntryMatcher(ctx) {
|
|
30216
30454
|
let cached;
|
|
30217
30455
|
async function ensure() {
|
|
@@ -30229,7 +30467,7 @@ function createPageEntryMatcher(ctx) {
|
|
|
30229
30467
|
if (!normalized) {
|
|
30230
30468
|
continue;
|
|
30231
30469
|
}
|
|
30232
|
-
set2.add(
|
|
30470
|
+
set2.add(path52.resolve(configService.absoluteSrcRoot, normalized));
|
|
30233
30471
|
}
|
|
30234
30472
|
for (const meta of scanService.loadSubPackages()) {
|
|
30235
30473
|
const root = meta.subPackage.root ?? "";
|
|
@@ -30238,7 +30476,7 @@ function createPageEntryMatcher(ctx) {
|
|
|
30238
30476
|
if (!normalized) {
|
|
30239
30477
|
continue;
|
|
30240
30478
|
}
|
|
30241
|
-
set2.add(
|
|
30479
|
+
set2.add(path52.resolve(configService.absoluteSrcRoot, root, normalized));
|
|
30242
30480
|
}
|
|
30243
30481
|
}
|
|
30244
30482
|
if (scanService.pluginJson) {
|
|
@@ -30248,7 +30486,7 @@ function createPageEntryMatcher(ctx) {
|
|
|
30248
30486
|
if (!normalized) {
|
|
30249
30487
|
continue;
|
|
30250
30488
|
}
|
|
30251
|
-
set2.add(
|
|
30489
|
+
set2.add(path52.resolve(configService.absoluteSrcRoot, removeExtensionDeep9(normalized)));
|
|
30252
30490
|
}
|
|
30253
30491
|
}
|
|
30254
30492
|
cached = set2;
|
|
@@ -30268,7 +30506,7 @@ function createPageEntryMatcher(ctx) {
|
|
|
30268
30506
|
|
|
30269
30507
|
// src/plugins/wevu/pageFeatures/plugin.ts
|
|
30270
30508
|
init_esm_shims();
|
|
30271
|
-
import
|
|
30509
|
+
import path53 from "pathe";
|
|
30272
30510
|
|
|
30273
30511
|
// src/plugins/utils/viteResolverAdapter.ts
|
|
30274
30512
|
init_esm_shims();
|
|
@@ -30320,7 +30558,7 @@ function createWevuAutoPageFeaturesPlugin(ctx) {
|
|
|
30320
30558
|
return null;
|
|
30321
30559
|
}
|
|
30322
30560
|
const filename = toAbsoluteId(sourceId, configService, void 0, { base: "cwd" });
|
|
30323
|
-
if (!filename || !
|
|
30561
|
+
if (!filename || !path53.isAbsolute(filename)) {
|
|
30324
30562
|
return null;
|
|
30325
30563
|
}
|
|
30326
30564
|
if (!await matcher.isPageFile(filename)) {
|
|
@@ -30361,24 +30599,24 @@ function injectTemplateComponentMeta(ast, templateComponentMeta) {
|
|
|
30361
30599
|
const injectedNames = /* @__PURE__ */ new Set();
|
|
30362
30600
|
let changed = false;
|
|
30363
30601
|
traverse(ast, {
|
|
30364
|
-
ImportDeclaration(
|
|
30365
|
-
if (!
|
|
30602
|
+
ImportDeclaration(path71) {
|
|
30603
|
+
if (!path71.node.specifiers.length) {
|
|
30366
30604
|
return;
|
|
30367
30605
|
}
|
|
30368
|
-
const kept =
|
|
30606
|
+
const kept = path71.node.specifiers.filter((specifier) => {
|
|
30369
30607
|
if (!("local" in specifier) || !t9.isIdentifier(specifier.local)) {
|
|
30370
30608
|
return true;
|
|
30371
30609
|
}
|
|
30372
30610
|
const localName = specifier.local.name;
|
|
30373
30611
|
return !candidateNames.has(localName);
|
|
30374
30612
|
});
|
|
30375
|
-
if (kept.length !==
|
|
30613
|
+
if (kept.length !== path71.node.specifiers.length) {
|
|
30376
30614
|
changed = true;
|
|
30377
30615
|
if (kept.length === 0) {
|
|
30378
|
-
|
|
30616
|
+
path71.remove();
|
|
30379
30617
|
return;
|
|
30380
30618
|
}
|
|
30381
|
-
|
|
30619
|
+
path71.node.specifiers = kept;
|
|
30382
30620
|
}
|
|
30383
30621
|
}
|
|
30384
30622
|
});
|
|
@@ -30421,10 +30659,10 @@ function vueSfcTransformPlugin() {
|
|
|
30421
30659
|
return {
|
|
30422
30660
|
name: "vue-sfc-transform",
|
|
30423
30661
|
visitor: {
|
|
30424
|
-
ImportDeclaration(
|
|
30425
|
-
const source =
|
|
30662
|
+
ImportDeclaration(path71) {
|
|
30663
|
+
const source = path71.node.source.value;
|
|
30426
30664
|
if (source === "vue") {
|
|
30427
|
-
const specifiers =
|
|
30665
|
+
const specifiers = path71.node.specifiers;
|
|
30428
30666
|
const filteredSpecifiers = specifiers.filter((s) => {
|
|
30429
30667
|
if (s.type === "ImportSpecifier" && t10.isIdentifier(s.imported) && s.imported.name === WE_VU_RUNTIME_APIS3.defineComponent) {
|
|
30430
30668
|
return false;
|
|
@@ -30432,14 +30670,14 @@ function vueSfcTransformPlugin() {
|
|
|
30432
30670
|
return true;
|
|
30433
30671
|
});
|
|
30434
30672
|
if (filteredSpecifiers.length === 0) {
|
|
30435
|
-
|
|
30673
|
+
path71.remove();
|
|
30436
30674
|
} else if (filteredSpecifiers.length !== specifiers.length) {
|
|
30437
|
-
|
|
30675
|
+
path71.node.specifiers = filteredSpecifiers;
|
|
30438
30676
|
}
|
|
30439
30677
|
}
|
|
30440
30678
|
},
|
|
30441
|
-
ObjectExpression(
|
|
30442
|
-
const properties =
|
|
30679
|
+
ObjectExpression(path71) {
|
|
30680
|
+
const properties = path71.node.properties;
|
|
30443
30681
|
const filtered = properties.filter((p) => {
|
|
30444
30682
|
if (p.type === "ObjectProperty") {
|
|
30445
30683
|
const key = p.key;
|
|
@@ -30449,11 +30687,11 @@ function vueSfcTransformPlugin() {
|
|
|
30449
30687
|
}
|
|
30450
30688
|
return true;
|
|
30451
30689
|
});
|
|
30452
|
-
|
|
30690
|
+
path71.node.properties = filtered;
|
|
30453
30691
|
},
|
|
30454
|
-
CallExpression(
|
|
30455
|
-
if (t10.isIdentifier(
|
|
30456
|
-
|
|
30692
|
+
CallExpression(path71) {
|
|
30693
|
+
if (t10.isIdentifier(path71.node.callee, { name: "__expose" }) && path71.parentPath?.isExpressionStatement() && path71.node.arguments.length === 0) {
|
|
30694
|
+
path71.parentPath.remove();
|
|
30457
30695
|
}
|
|
30458
30696
|
}
|
|
30459
30697
|
}
|
|
@@ -30507,22 +30745,22 @@ function resolveComponentExpression(declaration, defineComponentDecls, aliases)
|
|
|
30507
30745
|
// src/plugins/vue/transform/transformScript/collect.ts
|
|
30508
30746
|
function createCollectVisitors(state) {
|
|
30509
30747
|
return {
|
|
30510
|
-
VariableDeclarator(
|
|
30511
|
-
if (!t12.isIdentifier(
|
|
30748
|
+
VariableDeclarator(path71) {
|
|
30749
|
+
if (!t12.isIdentifier(path71.node.id) || !path71.node.init) {
|
|
30512
30750
|
return;
|
|
30513
30751
|
}
|
|
30514
|
-
if (t12.isObjectExpression(
|
|
30515
|
-
state.defineComponentDecls.set(
|
|
30752
|
+
if (t12.isObjectExpression(path71.node.init)) {
|
|
30753
|
+
state.defineComponentDecls.set(path71.node.id.name, t12.cloneNode(path71.node.init, true));
|
|
30516
30754
|
}
|
|
30517
|
-
const unwrapped = unwrapDefineComponent(
|
|
30755
|
+
const unwrapped = unwrapDefineComponent(path71.node.init, state.defineComponentAliases);
|
|
30518
30756
|
if (unwrapped) {
|
|
30519
|
-
state.defineComponentDecls.set(
|
|
30520
|
-
|
|
30757
|
+
state.defineComponentDecls.set(path71.node.id.name, t12.cloneNode(unwrapped, true));
|
|
30758
|
+
path71.node.init = unwrapped;
|
|
30521
30759
|
state.transformed = true;
|
|
30522
30760
|
}
|
|
30523
30761
|
},
|
|
30524
|
-
ExportDefaultDeclaration(
|
|
30525
|
-
state.defaultExportPath =
|
|
30762
|
+
ExportDefaultDeclaration(path71) {
|
|
30763
|
+
state.defaultExportPath = path71;
|
|
30526
30764
|
}
|
|
30527
30765
|
};
|
|
30528
30766
|
}
|
|
@@ -30568,16 +30806,17 @@ function ensureRuntimeImport(program, importedName, localName = importedName) {
|
|
|
30568
30806
|
// src/plugins/vue/transform/transformScript/imports.ts
|
|
30569
30807
|
function createImportVisitors(program, state) {
|
|
30570
30808
|
return {
|
|
30571
|
-
ImportDeclaration(
|
|
30572
|
-
if (
|
|
30809
|
+
ImportDeclaration(path71) {
|
|
30810
|
+
if (path71.node.source.value === "vue") {
|
|
30573
30811
|
const movedVueRuntimeAPIs = /* @__PURE__ */ new Set([
|
|
30574
30812
|
"useAttrs",
|
|
30575
30813
|
"useSlots",
|
|
30576
30814
|
"useModel",
|
|
30577
|
-
"mergeModels"
|
|
30815
|
+
"mergeModels",
|
|
30816
|
+
"useTemplateRef"
|
|
30578
30817
|
]);
|
|
30579
30818
|
const movedSpecifiers = [];
|
|
30580
|
-
const remaining =
|
|
30819
|
+
const remaining = path71.node.specifiers.filter((specifier) => {
|
|
30581
30820
|
if (t14.isImportSpecifier(specifier) && specifier.imported.type === "Identifier" && specifier.imported.name === WE_VU_RUNTIME_APIS4.defineComponent) {
|
|
30582
30821
|
state.defineComponentAliases.add(specifier.local.name);
|
|
30583
30822
|
state.transformed = true;
|
|
@@ -30599,29 +30838,29 @@ function createImportVisitors(program, state) {
|
|
|
30599
30838
|
}
|
|
30600
30839
|
}
|
|
30601
30840
|
if (remaining.length === 0) {
|
|
30602
|
-
|
|
30841
|
+
path71.remove();
|
|
30603
30842
|
return;
|
|
30604
30843
|
}
|
|
30605
|
-
|
|
30844
|
+
path71.node.specifiers = remaining;
|
|
30606
30845
|
}
|
|
30607
|
-
if (
|
|
30846
|
+
if (path71.node.importKind === "type") {
|
|
30608
30847
|
state.transformed = true;
|
|
30609
|
-
|
|
30848
|
+
path71.remove();
|
|
30610
30849
|
return;
|
|
30611
30850
|
}
|
|
30612
|
-
const kept =
|
|
30851
|
+
const kept = path71.node.specifiers.filter((specifier) => {
|
|
30613
30852
|
if ("importKind" in specifier && specifier.importKind === "type") {
|
|
30614
30853
|
state.transformed = true;
|
|
30615
30854
|
return false;
|
|
30616
30855
|
}
|
|
30617
30856
|
return true;
|
|
30618
30857
|
});
|
|
30619
|
-
if (kept.length !==
|
|
30858
|
+
if (kept.length !== path71.node.specifiers.length) {
|
|
30620
30859
|
if (kept.length === 0) {
|
|
30621
|
-
|
|
30860
|
+
path71.remove();
|
|
30622
30861
|
return;
|
|
30623
30862
|
}
|
|
30624
|
-
|
|
30863
|
+
path71.node.specifiers = kept;
|
|
30625
30864
|
}
|
|
30626
30865
|
}
|
|
30627
30866
|
};
|
|
@@ -30635,11 +30874,11 @@ init_esm_shims();
|
|
|
30635
30874
|
import * as t15 from "@babel/types";
|
|
30636
30875
|
function createSetupExposeVisitors(state) {
|
|
30637
30876
|
return {
|
|
30638
|
-
ObjectMethod(
|
|
30639
|
-
if (!t15.isIdentifier(
|
|
30877
|
+
ObjectMethod(path71) {
|
|
30878
|
+
if (!t15.isIdentifier(path71.node.key, { name: "setup" }) && !t15.isStringLiteral(path71.node.key, { value: "setup" })) {
|
|
30640
30879
|
return;
|
|
30641
30880
|
}
|
|
30642
|
-
const params =
|
|
30881
|
+
const params = path71.node.params;
|
|
30643
30882
|
if (params.length < 2 || !t15.isObjectPattern(params[1])) {
|
|
30644
30883
|
return;
|
|
30645
30884
|
}
|
|
@@ -30650,8 +30889,8 @@ function createSetupExposeVisitors(state) {
|
|
|
30650
30889
|
}
|
|
30651
30890
|
return t15.isIdentifier(property.key, { name: "expose" }) && t15.isIdentifier(property.value, { name: "__expose" });
|
|
30652
30891
|
});
|
|
30653
|
-
if (hasVueExposeAlias &&
|
|
30654
|
-
|
|
30892
|
+
if (hasVueExposeAlias && path71.scope.hasBinding("__expose") && !path71.scope.hasBinding("expose")) {
|
|
30893
|
+
path71.scope.rename("__expose", "expose");
|
|
30655
30894
|
state.transformed = true;
|
|
30656
30895
|
for (const property of ctxParam.properties) {
|
|
30657
30896
|
if (!t15.isObjectProperty(property)) {
|
|
@@ -30736,143 +30975,147 @@ function stripOptionalFromPattern(pattern) {
|
|
|
30736
30975
|
// src/plugins/vue/transform/transformScript/macros/stripTypes.ts
|
|
30737
30976
|
function createStripTypesVisitors(state) {
|
|
30738
30977
|
return {
|
|
30739
|
-
ExportNamedDeclaration(
|
|
30740
|
-
if (
|
|
30978
|
+
ExportNamedDeclaration(path71) {
|
|
30979
|
+
if (path71.node.exportKind === "type") {
|
|
30741
30980
|
state.transformed = true;
|
|
30742
|
-
|
|
30981
|
+
path71.remove();
|
|
30743
30982
|
return;
|
|
30744
30983
|
}
|
|
30745
|
-
if (
|
|
30746
|
-
const remaining =
|
|
30984
|
+
if (path71.node.specifiers?.length) {
|
|
30985
|
+
const remaining = path71.node.specifiers.filter((spec) => {
|
|
30747
30986
|
if (t17.isExportSpecifier(spec)) {
|
|
30748
30987
|
return spec.exportKind !== "type";
|
|
30749
30988
|
}
|
|
30750
30989
|
return true;
|
|
30751
30990
|
});
|
|
30752
|
-
if (remaining.length !==
|
|
30991
|
+
if (remaining.length !== path71.node.specifiers.length) {
|
|
30753
30992
|
state.transformed = true;
|
|
30754
30993
|
if (remaining.length === 0) {
|
|
30755
|
-
|
|
30994
|
+
path71.remove();
|
|
30756
30995
|
return;
|
|
30757
30996
|
}
|
|
30758
|
-
|
|
30997
|
+
path71.node.specifiers = remaining;
|
|
30759
30998
|
}
|
|
30760
30999
|
}
|
|
30761
31000
|
},
|
|
30762
|
-
CallExpression(
|
|
30763
|
-
if (t17.isIdentifier(
|
|
30764
|
-
if (
|
|
30765
|
-
|
|
31001
|
+
CallExpression(path71) {
|
|
31002
|
+
if (t17.isIdentifier(path71.node.callee, { name: "__expose" }) && path71.parentPath?.isExpressionStatement()) {
|
|
31003
|
+
if (path71.node.arguments.length === 0) {
|
|
31004
|
+
path71.parentPath.remove();
|
|
30766
31005
|
state.transformed = true;
|
|
30767
31006
|
return;
|
|
30768
31007
|
}
|
|
30769
31008
|
}
|
|
30770
|
-
if (
|
|
30771
|
-
|
|
31009
|
+
if (path71.node.typeParameters) {
|
|
31010
|
+
path71.node.typeParameters = null;
|
|
30772
31011
|
state.transformed = true;
|
|
30773
31012
|
}
|
|
30774
31013
|
},
|
|
30775
|
-
NewExpression(
|
|
30776
|
-
if (
|
|
30777
|
-
|
|
31014
|
+
NewExpression(path71) {
|
|
31015
|
+
if (path71.node.typeParameters) {
|
|
31016
|
+
path71.node.typeParameters = null;
|
|
30778
31017
|
state.transformed = true;
|
|
30779
31018
|
}
|
|
30780
31019
|
},
|
|
30781
|
-
ObjectProperty(
|
|
30782
|
-
if (t17.isIdentifier(
|
|
30783
|
-
|
|
31020
|
+
ObjectProperty(path71) {
|
|
31021
|
+
if (t17.isIdentifier(path71.node.key, { name: "__name" }) || t17.isStringLiteral(path71.node.key, { value: "__name" })) {
|
|
31022
|
+
path71.remove();
|
|
30784
31023
|
state.transformed = true;
|
|
30785
31024
|
}
|
|
30786
31025
|
},
|
|
30787
|
-
TSTypeAliasDeclaration(
|
|
30788
|
-
|
|
31026
|
+
TSTypeAliasDeclaration(path71) {
|
|
31027
|
+
path71.remove();
|
|
30789
31028
|
state.transformed = true;
|
|
30790
31029
|
},
|
|
30791
|
-
TSInterfaceDeclaration(
|
|
30792
|
-
|
|
31030
|
+
TSInterfaceDeclaration(path71) {
|
|
31031
|
+
path71.remove();
|
|
30793
31032
|
state.transformed = true;
|
|
30794
31033
|
},
|
|
30795
|
-
TSEnumDeclaration(
|
|
30796
|
-
|
|
31034
|
+
TSEnumDeclaration(path71) {
|
|
31035
|
+
path71.remove();
|
|
30797
31036
|
state.transformed = true;
|
|
30798
31037
|
},
|
|
30799
|
-
TSModuleDeclaration(
|
|
30800
|
-
|
|
31038
|
+
TSModuleDeclaration(path71) {
|
|
31039
|
+
path71.remove();
|
|
30801
31040
|
state.transformed = true;
|
|
30802
31041
|
},
|
|
30803
|
-
TSImportEqualsDeclaration(
|
|
30804
|
-
|
|
31042
|
+
TSImportEqualsDeclaration(path71) {
|
|
31043
|
+
path71.remove();
|
|
30805
31044
|
state.transformed = true;
|
|
30806
31045
|
},
|
|
30807
|
-
TSAsExpression(
|
|
30808
|
-
|
|
31046
|
+
TSAsExpression(path71) {
|
|
31047
|
+
path71.replaceWith(path71.node.expression);
|
|
30809
31048
|
state.transformed = true;
|
|
30810
31049
|
},
|
|
30811
|
-
|
|
30812
|
-
|
|
31050
|
+
TSSatisfiesExpression(path71) {
|
|
31051
|
+
path71.replaceWith(path71.node.expression);
|
|
30813
31052
|
state.transformed = true;
|
|
30814
31053
|
},
|
|
30815
|
-
|
|
30816
|
-
|
|
31054
|
+
TSTypeAssertion(path71) {
|
|
31055
|
+
path71.replaceWith(path71.node.expression);
|
|
30817
31056
|
state.transformed = true;
|
|
30818
31057
|
},
|
|
30819
|
-
|
|
30820
|
-
|
|
31058
|
+
TSNonNullExpression(path71) {
|
|
31059
|
+
path71.replaceWith(path71.node.expression);
|
|
30821
31060
|
state.transformed = true;
|
|
30822
31061
|
},
|
|
30823
|
-
|
|
30824
|
-
|
|
31062
|
+
TSTypeAnnotation(path71) {
|
|
31063
|
+
path71.remove();
|
|
30825
31064
|
state.transformed = true;
|
|
30826
31065
|
},
|
|
30827
|
-
|
|
30828
|
-
|
|
30829
|
-
|
|
31066
|
+
TSParameterProperty(path71) {
|
|
31067
|
+
path71.replaceWith(path71.node.parameter);
|
|
31068
|
+
state.transformed = true;
|
|
31069
|
+
},
|
|
31070
|
+
Function(path71) {
|
|
31071
|
+
if (path71.node.returnType) {
|
|
31072
|
+
path71.node.returnType = null;
|
|
30830
31073
|
state.transformed = true;
|
|
30831
31074
|
}
|
|
30832
|
-
if (
|
|
30833
|
-
|
|
31075
|
+
if (path71.node.typeParameters) {
|
|
31076
|
+
path71.node.typeParameters = null;
|
|
30834
31077
|
state.transformed = true;
|
|
30835
31078
|
}
|
|
30836
|
-
for (const param of
|
|
31079
|
+
for (const param of path71.node.params) {
|
|
30837
31080
|
if (stripOptionalFromPattern(param)) {
|
|
30838
31081
|
state.transformed = true;
|
|
30839
31082
|
}
|
|
30840
31083
|
}
|
|
30841
31084
|
},
|
|
30842
|
-
ClassMethod(
|
|
30843
|
-
if (stripOptionalFlag(
|
|
31085
|
+
ClassMethod(path71) {
|
|
31086
|
+
if (stripOptionalFlag(path71.node)) {
|
|
30844
31087
|
state.transformed = true;
|
|
30845
31088
|
}
|
|
30846
31089
|
},
|
|
30847
|
-
ClassPrivateMethod(
|
|
30848
|
-
if (stripOptionalFlag(
|
|
31090
|
+
ClassPrivateMethod(path71) {
|
|
31091
|
+
if (stripOptionalFlag(path71.node)) {
|
|
30849
31092
|
state.transformed = true;
|
|
30850
31093
|
}
|
|
30851
31094
|
},
|
|
30852
|
-
ClassAccessorProperty(
|
|
30853
|
-
if (
|
|
30854
|
-
|
|
31095
|
+
ClassAccessorProperty(path71) {
|
|
31096
|
+
if (path71.node.typeAnnotation) {
|
|
31097
|
+
path71.node.typeAnnotation = null;
|
|
30855
31098
|
state.transformed = true;
|
|
30856
31099
|
}
|
|
30857
|
-
if (stripOptionalFlag(
|
|
31100
|
+
if (stripOptionalFlag(path71.node)) {
|
|
30858
31101
|
state.transformed = true;
|
|
30859
31102
|
}
|
|
30860
31103
|
},
|
|
30861
|
-
ClassProperty(
|
|
30862
|
-
if (
|
|
30863
|
-
|
|
31104
|
+
ClassProperty(path71) {
|
|
31105
|
+
if (path71.node.typeAnnotation) {
|
|
31106
|
+
path71.node.typeAnnotation = null;
|
|
30864
31107
|
state.transformed = true;
|
|
30865
31108
|
}
|
|
30866
|
-
if (stripOptionalFlag(
|
|
31109
|
+
if (stripOptionalFlag(path71.node)) {
|
|
30867
31110
|
state.transformed = true;
|
|
30868
31111
|
}
|
|
30869
31112
|
},
|
|
30870
|
-
ClassPrivateProperty(
|
|
30871
|
-
if (
|
|
30872
|
-
|
|
31113
|
+
ClassPrivateProperty(path71) {
|
|
31114
|
+
if (path71.node.typeAnnotation) {
|
|
31115
|
+
path71.node.typeAnnotation = null;
|
|
30873
31116
|
state.transformed = true;
|
|
30874
31117
|
}
|
|
30875
|
-
if (stripOptionalFlag(
|
|
31118
|
+
if (stripOptionalFlag(path71.node)) {
|
|
30876
31119
|
state.transformed = true;
|
|
30877
31120
|
}
|
|
30878
31121
|
}
|
|
@@ -30889,7 +31132,7 @@ function createMacroVisitors(state) {
|
|
|
30889
31132
|
|
|
30890
31133
|
// src/plugins/vue/transform/transformScript/rewrite/index.ts
|
|
30891
31134
|
init_esm_shims();
|
|
30892
|
-
import * as
|
|
31135
|
+
import * as t24 from "@babel/types";
|
|
30893
31136
|
|
|
30894
31137
|
// src/plugins/vue/transform/transformScript/rewrite/classStyle.ts
|
|
30895
31138
|
init_esm_shims();
|
|
@@ -31394,6 +31637,53 @@ function rewriteComponentExport(params) {
|
|
|
31394
31637
|
return true;
|
|
31395
31638
|
}
|
|
31396
31639
|
|
|
31640
|
+
// src/plugins/vue/transform/transformScript/rewrite/templateRefs.ts
|
|
31641
|
+
init_esm_shims();
|
|
31642
|
+
import * as t23 from "@babel/types";
|
|
31643
|
+
function buildTemplateRefEntry(binding) {
|
|
31644
|
+
const props = [
|
|
31645
|
+
t23.objectProperty(t23.identifier("selector"), t23.stringLiteral(binding.selector)),
|
|
31646
|
+
t23.objectProperty(t23.identifier("inFor"), t23.booleanLiteral(binding.inFor))
|
|
31647
|
+
];
|
|
31648
|
+
if (binding.name) {
|
|
31649
|
+
props.push(t23.objectProperty(t23.identifier("name"), t23.stringLiteral(binding.name)));
|
|
31650
|
+
}
|
|
31651
|
+
if (binding.expAst) {
|
|
31652
|
+
const body = t23.blockStatement([t23.returnStatement(t23.cloneNode(binding.expAst, true))]);
|
|
31653
|
+
props.push(t23.objectProperty(t23.identifier("get"), t23.functionExpression(null, [], body)));
|
|
31654
|
+
}
|
|
31655
|
+
if (binding.kind) {
|
|
31656
|
+
props.push(t23.objectProperty(t23.identifier("kind"), t23.stringLiteral(binding.kind)));
|
|
31657
|
+
}
|
|
31658
|
+
return t23.objectExpression(props);
|
|
31659
|
+
}
|
|
31660
|
+
function injectTemplateRefs(optionsObject, bindings) {
|
|
31661
|
+
if (!bindings.length) {
|
|
31662
|
+
return false;
|
|
31663
|
+
}
|
|
31664
|
+
const entries = bindings.map((binding) => buildTemplateRefEntry(binding));
|
|
31665
|
+
const refsArray = t23.arrayExpression(entries);
|
|
31666
|
+
const key = createStaticObjectKey2("__wevuTemplateRefs");
|
|
31667
|
+
const existing = getObjectPropertyByKey2(optionsObject, "__wevuTemplateRefs");
|
|
31668
|
+
if (!existing) {
|
|
31669
|
+
optionsObject.properties.push(t23.objectProperty(key, refsArray));
|
|
31670
|
+
return true;
|
|
31671
|
+
}
|
|
31672
|
+
if (t23.isArrayExpression(existing.value)) {
|
|
31673
|
+
existing.value.elements.push(...entries);
|
|
31674
|
+
return true;
|
|
31675
|
+
}
|
|
31676
|
+
if (t23.isIdentifier(existing.value) || t23.isMemberExpression(existing.value)) {
|
|
31677
|
+
existing.value = t23.arrayExpression([
|
|
31678
|
+
...entries,
|
|
31679
|
+
t23.spreadElement(t23.cloneNode(existing.value, true))
|
|
31680
|
+
]);
|
|
31681
|
+
return true;
|
|
31682
|
+
}
|
|
31683
|
+
logger_default.warn("\u65E0\u6CD5\u81EA\u52A8\u6CE8\u5165 template ref \u5143\u6570\u636E\uFF0C\u8BF7\u624B\u52A8\u5408\u5E76 __wevuTemplateRefs\u3002");
|
|
31684
|
+
return false;
|
|
31685
|
+
}
|
|
31686
|
+
|
|
31397
31687
|
// src/plugins/vue/transform/transformScript/rewrite/index.ts
|
|
31398
31688
|
function rewriteDefaultExport(ast, state, options, enabledPageFeatures, serializedWevuDefaults, parsedWevuDefaults) {
|
|
31399
31689
|
if (!state.defaultExportPath) {
|
|
@@ -31406,10 +31696,10 @@ function rewriteDefaultExport(ast, state, options, enabledPageFeatures, serializ
|
|
|
31406
31696
|
state.defineComponentDecls,
|
|
31407
31697
|
state.defineComponentAliases
|
|
31408
31698
|
);
|
|
31409
|
-
if (componentExpr &&
|
|
31699
|
+
if (componentExpr && t24.isObjectExpression(componentExpr) && enabledPageFeatures.size) {
|
|
31410
31700
|
transformed = injectWevuPageFeatureFlagsIntoOptionsObject(componentExpr, enabledPageFeatures) || transformed;
|
|
31411
31701
|
}
|
|
31412
|
-
if (componentExpr &&
|
|
31702
|
+
if (componentExpr && t24.isObjectExpression(componentExpr) && parsedWevuDefaults) {
|
|
31413
31703
|
transformed = applyWevuDefaultsToComponentOptions({
|
|
31414
31704
|
componentExpr,
|
|
31415
31705
|
parsedWevuDefaults,
|
|
@@ -31418,13 +31708,21 @@ function rewriteDefaultExport(ast, state, options, enabledPageFeatures, serializ
|
|
|
31418
31708
|
}
|
|
31419
31709
|
const classStyleBindings = options?.classStyleRuntime === "js" ? options?.classStyleBindings ?? [] : [];
|
|
31420
31710
|
if (classStyleBindings.length) {
|
|
31421
|
-
if (componentExpr &&
|
|
31711
|
+
if (componentExpr && t24.isObjectExpression(componentExpr)) {
|
|
31422
31712
|
ensureClassStyleRuntimeImports(ast.program);
|
|
31423
31713
|
transformed = injectClassStyleComputed(componentExpr, classStyleBindings) || transformed;
|
|
31424
31714
|
} else {
|
|
31425
31715
|
logger_default.warn("\u65E0\u6CD5\u81EA\u52A8\u6CE8\u5165 class/style \u8BA1\u7B97\u5C5E\u6027\uFF1A\u7EC4\u4EF6\u9009\u9879\u4E0D\u662F\u5BF9\u8C61\u5B57\u9762\u91CF\u3002");
|
|
31426
31716
|
}
|
|
31427
31717
|
}
|
|
31718
|
+
const templateRefs = options?.templateRefs ?? [];
|
|
31719
|
+
if (templateRefs.length) {
|
|
31720
|
+
if (componentExpr && t24.isObjectExpression(componentExpr)) {
|
|
31721
|
+
transformed = injectTemplateRefs(componentExpr, templateRefs) || transformed;
|
|
31722
|
+
} else {
|
|
31723
|
+
logger_default.warn("\u65E0\u6CD5\u81EA\u52A8\u6CE8\u5165 template ref \u5143\u6570\u636E\uFF1A\u7EC4\u4EF6\u9009\u9879\u4E0D\u662F\u5BF9\u8C61\u5B57\u9762\u91CF\u3002");
|
|
31724
|
+
}
|
|
31725
|
+
}
|
|
31428
31726
|
if (componentExpr) {
|
|
31429
31727
|
if (options?.isApp) {
|
|
31430
31728
|
transformed = injectWevuDefaultsForApp({
|
|
@@ -31508,29 +31806,29 @@ async function compileScriptPhase(descriptor, descriptorForCompile, filename, op
|
|
|
31508
31806
|
const setupAst = parse(descriptorForCompile.scriptSetup.content, BABEL_TS_MODULE_PARSER_OPTIONS);
|
|
31509
31807
|
const pending = [];
|
|
31510
31808
|
traverse(setupAst, {
|
|
31511
|
-
ImportDeclaration(
|
|
31512
|
-
if (
|
|
31809
|
+
ImportDeclaration(path71) {
|
|
31810
|
+
if (path71.node.importKind === "type") {
|
|
31513
31811
|
return;
|
|
31514
31812
|
}
|
|
31515
|
-
if (!
|
|
31813
|
+
if (!t25.isStringLiteral(path71.node.source)) {
|
|
31516
31814
|
return;
|
|
31517
31815
|
}
|
|
31518
|
-
const importSource =
|
|
31519
|
-
for (const specifier of
|
|
31816
|
+
const importSource = path71.node.source.value;
|
|
31817
|
+
for (const specifier of path71.node.specifiers) {
|
|
31520
31818
|
if ("importKind" in specifier && specifier.importKind === "type") {
|
|
31521
31819
|
continue;
|
|
31522
31820
|
}
|
|
31523
|
-
if (!("local" in specifier) || !
|
|
31821
|
+
if (!("local" in specifier) || !t25.isIdentifier(specifier.local)) {
|
|
31524
31822
|
continue;
|
|
31525
31823
|
}
|
|
31526
31824
|
const localName = specifier.local.name;
|
|
31527
31825
|
if (!templateComponentNames.has(localName)) {
|
|
31528
31826
|
continue;
|
|
31529
31827
|
}
|
|
31530
|
-
if (
|
|
31828
|
+
if (t25.isImportDefaultSpecifier(specifier)) {
|
|
31531
31829
|
pending.push({ localName, importSource, importedName: "default", kind: "default" });
|
|
31532
|
-
} else if (
|
|
31533
|
-
const importedName =
|
|
31830
|
+
} else if (t25.isImportSpecifier(specifier)) {
|
|
31831
|
+
const importedName = t25.isIdentifier(specifier.imported) ? specifier.imported.name : t25.isStringLiteral(specifier.imported) ? specifier.imported.value : void 0;
|
|
31534
31832
|
pending.push({ localName, importSource, importedName, kind: "named" });
|
|
31535
31833
|
}
|
|
31536
31834
|
}
|
|
@@ -31581,7 +31879,8 @@ async function compileScriptPhase(descriptor, descriptorForCompile, filename, op
|
|
|
31581
31879
|
templateComponentMeta: Object.keys(autoComponentMeta).length ? autoComponentMeta : void 0,
|
|
31582
31880
|
wevuDefaults: options?.wevuDefaults,
|
|
31583
31881
|
classStyleRuntime: templateCompiled?.classStyleRuntime,
|
|
31584
|
-
classStyleBindings: templateCompiled?.classStyleBindings
|
|
31882
|
+
classStyleBindings: templateCompiled?.classStyleBindings,
|
|
31883
|
+
templateRefs: templateCompiled?.templateRefs
|
|
31585
31884
|
});
|
|
31586
31885
|
return { script: transformed.code, autoUsingComponentsMap, autoComponentMeta };
|
|
31587
31886
|
}
|
|
@@ -31636,7 +31935,7 @@ function transformScopedCss(source, id) {
|
|
|
31636
31935
|
function transformCssModules(source, id) {
|
|
31637
31936
|
const classes = {};
|
|
31638
31937
|
const hash = generateHash(id);
|
|
31639
|
-
const classRegex = /\.([a-z_][\w-]*)
|
|
31938
|
+
const classRegex = /\.([a-z_][\w-]*)(?:\[[^\]]+\])?\s*\{/gi;
|
|
31640
31939
|
const foundClasses = [];
|
|
31641
31940
|
let result = classRegex.exec(source);
|
|
31642
31941
|
while (result !== null) {
|
|
@@ -31722,7 +32021,7 @@ import {
|
|
|
31722
32021
|
|
|
31723
32022
|
// src/plugins/vue/compiler/template/classStyleRuntime.ts
|
|
31724
32023
|
init_esm_shims();
|
|
31725
|
-
import
|
|
32024
|
+
import path54 from "pathe";
|
|
31726
32025
|
var CLASS_STYLE_WXS_MODULE = "__weapp_vite";
|
|
31727
32026
|
var CLASS_STYLE_WXS_FILE = "__weapp_vite_class_style";
|
|
31728
32027
|
function buildClassStyleWxsTag(extension, src) {
|
|
@@ -31734,11 +32033,11 @@ function resolveClassStyleWxsLocation(options) {
|
|
|
31734
32033
|
const normalizedExt = options.extension.startsWith(".") ? options.extension.slice(1) : options.extension;
|
|
31735
32034
|
const normalizedRoot = normalizeRoot(options.packageRoot ?? "");
|
|
31736
32035
|
const fileName = normalizedRoot ? `${normalizedRoot}/${CLASS_STYLE_WXS_FILE}.${normalizedExt}` : `${CLASS_STYLE_WXS_FILE}.${normalizedExt}`;
|
|
31737
|
-
const baseDir =
|
|
32036
|
+
const baseDir = path54.posix.dirname(toPosixPath(options.relativeBase));
|
|
31738
32037
|
const fromDir = baseDir === "." ? "." : baseDir;
|
|
31739
|
-
let src =
|
|
32038
|
+
let src = path54.posix.relative(fromDir, fileName);
|
|
31740
32039
|
if (!src || src === ".") {
|
|
31741
|
-
src =
|
|
32040
|
+
src = path54.posix.basename(fileName);
|
|
31742
32041
|
}
|
|
31743
32042
|
if (!src.startsWith(".") && !src.startsWith("/")) {
|
|
31744
32043
|
src = `./${src}`;
|
|
@@ -32093,11 +32392,11 @@ init_esm_shims();
|
|
|
32093
32392
|
|
|
32094
32393
|
// src/plugins/vue/compiler/template/expression/bindings.ts
|
|
32095
32394
|
init_esm_shims();
|
|
32096
|
-
import * as
|
|
32395
|
+
import * as t29 from "@babel/types";
|
|
32097
32396
|
|
|
32098
32397
|
// src/plugins/vue/compiler/template/expression/parse.ts
|
|
32099
32398
|
init_esm_shims();
|
|
32100
|
-
import * as
|
|
32399
|
+
import * as t26 from "@babel/types";
|
|
32101
32400
|
var babelExpressionCache = new LRUCache({ max: 1024 });
|
|
32102
32401
|
var inlineHandlerCache = new LRUCache({ max: 1024 });
|
|
32103
32402
|
var BABEL_GENERATE_MINI_PROGRAM_OPTIONS = {
|
|
@@ -32163,17 +32462,17 @@ function parseInlineHandler(exp) {
|
|
|
32163
32462
|
return null;
|
|
32164
32463
|
}
|
|
32165
32464
|
const expression = stmt.expression;
|
|
32166
|
-
if (!
|
|
32465
|
+
if (!t26.isCallExpression(expression) || !t26.isIdentifier(expression.callee)) {
|
|
32167
32466
|
return null;
|
|
32168
32467
|
}
|
|
32169
32468
|
const name = expression.callee.name;
|
|
32170
32469
|
const args = [];
|
|
32171
32470
|
for (const arg of expression.arguments) {
|
|
32172
|
-
if (
|
|
32471
|
+
if (t26.isIdentifier(arg) && arg.name === "$event") {
|
|
32173
32472
|
args.push("$event");
|
|
32174
|
-
} else if (
|
|
32473
|
+
} else if (t26.isStringLiteral(arg) || t26.isNumericLiteral(arg) || t26.isBooleanLiteral(arg)) {
|
|
32175
32474
|
args.push(arg.value);
|
|
32176
|
-
} else if (
|
|
32475
|
+
} else if (t26.isNullLiteral(arg)) {
|
|
32177
32476
|
args.push(null);
|
|
32178
32477
|
} else {
|
|
32179
32478
|
inlineHandlerCache.set(exp, false);
|
|
@@ -32191,33 +32490,33 @@ function parseInlineHandler(exp) {
|
|
|
32191
32490
|
|
|
32192
32491
|
// src/plugins/vue/compiler/template/expression/scopedSlot.ts
|
|
32193
32492
|
init_esm_shims();
|
|
32194
|
-
import * as
|
|
32493
|
+
import * as t28 from "@babel/types";
|
|
32195
32494
|
|
|
32196
32495
|
// src/plugins/vue/compiler/template/expression/wxml.ts
|
|
32197
32496
|
init_esm_shims();
|
|
32198
|
-
import * as
|
|
32497
|
+
import * as t27 from "@babel/types";
|
|
32199
32498
|
function templateLiteralToConcat(node) {
|
|
32200
32499
|
const segments = [];
|
|
32201
32500
|
node.quasis.forEach((quasi, index) => {
|
|
32202
32501
|
const cooked = quasi.value.cooked ?? quasi.value.raw ?? "";
|
|
32203
32502
|
if (cooked) {
|
|
32204
|
-
segments.push(
|
|
32503
|
+
segments.push(t27.stringLiteral(cooked));
|
|
32205
32504
|
}
|
|
32206
32505
|
if (index < node.expressions.length) {
|
|
32207
32506
|
let inner = node.expressions[index];
|
|
32208
|
-
if (
|
|
32507
|
+
if (t27.isTemplateLiteral(inner)) {
|
|
32209
32508
|
inner = templateLiteralToConcat(inner);
|
|
32210
32509
|
}
|
|
32211
32510
|
segments.push(inner);
|
|
32212
32511
|
}
|
|
32213
32512
|
});
|
|
32214
32513
|
if (segments.length === 0) {
|
|
32215
|
-
return
|
|
32514
|
+
return t27.stringLiteral("");
|
|
32216
32515
|
}
|
|
32217
32516
|
if (segments.length === 1) {
|
|
32218
32517
|
return segments[0];
|
|
32219
32518
|
}
|
|
32220
|
-
return segments.reduce((acc, cur) =>
|
|
32519
|
+
return segments.reduce((acc, cur) => t27.binaryExpression("+", acc, cur));
|
|
32221
32520
|
}
|
|
32222
32521
|
function normalizeWxmlExpression(exp) {
|
|
32223
32522
|
if (!exp.includes("`") && !exp.includes("??")) {
|
|
@@ -32233,21 +32532,21 @@ function normalizeWxmlExpression(exp) {
|
|
|
32233
32532
|
return exp;
|
|
32234
32533
|
}
|
|
32235
32534
|
traverse(ast, {
|
|
32236
|
-
LogicalExpression(
|
|
32237
|
-
if (
|
|
32535
|
+
LogicalExpression(path71) {
|
|
32536
|
+
if (path71.node.operator !== "??") {
|
|
32238
32537
|
return;
|
|
32239
32538
|
}
|
|
32240
|
-
const left =
|
|
32241
|
-
const right =
|
|
32242
|
-
const test =
|
|
32243
|
-
|
|
32244
|
-
|
|
32539
|
+
const left = path71.node.left;
|
|
32540
|
+
const right = path71.node.right;
|
|
32541
|
+
const test = t27.binaryExpression("!=", t27.cloneNode(left), t27.nullLiteral());
|
|
32542
|
+
path71.replaceWith(t27.conditionalExpression(test, t27.cloneNode(left), t27.cloneNode(right)));
|
|
32543
|
+
path71.skip();
|
|
32245
32544
|
},
|
|
32246
|
-
TemplateLiteral(
|
|
32247
|
-
if (
|
|
32545
|
+
TemplateLiteral(path71) {
|
|
32546
|
+
if (t27.isTaggedTemplateExpression(path71.parent)) {
|
|
32248
32547
|
return;
|
|
32249
32548
|
}
|
|
32250
|
-
|
|
32549
|
+
path71.replaceWith(templateLiteralToConcat(path71.node));
|
|
32251
32550
|
}
|
|
32252
32551
|
});
|
|
32253
32552
|
const normalized = stmt.expression;
|
|
@@ -32324,19 +32623,19 @@ function rewriteScopedSlotExpression(exp, context) {
|
|
|
32324
32623
|
const slotProps = collectSlotPropMapping(context);
|
|
32325
32624
|
const createMemberAccess2 = (target, prop) => {
|
|
32326
32625
|
if (!prop) {
|
|
32327
|
-
return
|
|
32626
|
+
return t28.identifier(target);
|
|
32328
32627
|
}
|
|
32329
32628
|
if (/^[A-Z_$][\w$]*$/i.test(prop)) {
|
|
32330
|
-
return
|
|
32629
|
+
return t28.memberExpression(t28.identifier(target), t28.identifier(prop));
|
|
32331
32630
|
}
|
|
32332
|
-
return
|
|
32631
|
+
return t28.memberExpression(t28.identifier(target), t28.stringLiteral(prop), true);
|
|
32333
32632
|
};
|
|
32334
32633
|
traverse(ast, {
|
|
32335
|
-
Identifier(
|
|
32336
|
-
if (!
|
|
32634
|
+
Identifier(path71) {
|
|
32635
|
+
if (!path71.isReferencedIdentifier()) {
|
|
32337
32636
|
return;
|
|
32338
32637
|
}
|
|
32339
|
-
const name =
|
|
32638
|
+
const name = path71.node.name;
|
|
32340
32639
|
if (SCOPED_SLOT_GLOBALS.has(name)) {
|
|
32341
32640
|
return;
|
|
32342
32641
|
}
|
|
@@ -32345,23 +32644,23 @@ function rewriteScopedSlotExpression(exp, context) {
|
|
|
32345
32644
|
}
|
|
32346
32645
|
if (Object.prototype.hasOwnProperty.call(slotProps, name)) {
|
|
32347
32646
|
const member2 = createMemberAccess2("__wvSlotPropsData", slotProps[name]);
|
|
32348
|
-
const parent2 =
|
|
32349
|
-
if (parent2.isObjectProperty() && parent2.node.shorthand && parent2.node.key ===
|
|
32647
|
+
const parent2 = path71.parentPath;
|
|
32648
|
+
if (parent2.isObjectProperty() && parent2.node.shorthand && parent2.node.key === path71.node) {
|
|
32350
32649
|
parent2.node.shorthand = false;
|
|
32351
32650
|
parent2.node.value = member2;
|
|
32352
32651
|
return;
|
|
32353
32652
|
}
|
|
32354
|
-
|
|
32653
|
+
path71.replaceWith(member2);
|
|
32355
32654
|
return;
|
|
32356
32655
|
}
|
|
32357
32656
|
const member = createMemberAccess2("__wvOwner", name);
|
|
32358
|
-
const parent =
|
|
32359
|
-
if (parent.isObjectProperty() && parent.node.shorthand && parent.node.key ===
|
|
32657
|
+
const parent = path71.parentPath;
|
|
32658
|
+
if (parent.isObjectProperty() && parent.node.shorthand && parent.node.key === path71.node) {
|
|
32360
32659
|
parent.node.shorthand = false;
|
|
32361
32660
|
parent.node.value = member;
|
|
32362
32661
|
return;
|
|
32363
32662
|
}
|
|
32364
|
-
|
|
32663
|
+
path71.replaceWith(member);
|
|
32365
32664
|
}
|
|
32366
32665
|
});
|
|
32367
32666
|
const stmt = ast.program.body[0];
|
|
@@ -32389,45 +32688,45 @@ function normalizeClassBindingExpression(exp, context) {
|
|
|
32389
32688
|
if (!node) {
|
|
32390
32689
|
return;
|
|
32391
32690
|
}
|
|
32392
|
-
if (
|
|
32691
|
+
if (t29.isArrayExpression(node)) {
|
|
32393
32692
|
for (const el of node.elements) {
|
|
32394
32693
|
if (!el) {
|
|
32395
32694
|
continue;
|
|
32396
32695
|
}
|
|
32397
|
-
if (
|
|
32696
|
+
if (t29.isSpreadElement(el)) {
|
|
32398
32697
|
context.warnings.push("\u5C0F\u7A0B\u5E8F\u4E0D\u652F\u6301 :class \u7684\u5C55\u5F00\u8BED\u6CD5\uFF0C\u5DF2\u5FFD\u7565\u3002");
|
|
32399
32698
|
continue;
|
|
32400
32699
|
}
|
|
32401
|
-
if (
|
|
32700
|
+
if (t29.isExpression(el)) {
|
|
32402
32701
|
visit(el);
|
|
32403
32702
|
}
|
|
32404
32703
|
}
|
|
32405
32704
|
return;
|
|
32406
32705
|
}
|
|
32407
|
-
if (
|
|
32706
|
+
if (t29.isObjectExpression(node)) {
|
|
32408
32707
|
for (const prop of node.properties) {
|
|
32409
|
-
if (
|
|
32708
|
+
if (t29.isSpreadElement(prop)) {
|
|
32410
32709
|
context.warnings.push("\u5C0F\u7A0B\u5E8F\u4E0D\u652F\u6301 :class \u5BF9\u8C61\u7684\u5C55\u5F00\u8BED\u6CD5\uFF0C\u5DF2\u5FFD\u7565\u3002");
|
|
32411
32710
|
continue;
|
|
32412
32711
|
}
|
|
32413
|
-
if (!
|
|
32712
|
+
if (!t29.isObjectProperty(prop)) {
|
|
32414
32713
|
continue;
|
|
32415
32714
|
}
|
|
32416
32715
|
const value = prop.value;
|
|
32417
|
-
if (!
|
|
32716
|
+
if (!t29.isExpression(value)) {
|
|
32418
32717
|
continue;
|
|
32419
32718
|
}
|
|
32420
32719
|
const test = value;
|
|
32421
32720
|
if (prop.computed) {
|
|
32422
32721
|
const keyExpr = prop.key;
|
|
32423
|
-
if (!
|
|
32722
|
+
if (!t29.isExpression(keyExpr)) {
|
|
32424
32723
|
continue;
|
|
32425
32724
|
}
|
|
32426
|
-
pushExpr(
|
|
32427
|
-
} else if (
|
|
32428
|
-
pushExpr(
|
|
32429
|
-
} else if (
|
|
32430
|
-
pushExpr(
|
|
32725
|
+
pushExpr(t29.conditionalExpression(test, keyExpr, t29.stringLiteral("")));
|
|
32726
|
+
} else if (t29.isIdentifier(prop.key)) {
|
|
32727
|
+
pushExpr(t29.conditionalExpression(test, t29.stringLiteral(prop.key.name), t29.stringLiteral("")));
|
|
32728
|
+
} else if (t29.isStringLiteral(prop.key)) {
|
|
32729
|
+
pushExpr(t29.conditionalExpression(test, t29.stringLiteral(prop.key.value), t29.stringLiteral("")));
|
|
32431
32730
|
}
|
|
32432
32731
|
}
|
|
32433
32732
|
return;
|
|
@@ -32451,25 +32750,25 @@ function normalizeStyleBindingExpression(exp, context) {
|
|
|
32451
32750
|
};
|
|
32452
32751
|
const buildKeyExpression = (key, computed) => {
|
|
32453
32752
|
if (computed) {
|
|
32454
|
-
return
|
|
32753
|
+
return t29.isExpression(key) ? key : null;
|
|
32455
32754
|
}
|
|
32456
|
-
if (
|
|
32457
|
-
return
|
|
32755
|
+
if (t29.isIdentifier(key)) {
|
|
32756
|
+
return t29.stringLiteral(key.name);
|
|
32458
32757
|
}
|
|
32459
|
-
if (
|
|
32460
|
-
return
|
|
32758
|
+
if (t29.isStringLiteral(key)) {
|
|
32759
|
+
return t29.stringLiteral(key.value);
|
|
32461
32760
|
}
|
|
32462
|
-
if (
|
|
32463
|
-
return
|
|
32761
|
+
if (t29.isNumericLiteral(key)) {
|
|
32762
|
+
return t29.stringLiteral(String(key.value));
|
|
32464
32763
|
}
|
|
32465
|
-
if (
|
|
32466
|
-
return
|
|
32764
|
+
if (t29.isBooleanLiteral(key)) {
|
|
32765
|
+
return t29.stringLiteral(String(key.value));
|
|
32467
32766
|
}
|
|
32468
32767
|
return null;
|
|
32469
32768
|
};
|
|
32470
32769
|
const buildStylePair = (keyExpr, valueExpr) => {
|
|
32471
|
-
return
|
|
32472
|
-
|
|
32770
|
+
return t29.callExpression(
|
|
32771
|
+
t29.memberExpression(t29.identifier("__weapp_vite"), t29.identifier("stylePair")),
|
|
32473
32772
|
[keyExpr, valueExpr]
|
|
32474
32773
|
);
|
|
32475
32774
|
};
|
|
@@ -32477,32 +32776,32 @@ function normalizeStyleBindingExpression(exp, context) {
|
|
|
32477
32776
|
if (!node) {
|
|
32478
32777
|
return;
|
|
32479
32778
|
}
|
|
32480
|
-
if (
|
|
32779
|
+
if (t29.isArrayExpression(node)) {
|
|
32481
32780
|
for (const el of node.elements) {
|
|
32482
32781
|
if (!el) {
|
|
32483
32782
|
continue;
|
|
32484
32783
|
}
|
|
32485
|
-
if (
|
|
32784
|
+
if (t29.isSpreadElement(el)) {
|
|
32486
32785
|
context.warnings.push("\u5C0F\u7A0B\u5E8F\u4E0D\u652F\u6301 :style \u7684\u5C55\u5F00\u8BED\u6CD5\uFF0C\u5DF2\u5FFD\u7565\u3002");
|
|
32487
32786
|
continue;
|
|
32488
32787
|
}
|
|
32489
|
-
if (
|
|
32788
|
+
if (t29.isExpression(el)) {
|
|
32490
32789
|
visit(el);
|
|
32491
32790
|
}
|
|
32492
32791
|
}
|
|
32493
32792
|
return;
|
|
32494
32793
|
}
|
|
32495
|
-
if (
|
|
32794
|
+
if (t29.isObjectExpression(node)) {
|
|
32496
32795
|
for (const prop of node.properties) {
|
|
32497
|
-
if (
|
|
32796
|
+
if (t29.isSpreadElement(prop)) {
|
|
32498
32797
|
context.warnings.push("\u5C0F\u7A0B\u5E8F\u4E0D\u652F\u6301 :style \u5BF9\u8C61\u7684\u5C55\u5F00\u8BED\u6CD5\uFF0C\u5DF2\u5FFD\u7565\u3002");
|
|
32499
32798
|
continue;
|
|
32500
32799
|
}
|
|
32501
|
-
if (!
|
|
32800
|
+
if (!t29.isObjectProperty(prop)) {
|
|
32502
32801
|
continue;
|
|
32503
32802
|
}
|
|
32504
32803
|
const value = prop.value;
|
|
32505
|
-
if (!
|
|
32804
|
+
if (!t29.isExpression(value)) {
|
|
32506
32805
|
continue;
|
|
32507
32806
|
}
|
|
32508
32807
|
const keyExpr = buildKeyExpression(prop.key, prop.computed);
|
|
@@ -32524,7 +32823,7 @@ function normalizeStyleBindingExpression(exp, context) {
|
|
|
32524
32823
|
|
|
32525
32824
|
// src/plugins/vue/compiler/template/expression/js.ts
|
|
32526
32825
|
init_esm_shims();
|
|
32527
|
-
import * as
|
|
32826
|
+
import * as t30 from "@babel/types";
|
|
32528
32827
|
var JS_RUNTIME_GLOBALS = /* @__PURE__ */ new Set([
|
|
32529
32828
|
"Math",
|
|
32530
32829
|
"Number",
|
|
@@ -32579,13 +32878,13 @@ function createMemberAccess(target, prop) {
|
|
|
32579
32878
|
if (!prop) {
|
|
32580
32879
|
return target;
|
|
32581
32880
|
}
|
|
32582
|
-
if (
|
|
32583
|
-
return
|
|
32881
|
+
if (t30.isValidIdentifier(prop)) {
|
|
32882
|
+
return t30.memberExpression(target, t30.identifier(prop));
|
|
32584
32883
|
}
|
|
32585
|
-
return
|
|
32884
|
+
return t30.memberExpression(target, t30.stringLiteral(prop), true);
|
|
32586
32885
|
}
|
|
32587
32886
|
function createThisMemberAccess(prop) {
|
|
32588
|
-
return createMemberAccess(
|
|
32887
|
+
return createMemberAccess(t30.thisExpression(), prop);
|
|
32589
32888
|
}
|
|
32590
32889
|
function normalizeJsExpressionWithContext(exp, context, options) {
|
|
32591
32890
|
const trimmed = exp.trim();
|
|
@@ -32603,15 +32902,15 @@ function normalizeJsExpressionWithContext(exp, context, options) {
|
|
|
32603
32902
|
const locals = collectScopedSlotLocals(context);
|
|
32604
32903
|
const slotProps = context.rewriteScopedSlot ? collectSlotPropMapping(context) : {};
|
|
32605
32904
|
traverse(ast, {
|
|
32606
|
-
Identifier(
|
|
32607
|
-
if (!
|
|
32905
|
+
Identifier(path71) {
|
|
32906
|
+
if (!path71.isReferencedIdentifier()) {
|
|
32608
32907
|
return;
|
|
32609
32908
|
}
|
|
32610
|
-
const name =
|
|
32909
|
+
const name = path71.node.name;
|
|
32611
32910
|
if (JS_RUNTIME_GLOBALS.has(name)) {
|
|
32612
32911
|
return;
|
|
32613
32912
|
}
|
|
32614
|
-
if (
|
|
32913
|
+
if (path71.scope.hasBinding(name)) {
|
|
32615
32914
|
return;
|
|
32616
32915
|
}
|
|
32617
32916
|
if (locals.has(name)) {
|
|
@@ -32632,13 +32931,13 @@ function normalizeJsExpressionWithContext(exp, context, options) {
|
|
|
32632
32931
|
} else {
|
|
32633
32932
|
replacement = createThisMemberAccess(name);
|
|
32634
32933
|
}
|
|
32635
|
-
const parent =
|
|
32636
|
-
if (parent.isObjectProperty() && parent.node.shorthand && parent.node.key ===
|
|
32934
|
+
const parent = path71.parentPath;
|
|
32935
|
+
if (parent.isObjectProperty() && parent.node.shorthand && parent.node.key === path71.node) {
|
|
32637
32936
|
parent.node.shorthand = false;
|
|
32638
32937
|
parent.node.value = replacement;
|
|
32639
32938
|
return;
|
|
32640
32939
|
}
|
|
32641
|
-
|
|
32940
|
+
path71.replaceWith(replacement);
|
|
32642
32941
|
}
|
|
32643
32942
|
});
|
|
32644
32943
|
const stmt = ast.program.body[0];
|
|
@@ -32656,7 +32955,7 @@ import { NodeTypes as NodeTypes9 } from "@vue/compiler-core";
|
|
|
32656
32955
|
|
|
32657
32956
|
// src/plugins/vue/compiler/template/attributes.ts
|
|
32658
32957
|
init_esm_shims();
|
|
32659
|
-
import * as
|
|
32958
|
+
import * as t31 from "@babel/types";
|
|
32660
32959
|
import { NodeTypes as NodeTypes3 } from "@vue/compiler-core";
|
|
32661
32960
|
function toWxmlStringLiteral2(value) {
|
|
32662
32961
|
const escaped = value.replace(/\\/g, "\\\\").replace(/'/g, "\\'").replace(/\r/g, "\\r").replace(/\n/g, "\\n");
|
|
@@ -32677,12 +32976,12 @@ function generateExpressionCode(exp) {
|
|
|
32677
32976
|
}
|
|
32678
32977
|
function mergeJsExpressionParts(parts) {
|
|
32679
32978
|
if (!parts.length) {
|
|
32680
|
-
return
|
|
32979
|
+
return t31.stringLiteral("");
|
|
32681
32980
|
}
|
|
32682
32981
|
if (parts.length === 1) {
|
|
32683
32982
|
return parts[0];
|
|
32684
32983
|
}
|
|
32685
|
-
return
|
|
32984
|
+
return t31.arrayExpression(parts);
|
|
32686
32985
|
}
|
|
32687
32986
|
function createClassStyleBinding(context, type, exp, expAst) {
|
|
32688
32987
|
const index = context.classStyleBindings.length;
|
|
@@ -32715,7 +33014,7 @@ function renderClassAttribute(staticClass, dynamicClassExp, context) {
|
|
|
32715
33014
|
}
|
|
32716
33015
|
const jsParts = [];
|
|
32717
33016
|
if (staticValue) {
|
|
32718
|
-
jsParts.push(
|
|
33017
|
+
jsParts.push(t31.stringLiteral(staticValue));
|
|
32719
33018
|
}
|
|
32720
33019
|
const dynamicAst = normalizeJsExpressionWithContext(dynamicClassExp, context, { hint: "class \u7ED1\u5B9A" });
|
|
32721
33020
|
if (dynamicAst) {
|
|
@@ -32755,7 +33054,7 @@ function renderStyleAttribute(staticStyle, dynamicStyleExp, vShowExp, context) {
|
|
|
32755
33054
|
}
|
|
32756
33055
|
const jsParts = [];
|
|
32757
33056
|
if (staticValue) {
|
|
32758
|
-
jsParts.push(
|
|
33057
|
+
jsParts.push(t31.stringLiteral(staticValue));
|
|
32759
33058
|
}
|
|
32760
33059
|
if (dynamicStyleExp) {
|
|
32761
33060
|
const dynamicAst = normalizeJsExpressionWithContext(dynamicStyleExp, context, { hint: "style \u7ED1\u5B9A" });
|
|
@@ -32766,10 +33065,10 @@ function renderStyleAttribute(staticStyle, dynamicStyleExp, vShowExp, context) {
|
|
|
32766
33065
|
if (vShowExp) {
|
|
32767
33066
|
const showAst = normalizeJsExpressionWithContext(vShowExp, context, { hint: "v-show" });
|
|
32768
33067
|
if (showAst) {
|
|
32769
|
-
jsParts.push(
|
|
33068
|
+
jsParts.push(t31.conditionalExpression(
|
|
32770
33069
|
showAst,
|
|
32771
|
-
|
|
32772
|
-
|
|
33070
|
+
t31.stringLiteral(""),
|
|
33071
|
+
t31.stringLiteral("display: none")
|
|
32773
33072
|
));
|
|
32774
33073
|
}
|
|
32775
33074
|
}
|
|
@@ -33058,6 +33357,10 @@ function transformDirective(node, context, elementNode, forInfo) {
|
|
|
33058
33357
|
}
|
|
33059
33358
|
|
|
33060
33359
|
// src/plugins/vue/compiler/template/elements/attrs.ts
|
|
33360
|
+
var builtinTagSet = new Set(components.map((tag) => tag.toLowerCase()));
|
|
33361
|
+
function isBuiltinTag(tag) {
|
|
33362
|
+
return builtinTagSet.has(tag.toLowerCase());
|
|
33363
|
+
}
|
|
33061
33364
|
function collectElementAttributes(node, context, options) {
|
|
33062
33365
|
const { props } = node;
|
|
33063
33366
|
const attrs = options?.extraAttrs ? [...options.extraAttrs] : [];
|
|
@@ -33067,8 +33370,19 @@ function collectElementAttributes(node, context, options) {
|
|
|
33067
33370
|
let dynamicStyleExp;
|
|
33068
33371
|
let vShowExp;
|
|
33069
33372
|
let vTextExp;
|
|
33373
|
+
let templateRef;
|
|
33374
|
+
const inFor = Boolean(options?.forInfo || context.forStack.length);
|
|
33070
33375
|
for (const prop of props) {
|
|
33071
33376
|
if (prop.type === NodeTypes9.ATTRIBUTE) {
|
|
33377
|
+
if (prop.name === "ref") {
|
|
33378
|
+
if (prop.value?.type === NodeTypes9.TEXT) {
|
|
33379
|
+
const name = prop.value.content.trim();
|
|
33380
|
+
if (name) {
|
|
33381
|
+
templateRef = { name };
|
|
33382
|
+
}
|
|
33383
|
+
}
|
|
33384
|
+
continue;
|
|
33385
|
+
}
|
|
33072
33386
|
if (prop.name === "class" && prop.value?.type === NodeTypes9.TEXT) {
|
|
33073
33387
|
staticClass = prop.value.content;
|
|
33074
33388
|
continue;
|
|
@@ -33087,6 +33401,16 @@ function collectElementAttributes(node, context, options) {
|
|
|
33087
33401
|
if (options?.skipSlotDirective && prop.name === "slot") {
|
|
33088
33402
|
continue;
|
|
33089
33403
|
}
|
|
33404
|
+
if (prop.name === "bind" && prop.arg?.type === NodeTypes9.SIMPLE_EXPRESSION && prop.arg.content === "ref") {
|
|
33405
|
+
const rawExp = prop.exp?.type === NodeTypes9.SIMPLE_EXPRESSION ? prop.exp.content : "";
|
|
33406
|
+
if (rawExp) {
|
|
33407
|
+
const expAst = normalizeJsExpressionWithContext(rawExp, context, { hint: "ref \u7ED1\u5B9A" });
|
|
33408
|
+
if (expAst) {
|
|
33409
|
+
templateRef = { expAst };
|
|
33410
|
+
}
|
|
33411
|
+
}
|
|
33412
|
+
continue;
|
|
33413
|
+
}
|
|
33090
33414
|
if (prop.name === "bind" && prop.arg?.type === NodeTypes9.SIMPLE_EXPRESSION && prop.arg.content === "class" && prop.exp?.type === NodeTypes9.SIMPLE_EXPRESSION) {
|
|
33091
33415
|
dynamicClassExp = prop.exp.content;
|
|
33092
33416
|
continue;
|
|
@@ -33109,6 +33433,18 @@ function collectElementAttributes(node, context, options) {
|
|
|
33109
33433
|
}
|
|
33110
33434
|
}
|
|
33111
33435
|
}
|
|
33436
|
+
if (templateRef) {
|
|
33437
|
+
const className = `__wv-ref-${context.templateRefIndexSeed++}`;
|
|
33438
|
+
staticClass = staticClass ? `${staticClass} ${className}` : className;
|
|
33439
|
+
const isComponentRef = options?.isComponent ?? !isBuiltinTag(node.tag);
|
|
33440
|
+
context.templateRefs.push({
|
|
33441
|
+
selector: `.${className}`,
|
|
33442
|
+
inFor,
|
|
33443
|
+
name: templateRef.name,
|
|
33444
|
+
expAst: templateRef.expAst,
|
|
33445
|
+
kind: isComponentRef ? "component" : "element"
|
|
33446
|
+
});
|
|
33447
|
+
}
|
|
33112
33448
|
const classAttr = renderClassAttribute(staticClass, dynamicClassExp, context);
|
|
33113
33449
|
if (classAttr) {
|
|
33114
33450
|
attrs.unshift(classAttr);
|
|
@@ -33131,7 +33467,7 @@ import { NodeTypes as NodeTypes11 } from "@vue/compiler-core";
|
|
|
33131
33467
|
|
|
33132
33468
|
// src/plugins/vue/compiler/template/elements/tag-slot.ts
|
|
33133
33469
|
init_esm_shims();
|
|
33134
|
-
import * as
|
|
33470
|
+
import * as t32 from "@babel/types";
|
|
33135
33471
|
import { NodeTypes as NodeTypes10 } from "@vue/compiler-core";
|
|
33136
33472
|
function renderSlotNameAttribute(info, context, attrName) {
|
|
33137
33473
|
if (info.type === "static" && info.value !== "default") {
|
|
@@ -33205,38 +33541,38 @@ function parseSlotPropsExpression(exp, context) {
|
|
|
33205
33541
|
return {};
|
|
33206
33542
|
}
|
|
33207
33543
|
const expression = stmt.expression;
|
|
33208
|
-
if (!
|
|
33544
|
+
if (!t32.isArrowFunctionExpression(expression)) {
|
|
33209
33545
|
return {};
|
|
33210
33546
|
}
|
|
33211
33547
|
const param = expression.params[0];
|
|
33212
33548
|
if (!param) {
|
|
33213
33549
|
return {};
|
|
33214
33550
|
}
|
|
33215
|
-
if (
|
|
33551
|
+
if (t32.isIdentifier(param)) {
|
|
33216
33552
|
return { [param.name]: "" };
|
|
33217
33553
|
}
|
|
33218
|
-
if (
|
|
33554
|
+
if (t32.isObjectPattern(param)) {
|
|
33219
33555
|
const mapping = {};
|
|
33220
33556
|
for (const prop of param.properties) {
|
|
33221
|
-
if (
|
|
33557
|
+
if (t32.isRestElement(prop)) {
|
|
33222
33558
|
context.warnings.push("\u5C0F\u7A0B\u5E8F\u4E0D\u652F\u6301\u4F5C\u7528\u57DF\u63D2\u69FD\u7684\u5269\u4F59\u89E3\u6784\u5143\u7D20\u3002");
|
|
33223
33559
|
continue;
|
|
33224
33560
|
}
|
|
33225
|
-
if (!
|
|
33561
|
+
if (!t32.isObjectProperty(prop)) {
|
|
33226
33562
|
continue;
|
|
33227
33563
|
}
|
|
33228
33564
|
const key = prop.key;
|
|
33229
|
-
const propName =
|
|
33565
|
+
const propName = t32.isIdentifier(key) ? key.name : t32.isStringLiteral(key) ? key.value : void 0;
|
|
33230
33566
|
if (!propName) {
|
|
33231
33567
|
context.warnings.push("\u5C0F\u7A0B\u5E8F\u4E0D\u652F\u6301\u4F5C\u7528\u57DF\u63D2\u69FD\u7684\u8BA1\u7B97\u5C5E\u6027\u952E\u3002");
|
|
33232
33568
|
continue;
|
|
33233
33569
|
}
|
|
33234
33570
|
const value = prop.value;
|
|
33235
|
-
if (
|
|
33571
|
+
if (t32.isIdentifier(value)) {
|
|
33236
33572
|
mapping[value.name] = propName;
|
|
33237
33573
|
continue;
|
|
33238
33574
|
}
|
|
33239
|
-
if (
|
|
33575
|
+
if (t32.isAssignmentPattern(value) && t32.isIdentifier(value.left)) {
|
|
33240
33576
|
mapping[value.left.name] = propName;
|
|
33241
33577
|
context.warnings.push("\u4E0D\u652F\u6301\u4F5C\u7528\u57DF\u63D2\u69FD\u53C2\u6570\u7684\u9ED8\u8BA4\u503C\uFF0C\u9ED8\u8BA4\u503C\u5C06\u88AB\u5FFD\u7565\u3002");
|
|
33242
33578
|
continue;
|
|
@@ -33450,7 +33786,8 @@ function transformComponentWithSlots(node, context, transformNode2, options) {
|
|
|
33450
33786
|
if (!slotDeclarations.length) {
|
|
33451
33787
|
const { attrs: attrs2, vTextExp } = collectElementAttributes(node, context, {
|
|
33452
33788
|
skipSlotDirective: true,
|
|
33453
|
-
forInfo: options?.forInfo
|
|
33789
|
+
forInfo: options?.forInfo,
|
|
33790
|
+
isComponent: true
|
|
33454
33791
|
});
|
|
33455
33792
|
let children = node.children.map((child) => transformNode2(child, context)).join("");
|
|
33456
33793
|
if (vTextExp !== void 0) {
|
|
@@ -33470,7 +33807,8 @@ function transformComponentWithSlots(node, context, transformNode2, options) {
|
|
|
33470
33807
|
}
|
|
33471
33808
|
const { attrs } = collectElementAttributes(node, context, {
|
|
33472
33809
|
skipSlotDirective: true,
|
|
33473
|
-
forInfo: options?.forInfo
|
|
33810
|
+
forInfo: options?.forInfo,
|
|
33811
|
+
isComponent: true
|
|
33474
33812
|
});
|
|
33475
33813
|
const mergedAttrs = [...extraAttrs, ...attrs, ...slotGenericAttrs];
|
|
33476
33814
|
if (slotNames.length) {
|
|
@@ -33532,7 +33870,8 @@ function transformComponentWithSlotsFallback(node, context, transformNode2, opti
|
|
|
33532
33870
|
if (!slotDeclarations.length) {
|
|
33533
33871
|
const { attrs: attrs2, vTextExp } = collectElementAttributes(node, context, {
|
|
33534
33872
|
skipSlotDirective: true,
|
|
33535
|
-
forInfo: options?.forInfo
|
|
33873
|
+
forInfo: options?.forInfo,
|
|
33874
|
+
isComponent: true
|
|
33536
33875
|
});
|
|
33537
33876
|
let children = node.children.map((child) => transformNode2(child, context)).join("");
|
|
33538
33877
|
if (vTextExp !== void 0) {
|
|
@@ -33548,7 +33887,8 @@ function transformComponentWithSlotsFallback(node, context, transformNode2, opti
|
|
|
33548
33887
|
const renderedSlots = slotDeclarations.map((decl) => renderSlotFallback(decl, context, transformNode2)).join("");
|
|
33549
33888
|
const { attrs } = collectElementAttributes(node, context, {
|
|
33550
33889
|
skipSlotDirective: true,
|
|
33551
|
-
forInfo: options?.forInfo
|
|
33890
|
+
forInfo: options?.forInfo,
|
|
33891
|
+
isComponent: true
|
|
33552
33892
|
});
|
|
33553
33893
|
const mergedAttrs = [...extraAttrs, ...attrs];
|
|
33554
33894
|
const attrString = mergedAttrs.length ? ` ${mergedAttrs.join(" ")}` : "";
|
|
@@ -33924,7 +34264,9 @@ function compileVueTemplateToWxml(template, filename, options) {
|
|
|
33924
34264
|
classStyleWxsExtension: wxsExtension,
|
|
33925
34265
|
classStyleWxsSrc: options?.classStyleWxsSrc,
|
|
33926
34266
|
forStack: [],
|
|
33927
|
-
forIndexSeed: 0
|
|
34267
|
+
forIndexSeed: 0,
|
|
34268
|
+
templateRefs: [],
|
|
34269
|
+
templateRefIndexSeed: 0
|
|
33928
34270
|
};
|
|
33929
34271
|
let wxml = ast.children.map((child) => transformNode(child, context)).join("");
|
|
33930
34272
|
if (context.classStyleWxs) {
|
|
@@ -33950,6 +34292,9 @@ ${wxml}`;
|
|
|
33950
34292
|
result.classStyleBindings = context.classStyleBindings;
|
|
33951
34293
|
result.classStyleRuntime = context.classStyleRuntime;
|
|
33952
34294
|
}
|
|
34295
|
+
if (context.templateRefs.length) {
|
|
34296
|
+
result.templateRefs = context.templateRefs;
|
|
34297
|
+
}
|
|
33953
34298
|
return result;
|
|
33954
34299
|
} catch (error) {
|
|
33955
34300
|
warnings.push(`\u6A21\u677F\u7F16\u8BD1\u5931\u8D25\uFF1A${error}`);
|
|
@@ -34029,7 +34374,7 @@ async function compileVueFile(source, filename, options) {
|
|
|
34029
34374
|
// src/plugins/vue/transform/plugin/index.ts
|
|
34030
34375
|
init_esm_shims();
|
|
34031
34376
|
import fs28 from "fs-extra";
|
|
34032
|
-
import
|
|
34377
|
+
import path58 from "pathe";
|
|
34033
34378
|
|
|
34034
34379
|
// src/plugins/vue/transform/vitePlugin/injectPageFeatures.ts
|
|
34035
34380
|
init_esm_shims();
|
|
@@ -34152,18 +34497,18 @@ function emitClassStyleWxsAssetIfMissing(ctx, bundle, fileName, source) {
|
|
|
34152
34497
|
// src/plugins/vue/transform/vitePlugin/fallbackEntries.ts
|
|
34153
34498
|
init_esm_shims();
|
|
34154
34499
|
import fs25 from "fs-extra";
|
|
34155
|
-
import
|
|
34500
|
+
import path56 from "pathe";
|
|
34156
34501
|
|
|
34157
34502
|
// src/plugins/vue/transform/vitePlugin/collectVuePages.ts
|
|
34158
34503
|
init_esm_shims();
|
|
34159
34504
|
import fs24 from "fs-extra";
|
|
34160
|
-
import
|
|
34505
|
+
import path55 from "pathe";
|
|
34161
34506
|
async function collectVuePages(root) {
|
|
34162
34507
|
const results = [];
|
|
34163
34508
|
try {
|
|
34164
34509
|
const entries = await fs24.readdir(root);
|
|
34165
34510
|
for (const entry of entries) {
|
|
34166
|
-
const full =
|
|
34511
|
+
const full = path55.join(root, entry);
|
|
34167
34512
|
const stat5 = await fs24.stat(full);
|
|
34168
34513
|
if (stat5.isDirectory()) {
|
|
34169
34514
|
const nested = await collectVuePages(full);
|
|
@@ -34183,7 +34528,7 @@ async function collectFallbackPageEntryIds(configService, scanService) {
|
|
|
34183
34528
|
if (scanService?.appEntry?.json?.pages?.length) {
|
|
34184
34529
|
pageList = scanService.appEntry.json.pages;
|
|
34185
34530
|
} else {
|
|
34186
|
-
const appJsonPath =
|
|
34531
|
+
const appJsonPath = path56.join(configService.cwd, "dist", "app.json");
|
|
34187
34532
|
try {
|
|
34188
34533
|
const appJsonContent = await fs25.readFile(appJsonPath, "utf-8");
|
|
34189
34534
|
const appJson = JSON.parse(appJsonContent);
|
|
@@ -34192,15 +34537,15 @@ async function collectFallbackPageEntryIds(configService, scanService) {
|
|
|
34192
34537
|
}
|
|
34193
34538
|
}
|
|
34194
34539
|
const collectedEntries = /* @__PURE__ */ new Set();
|
|
34195
|
-
pageList.forEach((p) => collectedEntries.add(
|
|
34196
|
-
const extraVueFiles = await collectVuePages(
|
|
34540
|
+
pageList.forEach((p) => collectedEntries.add(path56.join(configService.absoluteSrcRoot, p)));
|
|
34541
|
+
const extraVueFiles = await collectVuePages(path56.join(configService.absoluteSrcRoot, "pages"));
|
|
34197
34542
|
extraVueFiles.forEach((f) => collectedEntries.add(f.slice(0, -4)));
|
|
34198
34543
|
return collectedEntries;
|
|
34199
34544
|
}
|
|
34200
34545
|
|
|
34201
34546
|
// src/plugins/vue/transform/plugin/classStyle.ts
|
|
34202
34547
|
init_esm_shims();
|
|
34203
|
-
import
|
|
34548
|
+
import path57 from "pathe";
|
|
34204
34549
|
function resolveClassStylePackageRoot(ctx, relativeBase, configService) {
|
|
34205
34550
|
const currentRoot = normalizeRoot(configService.currentSubPackageRoot ?? "");
|
|
34206
34551
|
if (currentRoot) {
|
|
@@ -34225,7 +34570,7 @@ function resolveClassStylePackageRoot(ctx, relativeBase, configService) {
|
|
|
34225
34570
|
function resolveClassStyleWxsLocationForBase(ctx, relativeBase, extension, configService) {
|
|
34226
34571
|
const classStyleWxsShared = configService.weappViteConfig?.vue?.template?.classStyleWxsShared ?? true;
|
|
34227
34572
|
const packageRoot = classStyleWxsShared ? resolveClassStylePackageRoot(ctx, relativeBase, configService) : (() => {
|
|
34228
|
-
const dir =
|
|
34573
|
+
const dir = path57.posix.dirname(toPosixPath(relativeBase));
|
|
34229
34574
|
return dir === "." ? "" : dir;
|
|
34230
34575
|
})();
|
|
34231
34576
|
return resolveClassStyleWxsLocation({ relativeBase, extension, packageRoot });
|
|
@@ -34337,6 +34682,16 @@ function createCompileVueFileOptions(ctx, pluginCtx, vuePath, isPage, isApp, con
|
|
|
34337
34682
|
defaults: jsonConfig?.defaults,
|
|
34338
34683
|
mergeStrategy: jsonConfig?.mergeStrategy
|
|
34339
34684
|
},
|
|
34685
|
+
sfcSrc: {
|
|
34686
|
+
resolveId: async (source, importer) => {
|
|
34687
|
+
if (typeof pluginCtx.resolve !== "function") {
|
|
34688
|
+
return void 0;
|
|
34689
|
+
}
|
|
34690
|
+
const resolved = await pluginCtx.resolve(source, importer);
|
|
34691
|
+
return resolved?.id;
|
|
34692
|
+
},
|
|
34693
|
+
checkMtime: getSfcCheckMtime(configService)
|
|
34694
|
+
},
|
|
34340
34695
|
wevuDefaults
|
|
34341
34696
|
};
|
|
34342
34697
|
}
|
|
@@ -34686,6 +35041,13 @@ function createVueTransformPlugin(ctx) {
|
|
|
34686
35041
|
const scopedSlotModules = /* @__PURE__ */ new Map();
|
|
34687
35042
|
const emittedScopedSlotChunks = /* @__PURE__ */ new Set();
|
|
34688
35043
|
const classStyleRuntimeWarned = { value: false };
|
|
35044
|
+
const resolveSfcSrc = async (pluginCtx, source, importer) => {
|
|
35045
|
+
if (typeof pluginCtx.resolve !== "function") {
|
|
35046
|
+
return void 0;
|
|
35047
|
+
}
|
|
35048
|
+
const resolved = await pluginCtx.resolve(source, importer);
|
|
35049
|
+
return resolved?.id;
|
|
35050
|
+
};
|
|
34689
35051
|
return {
|
|
34690
35052
|
name: `${VUE_PLUGIN_NAME}:transform`,
|
|
34691
35053
|
buildStart() {
|
|
@@ -34708,7 +35070,13 @@ function createVueTransformPlugin(ctx) {
|
|
|
34708
35070
|
let styles = styleBlocksCache.get(filename);
|
|
34709
35071
|
if (!styles) {
|
|
34710
35072
|
try {
|
|
34711
|
-
const parsedSfc = await readAndParseSfc(filename, {
|
|
35073
|
+
const parsedSfc = await readAndParseSfc(filename, {
|
|
35074
|
+
checkMtime: getSfcCheckMtime(ctx.configService),
|
|
35075
|
+
resolveSrc: {
|
|
35076
|
+
resolveId: (src, importer) => resolveSfcSrc(this, src, importer),
|
|
35077
|
+
checkMtime: getSfcCheckMtime(ctx.configService)
|
|
35078
|
+
}
|
|
35079
|
+
});
|
|
34712
35080
|
styles = parsedSfc.descriptor.styles;
|
|
34713
35081
|
styleBlocksCache.set(filename, styles);
|
|
34714
35082
|
} catch {
|
|
@@ -34734,7 +35102,7 @@ function createVueTransformPlugin(ctx) {
|
|
|
34734
35102
|
}
|
|
34735
35103
|
const sourceId = getSourceFromVirtualId(id);
|
|
34736
35104
|
const filename = toAbsoluteId(sourceId, configService, void 0, { base: "cwd" });
|
|
34737
|
-
if (!filename || !
|
|
35105
|
+
if (!filename || !path58.isAbsolute(filename)) {
|
|
34738
35106
|
return null;
|
|
34739
35107
|
}
|
|
34740
35108
|
if (typeof this.addWatchFile === "function") {
|
|
@@ -34744,7 +35112,14 @@ function createVueTransformPlugin(ctx) {
|
|
|
34744
35112
|
try {
|
|
34745
35113
|
const source = typeof code === "string" ? code : configService.isDev ? await readFile2(filename, { checkMtime: true, encoding: "utf8" }) : await fs28.readFile(filename, "utf-8");
|
|
34746
35114
|
try {
|
|
34747
|
-
const parsedSfc = await readAndParseSfc(filename, {
|
|
35115
|
+
const parsedSfc = await readAndParseSfc(filename, {
|
|
35116
|
+
source,
|
|
35117
|
+
checkMtime: false,
|
|
35118
|
+
resolveSrc: {
|
|
35119
|
+
resolveId: (src, importer) => resolveSfcSrc(this, src, importer),
|
|
35120
|
+
checkMtime: getSfcCheckMtime(ctx.configService)
|
|
35121
|
+
}
|
|
35122
|
+
});
|
|
34748
35123
|
styleBlocksCache.set(filename, parsedSfc.descriptor.styles);
|
|
34749
35124
|
} catch {
|
|
34750
35125
|
}
|
|
@@ -34761,6 +35136,12 @@ function createVueTransformPlugin(ctx) {
|
|
|
34761
35136
|
classStyleRuntimeWarned
|
|
34762
35137
|
})
|
|
34763
35138
|
);
|
|
35139
|
+
if (Array.isArray(result.meta?.sfcSrcDeps) && typeof this.addWatchFile === "function") {
|
|
35140
|
+
for (const dep of result.meta.sfcSrcDeps) {
|
|
35141
|
+
;
|
|
35142
|
+
this.addWatchFile(dep);
|
|
35143
|
+
}
|
|
35144
|
+
}
|
|
34764
35145
|
if (isPage && result.script) {
|
|
34765
35146
|
const injected = await injectWevuPageFeaturesInJsWithViteResolver(this, result.script, filename, {
|
|
34766
35147
|
checkMtime: configService.isDev
|
|
@@ -34904,12 +35285,12 @@ init_esm_shims();
|
|
|
34904
35285
|
import { createHash as createHash4 } from "crypto";
|
|
34905
35286
|
import { removeExtension as removeExtension2 } from "@weapp-core/shared";
|
|
34906
35287
|
import fs29 from "fs-extra";
|
|
34907
|
-
import
|
|
35288
|
+
import path59 from "pathe";
|
|
34908
35289
|
async function resolveWorkerEntry(ctx, entry) {
|
|
34909
35290
|
const { configService, scanService } = ctx;
|
|
34910
|
-
const relativeEntryPath =
|
|
35291
|
+
const relativeEntryPath = path59.join(scanService.workersDir, entry);
|
|
34911
35292
|
const key = removeExtension2(relativeEntryPath);
|
|
34912
|
-
const absoluteEntry =
|
|
35293
|
+
const absoluteEntry = path59.resolve(configService.absoluteSrcRoot, relativeEntryPath);
|
|
34913
35294
|
if (isJsOrTs(entry)) {
|
|
34914
35295
|
const exists = await fs29.pathExists(absoluteEntry);
|
|
34915
35296
|
if (!exists) {
|
|
@@ -34946,12 +35327,12 @@ function createWorkerBuildPlugin(ctx) {
|
|
|
34946
35327
|
options.chunkFileNames = (chunkInfo) => {
|
|
34947
35328
|
const workersDir = scanService.workersDir ?? "";
|
|
34948
35329
|
if (chunkInfo.isDynamicEntry) {
|
|
34949
|
-
return
|
|
35330
|
+
return path59.join(workersDir, "[name].js");
|
|
34950
35331
|
}
|
|
34951
35332
|
const sourceId = chunkInfo.facadeModuleId ?? chunkInfo.moduleIds[0];
|
|
34952
35333
|
const hashBase = typeof sourceId === "string" ? configService.relativeCwd(sourceId) : chunkInfo.name;
|
|
34953
35334
|
const stableHash = createHash4("sha256").update(hashBase).digest("base64url").slice(0, 8);
|
|
34954
|
-
return
|
|
35335
|
+
return path59.join(workersDir, `${chunkInfo.name}-${stableHash}.js`);
|
|
34955
35336
|
};
|
|
34956
35337
|
}
|
|
34957
35338
|
};
|
|
@@ -34967,7 +35348,7 @@ function workers(ctx) {
|
|
|
34967
35348
|
init_esm_shims();
|
|
34968
35349
|
import { removeExtension as removeExtension3 } from "@weapp-core/shared";
|
|
34969
35350
|
import fs30 from "fs-extra";
|
|
34970
|
-
import
|
|
35351
|
+
import path60 from "pathe";
|
|
34971
35352
|
var wxsCodeCache = new LRUCache({
|
|
34972
35353
|
max: 512
|
|
34973
35354
|
});
|
|
@@ -34992,13 +35373,13 @@ async function transformWxsFile(state, wxsPath) {
|
|
|
34992
35373
|
if (typeof result?.code === "string") {
|
|
34993
35374
|
code = result.code;
|
|
34994
35375
|
}
|
|
34995
|
-
const dirname5 =
|
|
35376
|
+
const dirname5 = path60.dirname(wxsPath);
|
|
34996
35377
|
await Promise.all(
|
|
34997
35378
|
importees.map(({ source }) => {
|
|
34998
35379
|
return transformWxsFile.call(
|
|
34999
35380
|
this,
|
|
35000
35381
|
state,
|
|
35001
|
-
|
|
35382
|
+
path60.resolve(dirname5, source)
|
|
35002
35383
|
);
|
|
35003
35384
|
})
|
|
35004
35385
|
);
|
|
@@ -35024,7 +35405,7 @@ async function handleWxsDeps(state, deps, absPath) {
|
|
|
35024
35405
|
if (!jsExtensions.includes(dep.attrs.lang) && !arr) {
|
|
35025
35406
|
return;
|
|
35026
35407
|
}
|
|
35027
|
-
const wxsPath =
|
|
35408
|
+
const wxsPath = path60.resolve(path60.dirname(absPath), dep.value);
|
|
35028
35409
|
await transformWxsFile.call(this, state, wxsPath);
|
|
35029
35410
|
})
|
|
35030
35411
|
);
|
|
@@ -35193,17 +35574,17 @@ function mergeMiniprogram(options, ...configs) {
|
|
|
35193
35574
|
};
|
|
35194
35575
|
if (isDev) {
|
|
35195
35576
|
const watchInclude = [
|
|
35196
|
-
|
|
35577
|
+
path61.join(cwd, srcRoot, "**")
|
|
35197
35578
|
];
|
|
35198
35579
|
const pluginRootConfig = config.weapp?.pluginRoot;
|
|
35199
35580
|
if (pluginRootConfig) {
|
|
35200
|
-
const absolutePluginRoot =
|
|
35201
|
-
const relativeToSrc =
|
|
35202
|
-
|
|
35581
|
+
const absolutePluginRoot = path61.resolve(cwd, pluginRootConfig);
|
|
35582
|
+
const relativeToSrc = path61.relative(
|
|
35583
|
+
path61.resolve(cwd, srcRoot),
|
|
35203
35584
|
absolutePluginRoot
|
|
35204
35585
|
);
|
|
35205
|
-
const pluginPatternBase = relativeToSrc.startsWith("..") ? absolutePluginRoot :
|
|
35206
|
-
watchInclude.push(
|
|
35586
|
+
const pluginPatternBase = relativeToSrc.startsWith("..") ? absolutePluginRoot : path61.join(cwd, srcRoot, relativeToSrc);
|
|
35587
|
+
watchInclude.push(path61.join(pluginPatternBase, "**"));
|
|
35207
35588
|
}
|
|
35208
35589
|
const inline = defu4(
|
|
35209
35590
|
config,
|
|
@@ -35216,7 +35597,7 @@ function mergeMiniprogram(options, ...configs) {
|
|
|
35216
35597
|
watch: {
|
|
35217
35598
|
exclude: [
|
|
35218
35599
|
...defaultExcluded,
|
|
35219
|
-
mpDistRoot ?
|
|
35600
|
+
mpDistRoot ? path61.join(cwd, mpDistRoot, "**") : path61.join(cwd, "dist", "**")
|
|
35220
35601
|
],
|
|
35221
35602
|
include: watchInclude
|
|
35222
35603
|
},
|
|
@@ -35468,14 +35849,14 @@ function createConfigService(ctx) {
|
|
|
35468
35849
|
if (!pluginRootConfig) {
|
|
35469
35850
|
return void 0;
|
|
35470
35851
|
}
|
|
35471
|
-
return
|
|
35852
|
+
return path62.resolve(options.cwd, pluginRootConfig);
|
|
35472
35853
|
};
|
|
35473
35854
|
const resolvePluginSourceBase = () => {
|
|
35474
35855
|
const absolutePluginRoot = resolveAbsolutePluginRoot();
|
|
35475
35856
|
if (!absolutePluginRoot) {
|
|
35476
35857
|
return void 0;
|
|
35477
35858
|
}
|
|
35478
|
-
return toPosixPath(
|
|
35859
|
+
return toPosixPath(path62.basename(absolutePluginRoot));
|
|
35479
35860
|
};
|
|
35480
35861
|
const resolveAbsolutePluginOutputRoot = () => {
|
|
35481
35862
|
const absolutePluginRoot = resolveAbsolutePluginRoot();
|
|
@@ -35484,19 +35865,19 @@ function createConfigService(ctx) {
|
|
|
35484
35865
|
}
|
|
35485
35866
|
const configured = options.projectConfig?.pluginRoot;
|
|
35486
35867
|
if (configured) {
|
|
35487
|
-
return
|
|
35868
|
+
return path62.resolve(options.cwd, configured);
|
|
35488
35869
|
}
|
|
35489
|
-
const outDir =
|
|
35490
|
-
const pluginBase =
|
|
35491
|
-
return
|
|
35870
|
+
const outDir = path62.resolve(options.cwd, options.mpDistRoot ?? "");
|
|
35871
|
+
const pluginBase = path62.basename(absolutePluginRoot);
|
|
35872
|
+
return path62.resolve(outDir, pluginBase);
|
|
35492
35873
|
};
|
|
35493
35874
|
const resolvePluginOutputBasePosix = () => {
|
|
35494
35875
|
const absoluteOutputRoot = resolveAbsolutePluginOutputRoot();
|
|
35495
35876
|
if (!absoluteOutputRoot) {
|
|
35496
35877
|
return void 0;
|
|
35497
35878
|
}
|
|
35498
|
-
const outDir =
|
|
35499
|
-
const relative3 =
|
|
35879
|
+
const outDir = path62.resolve(options.cwd, options.mpDistRoot ?? "");
|
|
35880
|
+
const relative3 = path62.relative(outDir, absoluteOutputRoot);
|
|
35500
35881
|
const normalized = toPosixPath(relative3);
|
|
35501
35882
|
if (!normalized || normalized === ".") {
|
|
35502
35883
|
return resolvePluginSourceBase();
|
|
@@ -35632,7 +36013,7 @@ function createConfigService(ctx) {
|
|
|
35632
36013
|
return options.mpDistRoot;
|
|
35633
36014
|
},
|
|
35634
36015
|
get outDir() {
|
|
35635
|
-
return
|
|
36016
|
+
return path62.resolve(options.cwd, options.mpDistRoot ?? "");
|
|
35636
36017
|
},
|
|
35637
36018
|
get currentSubPackageRoot() {
|
|
35638
36019
|
return options.currentSubPackageRoot;
|
|
@@ -35662,7 +36043,7 @@ function createConfigService(ctx) {
|
|
|
35662
36043
|
return resolveAbsolutePluginOutputRoot();
|
|
35663
36044
|
},
|
|
35664
36045
|
get absoluteSrcRoot() {
|
|
35665
|
-
return
|
|
36046
|
+
return path62.resolve(options.cwd, options.srcRoot);
|
|
35666
36047
|
},
|
|
35667
36048
|
get mode() {
|
|
35668
36049
|
return options.mode;
|
|
@@ -35680,26 +36061,26 @@ function createConfigService(ctx) {
|
|
|
35680
36061
|
return options.weappWeb;
|
|
35681
36062
|
},
|
|
35682
36063
|
relativeCwd(p) {
|
|
35683
|
-
return
|
|
36064
|
+
return path62.relative(options.cwd, p);
|
|
35684
36065
|
},
|
|
35685
36066
|
relativeSrcRoot(p) {
|
|
35686
36067
|
return options.relativeSrcRoot(p);
|
|
35687
36068
|
},
|
|
35688
36069
|
relativeAbsoluteSrcRoot(p) {
|
|
35689
|
-
const absoluteSrcRoot =
|
|
36070
|
+
const absoluteSrcRoot = path62.resolve(options.cwd, options.srcRoot);
|
|
35690
36071
|
const absolutePluginRoot = resolveAbsolutePluginRoot();
|
|
35691
36072
|
if (absolutePluginRoot) {
|
|
35692
|
-
const relativeToPlugin =
|
|
36073
|
+
const relativeToPlugin = path62.relative(absolutePluginRoot, p);
|
|
35693
36074
|
if (!relativeToPlugin.startsWith("..")) {
|
|
35694
|
-
const pluginBase =
|
|
35695
|
-
return relativeToPlugin ?
|
|
36075
|
+
const pluginBase = path62.basename(absolutePluginRoot);
|
|
36076
|
+
return relativeToPlugin ? path62.join(pluginBase, relativeToPlugin) : pluginBase;
|
|
35696
36077
|
}
|
|
35697
36078
|
}
|
|
35698
|
-
const relativeFromSrc =
|
|
36079
|
+
const relativeFromSrc = path62.relative(absoluteSrcRoot, p);
|
|
35699
36080
|
if (!relativeFromSrc.startsWith("..")) {
|
|
35700
36081
|
return relativeFromSrc;
|
|
35701
36082
|
}
|
|
35702
|
-
const relativeFromCwd =
|
|
36083
|
+
const relativeFromCwd = path62.relative(options.cwd, p);
|
|
35703
36084
|
return relativeFromCwd;
|
|
35704
36085
|
},
|
|
35705
36086
|
relativeOutputPath(p) {
|
|
@@ -35825,7 +36206,7 @@ init_esm_shims();
|
|
|
35825
36206
|
// src/runtime/npmPlugin/service.ts
|
|
35826
36207
|
init_esm_shims();
|
|
35827
36208
|
import fs34 from "fs-extra";
|
|
35828
|
-
import
|
|
36209
|
+
import path65 from "pathe";
|
|
35829
36210
|
|
|
35830
36211
|
// src/runtime/npmPlugin/builder.ts
|
|
35831
36212
|
init_esm_shims();
|
|
@@ -35833,7 +36214,7 @@ import { isBuiltin } from "module";
|
|
|
35833
36214
|
import process9 from "process";
|
|
35834
36215
|
import { defu as defu8, isObject as isObject7 } from "@weapp-core/shared";
|
|
35835
36216
|
import fs32 from "fs-extra";
|
|
35836
|
-
import
|
|
36217
|
+
import path63 from "pathe";
|
|
35837
36218
|
import { build as viteBuild } from "vite";
|
|
35838
36219
|
function createPackageBuilder(ctx, oxcVitePlugin) {
|
|
35839
36220
|
function isMiniprogramPackage(pkg) {
|
|
@@ -35924,14 +36305,14 @@ function createPackageBuilder(ctx, oxcVitePlugin) {
|
|
|
35924
36305
|
const { packageJson: targetJson, rootPath } = packageInfo;
|
|
35925
36306
|
const dependencies = targetJson.dependencies ?? {};
|
|
35926
36307
|
const keys = Object.keys(dependencies);
|
|
35927
|
-
const destOutDir =
|
|
36308
|
+
const destOutDir = path63.resolve(outDir, dep);
|
|
35928
36309
|
if (isMiniprogramPackage(targetJson)) {
|
|
35929
36310
|
if (await shouldSkipBuild(destOutDir, isDependenciesCacheOutdate)) {
|
|
35930
36311
|
logger_default.info(`[npm] \u4F9D\u8D56 \`${dep}\` \u672A\u53D1\u751F\u53D8\u5316\uFF0C\u8DF3\u8FC7\u5904\u7406!`);
|
|
35931
36312
|
return;
|
|
35932
36313
|
}
|
|
35933
36314
|
await copyBuild({
|
|
35934
|
-
from:
|
|
36315
|
+
from: path63.resolve(
|
|
35935
36316
|
rootPath,
|
|
35936
36317
|
targetJson.miniprogram
|
|
35937
36318
|
),
|
|
@@ -35957,7 +36338,7 @@ function createPackageBuilder(ctx, oxcVitePlugin) {
|
|
|
35957
36338
|
return;
|
|
35958
36339
|
}
|
|
35959
36340
|
if (!isDependenciesCacheOutdate && await fs32.pathExists(destOutDir)) {
|
|
35960
|
-
const destEntry =
|
|
36341
|
+
const destEntry = path63.resolve(destOutDir, "index.js");
|
|
35961
36342
|
if (await fs32.pathExists(destEntry)) {
|
|
35962
36343
|
const [srcStat, destStat] = await Promise.all([fs32.stat(index), fs32.stat(destEntry)]);
|
|
35963
36344
|
if (srcStat.mtimeMs <= destStat.mtimeMs) {
|
|
@@ -36002,11 +36383,11 @@ function createPackageBuilder(ctx, oxcVitePlugin) {
|
|
|
36002
36383
|
init_esm_shims();
|
|
36003
36384
|
import { isObject as isObject8, objectHash } from "@weapp-core/shared";
|
|
36004
36385
|
import fs33 from "fs-extra";
|
|
36005
|
-
import
|
|
36386
|
+
import path64 from "pathe";
|
|
36006
36387
|
function createDependenciesCache(ctx) {
|
|
36007
36388
|
function getDependenciesCacheFilePath(key = "/") {
|
|
36008
36389
|
const configService = requireConfigService(ctx, "\u751F\u6210 npm \u7F13\u5B58\u8DEF\u5F84\u524D\u5FC5\u987B\u521D\u59CB\u5316 configService\u3002");
|
|
36009
|
-
return
|
|
36390
|
+
return path64.resolve(configService.cwd, `node_modules/weapp-vite/.cache/${key.replaceAll("/", "-")}.json`);
|
|
36010
36391
|
}
|
|
36011
36392
|
function dependenciesCacheHash() {
|
|
36012
36393
|
const configService = requireConfigService(ctx, "\u8BFB\u53D6\u4F9D\u8D56\u7F13\u5B58\u54C8\u5E0C\u524D\u5FC5\u987B\u521D\u59CB\u5316 configService\u3002");
|
|
@@ -36076,10 +36457,10 @@ function createNpmService(ctx) {
|
|
|
36076
36457
|
debug?.("buildNpm start");
|
|
36077
36458
|
const packNpmRelationList = getPackNpmRelationList(ctx);
|
|
36078
36459
|
const [mainRelation, ...subRelations] = packNpmRelationList;
|
|
36079
|
-
const packageJsonPath =
|
|
36460
|
+
const packageJsonPath = path65.resolve(ctx.configService.cwd, mainRelation.packageJsonPath);
|
|
36080
36461
|
if (await fs34.pathExists(packageJsonPath)) {
|
|
36081
36462
|
const pkgJson = await fs34.readJson(packageJsonPath);
|
|
36082
|
-
const outDir =
|
|
36463
|
+
const outDir = path65.resolve(ctx.configService.cwd, mainRelation.miniprogramNpmDistDir, "miniprogram_npm");
|
|
36083
36464
|
if (pkgJson.dependencies) {
|
|
36084
36465
|
const dependencies = Object.keys(pkgJson.dependencies);
|
|
36085
36466
|
if (dependencies.length > 0) {
|
|
@@ -36098,7 +36479,7 @@ function createNpmService(ctx) {
|
|
|
36098
36479
|
const targetDirs = [
|
|
36099
36480
|
...subRelations.map((x) => {
|
|
36100
36481
|
return {
|
|
36101
|
-
npmDistDir:
|
|
36482
|
+
npmDistDir: path65.resolve(ctx.configService.cwd, x.miniprogramNpmDistDir, "miniprogram_npm")
|
|
36102
36483
|
};
|
|
36103
36484
|
}),
|
|
36104
36485
|
...[...ctx.scanService.independentSubPackageMap.values()].map((x) => {
|
|
@@ -36106,7 +36487,7 @@ function createNpmService(ctx) {
|
|
|
36106
36487
|
return {
|
|
36107
36488
|
root: x.subPackage.root,
|
|
36108
36489
|
dependencies: dependencies2,
|
|
36109
|
-
npmDistDir:
|
|
36490
|
+
npmDistDir: path65.resolve(ctx.configService.cwd, mainRelation.miniprogramNpmDistDir, x.subPackage.root, "miniprogram_npm")
|
|
36110
36491
|
};
|
|
36111
36492
|
})
|
|
36112
36493
|
];
|
|
@@ -36118,7 +36499,7 @@ function createNpmService(ctx) {
|
|
|
36118
36499
|
overwrite: true,
|
|
36119
36500
|
filter: (src) => {
|
|
36120
36501
|
if (Array.isArray(x.dependencies)) {
|
|
36121
|
-
const relPath =
|
|
36502
|
+
const relPath = path65.relative(outDir, src);
|
|
36122
36503
|
if (relPath === "") {
|
|
36123
36504
|
return true;
|
|
36124
36505
|
}
|
|
@@ -36134,7 +36515,7 @@ function createNpmService(ctx) {
|
|
|
36134
36515
|
overwrite: true,
|
|
36135
36516
|
filter: (src) => {
|
|
36136
36517
|
if (Array.isArray(x.dependencies)) {
|
|
36137
|
-
const relPath =
|
|
36518
|
+
const relPath = path65.relative(outDir, src);
|
|
36138
36519
|
if (relPath === "") {
|
|
36139
36520
|
return true;
|
|
36140
36521
|
}
|
|
@@ -37229,12 +37610,12 @@ init_esm_shims();
|
|
|
37229
37610
|
// src/runtime/scanPlugin/service.ts
|
|
37230
37611
|
init_esm_shims();
|
|
37231
37612
|
import { isObject as isObject9 } from "@weapp-core/shared";
|
|
37232
|
-
import
|
|
37613
|
+
import path69 from "pathe";
|
|
37233
37614
|
|
|
37234
37615
|
// src/runtime/scanPlugin/styleEntries/index.ts
|
|
37235
37616
|
init_esm_shims();
|
|
37236
37617
|
import fs37 from "fs-extra";
|
|
37237
|
-
import
|
|
37618
|
+
import path68 from "pathe";
|
|
37238
37619
|
|
|
37239
37620
|
// src/runtime/scanPlugin/styleEntries/config.ts
|
|
37240
37621
|
init_esm_shims();
|
|
@@ -37305,7 +37686,7 @@ function coerceStyleConfig(entry) {
|
|
|
37305
37686
|
// src/runtime/scanPlugin/styleEntries/entries.ts
|
|
37306
37687
|
init_esm_shims();
|
|
37307
37688
|
import fs36 from "fs-extra";
|
|
37308
|
-
import
|
|
37689
|
+
import path66 from "pathe";
|
|
37309
37690
|
|
|
37310
37691
|
// src/runtime/scanPlugin/styleEntries/patterns.ts
|
|
37311
37692
|
init_esm_shims();
|
|
@@ -37389,18 +37770,18 @@ function addStyleEntry(descriptor, absolutePath, posixOutput, root, normalizedRo
|
|
|
37389
37770
|
source: descriptor.source,
|
|
37390
37771
|
absolutePath,
|
|
37391
37772
|
outputRelativePath: posixOutput,
|
|
37392
|
-
inputExtension:
|
|
37773
|
+
inputExtension: path66.extname(absolutePath).toLowerCase(),
|
|
37393
37774
|
scope: descriptor.scope,
|
|
37394
37775
|
include,
|
|
37395
37776
|
exclude
|
|
37396
37777
|
});
|
|
37397
37778
|
}
|
|
37398
37779
|
function appendDefaultScopedStyleEntries(root, normalizedRoot, service, dedupe, normalized) {
|
|
37399
|
-
const absoluteSubRoot =
|
|
37780
|
+
const absoluteSubRoot = path66.resolve(service.absoluteSrcRoot, root);
|
|
37400
37781
|
for (const { base, scope } of DEFAULT_SCOPED_FILES) {
|
|
37401
37782
|
for (const ext2 of DEFAULT_SCOPED_EXTENSIONS) {
|
|
37402
37783
|
const filename = `${base}${ext2}`;
|
|
37403
|
-
const absolutePath =
|
|
37784
|
+
const absolutePath = path66.resolve(absoluteSubRoot, filename);
|
|
37404
37785
|
if (!fs36.existsSync(absolutePath)) {
|
|
37405
37786
|
continue;
|
|
37406
37787
|
}
|
|
@@ -37425,7 +37806,7 @@ function appendDefaultScopedStyleEntries(root, normalizedRoot, service, dedupe,
|
|
|
37425
37806
|
|
|
37426
37807
|
// src/runtime/scanPlugin/styleEntries/resolve.ts
|
|
37427
37808
|
init_esm_shims();
|
|
37428
|
-
import
|
|
37809
|
+
import path67 from "pathe";
|
|
37429
37810
|
function resolveStyleEntryAbsolutePath(source, subPackageRoot, configService) {
|
|
37430
37811
|
const service = configService;
|
|
37431
37812
|
if (!service) {
|
|
@@ -37436,17 +37817,17 @@ function resolveStyleEntryAbsolutePath(source, subPackageRoot, configService) {
|
|
|
37436
37817
|
return void 0;
|
|
37437
37818
|
}
|
|
37438
37819
|
const srcRoot = service.absoluteSrcRoot;
|
|
37439
|
-
const absoluteSubRoot =
|
|
37820
|
+
const absoluteSubRoot = path67.resolve(srcRoot, subPackageRoot);
|
|
37440
37821
|
const normalizedEntry = toPosixPath(trimmed);
|
|
37441
37822
|
const normalizedRoot = toPosixPath(subPackageRoot);
|
|
37442
37823
|
const candidates = [];
|
|
37443
|
-
if (
|
|
37824
|
+
if (path67.isAbsolute(trimmed)) {
|
|
37444
37825
|
candidates.push(trimmed);
|
|
37445
37826
|
} else if (normalizedEntry === normalizedRoot || normalizedEntry.startsWith(`${normalizedRoot}/`)) {
|
|
37446
|
-
candidates.push(
|
|
37827
|
+
candidates.push(path67.resolve(srcRoot, trimmed));
|
|
37447
37828
|
} else {
|
|
37448
|
-
candidates.push(
|
|
37449
|
-
candidates.push(
|
|
37829
|
+
candidates.push(path67.resolve(absoluteSubRoot, trimmed));
|
|
37830
|
+
candidates.push(path67.resolve(srcRoot, trimmed));
|
|
37450
37831
|
}
|
|
37451
37832
|
for (const candidate of candidates) {
|
|
37452
37833
|
if (isPathInside(srcRoot, candidate)) {
|
|
@@ -37474,7 +37855,7 @@ function inferScopeFromRelativePath(relativePath) {
|
|
|
37474
37855
|
if (cleaned.includes("/")) {
|
|
37475
37856
|
return void 0;
|
|
37476
37857
|
}
|
|
37477
|
-
const base =
|
|
37858
|
+
const base = path67.posix.basename(cleaned, path67.posix.extname(cleaned));
|
|
37478
37859
|
if (base === "pages") {
|
|
37479
37860
|
return "pages";
|
|
37480
37861
|
}
|
|
@@ -37516,7 +37897,7 @@ function normalizeSubPackageStyleEntries(styles, subPackage, configService) {
|
|
|
37516
37897
|
logger_default.warn(`[\u5206\u5305] \u5206\u5305 ${root} \u6837\u5F0F\u5165\u53E3 \`${descriptor.source}\` \u5BF9\u5E94\u6587\u4EF6\u4E0D\u5B58\u5728\uFF0C\u5DF2\u5FFD\u7565\u3002`);
|
|
37517
37898
|
continue;
|
|
37518
37899
|
}
|
|
37519
|
-
const ext2 =
|
|
37900
|
+
const ext2 = path68.extname(absolutePath).toLowerCase();
|
|
37520
37901
|
if (!SUPPORTED_SHARED_STYLE_EXTS.has(ext2)) {
|
|
37521
37902
|
logger_default.warn(`[\u5206\u5305] \u5206\u5305 ${root} \u6837\u5F0F\u5165\u53E3 \`${descriptor.source}\` \u5F53\u524D\u4EC5\u652F\u6301\u4EE5\u4E0B\u683C\u5F0F\uFF1A${SUPPORTED_SHARED_STYLE_EXTENSIONS.join(", ")}\uFF0C\u5DF2\u5FFD\u7565\u3002`);
|
|
37522
37903
|
continue;
|
|
@@ -37568,13 +37949,13 @@ function createScanService(ctx) {
|
|
|
37568
37949
|
return scanState.appEntry;
|
|
37569
37950
|
}
|
|
37570
37951
|
const appDirname = ctx.configService.absoluteSrcRoot;
|
|
37571
|
-
const appBasename =
|
|
37952
|
+
const appBasename = path69.resolve(appDirname, "app");
|
|
37572
37953
|
let { path: appConfigFile } = await findJsonEntry(appBasename);
|
|
37573
37954
|
const { path: appEntryPath } = await findJsEntry(appBasename);
|
|
37574
37955
|
let configFromVue;
|
|
37575
37956
|
let vueAppPath;
|
|
37576
37957
|
if (!appConfigFile) {
|
|
37577
|
-
const { extractConfigFromVue: extractConfigFromVue2 } = await import("./file-
|
|
37958
|
+
const { extractConfigFromVue: extractConfigFromVue2 } = await import("./file-XQ5KCZRI.mjs");
|
|
37578
37959
|
vueAppPath = await findVueEntry(appBasename);
|
|
37579
37960
|
if (vueAppPath) {
|
|
37580
37961
|
configFromVue = await extractConfigFromVue2(vueAppPath);
|
|
@@ -37584,7 +37965,7 @@ function createScanService(ctx) {
|
|
|
37584
37965
|
}
|
|
37585
37966
|
}
|
|
37586
37967
|
if (ctx.configService.absolutePluginRoot) {
|
|
37587
|
-
const pluginBasename =
|
|
37968
|
+
const pluginBasename = path69.resolve(ctx.configService.absolutePluginRoot, "plugin");
|
|
37588
37969
|
const { path: pluginConfigFile } = await findJsonEntry(pluginBasename);
|
|
37589
37970
|
if (pluginConfigFile) {
|
|
37590
37971
|
const pluginConfig = await ctx.jsonService.read(pluginConfigFile);
|
|
@@ -37613,14 +37994,14 @@ function createScanService(ctx) {
|
|
|
37613
37994
|
scanState.appEntry = resolvedAppEntry;
|
|
37614
37995
|
const { sitemapLocation = "sitemap.json", themeLocation = "theme.json" } = config;
|
|
37615
37996
|
if (sitemapLocation) {
|
|
37616
|
-
const { path: sitemapJsonPath } = await findJsonEntry(
|
|
37997
|
+
const { path: sitemapJsonPath } = await findJsonEntry(path69.resolve(appDirname, sitemapLocation));
|
|
37617
37998
|
if (sitemapJsonPath) {
|
|
37618
37999
|
resolvedAppEntry.sitemapJsonPath = sitemapJsonPath;
|
|
37619
38000
|
resolvedAppEntry.sitemapJson = await ctx.jsonService.read(sitemapJsonPath);
|
|
37620
38001
|
}
|
|
37621
38002
|
}
|
|
37622
38003
|
if (themeLocation) {
|
|
37623
|
-
const { path: themeJsonPath } = await findJsonEntry(
|
|
38004
|
+
const { path: themeJsonPath } = await findJsonEntry(path69.resolve(appDirname, themeLocation));
|
|
37624
38005
|
if (themeJsonPath) {
|
|
37625
38006
|
resolvedAppEntry.themeJsonPath = themeJsonPath;
|
|
37626
38007
|
resolvedAppEntry.themeJson = await ctx.jsonService.read(themeJsonPath);
|
|
@@ -37894,7 +38275,7 @@ function createWebServicePlugin(ctx) {
|
|
|
37894
38275
|
init_esm_shims();
|
|
37895
38276
|
import { removeExtensionDeep as removeExtensionDeep13 } from "@weapp-core/shared";
|
|
37896
38277
|
import fs38 from "fs-extra";
|
|
37897
|
-
import
|
|
38278
|
+
import path70 from "pathe";
|
|
37898
38279
|
|
|
37899
38280
|
// src/wxml/index.ts
|
|
37900
38281
|
init_esm_shims();
|
|
@@ -40537,7 +40918,7 @@ function createWxmlService(ctx) {
|
|
|
40537
40918
|
return cached;
|
|
40538
40919
|
}
|
|
40539
40920
|
}
|
|
40540
|
-
const dirname5 =
|
|
40921
|
+
const dirname5 = path70.dirname(filepath);
|
|
40541
40922
|
const wxml = await fs38.readFile(filepath, "utf8");
|
|
40542
40923
|
const res = analyze(wxml);
|
|
40543
40924
|
tokenMap.set(filepath, res);
|
|
@@ -40546,9 +40927,9 @@ function createWxmlService(ctx) {
|
|
|
40546
40927
|
filepath,
|
|
40547
40928
|
res.deps.filter((x) => isImportTag(x.tagName) && isTemplate(x.value)).map((x) => {
|
|
40548
40929
|
if (x.value.startsWith("/")) {
|
|
40549
|
-
return
|
|
40930
|
+
return path70.resolve(configService.absoluteSrcRoot, x.value.slice(1));
|
|
40550
40931
|
} else {
|
|
40551
|
-
return
|
|
40932
|
+
return path70.resolve(dirname5, x.value);
|
|
40552
40933
|
}
|
|
40553
40934
|
})
|
|
40554
40935
|
);
|