rolldown 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.
Files changed (33) hide show
  1. package/dist/cli.cjs +4 -3
  2. package/dist/cli.mjs +4 -3
  3. package/dist/experimental-index.cjs +3 -2
  4. package/dist/experimental-index.d.cts +1 -1
  5. package/dist/experimental-index.d.mts +2 -2
  6. package/dist/experimental-index.mjs +3 -2
  7. package/dist/filter-expression-index.cjs +11 -0
  8. package/dist/filter-expression-index.d.cts +4 -0
  9. package/dist/filter-expression-index.d.mts +4 -0
  10. package/dist/filter-expression-index.mjs +4 -0
  11. package/dist/index.cjs +3 -2
  12. package/dist/index.d.cts +2 -2
  13. package/dist/index.d.mts +3 -3
  14. package/dist/index.mjs +3 -2
  15. package/dist/parallel-plugin-worker.cjs +3 -2
  16. package/dist/parallel-plugin-worker.mjs +3 -2
  17. package/dist/parallel-plugin.d.cts +1 -1
  18. package/dist/parallel-plugin.d.mts +2 -2
  19. package/dist/parse-ast-index.cjs +1 -1
  20. package/dist/parse-ast-index.d.mts +1 -1
  21. package/dist/parse-ast-index.mjs +1 -1
  22. package/dist/shared/filter-expression-index-BKmgnKlV.mjs +69 -0
  23. package/dist/shared/filter-expression-index-CRtoeipP.cjs +119 -0
  24. package/dist/shared/{input-options.d-DW_DouH4.d.cts → input-options.d-BHwth6VM.d.cts} +83 -21
  25. package/dist/shared/{input-options.d-BS41m-u8.d.mts → input-options.d-CN-JV5dt.d.mts} +84 -22
  26. package/dist/shared/{parse-ast-index-BU0vRbCC.cjs → parse-ast-index-Bbz37LOL.cjs} +1 -0
  27. package/dist/shared/{parse-ast-index-C5zEG9SJ.mjs → parse-ast-index-D0SmlXT6.mjs} +1 -0
  28. package/dist/shared/{src-Bv1wl15e.cjs → src-B4f_CmD8.cjs} +248 -133
  29. package/dist/shared/{src-IKFm0rpN.mjs → src-CaxK4-gB.mjs} +1781 -1665
  30. package/package.json +19 -15
  31. /package/dist/shared/{binding.d-N_CFNfq2.d.mts → binding.d-BaNmLM9c.d.mts} +0 -0
  32. /package/dist/shared/{prompt-_yrURmmm.cjs → prompt-At99RuKY.cjs} +0 -0
  33. /package/dist/shared/{prompt-V-Wm9PcC.mjs → prompt-UMUDMApt.mjs} +0 -0
@@ -1,5 +1,6 @@
1
1
  import { __esm } from "./chunk-DUYDk_2O.mjs";
2
- import { augmentCodeLocation, error, import_binding, init_logs, init_parse_ast_index, logCycleLoading, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, parseAst } from "./parse-ast-index-C5zEG9SJ.mjs";
2
+ import { augmentCodeLocation, error, import_binding, init_logs, init_parse_ast_index, logCycleLoading, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, parseAst } from "./parse-ast-index-D0SmlXT6.mjs";
3
+ import { and, code, exclude, id, include, init_filter_expression_index, moduleType, or } from "./filter-expression-index-BKmgnKlV.mjs";
3
4
  import path from "node:path";
4
5
  import { toJsonSchema } from "@valibot/to-json-schema";
5
6
  import colors from "ansis";
@@ -8,7 +9,7 @@ import { availableParallelism } from "node:os";
8
9
  import { Worker } from "node:worker_threads";
9
10
 
10
11
  //#region package.json
11
- var version = "1.0.0-beta.8-commit.a98d94e";
12
+ var version = "1.0.0-beta.8-commit.852c603";
12
13
  var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
13
14
 
14
15
  //#endregion
@@ -144,13 +145,13 @@ var init_logging = __esm({ "src/log/logging.ts"() {
144
145
 
145
146
  //#endregion
146
147
  //#region src/log/log-handler.ts
147
- function getLogHandler(level, code, logger, pluginName, logLevel) {
148
+ function getLogHandler(level, code$1, logger, pluginName, logLevel) {
148
149
  if (logLevelPriority[level] < logLevelPriority[logLevel]) return noop;
149
150
  return (log, pos) => {
150
151
  if (pos != null) logger(LOG_LEVEL_WARN, logInvalidLogPosition(pluginName));
151
152
  log = normalizeLog(log);
152
153
  if (log.code && !log.pluginCode) log.pluginCode = log.code;
153
- log.code = code;
154
+ log.code = code$1;
154
155
  log.plugin = pluginName;
155
156
  logger(level, log);
156
157
  };
@@ -197,9 +198,9 @@ function getLogger(plugins, onLog, logLevel, watchMode) {
197
198
  };
198
199
  return logger;
199
200
  }
200
- function relativeId(id) {
201
- if (!path.isAbsolute(id)) return id;
202
- return path.relative(path.resolve(), id);
201
+ function relativeId(id$1) {
202
+ if (!path.isAbsolute(id$1)) return id$1;
203
+ return path.relative(path.resolve(), id$1);
203
204
  }
204
205
  var getOnLog, getDefaultOnLog, addLogToString, defaultPrintLog, getExtendedLogMessage;
205
206
  var init_logger = __esm({ "src/log/logger.ts"() {
@@ -494,7 +495,7 @@ function validateOption(key, options) {
494
495
  const issuePaths = issue.path.map((path$1) => path$1.key);
495
496
  let issueMsg = issue.message;
496
497
  if (issue.type === "union") {
497
- const subIssue = issue.issues?.find((i$21) => !(i$21.type !== issue.received && i$21.input === issue.input));
498
+ const subIssue = issue.issues?.find((i$22) => !(i$22.type !== issue.received && i$22.input === issue.input));
498
499
  if (subIssue) {
499
500
  if (subIssue.path) issuePaths.push(subIssue.path.map((path$1) => path$1.key));
500
501
  issueMsg = subIssue.message;
@@ -924,13 +925,13 @@ function normalizeErrors(rawErrors) {
924
925
  stack: void 0
925
926
  }));
926
927
  let summary = `Build failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
927
- for (let i$21 = 0; i$21 < errors.length; i$21++) {
928
+ for (let i$22 = 0; i$22 < errors.length; i$22++) {
928
929
  summary += "\n";
929
- if (i$21 >= 5) {
930
+ if (i$22 >= 5) {
930
931
  summary += "...";
931
932
  break;
932
933
  }
933
- summary += getErrorMessage(errors[i$21]);
934
+ summary += getErrorMessage(errors[i$22]);
934
935
  }
935
936
  const wrapper = new Error(summary);
936
937
  Object.defineProperty(wrapper, "errors", {
@@ -949,9 +950,9 @@ function getErrorMessage(e$5) {
949
950
  if (Object.hasOwn(e$5, "kind")) return e$5.message;
950
951
  let s$10 = "";
951
952
  if (e$5.plugin) s$10 += `[plugin ${e$5.plugin}]`;
952
- const id = e$5.id ?? e$5.loc?.file;
953
- if (id) {
954
- s$10 += " " + id;
953
+ const id$1 = e$5.id ?? e$5.loc?.file;
954
+ if (id$1) {
955
+ s$10 += " " + id$1;
955
956
  if (e$5.loc) s$10 += `:${e$5.loc.line}:${e$5.loc.column}`;
956
957
  }
957
958
  if (s$10) s$10 += "\n";
@@ -1011,1713 +1012,249 @@ function isEmptySourcemapFiled(array) {
1011
1012
  if (array.length === 0 || !array[0]) return true;
1012
1013
  return false;
1013
1014
  }
1014
- function normalizeTransformHookSourcemap(id, originalCode, rawMap) {
1015
+ function normalizeTransformHookSourcemap(id$1, originalCode, rawMap) {
1015
1016
  if (!rawMap) return;
1016
1017
  let map = typeof rawMap === "object" ? rawMap : JSON.parse(rawMap);
1017
1018
  if (isEmptySourcemapFiled(map.sourcesContent)) map.sourcesContent = [originalCode];
1018
- if (isEmptySourcemapFiled(map.sources) || map.sources && map.sources.length === 1 && map.sources[0] !== id) map.sources = [id];
1019
+ if (isEmptySourcemapFiled(map.sources) || map.sources && map.sources.length === 1 && map.sources[0] !== id$1) map.sources = [id$1];
1019
1020
  return map;
1020
1021
  }
1021
1022
  var init_transform_sourcemap = __esm({ "src/utils/transform-sourcemap.ts"() {} });
1022
1023
 
1023
1024
  //#endregion
1024
- //#region src/plugin/bindingify-hook-filter.ts
1025
- function bindingifyStringFilter(matcher) {
1026
- if (typeof matcher === "string" || matcher instanceof RegExp) return { include: [matcher] };
1027
- if (Array.isArray(matcher)) return { include: matcher };
1028
- return {
1029
- include: matcher.include ? arraify(matcher.include) : void 0,
1030
- exclude: matcher.exclude ? arraify(matcher.exclude) : void 0
1031
- };
1032
- }
1033
- function bindingifyResolveIdFilter(filterOption) {
1034
- return filterOption?.id ? bindingifyStringFilter(filterOption.id) : void 0;
1035
- }
1036
- function bindingifyLoadFilter(filterOption) {
1037
- return filterOption?.id ? bindingifyStringFilter(filterOption.id) : void 0;
1038
- }
1039
- function bindingifyTransformFilter(filterOption) {
1040
- if (!filterOption) return void 0;
1041
- const { id, code, moduleType } = filterOption;
1042
- let moduleTypeRet;
1043
- if (moduleType) if (Array.isArray(moduleType)) moduleTypeRet = moduleType;
1044
- else moduleTypeRet = moduleType.include;
1045
- return {
1046
- id: id ? bindingifyStringFilter(id) : void 0,
1047
- code: code ? bindingifyStringFilter(code) : void 0,
1048
- moduleType: moduleTypeRet
1049
- };
1050
- }
1051
- var init_bindingify_hook_filter = __esm({ "src/plugin/bindingify-hook-filter.ts"() {
1052
- init_misc();
1025
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-ANXBDSUI.js
1026
+ var init_chunk_ANXBDSUI = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-ANXBDSUI.js"() {} });
1027
+
1028
+ //#endregion
1029
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-3GOCSNFN.js
1030
+ var init_chunk_3GOCSNFN = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-3GOCSNFN.js"() {
1031
+ init_chunk_ANXBDSUI();
1053
1032
  } });
1054
1033
 
1055
1034
  //#endregion
1056
- //#region src/plugin/bindingify-plugin-hook-meta.ts
1057
- function bindingifyPluginHookMeta(options) {
1058
- return { order: bindingPluginOrder(options.order) };
1059
- }
1060
- function bindingPluginOrder(order) {
1061
- switch (order) {
1062
- case "post": return import_binding.BindingPluginOrder.Post;
1063
- case "pre": return import_binding.BindingPluginOrder.Pre;
1064
- case null:
1065
- case void 0: return void 0;
1066
- default: throw new Error(`Unknown plugin order: ${order}`);
1067
- }
1068
- }
1069
- var init_bindingify_plugin_hook_meta = __esm({ "src/plugin/bindingify-plugin-hook-meta.ts"() {} });
1035
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-LFJW7BOT.js
1036
+ var init_chunk_LFJW7BOT = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-LFJW7BOT.js"() {
1037
+ init_chunk_3GOCSNFN();
1038
+ } });
1070
1039
 
1071
1040
  //#endregion
1072
- //#region src/utils/asset-source.ts
1073
- function transformAssetSource(bindingAssetSource$1) {
1074
- return bindingAssetSource$1.inner;
1041
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-7ZI6JRPB.js
1042
+ var init_chunk_7ZI6JRPB = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-7ZI6JRPB.js"() {
1043
+ init_chunk_LFJW7BOT();
1044
+ init_chunk_ANXBDSUI();
1045
+ } });
1046
+
1047
+ //#endregion
1048
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-OXJMERKM.js
1049
+ var init_chunk_OXJMERKM = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-OXJMERKM.js"() {
1050
+ init_chunk_LFJW7BOT();
1051
+ init_chunk_ANXBDSUI();
1052
+ } });
1053
+
1054
+ //#endregion
1055
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-D6FCK2GA.js
1056
+ function u$13(o$12, n$7, a$15) {
1057
+ let t$14 = (r$12) => o$12(r$12, ...n$7);
1058
+ return a$15 === void 0 ? t$14 : Object.assign(t$14, {
1059
+ lazy: a$15,
1060
+ lazyArgs: n$7
1061
+ });
1075
1062
  }
1076
- function bindingAssetSource(source) {
1077
- return { inner: source };
1063
+ var init_chunk_D6FCK2GA = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-D6FCK2GA.js"() {} });
1064
+
1065
+ //#endregion
1066
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-WIMGWYZL.js
1067
+ function u$11(r$12, n$7, o$12) {
1068
+ let a$15 = r$12.length - n$7.length;
1069
+ if (a$15 === 0) return r$12(...n$7);
1070
+ if (a$15 === 1) return u$13(r$12, n$7, o$12);
1071
+ throw new Error("Wrong number of arguments");
1078
1072
  }
1079
- var init_asset_source = __esm({ "src/utils/asset-source.ts"() {} });
1073
+ var init_chunk_WIMGWYZL = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-WIMGWYZL.js"() {
1074
+ init_chunk_D6FCK2GA();
1075
+ } });
1080
1076
 
1081
1077
  //#endregion
1082
- //#region src/plugin/plugin-context.ts
1083
- var PluginContextImpl;
1084
- var init_plugin_context = __esm({ "src/plugin/plugin-context.ts"() {
1085
- init_logging();
1086
- init_logs();
1087
- init_parse_ast_index();
1088
- init_minimal_plugin_context();
1089
- init_asset_source();
1090
- init_misc();
1091
- init_transform_side_effects();
1092
- PluginContextImpl = class extends MinimalPluginContextImpl {
1093
- getModuleInfo;
1094
- constructor(outputOptions, context, plugin, data, onLog, logLevel, watchMode, currentLoadingModule) {
1095
- super(onLog, logLevel, plugin.name, watchMode);
1096
- this.outputOptions = outputOptions;
1097
- this.context = context;
1098
- this.data = data;
1099
- this.onLog = onLog;
1100
- this.currentLoadingModule = currentLoadingModule;
1101
- this.getModuleInfo = (id) => this.data.getModuleInfo(id, context);
1102
- }
1103
- async load(options) {
1104
- const id = options.id;
1105
- if (id === this.currentLoadingModule) this.onLog(LOG_LEVEL_WARN, logCycleLoading(this.pluginName, this.currentLoadingModule));
1106
- const moduleInfo = this.data.getModuleInfo(id, this.context);
1107
- if (moduleInfo && moduleInfo.code !== null) return moduleInfo;
1108
- const rawOptions = {
1109
- meta: options.meta || {},
1110
- moduleSideEffects: options.moduleSideEffects || null,
1111
- invalidate: false
1112
- };
1113
- this.data.updateModuleOption(id, rawOptions);
1114
- async function createLoadModulePromise(context, data) {
1115
- const loadPromise = data.loadModulePromiseMap.get(id);
1116
- if (loadPromise) return loadPromise;
1117
- let resolveFn;
1118
- const promise = new Promise((resolve, _) => {
1119
- resolveFn = resolve;
1120
- });
1121
- data.loadModulePromiseMap.set(id, promise);
1122
- try {
1123
- await context.load(id, bindingifySideEffects(options.moduleSideEffects), (_success) => {
1124
- resolveFn();
1125
- });
1126
- } catch (e$5) {
1127
- data.loadModulePromiseMap.delete(id);
1128
- throw e$5;
1129
- }
1130
- return promise;
1131
- }
1132
- await createLoadModulePromise(this.context, this.data);
1133
- return this.data.getModuleInfo(id, this.context);
1134
- }
1135
- async resolve(source, importer, options) {
1136
- let receipt = void 0;
1137
- if (options != null) receipt = this.data.saveResolveOptions(options);
1138
- const res = await this.context.resolve(source, importer, {
1139
- custom: receipt,
1140
- skipSelf: options?.skipSelf
1141
- });
1142
- if (receipt != null) this.data.removeSavedResolveOptions(receipt);
1143
- if (res == null) return null;
1144
- const info = this.data.getModuleOption(res.id) || {};
1145
- return {
1146
- ...res,
1147
- external: res.external === "relative" ? unreachable(`The PluginContext resolve result external couldn't be 'relative'`) : res.external,
1148
- ...info
1149
- };
1150
- }
1151
- emitFile = (file) => {
1152
- if (file.type === "prebuilt-chunk") return unimplemented("PluginContext.emitFile with type prebuilt-chunk");
1153
- if (file.type === "chunk") return this.context.emitChunk(file);
1154
- const fnSanitizedFileName = file.fileName || typeof this.outputOptions.sanitizeFileName !== "function" ? void 0 : this.outputOptions.sanitizeFileName(file.name || "asset");
1155
- const filename = file.fileName ? void 0 : this.getAssetFileNames(file);
1156
- return this.context.emitFile({
1157
- ...file,
1158
- originalFileName: file.originalFileName || void 0,
1159
- source: bindingAssetSource(file.source)
1160
- }, filename, fnSanitizedFileName);
1161
- };
1162
- getAssetFileNames(file) {
1163
- if (typeof this.outputOptions.assetFileNames === "function") return this.outputOptions.assetFileNames({
1164
- names: file.name ? [file.name] : [],
1165
- originalFileNames: file.originalFileName ? [file.originalFileName] : [],
1166
- source: file.source,
1167
- type: "asset"
1168
- });
1169
- }
1170
- getFileName(referenceId) {
1171
- return this.context.getFileName(referenceId);
1172
- }
1173
- getModuleIds() {
1174
- return this.data.getModuleIds(this.context);
1175
- }
1176
- addWatchFile(id) {
1177
- this.context.addWatchFile(id);
1178
- }
1179
- parse(input, options) {
1180
- return parseAst(input, options);
1181
- }
1182
- };
1078
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-BSLJB6JE.js
1079
+ var init_chunk_BSLJB6JE = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-BSLJB6JE.js"() {
1080
+ init_chunk_WIMGWYZL();
1183
1081
  } });
1184
1082
 
1185
1083
  //#endregion
1186
- //#region src/plugin/transform-plugin-context.ts
1187
- var TransformPluginContextImpl;
1188
- var init_transform_plugin_context = __esm({ "src/plugin/transform-plugin-context.ts"() {
1189
- init_log_handler();
1190
- init_logs();
1191
- init_plugin_context();
1192
- TransformPluginContextImpl = class extends PluginContextImpl {
1193
- constructor(outputOptions, context, plugin, data, inner, moduleId, moduleSource, onLog, LogLevelOption, watchMode) {
1194
- super(outputOptions, context, plugin, data, onLog, LogLevelOption, watchMode, moduleId);
1195
- this.inner = inner;
1196
- this.moduleId = moduleId;
1197
- this.moduleSource = moduleSource;
1198
- const getLogHandler$1 = (handler) => (log, pos) => {
1199
- log = normalizeLog(log);
1200
- if (pos) augmentCodeLocation(log, pos, moduleSource, moduleId);
1201
- log.id = moduleId;
1202
- log.hook = "transform";
1203
- handler(log);
1204
- };
1205
- this.debug = getLogHandler$1(this.debug);
1206
- this.warn = getLogHandler$1(this.warn);
1207
- this.info = getLogHandler$1(this.info);
1208
- }
1209
- error(e$5, pos) {
1210
- if (typeof e$5 === "string") e$5 = { message: e$5 };
1211
- if (pos) augmentCodeLocation(e$5, pos, this.moduleSource, this.moduleId);
1212
- e$5.id = this.moduleId;
1213
- e$5.hook = "transform";
1214
- return error(logPluginError(normalizeLog(e$5), this.pluginName));
1215
- }
1216
- getCombinedSourcemap() {
1217
- return JSON.parse(this.inner.getCombinedSourcemap());
1218
- }
1219
- };
1084
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-NJXNQM3G.js
1085
+ var init_chunk_NJXNQM3G = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-NJXNQM3G.js"() {} });
1086
+
1087
+ //#endregion
1088
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-6RKHJ2CP.js
1089
+ var init_chunk_6RKHJ2CP = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-6RKHJ2CP.js"() {
1090
+ init_chunk_WIMGWYZL();
1220
1091
  } });
1221
1092
 
1222
1093
  //#endregion
1223
- //#region src/plugin/bindingify-build-hooks.ts
1224
- function bindingifyBuildStart(args) {
1225
- const hook = args.plugin.buildStart;
1226
- if (!hook) return {};
1227
- const { handler, meta } = normalizeHook(hook);
1228
- return {
1229
- plugin: async (ctx, opts) => {
1230
- await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), new NormalizedInputOptionsImpl(opts, args.onLog));
1231
- },
1232
- meta: bindingifyPluginHookMeta(meta)
1233
- };
1234
- }
1235
- function bindingifyBuildEnd(args) {
1236
- const hook = args.plugin.buildEnd;
1237
- if (!hook) return {};
1238
- const { handler, meta } = normalizeHook(hook);
1239
- return {
1240
- plugin: async (ctx, err) => {
1241
- await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), err ? normalizeErrors(err) : void 0);
1242
- },
1243
- meta: bindingifyPluginHookMeta(meta)
1244
- };
1245
- }
1246
- function bindingifyResolveId(args) {
1247
- const hook = args.plugin.resolveId;
1248
- if (!hook) return {};
1249
- const { handler, meta, options } = normalizeHook(hook);
1250
- return {
1251
- plugin: async (ctx, specifier, importer, extraOptions) => {
1252
- const contextResolveOptions = extraOptions.custom != null ? args.pluginContextData.getSavedResolveOptions(extraOptions.custom) : void 0;
1253
- const newExtraOptions = {
1254
- ...extraOptions,
1255
- custom: contextResolveOptions?.custom,
1256
- [SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF]: contextResolveOptions?.[SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF]
1257
- };
1258
- const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), specifier, importer ?? void 0, newExtraOptions);
1259
- if (ret == null) return;
1260
- if (ret === false) return {
1261
- id: specifier,
1262
- external: true,
1263
- normalizeExternalId: true
1264
- };
1265
- if (typeof ret === "string") return {
1266
- id: ret,
1267
- normalizeExternalId: true
1268
- };
1269
- let exist = args.pluginContextData.updateModuleOption(ret.id, {
1270
- meta: ret.meta || {},
1271
- moduleSideEffects: ret.moduleSideEffects ?? null,
1272
- invalidate: false
1273
- });
1274
- return {
1275
- id: ret.id,
1276
- external: ret.external,
1277
- normalizeExternalId: false,
1278
- sideEffects: bindingifySideEffects(exist.moduleSideEffects)
1279
- };
1280
- },
1281
- meta: bindingifyPluginHookMeta(meta),
1282
- filter: bindingifyResolveIdFilter(options.filter)
1283
- };
1284
- }
1285
- function bindingifyResolveDynamicImport(args) {
1286
- const hook = args.plugin.resolveDynamicImport;
1287
- if (!hook) return {};
1288
- const { handler, meta } = normalizeHook(hook);
1289
- return {
1290
- plugin: async (ctx, specifier, importer) => {
1291
- const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), specifier, importer ?? void 0);
1292
- if (ret == null) return;
1293
- if (ret === false) return {
1294
- id: specifier,
1295
- external: true
1296
- };
1297
- if (typeof ret === "string") return { id: ret };
1298
- const result = {
1299
- id: ret.id,
1300
- external: ret.external
1301
- };
1302
- if (ret.moduleSideEffects !== null) result.sideEffects = bindingifySideEffects(ret.moduleSideEffects);
1303
- args.pluginContextData.updateModuleOption(ret.id, {
1304
- meta: ret.meta || {},
1305
- moduleSideEffects: ret.moduleSideEffects || null,
1306
- invalidate: false
1307
- });
1308
- return result;
1309
- },
1310
- meta: bindingifyPluginHookMeta(meta)
1311
- };
1312
- }
1313
- function bindingifyTransform(args) {
1314
- const hook = args.plugin.transform;
1315
- if (!hook) return {};
1316
- const { handler, meta, options } = normalizeHook(hook);
1317
- return {
1318
- plugin: async (ctx, code, id, meta$1) => {
1319
- 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);
1320
- if (ret == null) return void 0;
1321
- if (typeof ret === "string") return { code: ret };
1322
- let moduleOption = args.pluginContextData.updateModuleOption(id, {
1323
- meta: ret.meta ?? {},
1324
- moduleSideEffects: ret.moduleSideEffects ?? null,
1325
- invalidate: false
1326
- });
1327
- return {
1328
- code: ret.code,
1329
- map: bindingifySourcemap(normalizeTransformHookSourcemap(id, code, ret.map)),
1330
- sideEffects: bindingifySideEffects(moduleOption.moduleSideEffects),
1331
- moduleType: ret.moduleType
1332
- };
1333
- },
1334
- meta: bindingifyPluginHookMeta(meta),
1335
- filter: bindingifyTransformFilter(options.filter)
1336
- };
1337
- }
1338
- function bindingifyLoad(args) {
1339
- const hook = args.plugin.load;
1340
- if (!hook) return {};
1341
- const { handler, meta, options } = normalizeHook(hook);
1342
- return {
1343
- plugin: async (ctx, id) => {
1344
- const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode, id), id);
1345
- if (ret == null) return;
1346
- if (typeof ret === "string") return { code: ret };
1347
- let moduleOption = args.pluginContextData.updateModuleOption(id, {
1348
- meta: ret.meta || {},
1349
- moduleSideEffects: ret.moduleSideEffects ?? null,
1350
- invalidate: false
1351
- });
1352
- let map = preProcessSourceMap(ret, id);
1353
- return {
1354
- code: ret.code,
1355
- map: bindingifySourcemap(map),
1356
- moduleType: ret.moduleType,
1357
- sideEffects: bindingifySideEffects(moduleOption.moduleSideEffects)
1358
- };
1359
- },
1360
- meta: bindingifyPluginHookMeta(meta),
1361
- filter: bindingifyLoadFilter(options.filter)
1362
- };
1363
- }
1364
- function preProcessSourceMap(ret, id) {
1365
- if (!ret.map) return;
1366
- let map = typeof ret.map === "object" ? ret.map : JSON.parse(ret.map);
1367
- if (!isEmptySourcemapFiled(map.sources)) {
1368
- const directory = path.dirname(id) || ".";
1369
- const sourceRoot = map.sourceRoot || ".";
1370
- map.sources = map.sources.map((source) => path.resolve(directory, sourceRoot, source));
1371
- }
1372
- return map;
1373
- }
1374
- function bindingifyModuleParsed(args) {
1375
- const hook = args.plugin.moduleParsed;
1376
- if (!hook) return {};
1377
- const { handler, meta } = normalizeHook(hook);
1378
- return {
1379
- plugin: async (ctx, moduleInfo) => {
1380
- await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformModuleInfo(moduleInfo, args.pluginContextData.getModuleOption(moduleInfo.id)));
1381
- },
1382
- meta: bindingifyPluginHookMeta(meta)
1383
- };
1384
- }
1385
- var init_bindingify_build_hooks = __esm({ "src/plugin/bindingify-build-hooks.ts"() {
1386
- init_normalize_hook();
1387
- init_plugin_context$1();
1388
- init_normalized_input_options();
1389
- init_sourcemap();
1390
- init_error();
1391
- init_transform_module_info();
1392
- init_transform_side_effects();
1393
- init_transform_sourcemap();
1394
- init_bindingify_hook_filter();
1395
- init_bindingify_plugin_hook_meta();
1396
- init_plugin_context();
1397
- init_transform_plugin_context();
1094
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-QDGUNRDA.js
1095
+ var init_chunk_QDGUNRDA = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-QDGUNRDA.js"() {
1096
+ init_chunk_D6FCK2GA();
1398
1097
  } });
1399
1098
 
1400
1099
  //#endregion
1401
- //#region src/utils/transform-rendered-module.ts
1402
- function transformToRenderedModule(bindingRenderedModule) {
1403
- return {
1404
- get code() {
1405
- return bindingRenderedModule.code;
1406
- },
1407
- get renderedLength() {
1408
- return bindingRenderedModule.code?.length || 0;
1409
- },
1410
- get renderedExports() {
1411
- return bindingRenderedModule.renderedExports;
1412
- }
1413
- };
1414
- }
1415
- var init_transform_rendered_module = __esm({ "src/utils/transform-rendered-module.ts"() {} });
1100
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-MYLLMFC7.js
1101
+ var init_chunk_MYLLMFC7 = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-MYLLMFC7.js"() {
1102
+ init_chunk_WIMGWYZL();
1103
+ } });
1416
1104
 
1417
1105
  //#endregion
1418
- //#region src/utils/transform-rendered-chunk.ts
1419
- function transformRenderedChunk(chunk) {
1420
- let modules = null;
1421
- return {
1422
- get name() {
1423
- return chunk.name;
1424
- },
1425
- get isEntry() {
1426
- return chunk.isEntry;
1427
- },
1428
- get isDynamicEntry() {
1429
- return chunk.isDynamicEntry;
1430
- },
1431
- get facadeModuleId() {
1432
- return chunk.facadeModuleId;
1433
- },
1434
- get moduleIds() {
1435
- return chunk.moduleIds;
1436
- },
1437
- get exports() {
1438
- return chunk.exports;
1439
- },
1440
- get fileName() {
1441
- return chunk.fileName;
1442
- },
1443
- get imports() {
1444
- return chunk.imports;
1445
- },
1446
- get dynamicImports() {
1447
- return chunk.dynamicImports;
1448
- },
1449
- get modules() {
1450
- if (!modules) modules = transformChunkModules(chunk.modules);
1451
- return modules;
1106
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-DEVKGLTN.js
1107
+ var o$11, c$3, i$21;
1108
+ var init_chunk_DEVKGLTN = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-DEVKGLTN.js"() {
1109
+ o$11 = [
1110
+ " ",
1111
+ `
1112
+ `,
1113
+ "\v",
1114
+ "\f",
1115
+ "\r",
1116
+ " ",
1117
+ "…",
1118
+ "\xA0",
1119
+ " ",
1120
+ " ",
1121
+ " ",
1122
+ " ",
1123
+ " ",
1124
+ " ",
1125
+ " ",
1126
+ " ",
1127
+ " ",
1128
+ " ",
1129
+ " ",
1130
+ " ",
1131
+ "\u2028",
1132
+ "\u2029",
1133
+ " ",
1134
+ " ",
1135
+ " ",
1136
+ ""
1137
+ ], c$3 = new Set([
1138
+ "-",
1139
+ "_",
1140
+ ...o$11
1141
+ ]), i$21 = (r$12) => {
1142
+ let e$5 = [], t$14 = "", u$14 = () => {
1143
+ t$14.length > 0 && (e$5.push(t$14), t$14 = "");
1144
+ };
1145
+ for (let s$10 of r$12) {
1146
+ if (c$3.has(s$10)) {
1147
+ u$14();
1148
+ continue;
1149
+ }
1150
+ if (/[a-z]$/u.test(t$14) && /[A-Z]/u.test(s$10)) u$14();
1151
+ else if (/[A-Z][A-Z]$/u.test(t$14) && /[a-z]/u.test(s$10)) {
1152
+ let n$7 = t$14.slice(-1);
1153
+ t$14 = t$14.slice(0, -1), u$14(), t$14 = n$7;
1154
+ } else /\d$/u.test(t$14) !== /\d/u.test(s$10) && u$14();
1155
+ t$14 += s$10;
1452
1156
  }
1157
+ return u$14(), e$5;
1453
1158
  };
1454
- }
1455
- function transformChunkModules(modules) {
1456
- const result = {};
1457
- for (let i$21 = 0; i$21 < modules.values.length; i$21++) {
1458
- let key = modules.keys[i$21];
1459
- const mod = modules.values[i$21];
1460
- result[key] = transformToRenderedModule(mod);
1461
- }
1462
- return result;
1463
- }
1464
- var init_transform_rendered_chunk = __esm({ "src/utils/transform-rendered-chunk.ts"() {
1465
- init_transform_rendered_module();
1466
1159
  } });
1467
1160
 
1468
1161
  //#endregion
1469
- //#region src/utils/bindingify-output-options.ts
1470
- function bindingifyOutputOptions(outputOptions) {
1471
- const { dir, format, exports, hashCharacters, sourcemap, sourcemapDebugIds, sourcemapIgnoreList, sourcemapPathTransform, name, assetFileNames, entryFileNames, chunkFileNames, cssEntryFileNames, cssChunkFileNames, banner, footer, intro, outro, esModule, globals, file, sanitizeFileName } = outputOptions;
1472
- return {
1473
- dir,
1474
- file: file == null ? void 0 : file,
1475
- format: bindingifyFormat(format),
1476
- exports,
1477
- hashCharacters,
1478
- sourcemap: bindingifySourcemap$1(sourcemap),
1479
- sourcemapDebugIds,
1480
- sourcemapIgnoreList: bindingifySourcemapIgnoreList(sourcemapIgnoreList),
1481
- sourcemapPathTransform,
1482
- banner: bindingifyAddon(banner),
1483
- footer: bindingifyAddon(footer),
1484
- intro: bindingifyAddon(intro),
1485
- outro: bindingifyAddon(outro),
1486
- extend: outputOptions.extend,
1487
- globals,
1488
- esModule,
1489
- name,
1490
- assetFileNames: bindingifyAssetFilenames(assetFileNames),
1491
- entryFileNames,
1492
- chunkFileNames,
1493
- cssEntryFileNames,
1494
- cssChunkFileNames,
1495
- plugins: [],
1496
- minify: outputOptions.minify,
1497
- externalLiveBindings: outputOptions.externalLiveBindings,
1498
- inlineDynamicImports: outputOptions.inlineDynamicImports,
1499
- advancedChunks: outputOptions.advancedChunks,
1500
- polyfillRequire: outputOptions.polyfillRequire,
1501
- target: outputOptions.target,
1502
- sanitizeFileName
1503
- };
1504
- }
1505
- function bindingifyAddon(configAddon) {
1506
- return async (chunk) => {
1507
- if (typeof configAddon === "function") return configAddon(transformRenderedChunk(chunk));
1508
- return configAddon || "";
1509
- };
1510
- }
1511
- function bindingifyFormat(format) {
1512
- switch (format) {
1513
- case void 0:
1514
- case "es":
1515
- case "esm":
1516
- case "module": return "es";
1517
- case "cjs":
1518
- case "commonjs": return "cjs";
1519
- case "iife": return "iife";
1520
- case "umd": return "umd";
1521
- case "experimental-app": return "app";
1522
- default: unimplemented(`output.format: ${format}`);
1523
- }
1524
- }
1525
- function bindingifySourcemap$1(sourcemap) {
1526
- switch (sourcemap) {
1527
- case true: return "file";
1528
- case "inline": return "inline";
1529
- case false:
1530
- case void 0: return void 0;
1531
- case "hidden": return "hidden";
1532
- default: throw new Error(`unknown sourcemap: ${sourcemap}`);
1533
- }
1534
- }
1535
- function bindingifySourcemapIgnoreList(sourcemapIgnoreList) {
1536
- return typeof sourcemapIgnoreList === "function" ? sourcemapIgnoreList : sourcemapIgnoreList === false ? () => false : (relativeSourcePath, _sourcemapPath) => relativeSourcePath.includes("node_modules");
1537
- }
1538
- function bindingifyAssetFilenames(assetFileNames) {
1539
- if (typeof assetFileNames === "function") return (asset) => {
1540
- return assetFileNames({
1541
- names: asset.names,
1542
- originalFileNames: asset.originalFileNames,
1543
- source: transformAssetSource(asset.source),
1544
- type: "asset"
1545
- });
1546
- };
1547
- return assetFileNames;
1548
- }
1549
- var init_bindingify_output_options = __esm({ "src/utils/bindingify-output-options.ts"() {
1550
- init_asset_source();
1551
- init_misc();
1552
- init_transform_rendered_chunk();
1162
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-N4JUOEMS.js
1163
+ var init_chunk_N4JUOEMS = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-N4JUOEMS.js"() {
1164
+ init_chunk_DEVKGLTN();
1553
1165
  } });
1554
1166
 
1555
1167
  //#endregion
1556
- //#region src/options/normalized-output-options.ts
1557
- function normalizeAddon(value) {
1558
- if (typeof value === "function") return value;
1559
- return () => value || "";
1560
- }
1561
- var NormalizedOutputOptionsImpl;
1562
- var init_normalized_output_options = __esm({ "src/options/normalized-output-options.ts"() {
1563
- init_bindingify_output_options();
1564
- NormalizedOutputOptionsImpl = class {
1565
- constructor(inner, outputOptions, normalizedOutputPlugins) {
1566
- this.inner = inner;
1567
- this.outputOptions = outputOptions;
1568
- this.normalizedOutputPlugins = normalizedOutputPlugins;
1569
- }
1570
- get dir() {
1571
- return this.inner.dir ?? void 0;
1572
- }
1573
- get entryFileNames() {
1574
- return this.inner.entryFilenames || this.outputOptions.entryFileNames;
1575
- }
1576
- get chunkFileNames() {
1577
- return this.inner.chunkFilenames || this.outputOptions.chunkFileNames;
1578
- }
1579
- get assetFileNames() {
1580
- return this.inner.assetFilenames || this.outputOptions.assetFileNames;
1581
- }
1582
- get format() {
1583
- return this.inner.format;
1584
- }
1585
- get exports() {
1586
- return this.inner.exports;
1587
- }
1588
- get sourcemap() {
1589
- return this.inner.sourcemap;
1590
- }
1591
- get cssEntryFileNames() {
1592
- return this.inner.cssEntryFilenames || this.outputOptions.cssEntryFileNames;
1593
- }
1594
- get cssChunkFileNames() {
1595
- return this.inner.cssChunkFilenames || this.outputOptions.cssChunkFileNames;
1596
- }
1597
- get shimMissingExports() {
1598
- return this.inner.shimMissingExports;
1599
- }
1600
- get name() {
1601
- return this.inner.name ?? void 0;
1602
- }
1603
- get file() {
1604
- return this.inner.file ?? void 0;
1605
- }
1606
- get inlineDynamicImports() {
1607
- return this.inner.inlineDynamicImports;
1608
- }
1609
- get externalLiveBindings() {
1610
- return this.inner.externalLiveBindings;
1611
- }
1612
- get banner() {
1613
- return normalizeAddon(this.outputOptions.banner);
1614
- }
1615
- get footer() {
1616
- return normalizeAddon(this.outputOptions.footer);
1617
- }
1618
- get intro() {
1619
- return normalizeAddon(this.outputOptions.intro);
1620
- }
1621
- get outro() {
1622
- return normalizeAddon(this.outputOptions.outro);
1623
- }
1624
- get esModule() {
1625
- return this.inner.esModule;
1626
- }
1627
- get extend() {
1628
- return this.inner.extend;
1629
- }
1630
- get globals() {
1631
- return this.inner.globals || this.outputOptions.globals;
1632
- }
1633
- get hashCharacters() {
1634
- return this.inner.hashCharacters;
1635
- }
1636
- get sourcemapDebugIds() {
1637
- return this.inner.sourcemapDebugIds;
1638
- }
1639
- get sourcemapIgnoreList() {
1640
- return bindingifySourcemapIgnoreList(this.outputOptions.sourcemapIgnoreList);
1641
- }
1642
- get sourcemapPathTransform() {
1643
- return this.outputOptions.sourcemapPathTransform;
1644
- }
1645
- get minify() {
1646
- return this.inner.minify;
1647
- }
1648
- get comments() {
1649
- return this.inner.comments;
1650
- }
1651
- get polyfillRequire() {
1652
- return this.inner.polyfillRequire;
1653
- }
1654
- get plugins() {
1655
- return this.normalizedOutputPlugins;
1656
- }
1657
- };
1168
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-YRJ25UV2.js
1169
+ var init_chunk_YRJ25UV2 = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-YRJ25UV2.js"() {
1170
+ init_chunk_DEVKGLTN();
1171
+ init_chunk_WIMGWYZL();
1658
1172
  } });
1659
1173
 
1660
1174
  //#endregion
1661
- //#region src/utils/transform-to-rollup-output.ts
1662
- function transformToRollupSourceMap(map) {
1663
- const parsed = JSON.parse(map);
1664
- const obj = {
1665
- ...parsed,
1666
- toString() {
1667
- return JSON.stringify(obj);
1668
- },
1669
- toUrl() {
1670
- return `data:application/json;charset=utf-8;base64,${Buffer.from(obj.toString(), "utf-8").toString("base64")}`;
1671
- }
1672
- };
1673
- return obj;
1674
- }
1675
- function transformToRollupOutputChunk(bindingChunk, changed) {
1676
- const chunk = {
1677
- type: "chunk",
1678
- get code() {
1679
- return bindingChunk.code;
1680
- },
1681
- fileName: bindingChunk.fileName,
1682
- name: bindingChunk.name,
1683
- get modules() {
1684
- return transformChunkModules(bindingChunk.modules);
1685
- },
1686
- get imports() {
1687
- return bindingChunk.imports;
1688
- },
1689
- get dynamicImports() {
1690
- return bindingChunk.dynamicImports;
1691
- },
1692
- exports: bindingChunk.exports,
1693
- isEntry: bindingChunk.isEntry,
1694
- facadeModuleId: bindingChunk.facadeModuleId || null,
1695
- isDynamicEntry: bindingChunk.isDynamicEntry,
1696
- get moduleIds() {
1697
- return bindingChunk.moduleIds;
1698
- },
1699
- get map() {
1700
- return bindingChunk.map ? transformToRollupSourceMap(bindingChunk.map) : null;
1701
- },
1702
- sourcemapFileName: bindingChunk.sourcemapFileName || null,
1703
- preliminaryFileName: bindingChunk.preliminaryFileName
1704
- };
1705
- const cache = {};
1706
- return new Proxy(chunk, {
1707
- get(target, p$3) {
1708
- if (p$3 in cache) return cache[p$3];
1709
- const value = target[p$3];
1710
- cache[p$3] = value;
1711
- return value;
1712
- },
1713
- set(target, p$3, newValue) {
1714
- cache[p$3] = newValue;
1715
- changed?.updated.add(bindingChunk.fileName);
1716
- return true;
1717
- },
1718
- has(target, p$3) {
1719
- if (p$3 in cache) return true;
1720
- return p$3 in target;
1721
- }
1722
- });
1723
- }
1724
- function transformToRollupOutputAsset(bindingAsset, changed) {
1725
- const asset = {
1726
- type: "asset",
1727
- fileName: bindingAsset.fileName,
1728
- originalFileName: bindingAsset.originalFileName || null,
1729
- originalFileNames: bindingAsset.originalFileNames,
1730
- get source() {
1731
- return transformAssetSource(bindingAsset.source);
1732
- },
1733
- name: bindingAsset.name ?? void 0,
1734
- names: bindingAsset.names
1735
- };
1736
- const cache = {};
1737
- return new Proxy(asset, {
1738
- get(target, p$3) {
1739
- if (p$3 in cache) return cache[p$3];
1740
- const value = target[p$3];
1741
- cache[p$3] = value;
1742
- return value;
1743
- },
1744
- set(target, p$3, newValue) {
1745
- cache[p$3] = newValue;
1746
- changed?.updated.add(bindingAsset.fileName);
1747
- return true;
1748
- }
1749
- });
1750
- }
1751
- function transformToRollupOutput(output, changed) {
1752
- handleOutputErrors(output);
1753
- const { chunks, assets } = output;
1754
- return { output: [...chunks.map((chunk) => transformToRollupOutputChunk(chunk, changed)), ...assets.map((asset) => transformToRollupOutputAsset(asset, changed))] };
1755
- }
1756
- function handleOutputErrors(output) {
1757
- const rawErrors = output.errors;
1758
- if (rawErrors.length > 0) throw normalizeErrors(rawErrors);
1759
- }
1760
- function transformToOutputBundle(output, changed) {
1761
- const bundle = Object.fromEntries(transformToRollupOutput(output, changed).output.map((item) => [item.fileName, item]));
1762
- return new Proxy(bundle, { deleteProperty(target, property) {
1763
- if (typeof property === "string") changed.deleted.add(property);
1764
- return true;
1765
- } });
1766
- }
1767
- function collectChangedBundle(changed, bundle) {
1768
- const assets = [];
1769
- const chunks = [];
1770
- for (const key in bundle) {
1771
- if (changed.deleted.has(key) || !changed.updated.has(key)) continue;
1772
- const item = bundle[key];
1773
- if (item.type === "asset") assets.push({
1774
- filename: item.fileName,
1775
- originalFileNames: item.originalFileNames,
1776
- source: bindingAssetSource(item.source),
1777
- names: item.names
1778
- });
1779
- else chunks.push({
1780
- code: item.code,
1781
- filename: item.fileName,
1782
- name: item.name,
1783
- isEntry: item.isEntry,
1784
- exports: item.exports,
1785
- modules: {},
1786
- imports: item.imports,
1787
- dynamicImports: item.dynamicImports,
1788
- facadeModuleId: item.facadeModuleId || void 0,
1789
- isDynamicEntry: item.isDynamicEntry,
1790
- moduleIds: item.moduleIds,
1791
- map: bindingifySourcemap(item.map),
1792
- sourcemapFilename: item.sourcemapFileName || void 0,
1793
- preliminaryFilename: item.preliminaryFileName
1794
- });
1795
- }
1796
- return {
1797
- assets,
1798
- chunks,
1799
- deleted: Array.from(changed.deleted)
1800
- };
1801
- }
1802
- var init_transform_to_rollup_output = __esm({ "src/utils/transform-to-rollup-output.ts"() {
1803
- init_sourcemap();
1804
- init_asset_source();
1805
- init_error();
1806
- init_transform_rendered_chunk();
1175
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-Q5ASJ5N7.js
1176
+ var init_chunk_Q5ASJ5N7 = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-Q5ASJ5N7.js"() {
1177
+ init_chunk_WIMGWYZL();
1807
1178
  } });
1808
1179
 
1809
1180
  //#endregion
1810
- //#region src/plugin/bindingify-output-hooks.ts
1811
- function bindingifyRenderStart(args) {
1812
- const hook = args.plugin.renderStart;
1813
- if (!hook) return {};
1814
- const { handler, meta } = normalizeHook(hook);
1815
- return {
1816
- plugin: async (ctx, opts) => {
1817
- handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), new NormalizedOutputOptionsImpl(opts, args.outputOptions, args.normalizedOutputPlugins), new NormalizedInputOptionsImpl(opts, args.onLog));
1818
- },
1819
- meta: bindingifyPluginHookMeta(meta)
1820
- };
1821
- }
1822
- function bindingifyRenderChunk(args) {
1823
- const hook = args.plugin.renderChunk;
1824
- if (!hook) return {};
1825
- const { handler, meta } = normalizeHook(hook);
1826
- return {
1827
- plugin: async (ctx, code, chunk, opts, meta$1) => {
1828
- if (args.pluginContextData.getRenderChunkMeta() == null) args.pluginContextData.setRenderChunkMeta({ chunks: Object.fromEntries(Object.entries(meta$1.chunks).map(([key, value]) => [key, transformRenderedChunk(value)])) });
1829
- 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());
1830
- if (ret == null) return;
1831
- if (typeof ret === "string") return { code: ret };
1832
- if (!ret.map) return { code: ret.code };
1833
- return {
1834
- code: ret.code,
1835
- map: bindingifySourcemap(ret.map)
1836
- };
1837
- },
1838
- meta: bindingifyPluginHookMeta(meta)
1839
- };
1840
- }
1841
- function bindingifyAugmentChunkHash(args) {
1842
- const hook = args.plugin.augmentChunkHash;
1843
- if (!hook) return {};
1844
- const { handler, meta } = normalizeHook(hook);
1845
- return {
1846
- plugin: async (ctx, chunk) => {
1847
- return await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
1848
- },
1849
- meta: bindingifyPluginHookMeta(meta)
1850
- };
1851
- }
1852
- function bindingifyRenderError(args) {
1853
- const hook = args.plugin.renderError;
1854
- if (!hook) return {};
1855
- const { handler, meta } = normalizeHook(hook);
1856
- return {
1857
- plugin: async (ctx, err) => {
1858
- handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), normalizeErrors(err));
1859
- },
1860
- meta: bindingifyPluginHookMeta(meta)
1861
- };
1862
- }
1863
- function bindingifyGenerateBundle(args) {
1864
- const hook = args.plugin.generateBundle;
1865
- if (!hook) return {};
1866
- const { handler, meta } = normalizeHook(hook);
1867
- return {
1868
- plugin: async (ctx, bundle, isWrite, opts) => {
1869
- const changed = {
1870
- updated: new Set(),
1871
- deleted: new Set()
1872
- };
1873
- const output = transformToOutputBundle(bundle, changed);
1874
- await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), new NormalizedOutputOptionsImpl(opts, args.outputOptions, args.normalizedOutputPlugins), output, isWrite);
1875
- return collectChangedBundle(changed, output);
1876
- },
1877
- meta: bindingifyPluginHookMeta(meta)
1878
- };
1879
- }
1880
- function bindingifyWriteBundle(args) {
1881
- const hook = args.plugin.writeBundle;
1882
- if (!hook) return {};
1883
- const { handler, meta } = normalizeHook(hook);
1884
- return {
1885
- plugin: async (ctx, bundle, opts) => {
1886
- const changed = {
1887
- updated: new Set(),
1888
- deleted: new Set()
1889
- };
1890
- const output = transformToOutputBundle(bundle, changed);
1891
- await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), new NormalizedOutputOptionsImpl(opts, args.outputOptions, args.normalizedOutputPlugins), output);
1892
- return collectChangedBundle(changed, output);
1893
- },
1894
- meta: bindingifyPluginHookMeta(meta)
1895
- };
1896
- }
1897
- function bindingifyCloseBundle(args) {
1898
- const hook = args.plugin.closeBundle;
1899
- if (!hook) return {};
1900
- const { handler, meta } = normalizeHook(hook);
1901
- return {
1902
- plugin: async (ctx) => {
1903
- await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode));
1904
- },
1905
- meta: bindingifyPluginHookMeta(meta)
1906
- };
1907
- }
1908
- function bindingifyBanner(args) {
1909
- const hook = args.plugin.banner;
1910
- if (!hook) return {};
1911
- const { handler, meta } = normalizeHook(hook);
1912
- return {
1913
- plugin: async (ctx, chunk) => {
1914
- if (typeof handler === "string") return handler;
1915
- return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
1916
- },
1917
- meta: bindingifyPluginHookMeta(meta)
1918
- };
1919
- }
1920
- function bindingifyFooter(args) {
1921
- const hook = args.plugin.footer;
1922
- if (!hook) return {};
1923
- const { handler, meta } = normalizeHook(hook);
1924
- return {
1925
- plugin: async (ctx, chunk) => {
1926
- if (typeof handler === "string") return handler;
1927
- return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
1928
- },
1929
- meta: bindingifyPluginHookMeta(meta)
1930
- };
1931
- }
1932
- function bindingifyIntro(args) {
1933
- const hook = args.plugin.intro;
1934
- if (!hook) return {};
1935
- const { handler, meta } = normalizeHook(hook);
1936
- return {
1937
- plugin: async (ctx, chunk) => {
1938
- if (typeof handler === "string") return handler;
1939
- return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
1940
- },
1941
- meta: bindingifyPluginHookMeta(meta)
1942
- };
1943
- }
1944
- function bindingifyOutro(args) {
1945
- const hook = args.plugin.outro;
1946
- if (!hook) return {};
1947
- const { handler, meta } = normalizeHook(hook);
1948
- return {
1949
- plugin: async (ctx, chunk) => {
1950
- if (typeof handler === "string") return handler;
1951
- return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
1952
- },
1953
- meta: bindingifyPluginHookMeta(meta)
1954
- };
1955
- }
1956
- var init_bindingify_output_hooks = __esm({ "src/plugin/bindingify-output-hooks.ts"() {
1957
- init_normalized_input_options();
1958
- init_normalized_output_options();
1959
- init_sourcemap();
1960
- init_error();
1961
- init_normalize_hook();
1962
- init_transform_rendered_chunk();
1963
- init_transform_to_rollup_output();
1964
- init_bindingify_plugin_hook_meta();
1965
- init_plugin_context();
1181
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-WZOX4VKU.js
1182
+ var init_chunk_WZOX4VKU = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-WZOX4VKU.js"() {
1183
+ init_chunk_DEVKGLTN();
1184
+ init_chunk_WIMGWYZL();
1966
1185
  } });
1967
1186
 
1968
1187
  //#endregion
1969
- //#region src/plugin/bindingify-watch-hooks.ts
1970
- function bindingifyWatchChange(args) {
1971
- const hook = args.plugin.watchChange;
1972
- if (!hook) return {};
1973
- const { handler, meta } = normalizeHook(hook);
1974
- return {
1975
- plugin: async (ctx, id, event) => {
1976
- await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), id, { event });
1977
- },
1978
- meta: bindingifyPluginHookMeta(meta)
1979
- };
1980
- }
1981
- function bindingifyCloseWatcher(args) {
1982
- const hook = args.plugin.closeWatcher;
1983
- if (!hook) return {};
1984
- const { handler, meta } = normalizeHook(hook);
1985
- return {
1986
- plugin: async (ctx) => {
1987
- await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode));
1988
- },
1989
- meta: bindingifyPluginHookMeta(meta)
1990
- };
1991
- }
1992
- var init_bindingify_watch_hooks = __esm({ "src/plugin/bindingify-watch-hooks.ts"() {
1993
- init_normalize_hook();
1994
- init_bindingify_plugin_hook_meta();
1995
- init_plugin_context();
1188
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-Y3VKZ3P5.js
1189
+ var init_chunk_Y3VKZ3P5 = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-Y3VKZ3P5.js"() {
1190
+ init_chunk_WIMGWYZL();
1996
1191
  } });
1997
1192
 
1998
1193
  //#endregion
1999
- //#region src/plugin/generated/hook-usage.ts
2000
- function extractHookUsage(plugin) {
2001
- let hookUsage = new HookUsage();
2002
- if (plugin.buildStart) hookUsage.union(HookUsageKind.buildStart);
2003
- if (plugin.resolveId) hookUsage.union(HookUsageKind.resolveId);
2004
- if (plugin.resolveDynamicImport) hookUsage.union(HookUsageKind.resolveDynamicImport);
2005
- if (plugin.load) hookUsage.union(HookUsageKind.load);
2006
- if (plugin.transform) hookUsage.union(HookUsageKind.transform);
2007
- if (plugin.moduleParsed) hookUsage.union(HookUsageKind.moduleParsed);
2008
- if (plugin.buildEnd) hookUsage.union(HookUsageKind.buildEnd);
2009
- if (plugin.renderStart) hookUsage.union(HookUsageKind.renderStart);
2010
- if (plugin.renderError) hookUsage.union(HookUsageKind.renderError);
2011
- if (plugin.renderChunk) hookUsage.union(HookUsageKind.renderChunk);
2012
- if (plugin.augmentChunkHash) hookUsage.union(HookUsageKind.augmentChunkHash);
2013
- if (plugin.generateBundle) hookUsage.union(HookUsageKind.generateBundle);
2014
- if (plugin.writeBundle) hookUsage.union(HookUsageKind.writeBundle);
2015
- if (plugin.closeBundle) hookUsage.union(HookUsageKind.closeBundle);
2016
- if (plugin.watchChange) hookUsage.union(HookUsageKind.watchChange);
2017
- if (plugin.closeWatcher) hookUsage.union(HookUsageKind.closeWatcher);
2018
- if (plugin.banner) hookUsage.union(HookUsageKind.banner);
2019
- if (plugin.footer) hookUsage.union(HookUsageKind.footer);
2020
- if (plugin.intro) hookUsage.union(HookUsageKind.intro);
2021
- if (plugin.outro) hookUsage.union(HookUsageKind.outro);
2022
- return hookUsage;
2023
- }
2024
- var HookUsageKind, HookUsage;
2025
- var init_hook_usage = __esm({ "src/plugin/generated/hook-usage.ts"() {
2026
- HookUsageKind = /* @__PURE__ */ function(HookUsageKind$1) {
2027
- HookUsageKind$1[HookUsageKind$1["buildStart"] = 1] = "buildStart";
2028
- HookUsageKind$1[HookUsageKind$1["resolveId"] = 2] = "resolveId";
2029
- HookUsageKind$1[HookUsageKind$1["resolveDynamicImport"] = 4] = "resolveDynamicImport";
2030
- HookUsageKind$1[HookUsageKind$1["load"] = 8] = "load";
2031
- HookUsageKind$1[HookUsageKind$1["transform"] = 16] = "transform";
2032
- HookUsageKind$1[HookUsageKind$1["moduleParsed"] = 32] = "moduleParsed";
2033
- HookUsageKind$1[HookUsageKind$1["buildEnd"] = 64] = "buildEnd";
2034
- HookUsageKind$1[HookUsageKind$1["renderStart"] = 128] = "renderStart";
2035
- HookUsageKind$1[HookUsageKind$1["renderError"] = 256] = "renderError";
2036
- HookUsageKind$1[HookUsageKind$1["renderChunk"] = 512] = "renderChunk";
2037
- HookUsageKind$1[HookUsageKind$1["augmentChunkHash"] = 1024] = "augmentChunkHash";
2038
- HookUsageKind$1[HookUsageKind$1["generateBundle"] = 2048] = "generateBundle";
2039
- HookUsageKind$1[HookUsageKind$1["writeBundle"] = 4096] = "writeBundle";
2040
- HookUsageKind$1[HookUsageKind$1["closeBundle"] = 8192] = "closeBundle";
2041
- HookUsageKind$1[HookUsageKind$1["watchChange"] = 16384] = "watchChange";
2042
- HookUsageKind$1[HookUsageKind$1["closeWatcher"] = 32768] = "closeWatcher";
2043
- HookUsageKind$1[HookUsageKind$1["transformAst"] = 65536] = "transformAst";
2044
- HookUsageKind$1[HookUsageKind$1["banner"] = 131072] = "banner";
2045
- HookUsageKind$1[HookUsageKind$1["footer"] = 262144] = "footer";
2046
- HookUsageKind$1[HookUsageKind$1["intro"] = 524288] = "intro";
2047
- HookUsageKind$1[HookUsageKind$1["outro"] = 1048576] = "outro";
2048
- return HookUsageKind$1;
2049
- }({});
2050
- HookUsage = class {
2051
- bitflag = BigInt(0);
2052
- constructor() {}
2053
- union(kind) {
2054
- this.bitflag |= BigInt(kind);
2055
- }
2056
- inner() {
2057
- return Number(this.bitflag);
2058
- }
2059
- };
1194
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-ZRKG4NSC.js
1195
+ var init_chunk_ZRKG4NSC = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-ZRKG4NSC.js"() {
1196
+ init_chunk_WIMGWYZL();
2060
1197
  } });
2061
1198
 
2062
1199
  //#endregion
2063
- //#region src/plugin/bindingify-plugin.ts
2064
- function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode) {
2065
- const args = {
2066
- plugin,
2067
- options,
2068
- outputOptions,
2069
- pluginContextData,
2070
- onLog,
2071
- logLevel,
2072
- watchMode,
2073
- normalizedOutputPlugins
2074
- };
2075
- const { plugin: buildStart, meta: buildStartMeta } = bindingifyBuildStart(args);
2076
- const { plugin: resolveId, meta: resolveIdMeta, filter: resolveIdFilter } = bindingifyResolveId(args);
2077
- const { plugin: resolveDynamicImport, meta: resolveDynamicImportMeta } = bindingifyResolveDynamicImport(args);
2078
- const { plugin: buildEnd, meta: buildEndMeta } = bindingifyBuildEnd(args);
2079
- const { plugin: transform, meta: transformMeta, filter: transformFilter } = bindingifyTransform(args);
2080
- const { plugin: moduleParsed, meta: moduleParsedMeta } = bindingifyModuleParsed(args);
2081
- const { plugin: load, meta: loadMeta, filter: loadFilter } = bindingifyLoad(args);
2082
- const { plugin: renderChunk, meta: renderChunkMeta } = bindingifyRenderChunk(args);
2083
- const { plugin: augmentChunkHash, meta: augmentChunkHashMeta } = bindingifyAugmentChunkHash(args);
2084
- const { plugin: renderStart, meta: renderStartMeta } = bindingifyRenderStart(args);
2085
- const { plugin: renderError, meta: renderErrorMeta } = bindingifyRenderError(args);
2086
- const { plugin: generateBundle, meta: generateBundleMeta } = bindingifyGenerateBundle(args);
2087
- const { plugin: writeBundle, meta: writeBundleMeta } = bindingifyWriteBundle(args);
2088
- const { plugin: closeBundle, meta: closeBundleMeta } = bindingifyCloseBundle(args);
2089
- const { plugin: banner, meta: bannerMeta } = bindingifyBanner(args);
2090
- const { plugin: footer, meta: footerMeta } = bindingifyFooter(args);
2091
- const { plugin: intro, meta: introMeta } = bindingifyIntro(args);
2092
- const { plugin: outro, meta: outroMeta } = bindingifyOutro(args);
2093
- const { plugin: watchChange, meta: watchChangeMeta } = bindingifyWatchChange(args);
2094
- const { plugin: closeWatcher, meta: closeWatcherMeta } = bindingifyCloseWatcher(args);
2095
- let hookUsage = extractHookUsage(plugin).inner();
2096
- const result = {
2097
- name: plugin.name,
2098
- buildStart,
2099
- buildStartMeta,
2100
- resolveId,
2101
- resolveIdMeta,
2102
- resolveIdFilter,
2103
- resolveDynamicImport,
2104
- resolveDynamicImportMeta,
2105
- buildEnd,
2106
- buildEndMeta,
2107
- transform,
2108
- transformMeta,
2109
- transformFilter,
2110
- moduleParsed,
2111
- moduleParsedMeta,
2112
- load,
2113
- loadMeta,
2114
- loadFilter,
2115
- renderChunk,
2116
- renderChunkMeta,
2117
- augmentChunkHash,
2118
- augmentChunkHashMeta,
2119
- renderStart,
2120
- renderStartMeta,
2121
- renderError,
2122
- renderErrorMeta,
2123
- generateBundle,
2124
- generateBundleMeta,
2125
- writeBundle,
2126
- writeBundleMeta,
2127
- closeBundle,
2128
- closeBundleMeta,
2129
- banner,
2130
- bannerMeta,
2131
- footer,
2132
- footerMeta,
2133
- intro,
2134
- introMeta,
2135
- outro,
2136
- outroMeta,
2137
- watchChange,
2138
- watchChangeMeta,
2139
- closeWatcher,
2140
- closeWatcherMeta,
2141
- hookUsage
2142
- };
2143
- return wrapHandlers(result);
2144
- }
2145
- function wrapHandlers(plugin) {
2146
- for (const hookName of [
2147
- "buildStart",
2148
- "resolveId",
2149
- "resolveDynamicImport",
2150
- "buildEnd",
2151
- "transform",
2152
- "moduleParsed",
2153
- "load",
2154
- "renderChunk",
2155
- "augmentChunkHash",
2156
- "renderStart",
2157
- "renderError",
2158
- "generateBundle",
2159
- "writeBundle",
2160
- "closeBundle",
2161
- "banner",
2162
- "footer",
2163
- "intro",
2164
- "outro",
2165
- "watchChange",
2166
- "closeWatcher"
2167
- ]) {
2168
- const handler = plugin[hookName];
2169
- if (handler) plugin[hookName] = async (...args) => {
2170
- try {
2171
- return await handler(...args);
2172
- } catch (e$5) {
2173
- return error(logPluginError(e$5, plugin.name, {
2174
- hook: hookName,
2175
- id: hookName === "transform" ? args[2] : void 0
2176
- }));
2177
- }
2178
- };
2179
- }
2180
- return plugin;
2181
- }
2182
- var init_bindingify_plugin = __esm({ "src/plugin/bindingify-plugin.ts"() {
2183
- init_bindingify_build_hooks();
2184
- init_bindingify_output_hooks();
2185
- init_logs();
2186
- init_bindingify_watch_hooks();
2187
- init_hook_usage();
1200
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-QJLMYOTX.js
1201
+ var init_chunk_QJLMYOTX = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-QJLMYOTX.js"() {
1202
+ init_chunk_LFJW7BOT();
1203
+ init_chunk_ANXBDSUI();
2188
1204
  } });
2189
1205
 
2190
1206
  //#endregion
2191
- //#region src/plugin/plugin-context-data.ts
2192
- var PluginContextData;
2193
- var init_plugin_context_data = __esm({ "src/plugin/plugin-context-data.ts"() {
2194
- init_transform_module_info();
2195
- PluginContextData = class {
2196
- moduleOptionMap = new Map();
2197
- resolveOptionsMap = new Map();
2198
- loadModulePromiseMap = new Map();
2199
- renderedChunkMeta = null;
2200
- updateModuleOption(id, option) {
2201
- const existing = this.moduleOptionMap.get(id);
2202
- if (existing) {
2203
- if (option.moduleSideEffects != null) existing.moduleSideEffects = option.moduleSideEffects;
2204
- if (option.meta != null) Object.assign(existing.meta, option.meta);
2205
- if (option.invalidate != null) existing.invalidate = option.invalidate;
2206
- } else {
2207
- this.moduleOptionMap.set(id, option);
2208
- return option;
2209
- }
2210
- return existing;
2211
- }
2212
- getModuleOption(id) {
2213
- const option = this.moduleOptionMap.get(id);
2214
- if (!option) {
2215
- const raw = {
2216
- moduleSideEffects: null,
2217
- meta: {}
2218
- };
2219
- this.moduleOptionMap.set(id, raw);
2220
- return raw;
2221
- }
2222
- return option;
2223
- }
2224
- getModuleInfo(id, context) {
2225
- const bindingInfo = context.getModuleInfo(id);
2226
- if (bindingInfo) {
2227
- const info = transformModuleInfo(bindingInfo, this.getModuleOption(id));
2228
- return this.proxyModuleInfo(id, info);
2229
- }
2230
- return null;
2231
- }
2232
- proxyModuleInfo(id, info) {
2233
- let moduleSideEffects = info.moduleSideEffects;
2234
- Object.defineProperty(info, "moduleSideEffects", {
2235
- get() {
2236
- return moduleSideEffects;
2237
- },
2238
- set: (v$1) => {
2239
- this.updateModuleOption(id, {
2240
- moduleSideEffects: v$1,
2241
- meta: info.meta,
2242
- invalidate: true
2243
- });
2244
- moduleSideEffects = v$1;
2245
- }
2246
- });
2247
- return info;
2248
- }
2249
- getModuleIds(context) {
2250
- const moduleIds = context.getModuleIds();
2251
- return moduleIds.values();
2252
- }
2253
- saveResolveOptions(options) {
2254
- const index = this.resolveOptionsMap.size;
2255
- this.resolveOptionsMap.set(index, options);
2256
- return index;
2257
- }
2258
- getSavedResolveOptions(receipt) {
2259
- return this.resolveOptionsMap.get(receipt);
2260
- }
2261
- removeSavedResolveOptions(receipt) {
2262
- this.resolveOptionsMap.delete(receipt);
2263
- }
2264
- setRenderChunkMeta(meta) {
2265
- this.renderedChunkMeta = meta;
2266
- }
2267
- getRenderChunkMeta() {
2268
- return this.renderedChunkMeta;
2269
- }
2270
- clear() {
2271
- this.renderedChunkMeta = null;
2272
- this.loadModulePromiseMap.clear();
2273
- }
2274
- };
1207
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-DM52TTEP.js
1208
+ var init_chunk_DM52TTEP = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-DM52TTEP.js"() {
1209
+ init_chunk_WIMGWYZL();
2275
1210
  } });
2276
1211
 
2277
1212
  //#endregion
2278
- //#region src/utils/normalize-string-or-regex.ts
2279
- function normalizedStringOrRegex(pattern) {
2280
- if (!pattern) return void 0;
2281
- if (!isReadonlyArray(pattern)) return [pattern];
2282
- return pattern;
2283
- }
2284
- function isReadonlyArray(input) {
2285
- return Array.isArray(input);
2286
- }
2287
- var init_normalize_string_or_regex = __esm({ "src/utils/normalize-string-or-regex.ts"() {} });
1213
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-2P44HXVH.js
1214
+ var init_chunk_2P44HXVH = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-2P44HXVH.js"() {
1215
+ init_chunk_WIMGWYZL();
1216
+ } });
2288
1217
 
2289
1218
  //#endregion
2290
- //#region src/utils/bindingify-input-options.ts
2291
- function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel, watchMode) {
2292
- const pluginContextData = new PluginContextData();
2293
- const plugins = rawPlugins.map((plugin) => {
2294
- if ("_parallel" in plugin) return void 0;
2295
- if (plugin instanceof BuiltinPlugin) return bindingifyBuiltInPlugin(plugin);
2296
- return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode);
2297
- });
2298
- return {
2299
- input: bindingifyInput(inputOptions.input),
2300
- plugins,
2301
- cwd: inputOptions.cwd ?? process.cwd(),
2302
- external: bindingifyExternal(inputOptions.external),
2303
- resolve: bindingifyResolve(inputOptions.resolve),
2304
- platform: inputOptions.platform,
2305
- shimMissingExports: inputOptions.shimMissingExports,
2306
- logLevel: bindingifyLogLevel(logLevel),
2307
- onLog,
2308
- treeshake: bindingifyTreeshakeOptions(inputOptions.treeshake),
2309
- moduleTypes: inputOptions.moduleTypes,
2310
- define: inputOptions.define ? Object.entries(inputOptions.define) : void 0,
2311
- inject: bindingifyInject(inputOptions.inject),
2312
- experimental: {
2313
- strictExecutionOrder: inputOptions.experimental?.strictExecutionOrder,
2314
- disableLiveBindings: inputOptions.experimental?.disableLiveBindings,
2315
- viteMode: inputOptions.experimental?.viteMode,
2316
- resolveNewUrlToAsset: inputOptions.experimental?.resolveNewUrlToAsset,
2317
- hmr: bindingifyHmr(inputOptions.experimental?.hmr)
2318
- },
2319
- profilerNames: inputOptions?.profilerNames,
2320
- jsx: bindingifyJsx(inputOptions.jsx),
2321
- transform: inputOptions.transform,
2322
- watch: bindingifyWatch(inputOptions.watch),
2323
- dropLabels: inputOptions.dropLabels,
2324
- keepNames: inputOptions.keepNames,
2325
- checks: inputOptions.checks,
2326
- deferSyncScanData: () => {
2327
- let ret = [];
2328
- pluginContextData.moduleOptionMap.forEach((value, key) => {
2329
- if (value.invalidate) ret.push({
2330
- id: key,
2331
- sideEffects: bindingifySideEffects(value.moduleSideEffects)
2332
- });
2333
- });
2334
- return ret;
2335
- },
2336
- makeAbsoluteExternalsRelative: bindingifyMakeAbsoluteExternalsRelative(inputOptions.makeAbsoluteExternalsRelative),
2337
- debug: inputOptions.debug,
2338
- invalidateJsSideCache: pluginContextData.clear.bind(pluginContextData)
2339
- };
2340
- }
2341
- function bindingifyHmr(hmr) {
2342
- if (hmr) {
2343
- if (typeof hmr === "boolean") return hmr ? {} : void 0;
2344
- return hmr;
2345
- }
2346
- }
2347
- function bindingifyExternal(external) {
2348
- if (external) {
2349
- if (typeof external === "function") return (id, importer, isResolved) => {
2350
- if (id.startsWith("\0")) return false;
2351
- return external(id, importer, isResolved) ?? false;
2352
- };
2353
- const externalArr = arraify(external);
2354
- return (id, _importer, _isResolved) => {
2355
- return externalArr.some((pat) => {
2356
- if (pat instanceof RegExp) return pat.test(id);
2357
- return id === pat;
2358
- });
2359
- };
2360
- }
2361
- }
2362
- function bindingifyResolve(resolve) {
2363
- if (resolve) {
2364
- const { alias, extensionAlias,...rest } = resolve;
2365
- return {
2366
- alias: alias ? Object.entries(alias).map(([name, replacement]) => ({
2367
- find: name,
2368
- replacements: arraify(replacement)
2369
- })) : void 0,
2370
- extensionAlias: extensionAlias ? Object.entries(extensionAlias).map(([name, value]) => ({
2371
- target: name,
2372
- replacements: value
2373
- })) : void 0,
2374
- ...rest
2375
- };
2376
- }
2377
- }
2378
- function bindingifyInject(inject) {
2379
- if (inject) return Object.entries(inject).map(([alias, item]) => {
2380
- if (Array.isArray(item)) {
2381
- if (item[1] === "*") return {
2382
- tagNamespace: true,
2383
- alias,
2384
- from: item[0]
2385
- };
2386
- return {
2387
- tagNamed: true,
2388
- alias,
2389
- from: item[0],
2390
- imported: item[1]
2391
- };
2392
- } else return {
2393
- tagNamed: true,
2394
- imported: "default",
2395
- alias,
2396
- from: item
2397
- };
2398
- });
2399
- }
2400
- function bindingifyLogLevel(logLevel) {
2401
- switch (logLevel) {
2402
- case "silent": return import_binding.BindingLogLevel.Silent;
2403
- case "debug": return import_binding.BindingLogLevel.Debug;
2404
- case "warn": return import_binding.BindingLogLevel.Warn;
2405
- case "info": return import_binding.BindingLogLevel.Info;
2406
- default: throw new Error(`Unexpected log level: ${logLevel}`);
2407
- }
2408
- }
2409
- function bindingifyInput(input) {
2410
- if (input === void 0) return [];
2411
- if (typeof input === "string") return [{ import: input }];
2412
- if (Array.isArray(input)) return input.map((src) => ({ import: src }));
2413
- return Object.entries(input).map(([name, import_path]) => {
2414
- return {
2415
- name,
2416
- import: import_path
2417
- };
2418
- });
2419
- }
2420
- function bindingifyJsx(input) {
2421
- switch (input) {
2422
- case false: return { type: "Disable" };
2423
- case "react": return { type: "React" };
2424
- case "react-jsx": return { type: "ReactJsx" };
2425
- case "preserve": return { type: "Preserve" };
2426
- case void 0: return void 0;
2427
- }
2428
- if (input.mode === "preserve") return { type: "Preserve" };
2429
- const mode = input.mode ?? "automatic";
2430
- return {
2431
- type: "Enable",
2432
- field0: {
2433
- runtime: mode,
2434
- importSource: mode === "classic" ? input.importSource : mode === "automatic" ? input.jsxImportSource : void 0,
2435
- pragma: input.factory,
2436
- pragmaFrag: input.fragment,
2437
- development: input.development,
2438
- refresh: input.refresh
2439
- }
2440
- };
2441
- }
2442
- function bindingifyWatch(watch$1) {
2443
- if (watch$1) return {
2444
- buildDelay: watch$1.buildDelay,
2445
- skipWrite: watch$1.skipWrite,
2446
- include: normalizedStringOrRegex(watch$1.include),
2447
- exclude: normalizedStringOrRegex(watch$1.exclude)
2448
- };
2449
- }
2450
- function bindingifyTreeshakeOptions(config) {
2451
- if (config === false) return void 0;
2452
- if (config === true || config === void 0) return { moduleSideEffects: true };
2453
- let normalizedConfig = {
2454
- moduleSideEffects: true,
2455
- annotations: config.annotations,
2456
- manualPureFunctions: config.manualPureFunctions,
2457
- unknownGlobalSideEffects: config.unknownGlobalSideEffects
2458
- };
2459
- if (config.moduleSideEffects === void 0) normalizedConfig.moduleSideEffects = true;
2460
- else if (config.moduleSideEffects === "no-external") normalizedConfig.moduleSideEffects = [{
2461
- external: true,
2462
- sideEffects: false
2463
- }, {
2464
- external: false,
2465
- sideEffects: true
2466
- }];
2467
- else normalizedConfig.moduleSideEffects = config.moduleSideEffects;
2468
- return normalizedConfig;
2469
- }
2470
- function bindingifyMakeAbsoluteExternalsRelative(makeAbsoluteExternalsRelative) {
2471
- if (makeAbsoluteExternalsRelative === "ifRelativeSource") return { type: "IfRelativeSource" };
2472
- if (typeof makeAbsoluteExternalsRelative === "boolean") return {
2473
- type: "Bool",
2474
- field0: makeAbsoluteExternalsRelative
2475
- };
2476
- }
2477
- var init_bindingify_input_options = __esm({ "src/utils/bindingify-input-options.ts"() {
2478
- init_constructors();
2479
- init_utils();
2480
- init_bindingify_plugin();
2481
- init_plugin_context_data();
2482
- init_misc();
2483
- init_normalize_string_or_regex();
2484
- init_transform_side_effects();
1219
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-ZJS5DNQW.js
1220
+ var init_chunk_ZJS5DNQW = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-ZJS5DNQW.js"() {
1221
+ init_chunk_ANXBDSUI();
1222
+ init_chunk_WIMGWYZL();
2485
1223
  } });
2486
1224
 
2487
1225
  //#endregion
2488
- //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-ANXBDSUI.js
2489
- var init_chunk_ANXBDSUI = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-ANXBDSUI.js"() {} });
1226
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-DH3BPT6T.js
1227
+ var init_chunk_DH3BPT6T = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-DH3BPT6T.js"() {} });
2490
1228
 
2491
1229
  //#endregion
2492
- //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-3GOCSNFN.js
2493
- var init_chunk_3GOCSNFN = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-3GOCSNFN.js"() {
2494
- init_chunk_ANXBDSUI();
1230
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-OAMXQXGR.js
1231
+ var init_chunk_OAMXQXGR = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-OAMXQXGR.js"() {
1232
+ init_chunk_WIMGWYZL();
2495
1233
  } });
2496
1234
 
2497
1235
  //#endregion
2498
- //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-LFJW7BOT.js
2499
- var init_chunk_LFJW7BOT = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-LFJW7BOT.js"() {
2500
- init_chunk_3GOCSNFN();
1236
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-P5WDBFN2.js
1237
+ var init_chunk_P5WDBFN2 = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-P5WDBFN2.js"() {
1238
+ init_chunk_DH3BPT6T();
1239
+ init_chunk_OAMXQXGR();
2501
1240
  } });
2502
1241
 
2503
1242
  //#endregion
2504
- //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-7ZI6JRPB.js
2505
- var init_chunk_7ZI6JRPB = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-7ZI6JRPB.js"() {
2506
- init_chunk_LFJW7BOT();
2507
- init_chunk_ANXBDSUI();
2508
- } });
1243
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-EMIEIAAH.js
1244
+ var init_chunk_EMIEIAAH = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-EMIEIAAH.js"() {} });
2509
1245
 
2510
1246
  //#endregion
2511
- //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-OXJMERKM.js
2512
- var init_chunk_OXJMERKM = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-OXJMERKM.js"() {
2513
- init_chunk_LFJW7BOT();
2514
- init_chunk_ANXBDSUI();
1247
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-AHDTEY6L.js
1248
+ var init_chunk_AHDTEY6L = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-AHDTEY6L.js"() {
1249
+ init_chunk_P5WDBFN2();
1250
+ init_chunk_EMIEIAAH();
2515
1251
  } });
2516
1252
 
2517
1253
  //#endregion
2518
- //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-D6FCK2GA.js
2519
- function u$13(o$12, n$7, a$15) {
2520
- let t$14 = (r$12) => o$12(r$12, ...n$7);
2521
- return a$15 === void 0 ? t$14 : Object.assign(t$14, {
2522
- lazy: a$15,
2523
- lazyArgs: n$7
2524
- });
2525
- }
2526
- var init_chunk_D6FCK2GA = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-D6FCK2GA.js"() {} });
2527
-
2528
- //#endregion
2529
- //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-WIMGWYZL.js
2530
- function u$11(r$12, n$7, o$12) {
2531
- let a$15 = r$12.length - n$7.length;
2532
- if (a$15 === 0) return r$12(...n$7);
2533
- if (a$15 === 1) return u$13(r$12, n$7, o$12);
2534
- throw new Error("Wrong number of arguments");
2535
- }
2536
- var init_chunk_WIMGWYZL = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-WIMGWYZL.js"() {
2537
- init_chunk_D6FCK2GA();
2538
- } });
2539
-
2540
- //#endregion
2541
- //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-BSLJB6JE.js
2542
- var init_chunk_BSLJB6JE = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-BSLJB6JE.js"() {
2543
- init_chunk_WIMGWYZL();
2544
- } });
2545
-
2546
- //#endregion
2547
- //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-NJXNQM3G.js
2548
- var init_chunk_NJXNQM3G = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-NJXNQM3G.js"() {} });
2549
-
2550
- //#endregion
2551
- //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-6RKHJ2CP.js
2552
- var init_chunk_6RKHJ2CP = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-6RKHJ2CP.js"() {
2553
- init_chunk_WIMGWYZL();
2554
- } });
2555
-
2556
- //#endregion
2557
- //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-QDGUNRDA.js
2558
- var init_chunk_QDGUNRDA = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-QDGUNRDA.js"() {
2559
- init_chunk_D6FCK2GA();
2560
- } });
2561
-
2562
- //#endregion
2563
- //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-MYLLMFC7.js
2564
- var init_chunk_MYLLMFC7 = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-MYLLMFC7.js"() {
2565
- init_chunk_WIMGWYZL();
2566
- } });
2567
-
2568
- //#endregion
2569
- //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-DEVKGLTN.js
2570
- var o$11, c$3, i$20;
2571
- var init_chunk_DEVKGLTN = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-DEVKGLTN.js"() {
2572
- o$11 = [
2573
- " ",
2574
- `
2575
- `,
2576
- "\v",
2577
- "\f",
2578
- "\r",
2579
- " ",
2580
- "…",
2581
- "\xA0",
2582
- " ",
2583
- " ",
2584
- " ",
2585
- " ",
2586
- " ",
2587
- " ",
2588
- " ",
2589
- " ",
2590
- " ",
2591
- " ",
2592
- " ",
2593
- " ",
2594
- "\u2028",
2595
- "\u2029",
2596
- " ",
2597
- " ",
2598
- " ",
2599
- ""
2600
- ], c$3 = new Set([
2601
- "-",
2602
- "_",
2603
- ...o$11
2604
- ]), i$20 = (r$12) => {
2605
- let e$5 = [], t$14 = "", u$14 = () => {
2606
- t$14.length > 0 && (e$5.push(t$14), t$14 = "");
2607
- };
2608
- for (let s$10 of r$12) {
2609
- if (c$3.has(s$10)) {
2610
- u$14();
2611
- continue;
2612
- }
2613
- if (/[a-z]$/u.test(t$14) && /[A-Z]/u.test(s$10)) u$14();
2614
- else if (/[A-Z][A-Z]$/u.test(t$14) && /[a-z]/u.test(s$10)) {
2615
- let n$7 = t$14.slice(-1);
2616
- t$14 = t$14.slice(0, -1), u$14(), t$14 = n$7;
2617
- } else /\d$/u.test(t$14) !== /\d/u.test(s$10) && u$14();
2618
- t$14 += s$10;
2619
- }
2620
- return u$14(), e$5;
2621
- };
2622
- } });
2623
-
2624
- //#endregion
2625
- //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-N4JUOEMS.js
2626
- var init_chunk_N4JUOEMS = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-N4JUOEMS.js"() {
2627
- init_chunk_DEVKGLTN();
2628
- } });
2629
-
2630
- //#endregion
2631
- //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-YRJ25UV2.js
2632
- var init_chunk_YRJ25UV2 = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-YRJ25UV2.js"() {
2633
- init_chunk_DEVKGLTN();
2634
- init_chunk_WIMGWYZL();
2635
- } });
2636
-
2637
- //#endregion
2638
- //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-Q5ASJ5N7.js
2639
- var init_chunk_Q5ASJ5N7 = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-Q5ASJ5N7.js"() {
2640
- init_chunk_WIMGWYZL();
2641
- } });
2642
-
2643
- //#endregion
2644
- //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-WZOX4VKU.js
2645
- var init_chunk_WZOX4VKU = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-WZOX4VKU.js"() {
2646
- init_chunk_DEVKGLTN();
2647
- init_chunk_WIMGWYZL();
2648
- } });
2649
-
2650
- //#endregion
2651
- //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-Y3VKZ3P5.js
2652
- var init_chunk_Y3VKZ3P5 = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-Y3VKZ3P5.js"() {
2653
- init_chunk_WIMGWYZL();
2654
- } });
2655
-
2656
- //#endregion
2657
- //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-ZRKG4NSC.js
2658
- var init_chunk_ZRKG4NSC = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-ZRKG4NSC.js"() {
2659
- init_chunk_WIMGWYZL();
2660
- } });
2661
-
2662
- //#endregion
2663
- //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-QJLMYOTX.js
2664
- var init_chunk_QJLMYOTX = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-QJLMYOTX.js"() {
2665
- init_chunk_LFJW7BOT();
2666
- init_chunk_ANXBDSUI();
2667
- } });
2668
-
2669
- //#endregion
2670
- //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-DM52TTEP.js
2671
- var init_chunk_DM52TTEP = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-DM52TTEP.js"() {
2672
- init_chunk_WIMGWYZL();
2673
- } });
2674
-
2675
- //#endregion
2676
- //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-2P44HXVH.js
2677
- var init_chunk_2P44HXVH = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-2P44HXVH.js"() {
2678
- init_chunk_WIMGWYZL();
2679
- } });
2680
-
2681
- //#endregion
2682
- //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-ZJS5DNQW.js
2683
- var init_chunk_ZJS5DNQW = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-ZJS5DNQW.js"() {
2684
- init_chunk_ANXBDSUI();
2685
- init_chunk_WIMGWYZL();
2686
- } });
2687
-
2688
- //#endregion
2689
- //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-DH3BPT6T.js
2690
- var init_chunk_DH3BPT6T = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-DH3BPT6T.js"() {} });
2691
-
2692
- //#endregion
2693
- //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-OAMXQXGR.js
2694
- var init_chunk_OAMXQXGR = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-OAMXQXGR.js"() {
2695
- init_chunk_WIMGWYZL();
2696
- } });
2697
-
2698
- //#endregion
2699
- //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-P5WDBFN2.js
2700
- var init_chunk_P5WDBFN2 = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-P5WDBFN2.js"() {
2701
- init_chunk_DH3BPT6T();
2702
- init_chunk_OAMXQXGR();
2703
- } });
2704
-
2705
- //#endregion
2706
- //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-EMIEIAAH.js
2707
- var init_chunk_EMIEIAAH = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-EMIEIAAH.js"() {} });
2708
-
2709
- //#endregion
2710
- //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-AHDTEY6L.js
2711
- var init_chunk_AHDTEY6L = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-AHDTEY6L.js"() {
2712
- init_chunk_P5WDBFN2();
2713
- init_chunk_EMIEIAAH();
2714
- } });
2715
-
2716
- //#endregion
2717
- //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-4UEQNEAO.js
2718
- var init_chunk_4UEQNEAO = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-4UEQNEAO.js"() {
2719
- init_chunk_WIMGWYZL();
2720
- } });
1254
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-4UEQNEAO.js
1255
+ var init_chunk_4UEQNEAO = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-4UEQNEAO.js"() {
1256
+ init_chunk_WIMGWYZL();
1257
+ } });
2721
1258
 
2722
1259
  //#endregion
2723
1260
  //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-T4PLMLCP.js
@@ -2927,8 +1464,17 @@ var init_chunk_R72GEKLP = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_m
2927
1464
 
2928
1465
  //#endregion
2929
1466
  //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-3IFJP4R5.js
1467
+ function d$3(...r$12) {
1468
+ return u$11(i$19, r$12);
1469
+ }
1470
+ var i$19;
2930
1471
  var init_chunk_3IFJP4R5 = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-3IFJP4R5.js"() {
2931
1472
  init_chunk_WIMGWYZL();
1473
+ i$19 = (r$12, t$14) => {
1474
+ let a$15 = [[], []];
1475
+ for (let [o$12, e$5] of r$12.entries()) t$14(e$5, o$12, r$12) ? a$15[0].push(e$5) : a$15[1].push(e$5);
1476
+ return a$15;
1477
+ };
2932
1478
  } });
2933
1479
 
2934
1480
  //#endregion
@@ -3685,6 +2231,1576 @@ var init_dist = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/rem
3685
2231
  init_chunk_WIMGWYZL();
3686
2232
  } });
3687
2233
 
2234
+ //#endregion
2235
+ //#region src/plugin/bindingify-hook-filter.ts
2236
+ function generalHookFilterMatcherToFilterExprs(matcher, stringKind) {
2237
+ if (typeof matcher === "string" || matcher instanceof RegExp) return [include(id(matcher))];
2238
+ if (Array.isArray(matcher)) return matcher.map((m$10) => include(id(m$10)));
2239
+ if (matcher.custom) return matcher.custom;
2240
+ let ret = [];
2241
+ let isCode = stringKind === "code";
2242
+ if (matcher.exclude) ret.push(...arraify(matcher.exclude).map((m$10) => exclude(isCode ? code(m$10) : id(m$10))));
2243
+ if (matcher.include) ret.push(...arraify(matcher.include).map((m$10) => include(isCode ? code(m$10) : id(m$10))));
2244
+ return ret;
2245
+ }
2246
+ function transformFilterMatcherToFilterExprs(filterOption) {
2247
+ if (!filterOption) return void 0;
2248
+ const { id: id$1, code: code$1, moduleType: moduleType$1, custom } = filterOption;
2249
+ if (custom) return custom;
2250
+ let ret = [];
2251
+ let idIncludes = [];
2252
+ let idExcludes = [];
2253
+ let codeIncludes = [];
2254
+ let codeExcludes = [];
2255
+ if (id$1) [idIncludes, idExcludes] = d$3(generalHookFilterMatcherToFilterExprs(id$1, "id") ?? [], (m$10) => m$10.kind === "include");
2256
+ if (code$1) [codeIncludes, codeExcludes] = d$3(generalHookFilterMatcherToFilterExprs(code$1, "code") ?? [], (m$10) => m$10.kind === "include");
2257
+ ret.push(...idExcludes);
2258
+ ret.push(...codeExcludes);
2259
+ let cursor;
2260
+ if (moduleType$1) {
2261
+ let moduleTypes = Array.isArray(moduleType$1) ? moduleType$1 : moduleType$1.include ?? [];
2262
+ cursor = joinFilterExprsWithOr(moduleTypes.map((m$10) => moduleType(m$10)));
2263
+ }
2264
+ if (idIncludes.length) {
2265
+ let joinedOrExpr = joinFilterExprsWithOr(idIncludes.map((item) => item.expr));
2266
+ if (!cursor) cursor = joinedOrExpr;
2267
+ else cursor = and(cursor, joinedOrExpr);
2268
+ }
2269
+ if (codeIncludes.length) {
2270
+ let joinedOrExpr = joinFilterExprsWithOr(codeIncludes.map((item) => item.expr));
2271
+ if (!cursor) cursor = joinedOrExpr;
2272
+ else cursor = and(cursor, joinedOrExpr);
2273
+ }
2274
+ if (cursor) ret.push(include(cursor));
2275
+ return ret;
2276
+ }
2277
+ function joinFilterExprsWithOr(filterExprs) {
2278
+ if (filterExprs.length === 1) return filterExprs[0];
2279
+ return or(filterExprs[0], joinFilterExprsWithOr(filterExprs.slice(1)));
2280
+ }
2281
+ function bindingifyGeneralHookFilter(matcher, stringKind) {
2282
+ let filterExprs = generalHookFilterMatcherToFilterExprs(matcher, stringKind);
2283
+ let custom = [];
2284
+ if (filterExprs) custom = filterExprs.map(bindingifyFilterExpr);
2285
+ return { custom: custom.length > 0 ? custom : void 0 };
2286
+ }
2287
+ function bindingifyFilterExpr(expr) {
2288
+ let list = [];
2289
+ bindingifyFilterExprImpl(expr, list);
2290
+ return list;
2291
+ }
2292
+ function bindingifyFilterExprImpl(expr, list) {
2293
+ switch (expr.kind) {
2294
+ case "and": {
2295
+ bindingifyFilterExprImpl(expr.right, list);
2296
+ bindingifyFilterExprImpl(expr.left, list);
2297
+ list.push({ kind: "And" });
2298
+ break;
2299
+ }
2300
+ case "not": {
2301
+ bindingifyFilterExprImpl(expr.expr, list);
2302
+ list.push({ kind: "Not" });
2303
+ break;
2304
+ }
2305
+ case "id": {
2306
+ list.push({
2307
+ kind: "Id",
2308
+ value: expr.pattern
2309
+ });
2310
+ break;
2311
+ }
2312
+ case "moduleType": {
2313
+ list.push({
2314
+ kind: "ModuleType",
2315
+ value: expr.pattern
2316
+ });
2317
+ break;
2318
+ }
2319
+ case "code": {
2320
+ list.push({
2321
+ kind: "Code",
2322
+ value: expr.pattern
2323
+ });
2324
+ break;
2325
+ }
2326
+ case "include": {
2327
+ bindingifyFilterExprImpl(expr.expr, list);
2328
+ list.push({ kind: "Include" });
2329
+ break;
2330
+ }
2331
+ case "exclude": {
2332
+ bindingifyFilterExprImpl(expr.expr, list);
2333
+ list.push({ kind: "Exclude" });
2334
+ break;
2335
+ }
2336
+ default: throw new Error(`Unknown filter expression kind: ${expr.kind}`);
2337
+ }
2338
+ }
2339
+ function bindingifyResolveIdFilter(filterOption) {
2340
+ return filterOption?.id ? bindingifyGeneralHookFilter(filterOption.id, "id") : void 0;
2341
+ }
2342
+ function bindingifyLoadFilter(filterOption) {
2343
+ return filterOption?.id ? bindingifyGeneralHookFilter(filterOption.id, "id") : void 0;
2344
+ }
2345
+ function bindingifyTransformFilter(filterOption) {
2346
+ if (!filterOption) return void 0;
2347
+ let custom = transformFilterMatcherToFilterExprs(filterOption);
2348
+ let ret = [];
2349
+ if (custom) ret = custom.map(bindingifyFilterExpr);
2350
+ return { custom: ret.length > 0 ? ret : void 0 };
2351
+ }
2352
+ function bindingifyRenderChunkFilter(filterOption) {
2353
+ if (filterOption) {
2354
+ const { code: code$1 } = filterOption;
2355
+ return { custom: code$1 ? bindingifyGeneralHookFilter(code$1, "code").custom : void 0 };
2356
+ }
2357
+ }
2358
+ var init_bindingify_hook_filter = __esm({ "src/plugin/bindingify-hook-filter.ts"() {
2359
+ init_dist();
2360
+ init_filter_expression_index();
2361
+ init_misc();
2362
+ } });
2363
+
2364
+ //#endregion
2365
+ //#region src/plugin/bindingify-plugin-hook-meta.ts
2366
+ function bindingifyPluginHookMeta(options) {
2367
+ return { order: bindingPluginOrder(options.order) };
2368
+ }
2369
+ function bindingPluginOrder(order) {
2370
+ switch (order) {
2371
+ case "post": return import_binding.BindingPluginOrder.Post;
2372
+ case "pre": return import_binding.BindingPluginOrder.Pre;
2373
+ case null:
2374
+ case void 0: return void 0;
2375
+ default: throw new Error(`Unknown plugin order: ${order}`);
2376
+ }
2377
+ }
2378
+ var init_bindingify_plugin_hook_meta = __esm({ "src/plugin/bindingify-plugin-hook-meta.ts"() {} });
2379
+
2380
+ //#endregion
2381
+ //#region src/utils/asset-source.ts
2382
+ function transformAssetSource(bindingAssetSource$1) {
2383
+ return bindingAssetSource$1.inner;
2384
+ }
2385
+ function bindingAssetSource(source) {
2386
+ return { inner: source };
2387
+ }
2388
+ var init_asset_source = __esm({ "src/utils/asset-source.ts"() {} });
2389
+
2390
+ //#endregion
2391
+ //#region src/plugin/plugin-context.ts
2392
+ var PluginContextImpl;
2393
+ var init_plugin_context = __esm({ "src/plugin/plugin-context.ts"() {
2394
+ init_logging();
2395
+ init_logs();
2396
+ init_parse_ast_index();
2397
+ init_minimal_plugin_context();
2398
+ init_asset_source();
2399
+ init_misc();
2400
+ init_transform_side_effects();
2401
+ PluginContextImpl = class extends MinimalPluginContextImpl {
2402
+ getModuleInfo;
2403
+ constructor(outputOptions, context, plugin, data, onLog, logLevel, watchMode, currentLoadingModule) {
2404
+ super(onLog, logLevel, plugin.name, watchMode);
2405
+ this.outputOptions = outputOptions;
2406
+ this.context = context;
2407
+ this.data = data;
2408
+ this.onLog = onLog;
2409
+ this.currentLoadingModule = currentLoadingModule;
2410
+ this.getModuleInfo = (id$1) => this.data.getModuleInfo(id$1, context);
2411
+ }
2412
+ async load(options) {
2413
+ const id$1 = options.id;
2414
+ if (id$1 === this.currentLoadingModule) this.onLog(LOG_LEVEL_WARN, logCycleLoading(this.pluginName, this.currentLoadingModule));
2415
+ const moduleInfo = this.data.getModuleInfo(id$1, this.context);
2416
+ if (moduleInfo && moduleInfo.code !== null) return moduleInfo;
2417
+ const rawOptions = {
2418
+ meta: options.meta || {},
2419
+ moduleSideEffects: options.moduleSideEffects || null,
2420
+ invalidate: false
2421
+ };
2422
+ this.data.updateModuleOption(id$1, rawOptions);
2423
+ async function createLoadModulePromise(context, data) {
2424
+ const loadPromise = data.loadModulePromiseMap.get(id$1);
2425
+ if (loadPromise) return loadPromise;
2426
+ const promise = new Promise((resolve, _) => {
2427
+ data.loadModulePromiseResolveFnMap.set(id$1, resolve);
2428
+ });
2429
+ data.loadModulePromiseMap.set(id$1, promise);
2430
+ try {
2431
+ await context.load(id$1, bindingifySideEffects(options.moduleSideEffects));
2432
+ } catch (e$5) {
2433
+ data.loadModulePromiseMap.delete(id$1);
2434
+ data.loadModulePromiseResolveFnMap.delete(id$1);
2435
+ throw e$5;
2436
+ }
2437
+ return promise;
2438
+ }
2439
+ await createLoadModulePromise(this.context, this.data);
2440
+ return this.data.getModuleInfo(id$1, this.context);
2441
+ }
2442
+ async resolve(source, importer, options) {
2443
+ let receipt = void 0;
2444
+ if (options != null) receipt = this.data.saveResolveOptions(options);
2445
+ const res = await this.context.resolve(source, importer, {
2446
+ custom: receipt,
2447
+ skipSelf: options?.skipSelf
2448
+ });
2449
+ if (receipt != null) this.data.removeSavedResolveOptions(receipt);
2450
+ if (res == null) return null;
2451
+ const info = this.data.getModuleOption(res.id) || {};
2452
+ return {
2453
+ ...res,
2454
+ external: res.external === "relative" ? unreachable(`The PluginContext resolve result external couldn't be 'relative'`) : res.external,
2455
+ ...info
2456
+ };
2457
+ }
2458
+ emitFile = (file) => {
2459
+ if (file.type === "prebuilt-chunk") return unimplemented("PluginContext.emitFile with type prebuilt-chunk");
2460
+ if (file.type === "chunk") return this.context.emitChunk(file);
2461
+ const fnSanitizedFileName = file.fileName || typeof this.outputOptions.sanitizeFileName !== "function" ? void 0 : this.outputOptions.sanitizeFileName(file.name || "asset");
2462
+ const filename = file.fileName ? void 0 : this.getAssetFileNames(file);
2463
+ return this.context.emitFile({
2464
+ ...file,
2465
+ originalFileName: file.originalFileName || void 0,
2466
+ source: bindingAssetSource(file.source)
2467
+ }, filename, fnSanitizedFileName);
2468
+ };
2469
+ getAssetFileNames(file) {
2470
+ if (typeof this.outputOptions.assetFileNames === "function") return this.outputOptions.assetFileNames({
2471
+ names: file.name ? [file.name] : [],
2472
+ originalFileNames: file.originalFileName ? [file.originalFileName] : [],
2473
+ source: file.source,
2474
+ type: "asset"
2475
+ });
2476
+ }
2477
+ getFileName(referenceId) {
2478
+ return this.context.getFileName(referenceId);
2479
+ }
2480
+ getModuleIds() {
2481
+ return this.data.getModuleIds(this.context);
2482
+ }
2483
+ addWatchFile(id$1) {
2484
+ this.context.addWatchFile(id$1);
2485
+ }
2486
+ parse(input, options) {
2487
+ return parseAst(input, options);
2488
+ }
2489
+ };
2490
+ } });
2491
+
2492
+ //#endregion
2493
+ //#region src/plugin/transform-plugin-context.ts
2494
+ var TransformPluginContextImpl;
2495
+ var init_transform_plugin_context = __esm({ "src/plugin/transform-plugin-context.ts"() {
2496
+ init_log_handler();
2497
+ init_logs();
2498
+ init_plugin_context();
2499
+ TransformPluginContextImpl = class extends PluginContextImpl {
2500
+ constructor(outputOptions, context, plugin, data, inner, moduleId, moduleSource, onLog, LogLevelOption, watchMode) {
2501
+ super(outputOptions, context, plugin, data, onLog, LogLevelOption, watchMode, moduleId);
2502
+ this.inner = inner;
2503
+ this.moduleId = moduleId;
2504
+ this.moduleSource = moduleSource;
2505
+ const getLogHandler$1 = (handler) => (log, pos) => {
2506
+ log = normalizeLog(log);
2507
+ if (pos) augmentCodeLocation(log, pos, moduleSource, moduleId);
2508
+ log.id = moduleId;
2509
+ log.hook = "transform";
2510
+ handler(log);
2511
+ };
2512
+ this.debug = getLogHandler$1(this.debug);
2513
+ this.warn = getLogHandler$1(this.warn);
2514
+ this.info = getLogHandler$1(this.info);
2515
+ }
2516
+ error(e$5, pos) {
2517
+ if (typeof e$5 === "string") e$5 = { message: e$5 };
2518
+ if (pos) augmentCodeLocation(e$5, pos, this.moduleSource, this.moduleId);
2519
+ e$5.id = this.moduleId;
2520
+ e$5.hook = "transform";
2521
+ return error(logPluginError(normalizeLog(e$5), this.pluginName));
2522
+ }
2523
+ getCombinedSourcemap() {
2524
+ return JSON.parse(this.inner.getCombinedSourcemap());
2525
+ }
2526
+ };
2527
+ } });
2528
+
2529
+ //#endregion
2530
+ //#region src/plugin/bindingify-build-hooks.ts
2531
+ function bindingifyBuildStart(args) {
2532
+ const hook = args.plugin.buildStart;
2533
+ if (!hook) return {};
2534
+ const { handler, meta } = normalizeHook(hook);
2535
+ return {
2536
+ plugin: async (ctx, opts) => {
2537
+ await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), new NormalizedInputOptionsImpl(opts, args.onLog));
2538
+ },
2539
+ meta: bindingifyPluginHookMeta(meta)
2540
+ };
2541
+ }
2542
+ function bindingifyBuildEnd(args) {
2543
+ const hook = args.plugin.buildEnd;
2544
+ if (!hook) return {};
2545
+ const { handler, meta } = normalizeHook(hook);
2546
+ return {
2547
+ plugin: async (ctx, err) => {
2548
+ await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), err ? normalizeErrors(err) : void 0);
2549
+ },
2550
+ meta: bindingifyPluginHookMeta(meta)
2551
+ };
2552
+ }
2553
+ function bindingifyResolveId(args) {
2554
+ const hook = args.plugin.resolveId;
2555
+ if (!hook) return {};
2556
+ const { handler, meta, options } = normalizeHook(hook);
2557
+ return {
2558
+ plugin: async (ctx, specifier, importer, extraOptions) => {
2559
+ const contextResolveOptions = extraOptions.custom != null ? args.pluginContextData.getSavedResolveOptions(extraOptions.custom) : void 0;
2560
+ const newExtraOptions = {
2561
+ ...extraOptions,
2562
+ custom: contextResolveOptions?.custom,
2563
+ [SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF]: contextResolveOptions?.[SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF]
2564
+ };
2565
+ const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), specifier, importer ?? void 0, newExtraOptions);
2566
+ if (ret == null) return;
2567
+ if (ret === false) return {
2568
+ id: specifier,
2569
+ external: true,
2570
+ normalizeExternalId: true
2571
+ };
2572
+ if (typeof ret === "string") return {
2573
+ id: ret,
2574
+ normalizeExternalId: true
2575
+ };
2576
+ let exist = args.pluginContextData.updateModuleOption(ret.id, {
2577
+ meta: ret.meta || {},
2578
+ moduleSideEffects: ret.moduleSideEffects ?? null,
2579
+ invalidate: false
2580
+ });
2581
+ return {
2582
+ id: ret.id,
2583
+ external: ret.external,
2584
+ normalizeExternalId: false,
2585
+ sideEffects: bindingifySideEffects(exist.moduleSideEffects)
2586
+ };
2587
+ },
2588
+ meta: bindingifyPluginHookMeta(meta),
2589
+ filter: bindingifyResolveIdFilter(options.filter)
2590
+ };
2591
+ }
2592
+ function bindingifyResolveDynamicImport(args) {
2593
+ const hook = args.plugin.resolveDynamicImport;
2594
+ if (!hook) return {};
2595
+ const { handler, meta } = normalizeHook(hook);
2596
+ return {
2597
+ plugin: async (ctx, specifier, importer) => {
2598
+ const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), specifier, importer ?? void 0);
2599
+ if (ret == null) return;
2600
+ if (ret === false) return {
2601
+ id: specifier,
2602
+ external: true
2603
+ };
2604
+ if (typeof ret === "string") return { id: ret };
2605
+ const result = {
2606
+ id: ret.id,
2607
+ external: ret.external
2608
+ };
2609
+ if (ret.moduleSideEffects !== null) result.sideEffects = bindingifySideEffects(ret.moduleSideEffects);
2610
+ args.pluginContextData.updateModuleOption(ret.id, {
2611
+ meta: ret.meta || {},
2612
+ moduleSideEffects: ret.moduleSideEffects || null,
2613
+ invalidate: false
2614
+ });
2615
+ return result;
2616
+ },
2617
+ meta: bindingifyPluginHookMeta(meta)
2618
+ };
2619
+ }
2620
+ function bindingifyTransform(args) {
2621
+ const hook = args.plugin.transform;
2622
+ if (!hook) return {};
2623
+ const { handler, meta, options } = normalizeHook(hook);
2624
+ return {
2625
+ plugin: async (ctx, code$1, id$1, meta$1) => {
2626
+ 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);
2627
+ if (ret == null) return void 0;
2628
+ if (typeof ret === "string") return { code: ret };
2629
+ let moduleOption = args.pluginContextData.updateModuleOption(id$1, {
2630
+ meta: ret.meta ?? {},
2631
+ moduleSideEffects: ret.moduleSideEffects ?? null,
2632
+ invalidate: false
2633
+ });
2634
+ return {
2635
+ code: ret.code,
2636
+ map: bindingifySourcemap(normalizeTransformHookSourcemap(id$1, code$1, ret.map)),
2637
+ sideEffects: bindingifySideEffects(moduleOption.moduleSideEffects),
2638
+ moduleType: ret.moduleType
2639
+ };
2640
+ },
2641
+ meta: bindingifyPluginHookMeta(meta),
2642
+ filter: bindingifyTransformFilter(options.filter)
2643
+ };
2644
+ }
2645
+ function bindingifyLoad(args) {
2646
+ const hook = args.plugin.load;
2647
+ if (!hook) return {};
2648
+ const { handler, meta, options } = normalizeHook(hook);
2649
+ return {
2650
+ plugin: async (ctx, id$1) => {
2651
+ const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode, id$1), id$1);
2652
+ if (ret == null) return;
2653
+ if (typeof ret === "string") return { code: ret };
2654
+ let moduleOption = args.pluginContextData.updateModuleOption(id$1, {
2655
+ meta: ret.meta || {},
2656
+ moduleSideEffects: ret.moduleSideEffects ?? null,
2657
+ invalidate: false
2658
+ });
2659
+ let map = preProcessSourceMap(ret, id$1);
2660
+ return {
2661
+ code: ret.code,
2662
+ map: bindingifySourcemap(map),
2663
+ moduleType: ret.moduleType,
2664
+ sideEffects: bindingifySideEffects(moduleOption.moduleSideEffects)
2665
+ };
2666
+ },
2667
+ meta: bindingifyPluginHookMeta(meta),
2668
+ filter: bindingifyLoadFilter(options.filter)
2669
+ };
2670
+ }
2671
+ function preProcessSourceMap(ret, id$1) {
2672
+ if (!ret.map) return;
2673
+ let map = typeof ret.map === "object" ? ret.map : JSON.parse(ret.map);
2674
+ if (!isEmptySourcemapFiled(map.sources)) {
2675
+ const directory = path.dirname(id$1) || ".";
2676
+ const sourceRoot = map.sourceRoot || ".";
2677
+ map.sources = map.sources.map((source) => path.resolve(directory, sourceRoot, source));
2678
+ }
2679
+ return map;
2680
+ }
2681
+ function bindingifyModuleParsed(args) {
2682
+ const hook = args.plugin.moduleParsed;
2683
+ if (!hook) return {};
2684
+ const { handler, meta } = normalizeHook(hook);
2685
+ return {
2686
+ plugin: async (ctx, moduleInfo) => {
2687
+ await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformModuleInfo(moduleInfo, args.pluginContextData.getModuleOption(moduleInfo.id)));
2688
+ },
2689
+ meta: bindingifyPluginHookMeta(meta)
2690
+ };
2691
+ }
2692
+ var init_bindingify_build_hooks = __esm({ "src/plugin/bindingify-build-hooks.ts"() {
2693
+ init_normalize_hook();
2694
+ init_plugin_context$1();
2695
+ init_normalized_input_options();
2696
+ init_sourcemap();
2697
+ init_error();
2698
+ init_transform_module_info();
2699
+ init_transform_side_effects();
2700
+ init_transform_sourcemap();
2701
+ init_bindingify_hook_filter();
2702
+ init_bindingify_plugin_hook_meta();
2703
+ init_plugin_context();
2704
+ init_transform_plugin_context();
2705
+ } });
2706
+
2707
+ //#endregion
2708
+ //#region src/utils/transform-rendered-module.ts
2709
+ function transformToRenderedModule(bindingRenderedModule) {
2710
+ return {
2711
+ get code() {
2712
+ return bindingRenderedModule.code;
2713
+ },
2714
+ get renderedLength() {
2715
+ return bindingRenderedModule.code?.length || 0;
2716
+ },
2717
+ get renderedExports() {
2718
+ return bindingRenderedModule.renderedExports;
2719
+ }
2720
+ };
2721
+ }
2722
+ var init_transform_rendered_module = __esm({ "src/utils/transform-rendered-module.ts"() {} });
2723
+
2724
+ //#endregion
2725
+ //#region src/utils/transform-rendered-chunk.ts
2726
+ function transformRenderedChunk(chunk) {
2727
+ let modules = null;
2728
+ return {
2729
+ get name() {
2730
+ return chunk.name;
2731
+ },
2732
+ get isEntry() {
2733
+ return chunk.isEntry;
2734
+ },
2735
+ get isDynamicEntry() {
2736
+ return chunk.isDynamicEntry;
2737
+ },
2738
+ get facadeModuleId() {
2739
+ return chunk.facadeModuleId;
2740
+ },
2741
+ get moduleIds() {
2742
+ return chunk.moduleIds;
2743
+ },
2744
+ get exports() {
2745
+ return chunk.exports;
2746
+ },
2747
+ get fileName() {
2748
+ return chunk.fileName;
2749
+ },
2750
+ get imports() {
2751
+ return chunk.imports;
2752
+ },
2753
+ get dynamicImports() {
2754
+ return chunk.dynamicImports;
2755
+ },
2756
+ get modules() {
2757
+ if (!modules) modules = transformChunkModules(chunk.modules);
2758
+ return modules;
2759
+ }
2760
+ };
2761
+ }
2762
+ function transformChunkModules(modules) {
2763
+ const result = {};
2764
+ for (let i$22 = 0; i$22 < modules.values.length; i$22++) {
2765
+ let key = modules.keys[i$22];
2766
+ const mod = modules.values[i$22];
2767
+ result[key] = transformToRenderedModule(mod);
2768
+ }
2769
+ return result;
2770
+ }
2771
+ var init_transform_rendered_chunk = __esm({ "src/utils/transform-rendered-chunk.ts"() {
2772
+ init_transform_rendered_module();
2773
+ } });
2774
+
2775
+ //#endregion
2776
+ //#region src/utils/bindingify-output-options.ts
2777
+ function bindingifyOutputOptions(outputOptions) {
2778
+ const { dir, format, exports, hashCharacters, sourcemap, sourcemapDebugIds, sourcemapIgnoreList, sourcemapPathTransform, name, assetFileNames, entryFileNames, chunkFileNames, cssEntryFileNames, cssChunkFileNames, banner, footer, intro, outro, esModule, globals, file, sanitizeFileName } = outputOptions;
2779
+ return {
2780
+ dir,
2781
+ file: file == null ? void 0 : file,
2782
+ format: bindingifyFormat(format),
2783
+ exports,
2784
+ hashCharacters,
2785
+ sourcemap: bindingifySourcemap$1(sourcemap),
2786
+ sourcemapDebugIds,
2787
+ sourcemapIgnoreList: bindingifySourcemapIgnoreList(sourcemapIgnoreList),
2788
+ sourcemapPathTransform,
2789
+ banner: bindingifyAddon(banner),
2790
+ footer: bindingifyAddon(footer),
2791
+ intro: bindingifyAddon(intro),
2792
+ outro: bindingifyAddon(outro),
2793
+ extend: outputOptions.extend,
2794
+ globals,
2795
+ esModule,
2796
+ name,
2797
+ assetFileNames: bindingifyAssetFilenames(assetFileNames),
2798
+ entryFileNames,
2799
+ chunkFileNames,
2800
+ cssEntryFileNames,
2801
+ cssChunkFileNames,
2802
+ plugins: [],
2803
+ minify: outputOptions.minify,
2804
+ externalLiveBindings: outputOptions.externalLiveBindings,
2805
+ inlineDynamicImports: outputOptions.inlineDynamicImports,
2806
+ advancedChunks: outputOptions.advancedChunks,
2807
+ polyfillRequire: outputOptions.polyfillRequire,
2808
+ target: outputOptions.target,
2809
+ sanitizeFileName
2810
+ };
2811
+ }
2812
+ function bindingifyAddon(configAddon) {
2813
+ return async (chunk) => {
2814
+ if (typeof configAddon === "function") return configAddon(transformRenderedChunk(chunk));
2815
+ return configAddon || "";
2816
+ };
2817
+ }
2818
+ function bindingifyFormat(format) {
2819
+ switch (format) {
2820
+ case void 0:
2821
+ case "es":
2822
+ case "esm":
2823
+ case "module": return "es";
2824
+ case "cjs":
2825
+ case "commonjs": return "cjs";
2826
+ case "iife": return "iife";
2827
+ case "umd": return "umd";
2828
+ case "experimental-app": return "app";
2829
+ default: unimplemented(`output.format: ${format}`);
2830
+ }
2831
+ }
2832
+ function bindingifySourcemap$1(sourcemap) {
2833
+ switch (sourcemap) {
2834
+ case true: return "file";
2835
+ case "inline": return "inline";
2836
+ case false:
2837
+ case void 0: return void 0;
2838
+ case "hidden": return "hidden";
2839
+ default: throw new Error(`unknown sourcemap: ${sourcemap}`);
2840
+ }
2841
+ }
2842
+ function bindingifySourcemapIgnoreList(sourcemapIgnoreList) {
2843
+ return typeof sourcemapIgnoreList === "function" ? sourcemapIgnoreList : sourcemapIgnoreList === false ? () => false : (relativeSourcePath, _sourcemapPath) => relativeSourcePath.includes("node_modules");
2844
+ }
2845
+ function bindingifyAssetFilenames(assetFileNames) {
2846
+ if (typeof assetFileNames === "function") return (asset) => {
2847
+ return assetFileNames({
2848
+ names: asset.names,
2849
+ originalFileNames: asset.originalFileNames,
2850
+ source: transformAssetSource(asset.source),
2851
+ type: "asset"
2852
+ });
2853
+ };
2854
+ return assetFileNames;
2855
+ }
2856
+ var init_bindingify_output_options = __esm({ "src/utils/bindingify-output-options.ts"() {
2857
+ init_asset_source();
2858
+ init_misc();
2859
+ init_transform_rendered_chunk();
2860
+ } });
2861
+
2862
+ //#endregion
2863
+ //#region src/options/normalized-output-options.ts
2864
+ function normalizeAddon(value) {
2865
+ if (typeof value === "function") return value;
2866
+ return () => value || "";
2867
+ }
2868
+ var NormalizedOutputOptionsImpl;
2869
+ var init_normalized_output_options = __esm({ "src/options/normalized-output-options.ts"() {
2870
+ init_bindingify_output_options();
2871
+ NormalizedOutputOptionsImpl = class {
2872
+ constructor(inner, outputOptions, normalizedOutputPlugins) {
2873
+ this.inner = inner;
2874
+ this.outputOptions = outputOptions;
2875
+ this.normalizedOutputPlugins = normalizedOutputPlugins;
2876
+ }
2877
+ get dir() {
2878
+ return this.inner.dir ?? void 0;
2879
+ }
2880
+ get entryFileNames() {
2881
+ return this.inner.entryFilenames || this.outputOptions.entryFileNames;
2882
+ }
2883
+ get chunkFileNames() {
2884
+ return this.inner.chunkFilenames || this.outputOptions.chunkFileNames;
2885
+ }
2886
+ get assetFileNames() {
2887
+ return this.inner.assetFilenames || this.outputOptions.assetFileNames;
2888
+ }
2889
+ get format() {
2890
+ return this.inner.format;
2891
+ }
2892
+ get exports() {
2893
+ return this.inner.exports;
2894
+ }
2895
+ get sourcemap() {
2896
+ return this.inner.sourcemap;
2897
+ }
2898
+ get cssEntryFileNames() {
2899
+ return this.inner.cssEntryFilenames || this.outputOptions.cssEntryFileNames;
2900
+ }
2901
+ get cssChunkFileNames() {
2902
+ return this.inner.cssChunkFilenames || this.outputOptions.cssChunkFileNames;
2903
+ }
2904
+ get shimMissingExports() {
2905
+ return this.inner.shimMissingExports;
2906
+ }
2907
+ get name() {
2908
+ return this.inner.name ?? void 0;
2909
+ }
2910
+ get file() {
2911
+ return this.inner.file ?? void 0;
2912
+ }
2913
+ get inlineDynamicImports() {
2914
+ return this.inner.inlineDynamicImports;
2915
+ }
2916
+ get externalLiveBindings() {
2917
+ return this.inner.externalLiveBindings;
2918
+ }
2919
+ get banner() {
2920
+ return normalizeAddon(this.outputOptions.banner);
2921
+ }
2922
+ get footer() {
2923
+ return normalizeAddon(this.outputOptions.footer);
2924
+ }
2925
+ get intro() {
2926
+ return normalizeAddon(this.outputOptions.intro);
2927
+ }
2928
+ get outro() {
2929
+ return normalizeAddon(this.outputOptions.outro);
2930
+ }
2931
+ get esModule() {
2932
+ return this.inner.esModule;
2933
+ }
2934
+ get extend() {
2935
+ return this.inner.extend;
2936
+ }
2937
+ get globals() {
2938
+ return this.inner.globals || this.outputOptions.globals;
2939
+ }
2940
+ get hashCharacters() {
2941
+ return this.inner.hashCharacters;
2942
+ }
2943
+ get sourcemapDebugIds() {
2944
+ return this.inner.sourcemapDebugIds;
2945
+ }
2946
+ get sourcemapIgnoreList() {
2947
+ return bindingifySourcemapIgnoreList(this.outputOptions.sourcemapIgnoreList);
2948
+ }
2949
+ get sourcemapPathTransform() {
2950
+ return this.outputOptions.sourcemapPathTransform;
2951
+ }
2952
+ get minify() {
2953
+ return this.inner.minify;
2954
+ }
2955
+ get comments() {
2956
+ return this.inner.comments;
2957
+ }
2958
+ get polyfillRequire() {
2959
+ return this.inner.polyfillRequire;
2960
+ }
2961
+ get plugins() {
2962
+ return this.normalizedOutputPlugins;
2963
+ }
2964
+ };
2965
+ } });
2966
+
2967
+ //#endregion
2968
+ //#region src/utils/transform-to-rollup-output.ts
2969
+ function transformToRollupSourceMap(map) {
2970
+ const parsed = JSON.parse(map);
2971
+ const obj = {
2972
+ ...parsed,
2973
+ toString() {
2974
+ return JSON.stringify(obj);
2975
+ },
2976
+ toUrl() {
2977
+ return `data:application/json;charset=utf-8;base64,${Buffer.from(obj.toString(), "utf-8").toString("base64")}`;
2978
+ }
2979
+ };
2980
+ return obj;
2981
+ }
2982
+ function transformToRollupOutputChunk(bindingChunk, changed) {
2983
+ const chunk = {
2984
+ type: "chunk",
2985
+ get code() {
2986
+ return bindingChunk.code;
2987
+ },
2988
+ fileName: bindingChunk.fileName,
2989
+ name: bindingChunk.name,
2990
+ get modules() {
2991
+ return transformChunkModules(bindingChunk.modules);
2992
+ },
2993
+ get imports() {
2994
+ return bindingChunk.imports;
2995
+ },
2996
+ get dynamicImports() {
2997
+ return bindingChunk.dynamicImports;
2998
+ },
2999
+ exports: bindingChunk.exports,
3000
+ isEntry: bindingChunk.isEntry,
3001
+ facadeModuleId: bindingChunk.facadeModuleId || null,
3002
+ isDynamicEntry: bindingChunk.isDynamicEntry,
3003
+ get moduleIds() {
3004
+ return bindingChunk.moduleIds;
3005
+ },
3006
+ get map() {
3007
+ return bindingChunk.map ? transformToRollupSourceMap(bindingChunk.map) : null;
3008
+ },
3009
+ sourcemapFileName: bindingChunk.sourcemapFileName || null,
3010
+ preliminaryFileName: bindingChunk.preliminaryFileName
3011
+ };
3012
+ const cache = {};
3013
+ return new Proxy(chunk, {
3014
+ get(target, p$3) {
3015
+ if (p$3 in cache) return cache[p$3];
3016
+ const value = target[p$3];
3017
+ cache[p$3] = value;
3018
+ return value;
3019
+ },
3020
+ set(target, p$3, newValue) {
3021
+ cache[p$3] = newValue;
3022
+ changed?.updated.add(bindingChunk.fileName);
3023
+ return true;
3024
+ },
3025
+ has(target, p$3) {
3026
+ if (p$3 in cache) return true;
3027
+ return p$3 in target;
3028
+ }
3029
+ });
3030
+ }
3031
+ function transformToRollupOutputAsset(bindingAsset, changed) {
3032
+ const asset = {
3033
+ type: "asset",
3034
+ fileName: bindingAsset.fileName,
3035
+ originalFileName: bindingAsset.originalFileName || null,
3036
+ originalFileNames: bindingAsset.originalFileNames,
3037
+ get source() {
3038
+ return transformAssetSource(bindingAsset.source);
3039
+ },
3040
+ name: bindingAsset.name ?? void 0,
3041
+ names: bindingAsset.names
3042
+ };
3043
+ const cache = {};
3044
+ return new Proxy(asset, {
3045
+ get(target, p$3) {
3046
+ if (p$3 in cache) return cache[p$3];
3047
+ const value = target[p$3];
3048
+ cache[p$3] = value;
3049
+ return value;
3050
+ },
3051
+ set(target, p$3, newValue) {
3052
+ cache[p$3] = newValue;
3053
+ changed?.updated.add(bindingAsset.fileName);
3054
+ return true;
3055
+ }
3056
+ });
3057
+ }
3058
+ function transformToRollupOutput(output, changed) {
3059
+ handleOutputErrors(output);
3060
+ const { chunks, assets } = output;
3061
+ return { output: [...chunks.map((chunk) => transformToRollupOutputChunk(chunk, changed)), ...assets.map((asset) => transformToRollupOutputAsset(asset, changed))] };
3062
+ }
3063
+ function handleOutputErrors(output) {
3064
+ const rawErrors = output.errors;
3065
+ if (rawErrors.length > 0) throw normalizeErrors(rawErrors);
3066
+ }
3067
+ function transformToOutputBundle(output, changed) {
3068
+ const bundle = Object.fromEntries(transformToRollupOutput(output, changed).output.map((item) => [item.fileName, item]));
3069
+ return new Proxy(bundle, { deleteProperty(target, property) {
3070
+ if (typeof property === "string") changed.deleted.add(property);
3071
+ return true;
3072
+ } });
3073
+ }
3074
+ function collectChangedBundle(changed, bundle) {
3075
+ const assets = [];
3076
+ const chunks = [];
3077
+ for (const key in bundle) {
3078
+ if (changed.deleted.has(key) || !changed.updated.has(key)) continue;
3079
+ const item = bundle[key];
3080
+ if (item.type === "asset") assets.push({
3081
+ filename: item.fileName,
3082
+ originalFileNames: item.originalFileNames,
3083
+ source: bindingAssetSource(item.source),
3084
+ names: item.names
3085
+ });
3086
+ else chunks.push({
3087
+ code: item.code,
3088
+ filename: item.fileName,
3089
+ name: item.name,
3090
+ isEntry: item.isEntry,
3091
+ exports: item.exports,
3092
+ modules: {},
3093
+ imports: item.imports,
3094
+ dynamicImports: item.dynamicImports,
3095
+ facadeModuleId: item.facadeModuleId || void 0,
3096
+ isDynamicEntry: item.isDynamicEntry,
3097
+ moduleIds: item.moduleIds,
3098
+ map: bindingifySourcemap(item.map),
3099
+ sourcemapFilename: item.sourcemapFileName || void 0,
3100
+ preliminaryFilename: item.preliminaryFileName
3101
+ });
3102
+ }
3103
+ return {
3104
+ assets,
3105
+ chunks,
3106
+ deleted: Array.from(changed.deleted)
3107
+ };
3108
+ }
3109
+ var init_transform_to_rollup_output = __esm({ "src/utils/transform-to-rollup-output.ts"() {
3110
+ init_sourcemap();
3111
+ init_asset_source();
3112
+ init_error();
3113
+ init_transform_rendered_chunk();
3114
+ } });
3115
+
3116
+ //#endregion
3117
+ //#region src/plugin/bindingify-output-hooks.ts
3118
+ function bindingifyRenderStart(args) {
3119
+ const hook = args.plugin.renderStart;
3120
+ if (!hook) return {};
3121
+ const { handler, meta } = normalizeHook(hook);
3122
+ return {
3123
+ plugin: async (ctx, opts) => {
3124
+ handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), new NormalizedOutputOptionsImpl(opts, args.outputOptions, args.normalizedOutputPlugins), new NormalizedInputOptionsImpl(opts, args.onLog));
3125
+ },
3126
+ meta: bindingifyPluginHookMeta(meta)
3127
+ };
3128
+ }
3129
+ function bindingifyRenderChunk(args) {
3130
+ const hook = args.plugin.renderChunk;
3131
+ if (!hook) return {};
3132
+ const { handler, meta, options } = normalizeHook(hook);
3133
+ return {
3134
+ plugin: async (ctx, code$1, chunk, opts, meta$1) => {
3135
+ if (args.pluginContextData.getRenderChunkMeta() == null) args.pluginContextData.setRenderChunkMeta({ chunks: Object.fromEntries(Object.entries(meta$1.chunks).map(([key, value]) => [key, transformRenderedChunk(value)])) });
3136
+ 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());
3137
+ if (ret == null) return;
3138
+ if (typeof ret === "string") return { code: ret };
3139
+ if (!ret.map) return { code: ret.code };
3140
+ return {
3141
+ code: ret.code,
3142
+ map: bindingifySourcemap(ret.map)
3143
+ };
3144
+ },
3145
+ meta: bindingifyPluginHookMeta(meta),
3146
+ filter: bindingifyRenderChunkFilter(options.filter)
3147
+ };
3148
+ }
3149
+ function bindingifyAugmentChunkHash(args) {
3150
+ const hook = args.plugin.augmentChunkHash;
3151
+ if (!hook) return {};
3152
+ const { handler, meta } = normalizeHook(hook);
3153
+ return {
3154
+ plugin: async (ctx, chunk) => {
3155
+ return await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
3156
+ },
3157
+ meta: bindingifyPluginHookMeta(meta)
3158
+ };
3159
+ }
3160
+ function bindingifyRenderError(args) {
3161
+ const hook = args.plugin.renderError;
3162
+ if (!hook) return {};
3163
+ const { handler, meta } = normalizeHook(hook);
3164
+ return {
3165
+ plugin: async (ctx, err) => {
3166
+ handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), normalizeErrors(err));
3167
+ },
3168
+ meta: bindingifyPluginHookMeta(meta)
3169
+ };
3170
+ }
3171
+ function bindingifyGenerateBundle(args) {
3172
+ const hook = args.plugin.generateBundle;
3173
+ if (!hook) return {};
3174
+ const { handler, meta } = normalizeHook(hook);
3175
+ return {
3176
+ plugin: async (ctx, bundle, isWrite, opts) => {
3177
+ const changed = {
3178
+ updated: new Set(),
3179
+ deleted: new Set()
3180
+ };
3181
+ const output = transformToOutputBundle(bundle, changed);
3182
+ await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), new NormalizedOutputOptionsImpl(opts, args.outputOptions, args.normalizedOutputPlugins), output, isWrite);
3183
+ return collectChangedBundle(changed, output);
3184
+ },
3185
+ meta: bindingifyPluginHookMeta(meta)
3186
+ };
3187
+ }
3188
+ function bindingifyWriteBundle(args) {
3189
+ const hook = args.plugin.writeBundle;
3190
+ if (!hook) return {};
3191
+ const { handler, meta } = normalizeHook(hook);
3192
+ return {
3193
+ plugin: async (ctx, bundle, opts) => {
3194
+ const changed = {
3195
+ updated: new Set(),
3196
+ deleted: new Set()
3197
+ };
3198
+ const output = transformToOutputBundle(bundle, changed);
3199
+ await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), new NormalizedOutputOptionsImpl(opts, args.outputOptions, args.normalizedOutputPlugins), output);
3200
+ return collectChangedBundle(changed, output);
3201
+ },
3202
+ meta: bindingifyPluginHookMeta(meta)
3203
+ };
3204
+ }
3205
+ function bindingifyCloseBundle(args) {
3206
+ const hook = args.plugin.closeBundle;
3207
+ if (!hook) return {};
3208
+ const { handler, meta } = normalizeHook(hook);
3209
+ return {
3210
+ plugin: async (ctx) => {
3211
+ await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode));
3212
+ },
3213
+ meta: bindingifyPluginHookMeta(meta)
3214
+ };
3215
+ }
3216
+ function bindingifyBanner(args) {
3217
+ const hook = args.plugin.banner;
3218
+ if (!hook) return {};
3219
+ const { handler, meta } = normalizeHook(hook);
3220
+ return {
3221
+ plugin: async (ctx, chunk) => {
3222
+ if (typeof handler === "string") return handler;
3223
+ return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
3224
+ },
3225
+ meta: bindingifyPluginHookMeta(meta)
3226
+ };
3227
+ }
3228
+ function bindingifyFooter(args) {
3229
+ const hook = args.plugin.footer;
3230
+ if (!hook) return {};
3231
+ const { handler, meta } = normalizeHook(hook);
3232
+ return {
3233
+ plugin: async (ctx, chunk) => {
3234
+ if (typeof handler === "string") return handler;
3235
+ return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
3236
+ },
3237
+ meta: bindingifyPluginHookMeta(meta)
3238
+ };
3239
+ }
3240
+ function bindingifyIntro(args) {
3241
+ const hook = args.plugin.intro;
3242
+ if (!hook) return {};
3243
+ const { handler, meta } = normalizeHook(hook);
3244
+ return {
3245
+ plugin: async (ctx, chunk) => {
3246
+ if (typeof handler === "string") return handler;
3247
+ return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
3248
+ },
3249
+ meta: bindingifyPluginHookMeta(meta)
3250
+ };
3251
+ }
3252
+ function bindingifyOutro(args) {
3253
+ const hook = args.plugin.outro;
3254
+ if (!hook) return {};
3255
+ const { handler, meta } = normalizeHook(hook);
3256
+ return {
3257
+ plugin: async (ctx, chunk) => {
3258
+ if (typeof handler === "string") return handler;
3259
+ return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
3260
+ },
3261
+ meta: bindingifyPluginHookMeta(meta)
3262
+ };
3263
+ }
3264
+ var init_bindingify_output_hooks = __esm({ "src/plugin/bindingify-output-hooks.ts"() {
3265
+ init_normalized_input_options();
3266
+ init_normalized_output_options();
3267
+ init_sourcemap();
3268
+ init_error();
3269
+ init_normalize_hook();
3270
+ init_transform_rendered_chunk();
3271
+ init_transform_to_rollup_output();
3272
+ init_bindingify_hook_filter();
3273
+ init_bindingify_plugin_hook_meta();
3274
+ init_plugin_context();
3275
+ } });
3276
+
3277
+ //#endregion
3278
+ //#region src/plugin/bindingify-watch-hooks.ts
3279
+ function bindingifyWatchChange(args) {
3280
+ const hook = args.plugin.watchChange;
3281
+ if (!hook) return {};
3282
+ const { handler, meta } = normalizeHook(hook);
3283
+ return {
3284
+ plugin: async (ctx, id$1, event) => {
3285
+ await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), id$1, { event });
3286
+ },
3287
+ meta: bindingifyPluginHookMeta(meta)
3288
+ };
3289
+ }
3290
+ function bindingifyCloseWatcher(args) {
3291
+ const hook = args.plugin.closeWatcher;
3292
+ if (!hook) return {};
3293
+ const { handler, meta } = normalizeHook(hook);
3294
+ return {
3295
+ plugin: async (ctx) => {
3296
+ await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode));
3297
+ },
3298
+ meta: bindingifyPluginHookMeta(meta)
3299
+ };
3300
+ }
3301
+ var init_bindingify_watch_hooks = __esm({ "src/plugin/bindingify-watch-hooks.ts"() {
3302
+ init_normalize_hook();
3303
+ init_bindingify_plugin_hook_meta();
3304
+ init_plugin_context();
3305
+ } });
3306
+
3307
+ //#endregion
3308
+ //#region src/plugin/generated/hook-usage.ts
3309
+ function extractHookUsage(plugin) {
3310
+ let hookUsage = new HookUsage();
3311
+ if (plugin.buildStart) hookUsage.union(HookUsageKind.buildStart);
3312
+ if (plugin.resolveId) hookUsage.union(HookUsageKind.resolveId);
3313
+ if (plugin.resolveDynamicImport) hookUsage.union(HookUsageKind.resolveDynamicImport);
3314
+ if (plugin.load) hookUsage.union(HookUsageKind.load);
3315
+ if (plugin.transform) hookUsage.union(HookUsageKind.transform);
3316
+ if (plugin.moduleParsed) hookUsage.union(HookUsageKind.moduleParsed);
3317
+ if (plugin.buildEnd) hookUsage.union(HookUsageKind.buildEnd);
3318
+ if (plugin.renderStart) hookUsage.union(HookUsageKind.renderStart);
3319
+ if (plugin.renderError) hookUsage.union(HookUsageKind.renderError);
3320
+ if (plugin.renderChunk) hookUsage.union(HookUsageKind.renderChunk);
3321
+ if (plugin.augmentChunkHash) hookUsage.union(HookUsageKind.augmentChunkHash);
3322
+ if (plugin.generateBundle) hookUsage.union(HookUsageKind.generateBundle);
3323
+ if (plugin.writeBundle) hookUsage.union(HookUsageKind.writeBundle);
3324
+ if (plugin.closeBundle) hookUsage.union(HookUsageKind.closeBundle);
3325
+ if (plugin.watchChange) hookUsage.union(HookUsageKind.watchChange);
3326
+ if (plugin.closeWatcher) hookUsage.union(HookUsageKind.closeWatcher);
3327
+ if (plugin.banner) hookUsage.union(HookUsageKind.banner);
3328
+ if (plugin.footer) hookUsage.union(HookUsageKind.footer);
3329
+ if (plugin.intro) hookUsage.union(HookUsageKind.intro);
3330
+ if (plugin.outro) hookUsage.union(HookUsageKind.outro);
3331
+ return hookUsage;
3332
+ }
3333
+ var HookUsageKind, HookUsage;
3334
+ var init_hook_usage = __esm({ "src/plugin/generated/hook-usage.ts"() {
3335
+ HookUsageKind = /* @__PURE__ */ function(HookUsageKind$1) {
3336
+ HookUsageKind$1[HookUsageKind$1["buildStart"] = 1] = "buildStart";
3337
+ HookUsageKind$1[HookUsageKind$1["resolveId"] = 2] = "resolveId";
3338
+ HookUsageKind$1[HookUsageKind$1["resolveDynamicImport"] = 4] = "resolveDynamicImport";
3339
+ HookUsageKind$1[HookUsageKind$1["load"] = 8] = "load";
3340
+ HookUsageKind$1[HookUsageKind$1["transform"] = 16] = "transform";
3341
+ HookUsageKind$1[HookUsageKind$1["moduleParsed"] = 32] = "moduleParsed";
3342
+ HookUsageKind$1[HookUsageKind$1["buildEnd"] = 64] = "buildEnd";
3343
+ HookUsageKind$1[HookUsageKind$1["renderStart"] = 128] = "renderStart";
3344
+ HookUsageKind$1[HookUsageKind$1["renderError"] = 256] = "renderError";
3345
+ HookUsageKind$1[HookUsageKind$1["renderChunk"] = 512] = "renderChunk";
3346
+ HookUsageKind$1[HookUsageKind$1["augmentChunkHash"] = 1024] = "augmentChunkHash";
3347
+ HookUsageKind$1[HookUsageKind$1["generateBundle"] = 2048] = "generateBundle";
3348
+ HookUsageKind$1[HookUsageKind$1["writeBundle"] = 4096] = "writeBundle";
3349
+ HookUsageKind$1[HookUsageKind$1["closeBundle"] = 8192] = "closeBundle";
3350
+ HookUsageKind$1[HookUsageKind$1["watchChange"] = 16384] = "watchChange";
3351
+ HookUsageKind$1[HookUsageKind$1["closeWatcher"] = 32768] = "closeWatcher";
3352
+ HookUsageKind$1[HookUsageKind$1["transformAst"] = 65536] = "transformAst";
3353
+ HookUsageKind$1[HookUsageKind$1["banner"] = 131072] = "banner";
3354
+ HookUsageKind$1[HookUsageKind$1["footer"] = 262144] = "footer";
3355
+ HookUsageKind$1[HookUsageKind$1["intro"] = 524288] = "intro";
3356
+ HookUsageKind$1[HookUsageKind$1["outro"] = 1048576] = "outro";
3357
+ return HookUsageKind$1;
3358
+ }({});
3359
+ HookUsage = class {
3360
+ bitflag = BigInt(0);
3361
+ constructor() {}
3362
+ union(kind) {
3363
+ this.bitflag |= BigInt(kind);
3364
+ }
3365
+ inner() {
3366
+ return Number(this.bitflag);
3367
+ }
3368
+ };
3369
+ } });
3370
+
3371
+ //#endregion
3372
+ //#region src/plugin/bindingify-plugin.ts
3373
+ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode) {
3374
+ const args = {
3375
+ plugin,
3376
+ options,
3377
+ outputOptions,
3378
+ pluginContextData,
3379
+ onLog,
3380
+ logLevel,
3381
+ watchMode,
3382
+ normalizedOutputPlugins
3383
+ };
3384
+ const { plugin: buildStart, meta: buildStartMeta } = bindingifyBuildStart(args);
3385
+ const { plugin: resolveId, meta: resolveIdMeta, filter: resolveIdFilter } = bindingifyResolveId(args);
3386
+ const { plugin: resolveDynamicImport, meta: resolveDynamicImportMeta } = bindingifyResolveDynamicImport(args);
3387
+ const { plugin: buildEnd, meta: buildEndMeta } = bindingifyBuildEnd(args);
3388
+ const { plugin: transform, meta: transformMeta, filter: transformFilter } = bindingifyTransform(args);
3389
+ const { plugin: moduleParsed, meta: moduleParsedMeta } = bindingifyModuleParsed(args);
3390
+ const { plugin: load, meta: loadMeta, filter: loadFilter } = bindingifyLoad(args);
3391
+ const { plugin: renderChunk, meta: renderChunkMeta, filter: renderChunkFilter } = bindingifyRenderChunk(args);
3392
+ const { plugin: augmentChunkHash, meta: augmentChunkHashMeta } = bindingifyAugmentChunkHash(args);
3393
+ const { plugin: renderStart, meta: renderStartMeta } = bindingifyRenderStart(args);
3394
+ const { plugin: renderError, meta: renderErrorMeta } = bindingifyRenderError(args);
3395
+ const { plugin: generateBundle, meta: generateBundleMeta } = bindingifyGenerateBundle(args);
3396
+ const { plugin: writeBundle, meta: writeBundleMeta } = bindingifyWriteBundle(args);
3397
+ const { plugin: closeBundle, meta: closeBundleMeta } = bindingifyCloseBundle(args);
3398
+ const { plugin: banner, meta: bannerMeta } = bindingifyBanner(args);
3399
+ const { plugin: footer, meta: footerMeta } = bindingifyFooter(args);
3400
+ const { plugin: intro, meta: introMeta } = bindingifyIntro(args);
3401
+ const { plugin: outro, meta: outroMeta } = bindingifyOutro(args);
3402
+ const { plugin: watchChange, meta: watchChangeMeta } = bindingifyWatchChange(args);
3403
+ const { plugin: closeWatcher, meta: closeWatcherMeta } = bindingifyCloseWatcher(args);
3404
+ let hookUsage = extractHookUsage(plugin).inner();
3405
+ const result = {
3406
+ name: plugin.name,
3407
+ buildStart,
3408
+ buildStartMeta,
3409
+ resolveId,
3410
+ resolveIdMeta,
3411
+ resolveIdFilter,
3412
+ resolveDynamicImport,
3413
+ resolveDynamicImportMeta,
3414
+ buildEnd,
3415
+ buildEndMeta,
3416
+ transform,
3417
+ transformMeta,
3418
+ transformFilter,
3419
+ moduleParsed,
3420
+ moduleParsedMeta,
3421
+ load,
3422
+ loadMeta,
3423
+ loadFilter,
3424
+ renderChunk,
3425
+ renderChunkMeta,
3426
+ renderChunkFilter,
3427
+ augmentChunkHash,
3428
+ augmentChunkHashMeta,
3429
+ renderStart,
3430
+ renderStartMeta,
3431
+ renderError,
3432
+ renderErrorMeta,
3433
+ generateBundle,
3434
+ generateBundleMeta,
3435
+ writeBundle,
3436
+ writeBundleMeta,
3437
+ closeBundle,
3438
+ closeBundleMeta,
3439
+ banner,
3440
+ bannerMeta,
3441
+ footer,
3442
+ footerMeta,
3443
+ intro,
3444
+ introMeta,
3445
+ outro,
3446
+ outroMeta,
3447
+ watchChange,
3448
+ watchChangeMeta,
3449
+ closeWatcher,
3450
+ closeWatcherMeta,
3451
+ hookUsage
3452
+ };
3453
+ return wrapHandlers(result);
3454
+ }
3455
+ function wrapHandlers(plugin) {
3456
+ for (const hookName of [
3457
+ "buildStart",
3458
+ "resolveId",
3459
+ "resolveDynamicImport",
3460
+ "buildEnd",
3461
+ "transform",
3462
+ "moduleParsed",
3463
+ "load",
3464
+ "renderChunk",
3465
+ "augmentChunkHash",
3466
+ "renderStart",
3467
+ "renderError",
3468
+ "generateBundle",
3469
+ "writeBundle",
3470
+ "closeBundle",
3471
+ "banner",
3472
+ "footer",
3473
+ "intro",
3474
+ "outro",
3475
+ "watchChange",
3476
+ "closeWatcher"
3477
+ ]) {
3478
+ const handler = plugin[hookName];
3479
+ if (handler) plugin[hookName] = async (...args) => {
3480
+ try {
3481
+ return await handler(...args);
3482
+ } catch (e$5) {
3483
+ return error(logPluginError(e$5, plugin.name, {
3484
+ hook: hookName,
3485
+ id: hookName === "transform" ? args[2] : void 0
3486
+ }));
3487
+ }
3488
+ };
3489
+ }
3490
+ return plugin;
3491
+ }
3492
+ var init_bindingify_plugin = __esm({ "src/plugin/bindingify-plugin.ts"() {
3493
+ init_bindingify_build_hooks();
3494
+ init_bindingify_output_hooks();
3495
+ init_logs();
3496
+ init_bindingify_watch_hooks();
3497
+ init_hook_usage();
3498
+ } });
3499
+
3500
+ //#endregion
3501
+ //#region src/plugin/plugin-context-data.ts
3502
+ var PluginContextData;
3503
+ var init_plugin_context_data = __esm({ "src/plugin/plugin-context-data.ts"() {
3504
+ init_transform_module_info();
3505
+ PluginContextData = class {
3506
+ moduleOptionMap = new Map();
3507
+ resolveOptionsMap = new Map();
3508
+ loadModulePromiseMap = new Map();
3509
+ loadModulePromiseResolveFnMap = new Map();
3510
+ renderedChunkMeta = null;
3511
+ updateModuleOption(id$1, option) {
3512
+ const existing = this.moduleOptionMap.get(id$1);
3513
+ if (existing) {
3514
+ if (option.moduleSideEffects != null) existing.moduleSideEffects = option.moduleSideEffects;
3515
+ if (option.meta != null) Object.assign(existing.meta, option.meta);
3516
+ if (option.invalidate != null) existing.invalidate = option.invalidate;
3517
+ } else {
3518
+ this.moduleOptionMap.set(id$1, option);
3519
+ return option;
3520
+ }
3521
+ return existing;
3522
+ }
3523
+ getModuleOption(id$1) {
3524
+ const option = this.moduleOptionMap.get(id$1);
3525
+ if (!option) {
3526
+ const raw = {
3527
+ moduleSideEffects: null,
3528
+ meta: {}
3529
+ };
3530
+ this.moduleOptionMap.set(id$1, raw);
3531
+ return raw;
3532
+ }
3533
+ return option;
3534
+ }
3535
+ getModuleInfo(id$1, context) {
3536
+ const bindingInfo = context.getModuleInfo(id$1);
3537
+ if (bindingInfo) {
3538
+ const info = transformModuleInfo(bindingInfo, this.getModuleOption(id$1));
3539
+ return this.proxyModuleInfo(id$1, info);
3540
+ }
3541
+ return null;
3542
+ }
3543
+ proxyModuleInfo(id$1, info) {
3544
+ let moduleSideEffects = info.moduleSideEffects;
3545
+ Object.defineProperty(info, "moduleSideEffects", {
3546
+ get() {
3547
+ return moduleSideEffects;
3548
+ },
3549
+ set: (v$1) => {
3550
+ this.updateModuleOption(id$1, {
3551
+ moduleSideEffects: v$1,
3552
+ meta: info.meta,
3553
+ invalidate: true
3554
+ });
3555
+ moduleSideEffects = v$1;
3556
+ }
3557
+ });
3558
+ return info;
3559
+ }
3560
+ getModuleIds(context) {
3561
+ const moduleIds = context.getModuleIds();
3562
+ return moduleIds.values();
3563
+ }
3564
+ saveResolveOptions(options) {
3565
+ const index = this.resolveOptionsMap.size;
3566
+ this.resolveOptionsMap.set(index, options);
3567
+ return index;
3568
+ }
3569
+ getSavedResolveOptions(receipt) {
3570
+ return this.resolveOptionsMap.get(receipt);
3571
+ }
3572
+ removeSavedResolveOptions(receipt) {
3573
+ this.resolveOptionsMap.delete(receipt);
3574
+ }
3575
+ setRenderChunkMeta(meta) {
3576
+ this.renderedChunkMeta = meta;
3577
+ }
3578
+ getRenderChunkMeta() {
3579
+ return this.renderedChunkMeta;
3580
+ }
3581
+ markModuleLoaded(id$1, _success) {
3582
+ const resolve = this.loadModulePromiseResolveFnMap.get(id$1);
3583
+ if (resolve) resolve();
3584
+ }
3585
+ clear() {
3586
+ this.renderedChunkMeta = null;
3587
+ this.loadModulePromiseMap.clear();
3588
+ this.loadModulePromiseResolveFnMap.clear();
3589
+ }
3590
+ };
3591
+ } });
3592
+
3593
+ //#endregion
3594
+ //#region src/utils/normalize-string-or-regex.ts
3595
+ function normalizedStringOrRegex(pattern) {
3596
+ if (!pattern) return void 0;
3597
+ if (!isReadonlyArray(pattern)) return [pattern];
3598
+ return pattern;
3599
+ }
3600
+ function isReadonlyArray(input) {
3601
+ return Array.isArray(input);
3602
+ }
3603
+ var init_normalize_string_or_regex = __esm({ "src/utils/normalize-string-or-regex.ts"() {} });
3604
+
3605
+ //#endregion
3606
+ //#region src/utils/bindingify-input-options.ts
3607
+ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel, watchMode) {
3608
+ const pluginContextData = new PluginContextData();
3609
+ const plugins = rawPlugins.map((plugin) => {
3610
+ if ("_parallel" in plugin) return void 0;
3611
+ if (plugin instanceof BuiltinPlugin) return bindingifyBuiltInPlugin(plugin);
3612
+ return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode);
3613
+ });
3614
+ return {
3615
+ input: bindingifyInput(inputOptions.input),
3616
+ plugins,
3617
+ cwd: inputOptions.cwd ?? process.cwd(),
3618
+ external: bindingifyExternal(inputOptions.external),
3619
+ resolve: bindingifyResolve(inputOptions.resolve),
3620
+ platform: inputOptions.platform,
3621
+ shimMissingExports: inputOptions.shimMissingExports,
3622
+ logLevel: bindingifyLogLevel(logLevel),
3623
+ onLog,
3624
+ treeshake: bindingifyTreeshakeOptions(inputOptions.treeshake),
3625
+ moduleTypes: inputOptions.moduleTypes,
3626
+ define: inputOptions.define ? Object.entries(inputOptions.define) : void 0,
3627
+ inject: bindingifyInject(inputOptions.inject),
3628
+ experimental: {
3629
+ strictExecutionOrder: inputOptions.experimental?.strictExecutionOrder,
3630
+ disableLiveBindings: inputOptions.experimental?.disableLiveBindings,
3631
+ viteMode: inputOptions.experimental?.viteMode,
3632
+ resolveNewUrlToAsset: inputOptions.experimental?.resolveNewUrlToAsset,
3633
+ hmr: bindingifyHmr(inputOptions.experimental?.hmr)
3634
+ },
3635
+ profilerNames: inputOptions?.profilerNames,
3636
+ jsx: bindingifyJsx(inputOptions.jsx),
3637
+ transform: inputOptions.transform,
3638
+ watch: bindingifyWatch(inputOptions.watch),
3639
+ dropLabels: inputOptions.dropLabels,
3640
+ keepNames: inputOptions.keepNames,
3641
+ checks: inputOptions.checks,
3642
+ deferSyncScanData: () => {
3643
+ let ret = [];
3644
+ pluginContextData.moduleOptionMap.forEach((value, key) => {
3645
+ if (value.invalidate) ret.push({
3646
+ id: key,
3647
+ sideEffects: bindingifySideEffects(value.moduleSideEffects)
3648
+ });
3649
+ });
3650
+ return ret;
3651
+ },
3652
+ makeAbsoluteExternalsRelative: bindingifyMakeAbsoluteExternalsRelative(inputOptions.makeAbsoluteExternalsRelative),
3653
+ debug: inputOptions.debug,
3654
+ invalidateJsSideCache: pluginContextData.clear.bind(pluginContextData),
3655
+ markModuleLoaded: pluginContextData.markModuleLoaded.bind(pluginContextData)
3656
+ };
3657
+ }
3658
+ function bindingifyHmr(hmr) {
3659
+ if (hmr) {
3660
+ if (typeof hmr === "boolean") return hmr ? {} : void 0;
3661
+ return hmr;
3662
+ }
3663
+ }
3664
+ function bindingifyExternal(external) {
3665
+ if (external) {
3666
+ if (typeof external === "function") return (id$1, importer, isResolved) => {
3667
+ if (id$1.startsWith("\0")) return false;
3668
+ return external(id$1, importer, isResolved) ?? false;
3669
+ };
3670
+ const externalArr = arraify(external);
3671
+ return (id$1, _importer, _isResolved) => {
3672
+ return externalArr.some((pat) => {
3673
+ if (pat instanceof RegExp) return pat.test(id$1);
3674
+ return id$1 === pat;
3675
+ });
3676
+ };
3677
+ }
3678
+ }
3679
+ function bindingifyResolve(resolve) {
3680
+ if (resolve) {
3681
+ const { alias, extensionAlias,...rest } = resolve;
3682
+ return {
3683
+ alias: alias ? Object.entries(alias).map(([name, replacement]) => ({
3684
+ find: name,
3685
+ replacements: arraify(replacement)
3686
+ })) : void 0,
3687
+ extensionAlias: extensionAlias ? Object.entries(extensionAlias).map(([name, value]) => ({
3688
+ target: name,
3689
+ replacements: value
3690
+ })) : void 0,
3691
+ ...rest
3692
+ };
3693
+ }
3694
+ }
3695
+ function bindingifyInject(inject) {
3696
+ if (inject) return Object.entries(inject).map(([alias, item]) => {
3697
+ if (Array.isArray(item)) {
3698
+ if (item[1] === "*") return {
3699
+ tagNamespace: true,
3700
+ alias,
3701
+ from: item[0]
3702
+ };
3703
+ return {
3704
+ tagNamed: true,
3705
+ alias,
3706
+ from: item[0],
3707
+ imported: item[1]
3708
+ };
3709
+ } else return {
3710
+ tagNamed: true,
3711
+ imported: "default",
3712
+ alias,
3713
+ from: item
3714
+ };
3715
+ });
3716
+ }
3717
+ function bindingifyLogLevel(logLevel) {
3718
+ switch (logLevel) {
3719
+ case "silent": return import_binding.BindingLogLevel.Silent;
3720
+ case "debug": return import_binding.BindingLogLevel.Debug;
3721
+ case "warn": return import_binding.BindingLogLevel.Warn;
3722
+ case "info": return import_binding.BindingLogLevel.Info;
3723
+ default: throw new Error(`Unexpected log level: ${logLevel}`);
3724
+ }
3725
+ }
3726
+ function bindingifyInput(input) {
3727
+ if (input === void 0) return [];
3728
+ if (typeof input === "string") return [{ import: input }];
3729
+ if (Array.isArray(input)) return input.map((src) => ({ import: src }));
3730
+ return Object.entries(input).map(([name, import_path]) => {
3731
+ return {
3732
+ name,
3733
+ import: import_path
3734
+ };
3735
+ });
3736
+ }
3737
+ function bindingifyJsx(input) {
3738
+ switch (input) {
3739
+ case false: return { type: "Disable" };
3740
+ case "react": return { type: "React" };
3741
+ case "react-jsx": return { type: "ReactJsx" };
3742
+ case "preserve": return { type: "Preserve" };
3743
+ case void 0: return void 0;
3744
+ }
3745
+ if (input.mode === "preserve") return { type: "Preserve" };
3746
+ const mode = input.mode ?? "automatic";
3747
+ return {
3748
+ type: "Enable",
3749
+ field0: {
3750
+ runtime: mode,
3751
+ importSource: mode === "classic" ? input.importSource : mode === "automatic" ? input.jsxImportSource : void 0,
3752
+ pragma: input.factory,
3753
+ pragmaFrag: input.fragment,
3754
+ development: input.development,
3755
+ refresh: input.refresh
3756
+ }
3757
+ };
3758
+ }
3759
+ function bindingifyWatch(watch$1) {
3760
+ if (watch$1) return {
3761
+ buildDelay: watch$1.buildDelay,
3762
+ skipWrite: watch$1.skipWrite,
3763
+ include: normalizedStringOrRegex(watch$1.include),
3764
+ exclude: normalizedStringOrRegex(watch$1.exclude)
3765
+ };
3766
+ }
3767
+ function bindingifyTreeshakeOptions(config) {
3768
+ if (config === false) return void 0;
3769
+ if (config === true || config === void 0) return { moduleSideEffects: true };
3770
+ let normalizedConfig = {
3771
+ moduleSideEffects: true,
3772
+ annotations: config.annotations,
3773
+ manualPureFunctions: config.manualPureFunctions,
3774
+ unknownGlobalSideEffects: config.unknownGlobalSideEffects
3775
+ };
3776
+ if (config.moduleSideEffects === void 0) normalizedConfig.moduleSideEffects = true;
3777
+ else if (config.moduleSideEffects === "no-external") normalizedConfig.moduleSideEffects = [{
3778
+ external: true,
3779
+ sideEffects: false
3780
+ }, {
3781
+ external: false,
3782
+ sideEffects: true
3783
+ }];
3784
+ else normalizedConfig.moduleSideEffects = config.moduleSideEffects;
3785
+ return normalizedConfig;
3786
+ }
3787
+ function bindingifyMakeAbsoluteExternalsRelative(makeAbsoluteExternalsRelative) {
3788
+ if (makeAbsoluteExternalsRelative === "ifRelativeSource") return { type: "IfRelativeSource" };
3789
+ if (typeof makeAbsoluteExternalsRelative === "boolean") return {
3790
+ type: "Bool",
3791
+ field0: makeAbsoluteExternalsRelative
3792
+ };
3793
+ }
3794
+ var init_bindingify_input_options = __esm({ "src/utils/bindingify-input-options.ts"() {
3795
+ init_constructors();
3796
+ init_utils();
3797
+ init_bindingify_plugin();
3798
+ init_plugin_context_data();
3799
+ init_misc();
3800
+ init_normalize_string_or_regex();
3801
+ init_transform_side_effects();
3802
+ } });
3803
+
3688
3804
  //#endregion
3689
3805
  //#region src/utils/plugin/index.ts
3690
3806
  var isPluginHookName;
@@ -3835,10 +3951,10 @@ function createComposedPlugin(plugins) {
3835
3951
  case "load": {
3836
3952
  if (batchedHooks.load) {
3837
3953
  const batchedHandlers = batchedHooks.load;
3838
- composed.load = async function(id) {
3954
+ composed.load = async function(id$1) {
3839
3955
  for (const [handler, plugin] of batchedHandlers) {
3840
3956
  const { handler: handlerFn } = normalizeHook(handler);
3841
- const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), id);
3957
+ const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), id$1);
3842
3958
  if (!isNullish(result)) return result;
3843
3959
  }
3844
3960
  };
@@ -3848,11 +3964,11 @@ function createComposedPlugin(plugins) {
3848
3964
  case "transform": {
3849
3965
  if (batchedHooks.transform) {
3850
3966
  const batchedHandlers = batchedHooks.transform;
3851
- composed.transform = async function(initialCode, id, moduleType) {
3852
- let code = initialCode;
3967
+ composed.transform = async function(initialCode, id$1, moduleType$1) {
3968
+ let code$1 = initialCode;
3853
3969
  let moduleSideEffects = void 0;
3854
3970
  function updateOutput(newCode, newModuleSideEffects) {
3855
- code = newCode;
3971
+ code$1 = newCode;
3856
3972
  moduleSideEffects = newModuleSideEffects ?? void 0;
3857
3973
  }
3858
3974
  for (const [handler, plugin] of batchedHandlers) {
@@ -3860,14 +3976,14 @@ function createComposedPlugin(plugins) {
3860
3976
  this.getCombinedSourcemap = () => {
3861
3977
  throw new Error(`The getCombinedSourcemap is not implement in transform hook at composedJsPlugins`);
3862
3978
  };
3863
- const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), code, id, moduleType);
3979
+ const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), code$1, id$1, moduleType$1);
3864
3980
  if (!isNullish(result)) {
3865
3981
  if (typeof result === "string") updateOutput(result);
3866
3982
  else if (result.code) updateOutput(result.code, result.moduleSideEffects);
3867
3983
  }
3868
3984
  }
3869
3985
  return {
3870
- code,
3986
+ code: code$1,
3871
3987
  moduleSideEffects
3872
3988
  };
3873
3989
  };
@@ -3889,10 +4005,10 @@ function createComposedPlugin(plugins) {
3889
4005
  case "renderChunk": {
3890
4006
  if (batchedHooks.renderChunk) {
3891
4007
  const batchedHandlers = batchedHooks.renderChunk;
3892
- composed.renderChunk = async function(code, chunk, options, meta) {
4008
+ composed.renderChunk = async function(code$1, chunk, options, meta) {
3893
4009
  for (const [handler, plugin] of batchedHandlers) {
3894
4010
  const { handler: handlerFn } = normalizeHook(handler);
3895
- const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), code, chunk, options, meta);
4011
+ const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), code$1, chunk, options, meta);
3896
4012
  if (!isNullish(result)) return result;
3897
4013
  }
3898
4014
  };
@@ -3929,10 +4045,10 @@ function createComposedPlugin(plugins) {
3929
4045
  case "watchChange": {
3930
4046
  if (batchedHooks.watchChange) {
3931
4047
  const batchedHandlers = batchedHooks.watchChange;
3932
- composed.watchChange = async function(id, event) {
4048
+ composed.watchChange = async function(id$1, event) {
3933
4049
  await Promise.all(batchedHandlers.map(([handler, plugin]) => {
3934
4050
  const { handler: handlerFn } = normalizeHook(handler);
3935
- return handlerFn.call(applyFixedPluginResolveFn(this, plugin), id, event);
4051
+ return handlerFn.call(applyFixedPluginResolveFn(this, plugin), id$1, event);
3936
4052
  }));
3937
4053
  };
3938
4054
  }
@@ -4041,7 +4157,7 @@ async function initializeParallelPlugins(plugins) {
4041
4157
  };
4042
4158
  }
4043
4159
  function initializeWorkers(registryId, count, pluginInfos) {
4044
- return Promise.all(Array.from({ length: count }, (_, i$21) => initializeWorker(registryId, pluginInfos, i$21)));
4160
+ return Promise.all(Array.from({ length: count }, (_, i$22) => initializeWorker(registryId, pluginInfos, i$22)));
4045
4161
  }
4046
4162
  async function initializeWorker(registryId, pluginInfos, threadNumber) {
4047
4163
  const urlString = import.meta.resolve("#parallel-plugin-worker");
@@ -4248,8 +4364,8 @@ var init_watch_emitter = __esm({ "src/api/watch/watch-emitter.ts"() {
4248
4364
  break;
4249
4365
  case "event":
4250
4366
  for (const listener of listeners) {
4251
- const code = event.bundleEventKind();
4252
- switch (code) {
4367
+ const code$1 = event.bundleEventKind();
4368
+ switch (code$1) {
4253
4369
  case "BUNDLE_END":
4254
4370
  const { duration, output } = event.bundleEndData();
4255
4371
  await listener({
@@ -4266,7 +4382,7 @@ var init_watch_emitter = __esm({ "src/api/watch/watch-emitter.ts"() {
4266
4382
  });
4267
4383
  break;
4268
4384
  default:
4269
- await listener({ code });
4385
+ await listener({ code: code$1 });
4270
4386
  break;
4271
4387
  }
4272
4388
  }
@@ -4390,10 +4506,10 @@ function withFilter(pluginOption, filterObject) {
4390
4506
  }
4391
4507
  function findMatchedFilterObject(pluginName, overrideFilterObjectList) {
4392
4508
  if (overrideFilterObjectList.length === 1 && overrideFilterObjectList[0].pluginNamePattern === void 0) return 0;
4393
- for (let i$21 = 0; i$21 < overrideFilterObjectList.length; i$21++) for (let j$1 = 0; j$1 < (overrideFilterObjectList[i$21].pluginNamePattern ?? []).length; j$1++) {
4394
- let pattern = overrideFilterObjectList[i$21].pluginNamePattern[j$1];
4395
- if (typeof pattern === "string" && pattern === pluginName) return i$21;
4396
- else if (pattern instanceof RegExp && pattern.test(pluginName)) return i$21;
4509
+ for (let i$22 = 0; i$22 < overrideFilterObjectList.length; i$22++) for (let j$1 = 0; j$1 < (overrideFilterObjectList[i$22].pluginNamePattern ?? []).length; j$1++) {
4510
+ let pattern = overrideFilterObjectList[i$22].pluginNamePattern[j$1];
4511
+ if (typeof pattern === "string" && pattern === pluginName) return i$22;
4512
+ else if (pattern instanceof RegExp && pattern.test(pluginName)) return i$22;
4397
4513
  }
4398
4514
  return -1;
4399
4515
  }