@rolldown/browser 1.0.0-beta.8-commit.a98d94e → 1.0.0-beta.8-commit.baf6ca1
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/browser.mjs +343 -188
- package/dist/cli.cjs +8 -7
- package/dist/cli.mjs +4 -3
- package/dist/experimental-index.cjs +3 -2
- package/dist/experimental-index.d.cts +1 -1
- package/dist/experimental-index.d.mts +1 -1
- package/dist/experimental-index.mjs +3 -2
- package/dist/filter-index.cjs +12 -0
- package/dist/filter-index.d.cts +3 -0
- package/dist/filter-index.d.mts +3 -0
- package/dist/filter-index.mjs +4 -0
- package/dist/index.cjs +4 -4
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +4 -3
- package/dist/parallel-plugin-worker.cjs +3 -2
- package/dist/parallel-plugin-worker.mjs +3 -2
- package/dist/parallel-plugin.d.cts +1 -1
- package/dist/parallel-plugin.d.mts +1 -1
- package/dist/parse-ast-index.cjs +1 -1
- package/dist/parse-ast-index.mjs +1 -1
- package/dist/rolldown-binding.wasi-browser.js +1 -0
- package/dist/rolldown-binding.wasi.cjs +1 -0
- package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
- package/dist/shared/filter-index-ChddWdsi.cjs +255 -0
- package/dist/shared/filter-index-DmisSKZF.mjs +174 -0
- package/dist/shared/{input-options.d-CMFIv0CX.d.mts → input-options.d-9IzFBPMw.d.mts} +82 -23
- package/dist/shared/{input-options.d-P0YdGzip.d.cts → input-options.d-BFt2wKBM.d.cts} +82 -23
- package/dist/shared/{src-D9guL4ht.mjs → src-DN1_B1_m.mjs} +1783 -1740
- package/dist/shared/{src-CJ9XODOK.cjs → src-glXqJCVJ.cjs} +260 -219
- package/package.json +1 -1
- /package/dist/shared/{parse-ast-index-DWHg_E7J.mjs → parse-ast-index-B5wGnMSg.mjs} +0 -0
- /package/dist/shared/{parse-ast-index-B9pj8J1q.cjs → parse-ast-index-DTWvag1h.cjs} +0 -0
- /package/dist/shared/{prompt-_yrURmmm.cjs → prompt-At99RuKY.cjs} +0 -0
- /package/dist/shared/{prompt-B7SnYdwU.mjs → prompt-BqVpALUY.mjs} +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const require_chunk = require('./chunk-qZFfknuJ.cjs');
|
|
3
|
-
const
|
|
3
|
+
const require_filter_index = require('./filter-index-ChddWdsi.cjs');
|
|
4
|
+
const require_parse_ast_index = require('./parse-ast-index-DTWvag1h.cjs');
|
|
4
5
|
const src_rolldown_binding_wasi_cjs = require_chunk.__toESM(require("../rolldown-binding.wasi.cjs"));
|
|
5
6
|
const node_path = require_chunk.__toESM(require("node:path"));
|
|
6
7
|
const __valibot_to_json_schema = require_chunk.__toESM(require("@valibot/to-json-schema"));
|
|
@@ -10,7 +11,7 @@ const node_os = require_chunk.__toESM(require("node:os"));
|
|
|
10
11
|
const node_worker_threads = require_chunk.__toESM(require("node:worker_threads"));
|
|
11
12
|
|
|
12
13
|
//#region package.json
|
|
13
|
-
var version = "1.0.0-beta.8-commit.
|
|
14
|
+
var version = "1.0.0-beta.8-commit.baf6ca1";
|
|
14
15
|
var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
|
|
15
16
|
|
|
16
17
|
//#endregion
|
|
@@ -97,30 +98,6 @@ function isolatedDeclarationPlugin(config) {
|
|
|
97
98
|
return new BuiltinPlugin("builtin:isolated-declaration", config);
|
|
98
99
|
}
|
|
99
100
|
|
|
100
|
-
//#endregion
|
|
101
|
-
//#region src/utils/misc.ts
|
|
102
|
-
function arraify(value) {
|
|
103
|
-
return Array.isArray(value) ? value : [value];
|
|
104
|
-
}
|
|
105
|
-
function isNullish(value) {
|
|
106
|
-
return value === null || value === void 0;
|
|
107
|
-
}
|
|
108
|
-
function isPromiseLike(value) {
|
|
109
|
-
return value && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
|
|
110
|
-
}
|
|
111
|
-
function unimplemented(info) {
|
|
112
|
-
if (info) throw new Error(`unimplemented: ${info}`);
|
|
113
|
-
throw new Error("unimplemented");
|
|
114
|
-
}
|
|
115
|
-
function unreachable(info) {
|
|
116
|
-
if (info) throw new Error(`unreachable: ${info}`);
|
|
117
|
-
throw new Error("unreachable");
|
|
118
|
-
}
|
|
119
|
-
function unsupported(info) {
|
|
120
|
-
throw new Error(`UNSUPPORTED: ${info}`);
|
|
121
|
-
}
|
|
122
|
-
function noop(..._args) {}
|
|
123
|
-
|
|
124
101
|
//#endregion
|
|
125
102
|
//#region src/log/logging.ts
|
|
126
103
|
const LOG_LEVEL_SILENT = "silent";
|
|
@@ -138,13 +115,13 @@ const logLevelPriority = {
|
|
|
138
115
|
//#endregion
|
|
139
116
|
//#region src/log/log-handler.ts
|
|
140
117
|
const normalizeLog = (log) => typeof log === "string" ? { message: log } : typeof log === "function" ? normalizeLog(log()) : log;
|
|
141
|
-
function getLogHandler(level, code, logger, pluginName, logLevel) {
|
|
142
|
-
if (logLevelPriority[level] < logLevelPriority[logLevel]) return noop;
|
|
118
|
+
function getLogHandler(level, code$1, logger, pluginName, logLevel) {
|
|
119
|
+
if (logLevelPriority[level] < logLevelPriority[logLevel]) return require_filter_index.noop;
|
|
143
120
|
return (log, pos) => {
|
|
144
121
|
if (pos != null) logger(LOG_LEVEL_WARN, require_parse_ast_index.logInvalidLogPosition(pluginName));
|
|
145
122
|
log = normalizeLog(log);
|
|
146
123
|
if (log.code && !log.pluginCode) log.pluginCode = log.code;
|
|
147
|
-
log.code = code;
|
|
124
|
+
log.code = code$1;
|
|
148
125
|
log.plugin = pluginName;
|
|
149
126
|
logger(level, log);
|
|
150
127
|
};
|
|
@@ -221,9 +198,9 @@ const getExtendedLogMessage = (log) => {
|
|
|
221
198
|
if (log.loc) prefix += `${relativeId(log.loc.file)} (${log.loc.line}:${log.loc.column}) `;
|
|
222
199
|
return prefix + log.message;
|
|
223
200
|
};
|
|
224
|
-
function relativeId(id) {
|
|
225
|
-
if (!node_path.default.isAbsolute(id)) return id;
|
|
226
|
-
return node_path.default.relative(node_path.default.resolve(), id);
|
|
201
|
+
function relativeId(id$1) {
|
|
202
|
+
if (!node_path.default.isAbsolute(id$1)) return id$1;
|
|
203
|
+
return node_path.default.relative(node_path.default.resolve(), id$1);
|
|
227
204
|
}
|
|
228
205
|
|
|
229
206
|
//#endregion
|
|
@@ -242,7 +219,7 @@ function normalizeHook(hook) {
|
|
|
242
219
|
meta: { order }
|
|
243
220
|
};
|
|
244
221
|
}
|
|
245
|
-
unreachable("Invalid hook type");
|
|
222
|
+
require_filter_index.unreachable("Invalid hook type");
|
|
246
223
|
}
|
|
247
224
|
|
|
248
225
|
//#endregion
|
|
@@ -797,7 +774,7 @@ function validateOption(key, options) {
|
|
|
797
774
|
const issuePaths = issue.path.map((path$2) => path$2.key);
|
|
798
775
|
let issueMsg = issue.message;
|
|
799
776
|
if (issue.type === "union") {
|
|
800
|
-
const subIssue = issue.issues?.find((i) => !(i.type !== issue.received && i.input === issue.input));
|
|
777
|
+
const subIssue = issue.issues?.find((i$1) => !(i$1.type !== issue.received && i$1.input === issue.input));
|
|
801
778
|
if (subIssue) {
|
|
802
779
|
if (subIssue.path) issuePaths.push(subIssue.path.map((path$2) => path$2.key));
|
|
803
780
|
issueMsg = subIssue.message;
|
|
@@ -878,13 +855,13 @@ function normalizeErrors(rawErrors) {
|
|
|
878
855
|
stack: void 0
|
|
879
856
|
}));
|
|
880
857
|
let summary = `Build failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
|
|
881
|
-
for (let i = 0; i < errors.length; i++) {
|
|
858
|
+
for (let i$1 = 0; i$1 < errors.length; i$1++) {
|
|
882
859
|
summary += "\n";
|
|
883
|
-
if (i >= 5) {
|
|
860
|
+
if (i$1 >= 5) {
|
|
884
861
|
summary += "...";
|
|
885
862
|
break;
|
|
886
863
|
}
|
|
887
|
-
summary += getErrorMessage(errors[i]);
|
|
864
|
+
summary += getErrorMessage(errors[i$1]);
|
|
888
865
|
}
|
|
889
866
|
const wrapper = new Error(summary);
|
|
890
867
|
Object.defineProperty(wrapper, "errors", {
|
|
@@ -903,9 +880,9 @@ function getErrorMessage(e) {
|
|
|
903
880
|
if (Object.hasOwn(e, "kind")) return e.message;
|
|
904
881
|
let s = "";
|
|
905
882
|
if (e.plugin) s += `[plugin ${e.plugin}]`;
|
|
906
|
-
const id = e.id ?? e.loc?.file;
|
|
907
|
-
if (id) {
|
|
908
|
-
s += " " + id;
|
|
883
|
+
const id$1 = e.id ?? e.loc?.file;
|
|
884
|
+
if (id$1) {
|
|
885
|
+
s += " " + id$1;
|
|
909
886
|
if (e.loc) s += `:${e.loc.line}:${e.loc.column}`;
|
|
910
887
|
}
|
|
911
888
|
if (s) s += "\n";
|
|
@@ -924,7 +901,7 @@ function joinNewLine(s1, s2) {
|
|
|
924
901
|
function transformModuleInfo(info, option) {
|
|
925
902
|
return {
|
|
926
903
|
get ast() {
|
|
927
|
-
return unsupported("ModuleInfo#ast");
|
|
904
|
+
return require_filter_index.unsupported("ModuleInfo#ast");
|
|
928
905
|
},
|
|
929
906
|
get code() {
|
|
930
907
|
return info.code;
|
|
@@ -960,41 +937,175 @@ function isEmptySourcemapFiled(array) {
|
|
|
960
937
|
if (array.length === 0 || !array[0]) return true;
|
|
961
938
|
return false;
|
|
962
939
|
}
|
|
963
|
-
function normalizeTransformHookSourcemap(id, originalCode, rawMap) {
|
|
940
|
+
function normalizeTransformHookSourcemap(id$1, originalCode, rawMap) {
|
|
964
941
|
if (!rawMap) return;
|
|
965
942
|
let map = typeof rawMap === "object" ? rawMap : JSON.parse(rawMap);
|
|
966
943
|
if (isEmptySourcemapFiled(map.sourcesContent)) map.sourcesContent = [originalCode];
|
|
967
|
-
if (isEmptySourcemapFiled(map.sources) || map.sources && map.sources.length === 1 && map.sources[0] !== id) map.sources = [id];
|
|
944
|
+
if (isEmptySourcemapFiled(map.sources) || map.sources && map.sources.length === 1 && map.sources[0] !== id$1) map.sources = [id$1];
|
|
968
945
|
return map;
|
|
969
946
|
}
|
|
970
947
|
|
|
948
|
+
//#endregion
|
|
949
|
+
//#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-D6FCK2GA.js
|
|
950
|
+
function u$1(o, n, a) {
|
|
951
|
+
let t$1 = (r) => o(r, ...n);
|
|
952
|
+
return a === void 0 ? t$1 : Object.assign(t$1, {
|
|
953
|
+
lazy: a,
|
|
954
|
+
lazyArgs: n
|
|
955
|
+
});
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
//#endregion
|
|
959
|
+
//#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-WIMGWYZL.js
|
|
960
|
+
function u(r, n, o) {
|
|
961
|
+
let a = r.length - n.length;
|
|
962
|
+
if (a === 0) return r(...n);
|
|
963
|
+
if (a === 1) return u$1(r, n, o);
|
|
964
|
+
throw new Error("Wrong number of arguments");
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
//#endregion
|
|
968
|
+
//#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-3IFJP4R5.js
|
|
969
|
+
function d(...r) {
|
|
970
|
+
return u(i, r);
|
|
971
|
+
}
|
|
972
|
+
var i = (r, t$1) => {
|
|
973
|
+
let a = [[], []];
|
|
974
|
+
for (let [o, e] of r.entries()) t$1(e, o, r) ? a[0].push(e) : a[1].push(e);
|
|
975
|
+
return a;
|
|
976
|
+
};
|
|
977
|
+
|
|
978
|
+
//#endregion
|
|
979
|
+
//#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-5NQBDF4H.js
|
|
980
|
+
function t(...n) {
|
|
981
|
+
return u(Object.keys, n);
|
|
982
|
+
}
|
|
983
|
+
|
|
971
984
|
//#endregion
|
|
972
985
|
//#region src/plugin/bindingify-hook-filter.ts
|
|
973
|
-
function
|
|
974
|
-
if (typeof matcher === "string" || matcher instanceof RegExp) return
|
|
975
|
-
if (Array.isArray(matcher)) return
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
986
|
+
function generalHookFilterMatcherToFilterExprs(matcher, stringKind) {
|
|
987
|
+
if (typeof matcher === "string" || matcher instanceof RegExp) return [require_filter_index.include(require_filter_index.id(matcher))];
|
|
988
|
+
if (Array.isArray(matcher)) return matcher.map((m) => require_filter_index.include(require_filter_index.id(m)));
|
|
989
|
+
let ret = [];
|
|
990
|
+
let isCode = stringKind === "code";
|
|
991
|
+
if (matcher.exclude) ret.push(...require_filter_index.arraify(matcher.exclude).map((m) => require_filter_index.exclude(isCode ? require_filter_index.code(m) : require_filter_index.id(m))));
|
|
992
|
+
if (matcher.include) ret.push(...require_filter_index.arraify(matcher.include).map((m) => require_filter_index.include(isCode ? require_filter_index.code(m) : require_filter_index.id(m))));
|
|
993
|
+
return ret;
|
|
994
|
+
}
|
|
995
|
+
function transformFilterMatcherToFilterExprs(filterOption) {
|
|
996
|
+
if (!filterOption) return void 0;
|
|
997
|
+
if (Array.isArray(filterOption)) return filterOption;
|
|
998
|
+
const { id: id$1, code: code$1, moduleType: moduleType$1 } = filterOption;
|
|
999
|
+
let ret = [];
|
|
1000
|
+
let idIncludes = [];
|
|
1001
|
+
let idExcludes = [];
|
|
1002
|
+
let codeIncludes = [];
|
|
1003
|
+
let codeExcludes = [];
|
|
1004
|
+
if (id$1) [idIncludes, idExcludes] = d(generalHookFilterMatcherToFilterExprs(id$1, "id") ?? [], (m) => m.kind === "include");
|
|
1005
|
+
if (code$1) [codeIncludes, codeExcludes] = d(generalHookFilterMatcherToFilterExprs(code$1, "code") ?? [], (m) => m.kind === "include");
|
|
1006
|
+
ret.push(...idExcludes);
|
|
1007
|
+
ret.push(...codeExcludes);
|
|
1008
|
+
let andExprList = [];
|
|
1009
|
+
if (moduleType$1) {
|
|
1010
|
+
let moduleTypes = Array.isArray(moduleType$1) ? moduleType$1 : moduleType$1.include ?? [];
|
|
1011
|
+
andExprList.push(require_filter_index.or(...moduleTypes.map((m) => require_filter_index.moduleType(m))));
|
|
1012
|
+
}
|
|
1013
|
+
if (idIncludes.length) andExprList.push(require_filter_index.or(...idIncludes.map((item) => item.expr)));
|
|
1014
|
+
if (codeIncludes.length) andExprList.push(require_filter_index.or(...codeIncludes.map((item) => item.expr)));
|
|
1015
|
+
if (andExprList.length) ret.push(require_filter_index.include(require_filter_index.and(...andExprList)));
|
|
1016
|
+
return ret;
|
|
1017
|
+
}
|
|
1018
|
+
function bindingifyGeneralHookFilter(stringKind, pattern) {
|
|
1019
|
+
let filterExprs = generalHookFilterMatcherToFilterExprs(pattern, stringKind);
|
|
1020
|
+
let ret = [];
|
|
1021
|
+
if (filterExprs) ret = filterExprs.map(bindingifyFilterExpr);
|
|
1022
|
+
return ret.length > 0 ? { value: ret } : void 0;
|
|
1023
|
+
}
|
|
1024
|
+
function bindingifyFilterExpr(expr) {
|
|
1025
|
+
let list = [];
|
|
1026
|
+
bindingifyFilterExprImpl(expr, list);
|
|
1027
|
+
return list;
|
|
1028
|
+
}
|
|
1029
|
+
function bindingifyFilterExprImpl(expr, list) {
|
|
1030
|
+
switch (expr.kind) {
|
|
1031
|
+
case "and": {
|
|
1032
|
+
let args = expr.args;
|
|
1033
|
+
for (let i$1 = args.length - 1; i$1 >= 0; i$1--) bindingifyFilterExprImpl(args[i$1], list);
|
|
1034
|
+
list.push({
|
|
1035
|
+
kind: "And",
|
|
1036
|
+
payload: args.length
|
|
1037
|
+
});
|
|
1038
|
+
break;
|
|
1039
|
+
}
|
|
1040
|
+
case "or": {
|
|
1041
|
+
let args = expr.args;
|
|
1042
|
+
for (let i$1 = args.length - 1; i$1 >= 0; i$1--) bindingifyFilterExprImpl(args[i$1], list);
|
|
1043
|
+
list.push({
|
|
1044
|
+
kind: "Or",
|
|
1045
|
+
payload: args.length
|
|
1046
|
+
});
|
|
1047
|
+
break;
|
|
1048
|
+
}
|
|
1049
|
+
case "not": {
|
|
1050
|
+
bindingifyFilterExprImpl(expr.expr, list);
|
|
1051
|
+
list.push({ kind: "Not" });
|
|
1052
|
+
break;
|
|
1053
|
+
}
|
|
1054
|
+
case "id": {
|
|
1055
|
+
list.push({
|
|
1056
|
+
kind: "Id",
|
|
1057
|
+
payload: expr.pattern
|
|
1058
|
+
});
|
|
1059
|
+
break;
|
|
1060
|
+
}
|
|
1061
|
+
case "moduleType": {
|
|
1062
|
+
list.push({
|
|
1063
|
+
kind: "ModuleType",
|
|
1064
|
+
payload: expr.pattern
|
|
1065
|
+
});
|
|
1066
|
+
break;
|
|
1067
|
+
}
|
|
1068
|
+
case "code": {
|
|
1069
|
+
list.push({
|
|
1070
|
+
kind: "Code",
|
|
1071
|
+
payload: expr.pattern
|
|
1072
|
+
});
|
|
1073
|
+
break;
|
|
1074
|
+
}
|
|
1075
|
+
case "include": {
|
|
1076
|
+
bindingifyFilterExprImpl(expr.expr, list);
|
|
1077
|
+
list.push({ kind: "Include" });
|
|
1078
|
+
break;
|
|
1079
|
+
}
|
|
1080
|
+
case "exclude": {
|
|
1081
|
+
bindingifyFilterExprImpl(expr.expr, list);
|
|
1082
|
+
list.push({ kind: "Exclude" });
|
|
1083
|
+
break;
|
|
1084
|
+
}
|
|
1085
|
+
default: throw new Error(`Unknown filter expression: ${expr}`);
|
|
1086
|
+
}
|
|
980
1087
|
}
|
|
981
1088
|
function bindingifyResolveIdFilter(filterOption) {
|
|
982
|
-
|
|
1089
|
+
if (!filterOption) return void 0;
|
|
1090
|
+
if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
|
|
1091
|
+
return filterOption.id ? bindingifyGeneralHookFilter("id", filterOption.id) : void 0;
|
|
983
1092
|
}
|
|
984
1093
|
function bindingifyLoadFilter(filterOption) {
|
|
985
|
-
|
|
1094
|
+
if (!filterOption) return void 0;
|
|
1095
|
+
if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
|
|
1096
|
+
return filterOption.id ? bindingifyGeneralHookFilter("id", filterOption.id) : void 0;
|
|
986
1097
|
}
|
|
987
1098
|
function bindingifyTransformFilter(filterOption) {
|
|
988
1099
|
if (!filterOption) return void 0;
|
|
989
|
-
|
|
990
|
-
let
|
|
991
|
-
if (
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
1100
|
+
let filterExprs = transformFilterMatcherToFilterExprs(filterOption);
|
|
1101
|
+
let ret = [];
|
|
1102
|
+
if (filterExprs) ret = filterExprs.map(bindingifyFilterExpr);
|
|
1103
|
+
return { value: ret.length > 0 ? ret : void 0 };
|
|
1104
|
+
}
|
|
1105
|
+
function bindingifyRenderChunkFilter(filterOption) {
|
|
1106
|
+
if (!filterOption) return void 0;
|
|
1107
|
+
if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
|
|
1108
|
+
return filterOption.code ? bindingifyGeneralHookFilter("code", filterOption.code) : void 0;
|
|
998
1109
|
}
|
|
999
1110
|
|
|
1000
1111
|
//#endregion
|
|
@@ -1032,39 +1143,37 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
|
|
|
1032
1143
|
this.data = data;
|
|
1033
1144
|
this.onLog = onLog;
|
|
1034
1145
|
this.currentLoadingModule = currentLoadingModule;
|
|
1035
|
-
this.getModuleInfo = (id) => this.data.getModuleInfo(id, context);
|
|
1146
|
+
this.getModuleInfo = (id$1) => this.data.getModuleInfo(id$1, context);
|
|
1036
1147
|
}
|
|
1037
1148
|
async load(options) {
|
|
1038
|
-
const id = options.id;
|
|
1039
|
-
if (id === this.currentLoadingModule) this.onLog(LOG_LEVEL_WARN, require_parse_ast_index.logCycleLoading(this.pluginName, this.currentLoadingModule));
|
|
1040
|
-
const moduleInfo = this.data.getModuleInfo(id, this.context);
|
|
1149
|
+
const id$1 = options.id;
|
|
1150
|
+
if (id$1 === this.currentLoadingModule) this.onLog(LOG_LEVEL_WARN, require_parse_ast_index.logCycleLoading(this.pluginName, this.currentLoadingModule));
|
|
1151
|
+
const moduleInfo = this.data.getModuleInfo(id$1, this.context);
|
|
1041
1152
|
if (moduleInfo && moduleInfo.code !== null) return moduleInfo;
|
|
1042
1153
|
const rawOptions = {
|
|
1043
1154
|
meta: options.meta || {},
|
|
1044
1155
|
moduleSideEffects: options.moduleSideEffects || null,
|
|
1045
1156
|
invalidate: false
|
|
1046
1157
|
};
|
|
1047
|
-
this.data.updateModuleOption(id, rawOptions);
|
|
1158
|
+
this.data.updateModuleOption(id$1, rawOptions);
|
|
1048
1159
|
async function createLoadModulePromise(context, data) {
|
|
1049
|
-
const loadPromise = data.loadModulePromiseMap.get(id);
|
|
1160
|
+
const loadPromise = data.loadModulePromiseMap.get(id$1);
|
|
1050
1161
|
if (loadPromise) return loadPromise;
|
|
1051
|
-
let resolveFn;
|
|
1052
1162
|
const promise = new Promise((resolve, _) => {
|
|
1053
|
-
|
|
1163
|
+
data.loadModulePromiseResolveFnMap.set(id$1, resolve);
|
|
1054
1164
|
});
|
|
1055
|
-
data.loadModulePromiseMap.set(id, promise);
|
|
1165
|
+
data.loadModulePromiseMap.set(id$1, promise);
|
|
1056
1166
|
try {
|
|
1057
|
-
await context.load(id, bindingifySideEffects(options.moduleSideEffects)
|
|
1058
|
-
resolveFn();
|
|
1059
|
-
});
|
|
1167
|
+
await context.load(id$1, bindingifySideEffects(options.moduleSideEffects));
|
|
1060
1168
|
} catch (e) {
|
|
1061
|
-
data.loadModulePromiseMap.delete(id);
|
|
1169
|
+
data.loadModulePromiseMap.delete(id$1);
|
|
1170
|
+
data.loadModulePromiseResolveFnMap.delete(id$1);
|
|
1062
1171
|
throw e;
|
|
1063
1172
|
}
|
|
1064
1173
|
return promise;
|
|
1065
1174
|
}
|
|
1066
1175
|
await createLoadModulePromise(this.context, this.data);
|
|
1067
|
-
return this.data.getModuleInfo(id, this.context);
|
|
1176
|
+
return this.data.getModuleInfo(id$1, this.context);
|
|
1068
1177
|
}
|
|
1069
1178
|
async resolve(source, importer, options) {
|
|
1070
1179
|
let receipt = void 0;
|
|
@@ -1078,12 +1187,12 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
|
|
|
1078
1187
|
const info = this.data.getModuleOption(res.id) || {};
|
|
1079
1188
|
return {
|
|
1080
1189
|
...res,
|
|
1081
|
-
external: res.external === "relative" ? unreachable(`The PluginContext resolve result external couldn't be 'relative'`) : res.external,
|
|
1190
|
+
external: res.external === "relative" ? require_filter_index.unreachable(`The PluginContext resolve result external couldn't be 'relative'`) : res.external,
|
|
1082
1191
|
...info
|
|
1083
1192
|
};
|
|
1084
1193
|
}
|
|
1085
1194
|
emitFile = (file) => {
|
|
1086
|
-
if (file.type === "prebuilt-chunk") return unimplemented("PluginContext.emitFile with type prebuilt-chunk");
|
|
1195
|
+
if (file.type === "prebuilt-chunk") return require_filter_index.unimplemented("PluginContext.emitFile with type prebuilt-chunk");
|
|
1087
1196
|
if (file.type === "chunk") return this.context.emitChunk(file);
|
|
1088
1197
|
const fnSanitizedFileName = file.fileName || typeof this.outputOptions.sanitizeFileName !== "function" ? void 0 : this.outputOptions.sanitizeFileName(file.name || "asset");
|
|
1089
1198
|
const filename = file.fileName ? void 0 : this.getAssetFileNames(file);
|
|
@@ -1107,8 +1216,8 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
|
|
|
1107
1216
|
getModuleIds() {
|
|
1108
1217
|
return this.data.getModuleIds(this.context);
|
|
1109
1218
|
}
|
|
1110
|
-
addWatchFile(id) {
|
|
1111
|
-
this.context.addWatchFile(id);
|
|
1219
|
+
addWatchFile(id$1) {
|
|
1220
|
+
this.context.addWatchFile(id$1);
|
|
1112
1221
|
}
|
|
1113
1222
|
parse(input, options) {
|
|
1114
1223
|
return require_parse_ast_index.parseAst(input, options);
|
|
@@ -1242,18 +1351,18 @@ function bindingifyTransform(args) {
|
|
|
1242
1351
|
if (!hook) return {};
|
|
1243
1352
|
const { handler, meta, options } = normalizeHook(hook);
|
|
1244
1353
|
return {
|
|
1245
|
-
plugin: async (ctx, code, id, meta$1) => {
|
|
1246
|
-
const ret = await handler.call(new TransformPluginContextImpl(args.outputOptions, ctx.inner(), args.plugin, args.pluginContextData, ctx, id, code, args.onLog, args.logLevel, args.watchMode), code, id, meta$1);
|
|
1354
|
+
plugin: async (ctx, code$1, id$1, meta$1) => {
|
|
1355
|
+
const ret = await handler.call(new TransformPluginContextImpl(args.outputOptions, ctx.inner(), args.plugin, args.pluginContextData, ctx, id$1, code$1, args.onLog, args.logLevel, args.watchMode), code$1, id$1, meta$1);
|
|
1247
1356
|
if (ret == null) return void 0;
|
|
1248
1357
|
if (typeof ret === "string") return { code: ret };
|
|
1249
|
-
let moduleOption = args.pluginContextData.updateModuleOption(id, {
|
|
1358
|
+
let moduleOption = args.pluginContextData.updateModuleOption(id$1, {
|
|
1250
1359
|
meta: ret.meta ?? {},
|
|
1251
1360
|
moduleSideEffects: ret.moduleSideEffects ?? null,
|
|
1252
1361
|
invalidate: false
|
|
1253
1362
|
});
|
|
1254
1363
|
return {
|
|
1255
1364
|
code: ret.code,
|
|
1256
|
-
map: bindingifySourcemap$1(normalizeTransformHookSourcemap(id, code, ret.map)),
|
|
1365
|
+
map: bindingifySourcemap$1(normalizeTransformHookSourcemap(id$1, code$1, ret.map)),
|
|
1257
1366
|
sideEffects: bindingifySideEffects(moduleOption.moduleSideEffects),
|
|
1258
1367
|
moduleType: ret.moduleType
|
|
1259
1368
|
};
|
|
@@ -1267,16 +1376,16 @@ function bindingifyLoad(args) {
|
|
|
1267
1376
|
if (!hook) return {};
|
|
1268
1377
|
const { handler, meta, options } = normalizeHook(hook);
|
|
1269
1378
|
return {
|
|
1270
|
-
plugin: async (ctx, id) => {
|
|
1271
|
-
const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode, id), id);
|
|
1379
|
+
plugin: async (ctx, id$1) => {
|
|
1380
|
+
const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode, id$1), id$1);
|
|
1272
1381
|
if (ret == null) return;
|
|
1273
1382
|
if (typeof ret === "string") return { code: ret };
|
|
1274
|
-
let moduleOption = args.pluginContextData.updateModuleOption(id, {
|
|
1383
|
+
let moduleOption = args.pluginContextData.updateModuleOption(id$1, {
|
|
1275
1384
|
meta: ret.meta || {},
|
|
1276
1385
|
moduleSideEffects: ret.moduleSideEffects ?? null,
|
|
1277
1386
|
invalidate: false
|
|
1278
1387
|
});
|
|
1279
|
-
let map = preProcessSourceMap(ret, id);
|
|
1388
|
+
let map = preProcessSourceMap(ret, id$1);
|
|
1280
1389
|
return {
|
|
1281
1390
|
code: ret.code,
|
|
1282
1391
|
map: bindingifySourcemap$1(map),
|
|
@@ -1288,11 +1397,11 @@ function bindingifyLoad(args) {
|
|
|
1288
1397
|
filter: bindingifyLoadFilter(options.filter)
|
|
1289
1398
|
};
|
|
1290
1399
|
}
|
|
1291
|
-
function preProcessSourceMap(ret, id) {
|
|
1400
|
+
function preProcessSourceMap(ret, id$1) {
|
|
1292
1401
|
if (!ret.map) return;
|
|
1293
1402
|
let map = typeof ret.map === "object" ? ret.map : JSON.parse(ret.map);
|
|
1294
1403
|
if (!isEmptySourcemapFiled(map.sources)) {
|
|
1295
|
-
const directory = node_path.default.dirname(id) || ".";
|
|
1404
|
+
const directory = node_path.default.dirname(id$1) || ".";
|
|
1296
1405
|
const sourceRoot = map.sourceRoot || ".";
|
|
1297
1406
|
map.sources = map.sources.map((source) => node_path.default.resolve(directory, sourceRoot, source));
|
|
1298
1407
|
}
|
|
@@ -1366,9 +1475,9 @@ function transformRenderedChunk(chunk) {
|
|
|
1366
1475
|
}
|
|
1367
1476
|
function transformChunkModules(modules) {
|
|
1368
1477
|
const result = {};
|
|
1369
|
-
for (let i = 0; i < modules.values.length; i++) {
|
|
1370
|
-
let key = modules.keys[i];
|
|
1371
|
-
const mod = modules.values[i];
|
|
1478
|
+
for (let i$1 = 0; i$1 < modules.values.length; i$1++) {
|
|
1479
|
+
let key = modules.keys[i$1];
|
|
1480
|
+
const mod = modules.values[i$1];
|
|
1372
1481
|
result[key] = transformToRenderedModule(mod);
|
|
1373
1482
|
}
|
|
1374
1483
|
return result;
|
|
@@ -1428,7 +1537,7 @@ function bindingifyFormat(format) {
|
|
|
1428
1537
|
case "iife": return "iife";
|
|
1429
1538
|
case "umd": return "umd";
|
|
1430
1539
|
case "experimental-app": return "app";
|
|
1431
|
-
default: unimplemented(`output.format: ${format}`);
|
|
1540
|
+
default: require_filter_index.unimplemented(`output.format: ${format}`);
|
|
1432
1541
|
}
|
|
1433
1542
|
}
|
|
1434
1543
|
function bindingifySourcemap(sourcemap) {
|
|
@@ -1716,11 +1825,11 @@ function bindingifyRenderStart(args) {
|
|
|
1716
1825
|
function bindingifyRenderChunk(args) {
|
|
1717
1826
|
const hook = args.plugin.renderChunk;
|
|
1718
1827
|
if (!hook) return {};
|
|
1719
|
-
const { handler, meta } = normalizeHook(hook);
|
|
1828
|
+
const { handler, meta, options } = normalizeHook(hook);
|
|
1720
1829
|
return {
|
|
1721
|
-
plugin: async (ctx, code, chunk, opts, meta$1) => {
|
|
1830
|
+
plugin: async (ctx, code$1, chunk, opts, meta$1) => {
|
|
1722
1831
|
if (args.pluginContextData.getRenderChunkMeta() == null) args.pluginContextData.setRenderChunkMeta({ chunks: Object.fromEntries(Object.entries(meta$1.chunks).map(([key, value]) => [key, transformRenderedChunk(value)])) });
|
|
1723
|
-
const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), code, transformRenderedChunk(chunk), new NormalizedOutputOptionsImpl(opts, args.outputOptions, args.normalizedOutputPlugins), args.pluginContextData.getRenderChunkMeta());
|
|
1832
|
+
const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), code$1, transformRenderedChunk(chunk), new NormalizedOutputOptionsImpl(opts, args.outputOptions, args.normalizedOutputPlugins), args.pluginContextData.getRenderChunkMeta());
|
|
1724
1833
|
if (ret == null) return;
|
|
1725
1834
|
if (typeof ret === "string") return { code: ret };
|
|
1726
1835
|
if (!ret.map) return { code: ret.code };
|
|
@@ -1729,7 +1838,8 @@ function bindingifyRenderChunk(args) {
|
|
|
1729
1838
|
map: bindingifySourcemap$1(ret.map)
|
|
1730
1839
|
};
|
|
1731
1840
|
},
|
|
1732
|
-
meta: bindingifyPluginHookMeta(meta)
|
|
1841
|
+
meta: bindingifyPluginHookMeta(meta),
|
|
1842
|
+
filter: bindingifyRenderChunkFilter(options.filter)
|
|
1733
1843
|
};
|
|
1734
1844
|
}
|
|
1735
1845
|
function bindingifyAugmentChunkHash(args) {
|
|
@@ -1855,8 +1965,8 @@ function bindingifyWatchChange(args) {
|
|
|
1855
1965
|
if (!hook) return {};
|
|
1856
1966
|
const { handler, meta } = normalizeHook(hook);
|
|
1857
1967
|
return {
|
|
1858
|
-
plugin: async (ctx, id, event) => {
|
|
1859
|
-
await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), id, { event });
|
|
1968
|
+
plugin: async (ctx, id$1, event) => {
|
|
1969
|
+
await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), id$1, { event });
|
|
1860
1970
|
},
|
|
1861
1971
|
meta: bindingifyPluginHookMeta(meta)
|
|
1862
1972
|
};
|
|
@@ -1954,7 +2064,7 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
|
|
|
1954
2064
|
const { plugin: transform, meta: transformMeta, filter: transformFilter } = bindingifyTransform(args);
|
|
1955
2065
|
const { plugin: moduleParsed, meta: moduleParsedMeta } = bindingifyModuleParsed(args);
|
|
1956
2066
|
const { plugin: load, meta: loadMeta, filter: loadFilter } = bindingifyLoad(args);
|
|
1957
|
-
const { plugin: renderChunk, meta: renderChunkMeta } = bindingifyRenderChunk(args);
|
|
2067
|
+
const { plugin: renderChunk, meta: renderChunkMeta, filter: renderChunkFilter } = bindingifyRenderChunk(args);
|
|
1958
2068
|
const { plugin: augmentChunkHash, meta: augmentChunkHashMeta } = bindingifyAugmentChunkHash(args);
|
|
1959
2069
|
const { plugin: renderStart, meta: renderStartMeta } = bindingifyRenderStart(args);
|
|
1960
2070
|
const { plugin: renderError, meta: renderErrorMeta } = bindingifyRenderError(args);
|
|
@@ -1989,6 +2099,7 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
|
|
|
1989
2099
|
loadFilter,
|
|
1990
2100
|
renderChunk,
|
|
1991
2101
|
renderChunkMeta,
|
|
2102
|
+
renderChunkFilter,
|
|
1992
2103
|
augmentChunkHash,
|
|
1993
2104
|
augmentChunkHashMeta,
|
|
1994
2105
|
renderStart,
|
|
@@ -2061,47 +2172,48 @@ var PluginContextData = class {
|
|
|
2061
2172
|
moduleOptionMap = new Map();
|
|
2062
2173
|
resolveOptionsMap = new Map();
|
|
2063
2174
|
loadModulePromiseMap = new Map();
|
|
2175
|
+
loadModulePromiseResolveFnMap = new Map();
|
|
2064
2176
|
renderedChunkMeta = null;
|
|
2065
|
-
updateModuleOption(id, option) {
|
|
2066
|
-
const existing = this.moduleOptionMap.get(id);
|
|
2177
|
+
updateModuleOption(id$1, option) {
|
|
2178
|
+
const existing = this.moduleOptionMap.get(id$1);
|
|
2067
2179
|
if (existing) {
|
|
2068
2180
|
if (option.moduleSideEffects != null) existing.moduleSideEffects = option.moduleSideEffects;
|
|
2069
2181
|
if (option.meta != null) Object.assign(existing.meta, option.meta);
|
|
2070
2182
|
if (option.invalidate != null) existing.invalidate = option.invalidate;
|
|
2071
2183
|
} else {
|
|
2072
|
-
this.moduleOptionMap.set(id, option);
|
|
2184
|
+
this.moduleOptionMap.set(id$1, option);
|
|
2073
2185
|
return option;
|
|
2074
2186
|
}
|
|
2075
2187
|
return existing;
|
|
2076
2188
|
}
|
|
2077
|
-
getModuleOption(id) {
|
|
2078
|
-
const option = this.moduleOptionMap.get(id);
|
|
2189
|
+
getModuleOption(id$1) {
|
|
2190
|
+
const option = this.moduleOptionMap.get(id$1);
|
|
2079
2191
|
if (!option) {
|
|
2080
2192
|
const raw = {
|
|
2081
2193
|
moduleSideEffects: null,
|
|
2082
2194
|
meta: {}
|
|
2083
2195
|
};
|
|
2084
|
-
this.moduleOptionMap.set(id, raw);
|
|
2196
|
+
this.moduleOptionMap.set(id$1, raw);
|
|
2085
2197
|
return raw;
|
|
2086
2198
|
}
|
|
2087
2199
|
return option;
|
|
2088
2200
|
}
|
|
2089
|
-
getModuleInfo(id, context) {
|
|
2090
|
-
const bindingInfo = context.getModuleInfo(id);
|
|
2201
|
+
getModuleInfo(id$1, context) {
|
|
2202
|
+
const bindingInfo = context.getModuleInfo(id$1);
|
|
2091
2203
|
if (bindingInfo) {
|
|
2092
|
-
const info = transformModuleInfo(bindingInfo, this.getModuleOption(id));
|
|
2093
|
-
return this.proxyModuleInfo(id, info);
|
|
2204
|
+
const info = transformModuleInfo(bindingInfo, this.getModuleOption(id$1));
|
|
2205
|
+
return this.proxyModuleInfo(id$1, info);
|
|
2094
2206
|
}
|
|
2095
2207
|
return null;
|
|
2096
2208
|
}
|
|
2097
|
-
proxyModuleInfo(id, info) {
|
|
2209
|
+
proxyModuleInfo(id$1, info) {
|
|
2098
2210
|
let moduleSideEffects = info.moduleSideEffects;
|
|
2099
2211
|
Object.defineProperty(info, "moduleSideEffects", {
|
|
2100
2212
|
get() {
|
|
2101
2213
|
return moduleSideEffects;
|
|
2102
2214
|
},
|
|
2103
2215
|
set: (v) => {
|
|
2104
|
-
this.updateModuleOption(id, {
|
|
2216
|
+
this.updateModuleOption(id$1, {
|
|
2105
2217
|
moduleSideEffects: v,
|
|
2106
2218
|
meta: info.meta,
|
|
2107
2219
|
invalidate: true
|
|
@@ -2132,9 +2244,14 @@ var PluginContextData = class {
|
|
|
2132
2244
|
getRenderChunkMeta() {
|
|
2133
2245
|
return this.renderedChunkMeta;
|
|
2134
2246
|
}
|
|
2247
|
+
markModuleLoaded(id$1, _success) {
|
|
2248
|
+
const resolve = this.loadModulePromiseResolveFnMap.get(id$1);
|
|
2249
|
+
if (resolve) resolve();
|
|
2250
|
+
}
|
|
2135
2251
|
clear() {
|
|
2136
2252
|
this.renderedChunkMeta = null;
|
|
2137
2253
|
this.loadModulePromiseMap.clear();
|
|
2254
|
+
this.loadModulePromiseResolveFnMap.clear();
|
|
2138
2255
|
}
|
|
2139
2256
|
};
|
|
2140
2257
|
|
|
@@ -2198,7 +2315,8 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
|
|
|
2198
2315
|
},
|
|
2199
2316
|
makeAbsoluteExternalsRelative: bindingifyMakeAbsoluteExternalsRelative(inputOptions.makeAbsoluteExternalsRelative),
|
|
2200
2317
|
debug: inputOptions.debug,
|
|
2201
|
-
invalidateJsSideCache: pluginContextData.clear.bind(pluginContextData)
|
|
2318
|
+
invalidateJsSideCache: pluginContextData.clear.bind(pluginContextData),
|
|
2319
|
+
markModuleLoaded: pluginContextData.markModuleLoaded.bind(pluginContextData)
|
|
2202
2320
|
};
|
|
2203
2321
|
}
|
|
2204
2322
|
function bindingifyHmr(hmr) {
|
|
@@ -2209,15 +2327,15 @@ function bindingifyHmr(hmr) {
|
|
|
2209
2327
|
}
|
|
2210
2328
|
function bindingifyExternal(external) {
|
|
2211
2329
|
if (external) {
|
|
2212
|
-
if (typeof external === "function") return (id, importer, isResolved) => {
|
|
2213
|
-
if (id.startsWith("\0")) return false;
|
|
2214
|
-
return external(id, importer, isResolved) ?? false;
|
|
2330
|
+
if (typeof external === "function") return (id$1, importer, isResolved) => {
|
|
2331
|
+
if (id$1.startsWith("\0")) return false;
|
|
2332
|
+
return external(id$1, importer, isResolved) ?? false;
|
|
2215
2333
|
};
|
|
2216
|
-
const externalArr = arraify(external);
|
|
2217
|
-
return (id, _importer, _isResolved) => {
|
|
2334
|
+
const externalArr = require_filter_index.arraify(external);
|
|
2335
|
+
return (id$1, _importer, _isResolved) => {
|
|
2218
2336
|
return externalArr.some((pat) => {
|
|
2219
|
-
if (pat instanceof RegExp) return pat.test(id);
|
|
2220
|
-
return id === pat;
|
|
2337
|
+
if (pat instanceof RegExp) return pat.test(id$1);
|
|
2338
|
+
return id$1 === pat;
|
|
2221
2339
|
});
|
|
2222
2340
|
};
|
|
2223
2341
|
}
|
|
@@ -2228,7 +2346,7 @@ function bindingifyResolve(resolve) {
|
|
|
2228
2346
|
return {
|
|
2229
2347
|
alias: alias ? Object.entries(alias).map(([name, replacement]) => ({
|
|
2230
2348
|
find: name,
|
|
2231
|
-
replacements: arraify(replacement)
|
|
2349
|
+
replacements: require_filter_index.arraify(replacement)
|
|
2232
2350
|
})) : void 0,
|
|
2233
2351
|
extensionAlias: extensionAlias ? Object.entries(extensionAlias).map(([name, value]) => ({
|
|
2234
2352
|
target: name,
|
|
@@ -2338,31 +2456,6 @@ function bindingifyMakeAbsoluteExternalsRelative(makeAbsoluteExternalsRelative)
|
|
|
2338
2456
|
};
|
|
2339
2457
|
}
|
|
2340
2458
|
|
|
2341
|
-
//#endregion
|
|
2342
|
-
//#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-D6FCK2GA.js
|
|
2343
|
-
function u$1(o, n, a) {
|
|
2344
|
-
let t$1 = (r) => o(r, ...n);
|
|
2345
|
-
return a === void 0 ? t$1 : Object.assign(t$1, {
|
|
2346
|
-
lazy: a,
|
|
2347
|
-
lazyArgs: n
|
|
2348
|
-
});
|
|
2349
|
-
}
|
|
2350
|
-
|
|
2351
|
-
//#endregion
|
|
2352
|
-
//#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-WIMGWYZL.js
|
|
2353
|
-
function u(r, n, o) {
|
|
2354
|
-
let a = r.length - n.length;
|
|
2355
|
-
if (a === 0) return r(...n);
|
|
2356
|
-
if (a === 1) return u$1(r, n, o);
|
|
2357
|
-
throw new Error("Wrong number of arguments");
|
|
2358
|
-
}
|
|
2359
|
-
|
|
2360
|
-
//#endregion
|
|
2361
|
-
//#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-5NQBDF4H.js
|
|
2362
|
-
function t(...n) {
|
|
2363
|
-
return u(Object.keys, n);
|
|
2364
|
-
}
|
|
2365
|
-
|
|
2366
2459
|
//#endregion
|
|
2367
2460
|
//#region src/utils/plugin/index.ts
|
|
2368
2461
|
const isPluginHookName = function() {
|
|
@@ -2500,7 +2593,7 @@ function createComposedPlugin(plugins) {
|
|
|
2500
2593
|
if (symbolForCallerThatSkipSelf === handlerSymbol) continue;
|
|
2501
2594
|
const { handler: handlerFn } = normalizeHook(handler);
|
|
2502
2595
|
const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), source, importer, rawHookResolveIdOptions);
|
|
2503
|
-
if (!isNullish(result)) return result;
|
|
2596
|
+
if (!require_filter_index.isNullish(result)) return result;
|
|
2504
2597
|
}
|
|
2505
2598
|
};
|
|
2506
2599
|
}
|
|
@@ -2522,11 +2615,11 @@ function createComposedPlugin(plugins) {
|
|
|
2522
2615
|
case "load": {
|
|
2523
2616
|
if (batchedHooks.load) {
|
|
2524
2617
|
const batchedHandlers = batchedHooks.load;
|
|
2525
|
-
composed.load = async function(id) {
|
|
2618
|
+
composed.load = async function(id$1) {
|
|
2526
2619
|
for (const [handler, plugin] of batchedHandlers) {
|
|
2527
2620
|
const { handler: handlerFn } = normalizeHook(handler);
|
|
2528
|
-
const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), id);
|
|
2529
|
-
if (!isNullish(result)) return result;
|
|
2621
|
+
const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), id$1);
|
|
2622
|
+
if (!require_filter_index.isNullish(result)) return result;
|
|
2530
2623
|
}
|
|
2531
2624
|
};
|
|
2532
2625
|
}
|
|
@@ -2535,11 +2628,11 @@ function createComposedPlugin(plugins) {
|
|
|
2535
2628
|
case "transform": {
|
|
2536
2629
|
if (batchedHooks.transform) {
|
|
2537
2630
|
const batchedHandlers = batchedHooks.transform;
|
|
2538
|
-
composed.transform = async function(initialCode, id, moduleType) {
|
|
2539
|
-
let code = initialCode;
|
|
2631
|
+
composed.transform = async function(initialCode, id$1, moduleType$1) {
|
|
2632
|
+
let code$1 = initialCode;
|
|
2540
2633
|
let moduleSideEffects = void 0;
|
|
2541
2634
|
function updateOutput(newCode, newModuleSideEffects) {
|
|
2542
|
-
code = newCode;
|
|
2635
|
+
code$1 = newCode;
|
|
2543
2636
|
moduleSideEffects = newModuleSideEffects ?? void 0;
|
|
2544
2637
|
}
|
|
2545
2638
|
for (const [handler, plugin] of batchedHandlers) {
|
|
@@ -2547,14 +2640,14 @@ function createComposedPlugin(plugins) {
|
|
|
2547
2640
|
this.getCombinedSourcemap = () => {
|
|
2548
2641
|
throw new Error(`The getCombinedSourcemap is not implement in transform hook at composedJsPlugins`);
|
|
2549
2642
|
};
|
|
2550
|
-
const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), code, id, moduleType);
|
|
2551
|
-
if (!isNullish(result)) {
|
|
2643
|
+
const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), code$1, id$1, moduleType$1);
|
|
2644
|
+
if (!require_filter_index.isNullish(result)) {
|
|
2552
2645
|
if (typeof result === "string") updateOutput(result);
|
|
2553
2646
|
else if (result.code) updateOutput(result.code, result.moduleSideEffects);
|
|
2554
2647
|
}
|
|
2555
2648
|
}
|
|
2556
2649
|
return {
|
|
2557
|
-
code,
|
|
2650
|
+
code: code$1,
|
|
2558
2651
|
moduleSideEffects
|
|
2559
2652
|
};
|
|
2560
2653
|
};
|
|
@@ -2576,11 +2669,11 @@ function createComposedPlugin(plugins) {
|
|
|
2576
2669
|
case "renderChunk": {
|
|
2577
2670
|
if (batchedHooks.renderChunk) {
|
|
2578
2671
|
const batchedHandlers = batchedHooks.renderChunk;
|
|
2579
|
-
composed.renderChunk = async function(code, chunk, options, meta) {
|
|
2672
|
+
composed.renderChunk = async function(code$1, chunk, options, meta) {
|
|
2580
2673
|
for (const [handler, plugin] of batchedHandlers) {
|
|
2581
2674
|
const { handler: handlerFn } = normalizeHook(handler);
|
|
2582
|
-
const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), code, chunk, options, meta);
|
|
2583
|
-
if (!isNullish(result)) return result;
|
|
2675
|
+
const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), code$1, chunk, options, meta);
|
|
2676
|
+
if (!require_filter_index.isNullish(result)) return result;
|
|
2584
2677
|
}
|
|
2585
2678
|
};
|
|
2586
2679
|
}
|
|
@@ -2616,10 +2709,10 @@ function createComposedPlugin(plugins) {
|
|
|
2616
2709
|
case "watchChange": {
|
|
2617
2710
|
if (batchedHooks.watchChange) {
|
|
2618
2711
|
const batchedHandlers = batchedHooks.watchChange;
|
|
2619
|
-
composed.watchChange = async function(id, event) {
|
|
2712
|
+
composed.watchChange = async function(id$1, event) {
|
|
2620
2713
|
await Promise.all(batchedHandlers.map(([handler, plugin]) => {
|
|
2621
2714
|
const { handler: handlerFn } = normalizeHook(handler);
|
|
2622
|
-
return handlerFn.call(applyFixedPluginResolveFn(this, plugin), id, event);
|
|
2715
|
+
return handlerFn.call(applyFixedPluginResolveFn(this, plugin), id$1, event);
|
|
2623
2716
|
}));
|
|
2624
2717
|
};
|
|
2625
2718
|
}
|
|
@@ -2706,7 +2799,7 @@ async function initializeParallelPlugins(plugins) {
|
|
|
2706
2799
|
};
|
|
2707
2800
|
}
|
|
2708
2801
|
function initializeWorkers(registryId, count, pluginInfos) {
|
|
2709
|
-
return Promise.all(Array.from({ length: count }, (_, i) => initializeWorker(registryId, pluginInfos, i)));
|
|
2802
|
+
return Promise.all(Array.from({ length: count }, (_, i$1) => initializeWorker(registryId, pluginInfos, i$1)));
|
|
2710
2803
|
}
|
|
2711
2804
|
async function initializeWorker(registryId, pluginInfos, threadNumber) {
|
|
2712
2805
|
const urlString = (void 0)("#parallel-plugin-worker");
|
|
@@ -2880,8 +2973,8 @@ var WatcherEmitter = class {
|
|
|
2880
2973
|
break;
|
|
2881
2974
|
case "event":
|
|
2882
2975
|
for (const listener of listeners) {
|
|
2883
|
-
const code = event.bundleEventKind();
|
|
2884
|
-
switch (code) {
|
|
2976
|
+
const code$1 = event.bundleEventKind();
|
|
2977
|
+
switch (code$1) {
|
|
2885
2978
|
case "BUNDLE_END":
|
|
2886
2979
|
const { duration, output } = event.bundleEndData();
|
|
2887
2980
|
await listener({
|
|
@@ -2898,7 +2991,7 @@ var WatcherEmitter = class {
|
|
|
2898
2991
|
});
|
|
2899
2992
|
break;
|
|
2900
2993
|
default:
|
|
2901
|
-
await listener({ code });
|
|
2994
|
+
await listener({ code: code$1 });
|
|
2902
2995
|
break;
|
|
2903
2996
|
}
|
|
2904
2997
|
}
|
|
@@ -2947,8 +3040,8 @@ var Watcher = class {
|
|
|
2947
3040
|
}
|
|
2948
3041
|
};
|
|
2949
3042
|
async function createWatcher(emitter, input) {
|
|
2950
|
-
const options = arraify(input);
|
|
2951
|
-
const bundlerOptions = await Promise.all(options.map((option) => arraify(option.output || {}).map(async (output) => {
|
|
3043
|
+
const options = require_filter_index.arraify(input);
|
|
3044
|
+
const bundlerOptions = await Promise.all(options.map((option) => require_filter_index.arraify(option.output || {}).map(async (output) => {
|
|
2952
3045
|
const inputOptions = await PluginDriver.callOptionsHook(option, true);
|
|
2953
3046
|
return createBundlerOptions(inputOptions, output, true);
|
|
2954
3047
|
})).flat());
|
|
@@ -2976,46 +3069,6 @@ const watch = (input) => {
|
|
|
2976
3069
|
return emitter;
|
|
2977
3070
|
};
|
|
2978
3071
|
|
|
2979
|
-
//#endregion
|
|
2980
|
-
//#region src/plugin/with-filter.ts
|
|
2981
|
-
function withFilterImpl(pluginOption, filterObjectList) {
|
|
2982
|
-
if (isPromiseLike(pluginOption)) return pluginOption.then((p) => withFilter(p, filterObjectList));
|
|
2983
|
-
if (pluginOption == false || pluginOption == null) return pluginOption;
|
|
2984
|
-
if (Array.isArray(pluginOption)) return pluginOption.map((p) => withFilter(p, filterObjectList));
|
|
2985
|
-
let plugin = pluginOption;
|
|
2986
|
-
let filterObjectIndex = findMatchedFilterObject(plugin.name, filterObjectList);
|
|
2987
|
-
if (filterObjectIndex === -1) return plugin;
|
|
2988
|
-
let filterObject = filterObjectList[filterObjectIndex];
|
|
2989
|
-
Object.keys(plugin).forEach((key) => {
|
|
2990
|
-
switch (key) {
|
|
2991
|
-
case "transform":
|
|
2992
|
-
case "resolveId":
|
|
2993
|
-
case "load":
|
|
2994
|
-
if (!plugin[key]) return;
|
|
2995
|
-
if (typeof plugin[key] === "object") plugin[key].filter = filterObject[key] ?? plugin[key].filter;
|
|
2996
|
-
else plugin[key] = {
|
|
2997
|
-
handler: plugin[key],
|
|
2998
|
-
filter: filterObject[key]
|
|
2999
|
-
};
|
|
3000
|
-
break;
|
|
3001
|
-
default: break;
|
|
3002
|
-
}
|
|
3003
|
-
});
|
|
3004
|
-
return plugin;
|
|
3005
|
-
}
|
|
3006
|
-
function withFilter(pluginOption, filterObject) {
|
|
3007
|
-
return withFilterImpl(pluginOption, arraify(filterObject));
|
|
3008
|
-
}
|
|
3009
|
-
function findMatchedFilterObject(pluginName, overrideFilterObjectList) {
|
|
3010
|
-
if (overrideFilterObjectList.length === 1 && overrideFilterObjectList[0].pluginNamePattern === void 0) return 0;
|
|
3011
|
-
for (let i = 0; i < overrideFilterObjectList.length; i++) for (let j = 0; j < (overrideFilterObjectList[i].pluginNamePattern ?? []).length; j++) {
|
|
3012
|
-
let pattern = overrideFilterObjectList[i].pluginNamePattern[j];
|
|
3013
|
-
if (typeof pattern === "string" && pattern === pluginName) return i;
|
|
3014
|
-
else if (pattern instanceof RegExp && pattern.test(pluginName)) return i;
|
|
3015
|
-
}
|
|
3016
|
-
return -1;
|
|
3017
|
-
}
|
|
3018
|
-
|
|
3019
3072
|
//#endregion
|
|
3020
3073
|
//#region src/utils/define-config.ts
|
|
3021
3074
|
function defineConfig(config) {
|
|
@@ -3045,12 +3098,6 @@ Object.defineProperty(exports, 'VERSION', {
|
|
|
3045
3098
|
return VERSION;
|
|
3046
3099
|
}
|
|
3047
3100
|
});
|
|
3048
|
-
Object.defineProperty(exports, 'arraify', {
|
|
3049
|
-
enumerable: true,
|
|
3050
|
-
get: function () {
|
|
3051
|
-
return arraify;
|
|
3052
|
-
}
|
|
3053
|
-
});
|
|
3054
3101
|
Object.defineProperty(exports, 'bindingifyPlugin', {
|
|
3055
3102
|
enumerable: true,
|
|
3056
3103
|
get: function () {
|
|
@@ -3218,10 +3265,4 @@ Object.defineProperty(exports, 'watch', {
|
|
|
3218
3265
|
get: function () {
|
|
3219
3266
|
return watch;
|
|
3220
3267
|
}
|
|
3221
|
-
});
|
|
3222
|
-
Object.defineProperty(exports, 'withFilter', {
|
|
3223
|
-
enumerable: true,
|
|
3224
|
-
get: function () {
|
|
3225
|
-
return withFilter;
|
|
3226
|
-
}
|
|
3227
3268
|
});
|