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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/browser.mjs +343 -188
  2. package/dist/cli.cjs +8 -7
  3. package/dist/cli.mjs +4 -3
  4. package/dist/experimental-index.cjs +3 -2
  5. package/dist/experimental-index.d.cts +1 -1
  6. package/dist/experimental-index.d.mts +1 -1
  7. package/dist/experimental-index.mjs +3 -2
  8. package/dist/filter-index.cjs +12 -0
  9. package/dist/filter-index.d.cts +3 -0
  10. package/dist/filter-index.d.mts +3 -0
  11. package/dist/filter-index.mjs +4 -0
  12. package/dist/index.cjs +4 -4
  13. package/dist/index.d.cts +2 -2
  14. package/dist/index.d.mts +2 -2
  15. package/dist/index.mjs +4 -3
  16. package/dist/parallel-plugin-worker.cjs +3 -2
  17. package/dist/parallel-plugin-worker.mjs +3 -2
  18. package/dist/parallel-plugin.d.cts +1 -1
  19. package/dist/parallel-plugin.d.mts +1 -1
  20. package/dist/parse-ast-index.cjs +1 -1
  21. package/dist/parse-ast-index.mjs +1 -1
  22. package/dist/rolldown-binding.wasi-browser.js +1 -0
  23. package/dist/rolldown-binding.wasi.cjs +1 -0
  24. package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
  25. package/dist/shared/filter-index-ChddWdsi.cjs +255 -0
  26. package/dist/shared/filter-index-DmisSKZF.mjs +174 -0
  27. package/dist/shared/{input-options.d-CMFIv0CX.d.mts → input-options.d-9IzFBPMw.d.mts} +82 -23
  28. package/dist/shared/{input-options.d-P0YdGzip.d.cts → input-options.d-BFt2wKBM.d.cts} +82 -23
  29. package/dist/shared/{src-D9guL4ht.mjs → src-DN1_B1_m.mjs} +1783 -1740
  30. package/dist/shared/{src-CJ9XODOK.cjs → src-glXqJCVJ.cjs} +260 -219
  31. package/package.json +1 -1
  32. /package/dist/shared/{parse-ast-index-DWHg_E7J.mjs → parse-ast-index-B5wGnMSg.mjs} +0 -0
  33. /package/dist/shared/{parse-ast-index-B9pj8J1q.cjs → parse-ast-index-DTWvag1h.cjs} +0 -0
  34. /package/dist/shared/{prompt-_yrURmmm.cjs → prompt-At99RuKY.cjs} +0 -0
  35. /package/dist/shared/{prompt-B7SnYdwU.mjs → prompt-BqVpALUY.mjs} +0 -0
@@ -1,5 +1,6 @@
1
1
  import { __esm } from "./chunk-DSsiIF1Z.mjs";
2
- import { augmentCodeLocation, error, init_logs, init_parse_ast_index, logCycleLoading, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, parseAst } from "./parse-ast-index-DWHg_E7J.mjs";
2
+ import { and, arraify, code, exclude, id, include, init_filter_index, init_misc, isNullish, moduleType, noop, or, unimplemented, unreachable, unsupported } from "./filter-index-DmisSKZF.mjs";
3
+ import { augmentCodeLocation, error, init_logs, init_parse_ast_index, logCycleLoading, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, parseAst } from "./parse-ast-index-B5wGnMSg.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.baf6ca1";
13
14
  var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
14
15
 
15
16
  //#endregion
@@ -101,31 +102,6 @@ var init_constructors = __esm({ "src/builtin-plugin/constructors.ts"() {
101
102
  };
102
103
  } });
103
104
 
104
- //#endregion
105
- //#region src/utils/misc.ts
106
- function arraify(value) {
107
- return Array.isArray(value) ? value : [value];
108
- }
109
- function isNullish(value) {
110
- return value === null || value === void 0;
111
- }
112
- function isPromiseLike(value) {
113
- return value && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
114
- }
115
- function unimplemented(info) {
116
- if (info) throw new Error(`unimplemented: ${info}`);
117
- throw new Error("unimplemented");
118
- }
119
- function unreachable(info) {
120
- if (info) throw new Error(`unreachable: ${info}`);
121
- throw new Error("unreachable");
122
- }
123
- function unsupported(info) {
124
- throw new Error(`UNSUPPORTED: ${info}`);
125
- }
126
- function noop(..._args) {}
127
- var init_misc = __esm({ "src/utils/misc.ts"() {} });
128
-
129
105
  //#endregion
130
106
  //#region src/log/logging.ts
131
107
  var LOG_LEVEL_SILENT, LOG_LEVEL_ERROR, LOG_LEVEL_WARN, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, logLevelPriority;
@@ -145,13 +121,13 @@ var init_logging = __esm({ "src/log/logging.ts"() {
145
121
 
146
122
  //#endregion
147
123
  //#region src/log/log-handler.ts
148
- function getLogHandler(level, code, logger, pluginName, logLevel) {
124
+ function getLogHandler(level, code$1, logger, pluginName, logLevel) {
149
125
  if (logLevelPriority[level] < logLevelPriority[logLevel]) return noop;
150
126
  return (log, pos) => {
151
127
  if (pos != null) logger(LOG_LEVEL_WARN, logInvalidLogPosition(pluginName));
152
128
  log = normalizeLog(log);
153
129
  if (log.code && !log.pluginCode) log.pluginCode = log.code;
154
- log.code = code;
130
+ log.code = code$1;
155
131
  log.plugin = pluginName;
156
132
  logger(level, log);
157
133
  };
@@ -198,9 +174,9 @@ function getLogger(plugins, onLog, logLevel, watchMode) {
198
174
  };
199
175
  return logger;
200
176
  }
201
- function relativeId(id) {
202
- if (!path.isAbsolute(id)) return id;
203
- return path.relative(path.resolve(), id);
177
+ function relativeId(id$1) {
178
+ if (!path.isAbsolute(id$1)) return id$1;
179
+ return path.relative(path.resolve(), id$1);
204
180
  }
205
181
  var getOnLog, getDefaultOnLog, addLogToString, defaultPrintLog, getExtendedLogMessage;
206
182
  var init_logger = __esm({ "src/log/logger.ts"() {
@@ -273,7 +249,7 @@ var init_normalize_hook = __esm({ "src/utils/normalize-hook.ts"() {
273
249
  //#endregion
274
250
  //#region src/constants/plugin.ts
275
251
  var ENUMERATED_INPUT_PLUGIN_HOOK_NAMES, ENUMERATED_OUTPUT_PLUGIN_HOOK_NAMES, ENUMERATED_PLUGIN_HOOK_NAMES, DEFINED_HOOK_NAMES;
276
- var init_plugin$2 = __esm({ "src/constants/plugin.ts"() {
252
+ var init_plugin$1 = __esm({ "src/constants/plugin.ts"() {
277
253
  ENUMERATED_INPUT_PLUGIN_HOOK_NAMES = [
278
254
  "options",
279
255
  "buildStart",
@@ -362,7 +338,7 @@ function normalizePlugins(plugins, anonymousPrefix) {
362
338
  var normalizePluginOption, ANONYMOUS_PLUGIN_PREFIX, ANONYMOUS_OUTPUT_PLUGIN_PREFIX;
363
339
  var init_normalize_plugin_option = __esm({ "src/utils/normalize-plugin-option.ts"() {
364
340
  init_constructors();
365
- init_plugin$2();
341
+ init_plugin$1();
366
342
  init_logging();
367
343
  init_logs();
368
344
  init_async_flatten();
@@ -495,7 +471,7 @@ function validateOption(key, options) {
495
471
  const issuePaths = issue.path.map((path$1) => path$1.key);
496
472
  let issueMsg = issue.message;
497
473
  if (issue.type === "union") {
498
- const subIssue = issue.issues?.find((i$21) => !(i$21.type !== issue.received && i$21.input === issue.input));
474
+ const subIssue = issue.issues?.find((i$22) => !(i$22.type !== issue.received && i$22.input === issue.input));
499
475
  if (subIssue) {
500
476
  if (subIssue.path) issuePaths.push(subIssue.path.map((path$1) => path$1.key));
501
477
  issueMsg = subIssue.message;
@@ -925,13 +901,13 @@ function normalizeErrors(rawErrors) {
925
901
  stack: void 0
926
902
  }));
927
903
  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++) {
904
+ for (let i$22 = 0; i$22 < errors.length; i$22++) {
929
905
  summary += "\n";
930
- if (i$21 >= 5) {
906
+ if (i$22 >= 5) {
931
907
  summary += "...";
932
908
  break;
933
909
  }
934
- summary += getErrorMessage(errors[i$21]);
910
+ summary += getErrorMessage(errors[i$22]);
935
911
  }
936
912
  const wrapper = new Error(summary);
937
913
  Object.defineProperty(wrapper, "errors", {
@@ -950,9 +926,9 @@ function getErrorMessage(e$5) {
950
926
  if (Object.hasOwn(e$5, "kind")) return e$5.message;
951
927
  let s$10 = "";
952
928
  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;
929
+ const id$1 = e$5.id ?? e$5.loc?.file;
930
+ if (id$1) {
931
+ s$10 += " " + id$1;
956
932
  if (e$5.loc) s$10 += `:${e$5.loc.line}:${e$5.loc.column}`;
957
933
  }
958
934
  if (s$10) s$10 += "\n";
@@ -1012,1706 +988,242 @@ function isEmptySourcemapFiled(array) {
1012
988
  if (array.length === 0 || !array[0]) return true;
1013
989
  return false;
1014
990
  }
1015
- function normalizeTransformHookSourcemap(id, originalCode, rawMap) {
991
+ function normalizeTransformHookSourcemap(id$1, originalCode, rawMap) {
1016
992
  if (!rawMap) return;
1017
993
  let map = typeof rawMap === "object" ? rawMap : JSON.parse(rawMap);
1018
994
  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];
995
+ if (isEmptySourcemapFiled(map.sources) || map.sources && map.sources.length === 1 && map.sources[0] !== id$1) map.sources = [id$1];
1020
996
  return map;
1021
997
  }
1022
998
  var init_transform_sourcemap = __esm({ "src/utils/transform-sourcemap.ts"() {} });
1023
999
 
1024
1000
  //#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();
1001
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-ANXBDSUI.js
1002
+ var init_chunk_ANXBDSUI = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-ANXBDSUI.js"() {} });
1003
+
1004
+ //#endregion
1005
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-3GOCSNFN.js
1006
+ var init_chunk_3GOCSNFN = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-3GOCSNFN.js"() {
1007
+ init_chunk_ANXBDSUI();
1054
1008
  } });
1055
1009
 
1056
1010
  //#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"() {} });
1011
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-LFJW7BOT.js
1012
+ var init_chunk_LFJW7BOT = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-LFJW7BOT.js"() {
1013
+ init_chunk_3GOCSNFN();
1014
+ } });
1071
1015
 
1072
1016
  //#endregion
1073
- //#region src/utils/asset-source.ts
1074
- function transformAssetSource(bindingAssetSource$1) {
1075
- return bindingAssetSource$1.inner;
1017
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-7ZI6JRPB.js
1018
+ var init_chunk_7ZI6JRPB = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-7ZI6JRPB.js"() {
1019
+ init_chunk_LFJW7BOT();
1020
+ init_chunk_ANXBDSUI();
1021
+ } });
1022
+
1023
+ //#endregion
1024
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-OXJMERKM.js
1025
+ var init_chunk_OXJMERKM = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-OXJMERKM.js"() {
1026
+ init_chunk_LFJW7BOT();
1027
+ init_chunk_ANXBDSUI();
1028
+ } });
1029
+
1030
+ //#endregion
1031
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-D6FCK2GA.js
1032
+ function u$13(o$12, n$7, a$15) {
1033
+ let t$14 = (r$12) => o$12(r$12, ...n$7);
1034
+ return a$15 === void 0 ? t$14 : Object.assign(t$14, {
1035
+ lazy: a$15,
1036
+ lazyArgs: n$7
1037
+ });
1076
1038
  }
1077
- function bindingAssetSource(source) {
1078
- return { inner: source };
1039
+ var init_chunk_D6FCK2GA = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-D6FCK2GA.js"() {} });
1040
+
1041
+ //#endregion
1042
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-WIMGWYZL.js
1043
+ function u$11(r$12, n$7, o$12) {
1044
+ let a$15 = r$12.length - n$7.length;
1045
+ if (a$15 === 0) return r$12(...n$7);
1046
+ if (a$15 === 1) return u$13(r$12, n$7, o$12);
1047
+ throw new Error("Wrong number of arguments");
1079
1048
  }
1080
- var init_asset_source = __esm({ "src/utils/asset-source.ts"() {} });
1049
+ var init_chunk_WIMGWYZL = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-WIMGWYZL.js"() {
1050
+ init_chunk_D6FCK2GA();
1051
+ } });
1081
1052
 
1082
1053
  //#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
- };
1054
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-BSLJB6JE.js
1055
+ var init_chunk_BSLJB6JE = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-BSLJB6JE.js"() {
1056
+ init_chunk_WIMGWYZL();
1184
1057
  } });
1185
1058
 
1186
1059
  //#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
- };
1060
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-NJXNQM3G.js
1061
+ var init_chunk_NJXNQM3G = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-NJXNQM3G.js"() {} });
1062
+
1063
+ //#endregion
1064
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-6RKHJ2CP.js
1065
+ var init_chunk_6RKHJ2CP = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-6RKHJ2CP.js"() {
1066
+ init_chunk_WIMGWYZL();
1221
1067
  } });
1222
1068
 
1223
1069
  //#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();
1070
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-QDGUNRDA.js
1071
+ var init_chunk_QDGUNRDA = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-QDGUNRDA.js"() {
1072
+ init_chunk_D6FCK2GA();
1399
1073
  } });
1400
1074
 
1401
1075
  //#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"() {} });
1076
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-MYLLMFC7.js
1077
+ var init_chunk_MYLLMFC7 = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-MYLLMFC7.js"() {
1078
+ init_chunk_WIMGWYZL();
1079
+ } });
1417
1080
 
1418
1081
  //#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;
1082
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-DEVKGLTN.js
1083
+ var o$11, c$3, i$21;
1084
+ var init_chunk_DEVKGLTN = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-DEVKGLTN.js"() {
1085
+ o$11 = [
1086
+ " ",
1087
+ `
1088
+ `,
1089
+ "\v",
1090
+ "\f",
1091
+ "\r",
1092
+ " ",
1093
+ "…",
1094
+ "\xA0",
1095
+ " ",
1096
+ " ",
1097
+ " ",
1098
+ " ",
1099
+ " ",
1100
+ " ",
1101
+ " ",
1102
+ " ",
1103
+ " ",
1104
+ " ",
1105
+ " ",
1106
+ " ",
1107
+ "\u2028",
1108
+ "\u2029",
1109
+ " ",
1110
+ " ",
1111
+ " ",
1112
+ ""
1113
+ ], c$3 = new Set([
1114
+ "-",
1115
+ "_",
1116
+ ...o$11
1117
+ ]), i$21 = (r$12) => {
1118
+ let e$5 = [], t$14 = "", u$14 = () => {
1119
+ t$14.length > 0 && (e$5.push(t$14), t$14 = "");
1120
+ };
1121
+ for (let s$10 of r$12) {
1122
+ if (c$3.has(s$10)) {
1123
+ u$14();
1124
+ continue;
1125
+ }
1126
+ if (/[a-z]$/u.test(t$14) && /[A-Z]/u.test(s$10)) u$14();
1127
+ else if (/[A-Z][A-Z]$/u.test(t$14) && /[a-z]/u.test(s$10)) {
1128
+ let n$7 = t$14.slice(-1);
1129
+ t$14 = t$14.slice(0, -1), u$14(), t$14 = n$7;
1130
+ } else /\d$/u.test(t$14) !== /\d/u.test(s$10) && u$14();
1131
+ t$14 += s$10;
1453
1132
  }
1133
+ return u$14(), e$5;
1454
1134
  };
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
1135
  } });
1468
1136
 
1469
1137
  //#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();
1138
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-N4JUOEMS.js
1139
+ var init_chunk_N4JUOEMS = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-N4JUOEMS.js"() {
1140
+ init_chunk_DEVKGLTN();
1554
1141
  } });
1555
1142
 
1556
1143
  //#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
- };
1144
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-YRJ25UV2.js
1145
+ var init_chunk_YRJ25UV2 = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-YRJ25UV2.js"() {
1146
+ init_chunk_DEVKGLTN();
1147
+ init_chunk_WIMGWYZL();
1659
1148
  } });
1660
1149
 
1661
1150
  //#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();
1151
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-Q5ASJ5N7.js
1152
+ var init_chunk_Q5ASJ5N7 = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-Q5ASJ5N7.js"() {
1153
+ init_chunk_WIMGWYZL();
1808
1154
  } });
1809
1155
 
1810
1156
  //#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();
1157
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-WZOX4VKU.js
1158
+ var init_chunk_WZOX4VKU = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-WZOX4VKU.js"() {
1159
+ init_chunk_DEVKGLTN();
1160
+ init_chunk_WIMGWYZL();
1967
1161
  } });
1968
1162
 
1969
1163
  //#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();
1997
- } });
1998
-
1164
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-Y3VKZ3P5.js
1165
+ var init_chunk_Y3VKZ3P5 = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-Y3VKZ3P5.js"() {
1166
+ init_chunk_WIMGWYZL();
1167
+ } });
1168
+
1999
1169
  //#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
- };
1170
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-ZRKG4NSC.js
1171
+ var init_chunk_ZRKG4NSC = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-ZRKG4NSC.js"() {
1172
+ init_chunk_WIMGWYZL();
2061
1173
  } });
2062
1174
 
2063
1175
  //#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();
1176
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-QJLMYOTX.js
1177
+ var init_chunk_QJLMYOTX = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-QJLMYOTX.js"() {
1178
+ init_chunk_LFJW7BOT();
1179
+ init_chunk_ANXBDSUI();
2189
1180
  } });
2190
1181
 
2191
1182
  //#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
- };
1183
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-DM52TTEP.js
1184
+ var init_chunk_DM52TTEP = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-DM52TTEP.js"() {
1185
+ init_chunk_WIMGWYZL();
2276
1186
  } });
2277
1187
 
2278
1188
  //#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"() {} });
1189
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-2P44HXVH.js
1190
+ var init_chunk_2P44HXVH = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-2P44HXVH.js"() {
1191
+ init_chunk_WIMGWYZL();
1192
+ } });
2289
1193
 
2290
1194
  //#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();
1195
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-ZJS5DNQW.js
1196
+ var init_chunk_ZJS5DNQW = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-ZJS5DNQW.js"() {
1197
+ init_chunk_ANXBDSUI();
1198
+ init_chunk_WIMGWYZL();
2486
1199
  } });
2487
1200
 
2488
1201
  //#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"() {} });
1202
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-DH3BPT6T.js
1203
+ var init_chunk_DH3BPT6T = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-DH3BPT6T.js"() {} });
2491
1204
 
2492
1205
  //#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();
1206
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-OAMXQXGR.js
1207
+ var init_chunk_OAMXQXGR = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-OAMXQXGR.js"() {
1208
+ init_chunk_WIMGWYZL();
2496
1209
  } });
2497
1210
 
2498
1211
  //#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();
1212
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-P5WDBFN2.js
1213
+ var init_chunk_P5WDBFN2 = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-P5WDBFN2.js"() {
1214
+ init_chunk_DH3BPT6T();
1215
+ init_chunk_OAMXQXGR();
2502
1216
  } });
2503
1217
 
2504
1218
  //#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
- } });
1219
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-EMIEIAAH.js
1220
+ var init_chunk_EMIEIAAH = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-EMIEIAAH.js"() {} });
2510
1221
 
2511
1222
  //#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();
2516
- } });
2517
-
2518
- //#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();
1223
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-AHDTEY6L.js
1224
+ var init_chunk_AHDTEY6L = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-AHDTEY6L.js"() {
1225
+ init_chunk_P5WDBFN2();
1226
+ init_chunk_EMIEIAAH();
2715
1227
  } });
2716
1228
 
2717
1229
  //#endregion
@@ -2928,8 +1440,17 @@ var init_chunk_R72GEKLP = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_m
2928
1440
 
2929
1441
  //#endregion
2930
1442
  //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-3IFJP4R5.js
1443
+ function d$3(...r$12) {
1444
+ return u$11(i$19, r$12);
1445
+ }
1446
+ var i$19;
2931
1447
  var init_chunk_3IFJP4R5 = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-3IFJP4R5.js"() {
2932
1448
  init_chunk_WIMGWYZL();
1449
+ i$19 = (r$12, t$14) => {
1450
+ let a$15 = [[], []];
1451
+ 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);
1452
+ return a$15;
1453
+ };
2933
1454
  } });
2934
1455
 
2935
1456
  //#endregion
@@ -3686,11 +2207,1583 @@ var init_dist = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/rem
3686
2207
  init_chunk_WIMGWYZL();
3687
2208
  } });
3688
2209
 
2210
+ //#endregion
2211
+ //#region src/plugin/bindingify-hook-filter.ts
2212
+ function generalHookFilterMatcherToFilterExprs(matcher, stringKind) {
2213
+ if (typeof matcher === "string" || matcher instanceof RegExp) return [include(id(matcher))];
2214
+ if (Array.isArray(matcher)) return matcher.map((m$10) => include(id(m$10)));
2215
+ let ret = [];
2216
+ let isCode = stringKind === "code";
2217
+ if (matcher.exclude) ret.push(...arraify(matcher.exclude).map((m$10) => exclude(isCode ? code(m$10) : id(m$10))));
2218
+ if (matcher.include) ret.push(...arraify(matcher.include).map((m$10) => include(isCode ? code(m$10) : id(m$10))));
2219
+ return ret;
2220
+ }
2221
+ function transformFilterMatcherToFilterExprs(filterOption) {
2222
+ if (!filterOption) return void 0;
2223
+ if (Array.isArray(filterOption)) return filterOption;
2224
+ const { id: id$1, code: code$1, moduleType: moduleType$1 } = filterOption;
2225
+ let ret = [];
2226
+ let idIncludes = [];
2227
+ let idExcludes = [];
2228
+ let codeIncludes = [];
2229
+ let codeExcludes = [];
2230
+ if (id$1) [idIncludes, idExcludes] = d$3(generalHookFilterMatcherToFilterExprs(id$1, "id") ?? [], (m$10) => m$10.kind === "include");
2231
+ if (code$1) [codeIncludes, codeExcludes] = d$3(generalHookFilterMatcherToFilterExprs(code$1, "code") ?? [], (m$10) => m$10.kind === "include");
2232
+ ret.push(...idExcludes);
2233
+ ret.push(...codeExcludes);
2234
+ let andExprList = [];
2235
+ if (moduleType$1) {
2236
+ let moduleTypes = Array.isArray(moduleType$1) ? moduleType$1 : moduleType$1.include ?? [];
2237
+ andExprList.push(or(...moduleTypes.map((m$10) => moduleType(m$10))));
2238
+ }
2239
+ if (idIncludes.length) andExprList.push(or(...idIncludes.map((item) => item.expr)));
2240
+ if (codeIncludes.length) andExprList.push(or(...codeIncludes.map((item) => item.expr)));
2241
+ if (andExprList.length) ret.push(include(and(...andExprList)));
2242
+ return ret;
2243
+ }
2244
+ function bindingifyGeneralHookFilter(stringKind, pattern) {
2245
+ let filterExprs = generalHookFilterMatcherToFilterExprs(pattern, stringKind);
2246
+ let ret = [];
2247
+ if (filterExprs) ret = filterExprs.map(bindingifyFilterExpr);
2248
+ return ret.length > 0 ? { value: ret } : void 0;
2249
+ }
2250
+ function bindingifyFilterExpr(expr) {
2251
+ let list = [];
2252
+ bindingifyFilterExprImpl(expr, list);
2253
+ return list;
2254
+ }
2255
+ function bindingifyFilterExprImpl(expr, list) {
2256
+ switch (expr.kind) {
2257
+ case "and": {
2258
+ let args = expr.args;
2259
+ for (let i$22 = args.length - 1; i$22 >= 0; i$22--) bindingifyFilterExprImpl(args[i$22], list);
2260
+ list.push({
2261
+ kind: "And",
2262
+ payload: args.length
2263
+ });
2264
+ break;
2265
+ }
2266
+ case "or": {
2267
+ let args = expr.args;
2268
+ for (let i$22 = args.length - 1; i$22 >= 0; i$22--) bindingifyFilterExprImpl(args[i$22], list);
2269
+ list.push({
2270
+ kind: "Or",
2271
+ payload: args.length
2272
+ });
2273
+ break;
2274
+ }
2275
+ case "not": {
2276
+ bindingifyFilterExprImpl(expr.expr, list);
2277
+ list.push({ kind: "Not" });
2278
+ break;
2279
+ }
2280
+ case "id": {
2281
+ list.push({
2282
+ kind: "Id",
2283
+ payload: expr.pattern
2284
+ });
2285
+ break;
2286
+ }
2287
+ case "moduleType": {
2288
+ list.push({
2289
+ kind: "ModuleType",
2290
+ payload: expr.pattern
2291
+ });
2292
+ break;
2293
+ }
2294
+ case "code": {
2295
+ list.push({
2296
+ kind: "Code",
2297
+ payload: expr.pattern
2298
+ });
2299
+ break;
2300
+ }
2301
+ case "include": {
2302
+ bindingifyFilterExprImpl(expr.expr, list);
2303
+ list.push({ kind: "Include" });
2304
+ break;
2305
+ }
2306
+ case "exclude": {
2307
+ bindingifyFilterExprImpl(expr.expr, list);
2308
+ list.push({ kind: "Exclude" });
2309
+ break;
2310
+ }
2311
+ default: throw new Error(`Unknown filter expression: ${expr}`);
2312
+ }
2313
+ }
2314
+ function bindingifyResolveIdFilter(filterOption) {
2315
+ if (!filterOption) return void 0;
2316
+ if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
2317
+ return filterOption.id ? bindingifyGeneralHookFilter("id", filterOption.id) : void 0;
2318
+ }
2319
+ function bindingifyLoadFilter(filterOption) {
2320
+ if (!filterOption) return void 0;
2321
+ if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
2322
+ return filterOption.id ? bindingifyGeneralHookFilter("id", filterOption.id) : void 0;
2323
+ }
2324
+ function bindingifyTransformFilter(filterOption) {
2325
+ if (!filterOption) return void 0;
2326
+ let filterExprs = transformFilterMatcherToFilterExprs(filterOption);
2327
+ let ret = [];
2328
+ if (filterExprs) ret = filterExprs.map(bindingifyFilterExpr);
2329
+ return { value: ret.length > 0 ? ret : void 0 };
2330
+ }
2331
+ function bindingifyRenderChunkFilter(filterOption) {
2332
+ if (!filterOption) return void 0;
2333
+ if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
2334
+ return filterOption.code ? bindingifyGeneralHookFilter("code", filterOption.code) : void 0;
2335
+ }
2336
+ var init_bindingify_hook_filter = __esm({ "src/plugin/bindingify-hook-filter.ts"() {
2337
+ init_dist();
2338
+ init_filter_index();
2339
+ init_misc();
2340
+ } });
2341
+
2342
+ //#endregion
2343
+ //#region src/plugin/bindingify-plugin-hook-meta.ts
2344
+ function bindingifyPluginHookMeta(options) {
2345
+ return { order: bindingPluginOrder(options.order) };
2346
+ }
2347
+ function bindingPluginOrder(order) {
2348
+ switch (order) {
2349
+ case "post": return BindingPluginOrder.Post;
2350
+ case "pre": return BindingPluginOrder.Pre;
2351
+ case null:
2352
+ case void 0: return void 0;
2353
+ default: throw new Error(`Unknown plugin order: ${order}`);
2354
+ }
2355
+ }
2356
+ var init_bindingify_plugin_hook_meta = __esm({ "src/plugin/bindingify-plugin-hook-meta.ts"() {} });
2357
+
2358
+ //#endregion
2359
+ //#region src/utils/asset-source.ts
2360
+ function transformAssetSource(bindingAssetSource$1) {
2361
+ return bindingAssetSource$1.inner;
2362
+ }
2363
+ function bindingAssetSource(source) {
2364
+ return { inner: source };
2365
+ }
2366
+ var init_asset_source = __esm({ "src/utils/asset-source.ts"() {} });
2367
+
2368
+ //#endregion
2369
+ //#region src/plugin/plugin-context.ts
2370
+ var PluginContextImpl;
2371
+ var init_plugin_context = __esm({ "src/plugin/plugin-context.ts"() {
2372
+ init_logging();
2373
+ init_logs();
2374
+ init_parse_ast_index();
2375
+ init_minimal_plugin_context();
2376
+ init_asset_source();
2377
+ init_misc();
2378
+ init_transform_side_effects();
2379
+ PluginContextImpl = class extends MinimalPluginContextImpl {
2380
+ getModuleInfo;
2381
+ constructor(outputOptions, context, plugin, data, onLog, logLevel, watchMode, currentLoadingModule) {
2382
+ super(onLog, logLevel, plugin.name, watchMode);
2383
+ this.outputOptions = outputOptions;
2384
+ this.context = context;
2385
+ this.data = data;
2386
+ this.onLog = onLog;
2387
+ this.currentLoadingModule = currentLoadingModule;
2388
+ this.getModuleInfo = (id$1) => this.data.getModuleInfo(id$1, context);
2389
+ }
2390
+ async load(options) {
2391
+ const id$1 = options.id;
2392
+ if (id$1 === this.currentLoadingModule) this.onLog(LOG_LEVEL_WARN, logCycleLoading(this.pluginName, this.currentLoadingModule));
2393
+ const moduleInfo = this.data.getModuleInfo(id$1, this.context);
2394
+ if (moduleInfo && moduleInfo.code !== null) return moduleInfo;
2395
+ const rawOptions = {
2396
+ meta: options.meta || {},
2397
+ moduleSideEffects: options.moduleSideEffects || null,
2398
+ invalidate: false
2399
+ };
2400
+ this.data.updateModuleOption(id$1, rawOptions);
2401
+ async function createLoadModulePromise(context, data) {
2402
+ const loadPromise = data.loadModulePromiseMap.get(id$1);
2403
+ if (loadPromise) return loadPromise;
2404
+ const promise = new Promise((resolve, _) => {
2405
+ data.loadModulePromiseResolveFnMap.set(id$1, resolve);
2406
+ });
2407
+ data.loadModulePromiseMap.set(id$1, promise);
2408
+ try {
2409
+ await context.load(id$1, bindingifySideEffects(options.moduleSideEffects));
2410
+ } catch (e$5) {
2411
+ data.loadModulePromiseMap.delete(id$1);
2412
+ data.loadModulePromiseResolveFnMap.delete(id$1);
2413
+ throw e$5;
2414
+ }
2415
+ return promise;
2416
+ }
2417
+ await createLoadModulePromise(this.context, this.data);
2418
+ return this.data.getModuleInfo(id$1, this.context);
2419
+ }
2420
+ async resolve(source, importer, options) {
2421
+ let receipt = void 0;
2422
+ if (options != null) receipt = this.data.saveResolveOptions(options);
2423
+ const res = await this.context.resolve(source, importer, {
2424
+ custom: receipt,
2425
+ skipSelf: options?.skipSelf
2426
+ });
2427
+ if (receipt != null) this.data.removeSavedResolveOptions(receipt);
2428
+ if (res == null) return null;
2429
+ const info = this.data.getModuleOption(res.id) || {};
2430
+ return {
2431
+ ...res,
2432
+ external: res.external === "relative" ? unreachable(`The PluginContext resolve result external couldn't be 'relative'`) : res.external,
2433
+ ...info
2434
+ };
2435
+ }
2436
+ emitFile = (file) => {
2437
+ if (file.type === "prebuilt-chunk") return unimplemented("PluginContext.emitFile with type prebuilt-chunk");
2438
+ if (file.type === "chunk") return this.context.emitChunk(file);
2439
+ const fnSanitizedFileName = file.fileName || typeof this.outputOptions.sanitizeFileName !== "function" ? void 0 : this.outputOptions.sanitizeFileName(file.name || "asset");
2440
+ const filename = file.fileName ? void 0 : this.getAssetFileNames(file);
2441
+ return this.context.emitFile({
2442
+ ...file,
2443
+ originalFileName: file.originalFileName || void 0,
2444
+ source: bindingAssetSource(file.source)
2445
+ }, filename, fnSanitizedFileName);
2446
+ };
2447
+ getAssetFileNames(file) {
2448
+ if (typeof this.outputOptions.assetFileNames === "function") return this.outputOptions.assetFileNames({
2449
+ names: file.name ? [file.name] : [],
2450
+ originalFileNames: file.originalFileName ? [file.originalFileName] : [],
2451
+ source: file.source,
2452
+ type: "asset"
2453
+ });
2454
+ }
2455
+ getFileName(referenceId) {
2456
+ return this.context.getFileName(referenceId);
2457
+ }
2458
+ getModuleIds() {
2459
+ return this.data.getModuleIds(this.context);
2460
+ }
2461
+ addWatchFile(id$1) {
2462
+ this.context.addWatchFile(id$1);
2463
+ }
2464
+ parse(input, options) {
2465
+ return parseAst(input, options);
2466
+ }
2467
+ };
2468
+ } });
2469
+
2470
+ //#endregion
2471
+ //#region src/plugin/transform-plugin-context.ts
2472
+ var TransformPluginContextImpl;
2473
+ var init_transform_plugin_context = __esm({ "src/plugin/transform-plugin-context.ts"() {
2474
+ init_log_handler();
2475
+ init_logs();
2476
+ init_plugin_context();
2477
+ TransformPluginContextImpl = class extends PluginContextImpl {
2478
+ constructor(outputOptions, context, plugin, data, inner, moduleId, moduleSource, onLog, LogLevelOption, watchMode) {
2479
+ super(outputOptions, context, plugin, data, onLog, LogLevelOption, watchMode, moduleId);
2480
+ this.inner = inner;
2481
+ this.moduleId = moduleId;
2482
+ this.moduleSource = moduleSource;
2483
+ const getLogHandler$1 = (handler) => (log, pos) => {
2484
+ log = normalizeLog(log);
2485
+ if (pos) augmentCodeLocation(log, pos, moduleSource, moduleId);
2486
+ log.id = moduleId;
2487
+ log.hook = "transform";
2488
+ handler(log);
2489
+ };
2490
+ this.debug = getLogHandler$1(this.debug);
2491
+ this.warn = getLogHandler$1(this.warn);
2492
+ this.info = getLogHandler$1(this.info);
2493
+ }
2494
+ error(e$5, pos) {
2495
+ if (typeof e$5 === "string") e$5 = { message: e$5 };
2496
+ if (pos) augmentCodeLocation(e$5, pos, this.moduleSource, this.moduleId);
2497
+ e$5.id = this.moduleId;
2498
+ e$5.hook = "transform";
2499
+ return error(logPluginError(normalizeLog(e$5), this.pluginName));
2500
+ }
2501
+ getCombinedSourcemap() {
2502
+ return JSON.parse(this.inner.getCombinedSourcemap());
2503
+ }
2504
+ };
2505
+ } });
2506
+
2507
+ //#endregion
2508
+ //#region src/plugin/bindingify-build-hooks.ts
2509
+ function bindingifyBuildStart(args) {
2510
+ const hook = args.plugin.buildStart;
2511
+ if (!hook) return {};
2512
+ const { handler, meta } = normalizeHook(hook);
2513
+ return {
2514
+ plugin: async (ctx, opts) => {
2515
+ await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), new NormalizedInputOptionsImpl(opts, args.onLog));
2516
+ },
2517
+ meta: bindingifyPluginHookMeta(meta)
2518
+ };
2519
+ }
2520
+ function bindingifyBuildEnd(args) {
2521
+ const hook = args.plugin.buildEnd;
2522
+ if (!hook) return {};
2523
+ const { handler, meta } = normalizeHook(hook);
2524
+ return {
2525
+ plugin: async (ctx, err) => {
2526
+ await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), err ? normalizeErrors(err) : void 0);
2527
+ },
2528
+ meta: bindingifyPluginHookMeta(meta)
2529
+ };
2530
+ }
2531
+ function bindingifyResolveId(args) {
2532
+ const hook = args.plugin.resolveId;
2533
+ if (!hook) return {};
2534
+ const { handler, meta, options } = normalizeHook(hook);
2535
+ return {
2536
+ plugin: async (ctx, specifier, importer, extraOptions) => {
2537
+ const contextResolveOptions = extraOptions.custom != null ? args.pluginContextData.getSavedResolveOptions(extraOptions.custom) : void 0;
2538
+ const newExtraOptions = {
2539
+ ...extraOptions,
2540
+ custom: contextResolveOptions?.custom,
2541
+ [SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF]: contextResolveOptions?.[SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF]
2542
+ };
2543
+ 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);
2544
+ if (ret == null) return;
2545
+ if (ret === false) return {
2546
+ id: specifier,
2547
+ external: true,
2548
+ normalizeExternalId: true
2549
+ };
2550
+ if (typeof ret === "string") return {
2551
+ id: ret,
2552
+ normalizeExternalId: true
2553
+ };
2554
+ let exist = args.pluginContextData.updateModuleOption(ret.id, {
2555
+ meta: ret.meta || {},
2556
+ moduleSideEffects: ret.moduleSideEffects ?? null,
2557
+ invalidate: false
2558
+ });
2559
+ return {
2560
+ id: ret.id,
2561
+ external: ret.external,
2562
+ normalizeExternalId: false,
2563
+ sideEffects: bindingifySideEffects(exist.moduleSideEffects)
2564
+ };
2565
+ },
2566
+ meta: bindingifyPluginHookMeta(meta),
2567
+ filter: bindingifyResolveIdFilter(options.filter)
2568
+ };
2569
+ }
2570
+ function bindingifyResolveDynamicImport(args) {
2571
+ const hook = args.plugin.resolveDynamicImport;
2572
+ if (!hook) return {};
2573
+ const { handler, meta } = normalizeHook(hook);
2574
+ return {
2575
+ plugin: async (ctx, specifier, importer) => {
2576
+ const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), specifier, importer ?? void 0);
2577
+ if (ret == null) return;
2578
+ if (ret === false) return {
2579
+ id: specifier,
2580
+ external: true
2581
+ };
2582
+ if (typeof ret === "string") return { id: ret };
2583
+ const result = {
2584
+ id: ret.id,
2585
+ external: ret.external
2586
+ };
2587
+ if (ret.moduleSideEffects !== null) result.sideEffects = bindingifySideEffects(ret.moduleSideEffects);
2588
+ args.pluginContextData.updateModuleOption(ret.id, {
2589
+ meta: ret.meta || {},
2590
+ moduleSideEffects: ret.moduleSideEffects || null,
2591
+ invalidate: false
2592
+ });
2593
+ return result;
2594
+ },
2595
+ meta: bindingifyPluginHookMeta(meta)
2596
+ };
2597
+ }
2598
+ function bindingifyTransform(args) {
2599
+ const hook = args.plugin.transform;
2600
+ if (!hook) return {};
2601
+ const { handler, meta, options } = normalizeHook(hook);
2602
+ return {
2603
+ plugin: async (ctx, code$1, id$1, meta$1) => {
2604
+ 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);
2605
+ if (ret == null) return void 0;
2606
+ if (typeof ret === "string") return { code: ret };
2607
+ let moduleOption = args.pluginContextData.updateModuleOption(id$1, {
2608
+ meta: ret.meta ?? {},
2609
+ moduleSideEffects: ret.moduleSideEffects ?? null,
2610
+ invalidate: false
2611
+ });
2612
+ return {
2613
+ code: ret.code,
2614
+ map: bindingifySourcemap(normalizeTransformHookSourcemap(id$1, code$1, ret.map)),
2615
+ sideEffects: bindingifySideEffects(moduleOption.moduleSideEffects),
2616
+ moduleType: ret.moduleType
2617
+ };
2618
+ },
2619
+ meta: bindingifyPluginHookMeta(meta),
2620
+ filter: bindingifyTransformFilter(options.filter)
2621
+ };
2622
+ }
2623
+ function bindingifyLoad(args) {
2624
+ const hook = args.plugin.load;
2625
+ if (!hook) return {};
2626
+ const { handler, meta, options } = normalizeHook(hook);
2627
+ return {
2628
+ plugin: async (ctx, id$1) => {
2629
+ const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode, id$1), id$1);
2630
+ if (ret == null) return;
2631
+ if (typeof ret === "string") return { code: ret };
2632
+ let moduleOption = args.pluginContextData.updateModuleOption(id$1, {
2633
+ meta: ret.meta || {},
2634
+ moduleSideEffects: ret.moduleSideEffects ?? null,
2635
+ invalidate: false
2636
+ });
2637
+ let map = preProcessSourceMap(ret, id$1);
2638
+ return {
2639
+ code: ret.code,
2640
+ map: bindingifySourcemap(map),
2641
+ moduleType: ret.moduleType,
2642
+ sideEffects: bindingifySideEffects(moduleOption.moduleSideEffects)
2643
+ };
2644
+ },
2645
+ meta: bindingifyPluginHookMeta(meta),
2646
+ filter: bindingifyLoadFilter(options.filter)
2647
+ };
2648
+ }
2649
+ function preProcessSourceMap(ret, id$1) {
2650
+ if (!ret.map) return;
2651
+ let map = typeof ret.map === "object" ? ret.map : JSON.parse(ret.map);
2652
+ if (!isEmptySourcemapFiled(map.sources)) {
2653
+ const directory = path.dirname(id$1) || ".";
2654
+ const sourceRoot = map.sourceRoot || ".";
2655
+ map.sources = map.sources.map((source) => path.resolve(directory, sourceRoot, source));
2656
+ }
2657
+ return map;
2658
+ }
2659
+ function bindingifyModuleParsed(args) {
2660
+ const hook = args.plugin.moduleParsed;
2661
+ if (!hook) return {};
2662
+ const { handler, meta } = normalizeHook(hook);
2663
+ return {
2664
+ plugin: async (ctx, moduleInfo) => {
2665
+ 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)));
2666
+ },
2667
+ meta: bindingifyPluginHookMeta(meta)
2668
+ };
2669
+ }
2670
+ var init_bindingify_build_hooks = __esm({ "src/plugin/bindingify-build-hooks.ts"() {
2671
+ init_normalize_hook();
2672
+ init_plugin_context$1();
2673
+ init_normalized_input_options();
2674
+ init_sourcemap();
2675
+ init_error();
2676
+ init_transform_module_info();
2677
+ init_transform_side_effects();
2678
+ init_transform_sourcemap();
2679
+ init_bindingify_hook_filter();
2680
+ init_bindingify_plugin_hook_meta();
2681
+ init_plugin_context();
2682
+ init_transform_plugin_context();
2683
+ } });
2684
+
2685
+ //#endregion
2686
+ //#region src/utils/transform-rendered-module.ts
2687
+ function transformToRenderedModule(bindingRenderedModule) {
2688
+ return {
2689
+ get code() {
2690
+ return bindingRenderedModule.code;
2691
+ },
2692
+ get renderedLength() {
2693
+ return bindingRenderedModule.code?.length || 0;
2694
+ },
2695
+ get renderedExports() {
2696
+ return bindingRenderedModule.renderedExports;
2697
+ }
2698
+ };
2699
+ }
2700
+ var init_transform_rendered_module = __esm({ "src/utils/transform-rendered-module.ts"() {} });
2701
+
2702
+ //#endregion
2703
+ //#region src/utils/transform-rendered-chunk.ts
2704
+ function transformRenderedChunk(chunk) {
2705
+ let modules = null;
2706
+ return {
2707
+ get name() {
2708
+ return chunk.name;
2709
+ },
2710
+ get isEntry() {
2711
+ return chunk.isEntry;
2712
+ },
2713
+ get isDynamicEntry() {
2714
+ return chunk.isDynamicEntry;
2715
+ },
2716
+ get facadeModuleId() {
2717
+ return chunk.facadeModuleId;
2718
+ },
2719
+ get moduleIds() {
2720
+ return chunk.moduleIds;
2721
+ },
2722
+ get exports() {
2723
+ return chunk.exports;
2724
+ },
2725
+ get fileName() {
2726
+ return chunk.fileName;
2727
+ },
2728
+ get imports() {
2729
+ return chunk.imports;
2730
+ },
2731
+ get dynamicImports() {
2732
+ return chunk.dynamicImports;
2733
+ },
2734
+ get modules() {
2735
+ if (!modules) modules = transformChunkModules(chunk.modules);
2736
+ return modules;
2737
+ }
2738
+ };
2739
+ }
2740
+ function transformChunkModules(modules) {
2741
+ const result = {};
2742
+ for (let i$22 = 0; i$22 < modules.values.length; i$22++) {
2743
+ let key = modules.keys[i$22];
2744
+ const mod = modules.values[i$22];
2745
+ result[key] = transformToRenderedModule(mod);
2746
+ }
2747
+ return result;
2748
+ }
2749
+ var init_transform_rendered_chunk = __esm({ "src/utils/transform-rendered-chunk.ts"() {
2750
+ init_transform_rendered_module();
2751
+ } });
2752
+
2753
+ //#endregion
2754
+ //#region src/utils/bindingify-output-options.ts
2755
+ function bindingifyOutputOptions(outputOptions) {
2756
+ const { dir, format, exports, hashCharacters, sourcemap, sourcemapDebugIds, sourcemapIgnoreList, sourcemapPathTransform, name, assetFileNames, entryFileNames, chunkFileNames, cssEntryFileNames, cssChunkFileNames, banner, footer, intro, outro, esModule, globals, file, sanitizeFileName } = outputOptions;
2757
+ return {
2758
+ dir,
2759
+ file: file == null ? void 0 : file,
2760
+ format: bindingifyFormat(format),
2761
+ exports,
2762
+ hashCharacters,
2763
+ sourcemap: bindingifySourcemap$1(sourcemap),
2764
+ sourcemapDebugIds,
2765
+ sourcemapIgnoreList: bindingifySourcemapIgnoreList(sourcemapIgnoreList),
2766
+ sourcemapPathTransform,
2767
+ banner: bindingifyAddon(banner),
2768
+ footer: bindingifyAddon(footer),
2769
+ intro: bindingifyAddon(intro),
2770
+ outro: bindingifyAddon(outro),
2771
+ extend: outputOptions.extend,
2772
+ globals,
2773
+ esModule,
2774
+ name,
2775
+ assetFileNames: bindingifyAssetFilenames(assetFileNames),
2776
+ entryFileNames,
2777
+ chunkFileNames,
2778
+ cssEntryFileNames,
2779
+ cssChunkFileNames,
2780
+ plugins: [],
2781
+ minify: outputOptions.minify,
2782
+ externalLiveBindings: outputOptions.externalLiveBindings,
2783
+ inlineDynamicImports: outputOptions.inlineDynamicImports,
2784
+ advancedChunks: outputOptions.advancedChunks,
2785
+ polyfillRequire: outputOptions.polyfillRequire,
2786
+ target: outputOptions.target,
2787
+ sanitizeFileName
2788
+ };
2789
+ }
2790
+ function bindingifyAddon(configAddon) {
2791
+ return async (chunk) => {
2792
+ if (typeof configAddon === "function") return configAddon(transformRenderedChunk(chunk));
2793
+ return configAddon || "";
2794
+ };
2795
+ }
2796
+ function bindingifyFormat(format) {
2797
+ switch (format) {
2798
+ case void 0:
2799
+ case "es":
2800
+ case "esm":
2801
+ case "module": return "es";
2802
+ case "cjs":
2803
+ case "commonjs": return "cjs";
2804
+ case "iife": return "iife";
2805
+ case "umd": return "umd";
2806
+ case "experimental-app": return "app";
2807
+ default: unimplemented(`output.format: ${format}`);
2808
+ }
2809
+ }
2810
+ function bindingifySourcemap$1(sourcemap) {
2811
+ switch (sourcemap) {
2812
+ case true: return "file";
2813
+ case "inline": return "inline";
2814
+ case false:
2815
+ case void 0: return void 0;
2816
+ case "hidden": return "hidden";
2817
+ default: throw new Error(`unknown sourcemap: ${sourcemap}`);
2818
+ }
2819
+ }
2820
+ function bindingifySourcemapIgnoreList(sourcemapIgnoreList) {
2821
+ return typeof sourcemapIgnoreList === "function" ? sourcemapIgnoreList : sourcemapIgnoreList === false ? () => false : (relativeSourcePath, _sourcemapPath) => relativeSourcePath.includes("node_modules");
2822
+ }
2823
+ function bindingifyAssetFilenames(assetFileNames) {
2824
+ if (typeof assetFileNames === "function") return (asset) => {
2825
+ return assetFileNames({
2826
+ names: asset.names,
2827
+ originalFileNames: asset.originalFileNames,
2828
+ source: transformAssetSource(asset.source),
2829
+ type: "asset"
2830
+ });
2831
+ };
2832
+ return assetFileNames;
2833
+ }
2834
+ var init_bindingify_output_options = __esm({ "src/utils/bindingify-output-options.ts"() {
2835
+ init_asset_source();
2836
+ init_misc();
2837
+ init_transform_rendered_chunk();
2838
+ } });
2839
+
2840
+ //#endregion
2841
+ //#region src/options/normalized-output-options.ts
2842
+ function normalizeAddon(value) {
2843
+ if (typeof value === "function") return value;
2844
+ return () => value || "";
2845
+ }
2846
+ var NormalizedOutputOptionsImpl;
2847
+ var init_normalized_output_options = __esm({ "src/options/normalized-output-options.ts"() {
2848
+ init_bindingify_output_options();
2849
+ NormalizedOutputOptionsImpl = class {
2850
+ constructor(inner, outputOptions, normalizedOutputPlugins) {
2851
+ this.inner = inner;
2852
+ this.outputOptions = outputOptions;
2853
+ this.normalizedOutputPlugins = normalizedOutputPlugins;
2854
+ }
2855
+ get dir() {
2856
+ return this.inner.dir ?? void 0;
2857
+ }
2858
+ get entryFileNames() {
2859
+ return this.inner.entryFilenames || this.outputOptions.entryFileNames;
2860
+ }
2861
+ get chunkFileNames() {
2862
+ return this.inner.chunkFilenames || this.outputOptions.chunkFileNames;
2863
+ }
2864
+ get assetFileNames() {
2865
+ return this.inner.assetFilenames || this.outputOptions.assetFileNames;
2866
+ }
2867
+ get format() {
2868
+ return this.inner.format;
2869
+ }
2870
+ get exports() {
2871
+ return this.inner.exports;
2872
+ }
2873
+ get sourcemap() {
2874
+ return this.inner.sourcemap;
2875
+ }
2876
+ get cssEntryFileNames() {
2877
+ return this.inner.cssEntryFilenames || this.outputOptions.cssEntryFileNames;
2878
+ }
2879
+ get cssChunkFileNames() {
2880
+ return this.inner.cssChunkFilenames || this.outputOptions.cssChunkFileNames;
2881
+ }
2882
+ get shimMissingExports() {
2883
+ return this.inner.shimMissingExports;
2884
+ }
2885
+ get name() {
2886
+ return this.inner.name ?? void 0;
2887
+ }
2888
+ get file() {
2889
+ return this.inner.file ?? void 0;
2890
+ }
2891
+ get inlineDynamicImports() {
2892
+ return this.inner.inlineDynamicImports;
2893
+ }
2894
+ get externalLiveBindings() {
2895
+ return this.inner.externalLiveBindings;
2896
+ }
2897
+ get banner() {
2898
+ return normalizeAddon(this.outputOptions.banner);
2899
+ }
2900
+ get footer() {
2901
+ return normalizeAddon(this.outputOptions.footer);
2902
+ }
2903
+ get intro() {
2904
+ return normalizeAddon(this.outputOptions.intro);
2905
+ }
2906
+ get outro() {
2907
+ return normalizeAddon(this.outputOptions.outro);
2908
+ }
2909
+ get esModule() {
2910
+ return this.inner.esModule;
2911
+ }
2912
+ get extend() {
2913
+ return this.inner.extend;
2914
+ }
2915
+ get globals() {
2916
+ return this.inner.globals || this.outputOptions.globals;
2917
+ }
2918
+ get hashCharacters() {
2919
+ return this.inner.hashCharacters;
2920
+ }
2921
+ get sourcemapDebugIds() {
2922
+ return this.inner.sourcemapDebugIds;
2923
+ }
2924
+ get sourcemapIgnoreList() {
2925
+ return bindingifySourcemapIgnoreList(this.outputOptions.sourcemapIgnoreList);
2926
+ }
2927
+ get sourcemapPathTransform() {
2928
+ return this.outputOptions.sourcemapPathTransform;
2929
+ }
2930
+ get minify() {
2931
+ return this.inner.minify;
2932
+ }
2933
+ get comments() {
2934
+ return this.inner.comments;
2935
+ }
2936
+ get polyfillRequire() {
2937
+ return this.inner.polyfillRequire;
2938
+ }
2939
+ get plugins() {
2940
+ return this.normalizedOutputPlugins;
2941
+ }
2942
+ };
2943
+ } });
2944
+
2945
+ //#endregion
2946
+ //#region src/utils/transform-to-rollup-output.ts
2947
+ function transformToRollupSourceMap(map) {
2948
+ const parsed = JSON.parse(map);
2949
+ const obj = {
2950
+ ...parsed,
2951
+ toString() {
2952
+ return JSON.stringify(obj);
2953
+ },
2954
+ toUrl() {
2955
+ return `data:application/json;charset=utf-8;base64,${Buffer.from(obj.toString(), "utf-8").toString("base64")}`;
2956
+ }
2957
+ };
2958
+ return obj;
2959
+ }
2960
+ function transformToRollupOutputChunk(bindingChunk, changed) {
2961
+ const chunk = {
2962
+ type: "chunk",
2963
+ get code() {
2964
+ return bindingChunk.code;
2965
+ },
2966
+ fileName: bindingChunk.fileName,
2967
+ name: bindingChunk.name,
2968
+ get modules() {
2969
+ return transformChunkModules(bindingChunk.modules);
2970
+ },
2971
+ get imports() {
2972
+ return bindingChunk.imports;
2973
+ },
2974
+ get dynamicImports() {
2975
+ return bindingChunk.dynamicImports;
2976
+ },
2977
+ exports: bindingChunk.exports,
2978
+ isEntry: bindingChunk.isEntry,
2979
+ facadeModuleId: bindingChunk.facadeModuleId || null,
2980
+ isDynamicEntry: bindingChunk.isDynamicEntry,
2981
+ get moduleIds() {
2982
+ return bindingChunk.moduleIds;
2983
+ },
2984
+ get map() {
2985
+ return bindingChunk.map ? transformToRollupSourceMap(bindingChunk.map) : null;
2986
+ },
2987
+ sourcemapFileName: bindingChunk.sourcemapFileName || null,
2988
+ preliminaryFileName: bindingChunk.preliminaryFileName
2989
+ };
2990
+ const cache = {};
2991
+ return new Proxy(chunk, {
2992
+ get(target, p$3) {
2993
+ if (p$3 in cache) return cache[p$3];
2994
+ const value = target[p$3];
2995
+ cache[p$3] = value;
2996
+ return value;
2997
+ },
2998
+ set(target, p$3, newValue) {
2999
+ cache[p$3] = newValue;
3000
+ changed?.updated.add(bindingChunk.fileName);
3001
+ return true;
3002
+ },
3003
+ has(target, p$3) {
3004
+ if (p$3 in cache) return true;
3005
+ return p$3 in target;
3006
+ }
3007
+ });
3008
+ }
3009
+ function transformToRollupOutputAsset(bindingAsset, changed) {
3010
+ const asset = {
3011
+ type: "asset",
3012
+ fileName: bindingAsset.fileName,
3013
+ originalFileName: bindingAsset.originalFileName || null,
3014
+ originalFileNames: bindingAsset.originalFileNames,
3015
+ get source() {
3016
+ return transformAssetSource(bindingAsset.source);
3017
+ },
3018
+ name: bindingAsset.name ?? void 0,
3019
+ names: bindingAsset.names
3020
+ };
3021
+ const cache = {};
3022
+ return new Proxy(asset, {
3023
+ get(target, p$3) {
3024
+ if (p$3 in cache) return cache[p$3];
3025
+ const value = target[p$3];
3026
+ cache[p$3] = value;
3027
+ return value;
3028
+ },
3029
+ set(target, p$3, newValue) {
3030
+ cache[p$3] = newValue;
3031
+ changed?.updated.add(bindingAsset.fileName);
3032
+ return true;
3033
+ }
3034
+ });
3035
+ }
3036
+ function transformToRollupOutput(output, changed) {
3037
+ handleOutputErrors(output);
3038
+ const { chunks, assets } = output;
3039
+ return { output: [...chunks.map((chunk) => transformToRollupOutputChunk(chunk, changed)), ...assets.map((asset) => transformToRollupOutputAsset(asset, changed))] };
3040
+ }
3041
+ function handleOutputErrors(output) {
3042
+ const rawErrors = output.errors;
3043
+ if (rawErrors.length > 0) throw normalizeErrors(rawErrors);
3044
+ }
3045
+ function transformToOutputBundle(output, changed) {
3046
+ const bundle = Object.fromEntries(transformToRollupOutput(output, changed).output.map((item) => [item.fileName, item]));
3047
+ return new Proxy(bundle, { deleteProperty(target, property) {
3048
+ if (typeof property === "string") changed.deleted.add(property);
3049
+ return true;
3050
+ } });
3051
+ }
3052
+ function collectChangedBundle(changed, bundle) {
3053
+ const assets = [];
3054
+ const chunks = [];
3055
+ for (const key in bundle) {
3056
+ if (changed.deleted.has(key) || !changed.updated.has(key)) continue;
3057
+ const item = bundle[key];
3058
+ if (item.type === "asset") assets.push({
3059
+ filename: item.fileName,
3060
+ originalFileNames: item.originalFileNames,
3061
+ source: bindingAssetSource(item.source),
3062
+ names: item.names
3063
+ });
3064
+ else chunks.push({
3065
+ code: item.code,
3066
+ filename: item.fileName,
3067
+ name: item.name,
3068
+ isEntry: item.isEntry,
3069
+ exports: item.exports,
3070
+ modules: {},
3071
+ imports: item.imports,
3072
+ dynamicImports: item.dynamicImports,
3073
+ facadeModuleId: item.facadeModuleId || void 0,
3074
+ isDynamicEntry: item.isDynamicEntry,
3075
+ moduleIds: item.moduleIds,
3076
+ map: bindingifySourcemap(item.map),
3077
+ sourcemapFilename: item.sourcemapFileName || void 0,
3078
+ preliminaryFilename: item.preliminaryFileName
3079
+ });
3080
+ }
3081
+ return {
3082
+ assets,
3083
+ chunks,
3084
+ deleted: Array.from(changed.deleted)
3085
+ };
3086
+ }
3087
+ var init_transform_to_rollup_output = __esm({ "src/utils/transform-to-rollup-output.ts"() {
3088
+ init_sourcemap();
3089
+ init_asset_source();
3090
+ init_error();
3091
+ init_transform_rendered_chunk();
3092
+ } });
3093
+
3094
+ //#endregion
3095
+ //#region src/plugin/bindingify-output-hooks.ts
3096
+ function bindingifyRenderStart(args) {
3097
+ const hook = args.plugin.renderStart;
3098
+ if (!hook) return {};
3099
+ const { handler, meta } = normalizeHook(hook);
3100
+ return {
3101
+ plugin: async (ctx, opts) => {
3102
+ 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));
3103
+ },
3104
+ meta: bindingifyPluginHookMeta(meta)
3105
+ };
3106
+ }
3107
+ function bindingifyRenderChunk(args) {
3108
+ const hook = args.plugin.renderChunk;
3109
+ if (!hook) return {};
3110
+ const { handler, meta, options } = normalizeHook(hook);
3111
+ return {
3112
+ plugin: async (ctx, code$1, chunk, opts, meta$1) => {
3113
+ if (args.pluginContextData.getRenderChunkMeta() == null) args.pluginContextData.setRenderChunkMeta({ chunks: Object.fromEntries(Object.entries(meta$1.chunks).map(([key, value]) => [key, transformRenderedChunk(value)])) });
3114
+ 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());
3115
+ if (ret == null) return;
3116
+ if (typeof ret === "string") return { code: ret };
3117
+ if (!ret.map) return { code: ret.code };
3118
+ return {
3119
+ code: ret.code,
3120
+ map: bindingifySourcemap(ret.map)
3121
+ };
3122
+ },
3123
+ meta: bindingifyPluginHookMeta(meta),
3124
+ filter: bindingifyRenderChunkFilter(options.filter)
3125
+ };
3126
+ }
3127
+ function bindingifyAugmentChunkHash(args) {
3128
+ const hook = args.plugin.augmentChunkHash;
3129
+ if (!hook) return {};
3130
+ const { handler, meta } = normalizeHook(hook);
3131
+ return {
3132
+ plugin: async (ctx, chunk) => {
3133
+ return await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
3134
+ },
3135
+ meta: bindingifyPluginHookMeta(meta)
3136
+ };
3137
+ }
3138
+ function bindingifyRenderError(args) {
3139
+ const hook = args.plugin.renderError;
3140
+ if (!hook) return {};
3141
+ const { handler, meta } = normalizeHook(hook);
3142
+ return {
3143
+ plugin: async (ctx, err) => {
3144
+ handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), normalizeErrors(err));
3145
+ },
3146
+ meta: bindingifyPluginHookMeta(meta)
3147
+ };
3148
+ }
3149
+ function bindingifyGenerateBundle(args) {
3150
+ const hook = args.plugin.generateBundle;
3151
+ if (!hook) return {};
3152
+ const { handler, meta } = normalizeHook(hook);
3153
+ return {
3154
+ plugin: async (ctx, bundle, isWrite, opts) => {
3155
+ const changed = {
3156
+ updated: new Set(),
3157
+ deleted: new Set()
3158
+ };
3159
+ const output = transformToOutputBundle(bundle, changed);
3160
+ 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);
3161
+ return collectChangedBundle(changed, output);
3162
+ },
3163
+ meta: bindingifyPluginHookMeta(meta)
3164
+ };
3165
+ }
3166
+ function bindingifyWriteBundle(args) {
3167
+ const hook = args.plugin.writeBundle;
3168
+ if (!hook) return {};
3169
+ const { handler, meta } = normalizeHook(hook);
3170
+ return {
3171
+ plugin: async (ctx, bundle, opts) => {
3172
+ const changed = {
3173
+ updated: new Set(),
3174
+ deleted: new Set()
3175
+ };
3176
+ const output = transformToOutputBundle(bundle, changed);
3177
+ 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);
3178
+ return collectChangedBundle(changed, output);
3179
+ },
3180
+ meta: bindingifyPluginHookMeta(meta)
3181
+ };
3182
+ }
3183
+ function bindingifyCloseBundle(args) {
3184
+ const hook = args.plugin.closeBundle;
3185
+ if (!hook) return {};
3186
+ const { handler, meta } = normalizeHook(hook);
3187
+ return {
3188
+ plugin: async (ctx) => {
3189
+ await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode));
3190
+ },
3191
+ meta: bindingifyPluginHookMeta(meta)
3192
+ };
3193
+ }
3194
+ function bindingifyBanner(args) {
3195
+ const hook = args.plugin.banner;
3196
+ if (!hook) return {};
3197
+ const { handler, meta } = normalizeHook(hook);
3198
+ return {
3199
+ plugin: async (ctx, chunk) => {
3200
+ if (typeof handler === "string") return handler;
3201
+ return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
3202
+ },
3203
+ meta: bindingifyPluginHookMeta(meta)
3204
+ };
3205
+ }
3206
+ function bindingifyFooter(args) {
3207
+ const hook = args.plugin.footer;
3208
+ if (!hook) return {};
3209
+ const { handler, meta } = normalizeHook(hook);
3210
+ return {
3211
+ plugin: async (ctx, chunk) => {
3212
+ if (typeof handler === "string") return handler;
3213
+ return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
3214
+ },
3215
+ meta: bindingifyPluginHookMeta(meta)
3216
+ };
3217
+ }
3218
+ function bindingifyIntro(args) {
3219
+ const hook = args.plugin.intro;
3220
+ if (!hook) return {};
3221
+ const { handler, meta } = normalizeHook(hook);
3222
+ return {
3223
+ plugin: async (ctx, chunk) => {
3224
+ if (typeof handler === "string") return handler;
3225
+ return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
3226
+ },
3227
+ meta: bindingifyPluginHookMeta(meta)
3228
+ };
3229
+ }
3230
+ function bindingifyOutro(args) {
3231
+ const hook = args.plugin.outro;
3232
+ if (!hook) return {};
3233
+ const { handler, meta } = normalizeHook(hook);
3234
+ return {
3235
+ plugin: async (ctx, chunk) => {
3236
+ if (typeof handler === "string") return handler;
3237
+ return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
3238
+ },
3239
+ meta: bindingifyPluginHookMeta(meta)
3240
+ };
3241
+ }
3242
+ var init_bindingify_output_hooks = __esm({ "src/plugin/bindingify-output-hooks.ts"() {
3243
+ init_normalized_input_options();
3244
+ init_normalized_output_options();
3245
+ init_sourcemap();
3246
+ init_error();
3247
+ init_normalize_hook();
3248
+ init_transform_rendered_chunk();
3249
+ init_transform_to_rollup_output();
3250
+ init_bindingify_hook_filter();
3251
+ init_bindingify_plugin_hook_meta();
3252
+ init_plugin_context();
3253
+ } });
3254
+
3255
+ //#endregion
3256
+ //#region src/plugin/bindingify-watch-hooks.ts
3257
+ function bindingifyWatchChange(args) {
3258
+ const hook = args.plugin.watchChange;
3259
+ if (!hook) return {};
3260
+ const { handler, meta } = normalizeHook(hook);
3261
+ return {
3262
+ plugin: async (ctx, id$1, event) => {
3263
+ await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), id$1, { event });
3264
+ },
3265
+ meta: bindingifyPluginHookMeta(meta)
3266
+ };
3267
+ }
3268
+ function bindingifyCloseWatcher(args) {
3269
+ const hook = args.plugin.closeWatcher;
3270
+ if (!hook) return {};
3271
+ const { handler, meta } = normalizeHook(hook);
3272
+ return {
3273
+ plugin: async (ctx) => {
3274
+ await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode));
3275
+ },
3276
+ meta: bindingifyPluginHookMeta(meta)
3277
+ };
3278
+ }
3279
+ var init_bindingify_watch_hooks = __esm({ "src/plugin/bindingify-watch-hooks.ts"() {
3280
+ init_normalize_hook();
3281
+ init_bindingify_plugin_hook_meta();
3282
+ init_plugin_context();
3283
+ } });
3284
+
3285
+ //#endregion
3286
+ //#region src/plugin/generated/hook-usage.ts
3287
+ function extractHookUsage(plugin) {
3288
+ let hookUsage = new HookUsage();
3289
+ if (plugin.buildStart) hookUsage.union(HookUsageKind.buildStart);
3290
+ if (plugin.resolveId) hookUsage.union(HookUsageKind.resolveId);
3291
+ if (plugin.resolveDynamicImport) hookUsage.union(HookUsageKind.resolveDynamicImport);
3292
+ if (plugin.load) hookUsage.union(HookUsageKind.load);
3293
+ if (plugin.transform) hookUsage.union(HookUsageKind.transform);
3294
+ if (plugin.moduleParsed) hookUsage.union(HookUsageKind.moduleParsed);
3295
+ if (plugin.buildEnd) hookUsage.union(HookUsageKind.buildEnd);
3296
+ if (plugin.renderStart) hookUsage.union(HookUsageKind.renderStart);
3297
+ if (plugin.renderError) hookUsage.union(HookUsageKind.renderError);
3298
+ if (plugin.renderChunk) hookUsage.union(HookUsageKind.renderChunk);
3299
+ if (plugin.augmentChunkHash) hookUsage.union(HookUsageKind.augmentChunkHash);
3300
+ if (plugin.generateBundle) hookUsage.union(HookUsageKind.generateBundle);
3301
+ if (plugin.writeBundle) hookUsage.union(HookUsageKind.writeBundle);
3302
+ if (plugin.closeBundle) hookUsage.union(HookUsageKind.closeBundle);
3303
+ if (plugin.watchChange) hookUsage.union(HookUsageKind.watchChange);
3304
+ if (plugin.closeWatcher) hookUsage.union(HookUsageKind.closeWatcher);
3305
+ if (plugin.banner) hookUsage.union(HookUsageKind.banner);
3306
+ if (plugin.footer) hookUsage.union(HookUsageKind.footer);
3307
+ if (plugin.intro) hookUsage.union(HookUsageKind.intro);
3308
+ if (plugin.outro) hookUsage.union(HookUsageKind.outro);
3309
+ return hookUsage;
3310
+ }
3311
+ var HookUsageKind, HookUsage;
3312
+ var init_hook_usage = __esm({ "src/plugin/generated/hook-usage.ts"() {
3313
+ HookUsageKind = /* @__PURE__ */ function(HookUsageKind$1) {
3314
+ HookUsageKind$1[HookUsageKind$1["buildStart"] = 1] = "buildStart";
3315
+ HookUsageKind$1[HookUsageKind$1["resolveId"] = 2] = "resolveId";
3316
+ HookUsageKind$1[HookUsageKind$1["resolveDynamicImport"] = 4] = "resolveDynamicImport";
3317
+ HookUsageKind$1[HookUsageKind$1["load"] = 8] = "load";
3318
+ HookUsageKind$1[HookUsageKind$1["transform"] = 16] = "transform";
3319
+ HookUsageKind$1[HookUsageKind$1["moduleParsed"] = 32] = "moduleParsed";
3320
+ HookUsageKind$1[HookUsageKind$1["buildEnd"] = 64] = "buildEnd";
3321
+ HookUsageKind$1[HookUsageKind$1["renderStart"] = 128] = "renderStart";
3322
+ HookUsageKind$1[HookUsageKind$1["renderError"] = 256] = "renderError";
3323
+ HookUsageKind$1[HookUsageKind$1["renderChunk"] = 512] = "renderChunk";
3324
+ HookUsageKind$1[HookUsageKind$1["augmentChunkHash"] = 1024] = "augmentChunkHash";
3325
+ HookUsageKind$1[HookUsageKind$1["generateBundle"] = 2048] = "generateBundle";
3326
+ HookUsageKind$1[HookUsageKind$1["writeBundle"] = 4096] = "writeBundle";
3327
+ HookUsageKind$1[HookUsageKind$1["closeBundle"] = 8192] = "closeBundle";
3328
+ HookUsageKind$1[HookUsageKind$1["watchChange"] = 16384] = "watchChange";
3329
+ HookUsageKind$1[HookUsageKind$1["closeWatcher"] = 32768] = "closeWatcher";
3330
+ HookUsageKind$1[HookUsageKind$1["transformAst"] = 65536] = "transformAst";
3331
+ HookUsageKind$1[HookUsageKind$1["banner"] = 131072] = "banner";
3332
+ HookUsageKind$1[HookUsageKind$1["footer"] = 262144] = "footer";
3333
+ HookUsageKind$1[HookUsageKind$1["intro"] = 524288] = "intro";
3334
+ HookUsageKind$1[HookUsageKind$1["outro"] = 1048576] = "outro";
3335
+ return HookUsageKind$1;
3336
+ }({});
3337
+ HookUsage = class {
3338
+ bitflag = BigInt(0);
3339
+ constructor() {}
3340
+ union(kind) {
3341
+ this.bitflag |= BigInt(kind);
3342
+ }
3343
+ inner() {
3344
+ return Number(this.bitflag);
3345
+ }
3346
+ };
3347
+ } });
3348
+
3349
+ //#endregion
3350
+ //#region src/plugin/bindingify-plugin.ts
3351
+ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode) {
3352
+ const args = {
3353
+ plugin,
3354
+ options,
3355
+ outputOptions,
3356
+ pluginContextData,
3357
+ onLog,
3358
+ logLevel,
3359
+ watchMode,
3360
+ normalizedOutputPlugins
3361
+ };
3362
+ const { plugin: buildStart, meta: buildStartMeta } = bindingifyBuildStart(args);
3363
+ const { plugin: resolveId, meta: resolveIdMeta, filter: resolveIdFilter } = bindingifyResolveId(args);
3364
+ const { plugin: resolveDynamicImport, meta: resolveDynamicImportMeta } = bindingifyResolveDynamicImport(args);
3365
+ const { plugin: buildEnd, meta: buildEndMeta } = bindingifyBuildEnd(args);
3366
+ const { plugin: transform, meta: transformMeta, filter: transformFilter } = bindingifyTransform(args);
3367
+ const { plugin: moduleParsed, meta: moduleParsedMeta } = bindingifyModuleParsed(args);
3368
+ const { plugin: load, meta: loadMeta, filter: loadFilter } = bindingifyLoad(args);
3369
+ const { plugin: renderChunk, meta: renderChunkMeta, filter: renderChunkFilter } = bindingifyRenderChunk(args);
3370
+ const { plugin: augmentChunkHash, meta: augmentChunkHashMeta } = bindingifyAugmentChunkHash(args);
3371
+ const { plugin: renderStart, meta: renderStartMeta } = bindingifyRenderStart(args);
3372
+ const { plugin: renderError, meta: renderErrorMeta } = bindingifyRenderError(args);
3373
+ const { plugin: generateBundle, meta: generateBundleMeta } = bindingifyGenerateBundle(args);
3374
+ const { plugin: writeBundle, meta: writeBundleMeta } = bindingifyWriteBundle(args);
3375
+ const { plugin: closeBundle, meta: closeBundleMeta } = bindingifyCloseBundle(args);
3376
+ const { plugin: banner, meta: bannerMeta } = bindingifyBanner(args);
3377
+ const { plugin: footer, meta: footerMeta } = bindingifyFooter(args);
3378
+ const { plugin: intro, meta: introMeta } = bindingifyIntro(args);
3379
+ const { plugin: outro, meta: outroMeta } = bindingifyOutro(args);
3380
+ const { plugin: watchChange, meta: watchChangeMeta } = bindingifyWatchChange(args);
3381
+ const { plugin: closeWatcher, meta: closeWatcherMeta } = bindingifyCloseWatcher(args);
3382
+ let hookUsage = extractHookUsage(plugin).inner();
3383
+ const result = {
3384
+ name: plugin.name,
3385
+ buildStart,
3386
+ buildStartMeta,
3387
+ resolveId,
3388
+ resolveIdMeta,
3389
+ resolveIdFilter,
3390
+ resolveDynamicImport,
3391
+ resolveDynamicImportMeta,
3392
+ buildEnd,
3393
+ buildEndMeta,
3394
+ transform,
3395
+ transformMeta,
3396
+ transformFilter,
3397
+ moduleParsed,
3398
+ moduleParsedMeta,
3399
+ load,
3400
+ loadMeta,
3401
+ loadFilter,
3402
+ renderChunk,
3403
+ renderChunkMeta,
3404
+ renderChunkFilter,
3405
+ augmentChunkHash,
3406
+ augmentChunkHashMeta,
3407
+ renderStart,
3408
+ renderStartMeta,
3409
+ renderError,
3410
+ renderErrorMeta,
3411
+ generateBundle,
3412
+ generateBundleMeta,
3413
+ writeBundle,
3414
+ writeBundleMeta,
3415
+ closeBundle,
3416
+ closeBundleMeta,
3417
+ banner,
3418
+ bannerMeta,
3419
+ footer,
3420
+ footerMeta,
3421
+ intro,
3422
+ introMeta,
3423
+ outro,
3424
+ outroMeta,
3425
+ watchChange,
3426
+ watchChangeMeta,
3427
+ closeWatcher,
3428
+ closeWatcherMeta,
3429
+ hookUsage
3430
+ };
3431
+ return wrapHandlers(result);
3432
+ }
3433
+ function wrapHandlers(plugin) {
3434
+ for (const hookName of [
3435
+ "buildStart",
3436
+ "resolveId",
3437
+ "resolveDynamicImport",
3438
+ "buildEnd",
3439
+ "transform",
3440
+ "moduleParsed",
3441
+ "load",
3442
+ "renderChunk",
3443
+ "augmentChunkHash",
3444
+ "renderStart",
3445
+ "renderError",
3446
+ "generateBundle",
3447
+ "writeBundle",
3448
+ "closeBundle",
3449
+ "banner",
3450
+ "footer",
3451
+ "intro",
3452
+ "outro",
3453
+ "watchChange",
3454
+ "closeWatcher"
3455
+ ]) {
3456
+ const handler = plugin[hookName];
3457
+ if (handler) plugin[hookName] = async (...args) => {
3458
+ try {
3459
+ return await handler(...args);
3460
+ } catch (e$5) {
3461
+ return error(logPluginError(e$5, plugin.name, {
3462
+ hook: hookName,
3463
+ id: hookName === "transform" ? args[2] : void 0
3464
+ }));
3465
+ }
3466
+ };
3467
+ }
3468
+ return plugin;
3469
+ }
3470
+ var init_bindingify_plugin = __esm({ "src/plugin/bindingify-plugin.ts"() {
3471
+ init_bindingify_build_hooks();
3472
+ init_bindingify_output_hooks();
3473
+ init_logs();
3474
+ init_bindingify_watch_hooks();
3475
+ init_hook_usage();
3476
+ } });
3477
+
3478
+ //#endregion
3479
+ //#region src/plugin/plugin-context-data.ts
3480
+ var PluginContextData;
3481
+ var init_plugin_context_data = __esm({ "src/plugin/plugin-context-data.ts"() {
3482
+ init_transform_module_info();
3483
+ PluginContextData = class {
3484
+ moduleOptionMap = new Map();
3485
+ resolveOptionsMap = new Map();
3486
+ loadModulePromiseMap = new Map();
3487
+ loadModulePromiseResolveFnMap = new Map();
3488
+ renderedChunkMeta = null;
3489
+ updateModuleOption(id$1, option) {
3490
+ const existing = this.moduleOptionMap.get(id$1);
3491
+ if (existing) {
3492
+ if (option.moduleSideEffects != null) existing.moduleSideEffects = option.moduleSideEffects;
3493
+ if (option.meta != null) Object.assign(existing.meta, option.meta);
3494
+ if (option.invalidate != null) existing.invalidate = option.invalidate;
3495
+ } else {
3496
+ this.moduleOptionMap.set(id$1, option);
3497
+ return option;
3498
+ }
3499
+ return existing;
3500
+ }
3501
+ getModuleOption(id$1) {
3502
+ const option = this.moduleOptionMap.get(id$1);
3503
+ if (!option) {
3504
+ const raw = {
3505
+ moduleSideEffects: null,
3506
+ meta: {}
3507
+ };
3508
+ this.moduleOptionMap.set(id$1, raw);
3509
+ return raw;
3510
+ }
3511
+ return option;
3512
+ }
3513
+ getModuleInfo(id$1, context) {
3514
+ const bindingInfo = context.getModuleInfo(id$1);
3515
+ if (bindingInfo) {
3516
+ const info = transformModuleInfo(bindingInfo, this.getModuleOption(id$1));
3517
+ return this.proxyModuleInfo(id$1, info);
3518
+ }
3519
+ return null;
3520
+ }
3521
+ proxyModuleInfo(id$1, info) {
3522
+ let moduleSideEffects = info.moduleSideEffects;
3523
+ Object.defineProperty(info, "moduleSideEffects", {
3524
+ get() {
3525
+ return moduleSideEffects;
3526
+ },
3527
+ set: (v$1) => {
3528
+ this.updateModuleOption(id$1, {
3529
+ moduleSideEffects: v$1,
3530
+ meta: info.meta,
3531
+ invalidate: true
3532
+ });
3533
+ moduleSideEffects = v$1;
3534
+ }
3535
+ });
3536
+ return info;
3537
+ }
3538
+ getModuleIds(context) {
3539
+ const moduleIds = context.getModuleIds();
3540
+ return moduleIds.values();
3541
+ }
3542
+ saveResolveOptions(options) {
3543
+ const index = this.resolveOptionsMap.size;
3544
+ this.resolveOptionsMap.set(index, options);
3545
+ return index;
3546
+ }
3547
+ getSavedResolveOptions(receipt) {
3548
+ return this.resolveOptionsMap.get(receipt);
3549
+ }
3550
+ removeSavedResolveOptions(receipt) {
3551
+ this.resolveOptionsMap.delete(receipt);
3552
+ }
3553
+ setRenderChunkMeta(meta) {
3554
+ this.renderedChunkMeta = meta;
3555
+ }
3556
+ getRenderChunkMeta() {
3557
+ return this.renderedChunkMeta;
3558
+ }
3559
+ markModuleLoaded(id$1, _success) {
3560
+ const resolve = this.loadModulePromiseResolveFnMap.get(id$1);
3561
+ if (resolve) resolve();
3562
+ }
3563
+ clear() {
3564
+ this.renderedChunkMeta = null;
3565
+ this.loadModulePromiseMap.clear();
3566
+ this.loadModulePromiseResolveFnMap.clear();
3567
+ }
3568
+ };
3569
+ } });
3570
+
3571
+ //#endregion
3572
+ //#region src/utils/normalize-string-or-regex.ts
3573
+ function normalizedStringOrRegex(pattern) {
3574
+ if (!pattern) return void 0;
3575
+ if (!isReadonlyArray(pattern)) return [pattern];
3576
+ return pattern;
3577
+ }
3578
+ function isReadonlyArray(input) {
3579
+ return Array.isArray(input);
3580
+ }
3581
+ var init_normalize_string_or_regex = __esm({ "src/utils/normalize-string-or-regex.ts"() {} });
3582
+
3583
+ //#endregion
3584
+ //#region src/utils/bindingify-input-options.ts
3585
+ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel, watchMode) {
3586
+ const pluginContextData = new PluginContextData();
3587
+ const plugins = rawPlugins.map((plugin) => {
3588
+ if ("_parallel" in plugin) return void 0;
3589
+ if (plugin instanceof BuiltinPlugin) return bindingifyBuiltInPlugin(plugin);
3590
+ return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode);
3591
+ });
3592
+ return {
3593
+ input: bindingifyInput(inputOptions.input),
3594
+ plugins,
3595
+ cwd: inputOptions.cwd ?? process.cwd(),
3596
+ external: bindingifyExternal(inputOptions.external),
3597
+ resolve: bindingifyResolve(inputOptions.resolve),
3598
+ platform: inputOptions.platform,
3599
+ shimMissingExports: inputOptions.shimMissingExports,
3600
+ logLevel: bindingifyLogLevel(logLevel),
3601
+ onLog,
3602
+ treeshake: bindingifyTreeshakeOptions(inputOptions.treeshake),
3603
+ moduleTypes: inputOptions.moduleTypes,
3604
+ define: inputOptions.define ? Object.entries(inputOptions.define) : void 0,
3605
+ inject: bindingifyInject(inputOptions.inject),
3606
+ experimental: {
3607
+ strictExecutionOrder: inputOptions.experimental?.strictExecutionOrder,
3608
+ disableLiveBindings: inputOptions.experimental?.disableLiveBindings,
3609
+ viteMode: inputOptions.experimental?.viteMode,
3610
+ resolveNewUrlToAsset: inputOptions.experimental?.resolveNewUrlToAsset,
3611
+ hmr: bindingifyHmr(inputOptions.experimental?.hmr)
3612
+ },
3613
+ profilerNames: inputOptions?.profilerNames,
3614
+ jsx: bindingifyJsx(inputOptions.jsx),
3615
+ transform: inputOptions.transform,
3616
+ watch: bindingifyWatch(inputOptions.watch),
3617
+ dropLabels: inputOptions.dropLabels,
3618
+ keepNames: inputOptions.keepNames,
3619
+ checks: inputOptions.checks,
3620
+ deferSyncScanData: () => {
3621
+ let ret = [];
3622
+ pluginContextData.moduleOptionMap.forEach((value, key) => {
3623
+ if (value.invalidate) ret.push({
3624
+ id: key,
3625
+ sideEffects: bindingifySideEffects(value.moduleSideEffects)
3626
+ });
3627
+ });
3628
+ return ret;
3629
+ },
3630
+ makeAbsoluteExternalsRelative: bindingifyMakeAbsoluteExternalsRelative(inputOptions.makeAbsoluteExternalsRelative),
3631
+ debug: inputOptions.debug,
3632
+ invalidateJsSideCache: pluginContextData.clear.bind(pluginContextData),
3633
+ markModuleLoaded: pluginContextData.markModuleLoaded.bind(pluginContextData)
3634
+ };
3635
+ }
3636
+ function bindingifyHmr(hmr) {
3637
+ if (hmr) {
3638
+ if (typeof hmr === "boolean") return hmr ? {} : void 0;
3639
+ return hmr;
3640
+ }
3641
+ }
3642
+ function bindingifyExternal(external) {
3643
+ if (external) {
3644
+ if (typeof external === "function") return (id$1, importer, isResolved) => {
3645
+ if (id$1.startsWith("\0")) return false;
3646
+ return external(id$1, importer, isResolved) ?? false;
3647
+ };
3648
+ const externalArr = arraify(external);
3649
+ return (id$1, _importer, _isResolved) => {
3650
+ return externalArr.some((pat) => {
3651
+ if (pat instanceof RegExp) return pat.test(id$1);
3652
+ return id$1 === pat;
3653
+ });
3654
+ };
3655
+ }
3656
+ }
3657
+ function bindingifyResolve(resolve) {
3658
+ if (resolve) {
3659
+ const { alias, extensionAlias,...rest } = resolve;
3660
+ return {
3661
+ alias: alias ? Object.entries(alias).map(([name, replacement]) => ({
3662
+ find: name,
3663
+ replacements: arraify(replacement)
3664
+ })) : void 0,
3665
+ extensionAlias: extensionAlias ? Object.entries(extensionAlias).map(([name, value]) => ({
3666
+ target: name,
3667
+ replacements: value
3668
+ })) : void 0,
3669
+ ...rest
3670
+ };
3671
+ }
3672
+ }
3673
+ function bindingifyInject(inject) {
3674
+ if (inject) return Object.entries(inject).map(([alias, item]) => {
3675
+ if (Array.isArray(item)) {
3676
+ if (item[1] === "*") return {
3677
+ tagNamespace: true,
3678
+ alias,
3679
+ from: item[0]
3680
+ };
3681
+ return {
3682
+ tagNamed: true,
3683
+ alias,
3684
+ from: item[0],
3685
+ imported: item[1]
3686
+ };
3687
+ } else return {
3688
+ tagNamed: true,
3689
+ imported: "default",
3690
+ alias,
3691
+ from: item
3692
+ };
3693
+ });
3694
+ }
3695
+ function bindingifyLogLevel(logLevel) {
3696
+ switch (logLevel) {
3697
+ case "silent": return BindingLogLevel.Silent;
3698
+ case "debug": return BindingLogLevel.Debug;
3699
+ case "warn": return BindingLogLevel.Warn;
3700
+ case "info": return BindingLogLevel.Info;
3701
+ default: throw new Error(`Unexpected log level: ${logLevel}`);
3702
+ }
3703
+ }
3704
+ function bindingifyInput(input) {
3705
+ if (input === void 0) return [];
3706
+ if (typeof input === "string") return [{ import: input }];
3707
+ if (Array.isArray(input)) return input.map((src) => ({ import: src }));
3708
+ return Object.entries(input).map(([name, import_path]) => {
3709
+ return {
3710
+ name,
3711
+ import: import_path
3712
+ };
3713
+ });
3714
+ }
3715
+ function bindingifyJsx(input) {
3716
+ switch (input) {
3717
+ case false: return { type: "Disable" };
3718
+ case "react": return { type: "React" };
3719
+ case "react-jsx": return { type: "ReactJsx" };
3720
+ case "preserve": return { type: "Preserve" };
3721
+ case void 0: return void 0;
3722
+ }
3723
+ if (input.mode === "preserve") return { type: "Preserve" };
3724
+ const mode = input.mode ?? "automatic";
3725
+ return {
3726
+ type: "Enable",
3727
+ field0: {
3728
+ runtime: mode,
3729
+ importSource: mode === "classic" ? input.importSource : mode === "automatic" ? input.jsxImportSource : void 0,
3730
+ pragma: input.factory,
3731
+ pragmaFrag: input.fragment,
3732
+ development: input.development,
3733
+ refresh: input.refresh
3734
+ }
3735
+ };
3736
+ }
3737
+ function bindingifyWatch(watch$1) {
3738
+ if (watch$1) return {
3739
+ buildDelay: watch$1.buildDelay,
3740
+ skipWrite: watch$1.skipWrite,
3741
+ include: normalizedStringOrRegex(watch$1.include),
3742
+ exclude: normalizedStringOrRegex(watch$1.exclude)
3743
+ };
3744
+ }
3745
+ function bindingifyTreeshakeOptions(config) {
3746
+ if (config === false) return void 0;
3747
+ if (config === true || config === void 0) return { moduleSideEffects: true };
3748
+ let normalizedConfig = {
3749
+ moduleSideEffects: true,
3750
+ annotations: config.annotations,
3751
+ manualPureFunctions: config.manualPureFunctions,
3752
+ unknownGlobalSideEffects: config.unknownGlobalSideEffects
3753
+ };
3754
+ if (config.moduleSideEffects === void 0) normalizedConfig.moduleSideEffects = true;
3755
+ else if (config.moduleSideEffects === "no-external") normalizedConfig.moduleSideEffects = [{
3756
+ external: true,
3757
+ sideEffects: false
3758
+ }, {
3759
+ external: false,
3760
+ sideEffects: true
3761
+ }];
3762
+ else normalizedConfig.moduleSideEffects = config.moduleSideEffects;
3763
+ return normalizedConfig;
3764
+ }
3765
+ function bindingifyMakeAbsoluteExternalsRelative(makeAbsoluteExternalsRelative) {
3766
+ if (makeAbsoluteExternalsRelative === "ifRelativeSource") return { type: "IfRelativeSource" };
3767
+ if (typeof makeAbsoluteExternalsRelative === "boolean") return {
3768
+ type: "Bool",
3769
+ field0: makeAbsoluteExternalsRelative
3770
+ };
3771
+ }
3772
+ var init_bindingify_input_options = __esm({ "src/utils/bindingify-input-options.ts"() {
3773
+ init_constructors();
3774
+ init_utils();
3775
+ init_bindingify_plugin();
3776
+ init_plugin_context_data();
3777
+ init_misc();
3778
+ init_normalize_string_or_regex();
3779
+ init_transform_side_effects();
3780
+ } });
3781
+
3689
3782
  //#endregion
3690
3783
  //#region src/utils/plugin/index.ts
3691
3784
  var isPluginHookName;
3692
- var init_plugin$1 = __esm({ "src/utils/plugin/index.ts"() {
3693
- init_plugin$2();
3785
+ var init_plugin = __esm({ "src/utils/plugin/index.ts"() {
3786
+ init_plugin$1();
3694
3787
  isPluginHookName = function() {
3695
3788
  const PLUGIN_HOOK_NAMES_SET = new Set(ENUMERATED_PLUGIN_HOOK_NAMES);
3696
3789
  return function isPluginHookName$1(hookName) {
@@ -3836,10 +3929,10 @@ function createComposedPlugin(plugins) {
3836
3929
  case "load": {
3837
3930
  if (batchedHooks.load) {
3838
3931
  const batchedHandlers = batchedHooks.load;
3839
- composed.load = async function(id) {
3932
+ composed.load = async function(id$1) {
3840
3933
  for (const [handler, plugin] of batchedHandlers) {
3841
3934
  const { handler: handlerFn } = normalizeHook(handler);
3842
- const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), id);
3935
+ const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), id$1);
3843
3936
  if (!isNullish(result)) return result;
3844
3937
  }
3845
3938
  };
@@ -3849,11 +3942,11 @@ function createComposedPlugin(plugins) {
3849
3942
  case "transform": {
3850
3943
  if (batchedHooks.transform) {
3851
3944
  const batchedHandlers = batchedHooks.transform;
3852
- composed.transform = async function(initialCode, id, moduleType) {
3853
- let code = initialCode;
3945
+ composed.transform = async function(initialCode, id$1, moduleType$1) {
3946
+ let code$1 = initialCode;
3854
3947
  let moduleSideEffects = void 0;
3855
3948
  function updateOutput(newCode, newModuleSideEffects) {
3856
- code = newCode;
3949
+ code$1 = newCode;
3857
3950
  moduleSideEffects = newModuleSideEffects ?? void 0;
3858
3951
  }
3859
3952
  for (const [handler, plugin] of batchedHandlers) {
@@ -3861,14 +3954,14 @@ function createComposedPlugin(plugins) {
3861
3954
  this.getCombinedSourcemap = () => {
3862
3955
  throw new Error(`The getCombinedSourcemap is not implement in transform hook at composedJsPlugins`);
3863
3956
  };
3864
- const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), code, id, moduleType);
3957
+ const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), code$1, id$1, moduleType$1);
3865
3958
  if (!isNullish(result)) {
3866
3959
  if (typeof result === "string") updateOutput(result);
3867
3960
  else if (result.code) updateOutput(result.code, result.moduleSideEffects);
3868
3961
  }
3869
3962
  }
3870
3963
  return {
3871
- code,
3964
+ code: code$1,
3872
3965
  moduleSideEffects
3873
3966
  };
3874
3967
  };
@@ -3890,10 +3983,10 @@ function createComposedPlugin(plugins) {
3890
3983
  case "renderChunk": {
3891
3984
  if (batchedHooks.renderChunk) {
3892
3985
  const batchedHandlers = batchedHooks.renderChunk;
3893
- composed.renderChunk = async function(code, chunk, options, meta) {
3986
+ composed.renderChunk = async function(code$1, chunk, options, meta) {
3894
3987
  for (const [handler, plugin] of batchedHandlers) {
3895
3988
  const { handler: handlerFn } = normalizeHook(handler);
3896
- const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), code, chunk, options, meta);
3989
+ const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), code$1, chunk, options, meta);
3897
3990
  if (!isNullish(result)) return result;
3898
3991
  }
3899
3992
  };
@@ -3930,10 +4023,10 @@ function createComposedPlugin(plugins) {
3930
4023
  case "watchChange": {
3931
4024
  if (batchedHooks.watchChange) {
3932
4025
  const batchedHandlers = batchedHooks.watchChange;
3933
- composed.watchChange = async function(id, event) {
4026
+ composed.watchChange = async function(id$1, event) {
3934
4027
  await Promise.all(batchedHandlers.map(([handler, plugin]) => {
3935
4028
  const { handler: handlerFn } = normalizeHook(handler);
3936
- return handlerFn.call(applyFixedPluginResolveFn(this, plugin), id, event);
4029
+ return handlerFn.call(applyFixedPluginResolveFn(this, plugin), id$1, event);
3937
4030
  }));
3938
4031
  };
3939
4032
  }
@@ -4000,7 +4093,7 @@ var init_compose_js_plugins = __esm({ "src/utils/compose-js-plugins.ts"() {
4000
4093
  init_plugin_context$1();
4001
4094
  init_misc();
4002
4095
  init_normalize_hook();
4003
- init_plugin$1();
4096
+ init_plugin();
4004
4097
  unsupportedHookName = [
4005
4098
  "augmentChunkHash",
4006
4099
  "generateBundle",
@@ -4042,7 +4135,7 @@ async function initializeParallelPlugins(plugins) {
4042
4135
  };
4043
4136
  }
4044
4137
  function initializeWorkers(registryId, count, pluginInfos) {
4045
- return Promise.all(Array.from({ length: count }, (_, i$21) => initializeWorker(registryId, pluginInfos, i$21)));
4138
+ return Promise.all(Array.from({ length: count }, (_, i$22) => initializeWorker(registryId, pluginInfos, i$22)));
4046
4139
  }
4047
4140
  async function initializeWorker(registryId, pluginInfos, threadNumber) {
4048
4141
  const urlString = import.meta.resolve("#parallel-plugin-worker");
@@ -4249,8 +4342,8 @@ var init_watch_emitter = __esm({ "src/api/watch/watch-emitter.ts"() {
4249
4342
  break;
4250
4343
  case "event":
4251
4344
  for (const listener of listeners) {
4252
- const code = event.bundleEventKind();
4253
- switch (code) {
4345
+ const code$1 = event.bundleEventKind();
4346
+ switch (code$1) {
4254
4347
  case "BUNDLE_END":
4255
4348
  const { duration, output } = event.bundleEndData();
4256
4349
  await listener({
@@ -4267,7 +4360,7 @@ var init_watch_emitter = __esm({ "src/api/watch/watch-emitter.ts"() {
4267
4360
  });
4268
4361
  break;
4269
4362
  default:
4270
- await listener({ code });
4363
+ await listener({ code: code$1 });
4271
4364
  break;
4272
4365
  }
4273
4366
  }
@@ -4359,55 +4452,6 @@ var init_watch = __esm({ "src/api/watch/index.ts"() {
4359
4452
  };
4360
4453
  } });
4361
4454
 
4362
- //#endregion
4363
- //#region src/plugin/with-filter.ts
4364
- function withFilterImpl(pluginOption, filterObjectList) {
4365
- if (isPromiseLike(pluginOption)) return pluginOption.then((p$3) => withFilter(p$3, filterObjectList));
4366
- if (pluginOption == false || pluginOption == null) return pluginOption;
4367
- if (Array.isArray(pluginOption)) return pluginOption.map((p$3) => withFilter(p$3, filterObjectList));
4368
- let plugin = pluginOption;
4369
- let filterObjectIndex = findMatchedFilterObject(plugin.name, filterObjectList);
4370
- if (filterObjectIndex === -1) return plugin;
4371
- let filterObject = filterObjectList[filterObjectIndex];
4372
- Object.keys(plugin).forEach((key) => {
4373
- switch (key) {
4374
- case "transform":
4375
- case "resolveId":
4376
- case "load":
4377
- if (!plugin[key]) return;
4378
- if (typeof plugin[key] === "object") plugin[key].filter = filterObject[key] ?? plugin[key].filter;
4379
- else plugin[key] = {
4380
- handler: plugin[key],
4381
- filter: filterObject[key]
4382
- };
4383
- break;
4384
- default: break;
4385
- }
4386
- });
4387
- return plugin;
4388
- }
4389
- function withFilter(pluginOption, filterObject) {
4390
- return withFilterImpl(pluginOption, arraify(filterObject));
4391
- }
4392
- function findMatchedFilterObject(pluginName, overrideFilterObjectList) {
4393
- 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;
4398
- }
4399
- return -1;
4400
- }
4401
- var init_with_filter = __esm({ "src/plugin/with-filter.ts"() {
4402
- init_misc();
4403
- } });
4404
-
4405
- //#endregion
4406
- //#region src/plugin/index.ts
4407
- var init_plugin = __esm({ "src/plugin/index.ts"() {
4408
- init_with_filter();
4409
- } });
4410
-
4411
4455
  //#endregion
4412
4456
  //#region src/utils/define-config.ts
4413
4457
  function defineConfig(config) {
@@ -4422,10 +4466,9 @@ var init_src = __esm({ "src/index.ts"() {
4422
4466
  init_build();
4423
4467
  init_rolldown();
4424
4468
  init_watch();
4425
- init_plugin();
4426
4469
  init_define_config();
4427
4470
  VERSION = version;
4428
4471
  } });
4429
4472
 
4430
4473
  //#endregion
4431
- export { BuiltinPlugin, PluginContextData, VERSION, arraify, bindingifyPlugin, build, buildImportAnalysisPlugin, composeJsPlugins, createBundler, defineConfig, description, dynamicImportVarsPlugin, getInputCliKeys, getJsonSchema, getOutputCliKeys, handleOutputErrors, importGlobPlugin, init_bindingify_plugin, init_compose_js_plugins, init_constructors, init_create_bundler, init_misc, init_normalize_string_or_regex, init_plugin_context_data, init_rolldown, init_src, init_transform_to_rollup_output, init_validator, init_watch, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, reportPlugin, rolldown, validateCliOptions, version, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, watch, withFilter };
4474
+ export { BuiltinPlugin, PluginContextData, VERSION, bindingifyPlugin, build, buildImportAnalysisPlugin, composeJsPlugins, createBundler, defineConfig, description, dynamicImportVarsPlugin, getInputCliKeys, getJsonSchema, getOutputCliKeys, handleOutputErrors, importGlobPlugin, init_bindingify_plugin, init_compose_js_plugins, init_constructors, init_create_bundler, init_normalize_string_or_regex, init_plugin_context_data, init_rolldown, init_src, init_transform_to_rollup_output, init_validator, init_watch, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, reportPlugin, rolldown, validateCliOptions, version, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, watch };