weapp-vite 5.6.3 → 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-routes.cjs +2 -2
- package/dist/auto-routes.mjs +1 -1
- package/dist/{chunk-LE4PAGI5.mjs → chunk-AKJEW44F.mjs} +647 -405
- package/dist/{chunk-OQYESMEY.cjs → chunk-FUJ4D6IR.cjs} +757 -515
- package/dist/{chunk-7EOV7C3M.mjs → chunk-GU7U5762.mjs} +1 -1
- package/dist/{chunk-WYNGNSLK.cjs → chunk-VRKZFXIZ.cjs} +4 -4
- package/dist/cli.cjs +879 -280
- package/dist/cli.mjs +880 -281
- 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.d.cts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/json.d.cts +1 -1
- package/dist/json.d.ts +1 -1
- package/dist/types.d.cts +1 -1
- package/dist/types.d.ts +1 -1
- package/package.json +2 -2
|
@@ -650,11 +650,6 @@ var require_eventemitter3 = _chunkA5DD7GKXcjs.__commonJS.call(void 0, {
|
|
|
650
650
|
}
|
|
651
651
|
});
|
|
652
652
|
|
|
653
|
-
// src/logger.ts
|
|
654
|
-
_chunkA5DD7GKXcjs.init_cjs_shims.call(void 0, );
|
|
655
|
-
var _logger = require('@weapp-core/logger'); var _logger2 = _interopRequireDefault(_logger);
|
|
656
|
-
var logger_default = _logger2.default;
|
|
657
|
-
|
|
658
653
|
// src/constants.ts
|
|
659
654
|
_chunkA5DD7GKXcjs.init_cjs_shims.call(void 0, );
|
|
660
655
|
var VERSION = "__VERSION__";
|
|
@@ -673,6 +668,13 @@ var templateExtensions = ["wxml", "html"];
|
|
|
673
668
|
_chunkA5DD7GKXcjs.init_cjs_shims.call(void 0, );
|
|
674
669
|
var import_gte = _chunkA5DD7GKXcjs.__toESM.call(void 0, require_gte(), 1);
|
|
675
670
|
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
671
|
+
|
|
672
|
+
// src/logger.ts
|
|
673
|
+
_chunkA5DD7GKXcjs.init_cjs_shims.call(void 0, );
|
|
674
|
+
var _logger = require('@weapp-core/logger'); var _logger2 = _interopRequireDefault(_logger);
|
|
675
|
+
var logger_default = _logger2.default;
|
|
676
|
+
|
|
677
|
+
// src/utils/version.ts
|
|
676
678
|
function getRuntime() {
|
|
677
679
|
if (typeof _process2.default !== "undefined" && _optionalChain([_process2.default, 'access', _2 => _2.versions, 'optionalAccess', _3 => _3.node])) {
|
|
678
680
|
return {
|
|
@@ -707,55 +709,13 @@ function checkRuntime(minVersions) {
|
|
|
707
709
|
}
|
|
708
710
|
}
|
|
709
711
|
|
|
710
|
-
// src/utils/weappConfig.ts
|
|
711
|
-
_chunkA5DD7GKXcjs.init_cjs_shims.call(void 0, );
|
|
712
|
-
var _fsextra = require('fs-extra'); var _fsextra2 = _interopRequireDefault(_fsextra);
|
|
713
|
-
var _pathe = require('pathe'); var _pathe2 = _interopRequireDefault(_pathe);
|
|
714
|
-
var WEAPP_VITE_CONFIG_CANDIDATES = [
|
|
715
|
-
"weapp-vite.config.ts",
|
|
716
|
-
"weapp-vite.config.mts",
|
|
717
|
-
"weapp-vite.config.cts",
|
|
718
|
-
"weapp-vite.config.js",
|
|
719
|
-
"weapp-vite.config.mjs",
|
|
720
|
-
"weapp-vite.config.cjs",
|
|
721
|
-
"weapp-vite.config.json"
|
|
722
|
-
];
|
|
723
|
-
var WEAPP_VITE_CONFIG_SET = new Set(WEAPP_VITE_CONFIG_CANDIDATES);
|
|
724
|
-
async function findWeappConfigInDirectory(directory) {
|
|
725
|
-
for (const filename of WEAPP_VITE_CONFIG_CANDIDATES) {
|
|
726
|
-
const candidatePath = _pathe2.default.resolve(directory, filename);
|
|
727
|
-
if (await _fsextra2.default.pathExists(candidatePath)) {
|
|
728
|
-
return candidatePath;
|
|
729
|
-
}
|
|
730
|
-
}
|
|
731
|
-
return void 0;
|
|
732
|
-
}
|
|
733
|
-
async function resolveWeappConfigFile(options) {
|
|
734
|
-
const { root, specified } = options;
|
|
735
|
-
if (specified) {
|
|
736
|
-
const resolvedSpecified = _pathe2.default.isAbsolute(specified) ? specified : _pathe2.default.resolve(root, specified);
|
|
737
|
-
const specifiedBaseName = _pathe2.default.basename(resolvedSpecified);
|
|
738
|
-
if (WEAPP_VITE_CONFIG_SET.has(specifiedBaseName)) {
|
|
739
|
-
if (await _fsextra2.default.pathExists(resolvedSpecified)) {
|
|
740
|
-
return resolvedSpecified;
|
|
741
|
-
}
|
|
742
|
-
return void 0;
|
|
743
|
-
}
|
|
744
|
-
const fromSpecifiedDirectory = await findWeappConfigInDirectory(_pathe2.default.dirname(resolvedSpecified));
|
|
745
|
-
if (fromSpecifiedDirectory) {
|
|
746
|
-
return fromSpecifiedDirectory;
|
|
747
|
-
}
|
|
748
|
-
}
|
|
749
|
-
return findWeappConfigInDirectory(root);
|
|
750
|
-
}
|
|
751
|
-
|
|
752
712
|
// src/utils/index.ts
|
|
753
713
|
_chunkA5DD7GKXcjs.init_cjs_shims.call(void 0, );
|
|
754
714
|
|
|
755
715
|
// src/utils/file.ts
|
|
756
716
|
_chunkA5DD7GKXcjs.init_cjs_shims.call(void 0, );
|
|
757
|
-
|
|
758
|
-
|
|
717
|
+
var _fsextra = require('fs-extra'); var _fsextra2 = _interopRequireDefault(_fsextra);
|
|
718
|
+
var _pathe = require('pathe'); var _pathe2 = _interopRequireDefault(_pathe);
|
|
759
719
|
function isJsOrTs(name) {
|
|
760
720
|
if (typeof name === "string") {
|
|
761
721
|
return /\.[jt]s$/.test(name);
|
|
@@ -1015,121 +975,46 @@ function regExpTest(arr, str, options) {
|
|
|
1015
975
|
return false;
|
|
1016
976
|
}
|
|
1017
977
|
|
|
1018
|
-
// src/
|
|
978
|
+
// src/utils/weappConfig.ts
|
|
1019
979
|
_chunkA5DD7GKXcjs.init_cjs_shims.call(void 0, );
|
|
1020
980
|
|
|
1021
|
-
// src/platforms/adapters.ts
|
|
1022
|
-
_chunkA5DD7GKXcjs.init_cjs_shims.call(void 0, );
|
|
1023
|
-
var MINI_PROGRAM_PLATFORM_ADAPTERS = [
|
|
1024
|
-
{
|
|
1025
|
-
id: "weapp",
|
|
1026
|
-
displayName: "WeChat Mini Program",
|
|
1027
|
-
aliases: ["weapp", "wechat", "weixin", "wx"],
|
|
1028
|
-
outputExtensions: {
|
|
1029
|
-
js: "js",
|
|
1030
|
-
json: "json",
|
|
1031
|
-
wxml: "wxml",
|
|
1032
|
-
wxss: "wxss",
|
|
1033
|
-
wxs: "wxs"
|
|
1034
|
-
}
|
|
1035
|
-
},
|
|
1036
|
-
{
|
|
1037
|
-
id: "alipay",
|
|
1038
|
-
displayName: "Alipay Mini Program",
|
|
1039
|
-
aliases: ["alipay", "ali", "my"],
|
|
1040
|
-
outputExtensions: {
|
|
1041
|
-
js: "js",
|
|
1042
|
-
json: "json",
|
|
1043
|
-
wxml: "axml",
|
|
1044
|
-
wxss: "acss",
|
|
1045
|
-
wxs: "sjs"
|
|
1046
|
-
}
|
|
1047
|
-
},
|
|
1048
|
-
{
|
|
1049
|
-
id: "swan",
|
|
1050
|
-
displayName: "Baidu Smart Program",
|
|
1051
|
-
aliases: ["swan", "baidu", "bd"],
|
|
1052
|
-
outputExtensions: {
|
|
1053
|
-
js: "js",
|
|
1054
|
-
json: "json",
|
|
1055
|
-
wxml: "swan",
|
|
1056
|
-
wxss: "css",
|
|
1057
|
-
wxs: "sjs"
|
|
1058
|
-
}
|
|
1059
|
-
},
|
|
1060
|
-
{
|
|
1061
|
-
id: "tt",
|
|
1062
|
-
displayName: "ByteDance / Douyin Mini Program",
|
|
1063
|
-
aliases: ["tt", "toutiao", "bytedance", "douyin"],
|
|
1064
|
-
outputExtensions: {
|
|
1065
|
-
js: "js",
|
|
1066
|
-
json: "json",
|
|
1067
|
-
wxml: "ttml",
|
|
1068
|
-
wxss: "ttss"
|
|
1069
|
-
}
|
|
1070
|
-
},
|
|
1071
|
-
{
|
|
1072
|
-
id: "jd",
|
|
1073
|
-
displayName: "JD Mini Program",
|
|
1074
|
-
aliases: ["jd", "jingdong"],
|
|
1075
|
-
outputExtensions: {
|
|
1076
|
-
js: "js",
|
|
1077
|
-
json: "json",
|
|
1078
|
-
wxml: "jxml",
|
|
1079
|
-
wxss: "jxss",
|
|
1080
|
-
wxs: "wxs"
|
|
1081
|
-
}
|
|
1082
|
-
},
|
|
1083
|
-
{
|
|
1084
|
-
id: "xhs",
|
|
1085
|
-
displayName: "Xiaohongshu Mini Program",
|
|
1086
|
-
aliases: ["xhs", "xiaohongshu", "little-red-book", "red"],
|
|
1087
|
-
outputExtensions: {
|
|
1088
|
-
js: "js",
|
|
1089
|
-
json: "json",
|
|
1090
|
-
wxml: "xhsml",
|
|
1091
|
-
wxss: "css",
|
|
1092
|
-
wxs: "wxs"
|
|
1093
|
-
}
|
|
1094
|
-
}
|
|
1095
|
-
];
|
|
1096
981
|
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
982
|
+
var WEAPP_VITE_CONFIG_CANDIDATES = [
|
|
983
|
+
"weapp-vite.config.ts",
|
|
984
|
+
"weapp-vite.config.mts",
|
|
985
|
+
"weapp-vite.config.cts",
|
|
986
|
+
"weapp-vite.config.js",
|
|
987
|
+
"weapp-vite.config.mjs",
|
|
988
|
+
"weapp-vite.config.cjs",
|
|
989
|
+
"weapp-vite.config.json"
|
|
990
|
+
];
|
|
991
|
+
var WEAPP_VITE_CONFIG_SET = new Set(WEAPP_VITE_CONFIG_CANDIDATES);
|
|
992
|
+
async function findWeappConfigInDirectory(directory) {
|
|
993
|
+
for (const filename of WEAPP_VITE_CONFIG_CANDIDATES) {
|
|
994
|
+
const candidatePath = _pathe2.default.resolve(directory, filename);
|
|
995
|
+
if (await _fsextra2.default.pathExists(candidatePath)) {
|
|
996
|
+
return candidatePath;
|
|
1107
997
|
}
|
|
1108
|
-
PLATFORM_ALIAS_TO_ID.set(normalized, adapter.id);
|
|
1109
998
|
}
|
|
1110
|
-
|
|
1111
|
-
PLATFORM_ALIAS_TO_ID.set(adapter.id, adapter.id);
|
|
1112
|
-
}
|
|
1113
|
-
}
|
|
1114
|
-
var MINI_PLATFORM_ALIASES = Object.freeze(
|
|
1115
|
-
Object.fromEntries(PLATFORM_ALIAS_TO_ID.entries())
|
|
1116
|
-
);
|
|
1117
|
-
function normalizeMiniPlatform(input) {
|
|
1118
|
-
return input ? input.trim().toLowerCase() : void 0;
|
|
1119
|
-
}
|
|
1120
|
-
function resolveMiniPlatform(input) {
|
|
1121
|
-
const normalized = normalizeMiniPlatform(input);
|
|
1122
|
-
if (!normalized) {
|
|
1123
|
-
return void 0;
|
|
1124
|
-
}
|
|
1125
|
-
return PLATFORM_ALIAS_TO_ID.get(normalized);
|
|
999
|
+
return void 0;
|
|
1126
1000
|
}
|
|
1127
|
-
function
|
|
1128
|
-
const
|
|
1129
|
-
if (
|
|
1130
|
-
|
|
1001
|
+
async function resolveWeappConfigFile(options) {
|
|
1002
|
+
const { root, specified } = options;
|
|
1003
|
+
if (specified) {
|
|
1004
|
+
const resolvedSpecified = _pathe2.default.isAbsolute(specified) ? specified : _pathe2.default.resolve(root, specified);
|
|
1005
|
+
const specifiedBaseName = _pathe2.default.basename(resolvedSpecified);
|
|
1006
|
+
if (WEAPP_VITE_CONFIG_SET.has(specifiedBaseName)) {
|
|
1007
|
+
if (await _fsextra2.default.pathExists(resolvedSpecified)) {
|
|
1008
|
+
return resolvedSpecified;
|
|
1009
|
+
}
|
|
1010
|
+
return void 0;
|
|
1011
|
+
}
|
|
1012
|
+
const fromSpecifiedDirectory = await findWeappConfigInDirectory(_pathe2.default.dirname(resolvedSpecified));
|
|
1013
|
+
if (fromSpecifiedDirectory) {
|
|
1014
|
+
return fromSpecifiedDirectory;
|
|
1015
|
+
}
|
|
1131
1016
|
}
|
|
1132
|
-
return
|
|
1017
|
+
return findWeappConfigInDirectory(root);
|
|
1133
1018
|
}
|
|
1134
1019
|
|
|
1135
1020
|
// src/context/getInstance.ts
|
|
@@ -11895,31 +11780,170 @@ rimraf.rimraf = rimraf;
|
|
|
11895
11780
|
// src/runtime/buildPlugin.ts
|
|
11896
11781
|
var _vite = require('vite');
|
|
11897
11782
|
|
|
11783
|
+
// src/runtime/independentError.ts
|
|
11784
|
+
_chunkA5DD7GKXcjs.init_cjs_shims.call(void 0, );
|
|
11785
|
+
var ANSI_ESCAPE_PATTERN = /\u001B\[[0-9;]*m/g;
|
|
11786
|
+
function stripAnsi(value) {
|
|
11787
|
+
return value.replace(ANSI_ESCAPE_PATTERN, "");
|
|
11788
|
+
}
|
|
11789
|
+
function isErrorInstance(value) {
|
|
11790
|
+
return value instanceof Error;
|
|
11791
|
+
}
|
|
11792
|
+
function formatSummary(payload) {
|
|
11793
|
+
const parts = [];
|
|
11794
|
+
const code = payload.code;
|
|
11795
|
+
if (typeof code === "string" && code.trim()) {
|
|
11796
|
+
parts.push(`code: ${code.trim()}`);
|
|
11797
|
+
}
|
|
11798
|
+
const plugin = payload.plugin;
|
|
11799
|
+
if (typeof plugin === "string" && plugin.trim()) {
|
|
11800
|
+
parts.push(`plugin: ${plugin.trim()}`);
|
|
11801
|
+
}
|
|
11802
|
+
const id = payload.id;
|
|
11803
|
+
if (typeof id === "string" && id.trim()) {
|
|
11804
|
+
parts.push(`id: ${id.trim()}`);
|
|
11805
|
+
}
|
|
11806
|
+
if (!parts.length) {
|
|
11807
|
+
return "";
|
|
11808
|
+
}
|
|
11809
|
+
return ` (${parts.join(", ")})`;
|
|
11810
|
+
}
|
|
11811
|
+
function collectDetails(payload) {
|
|
11812
|
+
const details = [];
|
|
11813
|
+
const frame = payload.frame;
|
|
11814
|
+
if (typeof frame === "string" && frame.trim()) {
|
|
11815
|
+
details.push(frame.trim());
|
|
11816
|
+
}
|
|
11817
|
+
const stack = payload.stack;
|
|
11818
|
+
if (typeof stack === "string" && stack.trim()) {
|
|
11819
|
+
details.push(stack.trim());
|
|
11820
|
+
}
|
|
11821
|
+
return details;
|
|
11822
|
+
}
|
|
11823
|
+
function extractMessage(value, seen) {
|
|
11824
|
+
if (!value || seen.has(value)) {
|
|
11825
|
+
return void 0;
|
|
11826
|
+
}
|
|
11827
|
+
if (typeof value === "string") {
|
|
11828
|
+
const trimmed = stripAnsi(value).trim();
|
|
11829
|
+
return trimmed || void 0;
|
|
11830
|
+
}
|
|
11831
|
+
if (isErrorInstance(value)) {
|
|
11832
|
+
const trimmed = stripAnsi(_nullishCoalesce(value.message, () => ( ""))).trim();
|
|
11833
|
+
if (trimmed) {
|
|
11834
|
+
return trimmed;
|
|
11835
|
+
}
|
|
11836
|
+
if (value.cause) {
|
|
11837
|
+
return extractMessage(value.cause, seen);
|
|
11838
|
+
}
|
|
11839
|
+
return void 0;
|
|
11840
|
+
}
|
|
11841
|
+
if (typeof value === "object") {
|
|
11842
|
+
const record = value;
|
|
11843
|
+
seen.add(record);
|
|
11844
|
+
const directMessage = extractMessage(record.message, seen);
|
|
11845
|
+
if (directMessage) {
|
|
11846
|
+
return directMessage;
|
|
11847
|
+
}
|
|
11848
|
+
const nestedKeys = ["reason", "detail", "details", "error", "field0", "field1", "cause"];
|
|
11849
|
+
for (const key of nestedKeys) {
|
|
11850
|
+
if (key in record) {
|
|
11851
|
+
const nestedMessage = extractMessage(record[key], seen);
|
|
11852
|
+
if (nestedMessage) {
|
|
11853
|
+
return nestedMessage;
|
|
11854
|
+
}
|
|
11855
|
+
}
|
|
11856
|
+
}
|
|
11857
|
+
}
|
|
11858
|
+
return void 0;
|
|
11859
|
+
}
|
|
11860
|
+
function createIndependentBuildError(root, cause) {
|
|
11861
|
+
const fallback = `Independent bundle for ${root} failed`;
|
|
11862
|
+
if (isErrorInstance(cause)) {
|
|
11863
|
+
if (!cause.message || cause.message.trim() === "") {
|
|
11864
|
+
return new Error(fallback, { cause });
|
|
11865
|
+
}
|
|
11866
|
+
return cause;
|
|
11867
|
+
}
|
|
11868
|
+
if (!cause) {
|
|
11869
|
+
return new Error(fallback);
|
|
11870
|
+
}
|
|
11871
|
+
if (typeof cause === "string") {
|
|
11872
|
+
const trimmed = stripAnsi(cause).trim();
|
|
11873
|
+
if (!trimmed) {
|
|
11874
|
+
return new Error(fallback, { cause });
|
|
11875
|
+
}
|
|
11876
|
+
return new Error(trimmed, { cause });
|
|
11877
|
+
}
|
|
11878
|
+
if (typeof cause === "object") {
|
|
11879
|
+
const payload = cause;
|
|
11880
|
+
const seen = /* @__PURE__ */ new Set();
|
|
11881
|
+
const extracted = extractMessage(payload, seen);
|
|
11882
|
+
const summary = formatSummary(payload);
|
|
11883
|
+
const detailLines = collectDetails(payload);
|
|
11884
|
+
if (extracted) {
|
|
11885
|
+
let composedMessage = extracted;
|
|
11886
|
+
if (summary) {
|
|
11887
|
+
composedMessage += summary;
|
|
11888
|
+
}
|
|
11889
|
+
if (detailLines.length) {
|
|
11890
|
+
composedMessage += `
|
|
11891
|
+
${detailLines.join("\n")}`;
|
|
11892
|
+
}
|
|
11893
|
+
return new Error(composedMessage, { cause });
|
|
11894
|
+
}
|
|
11895
|
+
if (summary || detailLines.length) {
|
|
11896
|
+
const composed = detailLines.length ? `${fallback}${summary}
|
|
11897
|
+
${detailLines.join("\n")}` : `${fallback}${summary}`;
|
|
11898
|
+
if (composed.trim()) {
|
|
11899
|
+
return new Error(composed, { cause });
|
|
11900
|
+
}
|
|
11901
|
+
}
|
|
11902
|
+
}
|
|
11903
|
+
try {
|
|
11904
|
+
const serialized = JSON.stringify(cause);
|
|
11905
|
+
if (serialized && serialized !== "{}") {
|
|
11906
|
+
return new Error(`${fallback}: ${serialized}`, { cause });
|
|
11907
|
+
}
|
|
11908
|
+
} catch (e13) {
|
|
11909
|
+
}
|
|
11910
|
+
return new Error(fallback, { cause });
|
|
11911
|
+
}
|
|
11912
|
+
|
|
11913
|
+
// src/runtime/sharedBuildConfig.ts
|
|
11914
|
+
_chunkA5DD7GKXcjs.init_cjs_shims.call(void 0, );
|
|
11915
|
+
|
|
11916
|
+
|
|
11898
11917
|
// src/runtime/advancedChunks.ts
|
|
11899
11918
|
_chunkA5DD7GKXcjs.init_cjs_shims.call(void 0, );
|
|
11900
11919
|
|
|
11901
11920
|
// src/runtime/chunkStrategy.ts
|
|
11902
11921
|
_chunkA5DD7GKXcjs.init_cjs_shims.call(void 0, );
|
|
11922
|
+
var _buffer = require('buffer');
|
|
11903
11923
|
|
|
11904
11924
|
var SHARED_CHUNK_VIRTUAL_PREFIX = "weapp_shared_virtual";
|
|
11905
11925
|
var SUB_PACKAGE_SHARED_DIR = "weapp-shared";
|
|
11906
11926
|
var DEFAULT_SHARED_CHUNK_STRATEGY = "duplicate";
|
|
11927
|
+
var sharedChunkDiagnostics = /* @__PURE__ */ new Map();
|
|
11907
11928
|
function resolveSharedChunkName(options) {
|
|
11908
11929
|
const {
|
|
11909
11930
|
id,
|
|
11910
11931
|
ctx,
|
|
11911
11932
|
relativeAbsoluteSrcRoot,
|
|
11912
11933
|
subPackageRoots,
|
|
11913
|
-
strategy
|
|
11934
|
+
strategy,
|
|
11935
|
+
forceDuplicateTester
|
|
11914
11936
|
} = options;
|
|
11915
11937
|
const moduleInfo = ctx.getModuleInfo(id);
|
|
11916
11938
|
if (!_optionalChain([moduleInfo, 'optionalAccess', _224 => _224.importers]) || moduleInfo.importers.length <= 1) {
|
|
11917
11939
|
return void 0;
|
|
11918
11940
|
}
|
|
11919
|
-
const summary = summarizeImportPrefixes({
|
|
11941
|
+
const { summary, ignoredMainImporters } = summarizeImportPrefixes({
|
|
11942
|
+
ctx,
|
|
11920
11943
|
importers: moduleInfo.importers,
|
|
11921
11944
|
relativeAbsoluteSrcRoot,
|
|
11922
|
-
subPackageRoots: Array.from(subPackageRoots)
|
|
11945
|
+
subPackageRoots: Array.from(subPackageRoots),
|
|
11946
|
+
forceDuplicateTester
|
|
11923
11947
|
});
|
|
11924
11948
|
const keys = Object.keys(summary);
|
|
11925
11949
|
if (keys.length === 0) {
|
|
@@ -11933,19 +11957,145 @@ function resolveSharedChunkName(options) {
|
|
|
11933
11957
|
if (strategy === "duplicate" && !hasMainImporter) {
|
|
11934
11958
|
const combination = keys.filter(Boolean).sort().join("+");
|
|
11935
11959
|
const combinationSegment = combination ? `${combination}/` : "";
|
|
11936
|
-
|
|
11960
|
+
const sharedName = `${SHARED_CHUNK_VIRTUAL_PREFIX}/${combinationSegment}common`;
|
|
11961
|
+
if (ignoredMainImporters.length) {
|
|
11962
|
+
sharedChunkDiagnostics.set(sharedName, {
|
|
11963
|
+
ignoredMainImporters: Array.from(new Set(ignoredMainImporters))
|
|
11964
|
+
});
|
|
11965
|
+
sharedChunkDiagnostics.set(`${sharedName}.js`, {
|
|
11966
|
+
ignoredMainImporters: Array.from(new Set(ignoredMainImporters))
|
|
11967
|
+
});
|
|
11968
|
+
}
|
|
11969
|
+
return sharedName;
|
|
11937
11970
|
}
|
|
11938
11971
|
return "common";
|
|
11939
11972
|
}
|
|
11940
11973
|
function summarizeImportPrefixes(options) {
|
|
11941
|
-
const {
|
|
11974
|
+
const {
|
|
11975
|
+
ctx,
|
|
11976
|
+
importers,
|
|
11977
|
+
relativeAbsoluteSrcRoot,
|
|
11978
|
+
subPackageRoots,
|
|
11979
|
+
forceDuplicateTester
|
|
11980
|
+
} = options;
|
|
11942
11981
|
const summary = {};
|
|
11982
|
+
const ignoredImporters = /* @__PURE__ */ new Set();
|
|
11983
|
+
const state = {
|
|
11984
|
+
cache: /* @__PURE__ */ new Map(),
|
|
11985
|
+
stack: /* @__PURE__ */ new Set()
|
|
11986
|
+
};
|
|
11943
11987
|
for (const importer of importers) {
|
|
11944
|
-
const
|
|
11945
|
-
|
|
11946
|
-
|
|
11988
|
+
const { prefixes, ignored } = collectEffectivePrefixes(importer, {
|
|
11989
|
+
ctx,
|
|
11990
|
+
relativeAbsoluteSrcRoot,
|
|
11991
|
+
subPackageRoots,
|
|
11992
|
+
forceDuplicateTester
|
|
11993
|
+
}, state);
|
|
11994
|
+
for (const prefix of prefixes) {
|
|
11995
|
+
summary[prefix] = (summary[prefix] || 0) + 1;
|
|
11996
|
+
}
|
|
11997
|
+
for (const entry of ignored) {
|
|
11998
|
+
ignoredImporters.add(entry);
|
|
11999
|
+
}
|
|
12000
|
+
}
|
|
12001
|
+
return {
|
|
12002
|
+
summary,
|
|
12003
|
+
ignoredMainImporters: Array.from(ignoredImporters)
|
|
12004
|
+
};
|
|
12005
|
+
}
|
|
12006
|
+
function collectEffectivePrefixes(importer, options, state) {
|
|
12007
|
+
const cached = state.cache.get(importer);
|
|
12008
|
+
if (cached) {
|
|
12009
|
+
return {
|
|
12010
|
+
prefixes: [...cached.prefixes],
|
|
12011
|
+
hasRealMain: cached.hasRealMain,
|
|
12012
|
+
ignored: [...cached.ignored]
|
|
12013
|
+
};
|
|
12014
|
+
}
|
|
12015
|
+
if (state.stack.has(importer)) {
|
|
12016
|
+
return {
|
|
12017
|
+
prefixes: [""],
|
|
12018
|
+
hasRealMain: true,
|
|
12019
|
+
ignored: []
|
|
12020
|
+
};
|
|
12021
|
+
}
|
|
12022
|
+
state.stack.add(importer);
|
|
12023
|
+
const {
|
|
12024
|
+
ctx,
|
|
12025
|
+
relativeAbsoluteSrcRoot,
|
|
12026
|
+
subPackageRoots,
|
|
12027
|
+
forceDuplicateTester
|
|
12028
|
+
} = options;
|
|
12029
|
+
const relativeId = relativeAbsoluteSrcRoot(importer);
|
|
12030
|
+
const subPackagePrefix = resolveSubPackagePrefix(relativeId, subPackageRoots);
|
|
12031
|
+
if (subPackagePrefix) {
|
|
12032
|
+
const result2 = {
|
|
12033
|
+
prefixes: [subPackagePrefix],
|
|
12034
|
+
hasRealMain: false,
|
|
12035
|
+
ignored: []
|
|
12036
|
+
};
|
|
12037
|
+
state.cache.set(importer, result2);
|
|
12038
|
+
state.stack.delete(importer);
|
|
12039
|
+
return {
|
|
12040
|
+
prefixes: [...result2.prefixes],
|
|
12041
|
+
hasRealMain: result2.hasRealMain,
|
|
12042
|
+
ignored: []
|
|
12043
|
+
};
|
|
11947
12044
|
}
|
|
11948
|
-
|
|
12045
|
+
const moduleInfo = ctx.getModuleInfo(importer);
|
|
12046
|
+
const importerParents = _nullishCoalesce(_optionalChain([moduleInfo, 'optionalAccess', _225 => _225.importers]), () => ( []));
|
|
12047
|
+
const forcedDuplicate = _nullishCoalesce(_optionalChain([forceDuplicateTester, 'optionalCall', _226 => _226(relativeId, importer)]), () => ( false));
|
|
12048
|
+
if (!importerParents.length) {
|
|
12049
|
+
const result2 = forcedDuplicate ? {
|
|
12050
|
+
prefixes: [],
|
|
12051
|
+
hasRealMain: false,
|
|
12052
|
+
ignored: [relativeId]
|
|
12053
|
+
} : {
|
|
12054
|
+
prefixes: [""],
|
|
12055
|
+
hasRealMain: true,
|
|
12056
|
+
ignored: []
|
|
12057
|
+
};
|
|
12058
|
+
state.cache.set(importer, result2);
|
|
12059
|
+
state.stack.delete(importer);
|
|
12060
|
+
return {
|
|
12061
|
+
prefixes: [...result2.prefixes],
|
|
12062
|
+
hasRealMain: result2.hasRealMain,
|
|
12063
|
+
ignored: [...result2.ignored]
|
|
12064
|
+
};
|
|
12065
|
+
}
|
|
12066
|
+
const aggregatedPrefixes = /* @__PURE__ */ new Set();
|
|
12067
|
+
let hasRealMain = false;
|
|
12068
|
+
const aggregatedIgnored = [];
|
|
12069
|
+
for (const parent of importerParents) {
|
|
12070
|
+
const collectorResult = collectEffectivePrefixes(parent, options, state);
|
|
12071
|
+
for (const prefix of collectorResult.prefixes) {
|
|
12072
|
+
aggregatedPrefixes.add(prefix);
|
|
12073
|
+
}
|
|
12074
|
+
if (collectorResult.hasRealMain) {
|
|
12075
|
+
hasRealMain = true;
|
|
12076
|
+
}
|
|
12077
|
+
if (collectorResult.ignored.length) {
|
|
12078
|
+
aggregatedIgnored.push(...collectorResult.ignored);
|
|
12079
|
+
}
|
|
12080
|
+
}
|
|
12081
|
+
if (!aggregatedPrefixes.size) {
|
|
12082
|
+
aggregatedPrefixes.add("");
|
|
12083
|
+
hasRealMain = true;
|
|
12084
|
+
}
|
|
12085
|
+
const shouldIgnoreAsMain = !aggregatedPrefixes.has("") && importerParents.length > 0;
|
|
12086
|
+
const ignored = shouldIgnoreAsMain || forcedDuplicate && !aggregatedPrefixes.has("") ? [relativeId] : [];
|
|
12087
|
+
const result = {
|
|
12088
|
+
prefixes: Array.from(aggregatedPrefixes),
|
|
12089
|
+
hasRealMain,
|
|
12090
|
+
ignored: Array.from(/* @__PURE__ */ new Set([...aggregatedIgnored, ...ignored]))
|
|
12091
|
+
};
|
|
12092
|
+
state.cache.set(importer, result);
|
|
12093
|
+
state.stack.delete(importer);
|
|
12094
|
+
return {
|
|
12095
|
+
prefixes: [...result.prefixes],
|
|
12096
|
+
hasRealMain: result.hasRealMain,
|
|
12097
|
+
ignored: [...result.ignored]
|
|
12098
|
+
};
|
|
11949
12099
|
}
|
|
11950
12100
|
function resolveSubPackagePrefix(fileName, subPackageRoots) {
|
|
11951
12101
|
for (const root of subPackageRoots) {
|
|
@@ -12001,13 +12151,14 @@ function applySharedChunkStrategy(bundle, options) {
|
|
|
12001
12151
|
}
|
|
12002
12152
|
}
|
|
12003
12153
|
if (hasMainImporter || importerMap.size === 0) {
|
|
12154
|
+
consumeSharedChunkDiagnostics(originalSharedFileName);
|
|
12004
12155
|
let finalFileName = chunk.fileName;
|
|
12005
12156
|
if (fileName.startsWith(`${SHARED_CHUNK_VIRTUAL_PREFIX}/`)) {
|
|
12006
12157
|
const newFileName = fileName.slice(SHARED_CHUNK_VIRTUAL_PREFIX.length + 1);
|
|
12007
12158
|
chunk.fileName = newFileName;
|
|
12008
12159
|
finalFileName = newFileName;
|
|
12009
12160
|
}
|
|
12010
|
-
_optionalChain([options, 'access',
|
|
12161
|
+
_optionalChain([options, 'access', _227 => _227.onFallback, 'optionalCall', _228 => _228({
|
|
12011
12162
|
sharedFileName: originalSharedFileName,
|
|
12012
12163
|
finalFileName,
|
|
12013
12164
|
reason: hasMainImporter ? "main-package" : "no-subpackage",
|
|
@@ -12017,6 +12168,7 @@ function applySharedChunkStrategy(bundle, options) {
|
|
|
12017
12168
|
}
|
|
12018
12169
|
const importerToChunk = /* @__PURE__ */ new Map();
|
|
12019
12170
|
const duplicates = [];
|
|
12171
|
+
const diagnostics = consumeSharedChunkDiagnostics(originalSharedFileName);
|
|
12020
12172
|
for (const { newFileName, importers: importerFiles } of importerMap.values()) {
|
|
12021
12173
|
this.emitFile({
|
|
12022
12174
|
type: "asset",
|
|
@@ -12039,27 +12191,43 @@ function applySharedChunkStrategy(bundle, options) {
|
|
|
12039
12191
|
});
|
|
12040
12192
|
}
|
|
12041
12193
|
updateImporters(bundle, importerToChunk, fileName);
|
|
12042
|
-
|
|
12043
|
-
|
|
12044
|
-
|
|
12045
|
-
|
|
12046
|
-
|
|
12047
|
-
|
|
12048
|
-
|
|
12049
|
-
|
|
12050
|
-
_optionalChain([options, 'access', _227 => _227.onDuplicate, 'optionalCall', _228 => _228({
|
|
12194
|
+
delete bundle[fileName];
|
|
12195
|
+
const mapKey = `${fileName}.map`;
|
|
12196
|
+
if (bundle[mapKey]) {
|
|
12197
|
+
delete bundle[mapKey];
|
|
12198
|
+
}
|
|
12199
|
+
const chunkBytes = typeof originalCode === "string" ? _buffer.Buffer.byteLength(originalCode, "utf8") : void 0;
|
|
12200
|
+
const redundantBytes = typeof chunkBytes === "number" ? chunkBytes * Math.max(duplicates.length - 1, 0) : void 0;
|
|
12201
|
+
_optionalChain([options, 'access', _229 => _229.onDuplicate, 'optionalCall', _230 => _230({
|
|
12051
12202
|
sharedFileName: originalSharedFileName,
|
|
12052
|
-
duplicates
|
|
12203
|
+
duplicates,
|
|
12204
|
+
ignoredMainImporters: _optionalChain([diagnostics, 'optionalAccess', _231 => _231.ignoredMainImporters]),
|
|
12205
|
+
chunkBytes,
|
|
12206
|
+
redundantBytes
|
|
12053
12207
|
})]);
|
|
12054
12208
|
}
|
|
12055
12209
|
}
|
|
12210
|
+
function consumeSharedChunkDiagnostics(fileName) {
|
|
12211
|
+
const direct = sharedChunkDiagnostics.get(fileName);
|
|
12212
|
+
if (direct) {
|
|
12213
|
+
sharedChunkDiagnostics.delete(fileName);
|
|
12214
|
+
return direct;
|
|
12215
|
+
}
|
|
12216
|
+
const withoutExt = fileName.replace(/\.[^./\\]+$/, "");
|
|
12217
|
+
const fallback = sharedChunkDiagnostics.get(withoutExt);
|
|
12218
|
+
if (fallback) {
|
|
12219
|
+
sharedChunkDiagnostics.delete(withoutExt);
|
|
12220
|
+
return fallback;
|
|
12221
|
+
}
|
|
12222
|
+
return void 0;
|
|
12223
|
+
}
|
|
12056
12224
|
function isSharedVirtualChunk(fileName, output) {
|
|
12057
|
-
return _optionalChain([output, 'optionalAccess',
|
|
12225
|
+
return _optionalChain([output, 'optionalAccess', _232 => _232.type]) === "chunk" && fileName.startsWith(`${SHARED_CHUNK_VIRTUAL_PREFIX}/`);
|
|
12058
12226
|
}
|
|
12059
12227
|
function findChunkImporters(bundle, target) {
|
|
12060
12228
|
const importers = /* @__PURE__ */ new Set();
|
|
12061
12229
|
for (const [fileName, output] of Object.entries(bundle)) {
|
|
12062
|
-
if (_optionalChain([output, 'optionalAccess',
|
|
12230
|
+
if (_optionalChain([output, 'optionalAccess', _233 => _233.type]) !== "chunk") {
|
|
12063
12231
|
continue;
|
|
12064
12232
|
}
|
|
12065
12233
|
const chunk = output;
|
|
@@ -12130,170 +12298,104 @@ function createRelativeImport(fromFile, toFile) {
|
|
|
12130
12298
|
|
|
12131
12299
|
// src/runtime/advancedChunks.ts
|
|
12132
12300
|
function testByReg2DExpList(reg2DExpList) {
|
|
12133
|
-
return (id) => reg2DExpList.some((regExpList) => regExpList.some((regExp) => {
|
|
12134
|
-
regExp.lastIndex = 0;
|
|
12135
|
-
return regExp.test(id);
|
|
12136
|
-
}));
|
|
12137
|
-
}
|
|
12138
|
-
function createAdvancedChunkNameResolver(options) {
|
|
12139
|
-
const {
|
|
12140
|
-
relativeAbsoluteSrcRoot,
|
|
12141
|
-
getSubPackageRoots,
|
|
12142
|
-
strategy,
|
|
12143
|
-
vendorsMatchers
|
|
12144
|
-
|
|
12145
|
-
|
|
12146
|
-
|
|
12147
|
-
|
|
12148
|
-
const
|
|
12149
|
-
|
|
12150
|
-
|
|
12151
|
-
|
|
12152
|
-
|
|
12153
|
-
|
|
12154
|
-
|
|
12155
|
-
|
|
12156
|
-
|
|
12157
|
-
|
|
12158
|
-
|
|
12159
|
-
return "vendors";
|
|
12160
|
-
}
|
|
12161
|
-
return sharedName;
|
|
12162
|
-
};
|
|
12163
|
-
}
|
|
12164
|
-
|
|
12165
|
-
// src/runtime/independentError.ts
|
|
12166
|
-
_chunkA5DD7GKXcjs.init_cjs_shims.call(void 0, );
|
|
12167
|
-
var ANSI_ESCAPE_PATTERN = /\u001B\[[0-9;]*m/g;
|
|
12168
|
-
function stripAnsi(value) {
|
|
12169
|
-
return value.replace(ANSI_ESCAPE_PATTERN, "");
|
|
12170
|
-
}
|
|
12171
|
-
function isErrorInstance(value) {
|
|
12172
|
-
return value instanceof Error;
|
|
12173
|
-
}
|
|
12174
|
-
function formatSummary(payload) {
|
|
12175
|
-
const parts = [];
|
|
12176
|
-
const code = payload.code;
|
|
12177
|
-
if (typeof code === "string" && code.trim()) {
|
|
12178
|
-
parts.push(`code: ${code.trim()}`);
|
|
12179
|
-
}
|
|
12180
|
-
const plugin = payload.plugin;
|
|
12181
|
-
if (typeof plugin === "string" && plugin.trim()) {
|
|
12182
|
-
parts.push(`plugin: ${plugin.trim()}`);
|
|
12183
|
-
}
|
|
12184
|
-
const id = payload.id;
|
|
12185
|
-
if (typeof id === "string" && id.trim()) {
|
|
12186
|
-
parts.push(`id: ${id.trim()}`);
|
|
12187
|
-
}
|
|
12188
|
-
if (!parts.length) {
|
|
12189
|
-
return "";
|
|
12190
|
-
}
|
|
12191
|
-
return ` (${parts.join(", ")})`;
|
|
12192
|
-
}
|
|
12193
|
-
function collectDetails(payload) {
|
|
12194
|
-
const details = [];
|
|
12195
|
-
const frame = payload.frame;
|
|
12196
|
-
if (typeof frame === "string" && frame.trim()) {
|
|
12197
|
-
details.push(frame.trim());
|
|
12198
|
-
}
|
|
12199
|
-
const stack = payload.stack;
|
|
12200
|
-
if (typeof stack === "string" && stack.trim()) {
|
|
12201
|
-
details.push(stack.trim());
|
|
12202
|
-
}
|
|
12203
|
-
return details;
|
|
12204
|
-
}
|
|
12205
|
-
function extractMessage(value, seen) {
|
|
12206
|
-
if (!value || seen.has(value)) {
|
|
12207
|
-
return void 0;
|
|
12208
|
-
}
|
|
12209
|
-
if (typeof value === "string") {
|
|
12210
|
-
const trimmed = stripAnsi(value).trim();
|
|
12211
|
-
return trimmed || void 0;
|
|
12212
|
-
}
|
|
12213
|
-
if (isErrorInstance(value)) {
|
|
12214
|
-
const trimmed = stripAnsi(_nullishCoalesce(value.message, () => ( ""))).trim();
|
|
12215
|
-
if (trimmed) {
|
|
12216
|
-
return trimmed;
|
|
12217
|
-
}
|
|
12218
|
-
if (value.cause) {
|
|
12219
|
-
return extractMessage(value.cause, seen);
|
|
12301
|
+
return (id) => reg2DExpList.some((regExpList) => regExpList.some((regExp) => {
|
|
12302
|
+
regExp.lastIndex = 0;
|
|
12303
|
+
return regExp.test(id);
|
|
12304
|
+
}));
|
|
12305
|
+
}
|
|
12306
|
+
function createAdvancedChunkNameResolver(options) {
|
|
12307
|
+
const {
|
|
12308
|
+
relativeAbsoluteSrcRoot,
|
|
12309
|
+
getSubPackageRoots,
|
|
12310
|
+
strategy,
|
|
12311
|
+
vendorsMatchers,
|
|
12312
|
+
forceDuplicateTester
|
|
12313
|
+
} = options;
|
|
12314
|
+
const isVendor = testByReg2DExpList(vendorsMatchers);
|
|
12315
|
+
return (id, ctx) => {
|
|
12316
|
+
const subPackageRoots = Array.from(getSubPackageRoots());
|
|
12317
|
+
const sharedName = resolveSharedChunkName({
|
|
12318
|
+
id,
|
|
12319
|
+
ctx,
|
|
12320
|
+
relativeAbsoluteSrcRoot,
|
|
12321
|
+
subPackageRoots,
|
|
12322
|
+
strategy,
|
|
12323
|
+
forceDuplicateTester
|
|
12324
|
+
});
|
|
12325
|
+
if (!isVendor(id)) {
|
|
12326
|
+
return sharedName;
|
|
12220
12327
|
}
|
|
12221
|
-
|
|
12222
|
-
|
|
12223
|
-
if (typeof value === "object") {
|
|
12224
|
-
const record = value;
|
|
12225
|
-
seen.add(record);
|
|
12226
|
-
const directMessage = extractMessage(record.message, seen);
|
|
12227
|
-
if (directMessage) {
|
|
12228
|
-
return directMessage;
|
|
12328
|
+
if (strategy === "hoist") {
|
|
12329
|
+
return "vendors";
|
|
12229
12330
|
}
|
|
12230
|
-
|
|
12231
|
-
|
|
12232
|
-
|
|
12233
|
-
|
|
12234
|
-
|
|
12235
|
-
|
|
12331
|
+
return sharedName;
|
|
12332
|
+
};
|
|
12333
|
+
}
|
|
12334
|
+
|
|
12335
|
+
// src/runtime/sharedBuildConfig.ts
|
|
12336
|
+
var REG_NODE_MODULES_DIR = /[\\/]node_modules[\\/]/gi;
|
|
12337
|
+
var REG_COMMONJS_HELPERS = /commonjsHelpers\.js$/;
|
|
12338
|
+
function createSharedBuildConfig(configService, scanService) {
|
|
12339
|
+
const nodeModulesDeps = [REG_NODE_MODULES_DIR];
|
|
12340
|
+
const commonjsHelpersDeps = [REG_COMMONJS_HELPERS];
|
|
12341
|
+
const sharedStrategy = _nullishCoalesce(_optionalChain([configService, 'access', _234 => _234.weappViteConfig, 'optionalAccess', _235 => _235.chunks, 'optionalAccess', _236 => _236.sharedStrategy]), () => ( DEFAULT_SHARED_CHUNK_STRATEGY));
|
|
12342
|
+
const forceDuplicatePatterns = _optionalChain([configService, 'access', _237 => _237.weappViteConfig, 'optionalAccess', _238 => _238.chunks, 'optionalAccess', _239 => _239.forceDuplicatePatterns]);
|
|
12343
|
+
const forceDuplicateTester = createForceDuplicateTester(forceDuplicatePatterns);
|
|
12344
|
+
const resolveAdvancedChunkName = createAdvancedChunkNameResolver({
|
|
12345
|
+
vendorsMatchers: [nodeModulesDeps, commonjsHelpersDeps],
|
|
12346
|
+
relativeAbsoluteSrcRoot: configService.relativeAbsoluteSrcRoot,
|
|
12347
|
+
getSubPackageRoots: () => scanService.subPackageMap.keys(),
|
|
12348
|
+
strategy: sharedStrategy,
|
|
12349
|
+
forceDuplicateTester
|
|
12350
|
+
});
|
|
12351
|
+
return {
|
|
12352
|
+
build: {
|
|
12353
|
+
rolldownOptions: {
|
|
12354
|
+
output: {
|
|
12355
|
+
advancedChunks: {
|
|
12356
|
+
groups: [
|
|
12357
|
+
{
|
|
12358
|
+
name: (id, ctx) => resolveAdvancedChunkName(id, ctx)
|
|
12359
|
+
}
|
|
12360
|
+
]
|
|
12361
|
+
},
|
|
12362
|
+
chunkFileNames: "[name].js"
|
|
12236
12363
|
}
|
|
12237
12364
|
}
|
|
12238
12365
|
}
|
|
12239
|
-
}
|
|
12240
|
-
return void 0;
|
|
12366
|
+
};
|
|
12241
12367
|
}
|
|
12242
|
-
function
|
|
12243
|
-
|
|
12244
|
-
|
|
12245
|
-
if (!cause.message || cause.message.trim() === "") {
|
|
12246
|
-
return new Error(fallback, { cause });
|
|
12247
|
-
}
|
|
12248
|
-
return cause;
|
|
12249
|
-
}
|
|
12250
|
-
if (!cause) {
|
|
12251
|
-
return new Error(fallback);
|
|
12252
|
-
}
|
|
12253
|
-
if (typeof cause === "string") {
|
|
12254
|
-
const trimmed = stripAnsi(cause).trim();
|
|
12255
|
-
if (!trimmed) {
|
|
12256
|
-
return new Error(fallback, { cause });
|
|
12257
|
-
}
|
|
12258
|
-
return new Error(trimmed, { cause });
|
|
12368
|
+
function createForceDuplicateTester(patterns) {
|
|
12369
|
+
if (!patterns || patterns.length === 0) {
|
|
12370
|
+
return void 0;
|
|
12259
12371
|
}
|
|
12260
|
-
|
|
12261
|
-
|
|
12262
|
-
|
|
12263
|
-
|
|
12264
|
-
const summary = formatSummary(payload);
|
|
12265
|
-
const detailLines = collectDetails(payload);
|
|
12266
|
-
if (extracted) {
|
|
12267
|
-
let composedMessage = extracted;
|
|
12268
|
-
if (summary) {
|
|
12269
|
-
composedMessage += summary;
|
|
12270
|
-
}
|
|
12271
|
-
if (detailLines.length) {
|
|
12272
|
-
composedMessage += `
|
|
12273
|
-
${detailLines.join("\n")}`;
|
|
12274
|
-
}
|
|
12275
|
-
return new Error(composedMessage, { cause });
|
|
12372
|
+
const matchers = patterns.map((pattern) => {
|
|
12373
|
+
if (typeof pattern === "string") {
|
|
12374
|
+
const matcher = _picomatch2.default.call(void 0, pattern, { dot: true });
|
|
12375
|
+
return (value) => matcher(value);
|
|
12276
12376
|
}
|
|
12277
|
-
if (
|
|
12278
|
-
|
|
12279
|
-
|
|
12280
|
-
|
|
12281
|
-
|
|
12282
|
-
}
|
|
12377
|
+
if (isRegexp(pattern)) {
|
|
12378
|
+
return (value) => {
|
|
12379
|
+
pattern.lastIndex = 0;
|
|
12380
|
+
return pattern.test(value);
|
|
12381
|
+
};
|
|
12283
12382
|
}
|
|
12383
|
+
return void 0;
|
|
12384
|
+
}).filter((matcher) => typeof matcher === "function");
|
|
12385
|
+
if (!matchers.length) {
|
|
12386
|
+
return void 0;
|
|
12284
12387
|
}
|
|
12285
|
-
|
|
12286
|
-
const
|
|
12287
|
-
|
|
12288
|
-
|
|
12388
|
+
return (relativeId, absoluteId) => {
|
|
12389
|
+
for (const matcher of matchers) {
|
|
12390
|
+
if (matcher(relativeId) || matcher(absoluteId)) {
|
|
12391
|
+
return true;
|
|
12392
|
+
}
|
|
12289
12393
|
}
|
|
12290
|
-
|
|
12291
|
-
}
|
|
12292
|
-
return new Error(fallback, { cause });
|
|
12394
|
+
return false;
|
|
12395
|
+
};
|
|
12293
12396
|
}
|
|
12294
12397
|
|
|
12295
12398
|
// src/runtime/buildPlugin.ts
|
|
12296
|
-
var REG_NODE_MODULES_DIR = /[\\/]node_modules[\\/]/gi;
|
|
12297
12399
|
function createBuildService(ctx) {
|
|
12298
12400
|
function assertRuntimeServices(target) {
|
|
12299
12401
|
if (!target.configService || !target.watcherService || !target.npmService || !target.scanService) {
|
|
@@ -12360,7 +12462,7 @@ function createBuildService(ctx) {
|
|
|
12360
12462
|
function checkWorkersOptions() {
|
|
12361
12463
|
const workersDir = scanService.workersDir;
|
|
12362
12464
|
const hasWorkersDir = Boolean(workersDir);
|
|
12363
|
-
if (hasWorkersDir && _optionalChain([configService, 'access',
|
|
12465
|
+
if (hasWorkersDir && _optionalChain([configService, 'access', _240 => _240.weappViteConfig, 'optionalAccess', _241 => _241.worker, 'optionalAccess', _242 => _242.entry]) === void 0) {
|
|
12364
12466
|
logger_default.error("\u68C0\u6D4B\u5230\u5DF2\u7ECF\u5F00\u542F\u4E86 `worker`\uFF0C\u8BF7\u5728 `vite.config.ts` \u4E2D\u8BBE\u7F6E `weapp.worker.entry` \u8DEF\u5F84");
|
|
12365
12467
|
logger_default.error("\u6BD4\u5982\u5F15\u5165\u7684 `worker` \u8DEF\u5F84\u4E3A `workers/index`, \u6B64\u65F6 `weapp.worker.entry` \u8BBE\u7F6E\u4E3A `[index]` ");
|
|
12366
12468
|
throw new Error("\u8BF7\u5728 `vite.config.ts` \u4E2D\u8BBE\u7F6E `weapp.worker.entry` \u8DEF\u5F84");
|
|
@@ -12381,40 +12483,16 @@ function createBuildService(ctx) {
|
|
|
12381
12483
|
configService.mergeWorkers()
|
|
12382
12484
|
);
|
|
12383
12485
|
}
|
|
12384
|
-
function sharedBuildConfig() {
|
|
12385
|
-
const nodeModulesDeps = [REG_NODE_MODULES_DIR];
|
|
12386
|
-
const commonjsHelpersDeps = [/commonjsHelpers\.js$/];
|
|
12387
|
-
const sharedStrategy = _nullishCoalesce(_optionalChain([configService, 'access', _234 => _234.weappViteConfig, 'optionalAccess', _235 => _235.chunks, 'optionalAccess', _236 => _236.sharedStrategy]), () => ( DEFAULT_SHARED_CHUNK_STRATEGY));
|
|
12388
|
-
const resolveAdvancedChunkName = createAdvancedChunkNameResolver({
|
|
12389
|
-
vendorsMatchers: [nodeModulesDeps, commonjsHelpersDeps],
|
|
12390
|
-
relativeAbsoluteSrcRoot: configService.relativeAbsoluteSrcRoot,
|
|
12391
|
-
getSubPackageRoots: () => scanService.subPackageMap.keys(),
|
|
12392
|
-
strategy: sharedStrategy
|
|
12393
|
-
});
|
|
12394
|
-
return {
|
|
12395
|
-
build: {
|
|
12396
|
-
rolldownOptions: {
|
|
12397
|
-
output: {
|
|
12398
|
-
advancedChunks: {
|
|
12399
|
-
groups: [
|
|
12400
|
-
{
|
|
12401
|
-
name: (id, ctxPlugin) => resolveAdvancedChunkName(id, ctxPlugin)
|
|
12402
|
-
}
|
|
12403
|
-
]
|
|
12404
|
-
},
|
|
12405
|
-
chunkFileNames: "[name].js"
|
|
12406
|
-
}
|
|
12407
|
-
}
|
|
12408
|
-
}
|
|
12409
|
-
};
|
|
12410
|
-
}
|
|
12411
12486
|
async function runDev() {
|
|
12412
12487
|
if (_process2.default.env.NODE_ENV === void 0) {
|
|
12413
12488
|
_process2.default.env.NODE_ENV = "development";
|
|
12414
12489
|
}
|
|
12415
|
-
_optionalChain([debug, 'optionalCall',
|
|
12490
|
+
_optionalChain([debug, 'optionalCall', _243 => _243("dev build watcher start")]);
|
|
12416
12491
|
const { hasWorkersDir, workersDir } = checkWorkersOptions();
|
|
12417
|
-
const buildOptions = configService.merge(
|
|
12492
|
+
const buildOptions = configService.merge(
|
|
12493
|
+
void 0,
|
|
12494
|
+
createSharedBuildConfig(configService, scanService)
|
|
12495
|
+
);
|
|
12418
12496
|
const watcherPromise = _vite.build.call(void 0,
|
|
12419
12497
|
buildOptions
|
|
12420
12498
|
);
|
|
@@ -12476,8 +12554,8 @@ function createBuildService(ctx) {
|
|
|
12476
12554
|
});
|
|
12477
12555
|
}
|
|
12478
12556
|
}
|
|
12479
|
-
_optionalChain([debug, 'optionalCall',
|
|
12480
|
-
_optionalChain([debug, 'optionalCall',
|
|
12557
|
+
_optionalChain([debug, 'optionalCall', _244 => _244("dev build watcher end")]);
|
|
12558
|
+
_optionalChain([debug, 'optionalCall', _245 => _245("dev watcher listen start")]);
|
|
12481
12559
|
let startTime;
|
|
12482
12560
|
let resolveWatcher;
|
|
12483
12561
|
let rejectWatcher;
|
|
@@ -12500,14 +12578,17 @@ function createBuildService(ctx) {
|
|
|
12500
12578
|
return watcher;
|
|
12501
12579
|
}
|
|
12502
12580
|
async function runProd() {
|
|
12503
|
-
_optionalChain([debug, 'optionalCall',
|
|
12581
|
+
_optionalChain([debug, 'optionalCall', _246 => _246("prod build start")]);
|
|
12504
12582
|
const { hasWorkersDir } = checkWorkersOptions();
|
|
12505
12583
|
const bundlerPromise = _vite.build.call(void 0,
|
|
12506
|
-
configService.merge(
|
|
12584
|
+
configService.merge(
|
|
12585
|
+
void 0,
|
|
12586
|
+
createSharedBuildConfig(configService, scanService)
|
|
12587
|
+
)
|
|
12507
12588
|
);
|
|
12508
12589
|
const workerPromise = hasWorkersDir ? buildWorkers() : Promise.resolve();
|
|
12509
12590
|
const [output] = await Promise.all([bundlerPromise, workerPromise]);
|
|
12510
|
-
_optionalChain([debug, 'optionalCall',
|
|
12591
|
+
_optionalChain([debug, 'optionalCall', _247 => _247("prod build end")]);
|
|
12511
12592
|
return output;
|
|
12512
12593
|
}
|
|
12513
12594
|
async function buildEntry(options) {
|
|
@@ -12527,12 +12608,12 @@ function createBuildService(ctx) {
|
|
|
12527
12608
|
}
|
|
12528
12609
|
}
|
|
12529
12610
|
);
|
|
12530
|
-
_optionalChain([debug, 'optionalCall',
|
|
12611
|
+
_optionalChain([debug, 'optionalCall', _248 => _248("deletedFilePaths", deletedFilePaths)]);
|
|
12531
12612
|
logger_default.success(`\u5DF2\u6E05\u7A7A ${configService.mpDistRoot} \u76EE\u5F55`);
|
|
12532
12613
|
}
|
|
12533
|
-
_optionalChain([debug, 'optionalCall',
|
|
12614
|
+
_optionalChain([debug, 'optionalCall', _249 => _249("build start")]);
|
|
12534
12615
|
let npmBuildTask = Promise.resolve();
|
|
12535
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
12616
|
+
if (!_optionalChain([options, 'optionalAccess', _250 => _250.skipNpm])) {
|
|
12536
12617
|
let shouldBuildNpm = true;
|
|
12537
12618
|
if (configService.isDev) {
|
|
12538
12619
|
const isDependenciesOutdated = await npmService.checkDependenciesCacheOutdate();
|
|
@@ -12559,7 +12640,7 @@ function createBuildService(ctx) {
|
|
|
12559
12640
|
result = await runProd();
|
|
12560
12641
|
}
|
|
12561
12642
|
await npmBuildTask;
|
|
12562
|
-
_optionalChain([debug, 'optionalCall',
|
|
12643
|
+
_optionalChain([debug, 'optionalCall', _251 => _251("build end")]);
|
|
12563
12644
|
return result;
|
|
12564
12645
|
}
|
|
12565
12646
|
return {
|
|
@@ -19515,7 +19596,7 @@ function _tryModuleResolve(id, url, conditions) {
|
|
|
19515
19596
|
try {
|
|
19516
19597
|
return moduleResolve(id, url, conditions);
|
|
19517
19598
|
} catch (error) {
|
|
19518
|
-
if (!NOT_FOUND_ERRORS.has(_optionalChain([error, 'optionalAccess',
|
|
19599
|
+
if (!NOT_FOUND_ERRORS.has(_optionalChain([error, 'optionalAccess', _252 => _252.code]))) {
|
|
19519
19600
|
throw error;
|
|
19520
19601
|
}
|
|
19521
19602
|
}
|
|
@@ -19544,7 +19625,7 @@ function _resolve(id, options = {}) {
|
|
|
19544
19625
|
return pathToFileURL(id);
|
|
19545
19626
|
}
|
|
19546
19627
|
} catch (error) {
|
|
19547
|
-
if (_optionalChain([error, 'optionalAccess',
|
|
19628
|
+
if (_optionalChain([error, 'optionalAccess', _253 => _253.code]) !== "ENOENT") {
|
|
19548
19629
|
throw error;
|
|
19549
19630
|
}
|
|
19550
19631
|
}
|
|
@@ -19688,10 +19769,10 @@ function fromGeneratorFn(generatorFn, options) {
|
|
|
19688
19769
|
return fromObject({
|
|
19689
19770
|
name: generatorFn.name,
|
|
19690
19771
|
async(...args) {
|
|
19691
|
-
return iterateAsync(generatorFn.apply(this, args), _optionalChain([options, 'optionalAccess',
|
|
19772
|
+
return iterateAsync(generatorFn.apply(this, args), _optionalChain([options, 'optionalAccess', _254 => _254.onYield]));
|
|
19692
19773
|
},
|
|
19693
19774
|
sync(...args) {
|
|
19694
|
-
return iterateSync2(generatorFn.apply(this, args), _optionalChain([options, 'optionalAccess',
|
|
19775
|
+
return iterateSync2(generatorFn.apply(this, args), _optionalChain([options, 'optionalAccess', _255 => _255.onYield]));
|
|
19695
19776
|
}
|
|
19696
19777
|
});
|
|
19697
19778
|
}
|
|
@@ -19750,7 +19831,7 @@ function findUpSync(name, {
|
|
|
19750
19831
|
const filePath = isAbsoluteName ? name : sysPath2.default.join(directory, name);
|
|
19751
19832
|
try {
|
|
19752
19833
|
const stats = actualFS.default.statSync(filePath, { throwIfNoEntry: false });
|
|
19753
|
-
if (type === "file" && _optionalChain([stats, 'optionalAccess',
|
|
19834
|
+
if (type === "file" && _optionalChain([stats, 'optionalAccess', _256 => _256.isFile, 'call', _257 => _257()]) || type === "directory" && _optionalChain([stats, 'optionalAccess', _258 => _258.isDirectory, 'call', _259 => _259()])) {
|
|
19754
19835
|
return filePath;
|
|
19755
19836
|
}
|
|
19756
19837
|
} catch (e18) {
|
|
@@ -19969,18 +20050,18 @@ async function detect(options = {}) {
|
|
|
19969
20050
|
}
|
|
19970
20051
|
}
|
|
19971
20052
|
}
|
|
19972
|
-
if (_optionalChain([stopDir, 'optionalCall',
|
|
20053
|
+
if (_optionalChain([stopDir, 'optionalCall', _260 => _260(directory)]))
|
|
19973
20054
|
break;
|
|
19974
20055
|
}
|
|
19975
20056
|
return null;
|
|
19976
20057
|
}
|
|
19977
20058
|
function getNameAndVer(pkg) {
|
|
19978
|
-
const handelVer = (version2) => _nullishCoalesce(_optionalChain([version2, 'optionalAccess',
|
|
20059
|
+
const handelVer = (version2) => _nullishCoalesce(_optionalChain([version2, 'optionalAccess', _261 => _261.match, 'call', _262 => _262(/\d+(\.\d+){0,2}/), 'optionalAccess', _263 => _263[0]]), () => ( version2));
|
|
19979
20060
|
if (typeof pkg.packageManager === "string") {
|
|
19980
20061
|
const [name, ver] = pkg.packageManager.replace(/^\^/, "").split("@");
|
|
19981
20062
|
return { name, ver: handelVer(ver) };
|
|
19982
20063
|
}
|
|
19983
|
-
if (typeof _optionalChain([pkg, 'access',
|
|
20064
|
+
if (typeof _optionalChain([pkg, 'access', _264 => _264.devEngines, 'optionalAccess', _265 => _265.packageManager, 'optionalAccess', _266 => _266.name]) === "string") {
|
|
19984
20065
|
return {
|
|
19985
20066
|
name: pkg.devEngines.packageManager.name,
|
|
19986
20067
|
ver: handelVer(pkg.devEngines.packageManager.version)
|
|
@@ -20008,7 +20089,7 @@ async function handlePackageManager(filepath, onUnknown) {
|
|
|
20008
20089
|
agent = name;
|
|
20009
20090
|
return { name, agent, version: version2 };
|
|
20010
20091
|
} else {
|
|
20011
|
-
return _nullishCoalesce(_optionalChain([onUnknown, 'optionalCall',
|
|
20092
|
+
return _nullishCoalesce(_optionalChain([onUnknown, 'optionalCall', _267 => _267(pkg.packageManager)]), () => ( null));
|
|
20012
20093
|
}
|
|
20013
20094
|
}
|
|
20014
20095
|
} catch (e23) {
|
|
@@ -20022,6 +20103,123 @@ function isMetadataYarnClassic(metadataPath) {
|
|
|
20022
20103
|
// src/runtime/config/createConfigService.ts
|
|
20023
20104
|
|
|
20024
20105
|
|
|
20106
|
+
// src/platform.ts
|
|
20107
|
+
_chunkA5DD7GKXcjs.init_cjs_shims.call(void 0, );
|
|
20108
|
+
|
|
20109
|
+
// src/platforms/adapters.ts
|
|
20110
|
+
_chunkA5DD7GKXcjs.init_cjs_shims.call(void 0, );
|
|
20111
|
+
var MINI_PROGRAM_PLATFORM_ADAPTERS = [
|
|
20112
|
+
{
|
|
20113
|
+
id: "weapp",
|
|
20114
|
+
displayName: "WeChat Mini Program",
|
|
20115
|
+
aliases: ["weapp", "wechat", "weixin", "wx"],
|
|
20116
|
+
outputExtensions: {
|
|
20117
|
+
js: "js",
|
|
20118
|
+
json: "json",
|
|
20119
|
+
wxml: "wxml",
|
|
20120
|
+
wxss: "wxss",
|
|
20121
|
+
wxs: "wxs"
|
|
20122
|
+
}
|
|
20123
|
+
},
|
|
20124
|
+
{
|
|
20125
|
+
id: "alipay",
|
|
20126
|
+
displayName: "Alipay Mini Program",
|
|
20127
|
+
aliases: ["alipay", "ali", "my"],
|
|
20128
|
+
outputExtensions: {
|
|
20129
|
+
js: "js",
|
|
20130
|
+
json: "json",
|
|
20131
|
+
wxml: "axml",
|
|
20132
|
+
wxss: "acss",
|
|
20133
|
+
wxs: "sjs"
|
|
20134
|
+
}
|
|
20135
|
+
},
|
|
20136
|
+
{
|
|
20137
|
+
id: "swan",
|
|
20138
|
+
displayName: "Baidu Smart Program",
|
|
20139
|
+
aliases: ["swan", "baidu", "bd"],
|
|
20140
|
+
outputExtensions: {
|
|
20141
|
+
js: "js",
|
|
20142
|
+
json: "json",
|
|
20143
|
+
wxml: "swan",
|
|
20144
|
+
wxss: "css",
|
|
20145
|
+
wxs: "sjs"
|
|
20146
|
+
}
|
|
20147
|
+
},
|
|
20148
|
+
{
|
|
20149
|
+
id: "tt",
|
|
20150
|
+
displayName: "ByteDance / Douyin Mini Program",
|
|
20151
|
+
aliases: ["tt", "toutiao", "bytedance", "douyin"],
|
|
20152
|
+
outputExtensions: {
|
|
20153
|
+
js: "js",
|
|
20154
|
+
json: "json",
|
|
20155
|
+
wxml: "ttml",
|
|
20156
|
+
wxss: "ttss"
|
|
20157
|
+
}
|
|
20158
|
+
},
|
|
20159
|
+
{
|
|
20160
|
+
id: "jd",
|
|
20161
|
+
displayName: "JD Mini Program",
|
|
20162
|
+
aliases: ["jd", "jingdong"],
|
|
20163
|
+
outputExtensions: {
|
|
20164
|
+
js: "js",
|
|
20165
|
+
json: "json",
|
|
20166
|
+
wxml: "jxml",
|
|
20167
|
+
wxss: "jxss",
|
|
20168
|
+
wxs: "wxs"
|
|
20169
|
+
}
|
|
20170
|
+
},
|
|
20171
|
+
{
|
|
20172
|
+
id: "xhs",
|
|
20173
|
+
displayName: "Xiaohongshu Mini Program",
|
|
20174
|
+
aliases: ["xhs", "xiaohongshu", "little-red-book", "red"],
|
|
20175
|
+
outputExtensions: {
|
|
20176
|
+
js: "js",
|
|
20177
|
+
json: "json",
|
|
20178
|
+
wxml: "xhsml",
|
|
20179
|
+
wxss: "css",
|
|
20180
|
+
wxs: "wxs"
|
|
20181
|
+
}
|
|
20182
|
+
}
|
|
20183
|
+
];
|
|
20184
|
+
|
|
20185
|
+
// src/platform.ts
|
|
20186
|
+
var DEFAULT_MP_PLATFORM = "weapp";
|
|
20187
|
+
var PLATFORM_ADAPTER_BY_ID = /* @__PURE__ */ new Map();
|
|
20188
|
+
var PLATFORM_ALIAS_TO_ID = /* @__PURE__ */ new Map();
|
|
20189
|
+
for (const adapter of MINI_PROGRAM_PLATFORM_ADAPTERS) {
|
|
20190
|
+
PLATFORM_ADAPTER_BY_ID.set(adapter.id, adapter);
|
|
20191
|
+
for (const alias of adapter.aliases) {
|
|
20192
|
+
const normalized = alias.trim().toLowerCase();
|
|
20193
|
+
if (!normalized) {
|
|
20194
|
+
continue;
|
|
20195
|
+
}
|
|
20196
|
+
PLATFORM_ALIAS_TO_ID.set(normalized, adapter.id);
|
|
20197
|
+
}
|
|
20198
|
+
if (!PLATFORM_ALIAS_TO_ID.has(adapter.id)) {
|
|
20199
|
+
PLATFORM_ALIAS_TO_ID.set(adapter.id, adapter.id);
|
|
20200
|
+
}
|
|
20201
|
+
}
|
|
20202
|
+
var MINI_PLATFORM_ALIASES = Object.freeze(
|
|
20203
|
+
Object.fromEntries(PLATFORM_ALIAS_TO_ID.entries())
|
|
20204
|
+
);
|
|
20205
|
+
function normalizeMiniPlatform(input) {
|
|
20206
|
+
return input ? input.trim().toLowerCase() : void 0;
|
|
20207
|
+
}
|
|
20208
|
+
function resolveMiniPlatform(input) {
|
|
20209
|
+
const normalized = normalizeMiniPlatform(input);
|
|
20210
|
+
if (!normalized) {
|
|
20211
|
+
return void 0;
|
|
20212
|
+
}
|
|
20213
|
+
return PLATFORM_ALIAS_TO_ID.get(normalized);
|
|
20214
|
+
}
|
|
20215
|
+
function getMiniProgramPlatformAdapter(platform) {
|
|
20216
|
+
const adapter = PLATFORM_ADAPTER_BY_ID.get(platform);
|
|
20217
|
+
if (!adapter) {
|
|
20218
|
+
throw new Error(`Unsupported mini program platform "${platform}".`);
|
|
20219
|
+
}
|
|
20220
|
+
return adapter;
|
|
20221
|
+
}
|
|
20222
|
+
|
|
20025
20223
|
// src/runtime/oxcRuntime.ts
|
|
20026
20224
|
_chunkA5DD7GKXcjs.init_cjs_shims.call(void 0, );
|
|
20027
20225
|
|
|
@@ -20089,7 +20287,7 @@ export default _objectSpread2;`
|
|
|
20089
20287
|
function getOxcHelperName(id) {
|
|
20090
20288
|
OXC_RUNTIME_HELPER_ALIAS.lastIndex = 0;
|
|
20091
20289
|
const match2 = OXC_RUNTIME_HELPER_ALIAS.exec(id);
|
|
20092
|
-
return _optionalChain([match2, 'optionalAccess',
|
|
20290
|
+
return _optionalChain([match2, 'optionalAccess', _268 => _268[1]]);
|
|
20093
20291
|
}
|
|
20094
20292
|
function createOxcRuntimeSupport() {
|
|
20095
20293
|
const oxcRuntimeInfo = getPackageInfoSync("@oxc-project/runtime");
|
|
@@ -20304,7 +20502,9 @@ function getWeappViteConfig() {
|
|
|
20304
20502
|
},
|
|
20305
20503
|
chunks: {
|
|
20306
20504
|
sharedStrategy: "duplicate",
|
|
20307
|
-
logOptimization: true
|
|
20505
|
+
logOptimization: true,
|
|
20506
|
+
forceDuplicatePatterns: [],
|
|
20507
|
+
duplicateWarningBytes: 512 * 1024
|
|
20308
20508
|
}
|
|
20309
20509
|
};
|
|
20310
20510
|
}
|
|
@@ -20345,13 +20545,13 @@ function migrateEnhanceOptions(target, options) {
|
|
|
20345
20545
|
}
|
|
20346
20546
|
const enhance = target.enhance;
|
|
20347
20547
|
const userConfigured = _nullishCoalesce(options.userConfigured, () => ( {}));
|
|
20348
|
-
if (!userConfigured.wxml && _optionalChain([enhance, 'optionalAccess',
|
|
20548
|
+
if (!userConfigured.wxml && _optionalChain([enhance, 'optionalAccess', _269 => _269.wxml]) !== void 0) {
|
|
20349
20549
|
target.wxml = enhance.wxml;
|
|
20350
20550
|
}
|
|
20351
|
-
if (!userConfigured.wxs && _optionalChain([enhance, 'optionalAccess',
|
|
20551
|
+
if (!userConfigured.wxs && _optionalChain([enhance, 'optionalAccess', _270 => _270.wxs]) !== void 0) {
|
|
20352
20552
|
target.wxs = enhance.wxs;
|
|
20353
20553
|
}
|
|
20354
|
-
if (!userConfigured.autoImportComponents && _optionalChain([enhance, 'optionalAccess',
|
|
20554
|
+
if (!userConfigured.autoImportComponents && _optionalChain([enhance, 'optionalAccess', _271 => _271.autoImportComponents]) !== void 0) {
|
|
20355
20555
|
target.autoImportComponents = enhance.autoImportComponents;
|
|
20356
20556
|
}
|
|
20357
20557
|
if (options.warn && !hasLoggedEnhanceDeprecation) {
|
|
@@ -20516,7 +20716,7 @@ function normalizeSrcDir(root, cwd, srcRoot, config) {
|
|
|
20516
20716
|
return _pathe2.default.relative(root, absoluteSrc) || "";
|
|
20517
20717
|
}
|
|
20518
20718
|
function normalizeOutDir(root, config) {
|
|
20519
|
-
if (!_optionalChain([config, 'optionalAccess',
|
|
20719
|
+
if (!_optionalChain([config, 'optionalAccess', _272 => _272.outDir])) {
|
|
20520
20720
|
return _pathe2.default.resolve(root, "dist-web");
|
|
20521
20721
|
}
|
|
20522
20722
|
if (_pathe2.default.isAbsolute(config.outDir)) {
|
|
@@ -20592,11 +20792,11 @@ function createLoadConfig(options) {
|
|
|
20592
20792
|
command: isDev ? "serve" : "build",
|
|
20593
20793
|
mode
|
|
20594
20794
|
}, resolvedConfigFile, cwd);
|
|
20595
|
-
const loadedConfig = _nullishCoalesce(_optionalChain([loaded, 'optionalAccess',
|
|
20795
|
+
const loadedConfig = _nullishCoalesce(_optionalChain([loaded, 'optionalAccess', _273 => _273.config]), () => ( {}));
|
|
20596
20796
|
let weappLoaded;
|
|
20597
20797
|
if (weappConfigFilePath) {
|
|
20598
20798
|
const normalizedWeappPath = _pathe2.default.resolve(weappConfigFilePath);
|
|
20599
|
-
const normalizedLoadedPath = _optionalChain([loaded, 'optionalAccess',
|
|
20799
|
+
const normalizedLoadedPath = _optionalChain([loaded, 'optionalAccess', _274 => _274.path]) ? _pathe2.default.resolve(loaded.path) : void 0;
|
|
20600
20800
|
if (normalizedLoadedPath && normalizedLoadedPath === normalizedWeappPath) {
|
|
20601
20801
|
weappLoaded = loaded;
|
|
20602
20802
|
} else {
|
|
@@ -20629,47 +20829,47 @@ function createLoadConfig(options) {
|
|
|
20629
20829
|
weapp: getWeappViteConfig()
|
|
20630
20830
|
}
|
|
20631
20831
|
);
|
|
20632
|
-
if (_optionalChain([weappLoaded, 'optionalAccess',
|
|
20832
|
+
if (_optionalChain([weappLoaded, 'optionalAccess', _275 => _275.config, 'optionalAccess', _276 => _276.weapp])) {
|
|
20633
20833
|
config.weapp = _shared.defu.call(void 0,
|
|
20634
20834
|
weappLoaded.config.weapp,
|
|
20635
20835
|
_nullishCoalesce(config.weapp, () => ( {}))
|
|
20636
20836
|
);
|
|
20637
20837
|
}
|
|
20638
20838
|
const shouldWarnEnhance = [
|
|
20639
|
-
_optionalChain([inlineConfig, 'optionalAccess',
|
|
20640
|
-
_optionalChain([loadedConfig, 'access',
|
|
20641
|
-
_optionalChain([weappLoaded, 'optionalAccess',
|
|
20839
|
+
_optionalChain([inlineConfig, 'optionalAccess', _277 => _277.weapp, 'optionalAccess', _278 => _278.enhance]),
|
|
20840
|
+
_optionalChain([loadedConfig, 'access', _279 => _279.weapp, 'optionalAccess', _280 => _280.enhance]),
|
|
20841
|
+
_optionalChain([weappLoaded, 'optionalAccess', _281 => _281.config, 'optionalAccess', _282 => _282.weapp, 'optionalAccess', _283 => _283.enhance])
|
|
20642
20842
|
].some(hasDeprecatedEnhanceUsage);
|
|
20643
20843
|
const userConfiguredTopLevel = {
|
|
20644
20844
|
wxml: [
|
|
20645
|
-
_optionalChain([inlineConfig, 'optionalAccess',
|
|
20646
|
-
_optionalChain([loadedConfig, 'access',
|
|
20647
|
-
_optionalChain([weappLoaded, 'optionalAccess',
|
|
20845
|
+
_optionalChain([inlineConfig, 'optionalAccess', _284 => _284.weapp, 'optionalAccess', _285 => _285.wxml]),
|
|
20846
|
+
_optionalChain([loadedConfig, 'access', _286 => _286.weapp, 'optionalAccess', _287 => _287.wxml]),
|
|
20847
|
+
_optionalChain([weappLoaded, 'optionalAccess', _288 => _288.config, 'optionalAccess', _289 => _289.weapp, 'optionalAccess', _290 => _290.wxml])
|
|
20648
20848
|
].some((value) => value !== void 0),
|
|
20649
20849
|
wxs: [
|
|
20650
|
-
_optionalChain([inlineConfig, 'optionalAccess',
|
|
20651
|
-
_optionalChain([loadedConfig, 'access',
|
|
20652
|
-
_optionalChain([weappLoaded, 'optionalAccess',
|
|
20850
|
+
_optionalChain([inlineConfig, 'optionalAccess', _291 => _291.weapp, 'optionalAccess', _292 => _292.wxs]),
|
|
20851
|
+
_optionalChain([loadedConfig, 'access', _293 => _293.weapp, 'optionalAccess', _294 => _294.wxs]),
|
|
20852
|
+
_optionalChain([weappLoaded, 'optionalAccess', _295 => _295.config, 'optionalAccess', _296 => _296.weapp, 'optionalAccess', _297 => _297.wxs])
|
|
20653
20853
|
].some((value) => value !== void 0),
|
|
20654
20854
|
autoImportComponents: [
|
|
20655
|
-
_optionalChain([inlineConfig, 'optionalAccess',
|
|
20656
|
-
_optionalChain([loadedConfig, 'access',
|
|
20657
|
-
_optionalChain([weappLoaded, 'optionalAccess',
|
|
20855
|
+
_optionalChain([inlineConfig, 'optionalAccess', _298 => _298.weapp, 'optionalAccess', _299 => _299.autoImportComponents]),
|
|
20856
|
+
_optionalChain([loadedConfig, 'access', _300 => _300.weapp, 'optionalAccess', _301 => _301.autoImportComponents]),
|
|
20857
|
+
_optionalChain([weappLoaded, 'optionalAccess', _302 => _302.config, 'optionalAccess', _303 => _303.weapp, 'optionalAccess', _304 => _304.autoImportComponents])
|
|
20658
20858
|
].some((value) => value !== void 0)
|
|
20659
20859
|
};
|
|
20660
20860
|
migrateEnhanceOptions(config.weapp, {
|
|
20661
20861
|
warn: shouldWarnEnhance,
|
|
20662
20862
|
userConfigured: userConfiguredTopLevel
|
|
20663
20863
|
});
|
|
20664
|
-
const srcRoot = _nullishCoalesce(_optionalChain([config, 'access',
|
|
20864
|
+
const srcRoot = _nullishCoalesce(_optionalChain([config, 'access', _305 => _305.weapp, 'optionalAccess', _306 => _306.srcRoot]), () => ( ""));
|
|
20665
20865
|
const resolvedWebConfig = resolveWeappWebConfig({
|
|
20666
20866
|
cwd,
|
|
20667
20867
|
srcRoot,
|
|
20668
|
-
config: _optionalChain([config, 'access',
|
|
20868
|
+
config: _optionalChain([config, 'access', _307 => _307.weapp, 'optionalAccess', _308 => _308.web])
|
|
20669
20869
|
});
|
|
20670
20870
|
const buildConfig = _nullishCoalesce(config.build, () => ( (config.build = {})));
|
|
20671
|
-
const jsFormat = _nullishCoalesce(_optionalChain([config, 'access',
|
|
20672
|
-
const enableLegacyEs5 = _optionalChain([config, 'access',
|
|
20871
|
+
const jsFormat = _nullishCoalesce(_optionalChain([config, 'access', _309 => _309.weapp, 'optionalAccess', _310 => _310.jsFormat]), () => ( "cjs"));
|
|
20872
|
+
const enableLegacyEs5 = _optionalChain([config, 'access', _311 => _311.weapp, 'optionalAccess', _312 => _312.es5]) === true;
|
|
20673
20873
|
if (enableLegacyEs5 && jsFormat !== "cjs") {
|
|
20674
20874
|
throw new Error('`weapp.es5` \u4EC5\u652F\u6301\u5728 `weapp.jsFormat` \u4E3A "cjs" \u65F6\u4F7F\u7528\uFF0C\u8BF7\u5207\u6362\u5230 CommonJS \u6216\u5173\u95ED\u8BE5\u9009\u9879\u3002');
|
|
20675
20875
|
}
|
|
@@ -20716,11 +20916,11 @@ function createLoadConfig(options) {
|
|
|
20716
20916
|
config.plugins ??= [];
|
|
20717
20917
|
config.plugins.unshift(oxcVitePlugin);
|
|
20718
20918
|
}
|
|
20719
|
-
const platform = _nullishCoalesce(_optionalChain([config, 'access',
|
|
20720
|
-
const aliasEntries = getAliasEntries(_optionalChain([config, 'access',
|
|
20919
|
+
const platform = _nullishCoalesce(_optionalChain([config, 'access', _313 => _313.weapp, 'optionalAccess', _314 => _314.platform]), () => ( DEFAULT_MP_PLATFORM));
|
|
20920
|
+
const aliasEntries = getAliasEntries(_optionalChain([config, 'access', _315 => _315.weapp, 'optionalAccess', _316 => _316.jsonAlias]));
|
|
20721
20921
|
config.plugins ??= [];
|
|
20722
|
-
config.plugins.push(_vitetsconfigpaths2.default.call(void 0, _optionalChain([config, 'access',
|
|
20723
|
-
const configFilePath = _nullishCoalesce(_nullishCoalesce(_optionalChain([weappLoaded, 'optionalAccess',
|
|
20922
|
+
config.plugins.push(_vitetsconfigpaths2.default.call(void 0, _optionalChain([config, 'access', _317 => _317.weapp, 'optionalAccess', _318 => _318.tsconfigPaths])));
|
|
20923
|
+
const configFilePath = _nullishCoalesce(_nullishCoalesce(_optionalChain([weappLoaded, 'optionalAccess', _319 => _319.path]), () => ( _optionalChain([loaded, 'optionalAccess', _320 => _320.path]))), () => ( resolvedConfigFile));
|
|
20724
20924
|
const outputExtensions = getOutputExtensions(platform);
|
|
20725
20925
|
const relativeSrcRoot = (p) => {
|
|
20726
20926
|
if (srcRoot) {
|
|
@@ -20769,9 +20969,9 @@ function normalizeCopyGlobs(globs) {
|
|
|
20769
20969
|
}
|
|
20770
20970
|
function scanAssetFiles(configService, config) {
|
|
20771
20971
|
const weappViteConfig = configService.weappViteConfig;
|
|
20772
|
-
const include = normalizeCopyGlobs(_optionalChain([weappViteConfig, 'optionalAccess',
|
|
20773
|
-
const exclude = normalizeCopyGlobs(_optionalChain([weappViteConfig, 'optionalAccess',
|
|
20774
|
-
const filter3 = _nullishCoalesce(_optionalChain([weappViteConfig, 'optionalAccess',
|
|
20972
|
+
const include = normalizeCopyGlobs(_optionalChain([weappViteConfig, 'optionalAccess', _321 => _321.copy, 'optionalAccess', _322 => _322.include]));
|
|
20973
|
+
const exclude = normalizeCopyGlobs(_optionalChain([weappViteConfig, 'optionalAccess', _323 => _323.copy, 'optionalAccess', _324 => _324.exclude]));
|
|
20974
|
+
const filter3 = _nullishCoalesce(_optionalChain([weappViteConfig, 'optionalAccess', _325 => _325.copy, 'optionalAccess', _326 => _326.filter]), () => ( (() => true)));
|
|
20775
20975
|
const ignore = [
|
|
20776
20976
|
...defaultExcluded,
|
|
20777
20977
|
_pathe2.default.resolve(configService.cwd, `${config.build.outDir}/**/*`),
|
|
@@ -20829,7 +21029,7 @@ function createAssetCollector(state) {
|
|
|
20829
21029
|
},
|
|
20830
21030
|
async buildEnd() {
|
|
20831
21031
|
const assets = await state.pendingAssets;
|
|
20832
|
-
if (!_optionalChain([assets, 'optionalAccess',
|
|
21032
|
+
if (!_optionalChain([assets, 'optionalAccess', _327 => _327.length])) {
|
|
20833
21033
|
return;
|
|
20834
21034
|
}
|
|
20835
21035
|
for (const candidate of assets) {
|
|
@@ -20931,13 +21131,13 @@ function createAutoImportPlugin(state) {
|
|
|
20931
21131
|
return;
|
|
20932
21132
|
}
|
|
20933
21133
|
const weappConfig = configService.weappViteConfig;
|
|
20934
|
-
const globs = _nullishCoalesce(_optionalChain([weappConfig, 'optionalAccess',
|
|
20935
|
-
const globsKey = _nullishCoalesce(_optionalChain([globs, 'optionalAccess',
|
|
21134
|
+
const globs = _nullishCoalesce(_optionalChain([weappConfig, 'optionalAccess', _328 => _328.autoImportComponents, 'optionalAccess', _329 => _329.globs]), () => ( _optionalChain([weappConfig, 'optionalAccess', _330 => _330.enhance, 'optionalAccess', _331 => _331.autoImportComponents, 'optionalAccess', _332 => _332.globs])));
|
|
21135
|
+
const globsKey = _nullishCoalesce(_optionalChain([globs, 'optionalAccess', _333 => _333.join, 'call', _334 => _334("\0")]), () => ( ""));
|
|
20936
21136
|
if (globsKey !== state.lastGlobsKey) {
|
|
20937
21137
|
state.initialScanDone = false;
|
|
20938
21138
|
state.lastGlobsKey = globsKey;
|
|
20939
21139
|
}
|
|
20940
|
-
if (!_optionalChain([globs, 'optionalAccess',
|
|
21140
|
+
if (!_optionalChain([globs, 'optionalAccess', _335 => _335.length])) {
|
|
20941
21141
|
return;
|
|
20942
21142
|
}
|
|
20943
21143
|
if (state.initialScanDone) {
|
|
@@ -21028,14 +21228,14 @@ function createAutoRoutesPlugin(ctx) {
|
|
|
21028
21228
|
if (!service.isRouteFile(id)) {
|
|
21029
21229
|
return;
|
|
21030
21230
|
}
|
|
21031
|
-
const event = _optionalChain([change, 'optionalAccess',
|
|
21231
|
+
const event = _optionalChain([change, 'optionalAccess', _336 => _336.event]);
|
|
21032
21232
|
await service.handleFileChange(id, event);
|
|
21033
21233
|
},
|
|
21034
21234
|
async handleHotUpdate(context) {
|
|
21035
21235
|
if (!service.isRouteFile(context.file)) {
|
|
21036
21236
|
return;
|
|
21037
21237
|
}
|
|
21038
|
-
if (_optionalChain([resolvedConfig, 'optionalAccess',
|
|
21238
|
+
if (_optionalChain([resolvedConfig, 'optionalAccess', _337 => _337.command]) === "serve") {
|
|
21039
21239
|
await service.handleFileChange(context.file, "update");
|
|
21040
21240
|
}
|
|
21041
21241
|
const virtualModule = context.server.moduleGraph.getModuleById(RESOLVED_VIRTUAL_ID);
|
|
@@ -21259,7 +21459,7 @@ async function renderSharedStyleEntry(entry, _configService, resolvedConfig) {
|
|
|
21259
21459
|
};
|
|
21260
21460
|
}
|
|
21261
21461
|
const processed = await _vite.preprocessCSS.call(void 0, css2, absolutePath, resolvedConfig);
|
|
21262
|
-
const dependencies = _optionalChain([processed, 'optionalAccess',
|
|
21462
|
+
const dependencies = _optionalChain([processed, 'optionalAccess', _338 => _338.deps]) ? dedupeAndNormalizeDependencies(absolutePath, processed.deps) : [];
|
|
21263
21463
|
const result = {
|
|
21264
21464
|
css: processed.code,
|
|
21265
21465
|
dependencies
|
|
@@ -21295,10 +21495,10 @@ function invalidateSharedStyleCache() {
|
|
|
21295
21495
|
try {
|
|
21296
21496
|
const sharedState = _chunkA5DD7GKXcjs.__require.call(void 0, request);
|
|
21297
21497
|
if (sharedState) {
|
|
21298
|
-
_optionalChain([sharedState, 'access',
|
|
21299
|
-
_optionalChain([sharedState, 'access',
|
|
21300
|
-
_optionalChain([sharedState, 'access',
|
|
21301
|
-
_optionalChain([sharedState, 'access',
|
|
21498
|
+
_optionalChain([sharedState, 'access', _339 => _339.contextMap, 'optionalAccess', _340 => _340.clear, 'optionalCall', _341 => _341()]);
|
|
21499
|
+
_optionalChain([sharedState, 'access', _342 => _342.configContextMap, 'optionalAccess', _343 => _343.clear, 'optionalCall', _344 => _344()]);
|
|
21500
|
+
_optionalChain([sharedState, 'access', _345 => _345.contextSourcesMap, 'optionalAccess', _346 => _346.clear, 'optionalCall', _347 => _347()]);
|
|
21501
|
+
_optionalChain([sharedState, 'access', _348 => _348.sourceHashMap, 'optionalAccess', _349 => _349.clear, 'optionalCall', _350 => _350()]);
|
|
21302
21502
|
break;
|
|
21303
21503
|
}
|
|
21304
21504
|
} catch (e26) {
|
|
@@ -21358,7 +21558,7 @@ function createChunkEmitter(configService, loadedEntrySet, debug4) {
|
|
|
21358
21558
|
// @ts-ignore
|
|
21359
21559
|
preserveSignature: "exports-only"
|
|
21360
21560
|
});
|
|
21361
|
-
_optionalChain([debug4, 'optionalCall',
|
|
21561
|
+
_optionalChain([debug4, 'optionalCall', _351 => _351(`load ${fileName} \u8017\u65F6 ${(_perf_hooks.performance.now() - start).toFixed(2)}ms`)]);
|
|
21362
21562
|
});
|
|
21363
21563
|
};
|
|
21364
21564
|
}
|
|
@@ -22665,7 +22865,7 @@ function createEntryLoader(options) {
|
|
|
22665
22865
|
registerJsonAsset,
|
|
22666
22866
|
existsCache
|
|
22667
22867
|
);
|
|
22668
|
-
const pluginJsonPath = _optionalChain([scanService, 'optionalAccess',
|
|
22868
|
+
const pluginJsonPath = _optionalChain([scanService, 'optionalAccess', _352 => _352.pluginJsonPath]);
|
|
22669
22869
|
if (configService.absolutePluginRoot && pluginJsonPath) {
|
|
22670
22870
|
this.addWatchFile(pluginJsonPath);
|
|
22671
22871
|
const pluginJson = await jsonService.read(pluginJsonPath);
|
|
@@ -22713,13 +22913,13 @@ function createEntryLoader(options) {
|
|
|
22713
22913
|
normalizedEntries,
|
|
22714
22914
|
configService.absoluteSrcRoot
|
|
22715
22915
|
);
|
|
22716
|
-
_optionalChain([debug4, 'optionalCall',
|
|
22916
|
+
_optionalChain([debug4, 'optionalCall', _353 => _353(`resolvedIds ${relativeCwdId} \u8017\u65F6 ${getTime()}`)]);
|
|
22717
22917
|
const pendingResolvedIds = [];
|
|
22718
22918
|
const combinedResolved = pluginResolvedRecords ? [...resolvedIds, ...pluginResolvedRecords] : resolvedIds;
|
|
22719
22919
|
const pluginEntrySet = pluginResolvedRecords ? new Set(pluginResolvedRecords.map((record) => record.entry)) : void 0;
|
|
22720
22920
|
for (const { entry, resolvedId } of combinedResolved) {
|
|
22721
22921
|
if (!resolvedId) {
|
|
22722
|
-
if (_optionalChain([pluginEntrySet, 'optionalAccess',
|
|
22922
|
+
if (_optionalChain([pluginEntrySet, 'optionalAccess', _354 => _354.has, 'call', _355 => _355(entry)])) {
|
|
22723
22923
|
logger_default.warn(`\u6CA1\u6709\u627E\u5230\u63D2\u4EF6\u5165\u53E3 \`${entry}\` \u5BF9\u5E94\u7684\u811A\u672C\u6587\u4EF6\uFF0C\u8BF7\u68C0\u67E5\u8DEF\u5F84\u662F\u5426\u6B63\u786E!`);
|
|
22724
22924
|
} else {
|
|
22725
22925
|
logger_default.warn(`\u6CA1\u6709\u627E\u5230 \`${entry}\` \u7684\u5165\u53E3\u6587\u4EF6\uFF0C\u8BF7\u68C0\u67E5\u8DEF\u5F84\u662F\u5426\u6B63\u786E!`);
|
|
@@ -22734,7 +22934,7 @@ function createEntryLoader(options) {
|
|
|
22734
22934
|
if (pendingResolvedIds.length) {
|
|
22735
22935
|
await Promise.all(emitEntriesChunks.call(this, pendingResolvedIds));
|
|
22736
22936
|
}
|
|
22737
|
-
_optionalChain([debug4, 'optionalCall',
|
|
22937
|
+
_optionalChain([debug4, 'optionalCall', _356 => _356(`emitEntriesChunks ${relativeCwdId} \u8017\u65F6 ${getTime()}`)]);
|
|
22738
22938
|
registerJsonAsset({
|
|
22739
22939
|
jsonPath,
|
|
22740
22940
|
json,
|
|
@@ -22749,7 +22949,7 @@ function createEntryLoader(options) {
|
|
|
22749
22949
|
}
|
|
22750
22950
|
const code = await _fsextra2.default.readFile(id, "utf8");
|
|
22751
22951
|
const styleImports = await collectStyleImports(this, id, existsCache);
|
|
22752
|
-
_optionalChain([debug4, 'optionalCall',
|
|
22952
|
+
_optionalChain([debug4, 'optionalCall', _357 => _357(`loadEntry ${relativeCwdId} \u8017\u65F6 ${getTime()}`)]);
|
|
22753
22953
|
if (styleImports.length === 0) {
|
|
22754
22954
|
return {
|
|
22755
22955
|
code
|
|
@@ -22820,7 +23020,7 @@ function createTemplateScanner(wxmlService, debug4) {
|
|
|
22820
23020
|
const { components: components2 } = wxmlToken;
|
|
22821
23021
|
wxmlService.setWxmlComponentsMap(templateEntry, components2);
|
|
22822
23022
|
}
|
|
22823
|
-
_optionalChain([debug4, 'optionalCall',
|
|
23023
|
+
_optionalChain([debug4, 'optionalCall', _358 => _358(`scanTemplateEntry ${templateEntry} \u8017\u65F6 ${(_perf_hooks.performance.now() - start).toFixed(2)}ms`)]);
|
|
22824
23024
|
};
|
|
22825
23025
|
}
|
|
22826
23026
|
|
|
@@ -22994,7 +23194,7 @@ async function extractCssImportDependencies(ctx, importer) {
|
|
|
22994
23194
|
if (!match2) {
|
|
22995
23195
|
break;
|
|
22996
23196
|
}
|
|
22997
|
-
const rawSpecifier = _optionalChain([match2, 'access',
|
|
23197
|
+
const rawSpecifier = _optionalChain([match2, 'access', _359 => _359[1], 'optionalAccess', _360 => _360.trim, 'call', _361 => _361()]);
|
|
22998
23198
|
if (!rawSpecifier) {
|
|
22999
23199
|
continue;
|
|
23000
23200
|
}
|
|
@@ -23212,7 +23412,7 @@ function ensureSidecarWatcher(ctx, rootDir) {
|
|
|
23212
23412
|
return;
|
|
23213
23413
|
}
|
|
23214
23414
|
const normalizedPath = _pathe2.default.normalize(input);
|
|
23215
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
23415
|
+
if (!_optionalChain([options, 'optionalAccess', _362 => _362.silent])) {
|
|
23216
23416
|
logger_default.info(`[watch:${event}] ${ctx.configService.relativeCwd(normalizedPath)}`);
|
|
23217
23417
|
}
|
|
23218
23418
|
handleSidecarChange(event, normalizedPath, isReady);
|
|
@@ -23244,7 +23444,7 @@ function ensureSidecarWatcher(ctx, rootDir) {
|
|
|
23244
23444
|
return;
|
|
23245
23445
|
}
|
|
23246
23446
|
const relativeRoot = ctx.configService.relativeCwd(absRoot);
|
|
23247
|
-
const code = _nullishCoalesce(_optionalChain([error, 'optionalAccess',
|
|
23447
|
+
const code = _nullishCoalesce(_optionalChain([error, 'optionalAccess', _363 => _363.code]), () => ( "UNKNOWN"));
|
|
23248
23448
|
logger_default.warn(`[watch] ${relativeRoot} \u76D1\u542C\u6570\u91CF\u8FBE\u5230\u4E0A\u9650 (${code})\uFF0C\u4FA7\u8F66\u6587\u4EF6\u76D1\u542C\u5DF2\u505C\u7528`);
|
|
23249
23449
|
});
|
|
23250
23450
|
sidecarWatcherMap.set(absRoot, {
|
|
@@ -23408,7 +23608,7 @@ function createCacheKey(options) {
|
|
|
23408
23608
|
return `${options.removeComment ? 1 : 0}|${options.transformEvent ? 1 : 0}`;
|
|
23409
23609
|
}
|
|
23410
23610
|
function getCachedResult(data2, cacheKey) {
|
|
23411
|
-
return _optionalChain([handleCache, 'access',
|
|
23611
|
+
return _optionalChain([handleCache, 'access', _364 => _364.get, 'call', _365 => _365(data2), 'optionalAccess', _366 => _366.get, 'call', _367 => _367(cacheKey)]);
|
|
23412
23612
|
}
|
|
23413
23613
|
function setCachedResult(data2, cacheKey, result) {
|
|
23414
23614
|
let cacheForToken = handleCache.get(data2);
|
|
@@ -23484,7 +23684,7 @@ function handleWxml(data2, options) {
|
|
|
23484
23684
|
if (shouldTransformInlineWxs) {
|
|
23485
23685
|
for (const { end, start, value } of inlineWxsTokens) {
|
|
23486
23686
|
const { result } = getCachedInlineWxsTransform(value);
|
|
23487
|
-
if (_optionalChain([result, 'optionalAccess',
|
|
23687
|
+
if (_optionalChain([result, 'optionalAccess', _368 => _368.code])) {
|
|
23488
23688
|
ms.update(start, end, `
|
|
23489
23689
|
${result.code}`);
|
|
23490
23690
|
}
|
|
@@ -23535,11 +23735,11 @@ function emitWxmlAssetsWithCache(options) {
|
|
|
23535
23735
|
});
|
|
23536
23736
|
const emittedFiles = [];
|
|
23537
23737
|
for (const { id, fileName, token } of currentPackageWxmls) {
|
|
23538
|
-
_optionalChain([runtime, 'access',
|
|
23738
|
+
_optionalChain([runtime, 'access', _369 => _369.addWatchFile, 'optionalCall', _370 => _370(id)]);
|
|
23539
23739
|
const deps = wxmlService.depsMap.get(id);
|
|
23540
23740
|
if (deps) {
|
|
23541
23741
|
for (const dep of deps) {
|
|
23542
|
-
_optionalChain([runtime, 'access',
|
|
23742
|
+
_optionalChain([runtime, 'access', _371 => _371.addWatchFile, 'optionalCall', _372 => _372(dep)]);
|
|
23543
23743
|
}
|
|
23544
23744
|
}
|
|
23545
23745
|
emittedFiles.push(fileName);
|
|
@@ -23635,7 +23835,7 @@ function createCoreLifecyclePlugin(state) {
|
|
|
23635
23835
|
buildService.invalidateIndependentOutput(independentRoot);
|
|
23636
23836
|
scanService.markIndependentDirty(independentRoot);
|
|
23637
23837
|
handledByIndependentWatcher = true;
|
|
23638
|
-
if (_optionalChain([independentMeta, 'optionalAccess',
|
|
23838
|
+
if (_optionalChain([independentMeta, 'optionalAccess', _373 => _373.watchSharedStyles]) !== false) {
|
|
23639
23839
|
invalidateSharedStyleCache();
|
|
23640
23840
|
}
|
|
23641
23841
|
}
|
|
@@ -23683,7 +23883,7 @@ function createCoreLifecyclePlugin(state) {
|
|
|
23683
23883
|
options.input = scannedInput;
|
|
23684
23884
|
},
|
|
23685
23885
|
async load(id) {
|
|
23686
|
-
_optionalChain([configService, 'access',
|
|
23886
|
+
_optionalChain([configService, 'access', _374 => _374.weappViteConfig, 'optionalAccess', _375 => _375.debug, 'optionalAccess', _376 => _376.load, 'optionalCall', _377 => _377(id, subPackageMeta)]);
|
|
23687
23887
|
const relativeBasename = _shared.removeExtensionDeep.call(void 0, configService.relativeAbsoluteSrcRoot(id));
|
|
23688
23888
|
if (isCSSRequest(id)) {
|
|
23689
23889
|
const parsed = parseRequest(id);
|
|
@@ -23697,7 +23897,7 @@ function createCoreLifecyclePlugin(state) {
|
|
|
23697
23897
|
}
|
|
23698
23898
|
return null;
|
|
23699
23899
|
}
|
|
23700
|
-
if (loadedEntrySet.has(id) || _optionalChain([subPackageMeta, 'optionalAccess',
|
|
23900
|
+
if (loadedEntrySet.has(id) || _optionalChain([subPackageMeta, 'optionalAccess', _378 => _378.entries, 'access', _379 => _379.includes, 'call', _380 => _380(relativeBasename)])) {
|
|
23701
23901
|
return await loadEntry.call(this, id, "component");
|
|
23702
23902
|
}
|
|
23703
23903
|
if (relativeBasename === "app") {
|
|
@@ -23728,13 +23928,19 @@ function createCoreLifecyclePlugin(state) {
|
|
|
23728
23928
|
return subPackageRoots.find((root) => filePath === root || filePath.startsWith(`${root}/`));
|
|
23729
23929
|
};
|
|
23730
23930
|
var matchSubPackage = matchSubPackage2;
|
|
23731
|
-
const sharedStrategy = _nullishCoalesce(_optionalChain([configService, 'access',
|
|
23732
|
-
const shouldLogChunks = _nullishCoalesce(_optionalChain([configService, 'access',
|
|
23931
|
+
const sharedStrategy = _nullishCoalesce(_optionalChain([configService, 'access', _381 => _381.weappViteConfig, 'optionalAccess', _382 => _382.chunks, 'optionalAccess', _383 => _383.sharedStrategy]), () => ( DEFAULT_SHARED_CHUNK_STRATEGY));
|
|
23932
|
+
const shouldLogChunks = _nullishCoalesce(_optionalChain([configService, 'access', _384 => _384.weappViteConfig, 'optionalAccess', _385 => _385.chunks, 'optionalAccess', _386 => _386.logOptimization]), () => ( true));
|
|
23733
23933
|
const subPackageRoots = Array.from(scanService.subPackageMap.keys()).filter(Boolean);
|
|
23734
|
-
|
|
23735
|
-
|
|
23736
|
-
|
|
23737
|
-
|
|
23934
|
+
const duplicateWarningBytes = Number(_nullishCoalesce(_optionalChain([configService, 'access', _387 => _387.weappViteConfig, 'optionalAccess', _388 => _388.chunks, 'optionalAccess', _389 => _389.duplicateWarningBytes]), () => ( 0)));
|
|
23935
|
+
const shouldWarnOnDuplicate = Number.isFinite(duplicateWarningBytes) && duplicateWarningBytes > 0;
|
|
23936
|
+
let redundantBytesTotal = 0;
|
|
23937
|
+
const handleDuplicate = shouldLogChunks || shouldWarnOnDuplicate ? ({ duplicates, ignoredMainImporters, chunkBytes, redundantBytes }) => {
|
|
23938
|
+
if (shouldWarnOnDuplicate) {
|
|
23939
|
+
const duplicateCount = duplicates.length;
|
|
23940
|
+
const computedRedundant = typeof redundantBytes === "number" ? redundantBytes : typeof chunkBytes === "number" ? chunkBytes * Math.max(duplicateCount - 1, 0) : 0;
|
|
23941
|
+
redundantBytesTotal += computedRedundant;
|
|
23942
|
+
}
|
|
23943
|
+
if (shouldLogChunks) {
|
|
23738
23944
|
const subPackageSet = /* @__PURE__ */ new Set();
|
|
23739
23945
|
let totalReferences = 0;
|
|
23740
23946
|
for (const { fileName, importers } of duplicates) {
|
|
@@ -23745,8 +23951,14 @@ function createCoreLifecyclePlugin(state) {
|
|
|
23745
23951
|
}
|
|
23746
23952
|
}
|
|
23747
23953
|
const subPackageList = Array.from(subPackageSet).join("\u3001") || "\u76F8\u5173\u5206\u5305";
|
|
23748
|
-
|
|
23749
|
-
|
|
23954
|
+
const ignoredHint = _optionalChain([ignoredMainImporters, 'optionalAccess', _390 => _390.length]) ? `\uFF0C\u5FFD\u7565\u4E3B\u5305\u5F15\u7528\uFF1A${ignoredMainImporters.join("\u3001")}` : "";
|
|
23955
|
+
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`);
|
|
23956
|
+
}
|
|
23957
|
+
} : void 0;
|
|
23958
|
+
applySharedChunkStrategy.call(this, bundle, {
|
|
23959
|
+
strategy: sharedStrategy,
|
|
23960
|
+
subPackageRoots,
|
|
23961
|
+
onDuplicate: handleDuplicate,
|
|
23750
23962
|
onFallback: shouldLogChunks ? ({ reason, importers }) => {
|
|
23751
23963
|
const involvedSubs = /* @__PURE__ */ new Set();
|
|
23752
23964
|
let hasMainReference = false;
|
|
@@ -23773,11 +23985,14 @@ function createCoreLifecyclePlugin(state) {
|
|
|
23773
23985
|
}
|
|
23774
23986
|
} : void 0
|
|
23775
23987
|
});
|
|
23988
|
+
if (shouldWarnOnDuplicate && redundantBytesTotal > duplicateWarningBytes) {
|
|
23989
|
+
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`);
|
|
23990
|
+
}
|
|
23776
23991
|
}
|
|
23777
|
-
if (_optionalChain([configService, 'access',
|
|
23992
|
+
if (_optionalChain([configService, 'access', _391 => _391.weappViteConfig, 'optionalAccess', _392 => _392.debug, 'optionalAccess', _393 => _393.watchFiles])) {
|
|
23778
23993
|
const watcherService = ctx.watcherService;
|
|
23779
|
-
const watcherRoot = _nullishCoalesce(_optionalChain([subPackageMeta, 'optionalAccess',
|
|
23780
|
-
const watcher = _optionalChain([watcherService, 'optionalAccess',
|
|
23994
|
+
const watcherRoot = _nullishCoalesce(_optionalChain([subPackageMeta, 'optionalAccess', _394 => _394.subPackage, 'access', _395 => _395.root]), () => ( "/"));
|
|
23995
|
+
const watcher = _optionalChain([watcherService, 'optionalAccess', _396 => _396.getRollupWatcher, 'call', _397 => _397(watcherRoot)]);
|
|
23781
23996
|
let watchFiles;
|
|
23782
23997
|
if (watcher && typeof watcher.getWatchFiles === "function") {
|
|
23783
23998
|
watchFiles = await watcher.getWatchFiles();
|
|
@@ -23791,7 +24006,7 @@ function createCoreLifecyclePlugin(state) {
|
|
|
23791
24006
|
}
|
|
23792
24007
|
},
|
|
23793
24008
|
buildEnd() {
|
|
23794
|
-
_optionalChain([debug2, 'optionalCall',
|
|
24009
|
+
_optionalChain([debug2, 'optionalCall', _398 => _398(`${subPackageMeta ? `\u72EC\u7ACB\u5206\u5305 ${subPackageMeta.subPackage.root}` : "\u4E3B\u5305"} ${Array.from(this.getModuleIds()).length} \u4E2A\u6A21\u5757\u88AB\u7F16\u8BD1`)]);
|
|
23795
24010
|
}
|
|
23796
24011
|
};
|
|
23797
24012
|
}
|
|
@@ -23848,6 +24063,21 @@ function createRequireAnalysisPlugin(state) {
|
|
|
23848
24063
|
}
|
|
23849
24064
|
};
|
|
23850
24065
|
}
|
|
24066
|
+
function formatBytes(bytes) {
|
|
24067
|
+
if (!Number.isFinite(bytes) || bytes <= 0) {
|
|
24068
|
+
return "0 B";
|
|
24069
|
+
}
|
|
24070
|
+
const units = ["B", "KB", "MB", "GB"];
|
|
24071
|
+
let value = bytes;
|
|
24072
|
+
let index = 0;
|
|
24073
|
+
while (value >= 1024 && index < units.length - 1) {
|
|
24074
|
+
value /= 1024;
|
|
24075
|
+
index++;
|
|
24076
|
+
}
|
|
24077
|
+
const precision = value >= 100 ? 0 : value >= 10 ? 1 : 2;
|
|
24078
|
+
const formatted = value.toFixed(precision).replace(/\.0+$/, "");
|
|
24079
|
+
return `${formatted} ${units[index]}`;
|
|
24080
|
+
}
|
|
23851
24081
|
function emitJsonAssets(state) {
|
|
23852
24082
|
const { ctx } = state;
|
|
23853
24083
|
const { jsonService } = ctx;
|
|
@@ -23875,7 +24105,7 @@ async function flushIndependentBuilds(state) {
|
|
|
23875
24105
|
}
|
|
23876
24106
|
const outputs = await Promise.all(pendingIndependentBuilds);
|
|
23877
24107
|
for (const { rollup } of outputs) {
|
|
23878
|
-
const bundleOutputs = Array.isArray(_optionalChain([rollup, 'optionalAccess',
|
|
24108
|
+
const bundleOutputs = Array.isArray(_optionalChain([rollup, 'optionalAccess', _399 => _399.output])) ? rollup.output : [];
|
|
23879
24109
|
for (const output of bundleOutputs) {
|
|
23880
24110
|
if (output.type === "chunk") {
|
|
23881
24111
|
this.emitFile({
|
|
@@ -23912,13 +24142,13 @@ function toPosixPath(value) {
|
|
|
23912
24142
|
var styleMatcherCache = /* @__PURE__ */ new WeakMap();
|
|
23913
24143
|
function collectSharedStyleEntries(ctx, configService) {
|
|
23914
24144
|
const map = /* @__PURE__ */ new Map();
|
|
23915
|
-
const registry = _optionalChain([ctx, 'access',
|
|
23916
|
-
if (!_optionalChain([registry, 'optionalAccess',
|
|
24145
|
+
const registry = _optionalChain([ctx, 'access', _400 => _400.scanService, 'optionalAccess', _401 => _401.subPackageMap]);
|
|
24146
|
+
if (!_optionalChain([registry, 'optionalAccess', _402 => _402.size])) {
|
|
23917
24147
|
return map;
|
|
23918
24148
|
}
|
|
23919
24149
|
const currentRoot = configService.currentSubPackageRoot;
|
|
23920
24150
|
for (const [root, meta] of registry.entries()) {
|
|
23921
|
-
if (!_optionalChain([meta, 'access',
|
|
24151
|
+
if (!_optionalChain([meta, 'access', _403 => _403.styleEntries, 'optionalAccess', _404 => _404.length])) {
|
|
23922
24152
|
continue;
|
|
23923
24153
|
}
|
|
23924
24154
|
if (currentRoot && root !== currentRoot) {
|
|
@@ -23963,12 +24193,12 @@ function getStyleMatcher(entry) {
|
|
|
23963
24193
|
if (cached) {
|
|
23964
24194
|
return cached;
|
|
23965
24195
|
}
|
|
23966
|
-
const includePatterns = _optionalChain([entry, 'access',
|
|
23967
|
-
const excludePatterns = _optionalChain([entry, 'access',
|
|
24196
|
+
const includePatterns = _optionalChain([entry, 'access', _405 => _405.include, 'optionalAccess', _406 => _406.length]) ? entry.include : ["**/*"];
|
|
24197
|
+
const excludePatterns = _optionalChain([entry, 'access', _407 => _407.exclude, 'optionalAccess', _408 => _408.length]) ? entry.exclude : void 0;
|
|
23968
24198
|
const matcher = {
|
|
23969
24199
|
include: _picomatch2.default.call(void 0, includePatterns, { dot: true })
|
|
23970
24200
|
};
|
|
23971
|
-
if (_optionalChain([excludePatterns, 'optionalAccess',
|
|
24201
|
+
if (_optionalChain([excludePatterns, 'optionalAccess', _409 => _409.length])) {
|
|
23972
24202
|
matcher.exclude = _picomatch2.default.call(void 0, excludePatterns, { dot: true });
|
|
23973
24203
|
}
|
|
23974
24204
|
styleMatcherCache.set(entry, matcher);
|
|
@@ -24073,7 +24303,7 @@ function injectSharedStyleImports(css2, modulePath, fileName, sharedStyles, conf
|
|
|
24073
24303
|
}
|
|
24074
24304
|
const normalizedFileName = toPosixPath(fileName);
|
|
24075
24305
|
const entries = findSharedStylesForModule(normalizedModule, normalizedFileName, sharedStyles);
|
|
24076
|
-
if (!_optionalChain([entries, 'optionalAccess',
|
|
24306
|
+
if (!_optionalChain([entries, 'optionalAccess', _410 => _410.length])) {
|
|
24077
24307
|
return css2;
|
|
24078
24308
|
}
|
|
24079
24309
|
const specifiers = resolveImportSpecifiers(fileName, entries);
|
|
@@ -24285,14 +24515,14 @@ function createPluginPruner() {
|
|
|
24285
24515
|
name: "weapp-vite:preflight",
|
|
24286
24516
|
enforce: "pre",
|
|
24287
24517
|
configResolved(config) {
|
|
24288
|
-
if (!_optionalChain([config, 'access',
|
|
24518
|
+
if (!_optionalChain([config, 'access', _411 => _411.plugins, 'optionalAccess', _412 => _412.length])) {
|
|
24289
24519
|
return;
|
|
24290
24520
|
}
|
|
24291
24521
|
for (const removePlugin of removePlugins) {
|
|
24292
24522
|
const idx = config.plugins.findIndex((plugin) => plugin.name === removePlugin);
|
|
24293
24523
|
if (idx > -1) {
|
|
24294
24524
|
const [plugin] = config.plugins.splice(idx, 1);
|
|
24295
|
-
plugin && _optionalChain([debug3, 'optionalCall',
|
|
24525
|
+
plugin && _optionalChain([debug3, 'optionalCall', _413 => _413("remove plugin", plugin.name)]);
|
|
24296
24526
|
}
|
|
24297
24527
|
}
|
|
24298
24528
|
}
|
|
@@ -24348,8 +24578,8 @@ function createWorkerBuildPlugin(ctx) {
|
|
|
24348
24578
|
name: "weapp-vite:workers",
|
|
24349
24579
|
enforce: "pre",
|
|
24350
24580
|
async options(options) {
|
|
24351
|
-
const workerConfig = _optionalChain([configService, 'access',
|
|
24352
|
-
const entries = Array.isArray(_optionalChain([workerConfig, 'optionalAccess',
|
|
24581
|
+
const workerConfig = _optionalChain([configService, 'access', _414 => _414.weappViteConfig, 'optionalAccess', _415 => _415.worker]);
|
|
24582
|
+
const entries = Array.isArray(_optionalChain([workerConfig, 'optionalAccess', _416 => _416.entry])) ? workerConfig.entry : [_optionalChain([workerConfig, 'optionalAccess', _417 => _417.entry])];
|
|
24353
24583
|
const normalized = (await Promise.all(entries.filter(Boolean).map((entry) => resolveWorkerEntry(ctx, entry)))).filter((result) => Boolean(result.value)).reduce((acc, cur) => {
|
|
24354
24584
|
acc[cur.key] = cur.value;
|
|
24355
24585
|
return acc;
|
|
@@ -24406,7 +24636,7 @@ async function transformWxsFile(state, wxsPath) {
|
|
|
24406
24636
|
const { result, importees } = transformWxsCode(rawCode, {
|
|
24407
24637
|
filename: wxsPath
|
|
24408
24638
|
});
|
|
24409
|
-
if (typeof _optionalChain([result, 'optionalAccess',
|
|
24639
|
+
if (typeof _optionalChain([result, 'optionalAccess', _418 => _418.code]) === "string") {
|
|
24410
24640
|
code = result.code;
|
|
24411
24641
|
}
|
|
24412
24642
|
const dirname5 = _pathe2.default.dirname(wxsPath);
|
|
@@ -24483,15 +24713,25 @@ function wxs(ctx) {
|
|
|
24483
24713
|
|
|
24484
24714
|
// src/plugins/index.ts
|
|
24485
24715
|
var RUNTIME_PLUGINS_SYMBOL = Symbol.for("weapp-runtime:plugins");
|
|
24716
|
+
var WEAPP_VITE_CONTEXT_PLUGIN_NAME = "weapp-vite:context";
|
|
24717
|
+
function createContextPlugin(ctx) {
|
|
24718
|
+
return {
|
|
24719
|
+
name: WEAPP_VITE_CONTEXT_PLUGIN_NAME,
|
|
24720
|
+
enforce: "pre",
|
|
24721
|
+
api: {
|
|
24722
|
+
ctx
|
|
24723
|
+
}
|
|
24724
|
+
};
|
|
24725
|
+
}
|
|
24486
24726
|
function attachRuntimePlugins(ctx, plugins) {
|
|
24487
24727
|
const runtimePlugins = ctx[RUNTIME_PLUGINS_SYMBOL];
|
|
24488
|
-
if (!_optionalChain([runtimePlugins, 'optionalAccess',
|
|
24728
|
+
if (!_optionalChain([runtimePlugins, 'optionalAccess', _419 => _419.length])) {
|
|
24489
24729
|
return plugins;
|
|
24490
24730
|
}
|
|
24491
24731
|
return [...runtimePlugins, ...plugins];
|
|
24492
24732
|
}
|
|
24493
24733
|
function applyInspect(ctx, plugins) {
|
|
24494
|
-
const inspectOptions = _optionalChain([ctx, 'access',
|
|
24734
|
+
const inspectOptions = _optionalChain([ctx, 'access', _420 => _420.configService, 'access', _421 => _421.weappViteConfig, 'optionalAccess', _422 => _422.debug, 'optionalAccess', _423 => _423.inspect]);
|
|
24495
24735
|
if (!inspectOptions) {
|
|
24496
24736
|
return plugins;
|
|
24497
24737
|
}
|
|
@@ -24504,7 +24744,7 @@ function flatten(groups) {
|
|
|
24504
24744
|
}, []);
|
|
24505
24745
|
}
|
|
24506
24746
|
function vitePluginWeapp(ctx, subPackageMeta) {
|
|
24507
|
-
const groups = [preflight(ctx)];
|
|
24747
|
+
const groups = [[createContextPlugin(ctx)], preflight(ctx)];
|
|
24508
24748
|
if (!subPackageMeta) {
|
|
24509
24749
|
groups.push(asset(ctx), autoRoutes(ctx), autoImport(ctx));
|
|
24510
24750
|
}
|
|
@@ -24516,7 +24756,7 @@ function vitePluginWeapp(ctx, subPackageMeta) {
|
|
|
24516
24756
|
return applyInspect(ctx, assembled);
|
|
24517
24757
|
}
|
|
24518
24758
|
function vitePluginWeappWorkers(ctx) {
|
|
24519
|
-
const groups = [preflight(ctx), workers(ctx)];
|
|
24759
|
+
const groups = [[createContextPlugin(ctx)], preflight(ctx), workers(ctx)];
|
|
24520
24760
|
const assembled = attachRuntimePlugins(ctx, flatten(groups));
|
|
24521
24761
|
return applyInspect(ctx, assembled);
|
|
24522
24762
|
}
|
|
@@ -24582,7 +24822,7 @@ function createMergeFactories(options) {
|
|
|
24582
24822
|
const currentOptions = getOptions2();
|
|
24583
24823
|
applyRuntimePlatform("miniprogram");
|
|
24584
24824
|
const external = [];
|
|
24585
|
-
if (_optionalChain([currentOptions, 'access',
|
|
24825
|
+
if (_optionalChain([currentOptions, 'access', _424 => _424.packageJson, 'optionalAccess', _425 => _425.dependencies])) {
|
|
24586
24826
|
external.push(
|
|
24587
24827
|
...Object.keys(currentOptions.packageJson.dependencies).map((pkg) => {
|
|
24588
24828
|
return new RegExp(`^${pkg.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&")}(\\/|$)`);
|
|
@@ -24597,7 +24837,7 @@ function createMergeFactories(options) {
|
|
|
24597
24837
|
const watchInclude = [
|
|
24598
24838
|
_pathe2.default.join(currentOptions.cwd, currentOptions.srcRoot, "**")
|
|
24599
24839
|
];
|
|
24600
|
-
const pluginRootConfig = _optionalChain([currentOptions, 'access',
|
|
24840
|
+
const pluginRootConfig = _optionalChain([currentOptions, 'access', _426 => _426.config, 'access', _427 => _427.weapp, 'optionalAccess', _428 => _428.pluginRoot]);
|
|
24601
24841
|
if (pluginRootConfig) {
|
|
24602
24842
|
const absolutePluginRoot = _pathe2.default.resolve(currentOptions.cwd, pluginRootConfig);
|
|
24603
24843
|
const relativeToSrc = _pathe2.default.relative(
|
|
@@ -24657,7 +24897,7 @@ function createMergeFactories(options) {
|
|
|
24657
24897
|
);
|
|
24658
24898
|
inlineConfig.logLevel = "info";
|
|
24659
24899
|
injectBuiltinAliases(inlineConfig);
|
|
24660
|
-
const currentRoot = _optionalChain([subPackageMeta, 'optionalAccess',
|
|
24900
|
+
const currentRoot = _optionalChain([subPackageMeta, 'optionalAccess', _429 => _429.subPackage, 'access', _430 => _430.root]);
|
|
24661
24901
|
setOptions({
|
|
24662
24902
|
...currentOptions,
|
|
24663
24903
|
currentSubPackageRoot: currentRoot
|
|
@@ -24668,7 +24908,7 @@ function createMergeFactories(options) {
|
|
|
24668
24908
|
ensureConfigService();
|
|
24669
24909
|
const currentOptions = getOptions2();
|
|
24670
24910
|
const web = currentOptions.weappWeb;
|
|
24671
|
-
if (!_optionalChain([web, 'optionalAccess',
|
|
24911
|
+
if (!_optionalChain([web, 'optionalAccess', _431 => _431.enabled])) {
|
|
24672
24912
|
return void 0;
|
|
24673
24913
|
}
|
|
24674
24914
|
applyRuntimePlatform("web");
|
|
@@ -24759,7 +24999,7 @@ function createConfigService(ctx) {
|
|
|
24759
24999
|
defineEnv[key] = value;
|
|
24760
25000
|
}
|
|
24761
25001
|
function getDefineImportMetaEnv() {
|
|
24762
|
-
const mpPlatform = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
25002
|
+
const mpPlatform = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _432 => _432.platform]), () => ( DEFAULT_MP_PLATFORM));
|
|
24763
25003
|
const resolvedPlatform = _nullishCoalesce(defineEnv.PLATFORM, () => ( mpPlatform));
|
|
24764
25004
|
const env = {
|
|
24765
25005
|
PLATFORM: resolvedPlatform,
|
|
@@ -24775,7 +25015,7 @@ function createConfigService(ctx) {
|
|
|
24775
25015
|
}
|
|
24776
25016
|
function applyRuntimePlatform(runtime) {
|
|
24777
25017
|
const isWeb = runtime === "web";
|
|
24778
|
-
const mpPlatform = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
25018
|
+
const mpPlatform = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _433 => _433.platform]), () => ( DEFAULT_MP_PLATFORM));
|
|
24779
25019
|
const resolvedPlatform = isWeb ? "web" : mpPlatform;
|
|
24780
25020
|
setDefineEnv("PLATFORM", resolvedPlatform);
|
|
24781
25021
|
setDefineEnv("IS_WEB", isWeb);
|
|
@@ -24886,10 +25126,10 @@ function createConfigService(ctx) {
|
|
|
24886
25126
|
return options.srcRoot;
|
|
24887
25127
|
},
|
|
24888
25128
|
get pluginRoot() {
|
|
24889
|
-
return _optionalChain([options, 'access',
|
|
25129
|
+
return _optionalChain([options, 'access', _434 => _434.config, 'access', _435 => _435.weapp, 'optionalAccess', _436 => _436.pluginRoot]);
|
|
24890
25130
|
},
|
|
24891
25131
|
get absolutePluginRoot() {
|
|
24892
|
-
if (_optionalChain([options, 'access',
|
|
25132
|
+
if (_optionalChain([options, 'access', _437 => _437.config, 'access', _438 => _438.weapp, 'optionalAccess', _439 => _439.pluginRoot])) {
|
|
24893
25133
|
return _pathe2.default.resolve(options.cwd, options.config.weapp.pluginRoot);
|
|
24894
25134
|
}
|
|
24895
25135
|
},
|
|
@@ -24919,7 +25159,7 @@ function createConfigService(ctx) {
|
|
|
24919
25159
|
},
|
|
24920
25160
|
relativeAbsoluteSrcRoot(p) {
|
|
24921
25161
|
const absoluteSrcRoot = _pathe2.default.resolve(options.cwd, options.srcRoot);
|
|
24922
|
-
const pluginRootConfig = _optionalChain([options, 'access',
|
|
25162
|
+
const pluginRootConfig = _optionalChain([options, 'access', _440 => _440.config, 'access', _441 => _441.weapp, 'optionalAccess', _442 => _442.pluginRoot]);
|
|
24923
25163
|
if (pluginRootConfig) {
|
|
24924
25164
|
const absolutePluginRoot = _pathe2.default.resolve(options.cwd, pluginRootConfig);
|
|
24925
25165
|
const relativeToPlugin = _pathe2.default.relative(absolutePluginRoot, p);
|
|
@@ -24971,10 +25211,10 @@ function createJsonService(ctx) {
|
|
|
24971
25211
|
}
|
|
24972
25212
|
let resultJson;
|
|
24973
25213
|
if (/app\.json(?:\.[jt]s)?$/.test(filepath)) {
|
|
24974
|
-
await _optionalChain([ctx, 'access',
|
|
25214
|
+
await _optionalChain([ctx, 'access', _443 => _443.autoRoutesService, 'optionalAccess', _444 => _444.ensureFresh, 'call', _445 => _445()]);
|
|
24975
25215
|
}
|
|
24976
25216
|
if (/\.json\.[jt]s$/.test(filepath)) {
|
|
24977
|
-
const routesReference = _optionalChain([ctx, 'access',
|
|
25217
|
+
const routesReference = _optionalChain([ctx, 'access', _446 => _446.autoRoutesService, 'optionalAccess', _447 => _447.getReference, 'call', _448 => _448()]);
|
|
24978
25218
|
const fallbackRoutes = _nullishCoalesce(routesReference, () => ( { pages: [], entries: [], subPackages: [] }));
|
|
24979
25219
|
const routesModule = {
|
|
24980
25220
|
routes: fallbackRoutes,
|
|
@@ -25023,7 +25263,7 @@ function createJsonService(ctx) {
|
|
|
25023
25263
|
return resultJson;
|
|
25024
25264
|
} catch (error) {
|
|
25025
25265
|
logger_default.error(`\u6B8B\u7834\u7684JSON\u6587\u4EF6: ${filepath}`);
|
|
25026
|
-
_optionalChain([debug, 'optionalCall',
|
|
25266
|
+
_optionalChain([debug, 'optionalCall', _449 => _449(error)]);
|
|
25027
25267
|
}
|
|
25028
25268
|
}
|
|
25029
25269
|
function resolve8(entry) {
|
|
@@ -25078,7 +25318,7 @@ function createNpmService(ctx) {
|
|
|
25078
25318
|
if (!ctx.configService) {
|
|
25079
25319
|
throw new Error("configService must be initialized before writing npm cache");
|
|
25080
25320
|
}
|
|
25081
|
-
if (_optionalChain([ctx, 'access',
|
|
25321
|
+
if (_optionalChain([ctx, 'access', _450 => _450.configService, 'access', _451 => _451.weappViteConfig, 'optionalAccess', _452 => _452.npm, 'optionalAccess', _453 => _453.cache])) {
|
|
25082
25322
|
await _fsextra2.default.outputJSON(getDependenciesCacheFilePath(root), {
|
|
25083
25323
|
hash: dependenciesCacheHash()
|
|
25084
25324
|
});
|
|
@@ -25091,7 +25331,7 @@ function createNpmService(ctx) {
|
|
|
25091
25331
|
}
|
|
25092
25332
|
}
|
|
25093
25333
|
async function checkDependenciesCacheOutdate(root) {
|
|
25094
|
-
if (_optionalChain([ctx, 'access',
|
|
25334
|
+
if (_optionalChain([ctx, 'access', _454 => _454.configService, 'optionalAccess', _455 => _455.weappViteConfig, 'optionalAccess', _456 => _456.npm, 'optionalAccess', _457 => _457.cache])) {
|
|
25095
25335
|
const json = await readDependenciesCache(root);
|
|
25096
25336
|
if (_shared.isObject.call(void 0, json)) {
|
|
25097
25337
|
return dependenciesCacheHash() !== json.hash;
|
|
@@ -25124,7 +25364,7 @@ function createNpmService(ctx) {
|
|
|
25124
25364
|
target: "es6",
|
|
25125
25365
|
external: []
|
|
25126
25366
|
});
|
|
25127
|
-
const resolvedOptions = _optionalChain([ctx, 'access',
|
|
25367
|
+
const resolvedOptions = _optionalChain([ctx, 'access', _458 => _458.configService, 'optionalAccess', _459 => _459.weappViteConfig, 'optionalAccess', _460 => _460.npm, 'optionalAccess', _461 => _461.buildOptions, 'optionalCall', _462 => _462(
|
|
25128
25368
|
mergedOptions,
|
|
25129
25369
|
{ name, entry }
|
|
25130
25370
|
)]);
|
|
@@ -25224,7 +25464,7 @@ function createNpmService(ctx) {
|
|
|
25224
25464
|
throw new Error("configService must be initialized before resolving npm relation list");
|
|
25225
25465
|
}
|
|
25226
25466
|
let packNpmRelationList = [];
|
|
25227
|
-
if (_optionalChain([ctx, 'access',
|
|
25467
|
+
if (_optionalChain([ctx, 'access', _463 => _463.configService, 'access', _464 => _464.projectConfig, 'access', _465 => _465.setting, 'optionalAccess', _466 => _466.packNpmManually]) && Array.isArray(ctx.configService.projectConfig.setting.packNpmRelationList)) {
|
|
25228
25468
|
packNpmRelationList = ctx.configService.projectConfig.setting.packNpmRelationList;
|
|
25229
25469
|
} else {
|
|
25230
25470
|
packNpmRelationList = [
|
|
@@ -25237,10 +25477,10 @@ function createNpmService(ctx) {
|
|
|
25237
25477
|
return packNpmRelationList;
|
|
25238
25478
|
}
|
|
25239
25479
|
async function build3(options) {
|
|
25240
|
-
if (!_optionalChain([ctx, 'access',
|
|
25480
|
+
if (!_optionalChain([ctx, 'access', _467 => _467.configService, 'optionalAccess', _468 => _468.weappViteConfig, 'optionalAccess', _469 => _469.npm, 'optionalAccess', _470 => _470.enable])) {
|
|
25241
25481
|
return;
|
|
25242
25482
|
}
|
|
25243
|
-
_optionalChain([debug, 'optionalCall',
|
|
25483
|
+
_optionalChain([debug, 'optionalCall', _471 => _471("buildNpm start")]);
|
|
25244
25484
|
const packNpmRelationList = getPackNpmRelationList();
|
|
25245
25485
|
const [mainRelation, ...subRelations] = packNpmRelationList;
|
|
25246
25486
|
const packageJsonPath = _pathe2.default.resolve(ctx.configService.cwd, mainRelation.packageJsonPath);
|
|
@@ -25315,7 +25555,7 @@ function createNpmService(ctx) {
|
|
|
25315
25555
|
}
|
|
25316
25556
|
}
|
|
25317
25557
|
}
|
|
25318
|
-
_optionalChain([debug, 'optionalCall',
|
|
25558
|
+
_optionalChain([debug, 'optionalCall', _472 => _472("buildNpm end")]);
|
|
25319
25559
|
}
|
|
25320
25560
|
return {
|
|
25321
25561
|
getDependenciesCacheFilePath,
|
|
@@ -25359,7 +25599,7 @@ var TimeoutError = (_class16 = class _TimeoutError extends Error {
|
|
|
25359
25599
|
__init36() {this.name = "TimeoutError"}
|
|
25360
25600
|
constructor(message, options) {
|
|
25361
25601
|
super(message, options);_class16.prototype.__init36.call(this);;
|
|
25362
|
-
_optionalChain([Error, 'access',
|
|
25602
|
+
_optionalChain([Error, 'access', _473 => _473.captureStackTrace, 'optionalCall', _474 => _474(this, _TimeoutError)]);
|
|
25363
25603
|
}
|
|
25364
25604
|
}, _class16);
|
|
25365
25605
|
var getAbortedReason = (signal) => _nullishCoalesce(signal.reason, () => ( new DOMException("This operation was aborted.", "AbortError")));
|
|
@@ -25377,7 +25617,7 @@ function pTimeout(promise, options) {
|
|
|
25377
25617
|
if (typeof milliseconds !== "number" || Math.sign(milliseconds) !== 1) {
|
|
25378
25618
|
throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${milliseconds}\``);
|
|
25379
25619
|
}
|
|
25380
|
-
if (_optionalChain([signal, 'optionalAccess',
|
|
25620
|
+
if (_optionalChain([signal, 'optionalAccess', _475 => _475.aborted])) {
|
|
25381
25621
|
reject(getAbortedReason(signal));
|
|
25382
25622
|
return;
|
|
25383
25623
|
}
|
|
@@ -25475,7 +25715,7 @@ var PriorityQueue = class {
|
|
|
25475
25715
|
}
|
|
25476
25716
|
dequeue() {
|
|
25477
25717
|
const item = this.#queue.shift();
|
|
25478
|
-
return _optionalChain([item, 'optionalAccess',
|
|
25718
|
+
return _optionalChain([item, 'optionalAccess', _476 => _476.run]);
|
|
25479
25719
|
}
|
|
25480
25720
|
filter(options) {
|
|
25481
25721
|
return this.#queue.filter((element) => element.priority === options.priority).map((element) => element.run);
|
|
@@ -25536,10 +25776,10 @@ var PQueue = class extends import_index2.default {
|
|
|
25536
25776
|
...options
|
|
25537
25777
|
};
|
|
25538
25778
|
if (!(typeof options.intervalCap === "number" && options.intervalCap >= 1)) {
|
|
25539
|
-
throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${_nullishCoalesce(_optionalChain([options, 'access',
|
|
25779
|
+
throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${_nullishCoalesce(_optionalChain([options, 'access', _477 => _477.intervalCap, 'optionalAccess', _478 => _478.toString, 'call', _479 => _479()]), () => ( ""))}\` (${typeof options.intervalCap})`);
|
|
25540
25780
|
}
|
|
25541
25781
|
if (options.interval === void 0 || !(Number.isFinite(options.interval) && options.interval >= 0)) {
|
|
25542
|
-
throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${_nullishCoalesce(_optionalChain([options, 'access',
|
|
25782
|
+
throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${_nullishCoalesce(_optionalChain([options, 'access', _480 => _480.interval, 'optionalAccess', _481 => _481.toString, 'call', _482 => _482()]), () => ( ""))}\` (${typeof options.interval})`);
|
|
25543
25783
|
}
|
|
25544
25784
|
this.#carryoverIntervalCount = _nullishCoalesce(_nullishCoalesce(options.carryoverIntervalCount, () => ( options.carryoverConcurrencyCount)), () => ( false));
|
|
25545
25785
|
this.#isIntervalIgnored = options.intervalCap === Number.POSITIVE_INFINITY || options.interval === 0;
|
|
@@ -25746,7 +25986,7 @@ var PQueue = class extends import_index2.default {
|
|
|
25746
25986
|
});
|
|
25747
25987
|
try {
|
|
25748
25988
|
try {
|
|
25749
|
-
_optionalChain([options, 'access',
|
|
25989
|
+
_optionalChain([options, 'access', _483 => _483.signal, 'optionalAccess', _484 => _484.throwIfAborted, 'call', _485 => _485()]);
|
|
25750
25990
|
} catch (error) {
|
|
25751
25991
|
if (!this.#isIntervalIgnored) {
|
|
25752
25992
|
this.#intervalCount--;
|
|
@@ -26119,7 +26359,7 @@ var FileCache = class {
|
|
|
26119
26359
|
return true;
|
|
26120
26360
|
}
|
|
26121
26361
|
const cachedMtime = this.mtimeMap.get(id);
|
|
26122
|
-
const nextSignature = _optionalChain([options, 'optionalAccess',
|
|
26362
|
+
const nextSignature = _optionalChain([options, 'optionalAccess', _486 => _486.content]) !== void 0 ? createSignature(options.content) : void 0;
|
|
26123
26363
|
const updateSignature = () => {
|
|
26124
26364
|
if (nextSignature !== void 0) {
|
|
26125
26365
|
this.signatureMap.set(id, nextSignature);
|
|
@@ -26354,7 +26594,7 @@ function coerceStyleConfig(entry) {
|
|
|
26354
26594
|
if (!entry || typeof entry !== "object") {
|
|
26355
26595
|
return void 0;
|
|
26356
26596
|
}
|
|
26357
|
-
const source = _optionalChain([entry, 'access',
|
|
26597
|
+
const source = _optionalChain([entry, 'access', _487 => _487.source, 'optionalAccess', _488 => _488.toString, 'call', _489 => _489(), 'access', _490 => _490.trim, 'call', _491 => _491()]);
|
|
26358
26598
|
if (!source) {
|
|
26359
26599
|
return void 0;
|
|
26360
26600
|
}
|
|
@@ -26530,7 +26770,7 @@ function normalizeSubPackageStyleEntries(styles, subPackage, configService) {
|
|
|
26530
26770
|
if (!service) {
|
|
26531
26771
|
return void 0;
|
|
26532
26772
|
}
|
|
26533
|
-
const root = _optionalChain([subPackage, 'access',
|
|
26773
|
+
const root = _optionalChain([subPackage, 'access', _492 => _492.root, 'optionalAccess', _493 => _493.trim, 'call', _494 => _494()]);
|
|
26534
26774
|
if (!root) {
|
|
26535
26775
|
return void 0;
|
|
26536
26776
|
}
|
|
@@ -26638,7 +26878,7 @@ function createScanService(ctx) {
|
|
|
26638
26878
|
if (!ctx.configService) {
|
|
26639
26879
|
throw new Error("configService must be initialized before scanning subpackages");
|
|
26640
26880
|
}
|
|
26641
|
-
const json = _optionalChain([scanState, 'access',
|
|
26881
|
+
const json = _optionalChain([scanState, 'access', _495 => _495.appEntry, 'optionalAccess', _496 => _496.json]);
|
|
26642
26882
|
if (scanState.isDirty || subPackageMap.size === 0) {
|
|
26643
26883
|
subPackageMap.clear();
|
|
26644
26884
|
independentSubPackageMap.clear();
|
|
@@ -26656,15 +26896,15 @@ function createScanService(ctx) {
|
|
|
26656
26896
|
subPackage,
|
|
26657
26897
|
entries: resolveSubPackageEntries(subPackage)
|
|
26658
26898
|
};
|
|
26659
|
-
const subPackageConfig = _optionalChain([ctx, 'access',
|
|
26660
|
-
meta.subPackage.dependencies = _optionalChain([subPackageConfig, 'optionalAccess',
|
|
26661
|
-
meta.subPackage.inlineConfig = _optionalChain([subPackageConfig, 'optionalAccess',
|
|
26899
|
+
const subPackageConfig = _optionalChain([ctx, 'access', _497 => _497.configService, 'access', _498 => _498.weappViteConfig, 'optionalAccess', _499 => _499.subPackages, 'optionalAccess', _500 => _500[subPackage.root]]);
|
|
26900
|
+
meta.subPackage.dependencies = _optionalChain([subPackageConfig, 'optionalAccess', _501 => _501.dependencies]);
|
|
26901
|
+
meta.subPackage.inlineConfig = _optionalChain([subPackageConfig, 'optionalAccess', _502 => _502.inlineConfig]);
|
|
26662
26902
|
meta.styleEntries = normalizeSubPackageStyleEntries(
|
|
26663
|
-
_optionalChain([subPackageConfig, 'optionalAccess',
|
|
26903
|
+
_optionalChain([subPackageConfig, 'optionalAccess', _503 => _503.styles]),
|
|
26664
26904
|
subPackage,
|
|
26665
26905
|
ctx.configService
|
|
26666
26906
|
);
|
|
26667
|
-
meta.watchSharedStyles = _nullishCoalesce(_optionalChain([subPackageConfig, 'optionalAccess',
|
|
26907
|
+
meta.watchSharedStyles = _nullishCoalesce(_optionalChain([subPackageConfig, 'optionalAccess', _504 => _504.watchSharedStyles]), () => ( true));
|
|
26668
26908
|
metas.push(meta);
|
|
26669
26909
|
if (subPackage.root) {
|
|
26670
26910
|
subPackageMap.set(subPackage.root, meta);
|
|
@@ -26720,11 +26960,11 @@ function createScanService(ctx) {
|
|
|
26720
26960
|
loadSubPackages,
|
|
26721
26961
|
isMainPackageFileName,
|
|
26722
26962
|
get workersOptions() {
|
|
26723
|
-
return _optionalChain([scanState, 'access',
|
|
26963
|
+
return _optionalChain([scanState, 'access', _505 => _505.appEntry, 'optionalAccess', _506 => _506.json, 'optionalAccess', _507 => _507.workers]);
|
|
26724
26964
|
},
|
|
26725
26965
|
get workersDir() {
|
|
26726
|
-
const workersOptions = _optionalChain([scanState, 'access',
|
|
26727
|
-
return typeof workersOptions === "object" ? _optionalChain([workersOptions, 'optionalAccess',
|
|
26966
|
+
const workersOptions = _optionalChain([scanState, 'access', _508 => _508.appEntry, 'optionalAccess', _509 => _509.json, 'optionalAccess', _510 => _510.workers]);
|
|
26967
|
+
return typeof workersOptions === "object" ? _optionalChain([workersOptions, 'optionalAccess', _511 => _511.path]) : workersOptions;
|
|
26728
26968
|
},
|
|
26729
26969
|
markDirty() {
|
|
26730
26970
|
scanState.isDirty = true;
|
|
@@ -26771,7 +27011,7 @@ function createWatcherService(ctx) {
|
|
|
26771
27011
|
},
|
|
26772
27012
|
setRollupWatcher(watcher, root = "/") {
|
|
26773
27013
|
const oldWatcher = rollupWatcherMap.get(root);
|
|
26774
|
-
_optionalChain([oldWatcher, 'optionalAccess',
|
|
27014
|
+
_optionalChain([oldWatcher, 'optionalAccess', _512 => _512.close, 'call', _513 => _513()]);
|
|
26775
27015
|
rollupWatcherMap.set(root, watcher);
|
|
26776
27016
|
},
|
|
26777
27017
|
closeAll() {
|
|
@@ -26784,7 +27024,7 @@ function createWatcherService(ctx) {
|
|
|
26784
27024
|
});
|
|
26785
27025
|
});
|
|
26786
27026
|
sidecarWatcherMap.clear();
|
|
26787
|
-
void _optionalChain([ctx, 'access',
|
|
27027
|
+
void _optionalChain([ctx, 'access', _514 => _514.webService, 'optionalAccess', _515 => _515.close, 'call', _516 => _516(), 'access', _517 => _517.catch, 'call', _518 => _518(() => {
|
|
26788
27028
|
})]);
|
|
26789
27029
|
},
|
|
26790
27030
|
close(root = "/") {
|
|
@@ -26800,7 +27040,7 @@ function createWatcherService(ctx) {
|
|
|
26800
27040
|
sidecarWatcherMap.delete(root);
|
|
26801
27041
|
}
|
|
26802
27042
|
if (rollupWatcherMap.size === 0 && sidecarWatcherMap.size === 0) {
|
|
26803
|
-
void _optionalChain([ctx, 'access',
|
|
27043
|
+
void _optionalChain([ctx, 'access', _519 => _519.webService, 'optionalAccess', _520 => _520.close, 'call', _521 => _521(), 'access', _522 => _522.catch, 'call', _523 => _523(() => {
|
|
26804
27044
|
})]);
|
|
26805
27045
|
}
|
|
26806
27046
|
}
|
|
@@ -26813,7 +27053,7 @@ function createWatcherServicePlugin(ctx) {
|
|
|
26813
27053
|
name: "weapp-runtime:watcher-service",
|
|
26814
27054
|
closeBundle() {
|
|
26815
27055
|
const configService = ctx.configService;
|
|
26816
|
-
const isWatchMode = _optionalChain([configService, 'optionalAccess',
|
|
27056
|
+
const isWatchMode = _optionalChain([configService, 'optionalAccess', _524 => _524.isDev]) || Boolean(_optionalChain([configService, 'optionalAccess', _525 => _525.inlineConfig, 'optionalAccess', _526 => _526.build, 'optionalAccess', _527 => _527.watch]));
|
|
26817
27057
|
if (!isWatchMode) {
|
|
26818
27058
|
service.closeAll();
|
|
26819
27059
|
}
|
|
@@ -26830,10 +27070,10 @@ function createWebService(ctx) {
|
|
|
26830
27070
|
}
|
|
26831
27071
|
let devServer;
|
|
26832
27072
|
function isEnabled() {
|
|
26833
|
-
return Boolean(_optionalChain([ctx, 'access',
|
|
27073
|
+
return Boolean(_optionalChain([ctx, 'access', _528 => _528.configService, 'optionalAccess', _529 => _529.weappWebConfig, 'optionalAccess', _530 => _530.enabled]));
|
|
26834
27074
|
}
|
|
26835
27075
|
async function startDevServer() {
|
|
26836
|
-
if (!_optionalChain([ctx, 'access',
|
|
27076
|
+
if (!_optionalChain([ctx, 'access', _531 => _531.configService, 'optionalAccess', _532 => _532.isDev])) {
|
|
26837
27077
|
return void 0;
|
|
26838
27078
|
}
|
|
26839
27079
|
if (!isEnabled()) {
|
|
@@ -26842,7 +27082,7 @@ function createWebService(ctx) {
|
|
|
26842
27082
|
if (devServer) {
|
|
26843
27083
|
return devServer;
|
|
26844
27084
|
}
|
|
26845
|
-
const inlineConfig = _optionalChain([ctx, 'access',
|
|
27085
|
+
const inlineConfig = _optionalChain([ctx, 'access', _533 => _533.configService, 'optionalAccess', _534 => _534.mergeWeb, 'call', _535 => _535()]);
|
|
26846
27086
|
if (!inlineConfig) {
|
|
26847
27087
|
return void 0;
|
|
26848
27088
|
}
|
|
@@ -26855,7 +27095,7 @@ function createWebService(ctx) {
|
|
|
26855
27095
|
if (!isEnabled()) {
|
|
26856
27096
|
return void 0;
|
|
26857
27097
|
}
|
|
26858
|
-
const inlineConfig = _optionalChain([ctx, 'access',
|
|
27098
|
+
const inlineConfig = _optionalChain([ctx, 'access', _536 => _536.configService, 'optionalAccess', _537 => _537.mergeWeb, 'call', _538 => _538()]);
|
|
26859
27099
|
if (!inlineConfig) {
|
|
26860
27100
|
return void 0;
|
|
26861
27101
|
}
|
|
@@ -26885,7 +27125,7 @@ function createWebServicePlugin(ctx) {
|
|
|
26885
27125
|
return {
|
|
26886
27126
|
name: "weapp-runtime:web-service",
|
|
26887
27127
|
async closeBundle() {
|
|
26888
|
-
if (!_optionalChain([ctx, 'access',
|
|
27128
|
+
if (!_optionalChain([ctx, 'access', _539 => _539.configService, 'optionalAccess', _540 => _540.isDev])) {
|
|
26889
27129
|
await service.close();
|
|
26890
27130
|
}
|
|
26891
27131
|
}
|
|
@@ -29534,7 +29774,7 @@ function createWxmlService(ctx) {
|
|
|
29534
29774
|
return set3;
|
|
29535
29775
|
}
|
|
29536
29776
|
function clearAll() {
|
|
29537
|
-
const currentRoot = _optionalChain([ctx, 'access',
|
|
29777
|
+
const currentRoot = _optionalChain([ctx, 'access', _541 => _541.configService, 'optionalAccess', _542 => _542.currentSubPackageRoot]);
|
|
29538
29778
|
if (!currentRoot) {
|
|
29539
29779
|
depsMap.clear();
|
|
29540
29780
|
tokenMap.clear();
|
|
@@ -29593,7 +29833,7 @@ function createWxmlService(ctx) {
|
|
|
29593
29833
|
if (!ctx.configService) {
|
|
29594
29834
|
throw new Error("configService must be initialized before scanning wxml");
|
|
29595
29835
|
}
|
|
29596
|
-
const wxmlConfig = _nullishCoalesce(_optionalChain([ctx, 'access',
|
|
29836
|
+
const wxmlConfig = _nullishCoalesce(_optionalChain([ctx, 'access', _543 => _543.configService, 'access', _544 => _544.weappViteConfig, 'optionalAccess', _545 => _545.wxml]), () => ( _optionalChain([ctx, 'access', _546 => _546.configService, 'access', _547 => _547.weappViteConfig, 'optionalAccess', _548 => _548.enhance, 'optionalAccess', _549 => _549.wxml])));
|
|
29597
29837
|
return scanWxml(wxml, {
|
|
29598
29838
|
platform: ctx.configService.platform,
|
|
29599
29839
|
...wxmlConfig === true ? {} : wxmlConfig
|
|
@@ -29725,7 +29965,9 @@ function resetCompilerContext(key) {
|
|
|
29725
29965
|
|
|
29726
29966
|
|
|
29727
29967
|
|
|
29728
|
-
|
|
29968
|
+
|
|
29969
|
+
|
|
29970
|
+
exports.logger_default = logger_default; exports.VERSION = VERSION; exports.checkRuntime = checkRuntime; exports.resolveWeappConfigFile = resolveWeappConfigFile; exports.SHARED_CHUNK_VIRTUAL_PREFIX = SHARED_CHUNK_VIRTUAL_PREFIX; exports.createSharedBuildConfig = createSharedBuildConfig; exports.DEFAULT_MP_PLATFORM = DEFAULT_MP_PLATFORM; exports.normalizeMiniPlatform = normalizeMiniPlatform; exports.resolveMiniPlatform = resolveMiniPlatform; exports.setActiveCompilerContextKey = setActiveCompilerContextKey; exports.getCompilerContext = getCompilerContext; exports.resetCompilerContext = resetCompilerContext;
|
|
29729
29971
|
/*! Bundled license information:
|
|
29730
29972
|
|
|
29731
29973
|
chokidar/esm/index.js:
|