weapp-vite 5.6.3 → 5.7.1
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-7EOV7C3M.mjs → chunk-AXUA33LJ.mjs} +1 -1
- package/dist/{chunk-WYNGNSLK.cjs → chunk-GGLONZVQ.cjs} +4 -4
- package/dist/{chunk-LE4PAGI5.mjs → chunk-O4FBXXL3.mjs} +749 -395
- package/dist/{chunk-OQYESMEY.cjs → chunk-T4OVF4GP.cjs} +913 -559
- package/dist/cli.cjs +1043 -281
- package/dist/cli.mjs +1207 -446
- 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/modules/analyze-dashboard/assets/echarts.js +31 -0
- package/modules/analyze-dashboard/assets/index.css +2 -0
- package/modules/analyze-dashboard/assets/index.js +1 -0
- package/modules/analyze-dashboard/assets/rolldown-runtime.js +1 -0
- package/modules/analyze-dashboard/assets/vue.js +6 -0
- package/modules/analyze-dashboard/index.html +13 -0
- package/package.json +11 -4
|
@@ -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
|
-
}
|
|
1110
|
-
if (!PLATFORM_ALIAS_TO_ID.has(adapter.id)) {
|
|
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
998
|
}
|
|
1125
|
-
return
|
|
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,57 +11780,322 @@ rimraf.rimraf = rimraf;
|
|
|
11895
11780
|
// src/runtime/buildPlugin.ts
|
|
11896
11781
|
var _vite = require('vite');
|
|
11897
11782
|
|
|
11898
|
-
// src/runtime/
|
|
11899
|
-
_chunkA5DD7GKXcjs.init_cjs_shims.call(void 0, );
|
|
11900
|
-
|
|
11901
|
-
// src/runtime/chunkStrategy.ts
|
|
11783
|
+
// src/runtime/independentError.ts
|
|
11902
11784
|
_chunkA5DD7GKXcjs.init_cjs_shims.call(void 0, );
|
|
11903
|
-
|
|
11904
|
-
|
|
11905
|
-
|
|
11906
|
-
|
|
11907
|
-
function
|
|
11908
|
-
|
|
11909
|
-
|
|
11910
|
-
|
|
11911
|
-
|
|
11912
|
-
|
|
11913
|
-
|
|
11914
|
-
|
|
11915
|
-
const moduleInfo = ctx.getModuleInfo(id);
|
|
11916
|
-
if (!_optionalChain([moduleInfo, 'optionalAccess', _224 => _224.importers]) || moduleInfo.importers.length <= 1) {
|
|
11917
|
-
return 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()}`);
|
|
11918
11797
|
}
|
|
11919
|
-
const
|
|
11920
|
-
|
|
11921
|
-
|
|
11922
|
-
subPackageRoots: Array.from(subPackageRoots)
|
|
11923
|
-
});
|
|
11924
|
-
const keys = Object.keys(summary);
|
|
11925
|
-
if (keys.length === 0) {
|
|
11926
|
-
return void 0;
|
|
11798
|
+
const plugin = payload.plugin;
|
|
11799
|
+
if (typeof plugin === "string" && plugin.trim()) {
|
|
11800
|
+
parts.push(`plugin: ${plugin.trim()}`);
|
|
11927
11801
|
}
|
|
11928
|
-
|
|
11929
|
-
|
|
11930
|
-
|
|
11802
|
+
const id = payload.id;
|
|
11803
|
+
if (typeof id === "string" && id.trim()) {
|
|
11804
|
+
parts.push(`id: ${id.trim()}`);
|
|
11931
11805
|
}
|
|
11932
|
-
|
|
11933
|
-
|
|
11934
|
-
const combination = keys.filter(Boolean).sort().join("+");
|
|
11935
|
-
const combinationSegment = combination ? `${combination}/` : "";
|
|
11936
|
-
return `${SHARED_CHUNK_VIRTUAL_PREFIX}/${combinationSegment}common`;
|
|
11806
|
+
if (!parts.length) {
|
|
11807
|
+
return "";
|
|
11937
11808
|
}
|
|
11938
|
-
return "
|
|
11809
|
+
return ` (${parts.join(", ")})`;
|
|
11939
11810
|
}
|
|
11940
|
-
function
|
|
11941
|
-
const
|
|
11942
|
-
const
|
|
11943
|
-
|
|
11944
|
-
|
|
11945
|
-
|
|
11946
|
-
|
|
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
|
+
|
|
11917
|
+
// src/runtime/advancedChunks.ts
|
|
11918
|
+
_chunkA5DD7GKXcjs.init_cjs_shims.call(void 0, );
|
|
11919
|
+
|
|
11920
|
+
// src/runtime/chunkStrategy.ts
|
|
11921
|
+
_chunkA5DD7GKXcjs.init_cjs_shims.call(void 0, );
|
|
11922
|
+
var _buffer = require('buffer');
|
|
11923
|
+
|
|
11924
|
+
var SHARED_CHUNK_VIRTUAL_PREFIX = "weapp_shared_virtual";
|
|
11925
|
+
var SUB_PACKAGE_SHARED_DIR = "weapp-shared";
|
|
11926
|
+
var DEFAULT_SHARED_CHUNK_STRATEGY = "duplicate";
|
|
11927
|
+
var sharedChunkDiagnostics = /* @__PURE__ */ new Map();
|
|
11928
|
+
function resolveSharedChunkName(options) {
|
|
11929
|
+
const {
|
|
11930
|
+
id,
|
|
11931
|
+
ctx,
|
|
11932
|
+
relativeAbsoluteSrcRoot,
|
|
11933
|
+
subPackageRoots,
|
|
11934
|
+
strategy,
|
|
11935
|
+
forceDuplicateTester
|
|
11936
|
+
} = options;
|
|
11937
|
+
const moduleInfo = ctx.getModuleInfo(id);
|
|
11938
|
+
if (!_optionalChain([moduleInfo, 'optionalAccess', _224 => _224.importers]) || moduleInfo.importers.length <= 1) {
|
|
11939
|
+
return void 0;
|
|
11947
11940
|
}
|
|
11948
|
-
|
|
11941
|
+
const { summary, ignoredMainImporters } = summarizeImportPrefixes({
|
|
11942
|
+
ctx,
|
|
11943
|
+
importers: moduleInfo.importers,
|
|
11944
|
+
relativeAbsoluteSrcRoot,
|
|
11945
|
+
subPackageRoots: Array.from(subPackageRoots),
|
|
11946
|
+
forceDuplicateTester
|
|
11947
|
+
});
|
|
11948
|
+
const keys = Object.keys(summary);
|
|
11949
|
+
if (keys.length === 0) {
|
|
11950
|
+
return void 0;
|
|
11951
|
+
}
|
|
11952
|
+
if (keys.length === 1) {
|
|
11953
|
+
const prefix = keys[0];
|
|
11954
|
+
return prefix ? _pathe.posix.join(prefix, "common") : "common";
|
|
11955
|
+
}
|
|
11956
|
+
const hasMainImporter = keys.includes("");
|
|
11957
|
+
if (strategy === "duplicate" && !hasMainImporter) {
|
|
11958
|
+
const combination = keys.filter(Boolean).sort().join("+");
|
|
11959
|
+
const combinationSegment = combination ? `${combination}/` : "";
|
|
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;
|
|
11970
|
+
}
|
|
11971
|
+
return "common";
|
|
11972
|
+
}
|
|
11973
|
+
function summarizeImportPrefixes(options) {
|
|
11974
|
+
const {
|
|
11975
|
+
ctx,
|
|
11976
|
+
importers,
|
|
11977
|
+
relativeAbsoluteSrcRoot,
|
|
11978
|
+
subPackageRoots,
|
|
11979
|
+
forceDuplicateTester
|
|
11980
|
+
} = options;
|
|
11981
|
+
const summary = {};
|
|
11982
|
+
const ignoredImporters = /* @__PURE__ */ new Set();
|
|
11983
|
+
const state = {
|
|
11984
|
+
cache: /* @__PURE__ */ new Map(),
|
|
11985
|
+
stack: /* @__PURE__ */ new Set()
|
|
11986
|
+
};
|
|
11987
|
+
for (const importer of importers) {
|
|
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
|
+
};
|
|
12044
|
+
}
|
|
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,32 +12191,72 @@ function applySharedChunkStrategy(bundle, options) {
|
|
|
12039
12191
|
});
|
|
12040
12192
|
}
|
|
12041
12193
|
updateImporters(bundle, importerToChunk, fileName);
|
|
12042
|
-
|
|
12043
|
-
|
|
12044
|
-
|
|
12045
|
-
chunk.
|
|
12046
|
-
|
|
12047
|
-
|
|
12048
|
-
|
|
12049
|
-
|
|
12050
|
-
|
|
12194
|
+
delete bundle[fileName];
|
|
12195
|
+
const candidateMapKeys = /* @__PURE__ */ new Set();
|
|
12196
|
+
candidateMapKeys.add(`${fileName}.map`);
|
|
12197
|
+
if (typeof chunk.sourcemapFileName === "string" && chunk.sourcemapFileName) {
|
|
12198
|
+
candidateMapKeys.add(chunk.sourcemapFileName);
|
|
12199
|
+
}
|
|
12200
|
+
for (const mapKey of candidateMapKeys) {
|
|
12201
|
+
if (mapKey && bundle[mapKey]) {
|
|
12202
|
+
delete bundle[mapKey];
|
|
12203
|
+
}
|
|
12204
|
+
}
|
|
12205
|
+
const chunkBytes = typeof originalCode === "string" ? _buffer.Buffer.byteLength(originalCode, "utf8") : void 0;
|
|
12206
|
+
const redundantBytes = typeof chunkBytes === "number" ? chunkBytes * Math.max(duplicates.length - 1, 0) : void 0;
|
|
12207
|
+
_optionalChain([options, 'access', _229 => _229.onDuplicate, 'optionalCall', _230 => _230({
|
|
12051
12208
|
sharedFileName: originalSharedFileName,
|
|
12052
|
-
duplicates
|
|
12209
|
+
duplicates,
|
|
12210
|
+
ignoredMainImporters: _optionalChain([diagnostics, 'optionalAccess', _231 => _231.ignoredMainImporters]),
|
|
12211
|
+
chunkBytes,
|
|
12212
|
+
redundantBytes
|
|
12053
12213
|
})]);
|
|
12054
12214
|
}
|
|
12055
12215
|
}
|
|
12216
|
+
function consumeSharedChunkDiagnostics(fileName) {
|
|
12217
|
+
const direct = sharedChunkDiagnostics.get(fileName);
|
|
12218
|
+
if (direct) {
|
|
12219
|
+
sharedChunkDiagnostics.delete(fileName);
|
|
12220
|
+
return direct;
|
|
12221
|
+
}
|
|
12222
|
+
const withoutExt = fileName.replace(/\.[^./\\]+$/, "");
|
|
12223
|
+
const fallback = sharedChunkDiagnostics.get(withoutExt);
|
|
12224
|
+
if (fallback) {
|
|
12225
|
+
sharedChunkDiagnostics.delete(withoutExt);
|
|
12226
|
+
return fallback;
|
|
12227
|
+
}
|
|
12228
|
+
return void 0;
|
|
12229
|
+
}
|
|
12056
12230
|
function isSharedVirtualChunk(fileName, output) {
|
|
12057
|
-
return _optionalChain([output, 'optionalAccess',
|
|
12231
|
+
return _optionalChain([output, 'optionalAccess', _232 => _232.type]) === "chunk" && fileName.startsWith(`${SHARED_CHUNK_VIRTUAL_PREFIX}/`);
|
|
12058
12232
|
}
|
|
12059
12233
|
function findChunkImporters(bundle, target) {
|
|
12060
12234
|
const importers = /* @__PURE__ */ new Set();
|
|
12061
12235
|
for (const [fileName, output] of Object.entries(bundle)) {
|
|
12062
|
-
if (_optionalChain([output, 'optionalAccess',
|
|
12236
|
+
if (_optionalChain([output, 'optionalAccess', _233 => _233.type]) !== "chunk") {
|
|
12063
12237
|
continue;
|
|
12064
12238
|
}
|
|
12065
12239
|
const chunk = output;
|
|
12066
12240
|
if (chunk.imports.includes(target) || chunk.dynamicImports.includes(target)) {
|
|
12067
12241
|
importers.add(fileName);
|
|
12242
|
+
continue;
|
|
12243
|
+
}
|
|
12244
|
+
const metadata = chunk.viteMetadata;
|
|
12245
|
+
if (metadata) {
|
|
12246
|
+
const importedChunks = metadata.importedChunks;
|
|
12247
|
+
if (hasInCollection(importedChunks, target)) {
|
|
12248
|
+
importers.add(fileName);
|
|
12249
|
+
continue;
|
|
12250
|
+
}
|
|
12251
|
+
const importedScripts = _nullishCoalesce(metadata.importedScripts, () => ( metadata.importedScriptsByUrl));
|
|
12252
|
+
if (hasInCollection(importedScripts, target)) {
|
|
12253
|
+
importers.add(fileName);
|
|
12254
|
+
continue;
|
|
12255
|
+
}
|
|
12256
|
+
}
|
|
12257
|
+
const potentialImport = createRelativeImport(fileName, target);
|
|
12258
|
+
if (potentialImport && containsImportSpecifier(_nullishCoalesce(chunk.code, () => ( "")), potentialImport)) {
|
|
12259
|
+
importers.add(fileName);
|
|
12068
12260
|
}
|
|
12069
12261
|
}
|
|
12070
12262
|
return Array.from(importers);
|
|
@@ -12092,11 +12284,35 @@ function updateImporters(bundle, importerToChunk, originalFileName) {
|
|
|
12092
12284
|
const importerChunk = importer;
|
|
12093
12285
|
const originalImportPath = createRelativeImport(importerFile, originalFileName);
|
|
12094
12286
|
const newImportPath = createRelativeImport(importerFile, newChunkFile);
|
|
12287
|
+
let codeUpdated = false;
|
|
12095
12288
|
if (originalImportPath !== newImportPath) {
|
|
12096
|
-
|
|
12289
|
+
const updated = replaceAll(importerChunk.code, originalImportPath, newImportPath);
|
|
12290
|
+
if (updated !== importerChunk.code) {
|
|
12291
|
+
importerChunk.code = updated;
|
|
12292
|
+
codeUpdated = true;
|
|
12293
|
+
}
|
|
12294
|
+
}
|
|
12295
|
+
importerChunk.imports = replaceInArray(importerChunk.imports, originalFileName, newChunkFile, codeUpdated);
|
|
12296
|
+
importerChunk.dynamicImports = replaceInArray(importerChunk.dynamicImports, originalFileName, newChunkFile, codeUpdated);
|
|
12297
|
+
const implicitlyLoadedBefore = importerChunk.implicitlyLoadedBefore;
|
|
12298
|
+
if (Array.isArray(implicitlyLoadedBefore)) {
|
|
12299
|
+
importerChunk.implicitlyLoadedBefore = replaceInArray(
|
|
12300
|
+
implicitlyLoadedBefore,
|
|
12301
|
+
originalFileName,
|
|
12302
|
+
newChunkFile,
|
|
12303
|
+
codeUpdated
|
|
12304
|
+
);
|
|
12097
12305
|
}
|
|
12098
|
-
|
|
12099
|
-
|
|
12306
|
+
const referencedFiles = importerChunk.referencedFiles;
|
|
12307
|
+
if (Array.isArray(referencedFiles)) {
|
|
12308
|
+
importerChunk.referencedFiles = replaceInArray(
|
|
12309
|
+
referencedFiles,
|
|
12310
|
+
originalFileName,
|
|
12311
|
+
newChunkFile,
|
|
12312
|
+
codeUpdated
|
|
12313
|
+
);
|
|
12314
|
+
}
|
|
12315
|
+
updateViteMetadata(importerChunk, originalFileName, newChunkFile, codeUpdated);
|
|
12100
12316
|
}
|
|
12101
12317
|
}
|
|
12102
12318
|
function replaceAll(source, searchValue, replaceValue) {
|
|
@@ -12115,185 +12331,183 @@ function replaceAll(source, searchValue, replaceValue) {
|
|
|
12115
12331
|
}
|
|
12116
12332
|
return source;
|
|
12117
12333
|
}
|
|
12118
|
-
function
|
|
12119
|
-
|
|
12120
|
-
return
|
|
12121
|
-
});
|
|
12122
|
-
}
|
|
12123
|
-
function createRelativeImport(fromFile, toFile) {
|
|
12124
|
-
const relative3 = _pathe.posix.relative(_pathe.posix.dirname(fromFile), toFile);
|
|
12125
|
-
if (!relative3 || relative3.startsWith(".")) {
|
|
12126
|
-
return relative3 || "./";
|
|
12127
|
-
}
|
|
12128
|
-
return `./${relative3}`;
|
|
12129
|
-
}
|
|
12130
|
-
|
|
12131
|
-
// src/runtime/advancedChunks.ts
|
|
12132
|
-
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
|
-
} = options;
|
|
12145
|
-
const isVendor = testByReg2DExpList(vendorsMatchers);
|
|
12146
|
-
return (id, ctx) => {
|
|
12147
|
-
const subPackageRoots = Array.from(getSubPackageRoots());
|
|
12148
|
-
const sharedName = resolveSharedChunkName({
|
|
12149
|
-
id,
|
|
12150
|
-
ctx,
|
|
12151
|
-
relativeAbsoluteSrcRoot,
|
|
12152
|
-
subPackageRoots,
|
|
12153
|
-
strategy
|
|
12154
|
-
});
|
|
12155
|
-
if (!isVendor(id)) {
|
|
12156
|
-
return sharedName;
|
|
12157
|
-
}
|
|
12158
|
-
if (strategy === "hoist") {
|
|
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 "";
|
|
12334
|
+
function containsImportSpecifier(source, specifier) {
|
|
12335
|
+
if (!specifier) {
|
|
12336
|
+
return false;
|
|
12190
12337
|
}
|
|
12191
|
-
|
|
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());
|
|
12338
|
+
if (source.includes(specifier)) {
|
|
12339
|
+
return true;
|
|
12198
12340
|
}
|
|
12199
|
-
|
|
12200
|
-
|
|
12201
|
-
|
|
12341
|
+
if (specifier.startsWith("./")) {
|
|
12342
|
+
const trimmed = specifier.slice(2);
|
|
12343
|
+
if (trimmed && source.includes(trimmed)) {
|
|
12344
|
+
return true;
|
|
12345
|
+
}
|
|
12202
12346
|
}
|
|
12203
|
-
return
|
|
12347
|
+
return false;
|
|
12204
12348
|
}
|
|
12205
|
-
function
|
|
12206
|
-
if (!
|
|
12207
|
-
return
|
|
12349
|
+
function hasInCollection(collection, value) {
|
|
12350
|
+
if (!collection || !value) {
|
|
12351
|
+
return false;
|
|
12208
12352
|
}
|
|
12209
|
-
if (
|
|
12210
|
-
|
|
12211
|
-
return trimmed || void 0;
|
|
12353
|
+
if (collection instanceof Set) {
|
|
12354
|
+
return collection.has(value);
|
|
12212
12355
|
}
|
|
12213
|
-
if (
|
|
12214
|
-
|
|
12215
|
-
if (trimmed) {
|
|
12216
|
-
return trimmed;
|
|
12217
|
-
}
|
|
12218
|
-
if (value.cause) {
|
|
12219
|
-
return extractMessage(value.cause, seen);
|
|
12220
|
-
}
|
|
12221
|
-
return void 0;
|
|
12356
|
+
if (Array.isArray(collection)) {
|
|
12357
|
+
return collection.includes(value);
|
|
12222
12358
|
}
|
|
12223
|
-
if (
|
|
12224
|
-
|
|
12225
|
-
seen.add(record);
|
|
12226
|
-
const directMessage = extractMessage(record.message, seen);
|
|
12227
|
-
if (directMessage) {
|
|
12228
|
-
return directMessage;
|
|
12229
|
-
}
|
|
12230
|
-
const nestedKeys = ["reason", "detail", "details", "error", "field0", "field1", "cause"];
|
|
12231
|
-
for (const key of nestedKeys) {
|
|
12232
|
-
if (key in record) {
|
|
12233
|
-
const nestedMessage = extractMessage(record[key], seen);
|
|
12234
|
-
if (nestedMessage) {
|
|
12235
|
-
return nestedMessage;
|
|
12236
|
-
}
|
|
12237
|
-
}
|
|
12238
|
-
}
|
|
12359
|
+
if (collection instanceof Map) {
|
|
12360
|
+
return collection.has(value);
|
|
12239
12361
|
}
|
|
12240
|
-
return
|
|
12362
|
+
return false;
|
|
12241
12363
|
}
|
|
12242
|
-
function
|
|
12243
|
-
const
|
|
12244
|
-
|
|
12245
|
-
|
|
12246
|
-
|
|
12364
|
+
function replaceInArray(list, searchValue, replaceValue, shouldInsert) {
|
|
12365
|
+
const values = Array.isArray(list) ? [...list] : [];
|
|
12366
|
+
let replaced = false;
|
|
12367
|
+
for (let index = 0; index < values.length; index++) {
|
|
12368
|
+
const current2 = values[index];
|
|
12369
|
+
if (current2 === searchValue) {
|
|
12370
|
+
values[index] = replaceValue;
|
|
12371
|
+
replaced = true;
|
|
12247
12372
|
}
|
|
12248
|
-
return cause;
|
|
12249
12373
|
}
|
|
12250
|
-
if (!
|
|
12251
|
-
|
|
12374
|
+
if ((replaced || shouldInsert) && replaceValue && !values.includes(replaceValue)) {
|
|
12375
|
+
values.push(replaceValue);
|
|
12252
12376
|
}
|
|
12253
|
-
|
|
12254
|
-
|
|
12255
|
-
|
|
12256
|
-
|
|
12257
|
-
|
|
12258
|
-
return
|
|
12377
|
+
return values;
|
|
12378
|
+
}
|
|
12379
|
+
function updateViteMetadata(importerChunk, originalFileName, newChunkFile, shouldInsert) {
|
|
12380
|
+
const metadata = importerChunk.viteMetadata;
|
|
12381
|
+
if (!metadata || typeof metadata !== "object") {
|
|
12382
|
+
return;
|
|
12259
12383
|
}
|
|
12260
|
-
|
|
12261
|
-
|
|
12262
|
-
const
|
|
12263
|
-
|
|
12264
|
-
|
|
12265
|
-
|
|
12266
|
-
|
|
12267
|
-
let composedMessage = extracted;
|
|
12268
|
-
if (summary) {
|
|
12269
|
-
composedMessage += summary;
|
|
12384
|
+
const candidateKeys = ["importedChunks", "importedScripts"];
|
|
12385
|
+
for (const key of candidateKeys) {
|
|
12386
|
+
const collection = metadata[key];
|
|
12387
|
+
if (collection instanceof Set) {
|
|
12388
|
+
const hadOriginal = collection.delete(originalFileName);
|
|
12389
|
+
if (hadOriginal || shouldInsert) {
|
|
12390
|
+
collection.add(newChunkFile);
|
|
12270
12391
|
}
|
|
12271
|
-
|
|
12272
|
-
|
|
12273
|
-
|
|
12392
|
+
} else if (Array.isArray(collection)) {
|
|
12393
|
+
metadata[key] = replaceInArray(collection, originalFileName, newChunkFile, shouldInsert);
|
|
12394
|
+
} else if (collection instanceof Map) {
|
|
12395
|
+
if (collection.has(originalFileName)) {
|
|
12396
|
+
const originalValue = collection.get(originalFileName);
|
|
12397
|
+
collection.delete(originalFileName);
|
|
12398
|
+
collection.set(newChunkFile, originalValue);
|
|
12274
12399
|
}
|
|
12275
|
-
return new Error(composedMessage, { cause });
|
|
12276
12400
|
}
|
|
12277
|
-
|
|
12278
|
-
|
|
12279
|
-
|
|
12280
|
-
|
|
12281
|
-
|
|
12282
|
-
|
|
12401
|
+
}
|
|
12402
|
+
}
|
|
12403
|
+
function createRelativeImport(fromFile, toFile) {
|
|
12404
|
+
const relative3 = _pathe.posix.relative(_pathe.posix.dirname(fromFile), toFile);
|
|
12405
|
+
if (!relative3 || relative3.startsWith(".")) {
|
|
12406
|
+
return relative3 || "./";
|
|
12407
|
+
}
|
|
12408
|
+
return `./${relative3}`;
|
|
12409
|
+
}
|
|
12410
|
+
|
|
12411
|
+
// src/runtime/advancedChunks.ts
|
|
12412
|
+
function testByReg2DExpList(reg2DExpList) {
|
|
12413
|
+
return (id) => reg2DExpList.some((regExpList) => regExpList.some((regExp) => {
|
|
12414
|
+
regExp.lastIndex = 0;
|
|
12415
|
+
return regExp.test(id);
|
|
12416
|
+
}));
|
|
12417
|
+
}
|
|
12418
|
+
function createAdvancedChunkNameResolver(options) {
|
|
12419
|
+
const {
|
|
12420
|
+
relativeAbsoluteSrcRoot,
|
|
12421
|
+
getSubPackageRoots,
|
|
12422
|
+
strategy,
|
|
12423
|
+
vendorsMatchers,
|
|
12424
|
+
forceDuplicateTester
|
|
12425
|
+
} = options;
|
|
12426
|
+
const isVendor = testByReg2DExpList(vendorsMatchers);
|
|
12427
|
+
return (id, ctx) => {
|
|
12428
|
+
const subPackageRoots = Array.from(getSubPackageRoots());
|
|
12429
|
+
const sharedName = resolveSharedChunkName({
|
|
12430
|
+
id,
|
|
12431
|
+
ctx,
|
|
12432
|
+
relativeAbsoluteSrcRoot,
|
|
12433
|
+
subPackageRoots,
|
|
12434
|
+
strategy,
|
|
12435
|
+
forceDuplicateTester
|
|
12436
|
+
});
|
|
12437
|
+
if (!isVendor(id)) {
|
|
12438
|
+
return sharedName;
|
|
12439
|
+
}
|
|
12440
|
+
if (strategy === "hoist") {
|
|
12441
|
+
return "vendors";
|
|
12283
12442
|
}
|
|
12443
|
+
return sharedName;
|
|
12444
|
+
};
|
|
12445
|
+
}
|
|
12446
|
+
|
|
12447
|
+
// src/runtime/sharedBuildConfig.ts
|
|
12448
|
+
var REG_NODE_MODULES_DIR = /[\\/]node_modules[\\/]/gi;
|
|
12449
|
+
var REG_COMMONJS_HELPERS = /commonjsHelpers\.js$/;
|
|
12450
|
+
function createForceDuplicateTester(patterns) {
|
|
12451
|
+
if (!patterns || patterns.length === 0) {
|
|
12452
|
+
return void 0;
|
|
12284
12453
|
}
|
|
12285
|
-
|
|
12286
|
-
|
|
12287
|
-
|
|
12288
|
-
return
|
|
12454
|
+
const matchers = patterns.map((pattern) => {
|
|
12455
|
+
if (typeof pattern === "string") {
|
|
12456
|
+
const matcher = _picomatch2.default.call(void 0, pattern, { dot: true });
|
|
12457
|
+
return (value) => matcher(value);
|
|
12289
12458
|
}
|
|
12290
|
-
|
|
12459
|
+
if (isRegexp(pattern)) {
|
|
12460
|
+
return (value) => {
|
|
12461
|
+
pattern.lastIndex = 0;
|
|
12462
|
+
return pattern.test(value);
|
|
12463
|
+
};
|
|
12464
|
+
}
|
|
12465
|
+
return void 0;
|
|
12466
|
+
}).filter((matcher) => typeof matcher === "function");
|
|
12467
|
+
if (!matchers.length) {
|
|
12468
|
+
return void 0;
|
|
12291
12469
|
}
|
|
12292
|
-
return
|
|
12470
|
+
return (relativeId, absoluteId) => {
|
|
12471
|
+
for (const matcher of matchers) {
|
|
12472
|
+
if (matcher(relativeId) || matcher(absoluteId)) {
|
|
12473
|
+
return true;
|
|
12474
|
+
}
|
|
12475
|
+
}
|
|
12476
|
+
return false;
|
|
12477
|
+
};
|
|
12478
|
+
}
|
|
12479
|
+
function createSharedBuildConfig(configService, scanService) {
|
|
12480
|
+
const nodeModulesDeps = [REG_NODE_MODULES_DIR];
|
|
12481
|
+
const commonjsHelpersDeps = [REG_COMMONJS_HELPERS];
|
|
12482
|
+
const sharedStrategy = _nullishCoalesce(_optionalChain([configService, 'access', _234 => _234.weappViteConfig, 'optionalAccess', _235 => _235.chunks, 'optionalAccess', _236 => _236.sharedStrategy]), () => ( DEFAULT_SHARED_CHUNK_STRATEGY));
|
|
12483
|
+
const forceDuplicatePatterns = _optionalChain([configService, 'access', _237 => _237.weappViteConfig, 'optionalAccess', _238 => _238.chunks, 'optionalAccess', _239 => _239.forceDuplicatePatterns]);
|
|
12484
|
+
const forceDuplicateTester = createForceDuplicateTester(forceDuplicatePatterns);
|
|
12485
|
+
const resolveAdvancedChunkName = createAdvancedChunkNameResolver({
|
|
12486
|
+
vendorsMatchers: [nodeModulesDeps, commonjsHelpersDeps],
|
|
12487
|
+
relativeAbsoluteSrcRoot: configService.relativeAbsoluteSrcRoot,
|
|
12488
|
+
getSubPackageRoots: () => scanService.subPackageMap.keys(),
|
|
12489
|
+
strategy: sharedStrategy,
|
|
12490
|
+
forceDuplicateTester
|
|
12491
|
+
});
|
|
12492
|
+
return {
|
|
12493
|
+
build: {
|
|
12494
|
+
rolldownOptions: {
|
|
12495
|
+
output: {
|
|
12496
|
+
advancedChunks: {
|
|
12497
|
+
groups: [
|
|
12498
|
+
{
|
|
12499
|
+
name: (id, ctx) => resolveAdvancedChunkName(id, ctx)
|
|
12500
|
+
}
|
|
12501
|
+
]
|
|
12502
|
+
},
|
|
12503
|
+
chunkFileNames: "[name].js"
|
|
12504
|
+
}
|
|
12505
|
+
}
|
|
12506
|
+
}
|
|
12507
|
+
};
|
|
12293
12508
|
}
|
|
12294
12509
|
|
|
12295
12510
|
// src/runtime/buildPlugin.ts
|
|
12296
|
-
var REG_NODE_MODULES_DIR = /[\\/]node_modules[\\/]/gi;
|
|
12297
12511
|
function createBuildService(ctx) {
|
|
12298
12512
|
function assertRuntimeServices(target) {
|
|
12299
12513
|
if (!target.configService || !target.watcherService || !target.npmService || !target.scanService) {
|
|
@@ -12360,7 +12574,7 @@ function createBuildService(ctx) {
|
|
|
12360
12574
|
function checkWorkersOptions() {
|
|
12361
12575
|
const workersDir = scanService.workersDir;
|
|
12362
12576
|
const hasWorkersDir = Boolean(workersDir);
|
|
12363
|
-
if (hasWorkersDir && _optionalChain([configService, 'access',
|
|
12577
|
+
if (hasWorkersDir && _optionalChain([configService, 'access', _240 => _240.weappViteConfig, 'optionalAccess', _241 => _241.worker, 'optionalAccess', _242 => _242.entry]) === void 0) {
|
|
12364
12578
|
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
12579
|
logger_default.error("\u6BD4\u5982\u5F15\u5165\u7684 `worker` \u8DEF\u5F84\u4E3A `workers/index`, \u6B64\u65F6 `weapp.worker.entry` \u8BBE\u7F6E\u4E3A `[index]` ");
|
|
12366
12580
|
throw new Error("\u8BF7\u5728 `vite.config.ts` \u4E2D\u8BBE\u7F6E `weapp.worker.entry` \u8DEF\u5F84");
|
|
@@ -12381,40 +12595,16 @@ function createBuildService(ctx) {
|
|
|
12381
12595
|
configService.mergeWorkers()
|
|
12382
12596
|
);
|
|
12383
12597
|
}
|
|
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
12598
|
async function runDev() {
|
|
12412
12599
|
if (_process2.default.env.NODE_ENV === void 0) {
|
|
12413
12600
|
_process2.default.env.NODE_ENV = "development";
|
|
12414
12601
|
}
|
|
12415
|
-
_optionalChain([debug, 'optionalCall',
|
|
12602
|
+
_optionalChain([debug, 'optionalCall', _243 => _243("dev build watcher start")]);
|
|
12416
12603
|
const { hasWorkersDir, workersDir } = checkWorkersOptions();
|
|
12417
|
-
const buildOptions = configService.merge(
|
|
12604
|
+
const buildOptions = configService.merge(
|
|
12605
|
+
void 0,
|
|
12606
|
+
createSharedBuildConfig(configService, scanService)
|
|
12607
|
+
);
|
|
12418
12608
|
const watcherPromise = _vite.build.call(void 0,
|
|
12419
12609
|
buildOptions
|
|
12420
12610
|
);
|
|
@@ -12476,8 +12666,8 @@ function createBuildService(ctx) {
|
|
|
12476
12666
|
});
|
|
12477
12667
|
}
|
|
12478
12668
|
}
|
|
12479
|
-
_optionalChain([debug, 'optionalCall',
|
|
12480
|
-
_optionalChain([debug, 'optionalCall',
|
|
12669
|
+
_optionalChain([debug, 'optionalCall', _244 => _244("dev build watcher end")]);
|
|
12670
|
+
_optionalChain([debug, 'optionalCall', _245 => _245("dev watcher listen start")]);
|
|
12481
12671
|
let startTime;
|
|
12482
12672
|
let resolveWatcher;
|
|
12483
12673
|
let rejectWatcher;
|
|
@@ -12500,14 +12690,17 @@ function createBuildService(ctx) {
|
|
|
12500
12690
|
return watcher;
|
|
12501
12691
|
}
|
|
12502
12692
|
async function runProd() {
|
|
12503
|
-
_optionalChain([debug, 'optionalCall',
|
|
12693
|
+
_optionalChain([debug, 'optionalCall', _246 => _246("prod build start")]);
|
|
12504
12694
|
const { hasWorkersDir } = checkWorkersOptions();
|
|
12505
12695
|
const bundlerPromise = _vite.build.call(void 0,
|
|
12506
|
-
configService.merge(
|
|
12696
|
+
configService.merge(
|
|
12697
|
+
void 0,
|
|
12698
|
+
createSharedBuildConfig(configService, scanService)
|
|
12699
|
+
)
|
|
12507
12700
|
);
|
|
12508
12701
|
const workerPromise = hasWorkersDir ? buildWorkers() : Promise.resolve();
|
|
12509
12702
|
const [output] = await Promise.all([bundlerPromise, workerPromise]);
|
|
12510
|
-
_optionalChain([debug, 'optionalCall',
|
|
12703
|
+
_optionalChain([debug, 'optionalCall', _247 => _247("prod build end")]);
|
|
12511
12704
|
return output;
|
|
12512
12705
|
}
|
|
12513
12706
|
async function buildEntry(options) {
|
|
@@ -12527,12 +12720,12 @@ function createBuildService(ctx) {
|
|
|
12527
12720
|
}
|
|
12528
12721
|
}
|
|
12529
12722
|
);
|
|
12530
|
-
_optionalChain([debug, 'optionalCall',
|
|
12723
|
+
_optionalChain([debug, 'optionalCall', _248 => _248("deletedFilePaths", deletedFilePaths)]);
|
|
12531
12724
|
logger_default.success(`\u5DF2\u6E05\u7A7A ${configService.mpDistRoot} \u76EE\u5F55`);
|
|
12532
12725
|
}
|
|
12533
|
-
_optionalChain([debug, 'optionalCall',
|
|
12726
|
+
_optionalChain([debug, 'optionalCall', _249 => _249("build start")]);
|
|
12534
12727
|
let npmBuildTask = Promise.resolve();
|
|
12535
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
12728
|
+
if (!_optionalChain([options, 'optionalAccess', _250 => _250.skipNpm])) {
|
|
12536
12729
|
let shouldBuildNpm = true;
|
|
12537
12730
|
if (configService.isDev) {
|
|
12538
12731
|
const isDependenciesOutdated = await npmService.checkDependenciesCacheOutdate();
|
|
@@ -12559,7 +12752,7 @@ function createBuildService(ctx) {
|
|
|
12559
12752
|
result = await runProd();
|
|
12560
12753
|
}
|
|
12561
12754
|
await npmBuildTask;
|
|
12562
|
-
_optionalChain([debug, 'optionalCall',
|
|
12755
|
+
_optionalChain([debug, 'optionalCall', _251 => _251("build end")]);
|
|
12563
12756
|
return result;
|
|
12564
12757
|
}
|
|
12565
12758
|
return {
|
|
@@ -19515,7 +19708,7 @@ function _tryModuleResolve(id, url, conditions) {
|
|
|
19515
19708
|
try {
|
|
19516
19709
|
return moduleResolve(id, url, conditions);
|
|
19517
19710
|
} catch (error) {
|
|
19518
|
-
if (!NOT_FOUND_ERRORS.has(_optionalChain([error, 'optionalAccess',
|
|
19711
|
+
if (!NOT_FOUND_ERRORS.has(_optionalChain([error, 'optionalAccess', _252 => _252.code]))) {
|
|
19519
19712
|
throw error;
|
|
19520
19713
|
}
|
|
19521
19714
|
}
|
|
@@ -19544,7 +19737,7 @@ function _resolve(id, options = {}) {
|
|
|
19544
19737
|
return pathToFileURL(id);
|
|
19545
19738
|
}
|
|
19546
19739
|
} catch (error) {
|
|
19547
|
-
if (_optionalChain([error, 'optionalAccess',
|
|
19740
|
+
if (_optionalChain([error, 'optionalAccess', _253 => _253.code]) !== "ENOENT") {
|
|
19548
19741
|
throw error;
|
|
19549
19742
|
}
|
|
19550
19743
|
}
|
|
@@ -19688,10 +19881,10 @@ function fromGeneratorFn(generatorFn, options) {
|
|
|
19688
19881
|
return fromObject({
|
|
19689
19882
|
name: generatorFn.name,
|
|
19690
19883
|
async(...args) {
|
|
19691
|
-
return iterateAsync(generatorFn.apply(this, args), _optionalChain([options, 'optionalAccess',
|
|
19884
|
+
return iterateAsync(generatorFn.apply(this, args), _optionalChain([options, 'optionalAccess', _254 => _254.onYield]));
|
|
19692
19885
|
},
|
|
19693
19886
|
sync(...args) {
|
|
19694
|
-
return iterateSync2(generatorFn.apply(this, args), _optionalChain([options, 'optionalAccess',
|
|
19887
|
+
return iterateSync2(generatorFn.apply(this, args), _optionalChain([options, 'optionalAccess', _255 => _255.onYield]));
|
|
19695
19888
|
}
|
|
19696
19889
|
});
|
|
19697
19890
|
}
|
|
@@ -19750,7 +19943,7 @@ function findUpSync(name, {
|
|
|
19750
19943
|
const filePath = isAbsoluteName ? name : sysPath2.default.join(directory, name);
|
|
19751
19944
|
try {
|
|
19752
19945
|
const stats = actualFS.default.statSync(filePath, { throwIfNoEntry: false });
|
|
19753
|
-
if (type === "file" && _optionalChain([stats, 'optionalAccess',
|
|
19946
|
+
if (type === "file" && _optionalChain([stats, 'optionalAccess', _256 => _256.isFile, 'call', _257 => _257()]) || type === "directory" && _optionalChain([stats, 'optionalAccess', _258 => _258.isDirectory, 'call', _259 => _259()])) {
|
|
19754
19947
|
return filePath;
|
|
19755
19948
|
}
|
|
19756
19949
|
} catch (e18) {
|
|
@@ -19969,18 +20162,18 @@ async function detect(options = {}) {
|
|
|
19969
20162
|
}
|
|
19970
20163
|
}
|
|
19971
20164
|
}
|
|
19972
|
-
if (_optionalChain([stopDir, 'optionalCall',
|
|
20165
|
+
if (_optionalChain([stopDir, 'optionalCall', _260 => _260(directory)]))
|
|
19973
20166
|
break;
|
|
19974
20167
|
}
|
|
19975
20168
|
return null;
|
|
19976
20169
|
}
|
|
19977
20170
|
function getNameAndVer(pkg) {
|
|
19978
|
-
const handelVer = (version2) => _nullishCoalesce(_optionalChain([version2, 'optionalAccess',
|
|
20171
|
+
const handelVer = (version2) => _nullishCoalesce(_optionalChain([version2, 'optionalAccess', _261 => _261.match, 'call', _262 => _262(/\d+(\.\d+){0,2}/), 'optionalAccess', _263 => _263[0]]), () => ( version2));
|
|
19979
20172
|
if (typeof pkg.packageManager === "string") {
|
|
19980
20173
|
const [name, ver] = pkg.packageManager.replace(/^\^/, "").split("@");
|
|
19981
20174
|
return { name, ver: handelVer(ver) };
|
|
19982
20175
|
}
|
|
19983
|
-
if (typeof _optionalChain([pkg, 'access',
|
|
20176
|
+
if (typeof _optionalChain([pkg, 'access', _264 => _264.devEngines, 'optionalAccess', _265 => _265.packageManager, 'optionalAccess', _266 => _266.name]) === "string") {
|
|
19984
20177
|
return {
|
|
19985
20178
|
name: pkg.devEngines.packageManager.name,
|
|
19986
20179
|
ver: handelVer(pkg.devEngines.packageManager.version)
|
|
@@ -20008,7 +20201,7 @@ async function handlePackageManager(filepath, onUnknown) {
|
|
|
20008
20201
|
agent = name;
|
|
20009
20202
|
return { name, agent, version: version2 };
|
|
20010
20203
|
} else {
|
|
20011
|
-
return _nullishCoalesce(_optionalChain([onUnknown, 'optionalCall',
|
|
20204
|
+
return _nullishCoalesce(_optionalChain([onUnknown, 'optionalCall', _267 => _267(pkg.packageManager)]), () => ( null));
|
|
20012
20205
|
}
|
|
20013
20206
|
}
|
|
20014
20207
|
} catch (e23) {
|
|
@@ -20022,6 +20215,123 @@ function isMetadataYarnClassic(metadataPath) {
|
|
|
20022
20215
|
// src/runtime/config/createConfigService.ts
|
|
20023
20216
|
|
|
20024
20217
|
|
|
20218
|
+
// src/platform.ts
|
|
20219
|
+
_chunkA5DD7GKXcjs.init_cjs_shims.call(void 0, );
|
|
20220
|
+
|
|
20221
|
+
// src/platforms/adapters.ts
|
|
20222
|
+
_chunkA5DD7GKXcjs.init_cjs_shims.call(void 0, );
|
|
20223
|
+
var MINI_PROGRAM_PLATFORM_ADAPTERS = [
|
|
20224
|
+
{
|
|
20225
|
+
id: "weapp",
|
|
20226
|
+
displayName: "WeChat Mini Program",
|
|
20227
|
+
aliases: ["weapp", "wechat", "weixin", "wx"],
|
|
20228
|
+
outputExtensions: {
|
|
20229
|
+
js: "js",
|
|
20230
|
+
json: "json",
|
|
20231
|
+
wxml: "wxml",
|
|
20232
|
+
wxss: "wxss",
|
|
20233
|
+
wxs: "wxs"
|
|
20234
|
+
}
|
|
20235
|
+
},
|
|
20236
|
+
{
|
|
20237
|
+
id: "alipay",
|
|
20238
|
+
displayName: "Alipay Mini Program",
|
|
20239
|
+
aliases: ["alipay", "ali", "my"],
|
|
20240
|
+
outputExtensions: {
|
|
20241
|
+
js: "js",
|
|
20242
|
+
json: "json",
|
|
20243
|
+
wxml: "axml",
|
|
20244
|
+
wxss: "acss",
|
|
20245
|
+
wxs: "sjs"
|
|
20246
|
+
}
|
|
20247
|
+
},
|
|
20248
|
+
{
|
|
20249
|
+
id: "swan",
|
|
20250
|
+
displayName: "Baidu Smart Program",
|
|
20251
|
+
aliases: ["swan", "baidu", "bd"],
|
|
20252
|
+
outputExtensions: {
|
|
20253
|
+
js: "js",
|
|
20254
|
+
json: "json",
|
|
20255
|
+
wxml: "swan",
|
|
20256
|
+
wxss: "css",
|
|
20257
|
+
wxs: "sjs"
|
|
20258
|
+
}
|
|
20259
|
+
},
|
|
20260
|
+
{
|
|
20261
|
+
id: "tt",
|
|
20262
|
+
displayName: "ByteDance / Douyin Mini Program",
|
|
20263
|
+
aliases: ["tt", "toutiao", "bytedance", "douyin"],
|
|
20264
|
+
outputExtensions: {
|
|
20265
|
+
js: "js",
|
|
20266
|
+
json: "json",
|
|
20267
|
+
wxml: "ttml",
|
|
20268
|
+
wxss: "ttss"
|
|
20269
|
+
}
|
|
20270
|
+
},
|
|
20271
|
+
{
|
|
20272
|
+
id: "jd",
|
|
20273
|
+
displayName: "JD Mini Program",
|
|
20274
|
+
aliases: ["jd", "jingdong"],
|
|
20275
|
+
outputExtensions: {
|
|
20276
|
+
js: "js",
|
|
20277
|
+
json: "json",
|
|
20278
|
+
wxml: "jxml",
|
|
20279
|
+
wxss: "jxss",
|
|
20280
|
+
wxs: "wxs"
|
|
20281
|
+
}
|
|
20282
|
+
},
|
|
20283
|
+
{
|
|
20284
|
+
id: "xhs",
|
|
20285
|
+
displayName: "Xiaohongshu Mini Program",
|
|
20286
|
+
aliases: ["xhs", "xiaohongshu", "little-red-book", "red"],
|
|
20287
|
+
outputExtensions: {
|
|
20288
|
+
js: "js",
|
|
20289
|
+
json: "json",
|
|
20290
|
+
wxml: "xhsml",
|
|
20291
|
+
wxss: "css",
|
|
20292
|
+
wxs: "wxs"
|
|
20293
|
+
}
|
|
20294
|
+
}
|
|
20295
|
+
];
|
|
20296
|
+
|
|
20297
|
+
// src/platform.ts
|
|
20298
|
+
var DEFAULT_MP_PLATFORM = "weapp";
|
|
20299
|
+
var PLATFORM_ADAPTER_BY_ID = /* @__PURE__ */ new Map();
|
|
20300
|
+
var PLATFORM_ALIAS_TO_ID = /* @__PURE__ */ new Map();
|
|
20301
|
+
for (const adapter of MINI_PROGRAM_PLATFORM_ADAPTERS) {
|
|
20302
|
+
PLATFORM_ADAPTER_BY_ID.set(adapter.id, adapter);
|
|
20303
|
+
for (const alias of adapter.aliases) {
|
|
20304
|
+
const normalized = alias.trim().toLowerCase();
|
|
20305
|
+
if (!normalized) {
|
|
20306
|
+
continue;
|
|
20307
|
+
}
|
|
20308
|
+
PLATFORM_ALIAS_TO_ID.set(normalized, adapter.id);
|
|
20309
|
+
}
|
|
20310
|
+
if (!PLATFORM_ALIAS_TO_ID.has(adapter.id)) {
|
|
20311
|
+
PLATFORM_ALIAS_TO_ID.set(adapter.id, adapter.id);
|
|
20312
|
+
}
|
|
20313
|
+
}
|
|
20314
|
+
var MINI_PLATFORM_ALIASES = Object.freeze(
|
|
20315
|
+
Object.fromEntries(PLATFORM_ALIAS_TO_ID.entries())
|
|
20316
|
+
);
|
|
20317
|
+
function normalizeMiniPlatform(input) {
|
|
20318
|
+
return input ? input.trim().toLowerCase() : void 0;
|
|
20319
|
+
}
|
|
20320
|
+
function resolveMiniPlatform(input) {
|
|
20321
|
+
const normalized = normalizeMiniPlatform(input);
|
|
20322
|
+
if (!normalized) {
|
|
20323
|
+
return void 0;
|
|
20324
|
+
}
|
|
20325
|
+
return PLATFORM_ALIAS_TO_ID.get(normalized);
|
|
20326
|
+
}
|
|
20327
|
+
function getMiniProgramPlatformAdapter(platform) {
|
|
20328
|
+
const adapter = PLATFORM_ADAPTER_BY_ID.get(platform);
|
|
20329
|
+
if (!adapter) {
|
|
20330
|
+
throw new Error(`Unsupported mini program platform "${platform}".`);
|
|
20331
|
+
}
|
|
20332
|
+
return adapter;
|
|
20333
|
+
}
|
|
20334
|
+
|
|
20025
20335
|
// src/runtime/oxcRuntime.ts
|
|
20026
20336
|
_chunkA5DD7GKXcjs.init_cjs_shims.call(void 0, );
|
|
20027
20337
|
|
|
@@ -20089,7 +20399,7 @@ export default _objectSpread2;`
|
|
|
20089
20399
|
function getOxcHelperName(id) {
|
|
20090
20400
|
OXC_RUNTIME_HELPER_ALIAS.lastIndex = 0;
|
|
20091
20401
|
const match2 = OXC_RUNTIME_HELPER_ALIAS.exec(id);
|
|
20092
|
-
return _optionalChain([match2, 'optionalAccess',
|
|
20402
|
+
return _optionalChain([match2, 'optionalAccess', _268 => _268[1]]);
|
|
20093
20403
|
}
|
|
20094
20404
|
function createOxcRuntimeSupport() {
|
|
20095
20405
|
const oxcRuntimeInfo = getPackageInfoSync("@oxc-project/runtime");
|
|
@@ -20304,7 +20614,9 @@ function getWeappViteConfig() {
|
|
|
20304
20614
|
},
|
|
20305
20615
|
chunks: {
|
|
20306
20616
|
sharedStrategy: "duplicate",
|
|
20307
|
-
logOptimization: true
|
|
20617
|
+
logOptimization: true,
|
|
20618
|
+
forceDuplicatePatterns: [],
|
|
20619
|
+
duplicateWarningBytes: 512 * 1024
|
|
20308
20620
|
}
|
|
20309
20621
|
};
|
|
20310
20622
|
}
|
|
@@ -20345,13 +20657,13 @@ function migrateEnhanceOptions(target, options) {
|
|
|
20345
20657
|
}
|
|
20346
20658
|
const enhance = target.enhance;
|
|
20347
20659
|
const userConfigured = _nullishCoalesce(options.userConfigured, () => ( {}));
|
|
20348
|
-
if (!userConfigured.wxml && _optionalChain([enhance, 'optionalAccess',
|
|
20660
|
+
if (!userConfigured.wxml && _optionalChain([enhance, 'optionalAccess', _269 => _269.wxml]) !== void 0) {
|
|
20349
20661
|
target.wxml = enhance.wxml;
|
|
20350
20662
|
}
|
|
20351
|
-
if (!userConfigured.wxs && _optionalChain([enhance, 'optionalAccess',
|
|
20663
|
+
if (!userConfigured.wxs && _optionalChain([enhance, 'optionalAccess', _270 => _270.wxs]) !== void 0) {
|
|
20352
20664
|
target.wxs = enhance.wxs;
|
|
20353
20665
|
}
|
|
20354
|
-
if (!userConfigured.autoImportComponents && _optionalChain([enhance, 'optionalAccess',
|
|
20666
|
+
if (!userConfigured.autoImportComponents && _optionalChain([enhance, 'optionalAccess', _271 => _271.autoImportComponents]) !== void 0) {
|
|
20355
20667
|
target.autoImportComponents = enhance.autoImportComponents;
|
|
20356
20668
|
}
|
|
20357
20669
|
if (options.warn && !hasLoggedEnhanceDeprecation) {
|
|
@@ -20516,7 +20828,7 @@ function normalizeSrcDir(root, cwd, srcRoot, config) {
|
|
|
20516
20828
|
return _pathe2.default.relative(root, absoluteSrc) || "";
|
|
20517
20829
|
}
|
|
20518
20830
|
function normalizeOutDir(root, config) {
|
|
20519
|
-
if (!_optionalChain([config, 'optionalAccess',
|
|
20831
|
+
if (!_optionalChain([config, 'optionalAccess', _272 => _272.outDir])) {
|
|
20520
20832
|
return _pathe2.default.resolve(root, "dist-web");
|
|
20521
20833
|
}
|
|
20522
20834
|
if (_pathe2.default.isAbsolute(config.outDir)) {
|
|
@@ -20592,11 +20904,11 @@ function createLoadConfig(options) {
|
|
|
20592
20904
|
command: isDev ? "serve" : "build",
|
|
20593
20905
|
mode
|
|
20594
20906
|
}, resolvedConfigFile, cwd);
|
|
20595
|
-
const loadedConfig = _nullishCoalesce(_optionalChain([loaded, 'optionalAccess',
|
|
20907
|
+
const loadedConfig = _nullishCoalesce(_optionalChain([loaded, 'optionalAccess', _273 => _273.config]), () => ( {}));
|
|
20596
20908
|
let weappLoaded;
|
|
20597
20909
|
if (weappConfigFilePath) {
|
|
20598
20910
|
const normalizedWeappPath = _pathe2.default.resolve(weappConfigFilePath);
|
|
20599
|
-
const normalizedLoadedPath = _optionalChain([loaded, 'optionalAccess',
|
|
20911
|
+
const normalizedLoadedPath = _optionalChain([loaded, 'optionalAccess', _274 => _274.path]) ? _pathe2.default.resolve(loaded.path) : void 0;
|
|
20600
20912
|
if (normalizedLoadedPath && normalizedLoadedPath === normalizedWeappPath) {
|
|
20601
20913
|
weappLoaded = loaded;
|
|
20602
20914
|
} else {
|
|
@@ -20629,47 +20941,47 @@ function createLoadConfig(options) {
|
|
|
20629
20941
|
weapp: getWeappViteConfig()
|
|
20630
20942
|
}
|
|
20631
20943
|
);
|
|
20632
|
-
if (_optionalChain([weappLoaded, 'optionalAccess',
|
|
20944
|
+
if (_optionalChain([weappLoaded, 'optionalAccess', _275 => _275.config, 'optionalAccess', _276 => _276.weapp])) {
|
|
20633
20945
|
config.weapp = _shared.defu.call(void 0,
|
|
20634
20946
|
weappLoaded.config.weapp,
|
|
20635
20947
|
_nullishCoalesce(config.weapp, () => ( {}))
|
|
20636
20948
|
);
|
|
20637
20949
|
}
|
|
20638
20950
|
const shouldWarnEnhance = [
|
|
20639
|
-
_optionalChain([inlineConfig, 'optionalAccess',
|
|
20640
|
-
_optionalChain([loadedConfig, 'access',
|
|
20641
|
-
_optionalChain([weappLoaded, 'optionalAccess',
|
|
20951
|
+
_optionalChain([inlineConfig, 'optionalAccess', _277 => _277.weapp, 'optionalAccess', _278 => _278.enhance]),
|
|
20952
|
+
_optionalChain([loadedConfig, 'access', _279 => _279.weapp, 'optionalAccess', _280 => _280.enhance]),
|
|
20953
|
+
_optionalChain([weappLoaded, 'optionalAccess', _281 => _281.config, 'optionalAccess', _282 => _282.weapp, 'optionalAccess', _283 => _283.enhance])
|
|
20642
20954
|
].some(hasDeprecatedEnhanceUsage);
|
|
20643
20955
|
const userConfiguredTopLevel = {
|
|
20644
20956
|
wxml: [
|
|
20645
|
-
_optionalChain([inlineConfig, 'optionalAccess',
|
|
20646
|
-
_optionalChain([loadedConfig, 'access',
|
|
20647
|
-
_optionalChain([weappLoaded, 'optionalAccess',
|
|
20957
|
+
_optionalChain([inlineConfig, 'optionalAccess', _284 => _284.weapp, 'optionalAccess', _285 => _285.wxml]),
|
|
20958
|
+
_optionalChain([loadedConfig, 'access', _286 => _286.weapp, 'optionalAccess', _287 => _287.wxml]),
|
|
20959
|
+
_optionalChain([weappLoaded, 'optionalAccess', _288 => _288.config, 'optionalAccess', _289 => _289.weapp, 'optionalAccess', _290 => _290.wxml])
|
|
20648
20960
|
].some((value) => value !== void 0),
|
|
20649
20961
|
wxs: [
|
|
20650
|
-
_optionalChain([inlineConfig, 'optionalAccess',
|
|
20651
|
-
_optionalChain([loadedConfig, 'access',
|
|
20652
|
-
_optionalChain([weappLoaded, 'optionalAccess',
|
|
20962
|
+
_optionalChain([inlineConfig, 'optionalAccess', _291 => _291.weapp, 'optionalAccess', _292 => _292.wxs]),
|
|
20963
|
+
_optionalChain([loadedConfig, 'access', _293 => _293.weapp, 'optionalAccess', _294 => _294.wxs]),
|
|
20964
|
+
_optionalChain([weappLoaded, 'optionalAccess', _295 => _295.config, 'optionalAccess', _296 => _296.weapp, 'optionalAccess', _297 => _297.wxs])
|
|
20653
20965
|
].some((value) => value !== void 0),
|
|
20654
20966
|
autoImportComponents: [
|
|
20655
|
-
_optionalChain([inlineConfig, 'optionalAccess',
|
|
20656
|
-
_optionalChain([loadedConfig, 'access',
|
|
20657
|
-
_optionalChain([weappLoaded, 'optionalAccess',
|
|
20967
|
+
_optionalChain([inlineConfig, 'optionalAccess', _298 => _298.weapp, 'optionalAccess', _299 => _299.autoImportComponents]),
|
|
20968
|
+
_optionalChain([loadedConfig, 'access', _300 => _300.weapp, 'optionalAccess', _301 => _301.autoImportComponents]),
|
|
20969
|
+
_optionalChain([weappLoaded, 'optionalAccess', _302 => _302.config, 'optionalAccess', _303 => _303.weapp, 'optionalAccess', _304 => _304.autoImportComponents])
|
|
20658
20970
|
].some((value) => value !== void 0)
|
|
20659
20971
|
};
|
|
20660
20972
|
migrateEnhanceOptions(config.weapp, {
|
|
20661
20973
|
warn: shouldWarnEnhance,
|
|
20662
20974
|
userConfigured: userConfiguredTopLevel
|
|
20663
20975
|
});
|
|
20664
|
-
const srcRoot = _nullishCoalesce(_optionalChain([config, 'access',
|
|
20976
|
+
const srcRoot = _nullishCoalesce(_optionalChain([config, 'access', _305 => _305.weapp, 'optionalAccess', _306 => _306.srcRoot]), () => ( ""));
|
|
20665
20977
|
const resolvedWebConfig = resolveWeappWebConfig({
|
|
20666
20978
|
cwd,
|
|
20667
20979
|
srcRoot,
|
|
20668
|
-
config: _optionalChain([config, 'access',
|
|
20980
|
+
config: _optionalChain([config, 'access', _307 => _307.weapp, 'optionalAccess', _308 => _308.web])
|
|
20669
20981
|
});
|
|
20670
20982
|
const buildConfig = _nullishCoalesce(config.build, () => ( (config.build = {})));
|
|
20671
|
-
const jsFormat = _nullishCoalesce(_optionalChain([config, 'access',
|
|
20672
|
-
const enableLegacyEs5 = _optionalChain([config, 'access',
|
|
20983
|
+
const jsFormat = _nullishCoalesce(_optionalChain([config, 'access', _309 => _309.weapp, 'optionalAccess', _310 => _310.jsFormat]), () => ( "cjs"));
|
|
20984
|
+
const enableLegacyEs5 = _optionalChain([config, 'access', _311 => _311.weapp, 'optionalAccess', _312 => _312.es5]) === true;
|
|
20673
20985
|
if (enableLegacyEs5 && jsFormat !== "cjs") {
|
|
20674
20986
|
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
20987
|
}
|
|
@@ -20716,11 +21028,11 @@ function createLoadConfig(options) {
|
|
|
20716
21028
|
config.plugins ??= [];
|
|
20717
21029
|
config.plugins.unshift(oxcVitePlugin);
|
|
20718
21030
|
}
|
|
20719
|
-
const platform = _nullishCoalesce(_optionalChain([config, 'access',
|
|
20720
|
-
const aliasEntries = getAliasEntries(_optionalChain([config, 'access',
|
|
21031
|
+
const platform = _nullishCoalesce(_optionalChain([config, 'access', _313 => _313.weapp, 'optionalAccess', _314 => _314.platform]), () => ( DEFAULT_MP_PLATFORM));
|
|
21032
|
+
const aliasEntries = getAliasEntries(_optionalChain([config, 'access', _315 => _315.weapp, 'optionalAccess', _316 => _316.jsonAlias]));
|
|
20721
21033
|
config.plugins ??= [];
|
|
20722
|
-
config.plugins.push(_vitetsconfigpaths2.default.call(void 0, _optionalChain([config, 'access',
|
|
20723
|
-
const configFilePath = _nullishCoalesce(_nullishCoalesce(_optionalChain([weappLoaded, 'optionalAccess',
|
|
21034
|
+
config.plugins.push(_vitetsconfigpaths2.default.call(void 0, _optionalChain([config, 'access', _317 => _317.weapp, 'optionalAccess', _318 => _318.tsconfigPaths])));
|
|
21035
|
+
const configFilePath = _nullishCoalesce(_nullishCoalesce(_optionalChain([weappLoaded, 'optionalAccess', _319 => _319.path]), () => ( _optionalChain([loaded, 'optionalAccess', _320 => _320.path]))), () => ( resolvedConfigFile));
|
|
20724
21036
|
const outputExtensions = getOutputExtensions(platform);
|
|
20725
21037
|
const relativeSrcRoot = (p) => {
|
|
20726
21038
|
if (srcRoot) {
|
|
@@ -20769,9 +21081,9 @@ function normalizeCopyGlobs(globs) {
|
|
|
20769
21081
|
}
|
|
20770
21082
|
function scanAssetFiles(configService, config) {
|
|
20771
21083
|
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',
|
|
21084
|
+
const include = normalizeCopyGlobs(_optionalChain([weappViteConfig, 'optionalAccess', _321 => _321.copy, 'optionalAccess', _322 => _322.include]));
|
|
21085
|
+
const exclude = normalizeCopyGlobs(_optionalChain([weappViteConfig, 'optionalAccess', _323 => _323.copy, 'optionalAccess', _324 => _324.exclude]));
|
|
21086
|
+
const filter3 = _nullishCoalesce(_optionalChain([weappViteConfig, 'optionalAccess', _325 => _325.copy, 'optionalAccess', _326 => _326.filter]), () => ( (() => true)));
|
|
20775
21087
|
const ignore = [
|
|
20776
21088
|
...defaultExcluded,
|
|
20777
21089
|
_pathe2.default.resolve(configService.cwd, `${config.build.outDir}/**/*`),
|
|
@@ -20829,7 +21141,7 @@ function createAssetCollector(state) {
|
|
|
20829
21141
|
},
|
|
20830
21142
|
async buildEnd() {
|
|
20831
21143
|
const assets = await state.pendingAssets;
|
|
20832
|
-
if (!_optionalChain([assets, 'optionalAccess',
|
|
21144
|
+
if (!_optionalChain([assets, 'optionalAccess', _327 => _327.length])) {
|
|
20833
21145
|
return;
|
|
20834
21146
|
}
|
|
20835
21147
|
for (const candidate of assets) {
|
|
@@ -20931,13 +21243,13 @@ function createAutoImportPlugin(state) {
|
|
|
20931
21243
|
return;
|
|
20932
21244
|
}
|
|
20933
21245
|
const weappConfig = configService.weappViteConfig;
|
|
20934
|
-
const globs = _nullishCoalesce(_optionalChain([weappConfig, 'optionalAccess',
|
|
20935
|
-
const globsKey = _nullishCoalesce(_optionalChain([globs, 'optionalAccess',
|
|
21246
|
+
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])));
|
|
21247
|
+
const globsKey = _nullishCoalesce(_optionalChain([globs, 'optionalAccess', _333 => _333.join, 'call', _334 => _334("\0")]), () => ( ""));
|
|
20936
21248
|
if (globsKey !== state.lastGlobsKey) {
|
|
20937
21249
|
state.initialScanDone = false;
|
|
20938
21250
|
state.lastGlobsKey = globsKey;
|
|
20939
21251
|
}
|
|
20940
|
-
if (!_optionalChain([globs, 'optionalAccess',
|
|
21252
|
+
if (!_optionalChain([globs, 'optionalAccess', _335 => _335.length])) {
|
|
20941
21253
|
return;
|
|
20942
21254
|
}
|
|
20943
21255
|
if (state.initialScanDone) {
|
|
@@ -21028,14 +21340,14 @@ function createAutoRoutesPlugin(ctx) {
|
|
|
21028
21340
|
if (!service.isRouteFile(id)) {
|
|
21029
21341
|
return;
|
|
21030
21342
|
}
|
|
21031
|
-
const event = _optionalChain([change, 'optionalAccess',
|
|
21343
|
+
const event = _optionalChain([change, 'optionalAccess', _336 => _336.event]);
|
|
21032
21344
|
await service.handleFileChange(id, event);
|
|
21033
21345
|
},
|
|
21034
21346
|
async handleHotUpdate(context) {
|
|
21035
21347
|
if (!service.isRouteFile(context.file)) {
|
|
21036
21348
|
return;
|
|
21037
21349
|
}
|
|
21038
|
-
if (_optionalChain([resolvedConfig, 'optionalAccess',
|
|
21350
|
+
if (_optionalChain([resolvedConfig, 'optionalAccess', _337 => _337.command]) === "serve") {
|
|
21039
21351
|
await service.handleFileChange(context.file, "update");
|
|
21040
21352
|
}
|
|
21041
21353
|
const virtualModule = context.server.moduleGraph.getModuleById(RESOLVED_VIRTUAL_ID);
|
|
@@ -21259,7 +21571,7 @@ async function renderSharedStyleEntry(entry, _configService, resolvedConfig) {
|
|
|
21259
21571
|
};
|
|
21260
21572
|
}
|
|
21261
21573
|
const processed = await _vite.preprocessCSS.call(void 0, css2, absolutePath, resolvedConfig);
|
|
21262
|
-
const dependencies = _optionalChain([processed, 'optionalAccess',
|
|
21574
|
+
const dependencies = _optionalChain([processed, 'optionalAccess', _338 => _338.deps]) ? dedupeAndNormalizeDependencies(absolutePath, processed.deps) : [];
|
|
21263
21575
|
const result = {
|
|
21264
21576
|
css: processed.code,
|
|
21265
21577
|
dependencies
|
|
@@ -21295,10 +21607,10 @@ function invalidateSharedStyleCache() {
|
|
|
21295
21607
|
try {
|
|
21296
21608
|
const sharedState = _chunkA5DD7GKXcjs.__require.call(void 0, request);
|
|
21297
21609
|
if (sharedState) {
|
|
21298
|
-
_optionalChain([sharedState, 'access',
|
|
21299
|
-
_optionalChain([sharedState, 'access',
|
|
21300
|
-
_optionalChain([sharedState, 'access',
|
|
21301
|
-
_optionalChain([sharedState, 'access',
|
|
21610
|
+
_optionalChain([sharedState, 'access', _339 => _339.contextMap, 'optionalAccess', _340 => _340.clear, 'optionalCall', _341 => _341()]);
|
|
21611
|
+
_optionalChain([sharedState, 'access', _342 => _342.configContextMap, 'optionalAccess', _343 => _343.clear, 'optionalCall', _344 => _344()]);
|
|
21612
|
+
_optionalChain([sharedState, 'access', _345 => _345.contextSourcesMap, 'optionalAccess', _346 => _346.clear, 'optionalCall', _347 => _347()]);
|
|
21613
|
+
_optionalChain([sharedState, 'access', _348 => _348.sourceHashMap, 'optionalAccess', _349 => _349.clear, 'optionalCall', _350 => _350()]);
|
|
21302
21614
|
break;
|
|
21303
21615
|
}
|
|
21304
21616
|
} catch (e26) {
|
|
@@ -21358,7 +21670,7 @@ function createChunkEmitter(configService, loadedEntrySet, debug4) {
|
|
|
21358
21670
|
// @ts-ignore
|
|
21359
21671
|
preserveSignature: "exports-only"
|
|
21360
21672
|
});
|
|
21361
|
-
_optionalChain([debug4, 'optionalCall',
|
|
21673
|
+
_optionalChain([debug4, 'optionalCall', _351 => _351(`load ${fileName} \u8017\u65F6 ${(_perf_hooks.performance.now() - start).toFixed(2)}ms`)]);
|
|
21362
21674
|
});
|
|
21363
21675
|
};
|
|
21364
21676
|
}
|
|
@@ -22665,7 +22977,7 @@ function createEntryLoader(options) {
|
|
|
22665
22977
|
registerJsonAsset,
|
|
22666
22978
|
existsCache
|
|
22667
22979
|
);
|
|
22668
|
-
const pluginJsonPath = _optionalChain([scanService, 'optionalAccess',
|
|
22980
|
+
const pluginJsonPath = _optionalChain([scanService, 'optionalAccess', _352 => _352.pluginJsonPath]);
|
|
22669
22981
|
if (configService.absolutePluginRoot && pluginJsonPath) {
|
|
22670
22982
|
this.addWatchFile(pluginJsonPath);
|
|
22671
22983
|
const pluginJson = await jsonService.read(pluginJsonPath);
|
|
@@ -22713,13 +23025,13 @@ function createEntryLoader(options) {
|
|
|
22713
23025
|
normalizedEntries,
|
|
22714
23026
|
configService.absoluteSrcRoot
|
|
22715
23027
|
);
|
|
22716
|
-
_optionalChain([debug4, 'optionalCall',
|
|
23028
|
+
_optionalChain([debug4, 'optionalCall', _353 => _353(`resolvedIds ${relativeCwdId} \u8017\u65F6 ${getTime()}`)]);
|
|
22717
23029
|
const pendingResolvedIds = [];
|
|
22718
23030
|
const combinedResolved = pluginResolvedRecords ? [...resolvedIds, ...pluginResolvedRecords] : resolvedIds;
|
|
22719
23031
|
const pluginEntrySet = pluginResolvedRecords ? new Set(pluginResolvedRecords.map((record) => record.entry)) : void 0;
|
|
22720
23032
|
for (const { entry, resolvedId } of combinedResolved) {
|
|
22721
23033
|
if (!resolvedId) {
|
|
22722
|
-
if (_optionalChain([pluginEntrySet, 'optionalAccess',
|
|
23034
|
+
if (_optionalChain([pluginEntrySet, 'optionalAccess', _354 => _354.has, 'call', _355 => _355(entry)])) {
|
|
22723
23035
|
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
23036
|
} else {
|
|
22725
23037
|
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 +23046,7 @@ function createEntryLoader(options) {
|
|
|
22734
23046
|
if (pendingResolvedIds.length) {
|
|
22735
23047
|
await Promise.all(emitEntriesChunks.call(this, pendingResolvedIds));
|
|
22736
23048
|
}
|
|
22737
|
-
_optionalChain([debug4, 'optionalCall',
|
|
23049
|
+
_optionalChain([debug4, 'optionalCall', _356 => _356(`emitEntriesChunks ${relativeCwdId} \u8017\u65F6 ${getTime()}`)]);
|
|
22738
23050
|
registerJsonAsset({
|
|
22739
23051
|
jsonPath,
|
|
22740
23052
|
json,
|
|
@@ -22749,7 +23061,7 @@ function createEntryLoader(options) {
|
|
|
22749
23061
|
}
|
|
22750
23062
|
const code = await _fsextra2.default.readFile(id, "utf8");
|
|
22751
23063
|
const styleImports = await collectStyleImports(this, id, existsCache);
|
|
22752
|
-
_optionalChain([debug4, 'optionalCall',
|
|
23064
|
+
_optionalChain([debug4, 'optionalCall', _357 => _357(`loadEntry ${relativeCwdId} \u8017\u65F6 ${getTime()}`)]);
|
|
22753
23065
|
if (styleImports.length === 0) {
|
|
22754
23066
|
return {
|
|
22755
23067
|
code
|
|
@@ -22820,7 +23132,7 @@ function createTemplateScanner(wxmlService, debug4) {
|
|
|
22820
23132
|
const { components: components2 } = wxmlToken;
|
|
22821
23133
|
wxmlService.setWxmlComponentsMap(templateEntry, components2);
|
|
22822
23134
|
}
|
|
22823
|
-
_optionalChain([debug4, 'optionalCall',
|
|
23135
|
+
_optionalChain([debug4, 'optionalCall', _358 => _358(`scanTemplateEntry ${templateEntry} \u8017\u65F6 ${(_perf_hooks.performance.now() - start).toFixed(2)}ms`)]);
|
|
22824
23136
|
};
|
|
22825
23137
|
}
|
|
22826
23138
|
|
|
@@ -22994,7 +23306,7 @@ async function extractCssImportDependencies(ctx, importer) {
|
|
|
22994
23306
|
if (!match2) {
|
|
22995
23307
|
break;
|
|
22996
23308
|
}
|
|
22997
|
-
const rawSpecifier = _optionalChain([match2, 'access',
|
|
23309
|
+
const rawSpecifier = _optionalChain([match2, 'access', _359 => _359[1], 'optionalAccess', _360 => _360.trim, 'call', _361 => _361()]);
|
|
22998
23310
|
if (!rawSpecifier) {
|
|
22999
23311
|
continue;
|
|
23000
23312
|
}
|
|
@@ -23212,7 +23524,7 @@ function ensureSidecarWatcher(ctx, rootDir) {
|
|
|
23212
23524
|
return;
|
|
23213
23525
|
}
|
|
23214
23526
|
const normalizedPath = _pathe2.default.normalize(input);
|
|
23215
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
23527
|
+
if (!_optionalChain([options, 'optionalAccess', _362 => _362.silent])) {
|
|
23216
23528
|
logger_default.info(`[watch:${event}] ${ctx.configService.relativeCwd(normalizedPath)}`);
|
|
23217
23529
|
}
|
|
23218
23530
|
handleSidecarChange(event, normalizedPath, isReady);
|
|
@@ -23244,7 +23556,7 @@ function ensureSidecarWatcher(ctx, rootDir) {
|
|
|
23244
23556
|
return;
|
|
23245
23557
|
}
|
|
23246
23558
|
const relativeRoot = ctx.configService.relativeCwd(absRoot);
|
|
23247
|
-
const code = _nullishCoalesce(_optionalChain([error, 'optionalAccess',
|
|
23559
|
+
const code = _nullishCoalesce(_optionalChain([error, 'optionalAccess', _363 => _363.code]), () => ( "UNKNOWN"));
|
|
23248
23560
|
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
23561
|
});
|
|
23250
23562
|
sidecarWatcherMap.set(absRoot, {
|
|
@@ -23408,7 +23720,7 @@ function createCacheKey(options) {
|
|
|
23408
23720
|
return `${options.removeComment ? 1 : 0}|${options.transformEvent ? 1 : 0}`;
|
|
23409
23721
|
}
|
|
23410
23722
|
function getCachedResult(data2, cacheKey) {
|
|
23411
|
-
return _optionalChain([handleCache, 'access',
|
|
23723
|
+
return _optionalChain([handleCache, 'access', _364 => _364.get, 'call', _365 => _365(data2), 'optionalAccess', _366 => _366.get, 'call', _367 => _367(cacheKey)]);
|
|
23412
23724
|
}
|
|
23413
23725
|
function setCachedResult(data2, cacheKey, result) {
|
|
23414
23726
|
let cacheForToken = handleCache.get(data2);
|
|
@@ -23484,7 +23796,7 @@ function handleWxml(data2, options) {
|
|
|
23484
23796
|
if (shouldTransformInlineWxs) {
|
|
23485
23797
|
for (const { end, start, value } of inlineWxsTokens) {
|
|
23486
23798
|
const { result } = getCachedInlineWxsTransform(value);
|
|
23487
|
-
if (_optionalChain([result, 'optionalAccess',
|
|
23799
|
+
if (_optionalChain([result, 'optionalAccess', _368 => _368.code])) {
|
|
23488
23800
|
ms.update(start, end, `
|
|
23489
23801
|
${result.code}`);
|
|
23490
23802
|
}
|
|
@@ -23535,11 +23847,11 @@ function emitWxmlAssetsWithCache(options) {
|
|
|
23535
23847
|
});
|
|
23536
23848
|
const emittedFiles = [];
|
|
23537
23849
|
for (const { id, fileName, token } of currentPackageWxmls) {
|
|
23538
|
-
_optionalChain([runtime, 'access',
|
|
23850
|
+
_optionalChain([runtime, 'access', _369 => _369.addWatchFile, 'optionalCall', _370 => _370(id)]);
|
|
23539
23851
|
const deps = wxmlService.depsMap.get(id);
|
|
23540
23852
|
if (deps) {
|
|
23541
23853
|
for (const dep of deps) {
|
|
23542
|
-
_optionalChain([runtime, 'access',
|
|
23854
|
+
_optionalChain([runtime, 'access', _371 => _371.addWatchFile, 'optionalCall', _372 => _372(dep)]);
|
|
23543
23855
|
}
|
|
23544
23856
|
}
|
|
23545
23857
|
emittedFiles.push(fileName);
|
|
@@ -23635,7 +23947,7 @@ function createCoreLifecyclePlugin(state) {
|
|
|
23635
23947
|
buildService.invalidateIndependentOutput(independentRoot);
|
|
23636
23948
|
scanService.markIndependentDirty(independentRoot);
|
|
23637
23949
|
handledByIndependentWatcher = true;
|
|
23638
|
-
if (_optionalChain([independentMeta, 'optionalAccess',
|
|
23950
|
+
if (_optionalChain([independentMeta, 'optionalAccess', _373 => _373.watchSharedStyles]) !== false) {
|
|
23639
23951
|
invalidateSharedStyleCache();
|
|
23640
23952
|
}
|
|
23641
23953
|
}
|
|
@@ -23683,7 +23995,7 @@ function createCoreLifecyclePlugin(state) {
|
|
|
23683
23995
|
options.input = scannedInput;
|
|
23684
23996
|
},
|
|
23685
23997
|
async load(id) {
|
|
23686
|
-
_optionalChain([configService, 'access',
|
|
23998
|
+
_optionalChain([configService, 'access', _374 => _374.weappViteConfig, 'optionalAccess', _375 => _375.debug, 'optionalAccess', _376 => _376.load, 'optionalCall', _377 => _377(id, subPackageMeta)]);
|
|
23687
23999
|
const relativeBasename = _shared.removeExtensionDeep.call(void 0, configService.relativeAbsoluteSrcRoot(id));
|
|
23688
24000
|
if (isCSSRequest(id)) {
|
|
23689
24001
|
const parsed = parseRequest(id);
|
|
@@ -23697,7 +24009,7 @@ function createCoreLifecyclePlugin(state) {
|
|
|
23697
24009
|
}
|
|
23698
24010
|
return null;
|
|
23699
24011
|
}
|
|
23700
|
-
if (loadedEntrySet.has(id) || _optionalChain([subPackageMeta, 'optionalAccess',
|
|
24012
|
+
if (loadedEntrySet.has(id) || _optionalChain([subPackageMeta, 'optionalAccess', _378 => _378.entries, 'access', _379 => _379.includes, 'call', _380 => _380(relativeBasename)])) {
|
|
23701
24013
|
return await loadEntry.call(this, id, "component");
|
|
23702
24014
|
}
|
|
23703
24015
|
if (relativeBasename === "app") {
|
|
@@ -23728,13 +24040,19 @@ function createCoreLifecyclePlugin(state) {
|
|
|
23728
24040
|
return subPackageRoots.find((root) => filePath === root || filePath.startsWith(`${root}/`));
|
|
23729
24041
|
};
|
|
23730
24042
|
var matchSubPackage = matchSubPackage2;
|
|
23731
|
-
const sharedStrategy = _nullishCoalesce(_optionalChain([configService, 'access',
|
|
23732
|
-
const shouldLogChunks = _nullishCoalesce(_optionalChain([configService, 'access',
|
|
24043
|
+
const sharedStrategy = _nullishCoalesce(_optionalChain([configService, 'access', _381 => _381.weappViteConfig, 'optionalAccess', _382 => _382.chunks, 'optionalAccess', _383 => _383.sharedStrategy]), () => ( DEFAULT_SHARED_CHUNK_STRATEGY));
|
|
24044
|
+
const shouldLogChunks = _nullishCoalesce(_optionalChain([configService, 'access', _384 => _384.weappViteConfig, 'optionalAccess', _385 => _385.chunks, 'optionalAccess', _386 => _386.logOptimization]), () => ( true));
|
|
23733
24045
|
const subPackageRoots = Array.from(scanService.subPackageMap.keys()).filter(Boolean);
|
|
23734
|
-
|
|
23735
|
-
|
|
23736
|
-
|
|
23737
|
-
|
|
24046
|
+
const duplicateWarningBytes = Number(_nullishCoalesce(_optionalChain([configService, 'access', _387 => _387.weappViteConfig, 'optionalAccess', _388 => _388.chunks, 'optionalAccess', _389 => _389.duplicateWarningBytes]), () => ( 0)));
|
|
24047
|
+
const shouldWarnOnDuplicate = Number.isFinite(duplicateWarningBytes) && duplicateWarningBytes > 0;
|
|
24048
|
+
let redundantBytesTotal = 0;
|
|
24049
|
+
const handleDuplicate = shouldLogChunks || shouldWarnOnDuplicate ? ({ duplicates, ignoredMainImporters, chunkBytes, redundantBytes }) => {
|
|
24050
|
+
if (shouldWarnOnDuplicate) {
|
|
24051
|
+
const duplicateCount = duplicates.length;
|
|
24052
|
+
const computedRedundant = typeof redundantBytes === "number" ? redundantBytes : typeof chunkBytes === "number" ? chunkBytes * Math.max(duplicateCount - 1, 0) : 0;
|
|
24053
|
+
redundantBytesTotal += computedRedundant;
|
|
24054
|
+
}
|
|
24055
|
+
if (shouldLogChunks) {
|
|
23738
24056
|
const subPackageSet = /* @__PURE__ */ new Set();
|
|
23739
24057
|
let totalReferences = 0;
|
|
23740
24058
|
for (const { fileName, importers } of duplicates) {
|
|
@@ -23745,8 +24063,14 @@ function createCoreLifecyclePlugin(state) {
|
|
|
23745
24063
|
}
|
|
23746
24064
|
}
|
|
23747
24065
|
const subPackageList = Array.from(subPackageSet).join("\u3001") || "\u76F8\u5173\u5206\u5305";
|
|
23748
|
-
|
|
23749
|
-
|
|
24066
|
+
const ignoredHint = _optionalChain([ignoredMainImporters, 'optionalAccess', _390 => _390.length]) ? `\uFF0C\u5FFD\u7565\u4E3B\u5305\u5F15\u7528\uFF1A${ignoredMainImporters.join("\u3001")}` : "";
|
|
24067
|
+
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`);
|
|
24068
|
+
}
|
|
24069
|
+
} : void 0;
|
|
24070
|
+
applySharedChunkStrategy.call(this, bundle, {
|
|
24071
|
+
strategy: sharedStrategy,
|
|
24072
|
+
subPackageRoots,
|
|
24073
|
+
onDuplicate: handleDuplicate,
|
|
23750
24074
|
onFallback: shouldLogChunks ? ({ reason, importers }) => {
|
|
23751
24075
|
const involvedSubs = /* @__PURE__ */ new Set();
|
|
23752
24076
|
let hasMainReference = false;
|
|
@@ -23773,11 +24097,14 @@ function createCoreLifecyclePlugin(state) {
|
|
|
23773
24097
|
}
|
|
23774
24098
|
} : void 0
|
|
23775
24099
|
});
|
|
24100
|
+
if (shouldWarnOnDuplicate && redundantBytesTotal > duplicateWarningBytes) {
|
|
24101
|
+
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`);
|
|
24102
|
+
}
|
|
23776
24103
|
}
|
|
23777
|
-
if (_optionalChain([configService, 'access',
|
|
24104
|
+
if (_optionalChain([configService, 'access', _391 => _391.weappViteConfig, 'optionalAccess', _392 => _392.debug, 'optionalAccess', _393 => _393.watchFiles])) {
|
|
23778
24105
|
const watcherService = ctx.watcherService;
|
|
23779
|
-
const watcherRoot = _nullishCoalesce(_optionalChain([subPackageMeta, 'optionalAccess',
|
|
23780
|
-
const watcher = _optionalChain([watcherService, 'optionalAccess',
|
|
24106
|
+
const watcherRoot = _nullishCoalesce(_optionalChain([subPackageMeta, 'optionalAccess', _394 => _394.subPackage, 'access', _395 => _395.root]), () => ( "/"));
|
|
24107
|
+
const watcher = _optionalChain([watcherService, 'optionalAccess', _396 => _396.getRollupWatcher, 'call', _397 => _397(watcherRoot)]);
|
|
23781
24108
|
let watchFiles;
|
|
23782
24109
|
if (watcher && typeof watcher.getWatchFiles === "function") {
|
|
23783
24110
|
watchFiles = await watcher.getWatchFiles();
|
|
@@ -23791,7 +24118,7 @@ function createCoreLifecyclePlugin(state) {
|
|
|
23791
24118
|
}
|
|
23792
24119
|
},
|
|
23793
24120
|
buildEnd() {
|
|
23794
|
-
_optionalChain([debug2, 'optionalCall',
|
|
24121
|
+
_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
24122
|
}
|
|
23796
24123
|
};
|
|
23797
24124
|
}
|
|
@@ -23848,6 +24175,21 @@ function createRequireAnalysisPlugin(state) {
|
|
|
23848
24175
|
}
|
|
23849
24176
|
};
|
|
23850
24177
|
}
|
|
24178
|
+
function formatBytes(bytes) {
|
|
24179
|
+
if (!Number.isFinite(bytes) || bytes <= 0) {
|
|
24180
|
+
return "0 B";
|
|
24181
|
+
}
|
|
24182
|
+
const units = ["B", "KB", "MB", "GB"];
|
|
24183
|
+
let value = bytes;
|
|
24184
|
+
let index = 0;
|
|
24185
|
+
while (value >= 1024 && index < units.length - 1) {
|
|
24186
|
+
value /= 1024;
|
|
24187
|
+
index++;
|
|
24188
|
+
}
|
|
24189
|
+
const precision = value >= 100 ? 0 : value >= 10 ? 1 : 2;
|
|
24190
|
+
const formatted = value.toFixed(precision).replace(/\.0+$/, "");
|
|
24191
|
+
return `${formatted} ${units[index]}`;
|
|
24192
|
+
}
|
|
23851
24193
|
function emitJsonAssets(state) {
|
|
23852
24194
|
const { ctx } = state;
|
|
23853
24195
|
const { jsonService } = ctx;
|
|
@@ -23875,7 +24217,7 @@ async function flushIndependentBuilds(state) {
|
|
|
23875
24217
|
}
|
|
23876
24218
|
const outputs = await Promise.all(pendingIndependentBuilds);
|
|
23877
24219
|
for (const { rollup } of outputs) {
|
|
23878
|
-
const bundleOutputs = Array.isArray(_optionalChain([rollup, 'optionalAccess',
|
|
24220
|
+
const bundleOutputs = Array.isArray(_optionalChain([rollup, 'optionalAccess', _399 => _399.output])) ? rollup.output : [];
|
|
23879
24221
|
for (const output of bundleOutputs) {
|
|
23880
24222
|
if (output.type === "chunk") {
|
|
23881
24223
|
this.emitFile({
|
|
@@ -23912,13 +24254,13 @@ function toPosixPath(value) {
|
|
|
23912
24254
|
var styleMatcherCache = /* @__PURE__ */ new WeakMap();
|
|
23913
24255
|
function collectSharedStyleEntries(ctx, configService) {
|
|
23914
24256
|
const map = /* @__PURE__ */ new Map();
|
|
23915
|
-
const registry = _optionalChain([ctx, 'access',
|
|
23916
|
-
if (!_optionalChain([registry, 'optionalAccess',
|
|
24257
|
+
const registry = _optionalChain([ctx, 'access', _400 => _400.scanService, 'optionalAccess', _401 => _401.subPackageMap]);
|
|
24258
|
+
if (!_optionalChain([registry, 'optionalAccess', _402 => _402.size])) {
|
|
23917
24259
|
return map;
|
|
23918
24260
|
}
|
|
23919
24261
|
const currentRoot = configService.currentSubPackageRoot;
|
|
23920
24262
|
for (const [root, meta] of registry.entries()) {
|
|
23921
|
-
if (!_optionalChain([meta, 'access',
|
|
24263
|
+
if (!_optionalChain([meta, 'access', _403 => _403.styleEntries, 'optionalAccess', _404 => _404.length])) {
|
|
23922
24264
|
continue;
|
|
23923
24265
|
}
|
|
23924
24266
|
if (currentRoot && root !== currentRoot) {
|
|
@@ -23963,12 +24305,12 @@ function getStyleMatcher(entry) {
|
|
|
23963
24305
|
if (cached) {
|
|
23964
24306
|
return cached;
|
|
23965
24307
|
}
|
|
23966
|
-
const includePatterns = _optionalChain([entry, 'access',
|
|
23967
|
-
const excludePatterns = _optionalChain([entry, 'access',
|
|
24308
|
+
const includePatterns = _optionalChain([entry, 'access', _405 => _405.include, 'optionalAccess', _406 => _406.length]) ? entry.include : ["**/*"];
|
|
24309
|
+
const excludePatterns = _optionalChain([entry, 'access', _407 => _407.exclude, 'optionalAccess', _408 => _408.length]) ? entry.exclude : void 0;
|
|
23968
24310
|
const matcher = {
|
|
23969
24311
|
include: _picomatch2.default.call(void 0, includePatterns, { dot: true })
|
|
23970
24312
|
};
|
|
23971
|
-
if (_optionalChain([excludePatterns, 'optionalAccess',
|
|
24313
|
+
if (_optionalChain([excludePatterns, 'optionalAccess', _409 => _409.length])) {
|
|
23972
24314
|
matcher.exclude = _picomatch2.default.call(void 0, excludePatterns, { dot: true });
|
|
23973
24315
|
}
|
|
23974
24316
|
styleMatcherCache.set(entry, matcher);
|
|
@@ -24073,7 +24415,7 @@ function injectSharedStyleImports(css2, modulePath, fileName, sharedStyles, conf
|
|
|
24073
24415
|
}
|
|
24074
24416
|
const normalizedFileName = toPosixPath(fileName);
|
|
24075
24417
|
const entries = findSharedStylesForModule(normalizedModule, normalizedFileName, sharedStyles);
|
|
24076
|
-
if (!_optionalChain([entries, 'optionalAccess',
|
|
24418
|
+
if (!_optionalChain([entries, 'optionalAccess', _410 => _410.length])) {
|
|
24077
24419
|
return css2;
|
|
24078
24420
|
}
|
|
24079
24421
|
const specifiers = resolveImportSpecifiers(fileName, entries);
|
|
@@ -24285,14 +24627,14 @@ function createPluginPruner() {
|
|
|
24285
24627
|
name: "weapp-vite:preflight",
|
|
24286
24628
|
enforce: "pre",
|
|
24287
24629
|
configResolved(config) {
|
|
24288
|
-
if (!_optionalChain([config, 'access',
|
|
24630
|
+
if (!_optionalChain([config, 'access', _411 => _411.plugins, 'optionalAccess', _412 => _412.length])) {
|
|
24289
24631
|
return;
|
|
24290
24632
|
}
|
|
24291
24633
|
for (const removePlugin of removePlugins) {
|
|
24292
24634
|
const idx = config.plugins.findIndex((plugin) => plugin.name === removePlugin);
|
|
24293
24635
|
if (idx > -1) {
|
|
24294
24636
|
const [plugin] = config.plugins.splice(idx, 1);
|
|
24295
|
-
plugin && _optionalChain([debug3, 'optionalCall',
|
|
24637
|
+
plugin && _optionalChain([debug3, 'optionalCall', _413 => _413("remove plugin", plugin.name)]);
|
|
24296
24638
|
}
|
|
24297
24639
|
}
|
|
24298
24640
|
}
|
|
@@ -24348,8 +24690,8 @@ function createWorkerBuildPlugin(ctx) {
|
|
|
24348
24690
|
name: "weapp-vite:workers",
|
|
24349
24691
|
enforce: "pre",
|
|
24350
24692
|
async options(options) {
|
|
24351
|
-
const workerConfig = _optionalChain([configService, 'access',
|
|
24352
|
-
const entries = Array.isArray(_optionalChain([workerConfig, 'optionalAccess',
|
|
24693
|
+
const workerConfig = _optionalChain([configService, 'access', _414 => _414.weappViteConfig, 'optionalAccess', _415 => _415.worker]);
|
|
24694
|
+
const entries = Array.isArray(_optionalChain([workerConfig, 'optionalAccess', _416 => _416.entry])) ? workerConfig.entry : [_optionalChain([workerConfig, 'optionalAccess', _417 => _417.entry])];
|
|
24353
24695
|
const normalized = (await Promise.all(entries.filter(Boolean).map((entry) => resolveWorkerEntry(ctx, entry)))).filter((result) => Boolean(result.value)).reduce((acc, cur) => {
|
|
24354
24696
|
acc[cur.key] = cur.value;
|
|
24355
24697
|
return acc;
|
|
@@ -24406,7 +24748,7 @@ async function transformWxsFile(state, wxsPath) {
|
|
|
24406
24748
|
const { result, importees } = transformWxsCode(rawCode, {
|
|
24407
24749
|
filename: wxsPath
|
|
24408
24750
|
});
|
|
24409
|
-
if (typeof _optionalChain([result, 'optionalAccess',
|
|
24751
|
+
if (typeof _optionalChain([result, 'optionalAccess', _418 => _418.code]) === "string") {
|
|
24410
24752
|
code = result.code;
|
|
24411
24753
|
}
|
|
24412
24754
|
const dirname5 = _pathe2.default.dirname(wxsPath);
|
|
@@ -24483,15 +24825,25 @@ function wxs(ctx) {
|
|
|
24483
24825
|
|
|
24484
24826
|
// src/plugins/index.ts
|
|
24485
24827
|
var RUNTIME_PLUGINS_SYMBOL = Symbol.for("weapp-runtime:plugins");
|
|
24828
|
+
var WEAPP_VITE_CONTEXT_PLUGIN_NAME = "weapp-vite:context";
|
|
24829
|
+
function createContextPlugin(ctx) {
|
|
24830
|
+
return {
|
|
24831
|
+
name: WEAPP_VITE_CONTEXT_PLUGIN_NAME,
|
|
24832
|
+
enforce: "pre",
|
|
24833
|
+
api: {
|
|
24834
|
+
ctx
|
|
24835
|
+
}
|
|
24836
|
+
};
|
|
24837
|
+
}
|
|
24486
24838
|
function attachRuntimePlugins(ctx, plugins) {
|
|
24487
24839
|
const runtimePlugins = ctx[RUNTIME_PLUGINS_SYMBOL];
|
|
24488
|
-
if (!_optionalChain([runtimePlugins, 'optionalAccess',
|
|
24840
|
+
if (!_optionalChain([runtimePlugins, 'optionalAccess', _419 => _419.length])) {
|
|
24489
24841
|
return plugins;
|
|
24490
24842
|
}
|
|
24491
24843
|
return [...runtimePlugins, ...plugins];
|
|
24492
24844
|
}
|
|
24493
24845
|
function applyInspect(ctx, plugins) {
|
|
24494
|
-
const inspectOptions = _optionalChain([ctx, 'access',
|
|
24846
|
+
const inspectOptions = _optionalChain([ctx, 'access', _420 => _420.configService, 'access', _421 => _421.weappViteConfig, 'optionalAccess', _422 => _422.debug, 'optionalAccess', _423 => _423.inspect]);
|
|
24495
24847
|
if (!inspectOptions) {
|
|
24496
24848
|
return plugins;
|
|
24497
24849
|
}
|
|
@@ -24504,7 +24856,7 @@ function flatten(groups) {
|
|
|
24504
24856
|
}, []);
|
|
24505
24857
|
}
|
|
24506
24858
|
function vitePluginWeapp(ctx, subPackageMeta) {
|
|
24507
|
-
const groups = [preflight(ctx)];
|
|
24859
|
+
const groups = [[createContextPlugin(ctx)], preflight(ctx)];
|
|
24508
24860
|
if (!subPackageMeta) {
|
|
24509
24861
|
groups.push(asset(ctx), autoRoutes(ctx), autoImport(ctx));
|
|
24510
24862
|
}
|
|
@@ -24516,7 +24868,7 @@ function vitePluginWeapp(ctx, subPackageMeta) {
|
|
|
24516
24868
|
return applyInspect(ctx, assembled);
|
|
24517
24869
|
}
|
|
24518
24870
|
function vitePluginWeappWorkers(ctx) {
|
|
24519
|
-
const groups = [preflight(ctx), workers(ctx)];
|
|
24871
|
+
const groups = [[createContextPlugin(ctx)], preflight(ctx), workers(ctx)];
|
|
24520
24872
|
const assembled = attachRuntimePlugins(ctx, flatten(groups));
|
|
24521
24873
|
return applyInspect(ctx, assembled);
|
|
24522
24874
|
}
|
|
@@ -24582,7 +24934,7 @@ function createMergeFactories(options) {
|
|
|
24582
24934
|
const currentOptions = getOptions2();
|
|
24583
24935
|
applyRuntimePlatform("miniprogram");
|
|
24584
24936
|
const external = [];
|
|
24585
|
-
if (_optionalChain([currentOptions, 'access',
|
|
24937
|
+
if (_optionalChain([currentOptions, 'access', _424 => _424.packageJson, 'optionalAccess', _425 => _425.dependencies])) {
|
|
24586
24938
|
external.push(
|
|
24587
24939
|
...Object.keys(currentOptions.packageJson.dependencies).map((pkg) => {
|
|
24588
24940
|
return new RegExp(`^${pkg.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&")}(\\/|$)`);
|
|
@@ -24597,7 +24949,7 @@ function createMergeFactories(options) {
|
|
|
24597
24949
|
const watchInclude = [
|
|
24598
24950
|
_pathe2.default.join(currentOptions.cwd, currentOptions.srcRoot, "**")
|
|
24599
24951
|
];
|
|
24600
|
-
const pluginRootConfig = _optionalChain([currentOptions, 'access',
|
|
24952
|
+
const pluginRootConfig = _optionalChain([currentOptions, 'access', _426 => _426.config, 'access', _427 => _427.weapp, 'optionalAccess', _428 => _428.pluginRoot]);
|
|
24601
24953
|
if (pluginRootConfig) {
|
|
24602
24954
|
const absolutePluginRoot = _pathe2.default.resolve(currentOptions.cwd, pluginRootConfig);
|
|
24603
24955
|
const relativeToSrc = _pathe2.default.relative(
|
|
@@ -24657,7 +25009,7 @@ function createMergeFactories(options) {
|
|
|
24657
25009
|
);
|
|
24658
25010
|
inlineConfig.logLevel = "info";
|
|
24659
25011
|
injectBuiltinAliases(inlineConfig);
|
|
24660
|
-
const currentRoot = _optionalChain([subPackageMeta, 'optionalAccess',
|
|
25012
|
+
const currentRoot = _optionalChain([subPackageMeta, 'optionalAccess', _429 => _429.subPackage, 'access', _430 => _430.root]);
|
|
24661
25013
|
setOptions({
|
|
24662
25014
|
...currentOptions,
|
|
24663
25015
|
currentSubPackageRoot: currentRoot
|
|
@@ -24668,7 +25020,7 @@ function createMergeFactories(options) {
|
|
|
24668
25020
|
ensureConfigService();
|
|
24669
25021
|
const currentOptions = getOptions2();
|
|
24670
25022
|
const web = currentOptions.weappWeb;
|
|
24671
|
-
if (!_optionalChain([web, 'optionalAccess',
|
|
25023
|
+
if (!_optionalChain([web, 'optionalAccess', _431 => _431.enabled])) {
|
|
24672
25024
|
return void 0;
|
|
24673
25025
|
}
|
|
24674
25026
|
applyRuntimePlatform("web");
|
|
@@ -24759,7 +25111,7 @@ function createConfigService(ctx) {
|
|
|
24759
25111
|
defineEnv[key] = value;
|
|
24760
25112
|
}
|
|
24761
25113
|
function getDefineImportMetaEnv() {
|
|
24762
|
-
const mpPlatform = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
25114
|
+
const mpPlatform = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _432 => _432.platform]), () => ( DEFAULT_MP_PLATFORM));
|
|
24763
25115
|
const resolvedPlatform = _nullishCoalesce(defineEnv.PLATFORM, () => ( mpPlatform));
|
|
24764
25116
|
const env = {
|
|
24765
25117
|
PLATFORM: resolvedPlatform,
|
|
@@ -24775,7 +25127,7 @@ function createConfigService(ctx) {
|
|
|
24775
25127
|
}
|
|
24776
25128
|
function applyRuntimePlatform(runtime) {
|
|
24777
25129
|
const isWeb = runtime === "web";
|
|
24778
|
-
const mpPlatform = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
25130
|
+
const mpPlatform = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _433 => _433.platform]), () => ( DEFAULT_MP_PLATFORM));
|
|
24779
25131
|
const resolvedPlatform = isWeb ? "web" : mpPlatform;
|
|
24780
25132
|
setDefineEnv("PLATFORM", resolvedPlatform);
|
|
24781
25133
|
setDefineEnv("IS_WEB", isWeb);
|
|
@@ -24886,10 +25238,10 @@ function createConfigService(ctx) {
|
|
|
24886
25238
|
return options.srcRoot;
|
|
24887
25239
|
},
|
|
24888
25240
|
get pluginRoot() {
|
|
24889
|
-
return _optionalChain([options, 'access',
|
|
25241
|
+
return _optionalChain([options, 'access', _434 => _434.config, 'access', _435 => _435.weapp, 'optionalAccess', _436 => _436.pluginRoot]);
|
|
24890
25242
|
},
|
|
24891
25243
|
get absolutePluginRoot() {
|
|
24892
|
-
if (_optionalChain([options, 'access',
|
|
25244
|
+
if (_optionalChain([options, 'access', _437 => _437.config, 'access', _438 => _438.weapp, 'optionalAccess', _439 => _439.pluginRoot])) {
|
|
24893
25245
|
return _pathe2.default.resolve(options.cwd, options.config.weapp.pluginRoot);
|
|
24894
25246
|
}
|
|
24895
25247
|
},
|
|
@@ -24919,7 +25271,7 @@ function createConfigService(ctx) {
|
|
|
24919
25271
|
},
|
|
24920
25272
|
relativeAbsoluteSrcRoot(p) {
|
|
24921
25273
|
const absoluteSrcRoot = _pathe2.default.resolve(options.cwd, options.srcRoot);
|
|
24922
|
-
const pluginRootConfig = _optionalChain([options, 'access',
|
|
25274
|
+
const pluginRootConfig = _optionalChain([options, 'access', _440 => _440.config, 'access', _441 => _441.weapp, 'optionalAccess', _442 => _442.pluginRoot]);
|
|
24923
25275
|
if (pluginRootConfig) {
|
|
24924
25276
|
const absolutePluginRoot = _pathe2.default.resolve(options.cwd, pluginRootConfig);
|
|
24925
25277
|
const relativeToPlugin = _pathe2.default.relative(absolutePluginRoot, p);
|
|
@@ -24971,10 +25323,10 @@ function createJsonService(ctx) {
|
|
|
24971
25323
|
}
|
|
24972
25324
|
let resultJson;
|
|
24973
25325
|
if (/app\.json(?:\.[jt]s)?$/.test(filepath)) {
|
|
24974
|
-
await _optionalChain([ctx, 'access',
|
|
25326
|
+
await _optionalChain([ctx, 'access', _443 => _443.autoRoutesService, 'optionalAccess', _444 => _444.ensureFresh, 'call', _445 => _445()]);
|
|
24975
25327
|
}
|
|
24976
25328
|
if (/\.json\.[jt]s$/.test(filepath)) {
|
|
24977
|
-
const routesReference = _optionalChain([ctx, 'access',
|
|
25329
|
+
const routesReference = _optionalChain([ctx, 'access', _446 => _446.autoRoutesService, 'optionalAccess', _447 => _447.getReference, 'call', _448 => _448()]);
|
|
24978
25330
|
const fallbackRoutes = _nullishCoalesce(routesReference, () => ( { pages: [], entries: [], subPackages: [] }));
|
|
24979
25331
|
const routesModule = {
|
|
24980
25332
|
routes: fallbackRoutes,
|
|
@@ -25023,7 +25375,7 @@ function createJsonService(ctx) {
|
|
|
25023
25375
|
return resultJson;
|
|
25024
25376
|
} catch (error) {
|
|
25025
25377
|
logger_default.error(`\u6B8B\u7834\u7684JSON\u6587\u4EF6: ${filepath}`);
|
|
25026
|
-
_optionalChain([debug, 'optionalCall',
|
|
25378
|
+
_optionalChain([debug, 'optionalCall', _449 => _449(error)]);
|
|
25027
25379
|
}
|
|
25028
25380
|
}
|
|
25029
25381
|
function resolve8(entry) {
|
|
@@ -25078,7 +25430,7 @@ function createNpmService(ctx) {
|
|
|
25078
25430
|
if (!ctx.configService) {
|
|
25079
25431
|
throw new Error("configService must be initialized before writing npm cache");
|
|
25080
25432
|
}
|
|
25081
|
-
if (_optionalChain([ctx, 'access',
|
|
25433
|
+
if (_optionalChain([ctx, 'access', _450 => _450.configService, 'access', _451 => _451.weappViteConfig, 'optionalAccess', _452 => _452.npm, 'optionalAccess', _453 => _453.cache])) {
|
|
25082
25434
|
await _fsextra2.default.outputJSON(getDependenciesCacheFilePath(root), {
|
|
25083
25435
|
hash: dependenciesCacheHash()
|
|
25084
25436
|
});
|
|
@@ -25091,7 +25443,7 @@ function createNpmService(ctx) {
|
|
|
25091
25443
|
}
|
|
25092
25444
|
}
|
|
25093
25445
|
async function checkDependenciesCacheOutdate(root) {
|
|
25094
|
-
if (_optionalChain([ctx, 'access',
|
|
25446
|
+
if (_optionalChain([ctx, 'access', _454 => _454.configService, 'optionalAccess', _455 => _455.weappViteConfig, 'optionalAccess', _456 => _456.npm, 'optionalAccess', _457 => _457.cache])) {
|
|
25095
25447
|
const json = await readDependenciesCache(root);
|
|
25096
25448
|
if (_shared.isObject.call(void 0, json)) {
|
|
25097
25449
|
return dependenciesCacheHash() !== json.hash;
|
|
@@ -25124,7 +25476,7 @@ function createNpmService(ctx) {
|
|
|
25124
25476
|
target: "es6",
|
|
25125
25477
|
external: []
|
|
25126
25478
|
});
|
|
25127
|
-
const resolvedOptions = _optionalChain([ctx, 'access',
|
|
25479
|
+
const resolvedOptions = _optionalChain([ctx, 'access', _458 => _458.configService, 'optionalAccess', _459 => _459.weappViteConfig, 'optionalAccess', _460 => _460.npm, 'optionalAccess', _461 => _461.buildOptions, 'optionalCall', _462 => _462(
|
|
25128
25480
|
mergedOptions,
|
|
25129
25481
|
{ name, entry }
|
|
25130
25482
|
)]);
|
|
@@ -25224,7 +25576,7 @@ function createNpmService(ctx) {
|
|
|
25224
25576
|
throw new Error("configService must be initialized before resolving npm relation list");
|
|
25225
25577
|
}
|
|
25226
25578
|
let packNpmRelationList = [];
|
|
25227
|
-
if (_optionalChain([ctx, 'access',
|
|
25579
|
+
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
25580
|
packNpmRelationList = ctx.configService.projectConfig.setting.packNpmRelationList;
|
|
25229
25581
|
} else {
|
|
25230
25582
|
packNpmRelationList = [
|
|
@@ -25237,10 +25589,10 @@ function createNpmService(ctx) {
|
|
|
25237
25589
|
return packNpmRelationList;
|
|
25238
25590
|
}
|
|
25239
25591
|
async function build3(options) {
|
|
25240
|
-
if (!_optionalChain([ctx, 'access',
|
|
25592
|
+
if (!_optionalChain([ctx, 'access', _467 => _467.configService, 'optionalAccess', _468 => _468.weappViteConfig, 'optionalAccess', _469 => _469.npm, 'optionalAccess', _470 => _470.enable])) {
|
|
25241
25593
|
return;
|
|
25242
25594
|
}
|
|
25243
|
-
_optionalChain([debug, 'optionalCall',
|
|
25595
|
+
_optionalChain([debug, 'optionalCall', _471 => _471("buildNpm start")]);
|
|
25244
25596
|
const packNpmRelationList = getPackNpmRelationList();
|
|
25245
25597
|
const [mainRelation, ...subRelations] = packNpmRelationList;
|
|
25246
25598
|
const packageJsonPath = _pathe2.default.resolve(ctx.configService.cwd, mainRelation.packageJsonPath);
|
|
@@ -25315,7 +25667,7 @@ function createNpmService(ctx) {
|
|
|
25315
25667
|
}
|
|
25316
25668
|
}
|
|
25317
25669
|
}
|
|
25318
|
-
_optionalChain([debug, 'optionalCall',
|
|
25670
|
+
_optionalChain([debug, 'optionalCall', _472 => _472("buildNpm end")]);
|
|
25319
25671
|
}
|
|
25320
25672
|
return {
|
|
25321
25673
|
getDependenciesCacheFilePath,
|
|
@@ -25359,7 +25711,7 @@ var TimeoutError = (_class16 = class _TimeoutError extends Error {
|
|
|
25359
25711
|
__init36() {this.name = "TimeoutError"}
|
|
25360
25712
|
constructor(message, options) {
|
|
25361
25713
|
super(message, options);_class16.prototype.__init36.call(this);;
|
|
25362
|
-
_optionalChain([Error, 'access',
|
|
25714
|
+
_optionalChain([Error, 'access', _473 => _473.captureStackTrace, 'optionalCall', _474 => _474(this, _TimeoutError)]);
|
|
25363
25715
|
}
|
|
25364
25716
|
}, _class16);
|
|
25365
25717
|
var getAbortedReason = (signal) => _nullishCoalesce(signal.reason, () => ( new DOMException("This operation was aborted.", "AbortError")));
|
|
@@ -25377,7 +25729,7 @@ function pTimeout(promise, options) {
|
|
|
25377
25729
|
if (typeof milliseconds !== "number" || Math.sign(milliseconds) !== 1) {
|
|
25378
25730
|
throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${milliseconds}\``);
|
|
25379
25731
|
}
|
|
25380
|
-
if (_optionalChain([signal, 'optionalAccess',
|
|
25732
|
+
if (_optionalChain([signal, 'optionalAccess', _475 => _475.aborted])) {
|
|
25381
25733
|
reject(getAbortedReason(signal));
|
|
25382
25734
|
return;
|
|
25383
25735
|
}
|
|
@@ -25475,7 +25827,7 @@ var PriorityQueue = class {
|
|
|
25475
25827
|
}
|
|
25476
25828
|
dequeue() {
|
|
25477
25829
|
const item = this.#queue.shift();
|
|
25478
|
-
return _optionalChain([item, 'optionalAccess',
|
|
25830
|
+
return _optionalChain([item, 'optionalAccess', _476 => _476.run]);
|
|
25479
25831
|
}
|
|
25480
25832
|
filter(options) {
|
|
25481
25833
|
return this.#queue.filter((element) => element.priority === options.priority).map((element) => element.run);
|
|
@@ -25536,10 +25888,10 @@ var PQueue = class extends import_index2.default {
|
|
|
25536
25888
|
...options
|
|
25537
25889
|
};
|
|
25538
25890
|
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',
|
|
25891
|
+
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
25892
|
}
|
|
25541
25893
|
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',
|
|
25894
|
+
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
25895
|
}
|
|
25544
25896
|
this.#carryoverIntervalCount = _nullishCoalesce(_nullishCoalesce(options.carryoverIntervalCount, () => ( options.carryoverConcurrencyCount)), () => ( false));
|
|
25545
25897
|
this.#isIntervalIgnored = options.intervalCap === Number.POSITIVE_INFINITY || options.interval === 0;
|
|
@@ -25746,7 +26098,7 @@ var PQueue = class extends import_index2.default {
|
|
|
25746
26098
|
});
|
|
25747
26099
|
try {
|
|
25748
26100
|
try {
|
|
25749
|
-
_optionalChain([options, 'access',
|
|
26101
|
+
_optionalChain([options, 'access', _483 => _483.signal, 'optionalAccess', _484 => _484.throwIfAborted, 'call', _485 => _485()]);
|
|
25750
26102
|
} catch (error) {
|
|
25751
26103
|
if (!this.#isIntervalIgnored) {
|
|
25752
26104
|
this.#intervalCount--;
|
|
@@ -26119,7 +26471,7 @@ var FileCache = class {
|
|
|
26119
26471
|
return true;
|
|
26120
26472
|
}
|
|
26121
26473
|
const cachedMtime = this.mtimeMap.get(id);
|
|
26122
|
-
const nextSignature = _optionalChain([options, 'optionalAccess',
|
|
26474
|
+
const nextSignature = _optionalChain([options, 'optionalAccess', _486 => _486.content]) !== void 0 ? createSignature(options.content) : void 0;
|
|
26123
26475
|
const updateSignature = () => {
|
|
26124
26476
|
if (nextSignature !== void 0) {
|
|
26125
26477
|
this.signatureMap.set(id, nextSignature);
|
|
@@ -26354,7 +26706,7 @@ function coerceStyleConfig(entry) {
|
|
|
26354
26706
|
if (!entry || typeof entry !== "object") {
|
|
26355
26707
|
return void 0;
|
|
26356
26708
|
}
|
|
26357
|
-
const source = _optionalChain([entry, 'access',
|
|
26709
|
+
const source = _optionalChain([entry, 'access', _487 => _487.source, 'optionalAccess', _488 => _488.toString, 'call', _489 => _489(), 'access', _490 => _490.trim, 'call', _491 => _491()]);
|
|
26358
26710
|
if (!source) {
|
|
26359
26711
|
return void 0;
|
|
26360
26712
|
}
|
|
@@ -26530,7 +26882,7 @@ function normalizeSubPackageStyleEntries(styles, subPackage, configService) {
|
|
|
26530
26882
|
if (!service) {
|
|
26531
26883
|
return void 0;
|
|
26532
26884
|
}
|
|
26533
|
-
const root = _optionalChain([subPackage, 'access',
|
|
26885
|
+
const root = _optionalChain([subPackage, 'access', _492 => _492.root, 'optionalAccess', _493 => _493.trim, 'call', _494 => _494()]);
|
|
26534
26886
|
if (!root) {
|
|
26535
26887
|
return void 0;
|
|
26536
26888
|
}
|
|
@@ -26638,7 +26990,7 @@ function createScanService(ctx) {
|
|
|
26638
26990
|
if (!ctx.configService) {
|
|
26639
26991
|
throw new Error("configService must be initialized before scanning subpackages");
|
|
26640
26992
|
}
|
|
26641
|
-
const json = _optionalChain([scanState, 'access',
|
|
26993
|
+
const json = _optionalChain([scanState, 'access', _495 => _495.appEntry, 'optionalAccess', _496 => _496.json]);
|
|
26642
26994
|
if (scanState.isDirty || subPackageMap.size === 0) {
|
|
26643
26995
|
subPackageMap.clear();
|
|
26644
26996
|
independentSubPackageMap.clear();
|
|
@@ -26656,15 +27008,15 @@ function createScanService(ctx) {
|
|
|
26656
27008
|
subPackage,
|
|
26657
27009
|
entries: resolveSubPackageEntries(subPackage)
|
|
26658
27010
|
};
|
|
26659
|
-
const subPackageConfig = _optionalChain([ctx, 'access',
|
|
26660
|
-
meta.subPackage.dependencies = _optionalChain([subPackageConfig, 'optionalAccess',
|
|
26661
|
-
meta.subPackage.inlineConfig = _optionalChain([subPackageConfig, 'optionalAccess',
|
|
27011
|
+
const subPackageConfig = _optionalChain([ctx, 'access', _497 => _497.configService, 'access', _498 => _498.weappViteConfig, 'optionalAccess', _499 => _499.subPackages, 'optionalAccess', _500 => _500[subPackage.root]]);
|
|
27012
|
+
meta.subPackage.dependencies = _optionalChain([subPackageConfig, 'optionalAccess', _501 => _501.dependencies]);
|
|
27013
|
+
meta.subPackage.inlineConfig = _optionalChain([subPackageConfig, 'optionalAccess', _502 => _502.inlineConfig]);
|
|
26662
27014
|
meta.styleEntries = normalizeSubPackageStyleEntries(
|
|
26663
|
-
_optionalChain([subPackageConfig, 'optionalAccess',
|
|
27015
|
+
_optionalChain([subPackageConfig, 'optionalAccess', _503 => _503.styles]),
|
|
26664
27016
|
subPackage,
|
|
26665
27017
|
ctx.configService
|
|
26666
27018
|
);
|
|
26667
|
-
meta.watchSharedStyles = _nullishCoalesce(_optionalChain([subPackageConfig, 'optionalAccess',
|
|
27019
|
+
meta.watchSharedStyles = _nullishCoalesce(_optionalChain([subPackageConfig, 'optionalAccess', _504 => _504.watchSharedStyles]), () => ( true));
|
|
26668
27020
|
metas.push(meta);
|
|
26669
27021
|
if (subPackage.root) {
|
|
26670
27022
|
subPackageMap.set(subPackage.root, meta);
|
|
@@ -26720,11 +27072,11 @@ function createScanService(ctx) {
|
|
|
26720
27072
|
loadSubPackages,
|
|
26721
27073
|
isMainPackageFileName,
|
|
26722
27074
|
get workersOptions() {
|
|
26723
|
-
return _optionalChain([scanState, 'access',
|
|
27075
|
+
return _optionalChain([scanState, 'access', _505 => _505.appEntry, 'optionalAccess', _506 => _506.json, 'optionalAccess', _507 => _507.workers]);
|
|
26724
27076
|
},
|
|
26725
27077
|
get workersDir() {
|
|
26726
|
-
const workersOptions = _optionalChain([scanState, 'access',
|
|
26727
|
-
return typeof workersOptions === "object" ? _optionalChain([workersOptions, 'optionalAccess',
|
|
27078
|
+
const workersOptions = _optionalChain([scanState, 'access', _508 => _508.appEntry, 'optionalAccess', _509 => _509.json, 'optionalAccess', _510 => _510.workers]);
|
|
27079
|
+
return typeof workersOptions === "object" ? _optionalChain([workersOptions, 'optionalAccess', _511 => _511.path]) : workersOptions;
|
|
26728
27080
|
},
|
|
26729
27081
|
markDirty() {
|
|
26730
27082
|
scanState.isDirty = true;
|
|
@@ -26771,7 +27123,7 @@ function createWatcherService(ctx) {
|
|
|
26771
27123
|
},
|
|
26772
27124
|
setRollupWatcher(watcher, root = "/") {
|
|
26773
27125
|
const oldWatcher = rollupWatcherMap.get(root);
|
|
26774
|
-
_optionalChain([oldWatcher, 'optionalAccess',
|
|
27126
|
+
_optionalChain([oldWatcher, 'optionalAccess', _512 => _512.close, 'call', _513 => _513()]);
|
|
26775
27127
|
rollupWatcherMap.set(root, watcher);
|
|
26776
27128
|
},
|
|
26777
27129
|
closeAll() {
|
|
@@ -26784,7 +27136,7 @@ function createWatcherService(ctx) {
|
|
|
26784
27136
|
});
|
|
26785
27137
|
});
|
|
26786
27138
|
sidecarWatcherMap.clear();
|
|
26787
|
-
void _optionalChain([ctx, 'access',
|
|
27139
|
+
void _optionalChain([ctx, 'access', _514 => _514.webService, 'optionalAccess', _515 => _515.close, 'call', _516 => _516(), 'access', _517 => _517.catch, 'call', _518 => _518(() => {
|
|
26788
27140
|
})]);
|
|
26789
27141
|
},
|
|
26790
27142
|
close(root = "/") {
|
|
@@ -26800,7 +27152,7 @@ function createWatcherService(ctx) {
|
|
|
26800
27152
|
sidecarWatcherMap.delete(root);
|
|
26801
27153
|
}
|
|
26802
27154
|
if (rollupWatcherMap.size === 0 && sidecarWatcherMap.size === 0) {
|
|
26803
|
-
void _optionalChain([ctx, 'access',
|
|
27155
|
+
void _optionalChain([ctx, 'access', _519 => _519.webService, 'optionalAccess', _520 => _520.close, 'call', _521 => _521(), 'access', _522 => _522.catch, 'call', _523 => _523(() => {
|
|
26804
27156
|
})]);
|
|
26805
27157
|
}
|
|
26806
27158
|
}
|
|
@@ -26813,7 +27165,7 @@ function createWatcherServicePlugin(ctx) {
|
|
|
26813
27165
|
name: "weapp-runtime:watcher-service",
|
|
26814
27166
|
closeBundle() {
|
|
26815
27167
|
const configService = ctx.configService;
|
|
26816
|
-
const isWatchMode = _optionalChain([configService, 'optionalAccess',
|
|
27168
|
+
const isWatchMode = _optionalChain([configService, 'optionalAccess', _524 => _524.isDev]) || Boolean(_optionalChain([configService, 'optionalAccess', _525 => _525.inlineConfig, 'optionalAccess', _526 => _526.build, 'optionalAccess', _527 => _527.watch]));
|
|
26817
27169
|
if (!isWatchMode) {
|
|
26818
27170
|
service.closeAll();
|
|
26819
27171
|
}
|
|
@@ -26830,10 +27182,10 @@ function createWebService(ctx) {
|
|
|
26830
27182
|
}
|
|
26831
27183
|
let devServer;
|
|
26832
27184
|
function isEnabled() {
|
|
26833
|
-
return Boolean(_optionalChain([ctx, 'access',
|
|
27185
|
+
return Boolean(_optionalChain([ctx, 'access', _528 => _528.configService, 'optionalAccess', _529 => _529.weappWebConfig, 'optionalAccess', _530 => _530.enabled]));
|
|
26834
27186
|
}
|
|
26835
27187
|
async function startDevServer() {
|
|
26836
|
-
if (!_optionalChain([ctx, 'access',
|
|
27188
|
+
if (!_optionalChain([ctx, 'access', _531 => _531.configService, 'optionalAccess', _532 => _532.isDev])) {
|
|
26837
27189
|
return void 0;
|
|
26838
27190
|
}
|
|
26839
27191
|
if (!isEnabled()) {
|
|
@@ -26842,7 +27194,7 @@ function createWebService(ctx) {
|
|
|
26842
27194
|
if (devServer) {
|
|
26843
27195
|
return devServer;
|
|
26844
27196
|
}
|
|
26845
|
-
const inlineConfig = _optionalChain([ctx, 'access',
|
|
27197
|
+
const inlineConfig = _optionalChain([ctx, 'access', _533 => _533.configService, 'optionalAccess', _534 => _534.mergeWeb, 'call', _535 => _535()]);
|
|
26846
27198
|
if (!inlineConfig) {
|
|
26847
27199
|
return void 0;
|
|
26848
27200
|
}
|
|
@@ -26855,7 +27207,7 @@ function createWebService(ctx) {
|
|
|
26855
27207
|
if (!isEnabled()) {
|
|
26856
27208
|
return void 0;
|
|
26857
27209
|
}
|
|
26858
|
-
const inlineConfig = _optionalChain([ctx, 'access',
|
|
27210
|
+
const inlineConfig = _optionalChain([ctx, 'access', _536 => _536.configService, 'optionalAccess', _537 => _537.mergeWeb, 'call', _538 => _538()]);
|
|
26859
27211
|
if (!inlineConfig) {
|
|
26860
27212
|
return void 0;
|
|
26861
27213
|
}
|
|
@@ -26885,7 +27237,7 @@ function createWebServicePlugin(ctx) {
|
|
|
26885
27237
|
return {
|
|
26886
27238
|
name: "weapp-runtime:web-service",
|
|
26887
27239
|
async closeBundle() {
|
|
26888
|
-
if (!_optionalChain([ctx, 'access',
|
|
27240
|
+
if (!_optionalChain([ctx, 'access', _539 => _539.configService, 'optionalAccess', _540 => _540.isDev])) {
|
|
26889
27241
|
await service.close();
|
|
26890
27242
|
}
|
|
26891
27243
|
}
|
|
@@ -29534,7 +29886,7 @@ function createWxmlService(ctx) {
|
|
|
29534
29886
|
return set3;
|
|
29535
29887
|
}
|
|
29536
29888
|
function clearAll() {
|
|
29537
|
-
const currentRoot = _optionalChain([ctx, 'access',
|
|
29889
|
+
const currentRoot = _optionalChain([ctx, 'access', _541 => _541.configService, 'optionalAccess', _542 => _542.currentSubPackageRoot]);
|
|
29538
29890
|
if (!currentRoot) {
|
|
29539
29891
|
depsMap.clear();
|
|
29540
29892
|
tokenMap.clear();
|
|
@@ -29593,7 +29945,7 @@ function createWxmlService(ctx) {
|
|
|
29593
29945
|
if (!ctx.configService) {
|
|
29594
29946
|
throw new Error("configService must be initialized before scanning wxml");
|
|
29595
29947
|
}
|
|
29596
|
-
const wxmlConfig = _nullishCoalesce(_optionalChain([ctx, 'access',
|
|
29948
|
+
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
29949
|
return scanWxml(wxml, {
|
|
29598
29950
|
platform: ctx.configService.platform,
|
|
29599
29951
|
...wxmlConfig === true ? {} : wxmlConfig
|
|
@@ -29725,7 +30077,9 @@ function resetCompilerContext(key) {
|
|
|
29725
30077
|
|
|
29726
30078
|
|
|
29727
30079
|
|
|
29728
|
-
|
|
30080
|
+
|
|
30081
|
+
|
|
30082
|
+
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
30083
|
/*! Bundled license information:
|
|
29730
30084
|
|
|
29731
30085
|
chokidar/esm/index.js:
|