@rolldown/browser 1.0.0-beta.8-commit.1fd551c → 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 +324 -162
- package/dist/cli.cjs +6 -5
- package/dist/cli.mjs +6 -5
- 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-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 +3 -2
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +3 -2
- 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-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/{parse-ast-index-DAk8Z2V8.cjs → parse-ast-index-B9pj8J1q.cjs} +14 -13
- package/dist/shared/{parse-ast-index-Cprsj_YY.mjs → parse-ast-index-DWHg_E7J.mjs} +15 -14
- package/dist/shared/{src-BLbX9IKh.cjs → src-DbbYa-_8.cjs} +248 -133
- package/dist/shared/{src-BkpdHXjc.mjs → src-RM00Zc4c.mjs} +1781 -1665
- package/package.json +3 -3
- /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) {
|
|
1068
1116
|
return {
|
|
1069
|
-
|
|
1070
|
-
|
|
1117
|
+
kind: "id",
|
|
1118
|
+
pattern
|
|
1071
1119
|
};
|
|
1072
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) {
|
|
1140
|
+
return {
|
|
1141
|
+
kind: "exclude",
|
|
1142
|
+
expr
|
|
1143
|
+
};
|
|
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
|
|
@@ -1105,7 +1284,7 @@ function bindingPluginOrder(order) {
|
|
|
1105
1284
|
}
|
|
1106
1285
|
|
|
1107
1286
|
//#endregion
|
|
1108
|
-
//#region ../../node_modules/.pnpm/oxc-parser@0.
|
|
1287
|
+
//#region ../../node_modules/.pnpm/oxc-parser@0.67.0/node_modules/oxc-parser/wrap.mjs
|
|
1109
1288
|
function wrap$1(result) {
|
|
1110
1289
|
let program, module, comments, errors;
|
|
1111
1290
|
return {
|
|
@@ -1127,19 +1306,20 @@ function wrap$1(result) {
|
|
|
1127
1306
|
}
|
|
1128
1307
|
};
|
|
1129
1308
|
}
|
|
1130
|
-
function jsonParseAst(
|
|
1131
|
-
return JSON.parse(
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1309
|
+
function jsonParseAst(program) {
|
|
1310
|
+
return JSON.parse(program, transform);
|
|
1311
|
+
}
|
|
1312
|
+
function transform(key, value) {
|
|
1313
|
+
if (value === null && key === "value" && Object.hasOwn(this, "type") && this.type === "Literal") {
|
|
1314
|
+
if (Object.hasOwn(this, "bigint")) return BigInt(this.bigint);
|
|
1315
|
+
if (Object.hasOwn(this, "regex")) {
|
|
1316
|
+
const { regex } = this;
|
|
1317
|
+
try {
|
|
1318
|
+
return RegExp(regex.pattern, regex.flags);
|
|
1319
|
+
} catch (_err) {}
|
|
1140
1320
|
}
|
|
1141
|
-
|
|
1142
|
-
|
|
1321
|
+
}
|
|
1322
|
+
return value;
|
|
1143
1323
|
}
|
|
1144
1324
|
|
|
1145
1325
|
//#endregion
|
|
@@ -1151,12 +1331,12 @@ function wrap(result, sourceText) {
|
|
|
1151
1331
|
}
|
|
1152
1332
|
function normalizeParseError(sourceText, errors) {
|
|
1153
1333
|
let message = `Parse failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
|
|
1154
|
-
for (let i = 0; i < errors.length; i++) {
|
|
1155
|
-
if (i >= 5) {
|
|
1334
|
+
for (let i$1 = 0; i$1 < errors.length; i$1++) {
|
|
1335
|
+
if (i$1 >= 5) {
|
|
1156
1336
|
message += "\n...";
|
|
1157
1337
|
break;
|
|
1158
1338
|
}
|
|
1159
|
-
const e = errors[i];
|
|
1339
|
+
const e = errors[i$1];
|
|
1160
1340
|
message += e.message + "\n" + e.labels.map((label) => {
|
|
1161
1341
|
const location = locate(sourceText, label.start, { offsetLine: 1 });
|
|
1162
1342
|
if (!location) return;
|
|
@@ -1196,39 +1376,37 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
|
|
|
1196
1376
|
this.data = data;
|
|
1197
1377
|
this.onLog = onLog;
|
|
1198
1378
|
this.currentLoadingModule = currentLoadingModule;
|
|
1199
|
-
this.getModuleInfo = (id) => this.data.getModuleInfo(id, context);
|
|
1379
|
+
this.getModuleInfo = (id$1) => this.data.getModuleInfo(id$1, context);
|
|
1200
1380
|
}
|
|
1201
1381
|
async load(options) {
|
|
1202
|
-
const id = options.id;
|
|
1203
|
-
if (id === this.currentLoadingModule) this.onLog(LOG_LEVEL_WARN, logCycleLoading(this.pluginName, this.currentLoadingModule));
|
|
1204
|
-
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);
|
|
1205
1385
|
if (moduleInfo && moduleInfo.code !== null) return moduleInfo;
|
|
1206
1386
|
const rawOptions = {
|
|
1207
1387
|
meta: options.meta || {},
|
|
1208
1388
|
moduleSideEffects: options.moduleSideEffects || null,
|
|
1209
1389
|
invalidate: false
|
|
1210
1390
|
};
|
|
1211
|
-
this.data.updateModuleOption(id, rawOptions);
|
|
1391
|
+
this.data.updateModuleOption(id$1, rawOptions);
|
|
1212
1392
|
async function createLoadModulePromise(context, data) {
|
|
1213
|
-
const loadPromise = data.loadModulePromiseMap.get(id);
|
|
1393
|
+
const loadPromise = data.loadModulePromiseMap.get(id$1);
|
|
1214
1394
|
if (loadPromise) return loadPromise;
|
|
1215
|
-
let resolveFn;
|
|
1216
1395
|
const promise = new Promise((resolve, _) => {
|
|
1217
|
-
|
|
1396
|
+
data.loadModulePromiseResolveFnMap.set(id$1, resolve);
|
|
1218
1397
|
});
|
|
1219
|
-
data.loadModulePromiseMap.set(id, promise);
|
|
1398
|
+
data.loadModulePromiseMap.set(id$1, promise);
|
|
1220
1399
|
try {
|
|
1221
|
-
await context.load(id, bindingifySideEffects(options.moduleSideEffects)
|
|
1222
|
-
resolveFn();
|
|
1223
|
-
});
|
|
1400
|
+
await context.load(id$1, bindingifySideEffects(options.moduleSideEffects));
|
|
1224
1401
|
} catch (e) {
|
|
1225
|
-
data.loadModulePromiseMap.delete(id);
|
|
1402
|
+
data.loadModulePromiseMap.delete(id$1);
|
|
1403
|
+
data.loadModulePromiseResolveFnMap.delete(id$1);
|
|
1226
1404
|
throw e;
|
|
1227
1405
|
}
|
|
1228
1406
|
return promise;
|
|
1229
1407
|
}
|
|
1230
1408
|
await createLoadModulePromise(this.context, this.data);
|
|
1231
|
-
return this.data.getModuleInfo(id, this.context);
|
|
1409
|
+
return this.data.getModuleInfo(id$1, this.context);
|
|
1232
1410
|
}
|
|
1233
1411
|
async resolve(source, importer, options) {
|
|
1234
1412
|
let receipt = void 0;
|
|
@@ -1271,8 +1449,8 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
|
|
|
1271
1449
|
getModuleIds() {
|
|
1272
1450
|
return this.data.getModuleIds(this.context);
|
|
1273
1451
|
}
|
|
1274
|
-
addWatchFile(id) {
|
|
1275
|
-
this.context.addWatchFile(id);
|
|
1452
|
+
addWatchFile(id$1) {
|
|
1453
|
+
this.context.addWatchFile(id$1);
|
|
1276
1454
|
}
|
|
1277
1455
|
parse(input, options) {
|
|
1278
1456
|
return parseAst(input, options);
|
|
@@ -1406,18 +1584,18 @@ function bindingifyTransform(args) {
|
|
|
1406
1584
|
if (!hook) return {};
|
|
1407
1585
|
const { handler, meta, options } = normalizeHook(hook);
|
|
1408
1586
|
return {
|
|
1409
|
-
plugin: async (ctx, code, id, meta$1) => {
|
|
1410
|
-
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);
|
|
1411
1589
|
if (ret == null) return void 0;
|
|
1412
1590
|
if (typeof ret === "string") return { code: ret };
|
|
1413
|
-
let moduleOption = args.pluginContextData.updateModuleOption(id, {
|
|
1591
|
+
let moduleOption = args.pluginContextData.updateModuleOption(id$1, {
|
|
1414
1592
|
meta: ret.meta ?? {},
|
|
1415
1593
|
moduleSideEffects: ret.moduleSideEffects ?? null,
|
|
1416
1594
|
invalidate: false
|
|
1417
1595
|
});
|
|
1418
1596
|
return {
|
|
1419
1597
|
code: ret.code,
|
|
1420
|
-
map: bindingifySourcemap$1(normalizeTransformHookSourcemap(id, code, ret.map)),
|
|
1598
|
+
map: bindingifySourcemap$1(normalizeTransformHookSourcemap(id$1, code$1, ret.map)),
|
|
1421
1599
|
sideEffects: bindingifySideEffects(moduleOption.moduleSideEffects),
|
|
1422
1600
|
moduleType: ret.moduleType
|
|
1423
1601
|
};
|
|
@@ -1431,16 +1609,16 @@ function bindingifyLoad(args) {
|
|
|
1431
1609
|
if (!hook) return {};
|
|
1432
1610
|
const { handler, meta, options } = normalizeHook(hook);
|
|
1433
1611
|
return {
|
|
1434
|
-
plugin: async (ctx, id) => {
|
|
1435
|
-
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);
|
|
1436
1614
|
if (ret == null) return;
|
|
1437
1615
|
if (typeof ret === "string") return { code: ret };
|
|
1438
|
-
let moduleOption = args.pluginContextData.updateModuleOption(id, {
|
|
1616
|
+
let moduleOption = args.pluginContextData.updateModuleOption(id$1, {
|
|
1439
1617
|
meta: ret.meta || {},
|
|
1440
1618
|
moduleSideEffects: ret.moduleSideEffects ?? null,
|
|
1441
1619
|
invalidate: false
|
|
1442
1620
|
});
|
|
1443
|
-
let map = preProcessSourceMap(ret, id);
|
|
1621
|
+
let map = preProcessSourceMap(ret, id$1);
|
|
1444
1622
|
return {
|
|
1445
1623
|
code: ret.code,
|
|
1446
1624
|
map: bindingifySourcemap$1(map),
|
|
@@ -1452,11 +1630,11 @@ function bindingifyLoad(args) {
|
|
|
1452
1630
|
filter: bindingifyLoadFilter(options.filter)
|
|
1453
1631
|
};
|
|
1454
1632
|
}
|
|
1455
|
-
function preProcessSourceMap(ret, id) {
|
|
1633
|
+
function preProcessSourceMap(ret, id$1) {
|
|
1456
1634
|
if (!ret.map) return;
|
|
1457
1635
|
let map = typeof ret.map === "object" ? ret.map : JSON.parse(ret.map);
|
|
1458
1636
|
if (!isEmptySourcemapFiled(map.sources)) {
|
|
1459
|
-
const directory = path.dirname(id) || ".";
|
|
1637
|
+
const directory = path.dirname(id$1) || ".";
|
|
1460
1638
|
const sourceRoot = map.sourceRoot || ".";
|
|
1461
1639
|
map.sources = map.sources.map((source) => path.resolve(directory, sourceRoot, source));
|
|
1462
1640
|
}
|
|
@@ -1530,9 +1708,9 @@ function transformRenderedChunk(chunk) {
|
|
|
1530
1708
|
}
|
|
1531
1709
|
function transformChunkModules(modules) {
|
|
1532
1710
|
const result = {};
|
|
1533
|
-
for (let i = 0; i < modules.values.length; i++) {
|
|
1534
|
-
let key = modules.keys[i];
|
|
1535
|
-
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];
|
|
1536
1714
|
result[key] = transformToRenderedModule(mod);
|
|
1537
1715
|
}
|
|
1538
1716
|
return result;
|
|
@@ -1880,11 +2058,11 @@ function bindingifyRenderStart(args) {
|
|
|
1880
2058
|
function bindingifyRenderChunk(args) {
|
|
1881
2059
|
const hook = args.plugin.renderChunk;
|
|
1882
2060
|
if (!hook) return {};
|
|
1883
|
-
const { handler, meta } = normalizeHook(hook);
|
|
2061
|
+
const { handler, meta, options } = normalizeHook(hook);
|
|
1884
2062
|
return {
|
|
1885
|
-
plugin: async (ctx, code, chunk, opts, meta$1) => {
|
|
2063
|
+
plugin: async (ctx, code$1, chunk, opts, meta$1) => {
|
|
1886
2064
|
if (args.pluginContextData.getRenderChunkMeta() == null) args.pluginContextData.setRenderChunkMeta({ chunks: Object.fromEntries(Object.entries(meta$1.chunks).map(([key, value]) => [key, transformRenderedChunk(value)])) });
|
|
1887
|
-
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());
|
|
1888
2066
|
if (ret == null) return;
|
|
1889
2067
|
if (typeof ret === "string") return { code: ret };
|
|
1890
2068
|
if (!ret.map) return { code: ret.code };
|
|
@@ -1893,7 +2071,8 @@ function bindingifyRenderChunk(args) {
|
|
|
1893
2071
|
map: bindingifySourcemap$1(ret.map)
|
|
1894
2072
|
};
|
|
1895
2073
|
},
|
|
1896
|
-
meta: bindingifyPluginHookMeta(meta)
|
|
2074
|
+
meta: bindingifyPluginHookMeta(meta),
|
|
2075
|
+
filter: bindingifyRenderChunkFilter(options.filter)
|
|
1897
2076
|
};
|
|
1898
2077
|
}
|
|
1899
2078
|
function bindingifyAugmentChunkHash(args) {
|
|
@@ -2019,8 +2198,8 @@ function bindingifyWatchChange(args) {
|
|
|
2019
2198
|
if (!hook) return {};
|
|
2020
2199
|
const { handler, meta } = normalizeHook(hook);
|
|
2021
2200
|
return {
|
|
2022
|
-
plugin: async (ctx, id, event) => {
|
|
2023
|
-
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 });
|
|
2024
2203
|
},
|
|
2025
2204
|
meta: bindingifyPluginHookMeta(meta)
|
|
2026
2205
|
};
|
|
@@ -2115,10 +2294,10 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
|
|
|
2115
2294
|
const { plugin: resolveId, meta: resolveIdMeta, filter: resolveIdFilter } = bindingifyResolveId(args);
|
|
2116
2295
|
const { plugin: resolveDynamicImport, meta: resolveDynamicImportMeta } = bindingifyResolveDynamicImport(args);
|
|
2117
2296
|
const { plugin: buildEnd, meta: buildEndMeta } = bindingifyBuildEnd(args);
|
|
2118
|
-
const { plugin: transform, meta: transformMeta, filter: transformFilter } = bindingifyTransform(args);
|
|
2297
|
+
const { plugin: transform$1, meta: transformMeta, filter: transformFilter } = bindingifyTransform(args);
|
|
2119
2298
|
const { plugin: moduleParsed, meta: moduleParsedMeta } = bindingifyModuleParsed(args);
|
|
2120
2299
|
const { plugin: load, meta: loadMeta, filter: loadFilter } = bindingifyLoad(args);
|
|
2121
|
-
const { plugin: renderChunk, meta: renderChunkMeta } = bindingifyRenderChunk(args);
|
|
2300
|
+
const { plugin: renderChunk, meta: renderChunkMeta, filter: renderChunkFilter } = bindingifyRenderChunk(args);
|
|
2122
2301
|
const { plugin: augmentChunkHash, meta: augmentChunkHashMeta } = bindingifyAugmentChunkHash(args);
|
|
2123
2302
|
const { plugin: renderStart, meta: renderStartMeta } = bindingifyRenderStart(args);
|
|
2124
2303
|
const { plugin: renderError, meta: renderErrorMeta } = bindingifyRenderError(args);
|
|
@@ -2143,7 +2322,7 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
|
|
|
2143
2322
|
resolveDynamicImportMeta,
|
|
2144
2323
|
buildEnd,
|
|
2145
2324
|
buildEndMeta,
|
|
2146
|
-
transform,
|
|
2325
|
+
transform: transform$1,
|
|
2147
2326
|
transformMeta,
|
|
2148
2327
|
transformFilter,
|
|
2149
2328
|
moduleParsed,
|
|
@@ -2153,6 +2332,7 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
|
|
|
2153
2332
|
loadFilter,
|
|
2154
2333
|
renderChunk,
|
|
2155
2334
|
renderChunkMeta,
|
|
2335
|
+
renderChunkFilter,
|
|
2156
2336
|
augmentChunkHash,
|
|
2157
2337
|
augmentChunkHashMeta,
|
|
2158
2338
|
renderStart,
|
|
@@ -2225,47 +2405,48 @@ var PluginContextData = class {
|
|
|
2225
2405
|
moduleOptionMap = new Map();
|
|
2226
2406
|
resolveOptionsMap = new Map();
|
|
2227
2407
|
loadModulePromiseMap = new Map();
|
|
2408
|
+
loadModulePromiseResolveFnMap = new Map();
|
|
2228
2409
|
renderedChunkMeta = null;
|
|
2229
|
-
updateModuleOption(id, option) {
|
|
2230
|
-
const existing = this.moduleOptionMap.get(id);
|
|
2410
|
+
updateModuleOption(id$1, option) {
|
|
2411
|
+
const existing = this.moduleOptionMap.get(id$1);
|
|
2231
2412
|
if (existing) {
|
|
2232
2413
|
if (option.moduleSideEffects != null) existing.moduleSideEffects = option.moduleSideEffects;
|
|
2233
2414
|
if (option.meta != null) Object.assign(existing.meta, option.meta);
|
|
2234
2415
|
if (option.invalidate != null) existing.invalidate = option.invalidate;
|
|
2235
2416
|
} else {
|
|
2236
|
-
this.moduleOptionMap.set(id, option);
|
|
2417
|
+
this.moduleOptionMap.set(id$1, option);
|
|
2237
2418
|
return option;
|
|
2238
2419
|
}
|
|
2239
2420
|
return existing;
|
|
2240
2421
|
}
|
|
2241
|
-
getModuleOption(id) {
|
|
2242
|
-
const option = this.moduleOptionMap.get(id);
|
|
2422
|
+
getModuleOption(id$1) {
|
|
2423
|
+
const option = this.moduleOptionMap.get(id$1);
|
|
2243
2424
|
if (!option) {
|
|
2244
2425
|
const raw = {
|
|
2245
2426
|
moduleSideEffects: null,
|
|
2246
2427
|
meta: {}
|
|
2247
2428
|
};
|
|
2248
|
-
this.moduleOptionMap.set(id, raw);
|
|
2429
|
+
this.moduleOptionMap.set(id$1, raw);
|
|
2249
2430
|
return raw;
|
|
2250
2431
|
}
|
|
2251
2432
|
return option;
|
|
2252
2433
|
}
|
|
2253
|
-
getModuleInfo(id, context) {
|
|
2254
|
-
const bindingInfo = context.getModuleInfo(id);
|
|
2434
|
+
getModuleInfo(id$1, context) {
|
|
2435
|
+
const bindingInfo = context.getModuleInfo(id$1);
|
|
2255
2436
|
if (bindingInfo) {
|
|
2256
|
-
const info = transformModuleInfo(bindingInfo, this.getModuleOption(id));
|
|
2257
|
-
return this.proxyModuleInfo(id, info);
|
|
2437
|
+
const info = transformModuleInfo(bindingInfo, this.getModuleOption(id$1));
|
|
2438
|
+
return this.proxyModuleInfo(id$1, info);
|
|
2258
2439
|
}
|
|
2259
2440
|
return null;
|
|
2260
2441
|
}
|
|
2261
|
-
proxyModuleInfo(id, info) {
|
|
2442
|
+
proxyModuleInfo(id$1, info) {
|
|
2262
2443
|
let moduleSideEffects = info.moduleSideEffects;
|
|
2263
2444
|
Object.defineProperty(info, "moduleSideEffects", {
|
|
2264
2445
|
get() {
|
|
2265
2446
|
return moduleSideEffects;
|
|
2266
2447
|
},
|
|
2267
2448
|
set: (v$1) => {
|
|
2268
|
-
this.updateModuleOption(id, {
|
|
2449
|
+
this.updateModuleOption(id$1, {
|
|
2269
2450
|
moduleSideEffects: v$1,
|
|
2270
2451
|
meta: info.meta,
|
|
2271
2452
|
invalidate: true
|
|
@@ -2296,9 +2477,14 @@ var PluginContextData = class {
|
|
|
2296
2477
|
getRenderChunkMeta() {
|
|
2297
2478
|
return this.renderedChunkMeta;
|
|
2298
2479
|
}
|
|
2480
|
+
markModuleLoaded(id$1, _success) {
|
|
2481
|
+
const resolve = this.loadModulePromiseResolveFnMap.get(id$1);
|
|
2482
|
+
if (resolve) resolve();
|
|
2483
|
+
}
|
|
2299
2484
|
clear() {
|
|
2300
2485
|
this.renderedChunkMeta = null;
|
|
2301
2486
|
this.loadModulePromiseMap.clear();
|
|
2487
|
+
this.loadModulePromiseResolveFnMap.clear();
|
|
2302
2488
|
}
|
|
2303
2489
|
};
|
|
2304
2490
|
|
|
@@ -2362,7 +2548,8 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
|
|
|
2362
2548
|
},
|
|
2363
2549
|
makeAbsoluteExternalsRelative: bindingifyMakeAbsoluteExternalsRelative(inputOptions.makeAbsoluteExternalsRelative),
|
|
2364
2550
|
debug: inputOptions.debug,
|
|
2365
|
-
invalidateJsSideCache: pluginContextData.clear.bind(pluginContextData)
|
|
2551
|
+
invalidateJsSideCache: pluginContextData.clear.bind(pluginContextData),
|
|
2552
|
+
markModuleLoaded: pluginContextData.markModuleLoaded.bind(pluginContextData)
|
|
2366
2553
|
};
|
|
2367
2554
|
}
|
|
2368
2555
|
function bindingifyHmr(hmr) {
|
|
@@ -2373,15 +2560,15 @@ function bindingifyHmr(hmr) {
|
|
|
2373
2560
|
}
|
|
2374
2561
|
function bindingifyExternal(external) {
|
|
2375
2562
|
if (external) {
|
|
2376
|
-
if (typeof external === "function") return (id, importer, isResolved) => {
|
|
2377
|
-
if (id.startsWith("\0")) return false;
|
|
2378
|
-
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;
|
|
2379
2566
|
};
|
|
2380
2567
|
const externalArr = arraify(external);
|
|
2381
|
-
return (id, _importer, _isResolved) => {
|
|
2568
|
+
return (id$1, _importer, _isResolved) => {
|
|
2382
2569
|
return externalArr.some((pat) => {
|
|
2383
|
-
if (pat instanceof RegExp) return pat.test(id);
|
|
2384
|
-
return id === pat;
|
|
2570
|
+
if (pat instanceof RegExp) return pat.test(id$1);
|
|
2571
|
+
return id$1 === pat;
|
|
2385
2572
|
});
|
|
2386
2573
|
};
|
|
2387
2574
|
}
|
|
@@ -2502,31 +2689,6 @@ function bindingifyMakeAbsoluteExternalsRelative(makeAbsoluteExternalsRelative)
|
|
|
2502
2689
|
};
|
|
2503
2690
|
}
|
|
2504
2691
|
|
|
2505
|
-
//#endregion
|
|
2506
|
-
//#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-D6FCK2GA.js
|
|
2507
|
-
function u$1(o, n, a) {
|
|
2508
|
-
let t$1 = (r) => o(r, ...n);
|
|
2509
|
-
return a === void 0 ? t$1 : Object.assign(t$1, {
|
|
2510
|
-
lazy: a,
|
|
2511
|
-
lazyArgs: n
|
|
2512
|
-
});
|
|
2513
|
-
}
|
|
2514
|
-
|
|
2515
|
-
//#endregion
|
|
2516
|
-
//#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-WIMGWYZL.js
|
|
2517
|
-
function u(r, n, o) {
|
|
2518
|
-
let a = r.length - n.length;
|
|
2519
|
-
if (a === 0) return r(...n);
|
|
2520
|
-
if (a === 1) return u$1(r, n, o);
|
|
2521
|
-
throw new Error("Wrong number of arguments");
|
|
2522
|
-
}
|
|
2523
|
-
|
|
2524
|
-
//#endregion
|
|
2525
|
-
//#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-5NQBDF4H.js
|
|
2526
|
-
function t(...n) {
|
|
2527
|
-
return u(Object.keys, n);
|
|
2528
|
-
}
|
|
2529
|
-
|
|
2530
2692
|
//#endregion
|
|
2531
2693
|
//#region src/utils/plugin/index.ts
|
|
2532
2694
|
const isPluginHookName = function() {
|
|
@@ -2686,10 +2848,10 @@ function createComposedPlugin(plugins) {
|
|
|
2686
2848
|
case "load": {
|
|
2687
2849
|
if (batchedHooks.load) {
|
|
2688
2850
|
const batchedHandlers = batchedHooks.load;
|
|
2689
|
-
composed.load = async function(id) {
|
|
2851
|
+
composed.load = async function(id$1) {
|
|
2690
2852
|
for (const [handler, plugin] of batchedHandlers) {
|
|
2691
2853
|
const { handler: handlerFn } = normalizeHook(handler);
|
|
2692
|
-
const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), id);
|
|
2854
|
+
const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), id$1);
|
|
2693
2855
|
if (!isNullish(result)) return result;
|
|
2694
2856
|
}
|
|
2695
2857
|
};
|
|
@@ -2699,11 +2861,11 @@ function createComposedPlugin(plugins) {
|
|
|
2699
2861
|
case "transform": {
|
|
2700
2862
|
if (batchedHooks.transform) {
|
|
2701
2863
|
const batchedHandlers = batchedHooks.transform;
|
|
2702
|
-
composed.transform = async function(initialCode, id, moduleType) {
|
|
2703
|
-
let code = initialCode;
|
|
2864
|
+
composed.transform = async function(initialCode, id$1, moduleType$1) {
|
|
2865
|
+
let code$1 = initialCode;
|
|
2704
2866
|
let moduleSideEffects = void 0;
|
|
2705
2867
|
function updateOutput(newCode, newModuleSideEffects) {
|
|
2706
|
-
code = newCode;
|
|
2868
|
+
code$1 = newCode;
|
|
2707
2869
|
moduleSideEffects = newModuleSideEffects ?? void 0;
|
|
2708
2870
|
}
|
|
2709
2871
|
for (const [handler, plugin] of batchedHandlers) {
|
|
@@ -2711,14 +2873,14 @@ function createComposedPlugin(plugins) {
|
|
|
2711
2873
|
this.getCombinedSourcemap = () => {
|
|
2712
2874
|
throw new Error(`The getCombinedSourcemap is not implement in transform hook at composedJsPlugins`);
|
|
2713
2875
|
};
|
|
2714
|
-
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);
|
|
2715
2877
|
if (!isNullish(result)) {
|
|
2716
2878
|
if (typeof result === "string") updateOutput(result);
|
|
2717
2879
|
else if (result.code) updateOutput(result.code, result.moduleSideEffects);
|
|
2718
2880
|
}
|
|
2719
2881
|
}
|
|
2720
2882
|
return {
|
|
2721
|
-
code,
|
|
2883
|
+
code: code$1,
|
|
2722
2884
|
moduleSideEffects
|
|
2723
2885
|
};
|
|
2724
2886
|
};
|
|
@@ -2740,10 +2902,10 @@ function createComposedPlugin(plugins) {
|
|
|
2740
2902
|
case "renderChunk": {
|
|
2741
2903
|
if (batchedHooks.renderChunk) {
|
|
2742
2904
|
const batchedHandlers = batchedHooks.renderChunk;
|
|
2743
|
-
composed.renderChunk = async function(code, chunk, options, meta) {
|
|
2905
|
+
composed.renderChunk = async function(code$1, chunk, options, meta) {
|
|
2744
2906
|
for (const [handler, plugin] of batchedHandlers) {
|
|
2745
2907
|
const { handler: handlerFn } = normalizeHook(handler);
|
|
2746
|
-
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);
|
|
2747
2909
|
if (!isNullish(result)) return result;
|
|
2748
2910
|
}
|
|
2749
2911
|
};
|
|
@@ -2780,10 +2942,10 @@ function createComposedPlugin(plugins) {
|
|
|
2780
2942
|
case "watchChange": {
|
|
2781
2943
|
if (batchedHooks.watchChange) {
|
|
2782
2944
|
const batchedHandlers = batchedHooks.watchChange;
|
|
2783
|
-
composed.watchChange = async function(id, event) {
|
|
2945
|
+
composed.watchChange = async function(id$1, event) {
|
|
2784
2946
|
await Promise.all(batchedHandlers.map(([handler, plugin]) => {
|
|
2785
2947
|
const { handler: handlerFn } = normalizeHook(handler);
|
|
2786
|
-
return handlerFn.call(applyFixedPluginResolveFn(this, plugin), id, event);
|
|
2948
|
+
return handlerFn.call(applyFixedPluginResolveFn(this, plugin), id$1, event);
|
|
2787
2949
|
}));
|
|
2788
2950
|
};
|
|
2789
2951
|
}
|
|
@@ -2992,8 +3154,8 @@ var WatcherEmitter = class {
|
|
|
2992
3154
|
break;
|
|
2993
3155
|
case "event":
|
|
2994
3156
|
for (const listener of listeners) {
|
|
2995
|
-
const code = event.bundleEventKind();
|
|
2996
|
-
switch (code) {
|
|
3157
|
+
const code$1 = event.bundleEventKind();
|
|
3158
|
+
switch (code$1) {
|
|
2997
3159
|
case "BUNDLE_END":
|
|
2998
3160
|
const { duration, output } = event.bundleEndData();
|
|
2999
3161
|
await listener({
|
|
@@ -3010,7 +3172,7 @@ var WatcherEmitter = class {
|
|
|
3010
3172
|
});
|
|
3011
3173
|
break;
|
|
3012
3174
|
default:
|
|
3013
|
-
await listener({ code });
|
|
3175
|
+
await listener({ code: code$1 });
|
|
3014
3176
|
break;
|
|
3015
3177
|
}
|
|
3016
3178
|
}
|
|
@@ -3120,10 +3282,10 @@ function withFilter(pluginOption, filterObject) {
|
|
|
3120
3282
|
}
|
|
3121
3283
|
function findMatchedFilterObject(pluginName, overrideFilterObjectList) {
|
|
3122
3284
|
if (overrideFilterObjectList.length === 1 && overrideFilterObjectList[0].pluginNamePattern === void 0) return 0;
|
|
3123
|
-
for (let i = 0; i < overrideFilterObjectList.length; i++) for (let j = 0; j < (overrideFilterObjectList[i].pluginNamePattern ?? []).length; j++) {
|
|
3124
|
-
let pattern = overrideFilterObjectList[i].pluginNamePattern[j];
|
|
3125
|
-
if (typeof pattern === "string" && pattern === pluginName) return i;
|
|
3126
|
-
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;
|
|
3127
3289
|
}
|
|
3128
3290
|
return -1;
|
|
3129
3291
|
}
|