rolldown 0.14.0-snapshot-db4090b-20241123003628 → 0.14.0-snapshot-87f7277-20241125003644
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/cli.cjs +3 -3
- package/dist/cjs/experimental-index.cjs +34 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/parallel-plugin-worker.cjs +2 -2
- package/dist/esm/cli.mjs +3 -3
- package/dist/esm/experimental-index.mjs +34 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/parallel-plugin-worker.mjs +2 -2
- package/dist/shared/rolldown-binding.wasi.cjs +39 -36
- package/dist/shared/{src_index-wJBYWP9G.mjs → src_index-AKIcG6mr.mjs} +229 -278
- package/dist/shared/{src_index-WgTHG2Z9.cjs → src_index-AzJK-lP0.cjs} +230 -280
- package/dist/types/binding.d.ts +23 -18
- package/dist/types/builtin-plugin/alias-plugin.d.ts +10 -0
- package/dist/types/builtin-plugin/constructors.d.ts +16 -0
- package/dist/types/builtin-plugin/replace-plugin.d.ts +28 -0
- package/dist/types/{options/normalized-ecma-transform-plugin-config.d.ts → builtin-plugin/transform-plugin.d.ts} +2 -1
- package/dist/types/builtin-plugin/utils.d.ts +12 -0
- package/dist/types/cli/arguments/normalize.d.ts +2 -2
- package/dist/types/experimental-index.d.ts +5 -1
- package/dist/types/index.d.ts +4 -4
- package/dist/types/log/logger.d.ts +2 -16
- package/dist/types/options/input-options-schema.d.ts +588 -0
- package/dist/types/options/input-options.d.ts +99 -586
- package/dist/types/options/normalized-input-options.d.ts +8 -2
- package/dist/types/options/normalized-output-options.d.ts +12 -3
- package/dist/types/options/output-options-schema.d.ts +146 -0
- package/dist/types/options/output-options.d.ts +70 -142
- package/dist/types/options/watch-options.d.ts +5 -0
- package/dist/types/plugin/bindingify-build-hooks.d.ts +9 -10
- package/dist/types/plugin/bindingify-output-hooks.d.ts +12 -15
- package/dist/types/plugin/bindingify-plugin.d.ts +12 -3
- package/dist/types/plugin/bindingify-watch-hooks.d.ts +3 -5
- package/dist/types/plugin/index.d.ts +2 -2
- package/dist/types/plugin/minimal-plugin-context.d.ts +15 -0
- package/dist/types/plugin/plugin-context.d.ts +3 -3
- package/dist/types/plugin/transform-plugin-context.d.ts +2 -3
- package/dist/types/rolldown-build.d.ts +2 -2
- package/dist/types/rolldown.d.ts +2 -2
- package/dist/types/types/rolldown-options.d.ts +2 -2
- package/dist/types/utils/bindingify-input-options.d.ts +5 -0
- package/dist/types/utils/bindingify-output-options.d.ts +3 -0
- package/dist/types/utils/create-bundler.d.ts +2 -2
- package/dist/types/utils/normalize-plugin-option.d.ts +1 -1
- package/package.json +15 -15
- package/dist/types/options/bindingify-input-options.d.ts +0 -5
- package/dist/types/options/bindingify-output-options.d.ts +0 -3
- package/dist/types/options/normalized-alias-plugin-config.d.ts +0 -8
- package/dist/types/options/watch-option.d.ts +0 -5
- package/dist/types/plugin/builtin-plugin.d.ts +0 -94
- package/dist/types/types/input-options.d.ts +0 -101
- package/dist/types/types/output-options.d.ts +0 -74
|
@@ -564,6 +564,7 @@ var require_binding = __commonJSMin((exports, module) => {
|
|
|
564
564
|
module.exports.BindingCallableBuiltinPlugin = nativeBinding.BindingCallableBuiltinPlugin;
|
|
565
565
|
module.exports.BindingLog = nativeBinding.BindingLog;
|
|
566
566
|
module.exports.BindingModuleInfo = nativeBinding.BindingModuleInfo;
|
|
567
|
+
module.exports.BindingNormalizedOptions = nativeBinding.BindingNormalizedOptions;
|
|
567
568
|
module.exports.BindingOutputAsset = nativeBinding.BindingOutputAsset;
|
|
568
569
|
module.exports.BindingOutputChunk = nativeBinding.BindingOutputChunk;
|
|
569
570
|
module.exports.BindingOutputs = nativeBinding.BindingOutputs;
|
|
@@ -820,29 +821,6 @@ function normalizeHook(hook) {
|
|
|
820
821
|
|
|
821
822
|
//#endregion
|
|
822
823
|
//#region src/log/logger.ts
|
|
823
|
-
class MinimalPluginContext {
|
|
824
|
-
info;
|
|
825
|
-
warn;
|
|
826
|
-
debug;
|
|
827
|
-
meta;
|
|
828
|
-
error;
|
|
829
|
-
constructor(options, plugin) {
|
|
830
|
-
const onLog = options.onLog;
|
|
831
|
-
const pluginName = plugin.name || "unknown";
|
|
832
|
-
const logLevel = options.logLevel || LOG_LEVEL_INFO;
|
|
833
|
-
this.debug = getLogHandler(LOG_LEVEL_DEBUG, "PLUGIN_LOG", onLog, pluginName, logLevel);
|
|
834
|
-
this.info = getLogHandler(LOG_LEVEL_INFO, "PLUGIN_LOG", onLog, pluginName, logLevel);
|
|
835
|
-
this.warn = getLogHandler(LOG_LEVEL_WARN, "PLUGIN_WARNING", onLog, pluginName, logLevel);
|
|
836
|
-
this.error = (e) => {
|
|
837
|
-
return error(logPluginError(normalizeLog(e), pluginName));
|
|
838
|
-
};
|
|
839
|
-
this.meta = {
|
|
840
|
-
rollupVersion: "4.23.0",
|
|
841
|
-
rolldownVersion: VERSION,
|
|
842
|
-
watchMode: false
|
|
843
|
-
};
|
|
844
|
-
}
|
|
845
|
-
}
|
|
846
824
|
function getLogger(plugins, onLog, logLevel) {
|
|
847
825
|
const minimalPriority = logLevelPriority[logLevel];
|
|
848
826
|
const logger = (level, log, skipped = new Set()) => {
|
|
@@ -940,35 +918,7 @@ function relativeId(id) {
|
|
|
940
918
|
}
|
|
941
919
|
|
|
942
920
|
//#endregion
|
|
943
|
-
//#region src/
|
|
944
|
-
function normalizedStringOrRegex(pattern) {
|
|
945
|
-
if (!pattern) {
|
|
946
|
-
return undefined;
|
|
947
|
-
}
|
|
948
|
-
if (!Array.isArray(pattern)) {
|
|
949
|
-
pattern = [pattern];
|
|
950
|
-
}
|
|
951
|
-
return pattern;
|
|
952
|
-
}
|
|
953
|
-
|
|
954
|
-
//#endregion
|
|
955
|
-
//#region src/options/normalized-ecma-transform-plugin-config.ts
|
|
956
|
-
function normalizeEcmaTransformPluginConfig(config) {
|
|
957
|
-
if (!config) {
|
|
958
|
-
return undefined;
|
|
959
|
-
}
|
|
960
|
-
let normalizedConfig = {
|
|
961
|
-
jsxInject: config?.jsxInject,
|
|
962
|
-
exclude: normalizedStringOrRegex(config.exclude),
|
|
963
|
-
include: normalizedStringOrRegex(config.include),
|
|
964
|
-
targets: config.targets
|
|
965
|
-
};
|
|
966
|
-
return normalizedConfig;
|
|
967
|
-
}
|
|
968
|
-
|
|
969
|
-
//#endregion
|
|
970
|
-
//#region src/plugin/builtin-plugin.ts
|
|
971
|
-
var import_binding$5 = __toESM(require_binding());
|
|
921
|
+
//#region src/builtin-plugin/constructors.ts
|
|
972
922
|
class BuiltinPlugin {
|
|
973
923
|
constructor(name, options) {
|
|
974
924
|
this.name = name;
|
|
@@ -977,143 +927,39 @@ class BuiltinPlugin {
|
|
|
977
927
|
this.options = options;
|
|
978
928
|
}
|
|
979
929
|
}
|
|
980
|
-
class ModulePreloadPolyfillPlugin extends BuiltinPlugin {
|
|
981
|
-
constructor(config) {
|
|
982
|
-
super(import_binding$5.BindingBuiltinPluginName.ModulePreloadPolyfillPlugin, config);
|
|
983
|
-
}
|
|
984
|
-
}
|
|
985
|
-
class DynamicImportVarsPlugin extends BuiltinPlugin {
|
|
986
|
-
constructor() {
|
|
987
|
-
super(import_binding$5.BindingBuiltinPluginName.DynamicImportVarsPlugin);
|
|
988
|
-
}
|
|
989
|
-
}
|
|
990
|
-
class ImportGlobPlugin extends BuiltinPlugin {
|
|
991
|
-
constructor(config) {
|
|
992
|
-
super(import_binding$5.BindingBuiltinPluginName.ImportGlobPlugin, config);
|
|
993
|
-
}
|
|
994
|
-
}
|
|
995
|
-
class ManifestPlugin extends BuiltinPlugin {
|
|
996
|
-
constructor(config) {
|
|
997
|
-
super(import_binding$5.BindingBuiltinPluginName.ManifestPlugin, config);
|
|
998
|
-
}
|
|
999
|
-
}
|
|
1000
|
-
class WasmHelperPlugin extends BuiltinPlugin {
|
|
1001
|
-
constructor() {
|
|
1002
|
-
super(import_binding$5.BindingBuiltinPluginName.WasmHelperPlugin);
|
|
1003
|
-
}
|
|
1004
|
-
}
|
|
1005
|
-
class WasmFallbackPlugin extends BuiltinPlugin {
|
|
1006
|
-
constructor() {
|
|
1007
|
-
super(import_binding$5.BindingBuiltinPluginName.WasmFallbackPlugin);
|
|
1008
|
-
}
|
|
1009
|
-
}
|
|
1010
|
-
class LoadFallbackPlugin extends BuiltinPlugin {
|
|
1011
|
-
constructor() {
|
|
1012
|
-
super(import_binding$5.BindingBuiltinPluginName.LoadFallbackPlugin);
|
|
1013
|
-
}
|
|
1014
|
-
}
|
|
1015
|
-
class AliasPlugin extends BuiltinPlugin {
|
|
1016
|
-
constructor(config) {
|
|
1017
|
-
super(import_binding$5.BindingBuiltinPluginName.AliasPlugin, config);
|
|
1018
|
-
}
|
|
1019
|
-
}
|
|
1020
|
-
class TransformPlugin extends BuiltinPlugin {
|
|
1021
|
-
constructor(config) {
|
|
1022
|
-
let normalizedConfig = normalizeEcmaTransformPluginConfig(config);
|
|
1023
|
-
super(import_binding$5.BindingBuiltinPluginName.TransformPlugin, normalizedConfig);
|
|
1024
|
-
}
|
|
1025
|
-
}
|
|
1026
|
-
class JsonPlugin extends BuiltinPlugin {
|
|
1027
|
-
constructor(config) {
|
|
1028
|
-
super(import_binding$5.BindingBuiltinPluginName.JsonPlugin, config);
|
|
1029
|
-
}
|
|
1030
|
-
}
|
|
1031
|
-
class BuildImportAnalysisPlugin extends BuiltinPlugin {
|
|
1032
|
-
constructor(config) {
|
|
1033
|
-
super(import_binding$5.BindingBuiltinPluginName.BuildImportAnalysisPlugin, config);
|
|
1034
|
-
}
|
|
1035
|
-
}
|
|
1036
|
-
class ReplacePlugin extends BuiltinPlugin {
|
|
1037
|
-
constructor(config) {
|
|
1038
|
-
super(import_binding$5.BindingBuiltinPluginName.ReplacePlugin, config);
|
|
1039
|
-
}
|
|
1040
|
-
}
|
|
1041
|
-
class ViteResolvePlugin extends BuiltinPlugin {
|
|
1042
|
-
constructor(config) {
|
|
1043
|
-
super(import_binding$5.BindingBuiltinPluginName.ViteResolvePlugin, config);
|
|
1044
|
-
}
|
|
1045
|
-
}
|
|
1046
930
|
function modulePreloadPolyfillPlugin(config) {
|
|
1047
|
-
return new
|
|
931
|
+
return new BuiltinPlugin("builtin:module-preload-polyfill", config);
|
|
1048
932
|
}
|
|
1049
933
|
function dynamicImportVarsPlugin() {
|
|
1050
|
-
return new
|
|
934
|
+
return new BuiltinPlugin("builtin:dynamic-import-vars");
|
|
1051
935
|
}
|
|
1052
936
|
function importGlobPlugin(config) {
|
|
1053
|
-
return new
|
|
937
|
+
return new BuiltinPlugin("builtin:import-glob", config);
|
|
1054
938
|
}
|
|
1055
939
|
function manifestPlugin(config) {
|
|
1056
|
-
return new
|
|
940
|
+
return new BuiltinPlugin("builtin:manifest", config);
|
|
1057
941
|
}
|
|
1058
942
|
function wasmHelperPlugin() {
|
|
1059
|
-
return new
|
|
943
|
+
return new BuiltinPlugin("builtin:wasm-helper");
|
|
1060
944
|
}
|
|
1061
945
|
function wasmFallbackPlugin() {
|
|
1062
|
-
return new
|
|
1063
|
-
}
|
|
1064
|
-
function transformPlugin(config) {
|
|
1065
|
-
return new TransformPlugin(config);
|
|
946
|
+
return new BuiltinPlugin("builtin:wasm-fallback");
|
|
1066
947
|
}
|
|
1067
948
|
function loadFallbackPlugin() {
|
|
1068
|
-
return new
|
|
1069
|
-
}
|
|
1070
|
-
function aliasPlugin(config) {
|
|
1071
|
-
return new AliasPlugin(config);
|
|
949
|
+
return new BuiltinPlugin("builtin:load-fallback");
|
|
1072
950
|
}
|
|
1073
951
|
function jsonPlugin(config) {
|
|
1074
|
-
return new
|
|
952
|
+
return new BuiltinPlugin("builtin:json", config);
|
|
1075
953
|
}
|
|
1076
954
|
function buildImportAnalysisPlugin(config) {
|
|
1077
|
-
return new
|
|
955
|
+
return new BuiltinPlugin("builtin:build-import-analysis", config);
|
|
1078
956
|
}
|
|
1079
957
|
function viteResolvePlugin(config) {
|
|
1080
|
-
return new
|
|
958
|
+
return new BuiltinPlugin("builtin:vite-resolve", {
|
|
1081
959
|
...config,
|
|
1082
960
|
runtime: process.versions.deno ? "deno" : process.versions.bun ? "bun" : "node"
|
|
1083
961
|
});
|
|
1084
962
|
}
|
|
1085
|
-
function replacePlugin(values = {}, options = {}) {
|
|
1086
|
-
return new ReplacePlugin({
|
|
1087
|
-
...options,
|
|
1088
|
-
values
|
|
1089
|
-
});
|
|
1090
|
-
}
|
|
1091
|
-
function isCallableCompatibleBuiltinPlugin(plugin) {
|
|
1092
|
-
return plugin instanceof BuiltinPlugin && (0, import_binding$5.isCallableCompatibleBuiltinPlugin)(bindingifyBuiltInPlugin(plugin));
|
|
1093
|
-
}
|
|
1094
|
-
function makeBuiltinPluginCallable(plugin) {
|
|
1095
|
-
let callablePlugin = new import_binding$5.BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
|
|
1096
|
-
const wrappedPlugin = {_original: callablePlugin};
|
|
1097
|
-
for (const key in callablePlugin) {
|
|
1098
|
-
if (key === "name") {
|
|
1099
|
-
wrappedPlugin[key] = callablePlugin[key];
|
|
1100
|
-
} else {
|
|
1101
|
-
wrappedPlugin[key] = function(...args) {
|
|
1102
|
-
return callablePlugin[key](...args);
|
|
1103
|
-
};
|
|
1104
|
-
}
|
|
1105
|
-
}
|
|
1106
|
-
return wrappedPlugin;
|
|
1107
|
-
}
|
|
1108
|
-
function isCallableBuiltinPlugin(plugin) {
|
|
1109
|
-
return "_original"in plugin && plugin._original instanceof import_binding$5.BindingCallableBuiltinPlugin;
|
|
1110
|
-
}
|
|
1111
|
-
function bindingifyBuiltInPlugin(plugin) {
|
|
1112
|
-
return {
|
|
1113
|
-
__name: plugin.name,
|
|
1114
|
-
options: plugin.options
|
|
1115
|
-
};
|
|
1116
|
-
}
|
|
1117
963
|
|
|
1118
964
|
//#endregion
|
|
1119
965
|
//#region src/plugin/plugin-driver.ts
|
|
@@ -1244,14 +1090,38 @@ function transformModuleInfo(info, option) {
|
|
|
1244
1090
|
};
|
|
1245
1091
|
}
|
|
1246
1092
|
|
|
1093
|
+
//#endregion
|
|
1094
|
+
//#region src/plugin/minimal-plugin-context.ts
|
|
1095
|
+
class MinimalPluginContext {
|
|
1096
|
+
info;
|
|
1097
|
+
warn;
|
|
1098
|
+
debug;
|
|
1099
|
+
meta;
|
|
1100
|
+
error;
|
|
1101
|
+
constructor(onLog, logLevel, plugin) {
|
|
1102
|
+
const pluginName = plugin.name || "unknown";
|
|
1103
|
+
this.debug = getLogHandler(LOG_LEVEL_DEBUG, "PLUGIN_LOG", onLog, pluginName, logLevel);
|
|
1104
|
+
this.info = getLogHandler(LOG_LEVEL_INFO, "PLUGIN_LOG", onLog, pluginName, logLevel);
|
|
1105
|
+
this.warn = getLogHandler(LOG_LEVEL_WARN, "PLUGIN_WARNING", onLog, pluginName, logLevel);
|
|
1106
|
+
this.error = (e) => {
|
|
1107
|
+
return error(logPluginError(normalizeLog(e), pluginName));
|
|
1108
|
+
};
|
|
1109
|
+
this.meta = {
|
|
1110
|
+
rollupVersion: "4.23.0",
|
|
1111
|
+
rolldownVersion: VERSION,
|
|
1112
|
+
watchMode: false
|
|
1113
|
+
};
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1247
1117
|
//#endregion
|
|
1248
1118
|
//#region src/utils/transform-side-effects.ts
|
|
1249
|
-
var import_binding$
|
|
1119
|
+
var import_binding$5 = __toESM(require_binding());
|
|
1250
1120
|
function bindingifySideEffects(sideEffects) {
|
|
1251
1121
|
switch (sideEffects) {
|
|
1252
|
-
case true: return import_binding$
|
|
1253
|
-
case false: return import_binding$
|
|
1254
|
-
case "no-treeshake": return import_binding$
|
|
1122
|
+
case true: return import_binding$5.BindingHookSideEffects.True;
|
|
1123
|
+
case false: return import_binding$5.BindingHookSideEffects.False;
|
|
1124
|
+
case "no-treeshake": return import_binding$5.BindingHookSideEffects.NoTreeshake;
|
|
1255
1125
|
case null:
|
|
1256
1126
|
case undefined: return undefined;
|
|
1257
1127
|
default: throw new Error(`Unexpected side effects: ${sideEffects}`);
|
|
@@ -1269,16 +1139,16 @@ class PluginContext extends MinimalPluginContext {
|
|
|
1269
1139
|
getModuleIds;
|
|
1270
1140
|
addWatchFile;
|
|
1271
1141
|
parse;
|
|
1272
|
-
constructor(
|
|
1273
|
-
super(
|
|
1274
|
-
this.load = async ({ id: id,...options
|
|
1142
|
+
constructor(context, plugin, data, onLog, logLevel) {
|
|
1143
|
+
super(onLog, logLevel, plugin);
|
|
1144
|
+
this.load = async ({ id: id,...options }) => {
|
|
1275
1145
|
const moduleInfo = data.getModuleInfo(id, context);
|
|
1276
1146
|
if (moduleInfo && moduleInfo.code !== null) {
|
|
1277
1147
|
return moduleInfo;
|
|
1278
1148
|
}
|
|
1279
1149
|
const rawOptions = {
|
|
1280
|
-
meta: options
|
|
1281
|
-
moduleSideEffects: options
|
|
1150
|
+
meta: options.meta || {},
|
|
1151
|
+
moduleSideEffects: options.moduleSideEffects || null
|
|
1282
1152
|
};
|
|
1283
1153
|
data.updateModuleOption(id, rawOptions);
|
|
1284
1154
|
async function createLoadModulePromise() {
|
|
@@ -1292,7 +1162,7 @@ class PluginContext extends MinimalPluginContext {
|
|
|
1292
1162
|
});
|
|
1293
1163
|
data.loadModulePromiseMap.set(id, promise);
|
|
1294
1164
|
try {
|
|
1295
|
-
await context.load(id, bindingifySideEffects(options
|
|
1165
|
+
await context.load(id, bindingifySideEffects(options.moduleSideEffects), resolveFn);
|
|
1296
1166
|
} finally {
|
|
1297
1167
|
data.loadModulePromiseMap.delete(id);
|
|
1298
1168
|
}
|
|
@@ -1301,14 +1171,14 @@ class PluginContext extends MinimalPluginContext {
|
|
|
1301
1171
|
await createLoadModulePromise();
|
|
1302
1172
|
return data.getModuleInfo(id, context);
|
|
1303
1173
|
};
|
|
1304
|
-
this.resolve = async (source, importer, options
|
|
1174
|
+
this.resolve = async (source, importer, options) => {
|
|
1305
1175
|
let receipt = undefined;
|
|
1306
|
-
if (options
|
|
1307
|
-
receipt = data.saveResolveOptions(options
|
|
1176
|
+
if (options != null) {
|
|
1177
|
+
receipt = data.saveResolveOptions(options);
|
|
1308
1178
|
}
|
|
1309
1179
|
const res = await context.resolve(source, importer, {
|
|
1310
1180
|
custom: receipt,
|
|
1311
|
-
skipSelf: options
|
|
1181
|
+
skipSelf: options?.skipSelf
|
|
1312
1182
|
});
|
|
1313
1183
|
if (receipt != null) {
|
|
1314
1184
|
data.removeSavedResolveOptions(receipt);
|
|
@@ -1342,8 +1212,8 @@ class PluginContext extends MinimalPluginContext {
|
|
|
1342
1212
|
//#region src/plugin/transform-plugin-context.ts
|
|
1343
1213
|
class TransformPluginContext extends PluginContext {
|
|
1344
1214
|
error;
|
|
1345
|
-
constructor(
|
|
1346
|
-
super(
|
|
1215
|
+
constructor(context, plugin, data, inner, moduleId, moduleSource, onLog, LogLevelOption) {
|
|
1216
|
+
super(context, plugin, data, onLog, LogLevelOption);
|
|
1347
1217
|
const getLogHandler$1 = (handler) => (log, pos) => {
|
|
1348
1218
|
log = normalizeLog(log);
|
|
1349
1219
|
if (pos) augmentCodeLocation(log, pos, moduleSource, moduleId);
|
|
@@ -1366,14 +1236,14 @@ class TransformPluginContext extends PluginContext {
|
|
|
1366
1236
|
|
|
1367
1237
|
//#endregion
|
|
1368
1238
|
//#region src/plugin/bindingify-plugin-hook-meta.ts
|
|
1369
|
-
var import_binding$
|
|
1239
|
+
var import_binding$4 = __toESM(require_binding());
|
|
1370
1240
|
function bindingifyPluginHookMeta(options) {
|
|
1371
1241
|
return {order: bindingPluginOrder(options.order)};
|
|
1372
1242
|
}
|
|
1373
1243
|
function bindingPluginOrder(order) {
|
|
1374
1244
|
switch (order) {
|
|
1375
|
-
case "post": return import_binding$
|
|
1376
|
-
case "pre": return import_binding$
|
|
1245
|
+
case "post": return import_binding$4.BindingPluginOrder.Post;
|
|
1246
|
+
case "pre": return import_binding$4.BindingPluginOrder.Pre;
|
|
1377
1247
|
case null:
|
|
1378
1248
|
case undefined: return undefined;
|
|
1379
1249
|
default: throw new Error(`Unknown plugin order: ${order}`);
|
|
@@ -1424,49 +1294,65 @@ function bindingifyTransformFilter(filterOption) {
|
|
|
1424
1294
|
};
|
|
1425
1295
|
}
|
|
1426
1296
|
|
|
1297
|
+
//#endregion
|
|
1298
|
+
//#region src/options/normalized-input-options.ts
|
|
1299
|
+
class NormalizedInputOptions {
|
|
1300
|
+
inner;
|
|
1301
|
+
constructor(inner, onLog) {
|
|
1302
|
+
this.inner = inner;
|
|
1303
|
+
this.onLog = onLog;
|
|
1304
|
+
}
|
|
1305
|
+
get shimMissingExports() {
|
|
1306
|
+
return this.inner.shimMissingExports;
|
|
1307
|
+
}
|
|
1308
|
+
get input() {
|
|
1309
|
+
return this.inner.input;
|
|
1310
|
+
}
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1427
1313
|
//#endregion
|
|
1428
1314
|
//#region src/plugin/bindingify-build-hooks.ts
|
|
1429
|
-
function bindingifyBuildStart(
|
|
1430
|
-
const hook = plugin.buildStart;
|
|
1315
|
+
function bindingifyBuildStart(args) {
|
|
1316
|
+
const hook = args.plugin.buildStart;
|
|
1431
1317
|
if (!hook) {
|
|
1432
1318
|
return {};
|
|
1433
1319
|
}
|
|
1434
1320
|
const { handler: handler, meta: meta } = normalizeHook(hook);
|
|
1435
1321
|
return {
|
|
1436
|
-
plugin: async (ctx) => {
|
|
1437
|
-
await handler.call(new PluginContext(
|
|
1322
|
+
plugin: async (ctx, opts) => {
|
|
1323
|
+
await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedInputOptions(opts, args.onLog));
|
|
1438
1324
|
},
|
|
1439
1325
|
meta: bindingifyPluginHookMeta(meta)
|
|
1440
1326
|
};
|
|
1441
1327
|
}
|
|
1442
|
-
function bindingifyBuildEnd(
|
|
1443
|
-
const hook = plugin.buildEnd;
|
|
1328
|
+
function bindingifyBuildEnd(args) {
|
|
1329
|
+
const hook = args.plugin.buildEnd;
|
|
1444
1330
|
if (!hook) {
|
|
1445
1331
|
return {};
|
|
1446
1332
|
}
|
|
1447
1333
|
const { handler: handler, meta: meta } = normalizeHook(hook);
|
|
1448
1334
|
return {
|
|
1449
1335
|
plugin: async (ctx, err) => {
|
|
1450
|
-
await handler.call(new PluginContext(
|
|
1336
|
+
await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), err ? new Error(err) : undefined);
|
|
1451
1337
|
},
|
|
1452
1338
|
meta: bindingifyPluginHookMeta(meta)
|
|
1453
1339
|
};
|
|
1454
1340
|
}
|
|
1455
|
-
function bindingifyResolveId(
|
|
1456
|
-
const hook = plugin.resolveId;
|
|
1341
|
+
function bindingifyResolveId(args) {
|
|
1342
|
+
const hook = args.plugin.resolveId;
|
|
1457
1343
|
if (!hook) {
|
|
1458
1344
|
return {};
|
|
1459
1345
|
}
|
|
1460
1346
|
const { handler: handler, meta: meta, options: options } = normalizeHook(hook);
|
|
1461
1347
|
return {
|
|
1462
1348
|
plugin: async (ctx, specifier, importer, extraOptions) => {
|
|
1463
|
-
const contextResolveOptions = extraOptions.custom != null ? pluginContextData.getSavedResolveOptions(extraOptions.custom) : undefined;
|
|
1349
|
+
const contextResolveOptions = extraOptions.custom != null ? args.pluginContextData.getSavedResolveOptions(extraOptions.custom) : undefined;
|
|
1464
1350
|
const newExtraOptions = {
|
|
1465
1351
|
...extraOptions,
|
|
1466
1352
|
custom: contextResolveOptions?.custom,
|
|
1467
1353
|
[SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF]: contextResolveOptions?.[SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF]
|
|
1468
1354
|
};
|
|
1469
|
-
const ret = await handler.call(new PluginContext(
|
|
1355
|
+
const ret = await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), specifier, importer ?? undefined, newExtraOptions);
|
|
1470
1356
|
if (ret == null) {
|
|
1471
1357
|
return;
|
|
1472
1358
|
}
|
|
@@ -1486,7 +1372,7 @@ function bindingifyResolveId(plugin, normalizedOptions, pluginContextData) {
|
|
|
1486
1372
|
if (ret.moduleSideEffects !== null) {
|
|
1487
1373
|
result.sideEffects = bindingifySideEffects(ret.moduleSideEffects);
|
|
1488
1374
|
}
|
|
1489
|
-
pluginContextData.updateModuleOption(ret.id, {
|
|
1375
|
+
args.pluginContextData.updateModuleOption(ret.id, {
|
|
1490
1376
|
meta: ret.meta || {},
|
|
1491
1377
|
moduleSideEffects: ret.moduleSideEffects || null
|
|
1492
1378
|
});
|
|
@@ -1496,15 +1382,15 @@ function bindingifyResolveId(plugin, normalizedOptions, pluginContextData) {
|
|
|
1496
1382
|
filter: bindingifyResolveIdFilter(options.filter)
|
|
1497
1383
|
};
|
|
1498
1384
|
}
|
|
1499
|
-
function bindingifyResolveDynamicImport(
|
|
1500
|
-
const hook = plugin.resolveDynamicImport;
|
|
1385
|
+
function bindingifyResolveDynamicImport(args) {
|
|
1386
|
+
const hook = args.plugin.resolveDynamicImport;
|
|
1501
1387
|
if (!hook) {
|
|
1502
1388
|
return {};
|
|
1503
1389
|
}
|
|
1504
1390
|
const { handler: handler, meta: meta } = normalizeHook(hook);
|
|
1505
1391
|
return {
|
|
1506
1392
|
plugin: async (ctx, specifier, importer) => {
|
|
1507
|
-
const ret = await handler.call(new PluginContext(
|
|
1393
|
+
const ret = await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), specifier, importer ?? undefined);
|
|
1508
1394
|
if (ret == null) {
|
|
1509
1395
|
return;
|
|
1510
1396
|
}
|
|
@@ -1524,7 +1410,7 @@ function bindingifyResolveDynamicImport(plugin, options, pluginContextData) {
|
|
|
1524
1410
|
if (ret.moduleSideEffects !== null) {
|
|
1525
1411
|
result.sideEffects = bindingifySideEffects(ret.moduleSideEffects);
|
|
1526
1412
|
}
|
|
1527
|
-
pluginContextData.updateModuleOption(ret.id, {
|
|
1413
|
+
args.pluginContextData.updateModuleOption(ret.id, {
|
|
1528
1414
|
meta: ret.meta || {},
|
|
1529
1415
|
moduleSideEffects: ret.moduleSideEffects || null
|
|
1530
1416
|
});
|
|
@@ -1533,22 +1419,22 @@ function bindingifyResolveDynamicImport(plugin, options, pluginContextData) {
|
|
|
1533
1419
|
meta: bindingifyPluginHookMeta(meta)
|
|
1534
1420
|
};
|
|
1535
1421
|
}
|
|
1536
|
-
function bindingifyTransform(
|
|
1537
|
-
const hook = plugin.transform;
|
|
1422
|
+
function bindingifyTransform(args) {
|
|
1423
|
+
const hook = args.plugin.transform;
|
|
1538
1424
|
if (!hook) {
|
|
1539
1425
|
return {};
|
|
1540
1426
|
}
|
|
1541
1427
|
const { handler: handler, meta: meta, options: options } = normalizeHook(hook);
|
|
1542
1428
|
return {
|
|
1543
1429
|
plugin: async (ctx, code, id, meta$1) => {
|
|
1544
|
-
const ret = await handler.call(new TransformPluginContext(
|
|
1430
|
+
const ret = await handler.call(new TransformPluginContext(ctx.inner(), args.plugin, args.pluginContextData, ctx, id, code, args.onLog, args.logLevel), code, id, meta$1);
|
|
1545
1431
|
if (ret == null) {
|
|
1546
1432
|
return undefined;
|
|
1547
1433
|
}
|
|
1548
1434
|
if (typeof ret === "string") {
|
|
1549
1435
|
return {code: ret};
|
|
1550
1436
|
}
|
|
1551
|
-
pluginContextData.updateModuleOption(id, {
|
|
1437
|
+
args.pluginContextData.updateModuleOption(id, {
|
|
1552
1438
|
meta: ret.meta || {},
|
|
1553
1439
|
moduleSideEffects: ret.moduleSideEffects || null
|
|
1554
1440
|
});
|
|
@@ -1563,15 +1449,15 @@ function bindingifyTransform(plugin, normalizedOptions, pluginContextData) {
|
|
|
1563
1449
|
filter: bindingifyTransformFilter(options.filter)
|
|
1564
1450
|
};
|
|
1565
1451
|
}
|
|
1566
|
-
function bindingifyLoad(
|
|
1567
|
-
const hook = plugin.load;
|
|
1452
|
+
function bindingifyLoad(args) {
|
|
1453
|
+
const hook = args.plugin.load;
|
|
1568
1454
|
if (!hook) {
|
|
1569
1455
|
return {};
|
|
1570
1456
|
}
|
|
1571
1457
|
const { handler: handler, meta: meta, options: options } = normalizeHook(hook);
|
|
1572
1458
|
return {
|
|
1573
1459
|
plugin: async (ctx, id) => {
|
|
1574
|
-
const ret = await handler.call(new PluginContext(
|
|
1460
|
+
const ret = await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), id);
|
|
1575
1461
|
if (ret == null) {
|
|
1576
1462
|
return;
|
|
1577
1463
|
}
|
|
@@ -1587,7 +1473,7 @@ function bindingifyLoad(plugin, normalized_options, pluginContextData) {
|
|
|
1587
1473
|
if (ret.moduleSideEffects !== null) {
|
|
1588
1474
|
result.sideEffects = bindingifySideEffects(ret.moduleSideEffects);
|
|
1589
1475
|
}
|
|
1590
|
-
pluginContextData.updateModuleOption(id, {
|
|
1476
|
+
args.pluginContextData.updateModuleOption(id, {
|
|
1591
1477
|
meta: ret.meta || {},
|
|
1592
1478
|
moduleSideEffects: ret.moduleSideEffects || null
|
|
1593
1479
|
});
|
|
@@ -1609,37 +1495,52 @@ function preProcessSourceMap(ret, id) {
|
|
|
1609
1495
|
}
|
|
1610
1496
|
return map;
|
|
1611
1497
|
}
|
|
1612
|
-
function bindingifyModuleParsed(
|
|
1613
|
-
const hook = plugin.moduleParsed;
|
|
1498
|
+
function bindingifyModuleParsed(args) {
|
|
1499
|
+
const hook = args.plugin.moduleParsed;
|
|
1614
1500
|
if (!hook) {
|
|
1615
1501
|
return {};
|
|
1616
1502
|
}
|
|
1617
1503
|
const { handler: handler, meta: meta } = normalizeHook(hook);
|
|
1618
1504
|
return {
|
|
1619
1505
|
plugin: async (ctx, moduleInfo) => {
|
|
1620
|
-
await handler.call(new PluginContext(
|
|
1506
|
+
await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformModuleInfo(moduleInfo, args.pluginContextData.moduleOptionMap.get(moduleInfo.id)));
|
|
1621
1507
|
},
|
|
1622
1508
|
meta: bindingifyPluginHookMeta(meta)
|
|
1623
1509
|
};
|
|
1624
1510
|
}
|
|
1625
1511
|
|
|
1512
|
+
//#endregion
|
|
1513
|
+
//#region src/options/normalized-output-options.ts
|
|
1514
|
+
class NormalizedOutputOptionsImpl {
|
|
1515
|
+
inner;
|
|
1516
|
+
constructor(inner) {
|
|
1517
|
+
this.inner = inner;
|
|
1518
|
+
}
|
|
1519
|
+
get entryFileNames() {
|
|
1520
|
+
return this.inner.entryFilenames || unsupported("You should not take `NormalizedOutputOptions#entryFileNames` and call it directly");
|
|
1521
|
+
}
|
|
1522
|
+
get format() {
|
|
1523
|
+
return this.inner.format;
|
|
1524
|
+
}
|
|
1525
|
+
}
|
|
1526
|
+
|
|
1626
1527
|
//#endregion
|
|
1627
1528
|
//#region src/plugin/bindingify-output-hooks.ts
|
|
1628
|
-
function bindingifyRenderStart(
|
|
1629
|
-
const hook = plugin.renderStart;
|
|
1529
|
+
function bindingifyRenderStart(args) {
|
|
1530
|
+
const hook = args.plugin.renderStart;
|
|
1630
1531
|
if (!hook) {
|
|
1631
1532
|
return {};
|
|
1632
1533
|
}
|
|
1633
1534
|
const { handler: handler, meta: meta } = normalizeHook(hook);
|
|
1634
1535
|
return {
|
|
1635
|
-
plugin: async (ctx) => {
|
|
1636
|
-
handler.call(new PluginContext(
|
|
1536
|
+
plugin: async (ctx, opts) => {
|
|
1537
|
+
handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts), new NormalizedInputOptions(opts, args.onLog));
|
|
1637
1538
|
},
|
|
1638
1539
|
meta: bindingifyPluginHookMeta(meta)
|
|
1639
1540
|
};
|
|
1640
1541
|
}
|
|
1641
|
-
function bindingifyRenderChunk(
|
|
1642
|
-
const hook = plugin.renderChunk;
|
|
1542
|
+
function bindingifyRenderChunk(args) {
|
|
1543
|
+
const hook = args.plugin.renderChunk;
|
|
1643
1544
|
if (!hook) {
|
|
1644
1545
|
return {};
|
|
1645
1546
|
}
|
|
@@ -1649,7 +1550,7 @@ function bindingifyRenderChunk(plugin, options, outputOptions, pluginContextData
|
|
|
1649
1550
|
(Object.entries(chunk.modules)).forEach(([key, module$1]) => {
|
|
1650
1551
|
chunk.modules[key] = transformToRenderedModule(module$1);
|
|
1651
1552
|
});
|
|
1652
|
-
const ret = await handler.call(new PluginContext(
|
|
1553
|
+
const ret = await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), code, chunk, {});
|
|
1653
1554
|
if (ret == null) {
|
|
1654
1555
|
return;
|
|
1655
1556
|
}
|
|
@@ -1667,8 +1568,8 @@ function bindingifyRenderChunk(plugin, options, outputOptions, pluginContextData
|
|
|
1667
1568
|
meta: bindingifyPluginHookMeta(meta)
|
|
1668
1569
|
};
|
|
1669
1570
|
}
|
|
1670
|
-
function bindingifyAugmentChunkHash(
|
|
1671
|
-
const hook = plugin.augmentChunkHash;
|
|
1571
|
+
function bindingifyAugmentChunkHash(args) {
|
|
1572
|
+
const hook = args.plugin.augmentChunkHash;
|
|
1672
1573
|
if (!hook) {
|
|
1673
1574
|
return {};
|
|
1674
1575
|
}
|
|
@@ -1678,45 +1579,45 @@ function bindingifyAugmentChunkHash(plugin, options, pluginContextData) {
|
|
|
1678
1579
|
(Object.entries(chunk.modules)).forEach(([key, module$1]) => {
|
|
1679
1580
|
chunk.modules[key] = transformToRenderedModule(module$1);
|
|
1680
1581
|
});
|
|
1681
|
-
return await handler.call(new PluginContext(
|
|
1582
|
+
return await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), chunk);
|
|
1682
1583
|
},
|
|
1683
1584
|
meta: bindingifyPluginHookMeta(meta)
|
|
1684
1585
|
};
|
|
1685
1586
|
}
|
|
1686
|
-
function bindingifyRenderError(
|
|
1687
|
-
const hook = plugin.renderError;
|
|
1587
|
+
function bindingifyRenderError(args) {
|
|
1588
|
+
const hook = args.plugin.renderError;
|
|
1688
1589
|
if (!hook) {
|
|
1689
1590
|
return {};
|
|
1690
1591
|
}
|
|
1691
1592
|
const { handler: handler, meta: meta } = normalizeHook(hook);
|
|
1692
1593
|
return {
|
|
1693
1594
|
plugin: async (ctx, err) => {
|
|
1694
|
-
handler.call(new PluginContext(
|
|
1595
|
+
handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new Error(err));
|
|
1695
1596
|
},
|
|
1696
1597
|
meta: bindingifyPluginHookMeta(meta)
|
|
1697
1598
|
};
|
|
1698
1599
|
}
|
|
1699
|
-
function bindingifyGenerateBundle(
|
|
1700
|
-
const hook = plugin.generateBundle;
|
|
1600
|
+
function bindingifyGenerateBundle(args) {
|
|
1601
|
+
const hook = args.plugin.generateBundle;
|
|
1701
1602
|
if (!hook) {
|
|
1702
1603
|
return {};
|
|
1703
1604
|
}
|
|
1704
1605
|
const { handler: handler, meta: meta } = normalizeHook(hook);
|
|
1705
1606
|
return {
|
|
1706
|
-
plugin: async (ctx, bundle, isWrite) => {
|
|
1607
|
+
plugin: async (ctx, bundle, isWrite, opts) => {
|
|
1707
1608
|
const changed = {
|
|
1708
1609
|
updated: new Set(),
|
|
1709
1610
|
deleted: new Set()
|
|
1710
1611
|
};
|
|
1711
1612
|
const output = transformToOutputBundle(bundle, changed);
|
|
1712
|
-
await handler.call(new PluginContext(
|
|
1613
|
+
await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts), output, isWrite);
|
|
1713
1614
|
return collectChangedBundle(changed, output);
|
|
1714
1615
|
},
|
|
1715
1616
|
meta: bindingifyPluginHookMeta(meta)
|
|
1716
1617
|
};
|
|
1717
1618
|
}
|
|
1718
|
-
function bindingifyWriteBundle(
|
|
1719
|
-
const hook = plugin.writeBundle;
|
|
1619
|
+
function bindingifyWriteBundle(args) {
|
|
1620
|
+
const hook = args.plugin.writeBundle;
|
|
1720
1621
|
if (!hook) {
|
|
1721
1622
|
return {};
|
|
1722
1623
|
}
|
|
@@ -1728,27 +1629,27 @@ function bindingifyWriteBundle(plugin, options, outputOptions, pluginContextData
|
|
|
1728
1629
|
deleted: new Set()
|
|
1729
1630
|
};
|
|
1730
1631
|
const output = transformToOutputBundle(bundle, changed);
|
|
1731
|
-
await handler.call(new PluginContext(
|
|
1632
|
+
await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), {}, output);
|
|
1732
1633
|
return collectChangedBundle(changed, output);
|
|
1733
1634
|
},
|
|
1734
1635
|
meta: bindingifyPluginHookMeta(meta)
|
|
1735
1636
|
};
|
|
1736
1637
|
}
|
|
1737
|
-
function bindingifyCloseBundle(
|
|
1738
|
-
const hook = plugin.closeBundle;
|
|
1638
|
+
function bindingifyCloseBundle(args) {
|
|
1639
|
+
const hook = args.plugin.closeBundle;
|
|
1739
1640
|
if (!hook) {
|
|
1740
1641
|
return {};
|
|
1741
1642
|
}
|
|
1742
1643
|
const { handler: handler, meta: meta } = normalizeHook(hook);
|
|
1743
1644
|
return {
|
|
1744
1645
|
plugin: async (ctx) => {
|
|
1745
|
-
await handler.call(new PluginContext(
|
|
1646
|
+
await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel));
|
|
1746
1647
|
},
|
|
1747
1648
|
meta: bindingifyPluginHookMeta(meta)
|
|
1748
1649
|
};
|
|
1749
1650
|
}
|
|
1750
|
-
function bindingifyBanner(
|
|
1751
|
-
const hook = plugin.banner;
|
|
1651
|
+
function bindingifyBanner(args) {
|
|
1652
|
+
const hook = args.plugin.banner;
|
|
1752
1653
|
if (!hook) {
|
|
1753
1654
|
return {};
|
|
1754
1655
|
}
|
|
@@ -1758,13 +1659,13 @@ function bindingifyBanner(plugin, options, pluginContextData) {
|
|
|
1758
1659
|
if (typeof handler === "string") {
|
|
1759
1660
|
return handler;
|
|
1760
1661
|
}
|
|
1761
|
-
return handler.call(new PluginContext(
|
|
1662
|
+
return handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), chunk);
|
|
1762
1663
|
},
|
|
1763
1664
|
meta: bindingifyPluginHookMeta(meta)
|
|
1764
1665
|
};
|
|
1765
1666
|
}
|
|
1766
|
-
function bindingifyFooter(
|
|
1767
|
-
const hook = plugin.footer;
|
|
1667
|
+
function bindingifyFooter(args) {
|
|
1668
|
+
const hook = args.plugin.footer;
|
|
1768
1669
|
if (!hook) {
|
|
1769
1670
|
return {};
|
|
1770
1671
|
}
|
|
@@ -1774,13 +1675,13 @@ function bindingifyFooter(plugin, options, pluginContextData) {
|
|
|
1774
1675
|
if (typeof handler === "string") {
|
|
1775
1676
|
return handler;
|
|
1776
1677
|
}
|
|
1777
|
-
return handler.call(new PluginContext(
|
|
1678
|
+
return handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), chunk);
|
|
1778
1679
|
},
|
|
1779
1680
|
meta: bindingifyPluginHookMeta(meta)
|
|
1780
1681
|
};
|
|
1781
1682
|
}
|
|
1782
|
-
function bindingifyIntro(
|
|
1783
|
-
const hook = plugin.intro;
|
|
1683
|
+
function bindingifyIntro(args) {
|
|
1684
|
+
const hook = args.plugin.intro;
|
|
1784
1685
|
if (!hook) {
|
|
1785
1686
|
return {};
|
|
1786
1687
|
}
|
|
@@ -1790,13 +1691,13 @@ function bindingifyIntro(plugin, options, pluginContextData) {
|
|
|
1790
1691
|
if (typeof handler === "string") {
|
|
1791
1692
|
return handler;
|
|
1792
1693
|
}
|
|
1793
|
-
return handler.call(new PluginContext(
|
|
1694
|
+
return handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), chunk);
|
|
1794
1695
|
},
|
|
1795
1696
|
meta: bindingifyPluginHookMeta(meta)
|
|
1796
1697
|
};
|
|
1797
1698
|
}
|
|
1798
|
-
function bindingifyOutro(
|
|
1799
|
-
const hook = plugin.outro;
|
|
1699
|
+
function bindingifyOutro(args) {
|
|
1700
|
+
const hook = args.plugin.outro;
|
|
1800
1701
|
if (!hook) {
|
|
1801
1702
|
return {};
|
|
1802
1703
|
}
|
|
@@ -1806,7 +1707,7 @@ function bindingifyOutro(plugin, options, pluginContextData) {
|
|
|
1806
1707
|
if (typeof handler === "string") {
|
|
1807
1708
|
return handler;
|
|
1808
1709
|
}
|
|
1809
|
-
return handler.call(new PluginContext(
|
|
1710
|
+
return handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), chunk);
|
|
1810
1711
|
},
|
|
1811
1712
|
meta: bindingifyPluginHookMeta(meta)
|
|
1812
1713
|
};
|
|
@@ -1814,28 +1715,28 @@ function bindingifyOutro(plugin, options, pluginContextData) {
|
|
|
1814
1715
|
|
|
1815
1716
|
//#endregion
|
|
1816
1717
|
//#region src/plugin/bindingify-watch-hooks.ts
|
|
1817
|
-
function bindingifyWatchChange(
|
|
1818
|
-
const hook = plugin.watchChange;
|
|
1718
|
+
function bindingifyWatchChange(args) {
|
|
1719
|
+
const hook = args.plugin.watchChange;
|
|
1819
1720
|
if (!hook) {
|
|
1820
1721
|
return {};
|
|
1821
1722
|
}
|
|
1822
1723
|
const { handler: handler, meta: meta } = normalizeHook(hook);
|
|
1823
1724
|
return {
|
|
1824
1725
|
plugin: async (ctx, id, event) => {
|
|
1825
|
-
await handler.call(new PluginContext(
|
|
1726
|
+
await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), id, {event: event});
|
|
1826
1727
|
},
|
|
1827
1728
|
meta: bindingifyPluginHookMeta(meta)
|
|
1828
1729
|
};
|
|
1829
1730
|
}
|
|
1830
|
-
function bindingifyCloseWatcher(
|
|
1831
|
-
const hook = plugin.closeWatcher;
|
|
1731
|
+
function bindingifyCloseWatcher(args) {
|
|
1732
|
+
const hook = args.plugin.closeWatcher;
|
|
1832
1733
|
if (!hook) {
|
|
1833
1734
|
return {};
|
|
1834
1735
|
}
|
|
1835
1736
|
const { handler: handler, meta: meta } = normalizeHook(hook);
|
|
1836
1737
|
return {
|
|
1837
1738
|
plugin: async (ctx) => {
|
|
1838
|
-
await handler.call(new PluginContext(
|
|
1739
|
+
await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel));
|
|
1839
1740
|
},
|
|
1840
1741
|
meta: bindingifyPluginHookMeta(meta)
|
|
1841
1742
|
};
|
|
@@ -1843,27 +1744,35 @@ function bindingifyCloseWatcher(plugin, options, pluginContextData) {
|
|
|
1843
1744
|
|
|
1844
1745
|
//#endregion
|
|
1845
1746
|
//#region src/plugin/bindingify-plugin.ts
|
|
1846
|
-
function bindingifyPlugin(plugin, options, outputOptions, pluginContextData) {
|
|
1847
|
-
const
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
const { plugin:
|
|
1856
|
-
const { plugin:
|
|
1857
|
-
const { plugin:
|
|
1858
|
-
const { plugin:
|
|
1859
|
-
const { plugin:
|
|
1860
|
-
const { plugin:
|
|
1861
|
-
const { plugin:
|
|
1862
|
-
const { plugin:
|
|
1863
|
-
const { plugin:
|
|
1864
|
-
const { plugin:
|
|
1865
|
-
const { plugin:
|
|
1866
|
-
const { plugin:
|
|
1747
|
+
function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, onLog, logLevel) {
|
|
1748
|
+
const args = {
|
|
1749
|
+
plugin,
|
|
1750
|
+
options,
|
|
1751
|
+
outputOptions,
|
|
1752
|
+
pluginContextData,
|
|
1753
|
+
onLog,
|
|
1754
|
+
logLevel
|
|
1755
|
+
};
|
|
1756
|
+
const { plugin: buildStart, meta: buildStartMeta } = bindingifyBuildStart(args);
|
|
1757
|
+
const { plugin: resolveId, meta: resolveIdMeta, filter: resolveIdFilter } = bindingifyResolveId(args);
|
|
1758
|
+
const { plugin: resolveDynamicImport, meta: resolveDynamicImportMeta } = bindingifyResolveDynamicImport(args);
|
|
1759
|
+
const { plugin: buildEnd, meta: buildEndMeta } = bindingifyBuildEnd(args);
|
|
1760
|
+
const { plugin: transform, meta: transformMeta, filter: transformFilter } = bindingifyTransform(args);
|
|
1761
|
+
const { plugin: moduleParsed, meta: moduleParsedMeta } = bindingifyModuleParsed(args);
|
|
1762
|
+
const { plugin: load, meta: loadMeta, filter: loadFilter } = bindingifyLoad(args);
|
|
1763
|
+
const { plugin: renderChunk, meta: renderChunkMeta } = bindingifyRenderChunk(args);
|
|
1764
|
+
const { plugin: augmentChunkHash, meta: augmentChunkHashMeta } = bindingifyAugmentChunkHash(args);
|
|
1765
|
+
const { plugin: renderStart, meta: renderStartMeta } = bindingifyRenderStart(args);
|
|
1766
|
+
const { plugin: renderError, meta: renderErrorMeta } = bindingifyRenderError(args);
|
|
1767
|
+
const { plugin: generateBundle, meta: generateBundleMeta } = bindingifyGenerateBundle(args);
|
|
1768
|
+
const { plugin: writeBundle, meta: writeBundleMeta } = bindingifyWriteBundle(args);
|
|
1769
|
+
const { plugin: closeBundle, meta: closeBundleMeta } = bindingifyCloseBundle(args);
|
|
1770
|
+
const { plugin: banner, meta: bannerMeta } = bindingifyBanner(args);
|
|
1771
|
+
const { plugin: footer, meta: footerMeta } = bindingifyFooter(args);
|
|
1772
|
+
const { plugin: intro, meta: introMeta } = bindingifyIntro(args);
|
|
1773
|
+
const { plugin: outro, meta: outroMeta } = bindingifyOutro(args);
|
|
1774
|
+
const { plugin: watchChange, meta: watchChangeMeta } = bindingifyWatchChange(args);
|
|
1775
|
+
const { plugin: closeWatcher, meta: closeWatcherMeta } = bindingifyCloseWatcher(args);
|
|
1867
1776
|
const result = {
|
|
1868
1777
|
name: plugin.name ?? "unknown",
|
|
1869
1778
|
buildStart,
|
|
@@ -1977,7 +1886,49 @@ class PluginContextData {
|
|
|
1977
1886
|
}
|
|
1978
1887
|
|
|
1979
1888
|
//#endregion
|
|
1980
|
-
//#region src/
|
|
1889
|
+
//#region src/builtin-plugin/utils.ts
|
|
1890
|
+
var import_binding$3 = __toESM(require_binding());
|
|
1891
|
+
function makeBuiltinPluginCallable(plugin) {
|
|
1892
|
+
let callablePlugin = new import_binding$3.BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
|
|
1893
|
+
const wrappedPlugin = {_original: callablePlugin};
|
|
1894
|
+
for (const key in callablePlugin) {
|
|
1895
|
+
if (key === "name") {
|
|
1896
|
+
wrappedPlugin[key] = callablePlugin[key];
|
|
1897
|
+
} else {
|
|
1898
|
+
wrappedPlugin[key] = function(...args) {
|
|
1899
|
+
return callablePlugin[key](...args);
|
|
1900
|
+
};
|
|
1901
|
+
}
|
|
1902
|
+
}
|
|
1903
|
+
return wrappedPlugin;
|
|
1904
|
+
}
|
|
1905
|
+
function isCallableBuiltinPlugin(plugin) {
|
|
1906
|
+
return "_original"in plugin && plugin._original instanceof import_binding$3.BindingCallableBuiltinPlugin;
|
|
1907
|
+
}
|
|
1908
|
+
function bindingifyBuiltInPlugin(plugin) {
|
|
1909
|
+
return {
|
|
1910
|
+
__name: plugin.name,
|
|
1911
|
+
options: plugin.options
|
|
1912
|
+
};
|
|
1913
|
+
}
|
|
1914
|
+
function isCallableCompatibleBuiltinPlugin(plugin) {
|
|
1915
|
+
return plugin instanceof BuiltinPlugin && (0, import_binding$3.isCallableCompatibleBuiltinPlugin)(bindingifyBuiltInPlugin(plugin));
|
|
1916
|
+
}
|
|
1917
|
+
|
|
1918
|
+
//#endregion
|
|
1919
|
+
//#region src/utils/normalize-string-or-regex.ts
|
|
1920
|
+
function normalizedStringOrRegex(pattern) {
|
|
1921
|
+
if (!pattern) {
|
|
1922
|
+
return undefined;
|
|
1923
|
+
}
|
|
1924
|
+
if (!Array.isArray(pattern)) {
|
|
1925
|
+
pattern = [pattern];
|
|
1926
|
+
}
|
|
1927
|
+
return pattern;
|
|
1928
|
+
}
|
|
1929
|
+
|
|
1930
|
+
//#endregion
|
|
1931
|
+
//#region src/utils/bindingify-input-options.ts
|
|
1981
1932
|
var import_binding$2 = __toESM(require_binding());
|
|
1982
1933
|
function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions) {
|
|
1983
1934
|
const pluginContextData = new PluginContextData();
|
|
@@ -1990,7 +1941,7 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions) {
|
|
|
1990
1941
|
if (plugin instanceof BuiltinPlugin) {
|
|
1991
1942
|
return bindingifyBuiltInPlugin(plugin);
|
|
1992
1943
|
}
|
|
1993
|
-
return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData);
|
|
1944
|
+
return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData, onLog, logLevel);
|
|
1994
1945
|
});
|
|
1995
1946
|
return {
|
|
1996
1947
|
input: bindingifyInput(inputOptions.input),
|
|
@@ -2167,7 +2118,7 @@ function bindingifyTreeshakeOptions(config) {
|
|
|
2167
2118
|
}
|
|
2168
2119
|
|
|
2169
2120
|
//#endregion
|
|
2170
|
-
//#region src/
|
|
2121
|
+
//#region src/utils/bindingify-output-options.ts
|
|
2171
2122
|
function bindingifyOutputOptions(outputOptions) {
|
|
2172
2123
|
const { dir: dir, format: format, exports: exports, hashCharacters: hashCharacters, sourcemap: sourcemap, sourcemapIgnoreList: sourcemapIgnoreList, sourcemapPathTransform: sourcemapPathTransform, name: name, assetFileNames: assetFileNames, entryFileNames: entryFileNames, chunkFileNames: chunkFileNames, cssEntryFileNames: cssEntryFileNames, cssChunkFileNames: cssChunkFileNames, banner: banner, footer: footer, intro: intro, outro: outro, esModule: esModule, globals: globals, file: file } = outputOptions;
|
|
2173
2124
|
return {
|
|
@@ -2917,6 +2868,7 @@ const description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-comp
|
|
|
2917
2868
|
const VERSION = version;
|
|
2918
2869
|
|
|
2919
2870
|
//#endregion
|
|
2871
|
+
exports.BuiltinPlugin = BuiltinPlugin;
|
|
2920
2872
|
exports.LogLevelOptionSchema = LogLevelOptionSchema;
|
|
2921
2873
|
exports.LogLevelSchema = LogLevelSchema;
|
|
2922
2874
|
exports.LogLevelWithErrorSchema = LogLevelWithErrorSchema;
|
|
@@ -2925,7 +2877,6 @@ exports.RollupLogSchema = RollupLogSchema;
|
|
|
2925
2877
|
exports.RollupLogWithStringSchema = RollupLogWithStringSchema;
|
|
2926
2878
|
exports.TreeshakingOptionsSchema = TreeshakingOptionsSchema;
|
|
2927
2879
|
exports.VERSION = VERSION;
|
|
2928
|
-
exports.aliasPlugin = aliasPlugin;
|
|
2929
2880
|
exports.arraify = arraify;
|
|
2930
2881
|
exports.bindingifyPlugin = bindingifyPlugin;
|
|
2931
2882
|
exports.buildImportAnalysisPlugin = buildImportAnalysisPlugin;
|
|
@@ -2942,10 +2893,9 @@ exports.loadFallbackPlugin = loadFallbackPlugin;
|
|
|
2942
2893
|
exports.makeBuiltinPluginCallable = makeBuiltinPluginCallable;
|
|
2943
2894
|
exports.manifestPlugin = manifestPlugin;
|
|
2944
2895
|
exports.modulePreloadPolyfillPlugin = modulePreloadPolyfillPlugin;
|
|
2945
|
-
exports.
|
|
2896
|
+
exports.normalizedStringOrRegex = normalizedStringOrRegex;
|
|
2946
2897
|
exports.require_binding = require_binding;
|
|
2947
2898
|
exports.rolldown = rolldown;
|
|
2948
|
-
exports.transformPlugin = transformPlugin;
|
|
2949
2899
|
exports.version = version;
|
|
2950
2900
|
exports.viteResolvePlugin = viteResolvePlugin;
|
|
2951
2901
|
exports.wasmFallbackPlugin = wasmFallbackPlugin;
|