Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
ahabhgk committed Oct 15, 2024
1 parent 233e811 commit 42b3d03
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions crates/node_binding/binding.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1409,6 +1409,7 @@ export interface RawIncremental {
emitAssets: boolean
inferAsyncModules: boolean
providedExports: boolean
collectModuleDiagnostics: boolean
moduleHashes: boolean
moduleCodegen: boolean
moduleRuntimeRequirements: boolean
Expand Down
1 change: 1 addition & 0 deletions crates/rspack_binding_options/src/options/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ impl TryFrom<RawOptions> for CompilerOptions {
emit_assets: value.emit_assets,
infer_async_modules: value.infer_async_modules,
provided_exports: value.provided_exports,
collect_module_diagnostics: value.collect_module_diagnostics,
module_hashes: value.module_hashes,
module_codegen: value.module_codegen,
module_runtime_requirements: value.module_runtime_requirements,
Expand Down
2 changes: 2 additions & 0 deletions crates/rspack_binding_options/src/options/raw_experiments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ pub struct RawIncremental {
pub emit_assets: bool,
pub infer_async_modules: bool,
pub provided_exports: bool,
pub collect_module_diagnostics: bool,
pub module_hashes: bool,
pub module_codegen: bool,
pub module_runtime_requirements: bool,
Expand All @@ -29,6 +30,7 @@ impl From<RawIncremental> for Incremental {
emit_assets: value.emit_assets,
infer_async_modules: value.infer_async_modules,
provided_exports: value.provided_exports,
collect_module_diagnostics: value.collect_module_diagnostics,
module_hashes: value.module_hashes,
module_codegen: value.module_codegen,
module_runtime_requirements: value.module_runtime_requirements,
Expand Down
2 changes: 2 additions & 0 deletions crates/rspack_core/src/compiler/compilation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ pub struct Compilation {
pub named_chunk_groups: HashMap<String, ChunkGroupUkey>,

pub async_modules: IdentifierSet,
pub module_diagnostics: IdentifierMap<Diagnostic>,
pub code_generation_results: CodeGenerationResults,
pub cgm_hash_results: CgmHashResults,
pub cgm_runtime_requirements_results: CgmRuntimeRequirementsResults,
Expand Down Expand Up @@ -266,6 +267,7 @@ impl Compilation {
named_chunk_groups: Default::default(),

async_modules: Default::default(),
module_diagnostics: Default::default(),
code_generation_results: Default::default(),
cgm_hash_results: Default::default(),
cgm_runtime_requirements_results: Default::default(),
Expand Down
5 changes: 5 additions & 0 deletions crates/rspack_core/src/options/experiments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pub enum Incremental {
emit_assets: bool,
infer_async_modules: bool,
provided_exports: bool,
collect_module_diagnostics: bool,
module_hashes: bool,
module_codegen: bool,
module_runtime_requirements: bool,
Expand Down Expand Up @@ -45,6 +46,10 @@ impl Incremental {
matches!(self, Incremental::Enabled { provided_exports, .. } if *provided_exports)
}

pub fn collect_module_diagnostics_enabled(&self) -> bool {
matches!(self, Incremental::Enabled { collect_module_diagnostics, .. } if *collect_module_diagnostics)
}

pub fn module_hashes_enabled(&self) -> bool {
matches!(self, Incremental::Enabled { module_hashes, .. } if *module_hashes)
}
Expand Down
1 change: 1 addition & 0 deletions packages/rspack-test-tools/src/case/new-incremental.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ const watchCreator = new BasicCaseCreator({
emitAssets: true,
inferAsyncModules: true,
providedExports: true,
collectModuleDiagnostics: true,
moduleHashes: true,
moduleCodegen: true,
moduleRuntimeRequirements: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export class HotNewIncrementalProcessor<
emitAssets: true,
inferAsyncModules: true,
providedExports: true,
collectModuleDiagnostics: true,
moduleHashes: true,
moduleCodegen: true,
moduleRuntimeRequirements: true
Expand Down
15 changes: 15 additions & 0 deletions packages/rspack/etc/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2264,6 +2264,7 @@ const experiments_2: z.ZodObject<{
emitAssets: z.ZodOptional<z.ZodBoolean>;
inferAsyncModules: z.ZodOptional<z.ZodBoolean>;
providedExports: z.ZodOptional<z.ZodBoolean>;
collectModuleDiagnostics: z.ZodOptional<z.ZodBoolean>;
moduleHashes: z.ZodOptional<z.ZodBoolean>;
moduleCodegen: z.ZodOptional<z.ZodBoolean>;
moduleRuntimeRequirements: z.ZodOptional<z.ZodBoolean>;
Expand All @@ -2272,6 +2273,7 @@ const experiments_2: z.ZodObject<{
providedExports?: boolean | undefined;
emitAssets?: boolean | undefined;
inferAsyncModules?: boolean | undefined;
collectModuleDiagnostics?: boolean | undefined;
moduleHashes?: boolean | undefined;
moduleCodegen?: boolean | undefined;
moduleRuntimeRequirements?: boolean | undefined;
Expand All @@ -2280,6 +2282,7 @@ const experiments_2: z.ZodObject<{
providedExports?: boolean | undefined;
emitAssets?: boolean | undefined;
inferAsyncModules?: boolean | undefined;
collectModuleDiagnostics?: boolean | undefined;
moduleHashes?: boolean | undefined;
moduleCodegen?: boolean | undefined;
moduleRuntimeRequirements?: boolean | undefined;
Expand Down Expand Up @@ -2342,6 +2345,7 @@ const experiments_2: z.ZodObject<{
providedExports?: boolean | undefined;
emitAssets?: boolean | undefined;
inferAsyncModules?: boolean | undefined;
collectModuleDiagnostics?: boolean | undefined;
moduleHashes?: boolean | undefined;
moduleCodegen?: boolean | undefined;
moduleRuntimeRequirements?: boolean | undefined;
Expand Down Expand Up @@ -2384,6 +2388,7 @@ const experiments_2: z.ZodObject<{
providedExports?: boolean | undefined;
emitAssets?: boolean | undefined;
inferAsyncModules?: boolean | undefined;
collectModuleDiagnostics?: boolean | undefined;
moduleHashes?: boolean | undefined;
moduleCodegen?: boolean | undefined;
moduleRuntimeRequirements?: boolean | undefined;
Expand Down Expand Up @@ -3338,6 +3343,7 @@ const incremental: z.ZodObject<{
emitAssets: z.ZodOptional<z.ZodBoolean>;
inferAsyncModules: z.ZodOptional<z.ZodBoolean>;
providedExports: z.ZodOptional<z.ZodBoolean>;
collectModuleDiagnostics: z.ZodOptional<z.ZodBoolean>;
moduleHashes: z.ZodOptional<z.ZodBoolean>;
moduleCodegen: z.ZodOptional<z.ZodBoolean>;
moduleRuntimeRequirements: z.ZodOptional<z.ZodBoolean>;
Expand All @@ -3346,6 +3352,7 @@ const incremental: z.ZodObject<{
providedExports?: boolean | undefined;
emitAssets?: boolean | undefined;
inferAsyncModules?: boolean | undefined;
collectModuleDiagnostics?: boolean | undefined;
moduleHashes?: boolean | undefined;
moduleCodegen?: boolean | undefined;
moduleRuntimeRequirements?: boolean | undefined;
Expand All @@ -3354,6 +3361,7 @@ const incremental: z.ZodObject<{
providedExports?: boolean | undefined;
emitAssets?: boolean | undefined;
inferAsyncModules?: boolean | undefined;
collectModuleDiagnostics?: boolean | undefined;
moduleHashes?: boolean | undefined;
moduleCodegen?: boolean | undefined;
moduleRuntimeRequirements?: boolean | undefined;
Expand Down Expand Up @@ -9257,6 +9265,7 @@ export const rspackOptions: z.ZodObject<{
emitAssets: z.ZodOptional<z.ZodBoolean>;
inferAsyncModules: z.ZodOptional<z.ZodBoolean>;
providedExports: z.ZodOptional<z.ZodBoolean>;
collectModuleDiagnostics: z.ZodOptional<z.ZodBoolean>;
moduleHashes: z.ZodOptional<z.ZodBoolean>;
moduleCodegen: z.ZodOptional<z.ZodBoolean>;
moduleRuntimeRequirements: z.ZodOptional<z.ZodBoolean>;
Expand All @@ -9265,6 +9274,7 @@ export const rspackOptions: z.ZodObject<{
providedExports?: boolean | undefined;
emitAssets?: boolean | undefined;
inferAsyncModules?: boolean | undefined;
collectModuleDiagnostics?: boolean | undefined;
moduleHashes?: boolean | undefined;
moduleCodegen?: boolean | undefined;
moduleRuntimeRequirements?: boolean | undefined;
Expand All @@ -9273,6 +9283,7 @@ export const rspackOptions: z.ZodObject<{
providedExports?: boolean | undefined;
emitAssets?: boolean | undefined;
inferAsyncModules?: boolean | undefined;
collectModuleDiagnostics?: boolean | undefined;
moduleHashes?: boolean | undefined;
moduleCodegen?: boolean | undefined;
moduleRuntimeRequirements?: boolean | undefined;
Expand Down Expand Up @@ -9335,6 +9346,7 @@ export const rspackOptions: z.ZodObject<{
providedExports?: boolean | undefined;
emitAssets?: boolean | undefined;
inferAsyncModules?: boolean | undefined;
collectModuleDiagnostics?: boolean | undefined;
moduleHashes?: boolean | undefined;
moduleCodegen?: boolean | undefined;
moduleRuntimeRequirements?: boolean | undefined;
Expand Down Expand Up @@ -9377,6 +9389,7 @@ export const rspackOptions: z.ZodObject<{
providedExports?: boolean | undefined;
emitAssets?: boolean | undefined;
inferAsyncModules?: boolean | undefined;
collectModuleDiagnostics?: boolean | undefined;
moduleHashes?: boolean | undefined;
moduleCodegen?: boolean | undefined;
moduleRuntimeRequirements?: boolean | undefined;
Expand Down Expand Up @@ -11545,6 +11558,7 @@ export const rspackOptions: z.ZodObject<{
providedExports?: boolean | undefined;
emitAssets?: boolean | undefined;
inferAsyncModules?: boolean | undefined;
collectModuleDiagnostics?: boolean | undefined;
moduleHashes?: boolean | undefined;
moduleCodegen?: boolean | undefined;
moduleRuntimeRequirements?: boolean | undefined;
Expand Down Expand Up @@ -12143,6 +12157,7 @@ export const rspackOptions: z.ZodObject<{
providedExports?: boolean | undefined;
emitAssets?: boolean | undefined;
inferAsyncModules?: boolean | undefined;
collectModuleDiagnostics?: boolean | undefined;
moduleHashes?: boolean | undefined;
moduleCodegen?: boolean | undefined;
moduleRuntimeRequirements?: boolean | undefined;
Expand Down
1 change: 1 addition & 0 deletions packages/rspack/src/config/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,7 @@ function getRawIncremental(
emitAssets: incremental.emitAssets!,
inferAsyncModules: incremental.inferAsyncModules!,
providedExports: incremental.providedExports!,
collectModuleDiagnostics: incremental.collectModuleDiagnostics!,
moduleHashes: incremental.moduleHashes!,
moduleCodegen: incremental.moduleCodegen!,
moduleRuntimeRequirements: incremental.moduleRuntimeRequirements!
Expand Down
1 change: 1 addition & 0 deletions packages/rspack/src/config/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ const applyExperimentsDefaults = (experiments: ExperimentsNormalized) => {
D(experiments.incremental, "emitAssets", true);
D(experiments.incremental, "inferAsyncModules", false);
D(experiments.incremental, "providedExports", false);
D(experiments.incremental, "collectModuleDiagnostics", false);
D(experiments.incremental, "moduleHashes", false);
D(experiments.incremental, "moduleCodegen", false);
D(experiments.incremental, "moduleRuntimeRequirements", false);
Expand Down
1 change: 1 addition & 0 deletions packages/rspack/src/config/zod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1331,6 +1331,7 @@ const incremental = z.strictObject({
emitAssets: z.boolean().optional(),
inferAsyncModules: z.boolean().optional(),
providedExports: z.boolean().optional(),
collectModuleDiagnostics: z.boolean().optional(),
moduleHashes: z.boolean().optional(),
moduleCodegen: z.boolean().optional(),
moduleRuntimeRequirements: z.boolean().optional()
Expand Down

0 comments on commit 42b3d03

Please sign in to comment.