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
|
@@ -773,6 +773,230 @@ function getLogHandler(level, code, logger, pluginName, logLevel) {
|
|
|
773
773
|
};
|
|
774
774
|
}
|
|
775
775
|
|
|
776
|
+
//#endregion
|
|
777
|
+
//#region src/options/utils.ts
|
|
778
|
+
function normalizedStringOrRegex(pattern) {
|
|
779
|
+
if (!pattern) {
|
|
780
|
+
return undefined;
|
|
781
|
+
}
|
|
782
|
+
if (!Array.isArray(pattern)) {
|
|
783
|
+
pattern = [pattern];
|
|
784
|
+
}
|
|
785
|
+
return pattern;
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
//#endregion
|
|
789
|
+
//#region src/options/normalized-ecma-transform-plugin-config.ts
|
|
790
|
+
function normalizeEcmaTransformPluginConfig(config) {
|
|
791
|
+
if (!config) {
|
|
792
|
+
return undefined;
|
|
793
|
+
}
|
|
794
|
+
let normalizedConfig = {
|
|
795
|
+
jsxInject: config?.jsxInject,
|
|
796
|
+
exclude: normalizedStringOrRegex(config.exclude),
|
|
797
|
+
include: normalizedStringOrRegex(config.include),
|
|
798
|
+
targets: config.targets
|
|
799
|
+
};
|
|
800
|
+
return normalizedConfig;
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
//#endregion
|
|
804
|
+
//#region src/plugin/builtin-plugin.ts
|
|
805
|
+
var import_binding$6 = __toESM(require_binding());
|
|
806
|
+
class BuiltinPlugin {
|
|
807
|
+
constructor(name, options) {
|
|
808
|
+
this.name = name;
|
|
809
|
+
this.options = options;
|
|
810
|
+
this.name = name;
|
|
811
|
+
this.options = options;
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
class ModulePreloadPolyfillPlugin extends BuiltinPlugin {
|
|
815
|
+
constructor(config) {
|
|
816
|
+
super(import_binding$6.BindingBuiltinPluginName.ModulePreloadPolyfillPlugin, config);
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
class DynamicImportVarsPlugin extends BuiltinPlugin {
|
|
820
|
+
constructor() {
|
|
821
|
+
super(import_binding$6.BindingBuiltinPluginName.DynamicImportVarsPlugin);
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
class ImportGlobPlugin extends BuiltinPlugin {
|
|
825
|
+
constructor(config) {
|
|
826
|
+
super(import_binding$6.BindingBuiltinPluginName.ImportGlobPlugin, config);
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
class ManifestPlugin extends BuiltinPlugin {
|
|
830
|
+
constructor(config) {
|
|
831
|
+
super(import_binding$6.BindingBuiltinPluginName.ManifestPlugin, config);
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
class WasmHelperPlugin extends BuiltinPlugin {
|
|
835
|
+
constructor() {
|
|
836
|
+
super(import_binding$6.BindingBuiltinPluginName.WasmHelperPlugin);
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
class WasmFallbackPlugin extends BuiltinPlugin {
|
|
840
|
+
constructor() {
|
|
841
|
+
super(import_binding$6.BindingBuiltinPluginName.WasmFallbackPlugin);
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
class LoadFallbackPlugin extends BuiltinPlugin {
|
|
845
|
+
constructor() {
|
|
846
|
+
super(import_binding$6.BindingBuiltinPluginName.LoadFallbackPlugin);
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
class AliasPlugin extends BuiltinPlugin {
|
|
850
|
+
constructor(config) {
|
|
851
|
+
super(import_binding$6.BindingBuiltinPluginName.AliasPlugin, config);
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
class TransformPlugin extends BuiltinPlugin {
|
|
855
|
+
constructor(config) {
|
|
856
|
+
let normalizedConfig = normalizeEcmaTransformPluginConfig(config);
|
|
857
|
+
super(import_binding$6.BindingBuiltinPluginName.TransformPlugin, normalizedConfig);
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
class JsonPlugin extends BuiltinPlugin {
|
|
861
|
+
constructor(config) {
|
|
862
|
+
super(import_binding$6.BindingBuiltinPluginName.JsonPlugin, config);
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
class BuildImportAnalysisPlugin extends BuiltinPlugin {
|
|
866
|
+
constructor(config) {
|
|
867
|
+
super(import_binding$6.BindingBuiltinPluginName.BuildImportAnalysisPlugin, config);
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
class ReplacePlugin extends BuiltinPlugin {
|
|
871
|
+
constructor(config) {
|
|
872
|
+
super(import_binding$6.BindingBuiltinPluginName.ReplacePlugin, config);
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
function modulePreloadPolyfillPlugin(config) {
|
|
876
|
+
return new ModulePreloadPolyfillPlugin(config);
|
|
877
|
+
}
|
|
878
|
+
function dynamicImportVarsPlugin() {
|
|
879
|
+
return new DynamicImportVarsPlugin();
|
|
880
|
+
}
|
|
881
|
+
function importGlobPlugin(config) {
|
|
882
|
+
return new ImportGlobPlugin(config);
|
|
883
|
+
}
|
|
884
|
+
function manifestPlugin(config) {
|
|
885
|
+
return new ManifestPlugin(config);
|
|
886
|
+
}
|
|
887
|
+
function wasmHelperPlugin() {
|
|
888
|
+
return new WasmHelperPlugin();
|
|
889
|
+
}
|
|
890
|
+
function wasmFallbackPlugin() {
|
|
891
|
+
return new WasmFallbackPlugin();
|
|
892
|
+
}
|
|
893
|
+
function transformPlugin(config) {
|
|
894
|
+
return new TransformPlugin(config);
|
|
895
|
+
}
|
|
896
|
+
function loadFallbackPlugin() {
|
|
897
|
+
return new LoadFallbackPlugin();
|
|
898
|
+
}
|
|
899
|
+
function aliasPlugin(config) {
|
|
900
|
+
return new AliasPlugin(config);
|
|
901
|
+
}
|
|
902
|
+
function jsonPlugin(config) {
|
|
903
|
+
return new JsonPlugin(config);
|
|
904
|
+
}
|
|
905
|
+
function buildImportAnalysisPlugin(config) {
|
|
906
|
+
return new BuildImportAnalysisPlugin(config);
|
|
907
|
+
}
|
|
908
|
+
function replacePlugin(values = {}, options = {}) {
|
|
909
|
+
return new ReplacePlugin({
|
|
910
|
+
...options,
|
|
911
|
+
values
|
|
912
|
+
});
|
|
913
|
+
}
|
|
914
|
+
function bindingifyBuiltInPlugin(plugin) {
|
|
915
|
+
return {
|
|
916
|
+
__name: plugin.name,
|
|
917
|
+
options: plugin.options
|
|
918
|
+
};
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
//#endregion
|
|
922
|
+
//#region src/plugin/plugin-driver.ts
|
|
923
|
+
class PluginDriver {
|
|
924
|
+
async callOptionsHook(inputOptions) {
|
|
925
|
+
const logLevel = inputOptions.logLevel || LOG_LEVEL_INFO;
|
|
926
|
+
const plugins = getSortedPlugins("options", getObjectPlugins(inputOptions.plugins ?? []));
|
|
927
|
+
const logger = getLogger(plugins, getOnLog(inputOptions, logLevel), logLevel);
|
|
928
|
+
for (const plugin of plugins) {
|
|
929
|
+
const name = plugin.name || "unknown";
|
|
930
|
+
const options = plugin.options;
|
|
931
|
+
if (options) {
|
|
932
|
+
const { handler: handler } = normalizeHook(options);
|
|
933
|
+
const result = await handler.call({
|
|
934
|
+
debug: getLogHandler(LOG_LEVEL_DEBUG, "PLUGIN_LOG", logger, name, logLevel),
|
|
935
|
+
error: (e) => error(logPluginError(normalizeLog(e), name, {hook: "onLog"})),
|
|
936
|
+
info: getLogHandler(LOG_LEVEL_INFO, "PLUGIN_LOG", logger, name, logLevel),
|
|
937
|
+
meta: {
|
|
938
|
+
rollupVersion: "4.23.0",
|
|
939
|
+
rolldownVersion: VERSION,
|
|
940
|
+
watchMode: false
|
|
941
|
+
},
|
|
942
|
+
warn: getLogHandler(LOG_LEVEL_WARN, "PLUGIN_WARNING", logger, name, logLevel)
|
|
943
|
+
}, inputOptions);
|
|
944
|
+
if (result) {
|
|
945
|
+
inputOptions = result;
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
return inputOptions;
|
|
950
|
+
}
|
|
951
|
+
callOutputOptionsHook(inputOptions, outputOptions) {
|
|
952
|
+
const plugins = getSortedPlugins("outputOptions", getObjectPlugins(inputOptions.plugins));
|
|
953
|
+
for (const plugin of plugins) {
|
|
954
|
+
const options = plugin.outputOptions;
|
|
955
|
+
if (options) {
|
|
956
|
+
const { handler: handler } = normalizeHook(options);
|
|
957
|
+
const result = handler.call(null, outputOptions);
|
|
958
|
+
if (result) {
|
|
959
|
+
outputOptions = result;
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
return outputOptions;
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
function getObjectPlugins(plugins) {
|
|
967
|
+
return plugins.filter((plugin) => {
|
|
968
|
+
if ("_parallel"in plugin) {
|
|
969
|
+
return undefined;
|
|
970
|
+
}
|
|
971
|
+
if (plugin instanceof BuiltinPlugin) {
|
|
972
|
+
return undefined;
|
|
973
|
+
}
|
|
974
|
+
return plugin;
|
|
975
|
+
});
|
|
976
|
+
}
|
|
977
|
+
function getSortedPlugins(hookName, plugins) {
|
|
978
|
+
const pre = [];
|
|
979
|
+
const normal = [];
|
|
980
|
+
const post = [];
|
|
981
|
+
for (const plugin of plugins) {
|
|
982
|
+
const hook = plugin[hookName];
|
|
983
|
+
if (hook) {
|
|
984
|
+
if (typeof hook === "object") {
|
|
985
|
+
if (hook.order === "pre") {
|
|
986
|
+
pre.push(plugin);
|
|
987
|
+
continue;
|
|
988
|
+
}
|
|
989
|
+
if (hook.order === "post") {
|
|
990
|
+
post.push(plugin);
|
|
991
|
+
continue;
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
normal.push(plugin);
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
return [...pre, ...normal, ...post];
|
|
998
|
+
}
|
|
999
|
+
|
|
776
1000
|
//#endregion
|
|
777
1001
|
//#region src/log/logger.ts
|
|
778
1002
|
class MinimalPluginContext {
|
|
@@ -805,7 +1029,7 @@ function getLogger(plugins, onLog, logLevel) {
|
|
|
805
1029
|
if (logPriority < minimalPriority) {
|
|
806
1030
|
return;
|
|
807
1031
|
}
|
|
808
|
-
for (const plugin of plugins) {
|
|
1032
|
+
for (const plugin of getSortedPlugins("onLog", plugins)) {
|
|
809
1033
|
if (skipped.has(plugin)) continue;
|
|
810
1034
|
const { onLog: pluginOnLog } = plugin;
|
|
811
1035
|
if (pluginOnLog) {
|
|
@@ -971,12 +1195,12 @@ class TransformPluginContext extends PluginContext {
|
|
|
971
1195
|
|
|
972
1196
|
//#endregion
|
|
973
1197
|
//#region src/utils/transform-side-effects.ts
|
|
974
|
-
var import_binding$
|
|
1198
|
+
var import_binding$5 = __toESM(require_binding());
|
|
975
1199
|
function bindingifySideEffects(sideEffects) {
|
|
976
1200
|
switch (sideEffects) {
|
|
977
|
-
case true: return import_binding$
|
|
978
|
-
case false: return import_binding$
|
|
979
|
-
case "no-treeshake": return import_binding$
|
|
1201
|
+
case true: return import_binding$5.BindingHookSideEffects.True;
|
|
1202
|
+
case false: return import_binding$5.BindingHookSideEffects.False;
|
|
1203
|
+
case "no-treeshake": return import_binding$5.BindingHookSideEffects.NoTreeshake;
|
|
980
1204
|
case null:
|
|
981
1205
|
case undefined: return undefined;
|
|
982
1206
|
default: throw new Error(`Unexpected side effects: ${sideEffects}`);
|
|
@@ -985,14 +1209,14 @@ function bindingifySideEffects(sideEffects) {
|
|
|
985
1209
|
|
|
986
1210
|
//#endregion
|
|
987
1211
|
//#region src/plugin/bindingify-plugin-hook-meta.ts
|
|
988
|
-
var import_binding$
|
|
1212
|
+
var import_binding$4 = __toESM(require_binding());
|
|
989
1213
|
function bindingifyPluginHookMeta(options) {
|
|
990
1214
|
return {order: bindingPluginOrder(options.order)};
|
|
991
1215
|
}
|
|
992
1216
|
function bindingPluginOrder(order) {
|
|
993
1217
|
switch (order) {
|
|
994
|
-
case "post": return import_binding$
|
|
995
|
-
case "pre": return import_binding$
|
|
1218
|
+
case "post": return import_binding$4.BindingPluginOrder.Post;
|
|
1219
|
+
case "pre": return import_binding$4.BindingPluginOrder.Pre;
|
|
996
1220
|
case null:
|
|
997
1221
|
case undefined: return undefined;
|
|
998
1222
|
default: throw new Error(`Unknown plugin order: ${order}`);
|
|
@@ -1524,160 +1748,6 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData) {
|
|
|
1524
1748
|
};
|
|
1525
1749
|
}
|
|
1526
1750
|
|
|
1527
|
-
//#endregion
|
|
1528
|
-
//#region src/options/utils.ts
|
|
1529
|
-
function normalizedStringOrRegex(pattern) {
|
|
1530
|
-
if (!pattern) {
|
|
1531
|
-
return undefined;
|
|
1532
|
-
}
|
|
1533
|
-
if (!Array.isArray(pattern)) {
|
|
1534
|
-
pattern = [pattern];
|
|
1535
|
-
}
|
|
1536
|
-
return pattern;
|
|
1537
|
-
}
|
|
1538
|
-
|
|
1539
|
-
//#endregion
|
|
1540
|
-
//#region src/options/normalized-ecma-transform-plugin-config.ts
|
|
1541
|
-
function normalizeEcmaTransformPluginConfig(config) {
|
|
1542
|
-
if (!config) {
|
|
1543
|
-
return undefined;
|
|
1544
|
-
}
|
|
1545
|
-
let normalizedConfig = {
|
|
1546
|
-
jsxInject: config?.jsxInject,
|
|
1547
|
-
reactRefresh: config?.reactRefresh,
|
|
1548
|
-
exclude: normalizedStringOrRegex(config.exclude),
|
|
1549
|
-
include: normalizedStringOrRegex(config.include),
|
|
1550
|
-
targets: config.targets
|
|
1551
|
-
};
|
|
1552
|
-
return normalizedConfig;
|
|
1553
|
-
}
|
|
1554
|
-
|
|
1555
|
-
//#endregion
|
|
1556
|
-
//#region src/plugin/builtin-plugin.ts
|
|
1557
|
-
var import_binding$4 = __toESM(require_binding());
|
|
1558
|
-
class BuiltinPlugin {
|
|
1559
|
-
constructor(name, options) {
|
|
1560
|
-
this.name = name;
|
|
1561
|
-
this.options = options;
|
|
1562
|
-
this.name = name;
|
|
1563
|
-
this.options = options;
|
|
1564
|
-
}
|
|
1565
|
-
}
|
|
1566
|
-
class ModulePreloadPolyfillPlugin extends BuiltinPlugin {
|
|
1567
|
-
constructor(config) {
|
|
1568
|
-
super(import_binding$4.BindingBuiltinPluginName.ModulePreloadPolyfillPlugin, config);
|
|
1569
|
-
}
|
|
1570
|
-
}
|
|
1571
|
-
class DynamicImportVarsPlugin extends BuiltinPlugin {
|
|
1572
|
-
constructor() {
|
|
1573
|
-
super(import_binding$4.BindingBuiltinPluginName.DynamicImportVarsPlugin);
|
|
1574
|
-
}
|
|
1575
|
-
}
|
|
1576
|
-
class ImportGlobPlugin extends BuiltinPlugin {
|
|
1577
|
-
constructor(config) {
|
|
1578
|
-
super(import_binding$4.BindingBuiltinPluginName.ImportGlobPlugin, config);
|
|
1579
|
-
}
|
|
1580
|
-
}
|
|
1581
|
-
class ManifestPlugin extends BuiltinPlugin {
|
|
1582
|
-
constructor(config) {
|
|
1583
|
-
super(import_binding$4.BindingBuiltinPluginName.ManifestPlugin, config);
|
|
1584
|
-
}
|
|
1585
|
-
}
|
|
1586
|
-
class WasmHelperPlugin extends BuiltinPlugin {
|
|
1587
|
-
constructor() {
|
|
1588
|
-
super(import_binding$4.BindingBuiltinPluginName.WasmHelperPlugin);
|
|
1589
|
-
}
|
|
1590
|
-
}
|
|
1591
|
-
class WasmFallbackPlugin extends BuiltinPlugin {
|
|
1592
|
-
constructor() {
|
|
1593
|
-
super(import_binding$4.BindingBuiltinPluginName.WasmFallbackPlugin);
|
|
1594
|
-
}
|
|
1595
|
-
}
|
|
1596
|
-
class LoadFallbackPlugin extends BuiltinPlugin {
|
|
1597
|
-
constructor() {
|
|
1598
|
-
super(import_binding$4.BindingBuiltinPluginName.LoadFallbackPlugin);
|
|
1599
|
-
}
|
|
1600
|
-
}
|
|
1601
|
-
class AliasPlugin extends BuiltinPlugin {
|
|
1602
|
-
constructor(config) {
|
|
1603
|
-
super(import_binding$4.BindingBuiltinPluginName.AliasPlugin, config);
|
|
1604
|
-
}
|
|
1605
|
-
}
|
|
1606
|
-
class TransformPlugin extends BuiltinPlugin {
|
|
1607
|
-
constructor(config) {
|
|
1608
|
-
let normalizedConfig = normalizeEcmaTransformPluginConfig(config);
|
|
1609
|
-
super(import_binding$4.BindingBuiltinPluginName.TransformPlugin, normalizedConfig);
|
|
1610
|
-
}
|
|
1611
|
-
}
|
|
1612
|
-
class JsonPlugin extends BuiltinPlugin {
|
|
1613
|
-
constructor(config) {
|
|
1614
|
-
super(import_binding$4.BindingBuiltinPluginName.JsonPlugin, config);
|
|
1615
|
-
}
|
|
1616
|
-
}
|
|
1617
|
-
class BuildImportAnalysisPlugin extends BuiltinPlugin {
|
|
1618
|
-
constructor(config) {
|
|
1619
|
-
super(import_binding$4.BindingBuiltinPluginName.BuildImportAnalysisPlugin, config);
|
|
1620
|
-
}
|
|
1621
|
-
}
|
|
1622
|
-
class ReplacePlugin extends BuiltinPlugin {
|
|
1623
|
-
constructor(config) {
|
|
1624
|
-
super(import_binding$4.BindingBuiltinPluginName.ReplacePlugin, config);
|
|
1625
|
-
}
|
|
1626
|
-
}
|
|
1627
|
-
class ReactPlugin extends BuiltinPlugin {
|
|
1628
|
-
constructor() {
|
|
1629
|
-
super(import_binding$4.BindingBuiltinPluginName.ReactPlugin);
|
|
1630
|
-
}
|
|
1631
|
-
}
|
|
1632
|
-
function modulePreloadPolyfillPlugin(config) {
|
|
1633
|
-
return new ModulePreloadPolyfillPlugin(config);
|
|
1634
|
-
}
|
|
1635
|
-
function dynamicImportVarsPlugin() {
|
|
1636
|
-
return new DynamicImportVarsPlugin();
|
|
1637
|
-
}
|
|
1638
|
-
function importGlobPlugin(config) {
|
|
1639
|
-
return new ImportGlobPlugin(config);
|
|
1640
|
-
}
|
|
1641
|
-
function manifestPlugin(config) {
|
|
1642
|
-
return new ManifestPlugin(config);
|
|
1643
|
-
}
|
|
1644
|
-
function wasmHelperPlugin() {
|
|
1645
|
-
return new WasmHelperPlugin();
|
|
1646
|
-
}
|
|
1647
|
-
function wasmFallbackPlugin() {
|
|
1648
|
-
return new WasmFallbackPlugin();
|
|
1649
|
-
}
|
|
1650
|
-
function transformPlugin(config) {
|
|
1651
|
-
return new TransformPlugin(config);
|
|
1652
|
-
}
|
|
1653
|
-
function loadFallbackPlugin() {
|
|
1654
|
-
return new LoadFallbackPlugin();
|
|
1655
|
-
}
|
|
1656
|
-
function aliasPlugin(config) {
|
|
1657
|
-
return new AliasPlugin(config);
|
|
1658
|
-
}
|
|
1659
|
-
function jsonPlugin(config) {
|
|
1660
|
-
return new JsonPlugin(config);
|
|
1661
|
-
}
|
|
1662
|
-
function buildImportAnalysisPlugin(config) {
|
|
1663
|
-
return new BuildImportAnalysisPlugin(config);
|
|
1664
|
-
}
|
|
1665
|
-
function replacePlugin(values = {}, options = {}) {
|
|
1666
|
-
return new ReplacePlugin({
|
|
1667
|
-
...options,
|
|
1668
|
-
values
|
|
1669
|
-
});
|
|
1670
|
-
}
|
|
1671
|
-
function bindingifyBuiltInPlugin(plugin) {
|
|
1672
|
-
return {
|
|
1673
|
-
__name: plugin.name,
|
|
1674
|
-
options: plugin.options
|
|
1675
|
-
};
|
|
1676
|
-
}
|
|
1677
|
-
function reactPlugin() {
|
|
1678
|
-
return new ReactPlugin();
|
|
1679
|
-
}
|
|
1680
|
-
|
|
1681
1751
|
//#endregion
|
|
1682
1752
|
//#region src/plugin/plugin-context-data.ts
|
|
1683
1753
|
class PluginContextData {
|
|
@@ -1945,63 +2015,6 @@ async function initializeWorker(registryId, pluginInfos, threadNumber) {
|
|
|
1945
2015
|
}
|
|
1946
2016
|
}
|
|
1947
2017
|
|
|
1948
|
-
//#endregion
|
|
1949
|
-
//#region src/plugin/plugin-driver.ts
|
|
1950
|
-
class PluginDriver {
|
|
1951
|
-
async callOptionsHook(inputOptions) {
|
|
1952
|
-
const logLevel = inputOptions.logLevel || LOG_LEVEL_INFO;
|
|
1953
|
-
const plugins = getObjectPlugins(inputOptions.plugins ?? []);
|
|
1954
|
-
const logger = getLogger(plugins, getOnLog(inputOptions, logLevel), logLevel);
|
|
1955
|
-
for (const plugin of plugins) {
|
|
1956
|
-
const name = plugin.name || "unknown";
|
|
1957
|
-
const options = plugin.options;
|
|
1958
|
-
if (options) {
|
|
1959
|
-
const { handler: handler } = normalizeHook(options);
|
|
1960
|
-
const result = await handler.call({
|
|
1961
|
-
debug: getLogHandler(LOG_LEVEL_DEBUG, "PLUGIN_LOG", logger, name, logLevel),
|
|
1962
|
-
error: (e) => error(logPluginError(normalizeLog(e), name, {hook: "onLog"})),
|
|
1963
|
-
info: getLogHandler(LOG_LEVEL_INFO, "PLUGIN_LOG", logger, name, logLevel),
|
|
1964
|
-
meta: {
|
|
1965
|
-
rollupVersion: "4.23.0",
|
|
1966
|
-
rolldownVersion: VERSION,
|
|
1967
|
-
watchMode: false
|
|
1968
|
-
},
|
|
1969
|
-
warn: getLogHandler(LOG_LEVEL_WARN, "PLUGIN_WARNING", logger, name, logLevel)
|
|
1970
|
-
}, inputOptions);
|
|
1971
|
-
if (result) {
|
|
1972
|
-
inputOptions = result;
|
|
1973
|
-
}
|
|
1974
|
-
}
|
|
1975
|
-
}
|
|
1976
|
-
return inputOptions;
|
|
1977
|
-
}
|
|
1978
|
-
callOutputOptionsHook(inputOptions, outputOptions) {
|
|
1979
|
-
const plugins = getObjectPlugins(inputOptions.plugins);
|
|
1980
|
-
for (const plugin of plugins) {
|
|
1981
|
-
const options = plugin.outputOptions;
|
|
1982
|
-
if (options) {
|
|
1983
|
-
const { handler: handler } = normalizeHook(options);
|
|
1984
|
-
const result = handler.call(null, outputOptions);
|
|
1985
|
-
if (result) {
|
|
1986
|
-
outputOptions = result;
|
|
1987
|
-
}
|
|
1988
|
-
}
|
|
1989
|
-
}
|
|
1990
|
-
return outputOptions;
|
|
1991
|
-
}
|
|
1992
|
-
}
|
|
1993
|
-
function getObjectPlugins(plugins) {
|
|
1994
|
-
return plugins.filter((plugin) => {
|
|
1995
|
-
if ("_parallel"in plugin) {
|
|
1996
|
-
return undefined;
|
|
1997
|
-
}
|
|
1998
|
-
if (plugin instanceof BuiltinPlugin) {
|
|
1999
|
-
return undefined;
|
|
2000
|
-
}
|
|
2001
|
-
return plugin;
|
|
2002
|
-
});
|
|
2003
|
-
}
|
|
2004
|
-
|
|
2005
2018
|
//#endregion
|
|
2006
2019
|
//#region src/utils/async-flatten.ts
|
|
2007
2020
|
async function asyncFlatten(array) {
|
|
@@ -2526,9 +2539,6 @@ function getFormat(format) {
|
|
|
2526
2539
|
case "iife": {
|
|
2527
2540
|
return "iife";
|
|
2528
2541
|
}
|
|
2529
|
-
case "app": {
|
|
2530
|
-
return "app";
|
|
2531
|
-
}
|
|
2532
2542
|
case "umd": {
|
|
2533
2543
|
return "umd";
|
|
2534
2544
|
}
|
|
@@ -2558,7 +2568,6 @@ function bindingifyOutputOptions(outputOptions) {
|
|
|
2558
2568
|
case "cjs": return "cjs";
|
|
2559
2569
|
case "iife": return "iife";
|
|
2560
2570
|
case "umd": return "umd";
|
|
2561
|
-
case "app": return "app";
|
|
2562
2571
|
}
|
|
2563
2572
|
}(),
|
|
2564
2573
|
exports,
|
|
@@ -2648,10 +2657,6 @@ class RolldownBuild {
|
|
|
2648
2657
|
const output = await bundler.write();
|
|
2649
2658
|
return transformToRollupOutput(output);
|
|
2650
2659
|
}
|
|
2651
|
-
async experimental_hmr_rebuild(changedFiles) {
|
|
2652
|
-
const { assets: assets } = await this.#bundler.bundler.hmrRebuild(changedFiles);
|
|
2653
|
-
return [assets[0].fileName, transformAssetSource(assets[0].source)];
|
|
2654
|
-
}
|
|
2655
2660
|
async close() {
|
|
2656
2661
|
const { bundler: bundler, stopWorkers: stopWorkers } = await this.#getBundlerWithStopWorker({});
|
|
2657
2662
|
await stopWorkers?.();
|
|
@@ -2740,7 +2745,7 @@ const experimental_scan = async (input) => {
|
|
|
2740
2745
|
|
|
2741
2746
|
//#endregion
|
|
2742
2747
|
//#region package.json
|
|
2743
|
-
const version = "0.
|
|
2748
|
+
const version = "0.14.0";
|
|
2744
2749
|
const description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
|
|
2745
2750
|
|
|
2746
2751
|
//#endregion
|
|
@@ -2769,7 +2774,6 @@ exports.jsonPlugin = jsonPlugin;
|
|
|
2769
2774
|
exports.loadFallbackPlugin = loadFallbackPlugin;
|
|
2770
2775
|
exports.manifestPlugin = manifestPlugin;
|
|
2771
2776
|
exports.modulePreloadPolyfillPlugin = modulePreloadPolyfillPlugin;
|
|
2772
|
-
exports.reactPlugin = reactPlugin;
|
|
2773
2777
|
exports.replacePlugin = replacePlugin;
|
|
2774
2778
|
exports.require_binding = require_binding;
|
|
2775
2779
|
exports.rolldown = rolldown;
|