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