@rolldown/browser 1.0.0-beta.8-commit.a98d94e → 1.0.0-beta.8-commit.852c603
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 +308 -147
- package/dist/cli.cjs +3 -2
- package/dist/cli.mjs +3 -2
- package/dist/experimental-index.cjs +2 -1
- package/dist/experimental-index.d.cts +1 -1
- package/dist/experimental-index.d.mts +1 -1
- package/dist/experimental-index.mjs +2 -1
- package/dist/filter-expression-index.cjs +11 -0
- package/dist/filter-expression-index.d.cts +3 -0
- package/dist/filter-expression-index.d.mts +3 -0
- package/dist/filter-expression-index.mjs +4 -0
- package/dist/index.cjs +2 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -1
- package/dist/parallel-plugin-worker.cjs +2 -1
- package/dist/parallel-plugin-worker.mjs +2 -1
- package/dist/parallel-plugin.d.cts +1 -1
- package/dist/parallel-plugin.d.mts +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-expression-index-CIS7Rrin.mjs +69 -0
- package/dist/shared/filter-expression-index-CRtoeipP.cjs +119 -0
- package/dist/shared/{input-options.d-P0YdGzip.d.cts → input-options.d-C0G2toUx.d.cts} +83 -21
- package/dist/shared/{input-options.d-CMFIv0CX.d.mts → input-options.d-D_2wMOSn.d.mts} +83 -21
- package/dist/shared/{src-CJ9XODOK.cjs → src-DbbYa-_8.cjs} +247 -132
- package/dist/shared/{src-D9guL4ht.mjs → src-RM00Zc4c.mjs} +1780 -1664
- package/package.json +1 -1
- /package/dist/shared/{prompt-_yrURmmm.cjs → prompt-At99RuKY.cjs} +0 -0
- /package/dist/shared/{prompt-B7SnYdwU.mjs → prompt-BqVpALUY.mjs} +0 -0
package/dist/browser.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import colors from "ansis";
|
|
|
5
5
|
import * as v from "valibot";
|
|
6
6
|
|
|
7
7
|
//#region package.json
|
|
8
|
-
var version = "1.0.0-beta.8-commit.
|
|
8
|
+
var version = "1.0.0-beta.8-commit.852c603";
|
|
9
9
|
|
|
10
10
|
//#endregion
|
|
11
11
|
//#region src/builtin-plugin/utils.ts
|
|
@@ -119,18 +119,18 @@ function rangeContains(range, index) {
|
|
|
119
119
|
function getLocator(source, options = {}) {
|
|
120
120
|
const { offsetLine = 0, offsetColumn = 0 } = options;
|
|
121
121
|
let start = 0;
|
|
122
|
-
const ranges = source.split("\n").map((line, i$
|
|
122
|
+
const ranges = source.split("\n").map((line, i$2) => {
|
|
123
123
|
const end = start + line.length + 1;
|
|
124
124
|
/** @type {import('./types').Range} */
|
|
125
125
|
const range = {
|
|
126
126
|
start,
|
|
127
127
|
end,
|
|
128
|
-
line: i$
|
|
128
|
+
line: i$2
|
|
129
129
|
};
|
|
130
130
|
start = end;
|
|
131
131
|
return range;
|
|
132
132
|
});
|
|
133
|
-
let i = 0;
|
|
133
|
+
let i$1 = 0;
|
|
134
134
|
/**
|
|
135
135
|
* @param {string | number} search
|
|
136
136
|
* @param {number} [index]
|
|
@@ -139,16 +139,16 @@ function getLocator(source, options = {}) {
|
|
|
139
139
|
function locator(search, index) {
|
|
140
140
|
if (typeof search === "string") search = source.indexOf(search, index ?? 0);
|
|
141
141
|
if (search === -1) return void 0;
|
|
142
|
-
let range = ranges[i];
|
|
143
|
-
const d = search >= range.end ? 1 : -1;
|
|
142
|
+
let range = ranges[i$1];
|
|
143
|
+
const d$1 = search >= range.end ? 1 : -1;
|
|
144
144
|
while (range) {
|
|
145
145
|
if (rangeContains(range, search)) return {
|
|
146
146
|
line: offsetLine + range.line,
|
|
147
147
|
column: offsetColumn + search - range.start,
|
|
148
148
|
character: search
|
|
149
149
|
};
|
|
150
|
-
i += d;
|
|
151
|
-
range = ranges[i];
|
|
150
|
+
i$1 += d$1;
|
|
151
|
+
range = ranges[i$1];
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
return locator;
|
|
@@ -196,14 +196,14 @@ function logMultiplyNotifyOption() {
|
|
|
196
196
|
message: `Found multiply notify option at watch options, using first one to start notify watcher.`
|
|
197
197
|
};
|
|
198
198
|
}
|
|
199
|
-
function logPluginError(error$1, plugin, { hook, id } = {}) {
|
|
199
|
+
function logPluginError(error$1, plugin, { hook, id: id$1 } = {}) {
|
|
200
200
|
try {
|
|
201
|
-
const code = error$1.code;
|
|
202
|
-
if (!error$1.pluginCode && code != null && (typeof code !== "string" || !code.startsWith("PLUGIN_"))) error$1.pluginCode = code;
|
|
201
|
+
const code$1 = error$1.code;
|
|
202
|
+
if (!error$1.pluginCode && code$1 != null && (typeof code$1 !== "string" || !code$1.startsWith("PLUGIN_"))) error$1.pluginCode = code$1;
|
|
203
203
|
error$1.code = PLUGIN_ERROR;
|
|
204
204
|
error$1.plugin = plugin;
|
|
205
205
|
if (hook) error$1.hook = hook;
|
|
206
|
-
if (id) error$1.id = id;
|
|
206
|
+
if (id$1) error$1.id = id$1;
|
|
207
207
|
} catch (_) {} finally {
|
|
208
208
|
return error$1;
|
|
209
209
|
}
|
|
@@ -218,12 +218,12 @@ function error(base) {
|
|
|
218
218
|
}
|
|
219
219
|
throw base;
|
|
220
220
|
}
|
|
221
|
-
function augmentCodeLocation(properties, pos, source, id) {
|
|
221
|
+
function augmentCodeLocation(properties, pos, source, id$1) {
|
|
222
222
|
if (typeof pos === "object") {
|
|
223
223
|
const { line, column } = pos;
|
|
224
224
|
properties.loc = {
|
|
225
225
|
column,
|
|
226
|
-
file: id,
|
|
226
|
+
file: id$1,
|
|
227
227
|
line
|
|
228
228
|
};
|
|
229
229
|
} else {
|
|
@@ -233,7 +233,7 @@ function augmentCodeLocation(properties, pos, source, id) {
|
|
|
233
233
|
const { line, column } = location;
|
|
234
234
|
properties.loc = {
|
|
235
235
|
column,
|
|
236
|
-
file: id,
|
|
236
|
+
file: id$1,
|
|
237
237
|
line
|
|
238
238
|
};
|
|
239
239
|
}
|
|
@@ -246,13 +246,13 @@ function augmentCodeLocation(properties, pos, source, id) {
|
|
|
246
246
|
//#endregion
|
|
247
247
|
//#region src/log/log-handler.ts
|
|
248
248
|
const normalizeLog = (log) => typeof log === "string" ? { message: log } : typeof log === "function" ? normalizeLog(log()) : log;
|
|
249
|
-
function getLogHandler(level, code, logger, pluginName, logLevel) {
|
|
249
|
+
function getLogHandler(level, code$1, logger, pluginName, logLevel) {
|
|
250
250
|
if (logLevelPriority[level] < logLevelPriority[logLevel]) return noop;
|
|
251
251
|
return (log, pos) => {
|
|
252
252
|
if (pos != null) logger(LOG_LEVEL_WARN, logInvalidLogPosition(pluginName));
|
|
253
253
|
log = normalizeLog(log);
|
|
254
254
|
if (log.code && !log.pluginCode) log.pluginCode = log.code;
|
|
255
|
-
log.code = code;
|
|
255
|
+
log.code = code$1;
|
|
256
256
|
log.plugin = pluginName;
|
|
257
257
|
logger(level, log);
|
|
258
258
|
};
|
|
@@ -329,9 +329,9 @@ const getExtendedLogMessage = (log) => {
|
|
|
329
329
|
if (log.loc) prefix += `${relativeId(log.loc.file)} (${log.loc.line}:${log.loc.column}) `;
|
|
330
330
|
return prefix + log.message;
|
|
331
331
|
};
|
|
332
|
-
function relativeId(id) {
|
|
333
|
-
if (!path.isAbsolute(id)) return id;
|
|
334
|
-
return path.relative(path.resolve(), id);
|
|
332
|
+
function relativeId(id$1) {
|
|
333
|
+
if (!path.isAbsolute(id$1)) return id$1;
|
|
334
|
+
return path.relative(path.resolve(), id$1);
|
|
335
335
|
}
|
|
336
336
|
|
|
337
337
|
//#endregion
|
|
@@ -898,7 +898,7 @@ function validateOption(key, options) {
|
|
|
898
898
|
const issuePaths = issue.path.map((path$1) => path$1.key);
|
|
899
899
|
let issueMsg = issue.message;
|
|
900
900
|
if (issue.type === "union") {
|
|
901
|
-
const subIssue = issue.issues?.find((i) => !(i.type !== issue.received && i.input === issue.input));
|
|
901
|
+
const subIssue = issue.issues?.find((i$1) => !(i$1.type !== issue.received && i$1.input === issue.input));
|
|
902
902
|
if (subIssue) {
|
|
903
903
|
if (subIssue.path) issuePaths.push(subIssue.path.map((path$1) => path$1.key));
|
|
904
904
|
issueMsg = subIssue.message;
|
|
@@ -970,13 +970,13 @@ function normalizeErrors(rawErrors) {
|
|
|
970
970
|
stack: void 0
|
|
971
971
|
}));
|
|
972
972
|
let summary = `Build failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
|
|
973
|
-
for (let i = 0; i < errors.length; i++) {
|
|
973
|
+
for (let i$1 = 0; i$1 < errors.length; i$1++) {
|
|
974
974
|
summary += "\n";
|
|
975
|
-
if (i >= 5) {
|
|
975
|
+
if (i$1 >= 5) {
|
|
976
976
|
summary += "...";
|
|
977
977
|
break;
|
|
978
978
|
}
|
|
979
|
-
summary += getErrorMessage(errors[i]);
|
|
979
|
+
summary += getErrorMessage(errors[i$1]);
|
|
980
980
|
}
|
|
981
981
|
const wrapper = new Error(summary);
|
|
982
982
|
Object.defineProperty(wrapper, "errors", {
|
|
@@ -995,9 +995,9 @@ function getErrorMessage(e) {
|
|
|
995
995
|
if (Object.hasOwn(e, "kind")) return e.message;
|
|
996
996
|
let s = "";
|
|
997
997
|
if (e.plugin) s += `[plugin ${e.plugin}]`;
|
|
998
|
-
const id = e.id ?? e.loc?.file;
|
|
999
|
-
if (id) {
|
|
1000
|
-
s += " " + id;
|
|
998
|
+
const id$1 = e.id ?? e.loc?.file;
|
|
999
|
+
if (id$1) {
|
|
1000
|
+
s += " " + id$1;
|
|
1001
1001
|
if (e.loc) s += `:${e.loc.line}:${e.loc.column}`;
|
|
1002
1002
|
}
|
|
1003
1003
|
if (s) s += "\n";
|
|
@@ -1052,41 +1052,220 @@ function isEmptySourcemapFiled(array) {
|
|
|
1052
1052
|
if (array.length === 0 || !array[0]) return true;
|
|
1053
1053
|
return false;
|
|
1054
1054
|
}
|
|
1055
|
-
function normalizeTransformHookSourcemap(id, originalCode, rawMap) {
|
|
1055
|
+
function normalizeTransformHookSourcemap(id$1, originalCode, rawMap) {
|
|
1056
1056
|
if (!rawMap) return;
|
|
1057
1057
|
let map = typeof rawMap === "object" ? rawMap : JSON.parse(rawMap);
|
|
1058
1058
|
if (isEmptySourcemapFiled(map.sourcesContent)) map.sourcesContent = [originalCode];
|
|
1059
|
-
if (isEmptySourcemapFiled(map.sources) || map.sources && map.sources.length === 1 && map.sources[0] !== id) map.sources = [id];
|
|
1059
|
+
if (isEmptySourcemapFiled(map.sources) || map.sources && map.sources.length === 1 && map.sources[0] !== id$1) map.sources = [id$1];
|
|
1060
1060
|
return map;
|
|
1061
1061
|
}
|
|
1062
1062
|
|
|
1063
1063
|
//#endregion
|
|
1064
|
-
//#region
|
|
1065
|
-
function
|
|
1066
|
-
|
|
1067
|
-
|
|
1064
|
+
//#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-D6FCK2GA.js
|
|
1065
|
+
function u$1(o, n, a) {
|
|
1066
|
+
let t$1 = (r) => o(r, ...n);
|
|
1067
|
+
return a === void 0 ? t$1 : Object.assign(t$1, {
|
|
1068
|
+
lazy: a,
|
|
1069
|
+
lazyArgs: n
|
|
1070
|
+
});
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
//#endregion
|
|
1074
|
+
//#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-WIMGWYZL.js
|
|
1075
|
+
function u(r, n, o) {
|
|
1076
|
+
let a = r.length - n.length;
|
|
1077
|
+
if (a === 0) return r(...n);
|
|
1078
|
+
if (a === 1) return u$1(r, n, o);
|
|
1079
|
+
throw new Error("Wrong number of arguments");
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
//#endregion
|
|
1083
|
+
//#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-3IFJP4R5.js
|
|
1084
|
+
function d(...r) {
|
|
1085
|
+
return u(i, r);
|
|
1086
|
+
}
|
|
1087
|
+
var i = (r, t$1) => {
|
|
1088
|
+
let a = [[], []];
|
|
1089
|
+
for (let [o, e] of r.entries()) t$1(e, o, r) ? a[0].push(e) : a[1].push(e);
|
|
1090
|
+
return a;
|
|
1091
|
+
};
|
|
1092
|
+
|
|
1093
|
+
//#endregion
|
|
1094
|
+
//#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-5NQBDF4H.js
|
|
1095
|
+
function t(...n) {
|
|
1096
|
+
return u(Object.keys, n);
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
//#endregion
|
|
1100
|
+
//#region src/filter-expression-index.ts
|
|
1101
|
+
function and(left, right) {
|
|
1102
|
+
return {
|
|
1103
|
+
kind: "and",
|
|
1104
|
+
left,
|
|
1105
|
+
right
|
|
1106
|
+
};
|
|
1107
|
+
}
|
|
1108
|
+
function or(left, right) {
|
|
1109
|
+
return {
|
|
1110
|
+
kind: "or",
|
|
1111
|
+
left,
|
|
1112
|
+
right
|
|
1113
|
+
};
|
|
1114
|
+
}
|
|
1115
|
+
function id(pattern) {
|
|
1116
|
+
return {
|
|
1117
|
+
kind: "id",
|
|
1118
|
+
pattern
|
|
1119
|
+
};
|
|
1120
|
+
}
|
|
1121
|
+
function moduleType(pattern) {
|
|
1122
|
+
return {
|
|
1123
|
+
kind: "moduleType",
|
|
1124
|
+
pattern
|
|
1125
|
+
};
|
|
1126
|
+
}
|
|
1127
|
+
function code(pattern) {
|
|
1128
|
+
return {
|
|
1129
|
+
kind: "code",
|
|
1130
|
+
pattern
|
|
1131
|
+
};
|
|
1132
|
+
}
|
|
1133
|
+
function include(expr) {
|
|
1134
|
+
return {
|
|
1135
|
+
kind: "include",
|
|
1136
|
+
expr
|
|
1137
|
+
};
|
|
1138
|
+
}
|
|
1139
|
+
function exclude(expr) {
|
|
1068
1140
|
return {
|
|
1069
|
-
|
|
1070
|
-
|
|
1141
|
+
kind: "exclude",
|
|
1142
|
+
expr
|
|
1071
1143
|
};
|
|
1072
1144
|
}
|
|
1145
|
+
|
|
1146
|
+
//#endregion
|
|
1147
|
+
//#region src/plugin/bindingify-hook-filter.ts
|
|
1148
|
+
function generalHookFilterMatcherToFilterExprs(matcher, stringKind) {
|
|
1149
|
+
if (typeof matcher === "string" || matcher instanceof RegExp) return [include(id(matcher))];
|
|
1150
|
+
if (Array.isArray(matcher)) return matcher.map((m) => include(id(m)));
|
|
1151
|
+
if (matcher.custom) return matcher.custom;
|
|
1152
|
+
let ret = [];
|
|
1153
|
+
let isCode = stringKind === "code";
|
|
1154
|
+
if (matcher.exclude) ret.push(...arraify(matcher.exclude).map((m) => exclude(isCode ? code(m) : id(m))));
|
|
1155
|
+
if (matcher.include) ret.push(...arraify(matcher.include).map((m) => include(isCode ? code(m) : id(m))));
|
|
1156
|
+
return ret;
|
|
1157
|
+
}
|
|
1158
|
+
function transformFilterMatcherToFilterExprs(filterOption) {
|
|
1159
|
+
if (!filterOption) return void 0;
|
|
1160
|
+
const { id: id$1, code: code$1, moduleType: moduleType$1, custom } = filterOption;
|
|
1161
|
+
if (custom) return custom;
|
|
1162
|
+
let ret = [];
|
|
1163
|
+
let idIncludes = [];
|
|
1164
|
+
let idExcludes = [];
|
|
1165
|
+
let codeIncludes = [];
|
|
1166
|
+
let codeExcludes = [];
|
|
1167
|
+
if (id$1) [idIncludes, idExcludes] = d(generalHookFilterMatcherToFilterExprs(id$1, "id") ?? [], (m) => m.kind === "include");
|
|
1168
|
+
if (code$1) [codeIncludes, codeExcludes] = d(generalHookFilterMatcherToFilterExprs(code$1, "code") ?? [], (m) => m.kind === "include");
|
|
1169
|
+
ret.push(...idExcludes);
|
|
1170
|
+
ret.push(...codeExcludes);
|
|
1171
|
+
let cursor;
|
|
1172
|
+
if (moduleType$1) {
|
|
1173
|
+
let moduleTypes = Array.isArray(moduleType$1) ? moduleType$1 : moduleType$1.include ?? [];
|
|
1174
|
+
cursor = joinFilterExprsWithOr(moduleTypes.map((m) => moduleType(m)));
|
|
1175
|
+
}
|
|
1176
|
+
if (idIncludes.length) {
|
|
1177
|
+
let joinedOrExpr = joinFilterExprsWithOr(idIncludes.map((item) => item.expr));
|
|
1178
|
+
if (!cursor) cursor = joinedOrExpr;
|
|
1179
|
+
else cursor = and(cursor, joinedOrExpr);
|
|
1180
|
+
}
|
|
1181
|
+
if (codeIncludes.length) {
|
|
1182
|
+
let joinedOrExpr = joinFilterExprsWithOr(codeIncludes.map((item) => item.expr));
|
|
1183
|
+
if (!cursor) cursor = joinedOrExpr;
|
|
1184
|
+
else cursor = and(cursor, joinedOrExpr);
|
|
1185
|
+
}
|
|
1186
|
+
if (cursor) ret.push(include(cursor));
|
|
1187
|
+
return ret;
|
|
1188
|
+
}
|
|
1189
|
+
function joinFilterExprsWithOr(filterExprs) {
|
|
1190
|
+
if (filterExprs.length === 1) return filterExprs[0];
|
|
1191
|
+
return or(filterExprs[0], joinFilterExprsWithOr(filterExprs.slice(1)));
|
|
1192
|
+
}
|
|
1193
|
+
function bindingifyGeneralHookFilter(matcher, stringKind) {
|
|
1194
|
+
let filterExprs = generalHookFilterMatcherToFilterExprs(matcher, stringKind);
|
|
1195
|
+
let custom = [];
|
|
1196
|
+
if (filterExprs) custom = filterExprs.map(bindingifyFilterExpr);
|
|
1197
|
+
return { custom: custom.length > 0 ? custom : void 0 };
|
|
1198
|
+
}
|
|
1199
|
+
function bindingifyFilterExpr(expr) {
|
|
1200
|
+
let list = [];
|
|
1201
|
+
bindingifyFilterExprImpl(expr, list);
|
|
1202
|
+
return list;
|
|
1203
|
+
}
|
|
1204
|
+
function bindingifyFilterExprImpl(expr, list) {
|
|
1205
|
+
switch (expr.kind) {
|
|
1206
|
+
case "and": {
|
|
1207
|
+
bindingifyFilterExprImpl(expr.right, list);
|
|
1208
|
+
bindingifyFilterExprImpl(expr.left, list);
|
|
1209
|
+
list.push({ kind: "And" });
|
|
1210
|
+
break;
|
|
1211
|
+
}
|
|
1212
|
+
case "not": {
|
|
1213
|
+
bindingifyFilterExprImpl(expr.expr, list);
|
|
1214
|
+
list.push({ kind: "Not" });
|
|
1215
|
+
break;
|
|
1216
|
+
}
|
|
1217
|
+
case "id": {
|
|
1218
|
+
list.push({
|
|
1219
|
+
kind: "Id",
|
|
1220
|
+
value: expr.pattern
|
|
1221
|
+
});
|
|
1222
|
+
break;
|
|
1223
|
+
}
|
|
1224
|
+
case "moduleType": {
|
|
1225
|
+
list.push({
|
|
1226
|
+
kind: "ModuleType",
|
|
1227
|
+
value: expr.pattern
|
|
1228
|
+
});
|
|
1229
|
+
break;
|
|
1230
|
+
}
|
|
1231
|
+
case "code": {
|
|
1232
|
+
list.push({
|
|
1233
|
+
kind: "Code",
|
|
1234
|
+
value: expr.pattern
|
|
1235
|
+
});
|
|
1236
|
+
break;
|
|
1237
|
+
}
|
|
1238
|
+
case "include": {
|
|
1239
|
+
bindingifyFilterExprImpl(expr.expr, list);
|
|
1240
|
+
list.push({ kind: "Include" });
|
|
1241
|
+
break;
|
|
1242
|
+
}
|
|
1243
|
+
case "exclude": {
|
|
1244
|
+
bindingifyFilterExprImpl(expr.expr, list);
|
|
1245
|
+
list.push({ kind: "Exclude" });
|
|
1246
|
+
break;
|
|
1247
|
+
}
|
|
1248
|
+
default: throw new Error(`Unknown filter expression kind: ${expr.kind}`);
|
|
1249
|
+
}
|
|
1250
|
+
}
|
|
1073
1251
|
function bindingifyResolveIdFilter(filterOption) {
|
|
1074
|
-
return filterOption?.id ?
|
|
1252
|
+
return filterOption?.id ? bindingifyGeneralHookFilter(filterOption.id, "id") : void 0;
|
|
1075
1253
|
}
|
|
1076
1254
|
function bindingifyLoadFilter(filterOption) {
|
|
1077
|
-
return filterOption?.id ?
|
|
1255
|
+
return filterOption?.id ? bindingifyGeneralHookFilter(filterOption.id, "id") : void 0;
|
|
1078
1256
|
}
|
|
1079
1257
|
function bindingifyTransformFilter(filterOption) {
|
|
1080
1258
|
if (!filterOption) return void 0;
|
|
1081
|
-
|
|
1082
|
-
let
|
|
1083
|
-
if (
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1259
|
+
let custom = transformFilterMatcherToFilterExprs(filterOption);
|
|
1260
|
+
let ret = [];
|
|
1261
|
+
if (custom) ret = custom.map(bindingifyFilterExpr);
|
|
1262
|
+
return { custom: ret.length > 0 ? ret : void 0 };
|
|
1263
|
+
}
|
|
1264
|
+
function bindingifyRenderChunkFilter(filterOption) {
|
|
1265
|
+
if (filterOption) {
|
|
1266
|
+
const { code: code$1 } = filterOption;
|
|
1267
|
+
return { custom: code$1 ? bindingifyGeneralHookFilter(code$1, "code").custom : void 0 };
|
|
1268
|
+
}
|
|
1090
1269
|
}
|
|
1091
1270
|
|
|
1092
1271
|
//#endregion
|
|
@@ -1152,12 +1331,12 @@ function wrap(result, sourceText) {
|
|
|
1152
1331
|
}
|
|
1153
1332
|
function normalizeParseError(sourceText, errors) {
|
|
1154
1333
|
let message = `Parse failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
|
|
1155
|
-
for (let i = 0; i < errors.length; i++) {
|
|
1156
|
-
if (i >= 5) {
|
|
1334
|
+
for (let i$1 = 0; i$1 < errors.length; i$1++) {
|
|
1335
|
+
if (i$1 >= 5) {
|
|
1157
1336
|
message += "\n...";
|
|
1158
1337
|
break;
|
|
1159
1338
|
}
|
|
1160
|
-
const e = errors[i];
|
|
1339
|
+
const e = errors[i$1];
|
|
1161
1340
|
message += e.message + "\n" + e.labels.map((label) => {
|
|
1162
1341
|
const location = locate(sourceText, label.start, { offsetLine: 1 });
|
|
1163
1342
|
if (!location) return;
|
|
@@ -1197,39 +1376,37 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
|
|
|
1197
1376
|
this.data = data;
|
|
1198
1377
|
this.onLog = onLog;
|
|
1199
1378
|
this.currentLoadingModule = currentLoadingModule;
|
|
1200
|
-
this.getModuleInfo = (id) => this.data.getModuleInfo(id, context);
|
|
1379
|
+
this.getModuleInfo = (id$1) => this.data.getModuleInfo(id$1, context);
|
|
1201
1380
|
}
|
|
1202
1381
|
async load(options) {
|
|
1203
|
-
const id = options.id;
|
|
1204
|
-
if (id === this.currentLoadingModule) this.onLog(LOG_LEVEL_WARN, logCycleLoading(this.pluginName, this.currentLoadingModule));
|
|
1205
|
-
const moduleInfo = this.data.getModuleInfo(id, this.context);
|
|
1382
|
+
const id$1 = options.id;
|
|
1383
|
+
if (id$1 === this.currentLoadingModule) this.onLog(LOG_LEVEL_WARN, logCycleLoading(this.pluginName, this.currentLoadingModule));
|
|
1384
|
+
const moduleInfo = this.data.getModuleInfo(id$1, this.context);
|
|
1206
1385
|
if (moduleInfo && moduleInfo.code !== null) return moduleInfo;
|
|
1207
1386
|
const rawOptions = {
|
|
1208
1387
|
meta: options.meta || {},
|
|
1209
1388
|
moduleSideEffects: options.moduleSideEffects || null,
|
|
1210
1389
|
invalidate: false
|
|
1211
1390
|
};
|
|
1212
|
-
this.data.updateModuleOption(id, rawOptions);
|
|
1391
|
+
this.data.updateModuleOption(id$1, rawOptions);
|
|
1213
1392
|
async function createLoadModulePromise(context, data) {
|
|
1214
|
-
const loadPromise = data.loadModulePromiseMap.get(id);
|
|
1393
|
+
const loadPromise = data.loadModulePromiseMap.get(id$1);
|
|
1215
1394
|
if (loadPromise) return loadPromise;
|
|
1216
|
-
let resolveFn;
|
|
1217
1395
|
const promise = new Promise((resolve, _) => {
|
|
1218
|
-
|
|
1396
|
+
data.loadModulePromiseResolveFnMap.set(id$1, resolve);
|
|
1219
1397
|
});
|
|
1220
|
-
data.loadModulePromiseMap.set(id, promise);
|
|
1398
|
+
data.loadModulePromiseMap.set(id$1, promise);
|
|
1221
1399
|
try {
|
|
1222
|
-
await context.load(id, bindingifySideEffects(options.moduleSideEffects)
|
|
1223
|
-
resolveFn();
|
|
1224
|
-
});
|
|
1400
|
+
await context.load(id$1, bindingifySideEffects(options.moduleSideEffects));
|
|
1225
1401
|
} catch (e) {
|
|
1226
|
-
data.loadModulePromiseMap.delete(id);
|
|
1402
|
+
data.loadModulePromiseMap.delete(id$1);
|
|
1403
|
+
data.loadModulePromiseResolveFnMap.delete(id$1);
|
|
1227
1404
|
throw e;
|
|
1228
1405
|
}
|
|
1229
1406
|
return promise;
|
|
1230
1407
|
}
|
|
1231
1408
|
await createLoadModulePromise(this.context, this.data);
|
|
1232
|
-
return this.data.getModuleInfo(id, this.context);
|
|
1409
|
+
return this.data.getModuleInfo(id$1, this.context);
|
|
1233
1410
|
}
|
|
1234
1411
|
async resolve(source, importer, options) {
|
|
1235
1412
|
let receipt = void 0;
|
|
@@ -1272,8 +1449,8 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
|
|
|
1272
1449
|
getModuleIds() {
|
|
1273
1450
|
return this.data.getModuleIds(this.context);
|
|
1274
1451
|
}
|
|
1275
|
-
addWatchFile(id) {
|
|
1276
|
-
this.context.addWatchFile(id);
|
|
1452
|
+
addWatchFile(id$1) {
|
|
1453
|
+
this.context.addWatchFile(id$1);
|
|
1277
1454
|
}
|
|
1278
1455
|
parse(input, options) {
|
|
1279
1456
|
return parseAst(input, options);
|
|
@@ -1407,18 +1584,18 @@ function bindingifyTransform(args) {
|
|
|
1407
1584
|
if (!hook) return {};
|
|
1408
1585
|
const { handler, meta, options } = normalizeHook(hook);
|
|
1409
1586
|
return {
|
|
1410
|
-
plugin: async (ctx, code, id, meta$1) => {
|
|
1411
|
-
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);
|
|
1587
|
+
plugin: async (ctx, code$1, id$1, meta$1) => {
|
|
1588
|
+
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);
|
|
1412
1589
|
if (ret == null) return void 0;
|
|
1413
1590
|
if (typeof ret === "string") return { code: ret };
|
|
1414
|
-
let moduleOption = args.pluginContextData.updateModuleOption(id, {
|
|
1591
|
+
let moduleOption = args.pluginContextData.updateModuleOption(id$1, {
|
|
1415
1592
|
meta: ret.meta ?? {},
|
|
1416
1593
|
moduleSideEffects: ret.moduleSideEffects ?? null,
|
|
1417
1594
|
invalidate: false
|
|
1418
1595
|
});
|
|
1419
1596
|
return {
|
|
1420
1597
|
code: ret.code,
|
|
1421
|
-
map: bindingifySourcemap$1(normalizeTransformHookSourcemap(id, code, ret.map)),
|
|
1598
|
+
map: bindingifySourcemap$1(normalizeTransformHookSourcemap(id$1, code$1, ret.map)),
|
|
1422
1599
|
sideEffects: bindingifySideEffects(moduleOption.moduleSideEffects),
|
|
1423
1600
|
moduleType: ret.moduleType
|
|
1424
1601
|
};
|
|
@@ -1432,16 +1609,16 @@ function bindingifyLoad(args) {
|
|
|
1432
1609
|
if (!hook) return {};
|
|
1433
1610
|
const { handler, meta, options } = normalizeHook(hook);
|
|
1434
1611
|
return {
|
|
1435
|
-
plugin: async (ctx, id) => {
|
|
1436
|
-
const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode, id), id);
|
|
1612
|
+
plugin: async (ctx, id$1) => {
|
|
1613
|
+
const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode, id$1), id$1);
|
|
1437
1614
|
if (ret == null) return;
|
|
1438
1615
|
if (typeof ret === "string") return { code: ret };
|
|
1439
|
-
let moduleOption = args.pluginContextData.updateModuleOption(id, {
|
|
1616
|
+
let moduleOption = args.pluginContextData.updateModuleOption(id$1, {
|
|
1440
1617
|
meta: ret.meta || {},
|
|
1441
1618
|
moduleSideEffects: ret.moduleSideEffects ?? null,
|
|
1442
1619
|
invalidate: false
|
|
1443
1620
|
});
|
|
1444
|
-
let map = preProcessSourceMap(ret, id);
|
|
1621
|
+
let map = preProcessSourceMap(ret, id$1);
|
|
1445
1622
|
return {
|
|
1446
1623
|
code: ret.code,
|
|
1447
1624
|
map: bindingifySourcemap$1(map),
|
|
@@ -1453,11 +1630,11 @@ function bindingifyLoad(args) {
|
|
|
1453
1630
|
filter: bindingifyLoadFilter(options.filter)
|
|
1454
1631
|
};
|
|
1455
1632
|
}
|
|
1456
|
-
function preProcessSourceMap(ret, id) {
|
|
1633
|
+
function preProcessSourceMap(ret, id$1) {
|
|
1457
1634
|
if (!ret.map) return;
|
|
1458
1635
|
let map = typeof ret.map === "object" ? ret.map : JSON.parse(ret.map);
|
|
1459
1636
|
if (!isEmptySourcemapFiled(map.sources)) {
|
|
1460
|
-
const directory = path.dirname(id) || ".";
|
|
1637
|
+
const directory = path.dirname(id$1) || ".";
|
|
1461
1638
|
const sourceRoot = map.sourceRoot || ".";
|
|
1462
1639
|
map.sources = map.sources.map((source) => path.resolve(directory, sourceRoot, source));
|
|
1463
1640
|
}
|
|
@@ -1531,9 +1708,9 @@ function transformRenderedChunk(chunk) {
|
|
|
1531
1708
|
}
|
|
1532
1709
|
function transformChunkModules(modules) {
|
|
1533
1710
|
const result = {};
|
|
1534
|
-
for (let i = 0; i < modules.values.length; i++) {
|
|
1535
|
-
let key = modules.keys[i];
|
|
1536
|
-
const mod = modules.values[i];
|
|
1711
|
+
for (let i$1 = 0; i$1 < modules.values.length; i$1++) {
|
|
1712
|
+
let key = modules.keys[i$1];
|
|
1713
|
+
const mod = modules.values[i$1];
|
|
1537
1714
|
result[key] = transformToRenderedModule(mod);
|
|
1538
1715
|
}
|
|
1539
1716
|
return result;
|
|
@@ -1881,11 +2058,11 @@ function bindingifyRenderStart(args) {
|
|
|
1881
2058
|
function bindingifyRenderChunk(args) {
|
|
1882
2059
|
const hook = args.plugin.renderChunk;
|
|
1883
2060
|
if (!hook) return {};
|
|
1884
|
-
const { handler, meta } = normalizeHook(hook);
|
|
2061
|
+
const { handler, meta, options } = normalizeHook(hook);
|
|
1885
2062
|
return {
|
|
1886
|
-
plugin: async (ctx, code, chunk, opts, meta$1) => {
|
|
2063
|
+
plugin: async (ctx, code$1, chunk, opts, meta$1) => {
|
|
1887
2064
|
if (args.pluginContextData.getRenderChunkMeta() == null) args.pluginContextData.setRenderChunkMeta({ chunks: Object.fromEntries(Object.entries(meta$1.chunks).map(([key, value]) => [key, transformRenderedChunk(value)])) });
|
|
1888
|
-
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());
|
|
2065
|
+
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());
|
|
1889
2066
|
if (ret == null) return;
|
|
1890
2067
|
if (typeof ret === "string") return { code: ret };
|
|
1891
2068
|
if (!ret.map) return { code: ret.code };
|
|
@@ -1894,7 +2071,8 @@ function bindingifyRenderChunk(args) {
|
|
|
1894
2071
|
map: bindingifySourcemap$1(ret.map)
|
|
1895
2072
|
};
|
|
1896
2073
|
},
|
|
1897
|
-
meta: bindingifyPluginHookMeta(meta)
|
|
2074
|
+
meta: bindingifyPluginHookMeta(meta),
|
|
2075
|
+
filter: bindingifyRenderChunkFilter(options.filter)
|
|
1898
2076
|
};
|
|
1899
2077
|
}
|
|
1900
2078
|
function bindingifyAugmentChunkHash(args) {
|
|
@@ -2020,8 +2198,8 @@ function bindingifyWatchChange(args) {
|
|
|
2020
2198
|
if (!hook) return {};
|
|
2021
2199
|
const { handler, meta } = normalizeHook(hook);
|
|
2022
2200
|
return {
|
|
2023
|
-
plugin: async (ctx, id, event) => {
|
|
2024
|
-
await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), id, { event });
|
|
2201
|
+
plugin: async (ctx, id$1, event) => {
|
|
2202
|
+
await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), id$1, { event });
|
|
2025
2203
|
},
|
|
2026
2204
|
meta: bindingifyPluginHookMeta(meta)
|
|
2027
2205
|
};
|
|
@@ -2119,7 +2297,7 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
|
|
|
2119
2297
|
const { plugin: transform$1, meta: transformMeta, filter: transformFilter } = bindingifyTransform(args);
|
|
2120
2298
|
const { plugin: moduleParsed, meta: moduleParsedMeta } = bindingifyModuleParsed(args);
|
|
2121
2299
|
const { plugin: load, meta: loadMeta, filter: loadFilter } = bindingifyLoad(args);
|
|
2122
|
-
const { plugin: renderChunk, meta: renderChunkMeta } = bindingifyRenderChunk(args);
|
|
2300
|
+
const { plugin: renderChunk, meta: renderChunkMeta, filter: renderChunkFilter } = bindingifyRenderChunk(args);
|
|
2123
2301
|
const { plugin: augmentChunkHash, meta: augmentChunkHashMeta } = bindingifyAugmentChunkHash(args);
|
|
2124
2302
|
const { plugin: renderStart, meta: renderStartMeta } = bindingifyRenderStart(args);
|
|
2125
2303
|
const { plugin: renderError, meta: renderErrorMeta } = bindingifyRenderError(args);
|
|
@@ -2154,6 +2332,7 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
|
|
|
2154
2332
|
loadFilter,
|
|
2155
2333
|
renderChunk,
|
|
2156
2334
|
renderChunkMeta,
|
|
2335
|
+
renderChunkFilter,
|
|
2157
2336
|
augmentChunkHash,
|
|
2158
2337
|
augmentChunkHashMeta,
|
|
2159
2338
|
renderStart,
|
|
@@ -2226,47 +2405,48 @@ var PluginContextData = class {
|
|
|
2226
2405
|
moduleOptionMap = new Map();
|
|
2227
2406
|
resolveOptionsMap = new Map();
|
|
2228
2407
|
loadModulePromiseMap = new Map();
|
|
2408
|
+
loadModulePromiseResolveFnMap = new Map();
|
|
2229
2409
|
renderedChunkMeta = null;
|
|
2230
|
-
updateModuleOption(id, option) {
|
|
2231
|
-
const existing = this.moduleOptionMap.get(id);
|
|
2410
|
+
updateModuleOption(id$1, option) {
|
|
2411
|
+
const existing = this.moduleOptionMap.get(id$1);
|
|
2232
2412
|
if (existing) {
|
|
2233
2413
|
if (option.moduleSideEffects != null) existing.moduleSideEffects = option.moduleSideEffects;
|
|
2234
2414
|
if (option.meta != null) Object.assign(existing.meta, option.meta);
|
|
2235
2415
|
if (option.invalidate != null) existing.invalidate = option.invalidate;
|
|
2236
2416
|
} else {
|
|
2237
|
-
this.moduleOptionMap.set(id, option);
|
|
2417
|
+
this.moduleOptionMap.set(id$1, option);
|
|
2238
2418
|
return option;
|
|
2239
2419
|
}
|
|
2240
2420
|
return existing;
|
|
2241
2421
|
}
|
|
2242
|
-
getModuleOption(id) {
|
|
2243
|
-
const option = this.moduleOptionMap.get(id);
|
|
2422
|
+
getModuleOption(id$1) {
|
|
2423
|
+
const option = this.moduleOptionMap.get(id$1);
|
|
2244
2424
|
if (!option) {
|
|
2245
2425
|
const raw = {
|
|
2246
2426
|
moduleSideEffects: null,
|
|
2247
2427
|
meta: {}
|
|
2248
2428
|
};
|
|
2249
|
-
this.moduleOptionMap.set(id, raw);
|
|
2429
|
+
this.moduleOptionMap.set(id$1, raw);
|
|
2250
2430
|
return raw;
|
|
2251
2431
|
}
|
|
2252
2432
|
return option;
|
|
2253
2433
|
}
|
|
2254
|
-
getModuleInfo(id, context) {
|
|
2255
|
-
const bindingInfo = context.getModuleInfo(id);
|
|
2434
|
+
getModuleInfo(id$1, context) {
|
|
2435
|
+
const bindingInfo = context.getModuleInfo(id$1);
|
|
2256
2436
|
if (bindingInfo) {
|
|
2257
|
-
const info = transformModuleInfo(bindingInfo, this.getModuleOption(id));
|
|
2258
|
-
return this.proxyModuleInfo(id, info);
|
|
2437
|
+
const info = transformModuleInfo(bindingInfo, this.getModuleOption(id$1));
|
|
2438
|
+
return this.proxyModuleInfo(id$1, info);
|
|
2259
2439
|
}
|
|
2260
2440
|
return null;
|
|
2261
2441
|
}
|
|
2262
|
-
proxyModuleInfo(id, info) {
|
|
2442
|
+
proxyModuleInfo(id$1, info) {
|
|
2263
2443
|
let moduleSideEffects = info.moduleSideEffects;
|
|
2264
2444
|
Object.defineProperty(info, "moduleSideEffects", {
|
|
2265
2445
|
get() {
|
|
2266
2446
|
return moduleSideEffects;
|
|
2267
2447
|
},
|
|
2268
2448
|
set: (v$1) => {
|
|
2269
|
-
this.updateModuleOption(id, {
|
|
2449
|
+
this.updateModuleOption(id$1, {
|
|
2270
2450
|
moduleSideEffects: v$1,
|
|
2271
2451
|
meta: info.meta,
|
|
2272
2452
|
invalidate: true
|
|
@@ -2297,9 +2477,14 @@ var PluginContextData = class {
|
|
|
2297
2477
|
getRenderChunkMeta() {
|
|
2298
2478
|
return this.renderedChunkMeta;
|
|
2299
2479
|
}
|
|
2480
|
+
markModuleLoaded(id$1, _success) {
|
|
2481
|
+
const resolve = this.loadModulePromiseResolveFnMap.get(id$1);
|
|
2482
|
+
if (resolve) resolve();
|
|
2483
|
+
}
|
|
2300
2484
|
clear() {
|
|
2301
2485
|
this.renderedChunkMeta = null;
|
|
2302
2486
|
this.loadModulePromiseMap.clear();
|
|
2487
|
+
this.loadModulePromiseResolveFnMap.clear();
|
|
2303
2488
|
}
|
|
2304
2489
|
};
|
|
2305
2490
|
|
|
@@ -2363,7 +2548,8 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
|
|
|
2363
2548
|
},
|
|
2364
2549
|
makeAbsoluteExternalsRelative: bindingifyMakeAbsoluteExternalsRelative(inputOptions.makeAbsoluteExternalsRelative),
|
|
2365
2550
|
debug: inputOptions.debug,
|
|
2366
|
-
invalidateJsSideCache: pluginContextData.clear.bind(pluginContextData)
|
|
2551
|
+
invalidateJsSideCache: pluginContextData.clear.bind(pluginContextData),
|
|
2552
|
+
markModuleLoaded: pluginContextData.markModuleLoaded.bind(pluginContextData)
|
|
2367
2553
|
};
|
|
2368
2554
|
}
|
|
2369
2555
|
function bindingifyHmr(hmr) {
|
|
@@ -2374,15 +2560,15 @@ function bindingifyHmr(hmr) {
|
|
|
2374
2560
|
}
|
|
2375
2561
|
function bindingifyExternal(external) {
|
|
2376
2562
|
if (external) {
|
|
2377
|
-
if (typeof external === "function") return (id, importer, isResolved) => {
|
|
2378
|
-
if (id.startsWith("\0")) return false;
|
|
2379
|
-
return external(id, importer, isResolved) ?? false;
|
|
2563
|
+
if (typeof external === "function") return (id$1, importer, isResolved) => {
|
|
2564
|
+
if (id$1.startsWith("\0")) return false;
|
|
2565
|
+
return external(id$1, importer, isResolved) ?? false;
|
|
2380
2566
|
};
|
|
2381
2567
|
const externalArr = arraify(external);
|
|
2382
|
-
return (id, _importer, _isResolved) => {
|
|
2568
|
+
return (id$1, _importer, _isResolved) => {
|
|
2383
2569
|
return externalArr.some((pat) => {
|
|
2384
|
-
if (pat instanceof RegExp) return pat.test(id);
|
|
2385
|
-
return id === pat;
|
|
2570
|
+
if (pat instanceof RegExp) return pat.test(id$1);
|
|
2571
|
+
return id$1 === pat;
|
|
2386
2572
|
});
|
|
2387
2573
|
};
|
|
2388
2574
|
}
|
|
@@ -2503,31 +2689,6 @@ function bindingifyMakeAbsoluteExternalsRelative(makeAbsoluteExternalsRelative)
|
|
|
2503
2689
|
};
|
|
2504
2690
|
}
|
|
2505
2691
|
|
|
2506
|
-
//#endregion
|
|
2507
|
-
//#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-D6FCK2GA.js
|
|
2508
|
-
function u$1(o, n, a) {
|
|
2509
|
-
let t$1 = (r) => o(r, ...n);
|
|
2510
|
-
return a === void 0 ? t$1 : Object.assign(t$1, {
|
|
2511
|
-
lazy: a,
|
|
2512
|
-
lazyArgs: n
|
|
2513
|
-
});
|
|
2514
|
-
}
|
|
2515
|
-
|
|
2516
|
-
//#endregion
|
|
2517
|
-
//#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-WIMGWYZL.js
|
|
2518
|
-
function u(r, n, o) {
|
|
2519
|
-
let a = r.length - n.length;
|
|
2520
|
-
if (a === 0) return r(...n);
|
|
2521
|
-
if (a === 1) return u$1(r, n, o);
|
|
2522
|
-
throw new Error("Wrong number of arguments");
|
|
2523
|
-
}
|
|
2524
|
-
|
|
2525
|
-
//#endregion
|
|
2526
|
-
//#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-5NQBDF4H.js
|
|
2527
|
-
function t(...n) {
|
|
2528
|
-
return u(Object.keys, n);
|
|
2529
|
-
}
|
|
2530
|
-
|
|
2531
2692
|
//#endregion
|
|
2532
2693
|
//#region src/utils/plugin/index.ts
|
|
2533
2694
|
const isPluginHookName = function() {
|
|
@@ -2687,10 +2848,10 @@ function createComposedPlugin(plugins) {
|
|
|
2687
2848
|
case "load": {
|
|
2688
2849
|
if (batchedHooks.load) {
|
|
2689
2850
|
const batchedHandlers = batchedHooks.load;
|
|
2690
|
-
composed.load = async function(id) {
|
|
2851
|
+
composed.load = async function(id$1) {
|
|
2691
2852
|
for (const [handler, plugin] of batchedHandlers) {
|
|
2692
2853
|
const { handler: handlerFn } = normalizeHook(handler);
|
|
2693
|
-
const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), id);
|
|
2854
|
+
const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), id$1);
|
|
2694
2855
|
if (!isNullish(result)) return result;
|
|
2695
2856
|
}
|
|
2696
2857
|
};
|
|
@@ -2700,11 +2861,11 @@ function createComposedPlugin(plugins) {
|
|
|
2700
2861
|
case "transform": {
|
|
2701
2862
|
if (batchedHooks.transform) {
|
|
2702
2863
|
const batchedHandlers = batchedHooks.transform;
|
|
2703
|
-
composed.transform = async function(initialCode, id, moduleType) {
|
|
2704
|
-
let code = initialCode;
|
|
2864
|
+
composed.transform = async function(initialCode, id$1, moduleType$1) {
|
|
2865
|
+
let code$1 = initialCode;
|
|
2705
2866
|
let moduleSideEffects = void 0;
|
|
2706
2867
|
function updateOutput(newCode, newModuleSideEffects) {
|
|
2707
|
-
code = newCode;
|
|
2868
|
+
code$1 = newCode;
|
|
2708
2869
|
moduleSideEffects = newModuleSideEffects ?? void 0;
|
|
2709
2870
|
}
|
|
2710
2871
|
for (const [handler, plugin] of batchedHandlers) {
|
|
@@ -2712,14 +2873,14 @@ function createComposedPlugin(plugins) {
|
|
|
2712
2873
|
this.getCombinedSourcemap = () => {
|
|
2713
2874
|
throw new Error(`The getCombinedSourcemap is not implement in transform hook at composedJsPlugins`);
|
|
2714
2875
|
};
|
|
2715
|
-
const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), code, id, moduleType);
|
|
2876
|
+
const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), code$1, id$1, moduleType$1);
|
|
2716
2877
|
if (!isNullish(result)) {
|
|
2717
2878
|
if (typeof result === "string") updateOutput(result);
|
|
2718
2879
|
else if (result.code) updateOutput(result.code, result.moduleSideEffects);
|
|
2719
2880
|
}
|
|
2720
2881
|
}
|
|
2721
2882
|
return {
|
|
2722
|
-
code,
|
|
2883
|
+
code: code$1,
|
|
2723
2884
|
moduleSideEffects
|
|
2724
2885
|
};
|
|
2725
2886
|
};
|
|
@@ -2741,10 +2902,10 @@ function createComposedPlugin(plugins) {
|
|
|
2741
2902
|
case "renderChunk": {
|
|
2742
2903
|
if (batchedHooks.renderChunk) {
|
|
2743
2904
|
const batchedHandlers = batchedHooks.renderChunk;
|
|
2744
|
-
composed.renderChunk = async function(code, chunk, options, meta) {
|
|
2905
|
+
composed.renderChunk = async function(code$1, chunk, options, meta) {
|
|
2745
2906
|
for (const [handler, plugin] of batchedHandlers) {
|
|
2746
2907
|
const { handler: handlerFn } = normalizeHook(handler);
|
|
2747
|
-
const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), code, chunk, options, meta);
|
|
2908
|
+
const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), code$1, chunk, options, meta);
|
|
2748
2909
|
if (!isNullish(result)) return result;
|
|
2749
2910
|
}
|
|
2750
2911
|
};
|
|
@@ -2781,10 +2942,10 @@ function createComposedPlugin(plugins) {
|
|
|
2781
2942
|
case "watchChange": {
|
|
2782
2943
|
if (batchedHooks.watchChange) {
|
|
2783
2944
|
const batchedHandlers = batchedHooks.watchChange;
|
|
2784
|
-
composed.watchChange = async function(id, event) {
|
|
2945
|
+
composed.watchChange = async function(id$1, event) {
|
|
2785
2946
|
await Promise.all(batchedHandlers.map(([handler, plugin]) => {
|
|
2786
2947
|
const { handler: handlerFn } = normalizeHook(handler);
|
|
2787
|
-
return handlerFn.call(applyFixedPluginResolveFn(this, plugin), id, event);
|
|
2948
|
+
return handlerFn.call(applyFixedPluginResolveFn(this, plugin), id$1, event);
|
|
2788
2949
|
}));
|
|
2789
2950
|
};
|
|
2790
2951
|
}
|
|
@@ -2993,8 +3154,8 @@ var WatcherEmitter = class {
|
|
|
2993
3154
|
break;
|
|
2994
3155
|
case "event":
|
|
2995
3156
|
for (const listener of listeners) {
|
|
2996
|
-
const code = event.bundleEventKind();
|
|
2997
|
-
switch (code) {
|
|
3157
|
+
const code$1 = event.bundleEventKind();
|
|
3158
|
+
switch (code$1) {
|
|
2998
3159
|
case "BUNDLE_END":
|
|
2999
3160
|
const { duration, output } = event.bundleEndData();
|
|
3000
3161
|
await listener({
|
|
@@ -3011,7 +3172,7 @@ var WatcherEmitter = class {
|
|
|
3011
3172
|
});
|
|
3012
3173
|
break;
|
|
3013
3174
|
default:
|
|
3014
|
-
await listener({ code });
|
|
3175
|
+
await listener({ code: code$1 });
|
|
3015
3176
|
break;
|
|
3016
3177
|
}
|
|
3017
3178
|
}
|
|
@@ -3121,10 +3282,10 @@ function withFilter(pluginOption, filterObject) {
|
|
|
3121
3282
|
}
|
|
3122
3283
|
function findMatchedFilterObject(pluginName, overrideFilterObjectList) {
|
|
3123
3284
|
if (overrideFilterObjectList.length === 1 && overrideFilterObjectList[0].pluginNamePattern === void 0) return 0;
|
|
3124
|
-
for (let i = 0; i < overrideFilterObjectList.length; i++) for (let j = 0; j < (overrideFilterObjectList[i].pluginNamePattern ?? []).length; j++) {
|
|
3125
|
-
let pattern = overrideFilterObjectList[i].pluginNamePattern[j];
|
|
3126
|
-
if (typeof pattern === "string" && pattern === pluginName) return i;
|
|
3127
|
-
else if (pattern instanceof RegExp && pattern.test(pluginName)) return i;
|
|
3285
|
+
for (let i$1 = 0; i$1 < overrideFilterObjectList.length; i$1++) for (let j = 0; j < (overrideFilterObjectList[i$1].pluginNamePattern ?? []).length; j++) {
|
|
3286
|
+
let pattern = overrideFilterObjectList[i$1].pluginNamePattern[j];
|
|
3287
|
+
if (typeof pattern === "string" && pattern === pluginName) return i$1;
|
|
3288
|
+
else if (pattern instanceof RegExp && pattern.test(pluginName)) return i$1;
|
|
3128
3289
|
}
|
|
3129
3290
|
return -1;
|
|
3130
3291
|
}
|