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
|
@@ -594,6 +594,7 @@ var require_binding = __commonJSMin((exports, module) => {
|
|
|
594
594
|
module.exports.BindingCallableBuiltinPlugin = nativeBinding.BindingCallableBuiltinPlugin;
|
|
595
595
|
module.exports.BindingLog = nativeBinding.BindingLog;
|
|
596
596
|
module.exports.BindingModuleInfo = nativeBinding.BindingModuleInfo;
|
|
597
|
+
module.exports.BindingNormalizedOptions = nativeBinding.BindingNormalizedOptions;
|
|
597
598
|
module.exports.BindingOutputAsset = nativeBinding.BindingOutputAsset;
|
|
598
599
|
module.exports.BindingOutputChunk = nativeBinding.BindingOutputChunk;
|
|
599
600
|
module.exports.BindingOutputs = nativeBinding.BindingOutputs;
|
|
@@ -850,29 +851,6 @@ function normalizeHook(hook) {
|
|
|
850
851
|
|
|
851
852
|
//#endregion
|
|
852
853
|
//#region src/log/logger.ts
|
|
853
|
-
class MinimalPluginContext {
|
|
854
|
-
info;
|
|
855
|
-
warn;
|
|
856
|
-
debug;
|
|
857
|
-
meta;
|
|
858
|
-
error;
|
|
859
|
-
constructor(options, plugin) {
|
|
860
|
-
const onLog = options.onLog;
|
|
861
|
-
const pluginName = plugin.name || "unknown";
|
|
862
|
-
const logLevel = options.logLevel || LOG_LEVEL_INFO;
|
|
863
|
-
this.debug = getLogHandler(LOG_LEVEL_DEBUG, "PLUGIN_LOG", onLog, pluginName, logLevel);
|
|
864
|
-
this.info = getLogHandler(LOG_LEVEL_INFO, "PLUGIN_LOG", onLog, pluginName, logLevel);
|
|
865
|
-
this.warn = getLogHandler(LOG_LEVEL_WARN, "PLUGIN_WARNING", onLog, pluginName, logLevel);
|
|
866
|
-
this.error = (e) => {
|
|
867
|
-
return error(logPluginError(normalizeLog(e), pluginName));
|
|
868
|
-
};
|
|
869
|
-
this.meta = {
|
|
870
|
-
rollupVersion: "4.23.0",
|
|
871
|
-
rolldownVersion: VERSION,
|
|
872
|
-
watchMode: false
|
|
873
|
-
};
|
|
874
|
-
}
|
|
875
|
-
}
|
|
876
854
|
function getLogger(plugins, onLog, logLevel) {
|
|
877
855
|
const minimalPriority = logLevelPriority[logLevel];
|
|
878
856
|
const logger = (level, log, skipped = new Set()) => {
|
|
@@ -970,35 +948,7 @@ function relativeId(id) {
|
|
|
970
948
|
}
|
|
971
949
|
|
|
972
950
|
//#endregion
|
|
973
|
-
//#region src/
|
|
974
|
-
function normalizedStringOrRegex(pattern) {
|
|
975
|
-
if (!pattern) {
|
|
976
|
-
return undefined;
|
|
977
|
-
}
|
|
978
|
-
if (!Array.isArray(pattern)) {
|
|
979
|
-
pattern = [pattern];
|
|
980
|
-
}
|
|
981
|
-
return pattern;
|
|
982
|
-
}
|
|
983
|
-
|
|
984
|
-
//#endregion
|
|
985
|
-
//#region src/options/normalized-ecma-transform-plugin-config.ts
|
|
986
|
-
function normalizeEcmaTransformPluginConfig(config) {
|
|
987
|
-
if (!config) {
|
|
988
|
-
return undefined;
|
|
989
|
-
}
|
|
990
|
-
let normalizedConfig = {
|
|
991
|
-
jsxInject: config?.jsxInject,
|
|
992
|
-
exclude: normalizedStringOrRegex(config.exclude),
|
|
993
|
-
include: normalizedStringOrRegex(config.include),
|
|
994
|
-
targets: config.targets
|
|
995
|
-
};
|
|
996
|
-
return normalizedConfig;
|
|
997
|
-
}
|
|
998
|
-
|
|
999
|
-
//#endregion
|
|
1000
|
-
//#region src/plugin/builtin-plugin.ts
|
|
1001
|
-
var import_binding$5 = __toESM(require_binding());
|
|
951
|
+
//#region src/builtin-plugin/constructors.ts
|
|
1002
952
|
class BuiltinPlugin {
|
|
1003
953
|
constructor(name, options) {
|
|
1004
954
|
this.name = name;
|
|
@@ -1007,143 +957,39 @@ class BuiltinPlugin {
|
|
|
1007
957
|
this.options = options;
|
|
1008
958
|
}
|
|
1009
959
|
}
|
|
1010
|
-
class ModulePreloadPolyfillPlugin extends BuiltinPlugin {
|
|
1011
|
-
constructor(config) {
|
|
1012
|
-
super(import_binding$5.BindingBuiltinPluginName.ModulePreloadPolyfillPlugin, config);
|
|
1013
|
-
}
|
|
1014
|
-
}
|
|
1015
|
-
class DynamicImportVarsPlugin extends BuiltinPlugin {
|
|
1016
|
-
constructor() {
|
|
1017
|
-
super(import_binding$5.BindingBuiltinPluginName.DynamicImportVarsPlugin);
|
|
1018
|
-
}
|
|
1019
|
-
}
|
|
1020
|
-
class ImportGlobPlugin extends BuiltinPlugin {
|
|
1021
|
-
constructor(config) {
|
|
1022
|
-
super(import_binding$5.BindingBuiltinPluginName.ImportGlobPlugin, config);
|
|
1023
|
-
}
|
|
1024
|
-
}
|
|
1025
|
-
class ManifestPlugin extends BuiltinPlugin {
|
|
1026
|
-
constructor(config) {
|
|
1027
|
-
super(import_binding$5.BindingBuiltinPluginName.ManifestPlugin, config);
|
|
1028
|
-
}
|
|
1029
|
-
}
|
|
1030
|
-
class WasmHelperPlugin extends BuiltinPlugin {
|
|
1031
|
-
constructor() {
|
|
1032
|
-
super(import_binding$5.BindingBuiltinPluginName.WasmHelperPlugin);
|
|
1033
|
-
}
|
|
1034
|
-
}
|
|
1035
|
-
class WasmFallbackPlugin extends BuiltinPlugin {
|
|
1036
|
-
constructor() {
|
|
1037
|
-
super(import_binding$5.BindingBuiltinPluginName.WasmFallbackPlugin);
|
|
1038
|
-
}
|
|
1039
|
-
}
|
|
1040
|
-
class LoadFallbackPlugin extends BuiltinPlugin {
|
|
1041
|
-
constructor() {
|
|
1042
|
-
super(import_binding$5.BindingBuiltinPluginName.LoadFallbackPlugin);
|
|
1043
|
-
}
|
|
1044
|
-
}
|
|
1045
|
-
class AliasPlugin extends BuiltinPlugin {
|
|
1046
|
-
constructor(config) {
|
|
1047
|
-
super(import_binding$5.BindingBuiltinPluginName.AliasPlugin, config);
|
|
1048
|
-
}
|
|
1049
|
-
}
|
|
1050
|
-
class TransformPlugin extends BuiltinPlugin {
|
|
1051
|
-
constructor(config) {
|
|
1052
|
-
let normalizedConfig = normalizeEcmaTransformPluginConfig(config);
|
|
1053
|
-
super(import_binding$5.BindingBuiltinPluginName.TransformPlugin, normalizedConfig);
|
|
1054
|
-
}
|
|
1055
|
-
}
|
|
1056
|
-
class JsonPlugin extends BuiltinPlugin {
|
|
1057
|
-
constructor(config) {
|
|
1058
|
-
super(import_binding$5.BindingBuiltinPluginName.JsonPlugin, config);
|
|
1059
|
-
}
|
|
1060
|
-
}
|
|
1061
|
-
class BuildImportAnalysisPlugin extends BuiltinPlugin {
|
|
1062
|
-
constructor(config) {
|
|
1063
|
-
super(import_binding$5.BindingBuiltinPluginName.BuildImportAnalysisPlugin, config);
|
|
1064
|
-
}
|
|
1065
|
-
}
|
|
1066
|
-
class ReplacePlugin extends BuiltinPlugin {
|
|
1067
|
-
constructor(config) {
|
|
1068
|
-
super(import_binding$5.BindingBuiltinPluginName.ReplacePlugin, config);
|
|
1069
|
-
}
|
|
1070
|
-
}
|
|
1071
|
-
class ViteResolvePlugin extends BuiltinPlugin {
|
|
1072
|
-
constructor(config) {
|
|
1073
|
-
super(import_binding$5.BindingBuiltinPluginName.ViteResolvePlugin, config);
|
|
1074
|
-
}
|
|
1075
|
-
}
|
|
1076
960
|
function modulePreloadPolyfillPlugin(config) {
|
|
1077
|
-
return new
|
|
961
|
+
return new BuiltinPlugin("builtin:module-preload-polyfill", config);
|
|
1078
962
|
}
|
|
1079
963
|
function dynamicImportVarsPlugin() {
|
|
1080
|
-
return new
|
|
964
|
+
return new BuiltinPlugin("builtin:dynamic-import-vars");
|
|
1081
965
|
}
|
|
1082
966
|
function importGlobPlugin(config) {
|
|
1083
|
-
return new
|
|
967
|
+
return new BuiltinPlugin("builtin:import-glob", config);
|
|
1084
968
|
}
|
|
1085
969
|
function manifestPlugin(config) {
|
|
1086
|
-
return new
|
|
970
|
+
return new BuiltinPlugin("builtin:manifest", config);
|
|
1087
971
|
}
|
|
1088
972
|
function wasmHelperPlugin() {
|
|
1089
|
-
return new
|
|
973
|
+
return new BuiltinPlugin("builtin:wasm-helper");
|
|
1090
974
|
}
|
|
1091
975
|
function wasmFallbackPlugin() {
|
|
1092
|
-
return new
|
|
1093
|
-
}
|
|
1094
|
-
function transformPlugin(config) {
|
|
1095
|
-
return new TransformPlugin(config);
|
|
976
|
+
return new BuiltinPlugin("builtin:wasm-fallback");
|
|
1096
977
|
}
|
|
1097
978
|
function loadFallbackPlugin() {
|
|
1098
|
-
return new
|
|
1099
|
-
}
|
|
1100
|
-
function aliasPlugin(config) {
|
|
1101
|
-
return new AliasPlugin(config);
|
|
979
|
+
return new BuiltinPlugin("builtin:load-fallback");
|
|
1102
980
|
}
|
|
1103
981
|
function jsonPlugin(config) {
|
|
1104
|
-
return new
|
|
982
|
+
return new BuiltinPlugin("builtin:json", config);
|
|
1105
983
|
}
|
|
1106
984
|
function buildImportAnalysisPlugin(config) {
|
|
1107
|
-
return new
|
|
985
|
+
return new BuiltinPlugin("builtin:build-import-analysis", config);
|
|
1108
986
|
}
|
|
1109
987
|
function viteResolvePlugin(config) {
|
|
1110
|
-
return new
|
|
988
|
+
return new BuiltinPlugin("builtin:vite-resolve", {
|
|
1111
989
|
...config,
|
|
1112
990
|
runtime: process.versions.deno ? "deno" : process.versions.bun ? "bun" : "node"
|
|
1113
991
|
});
|
|
1114
992
|
}
|
|
1115
|
-
function replacePlugin(values = {}, options = {}) {
|
|
1116
|
-
return new ReplacePlugin({
|
|
1117
|
-
...options,
|
|
1118
|
-
values
|
|
1119
|
-
});
|
|
1120
|
-
}
|
|
1121
|
-
function isCallableCompatibleBuiltinPlugin(plugin) {
|
|
1122
|
-
return plugin instanceof BuiltinPlugin && (0, import_binding$5.isCallableCompatibleBuiltinPlugin)(bindingifyBuiltInPlugin(plugin));
|
|
1123
|
-
}
|
|
1124
|
-
function makeBuiltinPluginCallable(plugin) {
|
|
1125
|
-
let callablePlugin = new import_binding$5.BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
|
|
1126
|
-
const wrappedPlugin = {_original: callablePlugin};
|
|
1127
|
-
for (const key in callablePlugin) {
|
|
1128
|
-
if (key === "name") {
|
|
1129
|
-
wrappedPlugin[key] = callablePlugin[key];
|
|
1130
|
-
} else {
|
|
1131
|
-
wrappedPlugin[key] = function(...args) {
|
|
1132
|
-
return callablePlugin[key](...args);
|
|
1133
|
-
};
|
|
1134
|
-
}
|
|
1135
|
-
}
|
|
1136
|
-
return wrappedPlugin;
|
|
1137
|
-
}
|
|
1138
|
-
function isCallableBuiltinPlugin(plugin) {
|
|
1139
|
-
return "_original"in plugin && plugin._original instanceof import_binding$5.BindingCallableBuiltinPlugin;
|
|
1140
|
-
}
|
|
1141
|
-
function bindingifyBuiltInPlugin(plugin) {
|
|
1142
|
-
return {
|
|
1143
|
-
__name: plugin.name,
|
|
1144
|
-
options: plugin.options
|
|
1145
|
-
};
|
|
1146
|
-
}
|
|
1147
993
|
|
|
1148
994
|
//#endregion
|
|
1149
995
|
//#region src/plugin/plugin-driver.ts
|
|
@@ -1274,14 +1120,38 @@ function transformModuleInfo(info, option) {
|
|
|
1274
1120
|
};
|
|
1275
1121
|
}
|
|
1276
1122
|
|
|
1123
|
+
//#endregion
|
|
1124
|
+
//#region src/plugin/minimal-plugin-context.ts
|
|
1125
|
+
class MinimalPluginContext {
|
|
1126
|
+
info;
|
|
1127
|
+
warn;
|
|
1128
|
+
debug;
|
|
1129
|
+
meta;
|
|
1130
|
+
error;
|
|
1131
|
+
constructor(onLog, logLevel, plugin) {
|
|
1132
|
+
const pluginName = plugin.name || "unknown";
|
|
1133
|
+
this.debug = getLogHandler(LOG_LEVEL_DEBUG, "PLUGIN_LOG", onLog, pluginName, logLevel);
|
|
1134
|
+
this.info = getLogHandler(LOG_LEVEL_INFO, "PLUGIN_LOG", onLog, pluginName, logLevel);
|
|
1135
|
+
this.warn = getLogHandler(LOG_LEVEL_WARN, "PLUGIN_WARNING", onLog, pluginName, logLevel);
|
|
1136
|
+
this.error = (e) => {
|
|
1137
|
+
return error(logPluginError(normalizeLog(e), pluginName));
|
|
1138
|
+
};
|
|
1139
|
+
this.meta = {
|
|
1140
|
+
rollupVersion: "4.23.0",
|
|
1141
|
+
rolldownVersion: VERSION,
|
|
1142
|
+
watchMode: false
|
|
1143
|
+
};
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1277
1147
|
//#endregion
|
|
1278
1148
|
//#region src/utils/transform-side-effects.ts
|
|
1279
|
-
var import_binding$
|
|
1149
|
+
var import_binding$5 = __toESM(require_binding());
|
|
1280
1150
|
function bindingifySideEffects(sideEffects) {
|
|
1281
1151
|
switch (sideEffects) {
|
|
1282
|
-
case true: return import_binding$
|
|
1283
|
-
case false: return import_binding$
|
|
1284
|
-
case "no-treeshake": return import_binding$
|
|
1152
|
+
case true: return import_binding$5.BindingHookSideEffects.True;
|
|
1153
|
+
case false: return import_binding$5.BindingHookSideEffects.False;
|
|
1154
|
+
case "no-treeshake": return import_binding$5.BindingHookSideEffects.NoTreeshake;
|
|
1285
1155
|
case null:
|
|
1286
1156
|
case undefined: return undefined;
|
|
1287
1157
|
default: throw new Error(`Unexpected side effects: ${sideEffects}`);
|
|
@@ -1299,16 +1169,16 @@ class PluginContext extends MinimalPluginContext {
|
|
|
1299
1169
|
getModuleIds;
|
|
1300
1170
|
addWatchFile;
|
|
1301
1171
|
parse;
|
|
1302
|
-
constructor(
|
|
1303
|
-
super(
|
|
1304
|
-
this.load = async ({ id: id,...options
|
|
1172
|
+
constructor(context, plugin, data, onLog, logLevel) {
|
|
1173
|
+
super(onLog, logLevel, plugin);
|
|
1174
|
+
this.load = async ({ id: id,...options }) => {
|
|
1305
1175
|
const moduleInfo = data.getModuleInfo(id, context);
|
|
1306
1176
|
if (moduleInfo && moduleInfo.code !== null) {
|
|
1307
1177
|
return moduleInfo;
|
|
1308
1178
|
}
|
|
1309
1179
|
const rawOptions = {
|
|
1310
|
-
meta: options
|
|
1311
|
-
moduleSideEffects: options
|
|
1180
|
+
meta: options.meta || {},
|
|
1181
|
+
moduleSideEffects: options.moduleSideEffects || null
|
|
1312
1182
|
};
|
|
1313
1183
|
data.updateModuleOption(id, rawOptions);
|
|
1314
1184
|
async function createLoadModulePromise() {
|
|
@@ -1322,7 +1192,7 @@ class PluginContext extends MinimalPluginContext {
|
|
|
1322
1192
|
});
|
|
1323
1193
|
data.loadModulePromiseMap.set(id, promise);
|
|
1324
1194
|
try {
|
|
1325
|
-
await context.load(id, bindingifySideEffects(options
|
|
1195
|
+
await context.load(id, bindingifySideEffects(options.moduleSideEffects), resolveFn);
|
|
1326
1196
|
} finally {
|
|
1327
1197
|
data.loadModulePromiseMap.delete(id);
|
|
1328
1198
|
}
|
|
@@ -1331,14 +1201,14 @@ class PluginContext extends MinimalPluginContext {
|
|
|
1331
1201
|
await createLoadModulePromise();
|
|
1332
1202
|
return data.getModuleInfo(id, context);
|
|
1333
1203
|
};
|
|
1334
|
-
this.resolve = async (source, importer, options
|
|
1204
|
+
this.resolve = async (source, importer, options) => {
|
|
1335
1205
|
let receipt = undefined;
|
|
1336
|
-
if (options
|
|
1337
|
-
receipt = data.saveResolveOptions(options
|
|
1206
|
+
if (options != null) {
|
|
1207
|
+
receipt = data.saveResolveOptions(options);
|
|
1338
1208
|
}
|
|
1339
1209
|
const res = await context.resolve(source, importer, {
|
|
1340
1210
|
custom: receipt,
|
|
1341
|
-
skipSelf: options
|
|
1211
|
+
skipSelf: options?.skipSelf
|
|
1342
1212
|
});
|
|
1343
1213
|
if (receipt != null) {
|
|
1344
1214
|
data.removeSavedResolveOptions(receipt);
|
|
@@ -1372,8 +1242,8 @@ class PluginContext extends MinimalPluginContext {
|
|
|
1372
1242
|
//#region src/plugin/transform-plugin-context.ts
|
|
1373
1243
|
class TransformPluginContext extends PluginContext {
|
|
1374
1244
|
error;
|
|
1375
|
-
constructor(
|
|
1376
|
-
super(
|
|
1245
|
+
constructor(context, plugin, data, inner, moduleId, moduleSource, onLog, LogLevelOption) {
|
|
1246
|
+
super(context, plugin, data, onLog, LogLevelOption);
|
|
1377
1247
|
const getLogHandler$1 = (handler) => (log, pos) => {
|
|
1378
1248
|
log = normalizeLog(log);
|
|
1379
1249
|
if (pos) augmentCodeLocation(log, pos, moduleSource, moduleId);
|
|
@@ -1396,14 +1266,14 @@ class TransformPluginContext extends PluginContext {
|
|
|
1396
1266
|
|
|
1397
1267
|
//#endregion
|
|
1398
1268
|
//#region src/plugin/bindingify-plugin-hook-meta.ts
|
|
1399
|
-
var import_binding$
|
|
1269
|
+
var import_binding$4 = __toESM(require_binding());
|
|
1400
1270
|
function bindingifyPluginHookMeta(options) {
|
|
1401
1271
|
return {order: bindingPluginOrder(options.order)};
|
|
1402
1272
|
}
|
|
1403
1273
|
function bindingPluginOrder(order) {
|
|
1404
1274
|
switch (order) {
|
|
1405
|
-
case "post": return import_binding$
|
|
1406
|
-
case "pre": return import_binding$
|
|
1275
|
+
case "post": return import_binding$4.BindingPluginOrder.Post;
|
|
1276
|
+
case "pre": return import_binding$4.BindingPluginOrder.Pre;
|
|
1407
1277
|
case null:
|
|
1408
1278
|
case undefined: return undefined;
|
|
1409
1279
|
default: throw new Error(`Unknown plugin order: ${order}`);
|
|
@@ -1454,49 +1324,65 @@ function bindingifyTransformFilter(filterOption) {
|
|
|
1454
1324
|
};
|
|
1455
1325
|
}
|
|
1456
1326
|
|
|
1327
|
+
//#endregion
|
|
1328
|
+
//#region src/options/normalized-input-options.ts
|
|
1329
|
+
class NormalizedInputOptions {
|
|
1330
|
+
inner;
|
|
1331
|
+
constructor(inner, onLog) {
|
|
1332
|
+
this.inner = inner;
|
|
1333
|
+
this.onLog = onLog;
|
|
1334
|
+
}
|
|
1335
|
+
get shimMissingExports() {
|
|
1336
|
+
return this.inner.shimMissingExports;
|
|
1337
|
+
}
|
|
1338
|
+
get input() {
|
|
1339
|
+
return this.inner.input;
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1457
1343
|
//#endregion
|
|
1458
1344
|
//#region src/plugin/bindingify-build-hooks.ts
|
|
1459
|
-
function bindingifyBuildStart(
|
|
1460
|
-
const hook = plugin.buildStart;
|
|
1345
|
+
function bindingifyBuildStart(args) {
|
|
1346
|
+
const hook = args.plugin.buildStart;
|
|
1461
1347
|
if (!hook) {
|
|
1462
1348
|
return {};
|
|
1463
1349
|
}
|
|
1464
1350
|
const { handler: handler, meta: meta } = normalizeHook(hook);
|
|
1465
1351
|
return {
|
|
1466
|
-
plugin: async (ctx) => {
|
|
1467
|
-
await handler.call(new PluginContext(
|
|
1352
|
+
plugin: async (ctx, opts) => {
|
|
1353
|
+
await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedInputOptions(opts, args.onLog));
|
|
1468
1354
|
},
|
|
1469
1355
|
meta: bindingifyPluginHookMeta(meta)
|
|
1470
1356
|
};
|
|
1471
1357
|
}
|
|
1472
|
-
function bindingifyBuildEnd(
|
|
1473
|
-
const hook = plugin.buildEnd;
|
|
1358
|
+
function bindingifyBuildEnd(args) {
|
|
1359
|
+
const hook = args.plugin.buildEnd;
|
|
1474
1360
|
if (!hook) {
|
|
1475
1361
|
return {};
|
|
1476
1362
|
}
|
|
1477
1363
|
const { handler: handler, meta: meta } = normalizeHook(hook);
|
|
1478
1364
|
return {
|
|
1479
1365
|
plugin: async (ctx, err) => {
|
|
1480
|
-
await handler.call(new PluginContext(
|
|
1366
|
+
await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), err ? new Error(err) : undefined);
|
|
1481
1367
|
},
|
|
1482
1368
|
meta: bindingifyPluginHookMeta(meta)
|
|
1483
1369
|
};
|
|
1484
1370
|
}
|
|
1485
|
-
function bindingifyResolveId(
|
|
1486
|
-
const hook = plugin.resolveId;
|
|
1371
|
+
function bindingifyResolveId(args) {
|
|
1372
|
+
const hook = args.plugin.resolveId;
|
|
1487
1373
|
if (!hook) {
|
|
1488
1374
|
return {};
|
|
1489
1375
|
}
|
|
1490
1376
|
const { handler: handler, meta: meta, options: options } = normalizeHook(hook);
|
|
1491
1377
|
return {
|
|
1492
1378
|
plugin: async (ctx, specifier, importer, extraOptions) => {
|
|
1493
|
-
const contextResolveOptions = extraOptions.custom != null ? pluginContextData.getSavedResolveOptions(extraOptions.custom) : undefined;
|
|
1379
|
+
const contextResolveOptions = extraOptions.custom != null ? args.pluginContextData.getSavedResolveOptions(extraOptions.custom) : undefined;
|
|
1494
1380
|
const newExtraOptions = {
|
|
1495
1381
|
...extraOptions,
|
|
1496
1382
|
custom: contextResolveOptions?.custom,
|
|
1497
1383
|
[SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF]: contextResolveOptions?.[SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF]
|
|
1498
1384
|
};
|
|
1499
|
-
const ret = await handler.call(new PluginContext(
|
|
1385
|
+
const ret = await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), specifier, importer ?? undefined, newExtraOptions);
|
|
1500
1386
|
if (ret == null) {
|
|
1501
1387
|
return;
|
|
1502
1388
|
}
|
|
@@ -1516,7 +1402,7 @@ function bindingifyResolveId(plugin, normalizedOptions, pluginContextData) {
|
|
|
1516
1402
|
if (ret.moduleSideEffects !== null) {
|
|
1517
1403
|
result.sideEffects = bindingifySideEffects(ret.moduleSideEffects);
|
|
1518
1404
|
}
|
|
1519
|
-
pluginContextData.updateModuleOption(ret.id, {
|
|
1405
|
+
args.pluginContextData.updateModuleOption(ret.id, {
|
|
1520
1406
|
meta: ret.meta || {},
|
|
1521
1407
|
moduleSideEffects: ret.moduleSideEffects || null
|
|
1522
1408
|
});
|
|
@@ -1526,15 +1412,15 @@ function bindingifyResolveId(plugin, normalizedOptions, pluginContextData) {
|
|
|
1526
1412
|
filter: bindingifyResolveIdFilter(options.filter)
|
|
1527
1413
|
};
|
|
1528
1414
|
}
|
|
1529
|
-
function bindingifyResolveDynamicImport(
|
|
1530
|
-
const hook = plugin.resolveDynamicImport;
|
|
1415
|
+
function bindingifyResolveDynamicImport(args) {
|
|
1416
|
+
const hook = args.plugin.resolveDynamicImport;
|
|
1531
1417
|
if (!hook) {
|
|
1532
1418
|
return {};
|
|
1533
1419
|
}
|
|
1534
1420
|
const { handler: handler, meta: meta } = normalizeHook(hook);
|
|
1535
1421
|
return {
|
|
1536
1422
|
plugin: async (ctx, specifier, importer) => {
|
|
1537
|
-
const ret = await handler.call(new PluginContext(
|
|
1423
|
+
const ret = await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), specifier, importer ?? undefined);
|
|
1538
1424
|
if (ret == null) {
|
|
1539
1425
|
return;
|
|
1540
1426
|
}
|
|
@@ -1554,7 +1440,7 @@ function bindingifyResolveDynamicImport(plugin, options, pluginContextData) {
|
|
|
1554
1440
|
if (ret.moduleSideEffects !== null) {
|
|
1555
1441
|
result.sideEffects = bindingifySideEffects(ret.moduleSideEffects);
|
|
1556
1442
|
}
|
|
1557
|
-
pluginContextData.updateModuleOption(ret.id, {
|
|
1443
|
+
args.pluginContextData.updateModuleOption(ret.id, {
|
|
1558
1444
|
meta: ret.meta || {},
|
|
1559
1445
|
moduleSideEffects: ret.moduleSideEffects || null
|
|
1560
1446
|
});
|
|
@@ -1563,22 +1449,22 @@ function bindingifyResolveDynamicImport(plugin, options, pluginContextData) {
|
|
|
1563
1449
|
meta: bindingifyPluginHookMeta(meta)
|
|
1564
1450
|
};
|
|
1565
1451
|
}
|
|
1566
|
-
function bindingifyTransform(
|
|
1567
|
-
const hook = plugin.transform;
|
|
1452
|
+
function bindingifyTransform(args) {
|
|
1453
|
+
const hook = args.plugin.transform;
|
|
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, code, id, meta$1) => {
|
|
1574
|
-
const ret = await handler.call(new TransformPluginContext(
|
|
1460
|
+
const ret = await handler.call(new TransformPluginContext(ctx.inner(), args.plugin, args.pluginContextData, ctx, id, code, args.onLog, args.logLevel), code, id, meta$1);
|
|
1575
1461
|
if (ret == null) {
|
|
1576
1462
|
return undefined;
|
|
1577
1463
|
}
|
|
1578
1464
|
if (typeof ret === "string") {
|
|
1579
1465
|
return {code: ret};
|
|
1580
1466
|
}
|
|
1581
|
-
pluginContextData.updateModuleOption(id, {
|
|
1467
|
+
args.pluginContextData.updateModuleOption(id, {
|
|
1582
1468
|
meta: ret.meta || {},
|
|
1583
1469
|
moduleSideEffects: ret.moduleSideEffects || null
|
|
1584
1470
|
});
|
|
@@ -1593,15 +1479,15 @@ function bindingifyTransform(plugin, normalizedOptions, pluginContextData) {
|
|
|
1593
1479
|
filter: bindingifyTransformFilter(options.filter)
|
|
1594
1480
|
};
|
|
1595
1481
|
}
|
|
1596
|
-
function bindingifyLoad(
|
|
1597
|
-
const hook = plugin.load;
|
|
1482
|
+
function bindingifyLoad(args) {
|
|
1483
|
+
const hook = args.plugin.load;
|
|
1598
1484
|
if (!hook) {
|
|
1599
1485
|
return {};
|
|
1600
1486
|
}
|
|
1601
1487
|
const { handler: handler, meta: meta, options: options } = normalizeHook(hook);
|
|
1602
1488
|
return {
|
|
1603
1489
|
plugin: async (ctx, id) => {
|
|
1604
|
-
const ret = await handler.call(new PluginContext(
|
|
1490
|
+
const ret = await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), id);
|
|
1605
1491
|
if (ret == null) {
|
|
1606
1492
|
return;
|
|
1607
1493
|
}
|
|
@@ -1617,7 +1503,7 @@ function bindingifyLoad(plugin, normalized_options, pluginContextData) {
|
|
|
1617
1503
|
if (ret.moduleSideEffects !== null) {
|
|
1618
1504
|
result.sideEffects = bindingifySideEffects(ret.moduleSideEffects);
|
|
1619
1505
|
}
|
|
1620
|
-
pluginContextData.updateModuleOption(id, {
|
|
1506
|
+
args.pluginContextData.updateModuleOption(id, {
|
|
1621
1507
|
meta: ret.meta || {},
|
|
1622
1508
|
moduleSideEffects: ret.moduleSideEffects || null
|
|
1623
1509
|
});
|
|
@@ -1639,37 +1525,52 @@ function preProcessSourceMap(ret, id) {
|
|
|
1639
1525
|
}
|
|
1640
1526
|
return map;
|
|
1641
1527
|
}
|
|
1642
|
-
function bindingifyModuleParsed(
|
|
1643
|
-
const hook = plugin.moduleParsed;
|
|
1528
|
+
function bindingifyModuleParsed(args) {
|
|
1529
|
+
const hook = args.plugin.moduleParsed;
|
|
1644
1530
|
if (!hook) {
|
|
1645
1531
|
return {};
|
|
1646
1532
|
}
|
|
1647
1533
|
const { handler: handler, meta: meta } = normalizeHook(hook);
|
|
1648
1534
|
return {
|
|
1649
1535
|
plugin: async (ctx, moduleInfo) => {
|
|
1650
|
-
await handler.call(new PluginContext(
|
|
1536
|
+
await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformModuleInfo(moduleInfo, args.pluginContextData.moduleOptionMap.get(moduleInfo.id)));
|
|
1651
1537
|
},
|
|
1652
1538
|
meta: bindingifyPluginHookMeta(meta)
|
|
1653
1539
|
};
|
|
1654
1540
|
}
|
|
1655
1541
|
|
|
1542
|
+
//#endregion
|
|
1543
|
+
//#region src/options/normalized-output-options.ts
|
|
1544
|
+
class NormalizedOutputOptionsImpl {
|
|
1545
|
+
inner;
|
|
1546
|
+
constructor(inner) {
|
|
1547
|
+
this.inner = inner;
|
|
1548
|
+
}
|
|
1549
|
+
get entryFileNames() {
|
|
1550
|
+
return this.inner.entryFilenames || unsupported("You should not take `NormalizedOutputOptions#entryFileNames` and call it directly");
|
|
1551
|
+
}
|
|
1552
|
+
get format() {
|
|
1553
|
+
return this.inner.format;
|
|
1554
|
+
}
|
|
1555
|
+
}
|
|
1556
|
+
|
|
1656
1557
|
//#endregion
|
|
1657
1558
|
//#region src/plugin/bindingify-output-hooks.ts
|
|
1658
|
-
function bindingifyRenderStart(
|
|
1659
|
-
const hook = plugin.renderStart;
|
|
1559
|
+
function bindingifyRenderStart(args) {
|
|
1560
|
+
const hook = args.plugin.renderStart;
|
|
1660
1561
|
if (!hook) {
|
|
1661
1562
|
return {};
|
|
1662
1563
|
}
|
|
1663
1564
|
const { handler: handler, meta: meta } = normalizeHook(hook);
|
|
1664
1565
|
return {
|
|
1665
|
-
plugin: async (ctx) => {
|
|
1666
|
-
handler.call(new PluginContext(
|
|
1566
|
+
plugin: async (ctx, opts) => {
|
|
1567
|
+
handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts), new NormalizedInputOptions(opts, args.onLog));
|
|
1667
1568
|
},
|
|
1668
1569
|
meta: bindingifyPluginHookMeta(meta)
|
|
1669
1570
|
};
|
|
1670
1571
|
}
|
|
1671
|
-
function bindingifyRenderChunk(
|
|
1672
|
-
const hook = plugin.renderChunk;
|
|
1572
|
+
function bindingifyRenderChunk(args) {
|
|
1573
|
+
const hook = args.plugin.renderChunk;
|
|
1673
1574
|
if (!hook) {
|
|
1674
1575
|
return {};
|
|
1675
1576
|
}
|
|
@@ -1679,7 +1580,7 @@ function bindingifyRenderChunk(plugin, options, outputOptions, pluginContextData
|
|
|
1679
1580
|
(Object.entries(chunk.modules)).forEach(([key, module$1]) => {
|
|
1680
1581
|
chunk.modules[key] = transformToRenderedModule(module$1);
|
|
1681
1582
|
});
|
|
1682
|
-
const ret = await handler.call(new PluginContext(
|
|
1583
|
+
const ret = await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), code, chunk, {});
|
|
1683
1584
|
if (ret == null) {
|
|
1684
1585
|
return;
|
|
1685
1586
|
}
|
|
@@ -1697,8 +1598,8 @@ function bindingifyRenderChunk(plugin, options, outputOptions, pluginContextData
|
|
|
1697
1598
|
meta: bindingifyPluginHookMeta(meta)
|
|
1698
1599
|
};
|
|
1699
1600
|
}
|
|
1700
|
-
function bindingifyAugmentChunkHash(
|
|
1701
|
-
const hook = plugin.augmentChunkHash;
|
|
1601
|
+
function bindingifyAugmentChunkHash(args) {
|
|
1602
|
+
const hook = args.plugin.augmentChunkHash;
|
|
1702
1603
|
if (!hook) {
|
|
1703
1604
|
return {};
|
|
1704
1605
|
}
|
|
@@ -1708,45 +1609,45 @@ function bindingifyAugmentChunkHash(plugin, options, pluginContextData) {
|
|
|
1708
1609
|
(Object.entries(chunk.modules)).forEach(([key, module$1]) => {
|
|
1709
1610
|
chunk.modules[key] = transformToRenderedModule(module$1);
|
|
1710
1611
|
});
|
|
1711
|
-
return await handler.call(new PluginContext(
|
|
1612
|
+
return await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), chunk);
|
|
1712
1613
|
},
|
|
1713
1614
|
meta: bindingifyPluginHookMeta(meta)
|
|
1714
1615
|
};
|
|
1715
1616
|
}
|
|
1716
|
-
function bindingifyRenderError(
|
|
1717
|
-
const hook = plugin.renderError;
|
|
1617
|
+
function bindingifyRenderError(args) {
|
|
1618
|
+
const hook = args.plugin.renderError;
|
|
1718
1619
|
if (!hook) {
|
|
1719
1620
|
return {};
|
|
1720
1621
|
}
|
|
1721
1622
|
const { handler: handler, meta: meta } = normalizeHook(hook);
|
|
1722
1623
|
return {
|
|
1723
1624
|
plugin: async (ctx, err) => {
|
|
1724
|
-
handler.call(new PluginContext(
|
|
1625
|
+
handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new Error(err));
|
|
1725
1626
|
},
|
|
1726
1627
|
meta: bindingifyPluginHookMeta(meta)
|
|
1727
1628
|
};
|
|
1728
1629
|
}
|
|
1729
|
-
function bindingifyGenerateBundle(
|
|
1730
|
-
const hook = plugin.generateBundle;
|
|
1630
|
+
function bindingifyGenerateBundle(args) {
|
|
1631
|
+
const hook = args.plugin.generateBundle;
|
|
1731
1632
|
if (!hook) {
|
|
1732
1633
|
return {};
|
|
1733
1634
|
}
|
|
1734
1635
|
const { handler: handler, meta: meta } = normalizeHook(hook);
|
|
1735
1636
|
return {
|
|
1736
|
-
plugin: async (ctx, bundle, isWrite) => {
|
|
1637
|
+
plugin: async (ctx, bundle, isWrite, opts) => {
|
|
1737
1638
|
const changed = {
|
|
1738
1639
|
updated: new Set(),
|
|
1739
1640
|
deleted: new Set()
|
|
1740
1641
|
};
|
|
1741
1642
|
const output = transformToOutputBundle(bundle, changed);
|
|
1742
|
-
await handler.call(new PluginContext(
|
|
1643
|
+
await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts), output, isWrite);
|
|
1743
1644
|
return collectChangedBundle(changed, output);
|
|
1744
1645
|
},
|
|
1745
1646
|
meta: bindingifyPluginHookMeta(meta)
|
|
1746
1647
|
};
|
|
1747
1648
|
}
|
|
1748
|
-
function bindingifyWriteBundle(
|
|
1749
|
-
const hook = plugin.writeBundle;
|
|
1649
|
+
function bindingifyWriteBundle(args) {
|
|
1650
|
+
const hook = args.plugin.writeBundle;
|
|
1750
1651
|
if (!hook) {
|
|
1751
1652
|
return {};
|
|
1752
1653
|
}
|
|
@@ -1758,27 +1659,27 @@ function bindingifyWriteBundle(plugin, options, outputOptions, pluginContextData
|
|
|
1758
1659
|
deleted: new Set()
|
|
1759
1660
|
};
|
|
1760
1661
|
const output = transformToOutputBundle(bundle, changed);
|
|
1761
|
-
await handler.call(new PluginContext(
|
|
1662
|
+
await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), {}, output);
|
|
1762
1663
|
return collectChangedBundle(changed, output);
|
|
1763
1664
|
},
|
|
1764
1665
|
meta: bindingifyPluginHookMeta(meta)
|
|
1765
1666
|
};
|
|
1766
1667
|
}
|
|
1767
|
-
function bindingifyCloseBundle(
|
|
1768
|
-
const hook = plugin.closeBundle;
|
|
1668
|
+
function bindingifyCloseBundle(args) {
|
|
1669
|
+
const hook = args.plugin.closeBundle;
|
|
1769
1670
|
if (!hook) {
|
|
1770
1671
|
return {};
|
|
1771
1672
|
}
|
|
1772
1673
|
const { handler: handler, meta: meta } = normalizeHook(hook);
|
|
1773
1674
|
return {
|
|
1774
1675
|
plugin: async (ctx) => {
|
|
1775
|
-
await handler.call(new PluginContext(
|
|
1676
|
+
await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel));
|
|
1776
1677
|
},
|
|
1777
1678
|
meta: bindingifyPluginHookMeta(meta)
|
|
1778
1679
|
};
|
|
1779
1680
|
}
|
|
1780
|
-
function bindingifyBanner(
|
|
1781
|
-
const hook = plugin.banner;
|
|
1681
|
+
function bindingifyBanner(args) {
|
|
1682
|
+
const hook = args.plugin.banner;
|
|
1782
1683
|
if (!hook) {
|
|
1783
1684
|
return {};
|
|
1784
1685
|
}
|
|
@@ -1788,13 +1689,13 @@ function bindingifyBanner(plugin, options, pluginContextData) {
|
|
|
1788
1689
|
if (typeof handler === "string") {
|
|
1789
1690
|
return handler;
|
|
1790
1691
|
}
|
|
1791
|
-
return handler.call(new PluginContext(
|
|
1692
|
+
return handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), chunk);
|
|
1792
1693
|
},
|
|
1793
1694
|
meta: bindingifyPluginHookMeta(meta)
|
|
1794
1695
|
};
|
|
1795
1696
|
}
|
|
1796
|
-
function bindingifyFooter(
|
|
1797
|
-
const hook = plugin.footer;
|
|
1697
|
+
function bindingifyFooter(args) {
|
|
1698
|
+
const hook = args.plugin.footer;
|
|
1798
1699
|
if (!hook) {
|
|
1799
1700
|
return {};
|
|
1800
1701
|
}
|
|
@@ -1804,13 +1705,13 @@ function bindingifyFooter(plugin, options, pluginContextData) {
|
|
|
1804
1705
|
if (typeof handler === "string") {
|
|
1805
1706
|
return handler;
|
|
1806
1707
|
}
|
|
1807
|
-
return handler.call(new PluginContext(
|
|
1708
|
+
return handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), chunk);
|
|
1808
1709
|
},
|
|
1809
1710
|
meta: bindingifyPluginHookMeta(meta)
|
|
1810
1711
|
};
|
|
1811
1712
|
}
|
|
1812
|
-
function bindingifyIntro(
|
|
1813
|
-
const hook = plugin.intro;
|
|
1713
|
+
function bindingifyIntro(args) {
|
|
1714
|
+
const hook = args.plugin.intro;
|
|
1814
1715
|
if (!hook) {
|
|
1815
1716
|
return {};
|
|
1816
1717
|
}
|
|
@@ -1820,13 +1721,13 @@ function bindingifyIntro(plugin, options, pluginContextData) {
|
|
|
1820
1721
|
if (typeof handler === "string") {
|
|
1821
1722
|
return handler;
|
|
1822
1723
|
}
|
|
1823
|
-
return handler.call(new PluginContext(
|
|
1724
|
+
return handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), chunk);
|
|
1824
1725
|
},
|
|
1825
1726
|
meta: bindingifyPluginHookMeta(meta)
|
|
1826
1727
|
};
|
|
1827
1728
|
}
|
|
1828
|
-
function bindingifyOutro(
|
|
1829
|
-
const hook = plugin.outro;
|
|
1729
|
+
function bindingifyOutro(args) {
|
|
1730
|
+
const hook = args.plugin.outro;
|
|
1830
1731
|
if (!hook) {
|
|
1831
1732
|
return {};
|
|
1832
1733
|
}
|
|
@@ -1836,7 +1737,7 @@ function bindingifyOutro(plugin, options, pluginContextData) {
|
|
|
1836
1737
|
if (typeof handler === "string") {
|
|
1837
1738
|
return handler;
|
|
1838
1739
|
}
|
|
1839
|
-
return handler.call(new PluginContext(
|
|
1740
|
+
return handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), chunk);
|
|
1840
1741
|
},
|
|
1841
1742
|
meta: bindingifyPluginHookMeta(meta)
|
|
1842
1743
|
};
|
|
@@ -1844,28 +1745,28 @@ function bindingifyOutro(plugin, options, pluginContextData) {
|
|
|
1844
1745
|
|
|
1845
1746
|
//#endregion
|
|
1846
1747
|
//#region src/plugin/bindingify-watch-hooks.ts
|
|
1847
|
-
function bindingifyWatchChange(
|
|
1848
|
-
const hook = plugin.watchChange;
|
|
1748
|
+
function bindingifyWatchChange(args) {
|
|
1749
|
+
const hook = args.plugin.watchChange;
|
|
1849
1750
|
if (!hook) {
|
|
1850
1751
|
return {};
|
|
1851
1752
|
}
|
|
1852
1753
|
const { handler: handler, meta: meta } = normalizeHook(hook);
|
|
1853
1754
|
return {
|
|
1854
1755
|
plugin: async (ctx, id, event) => {
|
|
1855
|
-
await handler.call(new PluginContext(
|
|
1756
|
+
await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), id, {event: event});
|
|
1856
1757
|
},
|
|
1857
1758
|
meta: bindingifyPluginHookMeta(meta)
|
|
1858
1759
|
};
|
|
1859
1760
|
}
|
|
1860
|
-
function bindingifyCloseWatcher(
|
|
1861
|
-
const hook = plugin.closeWatcher;
|
|
1761
|
+
function bindingifyCloseWatcher(args) {
|
|
1762
|
+
const hook = args.plugin.closeWatcher;
|
|
1862
1763
|
if (!hook) {
|
|
1863
1764
|
return {};
|
|
1864
1765
|
}
|
|
1865
1766
|
const { handler: handler, meta: meta } = normalizeHook(hook);
|
|
1866
1767
|
return {
|
|
1867
1768
|
plugin: async (ctx) => {
|
|
1868
|
-
await handler.call(new PluginContext(
|
|
1769
|
+
await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel));
|
|
1869
1770
|
},
|
|
1870
1771
|
meta: bindingifyPluginHookMeta(meta)
|
|
1871
1772
|
};
|
|
@@ -1873,27 +1774,35 @@ function bindingifyCloseWatcher(plugin, options, pluginContextData) {
|
|
|
1873
1774
|
|
|
1874
1775
|
//#endregion
|
|
1875
1776
|
//#region src/plugin/bindingify-plugin.ts
|
|
1876
|
-
function bindingifyPlugin(plugin, options, outputOptions, pluginContextData) {
|
|
1877
|
-
const
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
const { plugin:
|
|
1886
|
-
const { plugin:
|
|
1887
|
-
const { plugin:
|
|
1888
|
-
const { plugin:
|
|
1889
|
-
const { plugin:
|
|
1890
|
-
const { plugin:
|
|
1891
|
-
const { plugin:
|
|
1892
|
-
const { plugin:
|
|
1893
|
-
const { plugin:
|
|
1894
|
-
const { plugin:
|
|
1895
|
-
const { plugin:
|
|
1896
|
-
const { plugin:
|
|
1777
|
+
function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, onLog, logLevel) {
|
|
1778
|
+
const args = {
|
|
1779
|
+
plugin,
|
|
1780
|
+
options,
|
|
1781
|
+
outputOptions,
|
|
1782
|
+
pluginContextData,
|
|
1783
|
+
onLog,
|
|
1784
|
+
logLevel
|
|
1785
|
+
};
|
|
1786
|
+
const { plugin: buildStart, meta: buildStartMeta } = bindingifyBuildStart(args);
|
|
1787
|
+
const { plugin: resolveId, meta: resolveIdMeta, filter: resolveIdFilter } = bindingifyResolveId(args);
|
|
1788
|
+
const { plugin: resolveDynamicImport, meta: resolveDynamicImportMeta } = bindingifyResolveDynamicImport(args);
|
|
1789
|
+
const { plugin: buildEnd, meta: buildEndMeta } = bindingifyBuildEnd(args);
|
|
1790
|
+
const { plugin: transform, meta: transformMeta, filter: transformFilter } = bindingifyTransform(args);
|
|
1791
|
+
const { plugin: moduleParsed, meta: moduleParsedMeta } = bindingifyModuleParsed(args);
|
|
1792
|
+
const { plugin: load, meta: loadMeta, filter: loadFilter } = bindingifyLoad(args);
|
|
1793
|
+
const { plugin: renderChunk, meta: renderChunkMeta } = bindingifyRenderChunk(args);
|
|
1794
|
+
const { plugin: augmentChunkHash, meta: augmentChunkHashMeta } = bindingifyAugmentChunkHash(args);
|
|
1795
|
+
const { plugin: renderStart, meta: renderStartMeta } = bindingifyRenderStart(args);
|
|
1796
|
+
const { plugin: renderError, meta: renderErrorMeta } = bindingifyRenderError(args);
|
|
1797
|
+
const { plugin: generateBundle, meta: generateBundleMeta } = bindingifyGenerateBundle(args);
|
|
1798
|
+
const { plugin: writeBundle, meta: writeBundleMeta } = bindingifyWriteBundle(args);
|
|
1799
|
+
const { plugin: closeBundle, meta: closeBundleMeta } = bindingifyCloseBundle(args);
|
|
1800
|
+
const { plugin: banner, meta: bannerMeta } = bindingifyBanner(args);
|
|
1801
|
+
const { plugin: footer, meta: footerMeta } = bindingifyFooter(args);
|
|
1802
|
+
const { plugin: intro, meta: introMeta } = bindingifyIntro(args);
|
|
1803
|
+
const { plugin: outro, meta: outroMeta } = bindingifyOutro(args);
|
|
1804
|
+
const { plugin: watchChange, meta: watchChangeMeta } = bindingifyWatchChange(args);
|
|
1805
|
+
const { plugin: closeWatcher, meta: closeWatcherMeta } = bindingifyCloseWatcher(args);
|
|
1897
1806
|
const result = {
|
|
1898
1807
|
name: plugin.name ?? "unknown",
|
|
1899
1808
|
buildStart,
|
|
@@ -2007,7 +1916,49 @@ class PluginContextData {
|
|
|
2007
1916
|
}
|
|
2008
1917
|
|
|
2009
1918
|
//#endregion
|
|
2010
|
-
//#region src/
|
|
1919
|
+
//#region src/builtin-plugin/utils.ts
|
|
1920
|
+
var import_binding$3 = __toESM(require_binding());
|
|
1921
|
+
function makeBuiltinPluginCallable(plugin) {
|
|
1922
|
+
let callablePlugin = new import_binding$3.BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
|
|
1923
|
+
const wrappedPlugin = {_original: callablePlugin};
|
|
1924
|
+
for (const key in callablePlugin) {
|
|
1925
|
+
if (key === "name") {
|
|
1926
|
+
wrappedPlugin[key] = callablePlugin[key];
|
|
1927
|
+
} else {
|
|
1928
|
+
wrappedPlugin[key] = function(...args) {
|
|
1929
|
+
return callablePlugin[key](...args);
|
|
1930
|
+
};
|
|
1931
|
+
}
|
|
1932
|
+
}
|
|
1933
|
+
return wrappedPlugin;
|
|
1934
|
+
}
|
|
1935
|
+
function isCallableBuiltinPlugin(plugin) {
|
|
1936
|
+
return "_original"in plugin && plugin._original instanceof import_binding$3.BindingCallableBuiltinPlugin;
|
|
1937
|
+
}
|
|
1938
|
+
function bindingifyBuiltInPlugin(plugin) {
|
|
1939
|
+
return {
|
|
1940
|
+
__name: plugin.name,
|
|
1941
|
+
options: plugin.options
|
|
1942
|
+
};
|
|
1943
|
+
}
|
|
1944
|
+
function isCallableCompatibleBuiltinPlugin(plugin) {
|
|
1945
|
+
return plugin instanceof BuiltinPlugin && (0, import_binding$3.isCallableCompatibleBuiltinPlugin)(bindingifyBuiltInPlugin(plugin));
|
|
1946
|
+
}
|
|
1947
|
+
|
|
1948
|
+
//#endregion
|
|
1949
|
+
//#region src/utils/normalize-string-or-regex.ts
|
|
1950
|
+
function normalizedStringOrRegex(pattern) {
|
|
1951
|
+
if (!pattern) {
|
|
1952
|
+
return undefined;
|
|
1953
|
+
}
|
|
1954
|
+
if (!Array.isArray(pattern)) {
|
|
1955
|
+
pattern = [pattern];
|
|
1956
|
+
}
|
|
1957
|
+
return pattern;
|
|
1958
|
+
}
|
|
1959
|
+
|
|
1960
|
+
//#endregion
|
|
1961
|
+
//#region src/utils/bindingify-input-options.ts
|
|
2011
1962
|
var import_binding$2 = __toESM(require_binding());
|
|
2012
1963
|
function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions) {
|
|
2013
1964
|
const pluginContextData = new PluginContextData();
|
|
@@ -2020,7 +1971,7 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions) {
|
|
|
2020
1971
|
if (plugin instanceof BuiltinPlugin) {
|
|
2021
1972
|
return bindingifyBuiltInPlugin(plugin);
|
|
2022
1973
|
}
|
|
2023
|
-
return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData);
|
|
1974
|
+
return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData, onLog, logLevel);
|
|
2024
1975
|
});
|
|
2025
1976
|
return {
|
|
2026
1977
|
input: bindingifyInput(inputOptions.input),
|
|
@@ -2197,7 +2148,7 @@ function bindingifyTreeshakeOptions(config) {
|
|
|
2197
2148
|
}
|
|
2198
2149
|
|
|
2199
2150
|
//#endregion
|
|
2200
|
-
//#region src/
|
|
2151
|
+
//#region src/utils/bindingify-output-options.ts
|
|
2201
2152
|
function bindingifyOutputOptions(outputOptions) {
|
|
2202
2153
|
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;
|
|
2203
2154
|
return {
|
|
@@ -2947,4 +2898,4 @@ const description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-comp
|
|
|
2947
2898
|
const VERSION = version;
|
|
2948
2899
|
|
|
2949
2900
|
//#endregion
|
|
2950
|
-
export { LogLevelOptionSchema, LogLevelSchema, LogLevelWithErrorSchema, PluginContextData, RollupLogSchema, RollupLogWithStringSchema, TreeshakingOptionsSchema, VERSION, __export, __toESM,
|
|
2901
|
+
export { BuiltinPlugin, LogLevelOptionSchema, LogLevelSchema, LogLevelWithErrorSchema, PluginContextData, RollupLogSchema, RollupLogWithStringSchema, TreeshakingOptionsSchema, VERSION, __export, __toESM, arraify, bindingifyPlugin, buildImportAnalysisPlugin, composeJsPlugins, defineConfig, description, dynamicImportVarsPlugin, experimental_scan, importGlobPlugin, isCallableBuiltinPlugin, isCallableCompatibleBuiltinPlugin, jsonPlugin, loadFallbackPlugin, makeBuiltinPluginCallable, manifestPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, require_binding, rolldown, version, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, watch };
|