Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions crates/node_binding/napi-binding.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2132,7 +2132,6 @@ export interface RawExperimentCacheOptionsPersistent {
export interface RawExperiments {
topLevelAwait: boolean
incremental?: false | { [key: string]: boolean }
rspackFuture?: RawRspackFuture
cache: boolean | { type: "persistent" } & RawExperimentCacheOptionsPersistent | { type: "memory" }
useInputFileSystem?: false | Array<RegExp>
css?: boolean
Expand Down Expand Up @@ -2781,10 +2780,6 @@ export interface RawRslibPluginOptions {
forceNodeShims?: boolean
}

export interface RawRspackFuture {

}

export interface RawRstestPluginOptions {
injectModulePathName: boolean
importMetaPathName: boolean
Expand Down
10 changes: 2 additions & 8 deletions crates/rspack/src/builder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ use rspack_core::{
MangleExportsOption, Mode, ModuleNoParseRules, ModuleOptions, ModuleRule, ModuleRuleEffect,
ModuleType, NodeDirnameOption, NodeFilenameOption, NodeGlobalOption, NodeOption, Optimization,
OutputOptions, ParseOption, ParserOptions, ParserOptionsMap, PathInfo, PublicPath, Resolve,
RspackFuture, RuleSetCondition, RuleSetLogicalConditions, SideEffectOption, StatsOptions,
TrustedTypes, UnsafeCachePredicate, UsedExportsOption, WasmLoading, WasmLoadingType,
RuleSetCondition, RuleSetLogicalConditions, SideEffectOption, StatsOptions, TrustedTypes,
UnsafeCachePredicate, UsedExportsOption, WasmLoading, WasmLoadingType,
incremental::{IncrementalOptions, IncrementalPasses},
};
use rspack_error::{Error, Result};
Expand Down Expand Up @@ -3686,8 +3686,6 @@ pub struct ExperimentsBuilder {
incremental: Option<IncrementalOptions>,
/// Whether to enable top level await.
top_level_await: Option<bool>,
/// Rspack future.
rspack_future: Option<RspackFuture>,
/// Cache options.
cache: Option<ExperimentCacheOptions>,
/// Whether to enable output module.
Expand All @@ -3706,7 +3704,6 @@ impl From<Experiments> for ExperimentsBuilder {
ExperimentsBuilder {
incremental: Some(value.incremental),
top_level_await: Some(value.top_level_await),
rspack_future: Some(value.rspack_future),
cache: Some(value.cache),
output_module: None,
future_defaults: None,
Expand All @@ -3721,7 +3718,6 @@ impl From<&mut ExperimentsBuilder> for ExperimentsBuilder {
ExperimentsBuilder {
incremental: value.incremental.take(),
top_level_await: value.top_level_await.take(),
rspack_future: value.rspack_future.take(),
cache: value.cache.take(),
output_module: value.output_module.take(),
future_defaults: value.future_defaults.take(),
Expand Down Expand Up @@ -3796,7 +3792,6 @@ impl ExperimentsBuilder {
ExperimentCacheOptions::Disabled
}
});
let rspack_future = d!(self.rspack_future.take(), RspackFuture {});

// Builder specific
let future_defaults = w!(self.future_defaults, false);
Expand All @@ -3807,7 +3802,6 @@ impl ExperimentsBuilder {
Ok(Experiments {
incremental,
top_level_await,
rspack_future,
cache,
css: d!(self.css, false),
lazy_barrel: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1513,7 +1513,6 @@ CompilerOptions {
),
},
top_level_await: true,
rspack_future: RspackFuture,
cache: Disabled,
css: false,
lazy_barrel: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
mod raw_cache;
mod raw_incremental;
mod raw_rspack_future;

use napi_derive::napi;
use raw_cache::{RawExperimentCacheOptions, normalize_raw_experiment_cache_options};
use raw_incremental::RawIncremental;
use raw_rspack_future::RawRspackFuture;
use rspack_core::{Experiments, incremental::IncrementalOptions};
use rspack_regex::RspackRegex;

Expand All @@ -17,7 +15,6 @@ pub struct RawExperiments {
pub top_level_await: bool,
#[napi(ts_type = "false | { [key: string]: boolean }")]
pub incremental: Option<WithFalse<RawIncremental>>,
pub rspack_future: Option<RawRspackFuture>,
#[napi(
ts_type = r#"boolean | { type: "persistent" } & RawExperimentCacheOptionsPersistent | { type: "memory" }"#
)]
Expand All @@ -40,7 +37,6 @@ impl From<RawExperiments> for Experiments {
None => IncrementalOptions::empty_passes(),
},
top_level_await: value.top_level_await,
rspack_future: value.rspack_future.unwrap_or_default().into(),
cache: normalize_raw_experiment_cache_options(value.cache),
css: value.css.unwrap_or(false),
lazy_barrel: value.lazy_barrel,
Expand Down

This file was deleted.

5 changes: 0 additions & 5 deletions crates/rspack_core/src/options/experiments/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,8 @@ use crate::incremental::IncrementalOptions;
pub struct Experiments {
pub incremental: IncrementalOptions,
pub top_level_await: bool,
pub rspack_future: RspackFuture,
pub cache: ExperimentCacheOptions,
pub css: bool,
pub lazy_barrel: bool,
pub defer_import: bool,
}

#[allow(clippy::empty_structs_with_brackets)]
#[derive(Debug)]
pub struct RspackFuture {}
8 changes: 3 additions & 5 deletions packages/rspack-test-tools/src/case/builtin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ export function defaultOptions(context: ITestContext): RspackOptions {
webassemblyModuleFilename: '[hash].module.wasm',
workerChunkLoading: 'import-scripts',
workerWasmLoading: 'fetch',
bundlerInfo: {
force: false,
},
},
module: {
rules: [
Expand Down Expand Up @@ -144,11 +147,6 @@ export function defaultOptions(context: ITestContext): RspackOptions {
experiments: {
css: true,
futureDefaults: true,
rspackFuture: {
bundlerInfo: {
force: false,
},
},
},
devtool: false,
context: context.getSource(),
Expand Down
8 changes: 3 additions & 5 deletions packages/rspack-test-tools/src/case/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ async function generateOptions(
chunkFilename: '[name].chunk.[fullhash].js',
publicPath: 'https://test.cases/path/',
library: { type: 'commonjs2' },
bundlerInfo: {
force: false,
},
},
optimization: {
moduleIds: 'named',
Expand All @@ -130,11 +133,6 @@ async function generateOptions(
target,
experiments: {
css: true,
rspackFuture: {
bundlerInfo: {
force: false,
},
},
},
} as RspackOptions;

Expand Down
8 changes: 3 additions & 5 deletions packages/rspack-test-tools/src/case/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,15 @@ export function defaultOptions(
cache: false,
output: {
path: context.getDist(),
bundlerInfo: {
force: false,
},
},
optimization: {
minimize: false,
},
experiments: {
css: true,
rspackFuture: {
bundlerInfo: {
force: false,
},
},
},
};
}
Expand Down
3 changes: 1 addition & 2 deletions packages/rspack-test-tools/src/case/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ export function getRspackDefaultConfig(
const normalizedConfig = getNormalizedWebpackOptions(config);
applyWebpackOptionsDefaults(normalizedConfig);
// make snapshot stable
(normalizedConfig as any).experiments.rspackFuture.bundlerInfo.version =
'$version$';
(normalizedConfig as any).output.bundlerInfo.version = '$version$';
process.chdir(CURRENT_CWD);
return normalizedConfig;
}
Expand Down
8 changes: 3 additions & 5 deletions packages/rspack-test-tools/src/case/diagnostic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,12 @@ function defaultOptions(context: ITestContext): RspackOptions {
},
output: {
path: context.getDist(),
bundlerInfo: {
force: false,
},
},
experiments: {
css: true,
rspackFuture: {
bundlerInfo: {
force: false,
},
},
},
} as RspackOptions;
}
Expand Down
10 changes: 5 additions & 5 deletions packages/rspack-test-tools/src/case/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@ function options(
moduleIds: 'named',
chunkIds: 'named',
},
otuput: {
bundlerInfo: {
force: false,
},
},
experiments: {
css: true,
rspackFuture: {
bundlerInfo: {
force: false,
},
},
},
} as RspackOptions;
if (typeof custom === 'function') {
Expand Down
8 changes: 3 additions & 5 deletions packages/rspack-test-tools/src/case/esm-output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ const defaultOptions = (
filename: '[name].mjs',
pathinfo: true,
module: true,
bundlerInfo: {
force: false,
},
},
bail: true,
optimization: {
Expand All @@ -128,11 +131,6 @@ const defaultOptions = (
plugins: [new rspack.experiments.EsmLibraryPlugin()],
experiments: {
css: true,
rspackFuture: {
bundlerInfo: {
force: false,
},
},
outputModule: true,
},
});
Expand Down
8 changes: 3 additions & 5 deletions packages/rspack-test-tools/src/case/hash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,12 @@ function defaultOptions(index: number, context: ITestContext): RspackOptions {
context: context.getSource(),
output: {
path: context.getDist(),
bundlerInfo: {
force: false,
},
},
experiments: {
css: true,
rspackFuture: {
bundlerInfo: {
force: false,
},
},
},
};
}
Expand Down
8 changes: 3 additions & 5 deletions packages/rspack-test-tools/src/case/hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,17 +264,15 @@ function defaultOptions(
entry: './hook',
output: {
path: context.getDist(),
bundlerInfo: {
force: false,
},
},
optimization: {
minimize: false,
},
experiments: {
css: true,
rspackFuture: {
bundlerInfo: {
force: false,
},
},
},
} as RspackOptions;
if (custom) {
Expand Down
8 changes: 3 additions & 5 deletions packages/rspack-test-tools/src/case/hot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ function defaultOptions(context: ITestContext, target: TTarget) {
chunkFilename: '[name].chunk.[fullhash].js',
publicPath: 'https://test.cases/path/',
library: { type: 'commonjs2' },
bundlerInfo: {
force: false,
},
},
optimization: {
moduleIds: 'named',
Expand All @@ -147,11 +150,6 @@ function defaultOptions(context: ITestContext, target: TTarget) {
css: true,
// test incremental: "safe" here, we test default incremental in Incremental-*.test.js
incremental: 'safe',
rspackFuture: {
bundlerInfo: {
force: false,
},
},
},
} as RspackOptions;

Expand Down
8 changes: 3 additions & 5 deletions packages/rspack-test-tools/src/case/normal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ function defaultOptions(
pathinfo: 'verbose',
path: context.getDist(),
filename: compilerOptions?.module ? 'bundle.mjs' : 'bundle.js',
bundlerInfo: {
force: false,
},
},
resolve: {
modules: ['web_modules', 'node_modules'],
Expand Down Expand Up @@ -221,11 +224,6 @@ function defaultOptions(
}),
experiments: {
css: false,
rspackFuture: {
bundlerInfo: {
force: false,
},
},
asyncWebAssembly: true,
topLevelAwait: true,
// CHANGE: rspack does not support `backCompat` yet.
Expand Down
6 changes: 3 additions & 3 deletions packages/rspack-test-tools/src/case/stats-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ function options(
const res = (custom?.(context) || {}) as RspackOptions;
res.experiments ??= {};
res.experiments!.css ??= true;
res.experiments!.rspackFuture ??= {};
res.experiments!.rspackFuture!.bundlerInfo ??= {};
res.experiments!.rspackFuture!.bundlerInfo!.force ??= false;
res.output ??= {};
res.output!.bundlerInfo ??= {};
res.output!.bundlerInfo!.force ??= false;
if (!global.printLogger) {
res.infrastructureLogging = {
level: 'error',
Expand Down
Loading
Loading