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