rolldown 0.13.2-snapshot-a292401-20241105072341 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/cli.cjs +3 -58
- package/dist/cjs/experimental-index.cjs +1 -2
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/parallel-plugin-worker.cjs +1 -1
- package/dist/esm/cli.mjs +3 -58
- package/dist/esm/experimental-index.mjs +2 -2
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/parallel-plugin-worker.mjs +1 -1
- package/dist/shared/rolldown-binding.wasi.cjs +71 -71
- package/dist/shared/{src_index-CngklO4k.cjs → src_index-3pqhEViJ.cjs} +233 -229
- package/dist/shared/{src_index-uxgg1P7A.mjs → src_index-ywYMd4vB.mjs} +234 -229
- package/dist/types/binding.d.ts +2 -5
- package/dist/types/cli/arguments/schema.d.ts +3 -6
- package/dist/types/experimental-index.d.ts +1 -1
- package/dist/types/options/input-options.d.ts +0 -6
- package/dist/types/options/normalized-output-options.d.ts +1 -1
- package/dist/types/options/output-options.d.ts +7 -7
- package/dist/types/plugin/builtin-plugin.d.ts +0 -4
- package/dist/types/plugin/plugin-driver.d.ts +1 -0
- package/dist/types/rolldown-build.d.ts +0 -2
- package/package.json +14 -23
|
@@ -803,6 +803,230 @@ function getLogHandler(level, code, logger, pluginName, logLevel) {
|
|
|
803
803
|
};
|
|
804
804
|
}
|
|
805
805
|
|
|
806
|
+
//#endregion
|
|
807
|
+
//#region src/options/utils.ts
|
|
808
|
+
function normalizedStringOrRegex(pattern) {
|
|
809
|
+
if (!pattern) {
|
|
810
|
+
return undefined;
|
|
811
|
+
}
|
|
812
|
+
if (!Array.isArray(pattern)) {
|
|
813
|
+
pattern = [pattern];
|
|
814
|
+
}
|
|
815
|
+
return pattern;
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
//#endregion
|
|
819
|
+
//#region src/options/normalized-ecma-transform-plugin-config.ts
|
|
820
|
+
function normalizeEcmaTransformPluginConfig(config) {
|
|
821
|
+
if (!config) {
|
|
822
|
+
return undefined;
|
|
823
|
+
}
|
|
824
|
+
let normalizedConfig = {
|
|
825
|
+
jsxInject: config?.jsxInject,
|
|
826
|
+
exclude: normalizedStringOrRegex(config.exclude),
|
|
827
|
+
include: normalizedStringOrRegex(config.include),
|
|
828
|
+
targets: config.targets
|
|
829
|
+
};
|
|
830
|
+
return normalizedConfig;
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
//#endregion
|
|
834
|
+
//#region src/plugin/builtin-plugin.ts
|
|
835
|
+
var import_binding$6 = __toESM(require_binding());
|
|
836
|
+
class BuiltinPlugin {
|
|
837
|
+
constructor(name, options) {
|
|
838
|
+
this.name = name;
|
|
839
|
+
this.options = options;
|
|
840
|
+
this.name = name;
|
|
841
|
+
this.options = options;
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
class ModulePreloadPolyfillPlugin extends BuiltinPlugin {
|
|
845
|
+
constructor(config) {
|
|
846
|
+
super(import_binding$6.BindingBuiltinPluginName.ModulePreloadPolyfillPlugin, config);
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
class DynamicImportVarsPlugin extends BuiltinPlugin {
|
|
850
|
+
constructor() {
|
|
851
|
+
super(import_binding$6.BindingBuiltinPluginName.DynamicImportVarsPlugin);
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
class ImportGlobPlugin extends BuiltinPlugin {
|
|
855
|
+
constructor(config) {
|
|
856
|
+
super(import_binding$6.BindingBuiltinPluginName.ImportGlobPlugin, config);
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
class ManifestPlugin extends BuiltinPlugin {
|
|
860
|
+
constructor(config) {
|
|
861
|
+
super(import_binding$6.BindingBuiltinPluginName.ManifestPlugin, config);
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
class WasmHelperPlugin extends BuiltinPlugin {
|
|
865
|
+
constructor() {
|
|
866
|
+
super(import_binding$6.BindingBuiltinPluginName.WasmHelperPlugin);
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
class WasmFallbackPlugin extends BuiltinPlugin {
|
|
870
|
+
constructor() {
|
|
871
|
+
super(import_binding$6.BindingBuiltinPluginName.WasmFallbackPlugin);
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
class LoadFallbackPlugin extends BuiltinPlugin {
|
|
875
|
+
constructor() {
|
|
876
|
+
super(import_binding$6.BindingBuiltinPluginName.LoadFallbackPlugin);
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
class AliasPlugin extends BuiltinPlugin {
|
|
880
|
+
constructor(config) {
|
|
881
|
+
super(import_binding$6.BindingBuiltinPluginName.AliasPlugin, config);
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
class TransformPlugin extends BuiltinPlugin {
|
|
885
|
+
constructor(config) {
|
|
886
|
+
let normalizedConfig = normalizeEcmaTransformPluginConfig(config);
|
|
887
|
+
super(import_binding$6.BindingBuiltinPluginName.TransformPlugin, normalizedConfig);
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
class JsonPlugin extends BuiltinPlugin {
|
|
891
|
+
constructor(config) {
|
|
892
|
+
super(import_binding$6.BindingBuiltinPluginName.JsonPlugin, config);
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
class BuildImportAnalysisPlugin extends BuiltinPlugin {
|
|
896
|
+
constructor(config) {
|
|
897
|
+
super(import_binding$6.BindingBuiltinPluginName.BuildImportAnalysisPlugin, config);
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
class ReplacePlugin extends BuiltinPlugin {
|
|
901
|
+
constructor(config) {
|
|
902
|
+
super(import_binding$6.BindingBuiltinPluginName.ReplacePlugin, config);
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
function modulePreloadPolyfillPlugin(config) {
|
|
906
|
+
return new ModulePreloadPolyfillPlugin(config);
|
|
907
|
+
}
|
|
908
|
+
function dynamicImportVarsPlugin() {
|
|
909
|
+
return new DynamicImportVarsPlugin();
|
|
910
|
+
}
|
|
911
|
+
function importGlobPlugin(config) {
|
|
912
|
+
return new ImportGlobPlugin(config);
|
|
913
|
+
}
|
|
914
|
+
function manifestPlugin(config) {
|
|
915
|
+
return new ManifestPlugin(config);
|
|
916
|
+
}
|
|
917
|
+
function wasmHelperPlugin() {
|
|
918
|
+
return new WasmHelperPlugin();
|
|
919
|
+
}
|
|
920
|
+
function wasmFallbackPlugin() {
|
|
921
|
+
return new WasmFallbackPlugin();
|
|
922
|
+
}
|
|
923
|
+
function transformPlugin(config) {
|
|
924
|
+
return new TransformPlugin(config);
|
|
925
|
+
}
|
|
926
|
+
function loadFallbackPlugin() {
|
|
927
|
+
return new LoadFallbackPlugin();
|
|
928
|
+
}
|
|
929
|
+
function aliasPlugin(config) {
|
|
930
|
+
return new AliasPlugin(config);
|
|
931
|
+
}
|
|
932
|
+
function jsonPlugin(config) {
|
|
933
|
+
return new JsonPlugin(config);
|
|
934
|
+
}
|
|
935
|
+
function buildImportAnalysisPlugin(config) {
|
|
936
|
+
return new BuildImportAnalysisPlugin(config);
|
|
937
|
+
}
|
|
938
|
+
function replacePlugin(values = {}, options = {}) {
|
|
939
|
+
return new ReplacePlugin({
|
|
940
|
+
...options,
|
|
941
|
+
values
|
|
942
|
+
});
|
|
943
|
+
}
|
|
944
|
+
function bindingifyBuiltInPlugin(plugin) {
|
|
945
|
+
return {
|
|
946
|
+
__name: plugin.name,
|
|
947
|
+
options: plugin.options
|
|
948
|
+
};
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
//#endregion
|
|
952
|
+
//#region src/plugin/plugin-driver.ts
|
|
953
|
+
class PluginDriver {
|
|
954
|
+
async callOptionsHook(inputOptions) {
|
|
955
|
+
const logLevel = inputOptions.logLevel || LOG_LEVEL_INFO;
|
|
956
|
+
const plugins = getSortedPlugins("options", getObjectPlugins(inputOptions.plugins ?? []));
|
|
957
|
+
const logger = getLogger(plugins, getOnLog(inputOptions, logLevel), logLevel);
|
|
958
|
+
for (const plugin of plugins) {
|
|
959
|
+
const name = plugin.name || "unknown";
|
|
960
|
+
const options = plugin.options;
|
|
961
|
+
if (options) {
|
|
962
|
+
const { handler: handler } = normalizeHook(options);
|
|
963
|
+
const result = await handler.call({
|
|
964
|
+
debug: getLogHandler(LOG_LEVEL_DEBUG, "PLUGIN_LOG", logger, name, logLevel),
|
|
965
|
+
error: (e) => error(logPluginError(normalizeLog(e), name, {hook: "onLog"})),
|
|
966
|
+
info: getLogHandler(LOG_LEVEL_INFO, "PLUGIN_LOG", logger, name, logLevel),
|
|
967
|
+
meta: {
|
|
968
|
+
rollupVersion: "4.23.0",
|
|
969
|
+
rolldownVersion: VERSION,
|
|
970
|
+
watchMode: false
|
|
971
|
+
},
|
|
972
|
+
warn: getLogHandler(LOG_LEVEL_WARN, "PLUGIN_WARNING", logger, name, logLevel)
|
|
973
|
+
}, inputOptions);
|
|
974
|
+
if (result) {
|
|
975
|
+
inputOptions = result;
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
return inputOptions;
|
|
980
|
+
}
|
|
981
|
+
callOutputOptionsHook(inputOptions, outputOptions) {
|
|
982
|
+
const plugins = getSortedPlugins("outputOptions", getObjectPlugins(inputOptions.plugins));
|
|
983
|
+
for (const plugin of plugins) {
|
|
984
|
+
const options = plugin.outputOptions;
|
|
985
|
+
if (options) {
|
|
986
|
+
const { handler: handler } = normalizeHook(options);
|
|
987
|
+
const result = handler.call(null, outputOptions);
|
|
988
|
+
if (result) {
|
|
989
|
+
outputOptions = result;
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
return outputOptions;
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
function getObjectPlugins(plugins) {
|
|
997
|
+
return plugins.filter((plugin) => {
|
|
998
|
+
if ("_parallel"in plugin) {
|
|
999
|
+
return undefined;
|
|
1000
|
+
}
|
|
1001
|
+
if (plugin instanceof BuiltinPlugin) {
|
|
1002
|
+
return undefined;
|
|
1003
|
+
}
|
|
1004
|
+
return plugin;
|
|
1005
|
+
});
|
|
1006
|
+
}
|
|
1007
|
+
function getSortedPlugins(hookName, plugins) {
|
|
1008
|
+
const pre = [];
|
|
1009
|
+
const normal = [];
|
|
1010
|
+
const post = [];
|
|
1011
|
+
for (const plugin of plugins) {
|
|
1012
|
+
const hook = plugin[hookName];
|
|
1013
|
+
if (hook) {
|
|
1014
|
+
if (typeof hook === "object") {
|
|
1015
|
+
if (hook.order === "pre") {
|
|
1016
|
+
pre.push(plugin);
|
|
1017
|
+
continue;
|
|
1018
|
+
}
|
|
1019
|
+
if (hook.order === "post") {
|
|
1020
|
+
post.push(plugin);
|
|
1021
|
+
continue;
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
normal.push(plugin);
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
return [...pre, ...normal, ...post];
|
|
1028
|
+
}
|
|
1029
|
+
|
|
806
1030
|
//#endregion
|
|
807
1031
|
//#region src/log/logger.ts
|
|
808
1032
|
class MinimalPluginContext {
|
|
@@ -835,7 +1059,7 @@ function getLogger(plugins, onLog, logLevel) {
|
|
|
835
1059
|
if (logPriority < minimalPriority) {
|
|
836
1060
|
return;
|
|
837
1061
|
}
|
|
838
|
-
for (const plugin of plugins) {
|
|
1062
|
+
for (const plugin of getSortedPlugins("onLog", plugins)) {
|
|
839
1063
|
if (skipped.has(plugin)) continue;
|
|
840
1064
|
const { onLog: pluginOnLog } = plugin;
|
|
841
1065
|
if (pluginOnLog) {
|
|
@@ -1001,12 +1225,12 @@ class TransformPluginContext extends PluginContext {
|
|
|
1001
1225
|
|
|
1002
1226
|
//#endregion
|
|
1003
1227
|
//#region src/utils/transform-side-effects.ts
|
|
1004
|
-
var import_binding$
|
|
1228
|
+
var import_binding$5 = __toESM(require_binding());
|
|
1005
1229
|
function bindingifySideEffects(sideEffects) {
|
|
1006
1230
|
switch (sideEffects) {
|
|
1007
|
-
case true: return import_binding$
|
|
1008
|
-
case false: return import_binding$
|
|
1009
|
-
case "no-treeshake": return import_binding$
|
|
1231
|
+
case true: return import_binding$5.BindingHookSideEffects.True;
|
|
1232
|
+
case false: return import_binding$5.BindingHookSideEffects.False;
|
|
1233
|
+
case "no-treeshake": return import_binding$5.BindingHookSideEffects.NoTreeshake;
|
|
1010
1234
|
case null:
|
|
1011
1235
|
case undefined: return undefined;
|
|
1012
1236
|
default: throw new Error(`Unexpected side effects: ${sideEffects}`);
|
|
@@ -1015,14 +1239,14 @@ function bindingifySideEffects(sideEffects) {
|
|
|
1015
1239
|
|
|
1016
1240
|
//#endregion
|
|
1017
1241
|
//#region src/plugin/bindingify-plugin-hook-meta.ts
|
|
1018
|
-
var import_binding$
|
|
1242
|
+
var import_binding$4 = __toESM(require_binding());
|
|
1019
1243
|
function bindingifyPluginHookMeta(options) {
|
|
1020
1244
|
return {order: bindingPluginOrder(options.order)};
|
|
1021
1245
|
}
|
|
1022
1246
|
function bindingPluginOrder(order) {
|
|
1023
1247
|
switch (order) {
|
|
1024
|
-
case "post": return import_binding$
|
|
1025
|
-
case "pre": return import_binding$
|
|
1248
|
+
case "post": return import_binding$4.BindingPluginOrder.Post;
|
|
1249
|
+
case "pre": return import_binding$4.BindingPluginOrder.Pre;
|
|
1026
1250
|
case null:
|
|
1027
1251
|
case undefined: return undefined;
|
|
1028
1252
|
default: throw new Error(`Unknown plugin order: ${order}`);
|
|
@@ -1554,160 +1778,6 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData) {
|
|
|
1554
1778
|
};
|
|
1555
1779
|
}
|
|
1556
1780
|
|
|
1557
|
-
//#endregion
|
|
1558
|
-
//#region src/options/utils.ts
|
|
1559
|
-
function normalizedStringOrRegex(pattern) {
|
|
1560
|
-
if (!pattern) {
|
|
1561
|
-
return undefined;
|
|
1562
|
-
}
|
|
1563
|
-
if (!Array.isArray(pattern)) {
|
|
1564
|
-
pattern = [pattern];
|
|
1565
|
-
}
|
|
1566
|
-
return pattern;
|
|
1567
|
-
}
|
|
1568
|
-
|
|
1569
|
-
//#endregion
|
|
1570
|
-
//#region src/options/normalized-ecma-transform-plugin-config.ts
|
|
1571
|
-
function normalizeEcmaTransformPluginConfig(config) {
|
|
1572
|
-
if (!config) {
|
|
1573
|
-
return undefined;
|
|
1574
|
-
}
|
|
1575
|
-
let normalizedConfig = {
|
|
1576
|
-
jsxInject: config?.jsxInject,
|
|
1577
|
-
reactRefresh: config?.reactRefresh,
|
|
1578
|
-
exclude: normalizedStringOrRegex(config.exclude),
|
|
1579
|
-
include: normalizedStringOrRegex(config.include),
|
|
1580
|
-
targets: config.targets
|
|
1581
|
-
};
|
|
1582
|
-
return normalizedConfig;
|
|
1583
|
-
}
|
|
1584
|
-
|
|
1585
|
-
//#endregion
|
|
1586
|
-
//#region src/plugin/builtin-plugin.ts
|
|
1587
|
-
var import_binding$4 = __toESM(require_binding());
|
|
1588
|
-
class BuiltinPlugin {
|
|
1589
|
-
constructor(name, options) {
|
|
1590
|
-
this.name = name;
|
|
1591
|
-
this.options = options;
|
|
1592
|
-
this.name = name;
|
|
1593
|
-
this.options = options;
|
|
1594
|
-
}
|
|
1595
|
-
}
|
|
1596
|
-
class ModulePreloadPolyfillPlugin extends BuiltinPlugin {
|
|
1597
|
-
constructor(config) {
|
|
1598
|
-
super(import_binding$4.BindingBuiltinPluginName.ModulePreloadPolyfillPlugin, config);
|
|
1599
|
-
}
|
|
1600
|
-
}
|
|
1601
|
-
class DynamicImportVarsPlugin extends BuiltinPlugin {
|
|
1602
|
-
constructor() {
|
|
1603
|
-
super(import_binding$4.BindingBuiltinPluginName.DynamicImportVarsPlugin);
|
|
1604
|
-
}
|
|
1605
|
-
}
|
|
1606
|
-
class ImportGlobPlugin extends BuiltinPlugin {
|
|
1607
|
-
constructor(config) {
|
|
1608
|
-
super(import_binding$4.BindingBuiltinPluginName.ImportGlobPlugin, config);
|
|
1609
|
-
}
|
|
1610
|
-
}
|
|
1611
|
-
class ManifestPlugin extends BuiltinPlugin {
|
|
1612
|
-
constructor(config) {
|
|
1613
|
-
super(import_binding$4.BindingBuiltinPluginName.ManifestPlugin, config);
|
|
1614
|
-
}
|
|
1615
|
-
}
|
|
1616
|
-
class WasmHelperPlugin extends BuiltinPlugin {
|
|
1617
|
-
constructor() {
|
|
1618
|
-
super(import_binding$4.BindingBuiltinPluginName.WasmHelperPlugin);
|
|
1619
|
-
}
|
|
1620
|
-
}
|
|
1621
|
-
class WasmFallbackPlugin extends BuiltinPlugin {
|
|
1622
|
-
constructor() {
|
|
1623
|
-
super(import_binding$4.BindingBuiltinPluginName.WasmFallbackPlugin);
|
|
1624
|
-
}
|
|
1625
|
-
}
|
|
1626
|
-
class LoadFallbackPlugin extends BuiltinPlugin {
|
|
1627
|
-
constructor() {
|
|
1628
|
-
super(import_binding$4.BindingBuiltinPluginName.LoadFallbackPlugin);
|
|
1629
|
-
}
|
|
1630
|
-
}
|
|
1631
|
-
class AliasPlugin extends BuiltinPlugin {
|
|
1632
|
-
constructor(config) {
|
|
1633
|
-
super(import_binding$4.BindingBuiltinPluginName.AliasPlugin, config);
|
|
1634
|
-
}
|
|
1635
|
-
}
|
|
1636
|
-
class TransformPlugin extends BuiltinPlugin {
|
|
1637
|
-
constructor(config) {
|
|
1638
|
-
let normalizedConfig = normalizeEcmaTransformPluginConfig(config);
|
|
1639
|
-
super(import_binding$4.BindingBuiltinPluginName.TransformPlugin, normalizedConfig);
|
|
1640
|
-
}
|
|
1641
|
-
}
|
|
1642
|
-
class JsonPlugin extends BuiltinPlugin {
|
|
1643
|
-
constructor(config) {
|
|
1644
|
-
super(import_binding$4.BindingBuiltinPluginName.JsonPlugin, config);
|
|
1645
|
-
}
|
|
1646
|
-
}
|
|
1647
|
-
class BuildImportAnalysisPlugin extends BuiltinPlugin {
|
|
1648
|
-
constructor(config) {
|
|
1649
|
-
super(import_binding$4.BindingBuiltinPluginName.BuildImportAnalysisPlugin, config);
|
|
1650
|
-
}
|
|
1651
|
-
}
|
|
1652
|
-
class ReplacePlugin extends BuiltinPlugin {
|
|
1653
|
-
constructor(config) {
|
|
1654
|
-
super(import_binding$4.BindingBuiltinPluginName.ReplacePlugin, config);
|
|
1655
|
-
}
|
|
1656
|
-
}
|
|
1657
|
-
class ReactPlugin extends BuiltinPlugin {
|
|
1658
|
-
constructor() {
|
|
1659
|
-
super(import_binding$4.BindingBuiltinPluginName.ReactPlugin);
|
|
1660
|
-
}
|
|
1661
|
-
}
|
|
1662
|
-
function modulePreloadPolyfillPlugin(config) {
|
|
1663
|
-
return new ModulePreloadPolyfillPlugin(config);
|
|
1664
|
-
}
|
|
1665
|
-
function dynamicImportVarsPlugin() {
|
|
1666
|
-
return new DynamicImportVarsPlugin();
|
|
1667
|
-
}
|
|
1668
|
-
function importGlobPlugin(config) {
|
|
1669
|
-
return new ImportGlobPlugin(config);
|
|
1670
|
-
}
|
|
1671
|
-
function manifestPlugin(config) {
|
|
1672
|
-
return new ManifestPlugin(config);
|
|
1673
|
-
}
|
|
1674
|
-
function wasmHelperPlugin() {
|
|
1675
|
-
return new WasmHelperPlugin();
|
|
1676
|
-
}
|
|
1677
|
-
function wasmFallbackPlugin() {
|
|
1678
|
-
return new WasmFallbackPlugin();
|
|
1679
|
-
}
|
|
1680
|
-
function transformPlugin(config) {
|
|
1681
|
-
return new TransformPlugin(config);
|
|
1682
|
-
}
|
|
1683
|
-
function loadFallbackPlugin() {
|
|
1684
|
-
return new LoadFallbackPlugin();
|
|
1685
|
-
}
|
|
1686
|
-
function aliasPlugin(config) {
|
|
1687
|
-
return new AliasPlugin(config);
|
|
1688
|
-
}
|
|
1689
|
-
function jsonPlugin(config) {
|
|
1690
|
-
return new JsonPlugin(config);
|
|
1691
|
-
}
|
|
1692
|
-
function buildImportAnalysisPlugin(config) {
|
|
1693
|
-
return new BuildImportAnalysisPlugin(config);
|
|
1694
|
-
}
|
|
1695
|
-
function replacePlugin(values = {}, options = {}) {
|
|
1696
|
-
return new ReplacePlugin({
|
|
1697
|
-
...options,
|
|
1698
|
-
values
|
|
1699
|
-
});
|
|
1700
|
-
}
|
|
1701
|
-
function bindingifyBuiltInPlugin(plugin) {
|
|
1702
|
-
return {
|
|
1703
|
-
__name: plugin.name,
|
|
1704
|
-
options: plugin.options
|
|
1705
|
-
};
|
|
1706
|
-
}
|
|
1707
|
-
function reactPlugin() {
|
|
1708
|
-
return new ReactPlugin();
|
|
1709
|
-
}
|
|
1710
|
-
|
|
1711
1781
|
//#endregion
|
|
1712
1782
|
//#region src/plugin/plugin-context-data.ts
|
|
1713
1783
|
class PluginContextData {
|
|
@@ -1975,63 +2045,6 @@ async function initializeWorker(registryId, pluginInfos, threadNumber) {
|
|
|
1975
2045
|
}
|
|
1976
2046
|
}
|
|
1977
2047
|
|
|
1978
|
-
//#endregion
|
|
1979
|
-
//#region src/plugin/plugin-driver.ts
|
|
1980
|
-
class PluginDriver {
|
|
1981
|
-
async callOptionsHook(inputOptions) {
|
|
1982
|
-
const logLevel = inputOptions.logLevel || LOG_LEVEL_INFO;
|
|
1983
|
-
const plugins = getObjectPlugins(inputOptions.plugins ?? []);
|
|
1984
|
-
const logger = getLogger(plugins, getOnLog(inputOptions, logLevel), logLevel);
|
|
1985
|
-
for (const plugin of plugins) {
|
|
1986
|
-
const name = plugin.name || "unknown";
|
|
1987
|
-
const options = plugin.options;
|
|
1988
|
-
if (options) {
|
|
1989
|
-
const { handler: handler } = normalizeHook(options);
|
|
1990
|
-
const result = await handler.call({
|
|
1991
|
-
debug: getLogHandler(LOG_LEVEL_DEBUG, "PLUGIN_LOG", logger, name, logLevel),
|
|
1992
|
-
error: (e) => error(logPluginError(normalizeLog(e), name, {hook: "onLog"})),
|
|
1993
|
-
info: getLogHandler(LOG_LEVEL_INFO, "PLUGIN_LOG", logger, name, logLevel),
|
|
1994
|
-
meta: {
|
|
1995
|
-
rollupVersion: "4.23.0",
|
|
1996
|
-
rolldownVersion: VERSION,
|
|
1997
|
-
watchMode: false
|
|
1998
|
-
},
|
|
1999
|
-
warn: getLogHandler(LOG_LEVEL_WARN, "PLUGIN_WARNING", logger, name, logLevel)
|
|
2000
|
-
}, inputOptions);
|
|
2001
|
-
if (result) {
|
|
2002
|
-
inputOptions = result;
|
|
2003
|
-
}
|
|
2004
|
-
}
|
|
2005
|
-
}
|
|
2006
|
-
return inputOptions;
|
|
2007
|
-
}
|
|
2008
|
-
callOutputOptionsHook(inputOptions, outputOptions) {
|
|
2009
|
-
const plugins = getObjectPlugins(inputOptions.plugins);
|
|
2010
|
-
for (const plugin of plugins) {
|
|
2011
|
-
const options = plugin.outputOptions;
|
|
2012
|
-
if (options) {
|
|
2013
|
-
const { handler: handler } = normalizeHook(options);
|
|
2014
|
-
const result = handler.call(null, outputOptions);
|
|
2015
|
-
if (result) {
|
|
2016
|
-
outputOptions = result;
|
|
2017
|
-
}
|
|
2018
|
-
}
|
|
2019
|
-
}
|
|
2020
|
-
return outputOptions;
|
|
2021
|
-
}
|
|
2022
|
-
}
|
|
2023
|
-
function getObjectPlugins(plugins) {
|
|
2024
|
-
return plugins.filter((plugin) => {
|
|
2025
|
-
if ("_parallel"in plugin) {
|
|
2026
|
-
return undefined;
|
|
2027
|
-
}
|
|
2028
|
-
if (plugin instanceof BuiltinPlugin) {
|
|
2029
|
-
return undefined;
|
|
2030
|
-
}
|
|
2031
|
-
return plugin;
|
|
2032
|
-
});
|
|
2033
|
-
}
|
|
2034
|
-
|
|
2035
2048
|
//#endregion
|
|
2036
2049
|
//#region src/utils/async-flatten.ts
|
|
2037
2050
|
async function asyncFlatten(array) {
|
|
@@ -2556,9 +2569,6 @@ function getFormat(format) {
|
|
|
2556
2569
|
case "iife": {
|
|
2557
2570
|
return "iife";
|
|
2558
2571
|
}
|
|
2559
|
-
case "app": {
|
|
2560
|
-
return "app";
|
|
2561
|
-
}
|
|
2562
2572
|
case "umd": {
|
|
2563
2573
|
return "umd";
|
|
2564
2574
|
}
|
|
@@ -2588,7 +2598,6 @@ function bindingifyOutputOptions(outputOptions) {
|
|
|
2588
2598
|
case "cjs": return "cjs";
|
|
2589
2599
|
case "iife": return "iife";
|
|
2590
2600
|
case "umd": return "umd";
|
|
2591
|
-
case "app": return "app";
|
|
2592
2601
|
}
|
|
2593
2602
|
}(),
|
|
2594
2603
|
exports,
|
|
@@ -2678,10 +2687,6 @@ class RolldownBuild {
|
|
|
2678
2687
|
const output = await bundler.write();
|
|
2679
2688
|
return transformToRollupOutput(output);
|
|
2680
2689
|
}
|
|
2681
|
-
async experimental_hmr_rebuild(changedFiles) {
|
|
2682
|
-
const { assets: assets } = await this.#bundler.bundler.hmrRebuild(changedFiles);
|
|
2683
|
-
return [assets[0].fileName, transformAssetSource(assets[0].source)];
|
|
2684
|
-
}
|
|
2685
2690
|
async close() {
|
|
2686
2691
|
const { bundler: bundler, stopWorkers: stopWorkers } = await this.#getBundlerWithStopWorker({});
|
|
2687
2692
|
await stopWorkers?.();
|
|
@@ -2770,7 +2775,7 @@ const experimental_scan = async (input) => {
|
|
|
2770
2775
|
|
|
2771
2776
|
//#endregion
|
|
2772
2777
|
//#region package.json
|
|
2773
|
-
const version = "0.
|
|
2778
|
+
const version = "0.14.0";
|
|
2774
2779
|
const description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
|
|
2775
2780
|
|
|
2776
2781
|
//#endregion
|
|
@@ -2778,4 +2783,4 @@ const description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-comp
|
|
|
2778
2783
|
const VERSION = version;
|
|
2779
2784
|
|
|
2780
2785
|
//#endregion
|
|
2781
|
-
export { LogLevelOptionSchema, LogLevelSchema, LogLevelWithErrorSchema, PluginContextData, RollupLogSchema, RollupLogWithStringSchema, VERSION, __export, __toESM, aliasPlugin, arraify, bindingifyPlugin, buildImportAnalysisPlugin, composeJsPlugins, defineConfig, description, dynamicImportVarsPlugin, experimental_scan, importGlobPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin,
|
|
2786
|
+
export { LogLevelOptionSchema, LogLevelSchema, LogLevelWithErrorSchema, PluginContextData, RollupLogSchema, RollupLogWithStringSchema, VERSION, __export, __toESM, aliasPlugin, arraify, bindingifyPlugin, buildImportAnalysisPlugin, composeJsPlugins, defineConfig, description, dynamicImportVarsPlugin, experimental_scan, importGlobPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, replacePlugin, require_binding, rolldown, transformPlugin, version, wasmFallbackPlugin, wasmHelperPlugin, watch };
|
package/dist/types/binding.d.ts
CHANGED
|
@@ -70,7 +70,6 @@ export declare class Bundler {
|
|
|
70
70
|
write(): Promise<BindingOutputs>
|
|
71
71
|
generate(): Promise<BindingOutputs>
|
|
72
72
|
scan(): Promise<void>
|
|
73
|
-
hmrRebuild(changedFiles: Array<string>): Promise<BindingOutputs>
|
|
74
73
|
close(): Promise<void>
|
|
75
74
|
watch(): Promise<BindingWatcher>
|
|
76
75
|
}
|
|
@@ -142,8 +141,7 @@ export declare enum BindingBuiltinPluginName {
|
|
|
142
141
|
AliasPlugin = 8,
|
|
143
142
|
JsonPlugin = 9,
|
|
144
143
|
BuildImportAnalysisPlugin = 10,
|
|
145
|
-
ReplacePlugin = 11
|
|
146
|
-
ReactPlugin = 12
|
|
144
|
+
ReplacePlugin = 11
|
|
147
145
|
}
|
|
148
146
|
|
|
149
147
|
export interface BindingEmittedAsset {
|
|
@@ -299,7 +297,7 @@ export interface BindingOutputOptions {
|
|
|
299
297
|
extend?: boolean
|
|
300
298
|
externalLiveBindings?: boolean
|
|
301
299
|
footer?: (chunk: RenderedChunk) => MaybePromise<VoidNullable<string>>
|
|
302
|
-
format?: 'es' | 'cjs' | 'iife' | 'umd'
|
|
300
|
+
format?: 'es' | 'cjs' | 'iife' | 'umd'
|
|
303
301
|
globals?: Record<string, string>
|
|
304
302
|
inlineDynamicImports?: boolean
|
|
305
303
|
intro?: (chunk: RenderedChunk) => MaybePromise<VoidNullable<string>>
|
|
@@ -428,7 +426,6 @@ export interface BindingTransformPluginConfig {
|
|
|
428
426
|
include?: Array<BindingStringOrRegex>
|
|
429
427
|
exclude?: Array<BindingStringOrRegex>
|
|
430
428
|
jsxInject?: string
|
|
431
|
-
reactRefresh?: boolean
|
|
432
429
|
targets?: string
|
|
433
430
|
}
|
|
434
431
|
|
|
@@ -69,7 +69,6 @@ export declare const cliOptionsSchema: z.ZodObject<z.objectUtil.extendShape<z.ob
|
|
|
69
69
|
}>>;
|
|
70
70
|
define: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
71
71
|
inject: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodTuple<[z.ZodString, z.ZodString], null>]>>>;
|
|
72
|
-
dev: z.ZodOptional<z.ZodBoolean>;
|
|
73
72
|
profilerNames: z.ZodOptional<z.ZodBoolean>;
|
|
74
73
|
jsx: z.ZodOptional<z.ZodObject<{
|
|
75
74
|
mode: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"classic">, z.ZodLiteral<"automatic">]>>;
|
|
@@ -138,7 +137,7 @@ export declare const cliOptionsSchema: z.ZodObject<z.objectUtil.extendShape<z.ob
|
|
|
138
137
|
dir: z.ZodOptional<z.ZodString>;
|
|
139
138
|
file: z.ZodOptional<z.ZodString>;
|
|
140
139
|
exports: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"auto">, z.ZodLiteral<"named">]>, z.ZodLiteral<"default">]>, z.ZodLiteral<"none">]>>;
|
|
141
|
-
format: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.
|
|
140
|
+
format: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"es">, z.ZodLiteral<"cjs">]>, z.ZodLiteral<"esm">]>, z.ZodLiteral<"module">]>, z.ZodLiteral<"commonjs">]>, z.ZodLiteral<"iife">]>, z.ZodLiteral<"umd">]>>;
|
|
142
141
|
sourcemap: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodBoolean, z.ZodLiteral<"inline">]>, z.ZodLiteral<"hidden">]>>;
|
|
143
142
|
sourcemapIgnoreList: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodType<import("../../options/output-options").SourcemapIgnoreListOption, z.ZodTypeDef, import("../../options/output-options").SourcemapIgnoreListOption>]>>;
|
|
144
143
|
sourcemapPathTransform: z.ZodOptional<z.ZodType<import("../../options/output-options").SourcemapPathTransformOption, z.ZodTypeDef, import("../../options/output-options").SourcemapPathTransformOption>>;
|
|
@@ -234,7 +233,6 @@ export declare const cliOptionsSchema: z.ZodObject<z.objectUtil.extendShape<z.ob
|
|
|
234
233
|
moduleTypes?: Record<string, "js" | "jsx" | "ts" | "tsx" | "json" | "text" | "base64" | "dataurl" | "binary" | "empty" | "css"> | undefined;
|
|
235
234
|
define?: Record<string, string> | undefined;
|
|
236
235
|
inject?: Record<string, string> | undefined;
|
|
237
|
-
dev?: boolean | undefined;
|
|
238
236
|
watch?: boolean | undefined;
|
|
239
237
|
footer?: string | undefined;
|
|
240
238
|
banner?: string | undefined;
|
|
@@ -244,7 +242,7 @@ export declare const cliOptionsSchema: z.ZodObject<z.objectUtil.extendShape<z.ob
|
|
|
244
242
|
name?: string | undefined;
|
|
245
243
|
exports?: "auto" | "named" | "default" | "none" | undefined;
|
|
246
244
|
dir?: string | undefined;
|
|
247
|
-
format?: "es" | "cjs" | "esm" | "module" | "commonjs" | "iife" | "umd" |
|
|
245
|
+
format?: "es" | "cjs" | "esm" | "module" | "commonjs" | "iife" | "umd" | undefined;
|
|
248
246
|
sourcemap?: boolean | "inline" | "hidden" | undefined;
|
|
249
247
|
extend?: boolean | undefined;
|
|
250
248
|
esModule?: boolean | undefined;
|
|
@@ -281,7 +279,6 @@ export declare const cliOptionsSchema: z.ZodObject<z.objectUtil.extendShape<z.ob
|
|
|
281
279
|
moduleTypes?: Record<string, "js" | "jsx" | "ts" | "tsx" | "json" | "text" | "base64" | "dataurl" | "binary" | "empty" | "css"> | undefined;
|
|
282
280
|
define?: Record<string, string> | undefined;
|
|
283
281
|
inject?: Record<string, string> | undefined;
|
|
284
|
-
dev?: boolean | undefined;
|
|
285
282
|
watch?: boolean | undefined;
|
|
286
283
|
footer?: string | undefined;
|
|
287
284
|
banner?: string | undefined;
|
|
@@ -291,7 +288,7 @@ export declare const cliOptionsSchema: z.ZodObject<z.objectUtil.extendShape<z.ob
|
|
|
291
288
|
name?: string | undefined;
|
|
292
289
|
exports?: "auto" | "named" | "default" | "none" | undefined;
|
|
293
290
|
dir?: string | undefined;
|
|
294
|
-
format?: "es" | "cjs" | "esm" | "module" | "commonjs" | "iife" | "umd" |
|
|
291
|
+
format?: "es" | "cjs" | "esm" | "module" | "commonjs" | "iife" | "umd" | undefined;
|
|
295
292
|
sourcemap?: boolean | "inline" | "hidden" | undefined;
|
|
296
293
|
extend?: boolean | undefined;
|
|
297
294
|
esModule?: boolean | undefined;
|
|
@@ -3,4 +3,4 @@ export { experimental_scan as scan } from './rolldown';
|
|
|
3
3
|
export { transform } from './binding';
|
|
4
4
|
export type { TransformOptions, TransformResult } from './binding';
|
|
5
5
|
export { composeJsPlugins as composePlugins } from './utils/compose-js-plugins';
|
|
6
|
-
export { modulePreloadPolyfillPlugin, dynamicImportVarsPlugin, wasmHelperPlugin, wasmFallbackPlugin, importGlobPlugin, manifestPlugin, loadFallbackPlugin, transformPlugin, aliasPlugin, jsonPlugin, buildImportAnalysisPlugin, replacePlugin,
|
|
6
|
+
export { modulePreloadPolyfillPlugin, dynamicImportVarsPlugin, wasmHelperPlugin, wasmFallbackPlugin, importGlobPlugin, manifestPlugin, loadFallbackPlugin, transformPlugin, aliasPlugin, jsonPlugin, buildImportAnalysisPlugin, replacePlugin, } from './plugin/builtin-plugin';
|
|
@@ -92,7 +92,6 @@ export declare const inputOptionsSchema: z.ZodObject<{
|
|
|
92
92
|
}>>;
|
|
93
93
|
define: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
94
94
|
inject: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodTuple<[z.ZodString, z.ZodString], null>]>>>;
|
|
95
|
-
dev: z.ZodOptional<z.ZodBoolean>;
|
|
96
95
|
profilerNames: z.ZodOptional<z.ZodBoolean>;
|
|
97
96
|
jsx: z.ZodOptional<z.ZodObject<{
|
|
98
97
|
mode: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"classic">, z.ZodLiteral<"automatic">]>>;
|
|
@@ -194,7 +193,6 @@ export declare const inputOptionsSchema: z.ZodObject<{
|
|
|
194
193
|
} | undefined;
|
|
195
194
|
define?: Record<string, string> | undefined;
|
|
196
195
|
inject?: Record<string, string | [string, string]> | undefined;
|
|
197
|
-
dev?: boolean | undefined;
|
|
198
196
|
profilerNames?: boolean | undefined;
|
|
199
197
|
watch?: false | {
|
|
200
198
|
skipWrite?: boolean | undefined;
|
|
@@ -247,7 +245,6 @@ export declare const inputOptionsSchema: z.ZodObject<{
|
|
|
247
245
|
} | undefined;
|
|
248
246
|
define?: Record<string, string> | undefined;
|
|
249
247
|
inject?: Record<string, string | [string, string]> | undefined;
|
|
250
|
-
dev?: boolean | undefined;
|
|
251
248
|
profilerNames?: boolean | undefined;
|
|
252
249
|
watch?: false | {
|
|
253
250
|
skipWrite?: boolean | undefined;
|
|
@@ -324,7 +321,6 @@ export declare const inputCliOptionsSchema: z.ZodObject<Omit<z.objectUtil.extend
|
|
|
324
321
|
}>>;
|
|
325
322
|
define: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
326
323
|
inject: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodTuple<[z.ZodString, z.ZodString], null>]>>>;
|
|
327
|
-
dev: z.ZodOptional<z.ZodBoolean>;
|
|
328
324
|
profilerNames: z.ZodOptional<z.ZodBoolean>;
|
|
329
325
|
jsx: z.ZodOptional<z.ZodObject<{
|
|
330
326
|
mode: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"classic">, z.ZodLiteral<"automatic">]>>;
|
|
@@ -408,7 +404,6 @@ export declare const inputCliOptionsSchema: z.ZodObject<Omit<z.objectUtil.extend
|
|
|
408
404
|
moduleTypes?: Record<string, "js" | "jsx" | "ts" | "tsx" | "json" | "text" | "base64" | "dataurl" | "binary" | "empty" | "css"> | undefined;
|
|
409
405
|
define?: Record<string, string> | undefined;
|
|
410
406
|
inject?: Record<string, string> | undefined;
|
|
411
|
-
dev?: boolean | undefined;
|
|
412
407
|
}, {
|
|
413
408
|
external?: string[] | undefined;
|
|
414
409
|
cwd?: string | undefined;
|
|
@@ -428,7 +423,6 @@ export declare const inputCliOptionsSchema: z.ZodObject<Omit<z.objectUtil.extend
|
|
|
428
423
|
moduleTypes?: Record<string, "js" | "jsx" | "ts" | "tsx" | "json" | "text" | "base64" | "dataurl" | "binary" | "empty" | "css"> | undefined;
|
|
429
424
|
define?: Record<string, string> | undefined;
|
|
430
425
|
inject?: Record<string, string> | undefined;
|
|
431
|
-
dev?: boolean | undefined;
|
|
432
426
|
}>;
|
|
433
427
|
type RawInputOptions = z.infer<typeof inputOptionsSchema>;
|
|
434
428
|
interface OverwriteInputOptionsWithDoc {
|
|
@@ -2,7 +2,7 @@ import type { SourcemapIgnoreListOption, SourcemapPathTransformOption } from '..
|
|
|
2
2
|
import type { OutputOptions } from './output-options';
|
|
3
3
|
import type { RolldownPlugin } from '../plugin';
|
|
4
4
|
import type { PreRenderedChunk, RenderedChunk } from '../binding';
|
|
5
|
-
export type InternalModuleFormat = 'es' | 'cjs' | 'iife' | '
|
|
5
|
+
export type InternalModuleFormat = 'es' | 'cjs' | 'iife' | 'umd';
|
|
6
6
|
type AddonFunction = (chunk: RenderedChunk) => string | Promise<string>;
|
|
7
7
|
type ChunkFileNamesOption = string | ((chunk: PreRenderedChunk) => string) | undefined;
|
|
8
8
|
export interface NormalizedOutputOptions extends OutputOptions {
|