@rolldown/browser 1.0.0-beta.8-commit.a98d94e → 1.0.0-beta.8-commit.852c603

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