rolldown 1.0.0-beta.2-commit.5deb279 → 1.0.0-beta.3
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 +1 -1
- package/dist/cjs/experimental-index.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/parallel-plugin-worker.cjs +1 -1
- package/dist/esm/cli.mjs +1 -1
- package/dist/esm/experimental-index.mjs +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/parallel-plugin-worker.mjs +1 -1
- package/dist/shared/{src-CV5Vk_cS.cjs → src-AhtJ8ilG.cjs} +47 -26
- package/dist/shared/{src-CwOjWVUb.mjs → src-CAwnm6PS.mjs} +47 -26
- package/dist/types/binding.d.ts +9 -3
- package/dist/types/index.d.ts +2 -2
- package/dist/types/options/normalized-output-options.d.ts +3 -3
- package/dist/types/options/normalized-output-options.js +1 -1
- package/dist/types/options/output-options.d.ts +8 -1
- package/dist/types/plugin/bindingify-build-hooks.js +7 -7
- package/dist/types/plugin/bindingify-output-hooks.js +11 -11
- package/dist/types/plugin/bindingify-watch-hooks.js +2 -2
- package/dist/types/plugin/plugin-context.d.ts +4 -1
- package/dist/types/plugin/plugin-context.js +15 -2
- package/dist/types/plugin/transform-plugin-context.d.ts +2 -1
- package/dist/types/plugin/transform-plugin-context.js +2 -2
- package/dist/types/utils/bindingify-output-options.js +15 -1
- package/package.json +14 -14
package/dist/cjs/cli.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const require_chunk = require('../shared/chunk-qZFfknuJ.cjs');
|
|
3
|
-
const require_src = require('../shared/src-
|
|
3
|
+
const require_src = require('../shared/src-AhtJ8ilG.cjs');
|
|
4
4
|
const require_binding = require('../shared/binding-orkvONpS.cjs');
|
|
5
5
|
const node_process = require_chunk.__toESM(require("node:process"));
|
|
6
6
|
const node_path = require_chunk.__toESM(require("node:path"));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const require_chunk = require('../shared/chunk-qZFfknuJ.cjs');
|
|
3
|
-
const require_src = require('../shared/src-
|
|
3
|
+
const require_src = require('../shared/src-AhtJ8ilG.cjs');
|
|
4
4
|
const require_binding = require('../shared/binding-orkvONpS.cjs');
|
|
5
5
|
const node_url = require_chunk.__toESM(require("node:url"));
|
|
6
6
|
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const require_chunk = require('../shared/chunk-qZFfknuJ.cjs');
|
|
3
|
-
const require_src = require('../shared/src-
|
|
3
|
+
const require_src = require('../shared/src-AhtJ8ilG.cjs');
|
|
4
4
|
const require_binding = require('../shared/binding-orkvONpS.cjs');
|
|
5
5
|
const node_worker_threads = require_chunk.__toESM(require("node:worker_threads"));
|
|
6
6
|
|
package/dist/esm/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { colors } from "../shared/binding-l7VLSKnB.mjs";
|
|
2
|
-
import { arraify, description, getInputCliKeys, getJsonSchema, getOutputCliKeys, rolldown, validateCliOptions, version, watch } from "../shared/src-
|
|
2
|
+
import { arraify, description, getInputCliKeys, getJsonSchema, getOutputCliKeys, rolldown, validateCliOptions, version, watch } from "../shared/src-CAwnm6PS.mjs";
|
|
3
3
|
import process$1, { cwd } from "node:process";
|
|
4
4
|
import path, { sep } from "node:path";
|
|
5
5
|
import fs from "node:fs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { import_binding } from "../shared/binding-l7VLSKnB.mjs";
|
|
2
|
-
import { BuiltinPlugin, buildImportAnalysisPlugin, composeJsPlugins, createBundler, dynamicImportVarsPlugin, handleOutputErrors, importGlobPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin } from "../shared/src-
|
|
2
|
+
import { BuiltinPlugin, buildImportAnalysisPlugin, composeJsPlugins, createBundler, dynamicImportVarsPlugin, handleOutputErrors, importGlobPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin } from "../shared/src-CAwnm6PS.mjs";
|
|
3
3
|
import { pathToFileURL } from "node:url";
|
|
4
4
|
|
|
5
5
|
//#region src/plugin/parallel-plugin.ts
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import "../shared/binding-l7VLSKnB.mjs";
|
|
2
|
-
import { VERSION, build, defineConfig, rolldown, watch } from "../shared/src-
|
|
2
|
+
import { VERSION, build, defineConfig, rolldown, watch } from "../shared/src-CAwnm6PS.mjs";
|
|
3
3
|
|
|
4
4
|
export { VERSION, build, defineConfig, rolldown, watch };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { import_binding } from "../shared/binding-l7VLSKnB.mjs";
|
|
2
|
-
import { PluginContextData, bindingifyPlugin } from "../shared/src-
|
|
2
|
+
import { PluginContextData, bindingifyPlugin } from "../shared/src-CAwnm6PS.mjs";
|
|
3
3
|
import { parentPort, workerData } from "node:worker_threads";
|
|
4
4
|
|
|
5
5
|
//#region src/parallel-plugin-worker.ts
|
|
@@ -744,8 +744,9 @@ function bindingifySideEffects(sideEffects) {
|
|
|
744
744
|
//#endregion
|
|
745
745
|
//#region src/plugin/plugin-context.ts
|
|
746
746
|
var PluginContext = class extends MinimalPluginContext {
|
|
747
|
-
constructor(context, plugin, data, onLog, logLevel, currentLoadingModule) {
|
|
747
|
+
constructor(outputOptions, context, plugin, data, onLog, logLevel, currentLoadingModule) {
|
|
748
748
|
super(onLog, logLevel, plugin.name);
|
|
749
|
+
this.outputOptions = outputOptions;
|
|
749
750
|
this.context = context;
|
|
750
751
|
this.data = data;
|
|
751
752
|
this.onLog = onLog;
|
|
@@ -797,10 +798,19 @@ var PluginContext = class extends MinimalPluginContext {
|
|
|
797
798
|
emitFile(file) {
|
|
798
799
|
if (file.type === "prebuilt-chunk") return unimplemented("PluginContext.emitFile with type prebuilt-chunk");
|
|
799
800
|
if (file.type === "chunk") return this.context.emitChunk(file);
|
|
801
|
+
const filename = file.fileName ? undefined : this.getAssetFileNames(file);
|
|
800
802
|
return this.context.emitFile({
|
|
801
803
|
...file,
|
|
802
804
|
originalFileName: file.originalFileName || undefined,
|
|
803
805
|
source: bindingAssetSource(file.source)
|
|
806
|
+
}, filename);
|
|
807
|
+
}
|
|
808
|
+
getAssetFileNames(file) {
|
|
809
|
+
if (typeof this.outputOptions.assetFileNames === "function") return this.outputOptions.assetFileNames({
|
|
810
|
+
names: file.name ? [file.name] : [],
|
|
811
|
+
originalFileNames: file.originalFileName ? [file.originalFileName] : [],
|
|
812
|
+
source: file.source,
|
|
813
|
+
type: "asset"
|
|
804
814
|
});
|
|
805
815
|
}
|
|
806
816
|
getFileName(referenceId) {
|
|
@@ -826,8 +836,8 @@ var PluginContext = class extends MinimalPluginContext {
|
|
|
826
836
|
//#endregion
|
|
827
837
|
//#region src/plugin/transform-plugin-context.ts
|
|
828
838
|
var TransformPluginContext = class extends PluginContext {
|
|
829
|
-
constructor(context, plugin, data, inner, moduleId, moduleSource, onLog, LogLevelOption) {
|
|
830
|
-
super(context, plugin, data, onLog, LogLevelOption, moduleId);
|
|
839
|
+
constructor(outputOptions, context, plugin, data, inner, moduleId, moduleSource, onLog, LogLevelOption) {
|
|
840
|
+
super(outputOptions, context, plugin, data, onLog, LogLevelOption, moduleId);
|
|
831
841
|
this.inner = inner;
|
|
832
842
|
this.moduleId = moduleId;
|
|
833
843
|
this.moduleSource = moduleSource;
|
|
@@ -932,7 +942,7 @@ function bindingifyBuildStart(args) {
|
|
|
932
942
|
const { handler, meta } = normalizeHook(hook);
|
|
933
943
|
return {
|
|
934
944
|
plugin: async (ctx, opts) => {
|
|
935
|
-
await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedInputOptionsImpl(opts, args.onLog));
|
|
945
|
+
await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedInputOptionsImpl(opts, args.onLog));
|
|
936
946
|
},
|
|
937
947
|
meta: bindingifyPluginHookMeta(meta)
|
|
938
948
|
};
|
|
@@ -943,7 +953,7 @@ function bindingifyBuildEnd(args) {
|
|
|
943
953
|
const { handler, meta } = normalizeHook(hook);
|
|
944
954
|
return {
|
|
945
955
|
plugin: async (ctx, err) => {
|
|
946
|
-
await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), err ? normalizeErrors(err) : undefined);
|
|
956
|
+
await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), err ? normalizeErrors(err) : undefined);
|
|
947
957
|
},
|
|
948
958
|
meta: bindingifyPluginHookMeta(meta)
|
|
949
959
|
};
|
|
@@ -960,7 +970,7 @@ function bindingifyResolveId(args) {
|
|
|
960
970
|
custom: contextResolveOptions?.custom,
|
|
961
971
|
[SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF]: contextResolveOptions?.[SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF]
|
|
962
972
|
};
|
|
963
|
-
const ret = await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), specifier, importer ?? undefined, newExtraOptions);
|
|
973
|
+
const ret = await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), specifier, importer ?? undefined, newExtraOptions);
|
|
964
974
|
if (ret == null) return;
|
|
965
975
|
if (ret === false) return {
|
|
966
976
|
id: specifier,
|
|
@@ -987,7 +997,7 @@ function bindingifyResolveDynamicImport(args) {
|
|
|
987
997
|
const { handler, meta } = normalizeHook(hook);
|
|
988
998
|
return {
|
|
989
999
|
plugin: async (ctx, specifier, importer) => {
|
|
990
|
-
const ret = await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), specifier, importer ?? undefined);
|
|
1000
|
+
const ret = await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), specifier, importer ?? undefined);
|
|
991
1001
|
if (ret == null) return;
|
|
992
1002
|
if (ret === false) return {
|
|
993
1003
|
id: specifier,
|
|
@@ -1014,7 +1024,7 @@ function bindingifyTransform(args) {
|
|
|
1014
1024
|
const { handler, meta, options } = normalizeHook(hook);
|
|
1015
1025
|
return {
|
|
1016
1026
|
plugin: async (ctx, code, id, meta$1) => {
|
|
1017
|
-
const ret = await handler.call(new TransformPluginContext(ctx.inner(), args.plugin, args.pluginContextData, ctx, id, code, args.onLog, args.logLevel), code, id, meta$1);
|
|
1027
|
+
const ret = await handler.call(new TransformPluginContext(args.outputOptions, ctx.inner(), args.plugin, args.pluginContextData, ctx, id, code, args.onLog, args.logLevel), code, id, meta$1);
|
|
1018
1028
|
if (ret == null) return undefined;
|
|
1019
1029
|
if (typeof ret === "string") return { code: ret };
|
|
1020
1030
|
args.pluginContextData.updateModuleOption(id, {
|
|
@@ -1038,7 +1048,7 @@ function bindingifyLoad(args) {
|
|
|
1038
1048
|
const { handler, meta, options } = normalizeHook(hook);
|
|
1039
1049
|
return {
|
|
1040
1050
|
plugin: async (ctx, id) => {
|
|
1041
|
-
const ret = await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, id), id);
|
|
1051
|
+
const ret = await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, id), id);
|
|
1042
1052
|
if (ret == null) return;
|
|
1043
1053
|
if (typeof ret === "string") return { code: ret };
|
|
1044
1054
|
args.pluginContextData.updateModuleOption(id, {
|
|
@@ -1073,7 +1083,7 @@ function bindingifyModuleParsed(args) {
|
|
|
1073
1083
|
const { handler, meta } = normalizeHook(hook);
|
|
1074
1084
|
return {
|
|
1075
1085
|
plugin: async (ctx, moduleInfo) => {
|
|
1076
|
-
await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformModuleInfo(moduleInfo, args.pluginContextData.getModuleOption(moduleInfo.id)));
|
|
1086
|
+
await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformModuleInfo(moduleInfo, args.pluginContextData.getModuleOption(moduleInfo.id)));
|
|
1077
1087
|
},
|
|
1078
1088
|
meta: bindingifyPluginHookMeta(meta)
|
|
1079
1089
|
};
|
|
@@ -1101,7 +1111,7 @@ var NormalizedOutputOptionsImpl = class {
|
|
|
1101
1111
|
return mapFunctionOption(this.inner.chunkFilenames, "chunkFileNames");
|
|
1102
1112
|
}
|
|
1103
1113
|
get assetFileNames() {
|
|
1104
|
-
return this.inner.assetFilenames;
|
|
1114
|
+
return mapFunctionOption(this.inner.assetFilenames, "assetFilenames");
|
|
1105
1115
|
}
|
|
1106
1116
|
get format() {
|
|
1107
1117
|
return this.inner.format;
|
|
@@ -1185,7 +1195,7 @@ function bindingifyRenderStart(args) {
|
|
|
1185
1195
|
const { handler, meta } = normalizeHook(hook);
|
|
1186
1196
|
return {
|
|
1187
1197
|
plugin: async (ctx, opts) => {
|
|
1188
|
-
handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts), new NormalizedInputOptionsImpl(opts, args.onLog));
|
|
1198
|
+
handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts), new NormalizedInputOptionsImpl(opts, args.onLog));
|
|
1189
1199
|
},
|
|
1190
1200
|
meta: bindingifyPluginHookMeta(meta)
|
|
1191
1201
|
};
|
|
@@ -1196,7 +1206,7 @@ function bindingifyRenderChunk(args) {
|
|
|
1196
1206
|
const { handler, meta } = normalizeHook(hook);
|
|
1197
1207
|
return {
|
|
1198
1208
|
plugin: async (ctx, code, chunk, opts) => {
|
|
1199
|
-
const ret = await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), code, transformRenderedChunk(chunk), new NormalizedOutputOptionsImpl(opts));
|
|
1209
|
+
const ret = await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), code, transformRenderedChunk(chunk), new NormalizedOutputOptionsImpl(opts));
|
|
1200
1210
|
if (ret == null) return;
|
|
1201
1211
|
if (typeof ret === "string") return { code: ret };
|
|
1202
1212
|
if (!ret.map) return { code: ret.code };
|
|
@@ -1214,7 +1224,7 @@ function bindingifyAugmentChunkHash(args) {
|
|
|
1214
1224
|
const { handler, meta } = normalizeHook(hook);
|
|
1215
1225
|
return {
|
|
1216
1226
|
plugin: async (ctx, chunk) => {
|
|
1217
|
-
return await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
|
|
1227
|
+
return await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
|
|
1218
1228
|
},
|
|
1219
1229
|
meta: bindingifyPluginHookMeta(meta)
|
|
1220
1230
|
};
|
|
@@ -1225,7 +1235,7 @@ function bindingifyRenderError(args) {
|
|
|
1225
1235
|
const { handler, meta } = normalizeHook(hook);
|
|
1226
1236
|
return {
|
|
1227
1237
|
plugin: async (ctx, err) => {
|
|
1228
|
-
handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), normalizeErrors(err));
|
|
1238
|
+
handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), normalizeErrors(err));
|
|
1229
1239
|
},
|
|
1230
1240
|
meta: bindingifyPluginHookMeta(meta)
|
|
1231
1241
|
};
|
|
@@ -1241,7 +1251,7 @@ function bindingifyGenerateBundle(args) {
|
|
|
1241
1251
|
deleted: new Set()
|
|
1242
1252
|
};
|
|
1243
1253
|
const output = transformToOutputBundle(bundle, changed);
|
|
1244
|
-
await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts), output, isWrite);
|
|
1254
|
+
await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts), output, isWrite);
|
|
1245
1255
|
return collectChangedBundle(changed, output);
|
|
1246
1256
|
},
|
|
1247
1257
|
meta: bindingifyPluginHookMeta(meta)
|
|
@@ -1258,7 +1268,7 @@ function bindingifyWriteBundle(args) {
|
|
|
1258
1268
|
deleted: new Set()
|
|
1259
1269
|
};
|
|
1260
1270
|
const output = transformToOutputBundle(bundle, changed);
|
|
1261
|
-
await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts), output);
|
|
1271
|
+
await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts), output);
|
|
1262
1272
|
return collectChangedBundle(changed, output);
|
|
1263
1273
|
},
|
|
1264
1274
|
meta: bindingifyPluginHookMeta(meta)
|
|
@@ -1270,7 +1280,7 @@ function bindingifyCloseBundle(args) {
|
|
|
1270
1280
|
const { handler, meta } = normalizeHook(hook);
|
|
1271
1281
|
return {
|
|
1272
1282
|
plugin: async (ctx) => {
|
|
1273
|
-
await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel));
|
|
1283
|
+
await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel));
|
|
1274
1284
|
},
|
|
1275
1285
|
meta: bindingifyPluginHookMeta(meta)
|
|
1276
1286
|
};
|
|
@@ -1282,7 +1292,7 @@ function bindingifyBanner(args) {
|
|
|
1282
1292
|
return {
|
|
1283
1293
|
plugin: async (ctx, chunk) => {
|
|
1284
1294
|
if (typeof handler === "string") return handler;
|
|
1285
|
-
return handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
|
|
1295
|
+
return handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
|
|
1286
1296
|
},
|
|
1287
1297
|
meta: bindingifyPluginHookMeta(meta)
|
|
1288
1298
|
};
|
|
@@ -1294,7 +1304,7 @@ function bindingifyFooter(args) {
|
|
|
1294
1304
|
return {
|
|
1295
1305
|
plugin: async (ctx, chunk) => {
|
|
1296
1306
|
if (typeof handler === "string") return handler;
|
|
1297
|
-
return handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
|
|
1307
|
+
return handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
|
|
1298
1308
|
},
|
|
1299
1309
|
meta: bindingifyPluginHookMeta(meta)
|
|
1300
1310
|
};
|
|
@@ -1306,7 +1316,7 @@ function bindingifyIntro(args) {
|
|
|
1306
1316
|
return {
|
|
1307
1317
|
plugin: async (ctx, chunk) => {
|
|
1308
1318
|
if (typeof handler === "string") return handler;
|
|
1309
|
-
return handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
|
|
1319
|
+
return handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
|
|
1310
1320
|
},
|
|
1311
1321
|
meta: bindingifyPluginHookMeta(meta)
|
|
1312
1322
|
};
|
|
@@ -1318,7 +1328,7 @@ function bindingifyOutro(args) {
|
|
|
1318
1328
|
return {
|
|
1319
1329
|
plugin: async (ctx, chunk) => {
|
|
1320
1330
|
if (typeof handler === "string") return handler;
|
|
1321
|
-
return handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
|
|
1331
|
+
return handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
|
|
1322
1332
|
},
|
|
1323
1333
|
meta: bindingifyPluginHookMeta(meta)
|
|
1324
1334
|
};
|
|
@@ -1332,7 +1342,7 @@ function bindingifyWatchChange(args) {
|
|
|
1332
1342
|
const { handler, meta } = normalizeHook(hook);
|
|
1333
1343
|
return {
|
|
1334
1344
|
plugin: async (ctx, id, event) => {
|
|
1335
|
-
await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), id, { event });
|
|
1345
|
+
await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), id, { event });
|
|
1336
1346
|
},
|
|
1337
1347
|
meta: bindingifyPluginHookMeta(meta)
|
|
1338
1348
|
};
|
|
@@ -1343,7 +1353,7 @@ function bindingifyCloseWatcher(args) {
|
|
|
1343
1353
|
const { handler, meta } = normalizeHook(hook);
|
|
1344
1354
|
return {
|
|
1345
1355
|
plugin: async (ctx) => {
|
|
1346
|
-
await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel));
|
|
1356
|
+
await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel));
|
|
1347
1357
|
},
|
|
1348
1358
|
meta: bindingifyPluginHookMeta(meta)
|
|
1349
1359
|
};
|
|
@@ -1704,7 +1714,7 @@ function bindingifyOutputOptions(outputOptions) {
|
|
|
1704
1714
|
globals,
|
|
1705
1715
|
esModule,
|
|
1706
1716
|
name,
|
|
1707
|
-
assetFileNames,
|
|
1717
|
+
assetFileNames: bindingifyAssetFilenames(assetFileNames),
|
|
1708
1718
|
entryFileNames,
|
|
1709
1719
|
chunkFileNames,
|
|
1710
1720
|
cssEntryFileNames,
|
|
@@ -1751,6 +1761,17 @@ function bindingifySourcemap(sourcemap) {
|
|
|
1751
1761
|
function bindingifySourcemapIgnoreList(sourcemapIgnoreList) {
|
|
1752
1762
|
return typeof sourcemapIgnoreList === "function" ? sourcemapIgnoreList : sourcemapIgnoreList === false ? () => false : (relativeSourcePath, _sourcemapPath) => relativeSourcePath.includes("node_modules");
|
|
1753
1763
|
}
|
|
1764
|
+
function bindingifyAssetFilenames(assetFileNames) {
|
|
1765
|
+
if (typeof assetFileNames === "function") return (asset) => {
|
|
1766
|
+
return assetFileNames({
|
|
1767
|
+
names: asset.names,
|
|
1768
|
+
originalFileNames: asset.originalFileNames,
|
|
1769
|
+
source: transformAssetSource(asset.source),
|
|
1770
|
+
type: "asset"
|
|
1771
|
+
});
|
|
1772
|
+
};
|
|
1773
|
+
return assetFileNames;
|
|
1774
|
+
}
|
|
1754
1775
|
|
|
1755
1776
|
//#endregion
|
|
1756
1777
|
//#region ../../node_modules/.pnpm/remeda@2.19.1/node_modules/remeda/dist/chunk-K26VP6CL.js
|
|
@@ -2622,7 +2643,7 @@ const watch = (input) => {
|
|
|
2622
2643
|
|
|
2623
2644
|
//#endregion
|
|
2624
2645
|
//#region package.json
|
|
2625
|
-
var version = "1.0.0-beta.
|
|
2646
|
+
var version = "1.0.0-beta.3";
|
|
2626
2647
|
var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
|
|
2627
2648
|
|
|
2628
2649
|
//#endregion
|
|
@@ -742,8 +742,9 @@ function bindingifySideEffects(sideEffects) {
|
|
|
742
742
|
//#endregion
|
|
743
743
|
//#region src/plugin/plugin-context.ts
|
|
744
744
|
var PluginContext = class extends MinimalPluginContext {
|
|
745
|
-
constructor(context, plugin, data, onLog, logLevel, currentLoadingModule) {
|
|
745
|
+
constructor(outputOptions, context, plugin, data, onLog, logLevel, currentLoadingModule) {
|
|
746
746
|
super(onLog, logLevel, plugin.name);
|
|
747
|
+
this.outputOptions = outputOptions;
|
|
747
748
|
this.context = context;
|
|
748
749
|
this.data = data;
|
|
749
750
|
this.onLog = onLog;
|
|
@@ -795,10 +796,19 @@ var PluginContext = class extends MinimalPluginContext {
|
|
|
795
796
|
emitFile(file) {
|
|
796
797
|
if (file.type === "prebuilt-chunk") return unimplemented("PluginContext.emitFile with type prebuilt-chunk");
|
|
797
798
|
if (file.type === "chunk") return this.context.emitChunk(file);
|
|
799
|
+
const filename = file.fileName ? undefined : this.getAssetFileNames(file);
|
|
798
800
|
return this.context.emitFile({
|
|
799
801
|
...file,
|
|
800
802
|
originalFileName: file.originalFileName || undefined,
|
|
801
803
|
source: bindingAssetSource(file.source)
|
|
804
|
+
}, filename);
|
|
805
|
+
}
|
|
806
|
+
getAssetFileNames(file) {
|
|
807
|
+
if (typeof this.outputOptions.assetFileNames === "function") return this.outputOptions.assetFileNames({
|
|
808
|
+
names: file.name ? [file.name] : [],
|
|
809
|
+
originalFileNames: file.originalFileName ? [file.originalFileName] : [],
|
|
810
|
+
source: file.source,
|
|
811
|
+
type: "asset"
|
|
802
812
|
});
|
|
803
813
|
}
|
|
804
814
|
getFileName(referenceId) {
|
|
@@ -824,8 +834,8 @@ var PluginContext = class extends MinimalPluginContext {
|
|
|
824
834
|
//#endregion
|
|
825
835
|
//#region src/plugin/transform-plugin-context.ts
|
|
826
836
|
var TransformPluginContext = class extends PluginContext {
|
|
827
|
-
constructor(context, plugin, data, inner, moduleId, moduleSource, onLog, LogLevelOption) {
|
|
828
|
-
super(context, plugin, data, onLog, LogLevelOption, moduleId);
|
|
837
|
+
constructor(outputOptions, context, plugin, data, inner, moduleId, moduleSource, onLog, LogLevelOption) {
|
|
838
|
+
super(outputOptions, context, plugin, data, onLog, LogLevelOption, moduleId);
|
|
829
839
|
this.inner = inner;
|
|
830
840
|
this.moduleId = moduleId;
|
|
831
841
|
this.moduleSource = moduleSource;
|
|
@@ -930,7 +940,7 @@ function bindingifyBuildStart(args) {
|
|
|
930
940
|
const { handler, meta } = normalizeHook(hook);
|
|
931
941
|
return {
|
|
932
942
|
plugin: async (ctx, opts) => {
|
|
933
|
-
await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedInputOptionsImpl(opts, args.onLog));
|
|
943
|
+
await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedInputOptionsImpl(opts, args.onLog));
|
|
934
944
|
},
|
|
935
945
|
meta: bindingifyPluginHookMeta(meta)
|
|
936
946
|
};
|
|
@@ -941,7 +951,7 @@ function bindingifyBuildEnd(args) {
|
|
|
941
951
|
const { handler, meta } = normalizeHook(hook);
|
|
942
952
|
return {
|
|
943
953
|
plugin: async (ctx, err) => {
|
|
944
|
-
await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), err ? normalizeErrors(err) : undefined);
|
|
954
|
+
await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), err ? normalizeErrors(err) : undefined);
|
|
945
955
|
},
|
|
946
956
|
meta: bindingifyPluginHookMeta(meta)
|
|
947
957
|
};
|
|
@@ -958,7 +968,7 @@ function bindingifyResolveId(args) {
|
|
|
958
968
|
custom: contextResolveOptions?.custom,
|
|
959
969
|
[SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF]: contextResolveOptions?.[SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF]
|
|
960
970
|
};
|
|
961
|
-
const ret = await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), specifier, importer ?? undefined, newExtraOptions);
|
|
971
|
+
const ret = await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), specifier, importer ?? undefined, newExtraOptions);
|
|
962
972
|
if (ret == null) return;
|
|
963
973
|
if (ret === false) return {
|
|
964
974
|
id: specifier,
|
|
@@ -985,7 +995,7 @@ function bindingifyResolveDynamicImport(args) {
|
|
|
985
995
|
const { handler, meta } = normalizeHook(hook);
|
|
986
996
|
return {
|
|
987
997
|
plugin: async (ctx, specifier, importer) => {
|
|
988
|
-
const ret = await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), specifier, importer ?? undefined);
|
|
998
|
+
const ret = await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), specifier, importer ?? undefined);
|
|
989
999
|
if (ret == null) return;
|
|
990
1000
|
if (ret === false) return {
|
|
991
1001
|
id: specifier,
|
|
@@ -1012,7 +1022,7 @@ function bindingifyTransform(args) {
|
|
|
1012
1022
|
const { handler, meta, options } = normalizeHook(hook);
|
|
1013
1023
|
return {
|
|
1014
1024
|
plugin: async (ctx, code, id, meta$1) => {
|
|
1015
|
-
const ret = await handler.call(new TransformPluginContext(ctx.inner(), args.plugin, args.pluginContextData, ctx, id, code, args.onLog, args.logLevel), code, id, meta$1);
|
|
1025
|
+
const ret = await handler.call(new TransformPluginContext(args.outputOptions, ctx.inner(), args.plugin, args.pluginContextData, ctx, id, code, args.onLog, args.logLevel), code, id, meta$1);
|
|
1016
1026
|
if (ret == null) return undefined;
|
|
1017
1027
|
if (typeof ret === "string") return { code: ret };
|
|
1018
1028
|
args.pluginContextData.updateModuleOption(id, {
|
|
@@ -1036,7 +1046,7 @@ function bindingifyLoad(args) {
|
|
|
1036
1046
|
const { handler, meta, options } = normalizeHook(hook);
|
|
1037
1047
|
return {
|
|
1038
1048
|
plugin: async (ctx, id) => {
|
|
1039
|
-
const ret = await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, id), id);
|
|
1049
|
+
const ret = await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, id), id);
|
|
1040
1050
|
if (ret == null) return;
|
|
1041
1051
|
if (typeof ret === "string") return { code: ret };
|
|
1042
1052
|
args.pluginContextData.updateModuleOption(id, {
|
|
@@ -1071,7 +1081,7 @@ function bindingifyModuleParsed(args) {
|
|
|
1071
1081
|
const { handler, meta } = normalizeHook(hook);
|
|
1072
1082
|
return {
|
|
1073
1083
|
plugin: async (ctx, moduleInfo) => {
|
|
1074
|
-
await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformModuleInfo(moduleInfo, args.pluginContextData.getModuleOption(moduleInfo.id)));
|
|
1084
|
+
await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformModuleInfo(moduleInfo, args.pluginContextData.getModuleOption(moduleInfo.id)));
|
|
1075
1085
|
},
|
|
1076
1086
|
meta: bindingifyPluginHookMeta(meta)
|
|
1077
1087
|
};
|
|
@@ -1099,7 +1109,7 @@ var NormalizedOutputOptionsImpl = class {
|
|
|
1099
1109
|
return mapFunctionOption(this.inner.chunkFilenames, "chunkFileNames");
|
|
1100
1110
|
}
|
|
1101
1111
|
get assetFileNames() {
|
|
1102
|
-
return this.inner.assetFilenames;
|
|
1112
|
+
return mapFunctionOption(this.inner.assetFilenames, "assetFilenames");
|
|
1103
1113
|
}
|
|
1104
1114
|
get format() {
|
|
1105
1115
|
return this.inner.format;
|
|
@@ -1183,7 +1193,7 @@ function bindingifyRenderStart(args) {
|
|
|
1183
1193
|
const { handler, meta } = normalizeHook(hook);
|
|
1184
1194
|
return {
|
|
1185
1195
|
plugin: async (ctx, opts) => {
|
|
1186
|
-
handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts), new NormalizedInputOptionsImpl(opts, args.onLog));
|
|
1196
|
+
handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts), new NormalizedInputOptionsImpl(opts, args.onLog));
|
|
1187
1197
|
},
|
|
1188
1198
|
meta: bindingifyPluginHookMeta(meta)
|
|
1189
1199
|
};
|
|
@@ -1194,7 +1204,7 @@ function bindingifyRenderChunk(args) {
|
|
|
1194
1204
|
const { handler, meta } = normalizeHook(hook);
|
|
1195
1205
|
return {
|
|
1196
1206
|
plugin: async (ctx, code, chunk, opts) => {
|
|
1197
|
-
const ret = await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), code, transformRenderedChunk(chunk), new NormalizedOutputOptionsImpl(opts));
|
|
1207
|
+
const ret = await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), code, transformRenderedChunk(chunk), new NormalizedOutputOptionsImpl(opts));
|
|
1198
1208
|
if (ret == null) return;
|
|
1199
1209
|
if (typeof ret === "string") return { code: ret };
|
|
1200
1210
|
if (!ret.map) return { code: ret.code };
|
|
@@ -1212,7 +1222,7 @@ function bindingifyAugmentChunkHash(args) {
|
|
|
1212
1222
|
const { handler, meta } = normalizeHook(hook);
|
|
1213
1223
|
return {
|
|
1214
1224
|
plugin: async (ctx, chunk) => {
|
|
1215
|
-
return await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
|
|
1225
|
+
return await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
|
|
1216
1226
|
},
|
|
1217
1227
|
meta: bindingifyPluginHookMeta(meta)
|
|
1218
1228
|
};
|
|
@@ -1223,7 +1233,7 @@ function bindingifyRenderError(args) {
|
|
|
1223
1233
|
const { handler, meta } = normalizeHook(hook);
|
|
1224
1234
|
return {
|
|
1225
1235
|
plugin: async (ctx, err) => {
|
|
1226
|
-
handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), normalizeErrors(err));
|
|
1236
|
+
handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), normalizeErrors(err));
|
|
1227
1237
|
},
|
|
1228
1238
|
meta: bindingifyPluginHookMeta(meta)
|
|
1229
1239
|
};
|
|
@@ -1239,7 +1249,7 @@ function bindingifyGenerateBundle(args) {
|
|
|
1239
1249
|
deleted: new Set()
|
|
1240
1250
|
};
|
|
1241
1251
|
const output = transformToOutputBundle(bundle, changed);
|
|
1242
|
-
await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts), output, isWrite);
|
|
1252
|
+
await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts), output, isWrite);
|
|
1243
1253
|
return collectChangedBundle(changed, output);
|
|
1244
1254
|
},
|
|
1245
1255
|
meta: bindingifyPluginHookMeta(meta)
|
|
@@ -1256,7 +1266,7 @@ function bindingifyWriteBundle(args) {
|
|
|
1256
1266
|
deleted: new Set()
|
|
1257
1267
|
};
|
|
1258
1268
|
const output = transformToOutputBundle(bundle, changed);
|
|
1259
|
-
await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts), output);
|
|
1269
|
+
await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts), output);
|
|
1260
1270
|
return collectChangedBundle(changed, output);
|
|
1261
1271
|
},
|
|
1262
1272
|
meta: bindingifyPluginHookMeta(meta)
|
|
@@ -1268,7 +1278,7 @@ function bindingifyCloseBundle(args) {
|
|
|
1268
1278
|
const { handler, meta } = normalizeHook(hook);
|
|
1269
1279
|
return {
|
|
1270
1280
|
plugin: async (ctx) => {
|
|
1271
|
-
await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel));
|
|
1281
|
+
await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel));
|
|
1272
1282
|
},
|
|
1273
1283
|
meta: bindingifyPluginHookMeta(meta)
|
|
1274
1284
|
};
|
|
@@ -1280,7 +1290,7 @@ function bindingifyBanner(args) {
|
|
|
1280
1290
|
return {
|
|
1281
1291
|
plugin: async (ctx, chunk) => {
|
|
1282
1292
|
if (typeof handler === "string") return handler;
|
|
1283
|
-
return handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
|
|
1293
|
+
return handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
|
|
1284
1294
|
},
|
|
1285
1295
|
meta: bindingifyPluginHookMeta(meta)
|
|
1286
1296
|
};
|
|
@@ -1292,7 +1302,7 @@ function bindingifyFooter(args) {
|
|
|
1292
1302
|
return {
|
|
1293
1303
|
plugin: async (ctx, chunk) => {
|
|
1294
1304
|
if (typeof handler === "string") return handler;
|
|
1295
|
-
return handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
|
|
1305
|
+
return handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
|
|
1296
1306
|
},
|
|
1297
1307
|
meta: bindingifyPluginHookMeta(meta)
|
|
1298
1308
|
};
|
|
@@ -1304,7 +1314,7 @@ function bindingifyIntro(args) {
|
|
|
1304
1314
|
return {
|
|
1305
1315
|
plugin: async (ctx, chunk) => {
|
|
1306
1316
|
if (typeof handler === "string") return handler;
|
|
1307
|
-
return handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
|
|
1317
|
+
return handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
|
|
1308
1318
|
},
|
|
1309
1319
|
meta: bindingifyPluginHookMeta(meta)
|
|
1310
1320
|
};
|
|
@@ -1316,7 +1326,7 @@ function bindingifyOutro(args) {
|
|
|
1316
1326
|
return {
|
|
1317
1327
|
plugin: async (ctx, chunk) => {
|
|
1318
1328
|
if (typeof handler === "string") return handler;
|
|
1319
|
-
return handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
|
|
1329
|
+
return handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
|
|
1320
1330
|
},
|
|
1321
1331
|
meta: bindingifyPluginHookMeta(meta)
|
|
1322
1332
|
};
|
|
@@ -1330,7 +1340,7 @@ function bindingifyWatchChange(args) {
|
|
|
1330
1340
|
const { handler, meta } = normalizeHook(hook);
|
|
1331
1341
|
return {
|
|
1332
1342
|
plugin: async (ctx, id, event) => {
|
|
1333
|
-
await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), id, { event });
|
|
1343
|
+
await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), id, { event });
|
|
1334
1344
|
},
|
|
1335
1345
|
meta: bindingifyPluginHookMeta(meta)
|
|
1336
1346
|
};
|
|
@@ -1341,7 +1351,7 @@ function bindingifyCloseWatcher(args) {
|
|
|
1341
1351
|
const { handler, meta } = normalizeHook(hook);
|
|
1342
1352
|
return {
|
|
1343
1353
|
plugin: async (ctx) => {
|
|
1344
|
-
await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel));
|
|
1354
|
+
await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel));
|
|
1345
1355
|
},
|
|
1346
1356
|
meta: bindingifyPluginHookMeta(meta)
|
|
1347
1357
|
};
|
|
@@ -1702,7 +1712,7 @@ function bindingifyOutputOptions(outputOptions) {
|
|
|
1702
1712
|
globals,
|
|
1703
1713
|
esModule,
|
|
1704
1714
|
name,
|
|
1705
|
-
assetFileNames,
|
|
1715
|
+
assetFileNames: bindingifyAssetFilenames(assetFileNames),
|
|
1706
1716
|
entryFileNames,
|
|
1707
1717
|
chunkFileNames,
|
|
1708
1718
|
cssEntryFileNames,
|
|
@@ -1749,6 +1759,17 @@ function bindingifySourcemap(sourcemap) {
|
|
|
1749
1759
|
function bindingifySourcemapIgnoreList(sourcemapIgnoreList) {
|
|
1750
1760
|
return typeof sourcemapIgnoreList === "function" ? sourcemapIgnoreList : sourcemapIgnoreList === false ? () => false : (relativeSourcePath, _sourcemapPath) => relativeSourcePath.includes("node_modules");
|
|
1751
1761
|
}
|
|
1762
|
+
function bindingifyAssetFilenames(assetFileNames) {
|
|
1763
|
+
if (typeof assetFileNames === "function") return (asset) => {
|
|
1764
|
+
return assetFileNames({
|
|
1765
|
+
names: asset.names,
|
|
1766
|
+
originalFileNames: asset.originalFileNames,
|
|
1767
|
+
source: transformAssetSource(asset.source),
|
|
1768
|
+
type: "asset"
|
|
1769
|
+
});
|
|
1770
|
+
};
|
|
1771
|
+
return assetFileNames;
|
|
1772
|
+
}
|
|
1752
1773
|
|
|
1753
1774
|
//#endregion
|
|
1754
1775
|
//#region ../../node_modules/.pnpm/remeda@2.19.1/node_modules/remeda/dist/chunk-K26VP6CL.js
|
|
@@ -2620,7 +2641,7 @@ const watch = (input) => {
|
|
|
2620
2641
|
|
|
2621
2642
|
//#endregion
|
|
2622
2643
|
//#region package.json
|
|
2623
|
-
var version = "1.0.0-beta.
|
|
2644
|
+
var version = "1.0.0-beta.3";
|
|
2624
2645
|
var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
|
|
2625
2646
|
|
|
2626
2647
|
//#endregion
|
package/dist/types/binding.d.ts
CHANGED
|
@@ -46,7 +46,7 @@ export declare class BindingNormalizedOptions {
|
|
|
46
46
|
get cssChunkFilenames(): string | undefined
|
|
47
47
|
get entryFilenames(): string | undefined
|
|
48
48
|
get chunkFilenames(): string | undefined
|
|
49
|
-
get assetFilenames(): string
|
|
49
|
+
get assetFilenames(): string | undefined
|
|
50
50
|
get dir(): string | null
|
|
51
51
|
get file(): string | null
|
|
52
52
|
get format(): 'es' | 'cjs' | 'app' | 'iife' | 'umd'
|
|
@@ -103,7 +103,7 @@ export declare class BindingOutputs {
|
|
|
103
103
|
export declare class BindingPluginContext {
|
|
104
104
|
load(specifier: string, sideEffects: BindingHookSideEffects | undefined, fn: () => void): Promise<void>
|
|
105
105
|
resolve(specifier: string, importer?: string | undefined | null, extraOptions?: BindingPluginContextResolveOptions | undefined | null): Promise<BindingPluginContextResolvedId | null>
|
|
106
|
-
emitFile(file: BindingEmittedAsset): string
|
|
106
|
+
emitFile(file: BindingEmittedAsset, assetFilename?: string | undefined | null): string
|
|
107
107
|
emitChunk(file: BindingEmittedChunk): string
|
|
108
108
|
getFileName(referenceId: string): string
|
|
109
109
|
getModuleInfo(moduleId: string): BindingModuleInfo | null
|
|
@@ -493,7 +493,7 @@ export interface BindingNotifyOption {
|
|
|
493
493
|
|
|
494
494
|
export interface BindingOutputOptions {
|
|
495
495
|
name?: string
|
|
496
|
-
assetFileNames?: string
|
|
496
|
+
assetFileNames?: string | ((chunk: BindingPreRenderedAsset) => string)
|
|
497
497
|
entryFileNames?: string | ((chunk: PreRenderedChunk) => string)
|
|
498
498
|
chunkFileNames?: string | ((chunk: PreRenderedChunk) => string)
|
|
499
499
|
cssEntryFileNames?: string | ((chunk: PreRenderedChunk) => string)
|
|
@@ -596,6 +596,12 @@ export interface BindingPluginWithIndex {
|
|
|
596
596
|
plugin: BindingPluginOptions
|
|
597
597
|
}
|
|
598
598
|
|
|
599
|
+
export interface BindingPreRenderedAsset {
|
|
600
|
+
names: Array<string>
|
|
601
|
+
originalFileNames: Array<string>
|
|
602
|
+
source: BindingAssetSource
|
|
603
|
+
}
|
|
604
|
+
|
|
599
605
|
export interface BindingRemote {
|
|
600
606
|
type?: string
|
|
601
607
|
entry: string
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RolldownOutput, OutputAsset, OutputChunk, RenderedChunk, SourceMap } from './types/rolldown-output';
|
|
2
2
|
import type { InputOptions, InputOption, ExternalOption, JsxOptions } from './options/input-options';
|
|
3
|
-
import type { ModuleFormat, OutputOptions } from './options/output-options';
|
|
3
|
+
import type { ModuleFormat, OutputOptions, PreRenderedAsset } from './options/output-options';
|
|
4
4
|
import type { RolldownOptions } from './types/rolldown-options';
|
|
5
5
|
import type { AsyncPluginHooks, CustomPluginOptions, FunctionPluginHooks, ImportKind, LoadResult, ModuleOptions, ModuleType, ObjectHook, ParallelPluginHooks, PartialResolvedId, Plugin, RolldownPlugin, RolldownPluginOption, ResolveIdResult, ResolvedId, SourceDescription, TransformResult } from './plugin';
|
|
6
6
|
import { DefineParallelPluginResult } from './plugin/parallel-plugin';
|
|
@@ -24,5 +24,5 @@ import { RolldownWatcher } from './api/watch/watch-emitter';
|
|
|
24
24
|
import { build, type BuildOptions } from './api/build';
|
|
25
25
|
export { defineConfig, rolldown, watch, build };
|
|
26
26
|
export declare const VERSION: string;
|
|
27
|
-
export type { OutputAsset, OutputChunk, RolldownOptions, RolldownOutput, RolldownBuild, InputOptions, NormalizedInputOptions, OutputOptions, NormalizedOutputOptions, Plugin, RolldownPlugin, RolldownPluginOption, DefineParallelPluginResult, ConfigExport, ImportKind, InputOption, ExternalOption, ModuleFormat, ModuleType, InternalModuleFormat, LoadResult, TransformResult, ResolveIdResult, PluginContext, TransformPluginContext, ObjectHook, PreRenderedChunk, SourceMap, SourceDescription, PartialNull, PartialResolvedId, ResolvedId, ModuleOptions, ModuleInfo, MinimalPluginContext, EmittedFile, EmittedAsset, CustomPluginOptions, AsyncPluginHooks, ParallelPluginHooks, FunctionPluginHooks, ExistingRawSourceMap, SourceMapInput, OutputBundle, JsxOptions, WatchOptions, RolldownWatcher, BuildOptions, RenderedChunk, };
|
|
27
|
+
export type { OutputAsset, OutputChunk, RolldownOptions, RolldownOutput, RolldownBuild, InputOptions, NormalizedInputOptions, OutputOptions, NormalizedOutputOptions, Plugin, RolldownPlugin, RolldownPluginOption, DefineParallelPluginResult, ConfigExport, ImportKind, InputOption, ExternalOption, ModuleFormat, ModuleType, InternalModuleFormat, LoadResult, TransformResult, ResolveIdResult, PluginContext, TransformPluginContext, ObjectHook, PreRenderedChunk, PreRenderedAsset, SourceMap, SourceDescription, PartialNull, PartialResolvedId, ResolvedId, ModuleOptions, ModuleInfo, MinimalPluginContext, EmittedFile, EmittedAsset, CustomPluginOptions, AsyncPluginHooks, ParallelPluginHooks, FunctionPluginHooks, ExistingRawSourceMap, SourceMapInput, OutputBundle, JsxOptions, WatchOptions, RolldownWatcher, BuildOptions, RenderedChunk, };
|
|
28
28
|
export type { RollupError, RollupLog, LoggingFunction } from './types/misc';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BindingNormalizedOptions } from '../binding';
|
|
2
2
|
import type { SourcemapIgnoreListOption, SourcemapPathTransformOption } from '../types/misc';
|
|
3
|
-
import type { ChunkFileNamesFunction, GlobalsFunction, OutputOptions } from './output-options';
|
|
3
|
+
import type { AssetFileNamesFunction, ChunkFileNamesFunction, GlobalsFunction, OutputOptions } from './output-options';
|
|
4
4
|
export type InternalModuleFormat = 'es' | 'cjs' | 'iife' | 'umd' | 'app';
|
|
5
5
|
export interface NormalizedOutputOptions {
|
|
6
6
|
name: string | undefined;
|
|
@@ -8,7 +8,7 @@ export interface NormalizedOutputOptions {
|
|
|
8
8
|
dir: string | undefined;
|
|
9
9
|
entryFileNames: string | ChunkFileNamesFunction;
|
|
10
10
|
chunkFileNames: string | ChunkFileNamesFunction;
|
|
11
|
-
assetFileNames: string;
|
|
11
|
+
assetFileNames: string | AssetFileNamesFunction;
|
|
12
12
|
format: InternalModuleFormat;
|
|
13
13
|
exports: NonNullable<OutputOptions['exports']>;
|
|
14
14
|
sourcemap: boolean | 'inline' | 'hidden';
|
|
@@ -38,7 +38,7 @@ export declare class NormalizedOutputOptionsImpl implements NormalizedOutputOpti
|
|
|
38
38
|
get dir(): string | undefined;
|
|
39
39
|
get entryFileNames(): string | UnsupportedFnRet;
|
|
40
40
|
get chunkFileNames(): string | UnsupportedFnRet;
|
|
41
|
-
get assetFileNames(): string;
|
|
41
|
+
get assetFileNames(): string | UnsupportedFnRet;
|
|
42
42
|
get format(): 'es' | 'cjs' | 'app' | 'iife' | 'umd';
|
|
43
43
|
get exports(): 'default' | 'named' | 'none' | 'auto';
|
|
44
44
|
get sourcemap(): boolean | 'inline' | 'hidden';
|
|
@@ -22,7 +22,7 @@ export class NormalizedOutputOptionsImpl {
|
|
|
22
22
|
return mapFunctionOption(this.inner.chunkFilenames, 'chunkFileNames');
|
|
23
23
|
}
|
|
24
24
|
get assetFileNames() {
|
|
25
|
-
return this.inner.assetFilenames;
|
|
25
|
+
return mapFunctionOption(this.inner.assetFilenames, 'assetFilenames');
|
|
26
26
|
}
|
|
27
27
|
get format() {
|
|
28
28
|
return this.inner.format;
|
|
@@ -6,6 +6,13 @@ import { RenderedChunk } from '../types/rolldown-output';
|
|
|
6
6
|
export type ModuleFormat = 'es' | 'cjs' | 'esm' | 'module' | 'commonjs' | 'iife' | 'umd' | 'experimental-app';
|
|
7
7
|
export type AddonFunction = (chunk: RenderedChunk) => string | Promise<string>;
|
|
8
8
|
export type ChunkFileNamesFunction = (chunkInfo: PreRenderedChunk) => string;
|
|
9
|
+
export interface PreRenderedAsset {
|
|
10
|
+
names: string[];
|
|
11
|
+
originalFileNames: string[];
|
|
12
|
+
source: string | Uint8Array;
|
|
13
|
+
type: 'asset';
|
|
14
|
+
}
|
|
15
|
+
export type AssetFileNamesFunction = (chunkInfo: PreRenderedAsset) => string;
|
|
9
16
|
export type GlobalsFunction = (name: string) => string;
|
|
10
17
|
export type ESTarget = 'es6' | 'es2015' | 'es2016' | 'es2017' | 'es2018' | 'es2019' | 'es2020' | 'es2021' | 'es2022' | 'es2023' | 'es2024' | 'esnext';
|
|
11
18
|
export interface OutputOptions {
|
|
@@ -32,7 +39,7 @@ export interface OutputOptions {
|
|
|
32
39
|
outro?: string | AddonFunction;
|
|
33
40
|
extend?: boolean;
|
|
34
41
|
esModule?: boolean | 'if-default-prop';
|
|
35
|
-
assetFileNames?: string;
|
|
42
|
+
assetFileNames?: string | AssetFileNamesFunction;
|
|
36
43
|
entryFileNames?: string | ChunkFileNamesFunction;
|
|
37
44
|
chunkFileNames?: string | ChunkFileNamesFunction;
|
|
38
45
|
cssEntryFileNames?: string | ChunkFileNamesFunction;
|
|
@@ -19,7 +19,7 @@ export function bindingifyBuildStart(args) {
|
|
|
19
19
|
const { handler, meta } = normalizeHook(hook);
|
|
20
20
|
return {
|
|
21
21
|
plugin: async (ctx, opts) => {
|
|
22
|
-
await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedInputOptionsImpl(opts, args.onLog));
|
|
22
|
+
await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedInputOptionsImpl(opts, args.onLog));
|
|
23
23
|
},
|
|
24
24
|
meta: bindingifyPluginHookMeta(meta),
|
|
25
25
|
};
|
|
@@ -32,7 +32,7 @@ export function bindingifyBuildEnd(args) {
|
|
|
32
32
|
const { handler, meta } = normalizeHook(hook);
|
|
33
33
|
return {
|
|
34
34
|
plugin: async (ctx, err) => {
|
|
35
|
-
await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), err ? normalizeErrors(err) : undefined);
|
|
35
|
+
await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), err ? normalizeErrors(err) : undefined);
|
|
36
36
|
},
|
|
37
37
|
meta: bindingifyPluginHookMeta(meta),
|
|
38
38
|
};
|
|
@@ -53,7 +53,7 @@ export function bindingifyResolveId(args) {
|
|
|
53
53
|
custom: contextResolveOptions?.custom,
|
|
54
54
|
[SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF]: contextResolveOptions?.[SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF],
|
|
55
55
|
};
|
|
56
|
-
const ret = await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), specifier, importer ?? undefined, newExtraOptions);
|
|
56
|
+
const ret = await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), specifier, importer ?? undefined, newExtraOptions);
|
|
57
57
|
if (ret == null) {
|
|
58
58
|
return;
|
|
59
59
|
}
|
|
@@ -90,7 +90,7 @@ export function bindingifyResolveDynamicImport(args) {
|
|
|
90
90
|
const { handler, meta } = normalizeHook(hook);
|
|
91
91
|
return {
|
|
92
92
|
plugin: async (ctx, specifier, importer) => {
|
|
93
|
-
const ret = await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), specifier, importer ?? undefined);
|
|
93
|
+
const ret = await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), specifier, importer ?? undefined);
|
|
94
94
|
if (ret == null) {
|
|
95
95
|
return;
|
|
96
96
|
}
|
|
@@ -129,7 +129,7 @@ export function bindingifyTransform(args) {
|
|
|
129
129
|
const { handler, meta, options } = normalizeHook(hook);
|
|
130
130
|
return {
|
|
131
131
|
plugin: async (ctx, code, id, meta) => {
|
|
132
|
-
const ret = await handler.call(new TransformPluginContext(ctx.inner(), args.plugin, args.pluginContextData, ctx, id, code, args.onLog, args.logLevel), code, id, meta);
|
|
132
|
+
const ret = await handler.call(new TransformPluginContext(args.outputOptions, ctx.inner(), args.plugin, args.pluginContextData, ctx, id, code, args.onLog, args.logLevel), code, id, meta);
|
|
133
133
|
if (ret == null) {
|
|
134
134
|
return undefined;
|
|
135
135
|
}
|
|
@@ -159,7 +159,7 @@ export function bindingifyLoad(args) {
|
|
|
159
159
|
const { handler, meta, options } = normalizeHook(hook);
|
|
160
160
|
return {
|
|
161
161
|
plugin: async (ctx, id) => {
|
|
162
|
-
const ret = await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, id), id);
|
|
162
|
+
const ret = await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, id), id);
|
|
163
163
|
if (ret == null) {
|
|
164
164
|
return;
|
|
165
165
|
}
|
|
@@ -206,7 +206,7 @@ export function bindingifyModuleParsed(args) {
|
|
|
206
206
|
const { handler, meta } = normalizeHook(hook);
|
|
207
207
|
return {
|
|
208
208
|
plugin: async (ctx, moduleInfo) => {
|
|
209
|
-
await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformModuleInfo(moduleInfo, args.pluginContextData.getModuleOption(moduleInfo.id)));
|
|
209
|
+
await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformModuleInfo(moduleInfo, args.pluginContextData.getModuleOption(moduleInfo.id)));
|
|
210
210
|
},
|
|
211
211
|
meta: bindingifyPluginHookMeta(meta),
|
|
212
212
|
};
|
|
@@ -15,7 +15,7 @@ export function bindingifyRenderStart(args) {
|
|
|
15
15
|
const { handler, meta } = normalizeHook(hook);
|
|
16
16
|
return {
|
|
17
17
|
plugin: async (ctx, opts) => {
|
|
18
|
-
handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts), new NormalizedInputOptionsImpl(opts, args.onLog));
|
|
18
|
+
handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts), new NormalizedInputOptionsImpl(opts, args.onLog));
|
|
19
19
|
},
|
|
20
20
|
meta: bindingifyPluginHookMeta(meta),
|
|
21
21
|
};
|
|
@@ -28,7 +28,7 @@ export function bindingifyRenderChunk(args) {
|
|
|
28
28
|
const { handler, meta } = normalizeHook(hook);
|
|
29
29
|
return {
|
|
30
30
|
plugin: async (ctx, code, chunk, opts) => {
|
|
31
|
-
const ret = await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), code, transformRenderedChunk(chunk), new NormalizedOutputOptionsImpl(opts));
|
|
31
|
+
const ret = await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), code, transformRenderedChunk(chunk), new NormalizedOutputOptionsImpl(opts));
|
|
32
32
|
if (ret == null) {
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
@@ -54,7 +54,7 @@ export function bindingifyAugmentChunkHash(args) {
|
|
|
54
54
|
const { handler, meta } = normalizeHook(hook);
|
|
55
55
|
return {
|
|
56
56
|
plugin: async (ctx, chunk) => {
|
|
57
|
-
return await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
|
|
57
|
+
return await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
|
|
58
58
|
},
|
|
59
59
|
meta: bindingifyPluginHookMeta(meta),
|
|
60
60
|
};
|
|
@@ -67,7 +67,7 @@ export function bindingifyRenderError(args) {
|
|
|
67
67
|
const { handler, meta } = normalizeHook(hook);
|
|
68
68
|
return {
|
|
69
69
|
plugin: async (ctx, err) => {
|
|
70
|
-
handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), normalizeErrors(err));
|
|
70
|
+
handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), normalizeErrors(err));
|
|
71
71
|
},
|
|
72
72
|
meta: bindingifyPluginHookMeta(meta),
|
|
73
73
|
};
|
|
@@ -85,7 +85,7 @@ export function bindingifyGenerateBundle(args) {
|
|
|
85
85
|
deleted: new Set(),
|
|
86
86
|
};
|
|
87
87
|
const output = transformToOutputBundle(bundle, changed);
|
|
88
|
-
await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts), output, isWrite);
|
|
88
|
+
await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts), output, isWrite);
|
|
89
89
|
return collectChangedBundle(changed, output);
|
|
90
90
|
},
|
|
91
91
|
meta: bindingifyPluginHookMeta(meta),
|
|
@@ -104,7 +104,7 @@ export function bindingifyWriteBundle(args) {
|
|
|
104
104
|
deleted: new Set(),
|
|
105
105
|
};
|
|
106
106
|
const output = transformToOutputBundle(bundle, changed);
|
|
107
|
-
await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts), output);
|
|
107
|
+
await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts), output);
|
|
108
108
|
return collectChangedBundle(changed, output);
|
|
109
109
|
},
|
|
110
110
|
meta: bindingifyPluginHookMeta(meta),
|
|
@@ -118,7 +118,7 @@ export function bindingifyCloseBundle(args) {
|
|
|
118
118
|
const { handler, meta } = normalizeHook(hook);
|
|
119
119
|
return {
|
|
120
120
|
plugin: async (ctx) => {
|
|
121
|
-
await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel));
|
|
121
|
+
await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel));
|
|
122
122
|
},
|
|
123
123
|
meta: bindingifyPluginHookMeta(meta),
|
|
124
124
|
};
|
|
@@ -134,7 +134,7 @@ export function bindingifyBanner(args) {
|
|
|
134
134
|
if (typeof handler === 'string') {
|
|
135
135
|
return handler;
|
|
136
136
|
}
|
|
137
|
-
return handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
|
|
137
|
+
return handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
|
|
138
138
|
},
|
|
139
139
|
meta: bindingifyPluginHookMeta(meta),
|
|
140
140
|
};
|
|
@@ -150,7 +150,7 @@ export function bindingifyFooter(args) {
|
|
|
150
150
|
if (typeof handler === 'string') {
|
|
151
151
|
return handler;
|
|
152
152
|
}
|
|
153
|
-
return handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
|
|
153
|
+
return handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
|
|
154
154
|
},
|
|
155
155
|
meta: bindingifyPluginHookMeta(meta),
|
|
156
156
|
};
|
|
@@ -166,7 +166,7 @@ export function bindingifyIntro(args) {
|
|
|
166
166
|
if (typeof handler === 'string') {
|
|
167
167
|
return handler;
|
|
168
168
|
}
|
|
169
|
-
return handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
|
|
169
|
+
return handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
|
|
170
170
|
},
|
|
171
171
|
meta: bindingifyPluginHookMeta(meta),
|
|
172
172
|
};
|
|
@@ -182,7 +182,7 @@ export function bindingifyOutro(args) {
|
|
|
182
182
|
if (typeof handler === 'string') {
|
|
183
183
|
return handler;
|
|
184
184
|
}
|
|
185
|
-
return handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
|
|
185
|
+
return handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
|
|
186
186
|
},
|
|
187
187
|
meta: bindingifyPluginHookMeta(meta),
|
|
188
188
|
};
|
|
@@ -9,7 +9,7 @@ export function bindingifyWatchChange(args) {
|
|
|
9
9
|
const { handler, meta } = normalizeHook(hook);
|
|
10
10
|
return {
|
|
11
11
|
plugin: async (ctx, id, event) => {
|
|
12
|
-
await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), id, { event: event });
|
|
12
|
+
await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), id, { event: event });
|
|
13
13
|
},
|
|
14
14
|
meta: bindingifyPluginHookMeta(meta),
|
|
15
15
|
};
|
|
@@ -22,7 +22,7 @@ export function bindingifyCloseWatcher(args) {
|
|
|
22
22
|
const { handler, meta } = normalizeHook(hook);
|
|
23
23
|
return {
|
|
24
24
|
plugin: async (ctx) => {
|
|
25
|
-
await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel));
|
|
25
|
+
await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel));
|
|
26
26
|
},
|
|
27
27
|
meta: bindingifyPluginHookMeta(meta),
|
|
28
28
|
};
|
|
@@ -7,6 +7,7 @@ import { PluginContextData } from './plugin-context-data';
|
|
|
7
7
|
import { SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF } from '../constants/plugin-context';
|
|
8
8
|
import { PartialNull } from '../types/utils';
|
|
9
9
|
import type { LogHandler, LogLevelOption } from '../types/misc';
|
|
10
|
+
import { OutputOptions } from '../options/output-options';
|
|
10
11
|
export interface EmittedAsset {
|
|
11
12
|
type: 'asset';
|
|
12
13
|
name?: string;
|
|
@@ -30,17 +31,19 @@ export interface PrivatePluginContextResolveOptions extends PluginContextResolve
|
|
|
30
31
|
[SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF]?: symbol;
|
|
31
32
|
}
|
|
32
33
|
export declare class PluginContext extends MinimalPluginContext {
|
|
34
|
+
private outputOptions;
|
|
33
35
|
private context;
|
|
34
36
|
private data;
|
|
35
37
|
private onLog;
|
|
36
38
|
private currentLoadingModule?;
|
|
37
|
-
constructor(context: BindingPluginContext, plugin: Plugin, data: PluginContextData, onLog: LogHandler, logLevel: LogLevelOption, currentLoadingModule?: string | undefined);
|
|
39
|
+
constructor(outputOptions: OutputOptions, context: BindingPluginContext, plugin: Plugin, data: PluginContextData, onLog: LogHandler, logLevel: LogLevelOption, currentLoadingModule?: string | undefined);
|
|
38
40
|
load(options: {
|
|
39
41
|
id: string;
|
|
40
42
|
resolveDependencies?: boolean;
|
|
41
43
|
} & Partial<PartialNull<ModuleOptions>>): Promise<ModuleInfo>;
|
|
42
44
|
resolve(source: string, importer?: string, options?: PluginContextResolveOptions): Promise<ResolvedId | null>;
|
|
43
45
|
emitFile(file: EmittedAsset | EmittedChunk): string;
|
|
46
|
+
private getAssetFileNames;
|
|
44
47
|
getFileName(referenceId: string): string;
|
|
45
48
|
getModuleInfo(id: string): ModuleInfo | null;
|
|
46
49
|
getModuleIds(): IterableIterator<string>;
|
|
@@ -6,12 +6,14 @@ import { bindingifySideEffects } from '../utils/transform-side-effects';
|
|
|
6
6
|
import { LOG_LEVEL_WARN } from '../log/logging';
|
|
7
7
|
import { logCycleLoading } from '../log/logs';
|
|
8
8
|
export class PluginContext extends MinimalPluginContext {
|
|
9
|
+
outputOptions;
|
|
9
10
|
context;
|
|
10
11
|
data;
|
|
11
12
|
onLog;
|
|
12
13
|
currentLoadingModule;
|
|
13
|
-
constructor(context, plugin, data, onLog, logLevel, currentLoadingModule) {
|
|
14
|
+
constructor(outputOptions, context, plugin, data, onLog, logLevel, currentLoadingModule) {
|
|
14
15
|
super(onLog, logLevel, plugin.name);
|
|
16
|
+
this.outputOptions = outputOptions;
|
|
15
17
|
this.context = context;
|
|
16
18
|
this.data = data;
|
|
17
19
|
this.onLog = onLog;
|
|
@@ -81,11 +83,22 @@ export class PluginContext extends MinimalPluginContext {
|
|
|
81
83
|
if (file.type === 'chunk') {
|
|
82
84
|
return this.context.emitChunk(file);
|
|
83
85
|
}
|
|
86
|
+
const filename = file.fileName ? undefined : this.getAssetFileNames(file);
|
|
84
87
|
return this.context.emitFile({
|
|
85
88
|
...file,
|
|
86
89
|
originalFileName: file.originalFileName || undefined,
|
|
87
90
|
source: bindingAssetSource(file.source),
|
|
88
|
-
});
|
|
91
|
+
}, filename);
|
|
92
|
+
}
|
|
93
|
+
getAssetFileNames(file) {
|
|
94
|
+
if (typeof this.outputOptions.assetFileNames === 'function') {
|
|
95
|
+
return this.outputOptions.assetFileNames({
|
|
96
|
+
names: file.name ? [file.name] : [],
|
|
97
|
+
originalFileNames: file.originalFileName ? [file.originalFileName] : [],
|
|
98
|
+
source: file.source,
|
|
99
|
+
type: 'asset',
|
|
100
|
+
});
|
|
101
|
+
}
|
|
89
102
|
}
|
|
90
103
|
getFileName(referenceId) {
|
|
91
104
|
return this.context.getFileName(referenceId);
|
|
@@ -4,11 +4,12 @@ import { PluginContext } from './plugin-context';
|
|
|
4
4
|
import { PluginContextData } from './plugin-context-data';
|
|
5
5
|
import type { Plugin } from './index';
|
|
6
6
|
import { SourceMap } from '../types/rolldown-output';
|
|
7
|
+
import { OutputOptions } from '../options/output-options';
|
|
7
8
|
export declare class TransformPluginContext extends PluginContext {
|
|
8
9
|
private inner;
|
|
9
10
|
private moduleId;
|
|
10
11
|
private moduleSource;
|
|
11
|
-
constructor(context: BindingPluginContext, plugin: Plugin, data: PluginContextData, inner: BindingTransformPluginContext, moduleId: string, moduleSource: string, onLog: LogHandler, LogLevelOption: LogLevelOption);
|
|
12
|
+
constructor(outputOptions: OutputOptions, context: BindingPluginContext, plugin: Plugin, data: PluginContextData, inner: BindingTransformPluginContext, moduleId: string, moduleSource: string, onLog: LogHandler, LogLevelOption: LogLevelOption);
|
|
12
13
|
error(e: RollupError | string, pos?: number | {
|
|
13
14
|
column: number;
|
|
14
15
|
line: number;
|
|
@@ -5,8 +5,8 @@ export class TransformPluginContext extends PluginContext {
|
|
|
5
5
|
inner;
|
|
6
6
|
moduleId;
|
|
7
7
|
moduleSource;
|
|
8
|
-
constructor(context, plugin, data, inner, moduleId, moduleSource, onLog, LogLevelOption) {
|
|
9
|
-
super(context, plugin, data, onLog, LogLevelOption, moduleId);
|
|
8
|
+
constructor(outputOptions, context, plugin, data, inner, moduleId, moduleSource, onLog, LogLevelOption) {
|
|
9
|
+
super(outputOptions, context, plugin, data, onLog, LogLevelOption, moduleId);
|
|
10
10
|
this.inner = inner;
|
|
11
11
|
this.moduleId = moduleId;
|
|
12
12
|
this.moduleSource = moduleSource;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { unimplemented } from './misc';
|
|
2
2
|
import { transformRenderedChunk } from './transform-rendered-chunk';
|
|
3
|
+
import { transformAssetSource } from './asset-source';
|
|
3
4
|
export function bindingifyOutputOptions(outputOptions) {
|
|
4
5
|
const { dir, format, exports, hashCharacters, sourcemap, sourcemapIgnoreList, sourcemapPathTransform, name, assetFileNames, entryFileNames, chunkFileNames, cssEntryFileNames, cssChunkFileNames, banner, footer, intro, outro, esModule, globals, file, } = outputOptions;
|
|
5
6
|
return {
|
|
@@ -20,7 +21,7 @@ export function bindingifyOutputOptions(outputOptions) {
|
|
|
20
21
|
globals,
|
|
21
22
|
esModule,
|
|
22
23
|
name,
|
|
23
|
-
assetFileNames,
|
|
24
|
+
assetFileNames: bindingifyAssetFilenames(assetFileNames),
|
|
24
25
|
entryFileNames,
|
|
25
26
|
chunkFileNames,
|
|
26
27
|
cssEntryFileNames,
|
|
@@ -90,3 +91,16 @@ function bindingifySourcemapIgnoreList(sourcemapIgnoreList) {
|
|
|
90
91
|
? () => false
|
|
91
92
|
: (relativeSourcePath, _sourcemapPath) => relativeSourcePath.includes('node_modules');
|
|
92
93
|
}
|
|
94
|
+
function bindingifyAssetFilenames(assetFileNames) {
|
|
95
|
+
if (typeof assetFileNames === 'function') {
|
|
96
|
+
return (asset) => {
|
|
97
|
+
return assetFileNames({
|
|
98
|
+
names: asset.names,
|
|
99
|
+
originalFileNames: asset.originalFileNames,
|
|
100
|
+
source: transformAssetSource(asset.source),
|
|
101
|
+
type: 'asset',
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
return assetFileNames;
|
|
106
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rolldown",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.3",
|
|
4
4
|
"description": "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.",
|
|
5
5
|
"homepage": "https://rolldown.rs/",
|
|
6
6
|
"repository": {
|
|
@@ -123,21 +123,21 @@
|
|
|
123
123
|
"unbuild": "^3.0.0",
|
|
124
124
|
"why-is-node-running": "^3.0.0",
|
|
125
125
|
"@rolldown/testing": "0.0.1",
|
|
126
|
-
"rolldown": "1.0.0-beta.
|
|
126
|
+
"rolldown": "1.0.0-beta.3"
|
|
127
127
|
},
|
|
128
128
|
"optionalDependencies": {
|
|
129
|
-
"@rolldown/binding-darwin-x64": "1.0.0-beta.
|
|
130
|
-
"@rolldown/binding-
|
|
131
|
-
"@rolldown/binding-
|
|
132
|
-
"@rolldown/binding-
|
|
133
|
-
"@rolldown/binding-linux-arm64-gnu": "1.0.0-beta.
|
|
134
|
-
"@rolldown/binding-linux-arm64-musl": "1.0.0-beta.
|
|
135
|
-
"@rolldown/binding-linux-x64-
|
|
136
|
-
"@rolldown/binding-linux-x64-
|
|
137
|
-
"@rolldown/binding-wasm32-wasi": "1.0.0-beta.
|
|
138
|
-
"@rolldown/binding-win32-
|
|
139
|
-
"@rolldown/binding-win32-x64-msvc": "1.0.0-beta.
|
|
140
|
-
"@rolldown/binding-win32-
|
|
129
|
+
"@rolldown/binding-darwin-x64": "1.0.0-beta.3",
|
|
130
|
+
"@rolldown/binding-linux-arm-gnueabihf": "1.0.0-beta.3",
|
|
131
|
+
"@rolldown/binding-freebsd-x64": "1.0.0-beta.3",
|
|
132
|
+
"@rolldown/binding-darwin-arm64": "1.0.0-beta.3",
|
|
133
|
+
"@rolldown/binding-linux-arm64-gnu": "1.0.0-beta.3",
|
|
134
|
+
"@rolldown/binding-linux-arm64-musl": "1.0.0-beta.3",
|
|
135
|
+
"@rolldown/binding-linux-x64-gnu": "1.0.0-beta.3",
|
|
136
|
+
"@rolldown/binding-linux-x64-musl": "1.0.0-beta.3",
|
|
137
|
+
"@rolldown/binding-wasm32-wasi": "1.0.0-beta.3",
|
|
138
|
+
"@rolldown/binding-win32-ia32-msvc": "1.0.0-beta.3",
|
|
139
|
+
"@rolldown/binding-win32-x64-msvc": "1.0.0-beta.3",
|
|
140
|
+
"@rolldown/binding-win32-arm64-msvc": "1.0.0-beta.3"
|
|
141
141
|
},
|
|
142
142
|
"scripts": {
|
|
143
143
|
"# Scrips for binding #": "_",
|