rolldown 0.15.0-commit.ddbe0a9 → 0.15.0-commit.f0c42f8
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-CQxH2KBL.mjs → src-DF6eJFya.mjs} +106 -99
- package/dist/shared/{src-fbNAyiv7.cjs → src-DO0qfKnj.cjs} +106 -99
- package/dist/tsconfig.dts.tsbuildinfo +1 -1
- package/dist/types/binding.d.ts +1 -0
- 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 +16 -16
package/dist/cjs/cli.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const require_chunk = require('../shared/chunk-BFvIen8E.cjs');
|
|
3
|
-
const require_src = require('../shared/src-
|
|
3
|
+
const require_src = require('../shared/src-DO0qfKnj.cjs');
|
|
4
4
|
const require_consola_36c0034f = require('../shared/consola_36c0034f-B7L-radJ.cjs');
|
|
5
5
|
const node_fs = require_chunk.__toESM(require("node:fs"));
|
|
6
6
|
const zod = require_chunk.__toESM(require("zod"));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const require_chunk = require('../shared/chunk-BFvIen8E.cjs');
|
|
3
|
-
const require_src = require('../shared/src-
|
|
3
|
+
const require_src = require('../shared/src-DO0qfKnj.cjs');
|
|
4
4
|
const node_url = require_chunk.__toESM(require("node:url"));
|
|
5
5
|
|
|
6
6
|
//#region src/plugin/parallel-plugin.ts
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const require_chunk = require('../shared/chunk-BFvIen8E.cjs');
|
|
3
|
-
const require_src = require('../shared/src-
|
|
3
|
+
const require_src = require('../shared/src-DO0qfKnj.cjs');
|
|
4
4
|
const node_worker_threads = require_chunk.__toESM(require("node:worker_threads"));
|
|
5
5
|
|
|
6
6
|
//#region src/parallel-plugin-worker.ts
|
package/dist/esm/cli.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LogLevelOptionSchema, LogLevelSchema, LogLevelWithErrorSchema, RollupLogSchema, RollupLogWithStringSchema, TreeshakingOptionsSchema, arraify, description, rolldown, version, watch } from "../shared/src-
|
|
1
|
+
import { LogLevelOptionSchema, LogLevelSchema, LogLevelWithErrorSchema, RollupLogSchema, RollupLogWithStringSchema, TreeshakingOptionsSchema, arraify, description, rolldown, version, watch } from "../shared/src-DF6eJFya.mjs";
|
|
2
2
|
import { createConsola } from "../shared/consola_36c0034f-D9ce-831.mjs";
|
|
3
3
|
import fs from "node:fs";
|
|
4
4
|
import { ZodFirstPartyTypeKind, z } from "zod";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BuiltinPlugin, __toESM, buildImportAnalysisPlugin, composeJsPlugins, createBundler, dynamicImportVarsPlugin, handleOutputErrors, importGlobPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, require_binding, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin } from "../shared/src-
|
|
1
|
+
import { BuiltinPlugin, __toESM, buildImportAnalysisPlugin, composeJsPlugins, createBundler, dynamicImportVarsPlugin, handleOutputErrors, importGlobPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, require_binding, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin } from "../shared/src-DF6eJFya.mjs";
|
|
2
2
|
import { pathToFileURL } from "node:url";
|
|
3
3
|
|
|
4
4
|
//#region src/plugin/parallel-plugin.ts
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PluginContextData, __toESM, bindingifyPlugin, require_binding } from "../shared/src-
|
|
1
|
+
import { PluginContextData, __toESM, bindingifyPlugin, require_binding } from "../shared/src-DF6eJFya.mjs";
|
|
2
2
|
import { parentPort, workerData } from "node:worker_threads";
|
|
3
3
|
|
|
4
4
|
//#region src/parallel-plugin-worker.ts
|
|
@@ -606,9 +606,7 @@ function unreachable(info) {
|
|
|
606
606
|
throw new Error("unreachable");
|
|
607
607
|
}
|
|
608
608
|
function unsupported(info) {
|
|
609
|
-
|
|
610
|
-
throw new Error(`UNSUPPORTED: ${info}`);
|
|
611
|
-
};
|
|
609
|
+
throw new Error(`UNSUPPORTED: ${info}`);
|
|
612
610
|
}
|
|
613
611
|
function noop(..._args) {}
|
|
614
612
|
|
|
@@ -851,7 +849,8 @@ function getLogger(plugins, onLog, logLevel) {
|
|
|
851
849
|
rolldownVersion: VERSION,
|
|
852
850
|
watchMode: false
|
|
853
851
|
},
|
|
854
|
-
warn: getLogHandler$1(LOG_LEVEL_WARN)
|
|
852
|
+
warn: getLogHandler$1(LOG_LEVEL_WARN),
|
|
853
|
+
pluginName: plugin.name || "unknown"
|
|
855
854
|
}, level, log) === false) return;
|
|
856
855
|
}
|
|
857
856
|
}
|
|
@@ -1074,7 +1073,8 @@ var PluginDriver = class {
|
|
|
1074
1073
|
rolldownVersion: VERSION,
|
|
1075
1074
|
watchMode: false
|
|
1076
1075
|
},
|
|
1077
|
-
warn: getLogHandler(LOG_LEVEL_WARN, "PLUGIN_WARNING", logger, name, logLevel)
|
|
1076
|
+
warn: getLogHandler(LOG_LEVEL_WARN, "PLUGIN_WARNING", logger, name, logLevel),
|
|
1077
|
+
pluginName: name
|
|
1078
1078
|
}, inputOptions);
|
|
1079
1079
|
if (result) inputOptions = result;
|
|
1080
1080
|
}
|
|
@@ -1174,6 +1174,7 @@ function transformModuleInfo(info, option) {
|
|
|
1174
1174
|
dynamicImporters: info.dynamicImporters,
|
|
1175
1175
|
importedIds: info.importedIds,
|
|
1176
1176
|
dynamicallyImportedIds: info.dynamicallyImportedIds,
|
|
1177
|
+
exports: info.exports,
|
|
1177
1178
|
isEntry: info.isEntry,
|
|
1178
1179
|
...option
|
|
1179
1180
|
};
|
|
@@ -1186,21 +1187,20 @@ var MinimalPluginContext = class {
|
|
|
1186
1187
|
warn;
|
|
1187
1188
|
debug;
|
|
1188
1189
|
meta;
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
const pluginName = plugin.name || "unknown";
|
|
1190
|
+
constructor(onLog, logLevel, pluginName) {
|
|
1191
|
+
this.pluginName = pluginName;
|
|
1192
1192
|
this.debug = getLogHandler(LOG_LEVEL_DEBUG, "PLUGIN_LOG", onLog, pluginName, logLevel);
|
|
1193
1193
|
this.info = getLogHandler(LOG_LEVEL_INFO, "PLUGIN_LOG", onLog, pluginName, logLevel);
|
|
1194
1194
|
this.warn = getLogHandler(LOG_LEVEL_WARN, "PLUGIN_WARNING", onLog, pluginName, logLevel);
|
|
1195
|
-
this.error = (e) => {
|
|
1196
|
-
return error(logPluginError(normalizeLog(e), pluginName));
|
|
1197
|
-
};
|
|
1198
1195
|
this.meta = {
|
|
1199
1196
|
rollupVersion: "4.23.0",
|
|
1200
1197
|
rolldownVersion: VERSION,
|
|
1201
1198
|
watchMode: false
|
|
1202
1199
|
};
|
|
1203
1200
|
}
|
|
1201
|
+
error(e) {
|
|
1202
|
+
return error(logPluginError(normalizeLog(e), this.pluginName));
|
|
1203
|
+
}
|
|
1204
1204
|
};
|
|
1205
1205
|
|
|
1206
1206
|
//#endregion
|
|
@@ -1220,84 +1220,92 @@ function bindingifySideEffects(sideEffects) {
|
|
|
1220
1220
|
//#endregion
|
|
1221
1221
|
//#region src/plugin/plugin-context.ts
|
|
1222
1222
|
var PluginContext = class extends MinimalPluginContext {
|
|
1223
|
-
load;
|
|
1224
|
-
resolve;
|
|
1225
|
-
emitFile;
|
|
1226
|
-
getFileName;
|
|
1227
|
-
getModuleInfo;
|
|
1228
|
-
getModuleIds;
|
|
1229
|
-
addWatchFile;
|
|
1230
|
-
/**
|
|
1231
|
-
* @deprecated This rollup API won't be supported by rolldown. Using this API will cause runtime error.
|
|
1232
|
-
*/
|
|
1233
|
-
parse;
|
|
1234
1223
|
constructor(context, plugin, data, onLog, logLevel, currentLoadingModule) {
|
|
1235
|
-
super(onLog, logLevel, plugin);
|
|
1236
|
-
this.
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
const promise = new Promise((resolve, _) => {
|
|
1250
|
-
resolveFn = resolve;
|
|
1251
|
-
});
|
|
1252
|
-
data.loadModulePromiseMap.set(id, promise);
|
|
1253
|
-
try {
|
|
1254
|
-
await context.load(id, bindingifySideEffects(options.moduleSideEffects), resolveFn);
|
|
1255
|
-
} finally {
|
|
1256
|
-
data.loadModulePromiseMap.delete(id);
|
|
1257
|
-
}
|
|
1258
|
-
return promise;
|
|
1259
|
-
}
|
|
1260
|
-
await createLoadModulePromise();
|
|
1261
|
-
return data.getModuleInfo(id, context);
|
|
1262
|
-
};
|
|
1263
|
-
this.resolve = async (source, importer, options) => {
|
|
1264
|
-
let receipt = undefined;
|
|
1265
|
-
if (options != null) receipt = data.saveResolveOptions(options);
|
|
1266
|
-
const res = await context.resolve(source, importer, {
|
|
1267
|
-
custom: receipt,
|
|
1268
|
-
skipSelf: options?.skipSelf
|
|
1269
|
-
});
|
|
1270
|
-
if (receipt != null) data.removeSavedResolveOptions(receipt);
|
|
1271
|
-
if (res == null) return null;
|
|
1272
|
-
const info = data.getModuleOption(res.id) || {};
|
|
1273
|
-
return {
|
|
1274
|
-
...res,
|
|
1275
|
-
...info
|
|
1276
|
-
};
|
|
1224
|
+
super(onLog, logLevel, plugin.name);
|
|
1225
|
+
this.context = context;
|
|
1226
|
+
this.data = data;
|
|
1227
|
+
this.onLog = onLog;
|
|
1228
|
+
this.currentLoadingModule = currentLoadingModule;
|
|
1229
|
+
}
|
|
1230
|
+
async load(options) {
|
|
1231
|
+
const id = options.id;
|
|
1232
|
+
if (id === this.currentLoadingModule) this.onLog(LOG_LEVEL_WARN, logCycleLoading(super.pluginName, this.currentLoadingModule));
|
|
1233
|
+
const moduleInfo = this.data.getModuleInfo(id, this.context);
|
|
1234
|
+
if (moduleInfo && moduleInfo.code !== null) return moduleInfo;
|
|
1235
|
+
const rawOptions = {
|
|
1236
|
+
meta: options.meta || {},
|
|
1237
|
+
moduleSideEffects: options.moduleSideEffects || null
|
|
1277
1238
|
};
|
|
1278
|
-
this.
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1239
|
+
this.data.updateModuleOption(id, rawOptions);
|
|
1240
|
+
async function createLoadModulePromise(context, data) {
|
|
1241
|
+
const loadPromise = data.loadModulePromiseMap.get(id);
|
|
1242
|
+
if (loadPromise) return loadPromise;
|
|
1243
|
+
let resolveFn;
|
|
1244
|
+
const promise = new Promise((resolve, _) => {
|
|
1245
|
+
resolveFn = resolve;
|
|
1284
1246
|
});
|
|
1247
|
+
data.loadModulePromiseMap.set(id, promise);
|
|
1248
|
+
try {
|
|
1249
|
+
await context.load(id, bindingifySideEffects(options.moduleSideEffects), resolveFn);
|
|
1250
|
+
} finally {
|
|
1251
|
+
data.loadModulePromiseMap.delete(id);
|
|
1252
|
+
}
|
|
1253
|
+
return promise;
|
|
1254
|
+
}
|
|
1255
|
+
await createLoadModulePromise(this.context, this.data);
|
|
1256
|
+
return this.data.getModuleInfo(id, this.context);
|
|
1257
|
+
}
|
|
1258
|
+
async resolve(source, importer, options) {
|
|
1259
|
+
let receipt = undefined;
|
|
1260
|
+
if (options != null) receipt = this.data.saveResolveOptions(options);
|
|
1261
|
+
const res = await this.context.resolve(source, importer, {
|
|
1262
|
+
custom: receipt,
|
|
1263
|
+
skipSelf: options?.skipSelf
|
|
1264
|
+
});
|
|
1265
|
+
if (receipt != null) this.data.removeSavedResolveOptions(receipt);
|
|
1266
|
+
if (res == null) return null;
|
|
1267
|
+
const info = this.data.getModuleOption(res.id) || {};
|
|
1268
|
+
return {
|
|
1269
|
+
...res,
|
|
1270
|
+
...info
|
|
1285
1271
|
};
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
this.
|
|
1290
|
-
|
|
1272
|
+
}
|
|
1273
|
+
emitFile(file) {
|
|
1274
|
+
if (file.type !== "asset") return unimplemented("PluginContext.emitFile: only asset type is supported");
|
|
1275
|
+
return this.context.emitFile({
|
|
1276
|
+
...file,
|
|
1277
|
+
originalFileName: file.originalFileName || undefined,
|
|
1278
|
+
source: bindingAssetSource(file.source)
|
|
1279
|
+
});
|
|
1280
|
+
}
|
|
1281
|
+
getFileName(referenceId) {
|
|
1282
|
+
return this.context.getFileName(referenceId);
|
|
1283
|
+
}
|
|
1284
|
+
getModuleInfo(id) {
|
|
1285
|
+
return this.data.getModuleInfo(id, this.context);
|
|
1286
|
+
}
|
|
1287
|
+
getModuleIds() {
|
|
1288
|
+
return this.data.getModuleIds(this.context);
|
|
1289
|
+
}
|
|
1290
|
+
addWatchFile(id) {
|
|
1291
|
+
this.context.addWatchFile(id);
|
|
1292
|
+
}
|
|
1293
|
+
/**
|
|
1294
|
+
* @deprecated This rollup API won't be supported by rolldown. Using this API will cause runtime error.
|
|
1295
|
+
*/
|
|
1296
|
+
parse(_input, _options) {
|
|
1297
|
+
unsupported("`PluginContext#parse` is not supported by rolldown.");
|
|
1291
1298
|
}
|
|
1292
1299
|
};
|
|
1293
1300
|
|
|
1294
1301
|
//#endregion
|
|
1295
1302
|
//#region src/plugin/transform-plugin-context.ts
|
|
1296
1303
|
var TransformPluginContext = class extends PluginContext {
|
|
1297
|
-
error;
|
|
1298
|
-
getCombinedSourcemap;
|
|
1299
1304
|
constructor(context, plugin, data, inner, moduleId, moduleSource, onLog, LogLevelOption) {
|
|
1300
1305
|
super(context, plugin, data, onLog, LogLevelOption, moduleId);
|
|
1306
|
+
this.inner = inner;
|
|
1307
|
+
this.moduleId = moduleId;
|
|
1308
|
+
this.moduleSource = moduleSource;
|
|
1301
1309
|
const getLogHandler$1 = (handler) => (log, pos) => {
|
|
1302
1310
|
log = normalizeLog(log);
|
|
1303
1311
|
if (pos) augmentCodeLocation(log, pos, moduleSource, moduleId);
|
|
@@ -1308,14 +1316,16 @@ var TransformPluginContext = class extends PluginContext {
|
|
|
1308
1316
|
this.debug = getLogHandler$1(this.debug);
|
|
1309
1317
|
this.warn = getLogHandler$1(this.warn);
|
|
1310
1318
|
this.info = getLogHandler$1(this.info);
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
+
}
|
|
1320
|
+
error(e, pos) {
|
|
1321
|
+
if (typeof e === "string") e = { message: e };
|
|
1322
|
+
if (pos) augmentCodeLocation(e, pos, this.moduleSource, this.moduleId);
|
|
1323
|
+
e.id = this.moduleId;
|
|
1324
|
+
e.hook = "transform";
|
|
1325
|
+
return error(logPluginError(normalizeLog(e), super.pluginName));
|
|
1326
|
+
}
|
|
1327
|
+
getCombinedSourcemap() {
|
|
1328
|
+
return JSON.parse(this.inner.getCombinedSourcemap());
|
|
1319
1329
|
}
|
|
1320
1330
|
};
|
|
1321
1331
|
|
|
@@ -1548,7 +1558,9 @@ function bindingifyModuleParsed(args) {
|
|
|
1548
1558
|
//#endregion
|
|
1549
1559
|
//#region src/options/normalized-output-options.ts
|
|
1550
1560
|
function mapFunctionOption(option, name) {
|
|
1551
|
-
return typeof option === "undefined" ?
|
|
1561
|
+
return typeof option === "undefined" ? () => {
|
|
1562
|
+
unsupported(`You should not take \`NormalizedOutputOptions#${name}\` and call it directly`);
|
|
1563
|
+
} : option;
|
|
1552
1564
|
}
|
|
1553
1565
|
var NormalizedOutputOptionsImpl = class {
|
|
1554
1566
|
inner;
|
|
@@ -2343,10 +2355,7 @@ function createComposedPlugin(plugins) {
|
|
|
2343
2355
|
const createFixedPluginResolveFnMap = new Map();
|
|
2344
2356
|
function applyFixedPluginResolveFn(ctx, plugin) {
|
|
2345
2357
|
const createFixedPluginResolveFn = createFixedPluginResolveFnMap.get(plugin);
|
|
2346
|
-
if (createFixedPluginResolveFn)
|
|
2347
|
-
...ctx,
|
|
2348
|
-
resolve: createFixedPluginResolveFn(ctx)
|
|
2349
|
-
};
|
|
2358
|
+
if (createFixedPluginResolveFn) ctx.resolve = createFixedPluginResolveFn(ctx, ctx.resolve.bind(ctx));
|
|
2350
2359
|
return ctx;
|
|
2351
2360
|
}
|
|
2352
2361
|
if (batchedHooks.resolveId) {
|
|
@@ -2355,14 +2364,14 @@ function createComposedPlugin(plugins) {
|
|
|
2355
2364
|
for (let handlerIdx = 0; handlerIdx < batchedHandlers.length; handlerIdx++) {
|
|
2356
2365
|
const [_handler, plugin] = batchedHandlers[handlerIdx];
|
|
2357
2366
|
const handlerSymbol = handlerSymbols[handlerIdx];
|
|
2358
|
-
const createFixedPluginResolveFn = (ctx) => {
|
|
2367
|
+
const createFixedPluginResolveFn = (ctx, resolve) => {
|
|
2359
2368
|
return (source, importer, rawContextResolveOptions) => {
|
|
2360
2369
|
const contextResolveOptions = rawContextResolveOptions ?? {};
|
|
2361
2370
|
if (contextResolveOptions.skipSelf) {
|
|
2362
2371
|
contextResolveOptions[SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF] = handlerSymbol;
|
|
2363
2372
|
contextResolveOptions.skipSelf = false;
|
|
2364
2373
|
}
|
|
2365
|
-
return
|
|
2374
|
+
return resolve(source, importer, contextResolveOptions);
|
|
2366
2375
|
};
|
|
2367
2376
|
};
|
|
2368
2377
|
createFixedPluginResolveFnMap.set(plugin, createFixedPluginResolveFn);
|
|
@@ -2420,12 +2429,10 @@ function createComposedPlugin(plugins) {
|
|
|
2420
2429
|
}
|
|
2421
2430
|
for (const [handler, plugin] of batchedHandlers) {
|
|
2422
2431
|
const { handler: handlerFn } = normalizeHook(handler);
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
}
|
|
2428
|
-
}, code, id, moduleType);
|
|
2432
|
+
this.getCombinedSourcemap = () => {
|
|
2433
|
+
throw new Error(`The getCombinedSourcemap is not implement in transform hook at composedJsPlugins`);
|
|
2434
|
+
};
|
|
2435
|
+
const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), code, id, moduleType);
|
|
2429
2436
|
if (!isNullish(result)) {
|
|
2430
2437
|
if (typeof result === "string") updateOutput(result);
|
|
2431
2438
|
else if (result.code) updateOutput(result.code, result.moduleSideEffects);
|
|
@@ -2824,7 +2831,7 @@ const watch = (input) => {
|
|
|
2824
2831
|
|
|
2825
2832
|
//#endregion
|
|
2826
2833
|
//#region package.json
|
|
2827
|
-
var version = "0.15.0-commit.
|
|
2834
|
+
var version = "0.15.0-commit.f0c42f8";
|
|
2828
2835
|
var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
|
|
2829
2836
|
|
|
2830
2837
|
//#endregion
|