rolldown 0.15.0-snapshot-3cea4f5-20241211003613 → 0.15.1-commit.4e41a08
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 +78 -26
- 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 +80 -28
- 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-0e08MJIp.mjs → src-Do1JlyLc.mjs} +118 -106
- package/dist/shared/{src-DYANT4eY.cjs → src-Dw217EaC.cjs} +118 -106
- package/dist/tsconfig.dts.tsbuildinfo +1 -1
- package/dist/types/binding.d.ts +8 -2
- package/dist/types/cli/load-config.d.ts +3 -0
- package/dist/types/cli/{utils.d.ts → logger.d.ts} +0 -2
- package/dist/types/options/input-options.d.ts +10 -2
- package/dist/types/options/normalized-output-options.d.ts +2 -1
- package/dist/types/plugin/minimal-plugin-context.d.ts +3 -3
- package/dist/types/plugin/plugin-context.d.ts +14 -10
- package/dist/types/plugin/transform-plugin-context.d.ts +7 -4
- package/dist/types/types/module-info.d.ts +1 -0
- package/dist/types/utils/misc.d.ts +1 -2
- package/package.json +15 -15
|
@@ -580,9 +580,7 @@ function unreachable(info) {
|
|
|
580
580
|
throw new Error("unreachable");
|
|
581
581
|
}
|
|
582
582
|
function unsupported(info) {
|
|
583
|
-
|
|
584
|
-
throw new Error(`UNSUPPORTED: ${info}`);
|
|
585
|
-
};
|
|
583
|
+
throw new Error(`UNSUPPORTED: ${info}`);
|
|
586
584
|
}
|
|
587
585
|
function noop(..._args) {}
|
|
588
586
|
|
|
@@ -825,7 +823,8 @@ function getLogger(plugins, onLog, logLevel) {
|
|
|
825
823
|
rolldownVersion: VERSION,
|
|
826
824
|
watchMode: false
|
|
827
825
|
},
|
|
828
|
-
warn: getLogHandler$1(LOG_LEVEL_WARN)
|
|
826
|
+
warn: getLogHandler$1(LOG_LEVEL_WARN),
|
|
827
|
+
pluginName: plugin.name || "unknown"
|
|
829
828
|
}, level, log) === false) return;
|
|
830
829
|
}
|
|
831
830
|
}
|
|
@@ -1048,7 +1047,8 @@ var PluginDriver = class {
|
|
|
1048
1047
|
rolldownVersion: VERSION,
|
|
1049
1048
|
watchMode: false
|
|
1050
1049
|
},
|
|
1051
|
-
warn: getLogHandler(LOG_LEVEL_WARN, "PLUGIN_WARNING", logger, name, logLevel)
|
|
1050
|
+
warn: getLogHandler(LOG_LEVEL_WARN, "PLUGIN_WARNING", logger, name, logLevel),
|
|
1051
|
+
pluginName: name
|
|
1052
1052
|
}, inputOptions);
|
|
1053
1053
|
if (result) inputOptions = result;
|
|
1054
1054
|
}
|
|
@@ -1148,6 +1148,7 @@ function transformModuleInfo(info, option) {
|
|
|
1148
1148
|
dynamicImporters: info.dynamicImporters,
|
|
1149
1149
|
importedIds: info.importedIds,
|
|
1150
1150
|
dynamicallyImportedIds: info.dynamicallyImportedIds,
|
|
1151
|
+
exports: info.exports,
|
|
1151
1152
|
isEntry: info.isEntry,
|
|
1152
1153
|
...option
|
|
1153
1154
|
};
|
|
@@ -1160,21 +1161,20 @@ var MinimalPluginContext = class {
|
|
|
1160
1161
|
warn;
|
|
1161
1162
|
debug;
|
|
1162
1163
|
meta;
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
const pluginName = plugin.name || "unknown";
|
|
1164
|
+
constructor(onLog, logLevel, pluginName) {
|
|
1165
|
+
this.pluginName = pluginName;
|
|
1166
1166
|
this.debug = getLogHandler(LOG_LEVEL_DEBUG, "PLUGIN_LOG", onLog, pluginName, logLevel);
|
|
1167
1167
|
this.info = getLogHandler(LOG_LEVEL_INFO, "PLUGIN_LOG", onLog, pluginName, logLevel);
|
|
1168
1168
|
this.warn = getLogHandler(LOG_LEVEL_WARN, "PLUGIN_WARNING", onLog, pluginName, logLevel);
|
|
1169
|
-
this.error = (e) => {
|
|
1170
|
-
return error(logPluginError(normalizeLog(e), pluginName));
|
|
1171
|
-
};
|
|
1172
1169
|
this.meta = {
|
|
1173
1170
|
rollupVersion: "4.23.0",
|
|
1174
1171
|
rolldownVersion: VERSION,
|
|
1175
1172
|
watchMode: false
|
|
1176
1173
|
};
|
|
1177
1174
|
}
|
|
1175
|
+
error(e) {
|
|
1176
|
+
return error(logPluginError(normalizeLog(e), this.pluginName));
|
|
1177
|
+
}
|
|
1178
1178
|
};
|
|
1179
1179
|
|
|
1180
1180
|
//#endregion
|
|
@@ -1194,84 +1194,92 @@ function bindingifySideEffects(sideEffects) {
|
|
|
1194
1194
|
//#endregion
|
|
1195
1195
|
//#region src/plugin/plugin-context.ts
|
|
1196
1196
|
var PluginContext = class extends MinimalPluginContext {
|
|
1197
|
-
load;
|
|
1198
|
-
resolve;
|
|
1199
|
-
emitFile;
|
|
1200
|
-
getFileName;
|
|
1201
|
-
getModuleInfo;
|
|
1202
|
-
getModuleIds;
|
|
1203
|
-
addWatchFile;
|
|
1204
|
-
/**
|
|
1205
|
-
* @deprecated This rollup API won't be supported by rolldown. Using this API will cause runtime error.
|
|
1206
|
-
*/
|
|
1207
|
-
parse;
|
|
1208
1197
|
constructor(context, plugin, data, onLog, logLevel, currentLoadingModule) {
|
|
1209
|
-
super(onLog, logLevel, plugin);
|
|
1210
|
-
this.
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
const promise = new Promise((resolve, _) => {
|
|
1224
|
-
resolveFn = resolve;
|
|
1225
|
-
});
|
|
1226
|
-
data.loadModulePromiseMap.set(id, promise);
|
|
1227
|
-
try {
|
|
1228
|
-
await context.load(id, bindingifySideEffects(options.moduleSideEffects), resolveFn);
|
|
1229
|
-
} finally {
|
|
1230
|
-
data.loadModulePromiseMap.delete(id);
|
|
1231
|
-
}
|
|
1232
|
-
return promise;
|
|
1233
|
-
}
|
|
1234
|
-
await createLoadModulePromise();
|
|
1235
|
-
return data.getModuleInfo(id, context);
|
|
1236
|
-
};
|
|
1237
|
-
this.resolve = async (source, importer, options) => {
|
|
1238
|
-
let receipt = undefined;
|
|
1239
|
-
if (options != null) receipt = data.saveResolveOptions(options);
|
|
1240
|
-
const res = await context.resolve(source, importer, {
|
|
1241
|
-
custom: receipt,
|
|
1242
|
-
skipSelf: options?.skipSelf
|
|
1243
|
-
});
|
|
1244
|
-
if (receipt != null) data.removeSavedResolveOptions(receipt);
|
|
1245
|
-
if (res == null) return null;
|
|
1246
|
-
const info = data.getModuleOption(res.id) || {};
|
|
1247
|
-
return {
|
|
1248
|
-
...res,
|
|
1249
|
-
...info
|
|
1250
|
-
};
|
|
1198
|
+
super(onLog, logLevel, plugin.name);
|
|
1199
|
+
this.context = context;
|
|
1200
|
+
this.data = data;
|
|
1201
|
+
this.onLog = onLog;
|
|
1202
|
+
this.currentLoadingModule = currentLoadingModule;
|
|
1203
|
+
}
|
|
1204
|
+
async load(options) {
|
|
1205
|
+
const id = options.id;
|
|
1206
|
+
if (id === this.currentLoadingModule) this.onLog(LOG_LEVEL_WARN, logCycleLoading(super.pluginName, this.currentLoadingModule));
|
|
1207
|
+
const moduleInfo = this.data.getModuleInfo(id, this.context);
|
|
1208
|
+
if (moduleInfo && moduleInfo.code !== null) return moduleInfo;
|
|
1209
|
+
const rawOptions = {
|
|
1210
|
+
meta: options.meta || {},
|
|
1211
|
+
moduleSideEffects: options.moduleSideEffects || null
|
|
1251
1212
|
};
|
|
1252
|
-
this.
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1213
|
+
this.data.updateModuleOption(id, rawOptions);
|
|
1214
|
+
async function createLoadModulePromise(context, data) {
|
|
1215
|
+
const loadPromise = data.loadModulePromiseMap.get(id);
|
|
1216
|
+
if (loadPromise) return loadPromise;
|
|
1217
|
+
let resolveFn;
|
|
1218
|
+
const promise = new Promise((resolve, _) => {
|
|
1219
|
+
resolveFn = resolve;
|
|
1258
1220
|
});
|
|
1221
|
+
data.loadModulePromiseMap.set(id, promise);
|
|
1222
|
+
try {
|
|
1223
|
+
await context.load(id, bindingifySideEffects(options.moduleSideEffects), resolveFn);
|
|
1224
|
+
} finally {
|
|
1225
|
+
data.loadModulePromiseMap.delete(id);
|
|
1226
|
+
}
|
|
1227
|
+
return promise;
|
|
1228
|
+
}
|
|
1229
|
+
await createLoadModulePromise(this.context, this.data);
|
|
1230
|
+
return this.data.getModuleInfo(id, this.context);
|
|
1231
|
+
}
|
|
1232
|
+
async resolve(source, importer, options) {
|
|
1233
|
+
let receipt = undefined;
|
|
1234
|
+
if (options != null) receipt = this.data.saveResolveOptions(options);
|
|
1235
|
+
const res = await this.context.resolve(source, importer, {
|
|
1236
|
+
custom: receipt,
|
|
1237
|
+
skipSelf: options?.skipSelf
|
|
1238
|
+
});
|
|
1239
|
+
if (receipt != null) this.data.removeSavedResolveOptions(receipt);
|
|
1240
|
+
if (res == null) return null;
|
|
1241
|
+
const info = this.data.getModuleOption(res.id) || {};
|
|
1242
|
+
return {
|
|
1243
|
+
...res,
|
|
1244
|
+
...info
|
|
1259
1245
|
};
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
this.
|
|
1264
|
-
|
|
1246
|
+
}
|
|
1247
|
+
emitFile(file) {
|
|
1248
|
+
if (file.type !== "asset") return unimplemented("PluginContext.emitFile: only asset type is supported");
|
|
1249
|
+
return this.context.emitFile({
|
|
1250
|
+
...file,
|
|
1251
|
+
originalFileName: file.originalFileName || undefined,
|
|
1252
|
+
source: bindingAssetSource(file.source)
|
|
1253
|
+
});
|
|
1254
|
+
}
|
|
1255
|
+
getFileName(referenceId) {
|
|
1256
|
+
return this.context.getFileName(referenceId);
|
|
1257
|
+
}
|
|
1258
|
+
getModuleInfo(id) {
|
|
1259
|
+
return this.data.getModuleInfo(id, this.context);
|
|
1260
|
+
}
|
|
1261
|
+
getModuleIds() {
|
|
1262
|
+
return this.data.getModuleIds(this.context);
|
|
1263
|
+
}
|
|
1264
|
+
addWatchFile(id) {
|
|
1265
|
+
this.context.addWatchFile(id);
|
|
1266
|
+
}
|
|
1267
|
+
/**
|
|
1268
|
+
* @deprecated This rollup API won't be supported by rolldown. Using this API will cause runtime error.
|
|
1269
|
+
*/
|
|
1270
|
+
parse(_input, _options) {
|
|
1271
|
+
unsupported("`PluginContext#parse` is not supported by rolldown.");
|
|
1265
1272
|
}
|
|
1266
1273
|
};
|
|
1267
1274
|
|
|
1268
1275
|
//#endregion
|
|
1269
1276
|
//#region src/plugin/transform-plugin-context.ts
|
|
1270
1277
|
var TransformPluginContext = class extends PluginContext {
|
|
1271
|
-
error;
|
|
1272
|
-
getCombinedSourcemap;
|
|
1273
1278
|
constructor(context, plugin, data, inner, moduleId, moduleSource, onLog, LogLevelOption) {
|
|
1274
1279
|
super(context, plugin, data, onLog, LogLevelOption, moduleId);
|
|
1280
|
+
this.inner = inner;
|
|
1281
|
+
this.moduleId = moduleId;
|
|
1282
|
+
this.moduleSource = moduleSource;
|
|
1275
1283
|
const getLogHandler$1 = (handler) => (log, pos) => {
|
|
1276
1284
|
log = normalizeLog(log);
|
|
1277
1285
|
if (pos) augmentCodeLocation(log, pos, moduleSource, moduleId);
|
|
@@ -1282,14 +1290,16 @@ var TransformPluginContext = class extends PluginContext {
|
|
|
1282
1290
|
this.debug = getLogHandler$1(this.debug);
|
|
1283
1291
|
this.warn = getLogHandler$1(this.warn);
|
|
1284
1292
|
this.info = getLogHandler$1(this.info);
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
+
}
|
|
1294
|
+
error(e, pos) {
|
|
1295
|
+
if (typeof e === "string") e = { message: e };
|
|
1296
|
+
if (pos) augmentCodeLocation(e, pos, this.moduleSource, this.moduleId);
|
|
1297
|
+
e.id = this.moduleId;
|
|
1298
|
+
e.hook = "transform";
|
|
1299
|
+
return error(logPluginError(normalizeLog(e), super.pluginName));
|
|
1300
|
+
}
|
|
1301
|
+
getCombinedSourcemap() {
|
|
1302
|
+
return JSON.parse(this.inner.getCombinedSourcemap());
|
|
1293
1303
|
}
|
|
1294
1304
|
};
|
|
1295
1305
|
|
|
@@ -1522,7 +1532,9 @@ function bindingifyModuleParsed(args) {
|
|
|
1522
1532
|
//#endregion
|
|
1523
1533
|
//#region src/options/normalized-output-options.ts
|
|
1524
1534
|
function mapFunctionOption(option, name) {
|
|
1525
|
-
return typeof option === "undefined" ?
|
|
1535
|
+
return typeof option === "undefined" ? () => {
|
|
1536
|
+
unsupported(`You should not take \`NormalizedOutputOptions#${name}\` and call it directly`);
|
|
1537
|
+
} : option;
|
|
1526
1538
|
}
|
|
1527
1539
|
var NormalizedOutputOptionsImpl = class {
|
|
1528
1540
|
inner;
|
|
@@ -2074,15 +2086,20 @@ function bindingifyInput(input) {
|
|
|
2074
2086
|
});
|
|
2075
2087
|
}
|
|
2076
2088
|
function bindingifyJsx(input) {
|
|
2089
|
+
if (input === false) return { type: "Disable" };
|
|
2077
2090
|
if (input) {
|
|
2078
|
-
|
|
2091
|
+
if (input.mode === "preserve") return { type: "Preserve" };
|
|
2092
|
+
const mode = input.mode ?? "automatic";
|
|
2079
2093
|
return {
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2094
|
+
type: "Enable",
|
|
2095
|
+
field0: {
|
|
2096
|
+
runtime: mode,
|
|
2097
|
+
importSource: mode === "classic" ? input.importSource : mode === "automatic" ? input.jsxImportSource : undefined,
|
|
2098
|
+
pragma: input.factory,
|
|
2099
|
+
pragmaFrag: input.fragment,
|
|
2100
|
+
development: input.development,
|
|
2101
|
+
refresh: input.refresh
|
|
2102
|
+
}
|
|
2086
2103
|
};
|
|
2087
2104
|
}
|
|
2088
2105
|
}
|
|
@@ -2317,10 +2334,7 @@ function createComposedPlugin(plugins) {
|
|
|
2317
2334
|
const createFixedPluginResolveFnMap = new Map();
|
|
2318
2335
|
function applyFixedPluginResolveFn(ctx, plugin) {
|
|
2319
2336
|
const createFixedPluginResolveFn = createFixedPluginResolveFnMap.get(plugin);
|
|
2320
|
-
if (createFixedPluginResolveFn)
|
|
2321
|
-
...ctx,
|
|
2322
|
-
resolve: createFixedPluginResolveFn(ctx)
|
|
2323
|
-
};
|
|
2337
|
+
if (createFixedPluginResolveFn) ctx.resolve = createFixedPluginResolveFn(ctx, ctx.resolve.bind(ctx));
|
|
2324
2338
|
return ctx;
|
|
2325
2339
|
}
|
|
2326
2340
|
if (batchedHooks.resolveId) {
|
|
@@ -2329,14 +2343,14 @@ function createComposedPlugin(plugins) {
|
|
|
2329
2343
|
for (let handlerIdx = 0; handlerIdx < batchedHandlers.length; handlerIdx++) {
|
|
2330
2344
|
const [_handler, plugin] = batchedHandlers[handlerIdx];
|
|
2331
2345
|
const handlerSymbol = handlerSymbols[handlerIdx];
|
|
2332
|
-
const createFixedPluginResolveFn = (ctx) => {
|
|
2346
|
+
const createFixedPluginResolveFn = (ctx, resolve) => {
|
|
2333
2347
|
return (source, importer, rawContextResolveOptions) => {
|
|
2334
2348
|
const contextResolveOptions = rawContextResolveOptions ?? {};
|
|
2335
2349
|
if (contextResolveOptions.skipSelf) {
|
|
2336
2350
|
contextResolveOptions[SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF] = handlerSymbol;
|
|
2337
2351
|
contextResolveOptions.skipSelf = false;
|
|
2338
2352
|
}
|
|
2339
|
-
return
|
|
2353
|
+
return resolve(source, importer, contextResolveOptions);
|
|
2340
2354
|
};
|
|
2341
2355
|
};
|
|
2342
2356
|
createFixedPluginResolveFnMap.set(plugin, createFixedPluginResolveFn);
|
|
@@ -2394,12 +2408,10 @@ function createComposedPlugin(plugins) {
|
|
|
2394
2408
|
}
|
|
2395
2409
|
for (const [handler, plugin] of batchedHandlers) {
|
|
2396
2410
|
const { handler: handlerFn } = normalizeHook(handler);
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
}
|
|
2402
|
-
}, code, id, moduleType);
|
|
2411
|
+
this.getCombinedSourcemap = () => {
|
|
2412
|
+
throw new Error(`The getCombinedSourcemap is not implement in transform hook at composedJsPlugins`);
|
|
2413
|
+
};
|
|
2414
|
+
const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), code, id, moduleType);
|
|
2403
2415
|
if (!isNullish(result)) {
|
|
2404
2416
|
if (typeof result === "string") updateOutput(result);
|
|
2405
2417
|
else if (result.code) updateOutput(result.code, result.moduleSideEffects);
|
|
@@ -2798,7 +2810,7 @@ const watch = (input) => {
|
|
|
2798
2810
|
|
|
2799
2811
|
//#endregion
|
|
2800
2812
|
//#region package.json
|
|
2801
|
-
var version = "0.15.
|
|
2813
|
+
var version = "0.15.1-commit.4e41a08";
|
|
2802
2814
|
var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
|
|
2803
2815
|
|
|
2804
2816
|
//#endregion
|