Visitar URL original
feat: add experimental.lazyBarrel option · rolldown/rolldown@94bf52d · GitHub
Skip to content

Commit 94bf52d

Browse files
committed
feat: add experimental.lazyBarrel option
1 parent 35fb9e7 commit 94bf52d

7 files changed

Lines changed: 23 additions & 2 deletions

File tree

‎crates/rolldown_binding/src/options/binding_input_options/binding_experimental_options.rs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ pub struct BindingExperimentalOptions {
1515
pub transform_hires_sourcemap: Option<Either<bool, String>>,
1616
pub native_magic_string: Option<bool>,
1717
pub chunk_optimization: Option<bool>,
18+
pub lazy_barrel: Option<bool>,
1819
}
1920

2021
impl TryFrom<BindingExperimentalOptions> for rolldown_common::ExperimentalOptions {
@@ -52,6 +53,7 @@ impl TryFrom<BindingExperimentalOptions> for rolldown_common::ExperimentalOption
5253
},
5354
native_magic_string: value.native_magic_string,
5455
chunk_optimization: value.chunk_optimization,
56+
lazy_barrel: value.lazy_barrel,
5557
})
5658
}
5759
}

‎crates/rolldown_common/src/inner_bundler_options/types/experimental_options.rs‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ use schemars::JsonSchema;
33
#[cfg(feature = "deserialize_bundler_options")]
44
use serde::Deserialize;
55

6-
use crate::inner_bundler_options::types::chunk_import_map::ChunkImportMap;
7-
86
use super::attach_debug_info::AttachDebugInfo;
7+
use super::chunk_import_map::ChunkImportMap;
98
use super::chunk_modules_order::ChunkModulesOrderBy;
109
use super::dev_mode_options::DevModeOptions;
1110

@@ -51,6 +50,7 @@ pub struct ExperimentalOptions {
5150
pub transform_hires_sourcemap: Option<SourcemapHires>,
5251
pub native_magic_string: Option<bool>,
5352
pub chunk_optimization: Option<bool>,
53+
pub lazy_barrel: Option<bool>,
5454
}
5555

5656
impl ExperimentalOptions {
@@ -82,4 +82,8 @@ impl ExperimentalOptions {
8282
pub fn is_chunk_optimization_enabled(&self) -> bool {
8383
self.chunk_optimization.unwrap_or(true)
8484
}
85+
86+
pub fn is_lazy_barrel_enabled(&self) -> bool {
87+
self.lazy_barrel.unwrap_or(false)
88+
}
8589
}

‎crates/rolldown_testing/_config.schema.json‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,6 +1036,12 @@
10361036
"boolean",
10371037
"null"
10381038
]
1039+
},
1040+
"lazyBarrel": {
1041+
"type": [
1042+
"boolean",
1043+
"null"
1044+
]
10391045
}
10401046
},
10411047
"additionalProperties": false

‎packages/rolldown/src/binding.d.cts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1861,6 +1861,7 @@ export interface BindingExperimentalOptions {
18611861
transformHiresSourcemap?: boolean | 'boundary'
18621862
nativeMagicString?: boolean
18631863
chunkOptimization?: boolean
1864+
lazyBarrel?: boolean
18641865
}
18651866

18661867
export interface BindingFilterToken {

‎packages/rolldown/src/options/input-options.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,12 @@ export interface InputOptions {
614614
* @default true
615615
*/
616616
chunkOptimization?: boolean;
617+
/**
618+
* Control whether to enable lazy barrel optimization.
619+
*
620+
* @default false
621+
*/
622+
lazyBarrel?: boolean;
617623
};
618624
/**
619625
* Configure how the code is transformed. This process happens after the `transform` hook.

‎packages/rolldown/src/utils/bindingify-input-options.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ function bindingifyExperimental(
180180
incrementalBuild: experimental?.incrementalBuild,
181181
nativeMagicString: experimental?.nativeMagicString,
182182
chunkOptimization: experimental?.chunkOptimization,
183+
lazyBarrel: experimental?.lazyBarrel,
183184
};
184185
}
185186

‎packages/rolldown/src/utils/validator.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,7 @@ const InputOptionsSchema = v.strictObject({
489489
),
490490
nativeMagicString: v.optional(v.boolean()),
491491
chunkOptimization: v.optional(v.boolean()),
492+
lazyBarrel: v.optional(v.boolean()),
492493
}),
493494
),
494495
transform: v.optional(TransformOptionsSchema),

0 commit comments

Comments
 (0)