weapp-vite 5.6.2 → 5.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auto-import-components/resolvers.cjs +5 -5
- package/dist/auto-import-components/resolvers.mjs +1 -1
- package/dist/auto-routes.cjs +8 -8
- package/dist/auto-routes.mjs +4 -4
- package/dist/{chunk-JXSGMLN2.mjs → chunk-2SUWUB42.mjs} +1 -1
- package/dist/{chunk-WWFEREWV.cjs → chunk-A5DD7GKX.cjs} +2 -2
- package/dist/{chunk-S4QPBSDQ.mjs → chunk-AKJEW44F.mjs} +1127 -993
- package/dist/chunk-FOWFAOSV.cjs +6 -0
- package/dist/{chunk-XMRIIXBJ.cjs → chunk-FUJ4D6IR.cjs} +1383 -1249
- package/dist/{chunk-ZIRGPJR5.cjs → chunk-G6EZVEVT.cjs} +2 -2
- package/dist/{chunk-3OJIAYQT.mjs → chunk-GU7U5762.mjs} +2 -2
- package/dist/{chunk-ACNTFTT2.cjs → chunk-MQBCRXCD.cjs} +2 -2
- package/dist/{chunk-DG5WTO5V.mjs → chunk-N463WDOG.mjs} +1 -1
- package/dist/{chunk-C5ZVOPAJ.mjs → chunk-SSQGJIB5.mjs} +2 -2
- package/dist/{chunk-634Q6FYA.cjs → chunk-VRKZFXIZ.cjs} +6 -6
- package/dist/{chunk-JMKI52G2.mjs → chunk-ZMX6CFVX.mjs} +1 -1
- package/dist/cli.cjs +884 -285
- package/dist/cli.mjs +881 -282
- package/dist/{config-BuTlQpli.d.cts → config-C-oMiscN.d.cts} +10 -0
- package/dist/{config-BB6bSUwe.d.ts → config-CbKHc1kT.d.ts} +10 -0
- package/dist/config.cjs +4 -4
- package/dist/config.d.cts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.mjs +3 -3
- package/dist/index.cjs +8 -8
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +6 -6
- package/dist/json.cjs +3 -3
- package/dist/json.d.cts +1 -1
- package/dist/json.d.ts +1 -1
- package/dist/json.mjs +2 -2
- package/dist/types.cjs +9 -9
- package/dist/types.d.cts +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.mjs +2 -2
- package/dist/volar.cjs +2 -2
- package/dist/volar.mjs +1 -1
- package/package.json +8 -8
- package/dist/chunk-EKHZHEQK.cjs +0 -6
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
__require,
|
|
4
4
|
__toESM,
|
|
5
5
|
init_esm_shims
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-SSQGJIB5.mjs";
|
|
7
7
|
|
|
8
8
|
// ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/debug.js
|
|
9
9
|
var require_debug = __commonJS({
|
|
@@ -163,13 +163,13 @@ var require_identifiers = __commonJS({
|
|
|
163
163
|
"../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/identifiers.js"(exports, module) {
|
|
164
164
|
"use strict";
|
|
165
165
|
init_esm_shims();
|
|
166
|
-
var
|
|
166
|
+
var numeric2 = /^[0-9]+$/;
|
|
167
167
|
var compareIdentifiers = (a, b) => {
|
|
168
168
|
if (typeof a === "number" && typeof b === "number") {
|
|
169
169
|
return a === b ? 0 : a < b ? -1 : 1;
|
|
170
170
|
}
|
|
171
|
-
const anum =
|
|
172
|
-
const bnum =
|
|
171
|
+
const anum = numeric2.test(a);
|
|
172
|
+
const bnum = numeric2.test(b);
|
|
173
173
|
if (anum && bnum) {
|
|
174
174
|
a = +a;
|
|
175
175
|
b = +b;
|
|
@@ -195,31 +195,31 @@ var require_semver = __commonJS({
|
|
|
195
195
|
var parseOptions = require_parse_options();
|
|
196
196
|
var { compareIdentifiers } = require_identifiers();
|
|
197
197
|
var SemVer = class _SemVer {
|
|
198
|
-
constructor(
|
|
198
|
+
constructor(version2, options) {
|
|
199
199
|
options = parseOptions(options);
|
|
200
|
-
if (
|
|
201
|
-
if (
|
|
202
|
-
return
|
|
200
|
+
if (version2 instanceof _SemVer) {
|
|
201
|
+
if (version2.loose === !!options.loose && version2.includePrerelease === !!options.includePrerelease) {
|
|
202
|
+
return version2;
|
|
203
203
|
} else {
|
|
204
|
-
|
|
204
|
+
version2 = version2.version;
|
|
205
205
|
}
|
|
206
|
-
} else if (typeof
|
|
207
|
-
throw new TypeError(`Invalid version. Must be a string. Got type "${typeof
|
|
206
|
+
} else if (typeof version2 !== "string") {
|
|
207
|
+
throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version2}".`);
|
|
208
208
|
}
|
|
209
|
-
if (
|
|
209
|
+
if (version2.length > MAX_LENGTH) {
|
|
210
210
|
throw new TypeError(
|
|
211
211
|
`version is longer than ${MAX_LENGTH} characters`
|
|
212
212
|
);
|
|
213
213
|
}
|
|
214
|
-
debug4("SemVer",
|
|
214
|
+
debug4("SemVer", version2, options);
|
|
215
215
|
this.options = options;
|
|
216
216
|
this.loose = !!options.loose;
|
|
217
217
|
this.includePrerelease = !!options.includePrerelease;
|
|
218
|
-
const m =
|
|
218
|
+
const m = version2.trim().match(options.loose ? re[t2.LOOSE] : re[t2.FULL]);
|
|
219
219
|
if (!m) {
|
|
220
|
-
throw new TypeError(`Invalid Version: ${
|
|
220
|
+
throw new TypeError(`Invalid Version: ${version2}`);
|
|
221
221
|
}
|
|
222
|
-
this.raw =
|
|
222
|
+
this.raw = version2;
|
|
223
223
|
this.major = +m[1];
|
|
224
224
|
this.minor = +m[2];
|
|
225
225
|
this.patch = +m[3];
|
|
@@ -481,219 +481,8 @@ var require_gte = __commonJS({
|
|
|
481
481
|
"use strict";
|
|
482
482
|
init_esm_shims();
|
|
483
483
|
var compare = require_compare();
|
|
484
|
-
var
|
|
485
|
-
module.exports =
|
|
486
|
-
}
|
|
487
|
-
});
|
|
488
|
-
|
|
489
|
-
// ../../node_modules/.pnpm/balanced-match@1.0.2/node_modules/balanced-match/index.js
|
|
490
|
-
var require_balanced_match = __commonJS({
|
|
491
|
-
"../../node_modules/.pnpm/balanced-match@1.0.2/node_modules/balanced-match/index.js"(exports, module) {
|
|
492
|
-
"use strict";
|
|
493
|
-
init_esm_shims();
|
|
494
|
-
module.exports = balanced;
|
|
495
|
-
function balanced(a, b, str) {
|
|
496
|
-
if (a instanceof RegExp) a = maybeMatch(a, str);
|
|
497
|
-
if (b instanceof RegExp) b = maybeMatch(b, str);
|
|
498
|
-
var r2 = range(a, b, str);
|
|
499
|
-
return r2 && {
|
|
500
|
-
start: r2[0],
|
|
501
|
-
end: r2[1],
|
|
502
|
-
pre: str.slice(0, r2[0]),
|
|
503
|
-
body: str.slice(r2[0] + a.length, r2[1]),
|
|
504
|
-
post: str.slice(r2[1] + b.length)
|
|
505
|
-
};
|
|
506
|
-
}
|
|
507
|
-
function maybeMatch(reg, str) {
|
|
508
|
-
var m = str.match(reg);
|
|
509
|
-
return m ? m[0] : null;
|
|
510
|
-
}
|
|
511
|
-
balanced.range = range;
|
|
512
|
-
function range(a, b, str) {
|
|
513
|
-
var begs, beg, left, right, result;
|
|
514
|
-
var ai = str.indexOf(a);
|
|
515
|
-
var bi = str.indexOf(b, ai + 1);
|
|
516
|
-
var i = ai;
|
|
517
|
-
if (ai >= 0 && bi > 0) {
|
|
518
|
-
if (a === b) {
|
|
519
|
-
return [ai, bi];
|
|
520
|
-
}
|
|
521
|
-
begs = [];
|
|
522
|
-
left = str.length;
|
|
523
|
-
while (i >= 0 && !result) {
|
|
524
|
-
if (i == ai) {
|
|
525
|
-
begs.push(i);
|
|
526
|
-
ai = str.indexOf(a, i + 1);
|
|
527
|
-
} else if (begs.length == 1) {
|
|
528
|
-
result = [begs.pop(), bi];
|
|
529
|
-
} else {
|
|
530
|
-
beg = begs.pop();
|
|
531
|
-
if (beg < left) {
|
|
532
|
-
left = beg;
|
|
533
|
-
right = bi;
|
|
534
|
-
}
|
|
535
|
-
bi = str.indexOf(b, i + 1);
|
|
536
|
-
}
|
|
537
|
-
i = ai < bi && ai >= 0 ? ai : bi;
|
|
538
|
-
}
|
|
539
|
-
if (begs.length) {
|
|
540
|
-
result = [left, right];
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
return result;
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
});
|
|
547
|
-
|
|
548
|
-
// ../../node_modules/.pnpm/brace-expansion@2.0.1/node_modules/brace-expansion/index.js
|
|
549
|
-
var require_brace_expansion = __commonJS({
|
|
550
|
-
"../../node_modules/.pnpm/brace-expansion@2.0.1/node_modules/brace-expansion/index.js"(exports, module) {
|
|
551
|
-
"use strict";
|
|
552
|
-
init_esm_shims();
|
|
553
|
-
var balanced = require_balanced_match();
|
|
554
|
-
module.exports = expandTop;
|
|
555
|
-
var escSlash = "\0SLASH" + Math.random() + "\0";
|
|
556
|
-
var escOpen = "\0OPEN" + Math.random() + "\0";
|
|
557
|
-
var escClose = "\0CLOSE" + Math.random() + "\0";
|
|
558
|
-
var escComma = "\0COMMA" + Math.random() + "\0";
|
|
559
|
-
var escPeriod = "\0PERIOD" + Math.random() + "\0";
|
|
560
|
-
function numeric(str) {
|
|
561
|
-
return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0);
|
|
562
|
-
}
|
|
563
|
-
function escapeBraces(str) {
|
|
564
|
-
return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod);
|
|
565
|
-
}
|
|
566
|
-
function unescapeBraces(str) {
|
|
567
|
-
return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".");
|
|
568
|
-
}
|
|
569
|
-
function parseCommaParts(str) {
|
|
570
|
-
if (!str)
|
|
571
|
-
return [""];
|
|
572
|
-
var parts = [];
|
|
573
|
-
var m = balanced("{", "}", str);
|
|
574
|
-
if (!m)
|
|
575
|
-
return str.split(",");
|
|
576
|
-
var pre = m.pre;
|
|
577
|
-
var body = m.body;
|
|
578
|
-
var post = m.post;
|
|
579
|
-
var p = pre.split(",");
|
|
580
|
-
p[p.length - 1] += "{" + body + "}";
|
|
581
|
-
var postParts = parseCommaParts(post);
|
|
582
|
-
if (post.length) {
|
|
583
|
-
p[p.length - 1] += postParts.shift();
|
|
584
|
-
p.push.apply(p, postParts);
|
|
585
|
-
}
|
|
586
|
-
parts.push.apply(parts, p);
|
|
587
|
-
return parts;
|
|
588
|
-
}
|
|
589
|
-
function expandTop(str) {
|
|
590
|
-
if (!str)
|
|
591
|
-
return [];
|
|
592
|
-
if (str.substr(0, 2) === "{}") {
|
|
593
|
-
str = "\\{\\}" + str.substr(2);
|
|
594
|
-
}
|
|
595
|
-
return expand2(escapeBraces(str), true).map(unescapeBraces);
|
|
596
|
-
}
|
|
597
|
-
function embrace(str) {
|
|
598
|
-
return "{" + str + "}";
|
|
599
|
-
}
|
|
600
|
-
function isPadded(el) {
|
|
601
|
-
return /^-?0\d/.test(el);
|
|
602
|
-
}
|
|
603
|
-
function lte(i, y) {
|
|
604
|
-
return i <= y;
|
|
605
|
-
}
|
|
606
|
-
function gte(i, y) {
|
|
607
|
-
return i >= y;
|
|
608
|
-
}
|
|
609
|
-
function expand2(str, isTop) {
|
|
610
|
-
var expansions = [];
|
|
611
|
-
var m = balanced("{", "}", str);
|
|
612
|
-
if (!m) return [str];
|
|
613
|
-
var pre = m.pre;
|
|
614
|
-
var post = m.post.length ? expand2(m.post, false) : [""];
|
|
615
|
-
if (/\$$/.test(m.pre)) {
|
|
616
|
-
for (var k = 0; k < post.length; k++) {
|
|
617
|
-
var expansion = pre + "{" + m.body + "}" + post[k];
|
|
618
|
-
expansions.push(expansion);
|
|
619
|
-
}
|
|
620
|
-
} else {
|
|
621
|
-
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
|
622
|
-
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
|
623
|
-
var isSequence = isNumericSequence || isAlphaSequence;
|
|
624
|
-
var isOptions = m.body.indexOf(",") >= 0;
|
|
625
|
-
if (!isSequence && !isOptions) {
|
|
626
|
-
if (m.post.match(/,.*\}/)) {
|
|
627
|
-
str = m.pre + "{" + m.body + escClose + m.post;
|
|
628
|
-
return expand2(str);
|
|
629
|
-
}
|
|
630
|
-
return [str];
|
|
631
|
-
}
|
|
632
|
-
var n2;
|
|
633
|
-
if (isSequence) {
|
|
634
|
-
n2 = m.body.split(/\.\./);
|
|
635
|
-
} else {
|
|
636
|
-
n2 = parseCommaParts(m.body);
|
|
637
|
-
if (n2.length === 1) {
|
|
638
|
-
n2 = expand2(n2[0], false).map(embrace);
|
|
639
|
-
if (n2.length === 1) {
|
|
640
|
-
return post.map(function(p) {
|
|
641
|
-
return m.pre + n2[0] + p;
|
|
642
|
-
});
|
|
643
|
-
}
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
var N;
|
|
647
|
-
if (isSequence) {
|
|
648
|
-
var x = numeric(n2[0]);
|
|
649
|
-
var y = numeric(n2[1]);
|
|
650
|
-
var width = Math.max(n2[0].length, n2[1].length);
|
|
651
|
-
var incr = n2.length == 3 ? Math.abs(numeric(n2[2])) : 1;
|
|
652
|
-
var test = lte;
|
|
653
|
-
var reverse = y < x;
|
|
654
|
-
if (reverse) {
|
|
655
|
-
incr *= -1;
|
|
656
|
-
test = gte;
|
|
657
|
-
}
|
|
658
|
-
var pad = n2.some(isPadded);
|
|
659
|
-
N = [];
|
|
660
|
-
for (var i = x; test(i, y); i += incr) {
|
|
661
|
-
var c;
|
|
662
|
-
if (isAlphaSequence) {
|
|
663
|
-
c = String.fromCharCode(i);
|
|
664
|
-
if (c === "\\")
|
|
665
|
-
c = "";
|
|
666
|
-
} else {
|
|
667
|
-
c = String(i);
|
|
668
|
-
if (pad) {
|
|
669
|
-
var need = width - c.length;
|
|
670
|
-
if (need > 0) {
|
|
671
|
-
var z = new Array(need + 1).join("0");
|
|
672
|
-
if (i < 0)
|
|
673
|
-
c = "-" + z + c.slice(1);
|
|
674
|
-
else
|
|
675
|
-
c = z + c;
|
|
676
|
-
}
|
|
677
|
-
}
|
|
678
|
-
}
|
|
679
|
-
N.push(c);
|
|
680
|
-
}
|
|
681
|
-
} else {
|
|
682
|
-
N = [];
|
|
683
|
-
for (var j = 0; j < n2.length; j++) {
|
|
684
|
-
N.push.apply(N, expand2(n2[j], false));
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
for (var j = 0; j < N.length; j++) {
|
|
688
|
-
for (var k = 0; k < post.length; k++) {
|
|
689
|
-
var expansion = pre + N[j] + post[k];
|
|
690
|
-
if (!isTop || isSequence || expansion)
|
|
691
|
-
expansions.push(expansion);
|
|
692
|
-
}
|
|
693
|
-
}
|
|
694
|
-
}
|
|
695
|
-
return expansions;
|
|
696
|
-
}
|
|
484
|
+
var gte2 = (a, b, loose) => compare(a, b, loose) >= 0;
|
|
485
|
+
module.exports = gte2;
|
|
697
486
|
}
|
|
698
487
|
});
|
|
699
488
|
|
|
@@ -860,11 +649,6 @@ var require_eventemitter3 = __commonJS({
|
|
|
860
649
|
}
|
|
861
650
|
});
|
|
862
651
|
|
|
863
|
-
// src/logger.ts
|
|
864
|
-
init_esm_shims();
|
|
865
|
-
import logger from "@weapp-core/logger";
|
|
866
|
-
var logger_default = logger;
|
|
867
|
-
|
|
868
652
|
// src/constants.ts
|
|
869
653
|
init_esm_shims();
|
|
870
654
|
var VERSION = "__VERSION__";
|
|
@@ -883,6 +667,13 @@ var templateExtensions = ["wxml", "html"];
|
|
|
883
667
|
init_esm_shims();
|
|
884
668
|
var import_gte = __toESM(require_gte(), 1);
|
|
885
669
|
import process2 from "process";
|
|
670
|
+
|
|
671
|
+
// src/logger.ts
|
|
672
|
+
init_esm_shims();
|
|
673
|
+
import logger from "@weapp-core/logger";
|
|
674
|
+
var logger_default = logger;
|
|
675
|
+
|
|
676
|
+
// src/utils/version.ts
|
|
886
677
|
function getRuntime() {
|
|
887
678
|
if (typeof process2 !== "undefined" && process2.versions?.node) {
|
|
888
679
|
return {
|
|
@@ -906,57 +697,15 @@ function getRuntime() {
|
|
|
906
697
|
throw new Error("Unknown runtime: cannot determine Node.js / Deno / Bun");
|
|
907
698
|
}
|
|
908
699
|
function checkRuntime(minVersions) {
|
|
909
|
-
const { runtime, version:
|
|
700
|
+
const { runtime, version: version2 } = getRuntime();
|
|
910
701
|
const required = minVersions[runtime];
|
|
911
702
|
if (!required) {
|
|
912
703
|
logger_default.warn(`No minimum version specified for ${runtime}, skipping check.`);
|
|
913
704
|
return;
|
|
914
705
|
}
|
|
915
|
-
if (!(0, import_gte.default)(
|
|
916
|
-
logger_default.warn(`\u5F53\u524D ${runtime} \u7248\u672C\u4E3A ${
|
|
917
|
-
}
|
|
918
|
-
}
|
|
919
|
-
|
|
920
|
-
// src/utils/weappConfig.ts
|
|
921
|
-
init_esm_shims();
|
|
922
|
-
import fs from "fs-extra";
|
|
923
|
-
import path from "pathe";
|
|
924
|
-
var WEAPP_VITE_CONFIG_CANDIDATES = [
|
|
925
|
-
"weapp-vite.config.ts",
|
|
926
|
-
"weapp-vite.config.mts",
|
|
927
|
-
"weapp-vite.config.cts",
|
|
928
|
-
"weapp-vite.config.js",
|
|
929
|
-
"weapp-vite.config.mjs",
|
|
930
|
-
"weapp-vite.config.cjs",
|
|
931
|
-
"weapp-vite.config.json"
|
|
932
|
-
];
|
|
933
|
-
var WEAPP_VITE_CONFIG_SET = new Set(WEAPP_VITE_CONFIG_CANDIDATES);
|
|
934
|
-
async function findWeappConfigInDirectory(directory) {
|
|
935
|
-
for (const filename of WEAPP_VITE_CONFIG_CANDIDATES) {
|
|
936
|
-
const candidatePath = path.resolve(directory, filename);
|
|
937
|
-
if (await fs.pathExists(candidatePath)) {
|
|
938
|
-
return candidatePath;
|
|
939
|
-
}
|
|
940
|
-
}
|
|
941
|
-
return void 0;
|
|
942
|
-
}
|
|
943
|
-
async function resolveWeappConfigFile(options) {
|
|
944
|
-
const { root, specified } = options;
|
|
945
|
-
if (specified) {
|
|
946
|
-
const resolvedSpecified = path.isAbsolute(specified) ? specified : path.resolve(root, specified);
|
|
947
|
-
const specifiedBaseName = path.basename(resolvedSpecified);
|
|
948
|
-
if (WEAPP_VITE_CONFIG_SET.has(specifiedBaseName)) {
|
|
949
|
-
if (await fs.pathExists(resolvedSpecified)) {
|
|
950
|
-
return resolvedSpecified;
|
|
951
|
-
}
|
|
952
|
-
return void 0;
|
|
953
|
-
}
|
|
954
|
-
const fromSpecifiedDirectory = await findWeappConfigInDirectory(path.dirname(resolvedSpecified));
|
|
955
|
-
if (fromSpecifiedDirectory) {
|
|
956
|
-
return fromSpecifiedDirectory;
|
|
957
|
-
}
|
|
706
|
+
if (!(0, import_gte.default)(version2, required)) {
|
|
707
|
+
logger_default.warn(`\u5F53\u524D ${runtime} \u7248\u672C\u4E3A ${version2} \u65E0\u6CD5\u6EE1\u8DB3 \`weapp-vite\` \u6700\u4F4E\u8981\u6C42\u7684\u7248\u672C(>= ${required})`);
|
|
958
708
|
}
|
|
959
|
-
return findWeappConfigInDirectory(root);
|
|
960
709
|
}
|
|
961
710
|
|
|
962
711
|
// src/utils/index.ts
|
|
@@ -964,8 +713,8 @@ init_esm_shims();
|
|
|
964
713
|
|
|
965
714
|
// src/utils/file.ts
|
|
966
715
|
init_esm_shims();
|
|
967
|
-
import
|
|
968
|
-
import
|
|
716
|
+
import fs from "fs-extra";
|
|
717
|
+
import path from "pathe";
|
|
969
718
|
function isJsOrTs(name) {
|
|
970
719
|
if (typeof name === "string") {
|
|
971
720
|
return /\.[jt]s$/.test(name);
|
|
@@ -986,13 +735,13 @@ function changeFileExtension(filePath, extension) {
|
|
|
986
735
|
return "";
|
|
987
736
|
}
|
|
988
737
|
extension = extension ? extension.startsWith(".") ? extension : `.${extension}` : "";
|
|
989
|
-
const basename4 =
|
|
990
|
-
return
|
|
738
|
+
const basename4 = path.basename(filePath, path.extname(filePath));
|
|
739
|
+
return path.join(path.dirname(filePath), basename4 + extension);
|
|
991
740
|
}
|
|
992
741
|
async function findVueEntry(filepath) {
|
|
993
742
|
for (const ext2 of vueExtensions) {
|
|
994
743
|
const p = changeFileExtension(filepath, ext2);
|
|
995
|
-
if (await
|
|
744
|
+
if (await fs.exists(p)) {
|
|
996
745
|
return p;
|
|
997
746
|
}
|
|
998
747
|
}
|
|
@@ -1002,7 +751,7 @@ async function findJsEntry(filepath) {
|
|
|
1002
751
|
return changeFileExtension(filepath, ext2);
|
|
1003
752
|
});
|
|
1004
753
|
for (const p of predictions) {
|
|
1005
|
-
if (await
|
|
754
|
+
if (await fs.exists(p)) {
|
|
1006
755
|
return {
|
|
1007
756
|
path: p,
|
|
1008
757
|
predictions
|
|
@@ -1018,7 +767,7 @@ async function findJsonEntry(filepath) {
|
|
|
1018
767
|
return changeFileExtension(filepath, ext2);
|
|
1019
768
|
});
|
|
1020
769
|
for (const p of predictions) {
|
|
1021
|
-
if (await
|
|
770
|
+
if (await fs.exists(p)) {
|
|
1022
771
|
return {
|
|
1023
772
|
predictions,
|
|
1024
773
|
path: p
|
|
@@ -1034,7 +783,7 @@ async function findCssEntry(filepath) {
|
|
|
1034
783
|
return changeFileExtension(filepath, ext2);
|
|
1035
784
|
});
|
|
1036
785
|
for (const p of predictions) {
|
|
1037
|
-
if (await
|
|
786
|
+
if (await fs.exists(p)) {
|
|
1038
787
|
return {
|
|
1039
788
|
predictions,
|
|
1040
789
|
path: p
|
|
@@ -1050,7 +799,7 @@ async function findTemplateEntry(filepath) {
|
|
|
1050
799
|
return changeFileExtension(filepath, ext2);
|
|
1051
800
|
});
|
|
1052
801
|
for (const p of predictions) {
|
|
1053
|
-
if (await
|
|
802
|
+
if (await fs.exists(p)) {
|
|
1054
803
|
return {
|
|
1055
804
|
predictions,
|
|
1056
805
|
path: p
|
|
@@ -1067,9 +816,9 @@ function isTemplate(filepath) {
|
|
|
1067
816
|
async function touch(filename) {
|
|
1068
817
|
const time = /* @__PURE__ */ new Date();
|
|
1069
818
|
try {
|
|
1070
|
-
await
|
|
819
|
+
await fs.utimes(filename, time, time);
|
|
1071
820
|
} catch {
|
|
1072
|
-
await
|
|
821
|
+
await fs.close(await fs.open(filename, "w"));
|
|
1073
822
|
}
|
|
1074
823
|
}
|
|
1075
824
|
|
|
@@ -1077,7 +826,7 @@ async function touch(filename) {
|
|
|
1077
826
|
init_esm_shims();
|
|
1078
827
|
import { get, isObject, set } from "@weapp-core/shared";
|
|
1079
828
|
import { parse as parseJson, stringify } from "comment-json";
|
|
1080
|
-
import
|
|
829
|
+
import path2 from "pathe";
|
|
1081
830
|
function jsonFileRemoveJsExtension(fileName) {
|
|
1082
831
|
return fileName.replace(/\.[jt]s$/, "");
|
|
1083
832
|
}
|
|
@@ -1122,7 +871,7 @@ function resolveImportee(importee, jsonPath, aliasEntries) {
|
|
|
1122
871
|
return importee;
|
|
1123
872
|
}
|
|
1124
873
|
const updatedId = importee.replace(matchedEntry.find, matchedEntry.replacement);
|
|
1125
|
-
return
|
|
874
|
+
return path2.relative(path2.dirname(jsonPath), updatedId);
|
|
1126
875
|
}
|
|
1127
876
|
return importee;
|
|
1128
877
|
}
|
|
@@ -1165,16 +914,16 @@ import crypto from "crypto";
|
|
|
1165
914
|
|
|
1166
915
|
// src/utils/projectConfig.ts
|
|
1167
916
|
init_esm_shims();
|
|
1168
|
-
import
|
|
1169
|
-
import
|
|
917
|
+
import fs2 from "fs-extra";
|
|
918
|
+
import path3 from "pathe";
|
|
1170
919
|
async function getProjectConfig(root, options) {
|
|
1171
|
-
const baseJsonPath =
|
|
1172
|
-
const privateJsonPath =
|
|
920
|
+
const baseJsonPath = path3.resolve(root, "project.config.json");
|
|
921
|
+
const privateJsonPath = path3.resolve(root, "project.private.config.json");
|
|
1173
922
|
let baseJson = {};
|
|
1174
923
|
let privateJson = {};
|
|
1175
|
-
if (await
|
|
924
|
+
if (await fs2.exists(baseJsonPath)) {
|
|
1176
925
|
try {
|
|
1177
|
-
baseJson = await
|
|
926
|
+
baseJson = await fs2.readJson(baseJsonPath) || {};
|
|
1178
927
|
} catch {
|
|
1179
928
|
throw new Error(`\u89E3\u6790 json \u683C\u5F0F\u5931\u8D25, project.config.json \u4E3A\u975E\u6CD5\u7684 json \u683C\u5F0F`);
|
|
1180
929
|
}
|
|
@@ -1182,9 +931,9 @@ async function getProjectConfig(root, options) {
|
|
|
1182
931
|
throw new Error(`\u5728 ${root} \u76EE\u5F55\u4E0B\u627E\u4E0D\u5230 project.config.json`);
|
|
1183
932
|
}
|
|
1184
933
|
if (!options?.ignorePrivate) {
|
|
1185
|
-
if (await
|
|
934
|
+
if (await fs2.exists(privateJsonPath)) {
|
|
1186
935
|
try {
|
|
1187
|
-
privateJson = await
|
|
936
|
+
privateJson = await fs2.readJson(privateJsonPath) || {};
|
|
1188
937
|
} catch {
|
|
1189
938
|
throw new Error(`\u89E3\u6790 json \u683C\u5F0F\u5931\u8D25, project.private.config.json \u4E3A\u975E\u6CD5\u7684 json \u683C\u5F0F`);
|
|
1190
939
|
}
|
|
@@ -1225,121 +974,46 @@ function regExpTest(arr, str, options) {
|
|
|
1225
974
|
return false;
|
|
1226
975
|
}
|
|
1227
976
|
|
|
1228
|
-
// src/
|
|
1229
|
-
init_esm_shims();
|
|
1230
|
-
|
|
1231
|
-
// src/platforms/adapters.ts
|
|
977
|
+
// src/utils/weappConfig.ts
|
|
1232
978
|
init_esm_shims();
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
wxs: "wxs"
|
|
1244
|
-
}
|
|
1245
|
-
},
|
|
1246
|
-
{
|
|
1247
|
-
id: "alipay",
|
|
1248
|
-
displayName: "Alipay Mini Program",
|
|
1249
|
-
aliases: ["alipay", "ali", "my"],
|
|
1250
|
-
outputExtensions: {
|
|
1251
|
-
js: "js",
|
|
1252
|
-
json: "json",
|
|
1253
|
-
wxml: "axml",
|
|
1254
|
-
wxss: "acss",
|
|
1255
|
-
wxs: "sjs"
|
|
1256
|
-
}
|
|
1257
|
-
},
|
|
1258
|
-
{
|
|
1259
|
-
id: "swan",
|
|
1260
|
-
displayName: "Baidu Smart Program",
|
|
1261
|
-
aliases: ["swan", "baidu", "bd"],
|
|
1262
|
-
outputExtensions: {
|
|
1263
|
-
js: "js",
|
|
1264
|
-
json: "json",
|
|
1265
|
-
wxml: "swan",
|
|
1266
|
-
wxss: "css",
|
|
1267
|
-
wxs: "sjs"
|
|
1268
|
-
}
|
|
1269
|
-
},
|
|
1270
|
-
{
|
|
1271
|
-
id: "tt",
|
|
1272
|
-
displayName: "ByteDance / Douyin Mini Program",
|
|
1273
|
-
aliases: ["tt", "toutiao", "bytedance", "douyin"],
|
|
1274
|
-
outputExtensions: {
|
|
1275
|
-
js: "js",
|
|
1276
|
-
json: "json",
|
|
1277
|
-
wxml: "ttml",
|
|
1278
|
-
wxss: "ttss"
|
|
1279
|
-
}
|
|
1280
|
-
},
|
|
1281
|
-
{
|
|
1282
|
-
id: "jd",
|
|
1283
|
-
displayName: "JD Mini Program",
|
|
1284
|
-
aliases: ["jd", "jingdong"],
|
|
1285
|
-
outputExtensions: {
|
|
1286
|
-
js: "js",
|
|
1287
|
-
json: "json",
|
|
1288
|
-
wxml: "jxml",
|
|
1289
|
-
wxss: "jxss",
|
|
1290
|
-
wxs: "wxs"
|
|
1291
|
-
}
|
|
1292
|
-
},
|
|
1293
|
-
{
|
|
1294
|
-
id: "xhs",
|
|
1295
|
-
displayName: "Xiaohongshu Mini Program",
|
|
1296
|
-
aliases: ["xhs", "xiaohongshu", "little-red-book", "red"],
|
|
1297
|
-
outputExtensions: {
|
|
1298
|
-
js: "js",
|
|
1299
|
-
json: "json",
|
|
1300
|
-
wxml: "xhsml",
|
|
1301
|
-
wxss: "css",
|
|
1302
|
-
wxs: "wxs"
|
|
1303
|
-
}
|
|
1304
|
-
}
|
|
979
|
+
import fs3 from "fs-extra";
|
|
980
|
+
import path4 from "pathe";
|
|
981
|
+
var WEAPP_VITE_CONFIG_CANDIDATES = [
|
|
982
|
+
"weapp-vite.config.ts",
|
|
983
|
+
"weapp-vite.config.mts",
|
|
984
|
+
"weapp-vite.config.cts",
|
|
985
|
+
"weapp-vite.config.js",
|
|
986
|
+
"weapp-vite.config.mjs",
|
|
987
|
+
"weapp-vite.config.cjs",
|
|
988
|
+
"weapp-vite.config.json"
|
|
1305
989
|
];
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
PLATFORM_ADAPTER_BY_ID.set(adapter.id, adapter);
|
|
1313
|
-
for (const alias of adapter.aliases) {
|
|
1314
|
-
const normalized = alias.trim().toLowerCase();
|
|
1315
|
-
if (!normalized) {
|
|
1316
|
-
continue;
|
|
990
|
+
var WEAPP_VITE_CONFIG_SET = new Set(WEAPP_VITE_CONFIG_CANDIDATES);
|
|
991
|
+
async function findWeappConfigInDirectory(directory) {
|
|
992
|
+
for (const filename of WEAPP_VITE_CONFIG_CANDIDATES) {
|
|
993
|
+
const candidatePath = path4.resolve(directory, filename);
|
|
994
|
+
if (await fs3.pathExists(candidatePath)) {
|
|
995
|
+
return candidatePath;
|
|
1317
996
|
}
|
|
1318
|
-
PLATFORM_ALIAS_TO_ID.set(normalized, adapter.id);
|
|
1319
|
-
}
|
|
1320
|
-
if (!PLATFORM_ALIAS_TO_ID.has(adapter.id)) {
|
|
1321
|
-
PLATFORM_ALIAS_TO_ID.set(adapter.id, adapter.id);
|
|
1322
|
-
}
|
|
1323
|
-
}
|
|
1324
|
-
var MINI_PLATFORM_ALIASES = Object.freeze(
|
|
1325
|
-
Object.fromEntries(PLATFORM_ALIAS_TO_ID.entries())
|
|
1326
|
-
);
|
|
1327
|
-
function normalizeMiniPlatform(input) {
|
|
1328
|
-
return input ? input.trim().toLowerCase() : void 0;
|
|
1329
|
-
}
|
|
1330
|
-
function resolveMiniPlatform(input) {
|
|
1331
|
-
const normalized = normalizeMiniPlatform(input);
|
|
1332
|
-
if (!normalized) {
|
|
1333
|
-
return void 0;
|
|
1334
997
|
}
|
|
1335
|
-
return
|
|
998
|
+
return void 0;
|
|
1336
999
|
}
|
|
1337
|
-
function
|
|
1338
|
-
const
|
|
1339
|
-
if (
|
|
1340
|
-
|
|
1000
|
+
async function resolveWeappConfigFile(options) {
|
|
1001
|
+
const { root, specified } = options;
|
|
1002
|
+
if (specified) {
|
|
1003
|
+
const resolvedSpecified = path4.isAbsolute(specified) ? specified : path4.resolve(root, specified);
|
|
1004
|
+
const specifiedBaseName = path4.basename(resolvedSpecified);
|
|
1005
|
+
if (WEAPP_VITE_CONFIG_SET.has(specifiedBaseName)) {
|
|
1006
|
+
if (await fs3.pathExists(resolvedSpecified)) {
|
|
1007
|
+
return resolvedSpecified;
|
|
1008
|
+
}
|
|
1009
|
+
return void 0;
|
|
1010
|
+
}
|
|
1011
|
+
const fromSpecifiedDirectory = await findWeappConfigInDirectory(path4.dirname(resolvedSpecified));
|
|
1012
|
+
if (fromSpecifiedDirectory) {
|
|
1013
|
+
return fromSpecifiedDirectory;
|
|
1014
|
+
}
|
|
1341
1015
|
}
|
|
1342
|
-
return
|
|
1016
|
+
return findWeappConfigInDirectory(root);
|
|
1343
1017
|
}
|
|
1344
1018
|
|
|
1345
1019
|
// src/context/getInstance.ts
|
|
@@ -4483,7 +4157,7 @@ function createAutoRoutesServicePlugin(ctx) {
|
|
|
4483
4157
|
|
|
4484
4158
|
// src/runtime/buildPlugin.ts
|
|
4485
4159
|
init_esm_shims();
|
|
4486
|
-
import
|
|
4160
|
+
import fs6 from "fs";
|
|
4487
4161
|
import process3 from "process";
|
|
4488
4162
|
|
|
4489
4163
|
// ../../node_modules/.pnpm/chokidar@4.0.3/node_modules/chokidar/esm/index.js
|
|
@@ -6055,8 +5729,8 @@ var FSWatcher = class extends EventEmitter {
|
|
|
6055
5729
|
}
|
|
6056
5730
|
return this._userIgnored(path36, stats);
|
|
6057
5731
|
}
|
|
6058
|
-
_isntIgnored(path36,
|
|
6059
|
-
return !this._isIgnored(path36,
|
|
5732
|
+
_isntIgnored(path36, stat5) {
|
|
5733
|
+
return !this._isIgnored(path36, stat5);
|
|
6060
5734
|
}
|
|
6061
5735
|
/**
|
|
6062
5736
|
* Provides a set of common helpers and properties relating to symlink handling.
|
|
@@ -6183,32 +5857,246 @@ var esm_default = { watch, FSWatcher };
|
|
|
6183
5857
|
// src/runtime/buildPlugin.ts
|
|
6184
5858
|
import path11 from "pathe";
|
|
6185
5859
|
|
|
6186
|
-
// ../../node_modules/.pnpm/rimraf@6.0
|
|
5860
|
+
// ../../node_modules/.pnpm/rimraf@6.1.0/node_modules/rimraf/dist/esm/index.js
|
|
6187
5861
|
init_esm_shims();
|
|
6188
5862
|
|
|
6189
|
-
// ../../node_modules/.pnpm/glob@11.0.
|
|
5863
|
+
// ../../node_modules/.pnpm/glob@11.0.3/node_modules/glob/dist/esm/index.js
|
|
6190
5864
|
init_esm_shims();
|
|
6191
5865
|
|
|
6192
|
-
// ../../node_modules/.pnpm/minimatch@10.
|
|
5866
|
+
// ../../node_modules/.pnpm/minimatch@10.1.1/node_modules/minimatch/dist/esm/index.js
|
|
6193
5867
|
init_esm_shims();
|
|
6194
|
-
var import_brace_expansion = __toESM(require_brace_expansion(), 1);
|
|
6195
5868
|
|
|
6196
|
-
// ../../node_modules/.pnpm
|
|
5869
|
+
// ../../node_modules/.pnpm/@isaacs+brace-expansion@5.0.0/node_modules/@isaacs/brace-expansion/dist/esm/index.js
|
|
6197
5870
|
init_esm_shims();
|
|
6198
|
-
var MAX_PATTERN_LENGTH = 1024 * 64;
|
|
6199
|
-
var assertValidPattern = (pattern) => {
|
|
6200
|
-
if (typeof pattern !== "string") {
|
|
6201
|
-
throw new TypeError("invalid pattern");
|
|
6202
|
-
}
|
|
6203
|
-
if (pattern.length > MAX_PATTERN_LENGTH) {
|
|
6204
|
-
throw new TypeError("pattern is too long");
|
|
6205
|
-
}
|
|
6206
|
-
};
|
|
6207
5871
|
|
|
6208
|
-
// ../../node_modules/.pnpm
|
|
5872
|
+
// ../../node_modules/.pnpm/@isaacs+balanced-match@4.0.1/node_modules/@isaacs/balanced-match/dist/esm/index.js
|
|
5873
|
+
init_esm_shims();
|
|
5874
|
+
var balanced = (a, b, str) => {
|
|
5875
|
+
const ma = a instanceof RegExp ? maybeMatch(a, str) : a;
|
|
5876
|
+
const mb = b instanceof RegExp ? maybeMatch(b, str) : b;
|
|
5877
|
+
const r2 = ma !== null && mb != null && range(ma, mb, str);
|
|
5878
|
+
return r2 && {
|
|
5879
|
+
start: r2[0],
|
|
5880
|
+
end: r2[1],
|
|
5881
|
+
pre: str.slice(0, r2[0]),
|
|
5882
|
+
body: str.slice(r2[0] + ma.length, r2[1]),
|
|
5883
|
+
post: str.slice(r2[1] + mb.length)
|
|
5884
|
+
};
|
|
5885
|
+
};
|
|
5886
|
+
var maybeMatch = (reg, str) => {
|
|
5887
|
+
const m = str.match(reg);
|
|
5888
|
+
return m ? m[0] : null;
|
|
5889
|
+
};
|
|
5890
|
+
var range = (a, b, str) => {
|
|
5891
|
+
let begs, beg, left, right = void 0, result;
|
|
5892
|
+
let ai = str.indexOf(a);
|
|
5893
|
+
let bi = str.indexOf(b, ai + 1);
|
|
5894
|
+
let i = ai;
|
|
5895
|
+
if (ai >= 0 && bi > 0) {
|
|
5896
|
+
if (a === b) {
|
|
5897
|
+
return [ai, bi];
|
|
5898
|
+
}
|
|
5899
|
+
begs = [];
|
|
5900
|
+
left = str.length;
|
|
5901
|
+
while (i >= 0 && !result) {
|
|
5902
|
+
if (i === ai) {
|
|
5903
|
+
begs.push(i);
|
|
5904
|
+
ai = str.indexOf(a, i + 1);
|
|
5905
|
+
} else if (begs.length === 1) {
|
|
5906
|
+
const r2 = begs.pop();
|
|
5907
|
+
if (r2 !== void 0)
|
|
5908
|
+
result = [r2, bi];
|
|
5909
|
+
} else {
|
|
5910
|
+
beg = begs.pop();
|
|
5911
|
+
if (beg !== void 0 && beg < left) {
|
|
5912
|
+
left = beg;
|
|
5913
|
+
right = bi;
|
|
5914
|
+
}
|
|
5915
|
+
bi = str.indexOf(b, i + 1);
|
|
5916
|
+
}
|
|
5917
|
+
i = ai < bi && ai >= 0 ? ai : bi;
|
|
5918
|
+
}
|
|
5919
|
+
if (begs.length && right !== void 0) {
|
|
5920
|
+
result = [left, right];
|
|
5921
|
+
}
|
|
5922
|
+
}
|
|
5923
|
+
return result;
|
|
5924
|
+
};
|
|
5925
|
+
|
|
5926
|
+
// ../../node_modules/.pnpm/@isaacs+brace-expansion@5.0.0/node_modules/@isaacs/brace-expansion/dist/esm/index.js
|
|
5927
|
+
var escSlash = "\0SLASH" + Math.random() + "\0";
|
|
5928
|
+
var escOpen = "\0OPEN" + Math.random() + "\0";
|
|
5929
|
+
var escClose = "\0CLOSE" + Math.random() + "\0";
|
|
5930
|
+
var escComma = "\0COMMA" + Math.random() + "\0";
|
|
5931
|
+
var escPeriod = "\0PERIOD" + Math.random() + "\0";
|
|
5932
|
+
var escSlashPattern = new RegExp(escSlash, "g");
|
|
5933
|
+
var escOpenPattern = new RegExp(escOpen, "g");
|
|
5934
|
+
var escClosePattern = new RegExp(escClose, "g");
|
|
5935
|
+
var escCommaPattern = new RegExp(escComma, "g");
|
|
5936
|
+
var escPeriodPattern = new RegExp(escPeriod, "g");
|
|
5937
|
+
var slashPattern = /\\\\/g;
|
|
5938
|
+
var openPattern = /\\{/g;
|
|
5939
|
+
var closePattern = /\\}/g;
|
|
5940
|
+
var commaPattern = /\\,/g;
|
|
5941
|
+
var periodPattern = /\\./g;
|
|
5942
|
+
function numeric(str) {
|
|
5943
|
+
return !isNaN(str) ? parseInt(str, 10) : str.charCodeAt(0);
|
|
5944
|
+
}
|
|
5945
|
+
function escapeBraces(str) {
|
|
5946
|
+
return str.replace(slashPattern, escSlash).replace(openPattern, escOpen).replace(closePattern, escClose).replace(commaPattern, escComma).replace(periodPattern, escPeriod);
|
|
5947
|
+
}
|
|
5948
|
+
function unescapeBraces(str) {
|
|
5949
|
+
return str.replace(escSlashPattern, "\\").replace(escOpenPattern, "{").replace(escClosePattern, "}").replace(escCommaPattern, ",").replace(escPeriodPattern, ".");
|
|
5950
|
+
}
|
|
5951
|
+
function parseCommaParts(str) {
|
|
5952
|
+
if (!str) {
|
|
5953
|
+
return [""];
|
|
5954
|
+
}
|
|
5955
|
+
const parts = [];
|
|
5956
|
+
const m = balanced("{", "}", str);
|
|
5957
|
+
if (!m) {
|
|
5958
|
+
return str.split(",");
|
|
5959
|
+
}
|
|
5960
|
+
const { pre, body, post } = m;
|
|
5961
|
+
const p = pre.split(",");
|
|
5962
|
+
p[p.length - 1] += "{" + body + "}";
|
|
5963
|
+
const postParts = parseCommaParts(post);
|
|
5964
|
+
if (post.length) {
|
|
5965
|
+
;
|
|
5966
|
+
p[p.length - 1] += postParts.shift();
|
|
5967
|
+
p.push.apply(p, postParts);
|
|
5968
|
+
}
|
|
5969
|
+
parts.push.apply(parts, p);
|
|
5970
|
+
return parts;
|
|
5971
|
+
}
|
|
5972
|
+
function expand(str) {
|
|
5973
|
+
if (!str) {
|
|
5974
|
+
return [];
|
|
5975
|
+
}
|
|
5976
|
+
if (str.slice(0, 2) === "{}") {
|
|
5977
|
+
str = "\\{\\}" + str.slice(2);
|
|
5978
|
+
}
|
|
5979
|
+
return expand_(escapeBraces(str), true).map(unescapeBraces);
|
|
5980
|
+
}
|
|
5981
|
+
function embrace(str) {
|
|
5982
|
+
return "{" + str + "}";
|
|
5983
|
+
}
|
|
5984
|
+
function isPadded(el) {
|
|
5985
|
+
return /^-?0\d/.test(el);
|
|
5986
|
+
}
|
|
5987
|
+
function lte(i, y) {
|
|
5988
|
+
return i <= y;
|
|
5989
|
+
}
|
|
5990
|
+
function gte(i, y) {
|
|
5991
|
+
return i >= y;
|
|
5992
|
+
}
|
|
5993
|
+
function expand_(str, isTop) {
|
|
5994
|
+
const expansions = [];
|
|
5995
|
+
const m = balanced("{", "}", str);
|
|
5996
|
+
if (!m)
|
|
5997
|
+
return [str];
|
|
5998
|
+
const pre = m.pre;
|
|
5999
|
+
const post = m.post.length ? expand_(m.post, false) : [""];
|
|
6000
|
+
if (/\$$/.test(m.pre)) {
|
|
6001
|
+
for (let k = 0; k < post.length; k++) {
|
|
6002
|
+
const expansion = pre + "{" + m.body + "}" + post[k];
|
|
6003
|
+
expansions.push(expansion);
|
|
6004
|
+
}
|
|
6005
|
+
} else {
|
|
6006
|
+
const isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
|
6007
|
+
const isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
|
6008
|
+
const isSequence = isNumericSequence || isAlphaSequence;
|
|
6009
|
+
const isOptions = m.body.indexOf(",") >= 0;
|
|
6010
|
+
if (!isSequence && !isOptions) {
|
|
6011
|
+
if (m.post.match(/,(?!,).*\}/)) {
|
|
6012
|
+
str = m.pre + "{" + m.body + escClose + m.post;
|
|
6013
|
+
return expand_(str);
|
|
6014
|
+
}
|
|
6015
|
+
return [str];
|
|
6016
|
+
}
|
|
6017
|
+
let n2;
|
|
6018
|
+
if (isSequence) {
|
|
6019
|
+
n2 = m.body.split(/\.\./);
|
|
6020
|
+
} else {
|
|
6021
|
+
n2 = parseCommaParts(m.body);
|
|
6022
|
+
if (n2.length === 1 && n2[0] !== void 0) {
|
|
6023
|
+
n2 = expand_(n2[0], false).map(embrace);
|
|
6024
|
+
if (n2.length === 1) {
|
|
6025
|
+
return post.map((p) => m.pre + n2[0] + p);
|
|
6026
|
+
}
|
|
6027
|
+
}
|
|
6028
|
+
}
|
|
6029
|
+
let N;
|
|
6030
|
+
if (isSequence && n2[0] !== void 0 && n2[1] !== void 0) {
|
|
6031
|
+
const x = numeric(n2[0]);
|
|
6032
|
+
const y = numeric(n2[1]);
|
|
6033
|
+
const width = Math.max(n2[0].length, n2[1].length);
|
|
6034
|
+
let incr = n2.length === 3 && n2[2] !== void 0 ? Math.abs(numeric(n2[2])) : 1;
|
|
6035
|
+
let test = lte;
|
|
6036
|
+
const reverse = y < x;
|
|
6037
|
+
if (reverse) {
|
|
6038
|
+
incr *= -1;
|
|
6039
|
+
test = gte;
|
|
6040
|
+
}
|
|
6041
|
+
const pad = n2.some(isPadded);
|
|
6042
|
+
N = [];
|
|
6043
|
+
for (let i = x; test(i, y); i += incr) {
|
|
6044
|
+
let c;
|
|
6045
|
+
if (isAlphaSequence) {
|
|
6046
|
+
c = String.fromCharCode(i);
|
|
6047
|
+
if (c === "\\") {
|
|
6048
|
+
c = "";
|
|
6049
|
+
}
|
|
6050
|
+
} else {
|
|
6051
|
+
c = String(i);
|
|
6052
|
+
if (pad) {
|
|
6053
|
+
const need = width - c.length;
|
|
6054
|
+
if (need > 0) {
|
|
6055
|
+
const z = new Array(need + 1).join("0");
|
|
6056
|
+
if (i < 0) {
|
|
6057
|
+
c = "-" + z + c.slice(1);
|
|
6058
|
+
} else {
|
|
6059
|
+
c = z + c;
|
|
6060
|
+
}
|
|
6061
|
+
}
|
|
6062
|
+
}
|
|
6063
|
+
}
|
|
6064
|
+
N.push(c);
|
|
6065
|
+
}
|
|
6066
|
+
} else {
|
|
6067
|
+
N = [];
|
|
6068
|
+
for (let j = 0; j < n2.length; j++) {
|
|
6069
|
+
N.push.apply(N, expand_(n2[j], false));
|
|
6070
|
+
}
|
|
6071
|
+
}
|
|
6072
|
+
for (let j = 0; j < N.length; j++) {
|
|
6073
|
+
for (let k = 0; k < post.length; k++) {
|
|
6074
|
+
const expansion = pre + N[j] + post[k];
|
|
6075
|
+
if (!isTop || isSequence || expansion) {
|
|
6076
|
+
expansions.push(expansion);
|
|
6077
|
+
}
|
|
6078
|
+
}
|
|
6079
|
+
}
|
|
6080
|
+
}
|
|
6081
|
+
return expansions;
|
|
6082
|
+
}
|
|
6083
|
+
|
|
6084
|
+
// ../../node_modules/.pnpm/minimatch@10.1.1/node_modules/minimatch/dist/esm/assert-valid-pattern.js
|
|
6085
|
+
init_esm_shims();
|
|
6086
|
+
var MAX_PATTERN_LENGTH = 1024 * 64;
|
|
6087
|
+
var assertValidPattern = (pattern) => {
|
|
6088
|
+
if (typeof pattern !== "string") {
|
|
6089
|
+
throw new TypeError("invalid pattern");
|
|
6090
|
+
}
|
|
6091
|
+
if (pattern.length > MAX_PATTERN_LENGTH) {
|
|
6092
|
+
throw new TypeError("pattern is too long");
|
|
6093
|
+
}
|
|
6094
|
+
};
|
|
6095
|
+
|
|
6096
|
+
// ../../node_modules/.pnpm/minimatch@10.1.1/node_modules/minimatch/dist/esm/ast.js
|
|
6209
6097
|
init_esm_shims();
|
|
6210
6098
|
|
|
6211
|
-
// ../../node_modules/.pnpm/minimatch@10.
|
|
6099
|
+
// ../../node_modules/.pnpm/minimatch@10.1.1/node_modules/minimatch/dist/esm/brace-expressions.js
|
|
6212
6100
|
init_esm_shims();
|
|
6213
6101
|
var posixClasses = {
|
|
6214
6102
|
"[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", true],
|
|
@@ -6318,13 +6206,16 @@ var parseClass = (glob2, position) => {
|
|
|
6318
6206
|
return [comb, uflag, endPos - pos, true];
|
|
6319
6207
|
};
|
|
6320
6208
|
|
|
6321
|
-
// ../../node_modules/.pnpm/minimatch@10.
|
|
6209
|
+
// ../../node_modules/.pnpm/minimatch@10.1.1/node_modules/minimatch/dist/esm/unescape.js
|
|
6322
6210
|
init_esm_shims();
|
|
6323
|
-
var unescape2 = (s, { windowsPathsNoEscape = false } = {}) => {
|
|
6324
|
-
|
|
6211
|
+
var unescape2 = (s, { windowsPathsNoEscape = false, magicalBraces = true } = {}) => {
|
|
6212
|
+
if (magicalBraces) {
|
|
6213
|
+
return windowsPathsNoEscape ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1");
|
|
6214
|
+
}
|
|
6215
|
+
return windowsPathsNoEscape ? s.replace(/\[([^\/\\{}])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\{}])\]/g, "$1$2").replace(/\\([^\/{}])/g, "$1");
|
|
6325
6216
|
};
|
|
6326
6217
|
|
|
6327
|
-
// ../../node_modules/.pnpm/minimatch@10.
|
|
6218
|
+
// ../../node_modules/.pnpm/minimatch@10.1.1/node_modules/minimatch/dist/esm/ast.js
|
|
6328
6219
|
var types = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
|
|
6329
6220
|
var isExtglobType = (c) => types.has(c);
|
|
6330
6221
|
var startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))";
|
|
@@ -6675,7 +6566,7 @@ var AST = class _AST {
|
|
|
6675
6566
|
if (this.#root === this)
|
|
6676
6567
|
this.#fillNegs();
|
|
6677
6568
|
if (!this.type) {
|
|
6678
|
-
const noEmpty = this.isStart() && this.isEnd();
|
|
6569
|
+
const noEmpty = this.isStart() && this.isEnd() && !this.#parts.some((s) => typeof s !== "string");
|
|
6679
6570
|
const src = this.#parts.map((p) => {
|
|
6680
6571
|
const [re, _, hasMagic2, uflag] = typeof p === "string" ? _AST.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
|
|
6681
6572
|
this.#hasMagic = this.#hasMagic || hasMagic2;
|
|
@@ -6785,10 +6676,7 @@ var AST = class _AST {
|
|
|
6785
6676
|
}
|
|
6786
6677
|
}
|
|
6787
6678
|
if (c === "*") {
|
|
6788
|
-
|
|
6789
|
-
re += starNoEmpty;
|
|
6790
|
-
else
|
|
6791
|
-
re += star;
|
|
6679
|
+
re += noEmpty && glob2 === "*" ? starNoEmpty : star;
|
|
6792
6680
|
hasMagic2 = true;
|
|
6793
6681
|
continue;
|
|
6794
6682
|
}
|
|
@@ -6803,13 +6691,16 @@ var AST = class _AST {
|
|
|
6803
6691
|
}
|
|
6804
6692
|
};
|
|
6805
6693
|
|
|
6806
|
-
// ../../node_modules/.pnpm/minimatch@10.
|
|
6694
|
+
// ../../node_modules/.pnpm/minimatch@10.1.1/node_modules/minimatch/dist/esm/escape.js
|
|
6807
6695
|
init_esm_shims();
|
|
6808
|
-
var escape = (s, { windowsPathsNoEscape = false } = {}) => {
|
|
6696
|
+
var escape = (s, { windowsPathsNoEscape = false, magicalBraces = false } = {}) => {
|
|
6697
|
+
if (magicalBraces) {
|
|
6698
|
+
return windowsPathsNoEscape ? s.replace(/[?*()[\]{}]/g, "[$&]") : s.replace(/[?*()[\]\\{}]/g, "\\$&");
|
|
6699
|
+
}
|
|
6809
6700
|
return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
|
|
6810
6701
|
};
|
|
6811
6702
|
|
|
6812
|
-
// ../../node_modules/.pnpm/minimatch@10.
|
|
6703
|
+
// ../../node_modules/.pnpm/minimatch@10.1.1/node_modules/minimatch/dist/esm/index.js
|
|
6813
6704
|
var minimatch = (p, pattern, options = {}) => {
|
|
6814
6705
|
assertValidPattern(pattern);
|
|
6815
6706
|
if (!options.nocomment && pattern.charAt(0) === "#") {
|
|
@@ -6925,7 +6816,7 @@ var braceExpand = (pattern, options = {}) => {
|
|
|
6925
6816
|
if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
|
|
6926
6817
|
return [pattern];
|
|
6927
6818
|
}
|
|
6928
|
-
return (
|
|
6819
|
+
return expand(pattern);
|
|
6929
6820
|
};
|
|
6930
6821
|
minimatch.braceExpand = braceExpand;
|
|
6931
6822
|
var makeRe = (pattern, options = {}) => new Minimatch(pattern, options).makeRe();
|
|
@@ -7446,16 +7337,27 @@ var Minimatch = class {
|
|
|
7446
7337
|
pp2[i] = twoStar;
|
|
7447
7338
|
}
|
|
7448
7339
|
} else if (next === void 0) {
|
|
7449
|
-
pp2[i - 1] = prev + "(
|
|
7340
|
+
pp2[i - 1] = prev + "(?:\\/|\\/" + twoStar + ")?";
|
|
7450
7341
|
} else if (next !== GLOBSTAR) {
|
|
7451
7342
|
pp2[i - 1] = prev + "(?:\\/|\\/" + twoStar + "\\/)" + next;
|
|
7452
7343
|
pp2[i + 1] = GLOBSTAR;
|
|
7453
7344
|
}
|
|
7454
7345
|
});
|
|
7455
|
-
|
|
7346
|
+
const filtered = pp2.filter((p) => p !== GLOBSTAR);
|
|
7347
|
+
if (this.partial && filtered.length >= 1) {
|
|
7348
|
+
const prefixes = [];
|
|
7349
|
+
for (let i = 1; i <= filtered.length; i++) {
|
|
7350
|
+
prefixes.push(filtered.slice(0, i).join("/"));
|
|
7351
|
+
}
|
|
7352
|
+
return "(?:" + prefixes.join("|") + ")";
|
|
7353
|
+
}
|
|
7354
|
+
return filtered.join("/");
|
|
7456
7355
|
}).join("|");
|
|
7457
7356
|
const [open2, close] = set3.length > 1 ? ["(?:", ")"] : ["", ""];
|
|
7458
7357
|
re = "^" + open2 + re + close + "$";
|
|
7358
|
+
if (this.partial) {
|
|
7359
|
+
re = "^(?:\\/|" + open2 + re.slice(1, -1) + close + ")$";
|
|
7360
|
+
}
|
|
7459
7361
|
if (this.negate)
|
|
7460
7362
|
re = "^(?!" + re + ").+$";
|
|
7461
7363
|
try {
|
|
@@ -7527,7 +7429,7 @@ minimatch.Minimatch = Minimatch;
|
|
|
7527
7429
|
minimatch.escape = escape;
|
|
7528
7430
|
minimatch.unescape = unescape2;
|
|
7529
7431
|
|
|
7530
|
-
// ../../node_modules/.pnpm/glob@11.0.
|
|
7432
|
+
// ../../node_modules/.pnpm/glob@11.0.3/node_modules/glob/dist/esm/glob.js
|
|
7531
7433
|
init_esm_shims();
|
|
7532
7434
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
7533
7435
|
|
|
@@ -9537,8 +9439,8 @@ var PathScurryBase = class {
|
|
|
9537
9439
|
*
|
|
9538
9440
|
* @internal
|
|
9539
9441
|
*/
|
|
9540
|
-
constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs:
|
|
9541
|
-
this.#fs = fsFromOption(
|
|
9442
|
+
constructor(cwd = process.cwd(), pathImpl, sep2, { nocase, childrenCacheSize = 16 * 1024, fs: fs25 = defaultFS } = {}) {
|
|
9443
|
+
this.#fs = fsFromOption(fs25);
|
|
9542
9444
|
if (cwd instanceof URL || cwd.startsWith("file://")) {
|
|
9543
9445
|
cwd = fileURLToPath(cwd);
|
|
9544
9446
|
}
|
|
@@ -10096,8 +9998,8 @@ var PathScurryWin32 = class extends PathScurryBase {
|
|
|
10096
9998
|
/**
|
|
10097
9999
|
* @internal
|
|
10098
10000
|
*/
|
|
10099
|
-
newRoot(
|
|
10100
|
-
return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs:
|
|
10001
|
+
newRoot(fs25) {
|
|
10002
|
+
return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs25 });
|
|
10101
10003
|
}
|
|
10102
10004
|
/**
|
|
10103
10005
|
* Return true if the provided path string is an absolute path
|
|
@@ -10125,8 +10027,8 @@ var PathScurryPosix = class extends PathScurryBase {
|
|
|
10125
10027
|
/**
|
|
10126
10028
|
* @internal
|
|
10127
10029
|
*/
|
|
10128
|
-
newRoot(
|
|
10129
|
-
return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs:
|
|
10030
|
+
newRoot(fs25) {
|
|
10031
|
+
return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs25 });
|
|
10130
10032
|
}
|
|
10131
10033
|
/**
|
|
10132
10034
|
* Return true if the provided path string is an absolute path
|
|
@@ -10144,7 +10046,7 @@ var PathScurryDarwin = class extends PathScurryPosix {
|
|
|
10144
10046
|
var Path = process.platform === "win32" ? PathWin32 : PathPosix;
|
|
10145
10047
|
var PathScurry = process.platform === "win32" ? PathScurryWin32 : process.platform === "darwin" ? PathScurryDarwin : PathScurryPosix;
|
|
10146
10048
|
|
|
10147
|
-
// ../../node_modules/.pnpm/glob@11.0.
|
|
10049
|
+
// ../../node_modules/.pnpm/glob@11.0.3/node_modules/glob/dist/esm/pattern.js
|
|
10148
10050
|
init_esm_shims();
|
|
10149
10051
|
var isPatternList = (pl2) => pl2.length >= 1;
|
|
10150
10052
|
var isGlobList = (gl) => gl.length >= 1;
|
|
@@ -10310,10 +10212,10 @@ var Pattern = class _Pattern {
|
|
|
10310
10212
|
}
|
|
10311
10213
|
};
|
|
10312
10214
|
|
|
10313
|
-
// ../../node_modules/.pnpm/glob@11.0.
|
|
10215
|
+
// ../../node_modules/.pnpm/glob@11.0.3/node_modules/glob/dist/esm/walker.js
|
|
10314
10216
|
init_esm_shims();
|
|
10315
10217
|
|
|
10316
|
-
// ../../node_modules/.pnpm/glob@11.0.
|
|
10218
|
+
// ../../node_modules/.pnpm/glob@11.0.3/node_modules/glob/dist/esm/ignore.js
|
|
10317
10219
|
init_esm_shims();
|
|
10318
10220
|
var defaultPlatform2 = typeof process === "object" && process && typeof process.platform === "string" ? process.platform : "linux";
|
|
10319
10221
|
var Ignore = class {
|
|
@@ -10401,7 +10303,7 @@ var Ignore = class {
|
|
|
10401
10303
|
}
|
|
10402
10304
|
};
|
|
10403
10305
|
|
|
10404
|
-
// ../../node_modules/.pnpm/glob@11.0.
|
|
10306
|
+
// ../../node_modules/.pnpm/glob@11.0.3/node_modules/glob/dist/esm/processor.js
|
|
10405
10307
|
init_esm_shims();
|
|
10406
10308
|
var HasWalkedCache = class _HasWalkedCache {
|
|
10407
10309
|
store;
|
|
@@ -10623,7 +10525,7 @@ var Processor = class _Processor {
|
|
|
10623
10525
|
}
|
|
10624
10526
|
};
|
|
10625
10527
|
|
|
10626
|
-
// ../../node_modules/.pnpm/glob@11.0.
|
|
10528
|
+
// ../../node_modules/.pnpm/glob@11.0.3/node_modules/glob/dist/esm/walker.js
|
|
10627
10529
|
var makeIgnore = (ignore, opts) => typeof ignore === "string" ? new Ignore([ignore], opts) : Array.isArray(ignore) ? new Ignore(ignore, opts) : ignore;
|
|
10628
10530
|
var GlobUtil = class {
|
|
10629
10531
|
path;
|
|
@@ -10950,7 +10852,7 @@ var GlobStream = class extends GlobUtil {
|
|
|
10950
10852
|
}
|
|
10951
10853
|
};
|
|
10952
10854
|
|
|
10953
|
-
// ../../node_modules/.pnpm/glob@11.0.
|
|
10855
|
+
// ../../node_modules/.pnpm/glob@11.0.3/node_modules/glob/dist/esm/glob.js
|
|
10954
10856
|
var defaultPlatform3 = typeof process === "object" && process && typeof process.platform === "string" ? process.platform : "linux";
|
|
10955
10857
|
var Glob = class {
|
|
10956
10858
|
absolute;
|
|
@@ -11150,7 +11052,7 @@ var Glob = class {
|
|
|
11150
11052
|
}
|
|
11151
11053
|
};
|
|
11152
11054
|
|
|
11153
|
-
// ../../node_modules/.pnpm/glob@11.0.
|
|
11055
|
+
// ../../node_modules/.pnpm/glob@11.0.3/node_modules/glob/dist/esm/has-magic.js
|
|
11154
11056
|
init_esm_shims();
|
|
11155
11057
|
var hasMagic = (pattern, options = {}) => {
|
|
11156
11058
|
if (!Array.isArray(pattern)) {
|
|
@@ -11163,7 +11065,7 @@ var hasMagic = (pattern, options = {}) => {
|
|
|
11163
11065
|
return false;
|
|
11164
11066
|
};
|
|
11165
11067
|
|
|
11166
|
-
// ../../node_modules/.pnpm/glob@11.0.
|
|
11068
|
+
// ../../node_modules/.pnpm/glob@11.0.3/node_modules/glob/dist/esm/index.js
|
|
11167
11069
|
function globStreamSync(pattern, options = {}) {
|
|
11168
11070
|
return new Glob(pattern, options).streamSync();
|
|
11169
11071
|
}
|
|
@@ -11211,7 +11113,7 @@ var glob = Object.assign(glob_, {
|
|
|
11211
11113
|
});
|
|
11212
11114
|
glob.glob = glob;
|
|
11213
11115
|
|
|
11214
|
-
// ../../node_modules/.pnpm/rimraf@6.0
|
|
11116
|
+
// ../../node_modules/.pnpm/rimraf@6.1.0/node_modules/rimraf/dist/esm/opt-arg.js
|
|
11215
11117
|
init_esm_shims();
|
|
11216
11118
|
var typeOrUndef = (val, t2) => typeof val === "undefined" || typeof val === t2;
|
|
11217
11119
|
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");
|
|
@@ -11244,16 +11146,10 @@ var optArgT = (opt) => {
|
|
|
11244
11146
|
var optArg = (opt = {}) => optArgT(opt);
|
|
11245
11147
|
var optArgSync = (opt = {}) => optArgT(opt);
|
|
11246
11148
|
|
|
11247
|
-
// ../../node_modules/.pnpm/rimraf@6.0
|
|
11149
|
+
// ../../node_modules/.pnpm/rimraf@6.1.0/node_modules/rimraf/dist/esm/path-arg.js
|
|
11248
11150
|
init_esm_shims();
|
|
11249
11151
|
import { parse as parse2, resolve as resolve3 } from "path";
|
|
11250
11152
|
import { inspect } from "util";
|
|
11251
|
-
|
|
11252
|
-
// ../../node_modules/.pnpm/rimraf@6.0.1/node_modules/rimraf/dist/esm/platform.js
|
|
11253
|
-
init_esm_shims();
|
|
11254
|
-
var platform_default = process.env.__TESTING_RIMRAF_PLATFORM__ || process.platform;
|
|
11255
|
-
|
|
11256
|
-
// ../../node_modules/.pnpm/rimraf@6.0.1/node_modules/rimraf/dist/esm/path-arg.js
|
|
11257
11153
|
var pathArg = (path36, opt = {}) => {
|
|
11258
11154
|
const type = typeof path36;
|
|
11259
11155
|
if (type !== "string") {
|
|
@@ -11281,7 +11177,7 @@ var pathArg = (path36, opt = {}) => {
|
|
|
11281
11177
|
code: "ERR_PRESERVE_ROOT"
|
|
11282
11178
|
});
|
|
11283
11179
|
}
|
|
11284
|
-
if (
|
|
11180
|
+
if (process.platform === "win32") {
|
|
11285
11181
|
const badWinChars = /[*|"<>?:]/;
|
|
11286
11182
|
const { root: root2 } = parse2(path36);
|
|
11287
11183
|
if (badWinChars.test(path36.substring(root2.length))) {
|
|
@@ -11295,46 +11191,37 @@ var pathArg = (path36, opt = {}) => {
|
|
|
11295
11191
|
};
|
|
11296
11192
|
var path_arg_default = pathArg;
|
|
11297
11193
|
|
|
11298
|
-
// ../../node_modules/.pnpm/rimraf@6.0
|
|
11194
|
+
// ../../node_modules/.pnpm/rimraf@6.1.0/node_modules/rimraf/dist/esm/rimraf-manual.js
|
|
11299
11195
|
init_esm_shims();
|
|
11300
11196
|
|
|
11301
|
-
// ../../node_modules/.pnpm/rimraf@6.0
|
|
11197
|
+
// ../../node_modules/.pnpm/rimraf@6.1.0/node_modules/rimraf/dist/esm/rimraf-posix.js
|
|
11302
11198
|
init_esm_shims();
|
|
11303
11199
|
|
|
11304
|
-
// ../../node_modules/.pnpm/rimraf@6.0
|
|
11200
|
+
// ../../node_modules/.pnpm/rimraf@6.1.0/node_modules/rimraf/dist/esm/fs.js
|
|
11305
11201
|
init_esm_shims();
|
|
11306
|
-
import fs6 from "fs";
|
|
11307
|
-
import { chmodSync, mkdirSync, renameSync, rmdirSync, rmSync, statSync, lstatSync as lstatSync2, unlinkSync } from "fs";
|
|
11308
11202
|
import { readdirSync as rdSync } from "fs";
|
|
11203
|
+
import fsPromises from "fs/promises";
|
|
11204
|
+
import { chmodSync, mkdirSync, renameSync, rmdirSync, rmSync, statSync, lstatSync as lstatSync2, unlinkSync } from "fs";
|
|
11309
11205
|
var readdirSync2 = (path36) => rdSync(path36, { withFileTypes: true });
|
|
11310
|
-
var chmod = (path36, mode) => new Promise((res, rej) => fs6.chmod(path36, mode, (er, ...d) => er ? rej(er) : res(...d)));
|
|
11311
|
-
var mkdir = (path36, options) => new Promise((res, rej) => fs6.mkdir(path36, options, (er, made) => er ? rej(er) : res(made)));
|
|
11312
|
-
var readdir4 = (path36) => new Promise((res, rej) => fs6.readdir(path36, { withFileTypes: true }, (er, data2) => er ? rej(er) : res(data2)));
|
|
11313
|
-
var rename = (oldPath, newPath) => new Promise((res, rej) => fs6.rename(oldPath, newPath, (er, ...d) => er ? rej(er) : res(...d)));
|
|
11314
|
-
var rm = (path36, options) => new Promise((res, rej) => fs6.rm(path36, options, (er, ...d) => er ? rej(er) : res(...d)));
|
|
11315
|
-
var rmdir = (path36) => new Promise((res, rej) => fs6.rmdir(path36, (er, ...d) => er ? rej(er) : res(...d)));
|
|
11316
|
-
var stat4 = (path36) => new Promise((res, rej) => fs6.stat(path36, (er, data2) => er ? rej(er) : res(data2)));
|
|
11317
|
-
var lstat4 = (path36) => new Promise((res, rej) => fs6.lstat(path36, (er, data2) => er ? rej(er) : res(data2)));
|
|
11318
|
-
var unlink = (path36) => new Promise((res, rej) => fs6.unlink(path36, (er, ...d) => er ? rej(er) : res(...d)));
|
|
11319
11206
|
var promises = {
|
|
11320
|
-
chmod,
|
|
11321
|
-
mkdir,
|
|
11322
|
-
readdir:
|
|
11323
|
-
rename,
|
|
11324
|
-
rm,
|
|
11325
|
-
rmdir,
|
|
11326
|
-
stat:
|
|
11327
|
-
lstat:
|
|
11328
|
-
unlink
|
|
11207
|
+
chmod: fsPromises.chmod,
|
|
11208
|
+
mkdir: fsPromises.mkdir,
|
|
11209
|
+
readdir: (path36) => fsPromises.readdir(path36, { withFileTypes: true }),
|
|
11210
|
+
rename: fsPromises.rename,
|
|
11211
|
+
rm: fsPromises.rm,
|
|
11212
|
+
rmdir: fsPromises.rmdir,
|
|
11213
|
+
stat: fsPromises.stat,
|
|
11214
|
+
lstat: fsPromises.lstat,
|
|
11215
|
+
unlink: fsPromises.unlink
|
|
11329
11216
|
};
|
|
11330
11217
|
|
|
11331
|
-
// ../../node_modules/.pnpm/rimraf@6.0
|
|
11218
|
+
// ../../node_modules/.pnpm/rimraf@6.1.0/node_modules/rimraf/dist/esm/rimraf-posix.js
|
|
11332
11219
|
import { parse as parse3, resolve as resolve4 } from "path";
|
|
11333
11220
|
|
|
11334
|
-
// ../../node_modules/.pnpm/rimraf@6.0
|
|
11221
|
+
// ../../node_modules/.pnpm/rimraf@6.1.0/node_modules/rimraf/dist/esm/readdir-or-error.js
|
|
11335
11222
|
init_esm_shims();
|
|
11336
|
-
var { readdir:
|
|
11337
|
-
var readdirOrError = (path36) =>
|
|
11223
|
+
var { readdir: readdir4 } = promises;
|
|
11224
|
+
var readdirOrError = (path36) => readdir4(path36).catch((er) => er);
|
|
11338
11225
|
var readdirOrErrorSync = (path36) => {
|
|
11339
11226
|
try {
|
|
11340
11227
|
return readdirSync2(path36);
|
|
@@ -11343,70 +11230,63 @@ var readdirOrErrorSync = (path36) => {
|
|
|
11343
11230
|
}
|
|
11344
11231
|
};
|
|
11345
11232
|
|
|
11346
|
-
// ../../node_modules/.pnpm/rimraf@6.0
|
|
11233
|
+
// ../../node_modules/.pnpm/rimraf@6.1.0/node_modules/rimraf/dist/esm/ignore-enoent.js
|
|
11347
11234
|
init_esm_shims();
|
|
11348
|
-
|
|
11349
|
-
|
|
11350
|
-
|
|
11235
|
+
|
|
11236
|
+
// ../../node_modules/.pnpm/rimraf@6.1.0/node_modules/rimraf/dist/esm/error.js
|
|
11237
|
+
init_esm_shims();
|
|
11238
|
+
var isRecord = (o) => !!o && typeof o === "object";
|
|
11239
|
+
var hasString = (o, key) => key in o && typeof o[key] === "string";
|
|
11240
|
+
var isFsError = (o) => isRecord(o) && hasString(o, "code") && hasString(o, "path");
|
|
11241
|
+
var errorCode = (er) => isRecord(er) && hasString(er, "code") ? er.code : null;
|
|
11242
|
+
|
|
11243
|
+
// ../../node_modules/.pnpm/rimraf@6.1.0/node_modules/rimraf/dist/esm/ignore-enoent.js
|
|
11244
|
+
var ignoreENOENT = async (p, rethrow) => p.catch((er) => {
|
|
11245
|
+
if (errorCode(er) === "ENOENT") {
|
|
11246
|
+
return;
|
|
11351
11247
|
}
|
|
11248
|
+
throw rethrow ?? er;
|
|
11352
11249
|
});
|
|
11353
|
-
var ignoreENOENTSync = (fn) => {
|
|
11250
|
+
var ignoreENOENTSync = (fn, rethrow) => {
|
|
11354
11251
|
try {
|
|
11355
11252
|
return fn();
|
|
11356
11253
|
} catch (er) {
|
|
11357
|
-
if (er
|
|
11358
|
-
|
|
11254
|
+
if (errorCode(er) === "ENOENT") {
|
|
11255
|
+
return;
|
|
11359
11256
|
}
|
|
11257
|
+
throw rethrow ?? er;
|
|
11360
11258
|
}
|
|
11361
11259
|
};
|
|
11362
11260
|
|
|
11363
|
-
// ../../node_modules/.pnpm/rimraf@6.0
|
|
11364
|
-
var { lstat:
|
|
11261
|
+
// ../../node_modules/.pnpm/rimraf@6.1.0/node_modules/rimraf/dist/esm/rimraf-posix.js
|
|
11262
|
+
var { lstat: lstat4, rmdir, unlink } = promises;
|
|
11365
11263
|
var rimrafPosix = async (path36, opt) => {
|
|
11366
|
-
|
|
11367
|
-
|
|
11368
|
-
}
|
|
11369
|
-
try {
|
|
11370
|
-
return await rimrafPosixDir(path36, opt, await lstat5(path36));
|
|
11371
|
-
} catch (er) {
|
|
11372
|
-
if (er?.code === "ENOENT")
|
|
11373
|
-
return true;
|
|
11374
|
-
throw er;
|
|
11375
|
-
}
|
|
11264
|
+
opt?.signal?.throwIfAborted();
|
|
11265
|
+
return await ignoreENOENT(lstat4(path36).then((stat5) => rimrafPosixDir(path36, opt, stat5))) ?? true;
|
|
11376
11266
|
};
|
|
11377
11267
|
var rimrafPosixSync = (path36, opt) => {
|
|
11378
|
-
|
|
11379
|
-
|
|
11380
|
-
}
|
|
11381
|
-
try {
|
|
11382
|
-
return rimrafPosixDirSync(path36, opt, lstatSync2(path36));
|
|
11383
|
-
} catch (er) {
|
|
11384
|
-
if (er?.code === "ENOENT")
|
|
11385
|
-
return true;
|
|
11386
|
-
throw er;
|
|
11387
|
-
}
|
|
11268
|
+
opt?.signal?.throwIfAborted();
|
|
11269
|
+
return ignoreENOENTSync(() => rimrafPosixDirSync(path36, opt, lstatSync2(path36))) ?? true;
|
|
11388
11270
|
};
|
|
11389
11271
|
var rimrafPosixDir = async (path36, opt, ent) => {
|
|
11390
|
-
|
|
11391
|
-
throw opt.signal.reason;
|
|
11392
|
-
}
|
|
11272
|
+
opt?.signal?.throwIfAborted();
|
|
11393
11273
|
const entries = ent.isDirectory() ? await readdirOrError(path36) : null;
|
|
11394
11274
|
if (!Array.isArray(entries)) {
|
|
11395
11275
|
if (entries) {
|
|
11396
|
-
if (entries
|
|
11276
|
+
if (errorCode(entries) === "ENOENT") {
|
|
11397
11277
|
return true;
|
|
11398
11278
|
}
|
|
11399
|
-
if (entries
|
|
11279
|
+
if (errorCode(entries) !== "ENOTDIR") {
|
|
11400
11280
|
throw entries;
|
|
11401
11281
|
}
|
|
11402
11282
|
}
|
|
11403
11283
|
if (opt.filter && !await opt.filter(path36, ent)) {
|
|
11404
11284
|
return false;
|
|
11405
11285
|
}
|
|
11406
|
-
await ignoreENOENT(
|
|
11286
|
+
await ignoreENOENT(unlink(path36));
|
|
11407
11287
|
return true;
|
|
11408
11288
|
}
|
|
11409
|
-
const removedAll = (await Promise.all(entries.map((ent2) => rimrafPosixDir(resolve4(path36, ent2.name), opt, ent2)))).
|
|
11289
|
+
const removedAll = (await Promise.all(entries.map((ent2) => rimrafPosixDir(resolve4(path36, ent2.name), opt, ent2)))).every((v) => v === true);
|
|
11410
11290
|
if (!removedAll) {
|
|
11411
11291
|
return false;
|
|
11412
11292
|
}
|
|
@@ -11416,20 +11296,18 @@ var rimrafPosixDir = async (path36, opt, ent) => {
|
|
|
11416
11296
|
if (opt.filter && !await opt.filter(path36, ent)) {
|
|
11417
11297
|
return false;
|
|
11418
11298
|
}
|
|
11419
|
-
await ignoreENOENT(
|
|
11299
|
+
await ignoreENOENT(rmdir(path36));
|
|
11420
11300
|
return true;
|
|
11421
11301
|
};
|
|
11422
11302
|
var rimrafPosixDirSync = (path36, opt, ent) => {
|
|
11423
|
-
|
|
11424
|
-
throw opt.signal.reason;
|
|
11425
|
-
}
|
|
11303
|
+
opt?.signal?.throwIfAborted();
|
|
11426
11304
|
const entries = ent.isDirectory() ? readdirOrErrorSync(path36) : null;
|
|
11427
11305
|
if (!Array.isArray(entries)) {
|
|
11428
11306
|
if (entries) {
|
|
11429
|
-
if (entries
|
|
11307
|
+
if (errorCode(entries) === "ENOENT") {
|
|
11430
11308
|
return true;
|
|
11431
11309
|
}
|
|
11432
|
-
if (entries
|
|
11310
|
+
if (errorCode(entries) !== "ENOTDIR") {
|
|
11433
11311
|
throw entries;
|
|
11434
11312
|
}
|
|
11435
11313
|
}
|
|
@@ -11457,62 +11335,43 @@ var rimrafPosixDirSync = (path36, opt, ent) => {
|
|
|
11457
11335
|
return true;
|
|
11458
11336
|
};
|
|
11459
11337
|
|
|
11460
|
-
// ../../node_modules/.pnpm/rimraf@6.0
|
|
11338
|
+
// ../../node_modules/.pnpm/rimraf@6.1.0/node_modules/rimraf/dist/esm/rimraf-windows.js
|
|
11461
11339
|
init_esm_shims();
|
|
11462
11340
|
import { parse as parse6, resolve as resolve7 } from "path";
|
|
11463
11341
|
|
|
11464
|
-
// ../../node_modules/.pnpm/rimraf@6.0
|
|
11342
|
+
// ../../node_modules/.pnpm/rimraf@6.1.0/node_modules/rimraf/dist/esm/fix-eperm.js
|
|
11465
11343
|
init_esm_shims();
|
|
11466
|
-
var { chmod
|
|
11344
|
+
var { chmod } = promises;
|
|
11467
11345
|
var fixEPERM = (fn) => async (path36) => {
|
|
11468
11346
|
try {
|
|
11469
|
-
return await fn(path36);
|
|
11347
|
+
return void await ignoreENOENT(fn(path36));
|
|
11470
11348
|
} catch (er) {
|
|
11471
|
-
|
|
11472
|
-
|
|
11473
|
-
|
|
11474
|
-
}
|
|
11475
|
-
if (fer?.code === "EPERM") {
|
|
11476
|
-
try {
|
|
11477
|
-
await chmod2(path36, 438);
|
|
11478
|
-
} catch (er2) {
|
|
11479
|
-
const fer2 = er2;
|
|
11480
|
-
if (fer2?.code === "ENOENT") {
|
|
11481
|
-
return;
|
|
11482
|
-
}
|
|
11483
|
-
throw er;
|
|
11349
|
+
if (errorCode(er) === "EPERM") {
|
|
11350
|
+
if (!await ignoreENOENT(chmod(path36, 438).then(() => true), er)) {
|
|
11351
|
+
return;
|
|
11484
11352
|
}
|
|
11485
|
-
return await fn(path36);
|
|
11353
|
+
return void await fn(path36);
|
|
11486
11354
|
}
|
|
11487
11355
|
throw er;
|
|
11488
11356
|
}
|
|
11489
11357
|
};
|
|
11490
11358
|
var fixEPERMSync = (fn) => (path36) => {
|
|
11491
11359
|
try {
|
|
11492
|
-
return fn(path36);
|
|
11360
|
+
return void ignoreENOENTSync(() => fn(path36));
|
|
11493
11361
|
} catch (er) {
|
|
11494
|
-
|
|
11495
|
-
|
|
11496
|
-
|
|
11497
|
-
}
|
|
11498
|
-
if (fer?.code === "EPERM") {
|
|
11499
|
-
try {
|
|
11500
|
-
chmodSync(path36, 438);
|
|
11501
|
-
} catch (er2) {
|
|
11502
|
-
const fer2 = er2;
|
|
11503
|
-
if (fer2?.code === "ENOENT") {
|
|
11504
|
-
return;
|
|
11505
|
-
}
|
|
11506
|
-
throw er;
|
|
11362
|
+
if (errorCode(er) === "EPERM") {
|
|
11363
|
+
if (!ignoreENOENTSync(() => (chmodSync(path36, 438), true), er)) {
|
|
11364
|
+
return;
|
|
11507
11365
|
}
|
|
11508
|
-
return fn(path36);
|
|
11366
|
+
return void fn(path36);
|
|
11509
11367
|
}
|
|
11510
11368
|
throw er;
|
|
11511
11369
|
}
|
|
11512
11370
|
};
|
|
11513
11371
|
|
|
11514
|
-
// ../../node_modules/.pnpm/rimraf@6.0
|
|
11372
|
+
// ../../node_modules/.pnpm/rimraf@6.1.0/node_modules/rimraf/dist/esm/retry-busy.js
|
|
11515
11373
|
init_esm_shims();
|
|
11374
|
+
import { setTimeout as setTimeout2 } from "timers/promises";
|
|
11516
11375
|
var MAXBACKOFF = 200;
|
|
11517
11376
|
var RATE = 1.2;
|
|
11518
11377
|
var MAXRETRIES = 10;
|
|
@@ -11527,16 +11386,12 @@ var retryBusy = (fn) => {
|
|
|
11527
11386
|
try {
|
|
11528
11387
|
return await fn(path36);
|
|
11529
11388
|
} catch (er) {
|
|
11530
|
-
|
|
11531
|
-
if (fer?.path === path36 && fer?.code && codes.has(fer.code)) {
|
|
11389
|
+
if (isFsError(er) && er.path === path36 && codes.has(er.code)) {
|
|
11532
11390
|
backoff = Math.ceil(backoff * rate);
|
|
11533
11391
|
total = backoff + total;
|
|
11534
11392
|
if (total < mbo) {
|
|
11535
|
-
|
|
11536
|
-
|
|
11537
|
-
method(path36, opt, backoff, total).then(res, rej);
|
|
11538
|
-
}, backoff);
|
|
11539
|
-
});
|
|
11393
|
+
await setTimeout2(backoff);
|
|
11394
|
+
return method(path36, opt, backoff, total);
|
|
11540
11395
|
}
|
|
11541
11396
|
if (retries < max) {
|
|
11542
11397
|
retries++;
|
|
@@ -11557,8 +11412,7 @@ var retryBusySync = (fn) => {
|
|
|
11557
11412
|
try {
|
|
11558
11413
|
return fn(path36);
|
|
11559
11414
|
} catch (er) {
|
|
11560
|
-
|
|
11561
|
-
if (fer?.path === path36 && fer?.code && codes.has(fer.code) && retries < max) {
|
|
11415
|
+
if (isFsError(er) && er.path === path36 && codes.has(er.code) && retries < max) {
|
|
11562
11416
|
retries++;
|
|
11563
11417
|
continue;
|
|
11564
11418
|
}
|
|
@@ -11569,23 +11423,23 @@ var retryBusySync = (fn) => {
|
|
|
11569
11423
|
return method;
|
|
11570
11424
|
};
|
|
11571
11425
|
|
|
11572
|
-
// ../../node_modules/.pnpm/rimraf@6.0
|
|
11426
|
+
// ../../node_modules/.pnpm/rimraf@6.1.0/node_modules/rimraf/dist/esm/rimraf-move-remove.js
|
|
11573
11427
|
init_esm_shims();
|
|
11574
11428
|
import { basename as basename3, parse as parse5, resolve as resolve6 } from "path";
|
|
11575
11429
|
|
|
11576
|
-
// ../../node_modules/.pnpm/rimraf@6.0
|
|
11430
|
+
// ../../node_modules/.pnpm/rimraf@6.1.0/node_modules/rimraf/dist/esm/default-tmp.js
|
|
11577
11431
|
init_esm_shims();
|
|
11578
11432
|
import { tmpdir } from "os";
|
|
11579
11433
|
import { parse as parse4, resolve as resolve5 } from "path";
|
|
11580
|
-
var { stat:
|
|
11434
|
+
var { stat: stat4 } = promises;
|
|
11581
11435
|
var isDirSync = (path36) => {
|
|
11582
11436
|
try {
|
|
11583
11437
|
return statSync(path36).isDirectory();
|
|
11584
|
-
} catch
|
|
11438
|
+
} catch {
|
|
11585
11439
|
return false;
|
|
11586
11440
|
}
|
|
11587
11441
|
};
|
|
11588
|
-
var isDir = (path36) =>
|
|
11442
|
+
var isDir = (path36) => stat4(path36).then((st) => st.isDirectory(), () => false);
|
|
11589
11443
|
var win32DefaultTmp = async (path36) => {
|
|
11590
11444
|
const { root } = parse4(path36);
|
|
11591
11445
|
const tmp = tmpdir();
|
|
@@ -11614,60 +11468,20 @@ var win32DefaultTmpSync = (path36) => {
|
|
|
11614
11468
|
};
|
|
11615
11469
|
var posixDefaultTmp = async () => tmpdir();
|
|
11616
11470
|
var posixDefaultTmpSync = () => tmpdir();
|
|
11617
|
-
var defaultTmp =
|
|
11618
|
-
var defaultTmpSync =
|
|
11471
|
+
var defaultTmp = process.platform === "win32" ? win32DefaultTmp : posixDefaultTmp;
|
|
11472
|
+
var defaultTmpSync = process.platform === "win32" ? win32DefaultTmpSync : posixDefaultTmpSync;
|
|
11619
11473
|
|
|
11620
|
-
// ../../node_modules/.pnpm/rimraf@6.0
|
|
11621
|
-
var { lstat:
|
|
11474
|
+
// ../../node_modules/.pnpm/rimraf@6.1.0/node_modules/rimraf/dist/esm/rimraf-move-remove.js
|
|
11475
|
+
var { lstat: lstat5, rename, unlink: unlink2, rmdir: rmdir2 } = promises;
|
|
11622
11476
|
var uniqueFilename = (path36) => `.${basename3(path36)}.${Math.random()}`;
|
|
11623
|
-
var unlinkFixEPERM =
|
|
11624
|
-
|
|
11625
|
-
return chmod3(path36, 438).then(() => unlink3(path36), (er2) => {
|
|
11626
|
-
if (er2.code === "ENOENT") {
|
|
11627
|
-
return;
|
|
11628
|
-
}
|
|
11629
|
-
throw er;
|
|
11630
|
-
});
|
|
11631
|
-
} else if (er.code === "ENOENT") {
|
|
11632
|
-
return;
|
|
11633
|
-
}
|
|
11634
|
-
throw er;
|
|
11635
|
-
});
|
|
11636
|
-
var unlinkFixEPERMSync = (path36) => {
|
|
11637
|
-
try {
|
|
11638
|
-
unlinkSync(path36);
|
|
11639
|
-
} catch (er) {
|
|
11640
|
-
if (er?.code === "EPERM") {
|
|
11641
|
-
try {
|
|
11642
|
-
return chmodSync(path36, 438);
|
|
11643
|
-
} catch (er2) {
|
|
11644
|
-
if (er2?.code === "ENOENT") {
|
|
11645
|
-
return;
|
|
11646
|
-
}
|
|
11647
|
-
throw er;
|
|
11648
|
-
}
|
|
11649
|
-
} else if (er?.code === "ENOENT") {
|
|
11650
|
-
return;
|
|
11651
|
-
}
|
|
11652
|
-
throw er;
|
|
11653
|
-
}
|
|
11654
|
-
};
|
|
11477
|
+
var unlinkFixEPERM = fixEPERM(unlink2);
|
|
11478
|
+
var unlinkFixEPERMSync = fixEPERMSync(unlinkSync);
|
|
11655
11479
|
var rimrafMoveRemove = async (path36, opt) => {
|
|
11656
|
-
|
|
11657
|
-
|
|
11658
|
-
}
|
|
11659
|
-
try {
|
|
11660
|
-
return await rimrafMoveRemoveDir(path36, opt, await lstat6(path36));
|
|
11661
|
-
} catch (er) {
|
|
11662
|
-
if (er?.code === "ENOENT")
|
|
11663
|
-
return true;
|
|
11664
|
-
throw er;
|
|
11665
|
-
}
|
|
11480
|
+
opt?.signal?.throwIfAborted();
|
|
11481
|
+
return await ignoreENOENT(lstat5(path36).then((stat5) => rimrafMoveRemoveDir(path36, opt, stat5))) ?? true;
|
|
11666
11482
|
};
|
|
11667
11483
|
var rimrafMoveRemoveDir = async (path36, opt, ent) => {
|
|
11668
|
-
|
|
11669
|
-
throw opt.signal.reason;
|
|
11670
|
-
}
|
|
11484
|
+
opt?.signal?.throwIfAborted();
|
|
11671
11485
|
if (!opt.tmp) {
|
|
11672
11486
|
return rimrafMoveRemoveDir(path36, { ...opt, tmp: await defaultTmp(path36) }, ent);
|
|
11673
11487
|
}
|
|
@@ -11677,10 +11491,10 @@ var rimrafMoveRemoveDir = async (path36, opt, ent) => {
|
|
|
11677
11491
|
const entries = ent.isDirectory() ? await readdirOrError(path36) : null;
|
|
11678
11492
|
if (!Array.isArray(entries)) {
|
|
11679
11493
|
if (entries) {
|
|
11680
|
-
if (entries
|
|
11494
|
+
if (errorCode(entries) === "ENOENT") {
|
|
11681
11495
|
return true;
|
|
11682
11496
|
}
|
|
11683
|
-
if (entries
|
|
11497
|
+
if (errorCode(entries) !== "ENOTDIR") {
|
|
11684
11498
|
throw entries;
|
|
11685
11499
|
}
|
|
11686
11500
|
}
|
|
@@ -11690,7 +11504,7 @@ var rimrafMoveRemoveDir = async (path36, opt, ent) => {
|
|
|
11690
11504
|
await ignoreENOENT(tmpUnlink(path36, opt.tmp, unlinkFixEPERM));
|
|
11691
11505
|
return true;
|
|
11692
11506
|
}
|
|
11693
|
-
const removedAll = (await Promise.all(entries.map((ent2) => rimrafMoveRemoveDir(resolve6(path36, ent2.name), opt, ent2)))).
|
|
11507
|
+
const removedAll = (await Promise.all(entries.map((ent2) => rimrafMoveRemoveDir(resolve6(path36, ent2.name), opt, ent2)))).every((v) => v === true);
|
|
11694
11508
|
if (!removedAll) {
|
|
11695
11509
|
return false;
|
|
11696
11510
|
}
|
|
@@ -11700,30 +11514,20 @@ var rimrafMoveRemoveDir = async (path36, opt, ent) => {
|
|
|
11700
11514
|
if (opt.filter && !await opt.filter(path36, ent)) {
|
|
11701
11515
|
return false;
|
|
11702
11516
|
}
|
|
11703
|
-
await ignoreENOENT(tmpUnlink(path36, opt.tmp,
|
|
11517
|
+
await ignoreENOENT(tmpUnlink(path36, opt.tmp, rmdir2));
|
|
11704
11518
|
return true;
|
|
11705
11519
|
};
|
|
11706
|
-
var tmpUnlink = async (path36, tmp,
|
|
11520
|
+
var tmpUnlink = async (path36, tmp, rm2) => {
|
|
11707
11521
|
const tmpFile = resolve6(tmp, uniqueFilename(path36));
|
|
11708
|
-
await
|
|
11709
|
-
return await
|
|
11522
|
+
await rename(path36, tmpFile);
|
|
11523
|
+
return await rm2(tmpFile);
|
|
11710
11524
|
};
|
|
11711
11525
|
var rimrafMoveRemoveSync = (path36, opt) => {
|
|
11712
|
-
|
|
11713
|
-
|
|
11714
|
-
}
|
|
11715
|
-
try {
|
|
11716
|
-
return rimrafMoveRemoveDirSync(path36, opt, lstatSync2(path36));
|
|
11717
|
-
} catch (er) {
|
|
11718
|
-
if (er?.code === "ENOENT")
|
|
11719
|
-
return true;
|
|
11720
|
-
throw er;
|
|
11721
|
-
}
|
|
11526
|
+
opt?.signal?.throwIfAborted();
|
|
11527
|
+
return ignoreENOENTSync(() => rimrafMoveRemoveDirSync(path36, opt, lstatSync2(path36))) ?? true;
|
|
11722
11528
|
};
|
|
11723
11529
|
var rimrafMoveRemoveDirSync = (path36, opt, ent) => {
|
|
11724
|
-
|
|
11725
|
-
throw opt.signal.reason;
|
|
11726
|
-
}
|
|
11530
|
+
opt?.signal?.throwIfAborted();
|
|
11727
11531
|
if (!opt.tmp) {
|
|
11728
11532
|
return rimrafMoveRemoveDirSync(path36, { ...opt, tmp: defaultTmpSync(path36) }, ent);
|
|
11729
11533
|
}
|
|
@@ -11734,10 +11538,10 @@ var rimrafMoveRemoveDirSync = (path36, opt, ent) => {
|
|
|
11734
11538
|
const entries = ent.isDirectory() ? readdirOrErrorSync(path36) : null;
|
|
11735
11539
|
if (!Array.isArray(entries)) {
|
|
11736
11540
|
if (entries) {
|
|
11737
|
-
if (entries
|
|
11541
|
+
if (errorCode(entries) === "ENOENT") {
|
|
11738
11542
|
return true;
|
|
11739
11543
|
}
|
|
11740
|
-
if (entries
|
|
11544
|
+
if (errorCode(entries) !== "ENOTDIR") {
|
|
11741
11545
|
throw entries;
|
|
11742
11546
|
}
|
|
11743
11547
|
}
|
|
@@ -11770,37 +11574,32 @@ var tmpUnlinkSync = (path36, tmp, rmSync2) => {
|
|
|
11770
11574
|
return rmSync2(tmpFile);
|
|
11771
11575
|
};
|
|
11772
11576
|
|
|
11773
|
-
// ../../node_modules/.pnpm/rimraf@6.0
|
|
11774
|
-
var { unlink:
|
|
11775
|
-
var rimrafWindowsFile = retryBusy(fixEPERM(
|
|
11577
|
+
// ../../node_modules/.pnpm/rimraf@6.1.0/node_modules/rimraf/dist/esm/rimraf-windows.js
|
|
11578
|
+
var { unlink: unlink3, rmdir: rmdir3, lstat: lstat6 } = promises;
|
|
11579
|
+
var rimrafWindowsFile = retryBusy(fixEPERM(unlink3));
|
|
11776
11580
|
var rimrafWindowsFileSync = retryBusySync(fixEPERMSync(unlinkSync));
|
|
11777
|
-
var rimrafWindowsDirRetry = retryBusy(fixEPERM(
|
|
11581
|
+
var rimrafWindowsDirRetry = retryBusy(fixEPERM(rmdir3));
|
|
11778
11582
|
var rimrafWindowsDirRetrySync = retryBusySync(fixEPERMSync(rmdirSync));
|
|
11779
|
-
var rimrafWindowsDirMoveRemoveFallback = async (path36, opt) => {
|
|
11780
|
-
|
|
11781
|
-
throw opt.signal.reason;
|
|
11782
|
-
}
|
|
11783
|
-
const { filter: filter3, ...options } = opt;
|
|
11583
|
+
var rimrafWindowsDirMoveRemoveFallback = async (path36, { filter: filter3, ...opt }) => {
|
|
11584
|
+
opt?.signal?.throwIfAborted();
|
|
11784
11585
|
try {
|
|
11785
|
-
|
|
11586
|
+
await rimrafWindowsDirRetry(path36, opt);
|
|
11587
|
+
return true;
|
|
11786
11588
|
} catch (er) {
|
|
11787
|
-
if (er
|
|
11788
|
-
return
|
|
11589
|
+
if (errorCode(er) === "ENOTEMPTY") {
|
|
11590
|
+
return rimrafMoveRemove(path36, opt);
|
|
11789
11591
|
}
|
|
11790
11592
|
throw er;
|
|
11791
11593
|
}
|
|
11792
11594
|
};
|
|
11793
|
-
var rimrafWindowsDirMoveRemoveFallbackSync = (path36, opt) => {
|
|
11794
|
-
|
|
11795
|
-
throw opt.signal.reason;
|
|
11796
|
-
}
|
|
11797
|
-
const { filter: filter3, ...options } = opt;
|
|
11595
|
+
var rimrafWindowsDirMoveRemoveFallbackSync = (path36, { filter: filter3, ...opt }) => {
|
|
11596
|
+
opt?.signal?.throwIfAborted();
|
|
11798
11597
|
try {
|
|
11799
|
-
|
|
11598
|
+
rimrafWindowsDirRetrySync(path36, opt);
|
|
11599
|
+
return true;
|
|
11800
11600
|
} catch (er) {
|
|
11801
|
-
|
|
11802
|
-
|
|
11803
|
-
return rimrafMoveRemoveSync(path36, options);
|
|
11601
|
+
if (errorCode(er) === "ENOTEMPTY") {
|
|
11602
|
+
return rimrafMoveRemoveSync(path36, opt);
|
|
11804
11603
|
}
|
|
11805
11604
|
throw er;
|
|
11806
11605
|
}
|
|
@@ -11809,40 +11608,22 @@ var START = Symbol("start");
|
|
|
11809
11608
|
var CHILD = Symbol("child");
|
|
11810
11609
|
var FINISH = Symbol("finish");
|
|
11811
11610
|
var rimrafWindows = async (path36, opt) => {
|
|
11812
|
-
|
|
11813
|
-
|
|
11814
|
-
}
|
|
11815
|
-
try {
|
|
11816
|
-
return await rimrafWindowsDir(path36, opt, await lstat7(path36), START);
|
|
11817
|
-
} catch (er) {
|
|
11818
|
-
if (er?.code === "ENOENT")
|
|
11819
|
-
return true;
|
|
11820
|
-
throw er;
|
|
11821
|
-
}
|
|
11611
|
+
opt?.signal?.throwIfAborted();
|
|
11612
|
+
return await ignoreENOENT(lstat6(path36).then((stat5) => rimrafWindowsDir(path36, opt, stat5, START))) ?? true;
|
|
11822
11613
|
};
|
|
11823
11614
|
var rimrafWindowsSync = (path36, opt) => {
|
|
11824
|
-
|
|
11825
|
-
|
|
11826
|
-
}
|
|
11827
|
-
try {
|
|
11828
|
-
return rimrafWindowsDirSync(path36, opt, lstatSync2(path36), START);
|
|
11829
|
-
} catch (er) {
|
|
11830
|
-
if (er?.code === "ENOENT")
|
|
11831
|
-
return true;
|
|
11832
|
-
throw er;
|
|
11833
|
-
}
|
|
11615
|
+
opt?.signal?.throwIfAborted();
|
|
11616
|
+
return ignoreENOENTSync(() => rimrafWindowsDirSync(path36, opt, lstatSync2(path36), START)) ?? true;
|
|
11834
11617
|
};
|
|
11835
11618
|
var rimrafWindowsDir = async (path36, opt, ent, state = START) => {
|
|
11836
|
-
|
|
11837
|
-
throw opt.signal.reason;
|
|
11838
|
-
}
|
|
11619
|
+
opt?.signal?.throwIfAborted();
|
|
11839
11620
|
const entries = ent.isDirectory() ? await readdirOrError(path36) : null;
|
|
11840
11621
|
if (!Array.isArray(entries)) {
|
|
11841
11622
|
if (entries) {
|
|
11842
|
-
if (entries
|
|
11623
|
+
if (errorCode(entries) === "ENOENT") {
|
|
11843
11624
|
return true;
|
|
11844
11625
|
}
|
|
11845
|
-
if (entries
|
|
11626
|
+
if (errorCode(entries) !== "ENOTDIR") {
|
|
11846
11627
|
throw entries;
|
|
11847
11628
|
}
|
|
11848
11629
|
}
|
|
@@ -11853,7 +11634,7 @@ var rimrafWindowsDir = async (path36, opt, ent, state = START) => {
|
|
|
11853
11634
|
return true;
|
|
11854
11635
|
}
|
|
11855
11636
|
const s = state === START ? CHILD : state;
|
|
11856
|
-
const removedAll = (await Promise.all(entries.map((ent2) => rimrafWindowsDir(resolve7(path36, ent2.name), opt, ent2, s)))).
|
|
11637
|
+
const removedAll = (await Promise.all(entries.map((ent2) => rimrafWindowsDir(resolve7(path36, ent2.name), opt, ent2, s)))).every((v) => v === true);
|
|
11857
11638
|
if (state === START) {
|
|
11858
11639
|
return rimrafWindowsDir(path36, opt, ent, FINISH);
|
|
11859
11640
|
} else if (state === FINISH) {
|
|
@@ -11874,10 +11655,10 @@ var rimrafWindowsDirSync = (path36, opt, ent, state = START) => {
|
|
|
11874
11655
|
const entries = ent.isDirectory() ? readdirOrErrorSync(path36) : null;
|
|
11875
11656
|
if (!Array.isArray(entries)) {
|
|
11876
11657
|
if (entries) {
|
|
11877
|
-
if (entries
|
|
11658
|
+
if (errorCode(entries) === "ENOENT") {
|
|
11878
11659
|
return true;
|
|
11879
11660
|
}
|
|
11880
|
-
if (entries
|
|
11661
|
+
if (errorCode(entries) !== "ENOTDIR") {
|
|
11881
11662
|
throw entries;
|
|
11882
11663
|
}
|
|
11883
11664
|
}
|
|
@@ -11905,22 +11686,20 @@ var rimrafWindowsDirSync = (path36, opt, ent, state = START) => {
|
|
|
11905
11686
|
if (opt.filter && !opt.filter(path36, ent)) {
|
|
11906
11687
|
return false;
|
|
11907
11688
|
}
|
|
11908
|
-
ignoreENOENTSync(() =>
|
|
11909
|
-
rimrafWindowsDirMoveRemoveFallbackSync(path36, opt);
|
|
11910
|
-
});
|
|
11689
|
+
ignoreENOENTSync(() => rimrafWindowsDirMoveRemoveFallbackSync(path36, opt));
|
|
11911
11690
|
}
|
|
11912
11691
|
return true;
|
|
11913
11692
|
};
|
|
11914
11693
|
|
|
11915
|
-
// ../../node_modules/.pnpm/rimraf@6.0
|
|
11916
|
-
var rimrafManual =
|
|
11917
|
-
var rimrafManualSync =
|
|
11694
|
+
// ../../node_modules/.pnpm/rimraf@6.1.0/node_modules/rimraf/dist/esm/rimraf-manual.js
|
|
11695
|
+
var rimrafManual = process.platform === "win32" ? rimrafWindows : rimrafPosix;
|
|
11696
|
+
var rimrafManualSync = process.platform === "win32" ? rimrafWindowsSync : rimrafPosixSync;
|
|
11918
11697
|
|
|
11919
|
-
// ../../node_modules/.pnpm/rimraf@6.0
|
|
11698
|
+
// ../../node_modules/.pnpm/rimraf@6.1.0/node_modules/rimraf/dist/esm/rimraf-native.js
|
|
11920
11699
|
init_esm_shims();
|
|
11921
|
-
var { rm
|
|
11700
|
+
var { rm } = promises;
|
|
11922
11701
|
var rimrafNative = async (path36, opt) => {
|
|
11923
|
-
await
|
|
11702
|
+
await rm(path36, {
|
|
11924
11703
|
...opt,
|
|
11925
11704
|
force: true,
|
|
11926
11705
|
recursive: true
|
|
@@ -11936,16 +11715,14 @@ var rimrafNativeSync = (path36, opt) => {
|
|
|
11936
11715
|
return true;
|
|
11937
11716
|
};
|
|
11938
11717
|
|
|
11939
|
-
// ../../node_modules/.pnpm/rimraf@6.0
|
|
11718
|
+
// ../../node_modules/.pnpm/rimraf@6.1.0/node_modules/rimraf/dist/esm/use-native.js
|
|
11940
11719
|
init_esm_shims();
|
|
11941
|
-
var
|
|
11942
|
-
var versArr = version.replace(/^v/, "").split(".");
|
|
11943
|
-
var [major = 0, minor = 0] = versArr.map((v) => parseInt(v, 10));
|
|
11720
|
+
var [major = 0, minor = 0] = process.version.replace(/^v/, "").split(".").map((v) => parseInt(v, 10));
|
|
11944
11721
|
var hasNative = major > 14 || major === 14 && minor >= 14;
|
|
11945
|
-
var useNative = !hasNative ||
|
|
11946
|
-
var useNativeSync = !hasNative ||
|
|
11722
|
+
var useNative = !hasNative || process.platform === "win32" ? () => false : (opt) => !opt?.signal && !opt?.filter;
|
|
11723
|
+
var useNativeSync = !hasNative || process.platform === "win32" ? () => false : (opt) => !opt?.signal && !opt?.filter;
|
|
11947
11724
|
|
|
11948
|
-
// ../../node_modules/.pnpm/rimraf@6.0
|
|
11725
|
+
// ../../node_modules/.pnpm/rimraf@6.1.0/node_modules/rimraf/dist/esm/index.js
|
|
11949
11726
|
var wrap = (fn) => async (path36, opt) => {
|
|
11950
11727
|
const options = optArg(opt);
|
|
11951
11728
|
if (options.glob) {
|
|
@@ -12002,31 +11779,170 @@ rimraf.rimraf = rimraf;
|
|
|
12002
11779
|
// src/runtime/buildPlugin.ts
|
|
12003
11780
|
import { build } from "vite";
|
|
12004
11781
|
|
|
11782
|
+
// src/runtime/independentError.ts
|
|
11783
|
+
init_esm_shims();
|
|
11784
|
+
var ANSI_ESCAPE_PATTERN = /\u001B\[[0-9;]*m/g;
|
|
11785
|
+
function stripAnsi(value) {
|
|
11786
|
+
return value.replace(ANSI_ESCAPE_PATTERN, "");
|
|
11787
|
+
}
|
|
11788
|
+
function isErrorInstance(value) {
|
|
11789
|
+
return value instanceof Error;
|
|
11790
|
+
}
|
|
11791
|
+
function formatSummary(payload) {
|
|
11792
|
+
const parts = [];
|
|
11793
|
+
const code = payload.code;
|
|
11794
|
+
if (typeof code === "string" && code.trim()) {
|
|
11795
|
+
parts.push(`code: ${code.trim()}`);
|
|
11796
|
+
}
|
|
11797
|
+
const plugin = payload.plugin;
|
|
11798
|
+
if (typeof plugin === "string" && plugin.trim()) {
|
|
11799
|
+
parts.push(`plugin: ${plugin.trim()}`);
|
|
11800
|
+
}
|
|
11801
|
+
const id = payload.id;
|
|
11802
|
+
if (typeof id === "string" && id.trim()) {
|
|
11803
|
+
parts.push(`id: ${id.trim()}`);
|
|
11804
|
+
}
|
|
11805
|
+
if (!parts.length) {
|
|
11806
|
+
return "";
|
|
11807
|
+
}
|
|
11808
|
+
return ` (${parts.join(", ")})`;
|
|
11809
|
+
}
|
|
11810
|
+
function collectDetails(payload) {
|
|
11811
|
+
const details = [];
|
|
11812
|
+
const frame = payload.frame;
|
|
11813
|
+
if (typeof frame === "string" && frame.trim()) {
|
|
11814
|
+
details.push(frame.trim());
|
|
11815
|
+
}
|
|
11816
|
+
const stack = payload.stack;
|
|
11817
|
+
if (typeof stack === "string" && stack.trim()) {
|
|
11818
|
+
details.push(stack.trim());
|
|
11819
|
+
}
|
|
11820
|
+
return details;
|
|
11821
|
+
}
|
|
11822
|
+
function extractMessage(value, seen) {
|
|
11823
|
+
if (!value || seen.has(value)) {
|
|
11824
|
+
return void 0;
|
|
11825
|
+
}
|
|
11826
|
+
if (typeof value === "string") {
|
|
11827
|
+
const trimmed = stripAnsi(value).trim();
|
|
11828
|
+
return trimmed || void 0;
|
|
11829
|
+
}
|
|
11830
|
+
if (isErrorInstance(value)) {
|
|
11831
|
+
const trimmed = stripAnsi(value.message ?? "").trim();
|
|
11832
|
+
if (trimmed) {
|
|
11833
|
+
return trimmed;
|
|
11834
|
+
}
|
|
11835
|
+
if (value.cause) {
|
|
11836
|
+
return extractMessage(value.cause, seen);
|
|
11837
|
+
}
|
|
11838
|
+
return void 0;
|
|
11839
|
+
}
|
|
11840
|
+
if (typeof value === "object") {
|
|
11841
|
+
const record = value;
|
|
11842
|
+
seen.add(record);
|
|
11843
|
+
const directMessage = extractMessage(record.message, seen);
|
|
11844
|
+
if (directMessage) {
|
|
11845
|
+
return directMessage;
|
|
11846
|
+
}
|
|
11847
|
+
const nestedKeys = ["reason", "detail", "details", "error", "field0", "field1", "cause"];
|
|
11848
|
+
for (const key of nestedKeys) {
|
|
11849
|
+
if (key in record) {
|
|
11850
|
+
const nestedMessage = extractMessage(record[key], seen);
|
|
11851
|
+
if (nestedMessage) {
|
|
11852
|
+
return nestedMessage;
|
|
11853
|
+
}
|
|
11854
|
+
}
|
|
11855
|
+
}
|
|
11856
|
+
}
|
|
11857
|
+
return void 0;
|
|
11858
|
+
}
|
|
11859
|
+
function createIndependentBuildError(root, cause) {
|
|
11860
|
+
const fallback = `Independent bundle for ${root} failed`;
|
|
11861
|
+
if (isErrorInstance(cause)) {
|
|
11862
|
+
if (!cause.message || cause.message.trim() === "") {
|
|
11863
|
+
return new Error(fallback, { cause });
|
|
11864
|
+
}
|
|
11865
|
+
return cause;
|
|
11866
|
+
}
|
|
11867
|
+
if (!cause) {
|
|
11868
|
+
return new Error(fallback);
|
|
11869
|
+
}
|
|
11870
|
+
if (typeof cause === "string") {
|
|
11871
|
+
const trimmed = stripAnsi(cause).trim();
|
|
11872
|
+
if (!trimmed) {
|
|
11873
|
+
return new Error(fallback, { cause });
|
|
11874
|
+
}
|
|
11875
|
+
return new Error(trimmed, { cause });
|
|
11876
|
+
}
|
|
11877
|
+
if (typeof cause === "object") {
|
|
11878
|
+
const payload = cause;
|
|
11879
|
+
const seen = /* @__PURE__ */ new Set();
|
|
11880
|
+
const extracted = extractMessage(payload, seen);
|
|
11881
|
+
const summary = formatSummary(payload);
|
|
11882
|
+
const detailLines = collectDetails(payload);
|
|
11883
|
+
if (extracted) {
|
|
11884
|
+
let composedMessage = extracted;
|
|
11885
|
+
if (summary) {
|
|
11886
|
+
composedMessage += summary;
|
|
11887
|
+
}
|
|
11888
|
+
if (detailLines.length) {
|
|
11889
|
+
composedMessage += `
|
|
11890
|
+
${detailLines.join("\n")}`;
|
|
11891
|
+
}
|
|
11892
|
+
return new Error(composedMessage, { cause });
|
|
11893
|
+
}
|
|
11894
|
+
if (summary || detailLines.length) {
|
|
11895
|
+
const composed = detailLines.length ? `${fallback}${summary}
|
|
11896
|
+
${detailLines.join("\n")}` : `${fallback}${summary}`;
|
|
11897
|
+
if (composed.trim()) {
|
|
11898
|
+
return new Error(composed, { cause });
|
|
11899
|
+
}
|
|
11900
|
+
}
|
|
11901
|
+
}
|
|
11902
|
+
try {
|
|
11903
|
+
const serialized = JSON.stringify(cause);
|
|
11904
|
+
if (serialized && serialized !== "{}") {
|
|
11905
|
+
return new Error(`${fallback}: ${serialized}`, { cause });
|
|
11906
|
+
}
|
|
11907
|
+
} catch {
|
|
11908
|
+
}
|
|
11909
|
+
return new Error(fallback, { cause });
|
|
11910
|
+
}
|
|
11911
|
+
|
|
11912
|
+
// src/runtime/sharedBuildConfig.ts
|
|
11913
|
+
init_esm_shims();
|
|
11914
|
+
import picomatch from "picomatch";
|
|
11915
|
+
|
|
12005
11916
|
// src/runtime/advancedChunks.ts
|
|
12006
11917
|
init_esm_shims();
|
|
12007
11918
|
|
|
12008
11919
|
// src/runtime/chunkStrategy.ts
|
|
12009
11920
|
init_esm_shims();
|
|
11921
|
+
import { Buffer as Buffer2 } from "buffer";
|
|
12010
11922
|
import { posix as path10 } from "pathe";
|
|
12011
11923
|
var SHARED_CHUNK_VIRTUAL_PREFIX = "weapp_shared_virtual";
|
|
12012
11924
|
var SUB_PACKAGE_SHARED_DIR = "weapp-shared";
|
|
12013
11925
|
var DEFAULT_SHARED_CHUNK_STRATEGY = "duplicate";
|
|
11926
|
+
var sharedChunkDiagnostics = /* @__PURE__ */ new Map();
|
|
12014
11927
|
function resolveSharedChunkName(options) {
|
|
12015
11928
|
const {
|
|
12016
11929
|
id,
|
|
12017
11930
|
ctx,
|
|
12018
11931
|
relativeAbsoluteSrcRoot,
|
|
12019
11932
|
subPackageRoots,
|
|
12020
|
-
strategy
|
|
11933
|
+
strategy,
|
|
11934
|
+
forceDuplicateTester
|
|
12021
11935
|
} = options;
|
|
12022
11936
|
const moduleInfo = ctx.getModuleInfo(id);
|
|
12023
11937
|
if (!moduleInfo?.importers || moduleInfo.importers.length <= 1) {
|
|
12024
11938
|
return void 0;
|
|
12025
11939
|
}
|
|
12026
|
-
const summary = summarizeImportPrefixes({
|
|
11940
|
+
const { summary, ignoredMainImporters } = summarizeImportPrefixes({
|
|
11941
|
+
ctx,
|
|
12027
11942
|
importers: moduleInfo.importers,
|
|
12028
11943
|
relativeAbsoluteSrcRoot,
|
|
12029
|
-
subPackageRoots: Array.from(subPackageRoots)
|
|
11944
|
+
subPackageRoots: Array.from(subPackageRoots),
|
|
11945
|
+
forceDuplicateTester
|
|
12030
11946
|
});
|
|
12031
11947
|
const keys = Object.keys(summary);
|
|
12032
11948
|
if (keys.length === 0) {
|
|
@@ -12040,19 +11956,145 @@ function resolveSharedChunkName(options) {
|
|
|
12040
11956
|
if (strategy === "duplicate" && !hasMainImporter) {
|
|
12041
11957
|
const combination = keys.filter(Boolean).sort().join("+");
|
|
12042
11958
|
const combinationSegment = combination ? `${combination}/` : "";
|
|
12043
|
-
|
|
11959
|
+
const sharedName = `${SHARED_CHUNK_VIRTUAL_PREFIX}/${combinationSegment}common`;
|
|
11960
|
+
if (ignoredMainImporters.length) {
|
|
11961
|
+
sharedChunkDiagnostics.set(sharedName, {
|
|
11962
|
+
ignoredMainImporters: Array.from(new Set(ignoredMainImporters))
|
|
11963
|
+
});
|
|
11964
|
+
sharedChunkDiagnostics.set(`${sharedName}.js`, {
|
|
11965
|
+
ignoredMainImporters: Array.from(new Set(ignoredMainImporters))
|
|
11966
|
+
});
|
|
11967
|
+
}
|
|
11968
|
+
return sharedName;
|
|
12044
11969
|
}
|
|
12045
11970
|
return "common";
|
|
12046
11971
|
}
|
|
12047
11972
|
function summarizeImportPrefixes(options) {
|
|
12048
|
-
const {
|
|
11973
|
+
const {
|
|
11974
|
+
ctx,
|
|
11975
|
+
importers,
|
|
11976
|
+
relativeAbsoluteSrcRoot,
|
|
11977
|
+
subPackageRoots,
|
|
11978
|
+
forceDuplicateTester
|
|
11979
|
+
} = options;
|
|
12049
11980
|
const summary = {};
|
|
11981
|
+
const ignoredImporters = /* @__PURE__ */ new Set();
|
|
11982
|
+
const state = {
|
|
11983
|
+
cache: /* @__PURE__ */ new Map(),
|
|
11984
|
+
stack: /* @__PURE__ */ new Set()
|
|
11985
|
+
};
|
|
12050
11986
|
for (const importer of importers) {
|
|
12051
|
-
const
|
|
12052
|
-
|
|
12053
|
-
|
|
11987
|
+
const { prefixes, ignored } = collectEffectivePrefixes(importer, {
|
|
11988
|
+
ctx,
|
|
11989
|
+
relativeAbsoluteSrcRoot,
|
|
11990
|
+
subPackageRoots,
|
|
11991
|
+
forceDuplicateTester
|
|
11992
|
+
}, state);
|
|
11993
|
+
for (const prefix of prefixes) {
|
|
11994
|
+
summary[prefix] = (summary[prefix] || 0) + 1;
|
|
11995
|
+
}
|
|
11996
|
+
for (const entry of ignored) {
|
|
11997
|
+
ignoredImporters.add(entry);
|
|
11998
|
+
}
|
|
12054
11999
|
}
|
|
12055
|
-
return
|
|
12000
|
+
return {
|
|
12001
|
+
summary,
|
|
12002
|
+
ignoredMainImporters: Array.from(ignoredImporters)
|
|
12003
|
+
};
|
|
12004
|
+
}
|
|
12005
|
+
function collectEffectivePrefixes(importer, options, state) {
|
|
12006
|
+
const cached = state.cache.get(importer);
|
|
12007
|
+
if (cached) {
|
|
12008
|
+
return {
|
|
12009
|
+
prefixes: [...cached.prefixes],
|
|
12010
|
+
hasRealMain: cached.hasRealMain,
|
|
12011
|
+
ignored: [...cached.ignored]
|
|
12012
|
+
};
|
|
12013
|
+
}
|
|
12014
|
+
if (state.stack.has(importer)) {
|
|
12015
|
+
return {
|
|
12016
|
+
prefixes: [""],
|
|
12017
|
+
hasRealMain: true,
|
|
12018
|
+
ignored: []
|
|
12019
|
+
};
|
|
12020
|
+
}
|
|
12021
|
+
state.stack.add(importer);
|
|
12022
|
+
const {
|
|
12023
|
+
ctx,
|
|
12024
|
+
relativeAbsoluteSrcRoot,
|
|
12025
|
+
subPackageRoots,
|
|
12026
|
+
forceDuplicateTester
|
|
12027
|
+
} = options;
|
|
12028
|
+
const relativeId = relativeAbsoluteSrcRoot(importer);
|
|
12029
|
+
const subPackagePrefix = resolveSubPackagePrefix(relativeId, subPackageRoots);
|
|
12030
|
+
if (subPackagePrefix) {
|
|
12031
|
+
const result2 = {
|
|
12032
|
+
prefixes: [subPackagePrefix],
|
|
12033
|
+
hasRealMain: false,
|
|
12034
|
+
ignored: []
|
|
12035
|
+
};
|
|
12036
|
+
state.cache.set(importer, result2);
|
|
12037
|
+
state.stack.delete(importer);
|
|
12038
|
+
return {
|
|
12039
|
+
prefixes: [...result2.prefixes],
|
|
12040
|
+
hasRealMain: result2.hasRealMain,
|
|
12041
|
+
ignored: []
|
|
12042
|
+
};
|
|
12043
|
+
}
|
|
12044
|
+
const moduleInfo = ctx.getModuleInfo(importer);
|
|
12045
|
+
const importerParents = moduleInfo?.importers ?? [];
|
|
12046
|
+
const forcedDuplicate = forceDuplicateTester?.(relativeId, importer) ?? false;
|
|
12047
|
+
if (!importerParents.length) {
|
|
12048
|
+
const result2 = forcedDuplicate ? {
|
|
12049
|
+
prefixes: [],
|
|
12050
|
+
hasRealMain: false,
|
|
12051
|
+
ignored: [relativeId]
|
|
12052
|
+
} : {
|
|
12053
|
+
prefixes: [""],
|
|
12054
|
+
hasRealMain: true,
|
|
12055
|
+
ignored: []
|
|
12056
|
+
};
|
|
12057
|
+
state.cache.set(importer, result2);
|
|
12058
|
+
state.stack.delete(importer);
|
|
12059
|
+
return {
|
|
12060
|
+
prefixes: [...result2.prefixes],
|
|
12061
|
+
hasRealMain: result2.hasRealMain,
|
|
12062
|
+
ignored: [...result2.ignored]
|
|
12063
|
+
};
|
|
12064
|
+
}
|
|
12065
|
+
const aggregatedPrefixes = /* @__PURE__ */ new Set();
|
|
12066
|
+
let hasRealMain = false;
|
|
12067
|
+
const aggregatedIgnored = [];
|
|
12068
|
+
for (const parent of importerParents) {
|
|
12069
|
+
const collectorResult = collectEffectivePrefixes(parent, options, state);
|
|
12070
|
+
for (const prefix of collectorResult.prefixes) {
|
|
12071
|
+
aggregatedPrefixes.add(prefix);
|
|
12072
|
+
}
|
|
12073
|
+
if (collectorResult.hasRealMain) {
|
|
12074
|
+
hasRealMain = true;
|
|
12075
|
+
}
|
|
12076
|
+
if (collectorResult.ignored.length) {
|
|
12077
|
+
aggregatedIgnored.push(...collectorResult.ignored);
|
|
12078
|
+
}
|
|
12079
|
+
}
|
|
12080
|
+
if (!aggregatedPrefixes.size) {
|
|
12081
|
+
aggregatedPrefixes.add("");
|
|
12082
|
+
hasRealMain = true;
|
|
12083
|
+
}
|
|
12084
|
+
const shouldIgnoreAsMain = !aggregatedPrefixes.has("") && importerParents.length > 0;
|
|
12085
|
+
const ignored = shouldIgnoreAsMain || forcedDuplicate && !aggregatedPrefixes.has("") ? [relativeId] : [];
|
|
12086
|
+
const result = {
|
|
12087
|
+
prefixes: Array.from(aggregatedPrefixes),
|
|
12088
|
+
hasRealMain,
|
|
12089
|
+
ignored: Array.from(/* @__PURE__ */ new Set([...aggregatedIgnored, ...ignored]))
|
|
12090
|
+
};
|
|
12091
|
+
state.cache.set(importer, result);
|
|
12092
|
+
state.stack.delete(importer);
|
|
12093
|
+
return {
|
|
12094
|
+
prefixes: [...result.prefixes],
|
|
12095
|
+
hasRealMain: result.hasRealMain,
|
|
12096
|
+
ignored: [...result.ignored]
|
|
12097
|
+
};
|
|
12056
12098
|
}
|
|
12057
12099
|
function resolveSubPackagePrefix(fileName, subPackageRoots) {
|
|
12058
12100
|
for (const root of subPackageRoots) {
|
|
@@ -12108,6 +12150,7 @@ function applySharedChunkStrategy(bundle, options) {
|
|
|
12108
12150
|
}
|
|
12109
12151
|
}
|
|
12110
12152
|
if (hasMainImporter || importerMap.size === 0) {
|
|
12153
|
+
consumeSharedChunkDiagnostics(originalSharedFileName);
|
|
12111
12154
|
let finalFileName = chunk.fileName;
|
|
12112
12155
|
if (fileName.startsWith(`${SHARED_CHUNK_VIRTUAL_PREFIX}/`)) {
|
|
12113
12156
|
const newFileName = fileName.slice(SHARED_CHUNK_VIRTUAL_PREFIX.length + 1);
|
|
@@ -12124,6 +12167,7 @@ function applySharedChunkStrategy(bundle, options) {
|
|
|
12124
12167
|
}
|
|
12125
12168
|
const importerToChunk = /* @__PURE__ */ new Map();
|
|
12126
12169
|
const duplicates = [];
|
|
12170
|
+
const diagnostics = consumeSharedChunkDiagnostics(originalSharedFileName);
|
|
12127
12171
|
for (const { newFileName, importers: importerFiles } of importerMap.values()) {
|
|
12128
12172
|
this.emitFile({
|
|
12129
12173
|
type: "asset",
|
|
@@ -12146,20 +12190,36 @@ function applySharedChunkStrategy(bundle, options) {
|
|
|
12146
12190
|
});
|
|
12147
12191
|
}
|
|
12148
12192
|
updateImporters(bundle, importerToChunk, fileName);
|
|
12149
|
-
|
|
12150
|
-
|
|
12151
|
-
|
|
12152
|
-
|
|
12153
|
-
|
|
12154
|
-
|
|
12155
|
-
|
|
12156
|
-
chunk.modules = {};
|
|
12193
|
+
delete bundle[fileName];
|
|
12194
|
+
const mapKey = `${fileName}.map`;
|
|
12195
|
+
if (bundle[mapKey]) {
|
|
12196
|
+
delete bundle[mapKey];
|
|
12197
|
+
}
|
|
12198
|
+
const chunkBytes = typeof originalCode === "string" ? Buffer2.byteLength(originalCode, "utf8") : void 0;
|
|
12199
|
+
const redundantBytes = typeof chunkBytes === "number" ? chunkBytes * Math.max(duplicates.length - 1, 0) : void 0;
|
|
12157
12200
|
options.onDuplicate?.({
|
|
12158
12201
|
sharedFileName: originalSharedFileName,
|
|
12159
|
-
duplicates
|
|
12202
|
+
duplicates,
|
|
12203
|
+
ignoredMainImporters: diagnostics?.ignoredMainImporters,
|
|
12204
|
+
chunkBytes,
|
|
12205
|
+
redundantBytes
|
|
12160
12206
|
});
|
|
12161
12207
|
}
|
|
12162
12208
|
}
|
|
12209
|
+
function consumeSharedChunkDiagnostics(fileName) {
|
|
12210
|
+
const direct = sharedChunkDiagnostics.get(fileName);
|
|
12211
|
+
if (direct) {
|
|
12212
|
+
sharedChunkDiagnostics.delete(fileName);
|
|
12213
|
+
return direct;
|
|
12214
|
+
}
|
|
12215
|
+
const withoutExt = fileName.replace(/\.[^./\\]+$/, "");
|
|
12216
|
+
const fallback = sharedChunkDiagnostics.get(withoutExt);
|
|
12217
|
+
if (fallback) {
|
|
12218
|
+
sharedChunkDiagnostics.delete(withoutExt);
|
|
12219
|
+
return fallback;
|
|
12220
|
+
}
|
|
12221
|
+
return void 0;
|
|
12222
|
+
}
|
|
12163
12223
|
function isSharedVirtualChunk(fileName, output) {
|
|
12164
12224
|
return output?.type === "chunk" && fileName.startsWith(`${SHARED_CHUNK_VIRTUAL_PREFIX}/`);
|
|
12165
12225
|
}
|
|
@@ -12247,7 +12307,8 @@ function createAdvancedChunkNameResolver(options) {
|
|
|
12247
12307
|
relativeAbsoluteSrcRoot,
|
|
12248
12308
|
getSubPackageRoots,
|
|
12249
12309
|
strategy,
|
|
12250
|
-
vendorsMatchers
|
|
12310
|
+
vendorsMatchers,
|
|
12311
|
+
forceDuplicateTester
|
|
12251
12312
|
} = options;
|
|
12252
12313
|
const isVendor = testByReg2DExpList(vendorsMatchers);
|
|
12253
12314
|
return (id, ctx) => {
|
|
@@ -12255,152 +12316,85 @@ function createAdvancedChunkNameResolver(options) {
|
|
|
12255
12316
|
const sharedName = resolveSharedChunkName({
|
|
12256
12317
|
id,
|
|
12257
12318
|
ctx,
|
|
12258
|
-
relativeAbsoluteSrcRoot,
|
|
12259
|
-
subPackageRoots,
|
|
12260
|
-
strategy
|
|
12261
|
-
|
|
12262
|
-
|
|
12263
|
-
|
|
12264
|
-
|
|
12265
|
-
if (strategy === "hoist") {
|
|
12266
|
-
return "vendors";
|
|
12267
|
-
}
|
|
12268
|
-
return sharedName;
|
|
12269
|
-
};
|
|
12270
|
-
}
|
|
12271
|
-
|
|
12272
|
-
// src/runtime/independentError.ts
|
|
12273
|
-
init_esm_shims();
|
|
12274
|
-
var ANSI_ESCAPE_PATTERN = /\u001B\[[0-9;]*m/g;
|
|
12275
|
-
function stripAnsi(value) {
|
|
12276
|
-
return value.replace(ANSI_ESCAPE_PATTERN, "");
|
|
12277
|
-
}
|
|
12278
|
-
function isErrorInstance(value) {
|
|
12279
|
-
return value instanceof Error;
|
|
12280
|
-
}
|
|
12281
|
-
function formatSummary(payload) {
|
|
12282
|
-
const parts = [];
|
|
12283
|
-
const code = payload.code;
|
|
12284
|
-
if (typeof code === "string" && code.trim()) {
|
|
12285
|
-
parts.push(`code: ${code.trim()}`);
|
|
12286
|
-
}
|
|
12287
|
-
const plugin = payload.plugin;
|
|
12288
|
-
if (typeof plugin === "string" && plugin.trim()) {
|
|
12289
|
-
parts.push(`plugin: ${plugin.trim()}`);
|
|
12290
|
-
}
|
|
12291
|
-
const id = payload.id;
|
|
12292
|
-
if (typeof id === "string" && id.trim()) {
|
|
12293
|
-
parts.push(`id: ${id.trim()}`);
|
|
12294
|
-
}
|
|
12295
|
-
if (!parts.length) {
|
|
12296
|
-
return "";
|
|
12297
|
-
}
|
|
12298
|
-
return ` (${parts.join(", ")})`;
|
|
12299
|
-
}
|
|
12300
|
-
function collectDetails(payload) {
|
|
12301
|
-
const details = [];
|
|
12302
|
-
const frame = payload.frame;
|
|
12303
|
-
if (typeof frame === "string" && frame.trim()) {
|
|
12304
|
-
details.push(frame.trim());
|
|
12305
|
-
}
|
|
12306
|
-
const stack = payload.stack;
|
|
12307
|
-
if (typeof stack === "string" && stack.trim()) {
|
|
12308
|
-
details.push(stack.trim());
|
|
12309
|
-
}
|
|
12310
|
-
return details;
|
|
12311
|
-
}
|
|
12312
|
-
function extractMessage(value, seen) {
|
|
12313
|
-
if (!value || seen.has(value)) {
|
|
12314
|
-
return void 0;
|
|
12315
|
-
}
|
|
12316
|
-
if (typeof value === "string") {
|
|
12317
|
-
const trimmed = stripAnsi(value).trim();
|
|
12318
|
-
return trimmed || void 0;
|
|
12319
|
-
}
|
|
12320
|
-
if (isErrorInstance(value)) {
|
|
12321
|
-
const trimmed = stripAnsi(value.message ?? "").trim();
|
|
12322
|
-
if (trimmed) {
|
|
12323
|
-
return trimmed;
|
|
12324
|
-
}
|
|
12325
|
-
if (value.cause) {
|
|
12326
|
-
return extractMessage(value.cause, seen);
|
|
12327
|
-
}
|
|
12328
|
-
return void 0;
|
|
12329
|
-
}
|
|
12330
|
-
if (typeof value === "object") {
|
|
12331
|
-
const record = value;
|
|
12332
|
-
seen.add(record);
|
|
12333
|
-
const directMessage = extractMessage(record.message, seen);
|
|
12334
|
-
if (directMessage) {
|
|
12335
|
-
return directMessage;
|
|
12319
|
+
relativeAbsoluteSrcRoot,
|
|
12320
|
+
subPackageRoots,
|
|
12321
|
+
strategy,
|
|
12322
|
+
forceDuplicateTester
|
|
12323
|
+
});
|
|
12324
|
+
if (!isVendor(id)) {
|
|
12325
|
+
return sharedName;
|
|
12336
12326
|
}
|
|
12337
|
-
|
|
12338
|
-
|
|
12339
|
-
|
|
12340
|
-
|
|
12341
|
-
|
|
12342
|
-
|
|
12327
|
+
if (strategy === "hoist") {
|
|
12328
|
+
return "vendors";
|
|
12329
|
+
}
|
|
12330
|
+
return sharedName;
|
|
12331
|
+
};
|
|
12332
|
+
}
|
|
12333
|
+
|
|
12334
|
+
// src/runtime/sharedBuildConfig.ts
|
|
12335
|
+
var REG_NODE_MODULES_DIR = /[\\/]node_modules[\\/]/gi;
|
|
12336
|
+
var REG_COMMONJS_HELPERS = /commonjsHelpers\.js$/;
|
|
12337
|
+
function createSharedBuildConfig(configService, scanService) {
|
|
12338
|
+
const nodeModulesDeps = [REG_NODE_MODULES_DIR];
|
|
12339
|
+
const commonjsHelpersDeps = [REG_COMMONJS_HELPERS];
|
|
12340
|
+
const sharedStrategy = configService.weappViteConfig?.chunks?.sharedStrategy ?? DEFAULT_SHARED_CHUNK_STRATEGY;
|
|
12341
|
+
const forceDuplicatePatterns = configService.weappViteConfig?.chunks?.forceDuplicatePatterns;
|
|
12342
|
+
const forceDuplicateTester = createForceDuplicateTester(forceDuplicatePatterns);
|
|
12343
|
+
const resolveAdvancedChunkName = createAdvancedChunkNameResolver({
|
|
12344
|
+
vendorsMatchers: [nodeModulesDeps, commonjsHelpersDeps],
|
|
12345
|
+
relativeAbsoluteSrcRoot: configService.relativeAbsoluteSrcRoot,
|
|
12346
|
+
getSubPackageRoots: () => scanService.subPackageMap.keys(),
|
|
12347
|
+
strategy: sharedStrategy,
|
|
12348
|
+
forceDuplicateTester
|
|
12349
|
+
});
|
|
12350
|
+
return {
|
|
12351
|
+
build: {
|
|
12352
|
+
rolldownOptions: {
|
|
12353
|
+
output: {
|
|
12354
|
+
advancedChunks: {
|
|
12355
|
+
groups: [
|
|
12356
|
+
{
|
|
12357
|
+
name: (id, ctx) => resolveAdvancedChunkName(id, ctx)
|
|
12358
|
+
}
|
|
12359
|
+
]
|
|
12360
|
+
},
|
|
12361
|
+
chunkFileNames: "[name].js"
|
|
12343
12362
|
}
|
|
12344
12363
|
}
|
|
12345
12364
|
}
|
|
12346
|
-
}
|
|
12347
|
-
return void 0;
|
|
12365
|
+
};
|
|
12348
12366
|
}
|
|
12349
|
-
function
|
|
12350
|
-
|
|
12351
|
-
|
|
12352
|
-
if (!cause.message || cause.message.trim() === "") {
|
|
12353
|
-
return new Error(fallback, { cause });
|
|
12354
|
-
}
|
|
12355
|
-
return cause;
|
|
12356
|
-
}
|
|
12357
|
-
if (!cause) {
|
|
12358
|
-
return new Error(fallback);
|
|
12359
|
-
}
|
|
12360
|
-
if (typeof cause === "string") {
|
|
12361
|
-
const trimmed = stripAnsi(cause).trim();
|
|
12362
|
-
if (!trimmed) {
|
|
12363
|
-
return new Error(fallback, { cause });
|
|
12364
|
-
}
|
|
12365
|
-
return new Error(trimmed, { cause });
|
|
12367
|
+
function createForceDuplicateTester(patterns) {
|
|
12368
|
+
if (!patterns || patterns.length === 0) {
|
|
12369
|
+
return void 0;
|
|
12366
12370
|
}
|
|
12367
|
-
|
|
12368
|
-
|
|
12369
|
-
|
|
12370
|
-
|
|
12371
|
-
const summary = formatSummary(payload);
|
|
12372
|
-
const detailLines = collectDetails(payload);
|
|
12373
|
-
if (extracted) {
|
|
12374
|
-
let composedMessage = extracted;
|
|
12375
|
-
if (summary) {
|
|
12376
|
-
composedMessage += summary;
|
|
12377
|
-
}
|
|
12378
|
-
if (detailLines.length) {
|
|
12379
|
-
composedMessage += `
|
|
12380
|
-
${detailLines.join("\n")}`;
|
|
12381
|
-
}
|
|
12382
|
-
return new Error(composedMessage, { cause });
|
|
12371
|
+
const matchers = patterns.map((pattern) => {
|
|
12372
|
+
if (typeof pattern === "string") {
|
|
12373
|
+
const matcher = picomatch(pattern, { dot: true });
|
|
12374
|
+
return (value) => matcher(value);
|
|
12383
12375
|
}
|
|
12384
|
-
if (
|
|
12385
|
-
|
|
12386
|
-
|
|
12387
|
-
|
|
12388
|
-
|
|
12389
|
-
}
|
|
12376
|
+
if (isRegexp(pattern)) {
|
|
12377
|
+
return (value) => {
|
|
12378
|
+
pattern.lastIndex = 0;
|
|
12379
|
+
return pattern.test(value);
|
|
12380
|
+
};
|
|
12390
12381
|
}
|
|
12382
|
+
return void 0;
|
|
12383
|
+
}).filter((matcher) => typeof matcher === "function");
|
|
12384
|
+
if (!matchers.length) {
|
|
12385
|
+
return void 0;
|
|
12391
12386
|
}
|
|
12392
|
-
|
|
12393
|
-
const
|
|
12394
|
-
|
|
12395
|
-
|
|
12387
|
+
return (relativeId, absoluteId) => {
|
|
12388
|
+
for (const matcher of matchers) {
|
|
12389
|
+
if (matcher(relativeId) || matcher(absoluteId)) {
|
|
12390
|
+
return true;
|
|
12391
|
+
}
|
|
12396
12392
|
}
|
|
12397
|
-
|
|
12398
|
-
}
|
|
12399
|
-
return new Error(fallback, { cause });
|
|
12393
|
+
return false;
|
|
12394
|
+
};
|
|
12400
12395
|
}
|
|
12401
12396
|
|
|
12402
12397
|
// src/runtime/buildPlugin.ts
|
|
12403
|
-
var REG_NODE_MODULES_DIR = /[\\/]node_modules[\\/]/gi;
|
|
12404
12398
|
function createBuildService(ctx) {
|
|
12405
12399
|
function assertRuntimeServices(target) {
|
|
12406
12400
|
if (!target.configService || !target.watcherService || !target.npmService || !target.scanService) {
|
|
@@ -12488,40 +12482,16 @@ function createBuildService(ctx) {
|
|
|
12488
12482
|
configService.mergeWorkers()
|
|
12489
12483
|
);
|
|
12490
12484
|
}
|
|
12491
|
-
function sharedBuildConfig() {
|
|
12492
|
-
const nodeModulesDeps = [REG_NODE_MODULES_DIR];
|
|
12493
|
-
const commonjsHelpersDeps = [/commonjsHelpers\.js$/];
|
|
12494
|
-
const sharedStrategy = configService.weappViteConfig?.chunks?.sharedStrategy ?? DEFAULT_SHARED_CHUNK_STRATEGY;
|
|
12495
|
-
const resolveAdvancedChunkName = createAdvancedChunkNameResolver({
|
|
12496
|
-
vendorsMatchers: [nodeModulesDeps, commonjsHelpersDeps],
|
|
12497
|
-
relativeAbsoluteSrcRoot: configService.relativeAbsoluteSrcRoot,
|
|
12498
|
-
getSubPackageRoots: () => scanService.subPackageMap.keys(),
|
|
12499
|
-
strategy: sharedStrategy
|
|
12500
|
-
});
|
|
12501
|
-
return {
|
|
12502
|
-
build: {
|
|
12503
|
-
rolldownOptions: {
|
|
12504
|
-
output: {
|
|
12505
|
-
advancedChunks: {
|
|
12506
|
-
groups: [
|
|
12507
|
-
{
|
|
12508
|
-
name: (id, ctxPlugin) => resolveAdvancedChunkName(id, ctxPlugin)
|
|
12509
|
-
}
|
|
12510
|
-
]
|
|
12511
|
-
},
|
|
12512
|
-
chunkFileNames: "[name].js"
|
|
12513
|
-
}
|
|
12514
|
-
}
|
|
12515
|
-
}
|
|
12516
|
-
};
|
|
12517
|
-
}
|
|
12518
12485
|
async function runDev() {
|
|
12519
12486
|
if (process3.env.NODE_ENV === void 0) {
|
|
12520
12487
|
process3.env.NODE_ENV = "development";
|
|
12521
12488
|
}
|
|
12522
12489
|
debug?.("dev build watcher start");
|
|
12523
12490
|
const { hasWorkersDir, workersDir } = checkWorkersOptions();
|
|
12524
|
-
const buildOptions = configService.merge(
|
|
12491
|
+
const buildOptions = configService.merge(
|
|
12492
|
+
void 0,
|
|
12493
|
+
createSharedBuildConfig(configService, scanService)
|
|
12494
|
+
);
|
|
12525
12495
|
const watcherPromise = build(
|
|
12526
12496
|
buildOptions
|
|
12527
12497
|
);
|
|
@@ -12571,7 +12541,7 @@ function createBuildService(ctx) {
|
|
|
12571
12541
|
}
|
|
12572
12542
|
const baseDir = typeof details === "object" && details && "watchedPath" in details ? details.watchedPath ?? absWorkerRoot : absWorkerRoot;
|
|
12573
12543
|
const resolved = path11.isAbsolute(candidate) ? candidate : path11.resolve(baseDir, candidate);
|
|
12574
|
-
const exists =
|
|
12544
|
+
const exists = fs6.existsSync(resolved);
|
|
12575
12545
|
if (exists) {
|
|
12576
12546
|
logWorkerEvent("rename->add", resolved);
|
|
12577
12547
|
return;
|
|
@@ -12610,7 +12580,10 @@ function createBuildService(ctx) {
|
|
|
12610
12580
|
debug?.("prod build start");
|
|
12611
12581
|
const { hasWorkersDir } = checkWorkersOptions();
|
|
12612
12582
|
const bundlerPromise = build(
|
|
12613
|
-
configService.merge(
|
|
12583
|
+
configService.merge(
|
|
12584
|
+
void 0,
|
|
12585
|
+
createSharedBuildConfig(configService, scanService)
|
|
12586
|
+
)
|
|
12614
12587
|
);
|
|
12615
12588
|
const workerPromise = hasWorkersDir ? buildWorkers() : Promise.resolve();
|
|
12616
12589
|
const [output] = await Promise.all([bundlerPromise, workerPromise]);
|
|
@@ -12695,11 +12668,11 @@ import { defu as defu5 } from "@weapp-core/shared";
|
|
|
12695
12668
|
|
|
12696
12669
|
// ../../node_modules/.pnpm/local-pkg@1.1.2/node_modules/local-pkg/dist/index.mjs
|
|
12697
12670
|
init_esm_shims();
|
|
12698
|
-
import
|
|
12671
|
+
import fs8 from "fs";
|
|
12699
12672
|
import { createRequire as createRequire2 } from "module";
|
|
12700
12673
|
import path13, { dirname as dirname4, join as join3, win32 as win322 } from "path";
|
|
12701
12674
|
import process4 from "process";
|
|
12702
|
-
import
|
|
12675
|
+
import fsPromises2 from "fs/promises";
|
|
12703
12676
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
12704
12677
|
|
|
12705
12678
|
// ../../node_modules/.pnpm/mlly@1.8.0/node_modules/mlly/dist/index.mjs
|
|
@@ -18292,10 +18265,10 @@ pp.readWord = function() {
|
|
|
18292
18265
|
}
|
|
18293
18266
|
return this.finishToken(type, word);
|
|
18294
18267
|
};
|
|
18295
|
-
var
|
|
18268
|
+
var version = "8.15.0";
|
|
18296
18269
|
Parser.acorn = {
|
|
18297
18270
|
Parser,
|
|
18298
|
-
version
|
|
18271
|
+
version,
|
|
18299
18272
|
defaultOptions: defaultOptions2,
|
|
18300
18273
|
Position,
|
|
18301
18274
|
SourceLocation,
|
|
@@ -18317,7 +18290,7 @@ Parser.acorn = {
|
|
|
18317
18290
|
|
|
18318
18291
|
// ../../node_modules/.pnpm/mlly@1.8.0/node_modules/mlly/dist/index.mjs
|
|
18319
18292
|
import { builtinModules, createRequire } from "module";
|
|
18320
|
-
import
|
|
18293
|
+
import fs7, { realpathSync as realpathSync2, statSync as statSync2, promises as promises2 } from "fs";
|
|
18321
18294
|
|
|
18322
18295
|
// ../../node_modules/.pnpm/ufo@1.6.1/node_modules/ufo/dist/index.mjs
|
|
18323
18296
|
init_esm_shims();
|
|
@@ -18721,7 +18694,7 @@ function read(jsonPath, { base, specifier }) {
|
|
|
18721
18694
|
}
|
|
18722
18695
|
let string;
|
|
18723
18696
|
try {
|
|
18724
|
-
string =
|
|
18697
|
+
string = fs7.readFileSync(path12.toNamespacedPath(jsonPath), "utf8");
|
|
18725
18698
|
} catch (error) {
|
|
18726
18699
|
const exception = (
|
|
18727
18700
|
/** @type {ErrnoException} */
|
|
@@ -19515,8 +19488,8 @@ function packageResolve(specifier, base, conditions) {
|
|
|
19515
19488
|
let packageJsonPath = fileURLToPath$1(packageJsonUrl);
|
|
19516
19489
|
let lastPath;
|
|
19517
19490
|
do {
|
|
19518
|
-
const
|
|
19519
|
-
if (!
|
|
19491
|
+
const stat5 = tryStatSync(packageJsonPath.slice(0, -13));
|
|
19492
|
+
if (!stat5 || !stat5.isDirectory()) {
|
|
19520
19493
|
lastPath = packageJsonPath;
|
|
19521
19494
|
packageJsonUrl = new URL$1(
|
|
19522
19495
|
(isScoped ? "../../../../node_modules/" : "../../../node_modules/") + packageName + "/package.json",
|
|
@@ -19646,8 +19619,8 @@ function _resolve(id, options = {}) {
|
|
|
19646
19619
|
}
|
|
19647
19620
|
if (isAbsolute2(id)) {
|
|
19648
19621
|
try {
|
|
19649
|
-
const
|
|
19650
|
-
if (
|
|
19622
|
+
const stat5 = statSync2(id);
|
|
19623
|
+
if (stat5.isFile()) {
|
|
19651
19624
|
return pathToFileURL(id);
|
|
19652
19625
|
}
|
|
19653
19626
|
} catch (error) {
|
|
@@ -19832,7 +19805,7 @@ async function findUp$1(name, {
|
|
|
19832
19805
|
while (directory) {
|
|
19833
19806
|
const filePath = isAbsoluteName ? name : path13.join(directory, name);
|
|
19834
19807
|
try {
|
|
19835
|
-
const stats = await
|
|
19808
|
+
const stats = await fsPromises2.stat(filePath);
|
|
19836
19809
|
if (type === "file" && stats.isFile() || type === "directory" && stats.isDirectory()) {
|
|
19837
19810
|
return filePath;
|
|
19838
19811
|
}
|
|
@@ -19856,7 +19829,7 @@ function findUpSync(name, {
|
|
|
19856
19829
|
while (directory) {
|
|
19857
19830
|
const filePath = isAbsoluteName ? name : path13.join(directory, name);
|
|
19858
19831
|
try {
|
|
19859
|
-
const stats =
|
|
19832
|
+
const stats = fs8.statSync(filePath, { throwIfNoEntry: false });
|
|
19860
19833
|
if (type === "file" && stats?.isFile() || type === "directory" && stats?.isDirectory()) {
|
|
19861
19834
|
return filePath;
|
|
19862
19835
|
}
|
|
@@ -19902,8 +19875,8 @@ function getPackageJsonPath(name, options = {}) {
|
|
|
19902
19875
|
return searchPackageJSON(entry);
|
|
19903
19876
|
}
|
|
19904
19877
|
var readFile = quansync2({
|
|
19905
|
-
async: (id) =>
|
|
19906
|
-
sync: (id) =>
|
|
19878
|
+
async: (id) => fs8.promises.readFile(id, "utf8"),
|
|
19879
|
+
sync: (id) => fs8.readFileSync(id, "utf8")
|
|
19907
19880
|
});
|
|
19908
19881
|
var getPackageInfo = quansync2(function* (name, options = {}) {
|
|
19909
19882
|
const packageJsonPath = getPackageJsonPath(name, options);
|
|
@@ -19942,7 +19915,7 @@ function searchPackageJSON(dir) {
|
|
|
19942
19915
|
return;
|
|
19943
19916
|
dir = newDir;
|
|
19944
19917
|
packageJsonPath = join3(dir, "package.json");
|
|
19945
|
-
if (
|
|
19918
|
+
if (fs8.existsSync(packageJsonPath))
|
|
19946
19919
|
break;
|
|
19947
19920
|
}
|
|
19948
19921
|
return packageJsonPath;
|
|
@@ -19953,7 +19926,7 @@ var findUp = quansync2({
|
|
|
19953
19926
|
});
|
|
19954
19927
|
var loadPackageJSON = quansync2(function* (cwd = process4.cwd()) {
|
|
19955
19928
|
const path36 = yield findUp("package.json", { cwd });
|
|
19956
|
-
if (!path36 || !
|
|
19929
|
+
if (!path36 || !fs8.existsSync(path36))
|
|
19957
19930
|
return null;
|
|
19958
19931
|
return JSON.parse(yield readFile(path36));
|
|
19959
19932
|
});
|
|
@@ -19966,7 +19939,7 @@ var isPackageListedSync = isPackageListed.sync;
|
|
|
19966
19939
|
|
|
19967
19940
|
// ../../node_modules/.pnpm/package-manager-detector@1.5.0/node_modules/package-manager-detector/dist/detect.mjs
|
|
19968
19941
|
init_esm_shims();
|
|
19969
|
-
import
|
|
19942
|
+
import fs9 from "fs/promises";
|
|
19970
19943
|
import path14 from "path";
|
|
19971
19944
|
import process5 from "process";
|
|
19972
19945
|
|
|
@@ -20010,8 +19983,8 @@ var INSTALL_METADATA = {
|
|
|
20010
19983
|
// ../../node_modules/.pnpm/package-manager-detector@1.5.0/node_modules/package-manager-detector/dist/detect.mjs
|
|
20011
19984
|
async function pathExists(path210, type) {
|
|
20012
19985
|
try {
|
|
20013
|
-
const
|
|
20014
|
-
return type === "file" ?
|
|
19986
|
+
const stat5 = await fs9.stat(path210);
|
|
19987
|
+
return type === "file" ? stat5.isFile() : stat5.isDirectory();
|
|
20015
19988
|
} catch {
|
|
20016
19989
|
return false;
|
|
20017
19990
|
}
|
|
@@ -20082,7 +20055,7 @@ async function detect(options = {}) {
|
|
|
20082
20055
|
return null;
|
|
20083
20056
|
}
|
|
20084
20057
|
function getNameAndVer(pkg) {
|
|
20085
|
-
const handelVer = (
|
|
20058
|
+
const handelVer = (version2) => version2?.match(/\d+(\.\d+){0,2}/)?.[0] ?? version2;
|
|
20086
20059
|
if (typeof pkg.packageManager === "string") {
|
|
20087
20060
|
const [name, ver] = pkg.packageManager.replace(/^\^/, "").split("@");
|
|
20088
20061
|
return { name, ver: handelVer(ver) };
|
|
@@ -20097,23 +20070,23 @@ function getNameAndVer(pkg) {
|
|
|
20097
20070
|
}
|
|
20098
20071
|
async function handlePackageManager(filepath, onUnknown) {
|
|
20099
20072
|
try {
|
|
20100
|
-
const pkg = JSON.parse(await
|
|
20073
|
+
const pkg = JSON.parse(await fs9.readFile(filepath, "utf8"));
|
|
20101
20074
|
let agent;
|
|
20102
20075
|
const nameAndVer = getNameAndVer(pkg);
|
|
20103
20076
|
if (nameAndVer) {
|
|
20104
20077
|
const name = nameAndVer.name;
|
|
20105
20078
|
const ver = nameAndVer.ver;
|
|
20106
|
-
let
|
|
20079
|
+
let version2 = ver;
|
|
20107
20080
|
if (name === "yarn" && ver && Number.parseInt(ver) > 1) {
|
|
20108
20081
|
agent = "yarn@berry";
|
|
20109
|
-
|
|
20110
|
-
return { name, agent, version:
|
|
20082
|
+
version2 = "berry";
|
|
20083
|
+
return { name, agent, version: version2 };
|
|
20111
20084
|
} else if (name === "pnpm" && ver && Number.parseInt(ver) < 7) {
|
|
20112
20085
|
agent = "pnpm@6";
|
|
20113
|
-
return { name, agent, version:
|
|
20086
|
+
return { name, agent, version: version2 };
|
|
20114
20087
|
} else if (AGENTS.includes(name)) {
|
|
20115
20088
|
agent = name;
|
|
20116
|
-
return { name, agent, version:
|
|
20089
|
+
return { name, agent, version: version2 };
|
|
20117
20090
|
} else {
|
|
20118
20091
|
return onUnknown?.(pkg.packageManager) ?? null;
|
|
20119
20092
|
}
|
|
@@ -20129,9 +20102,126 @@ function isMetadataYarnClassic(metadataPath) {
|
|
|
20129
20102
|
// src/runtime/config/createConfigService.ts
|
|
20130
20103
|
import path32 from "pathe";
|
|
20131
20104
|
|
|
20105
|
+
// src/platform.ts
|
|
20106
|
+
init_esm_shims();
|
|
20107
|
+
|
|
20108
|
+
// src/platforms/adapters.ts
|
|
20109
|
+
init_esm_shims();
|
|
20110
|
+
var MINI_PROGRAM_PLATFORM_ADAPTERS = [
|
|
20111
|
+
{
|
|
20112
|
+
id: "weapp",
|
|
20113
|
+
displayName: "WeChat Mini Program",
|
|
20114
|
+
aliases: ["weapp", "wechat", "weixin", "wx"],
|
|
20115
|
+
outputExtensions: {
|
|
20116
|
+
js: "js",
|
|
20117
|
+
json: "json",
|
|
20118
|
+
wxml: "wxml",
|
|
20119
|
+
wxss: "wxss",
|
|
20120
|
+
wxs: "wxs"
|
|
20121
|
+
}
|
|
20122
|
+
},
|
|
20123
|
+
{
|
|
20124
|
+
id: "alipay",
|
|
20125
|
+
displayName: "Alipay Mini Program",
|
|
20126
|
+
aliases: ["alipay", "ali", "my"],
|
|
20127
|
+
outputExtensions: {
|
|
20128
|
+
js: "js",
|
|
20129
|
+
json: "json",
|
|
20130
|
+
wxml: "axml",
|
|
20131
|
+
wxss: "acss",
|
|
20132
|
+
wxs: "sjs"
|
|
20133
|
+
}
|
|
20134
|
+
},
|
|
20135
|
+
{
|
|
20136
|
+
id: "swan",
|
|
20137
|
+
displayName: "Baidu Smart Program",
|
|
20138
|
+
aliases: ["swan", "baidu", "bd"],
|
|
20139
|
+
outputExtensions: {
|
|
20140
|
+
js: "js",
|
|
20141
|
+
json: "json",
|
|
20142
|
+
wxml: "swan",
|
|
20143
|
+
wxss: "css",
|
|
20144
|
+
wxs: "sjs"
|
|
20145
|
+
}
|
|
20146
|
+
},
|
|
20147
|
+
{
|
|
20148
|
+
id: "tt",
|
|
20149
|
+
displayName: "ByteDance / Douyin Mini Program",
|
|
20150
|
+
aliases: ["tt", "toutiao", "bytedance", "douyin"],
|
|
20151
|
+
outputExtensions: {
|
|
20152
|
+
js: "js",
|
|
20153
|
+
json: "json",
|
|
20154
|
+
wxml: "ttml",
|
|
20155
|
+
wxss: "ttss"
|
|
20156
|
+
}
|
|
20157
|
+
},
|
|
20158
|
+
{
|
|
20159
|
+
id: "jd",
|
|
20160
|
+
displayName: "JD Mini Program",
|
|
20161
|
+
aliases: ["jd", "jingdong"],
|
|
20162
|
+
outputExtensions: {
|
|
20163
|
+
js: "js",
|
|
20164
|
+
json: "json",
|
|
20165
|
+
wxml: "jxml",
|
|
20166
|
+
wxss: "jxss",
|
|
20167
|
+
wxs: "wxs"
|
|
20168
|
+
}
|
|
20169
|
+
},
|
|
20170
|
+
{
|
|
20171
|
+
id: "xhs",
|
|
20172
|
+
displayName: "Xiaohongshu Mini Program",
|
|
20173
|
+
aliases: ["xhs", "xiaohongshu", "little-red-book", "red"],
|
|
20174
|
+
outputExtensions: {
|
|
20175
|
+
js: "js",
|
|
20176
|
+
json: "json",
|
|
20177
|
+
wxml: "xhsml",
|
|
20178
|
+
wxss: "css",
|
|
20179
|
+
wxs: "wxs"
|
|
20180
|
+
}
|
|
20181
|
+
}
|
|
20182
|
+
];
|
|
20183
|
+
|
|
20184
|
+
// src/platform.ts
|
|
20185
|
+
var DEFAULT_MP_PLATFORM = "weapp";
|
|
20186
|
+
var PLATFORM_ADAPTER_BY_ID = /* @__PURE__ */ new Map();
|
|
20187
|
+
var PLATFORM_ALIAS_TO_ID = /* @__PURE__ */ new Map();
|
|
20188
|
+
for (const adapter of MINI_PROGRAM_PLATFORM_ADAPTERS) {
|
|
20189
|
+
PLATFORM_ADAPTER_BY_ID.set(adapter.id, adapter);
|
|
20190
|
+
for (const alias of adapter.aliases) {
|
|
20191
|
+
const normalized = alias.trim().toLowerCase();
|
|
20192
|
+
if (!normalized) {
|
|
20193
|
+
continue;
|
|
20194
|
+
}
|
|
20195
|
+
PLATFORM_ALIAS_TO_ID.set(normalized, adapter.id);
|
|
20196
|
+
}
|
|
20197
|
+
if (!PLATFORM_ALIAS_TO_ID.has(adapter.id)) {
|
|
20198
|
+
PLATFORM_ALIAS_TO_ID.set(adapter.id, adapter.id);
|
|
20199
|
+
}
|
|
20200
|
+
}
|
|
20201
|
+
var MINI_PLATFORM_ALIASES = Object.freeze(
|
|
20202
|
+
Object.fromEntries(PLATFORM_ALIAS_TO_ID.entries())
|
|
20203
|
+
);
|
|
20204
|
+
function normalizeMiniPlatform(input) {
|
|
20205
|
+
return input ? input.trim().toLowerCase() : void 0;
|
|
20206
|
+
}
|
|
20207
|
+
function resolveMiniPlatform(input) {
|
|
20208
|
+
const normalized = normalizeMiniPlatform(input);
|
|
20209
|
+
if (!normalized) {
|
|
20210
|
+
return void 0;
|
|
20211
|
+
}
|
|
20212
|
+
return PLATFORM_ALIAS_TO_ID.get(normalized);
|
|
20213
|
+
}
|
|
20214
|
+
function getMiniProgramPlatformAdapter(platform) {
|
|
20215
|
+
const adapter = PLATFORM_ADAPTER_BY_ID.get(platform);
|
|
20216
|
+
if (!adapter) {
|
|
20217
|
+
throw new Error(`Unsupported mini program platform "${platform}".`);
|
|
20218
|
+
}
|
|
20219
|
+
return adapter;
|
|
20220
|
+
}
|
|
20221
|
+
|
|
20132
20222
|
// src/runtime/oxcRuntime.ts
|
|
20133
20223
|
init_esm_shims();
|
|
20134
|
-
import
|
|
20224
|
+
import fs10 from "fs-extra";
|
|
20135
20225
|
import path15 from "pathe";
|
|
20136
20226
|
var NULL_BYTE = "\0";
|
|
20137
20227
|
var OXC_RUNTIME_HELPER_ALIAS = new RegExp(`^(?:${NULL_BYTE})?@oxc-project(?:/|\\+)runtime(?:@[^/]+)?/helpers/(.+)\\.js$`);
|
|
@@ -20241,9 +20331,9 @@ function createOxcRuntimeSupport() {
|
|
|
20241
20331
|
const helperName = getOxcHelperName(id);
|
|
20242
20332
|
if (helperName) {
|
|
20243
20333
|
const helperPath = id.startsWith(NULL_BYTE) ? path15.resolve(oxcRuntimeHelpersRoot, `${helperName}.js`) : id;
|
|
20244
|
-
if (await
|
|
20334
|
+
if (await fs10.pathExists(helperPath)) {
|
|
20245
20335
|
logger_default.warn(`[weapp-vite] resolving oxc helper via Rolldown plugin: ${helperName}`);
|
|
20246
|
-
return
|
|
20336
|
+
return fs10.readFile(helperPath, "utf8");
|
|
20247
20337
|
}
|
|
20248
20338
|
const fallback = fallbackHelpers[helperName];
|
|
20249
20339
|
if (fallback) {
|
|
@@ -20279,7 +20369,7 @@ function createOxcRuntimeSupport() {
|
|
|
20279
20369
|
}
|
|
20280
20370
|
const helperPath = path15.resolve(oxcRuntimeHelpersRoot, `${helperName}.js`);
|
|
20281
20371
|
logger_default.warn(`[weapp-vite] resolving oxc helper via Vite plugin: ${helperName}`);
|
|
20282
|
-
return
|
|
20372
|
+
return fs10.readFile(helperPath, "utf8");
|
|
20283
20373
|
}
|
|
20284
20374
|
};
|
|
20285
20375
|
return {
|
|
@@ -20372,7 +20462,7 @@ function createAliasManager(oxcAlias, builtinAliases) {
|
|
|
20372
20462
|
// src/runtime/config/internal/loadConfig.ts
|
|
20373
20463
|
init_esm_shims();
|
|
20374
20464
|
import { defu } from "@weapp-core/shared";
|
|
20375
|
-
import
|
|
20465
|
+
import fs11 from "fs-extra";
|
|
20376
20466
|
import path18 from "pathe";
|
|
20377
20467
|
import { loadConfigFromFile } from "vite";
|
|
20378
20468
|
import tsconfigPaths from "vite-tsconfig-paths";
|
|
@@ -20411,7 +20501,9 @@ function getWeappViteConfig() {
|
|
|
20411
20501
|
},
|
|
20412
20502
|
chunks: {
|
|
20413
20503
|
sharedStrategy: "duplicate",
|
|
20414
|
-
logOptimization: true
|
|
20504
|
+
logOptimization: true,
|
|
20505
|
+
forceDuplicatePatterns: [],
|
|
20506
|
+
duplicateWarningBytes: 512 * 1024
|
|
20415
20507
|
}
|
|
20416
20508
|
};
|
|
20417
20509
|
}
|
|
@@ -20681,8 +20773,8 @@ function createLoadConfig(options) {
|
|
|
20681
20773
|
}
|
|
20682
20774
|
const packageJsonPath = path18.resolve(cwd, "package.json");
|
|
20683
20775
|
let packageJson = {};
|
|
20684
|
-
if (await
|
|
20685
|
-
const content = await
|
|
20776
|
+
if (await fs11.exists(packageJsonPath)) {
|
|
20777
|
+
const content = await fs11.readJson(packageJsonPath, {
|
|
20686
20778
|
throws: false
|
|
20687
20779
|
}) || {};
|
|
20688
20780
|
packageJson = content;
|
|
@@ -20869,7 +20961,7 @@ import { wrapPlugin } from "vite-plugin-performance";
|
|
|
20869
20961
|
// src/plugins/asset.ts
|
|
20870
20962
|
init_esm_shims();
|
|
20871
20963
|
import { fdir as Fdir2 } from "fdir";
|
|
20872
|
-
import
|
|
20964
|
+
import fs12 from "fs-extra";
|
|
20873
20965
|
import path19 from "pathe";
|
|
20874
20966
|
function normalizeCopyGlobs(globs) {
|
|
20875
20967
|
return Array.isArray(globs) ? globs : [];
|
|
@@ -20912,7 +21004,7 @@ function scanAssetFiles(configService, config) {
|
|
|
20912
21004
|
Array.from(files).filter(filter3).map(async (file) => {
|
|
20913
21005
|
return {
|
|
20914
21006
|
file,
|
|
20915
|
-
buffer: await
|
|
21007
|
+
buffer: await fs12.readFile(file)
|
|
20916
21008
|
};
|
|
20917
21009
|
})
|
|
20918
21010
|
);
|
|
@@ -21160,13 +21252,13 @@ function autoRoutes(ctx) {
|
|
|
21160
21252
|
// src/plugins/core.ts
|
|
21161
21253
|
init_esm_shims();
|
|
21162
21254
|
import { isEmptyObject as isEmptyObject2, isObject as isObject6, removeExtensionDeep as removeExtensionDeep5 } from "@weapp-core/shared";
|
|
21163
|
-
import
|
|
21255
|
+
import fs16 from "fs-extra";
|
|
21164
21256
|
import path26 from "pathe";
|
|
21165
21257
|
|
|
21166
21258
|
// src/plugins/css/shared/preprocessor.ts
|
|
21167
21259
|
init_esm_shims();
|
|
21168
21260
|
import { createHash } from "crypto";
|
|
21169
|
-
import
|
|
21261
|
+
import fs13 from "fs-extra";
|
|
21170
21262
|
import path21 from "pathe";
|
|
21171
21263
|
import { preprocessCSS } from "vite";
|
|
21172
21264
|
|
|
@@ -21336,7 +21428,7 @@ async function renderSharedStyleEntry(entry, _configService, resolvedConfig) {
|
|
|
21336
21428
|
const cacheKey = `${absolutePath}:${resolvedConfig ? "resolved" : "raw"}`;
|
|
21337
21429
|
let stats;
|
|
21338
21430
|
try {
|
|
21339
|
-
stats = await
|
|
21431
|
+
stats = await fs13.stat(absolutePath);
|
|
21340
21432
|
} catch (error) {
|
|
21341
21433
|
const reason = error instanceof Error ? error.message : String(error);
|
|
21342
21434
|
throw new Error(`[subpackages] \u7F16\u8BD1\u5171\u4EAB\u6837\u5F0F \`${entry.source}\` \u5931\u8D25\uFF1A${reason}`);
|
|
@@ -21349,7 +21441,7 @@ async function renderSharedStyleEntry(entry, _configService, resolvedConfig) {
|
|
|
21349
21441
|
};
|
|
21350
21442
|
}
|
|
21351
21443
|
try {
|
|
21352
|
-
const css2 = await
|
|
21444
|
+
const css2 = await fs13.readFile(absolutePath, "utf8");
|
|
21353
21445
|
if (!resolvedConfig) {
|
|
21354
21446
|
const result2 = {
|
|
21355
21447
|
css: css2,
|
|
@@ -21496,7 +21588,7 @@ function createJsonEmitManager(configService) {
|
|
|
21496
21588
|
init_esm_shims();
|
|
21497
21589
|
import { performance as performance3 } from "perf_hooks";
|
|
21498
21590
|
import { removeExtensionDeep as removeExtensionDeep3 } from "@weapp-core/shared";
|
|
21499
|
-
import
|
|
21591
|
+
import fs14 from "fs-extra";
|
|
21500
21592
|
|
|
21501
21593
|
// ../../node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.mjs
|
|
21502
21594
|
init_esm_shims();
|
|
@@ -22662,7 +22754,7 @@ async function addWatchTarget(pluginCtx, target, existsCache) {
|
|
|
22662
22754
|
pluginCtx.addWatchFile(target);
|
|
22663
22755
|
return cached;
|
|
22664
22756
|
}
|
|
22665
|
-
const exists = await
|
|
22757
|
+
const exists = await fs14.exists(target);
|
|
22666
22758
|
pluginCtx.addWatchFile(target);
|
|
22667
22759
|
existsCache.set(target, exists);
|
|
22668
22760
|
return exists;
|
|
@@ -22854,7 +22946,7 @@ function createEntryLoader(options) {
|
|
|
22854
22946
|
type: "plugin"
|
|
22855
22947
|
});
|
|
22856
22948
|
}
|
|
22857
|
-
const code = await
|
|
22949
|
+
const code = await fs14.readFile(id, "utf8");
|
|
22858
22950
|
const styleImports = await collectStyleImports(this, id, existsCache);
|
|
22859
22951
|
debug4?.(`loadEntry ${relativeCwdId} \u8017\u65F6 ${getTime()}`);
|
|
22860
22952
|
if (styleImports.length === 0) {
|
|
@@ -22991,7 +23083,7 @@ function collectRequireTokens(ast) {
|
|
|
22991
23083
|
|
|
22992
23084
|
// src/plugins/utils/invalidateEntry.ts
|
|
22993
23085
|
init_esm_shims();
|
|
22994
|
-
import
|
|
23086
|
+
import fs15 from "fs";
|
|
22995
23087
|
import process6 from "process";
|
|
22996
23088
|
import path25 from "pathe";
|
|
22997
23089
|
var watchedCssExts = new Set(supportedCssLangs.map((ext2) => `.${ext2}`));
|
|
@@ -23077,7 +23169,7 @@ function registerCssImports(ctx, importer, dependencies) {
|
|
|
23077
23169
|
}
|
|
23078
23170
|
async function extractCssImportDependencies(ctx, importer) {
|
|
23079
23171
|
try {
|
|
23080
|
-
const stats = await
|
|
23172
|
+
const stats = await fs15.promises.stat(importer);
|
|
23081
23173
|
if (!stats.isFile()) {
|
|
23082
23174
|
cleanupImporterGraph(ctx, importer);
|
|
23083
23175
|
return;
|
|
@@ -23088,7 +23180,7 @@ async function extractCssImportDependencies(ctx, importer) {
|
|
|
23088
23180
|
}
|
|
23089
23181
|
let cssContent;
|
|
23090
23182
|
try {
|
|
23091
|
-
cssContent = await
|
|
23183
|
+
cssContent = await fs15.promises.readFile(importer, "utf8");
|
|
23092
23184
|
} catch {
|
|
23093
23185
|
cleanupImporterGraph(ctx, importer);
|
|
23094
23186
|
return;
|
|
@@ -23270,7 +23362,7 @@ function ensureSidecarWatcher(ctx, rootDir) {
|
|
|
23270
23362
|
}
|
|
23271
23363
|
const { sidecarWatcherMap } = ctx.runtimeState.watcher;
|
|
23272
23364
|
const absRoot = path25.normalize(rootDir);
|
|
23273
|
-
if (!
|
|
23365
|
+
if (!fs15.existsSync(absRoot)) {
|
|
23274
23366
|
return;
|
|
23275
23367
|
}
|
|
23276
23368
|
if (sidecarWatcherMap.has(absRoot)) {
|
|
@@ -23337,7 +23429,7 @@ function ensureSidecarWatcher(ctx, rootDir) {
|
|
|
23337
23429
|
}
|
|
23338
23430
|
const baseDir = typeof details === "object" && details && "watchedPath" in details ? details.watchedPath ?? absRoot : absRoot;
|
|
23339
23431
|
const resolved = path25.isAbsolute(candidate) ? candidate : path25.resolve(baseDir, candidate);
|
|
23340
|
-
const exists =
|
|
23432
|
+
const exists = fs15.existsSync(resolved);
|
|
23341
23433
|
const derivedEvent = exists ? "create" : "delete";
|
|
23342
23434
|
const relativeResolved = ctx.configService.relativeCwd(resolved);
|
|
23343
23435
|
logger_default.info(`[watch:rename->${derivedEvent}] ${relativeResolved}`);
|
|
@@ -23797,8 +23889,8 @@ function createCoreLifecyclePlugin(state) {
|
|
|
23797
23889
|
if (parsed.query.wxss) {
|
|
23798
23890
|
const realPath = getCssRealPath(parsed);
|
|
23799
23891
|
this.addWatchFile(realPath);
|
|
23800
|
-
if (await
|
|
23801
|
-
const css2 = await
|
|
23892
|
+
if (await fs16.exists(realPath)) {
|
|
23893
|
+
const css2 = await fs16.readFile(realPath, "utf8");
|
|
23802
23894
|
return { code: css2 };
|
|
23803
23895
|
}
|
|
23804
23896
|
}
|
|
@@ -23838,10 +23930,16 @@ function createCoreLifecyclePlugin(state) {
|
|
|
23838
23930
|
const sharedStrategy = configService.weappViteConfig?.chunks?.sharedStrategy ?? DEFAULT_SHARED_CHUNK_STRATEGY;
|
|
23839
23931
|
const shouldLogChunks = configService.weappViteConfig?.chunks?.logOptimization ?? true;
|
|
23840
23932
|
const subPackageRoots = Array.from(scanService.subPackageMap.keys()).filter(Boolean);
|
|
23841
|
-
|
|
23842
|
-
|
|
23843
|
-
|
|
23844
|
-
|
|
23933
|
+
const duplicateWarningBytes = Number(configService.weappViteConfig?.chunks?.duplicateWarningBytes ?? 0);
|
|
23934
|
+
const shouldWarnOnDuplicate = Number.isFinite(duplicateWarningBytes) && duplicateWarningBytes > 0;
|
|
23935
|
+
let redundantBytesTotal = 0;
|
|
23936
|
+
const handleDuplicate = shouldLogChunks || shouldWarnOnDuplicate ? ({ duplicates, ignoredMainImporters, chunkBytes, redundantBytes }) => {
|
|
23937
|
+
if (shouldWarnOnDuplicate) {
|
|
23938
|
+
const duplicateCount = duplicates.length;
|
|
23939
|
+
const computedRedundant = typeof redundantBytes === "number" ? redundantBytes : typeof chunkBytes === "number" ? chunkBytes * Math.max(duplicateCount - 1, 0) : 0;
|
|
23940
|
+
redundantBytesTotal += computedRedundant;
|
|
23941
|
+
}
|
|
23942
|
+
if (shouldLogChunks) {
|
|
23845
23943
|
const subPackageSet = /* @__PURE__ */ new Set();
|
|
23846
23944
|
let totalReferences = 0;
|
|
23847
23945
|
for (const { fileName, importers } of duplicates) {
|
|
@@ -23852,8 +23950,14 @@ function createCoreLifecyclePlugin(state) {
|
|
|
23852
23950
|
}
|
|
23853
23951
|
}
|
|
23854
23952
|
const subPackageList = Array.from(subPackageSet).join("\u3001") || "\u76F8\u5173\u5206\u5305";
|
|
23855
|
-
|
|
23856
|
-
|
|
23953
|
+
const ignoredHint = ignoredMainImporters?.length ? `\uFF0C\u5FFD\u7565\u4E3B\u5305\u5F15\u7528\uFF1A${ignoredMainImporters.join("\u3001")}` : "";
|
|
23954
|
+
logger_default.info(`[subpackages] \u5206\u5305 ${subPackageList} \u5171\u4EAB\u6A21\u5757\u5DF2\u590D\u5236\u5230\u5404\u81EA weapp-shared/common.js\uFF08${totalReferences} \u5904\u5F15\u7528${ignoredHint}\uFF09`);
|
|
23955
|
+
}
|
|
23956
|
+
} : void 0;
|
|
23957
|
+
applySharedChunkStrategy.call(this, bundle, {
|
|
23958
|
+
strategy: sharedStrategy,
|
|
23959
|
+
subPackageRoots,
|
|
23960
|
+
onDuplicate: handleDuplicate,
|
|
23857
23961
|
onFallback: shouldLogChunks ? ({ reason, importers }) => {
|
|
23858
23962
|
const involvedSubs = /* @__PURE__ */ new Set();
|
|
23859
23963
|
let hasMainReference = false;
|
|
@@ -23880,6 +23984,9 @@ function createCoreLifecyclePlugin(state) {
|
|
|
23880
23984
|
}
|
|
23881
23985
|
} : void 0
|
|
23882
23986
|
});
|
|
23987
|
+
if (shouldWarnOnDuplicate && redundantBytesTotal > duplicateWarningBytes) {
|
|
23988
|
+
logger_default.warn(`[subpackages] \u5206\u5305\u590D\u5236\u5171\u4EAB\u6A21\u5757\u4EA7\u751F\u5197\u4F59\u4F53\u79EF ${formatBytes(redundantBytesTotal)}\uFF0C\u5DF2\u8D85\u8FC7\u9608\u503C ${formatBytes(duplicateWarningBytes)}\uFF0C\u5EFA\u8BAE\u8C03\u6574\u5206\u5305\u5212\u5206\u6216\u8FD0\u884C weapp-vite analyze \u5B9A\u4F4D\u95EE\u9898\u3002`);
|
|
23989
|
+
}
|
|
23883
23990
|
}
|
|
23884
23991
|
if (configService.weappViteConfig?.debug?.watchFiles) {
|
|
23885
23992
|
const watcherService = ctx.watcherService;
|
|
@@ -23955,6 +24062,21 @@ function createRequireAnalysisPlugin(state) {
|
|
|
23955
24062
|
}
|
|
23956
24063
|
};
|
|
23957
24064
|
}
|
|
24065
|
+
function formatBytes(bytes) {
|
|
24066
|
+
if (!Number.isFinite(bytes) || bytes <= 0) {
|
|
24067
|
+
return "0 B";
|
|
24068
|
+
}
|
|
24069
|
+
const units = ["B", "KB", "MB", "GB"];
|
|
24070
|
+
let value = bytes;
|
|
24071
|
+
let index = 0;
|
|
24072
|
+
while (value >= 1024 && index < units.length - 1) {
|
|
24073
|
+
value /= 1024;
|
|
24074
|
+
index++;
|
|
24075
|
+
}
|
|
24076
|
+
const precision = value >= 100 ? 0 : value >= 10 ? 1 : 2;
|
|
24077
|
+
const formatted = value.toFixed(precision).replace(/\.0+$/, "");
|
|
24078
|
+
return `${formatted} ${units[index]}`;
|
|
24079
|
+
}
|
|
23958
24080
|
function emitJsonAssets(state) {
|
|
23959
24081
|
const { ctx } = state;
|
|
23960
24082
|
const { jsonService } = ctx;
|
|
@@ -24005,13 +24127,13 @@ async function flushIndependentBuilds(state) {
|
|
|
24005
24127
|
|
|
24006
24128
|
// src/plugins/css.ts
|
|
24007
24129
|
init_esm_shims();
|
|
24008
|
-
import
|
|
24130
|
+
import fs17 from "fs-extra";
|
|
24009
24131
|
import path28 from "pathe";
|
|
24010
24132
|
|
|
24011
24133
|
// src/plugins/css/shared/sharedStyles.ts
|
|
24012
24134
|
init_esm_shims();
|
|
24013
24135
|
import path27 from "pathe";
|
|
24014
|
-
import
|
|
24136
|
+
import picomatch2 from "picomatch";
|
|
24015
24137
|
var SLASH_RE = /\\/g;
|
|
24016
24138
|
function toPosixPath(value) {
|
|
24017
24139
|
return value.replace(SLASH_RE, "/");
|
|
@@ -24073,10 +24195,10 @@ function getStyleMatcher(entry) {
|
|
|
24073
24195
|
const includePatterns = entry.include?.length ? entry.include : ["**/*"];
|
|
24074
24196
|
const excludePatterns = entry.exclude?.length ? entry.exclude : void 0;
|
|
24075
24197
|
const matcher = {
|
|
24076
|
-
include:
|
|
24198
|
+
include: picomatch2(includePatterns, { dot: true })
|
|
24077
24199
|
};
|
|
24078
24200
|
if (excludePatterns?.length) {
|
|
24079
|
-
matcher.exclude =
|
|
24201
|
+
matcher.exclude = picomatch2(excludePatterns, { dot: true });
|
|
24080
24202
|
}
|
|
24081
24203
|
styleMatcherCache.set(entry, matcher);
|
|
24082
24204
|
return matcher;
|
|
@@ -24223,7 +24345,7 @@ async function handleBundleEntry(bundle, bundleKey, asset2, configService, share
|
|
|
24223
24345
|
}
|
|
24224
24346
|
if (fileName && fileName !== bundleKey) {
|
|
24225
24347
|
delete bundle[bundleKey];
|
|
24226
|
-
const css2 = await
|
|
24348
|
+
const css2 = await fs17.readFile(absOriginal, "utf8");
|
|
24227
24349
|
this.emitFile({
|
|
24228
24350
|
type: "asset",
|
|
24229
24351
|
fileName,
|
|
@@ -24284,7 +24406,7 @@ async function emitSharedStyleEntries(sharedStyles, emitted, configService, bund
|
|
|
24284
24406
|
if (typeof this.addWatchFile === "function") {
|
|
24285
24407
|
this.addWatchFile(absolutePath);
|
|
24286
24408
|
}
|
|
24287
|
-
if (!await
|
|
24409
|
+
if (!await fs17.pathExists(absolutePath)) {
|
|
24288
24410
|
continue;
|
|
24289
24411
|
}
|
|
24290
24412
|
const { css: renderedCss, dependencies } = await renderSharedStyleEntry(entry, configService, resolvedConfig);
|
|
@@ -24427,7 +24549,7 @@ function preflight(ctx) {
|
|
|
24427
24549
|
init_esm_shims();
|
|
24428
24550
|
import { createHash as createHash2 } from "crypto";
|
|
24429
24551
|
import { removeExtension as removeExtension2 } from "@weapp-core/shared";
|
|
24430
|
-
import
|
|
24552
|
+
import fs18 from "fs-extra";
|
|
24431
24553
|
import path29 from "pathe";
|
|
24432
24554
|
async function resolveWorkerEntry(ctx, entry) {
|
|
24433
24555
|
const { configService, scanService } = ctx;
|
|
@@ -24435,7 +24557,7 @@ async function resolveWorkerEntry(ctx, entry) {
|
|
|
24435
24557
|
const key = removeExtension2(relativeEntryPath);
|
|
24436
24558
|
const absoluteEntry = path29.resolve(configService.absoluteSrcRoot, relativeEntryPath);
|
|
24437
24559
|
if (isJsOrTs(entry)) {
|
|
24438
|
-
const exists = await
|
|
24560
|
+
const exists = await fs18.exists(absoluteEntry);
|
|
24439
24561
|
if (!exists) {
|
|
24440
24562
|
logger_default.warn(`\u5F15\u7528 worker: \`${configService.relativeCwd(relativeEntryPath)}\` \u4E0D\u5B58\u5728!`);
|
|
24441
24563
|
return { key };
|
|
@@ -24490,7 +24612,7 @@ function workers(ctx) {
|
|
|
24490
24612
|
// src/plugins/wxs.ts
|
|
24491
24613
|
init_esm_shims();
|
|
24492
24614
|
import { removeExtension as removeExtension3 } from "@weapp-core/shared";
|
|
24493
|
-
import
|
|
24615
|
+
import fs19 from "fs-extra";
|
|
24494
24616
|
import path30 from "pathe";
|
|
24495
24617
|
var wxsCodeCache = new LRUCache({
|
|
24496
24618
|
max: 512
|
|
@@ -24499,7 +24621,7 @@ async function transformWxsFile(state, wxsPath) {
|
|
|
24499
24621
|
const { ctx } = state;
|
|
24500
24622
|
const { configService } = ctx;
|
|
24501
24623
|
this.addWatchFile(wxsPath);
|
|
24502
|
-
if (!await
|
|
24624
|
+
if (!await fs19.exists(wxsPath)) {
|
|
24503
24625
|
return;
|
|
24504
24626
|
}
|
|
24505
24627
|
const suffixMatch = wxsPath.match(/\.wxs(\.[jt]s)?$/);
|
|
@@ -24507,7 +24629,7 @@ async function transformWxsFile(state, wxsPath) {
|
|
|
24507
24629
|
if (suffixMatch) {
|
|
24508
24630
|
isRaw = !suffixMatch[1];
|
|
24509
24631
|
}
|
|
24510
|
-
const rawCode = await
|
|
24632
|
+
const rawCode = await fs19.readFile(wxsPath, "utf8");
|
|
24511
24633
|
let code = wxsCodeCache.get(rawCode);
|
|
24512
24634
|
if (code === void 0) {
|
|
24513
24635
|
const { result, importees } = transformWxsCode(rawCode, {
|
|
@@ -24590,6 +24712,16 @@ function wxs(ctx) {
|
|
|
24590
24712
|
|
|
24591
24713
|
// src/plugins/index.ts
|
|
24592
24714
|
var RUNTIME_PLUGINS_SYMBOL = Symbol.for("weapp-runtime:plugins");
|
|
24715
|
+
var WEAPP_VITE_CONTEXT_PLUGIN_NAME = "weapp-vite:context";
|
|
24716
|
+
function createContextPlugin(ctx) {
|
|
24717
|
+
return {
|
|
24718
|
+
name: WEAPP_VITE_CONTEXT_PLUGIN_NAME,
|
|
24719
|
+
enforce: "pre",
|
|
24720
|
+
api: {
|
|
24721
|
+
ctx
|
|
24722
|
+
}
|
|
24723
|
+
};
|
|
24724
|
+
}
|
|
24593
24725
|
function attachRuntimePlugins(ctx, plugins) {
|
|
24594
24726
|
const runtimePlugins = ctx[RUNTIME_PLUGINS_SYMBOL];
|
|
24595
24727
|
if (!runtimePlugins?.length) {
|
|
@@ -24611,7 +24743,7 @@ function flatten(groups) {
|
|
|
24611
24743
|
}, []);
|
|
24612
24744
|
}
|
|
24613
24745
|
function vitePluginWeapp(ctx, subPackageMeta) {
|
|
24614
|
-
const groups = [preflight(ctx)];
|
|
24746
|
+
const groups = [[createContextPlugin(ctx)], preflight(ctx)];
|
|
24615
24747
|
if (!subPackageMeta) {
|
|
24616
24748
|
groups.push(asset(ctx), autoRoutes(ctx), autoImport(ctx));
|
|
24617
24749
|
}
|
|
@@ -24623,7 +24755,7 @@ function vitePluginWeapp(ctx, subPackageMeta) {
|
|
|
24623
24755
|
return applyInspect(ctx, assembled);
|
|
24624
24756
|
}
|
|
24625
24757
|
function vitePluginWeappWorkers(ctx) {
|
|
24626
|
-
const groups = [preflight(ctx), workers(ctx)];
|
|
24758
|
+
const groups = [[createContextPlugin(ctx)], preflight(ctx), workers(ctx)];
|
|
24627
24759
|
const assembled = attachRuntimePlugins(ctx, flatten(groups));
|
|
24628
24760
|
return applyInspect(ctx, assembled);
|
|
24629
24761
|
}
|
|
@@ -25059,7 +25191,7 @@ init_esm_shims();
|
|
|
25059
25191
|
import { createRequire as createRequire3 } from "module";
|
|
25060
25192
|
import process8 from "process";
|
|
25061
25193
|
import { parse as parseJson2 } from "comment-json";
|
|
25062
|
-
import
|
|
25194
|
+
import fs20 from "fs-extra";
|
|
25063
25195
|
import { bundleRequire } from "rolldown-require";
|
|
25064
25196
|
function parseCommentJson(json) {
|
|
25065
25197
|
return parseJson2(json, void 0, true);
|
|
@@ -25124,7 +25256,7 @@ function createJsonService(ctx) {
|
|
|
25124
25256
|
});
|
|
25125
25257
|
resultJson = typeof mod.default === "function" ? await mod.default(ctx) : mod.default;
|
|
25126
25258
|
} else {
|
|
25127
|
-
resultJson = parseCommentJson(await
|
|
25259
|
+
resultJson = parseCommentJson(await fs20.readFile(filepath, "utf8"));
|
|
25128
25260
|
}
|
|
25129
25261
|
cache2.set(filepath, resultJson);
|
|
25130
25262
|
return resultJson;
|
|
@@ -25157,7 +25289,7 @@ function createJsonServicePlugin(ctx) {
|
|
|
25157
25289
|
init_esm_shims();
|
|
25158
25290
|
import { isBuiltin } from "module";
|
|
25159
25291
|
import { defu as defu6, isObject as isObject8, objectHash } from "@weapp-core/shared";
|
|
25160
|
-
import
|
|
25292
|
+
import fs21 from "fs-extra";
|
|
25161
25293
|
import path33 from "pathe";
|
|
25162
25294
|
import { build as tsdownBuild } from "tsdown";
|
|
25163
25295
|
function createNpmService(ctx) {
|
|
@@ -25179,22 +25311,22 @@ function createNpmService(ctx) {
|
|
|
25179
25311
|
return Reflect.has(pkg, "miniprogram") && typeof pkg.miniprogram === "string";
|
|
25180
25312
|
}
|
|
25181
25313
|
async function shouldSkipBuild(outDir, isOutdated) {
|
|
25182
|
-
return !isOutdated && await
|
|
25314
|
+
return !isOutdated && await fs21.exists(outDir);
|
|
25183
25315
|
}
|
|
25184
25316
|
async function writeDependenciesCache(root) {
|
|
25185
25317
|
if (!ctx.configService) {
|
|
25186
25318
|
throw new Error("configService must be initialized before writing npm cache");
|
|
25187
25319
|
}
|
|
25188
25320
|
if (ctx.configService.weappViteConfig?.npm?.cache) {
|
|
25189
|
-
await
|
|
25321
|
+
await fs21.outputJSON(getDependenciesCacheFilePath(root), {
|
|
25190
25322
|
hash: dependenciesCacheHash()
|
|
25191
25323
|
});
|
|
25192
25324
|
}
|
|
25193
25325
|
}
|
|
25194
25326
|
async function readDependenciesCache(root) {
|
|
25195
25327
|
const cachePath = getDependenciesCacheFilePath(root);
|
|
25196
|
-
if (await
|
|
25197
|
-
return await
|
|
25328
|
+
if (await fs21.exists(cachePath)) {
|
|
25329
|
+
return await fs21.readJson(cachePath, { throws: false });
|
|
25198
25330
|
}
|
|
25199
25331
|
}
|
|
25200
25332
|
async function checkDependenciesCacheOutdate(root) {
|
|
@@ -25258,7 +25390,7 @@ function createNpmService(ctx) {
|
|
|
25258
25390
|
}
|
|
25259
25391
|
}
|
|
25260
25392
|
async function copyBuild({ from, to }) {
|
|
25261
|
-
await
|
|
25393
|
+
await fs21.copy(
|
|
25262
25394
|
from,
|
|
25263
25395
|
to
|
|
25264
25396
|
);
|
|
@@ -25351,8 +25483,8 @@ function createNpmService(ctx) {
|
|
|
25351
25483
|
const packNpmRelationList = getPackNpmRelationList();
|
|
25352
25484
|
const [mainRelation, ...subRelations] = packNpmRelationList;
|
|
25353
25485
|
const packageJsonPath = path33.resolve(ctx.configService.cwd, mainRelation.packageJsonPath);
|
|
25354
|
-
if (await
|
|
25355
|
-
const pkgJson = await
|
|
25486
|
+
if (await fs21.exists(packageJsonPath)) {
|
|
25487
|
+
const pkgJson = await fs21.readJson(packageJsonPath);
|
|
25356
25488
|
const outDir = path33.resolve(ctx.configService.cwd, mainRelation.miniprogramNpmDistDir, "miniprogram_npm");
|
|
25357
25489
|
if (pkgJson.dependencies) {
|
|
25358
25490
|
const dependencies = Object.keys(pkgJson.dependencies);
|
|
@@ -25387,8 +25519,8 @@ function createNpmService(ctx) {
|
|
|
25387
25519
|
await Promise.all(targetDirs.map(async (x) => {
|
|
25388
25520
|
if (x.root) {
|
|
25389
25521
|
const isDependenciesCacheOutdate2 = await checkDependenciesCacheOutdate(x.root);
|
|
25390
|
-
if (isDependenciesCacheOutdate2 || !await
|
|
25391
|
-
await
|
|
25522
|
+
if (isDependenciesCacheOutdate2 || !await fs21.exists(x.npmDistDir)) {
|
|
25523
|
+
await fs21.copy(outDir, x.npmDistDir, {
|
|
25392
25524
|
overwrite: true,
|
|
25393
25525
|
filter: (src) => {
|
|
25394
25526
|
if (Array.isArray(x.dependencies)) {
|
|
@@ -25404,7 +25536,7 @@ function createNpmService(ctx) {
|
|
|
25404
25536
|
}
|
|
25405
25537
|
await writeDependenciesCache(x.root);
|
|
25406
25538
|
} else {
|
|
25407
|
-
await
|
|
25539
|
+
await fs21.copy(outDir, x.npmDistDir, {
|
|
25408
25540
|
overwrite: true,
|
|
25409
25541
|
filter: (src) => {
|
|
25410
25542
|
if (Array.isArray(x.dependencies)) {
|
|
@@ -26161,7 +26293,7 @@ init_esm_shims();
|
|
|
26161
26293
|
|
|
26162
26294
|
// src/cache/file.ts
|
|
26163
26295
|
init_esm_shims();
|
|
26164
|
-
import
|
|
26296
|
+
import fs22 from "fs-extra";
|
|
26165
26297
|
var FNV_OFFSET_BASIS = 0xCBF29CE484222325n;
|
|
26166
26298
|
var FNV_PRIME = 0x100000001B3n;
|
|
26167
26299
|
var FNV_MASK = 0xFFFFFFFFFFFFFFFFn;
|
|
@@ -26211,8 +26343,8 @@ var FileCache = class {
|
|
|
26211
26343
|
async isInvalidate(id, options) {
|
|
26212
26344
|
let mtimeMs;
|
|
26213
26345
|
try {
|
|
26214
|
-
const
|
|
26215
|
-
mtimeMs =
|
|
26346
|
+
const stat5 = await fs22.stat(id);
|
|
26347
|
+
mtimeMs = stat5.mtimeMs;
|
|
26216
26348
|
} catch (error) {
|
|
26217
26349
|
if (error && error.code === "ENOENT") {
|
|
26218
26350
|
this.cache.delete(id);
|
|
@@ -26373,7 +26505,7 @@ function createRuntimeState() {
|
|
|
26373
26505
|
// src/runtime/scanPlugin.ts
|
|
26374
26506
|
init_esm_shims();
|
|
26375
26507
|
import { isObject as isObject9, removeExtensionDeep as removeExtensionDeep6 } from "@weapp-core/shared";
|
|
26376
|
-
import
|
|
26508
|
+
import fs23 from "fs-extra";
|
|
26377
26509
|
import path34 from "pathe";
|
|
26378
26510
|
var SUPPORTED_SHARED_STYLE_EXTENSIONS = [
|
|
26379
26511
|
".wxss",
|
|
@@ -26611,7 +26743,7 @@ function appendDefaultScopedStyleEntries(root, normalizedRoot, service, dedupe,
|
|
|
26611
26743
|
for (const ext2 of DEFAULT_SCOPED_EXTENSIONS) {
|
|
26612
26744
|
const filename = `${base}${ext2}`;
|
|
26613
26745
|
const absolutePath = path34.resolve(absoluteSubRoot, filename);
|
|
26614
|
-
if (!
|
|
26746
|
+
if (!fs23.existsSync(absolutePath)) {
|
|
26615
26747
|
continue;
|
|
26616
26748
|
}
|
|
26617
26749
|
const descriptor = {
|
|
@@ -26656,7 +26788,7 @@ function normalizeSubPackageStyleEntries(styles, subPackage, configService) {
|
|
|
26656
26788
|
logger_default.warn(`[subpackages] \u5206\u5305 ${root} \u6837\u5F0F\u5165\u53E3 \`${descriptor.source}\` \u89E3\u6790\u5931\u8D25\uFF0C\u5DF2\u5FFD\u7565\u3002`);
|
|
26657
26789
|
continue;
|
|
26658
26790
|
}
|
|
26659
|
-
if (!
|
|
26791
|
+
if (!fs23.existsSync(absolutePath)) {
|
|
26660
26792
|
logger_default.warn(`[subpackages] \u5206\u5305 ${root} \u6837\u5F0F\u5165\u53E3 \`${descriptor.source}\` \u5BF9\u5E94\u6587\u4EF6\u4E0D\u5B58\u5728\uFF0C\u5DF2\u5FFD\u7565\u3002`);
|
|
26661
26793
|
continue;
|
|
26662
26794
|
}
|
|
@@ -27002,7 +27134,7 @@ function createWebServicePlugin(ctx) {
|
|
|
27002
27134
|
// src/runtime/wxmlPlugin.ts
|
|
27003
27135
|
init_esm_shims();
|
|
27004
27136
|
import { removeExtensionDeep as removeExtensionDeep7 } from "@weapp-core/shared";
|
|
27005
|
-
import
|
|
27137
|
+
import fs24 from "fs-extra";
|
|
27006
27138
|
import path35 from "pathe";
|
|
27007
27139
|
|
|
27008
27140
|
// src/wxml/index.ts
|
|
@@ -29710,9 +29842,9 @@ function createWxmlService(ctx) {
|
|
|
29710
29842
|
if (!ctx.configService) {
|
|
29711
29843
|
throw new Error("configService must be initialized before scanning wxml");
|
|
29712
29844
|
}
|
|
29713
|
-
if (await
|
|
29845
|
+
if (await fs24.exists(filepath)) {
|
|
29714
29846
|
const dirname5 = path35.dirname(filepath);
|
|
29715
|
-
const wxml = await
|
|
29847
|
+
const wxml = await fs24.readFile(filepath, "utf8");
|
|
29716
29848
|
const shouldRescan = await cache2.isInvalidate(filepath, { content: wxml });
|
|
29717
29849
|
if (!shouldRescan) {
|
|
29718
29850
|
const cached = cache2.get(filepath);
|
|
@@ -29826,6 +29958,8 @@ export {
|
|
|
29826
29958
|
VERSION,
|
|
29827
29959
|
checkRuntime,
|
|
29828
29960
|
resolveWeappConfigFile,
|
|
29961
|
+
SHARED_CHUNK_VIRTUAL_PREFIX,
|
|
29962
|
+
createSharedBuildConfig,
|
|
29829
29963
|
DEFAULT_MP_PLATFORM,
|
|
29830
29964
|
normalizeMiniPlatform,
|
|
29831
29965
|
resolveMiniPlatform,
|