rolldown 1.0.0-beta.3-commit.306867e → 1.0.0-beta.3-commit.558ea78
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-BGJCTYiA.mjs → src-Cis0qYEg.mjs} +33 -13
- package/dist/shared/{src-BL6ftzBh.cjs → src-Z84gVvFu.cjs} +33 -13
- package/dist/types/index.d.ts +3 -3
- package/dist/types/log/logging.d.ts +1 -0
- package/dist/types/options/input-options.d.ts +2 -2
- package/dist/types/plugin/plugin-context-data.d.ts +2 -1
- package/package.json +14 -14
- package/dist/types/api/build.js +0 -22
- package/dist/types/api/experimental.js +0 -13
- package/dist/types/api/rolldown/index.js +0 -7
- package/dist/types/api/rolldown/rolldown-build.js +0 -43
- package/dist/types/api/watch/index.js +0 -8
- package/dist/types/api/watch/watch-emitter.js +0 -69
- package/dist/types/api/watch/watcher.js +0 -66
- package/dist/types/builtin-plugin/alias-plugin.js +0 -4
- package/dist/types/builtin-plugin/constructors.js +0 -68
- package/dist/types/builtin-plugin/replace-plugin.js +0 -29
- package/dist/types/builtin-plugin/transform-plugin.js +0 -16
- package/dist/types/builtin-plugin/utils.js +0 -19
- package/dist/types/cli/arguments/alias.js +0 -63
- package/dist/types/cli/arguments/index.js +0 -127
- package/dist/types/cli/arguments/normalize.js +0 -48
- package/dist/types/cli/arguments/utils.js +0 -67
- package/dist/types/cli/colors.js +0 -17
- package/dist/types/cli/commands/bundle.js +0 -203
- package/dist/types/cli/commands/help.js +0 -88
- package/dist/types/cli/index.js +0 -27
- package/dist/types/cli/load-config.js +0 -95
- package/dist/types/cli/logger.js +0 -35
- package/dist/types/constants/plugin-context.js +0 -7
- package/dist/types/constants/plugin.js +0 -69
- package/dist/types/experimental-index.js +0 -9
- package/dist/types/index.js +0 -7
- package/dist/types/log/logHandler.js +0 -25
- package/dist/types/log/logger.js +0 -107
- package/dist/types/log/logging.js +0 -11
- package/dist/types/log/logs.js +0 -86
- package/dist/types/options/input-options.js +0 -1
- package/dist/types/options/normalized-input-options.js +0 -21
- package/dist/types/options/normalized-output-options.js +0 -99
- package/dist/types/options/output-options.js +0 -1
- package/dist/types/options/watch-options.js +0 -1
- package/dist/types/parallel-plugin-worker.js +0 -31
- package/dist/types/parallel-plugin.js +0 -1
- package/dist/types/parse-ast-index.js +0 -73
- package/dist/types/plugin/bindingify-build-hooks.js +0 -213
- package/dist/types/plugin/bindingify-hook-filter.js +0 -39
- package/dist/types/plugin/bindingify-output-hooks.js +0 -189
- package/dist/types/plugin/bindingify-plugin-hook-meta.js +0 -19
- package/dist/types/plugin/bindingify-plugin.js +0 -124
- package/dist/types/plugin/bindingify-watch-hooks.js +0 -29
- package/dist/types/plugin/hook-filter.js +0 -1
- package/dist/types/plugin/index.js +0 -1
- package/dist/types/plugin/minimal-plugin-context.js +0 -25
- package/dist/types/plugin/parallel-plugin-implementation.js +0 -3
- package/dist/types/plugin/parallel-plugin.js +0 -6
- package/dist/types/plugin/plugin-context-data.js +0 -55
- package/dist/types/plugin/plugin-context.js +0 -124
- package/dist/types/plugin/plugin-driver.js +0 -88
- package/dist/types/plugin/transform-plugin-context.js +0 -37
- package/dist/types/types/assert.js +0 -1
- package/dist/types/types/config-export.js +0 -1
- package/dist/types/types/misc.js +0 -1
- package/dist/types/types/module-info.js +0 -1
- package/dist/types/types/module-side-effects.js +0 -1
- package/dist/types/types/output-bundle.js +0 -1
- package/dist/types/types/rolldown-options.js +0 -1
- package/dist/types/types/rolldown-output.js +0 -1
- package/dist/types/types/schema.js +0 -1
- package/dist/types/types/sourcemap.js +0 -16
- package/dist/types/types/utils.js +0 -1
- package/dist/types/utils/asset-source.js +0 -8
- package/dist/types/utils/async-flatten.js +0 -7
- package/dist/types/utils/bindingify-input-options.js +0 -226
- package/dist/types/utils/bindingify-output-options.js +0 -107
- package/dist/types/utils/code-frame.js +0 -46
- package/dist/types/utils/compose-js-plugins.js +0 -400
- package/dist/types/utils/create-bundler-option.js +0 -53
- package/dist/types/utils/create-bundler.js +0 -15
- package/dist/types/utils/define-config.js +0 -3
- package/dist/types/utils/error.js +0 -65
- package/dist/types/utils/initialize-parallel-plugins.js +0 -54
- package/dist/types/utils/misc.js +0 -22
- package/dist/types/utils/normalize-hook.js +0 -21
- package/dist/types/utils/normalize-plugin-option.js +0 -35
- package/dist/types/utils/normalize-string-or-regex.js +0 -14
- package/dist/types/utils/plugin/index.js +0 -7
- package/dist/types/utils/transform-module-info.js +0 -19
- package/dist/types/utils/transform-rendered-chunk.js +0 -43
- package/dist/types/utils/transform-rendered-module.js +0 -10
- package/dist/types/utils/transform-side-effects.js +0 -16
- package/dist/types/utils/transform-sourcemap.js +0 -29
- package/dist/types/utils/transform-to-rollup-output.js +0 -165
- package/dist/types/utils/validator.js +0 -276
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-Z84gVvFu.cjs');
|
|
4
4
|
const require_binding = require('../shared/binding-B9_Bsc0_.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-Z84gVvFu.cjs');
|
|
4
4
|
const require_binding = require('../shared/binding-B9_Bsc0_.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-Z84gVvFu.cjs');
|
|
4
4
|
const require_binding = require('../shared/binding-B9_Bsc0_.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-_xN4hdfO.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-Cis0qYEg.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-_xN4hdfO.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-Cis0qYEg.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-_xN4hdfO.mjs";
|
|
2
|
-
import { VERSION, build, defineConfig, rolldown, watch } from "../shared/src-
|
|
2
|
+
import { VERSION, build, defineConfig, rolldown, watch } from "../shared/src-Cis0qYEg.mjs";
|
|
3
3
|
|
|
4
4
|
export { VERSION, build, defineConfig, rolldown, watch };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { import_binding } from "../shared/binding-_xN4hdfO.mjs";
|
|
2
|
-
import { PluginContextData, bindingifyPlugin } from "../shared/src-
|
|
2
|
+
import { PluginContextData, bindingifyPlugin } from "../shared/src-Cis0qYEg.mjs";
|
|
3
3
|
import { parentPort, workerData } from "node:worker_threads";
|
|
4
4
|
|
|
5
5
|
//#region src/parallel-plugin-worker.ts
|
|
@@ -976,14 +976,14 @@ function bindingifyResolveId(args) {
|
|
|
976
976
|
external: true
|
|
977
977
|
};
|
|
978
978
|
if (typeof ret === "string") return { id: ret };
|
|
979
|
-
args.pluginContextData.updateModuleOption(ret.id, {
|
|
979
|
+
let exist = args.pluginContextData.updateModuleOption(ret.id, {
|
|
980
980
|
meta: ret.meta || {},
|
|
981
|
-
moduleSideEffects: ret.moduleSideEffects
|
|
981
|
+
moduleSideEffects: ret.moduleSideEffects ?? null
|
|
982
982
|
});
|
|
983
983
|
return {
|
|
984
984
|
id: ret.id,
|
|
985
985
|
external: ret.external,
|
|
986
|
-
sideEffects: bindingifySideEffects(
|
|
986
|
+
sideEffects: bindingifySideEffects(exist.moduleSideEffects)
|
|
987
987
|
};
|
|
988
988
|
},
|
|
989
989
|
meta: bindingifyPluginHookMeta(meta),
|
|
@@ -1026,14 +1026,14 @@ function bindingifyTransform(args) {
|
|
|
1026
1026
|
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);
|
|
1027
1027
|
if (ret == null) return void 0;
|
|
1028
1028
|
if (typeof ret === "string") return { code: ret };
|
|
1029
|
-
args.pluginContextData.updateModuleOption(id, {
|
|
1030
|
-
meta: ret.meta
|
|
1031
|
-
moduleSideEffects: ret.moduleSideEffects
|
|
1029
|
+
let moduleOption = args.pluginContextData.updateModuleOption(id, {
|
|
1030
|
+
meta: ret.meta ?? {},
|
|
1031
|
+
moduleSideEffects: ret.moduleSideEffects ?? null
|
|
1032
1032
|
});
|
|
1033
1033
|
return {
|
|
1034
1034
|
code: ret.code,
|
|
1035
1035
|
map: bindingifySourcemap$1(normalizeTransformHookSourcemap(id, code, ret.map)),
|
|
1036
|
-
sideEffects: bindingifySideEffects(
|
|
1036
|
+
sideEffects: bindingifySideEffects(moduleOption.moduleSideEffects),
|
|
1037
1037
|
moduleType: ret.moduleType
|
|
1038
1038
|
};
|
|
1039
1039
|
},
|
|
@@ -1050,16 +1050,16 @@ function bindingifyLoad(args) {
|
|
|
1050
1050
|
const ret = await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, id), id);
|
|
1051
1051
|
if (ret == null) return;
|
|
1052
1052
|
if (typeof ret === "string") return { code: ret };
|
|
1053
|
-
args.pluginContextData.updateModuleOption(id, {
|
|
1053
|
+
let moduleOption = args.pluginContextData.updateModuleOption(id, {
|
|
1054
1054
|
meta: ret.meta || {},
|
|
1055
|
-
moduleSideEffects: ret.moduleSideEffects
|
|
1055
|
+
moduleSideEffects: ret.moduleSideEffects ?? null
|
|
1056
1056
|
});
|
|
1057
1057
|
let map = preProcessSourceMap(ret, id);
|
|
1058
1058
|
return {
|
|
1059
1059
|
code: ret.code,
|
|
1060
1060
|
map: bindingifySourcemap$1(map),
|
|
1061
1061
|
moduleType: ret.moduleType,
|
|
1062
|
-
sideEffects: bindingifySideEffects(
|
|
1062
|
+
sideEffects: bindingifySideEffects(moduleOption.moduleSideEffects)
|
|
1063
1063
|
};
|
|
1064
1064
|
},
|
|
1065
1065
|
meta: bindingifyPluginHookMeta(meta),
|
|
@@ -1486,7 +1486,11 @@ var PluginContextData = class {
|
|
|
1486
1486
|
if (existing) {
|
|
1487
1487
|
if (option.moduleSideEffects != null) existing.moduleSideEffects = option.moduleSideEffects;
|
|
1488
1488
|
if (option.meta != null) Object.assign(existing.meta, option.meta);
|
|
1489
|
-
} else
|
|
1489
|
+
} else {
|
|
1490
|
+
this.moduleOptionMap.set(id, option);
|
|
1491
|
+
return option;
|
|
1492
|
+
}
|
|
1493
|
+
return existing;
|
|
1490
1494
|
}
|
|
1491
1495
|
getModuleOption(id) {
|
|
1492
1496
|
const option = this.moduleOptionMap.get(id);
|
|
@@ -1504,10 +1508,26 @@ var PluginContextData = class {
|
|
|
1504
1508
|
const bindingInfo = context.getModuleInfo(id);
|
|
1505
1509
|
if (bindingInfo) {
|
|
1506
1510
|
const info = transformModuleInfo(bindingInfo, this.getModuleOption(id));
|
|
1507
|
-
return info;
|
|
1511
|
+
return this.proxyModuleInfo(id, info);
|
|
1508
1512
|
}
|
|
1509
1513
|
return null;
|
|
1510
1514
|
}
|
|
1515
|
+
proxyModuleInfo(id, info) {
|
|
1516
|
+
let moduleSideEffects = info.moduleSideEffects;
|
|
1517
|
+
Object.defineProperty(info, "moduleSideEffects", {
|
|
1518
|
+
get() {
|
|
1519
|
+
return moduleSideEffects;
|
|
1520
|
+
},
|
|
1521
|
+
set: (v$1) => {
|
|
1522
|
+
this.updateModuleOption(id, {
|
|
1523
|
+
moduleSideEffects: v$1,
|
|
1524
|
+
meta: info.meta
|
|
1525
|
+
});
|
|
1526
|
+
moduleSideEffects = v$1;
|
|
1527
|
+
}
|
|
1528
|
+
});
|
|
1529
|
+
return info;
|
|
1530
|
+
}
|
|
1511
1531
|
getModuleIds(context) {
|
|
1512
1532
|
const moduleIds = context.getModuleIds();
|
|
1513
1533
|
return moduleIds.values();
|
|
@@ -2645,7 +2665,7 @@ const watch = (input) => {
|
|
|
2645
2665
|
|
|
2646
2666
|
//#endregion
|
|
2647
2667
|
//#region package.json
|
|
2648
|
-
var version = "1.0.0-beta.3-commit.
|
|
2668
|
+
var version = "1.0.0-beta.3-commit.558ea78";
|
|
2649
2669
|
var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
|
|
2650
2670
|
|
|
2651
2671
|
//#endregion
|
|
@@ -978,14 +978,14 @@ function bindingifyResolveId(args) {
|
|
|
978
978
|
external: true
|
|
979
979
|
};
|
|
980
980
|
if (typeof ret === "string") return { id: ret };
|
|
981
|
-
args.pluginContextData.updateModuleOption(ret.id, {
|
|
981
|
+
let exist = args.pluginContextData.updateModuleOption(ret.id, {
|
|
982
982
|
meta: ret.meta || {},
|
|
983
|
-
moduleSideEffects: ret.moduleSideEffects
|
|
983
|
+
moduleSideEffects: ret.moduleSideEffects ?? null
|
|
984
984
|
});
|
|
985
985
|
return {
|
|
986
986
|
id: ret.id,
|
|
987
987
|
external: ret.external,
|
|
988
|
-
sideEffects: bindingifySideEffects(
|
|
988
|
+
sideEffects: bindingifySideEffects(exist.moduleSideEffects)
|
|
989
989
|
};
|
|
990
990
|
},
|
|
991
991
|
meta: bindingifyPluginHookMeta(meta),
|
|
@@ -1028,14 +1028,14 @@ function bindingifyTransform(args) {
|
|
|
1028
1028
|
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);
|
|
1029
1029
|
if (ret == null) return void 0;
|
|
1030
1030
|
if (typeof ret === "string") return { code: ret };
|
|
1031
|
-
args.pluginContextData.updateModuleOption(id, {
|
|
1032
|
-
meta: ret.meta
|
|
1033
|
-
moduleSideEffects: ret.moduleSideEffects
|
|
1031
|
+
let moduleOption = args.pluginContextData.updateModuleOption(id, {
|
|
1032
|
+
meta: ret.meta ?? {},
|
|
1033
|
+
moduleSideEffects: ret.moduleSideEffects ?? null
|
|
1034
1034
|
});
|
|
1035
1035
|
return {
|
|
1036
1036
|
code: ret.code,
|
|
1037
1037
|
map: bindingifySourcemap$1(normalizeTransformHookSourcemap(id, code, ret.map)),
|
|
1038
|
-
sideEffects: bindingifySideEffects(
|
|
1038
|
+
sideEffects: bindingifySideEffects(moduleOption.moduleSideEffects),
|
|
1039
1039
|
moduleType: ret.moduleType
|
|
1040
1040
|
};
|
|
1041
1041
|
},
|
|
@@ -1052,16 +1052,16 @@ function bindingifyLoad(args) {
|
|
|
1052
1052
|
const ret = await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, id), id);
|
|
1053
1053
|
if (ret == null) return;
|
|
1054
1054
|
if (typeof ret === "string") return { code: ret };
|
|
1055
|
-
args.pluginContextData.updateModuleOption(id, {
|
|
1055
|
+
let moduleOption = args.pluginContextData.updateModuleOption(id, {
|
|
1056
1056
|
meta: ret.meta || {},
|
|
1057
|
-
moduleSideEffects: ret.moduleSideEffects
|
|
1057
|
+
moduleSideEffects: ret.moduleSideEffects ?? null
|
|
1058
1058
|
});
|
|
1059
1059
|
let map = preProcessSourceMap(ret, id);
|
|
1060
1060
|
return {
|
|
1061
1061
|
code: ret.code,
|
|
1062
1062
|
map: bindingifySourcemap$1(map),
|
|
1063
1063
|
moduleType: ret.moduleType,
|
|
1064
|
-
sideEffects: bindingifySideEffects(
|
|
1064
|
+
sideEffects: bindingifySideEffects(moduleOption.moduleSideEffects)
|
|
1065
1065
|
};
|
|
1066
1066
|
},
|
|
1067
1067
|
meta: bindingifyPluginHookMeta(meta),
|
|
@@ -1488,7 +1488,11 @@ var PluginContextData = class {
|
|
|
1488
1488
|
if (existing) {
|
|
1489
1489
|
if (option.moduleSideEffects != null) existing.moduleSideEffects = option.moduleSideEffects;
|
|
1490
1490
|
if (option.meta != null) Object.assign(existing.meta, option.meta);
|
|
1491
|
-
} else
|
|
1491
|
+
} else {
|
|
1492
|
+
this.moduleOptionMap.set(id, option);
|
|
1493
|
+
return option;
|
|
1494
|
+
}
|
|
1495
|
+
return existing;
|
|
1492
1496
|
}
|
|
1493
1497
|
getModuleOption(id) {
|
|
1494
1498
|
const option = this.moduleOptionMap.get(id);
|
|
@@ -1506,10 +1510,26 @@ var PluginContextData = class {
|
|
|
1506
1510
|
const bindingInfo = context.getModuleInfo(id);
|
|
1507
1511
|
if (bindingInfo) {
|
|
1508
1512
|
const info = transformModuleInfo(bindingInfo, this.getModuleOption(id));
|
|
1509
|
-
return info;
|
|
1513
|
+
return this.proxyModuleInfo(id, info);
|
|
1510
1514
|
}
|
|
1511
1515
|
return null;
|
|
1512
1516
|
}
|
|
1517
|
+
proxyModuleInfo(id, info) {
|
|
1518
|
+
let moduleSideEffects = info.moduleSideEffects;
|
|
1519
|
+
Object.defineProperty(info, "moduleSideEffects", {
|
|
1520
|
+
get() {
|
|
1521
|
+
return moduleSideEffects;
|
|
1522
|
+
},
|
|
1523
|
+
set: (v) => {
|
|
1524
|
+
this.updateModuleOption(id, {
|
|
1525
|
+
moduleSideEffects: v,
|
|
1526
|
+
meta: info.meta
|
|
1527
|
+
});
|
|
1528
|
+
moduleSideEffects = v;
|
|
1529
|
+
}
|
|
1530
|
+
});
|
|
1531
|
+
return info;
|
|
1532
|
+
}
|
|
1513
1533
|
getModuleIds(context) {
|
|
1514
1534
|
const moduleIds = context.getModuleIds();
|
|
1515
1535
|
return moduleIds.values();
|
|
@@ -2647,7 +2667,7 @@ const watch = (input) => {
|
|
|
2647
2667
|
|
|
2648
2668
|
//#endregion
|
|
2649
2669
|
//#region package.json
|
|
2650
|
-
var version = "1.0.0-beta.3-commit.
|
|
2670
|
+
var version = "1.0.0-beta.3-commit.558ea78";
|
|
2651
2671
|
var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
|
|
2652
2672
|
|
|
2653
2673
|
//#endregion
|
package/dist/types/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ import { PreRenderedChunk } from './binding';
|
|
|
16
16
|
import { PartialNull } from './types/utils';
|
|
17
17
|
import { NormalizedInputOptions } from './options/normalized-input-options';
|
|
18
18
|
import { ModuleInfo } from './types/module-info';
|
|
19
|
-
import { MinimalPluginContext } from './plugin/minimal-plugin-context';
|
|
19
|
+
import { PluginContextMeta, MinimalPluginContext } from './plugin/minimal-plugin-context';
|
|
20
20
|
import { ExistingRawSourceMap, SourceMapInput } from './types/sourcemap';
|
|
21
21
|
import { OutputBundle } from './types/output-bundle';
|
|
22
22
|
import { WatchOptions } from './options/watch-options';
|
|
@@ -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, PreRenderedAsset, SourceMap, SourceDescription, PartialNull, PartialResolvedId, ResolvedId, ModuleOptions, ModuleInfo, MinimalPluginContext, EmittedFile, EmittedAsset, CustomPluginOptions, AsyncPluginHooks, ParallelPluginHooks, FunctionPluginHooks, ExistingRawSourceMap, SourceMapInput, OutputBundle, JsxOptions, WatchOptions, RolldownWatcher, BuildOptions, RenderedChunk, };
|
|
28
|
-
export type { RollupError, RollupLog, LoggingFunction } from './types/misc';
|
|
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, PluginContextMeta, MinimalPluginContext, EmittedFile, EmittedAsset, CustomPluginOptions, AsyncPluginHooks, ParallelPluginHooks, FunctionPluginHooks, ExistingRawSourceMap, SourceMapInput, OutputBundle, JsxOptions, WatchOptions, RolldownWatcher, BuildOptions, RenderedChunk, };
|
|
28
|
+
export type { RollupError, RollupLog, LoggingFunction, LogLevel, WarningHandlerWithDefault, } from './types/misc';
|
|
@@ -3,6 +3,7 @@ export type LogLevelOption = LogLevel | 'silent';
|
|
|
3
3
|
export type LogLevelWithError = LogLevel | 'error';
|
|
4
4
|
export type RollupLog = any;
|
|
5
5
|
export type RollupLogWithString = RollupLog | string;
|
|
6
|
+
export type LogOrStringHandler = (level: LogLevelWithError, log: RollupLogWithString) => void;
|
|
6
7
|
export declare const LOG_LEVEL_SILENT: LogLevelOption;
|
|
7
8
|
export declare const LOG_LEVEL_ERROR = "error";
|
|
8
9
|
export declare const LOG_LEVEL_WARN: LogLevel;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RolldownPluginOption } from '../plugin';
|
|
2
|
-
import type { LogLevel, LogLevelOption,
|
|
2
|
+
import type { LogLevel, LogLevelOption, LogOrStringHandler, RollupLog, RollupLogWithString } from '../log/logging';
|
|
3
3
|
import type { NullValue, StringOrRegExp } from '../types/utils';
|
|
4
4
|
import type { TreeshakingOptions } from '../types/module-side-effects';
|
|
5
5
|
export type InputOption = string | string[] | Record<string, string>;
|
|
@@ -66,7 +66,7 @@ export interface InputOptions {
|
|
|
66
66
|
shimMissingExports?: boolean;
|
|
67
67
|
treeshake?: boolean | TreeshakingOptions;
|
|
68
68
|
logLevel?: LogLevelOption;
|
|
69
|
-
onLog?: (level: LogLevel, log: RollupLog, defaultHandler:
|
|
69
|
+
onLog?: (level: LogLevel, log: RollupLog, defaultHandler: LogOrStringHandler) => void;
|
|
70
70
|
onwarn?: (warning: RollupLog, defaultHandler: (warning: RollupLogWithString | (() => RollupLogWithString)) => void) => void;
|
|
71
71
|
moduleTypes?: ModuleTypes;
|
|
72
72
|
experimental?: {
|
|
@@ -6,9 +6,10 @@ export declare class PluginContextData {
|
|
|
6
6
|
moduleOptionMap: Map<string, ModuleOptions>;
|
|
7
7
|
resolveOptionsMap: Map<number, PluginContextResolveOptions>;
|
|
8
8
|
loadModulePromiseMap: Map<string, Promise<void>>;
|
|
9
|
-
updateModuleOption(id: string, option: ModuleOptions):
|
|
9
|
+
updateModuleOption(id: string, option: ModuleOptions): ModuleOptions;
|
|
10
10
|
getModuleOption(id: string): ModuleOptions;
|
|
11
11
|
getModuleInfo(id: string, context: BindingPluginContext): ModuleInfo | null;
|
|
12
|
+
proxyModuleInfo(id: string, info: ModuleInfo): ModuleInfo;
|
|
12
13
|
getModuleIds(context: BindingPluginContext): ArrayIterator<string>;
|
|
13
14
|
saveResolveOptions(options: PluginContextResolveOptions): number;
|
|
14
15
|
getSavedResolveOptions(receipt: number): PluginContextResolveOptions | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rolldown",
|
|
3
|
-
"version": "1.0.0-beta.3-commit.
|
|
3
|
+
"version": "1.0.0-beta.3-commit.558ea78",
|
|
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.3-commit.
|
|
126
|
+
"rolldown": "1.0.0-beta.3-commit.558ea78"
|
|
127
127
|
},
|
|
128
128
|
"optionalDependencies": {
|
|
129
|
-
"@rolldown/binding-darwin-arm64": "1.0.0-beta.3-commit.
|
|
130
|
-
"@rolldown/binding-darwin-x64": "1.0.0-beta.3-commit.
|
|
131
|
-
"@rolldown/binding-freebsd-x64": "1.0.0-beta.3-commit.
|
|
132
|
-
"@rolldown/binding-linux-
|
|
133
|
-
"@rolldown/binding-linux-
|
|
134
|
-
"@rolldown/binding-linux-arm64-
|
|
135
|
-
"@rolldown/binding-linux-x64-
|
|
136
|
-
"@rolldown/binding-
|
|
137
|
-
"@rolldown/binding-
|
|
138
|
-
"@rolldown/binding-win32-arm64-msvc": "1.0.0-beta.3-commit.
|
|
139
|
-
"@rolldown/binding-win32-
|
|
140
|
-
"@rolldown/binding-win32-
|
|
129
|
+
"@rolldown/binding-darwin-arm64": "1.0.0-beta.3-commit.558ea78",
|
|
130
|
+
"@rolldown/binding-darwin-x64": "1.0.0-beta.3-commit.558ea78",
|
|
131
|
+
"@rolldown/binding-freebsd-x64": "1.0.0-beta.3-commit.558ea78",
|
|
132
|
+
"@rolldown/binding-linux-arm64-gnu": "1.0.0-beta.3-commit.558ea78",
|
|
133
|
+
"@rolldown/binding-linux-arm-gnueabihf": "1.0.0-beta.3-commit.558ea78",
|
|
134
|
+
"@rolldown/binding-linux-arm64-musl": "1.0.0-beta.3-commit.558ea78",
|
|
135
|
+
"@rolldown/binding-linux-x64-gnu": "1.0.0-beta.3-commit.558ea78",
|
|
136
|
+
"@rolldown/binding-linux-x64-musl": "1.0.0-beta.3-commit.558ea78",
|
|
137
|
+
"@rolldown/binding-wasm32-wasi": "1.0.0-beta.3-commit.558ea78",
|
|
138
|
+
"@rolldown/binding-win32-arm64-msvc": "1.0.0-beta.3-commit.558ea78",
|
|
139
|
+
"@rolldown/binding-win32-x64-msvc": "1.0.0-beta.3-commit.558ea78",
|
|
140
|
+
"@rolldown/binding-win32-ia32-msvc": "1.0.0-beta.3-commit.558ea78"
|
|
141
141
|
},
|
|
142
142
|
"scripts": {
|
|
143
143
|
"# Scrips for binding #": "_",
|
package/dist/types/api/build.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { rolldown } from './rolldown';
|
|
2
|
-
async function build(options) {
|
|
3
|
-
if (Array.isArray(options)) {
|
|
4
|
-
return Promise.all(options.map((opts) => build(opts)));
|
|
5
|
-
}
|
|
6
|
-
else {
|
|
7
|
-
const { output, write = true, ...inputOptions } = options;
|
|
8
|
-
const build = await rolldown(inputOptions);
|
|
9
|
-
try {
|
|
10
|
-
if (write) {
|
|
11
|
-
return await build.write(output);
|
|
12
|
-
}
|
|
13
|
-
else {
|
|
14
|
-
return await build.generate(output);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
finally {
|
|
18
|
-
await build.close();
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
export { build };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { createBundler } from '../utils/create-bundler';
|
|
2
|
-
import { handleOutputErrors } from '../utils/transform-to-rollup-output';
|
|
3
|
-
/**
|
|
4
|
-
* This is an experimental API. It's behavior may change in the future.
|
|
5
|
-
*
|
|
6
|
-
* Calling this API will only execute the scan stage of rolldown.
|
|
7
|
-
*/
|
|
8
|
-
export const experimental_scan = async (input) => {
|
|
9
|
-
const { bundler, stopWorkers } = await createBundler(input, {});
|
|
10
|
-
const output = await bundler.scan();
|
|
11
|
-
handleOutputErrors(output);
|
|
12
|
-
await stopWorkers?.();
|
|
13
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { PluginDriver } from '../../plugin/plugin-driver';
|
|
2
|
-
import { RolldownBuild } from './rolldown-build';
|
|
3
|
-
// `async` here is intentional to be compatible with `rollup.rollup`.
|
|
4
|
-
export const rolldown = async (input) => {
|
|
5
|
-
const inputOptions = await PluginDriver.callOptionsHook(input);
|
|
6
|
-
return new RolldownBuild(inputOptions);
|
|
7
|
-
};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { transformToRollupOutput } from '../../utils/transform-to-rollup-output';
|
|
2
|
-
import { createBundler, } from '../../utils/create-bundler';
|
|
3
|
-
// @ts-expect-error TS2540: the polyfill of `asyncDispose`.
|
|
4
|
-
Symbol.asyncDispose ??= Symbol('Symbol.asyncDispose');
|
|
5
|
-
export class RolldownBuild {
|
|
6
|
-
#inputOptions;
|
|
7
|
-
#bundler;
|
|
8
|
-
constructor(inputOptions) {
|
|
9
|
-
// TODO: Check if `inputOptions.output` is set. If so, throw an warning that it is ignored.
|
|
10
|
-
this.#inputOptions = inputOptions;
|
|
11
|
-
}
|
|
12
|
-
get closed() {
|
|
13
|
-
// If the bundler has not yet been created, it is not closed.
|
|
14
|
-
return this.#bundler ? this.#bundler.bundler.closed : false;
|
|
15
|
-
}
|
|
16
|
-
// Create bundler for each `bundle.write/generate`
|
|
17
|
-
async #getBundlerWithStopWorker(outputOptions) {
|
|
18
|
-
if (this.#bundler) {
|
|
19
|
-
this.#bundler.stopWorkers?.();
|
|
20
|
-
}
|
|
21
|
-
return (this.#bundler = await createBundler(this.#inputOptions, outputOptions));
|
|
22
|
-
}
|
|
23
|
-
async generate(outputOptions = {}) {
|
|
24
|
-
const { bundler } = await this.#getBundlerWithStopWorker(outputOptions);
|
|
25
|
-
const output = await bundler.generate();
|
|
26
|
-
return transformToRollupOutput(output);
|
|
27
|
-
}
|
|
28
|
-
async write(outputOptions = {}) {
|
|
29
|
-
const { bundler } = await this.#getBundlerWithStopWorker(outputOptions);
|
|
30
|
-
const output = await bundler.write();
|
|
31
|
-
return transformToRollupOutput(output);
|
|
32
|
-
}
|
|
33
|
-
async close() {
|
|
34
|
-
const { bundler, stopWorkers } = await this.#getBundlerWithStopWorker({});
|
|
35
|
-
await stopWorkers?.();
|
|
36
|
-
await bundler.close();
|
|
37
|
-
}
|
|
38
|
-
async [Symbol.asyncDispose]() {
|
|
39
|
-
await this.close();
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
function _assert() {
|
|
43
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { normalizeErrors } from '../../utils/error';
|
|
2
|
-
export class WatcherEmitter {
|
|
3
|
-
listeners = new Map();
|
|
4
|
-
timer;
|
|
5
|
-
constructor() {
|
|
6
|
-
// The rust side already create a thread for watcher, but it isn't at main thread.
|
|
7
|
-
// So here we need to avoid main process exit util the user call `watcher.close()`.
|
|
8
|
-
this.timer = setInterval(() => { }, 1e9 /* Low power usage */);
|
|
9
|
-
}
|
|
10
|
-
on(event, listener) {
|
|
11
|
-
const listeners = this.listeners.get(event);
|
|
12
|
-
if (listeners) {
|
|
13
|
-
listeners.push(listener);
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
this.listeners.set(event, [listener]);
|
|
17
|
-
}
|
|
18
|
-
return this;
|
|
19
|
-
}
|
|
20
|
-
async onEvent(event) {
|
|
21
|
-
const listeners = this.listeners.get(event.eventKind());
|
|
22
|
-
if (listeners) {
|
|
23
|
-
switch (event.eventKind()) {
|
|
24
|
-
case 'close':
|
|
25
|
-
case 'restart':
|
|
26
|
-
for (const listener of listeners) {
|
|
27
|
-
await listener();
|
|
28
|
-
}
|
|
29
|
-
break;
|
|
30
|
-
case 'event':
|
|
31
|
-
for (const listener of listeners) {
|
|
32
|
-
const code = event.bundleEventKind();
|
|
33
|
-
switch (code) {
|
|
34
|
-
case 'BUNDLE_END':
|
|
35
|
-
const { duration, output } = event.bundleEndData();
|
|
36
|
-
await listener({
|
|
37
|
-
code: 'BUNDLE_END',
|
|
38
|
-
duration,
|
|
39
|
-
output: [output], // rolldown doesn't support arraying configure output
|
|
40
|
-
});
|
|
41
|
-
break;
|
|
42
|
-
case 'ERROR':
|
|
43
|
-
const errors = event.errors();
|
|
44
|
-
await listener({
|
|
45
|
-
code: 'ERROR',
|
|
46
|
-
error: normalizeErrors(errors),
|
|
47
|
-
});
|
|
48
|
-
break;
|
|
49
|
-
default:
|
|
50
|
-
await listener({ code });
|
|
51
|
-
break;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
break;
|
|
55
|
-
case 'change':
|
|
56
|
-
for (const listener of listeners) {
|
|
57
|
-
const { path, kind } = event.watchChangeData();
|
|
58
|
-
await listener(path, { event: kind });
|
|
59
|
-
}
|
|
60
|
-
break;
|
|
61
|
-
default:
|
|
62
|
-
throw new Error(`Unknown event: ${event}`);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
async close() {
|
|
67
|
-
clearInterval(this.timer);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { BindingWatcher } from '../../binding';
|
|
2
|
-
import { LOG_LEVEL_WARN } from '../../log/logging';
|
|
3
|
-
import { logMultiplyNotifyOption } from '../../log/logs';
|
|
4
|
-
import { PluginDriver } from '../../plugin/plugin-driver';
|
|
5
|
-
import { createBundlerOptions, } from '../../utils/create-bundler-option';
|
|
6
|
-
import { arraify } from '../../utils/misc';
|
|
7
|
-
export class Watcher {
|
|
8
|
-
closed;
|
|
9
|
-
inner;
|
|
10
|
-
emitter;
|
|
11
|
-
stopWorkers;
|
|
12
|
-
constructor(emitter, inner, stopWorkers) {
|
|
13
|
-
this.closed = false;
|
|
14
|
-
this.inner = inner;
|
|
15
|
-
this.emitter = emitter;
|
|
16
|
-
const originClose = emitter.close.bind(emitter);
|
|
17
|
-
emitter.close = async () => {
|
|
18
|
-
await this.close();
|
|
19
|
-
originClose();
|
|
20
|
-
};
|
|
21
|
-
this.stopWorkers = stopWorkers;
|
|
22
|
-
}
|
|
23
|
-
async close() {
|
|
24
|
-
if (this.closed)
|
|
25
|
-
return;
|
|
26
|
-
this.closed = true;
|
|
27
|
-
for (const stop of this.stopWorkers) {
|
|
28
|
-
await stop?.();
|
|
29
|
-
}
|
|
30
|
-
await this.inner.close();
|
|
31
|
-
}
|
|
32
|
-
start() {
|
|
33
|
-
// run first build after listener is attached
|
|
34
|
-
process.nextTick(() => this.inner.start(this.emitter.onEvent.bind(this.emitter)));
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
export async function createWatcher(emitter, input) {
|
|
38
|
-
const options = arraify(input);
|
|
39
|
-
const bundlerOptions = await Promise.all(options
|
|
40
|
-
.map((option) => arraify(option.output || {}).map(async (output) => {
|
|
41
|
-
const inputOptions = await PluginDriver.callOptionsHook(option);
|
|
42
|
-
return createBundlerOptions(inputOptions, output);
|
|
43
|
-
}))
|
|
44
|
-
.flat());
|
|
45
|
-
const notifyOptions = getValidNotifyOption(bundlerOptions);
|
|
46
|
-
const bindingWatcher = new BindingWatcher(bundlerOptions.map((option) => option.bundlerOptions), notifyOptions);
|
|
47
|
-
const watcher = new Watcher(emitter, bindingWatcher, bundlerOptions.map((option) => option.stopWorkers));
|
|
48
|
-
watcher.start();
|
|
49
|
-
}
|
|
50
|
-
function getValidNotifyOption(bundlerOptions) {
|
|
51
|
-
let result;
|
|
52
|
-
for (const option of bundlerOptions) {
|
|
53
|
-
if (option.inputOptions.watch) {
|
|
54
|
-
const notifyOption = option.inputOptions.watch.notify;
|
|
55
|
-
if (notifyOption) {
|
|
56
|
-
if (result) {
|
|
57
|
-
option.onLog(LOG_LEVEL_WARN, logMultiplyNotifyOption());
|
|
58
|
-
return result;
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
result = notifyOption;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|