From 09fd1f1d4cae4cf2b57d82d27aee8eb424f33198 Mon Sep 17 00:00:00 2001 From: harpsealjs Date: Tue, 20 May 2025 17:18:28 +0800 Subject: [PATCH 01/50] fix: mangle destructuring properties of esm specifier dependencies (#10423) fix: should mangle destructuring properties of esm specifier dependencies --- .../src/dependency/dependency_location.rs | 2 +- .../esm/esm_import_specifier_dependency.rs | 78 +++++++++-- .../src/parser_plugin/define_plugin/parser.rs | 13 +- .../esm_import_dependency_parser_plugin.rs | 15 +-- .../src/parser_plugin/import_meta_plugin.rs | 8 +- .../src/parser_plugin/import_parser_plugin.rs | 2 +- .../src/visitors/dependency/mod.rs | 5 +- .../src/visitors/dependency/parser/mod.rs | 22 +++- .../visitors/dependency/parser/walk_pre.rs | 25 +++- crates/rspack_plugin_json/src/lib.rs | 2 +- .../ConfigTestCases.basictest.js.snap | 123 ++++++++++++++++++ .../prefer-relative-css-import/test.filter.js | 2 - .../css/prefer-relative/test.filter.js | 2 - .../configCases/css/pseudo-export/index.js | 6 +- .../css/pseudo-export/test.filter.js | 2 +- .../css/pseudo-import/test.filter.js | 2 - .../css/runtime-issue/test.filter.js | 2 - .../configCases/css/url/test.filter.js | 2 +- .../css/webpack-ignore/test.filter.js | 2 +- .../configCases/json/proto/test.filter.js | 2 - .../mangle/exports-info-can-mangle/index.js | 2 +- .../exports-info-can-mangle/test.filter.js | 3 +- .../require-resolve-ignore/test.filter.js | 2 +- 23 files changed, 264 insertions(+), 60 deletions(-) delete mode 100644 tests/webpack-test/configCases/css/prefer-relative-css-import/test.filter.js delete mode 100644 tests/webpack-test/configCases/css/prefer-relative/test.filter.js delete mode 100644 tests/webpack-test/configCases/css/pseudo-import/test.filter.js delete mode 100644 tests/webpack-test/configCases/css/runtime-issue/test.filter.js delete mode 100644 tests/webpack-test/configCases/json/proto/test.filter.js diff --git a/crates/rspack_core/src/dependency/dependency_location.rs b/crates/rspack_core/src/dependency/dependency_location.rs index ea8871964ba4..a6bd565145e6 100644 --- a/crates/rspack_core/src/dependency/dependency_location.rs +++ b/crates/rspack_core/src/dependency/dependency_location.rs @@ -9,7 +9,7 @@ use rspack_util::itoa; /// Represents a range in a dependency, typically used for tracking the span of code in a source file. /// It stores the start and end positions (as offsets) of the range, typically using base-0 indexing. #[cacheable] -#[derive(Debug, Clone, Hash)] +#[derive(Debug, Clone, Hash, Eq, PartialEq)] pub struct DependencyRange { pub end: u32, pub start: u32, diff --git a/crates/rspack_plugin_javascript/src/dependency/esm/esm_import_specifier_dependency.rs b/crates/rspack_plugin_javascript/src/dependency/esm/esm_import_specifier_dependency.rs index dcc5daaae5e3..c94e72f04d31 100644 --- a/crates/rspack_plugin_javascript/src/dependency/esm/esm_import_specifier_dependency.rs +++ b/crates/rspack_plugin_javascript/src/dependency/esm/esm_import_specifier_dependency.rs @@ -1,6 +1,6 @@ use rspack_cacheable::{ cacheable, cacheable_dyn, - with::{AsOption, AsPreset, AsVec, Skip}, + with::{AsCacheable, AsOption, AsPreset, AsVec, Skip}, }; use rspack_collections::IdentifierSet; use rspack_core::{ @@ -9,8 +9,8 @@ use rspack_core::{ DependencyCategory, DependencyCodeGeneration, DependencyCondition, DependencyId, DependencyLocation, DependencyRange, DependencyTemplate, DependencyTemplateType, DependencyType, ExportPresenceMode, ExportsType, ExtendedReferencedExport, FactorizeInfo, ImportAttributes, - JavascriptParserOptions, ModuleDependency, ModuleGraph, ModuleReferenceOptions, ReferencedExport, - RuntimeSpec, SharedSourceMap, TemplateContext, TemplateReplaceSource, UsedByExports, + JavascriptParserOptions, ModuleDependency, ModuleGraph, ModuleReferenceOptions, RuntimeSpec, + SharedSourceMap, Template, TemplateContext, TemplateReplaceSource, UsedByExports, UsedName, }; use rspack_error::Diagnostic; use rustc_hash::FxHashSet as HashSet; @@ -20,6 +20,7 @@ use super::{ create_resource_identifier_for_esm_dependency, esm_import_dependency::esm_import_dependency_get_linking_error, esm_import_dependency_apply, }; +use crate::visitors::DestructuringAssignmentProperty; #[cacheable] #[derive(Debug, Clone)] @@ -38,8 +39,8 @@ pub struct ESMImportSpecifierDependency { call: bool, direct_import: bool, used_by_exports: Option, - #[cacheable(with=AsOption>)] - referenced_properties_in_destructuring: Option>, + #[cacheable(with=AsOption>)] + referenced_properties_in_destructuring: Option>, resource_identifier: String, export_presence_mode: ExportPresenceMode, attributes: Option, @@ -62,7 +63,7 @@ impl ESMImportSpecifierDependency { call: bool, direct_import: bool, export_presence_mode: ExportPresenceMode, - referenced_properties_in_destructuring: Option>, + referenced_properties_in_destructuring: Option>, attributes: Option, source_map: Option, ) -> Self { @@ -106,13 +107,13 @@ impl ESMImportSpecifierDependency { .map(|prop| { if let Some(v) = ids { let mut value = v.to_vec(); - value.push(prop.clone()); - ReferencedExport::new(value, false) + value.push(prop.id.clone()); + value } else { - ReferencedExport::new(vec![prop.clone()], false) + vec![prop.id.clone()] } }) - .map(ExtendedReferencedExport::Export) + .map(ExtendedReferencedExport::Array) .collect::>() } else if let Some(v) = ids { vec![ExtendedReferencedExport::Array(v.to_vec())] @@ -400,5 +401,62 @@ impl DependencyTemplate for ESMImportSpecifierDependencyTemplate { } else { source.replace(dep.range.start, dep.range.end, export_expr.as_str(), None); } + + let module_graph = code_generatable_context.compilation.get_module_graph(); + if let Some(referenced_properties) = &dep.referenced_properties_in_destructuring { + let mut prefixed_ids = ids.to_vec(); + + let module = module_graph + .get_module_by_dependency_id(&dep.id) + .expect("should have imported module"); + + if ids.first().is_some_and(|id| id == "default") { + let self_module = module_graph + .get_parent_module(&dep.id) + .and_then(|id| module_graph.module_by_identifier(id)) + .expect("should have parent module"); + let exports_type = + module.get_exports_type(&module_graph, self_module.build_meta().strict_esm_module); + if matches!( + exports_type, + ExportsType::DefaultOnly | ExportsType::DefaultWithNamed + ) && !ids.is_empty() + { + prefixed_ids = ids[1..].to_vec(); + } + } + + for prop in referenced_properties { + let mut concated_ids = prefixed_ids.clone(); + concated_ids.push(prop.id.clone()); + let Some(new_name) = module_graph + .get_exports_info(&module.identifier()) + .get_used_name( + &module_graph, + code_generatable_context.runtime, + UsedName::Vec(concated_ids), + ) + .and_then(|used| match used { + UsedName::Str(name) => Some(name), + UsedName::Vec(names) => names.last().cloned(), + }) + else { + return; + }; + + if new_name == prop.id { + continue; + } + + let comment = Template::to_normal_comment(prop.id.as_str()); + let key = format!("{}{}", comment, new_name); + let content = if prop.shorthand { + format!("{key}: {}", prop.id) + } else { + key + }; + source.replace(prop.range.start, prop.range.end, &content, None); + } + } } } diff --git a/crates/rspack_plugin_javascript/src/parser_plugin/define_plugin/parser.rs b/crates/rspack_plugin_javascript/src/parser_plugin/define_plugin/parser.rs index 20ff160ae267..24e7b542f61c 100644 --- a/crates/rspack_plugin_javascript/src/parser_plugin/define_plugin/parser.rs +++ b/crates/rspack_plugin_javascript/src/parser_plugin/define_plugin/parser.rs @@ -16,7 +16,7 @@ use swc_core::common::{Span, Spanned as _}; use super::DefineValue; use crate::{ utils::eval::{evaluate_to_string, BasicEvaluatedExpression}, - visitors::JavascriptParser, + visitors::{DestructuringAssignmentProperty, JavascriptParser}, JavascriptParserPlugin, }; @@ -580,7 +580,11 @@ fn dep( } } -fn to_code(code: &Value, asi_safe: Option, obj_keys: Option>) -> Cow { +fn to_code( + code: &Value, + asi_safe: Option, + obj_keys: Option>, +) -> Cow { fn wrap_ansi(code: Cow, is_arr: bool, asi_safe: Option) -> Cow { match asi_safe { Some(true) if is_arr => code, @@ -604,7 +608,10 @@ fn to_code(code: &Value, asi_safe: Option, obj_keys: Option, } +#[cacheable] +#[derive(Debug, Clone, Hash, Eq, PartialEq)] +pub struct DestructuringAssignmentProperty { + pub range: DependencyRange, + #[cacheable(with=AsPreset)] + pub id: Atom, + pub shorthand: bool, +} + #[derive(Debug, Clone)] pub enum ExportedVariableInfo { Name(String), @@ -236,7 +246,8 @@ pub struct JavascriptParser<'parser> { // TODO: delete `enter_call` pub(crate) enter_call: u32, pub(crate) member_expr_in_optional_chain: bool, - pub(crate) destructuring_assignment_properties: Option>>, + pub(crate) destructuring_assignment_properties: + Option>>, pub(crate) semicolons: &'parser mut FxHashSet, pub(crate) statement_path: Vec, pub(crate) prev_statement: Option, @@ -947,7 +958,10 @@ impl<'parser> JavascriptParser<'parser> { self.definitions_db.get(self.definitions, str).is_none() } - pub fn destructuring_assignment_properties_for(&self, span: &Span) -> Option> { + pub fn destructuring_assignment_properties_for( + &self, + span: &Span, + ) -> Option> { self .destructuring_assignment_properties .as_ref() diff --git a/crates/rspack_plugin_javascript/src/visitors/dependency/parser/walk_pre.rs b/crates/rspack_plugin_javascript/src/visitors/dependency/parser/walk_pre.rs index da21c8e95059..be40e9d43df3 100644 --- a/crates/rspack_plugin_javascript/src/visitors/dependency/parser/walk_pre.rs +++ b/crates/rspack_plugin_javascript/src/visitors/dependency/parser/walk_pre.rs @@ -12,7 +12,7 @@ use swc_core::{ use super::{ estree::{MaybeNamedFunctionDecl, Statement}, - JavascriptParser, + DestructuringAssignmentProperty, JavascriptParser, }; use crate::{parser_plugin::JavascriptParserPlugin, utils::eval}; @@ -193,24 +193,39 @@ impl JavascriptParser<'_> { } } - fn _pre_walk_object_pattern(&mut self, obj_pat: &ObjectPat) -> Option> { + fn _pre_walk_object_pattern( + &mut self, + obj_pat: &ObjectPat, + ) -> Option> { let mut keys = FxHashSet::default(); for prop in &obj_pat.props { match prop { ObjectPatProp::KeyValue(prop) => { if let Some(ident_key) = prop.key.as_ident() { - keys.insert(ident_key.sym.to_string()); + keys.insert(DestructuringAssignmentProperty { + id: ident_key.sym.clone(), + range: prop.key.span().into(), + shorthand: false, + }); } else { let name = eval::eval_prop_name(&prop.key); if let Some(id) = name.and_then(|id| id.as_string()) { - keys.insert(id); + keys.insert(DestructuringAssignmentProperty { + id: id.into(), + range: prop.key.span().into(), + shorthand: false, + }); } else { return None; } } } ObjectPatProp::Assign(prop) => { - keys.insert(prop.key.sym.to_string()); + keys.insert(DestructuringAssignmentProperty { + id: prop.key.sym.clone(), + range: prop.key.span().into(), + shorthand: true, + }); } ObjectPatProp::Rest(_) => return None, }; diff --git a/crates/rspack_plugin_json/src/lib.rs b/crates/rspack_plugin_json/src/lib.rs index e6697b15c6fd..2265e3ff6b5d 100644 --- a/crates/rspack_plugin_json/src/lib.rs +++ b/crates/rspack_plugin_json/src/lib.rs @@ -202,7 +202,7 @@ impl ParserAndGenerator for JsonParserAndGenerator { json_str.cow_replace('\\', r"\\").cow_replace('\'', r"\'") )) } else { - json_str + json_str.cow_replace("\"__proto__\":", "[\"__proto__\"]:") }; let content = if let Some(ref mut scope) = concatenation_scope { scope.register_namespace_export(NAMESPACE_OBJECT_EXPORT); diff --git a/tests/webpack-test/__snapshots__/ConfigTestCases.basictest.js.snap b/tests/webpack-test/__snapshots__/ConfigTestCases.basictest.js.snap index 733e2eefd703..5bbec0b44f6c 100644 --- a/tests/webpack-test/__snapshots__/ConfigTestCases.basictest.js.snap +++ b/tests/webpack-test/__snapshots__/ConfigTestCases.basictest.js.snap @@ -667,6 +667,129 @@ Array [ ] `; +exports[`ConfigTestCases css pseudo-import exported tests should compile 1`] = ` +Array [ + " +/*!***************************!*\\\\ + !*** ./style.modules.css ***! + \\\\***************************/ + + + + +._style_modules_css-class { + color: IMPORTED_NAME; + background: IMPORTED_NAME; +} + + +._style_modules_css-class {background: IMPORTED_NAME} + +._style_modules_css-class { + color: i__imported_a_0; + color: i__imported__b_1; + color: i__imported___c_2; + color: i__imported__d_3; +} + + + +._style_modules_css-class { + color: something; +} + + + +._style_modules_css-class { + color: again; +} + +/* TODO fix me */ +/*:import(\\"reexport.modules.css\\") { + primary-color: _my_color; +} + +.class {color: primary-color}*/ + + + +._style_modules_css-class { + color: _i_multile_values ; +} + +._style_modules_css-nest { + + + :export { + unknown: unknown; + } + + unknown: unknown; +} + +", + " +/*!***************************!*\\\\ + !*** ./style.modules.css ***! + \\\\***************************/ + + + + +._style_modules_css-class { + color: IMPORTED_NAME; + background: IMPORTED_NAME; +} + + +._style_modules_css-class {background: IMPORTED_NAME} + +._style_modules_css-class { + color: i__imported_a_0; + color: i__imported__b_1; + color: i__imported___c_2; + color: i__imported__d_3; +} + + + +._style_modules_css-class { + color: something; +} + + + +._style_modules_css-class { + color: again; +} + +/* TODO fix me */ +/*:import(\\"reexport.modules.css\\") { + primary-color: _my_color; +} + +.class {color: primary-color}*/ + + + +._style_modules_css-class { + color: _i_multile_values ; +} + +._style_modules_css-nest { + + + :export { + unknown: unknown; + } + + unknown: unknown; +} + +", +] +`; + exports[`ConfigTestCases css pure-css exported tests should compile 1`] = ` Array [ " diff --git a/tests/webpack-test/configCases/css/prefer-relative-css-import/test.filter.js b/tests/webpack-test/configCases/css/prefer-relative-css-import/test.filter.js deleted file mode 100644 index 246b8ee774b6..000000000000 --- a/tests/webpack-test/configCases/css/prefer-relative-css-import/test.filter.js +++ /dev/null @@ -1,2 +0,0 @@ -// css class is prefixed with an unexpected '-' -module.exports = () => false; diff --git a/tests/webpack-test/configCases/css/prefer-relative/test.filter.js b/tests/webpack-test/configCases/css/prefer-relative/test.filter.js deleted file mode 100644 index 246b8ee774b6..000000000000 --- a/tests/webpack-test/configCases/css/prefer-relative/test.filter.js +++ /dev/null @@ -1,2 +0,0 @@ -// css class is prefixed with an unexpected '-' -module.exports = () => false; diff --git a/tests/webpack-test/configCases/css/pseudo-export/index.js b/tests/webpack-test/configCases/css/pseudo-export/index.js index a5544176023f..f9c9ad867732 100644 --- a/tests/webpack-test/configCases/css/pseudo-export/index.js +++ b/tests/webpack-test/configCases/css/pseudo-export/index.js @@ -6,7 +6,7 @@ it("should allow to dynamic import a css module", done => { nsObj({ a: "a", abc: "a b c", - comments: "abc/****/ /* hello world *//****/ def", + comments: "abc def", whitespace: "abc\n\tdef", default: "default" }) @@ -26,7 +26,7 @@ it("should allow to reexport a css module", done => { nsObj({ a: "a", abc: "a b c", - comments: "abc/****/ /* hello world *//****/ def", + comments: "abc def", whitespace: "abc\n\tdef" }) ); @@ -45,7 +45,7 @@ it("should allow to import a css module", done => { nsObj({ a: "a", abc: "a b c", - comments: "abc/****/ /* hello world *//****/ def", + comments: "abc def", whitespace: "abc\n\tdef", default: "default" }) diff --git a/tests/webpack-test/configCases/css/pseudo-export/test.filter.js b/tests/webpack-test/configCases/css/pseudo-export/test.filter.js index 30ee57988c43..a4b0c617a292 100644 --- a/tests/webpack-test/configCases/css/pseudo-export/test.filter.js +++ b/tests/webpack-test/configCases/css/pseudo-export/test.filter.js @@ -1,2 +1,2 @@ // css-lexer cannot parse invalidate css comments -module.exports = () => false +module.exports = () => true diff --git a/tests/webpack-test/configCases/css/pseudo-import/test.filter.js b/tests/webpack-test/configCases/css/pseudo-import/test.filter.js deleted file mode 100644 index 246b8ee774b6..000000000000 --- a/tests/webpack-test/configCases/css/pseudo-import/test.filter.js +++ /dev/null @@ -1,2 +0,0 @@ -// css class is prefixed with an unexpected '-' -module.exports = () => false; diff --git a/tests/webpack-test/configCases/css/runtime-issue/test.filter.js b/tests/webpack-test/configCases/css/runtime-issue/test.filter.js deleted file mode 100644 index 246b8ee774b6..000000000000 --- a/tests/webpack-test/configCases/css/runtime-issue/test.filter.js +++ /dev/null @@ -1,2 +0,0 @@ -// css class is prefixed with an unexpected '-' -module.exports = () => false; diff --git a/tests/webpack-test/configCases/css/url/test.filter.js b/tests/webpack-test/configCases/css/url/test.filter.js index 0ba64710234b..6d1043dc9eab 100644 --- a/tests/webpack-test/configCases/css/url/test.filter.js +++ b/tests/webpack-test/configCases/css/url/test.filter.js @@ -1 +1 @@ -module.exports = () => false; +module.exports = () => "FIXME: more errors than expected"; diff --git a/tests/webpack-test/configCases/css/webpack-ignore/test.filter.js b/tests/webpack-test/configCases/css/webpack-ignore/test.filter.js index 25907bcb1cdb..28cd02fdae45 100644 --- a/tests/webpack-test/configCases/css/webpack-ignore/test.filter.js +++ b/tests/webpack-test/configCases/css/webpack-ignore/test.filter.js @@ -1,2 +1,2 @@ // Should handle webpackIgnore comments in css @import -module.exports = () => false; +module.exports = () => "TODO: support magic comments in css"; diff --git a/tests/webpack-test/configCases/json/proto/test.filter.js b/tests/webpack-test/configCases/json/proto/test.filter.js deleted file mode 100644 index 4b2feec307c2..000000000000 --- a/tests/webpack-test/configCases/json/proto/test.filter.js +++ /dev/null @@ -1,2 +0,0 @@ -// Doesn't preserve `__proto__` properties -module.exports = () => false; diff --git a/tests/webpack-test/configCases/mangle/exports-info-can-mangle/index.js b/tests/webpack-test/configCases/mangle/exports-info-can-mangle/index.js index 69f2d5099a7b..ebfa799ffb79 100644 --- a/tests/webpack-test/configCases/mangle/exports-info-can-mangle/index.js +++ b/tests/webpack-test/configCases/mangle/exports-info-can-mangle/index.js @@ -9,7 +9,7 @@ it("__webpack_exports_info__.xxx.canMangle should be correct", () => { const { bbb, bbbCanMangle } = b; expect(bbb).toBe("bbb"); expect(bbbCanMangle).toBe(true); - + expect(caCanMangle).toBe(true); expect(cbCanMangle).toBe(true); }); diff --git a/tests/webpack-test/configCases/mangle/exports-info-can-mangle/test.filter.js b/tests/webpack-test/configCases/mangle/exports-info-can-mangle/test.filter.js index 404d62374c92..10fea748a0c9 100644 --- a/tests/webpack-test/configCases/mangle/exports-info-can-mangle/test.filter.js +++ b/tests/webpack-test/configCases/mangle/exports-info-can-mangle/test.filter.js @@ -1,2 +1 @@ -// namespace import canMangle is false -module.exports = () => false; +module.exports = () => true; diff --git a/tests/webpack-test/configCases/parsing/require-resolve-ignore/test.filter.js b/tests/webpack-test/configCases/parsing/require-resolve-ignore/test.filter.js index dce5921fa50f..1c12958d5578 100644 --- a/tests/webpack-test/configCases/parsing/require-resolve-ignore/test.filter.js +++ b/tests/webpack-test/configCases/parsing/require-resolve-ignore/test.filter.js @@ -1,2 +1,2 @@ // Expecting createRequire import to stay and import.meta.url to not be evaluated -module.exports = () => false; +module.exports = () => "FIXME: createRequire is replaced with otherRequire"; From d68c9131f649d67cf696409ea2b7011947e1283a Mon Sep 17 00:00:00 2001 From: neverland Date: Tue, 20 May 2025 17:26:27 +0800 Subject: [PATCH 02/50] docs: update Rstack introduction (#10424) * docs: update README to introduce Rstack * docs: polish * chore: bump --- .vscode/settings.json | 11 ++++------- README.md | 19 ++++++++++++++----- README.zh-CN.md | 17 +++++++++++++---- pnpm-lock.yaml | 10 +++++----- website/docs/en/guide/start/ecosystem.mdx | 16 ++++++++-------- website/docs/zh/guide/start/ecosystem.mdx | 16 ++++++++-------- website/package.json | 2 +- website/theme/components/HomeFooter/index.tsx | 14 +++++++++++--- website/theme/i18n/enUS.ts | 2 +- website/theme/i18n/zhCN.ts | 2 +- 10 files changed, 66 insertions(+), 43 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index ae1a353474ab..eedd6d3319f0 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -18,13 +18,9 @@ "cSpell.caseSensitive": true, "rust-analyzer.procMacro.enable": true, "rust-analyzer.procMacro.attributes.enable": true, - "rust-analyzer.linkedProjects": [ - "Cargo.toml" - ], + "rust-analyzer.linkedProjects": ["Cargo.toml"], "rust-analyzer.cargo.targetDir": true, // Don't let RA blocking cargo build - "rust-analyzer.cargo.features": [ - "rspack_cacheable/noop" - ], + "rust-analyzer.cargo.features": ["rspack_cacheable/noop"], "files.associations": { "*.snap": "markdown", "*.snap.txt": "markdown", @@ -41,9 +37,10 @@ "rslib", "Rslib", "rspack", + "rstack", "threejs", "tokio", "ukey", "Ukey" ] -} \ No newline at end of file +} diff --git a/README.md b/README.md index 50a720335cb0..640a4ebbb978 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,19 @@ Rspack is a high performance JavaScript bundler written in Rust. It offers stron Read [Introduction](https://rspack.dev/guide/start/introduction) for details. +## 🦀 Rstack + +Rstack is a unified JavaScript toolchain built around Rspack, with high performance and consistent architecture. + +| Name | Description | +| ----------------------------------------------------- | ------------------------ | +| [Rspack](https://github.com/web-infra-dev/rspack) | Bundler | +| [Rsbuild](https://github.com/web-infra-dev/rsbuild) | Build tool | +| [Rslib](https://github.com/web-infra-dev/rslib) | Library development tool | +| [Rspress](https://github.com/web-infra-dev/rspress) | Static site generator | +| [Rsdoctor](https://github.com/web-infra-dev/rsdoctor) | Build analyzer | +| [Rstest](https://github.com/web-infra-dev/rstest) | Testing framework | + ## Getting started See [Quick start](https://rspack.dev/guide/start/quick-start). @@ -51,10 +64,6 @@ Come chat with us on [Discord](https://discord.gg/79ZZ66GH9E)! Rspack team and R | [awesome-rspack](https://github.com/web-infra-dev/awesome-rspack) | A curated list of awesome things related to Rspack | | [Rspack 1.x documentation](https://rspack.dev/) | Documentation for Rspack 1.x (latest) | | [Rspack 0.x documentation](https://v0.rspack.dev/) | Documentation for Rspack 0.x version | -| [Rsbuild](https://github.com/web-infra-dev/rsbuild) | An out-of-the-box build tool based on Rspack | -| [Rspress](https://github.com/web-infra-dev/rspress) | A fast static site generator based on Rsbuild | -| [Rsdoctor](https://github.com/web-infra-dev/rsdoctor) | A one-stop build analyzer for Rspack | -| [Rslib](https://github.com/web-infra-dev/rslib) | A library development tool powered by Rsbuild | | [rspack-dev-server](https://github.com/web-infra-dev/rspack-dev-server) | Dev server for Rspack | | [rstack-examples](https://github.com/rspack-contrib/rstack-examples) | Examples showcasing Rstack ecosystem tools (Rspack, Rsbuild, Rspress, Rsdoctor) | | [rspack-sources](https://github.com/web-infra-dev/rspack-sources) | Rust port of [webpack-sources](https://www.npmjs.com/package/webpack-sources) | @@ -66,7 +75,7 @@ Come chat with us on [Discord](https://discord.gg/79ZZ66GH9E)! Rspack team and R ## Benchmark -See [Benchmark](https://web-infra-dev.github.io/rspack-ecosystem-benchmark/). +See [Benchmark](https://rspack-ecosystem-benchmark.rspack.dev/). ## Credits diff --git a/README.zh-CN.md b/README.zh-CN.md index d3232141f033..95779d0b60e6 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -28,6 +28,19 @@ Rspack 是一个基于 Rust 编写的高性能 JavaScript 打包工具,它提 请阅读 [Rspack 介绍](https://rspack.dev/zh/guide/start/introduction) 章节来了解更多。 +## 🦀 Rstack + +Rstack 是一个围绕 Rspack 打造的 JavaScript 统一工具链,具有优秀的性能和一致的架构。 + +| 名称 | 描述 | +| ----------------------------------------------------- | -------------- | +| [Rspack](https://github.com/web-infra-dev/rspack) | 打包工具 | +| [Rsbuild](https://github.com/web-infra-dev/rsbuild) | 构建工具 | +| [Rslib](https://github.com/web-infra-dev/rslib) | 库开发工具 | +| [Rspress](https://github.com/web-infra-dev/rspress) | 静态站点生成器 | +| [Rsdoctor](https://github.com/web-infra-dev/rsdoctor) | 构建分析工具 | +| [Rstest](https://github.com/web-infra-dev/rstest) | 测试框架 | + ## 快速上手 请阅读[快速上手](https://rspack.dev/zh/guide/start/quick-start)。 @@ -47,10 +60,6 @@ Rspack 是一个基于 Rust 编写的高性能 JavaScript 打包工具,它提 | [awesome-rspack](https://github.com/web-infra-dev/awesome-rspack) | 与 Rspack 相关的精彩内容列表 | | [Rspack 1.x 文档](https://rspack.dev/zh/) | Rspack 1.x 版本的文档(最新) | | [Rspack 0.x 文档](https://v0.rspack.dev/zh/) | Rspack 0.x 版本的文档 | -| [Rsbuild](https://github.com/web-infra-dev/rsbuild) | 基于 Rspack 的构建工具 | -| [Rspress](https://github.com/web-infra-dev/rspress) | 基于 Rsbuild 的静态站点生成器 | -| [Rsdoctor](https://github.com/web-infra-dev/rsdoctor) | 针对 Rspack 的一站式构建分析工具 | -| [Rslib](https://github.com/web-infra-dev/rslib) | 基于 Rsbuild 的 library 开发工具 | | [rspack-dev-server](https://github.com/web-infra-dev/rspack-dev-server) | Rspack 的开发服务器 | | [rstack-examples](https://github.com/rspack-contrib/rstack-examples) | Rstack 生态(Rspack、Rsbuild、Rspress、Rsdoctor)的示例 | | [rspack-sources](https://github.com/web-infra-dev/rspack-sources) | Rust 版本的 [webpack-sources](https://www.npmjs.com/package/webpack-sources) | diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0575ca4c02f8..6071e2b512a3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -933,8 +933,8 @@ importers: website: dependencies: '@rstack-dev/doc-ui': - specifier: 1.10.0 - version: 1.10.0(react-dom@19.1.0(react@19.1.0))(react@19.1.0) + specifier: 1.10.1 + version: 1.10.1(react-dom@19.1.0(react@19.1.0))(react@19.1.0) axios: specifier: ^1.9.0 version: 1.9.0 @@ -2829,8 +2829,8 @@ packages: resolution: {integrity: sha512-JaIbF2Ohuucx8HirpqvkrF8ap17GobUr02GejowdJ3zK0tR2EkcgjAy6kjBAn4P4gr6cHhbqyFxqRTImVad2rg==} engines: {node: '>=18.0.0'} - '@rstack-dev/doc-ui@1.10.0': - resolution: {integrity: sha512-PRACISyGl8vnqQ1occngpVIfDT0ShKtpi+Tb/HIG7KK+WBV4DaZeNsN1JC5+LHWObEgYsyemCTwxHA9+i3PKIw==} + '@rstack-dev/doc-ui@1.10.1': + resolution: {integrity: sha512-ouJaW5yA9/un69/uAO3/vjsgG+imzkrgPe0nyS68uxJ3Xau4FF5nLZmsql2q56GrxrtW1JR+nMX9nZGZFWI4/w==} '@rushstack/node-core-library@5.13.0': resolution: {integrity: sha512-IGVhy+JgUacAdCGXKUrRhwHMTzqhWwZUI+qEPcdzsb80heOw0QPbhhoVsoiMF7Klp8eYsp7hzpScMXmOa3Uhfg==} @@ -9831,7 +9831,7 @@ snapshots: react: 19.1.0 react-dom: 19.1.0(react@19.1.0) - '@rstack-dev/doc-ui@1.10.0(react-dom@19.1.0(react@19.1.0))(react@19.1.0)': + '@rstack-dev/doc-ui@1.10.1(react-dom@19.1.0(react@19.1.0))(react@19.1.0)': dependencies: framer-motion: 12.11.3(react-dom@19.1.0(react@19.1.0))(react@19.1.0) transitivePeerDependencies: diff --git a/website/docs/en/guide/start/ecosystem.mdx b/website/docs/en/guide/start/ecosystem.mdx index 6a5c917d72ac..255c9d5c6054 100644 --- a/website/docs/en/guide/start/ecosystem.mdx +++ b/website/docs/en/guide/start/ecosystem.mdx @@ -2,9 +2,9 @@ import { Tag } from '@components/Tag'; # Ecosystem -## Rstack toolchain +## Rstack -Rstack is a high-performance, unified JavaScript toolchain based on Rspack, developed and maintained by the Rspack team. +Rstack is a unified JavaScript toolchain built around Rspack, with high performance and consistent architecture. ### Rsbuild @@ -12,6 +12,12 @@ Rstack is a high-performance, unified JavaScript toolchain based on Rspack, deve [Rsbuild](https://github.com/web-infra-dev/rsbuild) is a high-performance build tool powered by Rspack. It provides a set of thoughtfully designed default build configs, offering an out-of-the-box development experience and can fully unleash the performance advantages of Rspack. +### Rslib + +Library development tool + +[Rslib](https://github.com/web-infra-dev/rslib) is a library development tool based on Rsbuild, which reuses the carefully designed build configuration and plugin system of Rsbuild. It allows developers to create JavaScript libraries in a simple and intuitive way. + ### Rspress Static site generator @@ -19,12 +25,6 @@ Rstack is a high-performance, unified JavaScript toolchain based on Rspack, deve [Rspress](https://github.com/web-infra-dev/rspress) is a static site generator based on Rsbuild, React and MDX. It comes with a default documentation theme, and you can quickly build a documentation site with Rspress. You can also customize the theme to meet your personalized static site needs, such as blog sites, product homepages, etc. -### Rslib - -Library development tool - -[Rslib](https://github.com/web-infra-dev/rslib) is a library development tool based on Rsbuild, which reuses the carefully designed build configuration and plugin system of Rsbuild. It allows developers to create JavaScript libraries in a simple and intuitive way. - ### Rsdoctor Build analyzer diff --git a/website/docs/zh/guide/start/ecosystem.mdx b/website/docs/zh/guide/start/ecosystem.mdx index 401fb8fdbd4f..92dbdcdb33d2 100644 --- a/website/docs/zh/guide/start/ecosystem.mdx +++ b/website/docs/zh/guide/start/ecosystem.mdx @@ -2,9 +2,9 @@ import { Tag } from '@components/Tag'; # 生态 -## Rstack 工具链 +## Rstack -Rstack 是基于 Rspack 的高性能、一体化 JavaScript 工具链,由 Rspack 团队开发和维护。 +Rstack 是一个围绕 Rspack 打造的 JavaScript 统一工具链,具有优秀的性能和一致的架构。 ### Rsbuild @@ -12,18 +12,18 @@ Rstack 是基于 Rspack 的高性能、一体化 JavaScript 工具链,由 Rspa [Rsbuild](https://github.com/web-infra-dev/rsbuild) 是由 Rspack 驱动的高性能构建工具,它默认包含了一套精心设计的构建配置,提供开箱即用的开发体验,并能够充分发挥出 Rspack 的性能优势。 -### Rspress - -静态站点生成器 React - -[Rspress](https://github.com/web-infra-dev/rspress) 是一个基于 Rsbuild、React 和 MDX 的静态站点生成器,内置了一套默认的文档主题,你可以通过 Rspress 来快速搭建一个文档站点,同时也可以自定义主题,来满足个性化静态站需求,比如博客站、产品主页等。 - ### Rslib 库开发工具 [Rslib](https://github.com/web-infra-dev/rslib) 是一个基于 Rsbuild 的 npm 库开发工具,它复用了 Rsbuild 精心设计的构建配置和插件系统,使开发者能够以简单直观的方式创建 JavaScript 库。 +### Rspress + +静态站点生成器 React + +[Rspress](https://github.com/web-infra-dev/rspress) 是一个基于 Rsbuild、React 和 MDX 的静态站点生成器,内置了一套默认的文档主题,你可以通过 Rspress 来快速搭建一个文档站点,同时也可以自定义主题,来满足个性化静态站需求,比如博客站、产品主页等。 + ### Rsdoctor 构建分析工具 diff --git a/website/package.json b/website/package.json index 65d9373bd938..3283cb760991 100644 --- a/website/package.json +++ b/website/package.json @@ -18,7 +18,7 @@ }, "license": "MIT", "dependencies": { - "@rstack-dev/doc-ui": "1.10.0", + "@rstack-dev/doc-ui": "1.10.1", "axios": "^1.9.0", "markdown-to-jsx": "^7.7.6", "mermaid": "^11.6.0", diff --git a/website/theme/components/HomeFooter/index.tsx b/website/theme/components/HomeFooter/index.tsx index 8a9cfeacd97f..c7650982c5bc 100644 --- a/website/theme/components/HomeFooter/index.tsx +++ b/website/theme/components/HomeFooter/index.tsx @@ -53,12 +53,16 @@ function useFooterData() { ], }, { - title: t('ecosystem'), + title: t('toolchain'), items: [ { title: 'Rsbuild', link: 'https://rsbuild.dev/', }, + { + title: 'Rslib', + link: 'https://lib.rsbuild.dev/', + }, { title: 'Rspress', link: 'https://rspress.dev/', @@ -68,8 +72,8 @@ function useFooterData() { link: 'https://rsdoctor.dev/', }, { - title: 'Rslib', - link: 'https://github.com/web-infra-dev/rslib', + title: 'Rstest', + link: 'https://github.com/web-infra-dev/rstest', }, ], }, @@ -88,6 +92,10 @@ function useFooterData() { title: 'Twitter (X)', link: 'https://twitter.com/rspack_dev', }, + { + title: 'BlueSky', + link: 'https://bsky.app/profile/rspack.dev', + }, { title: 'Awesome Rspack', link: 'https://github.com/web-infra-dev/awesome-rspack', diff --git a/website/theme/i18n/enUS.ts b/website/theme/i18n/enUS.ts index 63434cf0f110..f3ecf2d3cbcc 100644 --- a/website/theme/i18n/enUS.ts +++ b/website/theme/i18n/enUS.ts @@ -68,6 +68,6 @@ export const EN_US = { compatibility: 'Compatibility', migration: 'Migration', cli: 'CLI', - ecosystem: 'Ecosystem', + toolchain: 'Toolchain', community: 'Community', } as const; diff --git a/website/theme/i18n/zhCN.ts b/website/theme/i18n/zhCN.ts index 6b06f6bc250c..7668482ee8a8 100644 --- a/website/theme/i18n/zhCN.ts +++ b/website/theme/i18n/zhCN.ts @@ -61,6 +61,6 @@ export const ZH_CN: Record = { compatibility: 'webpack 兼容性', migration: '迁移指南', cli: 'CLI', - ecosystem: '生态', + toolchain: '工具链', community: '社区', }; From 509ad6fdacdf29d47809cf2d93199af968aa97ae Mon Sep 17 00:00:00 2001 From: Wei Date: Tue, 20 May 2025 17:59:56 +0800 Subject: [PATCH 03/50] fix(minify): parser allow import attributes syntax (#10405) --- .../src/compiler/minify.rs | 1 + .../minify-parser/importAttributes.mjs | 4 +++ .../plugins/minify-parser/index.js | 7 ++++ .../plugins/minify-parser/rspack.config.js | 34 +++++++++++++++++++ .../plugins/minify-parser/test.config.js | 6 ++++ 5 files changed, 52 insertions(+) create mode 100644 packages/rspack-test-tools/tests/configCases/plugins/minify-parser/importAttributes.mjs create mode 100644 packages/rspack-test-tools/tests/configCases/plugins/minify-parser/index.js create mode 100644 packages/rspack-test-tools/tests/configCases/plugins/minify-parser/rspack.config.js create mode 100644 packages/rspack-test-tools/tests/configCases/plugins/minify-parser/test.config.js diff --git a/crates/rspack_javascript_compiler/src/compiler/minify.rs b/crates/rspack_javascript_compiler/src/compiler/minify.rs index e17dcdadacba..e1128b686e95 100644 --- a/crates/rspack_javascript_compiler/src/compiler/minify.rs +++ b/crates/rspack_javascript_compiler/src/compiler/minify.rs @@ -129,6 +129,7 @@ impl JavaScriptCompiler { jsx: true, decorators: true, decorators_before_export: true, + import_attributes: true, ..Default::default() }), opts diff --git a/packages/rspack-test-tools/tests/configCases/plugins/minify-parser/importAttributes.mjs b/packages/rspack-test-tools/tests/configCases/plugins/minify-parser/importAttributes.mjs new file mode 100644 index 000000000000..41d0200eee39 --- /dev/null +++ b/packages/rspack-test-tools/tests/configCases/plugins/minify-parser/importAttributes.mjs @@ -0,0 +1,4 @@ +import pkg from "./a.json" with { type: "json" }; + +console.log(pkg); + diff --git a/packages/rspack-test-tools/tests/configCases/plugins/minify-parser/index.js b/packages/rspack-test-tools/tests/configCases/plugins/minify-parser/index.js new file mode 100644 index 000000000000..d70d436060b1 --- /dev/null +++ b/packages/rspack-test-tools/tests/configCases/plugins/minify-parser/index.js @@ -0,0 +1,7 @@ +const fs = require("fs"); +const path = require("path"); + +it("[minify-parser]: import attributes should be preserved", () => { + const content = fs.readFileSync(path.resolve(__dirname, "importAttributes.js"), "utf-8"); + expect(content).toContain('import*as o from"./a.json"with{type:"json"}'); +}); diff --git a/packages/rspack-test-tools/tests/configCases/plugins/minify-parser/rspack.config.js b/packages/rspack-test-tools/tests/configCases/plugins/minify-parser/rspack.config.js new file mode 100644 index 000000000000..9dadaf309a2a --- /dev/null +++ b/packages/rspack-test-tools/tests/configCases/plugins/minify-parser/rspack.config.js @@ -0,0 +1,34 @@ +const { rspack } = require("@rspack/core"); + +/** @type {import("@rspack/core").Configuration} */ +module.exports = [ + { + entry: { + importAttributes: "./importAttributes.mjs" + }, + output: { + filename: "[name].js", + module: true + }, + externalsType: "module", + externals: ["./a.json"], + experiments: { + outputModule: true + }, + optimization: { + minimize: true, + minimizer: [new rspack.SwcJsMinimizerRspackPlugin()] + } + }, + { + entry: { + main: "./index.js" + }, + output: { + filename: "[name].js" + }, + externalsPresets: { + node: true + } + } +]; diff --git a/packages/rspack-test-tools/tests/configCases/plugins/minify-parser/test.config.js b/packages/rspack-test-tools/tests/configCases/plugins/minify-parser/test.config.js new file mode 100644 index 000000000000..06b5f0933ef8 --- /dev/null +++ b/packages/rspack-test-tools/tests/configCases/plugins/minify-parser/test.config.js @@ -0,0 +1,6 @@ +/** @type {import("../../../..").TConfigCaseConfig} */ +module.exports = { + findBundle: function (i) { + return ["main.js"]; + } +}; From 0ea0c2f2e082f713305098688a1e212811f84c94 Mon Sep 17 00:00:00 2001 From: Gengkun Date: Tue, 20 May 2025 19:25:00 +0800 Subject: [PATCH 04/50] chore: release v1.3.11 (#10415) --- crates/node_binding/package.json | 2 +- npm/darwin-arm64/package.json | 2 +- npm/darwin-x64/package.json | 2 +- npm/linux-x64-gnu/package.json | 2 +- npm/wasm32-wasi/package.json | 2 +- npm/win32-x64-msvc/package.json | 2 +- package.json | 2 +- packages/create-rspack/package.json | 2 +- packages/rspack-cli/package.json | 2 +- packages/rspack-test-tools/package.json | 2 +- packages/rspack/package.json | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/crates/node_binding/package.json b/crates/node_binding/package.json index f34e8980a595..c41ba3d8f86b 100644 --- a/crates/node_binding/package.json +++ b/crates/node_binding/package.json @@ -1,6 +1,6 @@ { "name": "@rspack/binding", - "version": "1.3.10", + "version": "1.3.11", "license": "MIT", "description": "Node binding for rspack", "main": "binding.js", diff --git a/npm/darwin-arm64/package.json b/npm/darwin-arm64/package.json index 1a2eeba6b0bd..a9418c296cd5 100644 --- a/npm/darwin-arm64/package.json +++ b/npm/darwin-arm64/package.json @@ -1,6 +1,6 @@ { "name": "@rspack/binding-darwin-arm64", - "version": "1.3.10", + "version": "1.3.11", "license": "MIT", "description": "Node binding for rspack", "main": "rspack.darwin-arm64.node", diff --git a/npm/darwin-x64/package.json b/npm/darwin-x64/package.json index ba65fef6ba40..2a8d24c12f81 100644 --- a/npm/darwin-x64/package.json +++ b/npm/darwin-x64/package.json @@ -1,6 +1,6 @@ { "name": "@rspack/binding-darwin-x64", - "version": "1.3.10", + "version": "1.3.11", "license": "MIT", "description": "Node binding for rspack", "main": "rspack.darwin-x64.node", diff --git a/npm/linux-x64-gnu/package.json b/npm/linux-x64-gnu/package.json index 58753a69cdf6..650fd46a2c30 100644 --- a/npm/linux-x64-gnu/package.json +++ b/npm/linux-x64-gnu/package.json @@ -1,6 +1,6 @@ { "name": "@rspack/binding-linux-x64-gnu", - "version": "1.3.10", + "version": "1.3.11", "license": "MIT", "description": "Node binding for rspack", "main": "rspack.linux-x64-gnu.node", diff --git a/npm/wasm32-wasi/package.json b/npm/wasm32-wasi/package.json index ed0a5e3fd7d7..245f9824e183 100644 --- a/npm/wasm32-wasi/package.json +++ b/npm/wasm32-wasi/package.json @@ -1,6 +1,6 @@ { "name": "@rspack/binding-wasm32-wasi", - "version": "1.3.10", + "version": "1.3.11", "license": "MIT", "description": "Node binding for rspack", "main": "rspack.wasi.cjs", diff --git a/npm/win32-x64-msvc/package.json b/npm/win32-x64-msvc/package.json index 17d18421ea68..444729fcab70 100644 --- a/npm/win32-x64-msvc/package.json +++ b/npm/win32-x64-msvc/package.json @@ -1,6 +1,6 @@ { "name": "@rspack/binding-win32-x64-msvc", - "version": "1.3.10", + "version": "1.3.11", "license": "MIT", "description": "Node binding for rspack", "main": "rspack.win32-x64-msvc.node", diff --git a/package.json b/package.json index 18e00f2abe02..a42ab992969d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "monorepo", - "version": "1.3.10", + "version": "1.3.11", "license": "MIT", "description": "The fast Rust-based web bundler with webpack-compatible API", "private": true, diff --git a/packages/create-rspack/package.json b/packages/create-rspack/package.json index 498c543f4896..07b0501bbb9d 100644 --- a/packages/create-rspack/package.json +++ b/packages/create-rspack/package.json @@ -1,6 +1,6 @@ { "name": "create-rspack", - "version": "1.3.10", + "version": "1.3.11", "homepage": "https://rspack.dev", "bugs": "https://github.com/web-infra-dev/rspack/issues", "repository": { diff --git a/packages/rspack-cli/package.json b/packages/rspack-cli/package.json index bd3b5d02d986..f1efaccf7a33 100644 --- a/packages/rspack-cli/package.json +++ b/packages/rspack-cli/package.json @@ -1,6 +1,6 @@ { "name": "@rspack/cli", - "version": "1.3.10", + "version": "1.3.11", "description": "CLI for rspack", "homepage": "https://rspack.dev", "bugs": "https://github.com/web-infra-dev/rspack/issues", diff --git a/packages/rspack-test-tools/package.json b/packages/rspack-test-tools/package.json index 3dd44259da24..5aed05cab063 100644 --- a/packages/rspack-test-tools/package.json +++ b/packages/rspack-test-tools/package.json @@ -1,6 +1,6 @@ { "name": "@rspack/test-tools", - "version": "1.3.10", + "version": "1.3.11", "license": "MIT", "description": "Test tools for rspack", "main": "dist/index.js", diff --git a/packages/rspack/package.json b/packages/rspack/package.json index ca34a55f2ac7..bfa7e8f3845e 100644 --- a/packages/rspack/package.json +++ b/packages/rspack/package.json @@ -1,6 +1,6 @@ { "name": "@rspack/core", - "version": "1.3.10", + "version": "1.3.11", "webpackVersion": "5.75.0", "license": "MIT", "description": "The fast Rust-based web bundler with webpack-compatible API", From 20dce0d068a9ed1494bcf77431b7ba476a711ce3 Mon Sep 17 00:00:00 2001 From: neverland Date: Tue, 20 May 2025 19:25:30 +0800 Subject: [PATCH 05/50] fix: update watchpack to 2.4.3 and remove temp code (#10412) * fix: update watchpack to 2.4.3 and remove temp code * fix * fix * fix --- packages/rspack-test-tools/package.json | 1 - packages/rspack/package.json | 2 +- packages/rspack/src/index.ts | 1 - packages/rspack/src/setupEnv.ts | 11 -------- pnpm-lock.yaml | 34 ++++++++++--------------- 5 files changed, 14 insertions(+), 35 deletions(-) delete mode 100644 packages/rspack/src/setupEnv.ts diff --git a/packages/rspack-test-tools/package.json b/packages/rspack-test-tools/package.json index 5aed05cab063..c53489308962 100644 --- a/packages/rspack-test-tools/package.json +++ b/packages/rspack-test-tools/package.json @@ -81,7 +81,6 @@ "@types/jsdom": "^21.1.7", "@types/react": "^19.1.4", "@types/react-dom": "^19.1.5", - "@types/webpack": "5.28.5", "@types/webpack-sources": "3.2.3", "@webdiscus/pug-loader": "^2.11.1", "acorn": "^8.14.1", diff --git a/packages/rspack/package.json b/packages/rspack/package.json index bfa7e8f3845e..8e56a4356bf6 100644 --- a/packages/rspack/package.json +++ b/packages/rspack/package.json @@ -58,7 +58,7 @@ "prebundle": "^1.3.3", "tsx": "^4.19.4", "typescript": "^5.8.3", - "watchpack": "^2.4.2", + "watchpack": "^2.4.3", "webpack-sources": "3.2.3", "zod": "^3.24.4", "zod-validation-error": "3.4.1", diff --git a/packages/rspack/src/index.ts b/packages/rspack/src/index.ts index 46035cdd103c..7e9e676b199a 100644 --- a/packages/rspack/src/index.ts +++ b/packages/rspack/src/index.ts @@ -1,4 +1,3 @@ -import "./setupEnv"; import * as rspackExports from "./exports"; import { rspack as rspackFn } from "./rspack"; // add exports on rspack() function diff --git a/packages/rspack/src/setupEnv.ts b/packages/rspack/src/setupEnv.ts deleted file mode 100644 index c154d94f8633..000000000000 --- a/packages/rspack/src/setupEnv.ts +++ /dev/null @@ -1,11 +0,0 @@ -import os from "node:os"; - -// There is a node.js bug on MacOS which causes closing file watchers to be really slow. -// This limits the number of watchers to mitigate the issue. -// https://github.com/nodejs/node/issues/29949 -if ( - os.platform() === "darwin" && - process.env.WATCHPACK_WATCHER_LIMIT === undefined -) { - process.env.WATCHPACK_WATCHER_LIMIT = "20"; -} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6071e2b512a3..61605f26a405 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -335,8 +335,8 @@ importers: specifier: ^5.8.3 version: 5.8.3 watchpack: - specifier: ^2.4.2 - version: 2.4.2 + specifier: ^2.4.3 + version: 2.4.3 webpack-sources: specifier: 3.2.3 version: 3.2.3 @@ -522,9 +522,6 @@ importers: '@types/react-dom': specifier: ^19.1.5 version: 19.1.5(@types/react@19.1.4) - '@types/webpack': - specifier: 5.28.5 - version: 5.28.5(@swc/core@1.11.24(@swc/helpers@0.5.17)) '@types/webpack-sources': specifier: 3.2.3 version: 3.2.3 @@ -3275,9 +3272,6 @@ packages: '@types/webpack-sources@3.2.3': resolution: {integrity: sha512-4nZOdMwSPHZ4pTEZzSp0AsTM4K7Qmu40UKW4tJDiOVs20UzYF9l+qUe4s0ftfN0pin06n+5cWWDJXH+sbhAiDw==} - '@types/webpack@5.28.5': - resolution: {integrity: sha512-wR87cgvxj3p6D0Crt1r5avwqffqPXUkNlnQ1mjU93G7gCuFjufZR4I6j8cz5g1F1tTYpfOOFvly+cmIQwL9wvw==} - '@types/ws@8.18.0': resolution: {integrity: sha512-8svvI3hMyvN0kKCJMvTJP/x6Y/EoQbepff882wL+Sn5QsXb3etnamgrJq4isrBxSJj5L2AuXcI0+bgkoAXGUJw==} @@ -7677,6 +7671,10 @@ packages: resolution: {integrity: sha512-TnbFSbcOCcDgjZ4piURLCbJ3nJhznVh9kw6F6iokjiFPl8ONxe9A6nMDVXDiNbrSfLILs6vB07F7wLBrwPYzJw==} engines: {node: '>=10.13.0'} + watchpack@2.4.3: + resolution: {integrity: sha512-adBYQLivcg1jbdKEJeqScJJFvgm4qY9+3tXw+jdG6lkVeqRJEtiQmSWjmth8GKmDZuX7sYM4YFxQsf0AzMfGGw==} + engines: {node: '>=10.13.0'} + wbuf@1.7.3: resolution: {integrity: sha512-O84QOnr0icsbFGLS0O3bI5FswxzRr8/gHwWkDlQFskhSPryQXvrTMxjxGP4+iWYoauLoBvfDpkrOauZ+0iZpDA==} @@ -10366,17 +10364,6 @@ snapshots: '@types/source-list-map': 0.1.6 source-map: 0.7.4 - '@types/webpack@5.28.5(@swc/core@1.11.24(@swc/helpers@0.5.17))': - dependencies: - '@types/node': 20.17.24 - tapable: 2.2.1 - webpack: 5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17)) - transitivePeerDependencies: - - '@swc/core' - - esbuild - - uglify-js - - webpack-cli - '@types/ws@8.18.0': dependencies: '@types/node': 20.17.46 @@ -15573,6 +15560,11 @@ snapshots: glob-to-regexp: 0.4.1 graceful-fs: 4.2.11(patch_hash=68ebc232025360cb3dcd3081f4067f4e9fc022ab6b6f71a3230e86c7a5b337d1) + watchpack@2.4.3: + dependencies: + glob-to-regexp: 0.4.1 + graceful-fs: 4.2.11(patch_hash=68ebc232025360cb3dcd3081f4067f4e9fc022ab6b6f71a3230e86c7a5b337d1) + wbuf@1.7.3: dependencies: minimalistic-assert: 1.0.1 @@ -15726,7 +15718,7 @@ snapshots: schema-utils: 4.3.0 tapable: 2.2.1 terser-webpack-plugin: 5.3.14(@swc/core@1.11.24(@swc/helpers@0.5.17))(webpack@5.98.0(@swc/core@1.11.24(@swc/helpers@0.5.17))) - watchpack: 2.4.2 + watchpack: 2.4.3 webpack-sources: 3.2.3 transitivePeerDependencies: - '@swc/core' @@ -15757,7 +15749,7 @@ snapshots: schema-utils: 4.3.2 tapable: 2.2.1 terser-webpack-plugin: 5.3.14(@swc/core@1.11.24(@swc/helpers@0.5.17))(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))) - watchpack: 2.4.2 + watchpack: 2.4.3 webpack-sources: 3.2.3 transitivePeerDependencies: - '@swc/core' From cc1eab334a1ded48a60045d425b147cf11b8f1e1 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 21 May 2025 08:32:15 +0800 Subject: [PATCH 06/50] chore(deps): update dependency webpack to v5.99.9 (#10428) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- package.json | 2 +- packages/rspack-test-tools/package.json | 2 +- pnpm-lock.yaml | 430 +++++++++--------------- 3 files changed, 154 insertions(+), 280 deletions(-) diff --git a/package.json b/package.json index a42ab992969d..74b4bcaf1d92 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,7 @@ "rimraf": "^5.0.10", "ts-jest": "29.3.2", "typescript": "^5.8.3", - "webpack": "5.99.8", + "webpack": "5.99.9", "zx": "8.5.4" }, "packageManager": "pnpm@10.10.0", diff --git a/packages/rspack-test-tools/package.json b/packages/rspack-test-tools/package.json index c53489308962..8c47cf23a9cc 100644 --- a/packages/rspack-test-tools/package.json +++ b/packages/rspack-test-tools/package.json @@ -63,7 +63,7 @@ "rimraf": "^5.0.10", "source-map": "^0.7.4", "terser-webpack-plugin": "^5.3.14", - "webpack": "5.99.8", + "webpack": "5.99.9", "webpack-merge": "6.0.1", "webpack-sources": "3.2.3" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 61605f26a405..086e9f755bd1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -86,8 +86,8 @@ importers: specifier: ^5.8.3 version: 5.8.3 webpack: - specifier: 5.99.8 - version: 5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17)) + specifier: 5.99.9 + version: 5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17)) zx: specifier: 8.5.4 version: 8.5.4 @@ -253,7 +253,7 @@ importers: version: link:../../rspack vue-loader: specifier: ^17.4.2 - version: 17.4.2(vue@3.5.13(typescript@5.8.3))(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))) + version: 17.4.2(vue@3.5.13(typescript@5.8.3))(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) packages/create-rspack/template-vue-ts: dependencies: @@ -275,7 +275,7 @@ importers: version: 5.8.3 vue-loader: specifier: ^17.4.2 - version: 17.4.2(vue@3.5.13(typescript@5.8.3))(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))) + version: 17.4.2(vue@3.5.13(typescript@5.8.3))(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) packages/rspack: dependencies: @@ -354,7 +354,7 @@ importers: version: 0.5.7 '@rspack/dev-server': specifier: 1.1.2 - version: 1.1.2(@rspack/core@packages+rspack)(@types/express@4.17.21)(webpack@5.98.0(@swc/core@1.11.24(@swc/helpers@0.5.17))) + version: 1.1.2(@rspack/core@packages+rspack)(@types/express@4.17.21)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) colorette: specifier: 2.0.20 version: 2.0.20 @@ -472,10 +472,10 @@ importers: version: 0.7.4 terser-webpack-plugin: specifier: ^5.3.14 - version: 5.3.14(@swc/core@1.11.24(@swc/helpers@0.5.17))(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))) + version: 5.3.14(@swc/core@1.11.24(@swc/helpers@0.5.17))(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) webpack: - specifier: 5.99.8 - version: 5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17)) + specifier: 5.99.9 + version: 5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17)) webpack-merge: specifier: 6.0.1 version: 6.0.1 @@ -527,13 +527,13 @@ importers: version: 3.2.3 '@webdiscus/pug-loader': specifier: ^2.11.1 - version: 2.11.1(enhanced-resolve@5.18.1)(prismjs@1.29.0)(pug@3.0.3)(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))) + version: 2.11.1(enhanced-resolve@5.18.1)(prismjs@1.29.0)(pug@3.0.3)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) acorn: specifier: ^8.14.1 version: 8.14.1 babel-loader: specifier: ^10.0.0 - version: 10.0.0(@babel/core@7.26.10)(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))) + version: 10.0.0(@babel/core@7.26.10)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) babel-plugin-import: specifier: ^1.13.8 version: 1.13.8 @@ -545,31 +545,31 @@ importers: version: 3.42.0 css-loader: specifier: ^7.1.2 - version: 7.1.2(@rspack/core@packages+rspack)(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))) + version: 7.1.2(@rspack/core@packages+rspack)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) file-loader: specifier: ^6.2.0 - version: 6.2.0(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))) + version: 6.2.0(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) html-loader: specifier: ^5.1.0 - version: 5.1.0(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))) + version: 5.1.0(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) html-webpack-plugin: specifier: ^5.6.3 - version: 5.6.3(@rspack/core@packages+rspack)(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))) + version: 5.6.3(@rspack/core@packages+rspack)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) less-loader: specifier: ^12.3.0 - version: 12.3.0(@rspack/core@packages+rspack)(less@4.3.0)(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))) + version: 12.3.0(@rspack/core@packages+rspack)(less@4.3.0)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) lodash: specifier: ^4.17.21 version: 4.17.21 postcss-loader: specifier: ^8.1.1 - version: 8.1.1(@rspack/core@packages+rspack)(postcss@8.5.3)(typescript@5.8.3)(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))) + version: 8.1.1(@rspack/core@packages+rspack)(postcss@8.5.3)(typescript@5.8.3)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) postcss-pxtorem: specifier: ^6.1.0 version: 6.1.0(postcss@8.5.3) raw-loader: specifier: ^4.0.2 - version: 4.0.2(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))) + version: 4.0.2(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) react: specifier: ^19.1.0 version: 19.1.0 @@ -581,13 +581,13 @@ importers: version: 0.17.0 sass-loader: specifier: ^16.0.5 - version: 16.0.5(@rspack/core@packages+rspack)(sass-embedded@1.86.1)(sass@1.56.2)(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))) + version: 16.0.5(@rspack/core@packages+rspack)(sass-embedded@1.86.1)(sass@1.56.2)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) source-map-loader: specifier: ^5.0.0 - version: 5.0.0(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))) + version: 5.0.0(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) style-loader: specifier: ^4.0.0 - version: 4.0.0(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))) + version: 4.0.0(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) terser: specifier: 5.39.1 version: 5.39.1 @@ -599,7 +599,7 @@ importers: version: 1.14.1 worker-rspack-loader: specifier: ^3.1.2 - version: 3.1.2(@rspack/core@packages+rspack)(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))) + version: 3.1.2(@rspack/core@packages+rspack)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) packages/rspack-test-tools/tests/normalCases/resolve/pnpm-workspace/packages/app: dependencies: @@ -687,7 +687,7 @@ importers: version: link:../../packages/rspack '@rspack/dev-server': specifier: 1.1.2 - version: 1.1.2(@rspack/core@packages+rspack)(@types/express@4.17.21)(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))) + version: 1.1.2(@rspack/core@packages+rspack)(@types/express@4.17.21)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) '@rspack/plugin-react-refresh': specifier: ^1.4.3 version: 1.4.3(react-refresh@0.17.0) @@ -699,13 +699,13 @@ importers: version: 11.0.4 babel-loader: specifier: ^10.0.0 - version: 10.0.0(@babel/core@7.27.1)(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))) + version: 10.0.0(@babel/core@7.27.1)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) core-js: specifier: 3.42.0 version: 3.42.0 css-loader: specifier: ^7.1.2 - version: 7.1.2(@rspack/core@packages+rspack)(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))) + version: 7.1.2(@rspack/core@packages+rspack)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) fs-extra: specifier: ^11.3.0 version: 11.3.0 @@ -714,7 +714,7 @@ importers: version: 8.5.3 postcss-loader: specifier: ^8.1.1 - version: 8.1.1(@rspack/core@packages+rspack)(postcss@8.5.3)(typescript@5.8.3)(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))) + version: 8.1.1(@rspack/core@packages+rspack)(postcss@8.5.3)(typescript@5.8.3)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) react: specifier: ^19.1.0 version: 19.1.0 @@ -735,7 +735,7 @@ importers: version: 3.5.13(typescript@5.8.3) vue-loader: specifier: ^17.4.2 - version: 17.4.2(vue@3.5.13(typescript@5.8.3))(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))) + version: 17.4.2(vue@3.5.13(typescript@5.8.3))(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) ws: specifier: ^8.18.2 version: 8.18.2 @@ -759,10 +759,10 @@ importers: version: 8.14.1 babel-loader: specifier: ^10.0.0 - version: 10.0.0(@babel/core@7.27.1)(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))) + version: 10.0.0(@babel/core@7.27.1)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) coffee-loader: specifier: ^1.0.1 - version: 1.0.1(coffeescript@2.7.0)(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))) + version: 1.0.1(coffeescript@2.7.0)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) coffeescript: specifier: ^2.7.0 version: 2.7.0 @@ -771,7 +771,7 @@ importers: version: 3.42.0 css-loader: specifier: ^7.1.2 - version: 7.1.2(@rspack/core@1.3.10(@swc/helpers@0.5.17))(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))) + version: 7.1.2(@rspack/core@1.3.11(@swc/helpers@0.5.17))(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) date-fns: specifier: ^4.1.0 version: 4.1.0 @@ -789,7 +789,7 @@ importers: version: 19.1.0(react@19.1.0) style-loader: specifier: ^4.0.0 - version: 4.0.0(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))) + version: 4.0.0(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) toml: specifier: ^3.0.0 version: 3.0.0 @@ -837,7 +837,7 @@ importers: version: 1.14.1 watchpack: specifier: ^2.4.2 - version: 2.4.2 + version: 2.4.3 webpack-sources: specifier: 3.2.3 version: 3.2.3 @@ -850,22 +850,22 @@ importers: version: link:../../packages/rspack '@webdiscus/pug-loader': specifier: ^2.11.1 - version: 2.11.1(enhanced-resolve@5.18.1)(prismjs@1.29.0)(pug@3.0.3)(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))) + version: 2.11.1(enhanced-resolve@5.18.1)(prismjs@1.29.0)(pug@3.0.3)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) babel-loader: specifier: ^10.0.0 - version: 10.0.0(@babel/core@7.27.1)(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))) + version: 10.0.0(@babel/core@7.27.1)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) bundle-loader: specifier: ^0.5.6 version: 0.5.6 coffee-loader: specifier: ^1.0.1 - version: 1.0.1(coffeescript@2.7.0)(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))) + version: 1.0.1(coffeescript@2.7.0)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) coffeescript: specifier: ^2.7.0 version: 2.7.0 css-loader: specifier: ^7.1.2 - version: 7.1.2(@rspack/core@packages+rspack)(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))) + version: 7.1.2(@rspack/core@packages+rspack)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) csv-to-markdown-table: specifier: ^1.5.0 version: 1.5.0 @@ -874,7 +874,7 @@ importers: version: 0.10.64 file-loader: specifier: ^6.2.0 - version: 6.2.0(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))) + version: 6.2.0(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) is-ci: specifier: 4.1.0 version: 4.1.0 @@ -883,7 +883,7 @@ importers: version: 4.3.0 less-loader: specifier: ^12.3.0 - version: 12.3.0(@rspack/core@packages+rspack)(less@4.3.0)(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))) + version: 12.3.0(@rspack/core@packages+rspack)(less@4.3.0)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) lodash-es: specifier: ^4.17.21 version: 4.17.21 @@ -898,7 +898,7 @@ importers: version: 1.4.4 raw-loader: specifier: ^4.0.2 - version: 4.0.2(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))) + version: 4.0.2(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) react: specifier: ^19.1.0 version: 19.1.0 @@ -916,16 +916,16 @@ importers: version: 5.39.1 terser-webpack-plugin: specifier: ^5.3.14 - version: 5.3.14(@swc/core@1.11.24(@swc/helpers@0.5.17))(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))) + version: 5.3.14(@swc/core@1.11.24(@swc/helpers@0.5.17))(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) ts-loader: specifier: ^9.5.2 - version: 9.5.2(typescript@5.8.3)(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))) + version: 9.5.2(typescript@5.8.3)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) typescript: specifier: ^5.8.3 version: 5.8.3 url-loader: specifier: ^4.1.1 - version: 4.1.1(file-loader@6.2.0(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))))(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))) + version: 4.1.1(file-loader@6.2.0(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))))(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) website: dependencies: @@ -962,10 +962,10 @@ importers: version: 1.3.1(@rsbuild/core@1.3.19) '@rspress/plugin-llms': specifier: 2.0.0-beta.6 - version: 2.0.0-beta.6(@rspress/core@2.0.0-beta.6(@types/react@19.1.4)(acorn@8.14.1)(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17)))) + version: 2.0.0-beta.6(@rspress/core@2.0.0-beta.6(@types/react@19.1.4)(acorn@8.14.1)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17)))) '@rspress/plugin-rss': specifier: 2.0.0-beta.6 - version: 2.0.0-beta.6(rspress@2.0.0-beta.6(@types/react@19.1.4)(acorn@8.14.1)(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17)))) + version: 2.0.0-beta.6(rspress@2.0.0-beta.6(@types/react@19.1.4)(acorn@8.14.1)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17)))) '@shikijs/transformers': specifier: ^3.4.2 version: 3.4.2 @@ -992,7 +992,7 @@ importers: version: 1.0.2(@rsbuild/core@1.3.19) rspress: specifier: 2.0.0-beta.6 - version: 2.0.0-beta.6(@types/react@19.1.4)(acorn@8.14.1)(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))) + version: 2.0.0-beta.6(@types/react@19.1.4)(acorn@8.14.1)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) rspress-plugin-font-open-sans: specifier: 1.0.0 version: 1.0.0 @@ -2586,8 +2586,8 @@ packages: typescript: optional: true - '@rspack/binding-darwin-arm64@1.3.10': - resolution: {integrity: sha512-0k/j8OeMSVm5u5Nzckp9Ie7S7hprnvNegebnGr+L6VCyD7sMqm4m+4rLHs99ZklYdH0dZtY2+LrzrtjUZCqfew==} + '@rspack/binding-darwin-arm64@1.3.11': + resolution: {integrity: sha512-sGoFDXYNinubhEiPSjtA/ua3qhMj6VVBPTSDvprZj+MT18YV7tQQtwBpm+8sbqJ1P5y+a3mzsP3IphRWyIQyXw==} cpu: [arm64] os: [darwin] @@ -2596,8 +2596,8 @@ packages: cpu: [arm64] os: [darwin] - '@rspack/binding-darwin-x64@1.3.10': - resolution: {integrity: sha512-jOyqYW/18cgxw60wK5oqJvM194pbD4H99xaif89McNtLkH3npFvBkXBHVWWuOHGoXNX0LhRpHcI89p9b9THQZQ==} + '@rspack/binding-darwin-x64@1.3.11': + resolution: {integrity: sha512-4zgOkCLxhp4Ki98GuDaZgz4exXcE4+sgvXY/xA/A5FGPVRbfQLQ5psSOk0F/gvMua1r15E66loQRJpuzUK6bTA==} cpu: [x64] os: [darwin] @@ -2606,8 +2606,8 @@ packages: cpu: [x64] os: [darwin] - '@rspack/binding-linux-arm64-gnu@1.3.10': - resolution: {integrity: sha512-zhF5ZNaT/7pxrm8xD3dWG1b4x+FO3LbVeZZG448CjpSo5T57kPD+SaGUU1GcPpn6mexf795x0SVS49aH7/e3Dg==} + '@rspack/binding-linux-arm64-gnu@1.3.11': + resolution: {integrity: sha512-NIOaIfYUmJs1XL4lbGVtcMm1KlA/6ZR6oAbs2ekofKXtJYAFQgnLTf7ZFmIwVjS0mP78BmeSNcIM6pd2w5id4w==} cpu: [arm64] os: [linux] @@ -2616,8 +2616,8 @@ packages: cpu: [arm64] os: [linux] - '@rspack/binding-linux-arm64-musl@1.3.10': - resolution: {integrity: sha512-o3x7IrOSCHK6lcRvdZgsSuOG1CHRQR00xiyLW7kkWmNm7t417LC9xdFWKIK62C5fKXGC5YcTbUkDMnQujespkg==} + '@rspack/binding-linux-arm64-musl@1.3.11': + resolution: {integrity: sha512-CRRAQ379uzA2QfD9HHNtxuuqzGksUapMVcTLY5NIXWfvHLUJShdlSJQv3UQcqgAJNrMY7Ex1PnoQs1jZgUiqZA==} cpu: [arm64] os: [linux] @@ -2626,8 +2626,8 @@ packages: cpu: [arm64] os: [linux] - '@rspack/binding-linux-x64-gnu@1.3.10': - resolution: {integrity: sha512-FMSi28VZhXMr15picOHFynULhqZ/FODPxRIS6uNrvPRYcbNuiO1v+VHV6X88mhOMmJ/aVF6OwjUO/o2l1FVa9Q==} + '@rspack/binding-linux-x64-gnu@1.3.11': + resolution: {integrity: sha512-k3OyvLneX2ZeL8z/OzPojpImqy6PgqKJD+NtOvcr/TgbgADHZ3xQttf6B2X+qnZMAgOZ+RTeTkOFrvsg9AEKmA==} cpu: [x64] os: [linux] @@ -2636,8 +2636,8 @@ packages: cpu: [x64] os: [linux] - '@rspack/binding-linux-x64-musl@1.3.10': - resolution: {integrity: sha512-e0xbY9SlbRGIFz41v1yc0HfREvmgMnLV1bLmTSPK8wI2suIEJ7iYYqsocHOAOk86qLZcxVrTnL6EjUcNaRTWlg==} + '@rspack/binding-linux-x64-musl@1.3.11': + resolution: {integrity: sha512-2agcELyyQ95jWGCW0YWD0TvAcN40yUjmxn9NXQBLHPX5Eb07NaHXairMsvV9vqQsPsq0nxxfd9Wsow18Y5r/Hw==} cpu: [x64] os: [linux] @@ -2646,8 +2646,8 @@ packages: cpu: [x64] os: [linux] - '@rspack/binding-win32-arm64-msvc@1.3.10': - resolution: {integrity: sha512-YHJPvEujWeWjU6EUF6sDpaec9rsOtKVvy16YCtGaxRpDQXqfuxibnp6Ge0ZTTrY+joRiWehRA9OUI+3McqI+QA==} + '@rspack/binding-win32-arm64-msvc@1.3.11': + resolution: {integrity: sha512-sjGoChazu0krigT/LVwGUsgCv3D3s/4cR/3P4VzuDNVlb4pbh1CDa642Fr0TceqAXCeKW5GiL/EQOfZ4semtcQ==} cpu: [arm64] os: [win32] @@ -2656,8 +2656,8 @@ packages: cpu: [arm64] os: [win32] - '@rspack/binding-win32-ia32-msvc@1.3.10': - resolution: {integrity: sha512-2iwSBzVBC89ZSk56MYwgirh3bda2WKmL9I3qPajiTEivChXpX7jp83jAtGE6CPqPYcccYz6nrURTHNUZhqXxVw==} + '@rspack/binding-win32-ia32-msvc@1.3.11': + resolution: {integrity: sha512-tjywW84oQLSqRmvQZ+fXP7e3eNmjScYrlWEPAQFjf08N19iAJ9UOGuuFw8Fk5ZmrlNZ2Qo9ASSOI7Nnwx2aZYg==} cpu: [ia32] os: [win32] @@ -2666,8 +2666,8 @@ packages: cpu: [ia32] os: [win32] - '@rspack/binding-win32-x64-msvc@1.3.10': - resolution: {integrity: sha512-ehWJ9Y5Zezj/+uJpiWbt29RZaRIM00f91PWuabM6/sKmHJhdCEE21u5iI3B8DeW/EjJsH8zkI69YYAxJWwGn9A==} + '@rspack/binding-win32-x64-msvc@1.3.11': + resolution: {integrity: sha512-pPy3yU6SAMfEPY7ki1KAetiDFfRbkYMiX3F89P9kX01UAePkLRNsjacHF4w7N3EsBsWn1FlGaYZdlzmOI5pg2Q==} cpu: [x64] os: [win32] @@ -2676,14 +2676,14 @@ packages: cpu: [x64] os: [win32] - '@rspack/binding@1.3.10': - resolution: {integrity: sha512-9TjO+Ig5U4VqdYWpBsv01n4d2KsgFfdXGIE7zdHXDDbry0avL0J4109ESqSeP9uC+Bi7ZCF53iaxJRvZDflNVQ==} + '@rspack/binding@1.3.11': + resolution: {integrity: sha512-BbMfZHqfH+CzFtZDg+v9nbKifJIJDUPD6KuoWlHq581koKvD3UMx6oVrj9w13JvO2xWNPeHclmqWAFgoD7faEQ==} '@rspack/binding@1.3.9': resolution: {integrity: sha512-3FFen1/0F2aP5uuCm8vPaJOrzM3karCPNMsc5gLCGfEy2rsK38Qinf9W4p1bw7+FhjOTzoSdkX+LFHeMDVxJhw==} - '@rspack/core@1.3.10': - resolution: {integrity: sha512-YomvSRGuMUQgCE2rNMdff2q1Z0YpZw/z6m5+PVTMSs9l/q69YKUzpbpSD8YyB5i1DddrRxC2RE34DkrBuwlREQ==} + '@rspack/core@1.3.11': + resolution: {integrity: sha512-aSYPtT1gum5MCfcFANdTroJ4JwzozuL3wX0twMGNAB7amq6+nZrbsUKWjcHgneCeZdahxzrKdyYef3FHaJ7lEA==} engines: {node: '>=16.0.0'} peerDependencies: '@swc/helpers': '>=0.5.1' @@ -3126,9 +3126,6 @@ packages: '@types/estree-jsx@1.0.5': resolution: {integrity: sha512-52CcUVNFyfb1A2ALocQw/Dd1BQFNmSdkuC3BkZ6iqhdMfQz7JWOFRuJFloOzjk+6WijU56m9oKXFAXc7o3Towg==} - '@types/estree@1.0.6': - resolution: {integrity: sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==} - '@types/estree@1.0.7': resolution: {integrity: sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ==} @@ -4461,9 +4458,6 @@ packages: resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==} engines: {node: '>= 0.4'} - es-module-lexer@1.6.0: - resolution: {integrity: sha512-qqnD1yMU6tk/jnaMosogGySTZP8YtUgAffA9nMN+E/rjxcfRQ6IEk7IiozUjgxKoFHBGjTLnrHB/YC45r/59EQ==} - es-module-lexer@1.7.0: resolution: {integrity: sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==} @@ -7720,18 +7714,8 @@ packages: resolution: {integrity: sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==} engines: {node: '>=10.13.0'} - webpack@5.98.0: - resolution: {integrity: sha512-UFynvx+gM44Gv9qFgj0acCQK2VE1CtdfwFdimkapco3hlPCJ/zeq73n2yVKimVbtm+TnApIugGhLJnkU6gjYXA==} - engines: {node: '>=10.13.0'} - hasBin: true - peerDependencies: - webpack-cli: '*' - peerDependenciesMeta: - webpack-cli: - optional: true - - webpack@5.99.8: - resolution: {integrity: sha512-lQ3CPiSTpfOnrEGeXDwoq5hIGzSjmwD72GdfVzF7CQAI7t47rJG9eDWvcEkEn3CUQymAElVvDg3YNTlCYj+qUQ==} + webpack@5.99.9: + resolution: {integrity: sha512-brOPwM3JnmOa+7kd3NsmOUOwbDAj8FT9xDsG3IW0MgbN9yZV7Oi/s/+MNQ/EcSMqw7qfoRyXPoeEWT8zLVdVGg==} engines: {node: '>=10.13.0'} hasBin: true peerDependencies: @@ -8987,12 +8971,12 @@ snapshots: '@leichtgewicht/ip-codec@2.0.5': {} - '@mdx-js/loader@3.1.0(acorn@8.14.1)(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17)))': + '@mdx-js/loader@3.1.0(acorn@8.14.1)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17)))': dependencies: '@mdx-js/mdx': 3.1.0(acorn@8.14.1) source-map: 0.7.4 optionalDependencies: - webpack: 5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17)) + webpack: 5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17)) transitivePeerDependencies: - acorn - supports-color @@ -9529,71 +9513,71 @@ snapshots: '@microsoft/api-extractor': 7.52.5(@types/node@20.17.46) typescript: 5.8.3 - '@rspack/binding-darwin-arm64@1.3.10': + '@rspack/binding-darwin-arm64@1.3.11': optional: true '@rspack/binding-darwin-arm64@1.3.9': optional: true - '@rspack/binding-darwin-x64@1.3.10': + '@rspack/binding-darwin-x64@1.3.11': optional: true '@rspack/binding-darwin-x64@1.3.9': optional: true - '@rspack/binding-linux-arm64-gnu@1.3.10': + '@rspack/binding-linux-arm64-gnu@1.3.11': optional: true '@rspack/binding-linux-arm64-gnu@1.3.9': optional: true - '@rspack/binding-linux-arm64-musl@1.3.10': + '@rspack/binding-linux-arm64-musl@1.3.11': optional: true '@rspack/binding-linux-arm64-musl@1.3.9': optional: true - '@rspack/binding-linux-x64-gnu@1.3.10': + '@rspack/binding-linux-x64-gnu@1.3.11': optional: true '@rspack/binding-linux-x64-gnu@1.3.9': optional: true - '@rspack/binding-linux-x64-musl@1.3.10': + '@rspack/binding-linux-x64-musl@1.3.11': optional: true '@rspack/binding-linux-x64-musl@1.3.9': optional: true - '@rspack/binding-win32-arm64-msvc@1.3.10': + '@rspack/binding-win32-arm64-msvc@1.3.11': optional: true '@rspack/binding-win32-arm64-msvc@1.3.9': optional: true - '@rspack/binding-win32-ia32-msvc@1.3.10': + '@rspack/binding-win32-ia32-msvc@1.3.11': optional: true '@rspack/binding-win32-ia32-msvc@1.3.9': optional: true - '@rspack/binding-win32-x64-msvc@1.3.10': + '@rspack/binding-win32-x64-msvc@1.3.11': optional: true '@rspack/binding-win32-x64-msvc@1.3.9': optional: true - '@rspack/binding@1.3.10': + '@rspack/binding@1.3.11': optionalDependencies: - '@rspack/binding-darwin-arm64': 1.3.10 - '@rspack/binding-darwin-x64': 1.3.10 - '@rspack/binding-linux-arm64-gnu': 1.3.10 - '@rspack/binding-linux-arm64-musl': 1.3.10 - '@rspack/binding-linux-x64-gnu': 1.3.10 - '@rspack/binding-linux-x64-musl': 1.3.10 - '@rspack/binding-win32-arm64-msvc': 1.3.10 - '@rspack/binding-win32-ia32-msvc': 1.3.10 - '@rspack/binding-win32-x64-msvc': 1.3.10 + '@rspack/binding-darwin-arm64': 1.3.11 + '@rspack/binding-darwin-x64': 1.3.11 + '@rspack/binding-linux-arm64-gnu': 1.3.11 + '@rspack/binding-linux-arm64-musl': 1.3.11 + '@rspack/binding-linux-x64-gnu': 1.3.11 + '@rspack/binding-linux-x64-musl': 1.3.11 + '@rspack/binding-win32-arm64-msvc': 1.3.11 + '@rspack/binding-win32-ia32-msvc': 1.3.11 + '@rspack/binding-win32-x64-msvc': 1.3.11 optional: true '@rspack/binding@1.3.9': @@ -9608,10 +9592,10 @@ snapshots: '@rspack/binding-win32-ia32-msvc': 1.3.9 '@rspack/binding-win32-x64-msvc': 1.3.9 - '@rspack/core@1.3.10(@swc/helpers@0.5.17)': + '@rspack/core@1.3.11(@swc/helpers@0.5.17)': dependencies: '@module-federation/runtime-tools': 0.13.1 - '@rspack/binding': 1.3.10 + '@rspack/binding': 1.3.11 '@rspack/lite-tapable': 1.0.1 caniuse-lite: 1.0.30001718 optionalDependencies: @@ -9627,30 +9611,13 @@ snapshots: optionalDependencies: '@swc/helpers': 0.5.17 - '@rspack/dev-server@1.1.2(@rspack/core@packages+rspack)(@types/express@4.17.21)(webpack@5.98.0(@swc/core@1.11.24(@swc/helpers@0.5.17)))': + '@rspack/dev-server@1.1.2(@rspack/core@packages+rspack)(@types/express@4.17.21)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17)))': dependencies: '@rspack/core': link:packages/rspack chokidar: 3.6.0 http-proxy-middleware: 2.0.7(@types/express@4.17.21) p-retry: 6.2.0 - webpack-dev-server: 5.2.0(webpack@5.98.0(@swc/core@1.11.24(@swc/helpers@0.5.17))) - ws: 8.18.2 - transitivePeerDependencies: - - '@types/express' - - bufferutil - - debug - - supports-color - - utf-8-validate - - webpack - - webpack-cli - - '@rspack/dev-server@1.1.2(@rspack/core@packages+rspack)(@types/express@4.17.21)(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17)))': - dependencies: - '@rspack/core': link:packages/rspack - chokidar: 3.6.0 - http-proxy-middleware: 2.0.7(@types/express@4.17.21) - p-retry: 6.2.0 - webpack-dev-server: 5.2.0(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))) + webpack-dev-server: 5.2.0(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) ws: 8.18.2 transitivePeerDependencies: - '@types/express' @@ -9674,9 +9641,9 @@ snapshots: html-entities: 2.6.0 react-refresh: 0.17.0 - '@rspress/core@2.0.0-beta.6(@types/react@19.1.4)(acorn@8.14.1)(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17)))': + '@rspress/core@2.0.0-beta.6(@types/react@19.1.4)(acorn@8.14.1)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17)))': dependencies: - '@mdx-js/loader': 3.1.0(acorn@8.14.1)(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))) + '@mdx-js/loader': 3.1.0(acorn@8.14.1)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) '@mdx-js/mdx': 3.1.0(acorn@8.14.1) '@mdx-js/react': 3.1.0(@types/react@19.1.4)(react@19.1.0) '@rsbuild/core': 1.3.19 @@ -9766,9 +9733,9 @@ snapshots: dependencies: '@rspress/shared': 2.0.0-beta.6 - '@rspress/plugin-llms@2.0.0-beta.6(@rspress/core@2.0.0-beta.6(@types/react@19.1.4)(acorn@8.14.1)(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))))': + '@rspress/plugin-llms@2.0.0-beta.6(@rspress/core@2.0.0-beta.6(@types/react@19.1.4)(acorn@8.14.1)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))))': dependencies: - '@rspress/core': 2.0.0-beta.6(@types/react@19.1.4)(acorn@8.14.1)(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))) + '@rspress/core': 2.0.0-beta.6(@types/react@19.1.4)(acorn@8.14.1)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) '@rspress/shared': 2.0.0-beta.6 remark-mdx: 3.1.0 remark-parse: 11.0.0 @@ -9784,11 +9751,11 @@ snapshots: '@rspress/runtime': 2.0.0-beta.6 medium-zoom: 1.1.0 - '@rspress/plugin-rss@2.0.0-beta.6(rspress@2.0.0-beta.6(@types/react@19.1.4)(acorn@8.14.1)(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))))': + '@rspress/plugin-rss@2.0.0-beta.6(rspress@2.0.0-beta.6(@types/react@19.1.4)(acorn@8.14.1)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))))': dependencies: '@rspress/shared': 2.0.0-beta.6 feed: 4.2.2 - rspress: 2.0.0-beta.6(@types/react@19.1.4)(acorn@8.14.1)(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))) + rspress: 2.0.0-beta.6(@types/react@19.1.4)(acorn@8.14.1)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) '@rspress/plugin-shiki@2.0.0-beta.6': dependencies: @@ -10186,8 +10153,6 @@ snapshots: dependencies: '@types/estree': 1.0.7 - '@types/estree@1.0.6': {} - '@types/estree@1.0.7': {} '@types/express-serve-static-core@4.19.0': @@ -10351,7 +10316,7 @@ snapshots: dependencies: '@types/node': 20.17.24 tapable: 2.2.1 - webpack: 5.98.0(@swc/core@1.11.24(@swc/helpers@0.5.17)) + webpack: 5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17)) transitivePeerDependencies: - '@swc/core' - esbuild @@ -10553,13 +10518,13 @@ snapshots: '@webassemblyjs/ast': 1.14.1 '@xtuc/long': 4.2.2 - '@webdiscus/pug-loader@2.11.1(enhanced-resolve@5.18.1)(prismjs@1.29.0)(pug@3.0.3)(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17)))': + '@webdiscus/pug-loader@2.11.1(enhanced-resolve@5.18.1)(prismjs@1.29.0)(pug@3.0.3)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17)))': dependencies: ansis: 3.10.0 enhanced-resolve: 5.18.1 parse5: 7.2.1 pug: 3.0.3 - webpack: 5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17)) + webpack: 5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17)) webpack-merge: 6.0.1 optionalDependencies: prismjs: 1.29.0 @@ -10718,17 +10683,17 @@ snapshots: transitivePeerDependencies: - supports-color - babel-loader@10.0.0(@babel/core@7.26.10)(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))): + babel-loader@10.0.0(@babel/core@7.26.10)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))): dependencies: '@babel/core': 7.26.10 find-up: 5.0.0 - webpack: 5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17)) + webpack: 5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17)) - babel-loader@10.0.0(@babel/core@7.27.1)(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))): + babel-loader@10.0.0(@babel/core@7.27.1)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))): dependencies: '@babel/core': 7.27.1 find-up: 5.0.0 - webpack: 5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17)) + webpack: 5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17)) babel-plugin-import@1.13.8: dependencies: @@ -11016,12 +10981,12 @@ snapshots: co@4.6.0: {} - coffee-loader@1.0.1(coffeescript@2.7.0)(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))): + coffee-loader@1.0.1(coffeescript@2.7.0)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))): dependencies: coffeescript: 2.7.0 loader-utils: 2.0.4 schema-utils: 3.3.0 - webpack: 5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17)) + webpack: 5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17)) coffeescript@2.7.0: {} @@ -11163,7 +11128,7 @@ snapshots: cspell-ban-words@0.0.4: {} - css-loader@7.1.2(@rspack/core@1.3.10(@swc/helpers@0.5.17))(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))): + css-loader@7.1.2(@rspack/core@1.3.11(@swc/helpers@0.5.17))(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))): dependencies: icss-utils: 5.1.0(postcss@8.5.3) postcss: 8.5.3 @@ -11174,10 +11139,10 @@ snapshots: postcss-value-parser: 4.2.0 semver: 7.7.1 optionalDependencies: - '@rspack/core': 1.3.10(@swc/helpers@0.5.17) - webpack: 5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17)) + '@rspack/core': 1.3.11(@swc/helpers@0.5.17) + webpack: 5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17)) - css-loader@7.1.2(@rspack/core@packages+rspack)(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))): + css-loader@7.1.2(@rspack/core@packages+rspack)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))): dependencies: icss-utils: 5.1.0(postcss@8.5.3) postcss: 8.5.3 @@ -11189,7 +11154,7 @@ snapshots: semver: 7.7.1 optionalDependencies: '@rspack/core': link:packages/rspack - webpack: 5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17)) + webpack: 5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17)) css-select@4.3.0: dependencies: @@ -11616,8 +11581,6 @@ snapshots: es-errors@1.3.0: {} - es-module-lexer@1.6.0: {} - es-module-lexer@1.7.0: {} es-object-atoms@1.1.1: @@ -11926,11 +11889,11 @@ snapshots: dependencies: xml-js: 1.6.11 - file-loader@6.2.0(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))): + file-loader@6.2.0(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))): dependencies: loader-utils: 2.0.4 schema-utils: 3.3.0 - webpack: 5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17)) + webpack: 5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17)) filelist@1.0.4: dependencies: @@ -12261,11 +12224,11 @@ snapshots: html-escaper@2.0.2: {} - html-loader@5.1.0(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))): + html-loader@5.1.0(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))): dependencies: html-minifier-terser: 7.2.0 parse5: 7.2.1 - webpack: 5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17)) + webpack: 5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17)) html-minifier-terser@6.1.0: dependencies: @@ -12297,7 +12260,7 @@ snapshots: html-void-elements@3.0.0: {} - html-webpack-plugin@5.6.3(@rspack/core@packages+rspack)(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))): + html-webpack-plugin@5.6.3(@rspack/core@packages+rspack)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))): dependencies: '@types/html-minifier-terser': 6.1.0 html-minifier-terser: 6.1.0 @@ -12306,7 +12269,7 @@ snapshots: tapable: 2.2.1 optionalDependencies: '@rspack/core': link:packages/rspack - webpack: 5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17)) + webpack: 5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17)) htmlparser2@6.1.0: dependencies: @@ -13088,12 +13051,12 @@ snapshots: leac@0.6.0: {} - less-loader@12.3.0(@rspack/core@packages+rspack)(less@4.3.0)(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))): + less-loader@12.3.0(@rspack/core@packages+rspack)(less@4.3.0)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))): dependencies: less: 4.3.0 optionalDependencies: '@rspack/core': link:packages/rspack - webpack: 5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17)) + webpack: 5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17)) less@4.3.0: dependencies: @@ -14067,7 +14030,7 @@ snapshots: postcss: 8.5.3 ts-node: 10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.46)(typescript@5.8.3) - postcss-loader@8.1.1(@rspack/core@packages+rspack)(postcss@8.5.3)(typescript@5.8.3)(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))): + postcss-loader@8.1.1(@rspack/core@packages+rspack)(postcss@8.5.3)(typescript@5.8.3)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))): dependencies: cosmiconfig: 9.0.0(typescript@5.8.3) jiti: 1.21.6 @@ -14075,7 +14038,7 @@ snapshots: semver: 7.7.1 optionalDependencies: '@rspack/core': link:packages/rspack - webpack: 5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17)) + webpack: 5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17)) transitivePeerDependencies: - typescript @@ -14277,11 +14240,11 @@ snapshots: iconv-lite: 0.4.24 unpipe: 1.0.0 - raw-loader@4.0.2(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))): + raw-loader@4.0.2(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))): dependencies: loader-utils: 2.0.4 schema-utils: 3.3.0 - webpack: 5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17)) + webpack: 5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17)) react-dom@19.1.0(react@19.1.0): dependencies: @@ -14569,10 +14532,10 @@ snapshots: rspress-plugin-sitemap@1.1.2: {} - rspress@2.0.0-beta.6(@types/react@19.1.4)(acorn@8.14.1)(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))): + rspress@2.0.0-beta.6(@types/react@19.1.4)(acorn@8.14.1)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))): dependencies: '@rsbuild/core': 1.3.19 - '@rspress/core': 2.0.0-beta.6(@types/react@19.1.4)(acorn@8.14.1)(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))) + '@rspress/core': 2.0.0-beta.6(@types/react@19.1.4)(acorn@8.14.1)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) '@rspress/shared': 2.0.0-beta.6 cac: 6.7.14 chokidar: 3.6.0 @@ -14694,14 +14657,14 @@ snapshots: sass-embedded-win32-ia32: 1.86.1 sass-embedded-win32-x64: 1.86.1 - sass-loader@16.0.5(@rspack/core@packages+rspack)(sass-embedded@1.86.1)(sass@1.56.2)(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))): + sass-loader@16.0.5(@rspack/core@packages+rspack)(sass-embedded@1.86.1)(sass@1.56.2)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))): dependencies: neo-async: 2.6.2 optionalDependencies: '@rspack/core': link:packages/rspack sass: 1.56.2 sass-embedded: 1.86.1 - webpack: 5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17)) + webpack: 5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17)) sass@1.56.2: dependencies: @@ -14889,11 +14852,11 @@ snapshots: source-map-js@1.2.1: {} - source-map-loader@5.0.0(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))): + source-map-loader@5.0.0(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))): dependencies: iconv-lite: 0.6.3 source-map-js: 1.2.1 - webpack: 5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17)) + webpack: 5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17)) source-map-support@0.5.13: dependencies: @@ -15015,9 +14978,9 @@ snapshots: dependencies: escape-string-regexp: 1.0.5 - style-loader@4.0.0(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))): + style-loader@4.0.0(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))): dependencies: - webpack: 5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17)) + webpack: 5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17)) style-to-js@1.1.16: dependencies: @@ -15086,25 +15049,14 @@ snapshots: tapable@2.2.1: {} - terser-webpack-plugin@5.3.14(@swc/core@1.11.24(@swc/helpers@0.5.17))(webpack@5.98.0(@swc/core@1.11.24(@swc/helpers@0.5.17))): - dependencies: - '@jridgewell/trace-mapping': 0.3.25 - jest-worker: 27.5.1 - schema-utils: 4.3.0 - serialize-javascript: 6.0.2 - terser: 5.39.1 - webpack: 5.98.0(@swc/core@1.11.24(@swc/helpers@0.5.17)) - optionalDependencies: - '@swc/core': 1.11.24(@swc/helpers@0.5.17) - - terser-webpack-plugin@5.3.14(@swc/core@1.11.24(@swc/helpers@0.5.17))(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))): + terser-webpack-plugin@5.3.14(@swc/core@1.11.24(@swc/helpers@0.5.17))(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))): dependencies: '@jridgewell/trace-mapping': 0.3.25 jest-worker: 27.5.1 schema-utils: 4.3.0 serialize-javascript: 6.0.2 terser: 5.39.1 - webpack: 5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17)) + webpack: 5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17)) optionalDependencies: '@swc/core': 1.11.24(@swc/helpers@0.5.17) @@ -15238,7 +15190,7 @@ snapshots: '@jest/types': 29.6.3 babel-jest: 29.7.0(@babel/core@7.27.1) - ts-loader@9.5.2(typescript@5.8.3)(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))): + ts-loader@9.5.2(typescript@5.8.3)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))): dependencies: chalk: 4.1.2 enhanced-resolve: 5.18.1 @@ -15246,7 +15198,7 @@ snapshots: semver: 7.7.2 source-map: 0.7.4 typescript: 5.8.3 - webpack: 5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17)) + webpack: 5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17)) ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.46)(typescript@5.8.3): dependencies: @@ -15377,14 +15329,14 @@ snapshots: dependencies: punycode: 2.3.1 - url-loader@4.1.1(file-loader@6.2.0(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))))(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))): + url-loader@4.1.1(file-loader@6.2.0(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))))(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))): dependencies: loader-utils: 2.0.4 mime-types: 2.1.35 schema-utils: 3.3.0 - webpack: 5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17)) + webpack: 5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17)) optionalDependencies: - file-loader: 6.2.0(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))) + file-loader: 6.2.0(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) url-parse@1.5.10: dependencies: @@ -15516,12 +15468,12 @@ snapshots: vscode-uri@3.0.8: {} - vue-loader@17.4.2(vue@3.5.13(typescript@5.8.3))(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))): + vue-loader@17.4.2(vue@3.5.13(typescript@5.8.3))(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))): dependencies: chalk: 4.1.2 hash-sum: 2.0.0 watchpack: 2.4.2 - webpack: 5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17)) + webpack: 5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17)) optionalDependencies: vue: 3.5.13(typescript@5.8.3) @@ -15591,7 +15543,7 @@ snapshots: - bufferutil - utf-8-validate - webpack-dev-middleware@7.4.2(webpack@5.98.0(@swc/core@1.11.24(@swc/helpers@0.5.17))): + webpack-dev-middleware@7.4.2(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))): dependencies: colorette: 2.0.20 memfs: 4.17.1 @@ -15600,20 +15552,9 @@ snapshots: range-parser: 1.2.1 schema-utils: 4.3.2 optionalDependencies: - webpack: 5.98.0(@swc/core@1.11.24(@swc/helpers@0.5.17)) + webpack: 5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17)) - webpack-dev-middleware@7.4.2(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))): - dependencies: - colorette: 2.0.20 - memfs: 4.17.1 - mime-types: 2.1.35 - on-finished: 2.4.1 - range-parser: 1.2.1 - schema-utils: 4.3.2 - optionalDependencies: - webpack: 5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17)) - - webpack-dev-server@5.2.0(webpack@5.98.0(@swc/core@1.11.24(@swc/helpers@0.5.17))): + webpack-dev-server@5.2.0(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))): dependencies: '@types/bonjour': 3.5.13 '@types/connect-history-api-fallback': 1.5.4 @@ -15640,47 +15581,10 @@ snapshots: serve-index: 1.9.1 sockjs: 0.3.24 spdy: 4.0.2 - webpack-dev-middleware: 7.4.2(webpack@5.98.0(@swc/core@1.11.24(@swc/helpers@0.5.17))) + webpack-dev-middleware: 7.4.2(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) ws: 8.18.2 optionalDependencies: - webpack: 5.98.0(@swc/core@1.11.24(@swc/helpers@0.5.17)) - transitivePeerDependencies: - - bufferutil - - debug - - supports-color - - utf-8-validate - - webpack-dev-server@5.2.0(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))): - dependencies: - '@types/bonjour': 3.5.13 - '@types/connect-history-api-fallback': 1.5.4 - '@types/express': 4.17.21 - '@types/serve-index': 1.9.4 - '@types/serve-static': 1.15.7 - '@types/sockjs': 0.3.36 - '@types/ws': 8.18.0 - ansi-html-community: 0.0.8 - bonjour-service: 1.2.1 - chokidar: 3.6.0 - colorette: 2.0.20 - compression: 1.7.4 - connect-history-api-fallback: 2.0.0 - express: 4.21.2 - graceful-fs: 4.2.11(patch_hash=68ebc232025360cb3dcd3081f4067f4e9fc022ab6b6f71a3230e86c7a5b337d1) - http-proxy-middleware: 2.0.7(@types/express@4.17.21) - ipaddr.js: 2.1.0 - launch-editor: 2.6.1 - open: 10.1.0 - p-retry: 6.2.0 - schema-utils: 4.3.2 - selfsigned: 2.4.1 - serve-index: 1.9.1 - sockjs: 0.3.24 - spdy: 4.0.2 - webpack-dev-middleware: 7.4.2(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))) - ws: 8.18.2 - optionalDependencies: - webpack: 5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17)) + webpack: 5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17)) transitivePeerDependencies: - bufferutil - debug @@ -15695,37 +15599,7 @@ snapshots: webpack-sources@3.2.3: {} - webpack@5.98.0(@swc/core@1.11.24(@swc/helpers@0.5.17)): - dependencies: - '@types/eslint-scope': 3.7.7 - '@types/estree': 1.0.6 - '@webassemblyjs/ast': 1.14.1 - '@webassemblyjs/wasm-edit': 1.14.1 - '@webassemblyjs/wasm-parser': 1.14.1 - acorn: 8.14.1 - browserslist: 4.24.5 - chrome-trace-event: 1.0.3 - enhanced-resolve: 5.18.1 - es-module-lexer: 1.6.0 - eslint-scope: 5.1.1 - events: 3.3.0 - glob-to-regexp: 0.4.1 - graceful-fs: 4.2.11(patch_hash=68ebc232025360cb3dcd3081f4067f4e9fc022ab6b6f71a3230e86c7a5b337d1) - json-parse-even-better-errors: 2.3.1 - loader-runner: 4.3.0 - mime-types: 2.1.35 - neo-async: 2.6.2 - schema-utils: 4.3.0 - tapable: 2.2.1 - terser-webpack-plugin: 5.3.14(@swc/core@1.11.24(@swc/helpers@0.5.17))(webpack@5.98.0(@swc/core@1.11.24(@swc/helpers@0.5.17))) - watchpack: 2.4.3 - webpack-sources: 3.2.3 - transitivePeerDependencies: - - '@swc/core' - - esbuild - - uglify-js - - webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17)): + webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17)): dependencies: '@types/eslint-scope': 3.7.7 '@types/estree': 1.0.7 @@ -15737,7 +15611,7 @@ snapshots: browserslist: 4.24.5 chrome-trace-event: 1.0.3 enhanced-resolve: 5.18.1 - es-module-lexer: 1.6.0 + es-module-lexer: 1.7.0 eslint-scope: 5.1.1 events: 3.3.0 glob-to-regexp: 0.4.1 @@ -15748,7 +15622,7 @@ snapshots: neo-async: 2.6.2 schema-utils: 4.3.2 tapable: 2.2.1 - terser-webpack-plugin: 5.3.14(@swc/core@1.11.24(@swc/helpers@0.5.17))(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))) + terser-webpack-plugin: 5.3.14(@swc/core@1.11.24(@swc/helpers@0.5.17))(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) watchpack: 2.4.3 webpack-sources: 3.2.3 transitivePeerDependencies: @@ -15804,13 +15678,13 @@ snapshots: assert-never: 1.4.0 babel-walk: 3.0.0-canary-5 - worker-rspack-loader@3.1.2(@rspack/core@packages+rspack)(webpack@5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17))): + worker-rspack-loader@3.1.2(@rspack/core@packages+rspack)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))): dependencies: loader-utils: 2.0.4 schema-utils: 3.3.0 optionalDependencies: '@rspack/core': link:packages/rspack - webpack: 5.99.8(@swc/core@1.11.24(@swc/helpers@0.5.17)) + webpack: 5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17)) wrap-ansi@6.2.0: dependencies: From d6c54dd229745e0108c98aed9e3145d5c3589c36 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 21 May 2025 09:04:11 +0800 Subject: [PATCH 07/50] chore(deps): update patch npm dependencies (#10431) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- crates/node_binding/package.json | 4 +- npm/wasm32-wasi/package.json | 2 +- package.json | 4 +- .../template-vue-js/package.json | 2 +- .../template-vue-ts/package.json | 2 +- packages/rspack-test-tools/package.json | 4 +- pnpm-lock.yaml | 687 +++++++++--------- tests/bench/package.json | 2 +- tests/e2e/package.json | 2 +- tests/webpack-test/package.json | 8 +- website/package.json | 4 +- 11 files changed, 360 insertions(+), 361 deletions(-) diff --git a/crates/node_binding/package.json b/crates/node_binding/package.json index c41ba3d8f86b..7cb1b01b691d 100644 --- a/crates/node_binding/package.json +++ b/crates/node_binding/package.json @@ -27,8 +27,8 @@ "bugs": "https://github.com/web-infra-dev/rspack/issues", "repository": "web-infra-dev/rspack", "devDependencies": { - "@napi-rs/cli": "3.0.0-alpha.78", - "@napi-rs/wasm-runtime": "^0.2.9", + "@napi-rs/cli": "3.0.0-alpha.80", + "@napi-rs/wasm-runtime": "^0.2.10", "emnapi": "^1.4.3", "typescript": "^5.8.3", "@emnapi/core": "^1.4.3" diff --git a/npm/wasm32-wasi/package.json b/npm/wasm32-wasi/package.json index 245f9824e183..085c120d3e0f 100644 --- a/npm/wasm32-wasi/package.json +++ b/npm/wasm32-wasi/package.json @@ -23,6 +23,6 @@ "wasi-worker-browser.mjs" ], "dependencies": { - "@napi-rs/wasm-runtime": "^0.2.9" + "@napi-rs/wasm-runtime": "^0.2.10" } } diff --git a/package.json b/package.json index 74b4bcaf1d92..076659670986 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "@taplo/cli": "^0.7.0", "@types/is-ci": "^3.0.4", "@types/jest": "29.5.14", - "@types/node": "^20.17.46", + "@types/node": "^20.17.50", "commander": "13.1.0", "cross-env": "^7.0.3", "husky": "^9.1.7", @@ -77,7 +77,7 @@ "prettier": "3.5.3", "prettier-2": "npm:prettier@2.8.8", "rimraf": "^5.0.10", - "ts-jest": "29.3.2", + "ts-jest": "29.3.4", "typescript": "^5.8.3", "webpack": "5.99.9", "zx": "8.5.4" diff --git a/packages/create-rspack/template-vue-js/package.json b/packages/create-rspack/template-vue-js/package.json index 4053da68c71a..40c3cbf3e996 100644 --- a/packages/create-rspack/template-vue-js/package.json +++ b/packages/create-rspack/template-vue-js/package.json @@ -8,7 +8,7 @@ "preview": "rspack preview" }, "dependencies": { - "vue": "^3.5.13" + "vue": "^3.5.14" }, "devDependencies": { "@rspack/cli": "workspace:*", diff --git a/packages/create-rspack/template-vue-ts/package.json b/packages/create-rspack/template-vue-ts/package.json index 0e76f18e78a7..80c47b68e6b8 100644 --- a/packages/create-rspack/template-vue-ts/package.json +++ b/packages/create-rspack/template-vue-ts/package.json @@ -8,7 +8,7 @@ "preview": "rspack preview" }, "dependencies": { - "vue": "^3.5.13" + "vue": "^3.5.14" }, "devDependencies": { "@rspack/cli": "workspace:*", diff --git a/packages/rspack-test-tools/package.json b/packages/rspack-test-tools/package.json index 8c47cf23a9cc..d99ffaa53040 100644 --- a/packages/rspack-test-tools/package.json +++ b/packages/rspack-test-tools/package.json @@ -57,7 +57,7 @@ "jest-diff": "^29.7.0", "jest-snapshot": "29.7.0", "jsdom": "^26.1.0", - "memfs": "4.17.1", + "memfs": "4.17.2", "path-serializer": "0.4.0", "pretty-format": "29.7.0", "rimraf": "^5.0.10", @@ -105,7 +105,7 @@ "source-map": "^0.7.4", "source-map-loader": "^5.0.0", "style-loader": "^4.0.0", - "terser": "5.39.1", + "terser": "5.39.2", "typescript": "^5.8.3", "wast-loader": "^1.14.1", "worker-rspack-loader": "^3.1.2" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 086e9f755bd1..0c96e165d034 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -27,10 +27,10 @@ importers: version: 29.7.0 '@microsoft/api-extractor': specifier: 7.52.5 - version: 7.52.5(@types/node@20.17.46) + version: 7.52.5(@types/node@20.17.50) '@microsoft/api-extractor-model': specifier: 7.30.5 - version: 7.30.5(@types/node@20.17.46) + version: 7.30.5(@types/node@20.17.50) '@rspack/cli': specifier: workspace:* version: link:packages/rspack-cli @@ -44,8 +44,8 @@ importers: specifier: 29.5.14 version: 29.5.14 '@types/node': - specifier: ^20.17.46 - version: 20.17.46 + specifier: ^20.17.50 + version: 20.17.50 commander: specifier: 13.1.0 version: 13.1.0 @@ -60,10 +60,10 @@ importers: version: 4.1.0 jest: specifier: 29.7.0 - version: 29.7.0(@types/node@20.17.46)(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.46)(typescript@5.8.3)) + version: 29.7.0(@types/node@20.17.50)(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.50)(typescript@5.8.3)) jest-cli: specifier: 29.7.0 - version: 29.7.0(@types/node@20.17.46)(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.46)(typescript@5.8.3)) + version: 29.7.0(@types/node@20.17.50)(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.50)(typescript@5.8.3)) jest-environment-node: specifier: 29.7.0 version: 29.7.0 @@ -80,8 +80,8 @@ importers: specifier: ^5.0.10 version: 5.0.10 ts-jest: - specifier: 29.3.2 - version: 29.3.2(@babel/core@7.27.1)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.27.1))(jest@29.7.0(@types/node@20.17.46)(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.46)(typescript@5.8.3)))(typescript@5.8.3) + specifier: 29.3.4 + version: 29.3.4(@babel/core@7.27.1)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.27.1))(jest@29.7.0(@types/node@20.17.50)(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.50)(typescript@5.8.3)))(typescript@5.8.3) typescript: specifier: ^5.8.3 version: 5.8.3 @@ -98,11 +98,11 @@ importers: specifier: ^1.4.3 version: 1.4.3 '@napi-rs/cli': - specifier: 3.0.0-alpha.78 - version: 3.0.0-alpha.78(@emnapi/runtime@1.4.1)(@types/node@20.17.46)(emnapi@1.4.3) + specifier: 3.0.0-alpha.80 + version: 3.0.0-alpha.80(@emnapi/runtime@1.4.3)(@types/node@20.17.50)(emnapi@1.4.3) '@napi-rs/wasm-runtime': - specifier: ^0.2.9 - version: 0.2.9 + specifier: ^0.2.10 + version: 0.2.10 emnapi: specifier: ^1.4.3 version: 1.4.3 @@ -135,8 +135,8 @@ importers: npm/wasm32-wasi: dependencies: '@napi-rs/wasm-runtime': - specifier: ^0.2.9 - version: 0.2.9 + specifier: ^0.2.10 + version: 0.2.10 npm/win32-x64-msvc: {} @@ -148,7 +148,7 @@ importers: devDependencies: '@rslib/core': specifier: 0.7.0 - version: 0.7.0(@microsoft/api-extractor@7.52.5(@types/node@20.17.46))(typescript@5.8.3) + version: 0.7.0(@microsoft/api-extractor@7.52.5(@types/node@20.17.50))(typescript@5.8.3) typescript: specifier: ^5.8.3 version: 5.8.3 @@ -210,7 +210,7 @@ importers: version: 0.17.0 ts-node: specifier: ^10.9.2 - version: 10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.46)(typescript@5.8.3) + version: 10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.50)(typescript@5.8.3) typescript: specifier: ^5.8.3 version: 5.8.3 @@ -234,7 +234,7 @@ importers: version: link:../../rspack ts-node: specifier: ^10.9.2 - version: 10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.46)(typescript@5.8.3) + version: 10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.50)(typescript@5.8.3) typescript: specifier: ^5.8.3 version: 5.8.3 @@ -242,8 +242,8 @@ importers: packages/create-rspack/template-vue-js: dependencies: vue: - specifier: ^3.5.13 - version: 3.5.13(typescript@5.8.3) + specifier: ^3.5.14 + version: 3.5.14(typescript@5.8.3) devDependencies: '@rspack/cli': specifier: workspace:* @@ -253,13 +253,13 @@ importers: version: link:../../rspack vue-loader: specifier: ^17.4.2 - version: 17.4.2(vue@3.5.13(typescript@5.8.3))(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) + version: 17.4.2(vue@3.5.14(typescript@5.8.3))(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) packages/create-rspack/template-vue-ts: dependencies: vue: - specifier: ^3.5.13 - version: 3.5.13(typescript@5.8.3) + specifier: ^3.5.14 + version: 3.5.14(typescript@5.8.3) devDependencies: '@rspack/cli': specifier: workspace:* @@ -269,13 +269,13 @@ importers: version: link:../../rspack ts-node: specifier: ^10.9.2 - version: 10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.46)(typescript@5.8.3) + version: 10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.50)(typescript@5.8.3) typescript: specifier: ^5.8.3 version: 5.8.3 vue-loader: specifier: ^17.4.2 - version: 17.4.2(vue@3.5.13(typescript@5.8.3))(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) + version: 17.4.2(vue@3.5.14(typescript@5.8.3))(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) packages/rspack: dependencies: @@ -297,7 +297,7 @@ importers: devDependencies: '@rslib/core': specifier: 0.7.0 - version: 0.7.0(@microsoft/api-extractor@7.52.5(@types/node@20.17.46))(typescript@5.8.3) + version: 0.7.0(@microsoft/api-extractor@7.52.5(@types/node@20.17.50))(typescript@5.8.3) '@swc/core': specifier: 1.11.24 version: 1.11.24(@swc/helpers@0.5.17) @@ -376,7 +376,7 @@ importers: devDependencies: '@rslib/core': specifier: 0.7.0 - version: 0.7.0(@microsoft/api-extractor@7.52.5(@types/node@20.17.46))(typescript@5.8.3) + version: 0.7.0(@microsoft/api-extractor@7.52.5(@types/node@20.17.50))(typescript@5.8.3) '@rspack/core': specifier: workspace:* version: link:../rspack @@ -403,7 +403,7 @@ importers: version: 5.1.1 ts-node: specifier: ^10.9.2 - version: 10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.46)(typescript@5.8.3) + version: 10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.50)(typescript@5.8.3) typescript: specifier: ^5.8.3 version: 5.8.3 @@ -456,8 +456,8 @@ importers: specifier: ^26.1.0 version: 26.1.0 memfs: - specifier: 4.17.1 - version: 4.17.1 + specifier: 4.17.2 + version: 4.17.2 path-serializer: specifier: 0.4.0 version: 0.4.0 @@ -589,8 +589,8 @@ importers: specifier: ^4.0.0 version: 4.0.0(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) terser: - specifier: 5.39.1 - version: 5.39.1 + specifier: 5.39.2 + version: 5.39.2 typescript: specifier: ^5.8.3 version: 5.8.3 @@ -651,7 +651,7 @@ importers: devDependencies: '@codspeed/vitest-plugin': specifier: ^4.0.1 - version: 4.0.1(vite@5.4.14(@types/node@20.17.46)(less@4.3.0)(sass-embedded@1.86.1)(sass@1.56.2)(terser@5.39.1))(vitest@3.1.3(@types/debug@4.1.12)(@types/node@20.17.46)(jsdom@26.1.0)(less@4.3.0)(sass-embedded@1.86.1)(sass@1.56.2)(terser@5.39.1)) + version: 4.0.1(vite@5.4.14(@types/node@20.17.50)(less@4.3.0)(sass-embedded@1.86.1)(sass@1.56.2)(terser@5.39.2))(vitest@3.1.4(@types/debug@4.1.12)(@types/node@20.17.50)(jsdom@26.1.0)(less@4.3.0)(sass-embedded@1.86.1)(sass@1.56.2)(terser@5.39.2)) '@rspack/cli': specifier: workspace:* version: link:../../packages/rspack-cli @@ -668,8 +668,8 @@ importers: specifier: ^19.1.5 version: 19.1.5(@types/react@19.1.4) vitest: - specifier: ^3.1.3 - version: 3.1.3(@types/debug@4.1.12)(@types/node@20.17.46)(jsdom@26.1.0)(less@4.3.0)(sass-embedded@1.86.1)(sass@1.56.2)(terser@5.39.1) + specifier: ^3.1.4 + version: 3.1.4(@types/debug@4.1.12)(@types/node@20.17.50)(jsdom@26.1.0)(less@4.3.0)(sass-embedded@1.86.1)(sass@1.56.2)(terser@5.39.2) tests/e2e: devDependencies: @@ -726,16 +726,16 @@ importers: version: 0.17.0 tailwindcss: specifier: ^3.4.17 - version: 3.4.17(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.46)(typescript@5.8.3)) + version: 3.4.17(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.50)(typescript@5.8.3)) typescript: specifier: ^5.8.3 version: 5.8.3 vue: - specifier: ^3.5.13 - version: 3.5.13(typescript@5.8.3) + specifier: ^3.5.14 + version: 3.5.14(typescript@5.8.3) vue-loader: specifier: ^17.4.2 - version: 17.4.2(vue@3.5.13(typescript@5.8.3))(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) + version: 17.4.2(vue@3.5.14(typescript@5.8.3))(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) ws: specifier: ^8.18.2 version: 8.18.2 @@ -747,7 +747,7 @@ importers: version: link:../../packages/rspack-cli jest-watch-typeahead: specifier: ^2.2.2 - version: 2.2.2(jest@29.7.0(@types/node@20.17.46)(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.46)(typescript@5.8.3))) + version: 2.2.2(jest@29.7.0(@types/node@20.17.50)(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.50)(typescript@5.8.3))) tests/webpack-examples: devDependencies: @@ -827,8 +827,8 @@ importers: specifier: ^0.17.0 version: 0.17.0 tapable: - specifier: 2.2.1 - version: 2.2.1 + specifier: 2.2.2 + version: 2.2.2 toml: specifier: ^3.0.0 version: 3.0.0 @@ -836,7 +836,7 @@ importers: specifier: ^1.14.1 version: 1.14.1 watchpack: - specifier: ^2.4.2 + specifier: ^2.4.3 version: 2.4.3 webpack-sources: specifier: 3.2.3 @@ -888,8 +888,8 @@ importers: specifier: ^4.17.21 version: 4.17.21 memfs: - specifier: ^4.17.1 - version: 4.17.1 + specifier: ^4.17.2 + version: 4.17.2 mime-types: specifier: ^3.0.1 version: 3.0.1 @@ -912,8 +912,8 @@ importers: specifier: ^0.7.4 version: 0.7.4 terser: - specifier: 5.39.1 - version: 5.39.1 + specifier: 5.39.2 + version: 5.39.2 terser-webpack-plugin: specifier: ^5.3.14 version: 5.3.14(@swc/core@1.11.24(@swc/helpers@0.5.17))(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) @@ -930,8 +930,8 @@ importers: website: dependencies: '@rstack-dev/doc-ui': - specifier: 1.10.1 - version: 1.10.1(react-dom@19.1.0(react@19.1.0))(react@19.1.0) + specifier: 1.10.2 + version: 1.10.2(react-dom@19.1.0(react@19.1.0))(react@19.1.0) axios: specifier: ^1.9.0 version: 1.9.0 @@ -952,7 +952,7 @@ importers: version: 7.7.2 tailwindcss: specifier: ^3.4.17 - version: 3.4.17(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.46)(typescript@5.8.3)) + version: 3.4.17(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.50)(typescript@5.8.3)) devDependencies: '@biomejs/biome': specifier: 1.9.4 @@ -970,8 +970,8 @@ importers: specifier: ^3.4.2 version: 3.4.2 '@types/node': - specifier: ^20.17.46 - version: 20.17.46 + specifier: ^20.17.50 + version: 20.17.50 '@types/react': specifier: ^19.1.4 version: 19.1.4 @@ -1442,8 +1442,8 @@ packages: '@emnapi/core@1.4.3': resolution: {integrity: sha512-4m62DuCE07lw01soJwPiBGC0nAww0Q+RY70VZ+n49yDIO13yyinhbWCeNnaob0lakDtWQzSdtNWzJeOJt2ma+g==} - '@emnapi/runtime@1.4.1': - resolution: {integrity: sha512-LMshMVP0ZhACNjQNYXiU1iZJ6QCcv0lUdPDPugqGvCGXt5xtRVBPdtA0qU12pEXZzpWAhWlZYptfdAFq10DOVQ==} + '@emnapi/runtime@1.4.3': + resolution: {integrity: sha512-pBPWdu6MLKROBX05wSNKcNb++m5Er+KQ9QkB+WVM+pW2Kx9hoSrVTnu3BdkI5eBLZoKu/J6mW/B6i6bJB2ytXQ==} '@emnapi/wasi-threads@1.0.2': resolution: {integrity: sha512-5n3nTJblwRi8LlXkJ9eBzu+kZR8Yxcc7ubakyQTFzPMtIhFpUBRbsnc2Dv88IZDIbCDlBiWrknhB4Lsz7mg6BA==} @@ -2046,8 +2046,8 @@ packages: '@module-federation/webpack-bundler-runtime@0.13.1': resolution: {integrity: sha512-QSuSIGa09S8mthbB1L6xERqrz+AzPlHR6D7RwAzssAc+IHf40U6NiTLPzUqp9mmKDhC5Tm0EISU0ZHNeJpnpBQ==} - '@napi-rs/cli@3.0.0-alpha.78': - resolution: {integrity: sha512-x+38HFEotUu5qPVs8xqOWOaZNdyqhc30zLFQkWJmVzsh4LU0MuYlnF7R4acH4ZB3kyhYoxiNfUQc2d9hUUbPlQ==} + '@napi-rs/cli@3.0.0-alpha.80': + resolution: {integrity: sha512-wgzLg9ZBOHJ4NKhw6B1uFtpYKOLiQQ6/kSNJEpjylCvcMyuS/TtBX3L3lFsA9B1AxWFhnVj9yvBWiuDXpleGRg==} engines: {node: '>= 16'} hasBin: true peerDependencies: @@ -2286,8 +2286,8 @@ packages: resolution: {integrity: sha512-hDsvmMZY8tl2CcLfjnTeE1o5W1eGTSL+ZIX8YEybtcJwA+Cc8SNHb7l6JqMnGcjOrWBZbHt8tzTN+W7qHS5Wmg==} engines: {node: '>= 10'} - '@napi-rs/wasm-runtime@0.2.9': - resolution: {integrity: sha512-OKRBiajrrxB9ATokgEQoG87Z25c67pCpYcCwmXYX8PBftC9pBfN18gnm/fh1wurSLEKIAt+QRFLFCQISrb66Jg==} + '@napi-rs/wasm-runtime@0.2.10': + resolution: {integrity: sha512-bCsCyeZEwVErsGmyPNSzwfwFn4OdxBj0mmv6hOFucB/k81Ojdu68RbZdxYsRQUPc9l6SU5F/cG+bXgWs3oUgsQ==} '@napi-rs/wasm-tools-android-arm-eabi@0.0.3': resolution: {integrity: sha512-T2tme8w5jZ/ZCjJurqNtKCxYtGoDjW9v2rn1bfI60ewCfkYXNpxrTURdkOib85sz+BcwmOfXn0enbg5W9KohoQ==} @@ -2826,8 +2826,8 @@ packages: resolution: {integrity: sha512-JaIbF2Ohuucx8HirpqvkrF8ap17GobUr02GejowdJ3zK0tR2EkcgjAy6kjBAn4P4gr6cHhbqyFxqRTImVad2rg==} engines: {node: '>=18.0.0'} - '@rstack-dev/doc-ui@1.10.1': - resolution: {integrity: sha512-ouJaW5yA9/un69/uAO3/vjsgG+imzkrgPe0nyS68uxJ3Xau4FF5nLZmsql2q56GrxrtW1JR+nMX9nZGZFWI4/w==} + '@rstack-dev/doc-ui@1.10.2': + resolution: {integrity: sha512-X++WhXEdLu91JqoQXsIN+LeP23nxXC8cgTDCkvOtOk6rGtSvyKb3ts3zXJthSG09mKQm/Q/OzDGcdTHhco/AsA==} '@rushstack/node-core-library@5.13.0': resolution: {integrity: sha512-IGVhy+JgUacAdCGXKUrRhwHMTzqhWwZUI+qEPcdzsb80heOw0QPbhhoVsoiMF7Klp8eYsp7hzpScMXmOa3Uhfg==} @@ -3201,11 +3201,8 @@ packages: '@types/node-forge@1.3.11': resolution: {integrity: sha512-FQx220y22OKNTqaByeBGqHWYz4cl94tpcxeFdvBo3wjG6XPBuZ0BNgNZRV5J5TFmmcsJ4IzsLkmGRiQbnYsBEQ==} - '@types/node@20.17.24': - resolution: {integrity: sha512-d7fGCyB96w9BnWQrOsJtpyiSaBcAYYr75bnK6ZRjDbql2cGLj/3GsL5OYmLPNq76l7Gf2q4Rv9J2o6h5CrD9sA==} - - '@types/node@20.17.46': - resolution: {integrity: sha512-0PQHLhZPWOxGW4auogW0eOQAuNIlCYvibIpG67ja0TOJ6/sehu+1en7sfceUn+QQtx4Rk3GxbLNwPh0Cav7TWw==} + '@types/node@20.17.50': + resolution: {integrity: sha512-Mxiq0ULv/zo1OzOhwPqOA13I81CV/W3nvd3ChtQZRT5Cwz3cr0FKo/wMSsbTqL3EXpaBAEQhva2B8ByRkOIh9A==} '@types/qs@6.9.14': resolution: {integrity: sha512-5khscbd3SwWMhFqylJBLQ0zIu7c1K6Vz0uBIt915BI3zV0q1nfjRQD3RqSBcPaO6PHEF4ov/t9y89fSiyThlPA==} @@ -3290,11 +3287,11 @@ packages: resolution: {integrity: sha512-rnK6hJBS6mwc+Bkab+PGPs9OiS0i/3kdTO+CkI8V0/VrW3vmz7O2Pxjw/owOlmo6PKEIxRSeZKv/kuL9itnpYA==} hasBin: true - '@vitest/expect@3.1.3': - resolution: {integrity: sha512-7FTQQuuLKmN1Ig/h+h/GO+44Q1IlglPlR2es4ab7Yvfx+Uk5xsv+Ykk+MEt/M2Yn/xGmzaLKxGw2lgy2bwuYqg==} + '@vitest/expect@3.1.4': + resolution: {integrity: sha512-xkD/ljeliyaClDYqHPNCiJ0plY5YIcM0OlRiZizLhlPmpXWpxnGMyTZXOHFhFeG7w9P5PBeL4IdtJ/HeQwTbQA==} - '@vitest/mocker@3.1.3': - resolution: {integrity: sha512-PJbLjonJK82uCWHjzgBJZuR7zmAOrSvKk1QBxrennDIgtH4uK0TB1PvYmc0XBCigxxtiAVPfWtAdy4lpz8SQGQ==} + '@vitest/mocker@3.1.4': + resolution: {integrity: sha512-8IJ3CvwtSw/EFXqWFL8aCMu+YyYXG2WUSrQbViOZkWTKTVicVwZ/YiEZDSqD00kX+v/+W+OnxhNWoeVKorHygA==} peerDependencies: msw: ^2.4.9 vite: ^5.0.0 || ^6.0.0 @@ -3304,49 +3301,49 @@ packages: vite: optional: true - '@vitest/pretty-format@3.1.3': - resolution: {integrity: sha512-i6FDiBeJUGLDKADw2Gb01UtUNb12yyXAqC/mmRWuYl+m/U9GS7s8us5ONmGkGpUUo7/iAYzI2ePVfOZTYvUifA==} + '@vitest/pretty-format@3.1.4': + resolution: {integrity: sha512-cqv9H9GvAEoTaoq+cYqUTCGscUjKqlJZC7PRwY5FMySVj5J+xOm1KQcCiYHJOEzOKRUhLH4R2pTwvFlWCEScsg==} - '@vitest/runner@3.1.3': - resolution: {integrity: sha512-Tae+ogtlNfFei5DggOsSUvkIaSuVywujMj6HzR97AHK6XK8i3BuVyIifWAm/sE3a15lF5RH9yQIrbXYuo0IFyA==} + '@vitest/runner@3.1.4': + resolution: {integrity: sha512-djTeF1/vt985I/wpKVFBMWUlk/I7mb5hmD5oP8K9ACRmVXgKTae3TUOtXAEBfslNKPzUQvnKhNd34nnRSYgLNQ==} - '@vitest/snapshot@3.1.3': - resolution: {integrity: sha512-XVa5OPNTYUsyqG9skuUkFzAeFnEzDp8hQu7kZ0N25B1+6KjGm4hWLtURyBbsIAOekfWQ7Wuz/N/XXzgYO3deWQ==} + '@vitest/snapshot@3.1.4': + resolution: {integrity: sha512-JPHf68DvuO7vilmvwdPr9TS0SuuIzHvxeaCkxYcCD4jTk67XwL45ZhEHFKIuCm8CYstgI6LZ4XbwD6ANrwMpFg==} - '@vitest/spy@3.1.3': - resolution: {integrity: sha512-x6w+ctOEmEXdWaa6TO4ilb7l9DxPR5bwEb6hILKuxfU1NqWT2mpJD9NJN7t3OTfxmVlOMrvtoFJGdgyzZ605lQ==} + '@vitest/spy@3.1.4': + resolution: {integrity: sha512-Xg1bXhu+vtPXIodYN369M86K8shGLouNjoVI78g8iAq2rFoHFdajNvJJ5A/9bPMFcfQqdaCpOgWKEoMQg/s0Yg==} - '@vitest/utils@3.1.3': - resolution: {integrity: sha512-2Ltrpht4OmHO9+c/nmHtF09HWiyWdworqnHIwjfvDyWjuwKbdkcS9AnhsDn+8E2RM4x++foD1/tNuLPVvWG1Rg==} + '@vitest/utils@3.1.4': + resolution: {integrity: sha512-yriMuO1cfFhmiGc8ataN51+9ooHRuURdfAZfwFd3usWynjzpLslZdYnRegTv32qdgtJTsj15FoeZe2g15fY1gg==} - '@vue/compiler-core@3.5.13': - resolution: {integrity: sha512-oOdAkwqUfW1WqpwSYJce06wvt6HljgY3fGeM9NcVA1HaYOij3mZG9Rkysn0OHuyUAGMbEbARIpsG+LPVlBJ5/Q==} + '@vue/compiler-core@3.5.14': + resolution: {integrity: sha512-k7qMHMbKvoCXIxPhquKQVw3Twid3Kg4s7+oYURxLGRd56LiuHJVrvFKI4fm2AM3c8apqODPfVJGoh8nePbXMRA==} - '@vue/compiler-dom@3.5.13': - resolution: {integrity: sha512-ZOJ46sMOKUjO3e94wPdCzQ6P1Lx/vhp2RSvfaab88Ajexs0AHeV0uasYhi99WPaogmBlRHNRuly8xV75cNTMDA==} + '@vue/compiler-dom@3.5.14': + resolution: {integrity: sha512-1aOCSqxGOea5I80U2hQJvXYpPm/aXo95xL/m/mMhgyPUsKe9jhjwWpziNAw7tYRnbz1I61rd9Mld4W9KmmRoug==} - '@vue/compiler-sfc@3.5.13': - resolution: {integrity: sha512-6VdaljMpD82w6c2749Zhf5T9u5uLBWKnVue6XWxprDobftnletJ8+oel7sexFfM3qIxNmVE7LSFGTpv6obNyaQ==} + '@vue/compiler-sfc@3.5.14': + resolution: {integrity: sha512-9T6m/9mMr81Lj58JpzsiSIjBgv2LiVoWjIVa7kuXHICUi8LiDSIotMpPRXYJsXKqyARrzjT24NAwttrMnMaCXA==} - '@vue/compiler-ssr@3.5.13': - resolution: {integrity: sha512-wMH6vrYHxQl/IybKJagqbquvxpWCuVYpoUJfCqFZwa/JY1GdATAQ+TgVtgrwwMZ0D07QhA99rs/EAAWfvG6KpA==} + '@vue/compiler-ssr@3.5.14': + resolution: {integrity: sha512-Y0G7PcBxr1yllnHuS/NxNCSPWnRGH4Ogrp0tsLA5QemDZuJLs99YjAKQ7KqkHE0vCg4QTKlQzXLKCMF7WPSl7Q==} - '@vue/reactivity@3.5.13': - resolution: {integrity: sha512-NaCwtw8o48B9I6L1zl2p41OHo/2Z4wqYGGIK1Khu5T7yxrn+ATOixn/Udn2m+6kZKB/J7cuT9DbWWhRxqixACg==} + '@vue/reactivity@3.5.14': + resolution: {integrity: sha512-7cK1Hp343Fu/SUCCO52vCabjvsYu7ZkOqyYu7bXV9P2yyfjUMUXHZafEbq244sP7gf+EZEz+77QixBTuEqkQQw==} - '@vue/runtime-core@3.5.13': - resolution: {integrity: sha512-Fj4YRQ3Az0WTZw1sFe+QDb0aXCerigEpw418pw1HBUKFtnQHWzwojaukAs2X/c9DQz4MQ4bsXTGlcpGxU/RCIw==} + '@vue/runtime-core@3.5.14': + resolution: {integrity: sha512-w9JWEANwHXNgieAhxPpEpJa+0V5G0hz3NmjAZwlOebtfKyp2hKxKF0+qSh0Xs6/PhfGihuSdqMprMVcQU/E6ag==} - '@vue/runtime-dom@3.5.13': - resolution: {integrity: sha512-dLaj94s93NYLqjLiyFzVs9X6dWhTdAlEAciC3Moq7gzAc13VJUdCnjjRurNM6uTLFATRHexHCTu/Xp3eW6yoog==} + '@vue/runtime-dom@3.5.14': + resolution: {integrity: sha512-lCfR++IakeI35TVR80QgOelsUIdcKjd65rWAMfdSlCYnaEY5t3hYwru7vvcWaqmrK+LpI7ZDDYiGU5V3xjMacw==} - '@vue/server-renderer@3.5.13': - resolution: {integrity: sha512-wAi4IRJV/2SAW3htkTlB+dHeRmpTiVIK1OGLWV1yeStVSebSQQOwGwIq0D3ZIoBj2C2qpgz5+vX9iEBkTdk5YA==} + '@vue/server-renderer@3.5.14': + resolution: {integrity: sha512-Rf/ISLqokIvcySIYnv3tNWq40PLpNLDLSJwwVWzG6MNtyIhfbcrAxo5ZL9nARJhqjZyWWa40oRb2IDuejeuv6w==} peerDependencies: - vue: 3.5.13 + vue: 3.5.14 - '@vue/shared@3.5.13': - resolution: {integrity: sha512-/hnE/qP5ZoGpol0a5mDi45bOd7t3tjYJBjsgCsivow7D48cJeV5l05RD82lPqi7gRiphZM37rnhW1l6ZoCNNnQ==} + '@vue/shared@3.5.14': + resolution: {integrity: sha512-oXTwNxVfc9EtP1zzXAlSlgARLXNC84frFYkS0HHz0h3E4WZSP9sywqjqzGCP9Y34M8ipNmd380pVgmMuwELDyQ==} '@webassemblyjs/ast@1.14.1': resolution: {integrity: sha512-nuBEDgQfm1ccRp/8bCQrx1frohyufl4JlbMMZ4P1wpeOfDhF6FQkxZJ1b/e+PLwr6X1Nhw6OLme5usuBWYBvuQ==} @@ -5737,8 +5734,8 @@ packages: medium-zoom@1.1.0: resolution: {integrity: sha512-ewyDsp7k4InCUp3jRmwHBRFGyjBimKps/AJLjRSox+2q/2H4p/PNpQf+pwONWlJiOudkBXtbdmVbFjqyybfTmQ==} - memfs@4.17.1: - resolution: {integrity: sha512-thuTRd7F4m4dReCIy7vv4eNYnU6XI/tHMLSMMHLiortw/Y0QxqKtinG523U2aerzwYWGi606oBP4oMPy4+edag==} + memfs@4.17.2: + resolution: {integrity: sha512-NgYhCOWgovOXSzvYgUW0LQ7Qy72rWQMGGFJDoWg4G30RHd3z77VbYdtJ4fembJXBy8pMIUA31XNAupobOQlwdg==} engines: {node: '>= 4.0.0'} merge-descriptors@1.0.3: @@ -7180,6 +7177,10 @@ packages: resolution: {integrity: sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==} engines: {node: '>=6'} + tapable@2.2.2: + resolution: {integrity: sha512-Re10+NauLTMCudc7T5WLFLAwDhQ0JWdrMK+9B2M8zR5hRExKmsRDCBA7/aV/pNJFltmBFO5BAMlQFi/vq3nKOg==} + engines: {node: '>=6'} + terser-webpack-plugin@5.3.14: resolution: {integrity: sha512-vkZjpUjb6OMS7dhV+tILUW6BhpDR7P2L/aQSAv+Uwk+m8KATX9EccViHTJR2qDtACKPIYndLGCyl3FMo+r2LMw==} engines: {node: '>= 10.13.0'} @@ -7201,8 +7202,8 @@ packages: engines: {node: '>=10'} hasBin: true - terser@5.39.1: - resolution: {integrity: sha512-Mm6+uad0ZuDtcV8/4uOZQDQ8RuiC5Pu+iZRedJtF7yA/27sPL7d++In/AJKpWZlU3SYMPPkVfwetn6sgZ66pUA==} + terser@5.39.2: + resolution: {integrity: sha512-yEPUmWve+VA78bI71BW70Dh0TuV4HHd+I5SHOAfS1+QBOmvmCiiffgjR8ryyEd3KIfvPGFqoADt8LdQ6XpXIvg==} engines: {node: '>=10'} hasBin: true @@ -7322,8 +7323,8 @@ packages: ts-interface-checker@0.1.13: resolution: {integrity: sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==} - ts-jest@29.3.2: - resolution: {integrity: sha512-bJJkrWc6PjFVz5g2DGCNUo8z7oFEYaz1xP1NpeDU7KNLMWPpEyV8Chbpkn8xjzgRDpQhnGMyvyldoL7h8JXyug==} + ts-jest@29.3.4: + resolution: {integrity: sha512-Iqbrm8IXOmV+ggWHOTEbjwyCf2xZlUMv5npExksXohL+tk8va4Fjhb+X2+Rt9NBmgO7bJ8WpnMLOwih/DnMlFA==} engines: {node: ^14.15.0 || ^16.10.0 || ^18.0.0 || >=20.0.0} hasBin: true peerDependencies: @@ -7394,8 +7395,8 @@ packages: resolution: {integrity: sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==} engines: {node: '>=10'} - type-fest@4.39.1: - resolution: {integrity: sha512-uW9qzd66uyHYxwyVBYiwS4Oi0qZyUqwjU+Oevr6ZogYiXt99EOYtwvzMSLw1c3lYo2HzJsep/NB23iEVEgjG/w==} + type-fest@4.41.0: + resolution: {integrity: sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA==} engines: {node: '>=16'} type-is@1.6.18: @@ -7533,8 +7534,8 @@ packages: vfile@6.0.3: resolution: {integrity: sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==} - vite-node@3.1.3: - resolution: {integrity: sha512-uHV4plJ2IxCl4u1up1FQRrqclylKAogbtBfOTwcuJ28xFi+89PZ57BRh+naIRvH70HPwxy5QHYzg1OrEaC7AbA==} + vite-node@3.1.4: + resolution: {integrity: sha512-6enNwYnpyDo4hEgytbmc6mYWHXDHYEn0D1/rw4Q+tnHUGtKTJsn8T1YkX6Q18wI5LCrS8CTYlBaiCqxOy2kvUA==} engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} hasBin: true @@ -7569,16 +7570,16 @@ packages: terser: optional: true - vitest@3.1.3: - resolution: {integrity: sha512-188iM4hAHQ0km23TN/adso1q5hhwKqUpv+Sd6p5sOuh6FhQnRNW3IsiIpvxqahtBabsJ2SLZgmGSpcYK4wQYJw==} + vitest@3.1.4: + resolution: {integrity: sha512-Ta56rT7uWxCSJXlBtKgIlApJnT6e6IGmTYxYcmxjJ4ujuZDI59GUQgVDObXXJujOmPDBYXHK1qmaGtneu6TNIQ==} engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} hasBin: true peerDependencies: '@edge-runtime/vm': '*' '@types/debug': ^4.1.12 '@types/node': ^18.0.0 || ^20.0.0 || >=22.0.0 - '@vitest/browser': 3.1.3 - '@vitest/ui': 3.1.3 + '@vitest/browser': 3.1.4 + '@vitest/ui': 3.1.4 happy-dom: '*' jsdom: '*' peerDependenciesMeta: @@ -7633,8 +7634,8 @@ packages: vue: optional: true - vue@3.5.13: - resolution: {integrity: sha512-wmeiSMxkZCSc+PM2w2VRsOYAZC8GdipNFRTsLSfodVqI9mbejKeXEGr8SckuLnrQPGe3oJN5c3K0vpoU9q/wCQ==} + vue@3.5.14: + resolution: {integrity: sha512-LbOm50/vZFG6Mhy6KscQYXZMQ0LMCC/y40HDJPPvGFQ+i/lUH+PJHR6C3assgOQiXdl6tAfsXHbXYVBZZu65ew==} peerDependencies: typescript: '*' peerDependenciesMeta: @@ -8415,11 +8416,11 @@ snapshots: transitivePeerDependencies: - debug - '@codspeed/vitest-plugin@4.0.1(vite@5.4.14(@types/node@20.17.46)(less@4.3.0)(sass-embedded@1.86.1)(sass@1.56.2)(terser@5.39.1))(vitest@3.1.3(@types/debug@4.1.12)(@types/node@20.17.46)(jsdom@26.1.0)(less@4.3.0)(sass-embedded@1.86.1)(sass@1.56.2)(terser@5.39.1))': + '@codspeed/vitest-plugin@4.0.1(vite@5.4.14(@types/node@20.17.50)(less@4.3.0)(sass-embedded@1.86.1)(sass@1.56.2)(terser@5.39.2))(vitest@3.1.4(@types/debug@4.1.12)(@types/node@20.17.50)(jsdom@26.1.0)(less@4.3.0)(sass-embedded@1.86.1)(sass@1.56.2)(terser@5.39.2))': dependencies: '@codspeed/core': 4.0.1 - vite: 5.4.14(@types/node@20.17.46)(less@4.3.0)(sass-embedded@1.86.1)(sass@1.56.2)(terser@5.39.1) - vitest: 3.1.3(@types/debug@4.1.12)(@types/node@20.17.46)(jsdom@26.1.0)(less@4.3.0)(sass-embedded@1.86.1)(sass@1.56.2)(terser@5.39.1) + vite: 5.4.14(@types/node@20.17.50)(less@4.3.0)(sass-embedded@1.86.1)(sass@1.56.2)(terser@5.39.2) + vitest: 3.1.4(@types/debug@4.1.12)(@types/node@20.17.50)(jsdom@26.1.0)(less@4.3.0)(sass-embedded@1.86.1)(sass@1.56.2)(terser@5.39.2) transitivePeerDependencies: - debug @@ -8460,7 +8461,7 @@ snapshots: '@emnapi/wasi-threads': 1.0.2 tslib: 2.8.1 - '@emnapi/runtime@1.4.1': + '@emnapi/runtime@1.4.3': dependencies: tslib: 2.8.1 @@ -8629,27 +8630,27 @@ snapshots: transitivePeerDependencies: - supports-color - '@inquirer/checkbox@4.1.4(@types/node@20.17.46)': + '@inquirer/checkbox@4.1.4(@types/node@20.17.50)': dependencies: - '@inquirer/core': 10.1.9(@types/node@20.17.46) + '@inquirer/core': 10.1.9(@types/node@20.17.50) '@inquirer/figures': 1.0.11 - '@inquirer/type': 3.0.5(@types/node@20.17.46) + '@inquirer/type': 3.0.5(@types/node@20.17.50) ansi-escapes: 4.3.2 yoctocolors-cjs: 2.1.2 optionalDependencies: - '@types/node': 20.17.46 + '@types/node': 20.17.50 - '@inquirer/confirm@5.1.8(@types/node@20.17.46)': + '@inquirer/confirm@5.1.8(@types/node@20.17.50)': dependencies: - '@inquirer/core': 10.1.9(@types/node@20.17.46) - '@inquirer/type': 3.0.5(@types/node@20.17.46) + '@inquirer/core': 10.1.9(@types/node@20.17.50) + '@inquirer/type': 3.0.5(@types/node@20.17.50) optionalDependencies: - '@types/node': 20.17.46 + '@types/node': 20.17.50 - '@inquirer/core@10.1.9(@types/node@20.17.46)': + '@inquirer/core@10.1.9(@types/node@20.17.50)': dependencies: '@inquirer/figures': 1.0.11 - '@inquirer/type': 3.0.5(@types/node@20.17.46) + '@inquirer/type': 3.0.5(@types/node@20.17.50) ansi-escapes: 4.3.2 cli-width: 4.1.0 mute-stream: 2.0.0 @@ -8657,93 +8658,93 @@ snapshots: wrap-ansi: 6.2.0 yoctocolors-cjs: 2.1.2 optionalDependencies: - '@types/node': 20.17.46 + '@types/node': 20.17.50 - '@inquirer/editor@4.2.9(@types/node@20.17.46)': + '@inquirer/editor@4.2.9(@types/node@20.17.50)': dependencies: - '@inquirer/core': 10.1.9(@types/node@20.17.46) - '@inquirer/type': 3.0.5(@types/node@20.17.46) + '@inquirer/core': 10.1.9(@types/node@20.17.50) + '@inquirer/type': 3.0.5(@types/node@20.17.50) external-editor: 3.1.0 optionalDependencies: - '@types/node': 20.17.46 + '@types/node': 20.17.50 - '@inquirer/expand@4.0.11(@types/node@20.17.46)': + '@inquirer/expand@4.0.11(@types/node@20.17.50)': dependencies: - '@inquirer/core': 10.1.9(@types/node@20.17.46) - '@inquirer/type': 3.0.5(@types/node@20.17.46) + '@inquirer/core': 10.1.9(@types/node@20.17.50) + '@inquirer/type': 3.0.5(@types/node@20.17.50) yoctocolors-cjs: 2.1.2 optionalDependencies: - '@types/node': 20.17.46 + '@types/node': 20.17.50 '@inquirer/figures@1.0.11': {} - '@inquirer/input@4.1.8(@types/node@20.17.46)': + '@inquirer/input@4.1.8(@types/node@20.17.50)': dependencies: - '@inquirer/core': 10.1.9(@types/node@20.17.46) - '@inquirer/type': 3.0.5(@types/node@20.17.46) + '@inquirer/core': 10.1.9(@types/node@20.17.50) + '@inquirer/type': 3.0.5(@types/node@20.17.50) optionalDependencies: - '@types/node': 20.17.46 + '@types/node': 20.17.50 - '@inquirer/number@3.0.11(@types/node@20.17.46)': + '@inquirer/number@3.0.11(@types/node@20.17.50)': dependencies: - '@inquirer/core': 10.1.9(@types/node@20.17.46) - '@inquirer/type': 3.0.5(@types/node@20.17.46) + '@inquirer/core': 10.1.9(@types/node@20.17.50) + '@inquirer/type': 3.0.5(@types/node@20.17.50) optionalDependencies: - '@types/node': 20.17.46 + '@types/node': 20.17.50 - '@inquirer/password@4.0.11(@types/node@20.17.46)': + '@inquirer/password@4.0.11(@types/node@20.17.50)': dependencies: - '@inquirer/core': 10.1.9(@types/node@20.17.46) - '@inquirer/type': 3.0.5(@types/node@20.17.46) + '@inquirer/core': 10.1.9(@types/node@20.17.50) + '@inquirer/type': 3.0.5(@types/node@20.17.50) ansi-escapes: 4.3.2 optionalDependencies: - '@types/node': 20.17.46 - - '@inquirer/prompts@7.4.0(@types/node@20.17.46)': - dependencies: - '@inquirer/checkbox': 4.1.4(@types/node@20.17.46) - '@inquirer/confirm': 5.1.8(@types/node@20.17.46) - '@inquirer/editor': 4.2.9(@types/node@20.17.46) - '@inquirer/expand': 4.0.11(@types/node@20.17.46) - '@inquirer/input': 4.1.8(@types/node@20.17.46) - '@inquirer/number': 3.0.11(@types/node@20.17.46) - '@inquirer/password': 4.0.11(@types/node@20.17.46) - '@inquirer/rawlist': 4.0.11(@types/node@20.17.46) - '@inquirer/search': 3.0.11(@types/node@20.17.46) - '@inquirer/select': 4.1.0(@types/node@20.17.46) + '@types/node': 20.17.50 + + '@inquirer/prompts@7.4.0(@types/node@20.17.50)': + dependencies: + '@inquirer/checkbox': 4.1.4(@types/node@20.17.50) + '@inquirer/confirm': 5.1.8(@types/node@20.17.50) + '@inquirer/editor': 4.2.9(@types/node@20.17.50) + '@inquirer/expand': 4.0.11(@types/node@20.17.50) + '@inquirer/input': 4.1.8(@types/node@20.17.50) + '@inquirer/number': 3.0.11(@types/node@20.17.50) + '@inquirer/password': 4.0.11(@types/node@20.17.50) + '@inquirer/rawlist': 4.0.11(@types/node@20.17.50) + '@inquirer/search': 3.0.11(@types/node@20.17.50) + '@inquirer/select': 4.1.0(@types/node@20.17.50) optionalDependencies: - '@types/node': 20.17.46 + '@types/node': 20.17.50 - '@inquirer/rawlist@4.0.11(@types/node@20.17.46)': + '@inquirer/rawlist@4.0.11(@types/node@20.17.50)': dependencies: - '@inquirer/core': 10.1.9(@types/node@20.17.46) - '@inquirer/type': 3.0.5(@types/node@20.17.46) + '@inquirer/core': 10.1.9(@types/node@20.17.50) + '@inquirer/type': 3.0.5(@types/node@20.17.50) yoctocolors-cjs: 2.1.2 optionalDependencies: - '@types/node': 20.17.46 + '@types/node': 20.17.50 - '@inquirer/search@3.0.11(@types/node@20.17.46)': + '@inquirer/search@3.0.11(@types/node@20.17.50)': dependencies: - '@inquirer/core': 10.1.9(@types/node@20.17.46) + '@inquirer/core': 10.1.9(@types/node@20.17.50) '@inquirer/figures': 1.0.11 - '@inquirer/type': 3.0.5(@types/node@20.17.46) + '@inquirer/type': 3.0.5(@types/node@20.17.50) yoctocolors-cjs: 2.1.2 optionalDependencies: - '@types/node': 20.17.46 + '@types/node': 20.17.50 - '@inquirer/select@4.1.0(@types/node@20.17.46)': + '@inquirer/select@4.1.0(@types/node@20.17.50)': dependencies: - '@inquirer/core': 10.1.9(@types/node@20.17.46) + '@inquirer/core': 10.1.9(@types/node@20.17.50) '@inquirer/figures': 1.0.11 - '@inquirer/type': 3.0.5(@types/node@20.17.46) + '@inquirer/type': 3.0.5(@types/node@20.17.50) ansi-escapes: 4.3.2 yoctocolors-cjs: 2.1.2 optionalDependencies: - '@types/node': 20.17.46 + '@types/node': 20.17.50 - '@inquirer/type@3.0.5(@types/node@20.17.46)': + '@inquirer/type@3.0.5(@types/node@20.17.50)': optionalDependencies: - '@types/node': 20.17.46 + '@types/node': 20.17.50 '@isaacs/cliui@8.0.2': dependencies: @@ -8767,27 +8768,27 @@ snapshots: '@jest/console@29.7.0': dependencies: '@jest/types': 29.6.3 - '@types/node': 20.17.46 + '@types/node': 20.17.50 chalk: 4.1.2 jest-message-util: 29.7.0 jest-util: 29.7.0 slash: 3.0.0 - '@jest/core@29.7.0(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.46)(typescript@5.8.3))': + '@jest/core@29.7.0(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.50)(typescript@5.8.3))': dependencies: '@jest/console': 29.7.0 '@jest/reporters': 29.7.0 '@jest/test-result': 29.7.0 '@jest/transform': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.17.46 + '@types/node': 20.17.50 ansi-escapes: 4.3.2 chalk: 4.1.2 ci-info: 3.9.0 exit: 0.1.2 graceful-fs: 4.2.11(patch_hash=68ebc232025360cb3dcd3081f4067f4e9fc022ab6b6f71a3230e86c7a5b337d1) jest-changed-files: 29.7.0 - jest-config: 29.7.0(@types/node@20.17.46)(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.46)(typescript@5.8.3)) + jest-config: 29.7.0(@types/node@20.17.50)(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.50)(typescript@5.8.3)) jest-haste-map: 29.7.0 jest-message-util: 29.7.0 jest-regex-util: 29.6.3 @@ -8812,7 +8813,7 @@ snapshots: dependencies: '@jest/fake-timers': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.17.46 + '@types/node': 20.17.50 jest-mock: 29.7.0 '@jest/expect-utils@29.7.0': @@ -8830,7 +8831,7 @@ snapshots: dependencies: '@jest/types': 29.6.3 '@sinonjs/fake-timers': 10.3.0 - '@types/node': 20.17.46 + '@types/node': 20.17.50 jest-message-util: 29.7.0 jest-mock: 29.7.0 jest-util: 29.7.0 @@ -8852,7 +8853,7 @@ snapshots: '@jest/transform': 29.7.0 '@jest/types': 29.6.3 '@jridgewell/trace-mapping': 0.3.25 - '@types/node': 20.17.46 + '@types/node': 20.17.50 chalk: 4.1.2 collect-v8-coverage: 1.0.2 exit: 0.1.2 @@ -8922,7 +8923,7 @@ snapshots: '@jest/schemas': 29.6.3 '@types/istanbul-lib-coverage': 2.0.6 '@types/istanbul-reports': 3.0.4 - '@types/node': 20.17.46 + '@types/node': 20.17.50 '@types/yargs': 17.0.33 chalk: 4.1.2 @@ -9027,23 +9028,23 @@ snapshots: dependencies: langium: 3.3.1 - '@microsoft/api-extractor-model@7.30.5(@types/node@20.17.46)': + '@microsoft/api-extractor-model@7.30.5(@types/node@20.17.50)': dependencies: '@microsoft/tsdoc': 0.15.1 '@microsoft/tsdoc-config': 0.17.1 - '@rushstack/node-core-library': 5.13.0(@types/node@20.17.46) + '@rushstack/node-core-library': 5.13.0(@types/node@20.17.50) transitivePeerDependencies: - '@types/node' - '@microsoft/api-extractor@7.52.5(@types/node@20.17.46)': + '@microsoft/api-extractor@7.52.5(@types/node@20.17.50)': dependencies: - '@microsoft/api-extractor-model': 7.30.5(@types/node@20.17.46) + '@microsoft/api-extractor-model': 7.30.5(@types/node@20.17.50) '@microsoft/tsdoc': 0.15.1 '@microsoft/tsdoc-config': 0.17.1 - '@rushstack/node-core-library': 5.13.0(@types/node@20.17.46) + '@rushstack/node-core-library': 5.13.0(@types/node@20.17.50) '@rushstack/rig-package': 0.5.3 - '@rushstack/terminal': 0.15.2(@types/node@20.17.46) - '@rushstack/ts-command-line': 5.0.0(@types/node@20.17.46) + '@rushstack/terminal': 0.15.2(@types/node@20.17.50) + '@rushstack/ts-command-line': 5.0.0(@types/node@20.17.50) lodash: 4.17.21 minimatch: 3.0.8 resolve: 1.22.10 @@ -9087,9 +9088,9 @@ snapshots: '@module-federation/runtime': 0.13.1 '@module-federation/sdk': 0.13.1 - '@napi-rs/cli@3.0.0-alpha.78(@emnapi/runtime@1.4.1)(@types/node@20.17.46)(emnapi@1.4.3)': + '@napi-rs/cli@3.0.0-alpha.80(@emnapi/runtime@1.4.3)(@types/node@20.17.50)(emnapi@1.4.3)': dependencies: - '@inquirer/prompts': 7.4.0(@types/node@20.17.46) + '@inquirer/prompts': 7.4.0(@types/node@20.17.50) '@napi-rs/cross-toolchain': 0.0.19 '@napi-rs/wasm-tools': 0.0.3 '@octokit/rest': 21.1.1 @@ -9098,12 +9099,12 @@ snapshots: debug: 4.4.0 js-yaml: 4.1.0 lodash-es: 4.17.21 - semver: 7.7.1 + semver: 7.7.2 toml: 3.0.0 typanion: 3.14.0 wasm-sjlj: 1.0.6 optionalDependencies: - '@emnapi/runtime': 1.4.1 + '@emnapi/runtime': 1.4.3 emnapi: 1.4.3 transitivePeerDependencies: - '@napi-rs/cross-toolchain-arm64-target-aarch64' @@ -9164,7 +9165,7 @@ snapshots: '@napi-rs/lzma-wasm32-wasi@1.4.1': dependencies: - '@napi-rs/wasm-runtime': 0.2.9 + '@napi-rs/wasm-runtime': 0.2.10 optional: true '@napi-rs/lzma-win32-arm64-msvc@1.4.1': @@ -9234,7 +9235,7 @@ snapshots: '@napi-rs/tar-wasm32-wasi@0.1.4': dependencies: - '@napi-rs/wasm-runtime': 0.2.9 + '@napi-rs/wasm-runtime': 0.2.10 optional: true '@napi-rs/tar-win32-arm64-msvc@0.1.4': @@ -9265,10 +9266,10 @@ snapshots: '@napi-rs/tar-win32-ia32-msvc': 0.1.4 '@napi-rs/tar-win32-x64-msvc': 0.1.4 - '@napi-rs/wasm-runtime@0.2.9': + '@napi-rs/wasm-runtime@0.2.10': dependencies: '@emnapi/core': 1.4.3 - '@emnapi/runtime': 1.4.1 + '@emnapi/runtime': 1.4.3 '@tybys/wasm-util': 0.9.0 '@napi-rs/wasm-tools-android-arm-eabi@0.0.3': @@ -9300,7 +9301,7 @@ snapshots: '@napi-rs/wasm-tools-wasm32-wasi@0.0.3': dependencies: - '@napi-rs/wasm-runtime': 0.2.9 + '@napi-rs/wasm-runtime': 0.2.10 optional: true '@napi-rs/wasm-tools-win32-arm64-msvc@0.0.3': @@ -9504,13 +9505,13 @@ snapshots: reduce-configs: 1.1.0 sass-embedded: 1.86.1 - '@rslib/core@0.7.0(@microsoft/api-extractor@7.52.5(@types/node@20.17.46))(typescript@5.8.3)': + '@rslib/core@0.7.0(@microsoft/api-extractor@7.52.5(@types/node@20.17.50))(typescript@5.8.3)': dependencies: '@rsbuild/core': 1.3.19 - rsbuild-plugin-dts: 0.7.0(@microsoft/api-extractor@7.52.5(@types/node@20.17.46))(@rsbuild/core@1.3.19)(typescript@5.8.3) + rsbuild-plugin-dts: 0.7.0(@microsoft/api-extractor@7.52.5(@types/node@20.17.50))(@rsbuild/core@1.3.19)(typescript@5.8.3) tinyglobby: 0.2.13 optionalDependencies: - '@microsoft/api-extractor': 7.52.5(@types/node@20.17.46) + '@microsoft/api-extractor': 7.52.5(@types/node@20.17.50) typescript: 5.8.3 '@rspack/binding-darwin-arm64@1.3.11': @@ -9796,7 +9797,7 @@ snapshots: react: 19.1.0 react-dom: 19.1.0(react@19.1.0) - '@rstack-dev/doc-ui@1.10.1(react-dom@19.1.0(react@19.1.0))(react@19.1.0)': + '@rstack-dev/doc-ui@1.10.2(react-dom@19.1.0(react@19.1.0))(react@19.1.0)': dependencies: framer-motion: 12.11.3(react-dom@19.1.0(react@19.1.0))(react@19.1.0) transitivePeerDependencies: @@ -9804,7 +9805,7 @@ snapshots: - react - react-dom - '@rushstack/node-core-library@5.13.0(@types/node@20.17.46)': + '@rushstack/node-core-library@5.13.0(@types/node@20.17.50)': dependencies: ajv: 8.13.0 ajv-draft-04: 1.0.0(ajv@8.13.0) @@ -9815,23 +9816,23 @@ snapshots: resolve: 1.22.10 semver: 7.5.4 optionalDependencies: - '@types/node': 20.17.46 + '@types/node': 20.17.50 '@rushstack/rig-package@0.5.3': dependencies: resolve: 1.22.10 strip-json-comments: 3.1.1 - '@rushstack/terminal@0.15.2(@types/node@20.17.46)': + '@rushstack/terminal@0.15.2(@types/node@20.17.50)': dependencies: - '@rushstack/node-core-library': 5.13.0(@types/node@20.17.46) + '@rushstack/node-core-library': 5.13.0(@types/node@20.17.50) supports-color: 8.1.1 optionalDependencies: - '@types/node': 20.17.46 + '@types/node': 20.17.50 - '@rushstack/ts-command-line@5.0.0(@types/node@20.17.46)': + '@rushstack/ts-command-line@5.0.0(@types/node@20.17.50)': dependencies: - '@rushstack/terminal': 0.15.2(@types/node@20.17.46) + '@rushstack/terminal': 0.15.2(@types/node@20.17.50) '@types/argparse': 1.0.38 argparse: 1.0.10 string-argv: 0.3.2 @@ -10003,20 +10004,20 @@ snapshots: '@types/body-parser@1.19.5': dependencies: '@types/connect': 3.4.38 - '@types/node': 20.17.46 + '@types/node': 20.17.50 '@types/bonjour@3.5.13': dependencies: - '@types/node': 20.17.46 + '@types/node': 20.17.50 '@types/connect-history-api-fallback@1.5.4': dependencies: '@types/express-serve-static-core': 4.19.0 - '@types/node': 20.17.46 + '@types/node': 20.17.50 '@types/connect@3.4.38': dependencies: - '@types/node': 20.17.46 + '@types/node': 20.17.50 '@types/d3-array@3.2.1': {} @@ -10157,7 +10158,7 @@ snapshots: '@types/express-serve-static-core@4.19.0': dependencies: - '@types/node': 20.17.46 + '@types/node': 20.17.50 '@types/qs': 6.9.14 '@types/range-parser': 1.2.7 '@types/send': 0.17.4 @@ -10172,13 +10173,13 @@ snapshots: '@types/fs-extra@11.0.4': dependencies: '@types/jsonfile': 6.1.4 - '@types/node': 20.17.24 + '@types/node': 20.17.50 '@types/geojson@7946.0.16': {} '@types/graceful-fs@4.1.9': dependencies: - '@types/node': 20.17.24 + '@types/node': 20.17.50 '@types/hast@3.0.4': dependencies: @@ -10190,11 +10191,11 @@ snapshots: '@types/http-proxy@1.17.14': dependencies: - '@types/node': 20.17.46 + '@types/node': 20.17.50 '@types/interpret@1.1.3': dependencies: - '@types/node': 20.17.24 + '@types/node': 20.17.50 '@types/is-ci@3.0.4': dependencies: @@ -10217,13 +10218,13 @@ snapshots: '@types/jsdom@20.0.1': dependencies: - '@types/node': 20.17.46 + '@types/node': 20.17.50 '@types/tough-cookie': 4.0.5 parse5: 7.2.1 '@types/jsdom@21.1.7': dependencies: - '@types/node': 20.17.24 + '@types/node': 20.17.50 '@types/tough-cookie': 4.0.5 parse5: 7.2.1 @@ -10231,7 +10232,7 @@ snapshots: '@types/jsonfile@6.1.4': dependencies: - '@types/node': 20.17.46 + '@types/node': 20.17.50 '@types/mdast@4.0.4': dependencies: @@ -10245,13 +10246,9 @@ snapshots: '@types/node-forge@1.3.11': dependencies: - '@types/node': 20.17.46 + '@types/node': 20.17.50 - '@types/node@20.17.24': - dependencies: - undici-types: 6.19.8 - - '@types/node@20.17.46': + '@types/node@20.17.50': dependencies: undici-types: 6.19.8 @@ -10278,7 +10275,7 @@ snapshots: '@types/send@0.17.4': dependencies: '@types/mime': 1.3.5 - '@types/node': 20.17.46 + '@types/node': 20.17.50 '@types/serve-index@1.9.4': dependencies: @@ -10287,12 +10284,12 @@ snapshots: '@types/serve-static@1.15.7': dependencies: '@types/http-errors': 2.0.4 - '@types/node': 20.17.46 + '@types/node': 20.17.50 '@types/send': 0.17.4 '@types/sockjs@0.3.36': dependencies: - '@types/node': 20.17.46 + '@types/node': 20.17.50 '@types/source-list-map@0.1.6': {} @@ -10310,11 +10307,11 @@ snapshots: '@types/watchpack@2.4.4': dependencies: '@types/graceful-fs': 4.1.9 - '@types/node': 20.17.24 + '@types/node': 20.17.50 '@types/webpack-bundle-analyzer@4.7.0(@swc/core@1.11.24(@swc/helpers@0.5.17))': dependencies: - '@types/node': 20.17.24 + '@types/node': 20.17.50 tapable: 2.2.1 webpack: 5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17)) transitivePeerDependencies: @@ -10325,13 +10322,13 @@ snapshots: '@types/webpack-sources@3.2.3': dependencies: - '@types/node': 20.17.24 + '@types/node': 20.17.50 '@types/source-list-map': 0.1.6 source-map: 0.7.4 '@types/ws@8.18.0': dependencies: - '@types/node': 20.17.46 + '@types/node': 20.17.50 '@types/yargs-parser@21.0.3': {} @@ -10348,99 +10345,99 @@ snapshots: '@vercel/ncc@0.38.3': {} - '@vitest/expect@3.1.3': + '@vitest/expect@3.1.4': dependencies: - '@vitest/spy': 3.1.3 - '@vitest/utils': 3.1.3 + '@vitest/spy': 3.1.4 + '@vitest/utils': 3.1.4 chai: 5.2.0 tinyrainbow: 2.0.0 - '@vitest/mocker@3.1.3(vite@5.4.14(@types/node@20.17.46)(less@4.3.0)(sass-embedded@1.86.1)(sass@1.56.2)(terser@5.39.1))': + '@vitest/mocker@3.1.4(vite@5.4.14(@types/node@20.17.50)(less@4.3.0)(sass-embedded@1.86.1)(sass@1.56.2)(terser@5.39.2))': dependencies: - '@vitest/spy': 3.1.3 + '@vitest/spy': 3.1.4 estree-walker: 3.0.3 magic-string: 0.30.17 optionalDependencies: - vite: 5.4.14(@types/node@20.17.46)(less@4.3.0)(sass-embedded@1.86.1)(sass@1.56.2)(terser@5.39.1) + vite: 5.4.14(@types/node@20.17.50)(less@4.3.0)(sass-embedded@1.86.1)(sass@1.56.2)(terser@5.39.2) - '@vitest/pretty-format@3.1.3': + '@vitest/pretty-format@3.1.4': dependencies: tinyrainbow: 2.0.0 - '@vitest/runner@3.1.3': + '@vitest/runner@3.1.4': dependencies: - '@vitest/utils': 3.1.3 + '@vitest/utils': 3.1.4 pathe: 2.0.3 - '@vitest/snapshot@3.1.3': + '@vitest/snapshot@3.1.4': dependencies: - '@vitest/pretty-format': 3.1.3 + '@vitest/pretty-format': 3.1.4 magic-string: 0.30.17 pathe: 2.0.3 - '@vitest/spy@3.1.3': + '@vitest/spy@3.1.4': dependencies: tinyspy: 3.0.2 - '@vitest/utils@3.1.3': + '@vitest/utils@3.1.4': dependencies: - '@vitest/pretty-format': 3.1.3 + '@vitest/pretty-format': 3.1.4 loupe: 3.1.3 tinyrainbow: 2.0.0 - '@vue/compiler-core@3.5.13': + '@vue/compiler-core@3.5.14': dependencies: '@babel/parser': 7.27.2 - '@vue/shared': 3.5.13 + '@vue/shared': 3.5.14 entities: 4.5.0 estree-walker: 2.0.2 source-map-js: 1.2.1 - '@vue/compiler-dom@3.5.13': + '@vue/compiler-dom@3.5.14': dependencies: - '@vue/compiler-core': 3.5.13 - '@vue/shared': 3.5.13 + '@vue/compiler-core': 3.5.14 + '@vue/shared': 3.5.14 - '@vue/compiler-sfc@3.5.13': + '@vue/compiler-sfc@3.5.14': dependencies: '@babel/parser': 7.27.2 - '@vue/compiler-core': 3.5.13 - '@vue/compiler-dom': 3.5.13 - '@vue/compiler-ssr': 3.5.13 - '@vue/shared': 3.5.13 + '@vue/compiler-core': 3.5.14 + '@vue/compiler-dom': 3.5.14 + '@vue/compiler-ssr': 3.5.14 + '@vue/shared': 3.5.14 estree-walker: 2.0.2 magic-string: 0.30.17 postcss: 8.5.3 source-map-js: 1.2.1 - '@vue/compiler-ssr@3.5.13': + '@vue/compiler-ssr@3.5.14': dependencies: - '@vue/compiler-dom': 3.5.13 - '@vue/shared': 3.5.13 + '@vue/compiler-dom': 3.5.14 + '@vue/shared': 3.5.14 - '@vue/reactivity@3.5.13': + '@vue/reactivity@3.5.14': dependencies: - '@vue/shared': 3.5.13 + '@vue/shared': 3.5.14 - '@vue/runtime-core@3.5.13': + '@vue/runtime-core@3.5.14': dependencies: - '@vue/reactivity': 3.5.13 - '@vue/shared': 3.5.13 + '@vue/reactivity': 3.5.14 + '@vue/shared': 3.5.14 - '@vue/runtime-dom@3.5.13': + '@vue/runtime-dom@3.5.14': dependencies: - '@vue/reactivity': 3.5.13 - '@vue/runtime-core': 3.5.13 - '@vue/shared': 3.5.13 + '@vue/reactivity': 3.5.14 + '@vue/runtime-core': 3.5.14 + '@vue/shared': 3.5.14 csstype: 3.1.3 - '@vue/server-renderer@3.5.13(vue@3.5.13(typescript@5.8.3))': + '@vue/server-renderer@3.5.14(vue@3.5.14(typescript@5.8.3))': dependencies: - '@vue/compiler-ssr': 3.5.13 - '@vue/shared': 3.5.13 - vue: 3.5.13(typescript@5.8.3) + '@vue/compiler-ssr': 3.5.14 + '@vue/shared': 3.5.14 + vue: 3.5.14(typescript@5.8.3) - '@vue/shared@3.5.13': {} + '@vue/shared@3.5.14': {} '@webassemblyjs/ast@1.14.1': dependencies: @@ -11097,13 +11094,13 @@ snapshots: optionalDependencies: typescript: 5.8.3 - create-jest@29.7.0(@types/node@20.17.46)(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.46)(typescript@5.8.3)): + create-jest@29.7.0(@types/node@20.17.50)(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.50)(typescript@5.8.3)): dependencies: '@jest/types': 29.6.3 chalk: 4.1.2 exit: 0.1.2 graceful-fs: 4.2.11(patch_hash=68ebc232025360cb3dcd3081f4067f4e9fc022ab6b6f71a3230e86c7a5b337d1) - jest-config: 29.7.0(@types/node@20.17.46)(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.46)(typescript@5.8.3)) + jest-config: 29.7.0(@types/node@20.17.50)(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.50)(typescript@5.8.3)) jest-util: 29.7.0 prompts: 2.4.2 transitivePeerDependencies: @@ -12238,7 +12235,7 @@ snapshots: he: 1.2.0 param-case: 3.0.4 relateurl: 0.2.7 - terser: 5.39.1 + terser: 5.39.2 html-minifier-terser@7.2.0: dependencies: @@ -12248,7 +12245,7 @@ snapshots: entities: 4.5.0 param-case: 3.0.4 relateurl: 0.2.7 - terser: 5.39.1 + terser: 5.39.2 html-to-text@9.0.5: dependencies: @@ -12587,7 +12584,7 @@ snapshots: '@jest/expect': 29.7.0 '@jest/test-result': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.17.46 + '@types/node': 20.17.50 chalk: 4.1.2 co: 4.6.0 dedent: 1.5.1 @@ -12607,16 +12604,16 @@ snapshots: - babel-plugin-macros - supports-color - jest-cli@29.7.0(@types/node@20.17.46)(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.46)(typescript@5.8.3)): + jest-cli@29.7.0(@types/node@20.17.50)(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.50)(typescript@5.8.3)): dependencies: - '@jest/core': 29.7.0(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.46)(typescript@5.8.3)) + '@jest/core': 29.7.0(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.50)(typescript@5.8.3)) '@jest/test-result': 29.7.0 '@jest/types': 29.6.3 chalk: 4.1.2 - create-jest: 29.7.0(@types/node@20.17.46)(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.46)(typescript@5.8.3)) + create-jest: 29.7.0(@types/node@20.17.50)(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.50)(typescript@5.8.3)) exit: 0.1.2 import-local: 3.1.0 - jest-config: 29.7.0(@types/node@20.17.46)(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.46)(typescript@5.8.3)) + jest-config: 29.7.0(@types/node@20.17.50)(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.50)(typescript@5.8.3)) jest-util: 29.7.0 jest-validate: 29.7.0 yargs: 17.7.2 @@ -12626,7 +12623,7 @@ snapshots: - supports-color - ts-node - jest-config@29.7.0(@types/node@20.17.46)(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.46)(typescript@5.8.3)): + jest-config@29.7.0(@types/node@20.17.50)(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.50)(typescript@5.8.3)): dependencies: '@babel/core': 7.27.1 '@jest/test-sequencer': 29.7.0 @@ -12651,8 +12648,8 @@ snapshots: slash: 3.0.0 strip-json-comments: 3.1.1 optionalDependencies: - '@types/node': 20.17.46 - ts-node: 10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.46)(typescript@5.8.3) + '@types/node': 20.17.50 + ts-node: 10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.50)(typescript@5.8.3) transitivePeerDependencies: - babel-plugin-macros - supports-color @@ -12682,7 +12679,7 @@ snapshots: '@jest/fake-timers': 29.7.0 '@jest/types': 29.6.3 '@types/jsdom': 20.0.1 - '@types/node': 20.17.24 + '@types/node': 20.17.50 jest-mock: 29.7.0 jest-util: 29.7.0 jsdom: 20.0.3 @@ -12696,7 +12693,7 @@ snapshots: '@jest/environment': 29.7.0 '@jest/fake-timers': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.17.46 + '@types/node': 20.17.50 jest-mock: 29.7.0 jest-util: 29.7.0 @@ -12706,7 +12703,7 @@ snapshots: dependencies: '@jest/types': 29.6.3 '@types/graceful-fs': 4.1.9 - '@types/node': 20.17.46 + '@types/node': 20.17.50 anymatch: 3.1.3 fb-watchman: 2.0.2 graceful-fs: 4.2.11(patch_hash=68ebc232025360cb3dcd3081f4067f4e9fc022ab6b6f71a3230e86c7a5b337d1) @@ -12745,7 +12742,7 @@ snapshots: jest-mock@29.7.0: dependencies: '@jest/types': 29.6.3 - '@types/node': 20.17.46 + '@types/node': 20.17.50 jest-util: 29.7.0 jest-pnp-resolver@1.2.3(jest-resolve@29.7.0): @@ -12780,7 +12777,7 @@ snapshots: '@jest/test-result': 29.7.0 '@jest/transform': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.17.46 + '@types/node': 20.17.50 chalk: 4.1.2 emittery: 0.13.1 graceful-fs: 4.2.11(patch_hash=68ebc232025360cb3dcd3081f4067f4e9fc022ab6b6f71a3230e86c7a5b337d1) @@ -12808,7 +12805,7 @@ snapshots: '@jest/test-result': 29.7.0 '@jest/transform': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.17.46 + '@types/node': 20.17.50 chalk: 4.1.2 cjs-module-lexer: 1.2.3 collect-v8-coverage: 1.0.2 @@ -12854,7 +12851,7 @@ snapshots: jest-util@29.7.0: dependencies: '@jest/types': 29.6.3 - '@types/node': 20.17.46 + '@types/node': 20.17.50 chalk: 4.1.2 ci-info: 3.9.0 graceful-fs: 4.2.11(patch_hash=68ebc232025360cb3dcd3081f4067f4e9fc022ab6b6f71a3230e86c7a5b337d1) @@ -12869,11 +12866,11 @@ snapshots: leven: 3.1.0 pretty-format: 29.7.0 - jest-watch-typeahead@2.2.2(jest@29.7.0(@types/node@20.17.46)(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.46)(typescript@5.8.3))): + jest-watch-typeahead@2.2.2(jest@29.7.0(@types/node@20.17.50)(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.50)(typescript@5.8.3))): dependencies: ansi-escapes: 6.2.1 chalk: 5.4.1 - jest: 29.7.0(@types/node@20.17.46)(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.46)(typescript@5.8.3)) + jest: 29.7.0(@types/node@20.17.50)(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.50)(typescript@5.8.3)) jest-regex-util: 29.6.3 jest-watcher: 29.7.0 slash: 5.1.0 @@ -12884,7 +12881,7 @@ snapshots: dependencies: '@jest/test-result': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.17.46 + '@types/node': 20.17.50 ansi-escapes: 4.3.2 chalk: 4.1.2 emittery: 0.13.1 @@ -12893,23 +12890,23 @@ snapshots: jest-worker@27.5.1: dependencies: - '@types/node': 20.17.46 + '@types/node': 20.17.50 merge-stream: 2.0.0 supports-color: 8.1.1 jest-worker@29.7.0: dependencies: - '@types/node': 20.17.46 + '@types/node': 20.17.50 jest-util: 29.7.0 merge-stream: 2.0.0 supports-color: 8.1.1 - jest@29.7.0(@types/node@20.17.46)(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.46)(typescript@5.8.3)): + jest@29.7.0(@types/node@20.17.50)(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.50)(typescript@5.8.3)): dependencies: - '@jest/core': 29.7.0(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.46)(typescript@5.8.3)) + '@jest/core': 29.7.0(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.50)(typescript@5.8.3)) '@jest/types': 29.6.3 import-local: 3.1.0 - jest-cli: 29.7.0(@types/node@20.17.46)(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.46)(typescript@5.8.3)) + jest-cli: 29.7.0(@types/node@20.17.50)(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.50)(typescript@5.8.3)) transitivePeerDependencies: - '@types/node' - babel-plugin-macros @@ -13370,7 +13367,7 @@ snapshots: medium-zoom@1.1.0: {} - memfs@4.17.1: + memfs@4.17.2: dependencies: '@jsonjoy.com/json-pack': 1.1.0(tslib@2.8.1) '@jsonjoy.com/util': 1.5.0(tslib@2.8.1) @@ -14022,13 +14019,13 @@ snapshots: camelcase-css: 2.0.1 postcss: 8.5.3 - postcss-load-config@4.0.2(postcss@8.5.3)(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.46)(typescript@5.8.3)): + postcss-load-config@4.0.2(postcss@8.5.3)(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.50)(typescript@5.8.3)): dependencies: lilconfig: 3.1.3 yaml: 2.7.0 optionalDependencies: postcss: 8.5.3 - ts-node: 10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.46)(typescript@5.8.3) + ts-node: 10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.50)(typescript@5.8.3) postcss-loader@8.1.1(@rspack/core@packages+rspack)(postcss@8.5.3)(typescript@5.8.3)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))): dependencies: @@ -14504,7 +14501,7 @@ snapshots: rrweb-cssom@0.8.0: {} - rsbuild-plugin-dts@0.7.0(@microsoft/api-extractor@7.52.5(@types/node@20.17.46))(@rsbuild/core@1.3.19)(typescript@5.8.3): + rsbuild-plugin-dts@0.7.0(@microsoft/api-extractor@7.52.5(@types/node@20.17.50))(@rsbuild/core@1.3.19)(typescript@5.8.3): dependencies: '@ast-grep/napi': 0.38.1 '@rsbuild/core': 1.3.19 @@ -14513,7 +14510,7 @@ snapshots: tinyglobby: 0.2.13 tsconfig-paths: 4.2.0 optionalDependencies: - '@microsoft/api-extractor': 7.52.5(@types/node@20.17.46) + '@microsoft/api-extractor': 7.52.5(@types/node@20.17.50) typescript: 5.8.3 rsbuild-plugin-google-analytics@1.0.3(@rsbuild/core@1.3.19): @@ -15020,7 +15017,7 @@ snapshots: sync-message-port@1.1.3: {} - tailwindcss@3.4.17(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.46)(typescript@5.8.3)): + tailwindcss@3.4.17(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.50)(typescript@5.8.3)): dependencies: '@alloc/quick-lru': 5.2.0 arg: 5.0.2 @@ -15039,7 +15036,7 @@ snapshots: postcss: 8.5.3 postcss-import: 15.1.0(postcss@8.5.3) postcss-js: 4.0.1(postcss@8.5.3) - postcss-load-config: 4.0.2(postcss@8.5.3)(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.46)(typescript@5.8.3)) + postcss-load-config: 4.0.2(postcss@8.5.3)(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.50)(typescript@5.8.3)) postcss-nested: 6.2.0(postcss@8.5.3) postcss-selector-parser: 6.1.2 resolve: 1.22.10 @@ -15049,13 +15046,15 @@ snapshots: tapable@2.2.1: {} + tapable@2.2.2: {} + terser-webpack-plugin@5.3.14(@swc/core@1.11.24(@swc/helpers@0.5.17))(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))): dependencies: '@jridgewell/trace-mapping': 0.3.25 jest-worker: 27.5.1 schema-utils: 4.3.0 serialize-javascript: 6.0.2 - terser: 5.39.1 + terser: 5.39.2 webpack: 5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17)) optionalDependencies: '@swc/core': 1.11.24(@swc/helpers@0.5.17) @@ -15067,7 +15066,7 @@ snapshots: commander: 2.20.3 source-map-support: 0.5.21 - terser@5.39.1: + terser@5.39.2: dependencies: '@jridgewell/source-map': 0.3.6 acorn: 8.14.1 @@ -15170,18 +15169,18 @@ snapshots: ts-interface-checker@0.1.13: {} - ts-jest@29.3.2(@babel/core@7.27.1)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.27.1))(jest@29.7.0(@types/node@20.17.46)(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.46)(typescript@5.8.3)))(typescript@5.8.3): + ts-jest@29.3.4(@babel/core@7.27.1)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.27.1))(jest@29.7.0(@types/node@20.17.50)(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.50)(typescript@5.8.3)))(typescript@5.8.3): dependencies: bs-logger: 0.2.6 ejs: 3.1.10 fast-json-stable-stringify: 2.1.0 - jest: 29.7.0(@types/node@20.17.46)(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.46)(typescript@5.8.3)) + jest: 29.7.0(@types/node@20.17.50)(ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.50)(typescript@5.8.3)) jest-util: 29.7.0 json5: 2.2.3 lodash.memoize: 4.1.2 make-error: 1.3.6 semver: 7.7.2 - type-fest: 4.39.1 + type-fest: 4.41.0 typescript: 5.8.3 yargs-parser: 21.1.1 optionalDependencies: @@ -15200,14 +15199,14 @@ snapshots: typescript: 5.8.3 webpack: 5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17)) - ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.46)(typescript@5.8.3): + ts-node@10.9.2(@swc/core@1.11.24(@swc/helpers@0.5.17))(@types/node@20.17.50)(typescript@5.8.3): dependencies: '@cspotcode/source-map-support': 0.8.1 '@tsconfig/node10': 1.0.11 '@tsconfig/node12': 1.0.11 '@tsconfig/node14': 1.0.3 '@tsconfig/node16': 1.0.4 - '@types/node': 20.17.46 + '@types/node': 20.17.50 acorn: 8.14.1 acorn-walk: 8.3.2 arg: 4.1.3 @@ -15243,7 +15242,7 @@ snapshots: type-fest@0.21.3: {} - type-fest@4.39.1: {} + type-fest@4.41.0: {} type-is@1.6.18: dependencies: @@ -15380,13 +15379,13 @@ snapshots: '@types/unist': 3.0.3 vfile-message: 4.0.2 - vite-node@3.1.3(@types/node@20.17.46)(less@4.3.0)(sass-embedded@1.86.1)(sass@1.56.2)(terser@5.39.1): + vite-node@3.1.4(@types/node@20.17.50)(less@4.3.0)(sass-embedded@1.86.1)(sass@1.56.2)(terser@5.39.2): dependencies: cac: 6.7.14 debug: 4.4.0 es-module-lexer: 1.7.0 pathe: 2.0.3 - vite: 5.4.14(@types/node@20.17.46)(less@4.3.0)(sass-embedded@1.86.1)(sass@1.56.2)(terser@5.39.1) + vite: 5.4.14(@types/node@20.17.50)(less@4.3.0)(sass-embedded@1.86.1)(sass@1.56.2)(terser@5.39.2) transitivePeerDependencies: - '@types/node' - less @@ -15398,28 +15397,28 @@ snapshots: - supports-color - terser - vite@5.4.14(@types/node@20.17.46)(less@4.3.0)(sass-embedded@1.86.1)(sass@1.56.2)(terser@5.39.1): + vite@5.4.14(@types/node@20.17.50)(less@4.3.0)(sass-embedded@1.86.1)(sass@1.56.2)(terser@5.39.2): dependencies: esbuild: 0.21.5 postcss: 8.5.3 rollup: 4.39.0 optionalDependencies: - '@types/node': 20.17.46 + '@types/node': 20.17.50 fsevents: 2.3.3 less: 4.3.0 sass: 1.56.2 sass-embedded: 1.86.1 - terser: 5.39.1 + terser: 5.39.2 - vitest@3.1.3(@types/debug@4.1.12)(@types/node@20.17.46)(jsdom@26.1.0)(less@4.3.0)(sass-embedded@1.86.1)(sass@1.56.2)(terser@5.39.1): + vitest@3.1.4(@types/debug@4.1.12)(@types/node@20.17.50)(jsdom@26.1.0)(less@4.3.0)(sass-embedded@1.86.1)(sass@1.56.2)(terser@5.39.2): dependencies: - '@vitest/expect': 3.1.3 - '@vitest/mocker': 3.1.3(vite@5.4.14(@types/node@20.17.46)(less@4.3.0)(sass-embedded@1.86.1)(sass@1.56.2)(terser@5.39.1)) - '@vitest/pretty-format': 3.1.3 - '@vitest/runner': 3.1.3 - '@vitest/snapshot': 3.1.3 - '@vitest/spy': 3.1.3 - '@vitest/utils': 3.1.3 + '@vitest/expect': 3.1.4 + '@vitest/mocker': 3.1.4(vite@5.4.14(@types/node@20.17.50)(less@4.3.0)(sass-embedded@1.86.1)(sass@1.56.2)(terser@5.39.2)) + '@vitest/pretty-format': 3.1.4 + '@vitest/runner': 3.1.4 + '@vitest/snapshot': 3.1.4 + '@vitest/spy': 3.1.4 + '@vitest/utils': 3.1.4 chai: 5.2.0 debug: 4.4.0 expect-type: 1.2.1 @@ -15431,12 +15430,12 @@ snapshots: tinyglobby: 0.2.13 tinypool: 1.0.2 tinyrainbow: 2.0.0 - vite: 5.4.14(@types/node@20.17.46)(less@4.3.0)(sass-embedded@1.86.1)(sass@1.56.2)(terser@5.39.1) - vite-node: 3.1.3(@types/node@20.17.46)(less@4.3.0)(sass-embedded@1.86.1)(sass@1.56.2)(terser@5.39.1) + vite: 5.4.14(@types/node@20.17.50)(less@4.3.0)(sass-embedded@1.86.1)(sass@1.56.2)(terser@5.39.2) + vite-node: 3.1.4(@types/node@20.17.50)(less@4.3.0)(sass-embedded@1.86.1)(sass@1.56.2)(terser@5.39.2) why-is-node-running: 2.3.0 optionalDependencies: '@types/debug': 4.1.12 - '@types/node': 20.17.46 + '@types/node': 20.17.50 jsdom: 26.1.0 transitivePeerDependencies: - less @@ -15468,22 +15467,22 @@ snapshots: vscode-uri@3.0.8: {} - vue-loader@17.4.2(vue@3.5.13(typescript@5.8.3))(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))): + vue-loader@17.4.2(vue@3.5.14(typescript@5.8.3))(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))): dependencies: chalk: 4.1.2 hash-sum: 2.0.0 watchpack: 2.4.2 webpack: 5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17)) optionalDependencies: - vue: 3.5.13(typescript@5.8.3) + vue: 3.5.14(typescript@5.8.3) - vue@3.5.13(typescript@5.8.3): + vue@3.5.14(typescript@5.8.3): dependencies: - '@vue/compiler-dom': 3.5.13 - '@vue/compiler-sfc': 3.5.13 - '@vue/runtime-dom': 3.5.13 - '@vue/server-renderer': 3.5.13(vue@3.5.13(typescript@5.8.3)) - '@vue/shared': 3.5.13 + '@vue/compiler-dom': 3.5.14 + '@vue/compiler-sfc': 3.5.14 + '@vue/runtime-dom': 3.5.14 + '@vue/server-renderer': 3.5.14(vue@3.5.14(typescript@5.8.3)) + '@vue/shared': 3.5.14 optionalDependencies: typescript: 5.8.3 @@ -15546,7 +15545,7 @@ snapshots: webpack-dev-middleware@7.4.2(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))): dependencies: colorette: 2.0.20 - memfs: 4.17.1 + memfs: 4.17.2 mime-types: 2.1.35 on-finished: 2.4.1 range-parser: 1.2.1 diff --git a/tests/bench/package.json b/tests/bench/package.json index 21be8dc8c1f8..1e7785daa617 100644 --- a/tests/bench/package.json +++ b/tests/bench/package.json @@ -13,7 +13,7 @@ "@rspack/plugin-react-refresh": "^1.4.3", "@types/react": "^19.1.4", "@types/react-dom": "^19.1.5", - "vitest": "^3.1.3" + "vitest": "^3.1.4" }, "dependencies": { "react": "^19.1.0", diff --git a/tests/e2e/package.json b/tests/e2e/package.json index 71856a8b4ff2..184719f2b122 100644 --- a/tests/e2e/package.json +++ b/tests/e2e/package.json @@ -25,7 +25,7 @@ "react-refresh": "^0.17.0", "typescript": "^5.8.3", "tailwindcss": "^3.4.17", - "vue": "^3.5.13", + "vue": "^3.5.14", "vue-loader": "^17.4.2", "css-loader": "^7.1.2", "ws": "^8.18.2" diff --git a/tests/webpack-test/package.json b/tests/webpack-test/package.json index 8a527ae7f564..6d89460f6369 100644 --- a/tests/webpack-test/package.json +++ b/tests/webpack-test/package.json @@ -29,7 +29,7 @@ "less": "4.3.0", "less-loader": "^12.3.0", "lodash-es": "^4.17.21", - "memfs": "^4.17.1", + "memfs": "^4.17.2", "mime-types": "^3.0.1", "mini-svg-data-uri": "^1.4.4", "raw-loader": "^4.0.2", @@ -39,7 +39,7 @@ "rimraf": "^5.0.10", "url-loader": "^4.1.1", "source-map": "^0.7.4", - "terser": "5.39.1", + "terser": "5.39.2", "terser-webpack-plugin": "^5.3.14", "ts-loader": "^9.5.2", "typescript": "^5.8.3" @@ -52,9 +52,9 @@ "graceful-fs": "4.2.11", "neo-async": "2.6.2", "react-refresh": "^0.17.0", - "tapable": "2.2.1", + "tapable": "2.2.2", "wast-loader": "^1.14.1", - "watchpack": "^2.4.2", + "watchpack": "^2.4.3", "webpack-sources": "3.2.3", "toml": "^3.0.0" } diff --git a/website/package.json b/website/package.json index 3283cb760991..a3b168a718aa 100644 --- a/website/package.json +++ b/website/package.json @@ -18,7 +18,7 @@ }, "license": "MIT", "dependencies": { - "@rstack-dev/doc-ui": "1.10.1", + "@rstack-dev/doc-ui": "1.10.2", "axios": "^1.9.0", "markdown-to-jsx": "^7.7.6", "mermaid": "^11.6.0", @@ -33,7 +33,7 @@ "@rspress/plugin-rss": "2.0.0-beta.6", "@rspress/plugin-llms": "2.0.0-beta.6", "@shikijs/transformers": "^3.4.2", - "@types/node": "^20.17.46", + "@types/node": "^20.17.50", "@types/react": "^19.1.4", "@types/semver": "^7.7.0", "cspell-ban-words": "0.0.4", From 99ffc996a615f9f3bb746f0b51c65486e75007cc Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 21 May 2025 10:36:46 +0800 Subject: [PATCH 08/50] chore(deps): update dependency @module-federation/runtime-tools to v0.14.0 (#10432) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- packages/rspack/package.json | 2 +- pnpm-lock.yaml | 47 ++++++++++++++++++++++++++++++++++-- 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/packages/rspack/package.json b/packages/rspack/package.json index 8e56a4356bf6..684b7f1849c4 100644 --- a/packages/rspack/package.json +++ b/packages/rspack/package.json @@ -65,7 +65,7 @@ "tinypool": "^1.0.2" }, "dependencies": { - "@module-federation/runtime-tools": "0.13.1", + "@module-federation/runtime-tools": "0.14.0", "@rspack/binding": "workspace:*", "@rspack/lite-tapable": "1.0.1", "caniuse-lite": "^1.0.30001718" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0c96e165d034..660a39b4f624 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -280,8 +280,8 @@ importers: packages/rspack: dependencies: '@module-federation/runtime-tools': - specifier: 0.13.1 - version: 0.13.1 + specifier: 0.14.0 + version: 0.14.0 '@rspack/binding': specifier: workspace:* version: link:../../crates/node_binding @@ -2031,21 +2031,39 @@ packages: '@module-federation/error-codes@0.13.1': resolution: {integrity: sha512-azgGDBnFRfqlivHOl96ZjlFUFlukESz2Rnnz/pINiSqoBBNjUE0fcAZP4X6jgrVITuEg90YkruZa7pW9I3m7Uw==} + '@module-federation/error-codes@0.14.0': + resolution: {integrity: sha512-GGk+EoeSACJikZZyShnLshtq9E2eCrDWbRiB4QAFXCX4oYmGgFfzXlx59vMNwqTKPJWxkEGnPYacJMcr2YYjag==} + '@module-federation/runtime-core@0.13.1': resolution: {integrity: sha512-TfyKfkSAentKeuvSsAItk8s5tqQSMfIRTPN2e1aoaq/kFhE+7blps719csyWSX5Lg5Es7WXKMsXHy40UgtBtuw==} + '@module-federation/runtime-core@0.14.0': + resolution: {integrity: sha512-fGE1Ro55zIFDp/CxQuRhKQ1pJvG7P0qvRm2N+4i8z++2bgDjcxnCKUqDJ8lLD+JfJQvUJf0tuSsJPgevzueD4g==} + '@module-federation/runtime-tools@0.13.1': resolution: {integrity: sha512-GEF1pxqLc80osIMZmE8j9UKZSaTm2hX2lql8tgIH/O9yK4wnF06k6LL5Ah+wJt+oJv6Dj55ri/MoxMP4SXoPNA==} + '@module-federation/runtime-tools@0.14.0': + resolution: {integrity: sha512-y/YN0c2DKsLETE+4EEbmYWjqF9G6ZwgZoDIPkaQ9p0pQu0V4YxzWfQagFFxR0RigYGuhJKmSU/rtNoHq+qF8jg==} + '@module-federation/runtime@0.13.1': resolution: {integrity: sha512-ZHnYvBquDm49LiHfv6fgagMo/cVJneijNJzfPh6S0CJrPS2Tay1bnTXzy8VA5sdIrESagYPaskKMGIj7YfnPug==} + '@module-federation/runtime@0.14.0': + resolution: {integrity: sha512-kR3cyHw/Y64SEa7mh4CHXOEQYY32LKLK75kJOmBroLNLO7/W01hMNAvGBYTedS7hWpVuefPk1aFZioy3q2VLdQ==} + '@module-federation/sdk@0.13.1': resolution: {integrity: sha512-bmf2FGQ0ymZuxYnw9bIUfhV3y6zDhaqgydEjbl4msObKMLGXZqhse2pTIIxBFpIxR1oONKX/y2FAolDCTlWKiw==} + '@module-federation/sdk@0.14.0': + resolution: {integrity: sha512-lg/OWRsh18hsyTCamOOhEX546vbDiA2O4OggTxxH2wTGr156N6DdELGQlYIKfRdU/0StgtQS81Goc0BgDZlx9A==} + '@module-federation/webpack-bundler-runtime@0.13.1': resolution: {integrity: sha512-QSuSIGa09S8mthbB1L6xERqrz+AzPlHR6D7RwAzssAc+IHf40U6NiTLPzUqp9mmKDhC5Tm0EISU0ZHNeJpnpBQ==} + '@module-federation/webpack-bundler-runtime@0.14.0': + resolution: {integrity: sha512-POWS6cKBicAAQ3DNY5X7XEUSfOfUsRaBNxbuwEfSGlrkTE9UcWheO06QP2ndHi8tHQuUKcIHi2navhPkJ+k5xg==} + '@napi-rs/cli@3.0.0-alpha.80': resolution: {integrity: sha512-wgzLg9ZBOHJ4NKhw6B1uFtpYKOLiQQ6/kSNJEpjylCvcMyuS/TtBX3L3lFsA9B1AxWFhnVj9yvBWiuDXpleGRg==} engines: {node: '>= 16'} @@ -9065,29 +9083,54 @@ snapshots: '@module-federation/error-codes@0.13.1': {} + '@module-federation/error-codes@0.14.0': {} + '@module-federation/runtime-core@0.13.1': dependencies: '@module-federation/error-codes': 0.13.1 '@module-federation/sdk': 0.13.1 + '@module-federation/runtime-core@0.14.0': + dependencies: + '@module-federation/error-codes': 0.14.0 + '@module-federation/sdk': 0.14.0 + '@module-federation/runtime-tools@0.13.1': dependencies: '@module-federation/runtime': 0.13.1 '@module-federation/webpack-bundler-runtime': 0.13.1 + '@module-federation/runtime-tools@0.14.0': + dependencies: + '@module-federation/runtime': 0.14.0 + '@module-federation/webpack-bundler-runtime': 0.14.0 + '@module-federation/runtime@0.13.1': dependencies: '@module-federation/error-codes': 0.13.1 '@module-federation/runtime-core': 0.13.1 '@module-federation/sdk': 0.13.1 + '@module-federation/runtime@0.14.0': + dependencies: + '@module-federation/error-codes': 0.14.0 + '@module-federation/runtime-core': 0.14.0 + '@module-federation/sdk': 0.14.0 + '@module-federation/sdk@0.13.1': {} + '@module-federation/sdk@0.14.0': {} + '@module-federation/webpack-bundler-runtime@0.13.1': dependencies: '@module-federation/runtime': 0.13.1 '@module-federation/sdk': 0.13.1 + '@module-federation/webpack-bundler-runtime@0.14.0': + dependencies: + '@module-federation/runtime': 0.14.0 + '@module-federation/sdk': 0.14.0 + '@napi-rs/cli@3.0.0-alpha.80(@emnapi/runtime@1.4.3)(@types/node@20.17.50)(emnapi@1.4.3)': dependencies: '@inquirer/prompts': 7.4.0(@types/node@20.17.50) From 3c46a528b4ca71d58fd1e306edf0dd93c824c1dd Mon Sep 17 00:00:00 2001 From: Cong-Cong Pan Date: Wed, 21 May 2025 14:13:55 +0800 Subject: [PATCH 09/50] feat: update to napi beta (#10436) --- Cargo.lock | 19 +++---- Cargo.toml | 6 +-- crates/node_binding/Cargo.toml | 4 +- crates/node_binding/src/asset.rs | 7 +-- crates/node_binding/src/build_info.rs | 6 +-- crates/node_binding/src/chunk.rs | 2 +- crates/node_binding/src/chunk_group.rs | 8 +-- crates/node_binding/src/compilation/chunks.rs | 4 +- crates/node_binding/src/compilation/mod.rs | 18 +++---- .../src/dependencies/entry_dependency.rs | 2 +- crates/node_binding/src/dependency.rs | 2 +- crates/node_binding/src/lib.rs | 10 ++-- crates/node_binding/src/module.rs | 52 +++++++++--------- crates/node_binding/src/module_graph.rs | 6 +-- crates/node_binding/src/modules/macros.rs | 53 ++++++++++--------- .../node_binding/src/modules/normal_module.rs | 40 ++++++-------- .../src/plugins/context_replacement.rs | 6 +-- .../node_binding/src/plugins/interceptor.rs | 2 +- .../src/plugins/js_loader/context.rs | 2 +- .../src/raw_options/raw_builtins/mod.rs | 12 ++--- .../raw_experiments/raw_cache/mod.rs | 2 +- .../src/raw_options/raw_split_chunks/mod.rs | 22 ++++---- .../raw_split_chunk_chunks.rs | 2 +- crates/node_binding/src/utils.rs | 6 ++- crates/rspack_core/src/binding/cell.rs | 16 +++--- crates/rspack_napi/src/ext/js_string_ext.rs | 5 +- .../rspack_napi/src/js_values/js_value_ref.rs | 43 --------------- crates/rspack_napi/src/js_values/mod.rs | 1 - .../src/js_values/one_shot_value_ref.rs | 2 +- .../threadsafe_one_shot_value_ref.rs | 19 ++++++- crates/rspack_napi/src/js_values/weak_ref.rs | 8 +-- crates/rspack_napi/src/threadsafe_function.rs | 4 +- .../src/threadsafe_js_value_ref.rs | 34 ++++++------ crates/rspack_napi/src/utils.rs | 16 +++--- crates/rspack_regex/src/napi.rs | 33 ++++++------ 35 files changed, 227 insertions(+), 247 deletions(-) delete mode 100644 crates/rspack_napi/src/js_values/js_value_ref.rs diff --git a/Cargo.lock b/Cargo.lock index cd617b0cc4e6..22bfc38466c2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2422,7 +2422,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" dependencies = [ "cfg-if", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] @@ -2751,9 +2751,9 @@ dependencies = [ [[package]] name = "napi" -version = "3.0.0-alpha.33" +version = "3.0.0-beta.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c857a2b38c994db8bec785554ab4216d45ad63469832070c86a992be0b5491ad" +checksum = "2584ca65c02941c297bec6c77bbb18845a45465fcefbdee44bd525445fbe2d99" dependencies = [ "anyhow", "bitflags 2.6.0", @@ -2767,17 +2767,18 @@ dependencies = [ [[package]] name = "napi-build" -version = "2.1.6" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e28acfa557c083f6e254a786e01ba253fc56f18ee000afcd4f79af735f73a6da" +checksum = "03acbfa4f156a32188bfa09b86dc11a431b5725253fc1fc6f6df5bed273382c4" [[package]] name = "napi-derive" -version = "3.0.0-alpha.29" +version = "3.0.0-beta.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7165d931d54f68115e651330d5fe0ae0081133d3f4ee3ab55b0b808f0c23f71" +checksum = "3e972aaeb88ee894ba926a0e0c6698fef12f7032432a2981d986186721bf57f4" dependencies = [ "convert_case 0.8.0", + "ctor", "napi-derive-backend", "proc-macro2", "quote", @@ -2786,9 +2787,9 @@ dependencies = [ [[package]] name = "napi-derive-backend" -version = "2.0.0-alpha.28" +version = "2.0.0-beta.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce3f36354262054df8e1c3a73bdcd36ea13f130feb1e4d86b67cab9e10d6ef6d" +checksum = "d9ba2844c69473593881c22de67530b554ed9af134f0bd19d296ce7f78ea583f" dependencies = [ "convert_case 0.8.0", "proc-macro2", diff --git a/Cargo.toml b/Cargo.toml index 6a3a5373e631..82cb93e251f3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -87,9 +87,9 @@ ustr = { package = "ustr-fxhash", version = "1.0.1" } xxhash-rust = { version = "0.8.14" } # Pinned -napi = { version = "3.0.0-alpha.33" } -napi-build = { version = "2.1.6" } -napi-derive = { version = "3.0.0-alpha.29" } +napi = { version = "3.0.0-beta.1" } +napi-build = { version = "2.2.0" } +napi-derive = { version = "3.0.0-beta.1" } # Serialize and Deserialize inventory = { version = "0.3.17" } diff --git a/crates/node_binding/Cargo.toml b/crates/node_binding/Cargo.toml index 97a5f6f3a347..be460fc9ea77 100644 --- a/crates/node_binding/Cargo.toml +++ b/crates/node_binding/Cargo.toml @@ -38,8 +38,8 @@ cow-utils = { workspace = true } tracing = { workspace = true } tracing-subscriber = { workspace = true } -napi = { workspace = true, features = ["async", "tokio_rt", "serde-json", "anyhow", "napi7"] } -napi-derive = { workspace = true } +napi = { workspace = true, features = ["async", "tokio_rt", "serde-json", "anyhow", "napi7", "compat-mode"] } +napi-derive = { workspace = true, features = ["compat-mode"] } color-backtrace = "0.6.1" diff --git a/crates/node_binding/src/asset.rs b/crates/node_binding/src/asset.rs index 3f97c8ae95a7..3ada51787412 100644 --- a/crates/node_binding/src/asset.rs +++ b/crates/node_binding/src/asset.rs @@ -1,8 +1,9 @@ use napi::{ bindgen_prelude::{ - Array, Either, FromNapiValue, Object, ToNapiValue, TypeName, Unknown, ValidateNapiValue, + Array, Either, FromNapiValue, JsObjectValue, Object, ToNapiValue, TypeName, Unknown, + ValidateNapiValue, }, - sys, Env, NapiRaw, + sys, Env, JsValue, }; use napi_derive::napi; use rspack_core::Reflector; @@ -90,7 +91,7 @@ unsafe fn napi_value_to_json( match value.get_type()? { napi::ValueType::Null => Ok(Some(serde_json::Value::Null)), napi::ValueType::Boolean => { - let b = value.coerce_to_bool()?.get_value()?; + let b = value.coerce_to_bool()?; Ok(Some(serde_json::Value::Bool(b))) } napi::ValueType::Number => { diff --git a/crates/node_binding/src/build_info.rs b/crates/node_binding/src/build_info.rs index 7258535b2544..5785e6caac26 100644 --- a/crates/node_binding/src/build_info.rs +++ b/crates/node_binding/src/build_info.rs @@ -1,6 +1,6 @@ use napi::{ bindgen_prelude::{Object, ToNapiValue, WeakReference}, - Env, JsString, NapiValue, + Env, JsString, }; use rspack_core::{Reflector, WeakBindingCell}; use rustc_hash::FxHashMap; @@ -34,7 +34,7 @@ impl Assets { #[napi] impl Assets { #[napi] - pub fn keys(&self, env: &Env) -> napi::Result> { + pub fn keys<'a>(&self, env: &'a Env) -> napi::Result>> { self.with_ref(|assets| { assets .keys() @@ -57,7 +57,7 @@ impl BuildInfo { pub fn get_jsobject(self, env: &Env) -> napi::Result { let raw_env = env.raw(); let napi_val = unsafe { ToNapiValue::to_napi_value(raw_env, self)? }; - Ok(unsafe { Object::from_raw_unchecked(raw_env, napi_val) }) + Ok(Object::from_raw(raw_env, napi_val)) } fn with_ref( diff --git a/crates/node_binding/src/chunk.rs b/crates/node_binding/src/chunk.rs index 7ec5f1f759c2..1b3dc81cd657 100644 --- a/crates/node_binding/src/chunk.rs +++ b/crates/node_binding/src/chunk.rs @@ -59,7 +59,7 @@ impl JsChunk { } #[napi(getter)] - pub fn id_name_hints(&self, env: Env) -> napi::Result> { + pub fn id_name_hints<'a>(&self, env: &'a Env) -> napi::Result>> { let (_, chunk) = self.as_ref()?; chunk .id_name_hints() diff --git a/crates/node_binding/src/chunk_group.rs b/crates/node_binding/src/chunk_group.rs index efb7519f3e37..216ac8f356a5 100644 --- a/crates/node_binding/src/chunk_group.rs +++ b/crates/node_binding/src/chunk_group.rs @@ -64,7 +64,7 @@ impl JsChunkGroup { } #[napi(getter)] - pub fn origins(&self, env: Env) -> napi::Result> { + pub fn origins<'a>(&self, env: &'a Env) -> napi::Result>> { let (compilation, chunk_graph) = self.as_ref()?; let origins = chunk_graph.origins(); let mut js_origins = Vec::with_capacity(origins.len()); @@ -244,11 +244,11 @@ impl ToNapiValue for JsChunkGroupWrapper { } #[napi(object, object_from_js = false)] -pub struct JsChunkGroupOrigin { +pub struct JsChunkGroupOrigin<'a> { #[napi(ts_type = "Module | undefined")] pub module: Option, - pub request: Option, - pub loc: Option>, + pub request: Option>, + pub loc: Option, JsRealDependencyLocation>>, } #[napi(object, object_from_js = false)] diff --git a/crates/node_binding/src/compilation/chunks.rs b/crates/node_binding/src/compilation/chunks.rs index 8c23ac1392a7..521ed23b4177 100644 --- a/crates/node_binding/src/compilation/chunks.rs +++ b/crates/node_binding/src/compilation/chunks.rs @@ -1,6 +1,6 @@ use napi::{ bindgen_prelude::{Object, ToNapiValue, WeakReference}, - Env, NapiValue, + Env, }; use rspack_core::Compilation; @@ -28,7 +28,7 @@ impl Chunks { pub fn get_jsobject(self, env: &Env) -> napi::Result { let raw_env = env.raw(); let napi_val = unsafe { ToNapiValue::to_napi_value(raw_env, self)? }; - Ok(unsafe { Object::from_raw_unchecked(raw_env, napi_val) }) + Ok(Object::from_raw(raw_env, napi_val)) } } diff --git a/crates/node_binding/src/compilation/mod.rs b/crates/node_binding/src/compilation/mod.rs index 878dd1666192..3c59fa752600 100644 --- a/crates/node_binding/src/compilation/mod.rs +++ b/crates/node_binding/src/compilation/mod.rs @@ -11,7 +11,6 @@ pub use code_generation_results::*; use dependencies::JsDependencies; use diagnostics::Diagnostics; use entries::JsEntries; -use napi::NapiRaw; use napi_derive::napi; use rspack_collections::{DatabaseItem, IdentifierSet}; use rspack_core::{ @@ -575,7 +574,7 @@ impl JsCompilation { &mut self, reference: Reference, module_identifiers: Vec, - f: Function, + f: Function<'static>, ) -> Result<()> { let compilation = self.as_mut()?; @@ -614,7 +613,7 @@ impl JsCompilation { base_uri: Option, original_module: Option, original_module_context: Option, - callback: Function, + callback: Function<'static>, ) -> Result<()> { let compilation = self.as_ref()?; @@ -711,7 +710,7 @@ impl JsCompilation { &mut self, reference: Reference, js_args: Vec<(String, &mut EntryDependency, Option)>, - f: Function, + f: Function<'static>, ) -> napi::Result<()> { let compilation = self.as_mut()?; @@ -808,7 +807,7 @@ impl JsCompilation { &mut self, reference: Reference, js_args: Vec<(String, &mut EntryDependency, Option)>, - f: Function, + f: Function<'static>, ) -> napi::Result<()> { let compilation = self.as_mut()?; @@ -913,16 +912,15 @@ impl ToNapiValue for JsAddEntryItemCallbackArgs { let env_wrapper = Env::from_raw(env); let mut js_array = env_wrapper.create_array(0)?; + let raw_undefined = Undefined::to_napi_value(env, ())?; + let undefined = Unknown::from_napi_value(env, raw_undefined)?; for result in val.0 { let js_result = match result { - Either::A(msg) => vec![ - env_wrapper.create_string(&msg)?.into_unknown(), - env_wrapper.get_undefined()?.into_unknown(), - ], + Either::A(msg) => vec![env_wrapper.create_string(&msg)?.to_unknown(), undefined], Either::B(module) => { let napi_val = ToNapiValue::to_napi_value(env, module)?; let js_module = Unknown::from_napi_value(env, napi_val)?; - vec![env_wrapper.get_undefined()?.into_unknown(), js_module] + vec![undefined, js_module] } }; js_array.insert(js_result)?; diff --git a/crates/node_binding/src/dependencies/entry_dependency.rs b/crates/node_binding/src/dependencies/entry_dependency.rs index 7213e241c8b8..4ea3d8b909d9 100644 --- a/crates/node_binding/src/dependencies/entry_dependency.rs +++ b/crates/node_binding/src/dependencies/entry_dependency.rs @@ -54,7 +54,7 @@ impl EntryDependency { } #[napi(getter)] - pub fn request(&mut self, env: Env) -> napi::Result> { + pub fn request<'a>(&mut self, env: &'a Env) -> napi::Result, ()>> { Ok(Either::A(env.create_string(&self.request)?)) } } diff --git a/crates/node_binding/src/dependency.rs b/crates/node_binding/src/dependency.rs index 04d8d4066cfd..c63123c4b56f 100644 --- a/crates/node_binding/src/dependency.rs +++ b/crates/node_binding/src/dependency.rs @@ -124,7 +124,7 @@ impl Dependency { } #[napi(getter)] - pub fn ids(&mut self, env: Env) -> napi::Result, ()>> { + pub fn ids<'a>(&mut self, env: &'a Env) -> napi::Result>, ()>> { let (dependency, compilation) = self.as_ref()?; Ok(match compilation { diff --git a/crates/node_binding/src/lib.rs b/crates/node_binding/src/lib.rs index 5c4bbc76f662..d512ef5c7c9b 100644 --- a/crates/node_binding/src/lib.rs +++ b/crates/node_binding/src/lib.rs @@ -1,13 +1,15 @@ #![recursion_limit = "256"] #![feature(let_chains)] #![feature(try_blocks)] +#![allow(deprecated)] + #[macro_use] extern crate napi_derive; extern crate rspack_allocator; use std::{cell::RefCell, sync::Arc}; use compiler::{Compiler, CompilerState, CompilerStateGuard}; -use napi::{bindgen_prelude::*, CallContext}; +use napi::{bindgen_prelude::*, CallContext, JsObject}; use rspack_collections::UkeyMap; use rspack_core::{ BoxDependency, Compilation, CompilerId, EntryOptions, ModuleIdentifier, PluginExt, @@ -211,7 +213,7 @@ impl JsCompiler { /// Build with the given option passed to the constructor #[napi(ts_args_type = "callback: (err: null | Error) => void")] - pub fn build(&mut self, reference: Reference, f: Function) -> Result<()> { + pub fn build(&mut self, reference: Reference, f: Function<'static>) -> Result<()> { unsafe { self.run(reference, |compiler, guard| { callbackify( @@ -238,7 +240,7 @@ impl JsCompiler { reference: Reference, changed_files: Vec, removed_files: Vec, - f: Function, + f: Function<'static>, ) -> Result<()> { use std::collections::HashSet; @@ -477,7 +479,7 @@ pub fn cleanup_global_trace() { } #[module_exports] -fn node_init(mut _exports: Object, env: Env) -> Result<()> { +fn node_init(mut _exports: JsObject, env: Env) -> Result<()> { rspack_core::set_thread_local_allocator(Box::new(allocator::NapiAllocatorImpl::new(env))); Ok(()) } diff --git a/crates/node_binding/src/module.rs b/crates/node_binding/src/module.rs index e2396d83cdd0..78ca8f014388 100644 --- a/crates/node_binding/src/module.rs +++ b/crates/node_binding/src/module.rs @@ -1,6 +1,7 @@ +#![allow(deprecated)] use std::{any::TypeId, cell::RefCell, ptr::NonNull, sync::Arc}; -use napi::{CallContext, JsString, JsSymbol, NapiRaw, NapiValue}; +use napi::{CallContext, JsObject, JsString, JsSymbol, NapiRaw}; use napi_derive::napi; use once_cell::unsync::OnceCell; use rspack_collections::{IdentifierMap, UkeyMap}; @@ -54,12 +55,15 @@ pub struct Module { impl Module { pub(crate) fn custom_into_instance(self, env: &Env) -> napi::Result> { let mut instance = self.into_instance(env)?; - let mut object = instance.as_object(env); + // The returned Object's lifetime should be tied to the input Env's lifetime, not the ClassInstance itself. + // Fix in: https://github.com/napi-rs/napi-rs/pull/2655 + let mut object = + unsafe { std::mem::transmute::>(instance.as_object(env)) }; let (_, module) = (*instance).as_ref()?; #[js_function] fn context_getter(ctx: CallContext) -> napi::Result> { - let this = ctx.this_unchecked::(); + let this = ctx.this_unchecked::(); let wrapped_value = unsafe { Module::from_napi_mut_ref(ctx.env.raw(), this.raw())? }; let (_, module) = wrapped_value.as_ref()?; Ok(match module.get_context() { @@ -70,7 +74,7 @@ impl Module { #[js_function] fn layer_getter(ctx: CallContext) -> napi::Result> { - let this = ctx.this_unchecked::(); + let this = ctx.this_unchecked::(); let wrapped_value = unsafe { Module::from_napi_mut_ref(ctx.env.raw(), this.raw())? }; let (_, module) = wrapped_value.as_ref()?; Ok(match module.get_layer() { @@ -81,7 +85,7 @@ impl Module { #[js_function] fn use_source_map_getter(ctx: CallContext) -> napi::Result { - let this = ctx.this_unchecked::(); + let this = ctx.this_unchecked::(); let wrapped_value = unsafe { Module::from_napi_mut_ref(ctx.env.raw(), this.raw())? }; let (_, module) = wrapped_value.as_ref()?; Ok(module.get_source_map_kind().source_map()) @@ -89,7 +93,7 @@ impl Module { #[js_function] fn use_simple_source_map_getter(ctx: CallContext) -> napi::Result { - let this = ctx.this_unchecked::(); + let this = ctx.this_unchecked::(); let wrapped_value = unsafe { Module::from_napi_mut_ref(ctx.env.raw(), this.raw())? }; let (_, module) = wrapped_value.as_ref()?; Ok(module.get_source_map_kind().source_map()) @@ -97,7 +101,7 @@ impl Module { #[js_function] fn factory_meta_getter(ctx: CallContext) -> napi::Result { - let this = ctx.this_unchecked::(); + let this = ctx.this_unchecked::(); let wrapped_value = unsafe { Module::from_napi_mut_ref(ctx.env.raw(), this.raw())? }; let (_, module) = wrapped_value.as_ref()?; Ok(match module.as_normal_module() { @@ -117,7 +121,7 @@ impl Module { #[js_function(1)] fn factory_meta_setter(ctx: CallContext) -> napi::Result<()> { - let this = ctx.this_unchecked::(); + let this = ctx.this_unchecked::(); let wrapped_value = unsafe { Module::from_napi_mut_ref(ctx.env.raw(), this.raw())? }; let module = wrapped_value.as_mut()?; let factory_meta = ctx.get::(0)?; @@ -127,7 +131,7 @@ impl Module { #[js_function] fn readable_identifier_getter(ctx: napi::CallContext) -> napi::Result { - let this = ctx.this::()?; + let this = ctx.this_unchecked::(); let wrapped_value = unsafe { Module::from_napi_mut_ref(ctx.env.raw(), this.raw())? }; let (_, module) = wrapped_value.as_ref()?; Ok( @@ -140,7 +144,7 @@ impl Module { #[js_function] fn build_info_getter(ctx: CallContext) -> napi::Result { - let mut this = ctx.this::()?; + let mut this = ctx.this_unchecked::(); let env = ctx.env; let raw_env = env.raw(); let mut reference: Reference = @@ -153,9 +157,9 @@ impl Module { let sym = unsafe { #[allow(clippy::unwrap_used)] let napi_val = ToNapiValue::to_napi_value(env.raw(), once_cell.get().unwrap())?; - JsSymbol::from_raw_unchecked(env.raw(), napi_val) + JsSymbol::from_napi_value(env.raw(), napi_val) }; - this.set_property(sym, &build_info) + this.set_property(sym, build_info) })?; let r = WeakRef::new(raw_env, &mut build_info)?; let result = r.as_object(env); @@ -165,7 +169,7 @@ impl Module { #[js_function(1)] fn build_info_setter(ctx: CallContext) -> napi::Result<()> { - let mut this = ctx.this_unchecked::(); + let mut this = ctx.this_unchecked::(); let input_object = ctx.get::(0)?; let env = ctx.env; let raw_env = env.raw(); @@ -179,17 +183,17 @@ impl Module { napi::KeyFilter::AllProperties, napi::KeyConversion::KeepNumbers, )?; - let names = Array::from_unknown(names.into_unknown())?; + let names = Array::from_unknown(names.to_unknown())?; for index in 0..names.len() { if let Some(name) = names.get::(index)? { - let name_clone = unsafe { Object::from_raw_unchecked(env.raw(), name.raw()) }; + let name_clone = Object::from_raw(env.raw(), name.raw()); let name_str = name_clone.coerce_to_string()?.into_string(); // known build info properties if name_str == "assets" { // TODO: Currently, setting assets is not supported. continue; } else { - let value = input_object.get_property::<&Unknown, Unknown>(&name)?; + let value = input_object.get_property::(name)?; new_instrance.set_property::(name, value)?; } } @@ -199,9 +203,9 @@ impl Module { let sym = unsafe { #[allow(clippy::unwrap_used)] let napi_val = ToNapiValue::to_napi_value(env.raw(), once_cell.get().unwrap())?; - JsSymbol::from_raw_unchecked(env.raw(), napi_val) + JsSymbol::from_napi_value(env.raw(), napi_val) }; - this.set_property(sym, &new_instrance) + this.set_property(sym, new_instrance) })?; reference.build_info_ref = Some(WeakRef::new(raw_env, &mut new_instrance)?); Ok(()) @@ -220,7 +224,7 @@ impl Module { Property::new("buildInfo")? .with_getter(build_info_getter) .with_setter(build_info_setter), - Property::new("buildMeta")?.with_value(&env.create_object()?), + Property::new("buildMeta")?.with_value(&Object::new(env)?), ])?; MODULE_IDENTIFIER_SYMBOL.with(|once_cell| { @@ -228,7 +232,7 @@ impl Module { let symbol = unsafe { #[allow(clippy::unwrap_used)] let napi_val = ToNapiValue::to_napi_value(env.raw(), once_cell.get().unwrap())?; - JsSymbol::from_raw_unchecked(env.raw(), napi_val) + JsSymbol::from_napi_value(env.raw(), napi_val)? }; object.set_property(symbol, identifier) })?; @@ -351,11 +355,11 @@ impl Module { } #[napi] - pub fn lib_ident( + pub fn lib_ident<'a>( &mut self, - env: &Env, + env: &'a Env, options: JsLibIdentOptions, - ) -> napi::Result> { + ) -> napi::Result>> { let (_, module) = self.as_ref()?; Ok( match module.lib_ident(LibIdentOptions { @@ -804,7 +808,7 @@ thread_local! { } #[module_exports] -fn init(mut exports: Object, env: Env) -> napi::Result<()> { +fn init(mut exports: JsObject, env: Env) -> napi::Result<()> { let module_identifier_symbol = OneShotRef::new(env.raw(), env.create_symbol(None)?)?; exports.set_named_property("MODULE_IDENTIFIER_SYMBOL", &module_identifier_symbol)?; MODULE_IDENTIFIER_SYMBOL.with(|once_cell| { diff --git a/crates/node_binding/src/module_graph.rs b/crates/node_binding/src/module_graph.rs index d87a60875913..e2017f94b6ec 100644 --- a/crates/node_binding/src/module_graph.rs +++ b/crates/node_binding/src/module_graph.rs @@ -73,12 +73,12 @@ impl JsModuleGraph { } #[napi(ts_args_type = "module: Module, runtime: string | string[]")] - pub fn get_used_exports( + pub fn get_used_exports<'a>( &self, - env: Env, + env: &'a Env, js_module: ModuleObjectRef, js_runtime: Either>, - ) -> napi::Result>>> { + ) -> napi::Result>>>> { let (_, module_graph) = self.as_ref()?; let mut runtime: FxHashSet> = FxHashSet::default(); diff --git a/crates/node_binding/src/modules/macros.rs b/crates/node_binding/src/modules/macros.rs index 61083fe8c28b..bdcf034437ea 100644 --- a/crates/node_binding/src/modules/macros.rs +++ b/crates/node_binding/src/modules/macros.rs @@ -7,15 +7,18 @@ macro_rules! impl_module_methods { env: &'a napi::Env, mut properties: Vec, ) -> napi::Result> { - use napi::bindgen_prelude::JavaScriptClassExt; + use napi::bindgen_prelude::{JavaScriptClassExt, JsObjectValue, JsValue}; let mut instance = self.into_instance(env)?; - let mut object = instance.as_object(env); + // The returned Object's lifetime should be tied to the input Env's lifetime, not the ClassInstance itself. + // Fix in: https://github.com/napi-rs/napi-rs/pull/2655 + let mut object = + unsafe { std::mem::transmute::>(instance.as_object(env)) }; let (_, module) = instance.module.as_ref()?; #[js_function] fn context_getter(ctx: napi::CallContext) -> napi::Result> { - let this = ctx.this::()?; + let this = ctx.this::()?; let wrapped_value: &mut $module = unsafe { napi::bindgen_prelude::FromNapiMutRef::from_napi_mut_ref( ctx.env.raw(), @@ -31,7 +34,7 @@ macro_rules! impl_module_methods { #[js_function] fn layer_getter(ctx: napi::CallContext) -> napi::Result> { - let this = ctx.this::()?; + let this = ctx.this::()?; let wrapped_value: &mut $module = unsafe { napi::bindgen_prelude::FromNapiMutRef::from_napi_mut_ref( ctx.env.raw(), @@ -47,7 +50,7 @@ macro_rules! impl_module_methods { #[js_function] fn use_source_map_getter(ctx: napi::CallContext) -> napi::Result { - let this = ctx.this::()?; + let this = ctx.this::()?; let wrapped_value: &mut $module = unsafe { napi::bindgen_prelude::FromNapiMutRef::from_napi_mut_ref( ctx.env.raw(), @@ -60,7 +63,7 @@ macro_rules! impl_module_methods { #[js_function] fn use_simple_source_map_getter(ctx: napi::CallContext) -> napi::Result { - let this = ctx.this::()?; + let this = ctx.this::()?; let wrapped_value: &mut $module = unsafe { napi::bindgen_prelude::FromNapiMutRef::from_napi_mut_ref( ctx.env.raw(), @@ -75,7 +78,7 @@ macro_rules! impl_module_methods { fn factory_meta_getter(ctx: napi::CallContext) -> napi::Result<$crate::JsFactoryMeta> { use rspack_core::Module; - let this = ctx.this_unchecked::(); + let this = ctx.this_unchecked::(); let wrapped_value: &mut $module = unsafe { napi::bindgen_prelude::FromNapiMutRef::from_napi_mut_ref( ctx.env.raw(), @@ -99,8 +102,8 @@ macro_rules! impl_module_methods { } #[js_function(1)] - fn factory_meta_setter(ctx: napi::CallContext) -> napi::Result { - let this = ctx.this_unchecked::(); + fn factory_meta_setter(ctx: napi::CallContext) -> napi::Result<()> { + let this = ctx.this_unchecked::(); let wrapped_value: &mut $module = unsafe { napi::bindgen_prelude::FromNapiMutRef::from_napi_mut_ref( ctx.env.raw(), @@ -110,12 +113,12 @@ macro_rules! impl_module_methods { let module = wrapped_value.module.as_mut()?; let factory_meta = ctx.get::<$crate::JsFactoryMeta>(0)?; module.set_factory_meta(factory_meta.into()); - ctx.env.get_undefined() + Ok(()) } #[js_function] fn readable_identifier_getter(ctx: napi::CallContext) -> napi::Result { - let this = ctx.this::()?; + let this = ctx.this::()?; let wrapped_value: &mut $module = unsafe { napi::bindgen_prelude::FromNapiMutRef::from_napi_mut_ref( ctx.env.raw(), @@ -132,8 +135,8 @@ macro_rules! impl_module_methods { #[js_function] fn build_info_getter(ctx: napi::CallContext) -> napi::Result { - use napi::{bindgen_prelude::FromNapiValue, NapiRaw, NapiValue}; - let mut this = ctx.this::()?; + use napi::{bindgen_prelude::FromNapiValue, NapiRaw}; + let mut this = ctx.this::()?; let env = ctx.env; let raw_env = env.raw(); let mut reference: napi::bindgen_prelude::Reference<$crate::Module> = @@ -146,7 +149,7 @@ macro_rules! impl_module_methods { let sym = unsafe { #[allow(clippy::unwrap_used)] let napi_val = napi::bindgen_prelude::ToNapiValue::to_napi_value(env.raw(), once_cell.get().unwrap())?; - napi::JsSymbol::from_raw_unchecked(env.raw(), napi_val) + napi::JsSymbol::from_napi_value(env.raw(), napi_val) }; this.set_property(sym, &build_info) })?; @@ -158,10 +161,10 @@ macro_rules! impl_module_methods { #[js_function(1)] fn build_info_setter(ctx: napi::CallContext) -> napi::Result<()> { - use napi::{bindgen_prelude::FromNapiValue, NapiRaw, NapiValue}; + use napi::{bindgen_prelude::FromNapiValue, NapiRaw}; use rspack_napi::string::JsStringExt; - let mut this = ctx.this_unchecked::(); - let input_object = ctx.get::(0)?; + let mut this = ctx.this_unchecked::(); + let input_object = ctx.get::(0)?; let env = ctx.env; let raw_env = env.raw(); let mut reference: napi::bindgen_prelude::Reference = @@ -177,14 +180,14 @@ macro_rules! impl_module_methods { let names = napi::bindgen_prelude::Array::from_unknown(names.into_unknown())?; for index in 0..names.len() { if let Some(name) = names.get::(index)? { - let name_clone = unsafe { napi::bindgen_prelude::Object::from_raw_unchecked(env.raw(), name.raw()) }; + let name_clone = napi::bindgen_prelude::Object::from_raw(env.raw(), name.raw()); let name_str = name_clone.coerce_to_string()?.into_string(); // known build info properties if name_str == "assets" { // TODO: Currently, setting assets is not supported. continue; } else { - let value = input_object.get_property::<&napi::bindgen_prelude::Unknown, napi::bindgen_prelude::Unknown>(&name)?; + let value = input_object.get_property::(name)?; new_instrance.set_property::(name, value)?; } } @@ -194,7 +197,7 @@ macro_rules! impl_module_methods { let sym = unsafe { #[allow(clippy::unwrap_used)] let napi_val = napi::bindgen_prelude::ToNapiValue::to_napi_value(env.raw(), once_cell.get().unwrap())?; - napi::JsSymbol::from_raw_unchecked(env.raw(), napi_val) + napi::JsSymbol::from_napi_value(env.raw(), napi_val) }; this.set_property(sym, &new_instrance) })?; @@ -218,7 +221,7 @@ macro_rules! impl_module_methods { .with_setter(factory_meta_setter), ); properties.push(napi::Property::new("buildInfo")?.with_getter(build_info_getter).with_setter(build_info_setter)); - properties.push(napi::Property::new("buildMeta")?.with_value(&env.create_object()?)); + properties.push(napi::Property::new("buildMeta")?.with_value(&napi::bindgen_prelude::Object::new(env)?)); properties.push( napi::Property::new("_readableIdentifier")?.with_getter(readable_identifier_getter), ); @@ -232,7 +235,7 @@ macro_rules! impl_module_methods { env.raw(), once_cell.get().unwrap(), )?; - ::from_raw_unchecked(env.raw(), napi_val) + ::from_napi_value(env.raw(), napi_val)? }; object.set_property(symbol, identifier) })?; @@ -276,11 +279,11 @@ macro_rules! impl_module_methods { } #[napi] - pub fn lib_ident( + pub fn lib_ident<'a>( &mut self, - env: &napi::Env, + env: &'a napi::Env, options: $crate::JsLibIdentOptions, - ) -> napi::Result> { + ) -> napi::Result>> { self.module.lib_ident(env, options) } diff --git a/crates/node_binding/src/modules/normal_module.rs b/crates/node_binding/src/modules/normal_module.rs index 8ef1c4253773..b9a226c34fc6 100644 --- a/crates/node_binding/src/modules/normal_module.rs +++ b/crates/node_binding/src/modules/normal_module.rs @@ -1,6 +1,6 @@ use napi::{ bindgen_prelude::{FromNapiMutRef, Object, ToNapiValue}, - CallContext, Either, NapiRaw, NapiValue, + CallContext, Either, JsObject, NapiRaw, }; use rspack_core::{parse_resource, ResourceData, ResourceParsedData}; @@ -28,32 +28,26 @@ impl NormalModule { let request = env.create_string(module.request())?; let user_request = env.create_string(module.user_request())?; let raw_request = env.create_string(module.raw_request())?; - let resource_resolve_data = unsafe { - Object::from_raw_unchecked( + let resource_resolve_data = Object::from_raw(env.raw(), unsafe { + ToNapiValue::to_napi_value( env.raw(), - ToNapiValue::to_napi_value( - env.raw(), - JsResourceData::from(resource_resolved_data.clone()), - )?, - ) - }; - let loaders = unsafe { - Object::from_raw_unchecked( + JsResourceData::from(resource_resolved_data.clone()), + )? + }); + let loaders = Object::from_raw(env.raw(), unsafe { + ToNapiValue::to_napi_value( env.raw(), - ToNapiValue::to_napi_value( - env.raw(), - module - .loaders() - .iter() - .map(JsLoaderItem::from) - .collect::>(), - )?, - ) - }; + module + .loaders() + .iter() + .map(JsLoaderItem::from) + .collect::>(), + )? + }); #[js_function] pub fn match_resource_getter(ctx: CallContext) -> napi::Result> { - let this = ctx.this_unchecked::(); + let this = ctx.this_unchecked::(); let env = ctx.env.raw(); let wrapped_value = unsafe { NormalModule::from_napi_mut_ref(env, this.raw())? }; @@ -66,7 +60,7 @@ impl NormalModule { #[js_function(1)] pub fn match_resource_setter(ctx: CallContext) -> napi::Result<()> { - let this = ctx.this_unchecked::(); + let this = ctx.this_unchecked::(); let env = ctx.env.raw(); let wrapped_value = unsafe { NormalModule::from_napi_mut_ref(env, this.raw())? }; diff --git a/crates/node_binding/src/plugins/context_replacement.rs b/crates/node_binding/src/plugins/context_replacement.rs index f88ba60fe800..1739bed3d977 100644 --- a/crates/node_binding/src/plugins/context_replacement.rs +++ b/crates/node_binding/src/plugins/context_replacement.rs @@ -6,7 +6,7 @@ use rspack_regex::RspackRegex; use rustc_hash::FxHashMap as HashMap; #[napi(object, object_to_js = false)] -pub struct RawContextReplacementPluginOptions { +pub struct RawContextReplacementPluginOptions<'a> { #[napi(ts_type = "RegExp")] pub resource_reg_exp: RspackRegex, pub new_content_resource: Option, @@ -14,11 +14,11 @@ pub struct RawContextReplacementPluginOptions { #[napi(ts_type = "RegExp")] pub new_content_reg_exp: Option, #[napi(ts_type = "Record")] - pub new_content_create_context_map: Option, + pub new_content_create_context_map: Option>, // new_content_callback } -impl TryFrom for ContextReplacementPluginOptions { +impl<'a> TryFrom> for ContextReplacementPluginOptions { type Error = Error; fn try_from(val: RawContextReplacementPluginOptions) -> Result { diff --git a/crates/node_binding/src/plugins/interceptor.rs b/crates/node_binding/src/plugins/interceptor.rs index 26ddfee402a1..11a7f1260adb 100644 --- a/crates/node_binding/src/plugins/interceptor.rs +++ b/crates/node_binding/src/plugins/interceptor.rs @@ -8,7 +8,7 @@ use async_trait::async_trait; use cow_utils::CowUtils; use napi::{ bindgen_prelude::{Buffer, FromNapiValue, Function, JsValuesTupleIntoVec, Promise, ToNapiValue}, - Env, NapiRaw, + Env, JsValue, }; use rspack_collections::IdentifierSet; use rspack_core::{ diff --git a/crates/node_binding/src/plugins/js_loader/context.rs b/crates/node_binding/src/plugins/js_loader/context.rs index 48f22acda709..b9ed006ffb7c 100644 --- a/crates/node_binding/src/plugins/js_loader/context.rs +++ b/crates/node_binding/src/plugins/js_loader/context.rs @@ -95,7 +95,7 @@ pub struct JsLoaderContext { /// Content maybe empty in pitching stage pub content: Either, #[napi(ts_type = "any")] - pub additional_data: Option>, + pub additional_data: Option>>, #[napi(js_name = "__internal__parseMeta")] pub parse_meta: HashMap, pub source_map: Option, diff --git a/crates/node_binding/src/raw_options/raw_builtins/mod.rs b/crates/node_binding/src/raw_options/raw_builtins/mod.rs index 1dc38d3f3534..f001c55621a1 100644 --- a/crates/node_binding/src/raw_options/raw_builtins/mod.rs +++ b/crates/node_binding/src/raw_options/raw_builtins/mod.rs @@ -20,8 +20,8 @@ mod raw_sri; mod raw_swc_js_minimizer; use napi::{ - bindgen_prelude::{FromNapiValue, Object}, - Env, JsUnknown, + bindgen_prelude::{FromNapiValue, JsObjectValue, Object}, + Env, Unknown, }; use napi_derive::napi; use raw_dll::{RawDllReferenceAgencyPluginOptions, RawFlagAllModulesAsUsedPluginOptions}; @@ -219,13 +219,13 @@ pub enum BuiltinPluginName { } #[napi(object)] -pub struct BuiltinPlugin { +pub struct BuiltinPlugin<'a> { pub name: BuiltinPluginName, - pub options: JsUnknown, + pub options: Unknown<'a>, pub can_inherent_from_parent: Option, } -impl BuiltinPlugin { +impl<'a> BuiltinPlugin<'a> { pub fn append_to( self, env: Env, @@ -726,6 +726,6 @@ impl BuiltinPlugin { } } -fn downcast_into(o: JsUnknown) -> Result { +fn downcast_into(o: Unknown) -> Result { rspack_napi::downcast_into(o).to_rspack_result() } diff --git a/crates/node_binding/src/raw_options/raw_experiments/raw_cache/mod.rs b/crates/node_binding/src/raw_options/raw_experiments/raw_cache/mod.rs index 84d4d2d84ec5..85b0133f6c54 100644 --- a/crates/node_binding/src/raw_options/raw_experiments/raw_cache/mod.rs +++ b/crates/node_binding/src/raw_options/raw_experiments/raw_cache/mod.rs @@ -4,7 +4,7 @@ mod raw_storage; use core::panic; use napi::{ - bindgen_prelude::{FromNapiValue, Object, TypeName, ValidateNapiValue}, + bindgen_prelude::{FromNapiValue, JsObjectValue, Object, TypeName, ValidateNapiValue}, Either, }; use napi_derive::napi; diff --git a/crates/node_binding/src/raw_options/raw_split_chunks/mod.rs b/crates/node_binding/src/raw_options/raw_split_chunks/mod.rs index 69bbdaa05cf9..214e238cf67a 100644 --- a/crates/node_binding/src/raw_options/raw_split_chunks/mod.rs +++ b/crates/node_binding/src/raw_options/raw_split_chunks/mod.rs @@ -26,17 +26,17 @@ use crate::JsFilename; #[napi(object, object_to_js = false)] #[derive(Debug)] -pub struct RawSplitChunksOptions { - pub fallback_cache_group: Option, +pub struct RawSplitChunksOptions<'a> { + pub fallback_cache_group: Option>, #[napi(ts_type = "string | false | Function")] #[debug(skip)] pub name: Option, pub filename: Option, - pub cache_groups: Option>, + pub cache_groups: Option>>, /// What kind of chunks should be selected. #[napi(ts_type = "RegExp | 'async' | 'initial' | 'all' | Function")] #[debug(skip)] - pub chunks: Option, + pub chunks: Option>, pub used_exports: Option, pub automatic_name_delimiter: Option, pub max_async_requests: Option, @@ -57,7 +57,7 @@ pub struct RawSplitChunksOptions { #[napi(object, object_to_js = false)] #[derive(Debug)] -pub struct RawCacheGroupOptions { +pub struct RawCacheGroupOptions<'a> { pub key: String, pub priority: Option, // pub reuse_existing_chunk: Option, @@ -71,13 +71,13 @@ pub struct RawCacheGroupOptions { /// What kind of chunks should be selected. #[napi(ts_type = "RegExp | 'async' | 'initial' | 'all'")] #[debug(skip)] - pub chunks: Option, + pub chunks: Option>, #[napi(ts_type = "RegExp | string")] #[debug(skip)] - pub r#type: Option>, + pub r#type: Option>>, #[napi(ts_type = "RegExp | string | ((layer?: string) => boolean)")] #[debug(skip)] - pub layer: Option, bool>>>, + pub layer: Option, ThreadsafeFunction, bool>>>, pub automatic_name_delimiter: Option, // pub max_async_requests: usize, // pub max_initial_requests: usize, @@ -102,7 +102,7 @@ pub struct RawCacheGroupOptions { pub used_exports: Option, } -impl From for rspack_plugin_split_chunks::PluginOptions { +impl<'a> From> for rspack_plugin_split_chunks::PluginOptions { fn from(raw_opts: RawSplitChunksOptions) -> Self { use rspack_plugin_split_chunks::SplitChunkSizes; @@ -285,10 +285,10 @@ impl From for rspack_plugin_split_chunks::PluginOptions { #[derive(Debug, Default)] #[napi(object, object_to_js = false)] -pub struct RawFallbackCacheGroupOptions { +pub struct RawFallbackCacheGroupOptions<'a> { #[napi(ts_type = "RegExp | 'async' | 'initial' | 'all'")] #[debug(skip)] - pub chunks: Option, + pub chunks: Option>, pub min_size: Option>, pub max_size: Option>, pub max_async_size: Option>, diff --git a/crates/node_binding/src/raw_options/raw_split_chunks/raw_split_chunk_chunks.rs b/crates/node_binding/src/raw_options/raw_split_chunks/raw_split_chunk_chunks.rs index 60afd35843d0..eb03f05089e4 100644 --- a/crates/node_binding/src/raw_options/raw_split_chunks/raw_split_chunk_chunks.rs +++ b/crates/node_binding/src/raw_options/raw_split_chunks/raw_split_chunk_chunks.rs @@ -7,7 +7,7 @@ use rspack_regex::RspackRegex; use crate::JsChunkWrapper; -pub type Chunks = Either3>; +pub type Chunks<'a> = Either3, ThreadsafeFunction>; pub fn create_chunks_filter(raw: Chunks) -> rspack_plugin_split_chunks::ChunkFilter { match raw { diff --git a/crates/node_binding/src/utils.rs b/crates/node_binding/src/utils.rs index 08a8abafedde..89ff1913037b 100644 --- a/crates/node_binding/src/utils.rs +++ b/crates/node_binding/src/utils.rs @@ -3,7 +3,11 @@ use rspack_napi::napi::{ bindgen_prelude::*, threadsafe_function::ThreadsafeFunctionCallMode, Result, }; -pub fn callbackify(f: Function, fut: F, call_js_back: impl FnOnce() + 'static) -> Result<()> +pub fn callbackify( + f: Function<'static>, + fut: F, + call_js_back: impl FnOnce() + 'static, +) -> Result<()> where R: 'static + ToNapiValue, F: 'static + Send + Future>, diff --git a/crates/rspack_core/src/binding/cell.rs b/crates/rspack_core/src/binding/cell.rs index 4e48e0634e25..821e875e635a 100644 --- a/crates/rspack_core/src/binding/cell.rs +++ b/crates/rspack_core/src/binding/cell.rs @@ -20,7 +20,7 @@ mod napi_binding { use derive_more::Debug; use napi::{ bindgen_prelude::{Object, ToNapiValue}, - Env, NapiValue, + Env, }; use once_cell::sync::OnceCell; use rspack_napi::{object_assign, ThreadsafeOneShotRef}; @@ -88,7 +88,7 @@ mod napi_binding { heap: heap.clone(), }; let napi_val = allocator.allocate_asset_info(raw_env, &binding_cell)?; - let target = unsafe { Object::from_raw_unchecked(raw_env, napi_val) }; + let target = Object::from_raw(raw_env, napi_val); ThreadsafeOneShotRef::new(raw_env, target) } HeapVariant::CodeGenerationResult(code_generation_result) => { @@ -98,7 +98,7 @@ mod napi_binding { heap: heap.clone(), }; let napi_val = allocator.allocate_code_generation_result(raw_env, &binding_cell)?; - let target = unsafe { Object::from_raw_unchecked(raw_env, napi_val) }; + let target = Object::from_raw(raw_env, napi_val); ThreadsafeOneShotRef::new(raw_env, target) } HeapVariant::Sources(sources) => { @@ -108,7 +108,7 @@ mod napi_binding { heap: heap.clone(), }; let napi_val = allocator.allocate_sources(raw_env, &binding_cell)?; - let target = unsafe { Object::from_raw_unchecked(raw_env, napi_val) }; + let target = Object::from_raw(raw_env, napi_val); ThreadsafeOneShotRef::new(raw_env, target) } HeapVariant::CodeGenerationResults(code_generation_results) => { @@ -118,7 +118,7 @@ mod napi_binding { heap: heap.clone(), }; let napi_val = allocator.allocate_code_generation_results(raw_env, &binding_cell)?; - let target = unsafe { Object::from_raw_unchecked(raw_env, napi_val) }; + let target = Object::from_raw(raw_env, napi_val); ThreadsafeOneShotRef::new(raw_env, target) } HeapVariant::Assets(assets) => { @@ -128,7 +128,7 @@ mod napi_binding { heap: heap.clone(), }; let napi_val = allocator.allocate_assets(raw_env, &binding_cell)?; - let target = unsafe { Object::from_raw_unchecked(raw_env, napi_val) }; + let target = Object::from_raw(raw_env, napi_val); ThreadsafeOneShotRef::new(raw_env, target) } })?; @@ -142,8 +142,8 @@ mod napi_binding { heap: heap.clone(), }; let napi_val = allocator.allocate_asset_info(raw_env, &binding_cell)?; - let new_object = unsafe { Object::from_raw_unchecked(raw_env, napi_val) }; - let mut original_object = unsafe { Object::from_raw_unchecked(raw_env, result) }; + let new_object = Object::from_raw(raw_env, napi_val); + let mut original_object = Object::from_raw(raw_env, result); object_assign(&mut original_object, &new_object)?; Ok(result) } diff --git a/crates/rspack_napi/src/ext/js_string_ext.rs b/crates/rspack_napi/src/ext/js_string_ext.rs index f477bebacef4..02f28951a4a1 100644 --- a/crates/rspack_napi/src/ext/js_string_ext.rs +++ b/crates/rspack_napi/src/ext/js_string_ext.rs @@ -4,13 +4,12 @@ pub trait JsStringExt { fn into_string(self) -> String; } -impl JsStringExt for JsString { +impl<'a> JsStringExt for JsString<'a> { fn into_string(self) -> String { self .into_utf8() .expect("Should into utf8") - .as_str() + .into_owned() .expect("Should as_str") - .to_string() } } diff --git a/crates/rspack_napi/src/js_values/js_value_ref.rs b/crates/rspack_napi/src/js_values/js_value_ref.rs deleted file mode 100644 index e83511000f10..000000000000 --- a/crates/rspack_napi/src/js_values/js_value_ref.rs +++ /dev/null @@ -1,43 +0,0 @@ -use std::marker::PhantomData; - -use napi::{bindgen_prelude::*, Env, NapiValue, Ref}; - -pub struct JsValueRef { - ref_: Ref, - _phantom: PhantomData, -} - -impl JsValueRef { - pub fn new(env: Env, value: T) -> Result { - let ref_ = Ref::new(&env, &value)?; - - Ok(Self { - ref_, - _phantom: PhantomData, - }) - } - - pub fn get(&self, env: Env) -> Result { - env.get_reference_value(&self.ref_) - } - - pub fn unref(&mut self, env: Env) -> Result<()> { - self.ref_.unref(&env) - } -} - -impl ToNapiValue for JsValueRef { - unsafe fn to_napi_value(env: sys::napi_env, val: Self) -> Result { - val - .get(Env::from(env)) - .and_then(|v| unsafe { T::to_napi_value(env, v) }) - } -} - -impl FromNapiValue for JsValueRef { - unsafe fn from_napi_value(env: sys::napi_env, napi_val: sys::napi_value) -> Result { - JsValueRef::::new(Env::from(env), unsafe { - T::from_napi_value(env, napi_val) - }?) - } -} diff --git a/crates/rspack_napi/src/js_values/mod.rs b/crates/rspack_napi/src/js_values/mod.rs index 11b8ceb10dec..abaa19a2dc99 100644 --- a/crates/rspack_napi/src/js_values/mod.rs +++ b/crates/rspack_napi/src/js_values/mod.rs @@ -1,4 +1,3 @@ -pub mod js_value_ref; pub mod one_shot_instance_ref; pub mod one_shot_value_ref; pub mod threadsafe_one_shot_value_ref; diff --git a/crates/rspack_napi/src/js_values/one_shot_value_ref.rs b/crates/rspack_napi/src/js_values/one_shot_value_ref.rs index cba8190baaa2..9b66d4185e19 100644 --- a/crates/rspack_napi/src/js_values/one_shot_value_ref.rs +++ b/crates/rspack_napi/src/js_values/one_shot_value_ref.rs @@ -27,7 +27,7 @@ pub struct OneShotRef { } impl OneShotRef { - pub fn new(env: napi_env, val: T) -> Result { + pub fn new(env: napi_env, val: T) -> Result { let napi_value = unsafe { ToNapiValue::to_napi_value(env, val)? }; let mut napi_ref = ptr::null_mut(); diff --git a/crates/rspack_napi/src/js_values/threadsafe_one_shot_value_ref.rs b/crates/rspack_napi/src/js_values/threadsafe_one_shot_value_ref.rs index bbc6bb25c56a..79d04e51fe5e 100644 --- a/crates/rspack_napi/src/js_values/threadsafe_one_shot_value_ref.rs +++ b/crates/rspack_napi/src/js_values/threadsafe_one_shot_value_ref.rs @@ -8,7 +8,7 @@ use std::{ }; use napi::{ - bindgen_prelude::{check_status, ToNapiValue}, + bindgen_prelude::{check_status, FromNapiValue, ToNapiValue}, sys::{self, napi_call_threadsafe_function, napi_env, napi_ref, napi_threadsafe_function__}, Env, Result, }; @@ -37,7 +37,7 @@ pub struct ThreadsafeOneShotRef { } impl ThreadsafeOneShotRef { - pub fn new(env: napi_env, val: T) -> Result { + pub fn new(env: napi_env, val: T) -> Result { let napi_value = unsafe { ToNapiValue::to_napi_value(env, val)? }; let mut napi_ref = ptr::null_mut(); @@ -147,3 +147,18 @@ impl ToNapiValue for &mut ThreadsafeOneShotRef { Ok(result) } } + +impl ToNapiValue for ThreadsafeOneShotRef { + unsafe fn to_napi_value(env: sys::napi_env, val: Self) -> Result { + unsafe { ToNapiValue::to_napi_value(env, &val) } + } +} + +impl FromNapiValue for ThreadsafeOneShotRef { + unsafe fn from_napi_value(env: sys::napi_env, napi_val: sys::napi_value) -> Result { + let mut napi_ref = ptr::null_mut(); + check_status!(unsafe { sys::napi_create_reference(env, napi_val, 1, &mut napi_ref) })?; + + Self::from_napi_ref(env, napi_ref) + } +} diff --git a/crates/rspack_napi/src/js_values/weak_ref.rs b/crates/rspack_napi/src/js_values/weak_ref.rs index e81047a4a254..6fe5a45aeb6f 100644 --- a/crates/rspack_napi/src/js_values/weak_ref.rs +++ b/crates/rspack_napi/src/js_values/weak_ref.rs @@ -3,9 +3,9 @@ use std::{cell::Cell, ptr, rc::Rc}; use napi::{ - bindgen_prelude::{check_status, Object, ToNapiValue}, + bindgen_prelude::{check_status, JsObjectValue, Object, ToNapiValue}, sys::{self, napi_env}, - Env, NapiRaw, NapiValue, Result, + Env, JsValue, Result, }; pub struct WeakRef { @@ -27,9 +27,9 @@ impl WeakRef { Ok(Self { raw_ref, deleted }) } - pub fn as_object(&self, env: &Env) -> Result { + pub fn as_object(&self, env: &Env) -> Result> { let napi_val = unsafe { ToNapiValue::to_napi_value(env.raw(), self)? }; - Ok(unsafe { Object::from_raw_unchecked(env.raw(), napi_val) }) + Ok(Object::from_raw(env.raw(), napi_val)) } } diff --git a/crates/rspack_napi/src/threadsafe_function.rs b/crates/rspack_napi/src/threadsafe_function.rs index 0cccdb6c4378..fcf36ddb7528 100644 --- a/crates/rspack_napi/src/threadsafe_function.rs +++ b/crates/rspack_napi/src/threadsafe_function.rs @@ -8,7 +8,7 @@ use napi::{ bindgen_prelude::{FromNapiValue, JsValuesTupleIntoVec, Promise, TypeName, ValidateNapiValue}, sys::{self, napi_env}, threadsafe_function::{ThreadsafeFunction as RawThreadsafeFunction, ThreadsafeFunctionCallMode}, - Env, JsUnknown as Unknown, NapiRaw, ValueType, + Env, JsValue, Unknown, ValueType, }; use oneshot::Receiver; use rspack_error::{miette::IntoDiagnostic, Error, Result}; @@ -20,7 +20,7 @@ type ErrorResolver = dyn FnOnce(Env); static ERROR_RESOLVER: OnceLock>> = OnceLock::new(); pub struct ThreadsafeFunction { - inner: Arc>, + inner: Arc, T, false, true>>, env: napi_env, _data: PhantomData, } diff --git a/crates/rspack_napi/src/threadsafe_js_value_ref.rs b/crates/rspack_napi/src/threadsafe_js_value_ref.rs index b2dea5f64679..5b7810eb9edd 100644 --- a/crates/rspack_napi/src/threadsafe_js_value_ref.rs +++ b/crates/rspack_napi/src/threadsafe_js_value_ref.rs @@ -1,16 +1,16 @@ use std::sync::{Arc, Mutex}; -use napi::{bindgen_prelude::*, NapiValue}; +use napi::{bindgen_prelude::*, Ref}; -use crate::{js_values::js_value_ref::JsValueRef, JsCallback}; +use crate::JsCallback; -struct ThreadsafeJsValueRefHandle { - value_ref: Arc>>, +struct ThreadsafeJsValueRefHandle> { + value_ref: Arc>>, drop_handle: JsCallback>, } -impl ThreadsafeJsValueRefHandle { - fn new(env: Env, js_ref: JsValueRef) -> Result { +impl> ThreadsafeJsValueRefHandle { + fn new(env: Env, js_ref: Ref) -> Result { Ok(Self { value_ref: Arc::new(Mutex::new(js_ref)), drop_handle: unsafe { JsCallback::new(env.raw()) }?, @@ -18,26 +18,26 @@ impl ThreadsafeJsValueRefHandle { } } -impl Drop for ThreadsafeJsValueRefHandle { +impl> Drop for ThreadsafeJsValueRefHandle { fn drop(&mut self) { let value_ref = self.value_ref.clone(); self.drop_handle.call(Box::new(move |env| { let _ = value_ref .lock() .expect("should lock `value_ref`") - .unref(env); + .unref(&env); })) } } -pub struct ThreadsafeJsValueRef { +pub struct ThreadsafeJsValueRef> { inner: Arc>, } -unsafe impl Send for ThreadsafeJsValueRef {} -unsafe impl Sync for ThreadsafeJsValueRef {} +unsafe impl> Send for ThreadsafeJsValueRef {} +unsafe impl> Sync for ThreadsafeJsValueRef {} -impl Clone for ThreadsafeJsValueRef { +impl> Clone for ThreadsafeJsValueRef { fn clone(&self) -> Self { Self { inner: self.inner.clone(), @@ -45,7 +45,7 @@ impl Clone for ThreadsafeJsValueRef { } } -impl FromNapiValue for ThreadsafeJsValueRef { +impl> FromNapiValue for ThreadsafeJsValueRef { unsafe fn from_napi_value(env: sys::napi_env, napi_val: sys::napi_value) -> Result { Self::new(Env::from(env), unsafe { T::from_napi_value(env, napi_val) @@ -53,7 +53,7 @@ impl FromNapiValue for ThreadsafeJsValueRef { } } -impl ToNapiValue for ThreadsafeJsValueRef { +impl> ToNapiValue for ThreadsafeJsValueRef { unsafe fn to_napi_value(env: sys::napi_env, val: Self) -> Result { val .get(Env::from(env)) @@ -61,9 +61,9 @@ impl ToNapiValue for ThreadsafeJsValueRef { } } -impl ThreadsafeJsValueRef { +impl> ThreadsafeJsValueRef { pub fn new(env: Env, value: T) -> Result { - let js_ref = JsValueRef::new(env, value)?; + let js_ref = Ref::new(&env, &value)?; Ok(Self { inner: Arc::new(ThreadsafeJsValueRefHandle::new(env, js_ref)?), @@ -76,6 +76,6 @@ impl ThreadsafeJsValueRef { .value_ref .lock() .expect("should lock `value_ref`") - .get(env) + .get_value(&env) } } diff --git a/crates/rspack_napi/src/utils.rs b/crates/rspack_napi/src/utils.rs index c6380467a7bd..2f1d52422923 100644 --- a/crates/rspack_napi/src/utils.rs +++ b/crates/rspack_napi/src/utils.rs @@ -1,6 +1,6 @@ use napi::{ - bindgen_prelude::{Array, FromNapiValue, Object, Unknown}, - Env, + bindgen_prelude::{Array, FromNapiValue, JsObjectValue, Object, Unknown}, + Env, JsValue, }; pub fn downcast_into(o: Unknown) -> napi::Result { @@ -13,11 +13,11 @@ pub fn object_assign(target: &mut Object, source: &Object) -> napi::Result<()> { napi::KeyFilter::AllProperties, napi::KeyConversion::KeepNumbers, )?; - let names = Array::from_unknown(names.into_unknown())?; + let names = Array::from_unknown(names.to_unknown())?; for index in 0..names.len() { if let Some(name) = names.get::(index)? { - let value = source.get_property::<&Unknown, Unknown>(&name)?; + let value = source.get_property::(name)?; target.set_property::(name, value)?; } } @@ -25,19 +25,19 @@ pub fn object_assign(target: &mut Object, source: &Object) -> napi::Result<()> { Ok(()) } -pub fn object_clone(env: &Env, object: &Object) -> napi::Result { - let mut new_object = env.create_object()?; +pub fn object_clone<'a>(env: &Env, object: &'a Object<'a>) -> napi::Result> { + let mut new_object = Object::new(env)?; let names = object.get_all_property_names( napi::KeyCollectionMode::OwnOnly, napi::KeyFilter::AllProperties, napi::KeyConversion::KeepNumbers, )?; - let names = Array::from_unknown(names.into_unknown())?; + let names = Array::from_unknown(names.to_unknown())?; for index in 0..names.len() { if let Some(name) = names.get::(index)? { - let value = object.get_property::<&Unknown, Unknown>(&name)?; + let value = object.get_property::(name)?; new_object.set_property::(name, value)?; } } diff --git a/crates/rspack_regex/src/napi.rs b/crates/rspack_regex/src/napi.rs index 2bac50683a78..ef04f3fdc2e0 100644 --- a/crates/rspack_regex/src/napi.rs +++ b/crates/rspack_regex/src/napi.rs @@ -1,6 +1,9 @@ use napi::{ - bindgen_prelude::{FromNapiValue, Function, ToNapiValue, TypeName, ValidateNapiValue}, - Env, JsObject, NapiRaw, NapiValue, + bindgen_prelude::{ + FromNapiValue, Function, JsObjectValue, Object, ToNapiValue, TypeName, Undefined, + ValidateNapiValue, + }, + Env, JsValue, Unknown, }; use crate::RspackRegex; @@ -19,26 +22,26 @@ impl TypeName for RspackRegex { impl FromNapiValue for RspackRegex { unsafe fn from_napi_value( - env: napi::sys::napi_env, + raw_env: napi::sys::napi_env, napi_val: napi::sys::napi_value, ) -> napi::Result { - let js_object = unsafe { JsObject::from_raw_unchecked(env, napi_val) }; + let js_object = Object::from_raw(raw_env, napi_val); - let env = Env::from(env); + let env = Env::from(raw_env); let global = env.get_global()?; let object_prototype_to_string = global - .get_named_property_unchecked::("Object")? - .get_named_property_unchecked::("prototype")? + .get_named_property_unchecked::("Object")? + .get_named_property_unchecked::("prototype")? .get_named_property_unchecked::("toString")?; - let js_string = object_prototype_to_string - .apply(&js_object, env.get_undefined()?.into_unknown())? - // .call_without_args(Some(&js_object))? - .coerce_to_string()? - .into_utf8()?; - let js_object_type = js_string.as_str()?; + let raw_undefined = Undefined::to_napi_value(raw_env, ())?; + let undefined = Unknown::from_napi_value(raw_env, raw_undefined)?; + let js_value = object_prototype_to_string.apply(js_object, undefined)?; + let js_string = js_value.coerce_to_string()?; + let js_utf8_string = js_string.into_utf8()?; + let object_type = js_utf8_string.as_str()?; - if js_object_type == "[object RegExp]" { + if object_type == "[object RegExp]" { let source = js_object.get_named_property::("source")?; let flags = js_object.get_named_property::("flags")?; @@ -49,7 +52,7 @@ impl FromNapiValue for RspackRegex { napi::Status::ObjectExpected, format!( "Expect value to be '[object RegExp]', but received {}", - js_object_type + object_type ), )) } From d152c6796b06cfdc665f5dc4e7a337e9d31d3842 Mon Sep 17 00:00:00 2001 From: Cong-Cong Pan Date: Wed, 21 May 2025 17:54:13 +0800 Subject: [PATCH 10/50] fix: set compilation errors result is wrong (#10439) --- crates/node_binding/binding.d.ts | 2 +- crates/node_binding/rspack.wasi-browser.js | 5 +- crates/node_binding/rspack.wasi.cjs | 6 +- crates/node_binding/src/compilation/mod.rs | 24 ++-- .../rspack_core/src/compiler/compilation.rs | 9 -- .../configCases/compilation/errors/index.js | 0 .../configCases/compilation/errors/loader.js | 8 ++ .../compilation/errors/rspack.config.js | 48 +++++++ packages/rspack/src/Compilation.ts | 128 +++--------------- 9 files changed, 93 insertions(+), 137 deletions(-) create mode 100644 packages/rspack-test-tools/tests/configCases/compilation/errors/index.js create mode 100644 packages/rspack-test-tools/tests/configCases/compilation/errors/loader.js create mode 100644 packages/rspack-test-tools/tests/configCases/compilation/errors/rspack.config.js diff --git a/crates/node_binding/binding.d.ts b/crates/node_binding/binding.d.ts index 037811e69be4..3f055640ac9f 100644 --- a/crates/node_binding/binding.d.ts +++ b/crates/node_binding/binding.d.ts @@ -253,10 +253,10 @@ export declare class JsCompilation { get hash(): string | null dependencies(): JsDependencies pushDiagnostic(diagnostic: JsRspackDiagnostic): void - spliceDiagnostic(start: number, end: number, replaceWith: Array): void pushNativeDiagnostic(diagnostic: ExternalObject<'Diagnostic'>): void pushNativeDiagnostics(diagnostics: ExternalObject<'Diagnostic[]'>): void get errors(): Diagnostics + get warnings(): Diagnostics getErrors(): Array getWarnings(): Array getStats(): JsStats diff --git a/crates/node_binding/rspack.wasi-browser.js b/crates/node_binding/rspack.wasi-browser.js index b275c5f85bfb..ee7296df2330 100644 --- a/crates/node_binding/rspack.wasi-browser.js +++ b/crates/node_binding/rspack.wasi-browser.js @@ -1,8 +1,8 @@ import { - instantiateNapiModuleSync as __emnapiInstantiateNapiModuleSync, + createOnMessage as __wasmCreateOnMessageForFsProxy, getDefaultContext as __emnapiGetDefaultContext, + instantiateNapiModuleSync as __emnapiInstantiateNapiModuleSync, WASI as __WASI, - createOnMessage as __wasmCreateOnMessageForFsProxy, } from '@napi-rs/wasm-runtime' import { memfs } from '@napi-rs/wasm-runtime/fs' import __wasmUrl from './rspack.wasm32-wasi.wasm?url' @@ -60,6 +60,7 @@ const { } }, }) +export default __napiModule.exports export const Assets = __napiModule.exports.Assets export const AsyncDependenciesBlock = __napiModule.exports.AsyncDependenciesBlock export const BuildInfo = __napiModule.exports.BuildInfo diff --git a/crates/node_binding/rspack.wasi.cjs b/crates/node_binding/rspack.wasi.cjs index 725e60c22d11..de1d4e0cc209 100644 --- a/crates/node_binding/rspack.wasi.cjs +++ b/crates/node_binding/rspack.wasi.cjs @@ -9,9 +9,9 @@ const { WASI: __nodeWASI } = require('node:wasi') const { Worker } = require('node:worker_threads') const { - instantiateNapiModuleSync: __emnapiInstantiateNapiModuleSync, - getDefaultContext: __emnapiGetDefaultContext, createOnMessage: __wasmCreateOnMessageForFsProxy, + getDefaultContext: __emnapiGetDefaultContext, + instantiateNapiModuleSync: __emnapiInstantiateNapiModuleSync, } = require('@napi-rs/wasm-runtime') const __rootDir = __nodePath.parse(process.cwd()).root @@ -84,7 +84,7 @@ const { instance: __napiInstance, module: __wasiModule, napiModule: __napiModule } }, }) - +module.exports = __napiModule.exports module.exports.Assets = __napiModule.exports.Assets module.exports.AsyncDependenciesBlock = __napiModule.exports.AsyncDependenciesBlock module.exports.BuildInfo = __napiModule.exports.BuildInfo diff --git a/crates/node_binding/src/compilation/mod.rs b/crates/node_binding/src/compilation/mod.rs index 3c59fa752600..8ed69628190a 100644 --- a/crates/node_binding/src/compilation/mod.rs +++ b/crates/node_binding/src/compilation/mod.rs @@ -403,20 +403,6 @@ impl JsCompilation { Ok(()) } - #[napi] - pub fn splice_diagnostic( - &mut self, - start: u32, - end: u32, - replace_with: Vec, - ) -> Result<()> { - let compilation = self.as_mut()?; - - let diagnostics = replace_with.into_iter().map(Into::into).collect(); - compilation.splice_diagnostic(start as usize, end as usize, diagnostics); - Ok(()) - } - #[napi(ts_args_type = r#"diagnostic: ExternalObject<'Diagnostic'>"#)] pub fn push_native_diagnostic(&mut self, diagnostic: &External) -> Result<()> { let compilation = self.as_mut()?; @@ -438,7 +424,7 @@ impl JsCompilation { Ok(()) } - #[napi(getter, ts_return_type = "Diagnostics")] + #[napi(getter)] pub fn errors(&self, reference: Reference) -> Result { Ok(Diagnostics::new( RspackSeverity::Error, @@ -446,6 +432,14 @@ impl JsCompilation { )) } + #[napi(getter)] + pub fn warnings(&self, reference: Reference) -> Result { + Ok(Diagnostics::new( + RspackSeverity::Warn, + reference.downgrade(), + )) + } + #[napi] pub fn get_errors(&self) -> Result> { let compilation = self.as_ref()?; diff --git a/crates/rspack_core/src/compiler/compilation.rs b/crates/rspack_core/src/compiler/compilation.rs index 8c12a99c1ec6..7232d486eef3 100644 --- a/crates/rspack_core/src/compiler/compilation.rs +++ b/crates/rspack_core/src/compiler/compilation.rs @@ -809,15 +809,6 @@ impl Compilation { self.diagnostics.push(diagnostic); } - pub fn splice_diagnostic( - &mut self, - s: usize, - e: usize, - replace_with: Vec, - ) -> Vec { - self.diagnostics.splice(s..e, replace_with).collect() - } - pub fn extend_diagnostics(&mut self, diagnostics: impl IntoIterator) { self.diagnostics.extend(diagnostics); } diff --git a/packages/rspack-test-tools/tests/configCases/compilation/errors/index.js b/packages/rspack-test-tools/tests/configCases/compilation/errors/index.js new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/rspack-test-tools/tests/configCases/compilation/errors/loader.js b/packages/rspack-test-tools/tests/configCases/compilation/errors/loader.js new file mode 100644 index 000000000000..b9084afff7e4 --- /dev/null +++ b/packages/rspack-test-tools/tests/configCases/compilation/errors/loader.js @@ -0,0 +1,8 @@ +module.exports = function (content) { + this.emitWarning(new Error("emitted warning1")); + this.emitError(new Error("emitted error1")); + this.emitWarning(new Error("emitted warning2")); + this.emitError(new Error("emitted error2")); + + return content; +} diff --git a/packages/rspack-test-tools/tests/configCases/compilation/errors/rspack.config.js b/packages/rspack-test-tools/tests/configCases/compilation/errors/rspack.config.js new file mode 100644 index 000000000000..82fbae9688a6 --- /dev/null +++ b/packages/rspack-test-tools/tests/configCases/compilation/errors/rspack.config.js @@ -0,0 +1,48 @@ +const PLUGIN_NAME = "plugin"; + +class Plugin { + /** + * @param {import("@rspack/core").Compiler} compiler + */ + apply(compiler) { + compiler.hooks.make.tap(PLUGIN_NAME, compilation => { + compilation.hooks.processAssets.tap(PLUGIN_NAME, () => { + expect(compilation.errors.length).toBe(2); + expect(compilation.errors[0].message).toMatch(/emitted error1/); + expect(compilation.errors[1].message).toMatch(/emitted error2/); + + expect(compilation.warnings.length).toBe(2); + expect(compilation.warnings[0].message).toMatch(/emitted warning1/); + expect(compilation.warnings[1].message).toMatch(/emitted warning2/); + + compilation.errors = []; + expect(compilation.errors.length).toBe(0); + + expect(compilation.warnings.length).toBe(2); + expect(compilation.warnings[0].message).toMatch(/emitted warning1/); + expect(compilation.warnings[1].message).toMatch(/emitted warning2/); + + compilation.warnings = []; + expect(compilation.warnings.length).toBe(0); + }); + }); + } +} + +/**@type {import("@rspack/core").Configuration}*/ +module.exports = { + entry: "./index.js", + plugins: [new Plugin()], + module: { + rules: [ + { + test: /\.js$/, + use: [ + { + loader: require.resolve("./loader") + } + ] + } + ] + } +}; diff --git a/packages/rspack/src/Compilation.ts b/packages/rspack/src/Compilation.ts index 92b2f36dcd30..2bc032c88bf4 100644 --- a/packages/rspack/src/Compilation.ts +++ b/packages/rspack/src/Compilation.ts @@ -8,15 +8,14 @@ * https://github.com/webpack/webpack/blob/main/LICENSE */ import * as binding from "@rspack/binding"; -import { - type AssetInfo, - type Dependency, - type ExternalObject, - type JsCompatSourceOwned, - type JsCompilation, - type JsPathData, - JsRspackSeverity, - type JsRuntimeModule +import type { + AssetInfo, + Dependency, + ExternalObject, + JsCompatSourceOwned, + JsCompilation, + JsPathData, + JsRuntimeModule } from "@rspack/binding"; export type { AssetInfo } from "@rspack/binding"; import * as liteTapable from "@rspack/lite-tapable"; @@ -33,7 +32,7 @@ import ModuleGraph from "./ModuleGraph"; import type { NormalModuleCompilationHooks } from "./NormalModule"; import type { NormalModuleFactory } from "./NormalModuleFactory"; import type { ResolverFactory } from "./ResolverFactory"; -import { JsRspackDiagnostic, type RspackError } from "./RspackError"; +import type { RspackError } from "./RspackError"; import { RuntimeModule } from "./RuntimeModule"; import { Stats, @@ -202,6 +201,7 @@ export class Compilation { #inner: JsCompilation; #shutdown: boolean; #errors?: RspackError[]; + #warnings?: RspackError[]; #chunks?: ReadonlySet; hooks: Readonly<{ @@ -717,110 +717,24 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si } set errors(errors: RspackError[]) { - const inner = this.#inner; - const length = inner.getErrors().length; - inner.spliceDiagnostic( - 0, - length, - errors.map(error => { - return JsRspackDiagnostic.__to_binding(error, JsRspackSeverity.Error); - }) - ); + if (!this.#errors) { + this.#errors = createDiagnosticArray(this.#inner.errors); + } + this.#errors.splice(0, this.#errors.length, ...errors); } get warnings(): RspackError[] { - const inner = this.#inner; - type WarnType = Error | RspackError; - const warnings = inner.getWarnings(); - const proxyMethod = [ - { - method: "push", - handler( - target: typeof Array.prototype.push, - thisArg: Array, - warns: WarnType[] - ) { - for (const warn of warns) { - inner.pushDiagnostic( - JsRspackDiagnostic.__to_binding(warn, JsRspackSeverity.Warn) - ); - } - return Reflect.apply(target, thisArg, warns); - } - }, - { - method: "pop", - handler(target: typeof Array.prototype.pop, thisArg: Array) { - inner.spliceDiagnostic(warnings.length - 1, warnings.length, []); - return Reflect.apply(target, thisArg, []); - } - }, - { - method: "shift", - handler( - target: typeof Array.prototype.shift, - thisArg: Array - ) { - inner.spliceDiagnostic(0, 1, []); - return Reflect.apply(target, thisArg, []); - } - }, - { - method: "unshift", - handler( - target: typeof Array.prototype.unshift, - thisArg: Array, - warns: WarnType[] - ) { - inner.spliceDiagnostic( - 0, - 0, - warns.map(warn => - JsRspackDiagnostic.__to_binding(warn, JsRspackSeverity.Warn) - ) - ); - return Reflect.apply(target, thisArg, warns); - } - }, - { - method: "splice", - handler( - target: typeof Array.prototype.splice, - thisArg: Array, - [startIdx, delCount, ...warns]: [number, number, ...WarnType[]] - ) { - const warnList = warns.map(warn => - JsRspackDiagnostic.__to_binding(warn, JsRspackSeverity.Warn) - ); - inner.spliceDiagnostic(startIdx, startIdx + delCount, warnList); - return Reflect.apply(target, thisArg, [ - startIdx, - delCount, - ...warnList - ]); - } - } - ]; - - for (const item of proxyMethod) { - const proxiedMethod = new Proxy(warnings[item.method as any], { - apply: item.handler as any - }); - warnings[item.method as any] = proxiedMethod; + if (!this.#warnings) { + this.#warnings = createDiagnosticArray(this.#inner.warnings); } - return warnings; + return this.#warnings; } set warnings(warnings: RspackError[]) { - const inner = this.#inner; - const length = inner.getWarnings().length; - inner.spliceDiagnostic( - 0, - length, - warnings.map(warning => { - return JsRspackDiagnostic.__to_binding(warning, JsRspackSeverity.Warn); - }) - ); + if (!this.#warnings) { + this.#warnings = createDiagnosticArray(this.#inner.warnings); + } + this.#warnings.splice(0, this.#warnings.length, ...warnings); } getPath(filename: string, data: PathData = {}) { From 8cf1df4d7a205f7dc09d3f08f735555ad6f0302d Mon Sep 17 00:00:00 2001 From: CPunisher <1343316114@qq.com> Date: Wed, 21 May 2025 17:57:49 +0800 Subject: [PATCH 11/50] refactor: use `#[napi(module_exports)]` (#10437) * use #[napi(module_exports)] * fix clippy --- crates/node_binding/src/lib.rs | 12 +++++++++--- crates/node_binding/src/module.rs | 3 +-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/crates/node_binding/src/lib.rs b/crates/node_binding/src/lib.rs index d512ef5c7c9b..e8ab437e4c11 100644 --- a/crates/node_binding/src/lib.rs +++ b/crates/node_binding/src/lib.rs @@ -9,7 +9,7 @@ extern crate rspack_allocator; use std::{cell::RefCell, sync::Arc}; use compiler::{Compiler, CompilerState, CompilerStateGuard}; -use napi::{bindgen_prelude::*, CallContext, JsObject}; +use napi::{bindgen_prelude::*, CallContext}; use rspack_collections::UkeyMap; use rspack_core::{ BoxDependency, Compilation, CompilerId, EntryOptions, ModuleIdentifier, PluginExt, @@ -478,12 +478,18 @@ pub fn cleanup_global_trace() { }); } -#[module_exports] -fn node_init(mut _exports: JsObject, env: Env) -> Result<()> { +fn node_init(mut _exports: Object, env: Env) -> Result<()> { rspack_core::set_thread_local_allocator(Box::new(allocator::NapiAllocatorImpl::new(env))); Ok(()) } +#[napi(module_exports)] +pub fn rspack_module_exports(exports: Object, env: Env) -> Result<()> { + node_init(exports, env)?; + module::init(exports, env)?; + Ok(()) +} + #[napi] /// Shutdown the tokio runtime manually. /// diff --git a/crates/node_binding/src/module.rs b/crates/node_binding/src/module.rs index 78ca8f014388..a762df117d6a 100644 --- a/crates/node_binding/src/module.rs +++ b/crates/node_binding/src/module.rs @@ -807,8 +807,7 @@ thread_local! { pub(crate) static COMPILATION_HOOKS_MAP_SYMBOL: OnceCell = Default::default(); } -#[module_exports] -fn init(mut exports: JsObject, env: Env) -> napi::Result<()> { +pub(super) fn init(mut exports: Object, env: Env) -> napi::Result<()> { let module_identifier_symbol = OneShotRef::new(env.raw(), env.create_symbol(None)?)?; exports.set_named_property("MODULE_IDENTIFIER_SYMBOL", &module_identifier_symbol)?; MODULE_IDENTIFIER_SYMBOL.with(|once_cell| { From e331ea6b004ae7a84f14ce8c60e95cc3e0d152ec Mon Sep 17 00:00:00 2001 From: Gengkun Date: Wed, 21 May 2025 18:01:16 +0800 Subject: [PATCH 12/50] refactor: replaced used name to slice for args (#10441) --- crates/node_binding/src/exports_info.rs | 20 +-- crates/rspack_core/src/concatenated_module.rs | 12 +- .../src/dependency/runtime_template.rs | 8 +- crates/rspack_core/src/exports_info.rs | 135 ++++++++---------- .../common_js_export_require_dependency.rs | 16 +-- .../commonjs/common_js_exports_dependency.rs | 9 +- .../common_js_full_require_dependency.rs | 5 +- .../common_js_self_reference_dependency.rs | 9 +- .../esm/esm_export_expression_dependency.rs | 11 +- ...sm_export_imported_specifier_dependency.rs | 41 +++--- .../esm/esm_export_specifier_dependency.rs | 9 +- .../esm/esm_import_specifier_dependency.rs | 5 +- .../src/dependency/esm/provide_dependency.rs | 6 +- .../src/dependency/export_info_dependency.rs | 8 +- .../dependency/pure_expression_dependency.rs | 4 +- .../src/parser_and_generator.rs | 11 +- .../__snapshots__/output.snap.txt | 8 +- 17 files changed, 138 insertions(+), 179 deletions(-) diff --git a/crates/node_binding/src/exports_info.rs b/crates/node_binding/src/exports_info.rs index c4aeb106383f..c16dfad1f6b8 100644 --- a/crates/node_binding/src/exports_info.rs +++ b/crates/node_binding/src/exports_info.rs @@ -2,7 +2,7 @@ use std::{ptr::NonNull, sync::Arc}; use napi::Either; use napi_derive::napi; -use rspack_core::{Compilation, ExportsInfo, ModuleGraph, RuntimeSpec, UsedName}; +use rspack_core::{Compilation, ExportsInfo, ModuleGraph, RuntimeSpec}; use crate::JsRuntimeSpec; @@ -84,18 +84,20 @@ impl JsExportsInfo { js_runtime: JsRuntimeSpec, ) -> napi::Result { let module_graph = self.as_ref()?; - let name = match js_name { - Either::A(s) => UsedName::Str(s.into()), - Either::B(v) => UsedName::Vec(v.into_iter().map(Into::into).collect::>()), - }; let runtime: Option = js_runtime.map(|js_rt| match js_rt { Either::A(str) => std::iter::once(str).map(Arc::from).collect(), Either::B(vec) => vec.into_iter().map(Arc::from).collect(), }); - Ok( - self + let used = match js_name { + Either::A(s) => self .exports_info - .get_used(&module_graph, name, runtime.as_ref()) as u32, - ) + .get_used(&module_graph, &[s.into()], runtime.as_ref()), + Either::B(v) => self.exports_info.get_used( + &module_graph, + v.into_iter().map(Into::into).collect::>().as_slice(), + runtime.as_ref(), + ), + }; + Ok(used as u32) } } diff --git a/crates/rspack_core/src/concatenated_module.rs b/crates/rspack_core/src/concatenated_module.rs index eab2fe2f7dd3..1aafc4279638 100644 --- a/crates/rspack_core/src/concatenated_module.rs +++ b/crates/rspack_core/src/concatenated_module.rs @@ -51,7 +51,7 @@ use crate::{ ErrorSpan, ExportInfoProvided, ExportsArgument, ExportsType, FactoryMeta, IdentCollector, LibIdentOptions, MaybeDynamicTargetExportInfoHashKey, Module, ModuleArgument, ModuleGraph, ModuleGraphConnection, ModuleIdentifier, ModuleLayer, ModuleType, Resolve, RuntimeCondition, - RuntimeGlobals, RuntimeSpec, SourceType, SpanExt, Template, UsageState, UsedName, DEFAULT_EXPORT, + RuntimeGlobals, RuntimeSpec, SourceType, SpanExt, Template, UsageState, DEFAULT_EXPORT, NAMESPACE_OBJECT_EXPORT, }; @@ -2107,9 +2107,7 @@ impl ConcatenatedModule { if let Some(ref export_id) = export_id && let Some(direct_export) = info.export_map.as_ref().and_then(|map| map.get(export_id)) { - if let Some(used_name) = - exports_info.get_used_name(mg, runtime, UsedName::Vec(export_name.clone())) - { + if let Some(used_name) = exports_info.get_used_name(mg, runtime, &export_name) { // https://github.com/webpack/webpack/blob/1f99ad6367f2b8a6ef17cce0e058f7a67fb7db18/lib/optimize/ConcatenatedModule.js#L402-L404 let used_name = used_name.to_used_name_vec(); @@ -2188,7 +2186,7 @@ impl ConcatenatedModule { if info.namespace_export_symbol.is_some() { // That's how webpack write https://github.com/webpack/webpack/blob/1f99ad6367f2b8a6ef17cce0e058f7a67fb7db18/lib/optimize/ConcatenatedModule.js#L463-L471 let used_name = exports_info - .get_used_name(mg, runtime, UsedName::Vec(export_name.clone())) + .get_used_name(mg, runtime, &export_name) .expect("should have export name"); let used_name = used_name.to_used_name_vec(); return Binding::Raw(RawBinding { @@ -2211,9 +2209,7 @@ impl ConcatenatedModule { ); } ModuleInfo::External(info) => { - if let Some(used_name) = - exports_info.get_used_name(mg, runtime, UsedName::Vec(export_name.clone())) - { + if let Some(used_name) = exports_info.get_used_name(mg, runtime, &export_name) { let used_name = used_name.to_used_name_vec(); let comment = if used_name == export_name { String::new() diff --git a/crates/rspack_core/src/dependency/runtime_template.rs b/crates/rspack_core/src/dependency/runtime_template.rs index 7973289c967a..785a09114617 100644 --- a/crates/rspack_core/src/dependency/runtime_template.rs +++ b/crates/rspack_core/src/dependency/runtime_template.rs @@ -211,11 +211,9 @@ pub fn export_from_import( let exports_info = compilation .get_module_graph() .get_exports_info(&module_identifier); - let Some(used_name) = exports_info.get_used_name( - &compilation.get_module_graph(), - *runtime, - crate::UsedName::Vec(export_name.to_vec()), - ) else { + let Some(used_name) = + exports_info.get_used_name(&compilation.get_module_graph(), *runtime, export_name) + else { return format!( "{} undefined", to_normal_comment(&property_access(export_name, 0)) diff --git a/crates/rspack_core/src/exports_info.rs b/crates/rspack_core/src/exports_info.rs index e6a28fcbc5ab..86010f9bba76 100644 --- a/crates/rspack_core/src/exports_info.rs +++ b/crates/rspack_core/src/exports_info.rs @@ -475,48 +475,43 @@ impl ExportsInfo { &self, mg: &ModuleGraph, runtime: Option<&RuntimeSpec>, - name: UsedName, + names: &[Atom], ) -> Option { - match name { - UsedName::Str(name) => { - let info = self.get_read_only_export_info(mg, &name); - info - .get_used_name(mg, Some(&name), runtime) - .map(UsedName::Str) - } - UsedName::Vec(names) => { - if names.is_empty() { - if !self.is_used(mg, runtime) { - return None; - } - return Some(UsedName::Vec(names)); - } - let export_info = self.get_read_only_export_info(mg, &names[0]); - let x = export_info.get_used_name(mg, Some(&names[0]), runtime)?; - let names_len = names.len(); - let mut arr = if x == names[0] && names.len() == 1 { - names.clone() - } else { - vec![x] - }; - if names_len == 1 { - return Some(UsedName::Vec(arr)); - } - if let Some(exports_info) = export_info.exports_info(mg) - && export_info.get_used(mg, runtime) == UsageState::OnlyPropertiesUsed - { - let nested = exports_info.get_used_name(mg, runtime, UsedName::Vec(names[1..].to_vec())); - let nested = nested?; - arr.extend(match nested { - UsedName::Str(name) => vec![name], - UsedName::Vec(names) => names, - }); - return Some(UsedName::Vec(arr)); - } - arr.extend(names.into_iter().skip(1)); - Some(UsedName::Vec(arr)) + if names.len() == 1 { + let name = &names[0]; + let info = self.get_read_only_export_info(mg, name); + return info + .get_used_name(mg, Some(name), runtime) + .map(|n| UsedName::Normal(vec![n])); + } + if names.is_empty() { + if !self.is_used(mg, runtime) { + return None; } + return Some(UsedName::Normal(names.to_vec())); + } + let export_info = self.get_read_only_export_info(mg, &names[0]); + let x = export_info.get_used_name(mg, Some(&names[0]), runtime)?; + let mut arr = if x == names[0] && names.len() == 1 { + names.to_vec() + } else { + vec![x] + }; + if names.len() == 1 { + return Some(UsedName::Normal(arr)); } + if let Some(exports_info) = export_info.exports_info(mg) + && export_info.get_used(mg, runtime) == UsageState::OnlyPropertiesUsed + { + let nested = exports_info.get_used_name(mg, runtime, &names[1..]); + let nested = nested?; + arr.extend(match nested { + UsedName::Normal(names) => names, + }); + return Some(UsedName::Normal(arr)); + } + arr.extend(names.iter().skip(1).cloned()); + Some(UsedName::Normal(arr)) } pub fn get_provided_exports(&self, mg: &ModuleGraph) -> ProvidedExports { @@ -673,31 +668,24 @@ impl ExportsInfo { pub fn get_used( &self, mg: &ModuleGraph, - name: UsedName, + names: &[Atom], runtime: Option<&RuntimeSpec>, ) -> UsageState { - match &name { - UsedName::Str(value) => { - let info = self.get_read_only_export_info(mg, value); - info.get_used(mg, runtime) - } - UsedName::Vec(value) => { - if value.is_empty() { - return self.other_exports_info(mg).get_used(mg, runtime); - } - let info = self.get_read_only_export_info(mg, &value[0]); - if let Some(exports_info) = info.exports_info(mg) - && value.len() > 1 - { - return exports_info.get_used( - mg, - UsedName::Vec(value.iter().skip(1).cloned().collect::>()), - runtime, - ); - } - info.get_used(mg, runtime) - } + if names.len() == 1 { + let value = &names[0]; + let info = self.get_read_only_export_info(mg, value); + return info.get_used(mg, runtime); } + if names.is_empty() { + return self.other_exports_info(mg).get_used(mg, runtime); + } + let info = self.get_read_only_export_info(mg, &names[0]); + if let Some(exports_info) = info.exports_info(mg) + && names.len() > 1 + { + return exports_info.get_used(mg, &names[1..], runtime); + } + info.get_used(mg, runtime) } pub fn get_usage_key(&self, mg: &ModuleGraph, runtime: Option<&RuntimeSpec>) -> UsageKey { @@ -824,15 +812,13 @@ impl ExportsInfoData { #[derive(Debug, Clone)] pub enum UsedName { - Str(Atom), - Vec(Vec), + Normal(Vec), } impl UsedName { pub fn to_used_name_vec(self) -> Vec { match self { - UsedName::Str(atom) => vec![atom], - UsedName::Vec(vec) => vec, + UsedName::Normal(vec) => vec, } } } @@ -840,18 +826,21 @@ impl UsedName { impl AsRef<[Atom]> for UsedName { fn as_ref(&self) -> &[Atom] { match self { - UsedName::Str(atom) => std::slice::from_ref(atom), - UsedName::Vec(vec) => vec, + UsedName::Normal(vec) => vec, } } } pub fn string_of_used_name(used: Option<&UsedName>) -> String { match used { - Some(UsedName::Str(str)) => str.to_string(), - Some(UsedName::Vec(value_key)) => property_access(value_key, 0) - .trim_start_matches('.') - .to_string(), + Some(UsedName::Normal(value_key)) => { + if value_key.len() == 1 { + return value_key[0].to_string(); + } + property_access(value_key, 0) + .trim_start_matches('.') + .to_string() + } None => "/* unused export */ undefined".to_string(), } } @@ -2069,9 +2058,7 @@ impl DependencyConditionFn for UsedByExportsDependencyCondition { .expect("should have parent module"); let exports_info = mg.get_exports_info(module_identifier); for export_name in self.used_by_exports.iter() { - if exports_info.get_used(mg, UsedName::Str(export_name.clone()), runtime) - != UsageState::Unused - { + if exports_info.get_used(mg, &[export_name.clone()], runtime) != UsageState::Unused { return ConnectionState::Bool(true); } } diff --git a/crates/rspack_plugin_javascript/src/dependency/commonjs/common_js_export_require_dependency.rs b/crates/rspack_plugin_javascript/src/dependency/commonjs/common_js_export_require_dependency.rs index 3d992d90f5fa..24b8f9a54d7c 100644 --- a/crates/rspack_plugin_javascript/src/dependency/commonjs/common_js_export_require_dependency.rs +++ b/crates/rspack_plugin_javascript/src/dependency/commonjs/common_js_export_require_dependency.rs @@ -422,11 +422,9 @@ impl DependencyTemplate for CommonJsExportRequireDependencyTemplate { let exports_argument = module.get_exports_argument(); let module_argument = module.get_module_argument(); - let used = mg.get_exports_info(&module.identifier()).get_used_name( - mg, - *runtime, - UsedName::Vec(dep.names.clone()), - ); + let used = mg + .get_exports_info(&module.identifier()) + .get_used_name(mg, *runtime, &dep.names); let base = if dep.base.is_exports() { runtime_requirements.insert(RuntimeGlobals::EXPORTS); @@ -453,15 +451,14 @@ impl DependencyTemplate for CommonJsExportRequireDependencyTemplate { let ids = dep.get_ids(mg); if let Some(used_imported) = mg .get_exports_info(&imported_module.identifier()) - .get_used_name(mg, *runtime, UsedName::Vec(ids.to_vec())) + .get_used_name(mg, *runtime, ids) { require_expr = format!( "{}{}", require_expr, property_access( match used_imported { - UsedName::Str(name) => vec![name].into_iter(), - UsedName::Vec(names) => names.into_iter(), + UsedName::Normal(names) => names.into_iter(), }, 0 ) @@ -475,8 +472,7 @@ impl DependencyTemplate for CommonJsExportRequireDependencyTemplate { "{base}{} = {require_expr}", property_access( match used { - UsedName::Str(name) => vec![name].into_iter(), - UsedName::Vec(names) => names.into_iter(), + UsedName::Normal(names) => names.into_iter(), }, 0 ) diff --git a/crates/rspack_plugin_javascript/src/dependency/commonjs/common_js_exports_dependency.rs b/crates/rspack_plugin_javascript/src/dependency/commonjs/common_js_exports_dependency.rs index 859d10351ee3..3be2ba0d6e9a 100644 --- a/crates/rspack_plugin_javascript/src/dependency/commonjs/common_js_exports_dependency.rs +++ b/crates/rspack_plugin_javascript/src/dependency/commonjs/common_js_exports_dependency.rs @@ -164,7 +164,7 @@ impl DependencyTemplate for CommonJsExportsDependencyTemplate { let used = module_graph .get_exports_info(&module.identifier()) - .get_used_name(&module_graph, *runtime, UsedName::Vec(dep.names.clone())); + .get_used_name(&module_graph, *runtime, &dep.names); let exports_argument = module.get_exports_argument(); let module_argument = module.get_module_argument(); @@ -192,8 +192,7 @@ impl DependencyTemplate for CommonJsExportsDependencyTemplate { base, property_access( match used { - UsedName::Str(name) => vec![name].into_iter(), - UsedName::Vec(names) => names.into_iter(), + UsedName::Normal(names) => names.into_iter(), }, 0 ) @@ -220,8 +219,8 @@ impl DependencyTemplate for CommonJsExportsDependencyTemplate { } } else if dep.base.is_define_property() { if let Some(value_range) = &dep.value_range { - if let Some(used) = used { - if let UsedName::Vec(used) = used { + if let Some(UsedName::Normal(used)) = used { + if !used.is_empty() { source.replace( dep.range.start, value_range.start, diff --git a/crates/rspack_plugin_javascript/src/dependency/commonjs/common_js_full_require_dependency.rs b/crates/rspack_plugin_javascript/src/dependency/commonjs/common_js_full_require_dependency.rs index 2932ed698ef7..87cdd553853e 100644 --- a/crates/rspack_plugin_javascript/src/dependency/commonjs/common_js_full_require_dependency.rs +++ b/crates/rspack_plugin_javascript/src/dependency/commonjs/common_js_full_require_dependency.rs @@ -177,7 +177,7 @@ impl DependencyTemplate for CommonJsFullRequireDependencyTemplate { if let Some(imported_module) = module_graph.module_graph_module_by_dependency_id(&dep.id) { let used = module_graph .get_exports_info(&imported_module.module_identifier) - .get_used_name(&module_graph, *runtime, UsedName::Vec(dep.names.clone())); + .get_used_name(&module_graph, *runtime, &dep.names); if let Some(used) = used { let comment = to_normal_comment(&property_access(dep.names.clone(), 0)); @@ -187,8 +187,7 @@ impl DependencyTemplate for CommonJsFullRequireDependencyTemplate { comment, property_access( match used { - UsedName::Str(name) => vec![name].into_iter(), - UsedName::Vec(names) => names.into_iter(), + UsedName::Normal(names) => names.into_iter(), }, 0 ) diff --git a/crates/rspack_plugin_javascript/src/dependency/commonjs/common_js_self_reference_dependency.rs b/crates/rspack_plugin_javascript/src/dependency/commonjs/common_js_self_reference_dependency.rs index 210bb6a79c79..7cd537d6631a 100644 --- a/crates/rspack_plugin_javascript/src/dependency/commonjs/common_js_self_reference_dependency.rs +++ b/crates/rspack_plugin_javascript/src/dependency/commonjs/common_js_self_reference_dependency.rs @@ -143,10 +143,10 @@ impl DependencyTemplate for CommonJsSelfReferenceDependencyTemplate { let used = if dep.names.is_empty() { module_graph .get_exports_info(&module.identifier()) - .get_used_name(&module_graph, *runtime, UsedName::Vec(dep.names.clone())) - .unwrap_or_else(|| UsedName::Vec(dep.names.clone())) + .get_used_name(&module_graph, *runtime, &dep.names) + .unwrap_or_else(|| UsedName::Normal(dep.names.clone())) } else { - UsedName::Vec(dep.names.clone()) + UsedName::Normal(dep.names.clone()) }; let exports_argument = module.get_exports_argument(); @@ -173,8 +173,7 @@ impl DependencyTemplate for CommonJsSelfReferenceDependencyTemplate { base, property_access( match used { - UsedName::Str(name) => vec![name].into_iter(), - UsedName::Vec(names) => names.into_iter(), + UsedName::Normal(names) => names.into_iter(), }, 0 ) diff --git a/crates/rspack_plugin_javascript/src/dependency/esm/esm_export_expression_dependency.rs b/crates/rspack_plugin_javascript/src/dependency/esm/esm_export_expression_dependency.rs index 9209f4b432da..f68cf20b3868 100644 --- a/crates/rspack_plugin_javascript/src/dependency/esm/esm_export_expression_dependency.rs +++ b/crates/rspack_plugin_javascript/src/dependency/esm/esm_export_expression_dependency.rs @@ -163,7 +163,7 @@ impl DependencyTemplate for ESMExportExpressionDependencyTemplate { let module_graph = compilation.get_module_graph(); module_graph .get_exports_info(module_identifier) - .get_used_name(&module_graph, *runtime, UsedName::Str(name.into())) + .get_used_name(&module_graph, *runtime, &[name.into()]) } if let Some(declaration) = &dep.declaration { @@ -192,8 +192,7 @@ impl DependencyTemplate for ESMExportExpressionDependencyTemplate { module.get_exports_argument(), vec![( match used { - UsedName::Str(s) => s, - UsedName::Vec(v) => v + UsedName::Normal(v) => v .iter() .map(|i| i.to_string()) .collect_vec() @@ -232,8 +231,7 @@ impl DependencyTemplate for ESMExportExpressionDependencyTemplate { module.get_exports_argument(), vec![( match used { - UsedName::Str(s) => s, - UsedName::Vec(v) => v + UsedName::Normal(v) => v .iter() .map(|i| i.to_string()) .collect_vec() @@ -250,8 +248,7 @@ impl DependencyTemplate for ESMExportExpressionDependencyTemplate { module.get_exports_argument(), property_access( match used { - UsedName::Str(name) => vec![name].into_iter(), - UsedName::Vec(names) => names.into_iter(), + UsedName::Normal(names) => names.into_iter(), }, 0 ) diff --git a/crates/rspack_plugin_javascript/src/dependency/esm/esm_export_imported_specifier_dependency.rs b/crates/rspack_plugin_javascript/src/dependency/esm/esm_export_imported_specifier_dependency.rs index a9a6434508e6..14366c0ac6a9 100644 --- a/crates/rspack_plugin_javascript/src/dependency/esm/esm_export_imported_specifier_dependency.rs +++ b/crates/rspack_plugin_javascript/src/dependency/esm/esm_export_imported_specifier_dependency.rs @@ -142,8 +142,7 @@ impl ESMExportImportedSpecifierDependency { let exports_info = module_graph.get_exports_info(parent_module); let is_name_unused = if let Some(ref name) = name { - exports_info.get_used(module_graph, UsedName::Str(name.clone()), runtime) - == UsageState::Unused + exports_info.get_used(module_graph, &[name.clone()], runtime) == UsageState::Unused } else { !exports_info.is_used(module_graph, runtime) }; @@ -514,7 +513,7 @@ impl ESMExportImportedSpecifierDependency { let used_name = mg.get_exports_info(&module.identifier()).get_used_name( mg, None, - UsedName::Str(mode.name.expect("should have name")), + &[mode.name.expect("should have name")], ); let key = string_of_used_name(used_name.as_ref()); @@ -533,7 +532,7 @@ impl ESMExportImportedSpecifierDependency { let used_name = mg.get_exports_info(&module.identifier()).get_used_name( mg, None, - UsedName::Str(mode.name.expect("should have name")), + &[mode.name.expect("should have name")], ); let key = string_of_used_name(used_name.as_ref()); let init_fragment = self @@ -542,7 +541,7 @@ impl ESMExportImportedSpecifierDependency { "reexport default export from named module", key, &import_var, - ValueKey::Str("".into()), + ValueKey::Name, ) .boxed(); fragments.push(init_fragment); @@ -551,7 +550,7 @@ impl ESMExportImportedSpecifierDependency { let used_name = mg.get_exports_info(&module.identifier()).get_used_name( mg, None, - UsedName::Str(mode.name.expect("should have name")), + &[mode.name.expect("should have name")], ); let key = string_of_used_name(used_name.as_ref()); @@ -561,7 +560,7 @@ impl ESMExportImportedSpecifierDependency { "reexport module object", key, &import_var, - ValueKey::Str("".into()), + ValueKey::Name, ) .boxed(); fragments.push(init_fragment); @@ -571,7 +570,7 @@ impl ESMExportImportedSpecifierDependency { let used_name = mg.get_exports_info(&module.identifier()).get_used_name( mg, None, - UsedName::Str(mode.name.expect("should have name")), + &[mode.name.expect("should have name")], ); let key = string_of_used_name(used_name.as_ref()); self.get_reexport_fake_namespace_object_fragments(ctxt, key, &import_var, mode.fake_type); @@ -580,7 +579,7 @@ impl ESMExportImportedSpecifierDependency { let used_name = mg.get_exports_info(&module.identifier()).get_used_name( mg, None, - UsedName::Str(mode.name.expect("should have name")), + &[mode.name.expect("should have name")], ); let key = string_of_used_name(used_name.as_ref()); @@ -590,7 +589,7 @@ impl ESMExportImportedSpecifierDependency { "reexport non-default export from non-ESM", key, "undefined", - ValueKey::Str("".into()), + ValueKey::Name, ) .boxed(); fragments.push(init_fragment); @@ -612,11 +611,9 @@ impl ESMExportImportedSpecifierDependency { continue; } - let used_name = mg.get_exports_info(&module_identifier).get_used_name( - mg, - None, - UsedName::Str(name.clone()), - ); + let used_name = + mg.get_exports_info(&module_identifier) + .get_used_name(mg, None, &[name.clone()]); let key = string_of_used_name(used_name.as_ref()); if checked { @@ -650,9 +647,9 @@ impl ESMExportImportedSpecifierDependency { runtime_condition, ))); } else { - let used_name = - mg.get_exports_info(imported_module) - .get_used_name(mg, None, UsedName::Vec(ids)); + let used_name = mg + .get_exports_info(imported_module) + .get_used_name(mg, None, &ids); let init_fragment = self .get_reexport_fragment(ctxt, "reexport safe", key, &import_var, used_name.into()) .boxed(); @@ -801,8 +798,7 @@ impl ESMExportImportedSpecifierDependency { match value_key { ValueKey::False => "/* unused export */ undefined".to_string(), ValueKey::Null => format!("{}_default.a", name), - ValueKey::Str(str) if str.is_empty() => name, - ValueKey::Str(str) => format!("{}{}", name, property_access(vec![str], 0)), + ValueKey::Name => name, ValueKey::Vec(value_key) => format!("{}{}", name, property_access(value_key, 0)), } } @@ -1367,15 +1363,14 @@ impl ModuleDependency for ESMExportImportedSpecifierDependency { enum ValueKey { False, Null, - Str(Atom), + Name, Vec(Vec), } impl From> for ValueKey { fn from(value: Option) -> Self { match value { - Some(UsedName::Str(atom)) => Self::Str(atom), - Some(UsedName::Vec(atoms)) => Self::Vec(atoms), + Some(UsedName::Normal(atoms)) => Self::Vec(atoms), None => Self::False, } } diff --git a/crates/rspack_plugin_javascript/src/dependency/esm/esm_export_specifier_dependency.rs b/crates/rspack_plugin_javascript/src/dependency/esm/esm_export_specifier_dependency.rs index 14d66f062cef..be2aff495b5a 100644 --- a/crates/rspack_plugin_javascript/src/dependency/esm/esm_export_specifier_dependency.rs +++ b/crates/rspack_plugin_javascript/src/dependency/esm/esm_export_specifier_dependency.rs @@ -140,13 +140,10 @@ impl DependencyTemplate for ESMExportSpecifierDependencyTemplate { let used_name = { let exports_info = module_graph.get_exports_info(&module.identifier()); - let used_name = - exports_info.get_used_name(&module_graph, *runtime, UsedName::Str(dep.name.clone())); + let used_name = exports_info.get_used_name(&module_graph, *runtime, &[dep.name.clone()]); used_name.map(|item| match item { - UsedName::Str(name) => name, - UsedName::Vec(vec) => { - // vec.contains(&dep.name) - // TODO: should align webpack + UsedName::Normal(vec) => { + // only have one value for export specifier dependency vec[0].clone() } }) diff --git a/crates/rspack_plugin_javascript/src/dependency/esm/esm_import_specifier_dependency.rs b/crates/rspack_plugin_javascript/src/dependency/esm/esm_import_specifier_dependency.rs index c94e72f04d31..da34744c3a3f 100644 --- a/crates/rspack_plugin_javascript/src/dependency/esm/esm_import_specifier_dependency.rs +++ b/crates/rspack_plugin_javascript/src/dependency/esm/esm_import_specifier_dependency.rs @@ -434,11 +434,10 @@ impl DependencyTemplate for ESMImportSpecifierDependencyTemplate { .get_used_name( &module_graph, code_generatable_context.runtime, - UsedName::Vec(concated_ids), + &concated_ids, ) .and_then(|used| match used { - UsedName::Str(name) => Some(name), - UsedName::Vec(names) => names.last().cloned(), + UsedName::Normal(names) => names.last().cloned(), }) else { return; diff --git a/crates/rspack_plugin_javascript/src/dependency/esm/provide_dependency.rs b/crates/rspack_plugin_javascript/src/dependency/esm/provide_dependency.rs index 8574e9b25deb..7a6a975a39e1 100644 --- a/crates/rspack_plugin_javascript/src/dependency/esm/provide_dependency.rs +++ b/crates/rspack_plugin_javascript/src/dependency/esm/provide_dependency.rs @@ -127,8 +127,7 @@ impl DependencyCodeGeneration for ProvideDependency { fn path_to_string(path: Option<&UsedName>) -> String { match path { Some(p) => match p { - UsedName::Str(str) => format!("[\"{}\"]", str.as_str()), - UsedName::Vec(vec) if !vec.is_empty() => vec + UsedName::Normal(vec) if !vec.is_empty() => vec .iter() .map(|part| format!("[\"{}\"]", part.as_str())) .join(""), @@ -175,8 +174,7 @@ impl DependencyTemplate for ProvideDependencyTemplate { return; }; let exports_info = module_graph.get_exports_info(con.module_identifier()); - let used_name = - exports_info.get_used_name(&module_graph, *runtime, UsedName::Vec(dep.ids.clone())); + let used_name = exports_info.get_used_name(&module_graph, *runtime, &dep.ids.clone()); init_fragments.push(Box::new(NormalInitFragment::new( format!( "/* provided dependency */ var {} = {}{};\n", diff --git a/crates/rspack_plugin_javascript/src/dependency/export_info_dependency.rs b/crates/rspack_plugin_javascript/src/dependency/export_info_dependency.rs index cc84bc3176e9..2a9e19c16f62 100644 --- a/crates/rspack_plugin_javascript/src/dependency/export_info_dependency.rs +++ b/crates/rspack_plugin_javascript/src/dependency/export_info_dependency.rs @@ -5,7 +5,7 @@ use rspack_cacheable::{ }; use rspack_core::{ DependencyCodeGeneration, DependencyTemplate, DependencyTemplateType, ExportProvided, - TemplateContext, TemplateReplaceSource, UsageState, UsedExports, UsedName, + TemplateContext, TemplateReplaceSource, UsageState, UsedExports, }; use swc_core::ecma::atoms::Atom; @@ -87,13 +87,11 @@ impl ExportInfoDependency { can_mangle.map(|v| v.to_string()) } "used" => { - let used = - exports_info.get_used(&module_graph, UsedName::Vec(export_name.clone()), *runtime); + let used = exports_info.get_used(&module_graph, &export_name.clone(), *runtime); Some((!matches!(used, UsageState::Unused)).to_string()) } "useInfo" => { - let used_state = - exports_info.get_used(&module_graph, UsedName::Vec(export_name.clone()), *runtime); + let used_state = exports_info.get_used(&module_graph, &export_name.clone(), *runtime); Some( (match used_state { UsageState::Used => "true", diff --git a/crates/rspack_plugin_javascript/src/dependency/pure_expression_dependency.rs b/crates/rspack_plugin_javascript/src/dependency/pure_expression_dependency.rs index 32240c96e7b3..1083d49dc2b3 100644 --- a/crates/rspack_plugin_javascript/src/dependency/pure_expression_dependency.rs +++ b/crates/rspack_plugin_javascript/src/dependency/pure_expression_dependency.rs @@ -5,7 +5,6 @@ use rspack_core::{ Compilation, ConnectionState, Dependency, DependencyCodeGeneration, DependencyId, DependencyRange, DependencyTemplate, DependencyTemplateType, ModuleGraph, ModuleIdentifier, RuntimeCondition, RuntimeSpec, TemplateContext, TemplateReplaceSource, UsageState, UsedByExports, - UsedName, }; use rspack_util::ext::DynHash; @@ -43,8 +42,7 @@ impl PureExpressionDependency { let exports_info = module_graph.get_exports_info(&self.module_identifier); filter_runtime(runtime, |cur_runtime| { set.iter().any(|id| { - exports_info.get_used(&module_graph, UsedName::Str(id.clone()), cur_runtime) - != UsageState::Unused + exports_info.get_used(&module_graph, &[id.clone()], cur_runtime) != UsageState::Unused }) }) } diff --git a/crates/rspack_plugin_wasm/src/parser_and_generator.rs b/crates/rspack_plugin_wasm/src/parser_and_generator.rs index 38ddba1ae2bb..8a196ad1c222 100644 --- a/crates/rspack_plugin_wasm/src/parser_and_generator.rs +++ b/crates/rspack_plugin_wasm/src/parser_and_generator.rs @@ -8,6 +8,7 @@ use indexmap::IndexMap; use rspack_cacheable::{cacheable, cacheable_dyn, with::Unsupported}; use rspack_collections::Identifier; use rspack_core::{ + property_access, rspack_sources::{BoxSource, RawStringSource, Source, SourceExt}, AssetInfo, BoxDependency, BuildMetaExportsType, ChunkGraph, Compilation, DependencyType::WasmImport, @@ -199,17 +200,17 @@ impl ParserAndGenerator for AsyncWasmParserAndGenerator { .expect("should be wasm import dependency"); let dep_name = serde_json::to_string(dep.name()).expect("should be ok."); - let used_name = module_graph + let Some(UsedName::Normal(used_name)) = module_graph .get_exports_info(&mgm.module_identifier) - .get_used_name(module_graph, *runtime, UsedName::Str(dep.name().into())); - let Some(UsedName::Str(used_name)) = used_name else { + .get_used_name(module_graph, *runtime, &[dep.name().into()]) + else { return; }; let request = dep.request(); let val = ( mgm.module_identifier, dep_name, - serde_json::to_string(&used_name).expect("should convert to json string"), + property_access(used_name, 0), ); if let Some(deps) = wasm_deps_by_request.get_mut(&request) { deps.push(val); @@ -233,7 +234,7 @@ impl ParserAndGenerator for AsyncWasmParserAndGenerator { .map(|(id, name, used_name)| { let import_var = dep_modules.get(&id).expect("should be ok"); let import_var = &import_var.0; - format!("{name}: {import_var}[{used_name}]") + format!("{name}: {import_var}{used_name}") }) .collect::>() .join(",\n"); diff --git a/packages/rspack-test-tools/tests/builtinCases/plugin-wasm/imports-multiple/__snapshots__/output.snap.txt b/packages/rspack-test-tools/tests/builtinCases/plugin-wasm/imports-multiple/__snapshots__/output.snap.txt index 87c734d291f2..a7e0321789cf 100644 --- a/packages/rspack-test-tools/tests/builtinCases/plugin-wasm/imports-multiple/__snapshots__/output.snap.txt +++ b/packages/rspack-test-tools/tests/builtinCases/plugin-wasm/imports-multiple/__snapshots__/output.snap.txt @@ -64,10 +64,10 @@ __webpack_async_result__(); var __webpack_instantiate__ = function ([WEBPACK_IMPORTED_MODULE_0, WEBPACK_IMPORTED_MODULE_1]) { return __webpack_require__.v(exports, module.id, "e7320130ff8b397e" , { "./module": { -"getNumber": WEBPACK_IMPORTED_MODULE_0["getNumber"] +"getNumber": WEBPACK_IMPORTED_MODULE_0.getNumber }, "./module2": { -"getNumber": WEBPACK_IMPORTED_MODULE_1["getNumber"] +"getNumber": WEBPACK_IMPORTED_MODULE_1.getNumber } }); } @@ -80,10 +80,10 @@ var WEBPACK_IMPORTED_MODULE_1 = __webpack_require__("./module2.js"); var [WEBPACK_IMPORTED_MODULE_0, WEBPACK_IMPORTED_MODULE_1] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__; await __webpack_require__.v(exports, module.id, "e7320130ff8b397e" , { "./module": { -"getNumber": WEBPACK_IMPORTED_MODULE_0["getNumber"] +"getNumber": WEBPACK_IMPORTED_MODULE_0.getNumber }, "./module2": { -"getNumber": WEBPACK_IMPORTED_MODULE_1["getNumber"] +"getNumber": WEBPACK_IMPORTED_MODULE_1.getNumber } }); From cb3c64788cbf8294abca43039f8c358152d6ddde Mon Sep 17 00:00:00 2001 From: harpsealjs Date: Wed, 21 May 2025 18:05:03 +0800 Subject: [PATCH 13/50] fix: css prefetch and preload (#10440) * fix: css prefetch and preload * fix: css prefetch and preload --- crates/rspack_core/src/chunk.rs | 40 ++++- crates/rspack_core/src/options/output.rs | 9 - crates/rspack_core/src/stats/mod.rs | 5 +- .../src/runtime/css_loading_with_prefetch.js | 17 ++ .../src/runtime/css_loading_with_preload.js | 17 ++ crates/rspack_plugin_css/src/runtime/mod.rs | 72 +++++++- .../src/chunk_prefetch_preload.rs | 15 +- .../src/runtime_module/jsonp_chunk_loading.rs | 46 +++-- .../runtime_module/module_chunk_loading.rs | 159 +++++++++++++++++- .../module_chunk_loading_with_prefetch.ejs | 8 + .../module_chunk_loading_with_preload.ejs | 8 + crates/rspack_plugin_sri/src/runtime.rs | 7 +- .../test.filter.js | 2 - .../css/prefetch-preload-module/index.mjs | 12 +- .../prefetch-preload-module/test.filter.js | 2 - .../css/pseudo-export/test.filter.js | 2 - .../test.filter.js | 2 - .../test.filter.js | 3 +- .../web/prefetch-preload-module/index.mjs | 15 +- .../prefetch-preload-module/test.filter.js | 2 - 20 files changed, 369 insertions(+), 74 deletions(-) create mode 100644 crates/rspack_plugin_css/src/runtime/css_loading_with_prefetch.js create mode 100644 crates/rspack_plugin_css/src/runtime/css_loading_with_preload.js create mode 100644 crates/rspack_plugin_runtime/src/runtime_module/runtime/module_chunk_loading_with_prefetch.ejs create mode 100644 crates/rspack_plugin_runtime/src/runtime_module/runtime/module_chunk_loading_with_preload.ejs delete mode 100644 tests/webpack-test/configCases/css/prefetch-preload-module-only-css/test.filter.js delete mode 100644 tests/webpack-test/configCases/css/prefetch-preload-module/test.filter.js delete mode 100644 tests/webpack-test/configCases/css/pseudo-export/test.filter.js delete mode 100644 tests/webpack-test/configCases/web/prefetch-preload-module-jsonp/test.filter.js delete mode 100644 tests/webpack-test/configCases/web/prefetch-preload-module/test.filter.js diff --git a/crates/rspack_core/src/chunk.rs b/crates/rspack_core/src/chunk.rs index 58bafcdbae5b..d7123913e517 100644 --- a/crates/rspack_core/src/chunk.rs +++ b/crates/rspack_core/src/chunk.rs @@ -796,10 +796,11 @@ impl Chunk { ) } - pub fn get_child_ids_by_order( + pub fn get_child_ids_by_order bool>( &self, order: &ChunkGroupOrderKey, compilation: &Compilation, + filter_fn: &F, ) -> Option> { self .get_children_of_type_in_order(order, compilation, true) @@ -808,26 +809,31 @@ impl Chunk { .iter() .flat_map(|(_, child_chunks)| { child_chunks.iter().filter_map(|chunk_ukey| { - compilation - .chunk_by_ukey - .expect_get(chunk_ukey) - .id(&compilation.chunk_ids_artifact) - .cloned() + if filter_fn(chunk_ukey, compilation) { + compilation + .chunk_by_ukey + .expect_get(chunk_ukey) + .id(&compilation.chunk_ids_artifact) + .cloned() + } else { + None + } }) }) .collect_vec() }) } - pub fn get_child_ids_by_orders_map( + pub fn get_child_ids_by_orders_map bool>( &self, include_direct_children: bool, compilation: &Compilation, + filter_fn: &F, ) -> HashMap, BuildHasherDefault>> { let mut result = HashMap::default(); - fn add_child_ids_by_orders_to_map( + fn add_child_ids_by_orders_to_map bool>( chunk_ukey: &ChunkUkey, order: &ChunkGroupOrderKey, result: &mut HashMap< @@ -835,11 +841,12 @@ impl Chunk { IndexMap, BuildHasherDefault>, >, compilation: &Compilation, + filter_fn: &F, ) { let chunk = compilation.chunk_by_ukey.expect_get(chunk_ukey); if let (Some(chunk_id), Some(child_chunk_ids)) = ( chunk.id(&compilation.chunk_ids_artifact).cloned(), - chunk.get_child_ids_by_order(order, compilation), + chunk.get_child_ids_by_order(order, compilation, filter_fn), ) { result .entry(order.clone()) @@ -864,12 +871,14 @@ impl Chunk { &ChunkGroupOrderKey::Prefetch, &mut result, compilation, + filter_fn, ); add_child_ids_by_orders_to_map( &chunk_ukey, &ChunkGroupOrderKey::Preload, &mut result, compilation, + filter_fn, ); } } @@ -880,17 +889,30 @@ impl Chunk { &ChunkGroupOrderKey::Prefetch, &mut result, compilation, + filter_fn, ); add_child_ids_by_orders_to_map( &chunk_ukey, &ChunkGroupOrderKey::Preload, &mut result, compilation, + filter_fn, ); } result } + + pub fn has_child_by_order bool>( + &self, + compilation: &Compilation, + r#type: &ChunkGroupOrderKey, + include_direct_children: bool, + filter_fn: &F, + ) -> bool { + let map = self.get_child_ids_by_orders_map(include_direct_children, compilation, filter_fn); + map.get(r#type).is_some_and(|map| !map.is_empty()) + } } pub fn chunk_hash_js<'a>( diff --git a/crates/rspack_core/src/options/output.rs b/crates/rspack_core/src/options/output.rs index 0f79f8d518c9..bd207986cbe2 100644 --- a/crates/rspack_core/src/options/output.rs +++ b/crates/rspack_core/src/options/output.rs @@ -197,15 +197,6 @@ pub enum CrossOriginLoading { Enable(String), } -impl std::fmt::Display for CrossOriginLoading { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - CrossOriginLoading::Disable => write!(f, "false"), - CrossOriginLoading::Enable(value) => write!(f, "\"{value}\""), - } - } -} - #[derive(Default, Clone, Copy, Debug)] pub struct PathData<'a> { pub filename: Option<&'a str>, diff --git a/crates/rspack_core/src/stats/mod.rs b/crates/rspack_core/src/stats/mod.rs index df5ef4a7ee8a..51740af76b50 100644 --- a/crates/rspack_core/src/stats/mod.rs +++ b/crates/rspack_core/src/stats/mod.rs @@ -344,8 +344,11 @@ impl Stats<'_> { }); let mut children_by_order = HashMap::>::default(); + let chunk_filter = |_: &ChunkUkey, __: &Compilation| true; for order in &orders { - if let Some(order_chlidren) = c.get_child_ids_by_order(order, self.compilation) { + if let Some(order_chlidren) = + c.get_child_ids_by_order(order, self.compilation, &chunk_filter) + { children_by_order.insert( order.clone(), order_chlidren diff --git a/crates/rspack_plugin_css/src/runtime/css_loading_with_prefetch.js b/crates/rspack_plugin_css/src/runtime/css_loading_with_prefetch.js new file mode 100644 index 000000000000..386cf9f04518 --- /dev/null +++ b/crates/rspack_plugin_css/src/runtime/css_loading_with_prefetch.js @@ -0,0 +1,17 @@ +__webpack_require__.F.s = function (chunkId) { + if ((!__webpack_require__.o(installedChunks, chunkId) || installedChunks[chunkId] === undefined) && $CSS_MATCHER$) { + installedChunks[chunkId] = null; + if (typeof document === 'undefined') return; + + var link = document.createElement('link'); + $CHARSET_PLACEHOLDER$ + $CROSS_ORIGIN_PLACEHOLDER$ + if (__webpack_require__.nc) { + link.setAttribute("nonce", __webpack_require__.nc); + } + link.rel = "prefetch"; + link.as = "style"; + link.href = __webpack_require__.p + __webpack_require__.k(chunkId); + document.head.appendChild(link); + } +}; diff --git a/crates/rspack_plugin_css/src/runtime/css_loading_with_preload.js b/crates/rspack_plugin_css/src/runtime/css_loading_with_preload.js new file mode 100644 index 000000000000..49a1deb6d281 --- /dev/null +++ b/crates/rspack_plugin_css/src/runtime/css_loading_with_preload.js @@ -0,0 +1,17 @@ +__webpack_require__.H.s = function (chunkId) { + if ((!__webpack_require__.o(installedChunks, chunkId) || installedChunks[chunkId] === undefined) && $CSS_MATCHER$) { + installedChunks[chunkId] = null; + if (typeof document === 'undefined') return; + + var link = document.createElement('link'); + $CHARSET_PLACEHOLDER$ + if (__webpack_require__.nc) { + link.setAttribute("nonce", __webpack_require__.nc); + } + link.rel = "preload"; + link.as = "style"; + link.href = __webpack_require__.p + __webpack_require__.k(chunkId); + $CROSS_ORIGIN_PLACEHOLDER$ + document.head.appendChild(link); + } +}; diff --git a/crates/rspack_plugin_css/src/runtime/mod.rs b/crates/rspack_plugin_css/src/runtime/mod.rs index 3156bd750616..997b9fa9d2db 100644 --- a/crates/rspack_plugin_css/src/runtime/mod.rs +++ b/crates/rspack_plugin_css/src/runtime/mod.rs @@ -3,8 +3,8 @@ use std::borrow::Cow; use cow_utils::CowUtils; use rspack_collections::Identifier; use rspack_core::{ - basic_function, compile_boolean_matcher, impl_runtime_module, BooleanMatcher, ChunkUkey, - Compilation, CrossOriginLoading, RuntimeGlobals, RuntimeModule, RuntimeModuleStage, + basic_function, compile_boolean_matcher, impl_runtime_module, BooleanMatcher, ChunkGroupOrderKey, + ChunkUkey, Compilation, CrossOriginLoading, RuntimeGlobals, RuntimeModule, RuntimeModuleStage, }; use rspack_plugin_runtime::{chunk_has_css, get_chunk_runtime_requirements, stringify_chunks}; use rustc_hash::FxHashSet as HashSet; @@ -60,6 +60,24 @@ impl RuntimeModule for CssLoadingRuntimeModule { } } + let environment = &compilation.options.output.environment; + let with_prefetch = runtime_requirements.contains(RuntimeGlobals::PREFETCH_CHUNK_HANDLERS) + && environment.supports_document() + && chunk.has_child_by_order( + compilation, + &ChunkGroupOrderKey::Prefetch, + true, + &chunk_has_css, + ); + let with_preload = runtime_requirements.contains(RuntimeGlobals::PRELOAD_CHUNK_HANDLERS) + && environment.supports_document() + && chunk.has_child_by_order( + compilation, + &ChunkGroupOrderKey::Preload, + true, + &chunk_has_css, + ); + if !with_hmr && !with_loading { return Ok("".to_string()); } @@ -95,7 +113,6 @@ impl RuntimeModule for CssLoadingRuntimeModule { }; let chunk_load_timeout = compilation.options.output.chunk_load_timeout.to_string(); - let environment = &compilation.options.output.environment; let load_css_chunk_data = basic_function( environment, @@ -175,6 +192,55 @@ installedChunks[chunkId] = 0; ); } + let charset_content = if compilation.options.output.charset { + "link.charset = 'utf-8';" + } else { + "" + }; + + if with_prefetch && !matches!(has_css_matcher, BooleanMatcher::Condition(false)) { + let cross_origin_content = if let CrossOriginLoading::Enable(cross_origin) = + &compilation.options.output.cross_origin_loading + { + format!("link.crossOrigin = '{}';", cross_origin) + } else { + "".to_string() + }; + source.push_str( + &include_str!("./css_loading_with_prefetch.js") + .cow_replace("$CSS_MATCHER$", &has_css_matcher.render("chunkId")) + .cow_replace("$CHARSET_PLACEHOLDER$", charset_content) + .cow_replace("$CROSS_ORIGIN_PLACEHOLDER$", &cross_origin_content), + ); + } + + if with_preload && !matches!(has_css_matcher, BooleanMatcher::Condition(false)) { + let cross_origin_content = if let CrossOriginLoading::Enable(cross_origin) = + &compilation.options.output.cross_origin_loading + { + if cross_origin == "use-credentials" { + format!("link.crossOrigin = '{}';", &cross_origin) + } else { + format!( + r#" + if (link.href.indexOf(window.location.origin + '/') !== 0) {{ + link.crossOrigin = '{}'; + }} + "#, + &cross_origin + ) + } + } else { + "".to_string() + }; + source.push_str( + &include_str!("./css_loading_with_preload.js") + .cow_replace("$CSS_MATCHER$", &has_css_matcher.render("chunkId")) + .cow_replace("$CHARSET_PLACEHOLDER$", charset_content) + .cow_replace("$CROSS_ORIGIN_PLACEHOLDER$", &cross_origin_content), + ); + } + if with_hmr { source.push_str(include_str!("./css_loading_with_hmr.js")); } diff --git a/crates/rspack_plugin_runtime/src/chunk_prefetch_preload.rs b/crates/rspack_plugin_runtime/src/chunk_prefetch_preload.rs index f1548e10ec27..fe59525936b6 100644 --- a/crates/rspack_plugin_runtime/src/chunk_prefetch_preload.rs +++ b/crates/rspack_plugin_runtime/src/chunk_prefetch_preload.rs @@ -50,25 +50,22 @@ async fn additional_tree_runtime_requirements( runtime_requirements: &mut RuntimeGlobals, ) -> Result<()> { let chunk = compilation.chunk_by_ukey.expect_get(chunk_ukey); - let chunk_map = chunk.get_child_ids_by_orders_map(false, compilation); + let chunk_filter = |_: &ChunkUkey, __: &Compilation| true; + let mut chunk_map = chunk.get_child_ids_by_orders_map(false, compilation, &chunk_filter); - if let Some(prefetch_map) = chunk_map.get(&ChunkGroupOrderKey::Prefetch) { + if let Some(prefetch_map) = chunk_map.remove(&ChunkGroupOrderKey::Prefetch) { runtime_requirements.insert(RuntimeGlobals::PREFETCH_CHUNK); compilation.add_runtime_module( chunk_ukey, - Box::new(ChunkPrefetchTriggerRuntimeModule::new( - prefetch_map.to_owned(), - )), + Box::new(ChunkPrefetchTriggerRuntimeModule::new(prefetch_map)), )? } - if let Some(preload_map) = chunk_map.get(&ChunkGroupOrderKey::Preload) { + if let Some(preload_map) = chunk_map.remove(&ChunkGroupOrderKey::Preload) { runtime_requirements.insert(RuntimeGlobals::PRELOAD_CHUNK); compilation.add_runtime_module( chunk_ukey, - Box::new(ChunkPreloadTriggerRuntimeModule::new( - preload_map.to_owned(), - )), + Box::new(ChunkPreloadTriggerRuntimeModule::new(preload_map)), )? } diff --git a/crates/rspack_plugin_runtime/src/runtime_module/jsonp_chunk_loading.rs b/crates/rspack_plugin_runtime/src/runtime_module/jsonp_chunk_loading.rs index 92c056417a8f..9729d7814bb1 100644 --- a/crates/rspack_plugin_runtime/src/runtime_module/jsonp_chunk_loading.rs +++ b/crates/rspack_plugin_runtime/src/runtime_module/jsonp_chunk_loading.rs @@ -3,8 +3,8 @@ use std::ptr::NonNull; use cow_utils::CowUtils; use rspack_collections::{DatabaseItem, Identifier}; use rspack_core::{ - compile_boolean_matcher, impl_runtime_module, BooleanMatcher, Chunk, ChunkUkey, Compilation, - CrossOriginLoading, RuntimeGlobals, RuntimeModule, RuntimeModuleStage, + compile_boolean_matcher, impl_runtime_module, BooleanMatcher, Chunk, ChunkGroupOrderKey, + ChunkUkey, Compilation, CrossOriginLoading, RuntimeGlobals, RuntimeModule, RuntimeModuleStage, }; use super::generate_javascript_hmr_runtime; @@ -117,8 +117,22 @@ impl RuntimeModule for JsonpChunkLoadingRuntimeModule { let with_hmr = runtime_requirements.contains(RuntimeGlobals::HMR_DOWNLOAD_UPDATE_HANDLERS); let with_hmr_manifest = runtime_requirements.contains(RuntimeGlobals::HMR_DOWNLOAD_MANIFEST); let with_callback = runtime_requirements.contains(RuntimeGlobals::CHUNK_CALLBACK); - let with_prefetch = runtime_requirements.contains(RuntimeGlobals::PREFETCH_CHUNK_HANDLERS); - let with_preload = runtime_requirements.contains(RuntimeGlobals::PRELOAD_CHUNK_HANDLERS); + let with_prefetch = runtime_requirements.contains(RuntimeGlobals::PREFETCH_CHUNK_HANDLERS) + && compilation.options.output.environment.supports_document() + && chunk.has_child_by_order( + compilation, + &ChunkGroupOrderKey::Prefetch, + true, + &chunk_has_js, + ); + let with_preload = runtime_requirements.contains(RuntimeGlobals::PRELOAD_CHUNK_HANDLERS) + && compilation.options.output.environment.supports_document() + && chunk.has_child_by_order( + compilation, + &ChunkGroupOrderKey::Preload, + true, + &chunk_has_js, + ); let with_fetch_priority = runtime_requirements.contains(RuntimeGlobals::HAS_FETCH_PRIORITY); let cross_origin_loading = &compilation.options.output.cross_origin_loading; let script_type = &compilation.options.output.script_type; @@ -198,8 +212,8 @@ impl RuntimeModule for JsonpChunkLoadingRuntimeModule { if with_prefetch && !matches!(has_js_matcher, BooleanMatcher::Condition(false)) { let cross_origin = match cross_origin_loading { CrossOriginLoading::Disable => "".to_string(), - CrossOriginLoading::Enable(_) => { - format!("link.crossOrigin = {}", cross_origin_loading) + CrossOriginLoading::Enable(v) => { + format!("link.crossOrigin = '{}';", v) } }; let link_prefetch_code = r#" @@ -209,8 +223,8 @@ impl RuntimeModule for JsonpChunkLoadingRuntimeModule { if (__webpack_require__.nc) { link.setAttribute("nonce", __webpack_require__.nc); } - link.rel = "prefetch"; - link.as = "script"; + link.rel = 'prefetch'; + link.as = 'script'; link.href = __webpack_require__.p + __webpack_require__.u(chunkId); "# .cow_replace( @@ -251,17 +265,17 @@ impl RuntimeModule for JsonpChunkLoadingRuntimeModule { if with_preload && !matches!(has_js_matcher, BooleanMatcher::Condition(false)) { let cross_origin = match cross_origin_loading { CrossOriginLoading::Disable => "".to_string(), - CrossOriginLoading::Enable(cross_origin_value) => { - if cross_origin_value.eq("use-credentials") { - "link.crossOrigin = \"use-credentials\";".to_string() + CrossOriginLoading::Enable(v) => { + if v.eq("use-credentials") { + "link.crossOrigin = 'use-credentials';".to_string() } else { format!( r#" if (link.href.indexOf(window.location.origin + '/') !== 0) {{ - link.crossOrigin = {} + link.crossOrigin = '{}'; }} "#, - cross_origin_loading + v ) } } @@ -275,11 +289,11 @@ impl RuntimeModule for JsonpChunkLoadingRuntimeModule { ) }; let script_type_link_post = if script_type.eq("module") { - "link.rel = \"modulepreload\";" + "link.rel = 'modulepreload';" } else { r#" - link.rel = "preload"; - link.as = "script"; + link.rel = 'preload'; + link.as = 'script'; "# }; diff --git a/crates/rspack_plugin_runtime/src/runtime_module/module_chunk_loading.rs b/crates/rspack_plugin_runtime/src/runtime_module/module_chunk_loading.rs index 7ab3dd84cfe2..48ff572c1ad1 100644 --- a/crates/rspack_plugin_runtime/src/runtime_module/module_chunk_loading.rs +++ b/crates/rspack_plugin_runtime/src/runtime_module/module_chunk_loading.rs @@ -1,13 +1,17 @@ +use std::ptr::NonNull; + +use cow_utils::CowUtils; use rspack_collections::{DatabaseItem, Identifier}; use rspack_core::{ - compile_boolean_matcher, impl_runtime_module, BooleanMatcher, Chunk, ChunkUkey, Compilation, - RuntimeGlobals, RuntimeModule, RuntimeModuleStage, + compile_boolean_matcher, impl_runtime_module, BooleanMatcher, Chunk, ChunkGroupOrderKey, + ChunkUkey, Compilation, CrossOriginLoading, RuntimeGlobals, RuntimeModule, RuntimeModuleStage, }; use super::utils::{chunk_has_js, get_output_dir}; use crate::{ get_chunk_runtime_requirements, runtime_module::utils::{get_initial_chunk_ids, stringify_chunks}, + LinkPrefetchData, LinkPreloadData, RuntimeModuleChunkWrapper, RuntimePlugin, }; #[impl_runtime_module] @@ -51,6 +55,8 @@ impl ModuleChunkLoadingRuntimeModule { match template_id { TemplateId::Raw => self.id.to_string(), TemplateId::WithLoading => format!("{}_with_loading", self.id), + TemplateId::WithPrefetch => format!("{}_with_prefetch", self.id), + TemplateId::WithPreload => format!("{}_with_preload", self.id), } } } @@ -58,6 +64,8 @@ impl ModuleChunkLoadingRuntimeModule { enum TemplateId { Raw, WithLoading, + WithPrefetch, + WithPreload, } #[async_trait::async_trait] @@ -76,6 +84,14 @@ impl RuntimeModule for ModuleChunkLoadingRuntimeModule { self.template(TemplateId::WithLoading), include_str!("runtime/module_chunk_loading_with_loading.ejs").to_string(), ), + ( + self.template(TemplateId::WithPrefetch), + include_str!("runtime/module_chunk_loading_with_prefetch.ejs").to_string(), + ), + ( + self.template(TemplateId::WithPreload), + include_str!("runtime/module_chunk_loading_with_preload.ejs").to_string(), + ), ] } @@ -85,12 +101,30 @@ impl RuntimeModule for ModuleChunkLoadingRuntimeModule { .expect_get(&self.chunk.expect("The chunk should be attached.")); let runtime_requirements = get_chunk_runtime_requirements(compilation, &chunk.ukey()); + let hooks = RuntimePlugin::get_compilation_hooks(compilation.id()); + let with_base_uri = runtime_requirements.contains(RuntimeGlobals::BASE_URI); let with_external_install_chunk = runtime_requirements.contains(RuntimeGlobals::EXTERNAL_INSTALL_CHUNK); let with_loading = runtime_requirements.contains(RuntimeGlobals::ENSURE_CHUNK_HANDLERS); let with_on_chunk_load = runtime_requirements.contains(RuntimeGlobals::ON_CHUNKS_LOADED); let with_hmr = runtime_requirements.contains(RuntimeGlobals::HMR_DOWNLOAD_UPDATE_HANDLERS); + let with_prefetch = runtime_requirements.contains(RuntimeGlobals::PREFETCH_CHUNK_HANDLERS) + && compilation.options.output.environment.supports_document() + && chunk.has_child_by_order( + compilation, + &ChunkGroupOrderKey::Prefetch, + true, + &chunk_has_js, + ); + let with_preload = runtime_requirements.contains(RuntimeGlobals::PRELOAD_CHUNK_HANDLERS) + && compilation.options.output.environment.supports_document() + && chunk.has_child_by_order( + compilation, + &ChunkGroupOrderKey::Preload, + true, + &chunk_has_js, + ); let condition_map = compilation @@ -167,6 +201,127 @@ impl RuntimeModule for ModuleChunkLoadingRuntimeModule { )); } + if !matches!(has_js_matcher, BooleanMatcher::Condition(false)) { + let js_matcher = has_js_matcher.render("chunkId"); + let charset = compilation.options.output.charset; + let cross_origin_loading = &compilation.options.output.cross_origin_loading; + if with_prefetch { + let cross_origin = match cross_origin_loading { + CrossOriginLoading::Disable => "".to_string(), + CrossOriginLoading::Enable(v) => { + format!("link.crossOrigin = '{}'", v) + } + }; + let link_prefetch_code = r#" + var link = document.createElement('link'); + $LINK_CHART_CHARSET$ + $CROSS_ORIGIN$ + if (__webpack_require__.nc) { + link.setAttribute('nonce', __webpack_require__.nc); + } + link.rel = 'prefetch'; + link.as = 'script'; + link.href = __webpack_require__.p + __webpack_require__.u(chunkId); + "# + .cow_replace( + "$LINK_CHART_CHARSET$", + if charset { + "link.charset = 'utf-8';" + } else { + "" + }, + ) + .cow_replace("$CROSS_ORIGIN$", &cross_origin) + .to_string(); + + let chunk_ukey = self.chunk.expect("The chunk should be attached"); + let res = hooks + .link_prefetch + .call(LinkPrefetchData { + code: link_prefetch_code, + chunk: RuntimeModuleChunkWrapper { + chunk_ukey, + compilation_id: compilation.id(), + compilation: NonNull::from(compilation), + }, + }) + .await?; + + let raw_source = compilation.runtime_template.render( + &self.template(TemplateId::WithPrefetch), + Some(serde_json::json!({ + "_link_prefetch": &res.code, + "_js_matcher": &js_matcher, + })), + )?; + + source.push_str(&raw_source); + } + if with_preload { + let cross_origin = match cross_origin_loading { + CrossOriginLoading::Disable => "".to_string(), + CrossOriginLoading::Enable(v) => { + if v.eq("use-credentials") { + "link.crossOrigin = 'use-credentials';".to_string() + } else { + format!( + r#" + if (link.href.indexOf(window.location.origin + '/') !== 0) {{ + link.crossOrigin = '{}'; + }} + "#, + v + ) + } + } + }; + + let link_preload_code = r#" + var link = document.createElement('link'); + $LINK_CHART_CHARSET$ + if (__webpack_require__.nc) { + link.setAttribute("nonce", __webpack_require__.nc); + } + link.rel = 'modulepreload'; + link.href = __webpack_require__.p + __webpack_require__.u(chunkId); + $CROSS_ORIGIN$ + "# + .cow_replace( + "$LINK_CHART_CHARSET$", + if charset { + "link.charset = 'utf-8';" + } else { + "" + }, + ) + .cow_replace("$CROSS_ORIGIN$", cross_origin.as_str()) + .to_string(); + + let chunk_ukey = self.chunk.expect("The chunk should be attached"); + let res = hooks + .link_preload + .call(LinkPreloadData { + code: link_preload_code, + chunk: RuntimeModuleChunkWrapper { + chunk_ukey, + compilation_id: compilation.id(), + compilation: NonNull::from(compilation), + }, + }) + .await?; + + let raw_source = compilation.runtime_template.render( + &self.template(TemplateId::WithPreload), + Some(serde_json::json!({ + "_js_matcher": &js_matcher, + "_link_preload": &res.code, + })), + )?; + + source.push_str(&raw_source); + } + } + if with_external_install_chunk { source.push_str(&format!( r#" diff --git a/crates/rspack_plugin_runtime/src/runtime_module/runtime/module_chunk_loading_with_prefetch.ejs b/crates/rspack_plugin_runtime/src/runtime_module/runtime/module_chunk_loading_with_prefetch.ejs new file mode 100644 index 000000000000..8930c7f3ac6e --- /dev/null +++ b/crates/rspack_plugin_runtime/src/runtime_module/runtime/module_chunk_loading_with_prefetch.ejs @@ -0,0 +1,8 @@ +<%- PREFETCH_CHUNK_HANDLERS %>.j = <%- basicFunction("chunkId") %> { + if (typeof document === 'undefined') return; + if((!<%- HAS_OWN_PROPERTY %>(installedChunks, chunkId) || installedChunks[chunkId] === undefined) && <%- _js_matcher %>) { + installedChunks[chunkId] = null; + <%- _link_prefetch %> + document.head.appendChild(link); + } +}; diff --git a/crates/rspack_plugin_runtime/src/runtime_module/runtime/module_chunk_loading_with_preload.ejs b/crates/rspack_plugin_runtime/src/runtime_module/runtime/module_chunk_loading_with_preload.ejs new file mode 100644 index 000000000000..05ab18b23bf1 --- /dev/null +++ b/crates/rspack_plugin_runtime/src/runtime_module/runtime/module_chunk_loading_with_preload.ejs @@ -0,0 +1,8 @@ +<%- PRELOAD_CHUNK_HANDLERS %>.j = <%- basicFunction("chunkId") %> { + if (typeof document === 'undefined') return; + if((!<%- HAS_OWN_PROPERTY %>(installedChunks, chunkId) || installedChunks[chunkId] === undefined) && <%- _js_matcher %>) { + installedChunks[chunkId] = null; + <%- _link_preload %> + document.head.appendChild(link); + } +}; diff --git a/crates/rspack_plugin_sri/src/runtime.rs b/crates/rspack_plugin_sri/src/runtime.rs index 829db1e1186b..2cce9ecaca2a 100644 --- a/crates/rspack_plugin_sri/src/runtime.rs +++ b/crates/rspack_plugin_sri/src/runtime.rs @@ -19,7 +19,12 @@ use crate::{ fn add_attribute(tag: &str, code: &str, cross_origin_loading: &CrossOriginLoading) -> String { format!( "{}\n{tag}.integrity = {}[chunkId];\n{tag}.crossOrigin = {};", - code, SRI_HASH_VARIABLE_REFERENCE, cross_origin_loading + code, + SRI_HASH_VARIABLE_REFERENCE, + match cross_origin_loading { + CrossOriginLoading::Disable => "false".to_string(), + CrossOriginLoading::Enable(v) => format!("'{}'", v), + } ) } diff --git a/tests/webpack-test/configCases/css/prefetch-preload-module-only-css/test.filter.js b/tests/webpack-test/configCases/css/prefetch-preload-module-only-css/test.filter.js deleted file mode 100644 index e75711af1cc1..000000000000 --- a/tests/webpack-test/configCases/css/prefetch-preload-module-only-css/test.filter.js +++ /dev/null @@ -1,2 +0,0 @@ -// document.head._children is empty -module.exports = () => false; diff --git a/tests/webpack-test/configCases/css/prefetch-preload-module/index.mjs b/tests/webpack-test/configCases/css/prefetch-preload-module/index.mjs index 86b97ef2ea35..33adf9673f0f 100644 --- a/tests/webpack-test/configCases/css/prefetch-preload-module/index.mjs +++ b/tests/webpack-test/configCases/css/prefetch-preload-module/index.mjs @@ -36,19 +36,21 @@ it("should prefetch and preload child chunks on chunk load", () => { // Test normal script loading link = document.head._children[3]; expect(link._type).toBe("link"); + expect(link.rel).toBe("modulepreload"); + expect(link.href).toBe("https://example.com/public/path/chunk1-b.mjs"); + + link = document.head._children[4]; + expect(link._type).toBe("link"); expect(link.rel).toBe("preload"); expect(link.as).toBe("style"); expect(link.href).toBe("https://example.com/public/path/chunk1-a-css.css"); - link = document.head._children[4]; + link = document.head._children[5]; expect(link._type).toBe("link"); expect(link.rel).toBe("modulepreload"); expect(link.href).toBe("https://example.com/public/path/chunk1-a-css.mjs"); - link = document.head._children[5]; - expect(link._type).toBe("link"); - expect(link.rel).toBe("modulepreload"); - expect(link.href).toBe("https://example.com/public/path/chunk1-b.mjs"); + return promise.then(() => { expect(document.head._children).toHaveLength(8); diff --git a/tests/webpack-test/configCases/css/prefetch-preload-module/test.filter.js b/tests/webpack-test/configCases/css/prefetch-preload-module/test.filter.js deleted file mode 100644 index e75711af1cc1..000000000000 --- a/tests/webpack-test/configCases/css/prefetch-preload-module/test.filter.js +++ /dev/null @@ -1,2 +0,0 @@ -// document.head._children is empty -module.exports = () => false; diff --git a/tests/webpack-test/configCases/css/pseudo-export/test.filter.js b/tests/webpack-test/configCases/css/pseudo-export/test.filter.js deleted file mode 100644 index a4b0c617a292..000000000000 --- a/tests/webpack-test/configCases/css/pseudo-export/test.filter.js +++ /dev/null @@ -1,2 +0,0 @@ -// css-lexer cannot parse invalidate css comments -module.exports = () => true diff --git a/tests/webpack-test/configCases/web/prefetch-preload-module-jsonp/test.filter.js b/tests/webpack-test/configCases/web/prefetch-preload-module-jsonp/test.filter.js deleted file mode 100644 index 61d2e442bd2b..000000000000 --- a/tests/webpack-test/configCases/web/prefetch-preload-module-jsonp/test.filter.js +++ /dev/null @@ -1,2 +0,0 @@ -// missing https://example.com/public/path/chunk2-css.css in document.head._children -module.exports = () => false diff --git a/tests/webpack-test/configCases/web/prefetch-preload-module-only-js/test.filter.js b/tests/webpack-test/configCases/web/prefetch-preload-module-only-js/test.filter.js index 9bc1aaf3570a..09871c9caa2f 100644 --- a/tests/webpack-test/configCases/web/prefetch-preload-module-only-js/test.filter.js +++ b/tests/webpack-test/configCases/web/prefetch-preload-module-only-js/test.filter.js @@ -1,2 +1 @@ -// no links in document.head._children -module.exports = () => false +module.exports = () => "FIXME: unexpected css prefetch/preload runtime" diff --git a/tests/webpack-test/configCases/web/prefetch-preload-module/index.mjs b/tests/webpack-test/configCases/web/prefetch-preload-module/index.mjs index 7b92f910731b..6521a413e3d2 100644 --- a/tests/webpack-test/configCases/web/prefetch-preload-module/index.mjs +++ b/tests/webpack-test/configCases/web/prefetch-preload-module/index.mjs @@ -35,32 +35,33 @@ it("should prefetch and preload child chunks on chunk load", () => { expect(document.head._children).toHaveLength(6); // Test normal script loading + // Test preload of chunk1-b link = document.head._children[3]; expect(link._type).toBe("link"); - expect(link.rel).toBe("preload"); - expect(link.as).toBe("style"); - expect(link.href).toBe("https://example.com/public/path/chunk1-a-css.css"); + expect(link.rel).toBe("modulepreload"); + expect(link.href).toBe("https://example.com/public/path/chunk1-b.mjs"); expect(link.charset).toBe("utf-8"); expect(link.getAttribute("nonce")).toBe("nonce"); expect(link.crossOrigin).toBe("anonymous"); link = document.head._children[4]; expect(link._type).toBe("link"); - expect(link.rel).toBe("modulepreload"); - expect(link.href).toBe("https://example.com/public/path/chunk1-a-css.mjs"); + expect(link.rel).toBe("preload"); + expect(link.as).toBe("style"); + expect(link.href).toBe("https://example.com/public/path/chunk1-a-css.css"); expect(link.charset).toBe("utf-8"); expect(link.getAttribute("nonce")).toBe("nonce"); expect(link.crossOrigin).toBe("anonymous"); - // Test preload of chunk1-b link = document.head._children[5]; expect(link._type).toBe("link"); expect(link.rel).toBe("modulepreload"); - expect(link.href).toBe("https://example.com/public/path/chunk1-b.mjs"); + expect(link.href).toBe("https://example.com/public/path/chunk1-a-css.mjs"); expect(link.charset).toBe("utf-8"); expect(link.getAttribute("nonce")).toBe("nonce"); expect(link.crossOrigin).toBe("anonymous"); + return promise.then(() => { expect(document.head._children).toHaveLength(8); diff --git a/tests/webpack-test/configCases/web/prefetch-preload-module/test.filter.js b/tests/webpack-test/configCases/web/prefetch-preload-module/test.filter.js deleted file mode 100644 index 9bc1aaf3570a..000000000000 --- a/tests/webpack-test/configCases/web/prefetch-preload-module/test.filter.js +++ /dev/null @@ -1,2 +0,0 @@ -// no links in document.head._children -module.exports = () => false From cae95f14bc3765e6463ebcdd522a63638360cde1 Mon Sep 17 00:00:00 2001 From: harpsealjs Date: Wed, 21 May 2025 19:44:23 +0800 Subject: [PATCH 14/50] fix: eval sourcemap debugids (#10443) --- .../src/eval_source_map_dev_tool_plugin.rs | 13 +++++-- .../src/generate_debug_id.rs | 31 ++++++++++++++++ crates/rspack_plugin_devtool/src/lib.rs | 1 + .../src/source_map_dev_tool_plugin.rs | 35 ++----------------- .../eval-source-map-debugids/test.filter.js | 2 -- .../system-named-assets-path/test.filter.js | 2 +- 6 files changed, 47 insertions(+), 37 deletions(-) create mode 100644 crates/rspack_plugin_devtool/src/generate_debug_id.rs delete mode 100644 tests/webpack-test/configCases/source-map/eval-source-map-debugids/test.filter.js diff --git a/crates/rspack_plugin_devtool/src/eval_source_map_dev_tool_plugin.rs b/crates/rspack_plugin_devtool/src/eval_source_map_dev_tool_plugin.rs index 44ad522226bd..5380d592c7ed 100644 --- a/crates/rspack_plugin_devtool/src/eval_source_map_dev_tool_plugin.rs +++ b/crates/rspack_plugin_devtool/src/eval_source_map_dev_tool_plugin.rs @@ -19,8 +19,8 @@ use rspack_plugin_javascript::{ use rspack_util::identifier::make_paths_absolute; use crate::{ - module_filename_helpers::ModuleFilenameHelpers, ModuleFilenameTemplate, ModuleOrSource, - SourceMapDevToolPluginOptions, + generate_debug_id::generate_debug_id, module_filename_helpers::ModuleFilenameHelpers, + ModuleFilenameTemplate, ModuleOrSource, SourceMapDevToolPluginOptions, }; const EVAL_SOURCE_MAP_DEV_TOOL_PLUGIN_NAME: &str = "rspack.EvalSourceMapDevToolPlugin"; @@ -34,6 +34,7 @@ pub struct EvalSourceMapDevToolPlugin { module_filename_template: ModuleFilenameTemplate, namespace: String, source_root: Option, + debug_ids: bool, // TODO: memory leak if not clear across multiple compilations cache: DashMap, } @@ -55,6 +56,7 @@ impl EvalSourceMapDevToolPlugin { module_filename_template, namespace, options.source_root, + options.debug_ids, Default::default(), ) } @@ -165,6 +167,13 @@ async fn eval_source_map_devtool_plugin_render_module_content( map.set_source_root(self.source_root.clone()); map.set_file(Some(module.identifier().to_string())); + if self.debug_ids { + map.set_debug_id(Some(generate_debug_id( + module.identifier().as_str(), + source.as_bytes(), + ))); + } + let mut map_buffer = Vec::new(); let module_ids = &compilation.module_ids_artifact; // align with https://github.com/webpack/webpack/blob/3919c844eca394d73ca930e4fc5506fb86e2b094/lib/EvalSourceMapDevToolPlugin.js#L171 diff --git a/crates/rspack_plugin_devtool/src/generate_debug_id.rs b/crates/rspack_plugin_devtool/src/generate_debug_id.rs new file mode 100644 index 000000000000..a586f95d9f2e --- /dev/null +++ b/crates/rspack_plugin_devtool/src/generate_debug_id.rs @@ -0,0 +1,31 @@ +use std::hash::Hasher; + +use rspack_hash::{HashDigest, HashFunction, RspackHash}; + +pub fn generate_debug_id(filename: &str, source: &[u8]) -> String { + let mut hasher = RspackHash::new(&HashFunction::Xxhash64); + hasher.write(source); + let source_hash = hasher.digest(&HashDigest::Hex); + + let mut file_hasher = RspackHash::new(&HashFunction::Xxhash64); + file_hasher.write(filename.as_bytes()); + file_hasher.write(source_hash.encoded().as_bytes()); + let file_hash = file_hasher.digest(&HashDigest::Hex); + let hash128 = format!("{}{}", source_hash.encoded(), file_hash.encoded()); + + let part3 = format!("4{}", &hash128[12..15]); + let part4 = format!( + "{:x}{}", + u8::from_str_radix(&hash128[15..16], 16).unwrap_or(0) & 3 | 8, + &hash128[17..20] + ); + + [ + &hash128[0..8], + &hash128[8..12], + &part3, + &part4, + &hash128[20..32], + ] + .join("-") +} diff --git a/crates/rspack_plugin_devtool/src/lib.rs b/crates/rspack_plugin_devtool/src/lib.rs index d8ba84d3e4fd..430981ef5f6f 100644 --- a/crates/rspack_plugin_devtool/src/lib.rs +++ b/crates/rspack_plugin_devtool/src/lib.rs @@ -2,6 +2,7 @@ mod eval_dev_tool_module_plugin; mod eval_source_map_dev_tool_plugin; +mod generate_debug_id; mod mapped_assets_cache; mod module_filename_helpers; mod source_map_dev_tool_module_options_plugin; diff --git a/crates/rspack_plugin_devtool/src/source_map_dev_tool_plugin.rs b/crates/rspack_plugin_devtool/src/source_map_dev_tool_plugin.rs index 2c52a387b65e..ea0d93c97eee 100644 --- a/crates/rspack_plugin_devtool/src/source_map_dev_tool_plugin.rs +++ b/crates/rspack_plugin_devtool/src/source_map_dev_tool_plugin.rs @@ -25,8 +25,8 @@ use rustc_hash::{FxHashMap as HashMap, FxHashSet as HashSet}; use sugar_path::SugarPath; use crate::{ - mapped_assets_cache::MappedAssetsCache, module_filename_helpers::ModuleFilenameHelpers, - ModuleFilenameTemplateFn, ModuleOrSource, + generate_debug_id::generate_debug_id, mapped_assets_cache::MappedAssetsCache, + module_filename_helpers::ModuleFilenameHelpers, ModuleFilenameTemplateFn, ModuleOrSource, }; static SCHEMA_SOURCE_REGEXP: LazyLock = @@ -86,35 +86,6 @@ pub struct SourceMapDevToolPluginOptions { pub debug_ids: bool, } -fn create_debug_id(filename: &str, source: &[u8]) -> String { - // We need two 64 bit hashes to give us the 128 bits required for a uuid - // The first 64 bit hash is built from the source - let mut hasher = RspackHash::new(&rspack_hash::HashFunction::Xxhash64); - hasher.write(source); - let hash1 = hasher.finish().to_le_bytes(); - - // The second 64 bit hash is built from the filename and the source hash - let mut hasher = RspackHash::new(&rspack_hash::HashFunction::Xxhash64); - hasher.write(filename.as_bytes()); - hasher.write(&hash1); - let hash2 = hasher.finish().to_le_bytes(); - - let mut bytes = [hash1, hash2].concat(); - - // Build the uuid from the 16 bytes - let mut uuid = String::with_capacity(36); - bytes[6] = (bytes[6] & 0x0f) | 0x40; - bytes[8] = (bytes[8] & 0x3f) | 0x80; - - for (i, byte) in bytes.iter().enumerate() { - if i == 4 || i == 6 || i == 8 || i == 10 { - uuid.push('-'); - } - uuid.push_str(&format!("{byte:02x}")); - } - uuid -} - enum SourceMappingUrlComment { String(String), Fn(AppendFn), @@ -419,7 +390,7 @@ impl SourceMapDevToolPlugin { let (source_map_json, debug_id) = match source_map { Some(mut map) => { let debug_id = self.debug_ids.then(|| { - let debug_id = create_debug_id(&source_filename, &source.buffer()); + let debug_id = generate_debug_id(&source_filename, &source.buffer()); map.set_debug_id(Some(debug_id.clone())); debug_id }); diff --git a/tests/webpack-test/configCases/source-map/eval-source-map-debugids/test.filter.js b/tests/webpack-test/configCases/source-map/eval-source-map-debugids/test.filter.js deleted file mode 100644 index c4cf14995c15..000000000000 --- a/tests/webpack-test/configCases/source-map/eval-source-map-debugids/test.filter.js +++ /dev/null @@ -1,2 +0,0 @@ -// missing debugId property in sourceMappingURL base64 content -module.exports = () => false diff --git a/tests/webpack-test/configCases/target/system-named-assets-path/test.filter.js b/tests/webpack-test/configCases/target/system-named-assets-path/test.filter.js index fed7caa7b924..0fcd505d2e82 100644 --- a/tests/webpack-test/configCases/target/system-named-assets-path/test.filter.js +++ b/tests/webpack-test/configCases/target/system-named-assets-path/test.filter.js @@ -1 +1 @@ -module.exports = () => false +module.exports = () => "NOPLAN: support systemjs" From bff44def8c279ddf4f3ea41640deea89458ff7e3 Mon Sep 17 00:00:00 2001 From: qixuan <58852732+GiveMe-A-Name@users.noreply.github.com> Date: Thu, 22 May 2025 10:11:10 +0800 Subject: [PATCH 15/50] feat(swc_compiler_api): add diagnostics field to TransformOutput (#10435) enhance: add diagnostics field to TransformOutput --- crates/node_binding/binding.d.ts | 1 + crates/node_binding/src/swc.rs | 2 ++ packages/rspack/etc/core.api.md | 28 ++++++++++++++++++++++++---- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/crates/node_binding/binding.d.ts b/crates/node_binding/binding.d.ts index 3f055640ac9f..2b80896a485c 100644 --- a/crates/node_binding/binding.d.ts +++ b/crates/node_binding/binding.d.ts @@ -2627,4 +2627,5 @@ export declare function transform(source: string, options: string): Promise } diff --git a/crates/node_binding/src/swc.rs b/crates/node_binding/src/swc.rs index 7ace2fe32f31..0e530fa0f769 100644 --- a/crates/node_binding/src/swc.rs +++ b/crates/node_binding/src/swc.rs @@ -9,6 +9,7 @@ use swc_core::ecma::ast::noop_pass; pub struct TransformOutput { pub code: String, pub map: Option, + pub diagnostics: Vec, } impl From for TransformOutput { @@ -18,6 +19,7 @@ impl From for TransformOutput { map: value .map .map(|v| serde_json::to_string(&v).expect("failed to serialize transformOutput.map")), + diagnostics: value.diagnostics, } } } diff --git a/packages/rspack/etc/core.api.md b/packages/rspack/etc/core.api.md index 14d9c805a01a..fac6ba477d19 100644 --- a/packages/rspack/etc/core.api.md +++ b/packages/rspack/etc/core.api.md @@ -1033,18 +1033,18 @@ export class Compilation { // (undocumented) getAsset(name: string): Readonly | void; // (undocumented) - getAssetPath(filename: Filename, data?: PathData): string; + getAssetPath(filename: string, data?: PathData): string; // (undocumented) - getAssetPathWithInfo(filename: Filename, data?: PathData): binding.PathWithInfo; + getAssetPathWithInfo(filename: string, data?: PathData): binding.PathWithInfo; getAssets(): ReadonlyArray; // (undocumented) getCache(name: string): CacheFacade_2; // (undocumented) getLogger(name: string | (() => string)): Logger_3; // (undocumented) - getPath(filename: Filename, data?: PathData): string; + getPath(filename: string, data?: PathData): string; // (undocumented) - getPathWithInfo(filename: Filename, data?: PathData): binding.PathWithInfo; + getPathWithInfo(filename: string, data?: PathData): binding.PathWithInfo; // (undocumented) getStats(): Stats; // (undocumented) @@ -1654,6 +1654,24 @@ export type CssAutoParserOptions = { // @public export type CssChunkFilename = Filename; +// @public (undocumented) +const CssChunkingPlugin: { + new (options: CssChunkingPluginOptions): { + name: binding.BuiltinPluginName; + _args: [options: CssChunkingPluginOptions]; + affectedHooks: "done" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "compilation" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | "additionalPass" | undefined; + raw(compiler: Compiler_2): binding.BuiltinPlugin; + apply(compiler: Compiler_2): void; + }; +}; + +// @public (undocumented) +interface CssChunkingPluginOptions { + nextjs?: boolean; + // (undocumented) + strict?: boolean; +} + // @public (undocumented) export interface CssExtractRspackLoaderOptions { // (undocumented) @@ -2447,6 +2465,8 @@ export const experiments: Experiments_2; // @public (undocumented) interface Experiments_2 { + // (undocumented) + CssChunkingPlugin: typeof CssChunkingPlugin; // (undocumented) globalTrace: { register: (filter: string, layer: "chrome" | "logger", output: string) => Promise; From 942075fa79842b2ede0a835f881614aaaa23fa1b Mon Sep 17 00:00:00 2001 From: hardfist Date: Thu, 22 May 2025 13:45:07 +0800 Subject: [PATCH 16/50] refactor: avoid read rust side json in js side (#10445) * refactor: avoid parse rust side json in js side * chore: use stream write --- crates/rspack_tracing_chrome/src/lib.rs | 4 +-- packages/rspack/src/trace/index.ts | 35 ++++++++++++++----------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/crates/rspack_tracing_chrome/src/lib.rs b/crates/rspack_tracing_chrome/src/lib.rs index ee1b5286f7c7..347606468e83 100644 --- a/crates/rspack_tracing_chrome/src/lib.rs +++ b/crates/rspack_tracing_chrome/src/lib.rs @@ -433,8 +433,8 @@ where serde_json::to_writer(&mut write, &entry).unwrap(); has_started = true; } - - write.write_all(b"\n]").unwrap(); + // we need to merge tracing with js side, so don't end it early + // write.write_all(b"\n]").unwrap(); write.flush().unwrap(); }); diff --git a/packages/rspack/src/trace/index.ts b/packages/rspack/src/trace/index.ts index 6a06fd72f807..4c4917439483 100644 --- a/packages/rspack/src/trace/index.ts +++ b/packages/rspack/src/trace/index.ts @@ -49,6 +49,11 @@ export class JavaScriptTracer { } } + /** + * + * @param isEnd true means we are at the end of tracing,and can append ']' to close the json + * @returns + */ static async cleanupJavaScriptTrace() { if (!this.layer.includes("chrome")) { return; @@ -92,22 +97,20 @@ export class JavaScriptTracer { } }); } - const originTrace = fs.readFileSync(this.output, "utf-8"); - // this is hack, [] is empty and [{}] is not empty - const originTraceIsEmpty = !originTrace.includes("{"); - const eventMsg = - (this.events.length > 0 && !originTraceIsEmpty ? "," : "") + - this.events - .map(x => { - return JSON.stringify(x); - }) - .join(",\n"); - - // a naive implementation to merge rust & Node.js trace, we can't use JSON.parse because sometime the trace file is too big to parse - const newTrace = originTrace.replace(/]$/, `${eventMsg}\n]`); - fs.writeFileSync(this.output, newTrace, { - flush: true - }); + const is_empty = fs.statSync(this.output).size === 0; + const fd = fs.openSync(this.output, "a"); + // stream write to file to avoid large string memory issue + let first = is_empty; + for (const event of this.events) { + if (!first) { + fs.writeFileSync(fd, ",\n"); + } + fs.writeFileSync(fd, JSON.stringify(event)); + first = false; + } + // even lots of tracing tools supports json without ending ], we end it for better compat with other tools + fs.writeFileSync(fd, "\n]"); + fs.closeSync(fd); }); } // get elapsed time since start(microseconds same as rust side timestamp) From 3b864e9cc494be5bca65f7173c9fe50929bfffc5 Mon Sep 17 00:00:00 2001 From: harpsealjs Date: Thu, 22 May 2025 14:06:32 +0800 Subject: [PATCH 17/50] fix: missing fetch priority after hmr updating (#10442) * fix: missing fetch priority after hmr updating * fix: missing fetch priority after hmr updating --- crates/node_binding/src/runtime.rs | 1 + .../rspack_plugin_css/src/runtime/css_loading.js | 15 ++++++++------- .../hotCases/css/fetch-priority/test.filter.js | 1 - 3 files changed, 9 insertions(+), 8 deletions(-) delete mode 100644 tests/webpack-test/hotCases/css/fetch-priority/test.filter.js diff --git a/crates/node_binding/src/runtime.rs b/crates/node_binding/src/runtime.rs index 29e605119be0..e17f34a7acaa 100644 --- a/crates/node_binding/src/runtime.rs +++ b/crates/node_binding/src/runtime.rs @@ -93,6 +93,7 @@ static RUNTIME_GLOBAL_MAP: LazyLock = LazyLock::new(|| { declare_runtime_global!(PRELOAD_CHUNK_HANDLERS); declare_runtime_global!(RSPACK_VERSION); declare_runtime_global!(HAS_CSS_MODULES); + declare_runtime_global!(HAS_FETCH_PRIORITY); to_js_map.shrink_to_fit(); from_js_map.shrink_to_fit(); diff --git a/crates/rspack_plugin_css/src/runtime/css_loading.js b/crates/rspack_plugin_css/src/runtime/css_loading.js index 908e67caa1f1..be8a10a17a28 100644 --- a/crates/rspack_plugin_css/src/runtime/css_loading.js +++ b/crates/rspack_plugin_css/src/runtime/css_loading.js @@ -1,12 +1,12 @@ var uniqueName = "__UNIQUE_NAME__"; function handleCssComposes(exports, composes) { - for (var i = 0; i < composes.length; i += 3) { - var moduleId = composes[i]; - var composeFrom = composes[i + 1]; - var composeVar = composes[i + 2]; - var composedId = __webpack_require__(composeFrom)[composeVar]; - exports[moduleId] = exports[moduleId] + " " + composedId - } + for (var i = 0; i < composes.length; i += 3) { + var moduleId = composes[i]; + var composeFrom = composes[i + 1]; + var composeVar = composes[i + 2]; + var composedId = __webpack_require__(composeFrom)[composeVar]; + exports[moduleId] = exports[moduleId] + " " + composedId + } } var loadCssChunkData = __CSS_CHUNK_DATA__ var loadingAttribute = "data-webpack-loading"; @@ -66,6 +66,7 @@ var loadStylesheet = function (chunkId, url, done, hmr, fetchPriority) { link.onerror = onLinkComplete.bind(null, link.onerror); link.onload = onLinkComplete.bind(null, link.onload); } else onLinkComplete(undefined, { type: "load", target: link }); + if (hmr && hmr.getAttribute("fetchpriority")) link.setAttribute("fetchpriority", hmr.getAttribute("fetchpriority")); hmr ? document.head.insertBefore(link, hmr) : needAttach && document.head.appendChild(link); return link; }; diff --git a/tests/webpack-test/hotCases/css/fetch-priority/test.filter.js b/tests/webpack-test/hotCases/css/fetch-priority/test.filter.js deleted file mode 100644 index 0ba64710234b..000000000000 --- a/tests/webpack-test/hotCases/css/fetch-priority/test.filter.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = () => false; From 1890d8f93add47bfb86fc2eb1b6401521fcb11a8 Mon Sep 17 00:00:00 2001 From: qixuan <58852732+GiveMe-A-Name@users.noreply.github.com> Date: Thu, 22 May 2025 14:22:47 +0800 Subject: [PATCH 18/50] fix: swc compiler api using wasm plugin without tokio runtime panic. (#10438) * fix: async transform and minify fn in napi - napi will add tokio runtime auto in async fn, and swc wasm runtime need runnning in tokio runtime. * refactor: replace the closure with the function itself: `TransformOutput::from` * test: add swc api test case for @swc/plugin-remove-console --- crates/node_binding/src/swc.rs | 109 ++++++------------ .../tests/compilerCases/swc-api.js | 25 ++++ 2 files changed, 60 insertions(+), 74 deletions(-) create mode 100644 packages/rspack-test-tools/tests/compilerCases/swc-api.js diff --git a/crates/node_binding/src/swc.rs b/crates/node_binding/src/swc.rs index 0e530fa0f769..6bfece8d458a 100644 --- a/crates/node_binding/src/swc.rs +++ b/crates/node_binding/src/swc.rs @@ -1,4 +1,3 @@ -use napi::{bindgen_prelude::AsyncTask, Task}; use rspack_javascript_compiler::{ minify::JsMinifyOptions, transform::SwcOptions, JavaScriptCompiler, TransformOutput as CompilerTransformOutput, @@ -24,80 +23,42 @@ impl From for TransformOutput { } } -pub struct AsyncTransform { - source: String, - options: String, +#[napi] +pub async fn transform(source: String, options: String) -> napi::Result { + let options: SwcOptions = serde_json::from_str(&options)?; + let compiler = JavaScriptCompiler::new(); + compiler + .transform( + source, + Some(swc_core::common::FileName::Anon), + options, + None, + |_| noop_pass(), + ) + .map(TransformOutput::from) + .map_err(|e| napi::Error::new(napi::Status::GenericFailure, format!("{}", e))) } -impl Task for AsyncTransform { - type Output = CompilerTransformOutput; - type JsValue = TransformOutput; +#[napi] +pub async fn minify(source: String, options: String) -> napi::Result { + let options: JsMinifyOptions = serde_json::from_str(&options)?; + let compiler = JavaScriptCompiler::new(); + compiler + .minify( + swc_core::common::FileName::Anon, + source, + options, + None::<&dyn Fn(&swc_core::common::comments::SingleThreadedComments)>, + ) + .map(TransformOutput::from) + .map_err(|e| { + let v = e.into_inner(); + let err = v + .into_iter() + .map(|e| format!("{:?}", e)) + .collect::>() + .join("\n"); - fn compute(&mut self) -> napi::Result { - let compiler = JavaScriptCompiler::new(); - let options: SwcOptions = serde_json::from_str(&self.options)?; - let source = std::mem::take(&mut self.source); - compiler - .transform( - source, - Some(swc_core::common::FileName::Anon), - options, - None, - |_| noop_pass(), - ) - .map_err(|e| napi::Error::new(napi::Status::GenericFailure, format!("{}", e))) - } - - fn resolve(&mut self, _env: napi::Env, output: Self::Output) -> napi::Result { - let output = TransformOutput::from(output); - Ok(output) - } -} - -pub struct AsyncMinifier { - source: String, - options: String, -} - -impl Task for AsyncMinifier { - type Output = CompilerTransformOutput; - type JsValue = TransformOutput; - - fn compute(&mut self) -> napi::Result { - let options: JsMinifyOptions = serde_json::from_str(&self.options)?; - let compiler = JavaScriptCompiler::new(); - let source = std::mem::take(&mut self.source); - compiler - .minify( - swc_core::common::FileName::Anon, - source, - options, - None::<&dyn Fn(&swc_core::common::comments::SingleThreadedComments)>, - ) - .map_err(|e| { - let v = e.into_inner(); - let err = v - .into_iter() - .map(|e| format!("{:?}", e)) - .collect::>() - .join("\n"); - - napi::Error::new(napi::Status::GenericFailure, err) - }) - } - - fn resolve(&mut self, _env: napi::Env, output: Self::Output) -> napi::Result { - let output = TransformOutput::from(output); - Ok(output) - } -} - -#[napi(ts_return_type = "Promise")] -pub fn transform(source: String, options: String) -> AsyncTask { - AsyncTask::new(AsyncTransform { source, options }) -} - -#[napi(ts_return_type = "Promise")] -pub fn minify(source: String, options: String) -> AsyncTask { - AsyncTask::new(AsyncMinifier { source, options }) + napi::Error::new(napi::Status::GenericFailure, err) + }) } diff --git a/packages/rspack-test-tools/tests/compilerCases/swc-api.js b/packages/rspack-test-tools/tests/compilerCases/swc-api.js new file mode 100644 index 000000000000..fcff3f6794b7 --- /dev/null +++ b/packages/rspack-test-tools/tests/compilerCases/swc-api.js @@ -0,0 +1,25 @@ +/** @type {import('../..').TCompilerCaseConfig} */ +module.exports = { + description: "should load @swc/plugin-remove-console successfully and transform code using rspack inner swc api", + async check(_, compiler, __) { + let swc = compiler.rspack.experiments.swc; + + let source = 'function main() { console.log("Hello Rspack") }; main();'; + let result = await swc.transform(source, { + filename: "index.js", + minify: true, + jsc: { + parser: { + syntax: "ecmascript", + dynamicImport: true + }, + target: "es5", + experimental: { + plugins: [[require.resolve("@swc/plugin-remove-console"), {}]], + } + } + }); + + expect(result.code).toMatchInlineSnapshot(`function main(){;};main();`); + } +} From 7033258cecd94afd319a30ea452603cca312b48a Mon Sep 17 00:00:00 2001 From: Fy <1114550440@qq.com> Date: Thu, 22 May 2025 14:23:02 +0800 Subject: [PATCH 19/50] chore: add comment to other export info (#10417) --- crates/rspack_core/src/exports_info.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/crates/rspack_core/src/exports_info.rs b/crates/rspack_core/src/exports_info.rs index 86010f9bba76..2d349d0c9348 100644 --- a/crates/rspack_core/src/exports_info.rs +++ b/crates/rspack_core/src/exports_info.rs @@ -776,7 +776,16 @@ impl ExportsInfo { #[derive(Debug, Clone)] pub struct ExportsInfoData { exports: BTreeMap, + + /// other export info is a strange name and hard to understand + /// it has 2 meanings: + /// 1. it is used as factory template, so that we can set one property in one exportsInfo, + /// then export info created by it can extends those property + /// 2. it is used to flag if the whole exportsInfo can be statically analyzed. In many commonjs + /// case, we can not statically analyze the exportsInfo, its other_export_info.provided will + /// be ExportInfoProvided::Null other_exports_info: ExportInfo, + side_effects_only_info: ExportInfo, redirect_to: Option, id: ExportsInfo, @@ -1502,9 +1511,13 @@ pub struct ExportInfoData { #[derive(Debug, Hash, Clone, Copy)] pub enum ExportInfoProvided { + /// The export can be statically analyzed, and it is provided True, + + /// The export can be statically analyzed, and the it is not provided False, - /// `Null` has real semantic in webpack https://github.com/webpack/webpack/blob/853bfda35a0080605c09e1bdeb0103bcb9367a10/lib/ExportsInfo.js#L830 + + /// The export is unknown, we don't know if module really has this export, eg. cjs module Null, } From af51213bcf69775d71fb9387caa2dd85a5df9b33 Mon Sep 17 00:00:00 2001 From: Cong-Cong Pan Date: Thu, 22 May 2025 15:33:54 +0800 Subject: [PATCH 20/50] docs: improve devtool docs (#9832) * docs: improve devtool docs * docs: improve devtool docs --------- Co-authored-by: pshu Co-authored-by: neverland --- website/docs/en/config/devtool.mdx | 111 +++++++++++++++++++---------- website/docs/zh/config/devtool.mdx | 103 ++++++++++++++++---------- 2 files changed, 142 insertions(+), 72 deletions(-) diff --git a/website/docs/en/config/devtool.mdx b/website/docs/en/config/devtool.mdx index 7562ea66d613..26d05b9428d6 100644 --- a/website/docs/en/config/devtool.mdx +++ b/website/docs/en/config/devtool.mdx @@ -4,54 +4,93 @@ import WebpackLicense from '@components/WebpackLicense'; # Devtool -The `devtool` configuration is used to control the behavior of the Source Map generation. +Choose a style of source mapping to enhance the debugging process. These values can affect build and rebuild speed dramatically. + +Use the [SourceMapDevToolPlugin](/plugins/webpack/source-map-dev-tool-plugin) or [EvalSourceMapDevToolPlugin](/plugins/webpack/eval-source-map-dev-tool-plugin) for a more fine grained configuration. - **Type:** ```ts -type Devtool = - | false - | 'eval' - | 'cheap-source-map' - | 'cheap-module-source-map' - | 'source-map' - | 'inline-cheap-source-map' - | 'inline-cheap-module-source-map' - | 'inline-source-map' - | 'inline-nosources-cheap-source-map' - | 'inline-nosources-cheap-module-source-map' - | 'inline-nosources-source-map' - | 'nosources-cheap-source-map' - | 'nosources-cheap-module-source-map' - | 'nosources-source-map' - | 'hidden-nosources-cheap-source-map' - | 'hidden-nosources-cheap-module-source-map' - | 'hidden-nosources-source-map' - | 'hidden-cheap-source-map' - | 'hidden-cheap-module-source-map' - | 'hidden-source-map' - | 'eval-cheap-source-map' - | 'eval-cheap-module-source-map' - | 'eval-source-map' - | 'eval-nosources-cheap-source-map' - | 'eval-nosources-cheap-module-source-map' - | 'eval-nosources-source-map'; +type Devtool = 'string' | false; ``` - **Default:** `eval` -The main types of Source Map generated behaviors are `source-map`, `eval`, `cheap`, `module`, `inline`, `nosources` and `hidden`, and they can be combined. +## Configuration Guide + +### Step 1: Determine Debugging Needs + +- **Not required** → Set `devtool: false` + - Disables all debugging information + - Zero build overhead with maximum build speed +- **Required** → Proceed to [Step 2](#step-2-define-debugging-requirements) + +### Step 2: Define Debugging Requirements + +- **Module-level positioning only** → Set `devtool: 'eval'` + - Each module executed via `eval()` with `//# sourceURL` comment + - Extremely fast build speed +- **Full source code mapping needed** → Proceed to [Step 3](#step-3-configure-sourcemap) + +### Step 3: Configure SourceMap + +Set `devtool: 'source-map'`, A full SourceMap is emitted as a separate file. It adds a `//# sourceMapURL` comment to the bundle so development tools know where to find it. + +It also supports combination with the following modifiers to improve performance and control SourceMap generation. + +Performance optimization modifiers, to speed up the build, usually used in development environments: + +| Modifier | Effect | Performance improvement | +| -------- | -------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------- | +| eval | Each module is executed with `eval()` and a SourceMap is added as a DataUrl to the `eval()`, avoiding chunk-level multiple SourceMap concate | ⚡⚡⚡ | +| cheap | Maps line numbers only (no columns), ignores source maps from loaders | ⚡⚡ | +| module | Processes source maps from loaders to map to original code (line-only mapping) | ⚡ | + +Functional modifiers, to control SourceMap generation, usually used in production environments: + +| Modifier | Effect | +| --------- | ------------------------------------------------------------------------------------------------------------------------------------------- | +| hidden | SourceMap is emitted as a separate file, but no `//# sourceMappingURL=[url]` comment is added to the bundle, protecting source code privacy | +| inline | SourceMap is added as a DataUrl to the bundle | +| nosources | SourceMap is created without the `sourcesContent` in it | +| debugids | SourceMap is created with the `debugId` in it | + +We expect a certain pattern when validate devtool name, pay attention and don't mix up the sequence of devtool string. The pattern is: `[inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map[-debugids]`. + +## Recommended configurations + +### Development + +The following options are ideal for development: + +`eval` - Each module is executed with `eval()` and `//# sourceURL`. This is pretty fast. The main disadvantage is that it doesn't display line numbers correctly since it gets mapped to transpiled code instead of the original code (No Source Maps from Loaders). + +`eval-source-map` - Each module is executed with `eval()` and a SourceMap is added as a DataUrl to the `eval()`. Initially it is slow, but it provides fast rebuild speed and yields real files. Line numbers are correctly mapped since it gets mapped to the original code. It yields the best quality SourceMaps for development. + +`eval-cheap-source-map` - Similar to `eval-source-map`, each module is executed with `eval()`. It is "cheap" because it doesn't have column mappings, it only maps line numbers. It ignores SourceMaps from Loaders and only display transpiled code similar to the eval devtool. + +`eval-cheap-module-source-map` - Similar to `eval-cheap-source-map`, however, in this case Source Maps from Loaders are processed for better results. However Loader Source Maps are simplified to a single mapping per line. + +### Production + +These options are typically used in production: -- `source-map` is the most basic behavior, indicating the generation of Source Map, which has a partial overhead on build performance when Source Map is turned on. +'false' - No SourceMap is emitted. This is a good option to start with. -- `eval` wraps the module generated code with `eval()`, so Rspack can internally cache the module generated results, so when `eval` is used in combination with `source-map`, it optimizes the speed of Source Map generation when rebuilding. +`source-map` - A full SourceMap is emitted as a separate file. It adds a reference comment to the bundle so development tools know where to find it. -- `cheap` means that the Source Map will only generate the mapping of rows, ignoring the mapping of columns, in order to speed up the generation of the Source Map. +:::warning +You should configure your server to disallow access to the Source Map file for normal users! +::: -- `module` is used to control whether the loader needs to return the Source Map, so without `module`, the Source Map can only map code that will be processed by the loader, and because the loader does not need to process the Source Map, the Source Map generation speed will be improved. +`hidden-source-map` - Same as `source-map`, but doesn't add a reference comment to the bundle. Useful if you only want SourceMaps to map error stack traces from error reports, but don't want to expose your SourceMap for the browser development tools. -- `inline` indicates whether the generated Source Map is inlined into the end of the file via the data url. +:::warning +You should not deploy the Source Map file to the webserver. Instead only use it for error report tooling. +::: -- `nosources` is used to control whether the generated Source Map contains source code content to reduce the size of the generated Source Map. +`nosources-source-map` - A SourceMap is created without the `sourcesContent` in it. It can be used to map stack traces on the client without exposing all of the source code. You can deploy the Source Map file to the webserver. -- `hidden` is used to control whether the end of the generated file contains the `# sourceMappingURL=...` annotation. The browser developer tools and VS Code etc. will look for the Source Map by the path or data url of this annotation in order to map the product's row number back to its location in the source code during debugging. +:::warning +It still exposes original filenames and structure, but it doesn't expose the original code. +::: diff --git a/website/docs/zh/config/devtool.mdx b/website/docs/zh/config/devtool.mdx index 3548c103e799..5d49f18a7267 100644 --- a/website/docs/zh/config/devtool.mdx +++ b/website/docs/zh/config/devtool.mdx @@ -4,54 +4,85 @@ import WebpackLicense from '@components/WebpackLicense'; # Devtool -调试:该选项用于控制 Source Map 的生成行为。 +该选项用于控制调试信息生成策略,影响调试能力与构建性能。 + +需要精细控制时,直接使用 [SourceMapDevToolPlugin](/plugins/webpack/source-map-dev-tool-plugin) 或 [EvalSourceMapDevToolPlugin](/plugins/webpack/eval-source-map-dev-tool-plugin)。 - **类型:** ```ts -type Devtool = - | false - | 'eval' - | 'cheap-source-map' - | 'cheap-module-source-map' - | 'source-map' - | 'inline-cheap-source-map' - | 'inline-cheap-module-source-map' - | 'inline-source-map' - | 'inline-nosources-cheap-source-map' - | 'inline-nosources-cheap-module-source-map' - | 'inline-nosources-source-map' - | 'nosources-cheap-source-map' - | 'nosources-cheap-module-source-map' - | 'nosources-source-map' - | 'hidden-nosources-cheap-source-map' - | 'hidden-nosources-cheap-module-source-map' - | 'hidden-nosources-source-map' - | 'hidden-cheap-source-map' - | 'hidden-cheap-module-source-map' - | 'hidden-source-map' - | 'eval-cheap-source-map' - | 'eval-cheap-module-source-map' - | 'eval-source-map' - | 'eval-nosources-cheap-source-map' - | 'eval-nosources-cheap-module-source-map' - | 'eval-nosources-source-map'; +type Devtool = 'string' | false; ``` - **默认值:** `eval` -Source Map 生成主要有 `source-map`、`eval`、`cheap`、`module`、`inline`、`nosources` 和 `hidden` 这几种风格,它们之间可以进行组合。 +## 决策指南 + +### 步骤1:是否需要调试 + +- **不需要** → 设置 `devtool: false` + - 禁用所有调试信息 + - 零额外构建开销,极致构建速度 +- **需要** → 进入[步骤2](#步骤2明确调试需求) + +### 步骤2:明确调试需求 + +- **仅需定位模块** → 设置 `devtool: 'eval'` + - 每个模块都使用 `eval()` 执行,并且都有 `//# sourceURL` + - 极快的构建速度 +- **需要源码映射** → 进入[步骤3](#步骤3配置-source-map) + +### 步骤3:配置 SourceMap + +设置 `devtool: 'source-map'` 时,SourceMap 作为一个单独的文件生成。bundle 添加 `//# sourceMapURL` 注释,以便开发工具知道在哪里可以找到它。 + +它还支持与以下修饰符进行组合,以提升性能或控制 SourceMap 生成。 + +性能优化修饰符,提升构建速度,通常用于开发环境: + +| 修饰符 | 效果 | 性能提升 | +| ------ | ------------------------------------------------------------------------------------------------------------------------ | -------- | +| eval | 每个模块都使用 `eval()` 执行,并且将模块 SourceMap 转换为 DataUrl 后添加到 `eval()` 中,避免 chunk 级 SourceMap 合并计算 | ⚡⚡ | +| cheap | 仅计算行映射,忽略列映射。仅映射到转译后的代码,忽略来自 loader 的 SourceMap | ⚡⚡ | +| module | 处理来自 loader 的 SourceMap,以映射到源代码。仅计算行映射,忽略列映射 | ⚡ | + +功能修饰符,按需控制 SourceMap 的生成,通常用于生产环境: + +| 修饰符 | 效果 | +| --------- | ------------------------------------------------------------------------------------------------------ | +| hidden | SourceMap 作为一个单独的文件生成,但不会为 bundle 添加 `//# sourceMappingURL=[url]` 注释,保护源码隐私 | +| inline | SourceMap 以 base64 内联到 bundle 中,不生成单独的文件 | +| nosources | 创建的 SourceMap 不包含 `sourcesContent`(源代码内容) | +| debugids | 创建的 SourceMap 增加 `debugId` 字段 | + +验证 `devtool` 的配置时,我们期望的格式是 `[inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map[-debugids]`. + +## 推荐配置 + +### 开发环境 + +以下选项非常适合开发环境: + +`eval` - 每个模块都使用 `eval()` 执行,并且都有 `//# sourceURL`。优点是构建性能极快,缺点是,不会映射到源代码。 + +`eval-source-map` - 每个模块使用 `eval()` 执行,并且将模块 SourceMap 转换为 DataUrl 后添加到 `eval()` 中,避免 chunk 级 SourceMap 合并计算。 + +`eval-cheap-source-map` - 类似 `eval-source-map`,每个模块使用 `eval()` 执行。SourceMap 不计算列映射,只是映射行。忽略源自 loader 的 SourceMap,仅映射到转译后的代码。 + +`eval-cheap-module-source-map` - 类似 `eval-cheap-source-map`,并且,但会处理源自 loader 的 SourceMap,映射到源代码。然而,SourceMap 不计算列映射,只是映射行。 -- `source-map` 是最基础的行为,表示生成 Source Map,当开启 Source Map 时会对构建性能有部分开销。 +### 生产环境 -- `eval` 会通过 `eval()` 包裹模块生成的代码,因此 Rspack 可以在内部对模块的生成结果做缓存,所以当 `eval` 和 `source-map` 组合使用时会优化重新构建时的 Source Map 生成速度。 +这些选项通常用于生产环境中: -- `cheap` 表示 Source Map 只会生成行的映射,忽略列的映射关系,以加快 Source Map 的生成速度。 +`false` - 不生成 SourceMap。 -- `module` 用来控制 loader 是否需要返回 Source Map,所以不开 `module` 时,Source Map 只能映射会 loader 处理之后的代码,同时因为 loader 不需要处理 Source Map,所以 Source Map 生成速度也会有所提升。 +`source-map` - SourceMap 作为一个单独的文件生成。bundle 添加 `//# sourceMapURL` 注释,以便开发工具知道在哪里可以找到它。 -- `inline` 表示生成的 Source Map 是否通过 data url 内联到文件末尾。 +:::warning +你应该配置你的服务器,不允许普通用户访问 SourceMap 文件! +::: -- `nosources` 用来控制生成的 Source Map 中是否包含源码内容,以减小生成的 Source Map 体积。 +`hidden-source-map` - 与 `source-map` 相同,但不会为 bundle 添加 `//# sourceMapURL` 注释。你可以将 SourceMap 用于错误报告工具,来映射源自客户端的错误堆栈,而不必向浏览器暴露你的 SourceMap。 -- `hidden` 用来控制生成的文件尾部是否包含 `# sourceMappingURL=...` 注释。浏览器的开发者工具和 VS Code 等会通过这段注释的路径或 data url 来寻找 Source Map,以便在调试时将产物的行列号映射回源码中的位置。 +`nosources-source-map` - 创建的 SourceMap 不包含 `sourcesContent`(源代码内容)。用来映射客户端上的错误堆栈,而不会暴露源代码,但仍然会暴露原始的文件名和结构。 From 5e17286e903234bca7df3a9a68f88aa7de1c7b65 Mon Sep 17 00:00:00 2001 From: Leyang Date: Thu, 22 May 2025 15:51:24 +0800 Subject: [PATCH 21/50] docs: add midscenejs to join-us documentation (#10447) docs: add midscene to join-us documentation --- website/docs/en/misc/team/join-us.mdx | 1 + website/docs/zh/misc/team/join-us.mdx | 1 + 2 files changed, 2 insertions(+) diff --git a/website/docs/en/misc/team/join-us.mdx b/website/docs/en/misc/team/join-us.mdx index 161dc0c25ada..38d176355e1f 100644 --- a/website/docs/en/misc/team/join-us.mdx +++ b/website/docs/en/misc/team/join-us.mdx @@ -14,6 +14,7 @@ We have created a series of Web tools to enhance development efficiency and expe - **Open source solutions based on Rspack**, including [Rsbuild](https://github.com/web-infra-dev/rsbuild), [Rspress](https://github.com/web-infra-dev/rspress), and [Modern.js](https://github.com/web-infra-dev/modern.js), forming a series of ready-to-use solutions, offering multi-scenario support from Web building, static site generation to full-stack research and development. - **High-performance Web solutions**, which go beyond the traditional Web. Breaking through the conventional WebView and combining with the end, browser kernel, we continue to explore various end performance optimization methods, allowing developers to enjoy optimization capabilities at an extremely low cost. - **Modern Web engineering system**, including a React-based progressive Web development framework, esbuild-based module development tools, monorepo solutions, micro-frontend/micro-module solutions, and build diagnostic analysis tools. +- **Next-generation products from an AI-first perspective**, including [MidsceneJS](https://midscenejs.com), exploring the application of AI in the Web field. Currently, these tools are widely used and well-received within ByteDance. At the same time, several projects have been open-sourced to GitHub, where they are being built and developed together with the community developers. diff --git a/website/docs/zh/misc/team/join-us.mdx b/website/docs/zh/misc/team/join-us.mdx index 4e959acb388d..6109d61a6fac 100644 --- a/website/docs/zh/misc/team/join-us.mdx +++ b/website/docs/zh/misc/team/join-us.mdx @@ -14,6 +14,7 @@ - **基于 Rspack 的开源方案**,包括 [Rsbuild](https://github.com/web-infra-dev/rsbuild)、[Rspress](https://github.com/web-infra-dev/rspress) 和 [Modern.js](https://github.com/web-infra-dev/modern.js),构成一系列开箱即用的解决方案,提供从 Web 构建、静态站点生成到全栈研发的多场景支持。 - **高性能 Web 解决方案**,基于 Web 不止于 Web。突破传统的 WebView,与端、浏览器内核相结合,持续探索各种端性能优化方式,让开发者以极低成本享受优化能力。 - **现代 Web 工程体系**,包括基于 React 的渐进式 Web 开发框架、基于 esbuild 的模块开发工具、monorepo 解决方案、微前端/微模块解决方案、构建诊断分析工具。 +- **AI 视角下的下一代产品**,包括 [MidsceneJS](https://midscenejs.com/zh) 等,探索 AI 在 Web 领域的应用。 当前,这些工具在 ByteDance 内部被广泛使用和好评。同时,其中多个项目已经开源到 GitHub,与社区开发者共同建设和发展。 From 096bf260508727d3bdba928c47b511289fe1ad84 Mon Sep 17 00:00:00 2001 From: harpsealjs Date: Thu, 22 May 2025 17:29:03 +0800 Subject: [PATCH 22/50] fix: render namespace template in devtool plugins (#10448) --- .../src/eval_dev_tool_module_plugin.rs | 24 +++++- .../src/eval_source_map_dev_tool_plugin.rs | 21 ++++- .../src/source_map_dev_tool_plugin.rs | 80 +++++++++++++------ .../test.filter.js | 2 - 4 files changed, 93 insertions(+), 34 deletions(-) delete mode 100644 tests/webpack-test/configCases/source-map/devtool-namespace-with-source-map/test.filter.js diff --git a/crates/rspack_plugin_devtool/src/eval_dev_tool_module_plugin.rs b/crates/rspack_plugin_devtool/src/eval_dev_tool_module_plugin.rs index 0866aec2fac2..efa3ff25ba17 100644 --- a/crates/rspack_plugin_devtool/src/eval_dev_tool_module_plugin.rs +++ b/crates/rspack_plugin_devtool/src/eval_dev_tool_module_plugin.rs @@ -7,7 +7,7 @@ use rspack_core::{ rspack_sources::{BoxSource, RawStringSource, Source, SourceExt}, ApplyContext, BoxModule, ChunkInitFragments, ChunkUkey, Compilation, CompilationAdditionalModuleRuntimeRequirements, CompilationParams, CompilerCompilation, - CompilerOptions, ModuleIdentifier, Plugin, PluginContext, RuntimeGlobals, + CompilerOptions, Filename, ModuleIdentifier, PathData, Plugin, PluginContext, RuntimeGlobals, }; use rspack_error::Result; use rspack_hash::RspackHash; @@ -89,7 +89,7 @@ async fn eval_devtool_plugin_compilation( async fn eval_devtool_plugin_render_module_content( &self, compilation: &Compilation, - _chunk_ukey: &ChunkUkey, + chunk_ukey: &ChunkUkey, module: &BoxModule, render_source: &mut RenderSource, _init_fragments: &mut ChunkInitFragments, @@ -102,6 +102,22 @@ async fn eval_devtool_plugin_render_module_content( return Ok(()); } + let chunk = compilation.chunk_by_ukey.get(chunk_ukey); + let path_data = PathData::default() + .chunk_id_optional( + chunk.and_then(|c| c.id(&compilation.chunk_ids_artifact).map(|id| id.as_str())), + ) + .chunk_name_optional(chunk.and_then(|c| c.name())) + .chunk_hash_optional(chunk.and_then(|c| { + c.rendered_hash( + &compilation.chunk_hashes_artifact, + compilation.options.output.hash_digest_length, + ) + })); + + let filename = Filename::from(self.namespace.as_str()); + let namespace = compilation.get_path(&filename, path_data).await?; + let output_options = &compilation.options.output; let str = match &self.module_filename_template { ModuleFilenameTemplate::String(s) => ModuleFilenameHelpers::create_filename_of_string_template( @@ -109,7 +125,7 @@ async fn eval_devtool_plugin_render_module_content( compilation, s, output_options, - &self.namespace, + &namespace, ), ModuleFilenameTemplate::Fn(f) => { ModuleFilenameHelpers::create_filename_of_fn_template( @@ -117,7 +133,7 @@ async fn eval_devtool_plugin_render_module_content( compilation, f, output_options, - &self.namespace, + &namespace, ) .await? } diff --git a/crates/rspack_plugin_devtool/src/eval_source_map_dev_tool_plugin.rs b/crates/rspack_plugin_devtool/src/eval_source_map_dev_tool_plugin.rs index 5380d592c7ed..967159789a93 100644 --- a/crates/rspack_plugin_devtool/src/eval_source_map_dev_tool_plugin.rs +++ b/crates/rspack_plugin_devtool/src/eval_source_map_dev_tool_plugin.rs @@ -7,7 +7,7 @@ use rspack_core::{ rspack_sources::{BoxSource, MapOptions, RawStringSource, Source, SourceExt}, ApplyContext, BoxModule, ChunkGraph, ChunkInitFragments, ChunkUkey, Compilation, CompilationAdditionalModuleRuntimeRequirements, CompilationParams, CompilerCompilation, - CompilerOptions, ModuleIdentifier, Plugin, PluginContext, RuntimeGlobals, + CompilerOptions, Filename, ModuleIdentifier, PathData, Plugin, PluginContext, RuntimeGlobals, }; use rspack_error::Result; use rspack_hash::{RspackHash, RspackHashDigest}; @@ -123,6 +123,21 @@ async fn eval_source_map_devtool_plugin_render_module_content( ModuleOrSource::Source(source.to_string()) } }); + let path_data = PathData::default() + .chunk_id_optional( + chunk + .id(&compilation.chunk_ids_artifact) + .map(|id| id.as_str()), + ) + .chunk_name_optional(chunk.name()) + .chunk_hash_optional(chunk.rendered_hash( + &compilation.chunk_hashes_artifact, + compilation.options.output.hash_digest_length, + )); + + let filename = Filename::from(self.namespace.as_str()); + let namespace = compilation.get_path(&filename, path_data).await?; + let module_filenames = match &self.module_filename_template { ModuleFilenameTemplate::String(s) => modules .map(|module_or_source| { @@ -131,7 +146,7 @@ async fn eval_source_map_devtool_plugin_render_module_content( compilation, s, output_options, - &self.namespace, + &namespace, ) }) .collect::>(), @@ -143,7 +158,7 @@ async fn eval_source_map_devtool_plugin_render_module_content( compilation, f, output_options, - &self.namespace, + &namespace, ) }); join_all(features) diff --git a/crates/rspack_plugin_devtool/src/source_map_dev_tool_plugin.rs b/crates/rspack_plugin_devtool/src/source_map_dev_tool_plugin.rs index ea0d93c97eee..7cef44ebc9b7 100644 --- a/crates/rspack_plugin_devtool/src/source_map_dev_tool_plugin.rs +++ b/crates/rspack_plugin_devtool/src/source_map_dev_tool_plugin.rs @@ -225,9 +225,15 @@ impl SourceMapDevToolPlugin { let source_map_modules = mapped_sources .par_iter() - .filter_map(|(_file, _asset, source_map)| source_map.as_ref()) - .flat_map(|source_map| source_map.sources()) - .map(|source| { + .filter_map(|(file, _asset, source_map)| source_map.as_ref().map(|s| (file, s))) + .flat_map(|(file, source_map)| { + source_map + .sources() + .iter() + .map(|i| (file, i)) + .collect::>() + }) + .map(|(file, source)| { let module_or_source = if let Some(stripped) = source.strip_prefix("webpack://") { let source = make_paths_absolute(compilation.options.context.as_str(), stripped); let identifier = ModuleIdentifier::from(source.as_str()); @@ -241,35 +247,59 @@ impl SourceMapDevToolPlugin { } else { ModuleOrSource::Source(source.to_string()) }; - (source.to_string(), module_or_source) + + (source.to_string(), (file.to_string(), module_or_source)) }) .collect::>(); let module_source_names = source_map_modules.values().collect::>(); let mut module_to_source_name = match &self.module_filename_template { - ModuleFilenameTemplate::String(s) => module_source_names - .into_par_iter() - .map(|module_or_source| { - if let ModuleOrSource::Source(source) = module_or_source { - if SCHEMA_SOURCE_REGEXP.is_match(source) { - return (module_or_source, source.to_string()); + ModuleFilenameTemplate::String(s) => { + let tasks = module_source_names + .into_iter() + .map(|(file, module_or_source)| async move { + if let ModuleOrSource::Source(source) = module_or_source { + if SCHEMA_SOURCE_REGEXP.is_match(source) { + return Ok((module_or_source, source.to_string())); + } } - } - let source_name = ModuleFilenameHelpers::create_filename_of_string_template( - module_or_source, - compilation, - s, - output_options, - &self.namespace, - ); - (module_or_source, source_name) - }) - .collect::>(), + let chunk = file_to_chunk.get(file); + let path_data = PathData::default() + .chunk_id_optional( + chunk.and_then(|c| c.id(&compilation.chunk_ids_artifact).map(|id| id.as_str())), + ) + .chunk_name_optional(chunk.and_then(|c| c.name())) + .chunk_hash_optional(chunk.and_then(|c| { + c.rendered_hash( + &compilation.chunk_hashes_artifact, + compilation.options.output.hash_digest_length, + ) + })); + + let filename = Filename::from(self.namespace.as_str()); + let namespace = compilation.get_path(&filename, path_data).await?; + + let source_name = ModuleFilenameHelpers::create_filename_of_string_template( + module_or_source, + compilation, + s, + output_options, + &namespace, + ); + Ok((module_or_source, source_name)) + }) + .collect::>(); + + join_all(tasks) + .await + .into_iter() + .collect::>>()? + } ModuleFilenameTemplate::Fn(f) => { - let features = module_source_names + let tasks = module_source_names .into_iter() - .map(|module_or_source| async move { + .map(|(_, module_or_source)| async move { if let ModuleOrSource::Source(source) = module_or_source { if SCHEMA_SOURCE_REGEXP.is_match(source) { return Ok((module_or_source, source.to_string())); @@ -287,7 +317,7 @@ impl SourceMapDevToolPlugin { Ok((module_or_source, source_name)) }) .collect::>(); - join_all(features) + join_all(tasks) .await .into_iter() .collect::>>()? @@ -368,7 +398,7 @@ impl SourceMapDevToolPlugin { .get(source) .expect("expected a module or source"); module_to_source_name - .get(module_or_source) + .get(&module_or_source.1) .expect("expected a filename at the given index but found None") .clone() }) diff --git a/tests/webpack-test/configCases/source-map/devtool-namespace-with-source-map/test.filter.js b/tests/webpack-test/configCases/source-map/devtool-namespace-with-source-map/test.filter.js deleted file mode 100644 index 707aed0d3266..000000000000 --- a/tests/webpack-test/configCases/source-map/devtool-namespace-with-source-map/test.filter.js +++ /dev/null @@ -1,2 +0,0 @@ -// missing substitution on output.library -module.exports = () => false From b22d8ad170e9d167c1360dc5e2a4aefa8232843c Mon Sep 17 00:00:00 2001 From: harpsealjs Date: Thu, 22 May 2025 20:10:01 +0800 Subject: [PATCH 23/50] fix: missing import scripts runtime when target is webworker (#10450) --- .../rspack_plugin_runtime/src/import_scripts_chunk_loading.rs | 2 +- .../src/runtime_module/import_scripts_chunk_loading.rs | 4 +++- .../runtime_module/runtime/import_scripts_chunk_loading.ejs | 2 ++ .../configCases/runtime/target-webworker/test.filter.js | 2 -- 4 files changed, 6 insertions(+), 4 deletions(-) delete mode 100644 tests/webpack-test/configCases/runtime/target-webworker/test.filter.js diff --git a/crates/rspack_plugin_runtime/src/import_scripts_chunk_loading.rs b/crates/rspack_plugin_runtime/src/import_scripts_chunk_loading.rs index 61cca91179b8..f068e820bcd6 100644 --- a/crates/rspack_plugin_runtime/src/import_scripts_chunk_loading.rs +++ b/crates/rspack_plugin_runtime/src/import_scripts_chunk_loading.rs @@ -44,7 +44,7 @@ async fn runtime_requirements_in_tree( runtime_requirements_mut.insert(RuntimeGlobals::PUBLIC_PATH); runtime_requirements_mut.insert(RuntimeGlobals::GET_UPDATE_MANIFEST_FILENAME); } - RuntimeGlobals::BASE_URI if is_enabled_for_chunk => { + RuntimeGlobals::BASE_URI | RuntimeGlobals::ON_CHUNKS_LOADED if is_enabled_for_chunk => { has_chunk_loading = true; } _ => {} diff --git a/crates/rspack_plugin_runtime/src/runtime_module/import_scripts_chunk_loading.rs b/crates/rspack_plugin_runtime/src/runtime_module/import_scripts_chunk_loading.rs index 93310d388701..ae10d58389ef 100644 --- a/crates/rspack_plugin_runtime/src/runtime_module/import_scripts_chunk_loading.rs +++ b/crates/rspack_plugin_runtime/src/runtime_module/import_scripts_chunk_loading.rs @@ -108,6 +108,7 @@ impl RuntimeModule for ImportScriptsChunkLoadingRuntimeModule { let with_hmr = runtime_requirements.contains(RuntimeGlobals::HMR_DOWNLOAD_UPDATE_HANDLERS); let with_hmr_manifest = runtime_requirements.contains(RuntimeGlobals::HMR_DOWNLOAD_MANIFEST); let with_loading = runtime_requirements.contains(RuntimeGlobals::ENSURE_CHUNK_HANDLERS); + let with_callback = runtime_requirements.contains(RuntimeGlobals::CHUNK_CALLBACK); let condition_map = compilation @@ -138,7 +139,7 @@ impl RuntimeModule for ImportScriptsChunkLoadingRuntimeModule { )); } - if with_loading { + if with_loading || with_callback { let chunk_loading_global_expr = format!( "{}[\"{}\"]", &compilation.options.output.global_object, &compilation.options.output.chunk_loading_global @@ -180,6 +181,7 @@ impl RuntimeModule for ImportScriptsChunkLoadingRuntimeModule { Some(serde_json::json!({ "_body": body, "_chunk_loading_global_expr": chunk_loading_global_expr, + "_with_loading": with_loading, })), )?; diff --git a/crates/rspack_plugin_runtime/src/runtime_module/runtime/import_scripts_chunk_loading.ejs b/crates/rspack_plugin_runtime/src/runtime_module/runtime/import_scripts_chunk_loading.ejs index c22f0ba58ddd..9774ee25b2d2 100644 --- a/crates/rspack_plugin_runtime/src/runtime_module/runtime/import_scripts_chunk_loading.ejs +++ b/crates/rspack_plugin_runtime/src/runtime_module/runtime/import_scripts_chunk_loading.ejs @@ -10,9 +10,11 @@ var installChunk = <%- basicFunction("data") %> { while (chunkIds.length) installedChunks[chunkIds.pop()] = 1; parentChunkLoadingFunction(data); }; +<% if (_with_loading) { %> <%- ENSURE_CHUNK_HANDLERS %>.i = <%- basicFunction("chunkId, promises") %> { <%- _body %> }; +<% } %> var chunkLoadingGlobal = <%- _chunk_loading_global_expr %> = <%- _chunk_loading_global_expr %> || []; var parentChunkLoadingFunction = chunkLoadingGlobal.push.bind(chunkLoadingGlobal); chunkLoadingGlobal.push = installChunk; \ No newline at end of file diff --git a/tests/webpack-test/configCases/runtime/target-webworker/test.filter.js b/tests/webpack-test/configCases/runtime/target-webworker/test.filter.js deleted file mode 100644 index 5d638e4116a6..000000000000 --- a/tests/webpack-test/configCases/runtime/target-webworker/test.filter.js +++ /dev/null @@ -1,2 +0,0 @@ -// No tests exported by test case -module.exports = () => false From 205e48f4a35a50dee19d7fe83720a5e9bc8e88b8 Mon Sep 17 00:00:00 2001 From: harpsealjs Date: Fri, 23 May 2025 11:24:36 +0800 Subject: [PATCH 24/50] test: enable more webpack test cases (#10449) --- packages/rspack/src/config/adapterRuleUse.ts | 2 +- .../custom-hash-function/debug-hash/test.filter.js | 2 +- .../loaders-and-plugins-falsy/basic/test.filter.js | 2 -- .../mangle-with-destructuring-assignment/index.js | 12 +++++++----- .../test.filter.js | 2 -- .../optimization/issue-19184/test.filter.js | 3 +-- .../records/with-readRecords-hook/test.filter.js | 3 +-- .../resolve/function-plugins/test.filter.js | 2 +- .../resolve/unsafe-cache-proxy/test.filter.js | 2 +- .../configCases/rule-set/oneOf/test.filter.js | 3 +-- .../statsCases/split-chunks-dedup/test.filter.js | 3 +-- .../statsCases/split-chunks-dedup/webpack.config.js | 6 ++---- .../statsCases/track-returned/test.filter.js | 3 +-- 13 files changed, 18 insertions(+), 27 deletions(-) delete mode 100644 tests/webpack-test/configCases/loaders-and-plugins-falsy/basic/test.filter.js delete mode 100644 tests/webpack-test/configCases/mangle/mangle-with-destructuring-assignment/test.filter.js diff --git a/packages/rspack/src/config/adapterRuleUse.ts b/packages/rspack/src/config/adapterRuleUse.ts index 1ae6d5ae3591..e42357744507 100644 --- a/packages/rspack/src/config/adapterRuleUse.ts +++ b/packages/rspack/src/config/adapterRuleUse.ts @@ -495,7 +495,7 @@ function createRawModuleRuleUsesImpl( return []; } - return uses.map((use, index) => { + return uses.filter(Boolean).map((use, index) => { let o: string | undefined; let isBuiltin = false; if (use.loader.startsWith(BUILTIN_LOADER_PREFIX)) { diff --git a/tests/webpack-test/configCases/custom-hash-function/debug-hash/test.filter.js b/tests/webpack-test/configCases/custom-hash-function/debug-hash/test.filter.js index f8dcc9e130e1..839ed7b0a125 100644 --- a/tests/webpack-test/configCases/custom-hash-function/debug-hash/test.filter.js +++ b/tests/webpack-test/configCases/custom-hash-function/debug-hash/test.filter.js @@ -1,2 +1,2 @@ // debug hash is not implemented -module.exports = () => false; +module.exports = () => "NOPLAN: support debug hash function"; diff --git a/tests/webpack-test/configCases/loaders-and-plugins-falsy/basic/test.filter.js b/tests/webpack-test/configCases/loaders-and-plugins-falsy/basic/test.filter.js deleted file mode 100644 index 5faecfb6f2f1..000000000000 --- a/tests/webpack-test/configCases/loaders-and-plugins-falsy/basic/test.filter.js +++ /dev/null @@ -1,2 +0,0 @@ -// Cannot read properties of null (reading 'loader') in adapterRuleUse createRawModuleRuleUsesImpl function -module.exports = () => false; diff --git a/tests/webpack-test/configCases/mangle/mangle-with-destructuring-assignment/index.js b/tests/webpack-test/configCases/mangle/mangle-with-destructuring-assignment/index.js index 1d460b293694..fcc00e240f80 100644 --- a/tests/webpack-test/configCases/mangle/mangle-with-destructuring-assignment/index.js +++ b/tests/webpack-test/configCases/mangle/mangle-with-destructuring-assignment/index.js @@ -66,15 +66,16 @@ it("should mangle when destructuring json", async () => { expect(values[1]).toBe(3); const generatedJson = __non_webpack_require__(path.resolve(__dirname, "data.json.js")); + // CHANGE: mangled name is different expect(generatedJson).toEqual({ - "W": { + "j": { "arr": [ { "prop1": 1, "prop2": 2 }, { "prop3": 3, "prop4": 4 }, { "prop5": 5, "prop6": 6 } ] }, - "p": "foo" + "R": "foo" }); }); @@ -84,10 +85,11 @@ it("should mangle when destructuring json 2", async () => { expect(prop2).toBe(2); const generatedJson = __non_webpack_require__(path.resolve(__dirname, "data.json_2.js")); + // CHANGE: mangled name is different expect(generatedJson).toEqual({ - "W": { - "Q": [ - { "X": 1, "Q": 2 }, + "j": { + "a": [ + { "M": 1, "N": 2 }, ], } }); diff --git a/tests/webpack-test/configCases/mangle/mangle-with-destructuring-assignment/test.filter.js b/tests/webpack-test/configCases/mangle/mangle-with-destructuring-assignment/test.filter.js deleted file mode 100644 index 37a767f96d2b..000000000000 --- a/tests/webpack-test/configCases/mangle/mangle-with-destructuring-assignment/test.filter.js +++ /dev/null @@ -1,2 +0,0 @@ -// compilation.codeGenerationResults undefined -module.exports = () => false; diff --git a/tests/webpack-test/configCases/optimization/issue-19184/test.filter.js b/tests/webpack-test/configCases/optimization/issue-19184/test.filter.js index ed3f5ac6c7ea..79da059fb852 100644 --- a/tests/webpack-test/configCases/optimization/issue-19184/test.filter.js +++ b/tests/webpack-test/configCases/optimization/issue-19184/test.filter.js @@ -1,2 +1 @@ -// moduleIds: hashed is not implemented -module.exports = () => false; +module.exports = () => "NOPLAN: moduleIds: 'hashed' has been deprecated" diff --git a/tests/webpack-test/configCases/records/with-readRecords-hook/test.filter.js b/tests/webpack-test/configCases/records/with-readRecords-hook/test.filter.js index b850e5311c86..9dd5f296c1f3 100644 --- a/tests/webpack-test/configCases/records/with-readRecords-hook/test.filter.js +++ b/tests/webpack-test/configCases/records/with-readRecords-hook/test.filter.js @@ -1,2 +1 @@ -// compiler.hooks.readRecords is undefined -module.exports = () => false; +module.exports = () => "NOPLAN: cache is different with webpack"; diff --git a/tests/webpack-test/configCases/resolve/function-plugins/test.filter.js b/tests/webpack-test/configCases/resolve/function-plugins/test.filter.js index f1a5df29cfd5..4a848745db9b 100644 --- a/tests/webpack-test/configCases/resolve/function-plugins/test.filter.js +++ b/tests/webpack-test/configCases/resolve/function-plugins/test.filter.js @@ -1,2 +1,2 @@ // function plugins not executed -module.exports = () => false; +module.exports = () => "TODO: support resolve plugins"; diff --git a/tests/webpack-test/configCases/resolve/unsafe-cache-proxy/test.filter.js b/tests/webpack-test/configCases/resolve/unsafe-cache-proxy/test.filter.js index 49c33e4624c8..6dbccd84cf6f 100644 --- a/tests/webpack-test/configCases/resolve/unsafe-cache-proxy/test.filter.js +++ b/tests/webpack-test/configCases/resolve/unsafe-cache-proxy/test.filter.js @@ -1,2 +1,2 @@ // resolve.unsafeCache doesn't work with the `Proxy` -module.exports = () => false; +module.exports = () => "NOPLAN: cache is different with webpack"; diff --git a/tests/webpack-test/configCases/rule-set/oneOf/test.filter.js b/tests/webpack-test/configCases/rule-set/oneOf/test.filter.js index e3f054395a59..b9cc71111341 100644 --- a/tests/webpack-test/configCases/rule-set/oneOf/test.filter.js +++ b/tests/webpack-test/configCases/rule-set/oneOf/test.filter.js @@ -1,2 +1 @@ -// oneOf rule not taken into account -module.exports = () => false; +module.exports = () => "FIXME: oneOf rule not taken into account"; diff --git a/tests/webpack-test/statsCases/split-chunks-dedup/test.filter.js b/tests/webpack-test/statsCases/split-chunks-dedup/test.filter.js index 81294c126d30..200eb07df324 100644 --- a/tests/webpack-test/statsCases/split-chunks-dedup/test.filter.js +++ b/tests/webpack-test/statsCases/split-chunks-dedup/test.filter.js @@ -1,2 +1 @@ -// Cannot find module '../../../lib/ModuleTypeConstants' -module.exports = () => false; +module.exports = () => "NOPLAN: support webpack.optimize.MergeDuplicateChunksPlugin"; diff --git a/tests/webpack-test/statsCases/split-chunks-dedup/webpack.config.js b/tests/webpack-test/statsCases/split-chunks-dedup/webpack.config.js index 922fa14ce6a1..5072fbcc90d8 100644 --- a/tests/webpack-test/statsCases/split-chunks-dedup/webpack.config.js +++ b/tests/webpack-test/statsCases/split-chunks-dedup/webpack.config.js @@ -1,8 +1,5 @@ const webpack = require("@rspack/core"); const { ModuleFederationPlugin } = webpack.container; -const { - WEBPACK_MODULE_TYPE_PROVIDE -} = require("../../../lib/ModuleTypeConstants"); const chunkIdChunkNameMap = new Map(); const usedSharedModuleNames = new Set(); @@ -33,7 +30,8 @@ module.exports = { if (group.origins) { for (const origin of group.origins) { if ( - origin.module.type === WEBPACK_MODULE_TYPE_PROVIDE && + // CHANGE: origin.module.type === WEBPACK_MODULE_TYPE_PROVIDE + origin.module.type === "provide-module" && chunk.id ) { if (chunkIdChunkNameMap.has(chunk.id)) { diff --git a/tests/webpack-test/statsCases/track-returned/test.filter.js b/tests/webpack-test/statsCases/track-returned/test.filter.js index 7cdcae0327a2..98920f0a8d3f 100644 --- a/tests/webpack-test/statsCases/track-returned/test.filter.js +++ b/tests/webpack-test/statsCases/track-returned/test.filter.js @@ -1,2 +1 @@ -// Can't resolve 'fail' -module.exports = () => false; +module.exports = () => "FIXME: not stop walking when meeting return statement"; From d6d8facb3acb4e47a6dca010fcda79bc375e2bd5 Mon Sep 17 00:00:00 2001 From: hardfist Date: Fri, 23 May 2025 12:59:50 +0800 Subject: [PATCH 25/50] chore: unify edtion version (#10446) --- Cargo.toml | 1 + crates/node_binding/Cargo.toml | 14 ++++++------ crates/rspack/Cargo.toml | 12 +++++----- crates/rspack_allocator/Cargo.toml | 12 +++++----- crates/rspack_base64/Cargo.toml | 12 +++++----- crates/rspack_browserslist/Cargo.toml | 2 +- crates/rspack_browserslist/src/lib.rs | 2 +- crates/rspack_cacheable/Cargo.toml | 12 +++++----- crates/rspack_cacheable_test/Cargo.toml | 12 +++++----- crates/rspack_collections/Cargo.toml | 2 +- crates/rspack_core/Cargo.toml | 12 +++++----- crates/rspack_error/Cargo.toml | 12 +++++----- crates/rspack_fs/Cargo.toml | 12 +++++----- crates/rspack_futures/Cargo.toml | 12 +++++----- crates/rspack_hash/Cargo.toml | 12 +++++----- crates/rspack_hook/Cargo.toml | 22 +++++++++---------- crates/rspack_ids/Cargo.toml | 12 +++++----- crates/rspack_javascript_compiler/Cargo.toml | 2 +- crates/rspack_javascript_compiler/src/ast.rs | 4 ++-- .../src/compiler/minify.rs | 10 ++++----- .../src/compiler/mod.rs | 2 +- .../src/compiler/parse.rs | 6 ++--- .../src/compiler/stringify.rs | 13 ++++++----- .../src/compiler/transform.rs | 15 ++++++------- .../rspack_javascript_compiler/src/error.rs | 6 ++--- crates/rspack_javascript_compiler/src/lib.rs | 2 +- crates/rspack_loader_lightningcss/Cargo.toml | 12 +++++----- .../rspack_loader_preact_refresh/Cargo.toml | 12 +++++----- crates/rspack_loader_react_refresh/Cargo.toml | 12 +++++----- crates/rspack_loader_runner/Cargo.toml | 12 +++++----- crates/rspack_loader_swc/Cargo.toml | 12 +++++----- crates/rspack_loader_testing/Cargo.toml | 12 +++++----- crates/rspack_macros/Cargo.toml | 12 +++++----- crates/rspack_macros_test/Cargo.toml | 12 +++++----- crates/rspack_napi/Cargo.toml | 12 +++++----- crates/rspack_napi_macros/Cargo.toml | 12 +++++----- crates/rspack_paths/Cargo.toml | 12 +++++----- crates/rspack_plugin_asset/Cargo.toml | 12 +++++----- crates/rspack_plugin_banner/Cargo.toml | 12 +++++----- .../Cargo.toml | 12 +++++----- .../Cargo.toml | 12 +++++----- crates/rspack_plugin_copy/Cargo.toml | 12 +++++----- crates/rspack_plugin_css/Cargo.toml | 12 +++++----- crates/rspack_plugin_css_chunking/Cargo.toml | 12 +++++----- crates/rspack_plugin_devtool/Cargo.toml | 12 +++++----- crates/rspack_plugin_dll/Cargo.toml | 2 +- crates/rspack_plugin_dynamic_entry/Cargo.toml | 12 +++++----- .../Cargo.toml | 12 +++++----- crates/rspack_plugin_entry/Cargo.toml | 12 +++++----- crates/rspack_plugin_externals/Cargo.toml | 12 +++++----- crates/rspack_plugin_extract_css/Cargo.toml | 12 +++++----- crates/rspack_plugin_hmr/Cargo.toml | 12 +++++----- crates/rspack_plugin_html/Cargo.toml | 12 +++++----- crates/rspack_plugin_ignore/Cargo.toml | 12 +++++----- crates/rspack_plugin_javascript/Cargo.toml | 12 +++++----- crates/rspack_plugin_json/Cargo.toml | 12 +++++----- .../rspack_plugin_lazy_compilation/Cargo.toml | 2 +- crates/rspack_plugin_library/Cargo.toml | 2 +- .../Cargo.toml | 12 +++++----- .../Cargo.toml | 12 +++++----- .../Cargo.toml | 12 +++++----- crates/rspack_plugin_mf/Cargo.toml | 12 +++++----- .../Cargo.toml | 12 +++++----- .../Cargo.toml | 12 +++++----- crates/rspack_plugin_progress/Cargo.toml | 12 +++++----- .../Cargo.toml | 12 +++++----- .../Cargo.toml | 12 +++++----- .../Cargo.toml | 12 +++++----- crates/rspack_plugin_rsdoctor/Cargo.toml | 12 +++++----- crates/rspack_plugin_runtime/Cargo.toml | 12 +++++----- crates/rspack_plugin_runtime_chunk/Cargo.toml | 12 +++++----- crates/rspack_plugin_schemes/Cargo.toml | 12 +++++----- crates/rspack_plugin_size_limits/Cargo.toml | 12 +++++----- crates/rspack_plugin_split_chunks/Cargo.toml | 12 +++++----- crates/rspack_plugin_sri/Cargo.toml | 12 +++++----- .../rspack_plugin_swc_js_minimizer/Cargo.toml | 12 +++++----- .../Cargo.toml | 12 +++++----- crates/rspack_plugin_wasm/Cargo.toml | 12 +++++----- .../Cargo.toml | 12 +++++----- crates/rspack_plugin_worker/Cargo.toml | 12 +++++----- crates/rspack_regex/Cargo.toml | 12 +++++----- crates/rspack_storage/Cargo.toml | 12 +++++----- crates/rspack_tracing/Cargo.toml | 12 +++++----- crates/rspack_tracing_chrome/Cargo.toml | 2 +- crates/rspack_tracing_chrome/src/lib.rs | 8 +++---- crates/rspack_util/Cargo.toml | 12 +++++----- crates/swc_plugin_import/Cargo.toml | 12 +++++----- tasks/benchmark/Cargo.toml | 14 ++++++------ tasks/release-check/Cargo.toml | 2 +- 89 files changed, 470 insertions(+), 469 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 82cb93e251f3..50b98ac749db 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,6 +6,7 @@ resolver = "2" # See https://doc.rust-lang.org/cargo/referen authors = ["Rspack Teams"] categories = ["bundler", "development-tools", "web-programming"] documentation = "https://rspack.dev/" +edition = "2021" homepage = "https://rspack.dev/" license = "MIT" repository = "https://github.com/web-infra-dev/rspack" diff --git a/crates/node_binding/Cargo.toml b/crates/node_binding/Cargo.toml index be460fc9ea77..e4ecee8bc2dd 100644 --- a/crates/node_binding/Cargo.toml +++ b/crates/node_binding/Cargo.toml @@ -1,11 +1,11 @@ [package] -description = "node binding" -edition = "2021" -license = "MIT" -name = "rspack_node" -publish = false -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "node binding" +edition.workspace = true +license = "MIT" +name = "rspack_node" +publish = false +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" [lib] crate-type = ["cdylib"] diff --git a/crates/rspack/Cargo.toml b/crates/rspack/Cargo.toml index 06ab3d035c1f..de22022e4ce7 100644 --- a/crates/rspack/Cargo.toml +++ b/crates/rspack/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack" -edition = "2021" -license = "MIT" -name = "rspack" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack" +edition.workspace = true +license = "MIT" +name = "rspack" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" [features] full = ["loaders"] diff --git a/crates/rspack_allocator/Cargo.toml b/crates/rspack_allocator/Cargo.toml index 887250b81be7..ab2a0aeddc92 100644 --- a/crates/rspack_allocator/Cargo.toml +++ b/crates/rspack_allocator/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack allocator" -edition = "2021" -license = "MIT" -name = "rspack_allocator" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack allocator" +edition.workspace = true +license = "MIT" +name = "rspack_allocator" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [target.'cfg(target_os = "linux")'.dependencies] diff --git a/crates/rspack_base64/Cargo.toml b/crates/rspack_base64/Cargo.toml index 7497a5deae6c..312e9e916a75 100644 --- a/crates/rspack_base64/Cargo.toml +++ b/crates/rspack_base64/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack base64" -edition = "2021" -license = "MIT" -name = "rspack_base64" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack base64" +edition.workspace = true +license = "MIT" +name = "rspack_base64" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" [dependencies] base64-simd = { version = "0.8.0", features = ["alloc"] } diff --git a/crates/rspack_browserslist/Cargo.toml b/crates/rspack_browserslist/Cargo.toml index b2dffc054e2f..d947c861d027 100644 --- a/crates/rspack_browserslist/Cargo.toml +++ b/crates/rspack_browserslist/Cargo.toml @@ -2,7 +2,7 @@ authors.workspace = true categories.workspace = true documentation.workspace = true -edition = "2024" +edition.workspace = true homepage.workspace = true license.workspace = true name = "rspack_browserslist" diff --git a/crates/rspack_browserslist/src/lib.rs b/crates/rspack_browserslist/src/lib.rs index 0d19a2b3e427..00073cf6290b 100644 --- a/crates/rspack_browserslist/src/lib.rs +++ b/crates/rspack_browserslist/src/lib.rs @@ -3,7 +3,7 @@ use lightningcss::targets::Browsers; pub fn from_browserslist, I: IntoIterator>( query: I, ) -> Result, browserslist::Error> { - use browserslist::{Opts, resolve}; + use browserslist::{resolve, Opts}; from_distribs(resolve(query, &Opts::default())?) } diff --git a/crates/rspack_cacheable/Cargo.toml b/crates/rspack_cacheable/Cargo.toml index e7a9f69b6009..19c0f950fd36 100644 --- a/crates/rspack_cacheable/Cargo.toml +++ b/crates/rspack_cacheable/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack_cacheable" -edition = "2021" -license = "MIT" -name = "rspack_cacheable" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack_cacheable" +edition.workspace = true +license = "MIT" +name = "rspack_cacheable" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" [features] noop = [] diff --git a/crates/rspack_cacheable_test/Cargo.toml b/crates/rspack_cacheable_test/Cargo.toml index 6a48b76c271a..de6690daf7c5 100644 --- a/crates/rspack_cacheable_test/Cargo.toml +++ b/crates/rspack_cacheable_test/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack_cacheable_test" -edition = "2021" -license = "MIT" -name = "rspack_cacheable_test" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack_cacheable_test" +edition.workspace = true +license = "MIT" +name = "rspack_cacheable_test" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/rspack_collections/Cargo.toml b/crates/rspack_collections/Cargo.toml index a1a5b3df41ba..583b5a379c94 100644 --- a/crates/rspack_collections/Cargo.toml +++ b/crates/rspack_collections/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "rspack collections" documentation.workspace = true -edition = "2021" +edition.workspace = true homepage.workspace = true license = "MIT" name = "rspack_collections" diff --git a/crates/rspack_core/Cargo.toml b/crates/rspack_core/Cargo.toml index b91d032a0331..63084422e698 100644 --- a/crates/rspack_core/Cargo.toml +++ b/crates/rspack_core/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack core" -edition = "2021" -license = "MIT" -name = "rspack_core" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack core" +edition.workspace = true +license = "MIT" +name = "rspack_core" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" [dependencies] anymap = { workspace = true } diff --git a/crates/rspack_error/Cargo.toml b/crates/rspack_error/Cargo.toml index 947f303b2b7c..50b4e8f7d600 100644 --- a/crates/rspack_error/Cargo.toml +++ b/crates/rspack_error/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack error" -edition = "2021" -license = "MIT" -name = "rspack_error" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack error" +edition.workspace = true +license = "MIT" +name = "rspack_error" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] diff --git a/crates/rspack_fs/Cargo.toml b/crates/rspack_fs/Cargo.toml index 9cdaac79f590..851277bff930 100644 --- a/crates/rspack_fs/Cargo.toml +++ b/crates/rspack_fs/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack fs" -edition = "2021" -license = "MIT" -name = "rspack_fs" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack fs" +edition.workspace = true +license = "MIT" +name = "rspack_fs" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" [dependencies] async-trait = { workspace = true } diff --git a/crates/rspack_futures/Cargo.toml b/crates/rspack_futures/Cargo.toml index 011b55935bed..586c1b531b29 100644 --- a/crates/rspack_futures/Cargo.toml +++ b/crates/rspack_futures/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack futures" -edition = "2021" -license = "MIT" -name = "rspack_futures" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack futures" +edition.workspace = true +license = "MIT" +name = "rspack_futures" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" [dependencies] tokio = { workspace = true, features = ["rt"] } diff --git a/crates/rspack_hash/Cargo.toml b/crates/rspack_hash/Cargo.toml index cd77a541864a..ef0d1fd21af0 100644 --- a/crates/rspack_hash/Cargo.toml +++ b/crates/rspack_hash/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack hash" -edition = "2021" -license = "MIT" -name = "rspack_hash" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack hash" +edition.workspace = true +license = "MIT" +name = "rspack_hash" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" [dependencies] md4 = "0.10.2" diff --git a/crates/rspack_hook/Cargo.toml b/crates/rspack_hook/Cargo.toml index 6768a0c681b5..3ca5e9a45365 100644 --- a/crates/rspack_hook/Cargo.toml +++ b/crates/rspack_hook/Cargo.toml @@ -1,15 +1,15 @@ [package] -description = "rspack hook" -edition = "2021" -license = "MIT" -name = "rspack_hook" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack hook" +edition.workspace = true +license = "MIT" +name = "rspack_hook" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -async-trait = { workspace = true } -rspack_error = { workspace = true } -rspack_macros = { workspace = true } -rustc-hash = { workspace = true } -tracing = { workspace = true } +async-trait = { workspace = true } +rspack_error = { workspace = true } +rspack_macros = { workspace = true } +rustc-hash = { workspace = true } +tracing = { workspace = true } diff --git a/crates/rspack_ids/Cargo.toml b/crates/rspack_ids/Cargo.toml index 6ce074c8f5b6..b44ffa855aa9 100644 --- a/crates/rspack_ids/Cargo.toml +++ b/crates/rspack_ids/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack id implementation" -edition = "2021" -license = "MIT" -name = "rspack_ids" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack id implementation" +edition.workspace = true +license = "MIT" +name = "rspack_ids" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] diff --git a/crates/rspack_javascript_compiler/Cargo.toml b/crates/rspack_javascript_compiler/Cargo.toml index 4a7167278e85..f31c1a86d0bb 100644 --- a/crates/rspack_javascript_compiler/Cargo.toml +++ b/crates/rspack_javascript_compiler/Cargo.toml @@ -2,7 +2,7 @@ authors.workspace = true categories.workspace = true documentation.workspace = true -edition = "2024" +edition.workspace = true homepage.workspace = true license.workspace = true name = "rspack_javascript_compiler" diff --git a/crates/rspack_javascript_compiler/src/ast.rs b/crates/rspack_javascript_compiler/src/ast.rs index a0f5017e6efc..356098cdd587 100644 --- a/crates/rspack_javascript_compiler/src/ast.rs +++ b/crates/rspack_javascript_compiler/src/ast.rs @@ -2,10 +2,10 @@ use std::{hash::Hash, sync::Arc}; use rspack_error::BatchErrors; use swc_core::{ - common::{GLOBALS, Globals, Mark, SourceMap, errors::Handler, sync::Lrc, util::take::Take}, + common::{errors::Handler, sync::Lrc, util::take::Take, Globals, Mark, SourceMap, GLOBALS}, ecma::{ ast::{Module, Program as SwcProgram}, - transforms::base::helpers::{HELPERS, HelperData, Helpers}, + transforms::base::helpers::{HelperData, Helpers, HELPERS}, visit::{Fold, FoldWith, Visit, VisitMut, VisitMutWith, VisitWith}, }, }; diff --git a/crates/rspack_javascript_compiler/src/compiler/minify.rs b/crates/rspack_javascript_compiler/src/compiler/minify.rs index e1128b686e95..ecd22ca30b31 100644 --- a/crates/rspack_javascript_compiler/src/compiler/minify.rs +++ b/crates/rspack_javascript_compiler/src/compiler/minify.rs @@ -8,13 +8,13 @@ pub use swc_core::base::BoolOrDataConfig; use swc_core::{ atoms::Atom, base::{ - BoolOr, config::{IsModule, JsMinifyCommentOption, JsMinifyFormatOptions, SourceMapsConfig}, + BoolOr, }, common::{ - BytePos, FileName, Mark, comments::{Comments, SingleThreadedComments}, errors::HANDLER, + BytePos, FileName, Mark, }, ecma::{ ast::Ident, @@ -25,17 +25,17 @@ use swc_core::{ hygiene::hygiene, resolver, }, - visit::{Visit, VisitMutWith, noop_visit_type}, + visit::{noop_visit_type, Visit, VisitMutWith}, }, }; pub use swc_ecma_minifier::option::{ - MangleOptions, MinifyOptions, TopLevelOptions, terser::{TerserCompressorOptions, TerserEcmaVersion}, + MangleOptions, MinifyOptions, TopLevelOptions, }; use super::{ - JavaScriptCompiler, TransformOutput, stringify::{PrintOptions, SourceMapConfig}, + JavaScriptCompiler, TransformOutput, }; use crate::error::with_rspack_error_handler; diff --git a/crates/rspack_javascript_compiler/src/compiler/mod.rs b/crates/rspack_javascript_compiler/src/compiler/mod.rs index bfa5388d0a29..6467b83121f6 100644 --- a/crates/rspack_javascript_compiler/src/compiler/mod.rs +++ b/crates/rspack_javascript_compiler/src/compiler/mod.rs @@ -6,7 +6,7 @@ pub mod stringify; pub mod transform; use rspack_sources::SourceMap; -use swc_core::common::{GLOBALS, Globals, SourceMap as SwcSourceMap}; +use swc_core::common::{Globals, SourceMap as SwcSourceMap, GLOBALS}; #[derive(Default)] /// JavaScriptCompiler is a struct that represents a JavaScript compiler instance. diff --git a/crates/rspack_javascript_compiler/src/compiler/parse.rs b/crates/rspack_javascript_compiler/src/compiler/parse.rs index c689af371a65..8dc334304879 100644 --- a/crates/rspack_javascript_compiler/src/compiler/parse.rs +++ b/crates/rspack_javascript_compiler/src/compiler/parse.rs @@ -3,10 +3,10 @@ use std::sync::Arc; use rspack_error::BatchErrors; use swc_core::{ base::config::IsModule, - common::{FileName, SourceFile, comments::Comments, input::SourceFileInput}, + common::{comments::Comments, input::SourceFileInput, FileName, SourceFile}, ecma::{ ast::{EsVersion, Program as SwcProgram}, - parser::{self, Parser, Syntax, lexer::Lexer}, + parser::{self, lexer::Lexer, Parser, Syntax}, }, }; use swc_node_comments::SwcComments; @@ -14,7 +14,7 @@ use swc_node_comments::SwcComments; use super::JavaScriptCompiler; use crate::{ ast::{self, Ast}, - error::{DedupEcmaErrors, ecma_parse_error_deduped_to_rspack_error}, + error::{ecma_parse_error_deduped_to_rspack_error, DedupEcmaErrors}, }; impl JavaScriptCompiler { diff --git a/crates/rspack_javascript_compiler/src/compiler/stringify.rs b/crates/rspack_javascript_compiler/src/compiler/stringify.rs index 635ee075c230..2085ff0db5df 100644 --- a/crates/rspack_javascript_compiler/src/compiler/stringify.rs +++ b/crates/rspack_javascript_compiler/src/compiler/stringify.rs @@ -1,22 +1,23 @@ use std::sync::Arc; -use rspack_error::{Error, miette::IntoDiagnostic}; -use rspack_sources::{Mapping, OriginalLocation, encode_mappings}; +use rspack_error::{miette::IntoDiagnostic, Error}; +use rspack_sources::{encode_mappings, Mapping, OriginalLocation}; use rustc_hash::FxHashMap; use swc_core::{ base::{config::JsMinifyFormatOptions, sourcemap}, common::{ - BytePos, FileName, SourceMap as SwcSourceMap, comments::Comments, - source_map::SourceMapGenConfig, + comments::Comments, source_map::SourceMapGenConfig, BytePos, FileName, + SourceMap as SwcSourceMap, }, ecma::{ ast::{EsVersion, Ident, Program as SwcProgram}, atoms::Atom, codegen::{ - self, Emitter, Node, + self, text_writer::{self, WriteJs}, + Emitter, Node, }, - visit::{Visit, VisitWith, noop_visit_type}, + visit::{noop_visit_type, Visit, VisitWith}, }, }; diff --git a/crates/rspack_javascript_compiler/src/compiler/transform.rs b/crates/rspack_javascript_compiler/src/compiler/transform.rs index 4670c7a86a78..5030c20bbbd9 100644 --- a/crates/rspack_javascript_compiler/src/compiler/transform.rs +++ b/crates/rspack_javascript_compiler/src/compiler/transform.rs @@ -12,32 +12,31 @@ use std::{ sync::{Arc, LazyLock}, }; -use anyhow::{Context, bail}; +use anyhow::{bail, Context}; use base64::prelude::*; use indoc::formatdoc; use jsonc_parser::parse_to_serde_value; -use rspack_error::{AnyhowResultToRspackResultExt, Error, miette::MietteDiagnostic}; +use rspack_error::{miette::MietteDiagnostic, AnyhowResultToRspackResultExt, Error}; use rspack_util::{itoa, source_map::SourceMapKind, swc::minify_file_comments}; use serde_json::error::Category; -use swc_config::{IsModule, merge::Merge}; +use swc_config::{merge::Merge, IsModule}; pub use swc_core::base::config::Options as SwcOptions; use swc_core::{ base::{ - BoolOr, config::{ BuiltInput, Config, ConfigFile, InputSourceMap, JsMinifyCommentOption, JsMinifyFormatOptions, Rc, RootMode, SourceMapsConfig, }, - sourcemap, + sourcemap, BoolOr, }, common::{ - FileName, GLOBALS, Mark, SourceFile, SourceMap, comments::{Comments, SingleThreadedComments}, errors::Handler, + FileName, Mark, SourceFile, SourceMap, GLOBALS, }, ecma::{ ast::{EsVersion, Pass, Program}, - parser::{Syntax, parse_file_as_module, parse_file_as_program, parse_file_as_script}, + parser::{parse_file_as_module, parse_file_as_program, parse_file_as_script, Syntax}, transforms::base::helpers::{self, Helpers}, }, }; @@ -45,8 +44,8 @@ use swc_error_reporters::handler::try_with_handler; use url::Url; use super::{ - JavaScriptCompiler, TransformOutput, stringify::{PrintOptions, SourceMapConfig}, + JavaScriptCompiler, TransformOutput, }; impl JavaScriptCompiler { diff --git a/crates/rspack_javascript_compiler/src/error.rs b/crates/rspack_javascript_compiler/src/error.rs index d78618cbad0c..87127d9c7b83 100644 --- a/crates/rspack_javascript_compiler/src/error.rs +++ b/crates/rspack_javascript_compiler/src/error.rs @@ -1,14 +1,14 @@ use std::{ fmt::Debug, - sync::{Arc, mpsc}, + sync::{mpsc, Arc}, }; use rspack_cacheable::cacheable; -use rspack_error::{BatchErrors, DiagnosticKind, TraceableError, error}; +use rspack_error::{error, BatchErrors, DiagnosticKind, TraceableError}; use rustc_hash::FxHashSet as HashSet; use swc_core::common::{ + errors::{Emitter, Handler, HANDLER}, SourceFile, SourceMap, Span, Spanned, - errors::{Emitter, HANDLER, Handler}, }; /// Using `u32` instead of `usize` to reduce memory usage, diff --git a/crates/rspack_javascript_compiler/src/lib.rs b/crates/rspack_javascript_compiler/src/lib.rs index 330819d31f38..9244ddc74d0f 100644 --- a/crates/rspack_javascript_compiler/src/lib.rs +++ b/crates/rspack_javascript_compiler/src/lib.rs @@ -2,4 +2,4 @@ pub mod ast; mod compiler; mod error; -pub use compiler::{JavaScriptCompiler, TransformOutput, minify, parse, transform}; +pub use compiler::{minify, parse, transform, JavaScriptCompiler, TransformOutput}; diff --git a/crates/rspack_loader_lightningcss/Cargo.toml b/crates/rspack_loader_lightningcss/Cargo.toml index 3c221270fcb0..2ef2211305ad 100644 --- a/crates/rspack_loader_lightningcss/Cargo.toml +++ b/crates/rspack_loader_lightningcss/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack lightingcss loader" -edition = "2021" -license = "MIT" -name = "rspack_loader_lightningcss" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack lightingcss loader" +edition.workspace = true +license = "MIT" +name = "rspack_loader_lightningcss" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] diff --git a/crates/rspack_loader_preact_refresh/Cargo.toml b/crates/rspack_loader_preact_refresh/Cargo.toml index c3979229279c..aa6039cf8d7a 100644 --- a/crates/rspack_loader_preact_refresh/Cargo.toml +++ b/crates/rspack_loader_preact_refresh/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack preact refresh loader" -edition = "2021" -license = "MIT" -name = "rspack_loader_preact_refresh" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack preact refresh loader" +edition.workspace = true +license = "MIT" +name = "rspack_loader_preact_refresh" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] diff --git a/crates/rspack_loader_react_refresh/Cargo.toml b/crates/rspack_loader_react_refresh/Cargo.toml index 6cbc2cec268e..441be3c04250 100644 --- a/crates/rspack_loader_react_refresh/Cargo.toml +++ b/crates/rspack_loader_react_refresh/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack react refresh loader" -edition = "2021" -license = "MIT" -name = "rspack_loader_react_refresh" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack react refresh loader" +edition.workspace = true +license = "MIT" +name = "rspack_loader_react_refresh" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] diff --git a/crates/rspack_loader_runner/Cargo.toml b/crates/rspack_loader_runner/Cargo.toml index 41fc04b69db9..ecdadfdc919d 100644 --- a/crates/rspack_loader_runner/Cargo.toml +++ b/crates/rspack_loader_runner/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack loader runner" -edition = "2021" -license = "MIT" -name = "rspack_loader_runner" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack loader runner" +edition.workspace = true +license = "MIT" +name = "rspack_loader_runner" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" [dependencies] anymap = { workspace = true } async-trait = { workspace = true } diff --git a/crates/rspack_loader_swc/Cargo.toml b/crates/rspack_loader_swc/Cargo.toml index 00d15ca9407e..40a7b6b94912 100644 --- a/crates/rspack_loader_swc/Cargo.toml +++ b/crates/rspack_loader_swc/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack builtin swc loader" -edition = "2021" -license = "MIT" -name = "rspack_loader_swc" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack builtin swc loader" +edition.workspace = true +license = "MIT" +name = "rspack_loader_swc" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [package.metadata.cargo-shear] ignored = ["swc"] diff --git a/crates/rspack_loader_testing/Cargo.toml b/crates/rspack_loader_testing/Cargo.toml index 8afc56c41d09..ee5c77df68db 100644 --- a/crates/rspack_loader_testing/Cargo.toml +++ b/crates/rspack_loader_testing/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack loader test" -edition = "2021" -license = "MIT" -name = "rspack_loader_testing" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack loader test" +edition.workspace = true +license = "MIT" +name = "rspack_loader_testing" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] diff --git a/crates/rspack_macros/Cargo.toml b/crates/rspack_macros/Cargo.toml index 10c1da03c152..02d3d6076c47 100644 --- a/crates/rspack_macros/Cargo.toml +++ b/crates/rspack_macros/Cargo.toml @@ -1,11 +1,11 @@ [package] -description = "rspack macros" -edition = "2021" -license = "MIT" -name = "rspack_macros" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack macros" +edition.workspace = true +license = "MIT" +name = "rspack_macros" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" [lib] proc-macro = true diff --git a/crates/rspack_macros_test/Cargo.toml b/crates/rspack_macros_test/Cargo.toml index 41416166a9a3..b108a1e6ef86 100644 --- a/crates/rspack_macros_test/Cargo.toml +++ b/crates/rspack_macros_test/Cargo.toml @@ -1,11 +1,11 @@ [package] -description = "rspack macros test" -edition = "2021" -license = "MIT" -name = "rspack_macros_test" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack macros test" +edition.workspace = true +license = "MIT" +name = "rspack_macros_test" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" [dev-dependencies] async-trait = { workspace = true } rspack_cacheable = { workspace = true } diff --git a/crates/rspack_napi/Cargo.toml b/crates/rspack_napi/Cargo.toml index 698ece16494b..9f543102a41a 100644 --- a/crates/rspack_napi/Cargo.toml +++ b/crates/rspack_napi/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack napi" -edition = "2021" -license = "MIT" -name = "rspack_napi" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack napi" +edition.workspace = true +license = "MIT" +name = "rspack_napi" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] diff --git a/crates/rspack_napi_macros/Cargo.toml b/crates/rspack_napi_macros/Cargo.toml index 0be07bd93daa..8da3554b764f 100644 --- a/crates/rspack_napi_macros/Cargo.toml +++ b/crates/rspack_napi_macros/Cargo.toml @@ -1,11 +1,11 @@ [package] -description = "rspack macros plugin" -edition = "2021" -license = "MIT" -name = "rspack_napi_macros" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack macros plugin" +edition.workspace = true +license = "MIT" +name = "rspack_napi_macros" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" [lib] proc-macro = true diff --git a/crates/rspack_paths/Cargo.toml b/crates/rspack_paths/Cargo.toml index 9ad04ccaae24..a0714ba1657d 100644 --- a/crates/rspack_paths/Cargo.toml +++ b/crates/rspack_paths/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack paths" -edition = "2021" -license = "MIT" -name = "rspack_paths" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack paths" +edition.workspace = true +license = "MIT" +name = "rspack_paths" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/rspack_plugin_asset/Cargo.toml b/crates/rspack_plugin_asset/Cargo.toml index 6b4607a10104..839014033d00 100644 --- a/crates/rspack_plugin_asset/Cargo.toml +++ b/crates/rspack_plugin_asset/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack asset plugin" -edition = "2021" -license = "MIT" -name = "rspack_plugin_asset" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack asset plugin" +edition.workspace = true +license = "MIT" +name = "rspack_plugin_asset" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] diff --git a/crates/rspack_plugin_banner/Cargo.toml b/crates/rspack_plugin_banner/Cargo.toml index b67fcd1c6021..5c4b2f47d7f9 100644 --- a/crates/rspack_plugin_banner/Cargo.toml +++ b/crates/rspack_plugin_banner/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack banner plugin" -edition = "2021" -license = "MIT" -name = "rspack_plugin_banner" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack banner plugin" +edition.workspace = true +license = "MIT" +name = "rspack_plugin_banner" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] diff --git a/crates/rspack_plugin_circular_dependencies/Cargo.toml b/crates/rspack_plugin_circular_dependencies/Cargo.toml index aef2d128a729..204cc40ee459 100644 --- a/crates/rspack_plugin_circular_dependencies/Cargo.toml +++ b/crates/rspack_plugin_circular_dependencies/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack circular dependency detection plugin" -edition = "2021" -license = "MIT" -name = "rspack_plugin_circular_dependencies" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack circular dependency detection plugin" +edition.workspace = true +license = "MIT" +name = "rspack_plugin_circular_dependencies" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" [dependencies] cow-utils = { workspace = true } diff --git a/crates/rspack_plugin_context_replacement/Cargo.toml b/crates/rspack_plugin_context_replacement/Cargo.toml index 187f2112ad36..251d025830a9 100644 --- a/crates/rspack_plugin_context_replacement/Cargo.toml +++ b/crates/rspack_plugin_context_replacement/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack context replacement plugin" -edition = "2021" -license = "MIT" -name = "rspack_plugin_context_replacement" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack context replacement plugin" +edition.workspace = true +license = "MIT" +name = "rspack_plugin_context_replacement" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" [dependencies] rspack_core = { workspace = true } diff --git a/crates/rspack_plugin_copy/Cargo.toml b/crates/rspack_plugin_copy/Cargo.toml index 40f05ee3219a..366e2dabd6af 100644 --- a/crates/rspack_plugin_copy/Cargo.toml +++ b/crates/rspack_plugin_copy/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack copy plugin" -edition = "2021" -license = "MIT" -name = "rspack_plugin_copy" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack copy plugin" +edition.workspace = true +license = "MIT" +name = "rspack_plugin_copy" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" [dependencies] dashmap = { workspace = true } derive_more = { workspace = true, features = ["debug"] } diff --git a/crates/rspack_plugin_css/Cargo.toml b/crates/rspack_plugin_css/Cargo.toml index b00261cd63c6..e4acffe83891 100644 --- a/crates/rspack_plugin_css/Cargo.toml +++ b/crates/rspack_plugin_css/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack css plugin" -edition = "2021" -license = "MIT" -name = "rspack_plugin_css" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack css plugin" +edition.workspace = true +license = "MIT" +name = "rspack_plugin_css" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" [dependencies] async-trait = { workspace = true } cow-utils = { workspace = true } diff --git a/crates/rspack_plugin_css_chunking/Cargo.toml b/crates/rspack_plugin_css_chunking/Cargo.toml index 8bc5c2c0a679..53c6b34c5fa4 100644 --- a/crates/rspack_plugin_css_chunking/Cargo.toml +++ b/crates/rspack_plugin_css_chunking/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack css chunking plugin" -edition = "2021" -license = "MIT" -name = "rspack_plugin_css_chunking" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack css chunking plugin" +edition.workspace = true +license = "MIT" +name = "rspack_plugin_css_chunking" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" [dependencies] indexmap = { workspace = true } diff --git a/crates/rspack_plugin_devtool/Cargo.toml b/crates/rspack_plugin_devtool/Cargo.toml index b3ed2811e801..550e6a97ecef 100644 --- a/crates/rspack_plugin_devtool/Cargo.toml +++ b/crates/rspack_plugin_devtool/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack devtool plugin" -edition = "2021" -license = "MIT" -name = "rspack_plugin_devtool" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack devtool plugin" +edition.workspace = true +license = "MIT" +name = "rspack_plugin_devtool" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] diff --git a/crates/rspack_plugin_dll/Cargo.toml b/crates/rspack_plugin_dll/Cargo.toml index eae02cba73d7..e07446ade5bf 100644 --- a/crates/rspack_plugin_dll/Cargo.toml +++ b/crates/rspack_plugin_dll/Cargo.toml @@ -1,6 +1,6 @@ [package] description = "rspack dynamic entry plugin" -edition = "2021" +edition.workspace = true homepage.workspace = true license = "MIT" name = "rspack_plugin_dll" diff --git a/crates/rspack_plugin_dynamic_entry/Cargo.toml b/crates/rspack_plugin_dynamic_entry/Cargo.toml index 784ba84110bb..cfa71b19a564 100644 --- a/crates/rspack_plugin_dynamic_entry/Cargo.toml +++ b/crates/rspack_plugin_dynamic_entry/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack dynamic entry plugin" -edition = "2021" -license = "MIT" -name = "rspack_plugin_dynamic_entry" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack dynamic entry plugin" +edition.workspace = true +license = "MIT" +name = "rspack_plugin_dynamic_entry" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] diff --git a/crates/rspack_plugin_ensure_chunk_conditions/Cargo.toml b/crates/rspack_plugin_ensure_chunk_conditions/Cargo.toml index 62e8b5fe4636..b083cbea8d43 100644 --- a/crates/rspack_plugin_ensure_chunk_conditions/Cargo.toml +++ b/crates/rspack_plugin_ensure_chunk_conditions/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack ensure chunk conditions plugin" -edition = "2021" -license = "MIT" -name = "rspack_plugin_ensure_chunk_conditions" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack ensure chunk conditions plugin" +edition.workspace = true +license = "MIT" +name = "rspack_plugin_ensure_chunk_conditions" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] diff --git a/crates/rspack_plugin_entry/Cargo.toml b/crates/rspack_plugin_entry/Cargo.toml index 19371278d481..67a59635cf14 100644 --- a/crates/rspack_plugin_entry/Cargo.toml +++ b/crates/rspack_plugin_entry/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack entry plugin" -edition = "2021" -license = "MIT" -name = "rspack_plugin_entry" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack entry plugin" +edition.workspace = true +license = "MIT" +name = "rspack_plugin_entry" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] diff --git a/crates/rspack_plugin_externals/Cargo.toml b/crates/rspack_plugin_externals/Cargo.toml index 83446fd08652..48caa2ee0d71 100644 --- a/crates/rspack_plugin_externals/Cargo.toml +++ b/crates/rspack_plugin_externals/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack externals plugin" -edition = "2021" -license = "MIT" -name = "rspack_plugin_externals" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack externals plugin" +edition.workspace = true +license = "MIT" +name = "rspack_plugin_externals" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] diff --git a/crates/rspack_plugin_extract_css/Cargo.toml b/crates/rspack_plugin_extract_css/Cargo.toml index 6728d68632b4..7a4df2721776 100644 --- a/crates/rspack_plugin_extract_css/Cargo.toml +++ b/crates/rspack_plugin_extract_css/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack extract css plugin" -edition = "2021" -license = "MIT" -name = "rspack_plugin_extract_css" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack extract css plugin" +edition.workspace = true +license = "MIT" +name = "rspack_plugin_extract_css" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" [dependencies] async-trait = { workspace = true } cow-utils = { workspace = true } diff --git a/crates/rspack_plugin_hmr/Cargo.toml b/crates/rspack_plugin_hmr/Cargo.toml index 035ee645e81e..f650277009d1 100644 --- a/crates/rspack_plugin_hmr/Cargo.toml +++ b/crates/rspack_plugin_hmr/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack hmr plugin" -edition = "2021" -license = "MIT" -name = "rspack_plugin_hmr" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack hmr plugin" +edition.workspace = true +license = "MIT" +name = "rspack_plugin_hmr" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" [dependencies] rspack_cacheable = { workspace = true } diff --git a/crates/rspack_plugin_html/Cargo.toml b/crates/rspack_plugin_html/Cargo.toml index 264d1fa8b4d4..50f0edbde2ac 100644 --- a/crates/rspack_plugin_html/Cargo.toml +++ b/crates/rspack_plugin_html/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack html plugin" -edition = "2021" -license = "MIT" -name = "rspack_plugin_html" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack html plugin" +edition.workspace = true +license = "MIT" +name = "rspack_plugin_html" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" [features] default = [] diff --git a/crates/rspack_plugin_ignore/Cargo.toml b/crates/rspack_plugin_ignore/Cargo.toml index 2efa51ada2cd..fbc753c9fd49 100644 --- a/crates/rspack_plugin_ignore/Cargo.toml +++ b/crates/rspack_plugin_ignore/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack ignore plugin" -edition = "2021" -license = "MIT" -name = "rspack_plugin_ignore" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack ignore plugin" +edition.workspace = true +license = "MIT" +name = "rspack_plugin_ignore" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] diff --git a/crates/rspack_plugin_javascript/Cargo.toml b/crates/rspack_plugin_javascript/Cargo.toml index 5de67a2075d0..c67427e9e590 100644 --- a/crates/rspack_plugin_javascript/Cargo.toml +++ b/crates/rspack_plugin_javascript/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack javascript plugin" -edition = "2021" -license = "MIT" -name = "rspack_plugin_javascript" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack javascript plugin" +edition.workspace = true +license = "MIT" +name = "rspack_plugin_javascript" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" [dependencies] anymap = { workspace = true } async-trait = { workspace = true } diff --git a/crates/rspack_plugin_json/Cargo.toml b/crates/rspack_plugin_json/Cargo.toml index bf18a3b56485..dd6615881767 100644 --- a/crates/rspack_plugin_json/Cargo.toml +++ b/crates/rspack_plugin_json/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack json plugin" -edition = "2021" -license = "MIT" -name = "rspack_plugin_json" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack json plugin" +edition.workspace = true +license = "MIT" +name = "rspack_plugin_json" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] diff --git a/crates/rspack_plugin_lazy_compilation/Cargo.toml b/crates/rspack_plugin_lazy_compilation/Cargo.toml index 0f166a67f9c1..22e46919a95b 100644 --- a/crates/rspack_plugin_lazy_compilation/Cargo.toml +++ b/crates/rspack_plugin_lazy_compilation/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "rspack lazy compilation plugin" documentation.workspace = true -edition = "2021" +edition.workspace = true homepage.workspace = true license = "MIT" name = "rspack_plugin_lazy_compilation" diff --git a/crates/rspack_plugin_library/Cargo.toml b/crates/rspack_plugin_library/Cargo.toml index c5342562234d..9ccc5bb26ec3 100644 --- a/crates/rspack_plugin_library/Cargo.toml +++ b/crates/rspack_plugin_library/Cargo.toml @@ -1,7 +1,7 @@ [package] description = "rspack library plugin" documentation.workspace = true -edition = "2021" +edition.workspace = true homepage.workspace = true license = "MIT" name = "rspack_plugin_library" diff --git a/crates/rspack_plugin_lightning_css_minimizer/Cargo.toml b/crates/rspack_plugin_lightning_css_minimizer/Cargo.toml index c3b3a46eabb1..67e7c96898bb 100644 --- a/crates/rspack_plugin_lightning_css_minimizer/Cargo.toml +++ b/crates/rspack_plugin_lightning_css_minimizer/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack lightning css minifier plugin" -edition = "2021" -license = "MIT" -name = "rspack_plugin_lightning_css_minimizer" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack lightning css minifier plugin" +edition.workspace = true +license = "MIT" +name = "rspack_plugin_lightning_css_minimizer" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] diff --git a/crates/rspack_plugin_limit_chunk_count/Cargo.toml b/crates/rspack_plugin_limit_chunk_count/Cargo.toml index 301b3e8d9a9f..c73c6857c158 100644 --- a/crates/rspack_plugin_limit_chunk_count/Cargo.toml +++ b/crates/rspack_plugin_limit_chunk_count/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack limit chunk count plugin" -edition = "2021" -license = "MIT" -name = "rspack_plugin_limit_chunk_count" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack limit chunk count plugin" +edition.workspace = true +license = "MIT" +name = "rspack_plugin_limit_chunk_count" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] diff --git a/crates/rspack_plugin_merge_duplicate_chunks/Cargo.toml b/crates/rspack_plugin_merge_duplicate_chunks/Cargo.toml index d07b162e153e..dd1f6dbbd550 100644 --- a/crates/rspack_plugin_merge_duplicate_chunks/Cargo.toml +++ b/crates/rspack_plugin_merge_duplicate_chunks/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack merge duplicated chunks plugin" -edition = "2021" -license = "MIT" -name = "rspack_plugin_merge_duplicate_chunks" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack merge duplicated chunks plugin" +edition.workspace = true +license = "MIT" +name = "rspack_plugin_merge_duplicate_chunks" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] diff --git a/crates/rspack_plugin_mf/Cargo.toml b/crates/rspack_plugin_mf/Cargo.toml index 083bda3af390..a4ec4d7e1f9f 100644 --- a/crates/rspack_plugin_mf/Cargo.toml +++ b/crates/rspack_plugin_mf/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack module federation plugin" -edition = "2021" -license = "MIT" -name = "rspack_plugin_mf" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack module federation plugin" +edition.workspace = true +license = "MIT" +name = "rspack_plugin_mf" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] diff --git a/crates/rspack_plugin_module_info_header/Cargo.toml b/crates/rspack_plugin_module_info_header/Cargo.toml index fe1abe800b1d..50d933a5be23 100644 --- a/crates/rspack_plugin_module_info_header/Cargo.toml +++ b/crates/rspack_plugin_module_info_header/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack module info header plugin" -edition = "2021" -license = "MIT" -name = "rspack_plugin_module_info_header" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack module info header plugin" +edition.workspace = true +license = "MIT" +name = "rspack_plugin_module_info_header" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] diff --git a/crates/rspack_plugin_no_emit_on_errors/Cargo.toml b/crates/rspack_plugin_no_emit_on_errors/Cargo.toml index 58c9755be996..99470c7c93bb 100644 --- a/crates/rspack_plugin_no_emit_on_errors/Cargo.toml +++ b/crates/rspack_plugin_no_emit_on_errors/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack no emit on errors plugin" -edition = "2021" -license = "MIT" -name = "rspack_plugin_no_emit_on_errors" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack no emit on errors plugin" +edition.workspace = true +license = "MIT" +name = "rspack_plugin_no_emit_on_errors" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] diff --git a/crates/rspack_plugin_progress/Cargo.toml b/crates/rspack_plugin_progress/Cargo.toml index aa55fab492cc..e35f583bb1b3 100644 --- a/crates/rspack_plugin_progress/Cargo.toml +++ b/crates/rspack_plugin_progress/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack progress plugin" -edition = "2021" -license = "MIT" -name = "rspack_plugin_progress" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack progress plugin" +edition.workspace = true +license = "MIT" +name = "rspack_plugin_progress" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] diff --git a/crates/rspack_plugin_real_content_hash/Cargo.toml b/crates/rspack_plugin_real_content_hash/Cargo.toml index 15cb32696a7d..148ac230e42f 100644 --- a/crates/rspack_plugin_real_content_hash/Cargo.toml +++ b/crates/rspack_plugin_real_content_hash/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack real_content_hash plugin" -edition = "2021" -license = "MIT" -name = "rspack_plugin_real_content_hash" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack real_content_hash plugin" +edition.workspace = true +license = "MIT" +name = "rspack_plugin_real_content_hash" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] diff --git a/crates/rspack_plugin_remove_duplicate_modules/Cargo.toml b/crates/rspack_plugin_remove_duplicate_modules/Cargo.toml index 01ed5bf55e53..1d6800547169 100644 --- a/crates/rspack_plugin_remove_duplicate_modules/Cargo.toml +++ b/crates/rspack_plugin_remove_duplicate_modules/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "remove duplicate modules" -edition = "2021" -license = "MIT" -name = "rspack_plugin_remove_duplicate_modules" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "remove duplicate modules" +edition.workspace = true +license = "MIT" +name = "rspack_plugin_remove_duplicate_modules" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" [lints] workspace = true diff --git a/crates/rspack_plugin_remove_empty_chunks/Cargo.toml b/crates/rspack_plugin_remove_empty_chunks/Cargo.toml index a23a5b9c6226..853670a8485c 100644 --- a/crates/rspack_plugin_remove_empty_chunks/Cargo.toml +++ b/crates/rspack_plugin_remove_empty_chunks/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack remove emty chunks plugin" -edition = "2021" -license = "MIT" -name = "rspack_plugin_remove_empty_chunks" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack remove emty chunks plugin" +edition.workspace = true +license = "MIT" +name = "rspack_plugin_remove_empty_chunks" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] diff --git a/crates/rspack_plugin_rsdoctor/Cargo.toml b/crates/rspack_plugin_rsdoctor/Cargo.toml index 62f409a6b5cc..f385111e3155 100644 --- a/crates/rspack_plugin_rsdoctor/Cargo.toml +++ b/crates/rspack_plugin_rsdoctor/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack rsdoctor native plugin" -edition = "2021" -license = "MIT" -name = "rspack_plugin_rsdoctor" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack rsdoctor native plugin" +edition.workspace = true +license = "MIT" +name = "rspack_plugin_rsdoctor" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] diff --git a/crates/rspack_plugin_runtime/Cargo.toml b/crates/rspack_plugin_runtime/Cargo.toml index 00e162f06362..f34d43a8a222 100644 --- a/crates/rspack_plugin_runtime/Cargo.toml +++ b/crates/rspack_plugin_runtime/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack runtime plugin" -edition = "2021" -license = "MIT" -name = "rspack_plugin_runtime" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack runtime plugin" +edition.workspace = true +license = "MIT" +name = "rspack_plugin_runtime" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] diff --git a/crates/rspack_plugin_runtime_chunk/Cargo.toml b/crates/rspack_plugin_runtime_chunk/Cargo.toml index 056bb30c8273..c27fbc1baaeb 100644 --- a/crates/rspack_plugin_runtime_chunk/Cargo.toml +++ b/crates/rspack_plugin_runtime_chunk/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack runtime_chunk plugin" -edition = "2021" -license = "MIT" -name = "rspack_plugin_runtime_chunk" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack runtime_chunk plugin" +edition.workspace = true +license = "MIT" +name = "rspack_plugin_runtime_chunk" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] diff --git a/crates/rspack_plugin_schemes/Cargo.toml b/crates/rspack_plugin_schemes/Cargo.toml index 5d6ac1a6c556..c03b5b84acd3 100644 --- a/crates/rspack_plugin_schemes/Cargo.toml +++ b/crates/rspack_plugin_schemes/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack schemes plugin" -edition = "2021" -license = "MIT" -name = "rspack_plugin_schemes" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack schemes plugin" +edition.workspace = true +license = "MIT" +name = "rspack_plugin_schemes" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/rspack_plugin_size_limits/Cargo.toml b/crates/rspack_plugin_size_limits/Cargo.toml index c740a816b772..09922b9c73c5 100644 --- a/crates/rspack_plugin_size_limits/Cargo.toml +++ b/crates/rspack_plugin_size_limits/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack size limits plugin" -edition = "2021" -license = "MIT" -name = "rspack_plugin_size_limits" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack size limits plugin" +edition.workspace = true +license = "MIT" +name = "rspack_plugin_size_limits" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] diff --git a/crates/rspack_plugin_split_chunks/Cargo.toml b/crates/rspack_plugin_split_chunks/Cargo.toml index 82d15aa167b5..ff3ee4abb11f 100644 --- a/crates/rspack_plugin_split_chunks/Cargo.toml +++ b/crates/rspack_plugin_split_chunks/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack split chunks plugin" -edition = "2021" -license = "MIT" -name = "rspack_plugin_split_chunks" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack split chunks plugin" +edition.workspace = true +license = "MIT" +name = "rspack_plugin_split_chunks" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/rspack_plugin_sri/Cargo.toml b/crates/rspack_plugin_sri/Cargo.toml index 0c39e77f6747..73fdc0a70849 100644 --- a/crates/rspack_plugin_sri/Cargo.toml +++ b/crates/rspack_plugin_sri/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack subresource integrity plugin" -edition = "2021" -license = "MIT" -name = "rspack_plugin_sri" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack subresource integrity plugin" +edition.workspace = true +license = "MIT" +name = "rspack_plugin_sri" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] diff --git a/crates/rspack_plugin_swc_js_minimizer/Cargo.toml b/crates/rspack_plugin_swc_js_minimizer/Cargo.toml index 4e0d20b5e58b..beab67af5c21 100644 --- a/crates/rspack_plugin_swc_js_minimizer/Cargo.toml +++ b/crates/rspack_plugin_swc_js_minimizer/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack swc minifier plugin" -edition = "2021" -license = "MIT" -name = "rspack_plugin_swc_js_minimizer" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack swc minifier plugin" +edition.workspace = true +license = "MIT" +name = "rspack_plugin_swc_js_minimizer" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/rspack_plugin_warn_sensitive_module/Cargo.toml b/crates/rspack_plugin_warn_sensitive_module/Cargo.toml index 1d86d5333e98..d120f51d0707 100644 --- a/crates/rspack_plugin_warn_sensitive_module/Cargo.toml +++ b/crates/rspack_plugin_warn_sensitive_module/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack sensitive module plugin" -edition = "2021" -license = "MIT" -name = "rspack_plugin_warn_sensitive_module" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack sensitive module plugin" +edition.workspace = true +license = "MIT" +name = "rspack_plugin_warn_sensitive_module" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" [dependencies] cow-utils = { workspace = true } diff --git a/crates/rspack_plugin_wasm/Cargo.toml b/crates/rspack_plugin_wasm/Cargo.toml index 58c86712060a..bd5e99f19355 100644 --- a/crates/rspack_plugin_wasm/Cargo.toml +++ b/crates/rspack_plugin_wasm/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack wasm plugin" -edition = "2021" -license = "MIT" -name = "rspack_plugin_wasm" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack wasm plugin" +edition.workspace = true +license = "MIT" +name = "rspack_plugin_wasm" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/rspack_plugin_web_worker_template/Cargo.toml b/crates/rspack_plugin_web_worker_template/Cargo.toml index 89b95dc7efc1..9a41079a5f16 100644 --- a/crates/rspack_plugin_web_worker_template/Cargo.toml +++ b/crates/rspack_plugin_web_worker_template/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack web worker plugin" -edition = "2021" -license = "MIT" -name = "rspack_plugin_web_worker_template" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack web worker plugin" +edition.workspace = true +license = "MIT" +name = "rspack_plugin_web_worker_template" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/rspack_plugin_worker/Cargo.toml b/crates/rspack_plugin_worker/Cargo.toml index 98e9d9ead988..5570ed33c538 100644 --- a/crates/rspack_plugin_worker/Cargo.toml +++ b/crates/rspack_plugin_worker/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack plugin worker" -edition = "2021" -license = "MIT" -name = "rspack_plugin_worker" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack plugin worker" +edition.workspace = true +license = "MIT" +name = "rspack_plugin_worker" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/rspack_regex/Cargo.toml b/crates/rspack_regex/Cargo.toml index 2206ef74d6b9..dc9b0e459972 100644 --- a/crates/rspack_regex/Cargo.toml +++ b/crates/rspack_regex/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack regex" -edition = "2021" -license = "MIT" -name = "rspack_regex" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack regex" +edition.workspace = true +license = "MIT" +name = "rspack_regex" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/rspack_storage/Cargo.toml b/crates/rspack_storage/Cargo.toml index c1b2f1ab7cb7..391fffb867ce 100644 --- a/crates/rspack_storage/Cargo.toml +++ b/crates/rspack_storage/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack cache storage" -edition = "2021" -license = "MIT" -name = "rspack_storage" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack cache storage" +edition.workspace = true +license = "MIT" +name = "rspack_storage" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/rspack_tracing/Cargo.toml b/crates/rspack_tracing/Cargo.toml index c8acfea36ee2..44c910a56533 100644 --- a/crates/rspack_tracing/Cargo.toml +++ b/crates/rspack_tracing/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack tracing" -edition = "2021" -license = "MIT" -name = "rspack_tracing" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack tracing" +edition.workspace = true +license = "MIT" +name = "rspack_tracing" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [features] diff --git a/crates/rspack_tracing_chrome/Cargo.toml b/crates/rspack_tracing_chrome/Cargo.toml index 79b89f7ea5e9..af7be33bce9d 100644 --- a/crates/rspack_tracing_chrome/Cargo.toml +++ b/crates/rspack_tracing_chrome/Cargo.toml @@ -2,7 +2,7 @@ authors.workspace = true categories.workspace = true documentation.workspace = true -edition = "2024" +edition.workspace = true homepage.workspace = true license.workspace = true name = "rspack_tracing_chrome" diff --git a/crates/rspack_tracing_chrome/src/lib.rs b/crates/rspack_tracing_chrome/src/lib.rs index 347606468e83..9d9f90c1c6a3 100644 --- a/crates/rspack_tracing_chrome/src/lib.rs +++ b/crates/rspack_tracing_chrome/src/lib.rs @@ -6,20 +6,20 @@ use std::{ marker::PhantomData, path::Path, sync::{ - Arc, Mutex, atomic::{AtomicUsize, Ordering}, mpsc, mpsc::Sender, + Arc, Mutex, }, thread::JoinHandle, }; -use serde_json::{Value as JsonValue, json}; -use tracing_core::{Event, Subscriber, field::Field, span}; +use serde_json::{json, Value as JsonValue}; +use tracing_core::{field::Field, span, Event, Subscriber}; use tracing_subscriber::{ - Layer, layer::Context, registry::{LookupSpan, SpanRef}, + Layer, }; thread_local! { diff --git a/crates/rspack_util/Cargo.toml b/crates/rspack_util/Cargo.toml index db2f20f0a60e..f784777b13c8 100644 --- a/crates/rspack_util/Cargo.toml +++ b/crates/rspack_util/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "rspack util" -edition = "2021" -license = "MIT" -name = "rspack_util" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack util" +edition.workspace = true +license = "MIT" +name = "rspack_util" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/swc_plugin_import/Cargo.toml b/crates/swc_plugin_import/Cargo.toml index b58340babbf2..d986787e54f7 100644 --- a/crates/swc_plugin_import/Cargo.toml +++ b/crates/swc_plugin_import/Cargo.toml @@ -1,10 +1,10 @@ [package] -description = "babel-plugin-import rewritten in Rust" -edition = "2021" -license = "MIT" -name = "rspack_swc_plugin_import" -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "babel-plugin-import rewritten in Rust" +edition.workspace = true +license = "MIT" +name = "rspack_swc_plugin_import" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" [dependencies] cow-utils = { workspace = true } diff --git a/tasks/benchmark/Cargo.toml b/tasks/benchmark/Cargo.toml index cfcedb75d99e..e0fe02783ddd 100644 --- a/tasks/benchmark/Cargo.toml +++ b/tasks/benchmark/Cargo.toml @@ -1,11 +1,11 @@ [package] -description = "rspack benchmark tooling" -edition = "2021" -license = "MIT" -name = "rspack_benchmark" -publish = false -repository = "https://github.com/web-infra-dev/rspack" -version = "0.2.0" +description = "rspack benchmark tooling" +edition.workspace = true +license = "MIT" +name = "rspack_benchmark" +publish = false +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" [features] codspeed = ["criterion2/codspeed"] diff --git a/tasks/release-check/Cargo.toml b/tasks/release-check/Cargo.toml index 8f332cc55644..456ccab75b63 100644 --- a/tasks/release-check/Cargo.toml +++ b/tasks/release-check/Cargo.toml @@ -3,7 +3,7 @@ authors.workspace = true categories.workspace = true description = "check whether crates missing field for publish" documentation.workspace = true -edition = "2021" +edition.workspace = true homepage.workspace = true license.workspace = true name = "release-check" From 2a57382c28fd01426f560a446242a8a92b5d0335 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 23 May 2025 13:02:05 +0800 Subject: [PATCH 26/50] chore(deps): update github-actions (#10429) * chore(deps): update github-actions * chore: merge renovate groups --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: neverland --- .github/renovate.json5 | 80 +++++----------------- .github/workflows/ci-rust.yaml | 2 +- .github/workflows/issue-pr-trigger.yml | 2 +- .github/workflows/reusable-build-bench.yml | 2 +- .github/workflows/team-label.yaml | 2 +- 5 files changed, 20 insertions(+), 68 deletions(-) diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 81e5066ed66b..a2ecf48145ea 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -26,23 +26,6 @@ // always bump package.json rangeStrategy: "bump" }, - { - groupName: "github-actions", - matchManagers: ["github-actions"], - excludePackageNames: [ - "actions/upload-artifact", - "actions/download-artifact" - ] - }, - { - groupName: "ignored github-actions upload-download-actions", - matchManagers: ["github-actions"], - matchPackageNames: [ - "actions/upload-artifact", - "actions/download-artifact" - ], - enabled: false - }, { groupName: "patch crates", matchManagers: ["cargo"], @@ -76,36 +59,18 @@ matchManagers: ["npm"], matchPackageNames: ["/^@rspack/"] }, - // opentelemetry npm packages - { - groupName: "opentelemetry", - matchManagers: ["npm"], - matchPackageNames: ["/^@opentelemetry/"] - }, // Babel npm packages { groupName: "babel", matchManagers: ["npm"], matchPackageNames: ["/babel/"] }, - // Types npm packages - { - groupName: "types", - matchManagers: ["npm"], - matchPackageNames: ["/^@types/"] - }, // SWC npm packages { groupName: "SWC", matchManagers: ["npm"], matchPackageNames: ["/^@swc/"] }, - // React npm packages - { - groupName: "React", - matchManagers: ["npm"], - matchPackageNames: ["/^react/"] - }, // Rspack crates { groupName: "crate rspack_resolver", @@ -146,46 +111,33 @@ // bump major and minor in a separate PR matchUpdateTypes: ["patch"] }, - { - groupName: "webpack", - matchManagers: ["npm"], - matchPackagePrefixes: ["webpack"] - }, { // should update the playwright image in .github/workflows/reusable-build.yml groupName: "playwright", matchManagers: ["npm"], matchPackagePrefixes: ["@playwright/test"] }, + // Disable Node.js updates { - groupName: "typescript and @microsoft/api-extractor", - matchManagers: ["npm"], - matchPackageNames: [ - "typescript", - "@microsoft/api-extractor", - "@microsoft/api-extractor-model" - ], - // bump major in a separate PR - matchUpdateTypes: ["patch", "minor"] - }, - { - // linter and formatter - groupName: "@biomejs/biome and prettier", - matchManagers: ["npm"], - matchPackageNames: ["@biomejs/biome", "prettier"] + groupName: "node", + matchPackageNames: ["node"], + enabled: false }, - // Rspress npm packages { - groupName: "rspress", - matchManagers: ["npm"], - matchFileNames: ["website/package.json"], - matchPackagePrefixes: ["@rspress/", "rspress-plugin-", "rsbuild-plugin"], - matchPackageNames: ["rspress"] + groupName: "github-actions", + matchManagers: ["github-actions"], + excludePackageNames: [ + "actions/upload-artifact", + "actions/download-artifact" + ] }, - // Disable Node.js updates { - groupName: "node", - matchPackageNames: ["node"], + groupName: "ignored github-actions upload-download-actions", + matchManagers: ["github-actions"], + matchPackageNames: [ + "actions/upload-artifact", + "actions/download-artifact" + ], enabled: false } ] diff --git a/.github/workflows/ci-rust.yaml b/.github/workflows/ci-rust.yaml index 64b1cbb3fc0d..a789fffd0306 100644 --- a/.github/workflows/ci-rust.yaml +++ b/.github/workflows/ci-rust.yaml @@ -83,7 +83,7 @@ jobs: key: check - name: Install cargo-deny - uses: taiki-e/install-action@13608a19a2204ea4cc0b5888e995ab288684b613 # v2 + uses: taiki-e/install-action@52039f232923165906a3c824622a332e84ca4560 # v2 with: tool: cargo-deny@0.16 - name: Check licenses diff --git a/.github/workflows/issue-pr-trigger.yml b/.github/workflows/issue-pr-trigger.yml index 0f5fed8efa21..69b9f322c866 100644 --- a/.github/workflows/issue-pr-trigger.yml +++ b/.github/workflows/issue-pr-trigger.yml @@ -13,7 +13,7 @@ jobs: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 with: - node-version: "22.15.1" + node-version: "22.16.0" - name: Check if triggered by project member id: check_member if: github.event.sender.type == 'User' && github.actor != 'renovate' diff --git a/.github/workflows/reusable-build-bench.yml b/.github/workflows/reusable-build-bench.yml index 37be3b07549e..1974bf1f334d 100644 --- a/.github/workflows/reusable-build-bench.yml +++ b/.github/workflows/reusable-build-bench.yml @@ -42,7 +42,7 @@ jobs: key: build-bench-${{ inputs.target }} - name: Install cargo-codspeed binary - uses: taiki-e/install-action@13608a19a2204ea4cc0b5888e995ab288684b613 # v2 + uses: taiki-e/install-action@52039f232923165906a3c824622a332e84ca4560 # v2 with: tool: cargo-codspeed@2.10.1 diff --git a/.github/workflows/team-label.yaml b/.github/workflows/team-label.yaml index d02dab657091..933088ec5ace 100644 --- a/.github/workflows/team-label.yaml +++ b/.github/workflows/team-label.yaml @@ -15,6 +15,6 @@ jobs: team-labeler: runs-on: ubuntu-latest steps: - - uses: JulienKode/team-labeler-action@2c5f382e5211e2682390133617b9e7f9a05190f5 # v2.0.0 + - uses: JulienKode/team-labeler-action@2ae7f231625e352b030b6fd25386221454cec899 # v2.0.1 with: repo-token: "${{ secrets.GITHUB_TOKEN }}" From 4f9b099796d9b969baf35be3eb08c0b5dd7be66c Mon Sep 17 00:00:00 2001 From: hardfist Date: Fri, 23 May 2025 16:46:23 +0800 Subject: [PATCH 27/50] chore: add rspack_version and options to tracing (#10453) --- Cargo.lock | 1 + crates/node_binding/Cargo.toml | 1 + crates/node_binding/src/lib.rs | 6 ++++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 22bfc38466c2..c8ac690a222c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4500,6 +4500,7 @@ dependencies = [ "rspack_loader_runner", "rspack_loader_swc", "rspack_loader_testing", + "rspack_macros", "rspack_napi", "rspack_napi_macros", "rspack_paths", diff --git a/crates/node_binding/Cargo.toml b/crates/node_binding/Cargo.toml index e4ecee8bc2dd..c3b23ec40579 100644 --- a/crates/node_binding/Cargo.toml +++ b/crates/node_binding/Cargo.toml @@ -58,6 +58,7 @@ rspack_loader_react_refresh = { workspace = true } rspack_loader_runner = { workspace = true } rspack_loader_swc = { workspace = true } rspack_loader_testing = { workspace = true } +rspack_macros = { workspace = true } rspack_napi_macros = { workspace = true } rspack_plugin_asset = { workspace = true } rspack_plugin_banner = { workspace = true } diff --git a/crates/node_binding/src/lib.rs b/crates/node_binding/src/lib.rs index e8ab437e4c11..96cab43705fe 100644 --- a/crates/node_binding/src/lib.rs +++ b/crates/node_binding/src/lib.rs @@ -93,6 +93,7 @@ pub use resolver::*; use resolver_factory::*; pub use resource_data::*; pub use rsdoctor::*; +use rspack_macros::rspack_version; use rspack_tracing::{ChromeTracer, StdoutTracer, Tracer}; pub use runtime::*; use rustc_hash::FxHashMap; @@ -142,7 +143,8 @@ impl JsCompiler { intermediate_filesystem: Option, mut resolver_factory_reference: Reference, ) -> Result { - tracing::debug!("raw_options: {:#?}", &options); + tracing::info!(name:"rspack_version", version = rspack_version!()); + tracing::info!(name:"raw_options", options=?&options); let mut plugins = Vec::with_capacity(builtin_plugins.len()); let js_hooks_plugin = JsHooksAdapterPlugin::from_js_hooks(env, register_js_taps)?; @@ -164,7 +166,7 @@ impl JsCompiler { let compiler_options: rspack_core::CompilerOptions = options.try_into().to_napi_result()?; - tracing::debug!("normalized_options: {:#?}", &compiler_options); + tracing::debug!(name:"normalized_options", options=?&compiler_options); let resolver_factory = (*resolver_factory_reference).get_resolver_factory(compiler_options.resolve.clone()); From dda00298bf72d2a38bac8a2c3c6341f047bbaee5 Mon Sep 17 00:00:00 2001 From: Soon Date: Fri, 23 May 2025 16:49:08 +0800 Subject: [PATCH 28/50] docs(rspress): use @rspress/plugin-algolia for search (#10454) --- pnpm-lock.yaml | 259 ++++++++++++++++++++++++++++++++++++++ website/package.json | 1 + website/rspress.config.ts | 2 + website/theme/index.tsx | 23 +++- 4 files changed, 284 insertions(+), 1 deletion(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 660a39b4f624..16002a2bbd20 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -960,6 +960,9 @@ importers: '@rsbuild/plugin-sass': specifier: ^1.3.1 version: 1.3.1(@rsbuild/core@1.3.19) + '@rspress/plugin-algolia': + specifier: 2.0.0-beta.6 + version: 2.0.0-beta.6(@algolia/client-search@5.25.0)(@rspress/runtime@2.0.0-beta.6)(@types/react@19.1.4)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(search-insights@2.17.3) '@rspress/plugin-llms': specifier: 2.0.0-beta.6 version: 2.0.0-beta.6(@rspress/core@2.0.0-beta.6(@types/react@19.1.4)(acorn@8.14.1)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17)))) @@ -1017,6 +1020,78 @@ packages: '@actions/io@1.1.3': resolution: {integrity: sha512-wi9JjgKLYS7U/z8PPbco+PvTb/nRWjeoFlJ1Qer83k/3C5PHQi28hiVdeE2kHXmIL99mQFawx8qt/JPjZilJ8Q==} + '@algolia/autocomplete-core@1.17.9': + resolution: {integrity: sha512-O7BxrpLDPJWWHv/DLA9DRFWs+iY1uOJZkqUwjS5HSZAGcl0hIVCQ97LTLewiZmZ402JYUrun+8NqFP+hCknlbQ==} + + '@algolia/autocomplete-plugin-algolia-insights@1.17.9': + resolution: {integrity: sha512-u1fEHkCbWF92DBeB/KHeMacsjsoI0wFhjZtlCq2ddZbAehshbZST6Hs0Avkc0s+4UyBGbMDnSuXHLuvRWK5iDQ==} + peerDependencies: + search-insights: '>= 1 < 3' + + '@algolia/autocomplete-preset-algolia@1.17.9': + resolution: {integrity: sha512-Na1OuceSJeg8j7ZWn5ssMu/Ax3amtOwk76u4h5J4eK2Nx2KB5qt0Z4cOapCsxot9VcEN11ADV5aUSlQF4RhGjQ==} + peerDependencies: + '@algolia/client-search': '>= 4.9.1 < 6' + algoliasearch: '>= 4.9.1 < 6' + + '@algolia/autocomplete-shared@1.17.9': + resolution: {integrity: sha512-iDf05JDQ7I0b7JEA/9IektxN/80a2MZ1ToohfmNS3rfeuQnIKI3IJlIafD0xu4StbtQTghx9T3Maa97ytkXenQ==} + peerDependencies: + '@algolia/client-search': '>= 4.9.1 < 6' + algoliasearch: '>= 4.9.1 < 6' + + '@algolia/client-abtesting@5.25.0': + resolution: {integrity: sha512-1pfQulNUYNf1Tk/svbfjfkLBS36zsuph6m+B6gDkPEivFmso/XnRgwDvjAx80WNtiHnmeNjIXdF7Gos8+OLHqQ==} + engines: {node: '>= 14.0.0'} + + '@algolia/client-analytics@5.25.0': + resolution: {integrity: sha512-AFbG6VDJX/o2vDd9hqncj1B6B4Tulk61mY0pzTtzKClyTDlNP0xaUiEKhl6E7KO9I/x0FJF5tDCm0Hn6v5x18A==} + engines: {node: '>= 14.0.0'} + + '@algolia/client-common@5.25.0': + resolution: {integrity: sha512-il1zS/+Rc6la6RaCdSZ2YbJnkQC6W1wiBO8+SH+DE6CPMWBU6iDVzH0sCKSAtMWl9WBxoN6MhNjGBnCv9Yy2bA==} + engines: {node: '>= 14.0.0'} + + '@algolia/client-insights@5.25.0': + resolution: {integrity: sha512-blbjrUH1siZNfyCGeq0iLQu00w3a4fBXm0WRIM0V8alcAPo7rWjLbMJMrfBtzL9X5ic6wgxVpDADXduGtdrnkw==} + engines: {node: '>= 14.0.0'} + + '@algolia/client-personalization@5.25.0': + resolution: {integrity: sha512-aywoEuu1NxChBcHZ1pWaat0Plw7A8jDMwjgRJ00Mcl7wGlwuPt5dJ/LTNcg3McsEUbs2MBNmw0ignXBw9Tbgow==} + engines: {node: '>= 14.0.0'} + + '@algolia/client-query-suggestions@5.25.0': + resolution: {integrity: sha512-a/W2z6XWKjKjIW1QQQV8PTTj1TXtaKx79uR3NGBdBdGvVdt24KzGAaN7sCr5oP8DW4D3cJt44wp2OY/fZcPAVA==} + engines: {node: '>= 14.0.0'} + + '@algolia/client-search@5.25.0': + resolution: {integrity: sha512-9rUYcMIBOrCtYiLX49djyzxqdK9Dya/6Z/8sebPn94BekT+KLOpaZCuc6s0Fpfq7nx5J6YY5LIVFQrtioK9u0g==} + engines: {node: '>= 14.0.0'} + + '@algolia/ingestion@1.25.0': + resolution: {integrity: sha512-jJeH/Hk+k17Vkokf02lkfYE4A+EJX+UgnMhTLR/Mb+d1ya5WhE+po8p5a/Nxb6lo9OLCRl6w3Hmk1TX1e9gVbQ==} + engines: {node: '>= 14.0.0'} + + '@algolia/monitoring@1.25.0': + resolution: {integrity: sha512-Ls3i1AehJ0C6xaHe7kK9vPmzImOn5zBg7Kzj8tRYIcmCWVyuuFwCIsbuIIz/qzUf1FPSWmw0TZrGeTumk2fqXg==} + engines: {node: '>= 14.0.0'} + + '@algolia/recommend@5.25.0': + resolution: {integrity: sha512-79sMdHpiRLXVxSjgw7Pt4R1aNUHxFLHiaTDnN2MQjHwJ1+o3wSseb55T9VXU4kqy3m7TUme3pyRhLk5ip/S4Mw==} + engines: {node: '>= 14.0.0'} + + '@algolia/requester-browser-xhr@5.25.0': + resolution: {integrity: sha512-JLaF23p1SOPBmfEqozUAgKHQrGl3z/Z5RHbggBu6s07QqXXcazEsub5VLonCxGVqTv6a61AAPr8J1G5HgGGjEw==} + engines: {node: '>= 14.0.0'} + + '@algolia/requester-fetch@5.25.0': + resolution: {integrity: sha512-rtzXwqzFi1edkOF6sXxq+HhmRKDy7tz84u0o5t1fXwz0cwx+cjpmxu/6OQKTdOJFS92JUYHsG51Iunie7xbqfQ==} + engines: {node: '>= 14.0.0'} + + '@algolia/requester-node-http@5.25.0': + resolution: {integrity: sha512-ZO0UKvDyEFvyeJQX0gmZDQEvhLZ2X10K+ps6hViMo1HgE2V8em00SwNsQ+7E/52a+YiBkVWX61pJJJE44juDMQ==} + engines: {node: '>= 14.0.0'} + '@alloc/quick-lru@5.2.0': resolution: {integrity: sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw==} engines: {node: '>=10'} @@ -1439,6 +1514,26 @@ packages: resolution: {integrity: sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw==} engines: {node: '>=10.0.0'} + '@docsearch/css@3.9.0': + resolution: {integrity: sha512-cQbnVbq0rrBwNAKegIac/t6a8nWoUAn8frnkLFW6YARaRmAQr5/Eoe6Ln2fqkUCZ40KpdrKbpSAmgrkviOxuWA==} + + '@docsearch/react@3.9.0': + resolution: {integrity: sha512-mb5FOZYZIkRQ6s/NWnM98k879vu5pscWqTLubLFBO87igYYT4VzVazh4h5o/zCvTIZgEt3PvsCOMOswOUo9yHQ==} + peerDependencies: + '@types/react': '>= 16.8.0 < 20.0.0' + react: '>= 16.8.0 < 20.0.0' + react-dom: '>= 16.8.0 < 20.0.0' + search-insights: '>= 1 < 3' + peerDependenciesMeta: + '@types/react': + optional: true + react: + optional: true + react-dom: + optional: true + search-insights: + optional: true + '@emnapi/core@1.4.3': resolution: {integrity: sha512-4m62DuCE07lw01soJwPiBGC0nAww0Q+RY70VZ+n49yDIO13yyinhbWCeNnaob0lakDtWQzSdtNWzJeOJt2ma+g==} @@ -2799,6 +2894,12 @@ packages: resolution: {integrity: sha512-NpNhTKBIlV3O6ADhoZkgHvBFvXMW2TYlIWmIT1ysJESUBqDpaN9H3Teve5fugjU2pQ2ORBZO6SQGKliMw/8m/Q==} engines: {node: '>= 10'} + '@rspress/plugin-algolia@2.0.0-beta.6': + resolution: {integrity: sha512-IEmpJVdjauEHkB7kAGQvRDfb1igx8Neeqv7V2+sZks1N3TVWOI2f2ovskF3oDewLvfiZ7CQsVRxHbyCRUstOaA==} + engines: {node: '>=18.0.0'} + peerDependencies: + '@rspress/runtime': ^2.0.0-beta.6 + '@rspress/plugin-auto-nav-sidebar@2.0.0-beta.6': resolution: {integrity: sha512-Vn/vmEpmLUKhbPUZgo3qh+SDYyy4CWBEQEqclJjBSZho0VuQELdJBGXFxsDWoEUCuuYC5fI/qi6p7Lx+p/D66g==} engines: {node: '>=18.0.0'} @@ -3510,6 +3611,10 @@ packages: ajv@8.13.0: resolution: {integrity: sha512-PRA911Blj99jR5RMeTunVbNXMF6Lp4vZXnk5GQjcnUWUTsrXtekg/pnmFFI2u/I36Y/2bITGS30GZCXei6uNkA==} + algoliasearch@5.25.0: + resolution: {integrity: sha512-n73BVorL4HIwKlfJKb4SEzAYkR3Buwfwbh+MYxg2mloFph2fFGV58E90QTzdbfzWrLn4HE5Czx/WTjI8fcHaMg==} + engines: {node: '>= 14.0.0'} + ansi-escapes@4.3.2: resolution: {integrity: sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==} engines: {node: '>=8'} @@ -6896,6 +7001,9 @@ packages: resolution: {integrity: sha512-Gn/JaSk/Mt9gYubxTtSn/QCV4em9mpAPiR1rqy/Ocu19u/G9J5WWdNoUT4SiV6mFC3y6cxyFcFwdzPM3FgxGAQ==} engines: {node: '>= 10.13.0'} + search-insights@2.17.3: + resolution: {integrity: sha512-RQPdCYTa8A68uM2jwxoY842xDhvx3E5LFL1LxvxCNMev4o5mLuokczhzjAgGwUZBAmOKZknArSxLKmXtIi2AxQ==} + section-matter@1.0.0: resolution: {integrity: sha512-vfD3pmTzGpufjScBh50YHKzEu2lxBWhVEHsNGoEXmCmn2hKGfeNLYMzCJpe8cD7gqX7TJluOVpBkAequ6dgMmA==} engines: {node: '>=4'} @@ -7959,6 +8067,111 @@ snapshots: '@actions/io@1.1.3': {} + '@algolia/autocomplete-core@1.17.9(@algolia/client-search@5.25.0)(algoliasearch@5.25.0)(search-insights@2.17.3)': + dependencies: + '@algolia/autocomplete-plugin-algolia-insights': 1.17.9(@algolia/client-search@5.25.0)(algoliasearch@5.25.0)(search-insights@2.17.3) + '@algolia/autocomplete-shared': 1.17.9(@algolia/client-search@5.25.0)(algoliasearch@5.25.0) + transitivePeerDependencies: + - '@algolia/client-search' + - algoliasearch + - search-insights + + '@algolia/autocomplete-plugin-algolia-insights@1.17.9(@algolia/client-search@5.25.0)(algoliasearch@5.25.0)(search-insights@2.17.3)': + dependencies: + '@algolia/autocomplete-shared': 1.17.9(@algolia/client-search@5.25.0)(algoliasearch@5.25.0) + search-insights: 2.17.3 + transitivePeerDependencies: + - '@algolia/client-search' + - algoliasearch + + '@algolia/autocomplete-preset-algolia@1.17.9(@algolia/client-search@5.25.0)(algoliasearch@5.25.0)': + dependencies: + '@algolia/autocomplete-shared': 1.17.9(@algolia/client-search@5.25.0)(algoliasearch@5.25.0) + '@algolia/client-search': 5.25.0 + algoliasearch: 5.25.0 + + '@algolia/autocomplete-shared@1.17.9(@algolia/client-search@5.25.0)(algoliasearch@5.25.0)': + dependencies: + '@algolia/client-search': 5.25.0 + algoliasearch: 5.25.0 + + '@algolia/client-abtesting@5.25.0': + dependencies: + '@algolia/client-common': 5.25.0 + '@algolia/requester-browser-xhr': 5.25.0 + '@algolia/requester-fetch': 5.25.0 + '@algolia/requester-node-http': 5.25.0 + + '@algolia/client-analytics@5.25.0': + dependencies: + '@algolia/client-common': 5.25.0 + '@algolia/requester-browser-xhr': 5.25.0 + '@algolia/requester-fetch': 5.25.0 + '@algolia/requester-node-http': 5.25.0 + + '@algolia/client-common@5.25.0': {} + + '@algolia/client-insights@5.25.0': + dependencies: + '@algolia/client-common': 5.25.0 + '@algolia/requester-browser-xhr': 5.25.0 + '@algolia/requester-fetch': 5.25.0 + '@algolia/requester-node-http': 5.25.0 + + '@algolia/client-personalization@5.25.0': + dependencies: + '@algolia/client-common': 5.25.0 + '@algolia/requester-browser-xhr': 5.25.0 + '@algolia/requester-fetch': 5.25.0 + '@algolia/requester-node-http': 5.25.0 + + '@algolia/client-query-suggestions@5.25.0': + dependencies: + '@algolia/client-common': 5.25.0 + '@algolia/requester-browser-xhr': 5.25.0 + '@algolia/requester-fetch': 5.25.0 + '@algolia/requester-node-http': 5.25.0 + + '@algolia/client-search@5.25.0': + dependencies: + '@algolia/client-common': 5.25.0 + '@algolia/requester-browser-xhr': 5.25.0 + '@algolia/requester-fetch': 5.25.0 + '@algolia/requester-node-http': 5.25.0 + + '@algolia/ingestion@1.25.0': + dependencies: + '@algolia/client-common': 5.25.0 + '@algolia/requester-browser-xhr': 5.25.0 + '@algolia/requester-fetch': 5.25.0 + '@algolia/requester-node-http': 5.25.0 + + '@algolia/monitoring@1.25.0': + dependencies: + '@algolia/client-common': 5.25.0 + '@algolia/requester-browser-xhr': 5.25.0 + '@algolia/requester-fetch': 5.25.0 + '@algolia/requester-node-http': 5.25.0 + + '@algolia/recommend@5.25.0': + dependencies: + '@algolia/client-common': 5.25.0 + '@algolia/requester-browser-xhr': 5.25.0 + '@algolia/requester-fetch': 5.25.0 + '@algolia/requester-node-http': 5.25.0 + + '@algolia/requester-browser-xhr@5.25.0': + dependencies: + '@algolia/client-common': 5.25.0 + + '@algolia/requester-fetch@5.25.0': + dependencies: + '@algolia/client-common': 5.25.0 + + '@algolia/requester-node-http@5.25.0': + dependencies: + '@algolia/client-common': 5.25.0 + '@alloc/quick-lru@5.2.0': {} '@ampproject/remapping@2.3.0': @@ -8474,6 +8687,22 @@ snapshots: '@discoveryjs/json-ext@0.5.7': {} + '@docsearch/css@3.9.0': {} + + '@docsearch/react@3.9.0(@algolia/client-search@5.25.0)(@types/react@19.1.4)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(search-insights@2.17.3)': + dependencies: + '@algolia/autocomplete-core': 1.17.9(@algolia/client-search@5.25.0)(algoliasearch@5.25.0)(search-insights@2.17.3) + '@algolia/autocomplete-preset-algolia': 1.17.9(@algolia/client-search@5.25.0)(algoliasearch@5.25.0) + '@docsearch/css': 3.9.0 + algoliasearch: 5.25.0 + optionalDependencies: + '@types/react': 19.1.4 + react: 19.1.0 + react-dom: 19.1.0(react@19.1.0) + search-insights: 2.17.3 + transitivePeerDependencies: + - '@algolia/client-search' + '@emnapi/core@1.4.3': dependencies: '@emnapi/wasi-threads': 1.0.2 @@ -9765,6 +9994,18 @@ snapshots: '@rspress/mdx-rs-win32-arm64-msvc': 0.6.6 '@rspress/mdx-rs-win32-x64-msvc': 0.6.6 + '@rspress/plugin-algolia@2.0.0-beta.6(@algolia/client-search@5.25.0)(@rspress/runtime@2.0.0-beta.6)(@types/react@19.1.4)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(search-insights@2.17.3)': + dependencies: + '@docsearch/css': 3.9.0 + '@docsearch/react': 3.9.0(@algolia/client-search@5.25.0)(@types/react@19.1.4)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(search-insights@2.17.3) + '@rspress/runtime': 2.0.0-beta.6 + transitivePeerDependencies: + - '@algolia/client-search' + - '@types/react' + - react + - react-dom + - search-insights + '@rspress/plugin-auto-nav-sidebar@2.0.0-beta.6': dependencies: '@rspress/shared': 2.0.0-beta.6 @@ -10645,6 +10886,22 @@ snapshots: require-from-string: 2.0.2 uri-js: 4.4.1 + algoliasearch@5.25.0: + dependencies: + '@algolia/client-abtesting': 5.25.0 + '@algolia/client-analytics': 5.25.0 + '@algolia/client-common': 5.25.0 + '@algolia/client-insights': 5.25.0 + '@algolia/client-personalization': 5.25.0 + '@algolia/client-query-suggestions': 5.25.0 + '@algolia/client-search': 5.25.0 + '@algolia/ingestion': 1.25.0 + '@algolia/monitoring': 1.25.0 + '@algolia/recommend': 5.25.0 + '@algolia/requester-browser-xhr': 5.25.0 + '@algolia/requester-fetch': 5.25.0 + '@algolia/requester-node-http': 5.25.0 + ansi-escapes@4.3.2: dependencies: type-fest: 0.21.3 @@ -14741,6 +14998,8 @@ snapshots: ajv-formats: 2.1.1(ajv@8.13.0) ajv-keywords: 5.1.0(ajv@8.13.0) + search-insights@2.17.3: {} + section-matter@1.0.0: dependencies: extend-shallow: 2.0.1 diff --git a/website/package.json b/website/package.json index a3b168a718aa..84d280858519 100644 --- a/website/package.json +++ b/website/package.json @@ -32,6 +32,7 @@ "@rsbuild/plugin-sass": "^1.3.1", "@rspress/plugin-rss": "2.0.0-beta.6", "@rspress/plugin-llms": "2.0.0-beta.6", + "@rspress/plugin-algolia": "2.0.0-beta.6", "@shikijs/transformers": "^3.4.2", "@types/node": "^20.17.50", "@types/react": "^19.1.4", diff --git a/website/rspress.config.ts b/website/rspress.config.ts index 86abd6ce2669..941cd760cef7 100644 --- a/website/rspress.config.ts +++ b/website/rspress.config.ts @@ -1,5 +1,6 @@ import path from 'node:path'; import { pluginSass } from '@rsbuild/plugin-sass'; +import { pluginAlgolia } from '@rspress/plugin-algolia'; import { pluginLlms } from '@rspress/plugin-llms'; import { pluginRss } from '@rspress/plugin-rss'; import { transformerNotationHighlight } from '@shikijs/transformers'; @@ -40,6 +41,7 @@ export default defineConfig({ exclude: ['**/types/*.mdx'], }, plugins: [ + pluginAlgolia(), pluginLlms(), pluginSitemap({ domain: PUBLISH_URL, diff --git a/website/theme/index.tsx b/website/theme/index.tsx index d59fc577ecc6..9afbcf957c78 100644 --- a/website/theme/index.tsx +++ b/website/theme/index.tsx @@ -1,3 +1,7 @@ +import { + Search as PluginAlgoliaSearch, + ZH_LOCALES, +} from '@rspress/plugin-algolia/runtime'; import { Announcement } from '@rstack-dev/doc-ui/announcement'; import { ConfigProvider } from '@rstack-dev/doc-ui/antd'; import { NavIcon } from '@rstack-dev/doc-ui/nav-icon'; @@ -52,6 +56,23 @@ const Layout = () => { ); }; -export { Layout, HomeLayout }; +const Search = () => { + const lang = useLang(); + return ( + + ); +}; + +export { Layout, HomeLayout, Search }; export * from 'rspress/theme'; From cb7bab970462f8619e104c9fc3173dd7bcd0d6b0 Mon Sep 17 00:00:00 2001 From: hardfist Date: Fri, 23 May 2025 17:27:37 +0800 Subject: [PATCH 29/50] fix(core): fix tracing async exit early (#10455) chore: fix async exit early --- packages/rspack/src/exports.ts | 2 +- packages/rspack/src/trace/index.ts | 20 ++++++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/packages/rspack/src/exports.ts b/packages/rspack/src/exports.ts index c93ea1a43aa7..66b389a0b00c 100644 --- a/packages/rspack/src/exports.ts +++ b/packages/rspack/src/exports.ts @@ -366,7 +366,7 @@ export const experiments: Experiments = { // make sure run cleanupGlobalTrace first so we can safely append Node.js trace to it otherwise it will overlap cleanupGlobalTrace(); - JavaScriptTracer.cleanupJavaScriptTrace(); + await JavaScriptTracer.cleanupJavaScriptTrace(); } }, RemoveDuplicateModulesPlugin, diff --git a/packages/rspack/src/trace/index.ts b/packages/rspack/src/trace/index.ts index 4c4917439483..5c817d6ab844 100644 --- a/packages/rspack/src/trace/index.ts +++ b/packages/rspack/src/trace/index.ts @@ -58,8 +58,10 @@ export class JavaScriptTracer { if (!this.layer.includes("chrome")) { return; } - - this.session.post("Profiler.stop", (err, param) => { + const profileHandler = ( + err: Error | null, + param: import("node:inspector").Profiler.StopReturnType + ) => { let cpu_profile: import("node:inspector").Profiler.Profile | undefined; if (err) { console.error("Error stopping profiler:", err); @@ -111,6 +113,20 @@ export class JavaScriptTracer { // even lots of tracing tools supports json without ending ], we end it for better compat with other tools fs.writeFileSync(fd, "\n]"); fs.closeSync(fd); + }; + return new Promise((resolve, reject) => { + this.session.post("Profiler.stop", (err, params) => { + if (err) { + reject(err); + } else { + try { + profileHandler(err, params); + resolve(); + } catch (err) { + reject(err); + } + } + }); }); } // get elapsed time since start(microseconds same as rust side timestamp) From 55b01b97c028d1cb832b5d772e780a95aecebd9b Mon Sep 17 00:00:00 2001 From: Cong-Cong Pan Date: Fri, 23 May 2025 20:39:54 +0800 Subject: [PATCH 30/50] fix: loader in module user request should be resolved path (#10365) --- .../rspack_core/src/normal_module_factory.rs | 49 ++++++++++--------- crates/rspack_core/src/utils/identifier.rs | 22 ++++++--- .../module-instance/rspack.config.js | 6 +-- .../StatsTestCases.basictest.js.snap | 36 +++++++------- .../cases/loaders/no-string/errors.js | 8 +-- 5 files changed, 63 insertions(+), 58 deletions(-) diff --git a/crates/rspack_core/src/normal_module_factory.rs b/crates/rspack_core/src/normal_module_factory.rs index b97db4c51561..714a30b661b7 100644 --- a/crates/rspack_core/src/normal_module_factory.rs +++ b/crates/rspack_core/src/normal_module_factory.rs @@ -393,8 +393,15 @@ impl NormalModuleFactory { .await? }; + let mut resolved_inline_loaders = vec![]; + for l in inline_loaders { + resolved_inline_loaders + .push(resolve_each(plugin_driver, &data.context, &loader_resolver, &l).await?) + } + let user_request = { - let suffix = stringify_loaders_and_resource(&inline_loaders, &resource_data.resource); + let suffix = + stringify_loaders_and_resource(&resolved_inline_loaders, &resource_data.resource); if let Some(ResourceData { resource, .. }) = match_resource_data.as_ref() { let mut resource = resource.to_owned(); resource += "!=!"; @@ -451,7 +458,10 @@ impl NormalModuleFactory { } let mut all_loaders = Vec::with_capacity( - pre_loaders.len() + post_loaders.len() + normal_loaders.len() + inline_loaders.len(), + pre_loaders.len() + + post_loaders.len() + + normal_loaders.len() + + resolved_inline_loaders.len(), ); for l in post_loaders { @@ -459,14 +469,7 @@ impl NormalModuleFactory { .push(resolve_each(plugin_driver, &self.options.context, &loader_resolver, &l).await?) } - let mut resolved_inline_loaders = vec![]; let mut resolved_normal_loaders = vec![]; - - for l in inline_loaders { - resolved_inline_loaders - .push(resolve_each(plugin_driver, &data.context, &loader_resolver, &l).await?) - } - for l in normal_loaders { resolved_normal_loaders .push(resolve_each(plugin_driver, &self.options.context, &loader_resolver, &l).await?) @@ -485,20 +488,6 @@ impl NormalModuleFactory { .push(resolve_each(plugin_driver, &self.options.context, &loader_resolver, &l).await?) } - async fn resolve_each( - plugin_driver: &SharedPluginDriver, - context: &Context, - loader_resolver: &Resolver, - l: &ModuleRuleUseLoader, - ) -> Result>> { - plugin_driver - .normal_module_factory_hooks - .resolve_loader - .call(context, loader_resolver, l) - .await? - .ok_or_else(|| error!("Unable to resolve loader {}", l.loader)) - } - all_loaders }; @@ -902,6 +891,20 @@ impl NormalModuleFactory { } } +async fn resolve_each( + plugin_driver: &SharedPluginDriver, + context: &Context, + loader_resolver: &Resolver, + l: &ModuleRuleUseLoader, +) -> Result>> { + plugin_driver + .normal_module_factory_hooks + .resolve_loader + .call(context, loader_resolver, l) + .await? + .ok_or_else(|| error!("Unable to resolve loader {}", l.loader)) +} + /// Using `u32` instead of `usize` to reduce memory usage, /// `u32` is 4 bytes on 64bit machine, comparing to `usize` which is 8 bytes. /// ## Warning diff --git a/crates/rspack_core/src/utils/identifier.rs b/crates/rspack_core/src/utils/identifier.rs index 032d4b180a8f..85b0e3c0c9e2 100644 --- a/crates/rspack_core/src/utils/identifier.rs +++ b/crates/rspack_core/src/utils/identifier.rs @@ -4,7 +4,7 @@ use regex::Regex; use rspack_paths::Utf8Path; use rspack_util::identifier::absolute_to_request; -use crate::ModuleRuleUseLoader; +use crate::BoxLoader; pub fn contextify(context: impl AsRef, request: &str) -> String { let context = context.as_ref(); @@ -33,16 +33,22 @@ pub fn to_identifier(v: &str) -> Cow { } pub fn stringify_loaders_and_resource<'a>( - loaders: &'a [ModuleRuleUseLoader], + loaders: &'a [BoxLoader], resource: &'a str, ) -> Cow<'a, str> { if !loaders.is_empty() { - let s = loaders - .iter() - .map(|i| &*i.loader) - .collect::>() - .join("!"); - Cow::Owned(format!("{s}!{resource}")) + let mut s = String::new(); + for loader in loaders { + let identifier = loader.identifier(); + if let Some((_type, ident)) = identifier.split_once('|') { + s.push_str(ident); + } else { + s.push_str(identifier.as_str()); + } + s.push('!'); + } + s.push_str(resource); + Cow::Owned(s) } else { Cow::Borrowed(resource) } diff --git a/packages/rspack-test-tools/tests/configCases/normal-module/module-instance/rspack.config.js b/packages/rspack-test-tools/tests/configCases/normal-module/module-instance/rspack.config.js index 3b34f4b067e5..2ab6c695b9ff 100644 --- a/packages/rspack-test-tools/tests/configCases/normal-module/module-instance/rspack.config.js +++ b/packages/rspack-test-tools/tests/configCases/normal-module/module-instance/rspack.config.js @@ -20,12 +20,12 @@ class Plugin { expect(module.constructor.name).toBe("NormalModule"); expect(module.resource).toContain("index.js"); - expect(module.userRequest).toContain("index.js"); + expect(module.userRequest).toBe(`${path.join(__dirname, "passthrough-loader.js")}!${path.join(__dirname, "index.js")}`); expect(module.rawRequest).toContain("index.js"); expect(module.resourceResolveData.fragment).toBe(""); - expect(module.resourceResolveData.path).toContain("index.js"); + expect(module.resourceResolveData.path).toBe(path.join(__dirname, "index.js")); expect(module.resourceResolveData.query).toBe(""); - expect(module.resourceResolveData.resource).toContain("index.js"); + expect(module.resourceResolveData.resource).toBe(path.join(__dirname, "index.js")); expect(module.loaders.length).toBe(1); expect( module.loaders.map(({ loader }) => diff --git a/tests/webpack-test/__snapshots__/StatsTestCases.basictest.js.snap b/tests/webpack-test/__snapshots__/StatsTestCases.basictest.js.snap index 672e569f78bb..0d740f562273 100644 --- a/tests/webpack-test/__snapshots__/StatsTestCases.basictest.js.snap +++ b/tests/webpack-test/__snapshots__/StatsTestCases.basictest.js.snap @@ -507,73 +507,73 @@ Rspack x.x.x compiled successfully in X.23" exports[`StatsTestCases should print correct stats for errors-space-error 1`] = ` "assets by status xx bytes [cached] 1 asset -./loader!./index.js xx bytes [built] [code generated] [2 errors] +./loader.js!./index.js xx bytes [built] [code generated] [2 errors] -ERROR in ./index.js (./loader!./index.js) +ERROR in ./index.js (./loader.js!./index.js) × stack1stack2 │ stack3 -ERROR in ./index.js (./loader!./index.js) +ERROR in ./index.js (./loader.js!./index.js) × stack1stack2 Rspack x.x.x compiled with 2 errors in X.23 assets by status xx bytes [cached] 1 asset -./loader!./index.js xx bytes [built] [code generated] [2 errors] +./loader.js!./index.js xx bytes [built] [code generated] [2 errors] -ERROR in ./index.js (./loader!./index.js) +ERROR in ./index.js (./loader.js!./index.js) × stack1stack2 │ stack3 -ERROR in ./index.js (./loader!./index.js) +ERROR in ./index.js (./loader.js!./index.js) × stack1stack2 Rspack x.x.x compiled with 2 errors in X.23 assets by status xx bytes [cached] 1 asset -./loader!./index.js xx bytes [built] [code generated] [2 errors] +./loader.js!./index.js xx bytes [built] [code generated] [2 errors] -ERROR in ./index.js (./loader!./index.js) +ERROR in ./index.js (./loader.js!./index.js) × stack1stack2 │ stack3 -ERROR in ./index.js (./loader!./index.js) +ERROR in ./index.js (./loader.js!./index.js) × stack1stack2 Rspack x.x.x compiled with 2 errors in X.23 assets by status xx bytes [cached] 1 asset -./loader!./index.js xx bytes [built] [code generated] [2 errors] +./loader.js!./index.js xx bytes [built] [code generated] [2 errors] -ERROR in ./index.js (./loader!./index.js) +ERROR in ./index.js (./loader.js!./index.js) × stack1stack2 │ stack3 -ERROR in ./index.js (./loader!./index.js) +ERROR in ./index.js (./loader.js!./index.js) × stack1stack2 Rspack x.x.x compiled with 2 errors in X.23 assets by status xx bytes [cached] 1 asset -./loader!./index.js xx bytes [built] [code generated] [2 errors] +./loader.js!./index.js xx bytes [built] [code generated] [2 errors] -ERROR in ./index.js (./loader!./index.js) +ERROR in ./index.js (./loader.js!./index.js) × stack1stack2 │ stack3 -ERROR in ./index.js (./loader!./index.js) +ERROR in ./index.js (./loader.js!./index.js) × stack1stack2 Rspack x.x.x compiled with 2 errors in X.23 assets by status xx bytes [cached] 1 asset -./loader!./index.js xx bytes [built] [code generated] [2 errors] +./loader.js!./index.js xx bytes [built] [code generated] [2 errors] -ERROR in ./index.js (./loader!./index.js) +ERROR in ./index.js (./loader.js!./index.js) × stack1stack2 │ stack3 -ERROR in ./index.js (./loader!./index.js) +ERROR in ./index.js (./loader.js!./index.js) × stack1stack2 Rspack x.x.x compiled with 2 errors in X.23" diff --git a/tests/webpack-test/cases/loaders/no-string/errors.js b/tests/webpack-test/cases/loaders/no-string/errors.js index a4a8a891fac6..da955d44ea61 100644 --- a/tests/webpack-test/cases/loaders/no-string/errors.js +++ b/tests/webpack-test/cases/loaders/no-string/errors.js @@ -1,16 +1,12 @@ module.exports = [ [ - // CHANGE: - // { moduleName: /\.\/loaders\/no-string\/loader\.js!\.\/loaders\/no-string\/file\.js/ }, - { moduleName: /.\/loader\.js!\.\/loaders\/no-string\/file\.js/ }, + { moduleName: /\.\/loaders\/no-string\/loader\.js!\.\/loaders\/no-string\/file\.js/ }, // CHANGE: // /Module build failed: Error: Final loader \(\.\/loaders\/no-string\/loader\.js\) didn't return a Buffer or String/ /Buffer, Uint8Array or string expected/ ], [ - // CHANGE: - // { moduleName: /\.\/loaders\/no-string\/loader\.js!\.\/loaders\/no-string\/pitch-loader\.js!\.\/loaders\/no-string\/file\.js/ }, - { moduleName: /\.\/loader\.js!\.\/pitch-loader\.js!\.\/loaders\/no-string\/file\.js/ }, + { moduleName: /\.\/loaders\/no-string\/loader\.js!\.\/loaders\/no-string\/pitch-loader\.js!\.\/loaders\/no-string\/file\.js/ }, // CHANGE: // /Module build failed: Error: Final loader \(\.\/loaders\/no-string\/loader\.js\) didn't return a Buffer or String/ /Buffer, Uint8Array or string expected/ From ba8a33e45b33e2a4915537191aa5247065b15001 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 24 May 2025 16:04:34 +0800 Subject: [PATCH 31/50] chore(deps): update dependency webpack-sources to v3.3.0 (#10460) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- packages/rspack-test-tools/package.json | 2 +- packages/rspack/package.json | 2 +- pnpm-lock.yaml | 18 ++++++++++++------ tests/webpack-test/package.json | 2 +- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/packages/rspack-test-tools/package.json b/packages/rspack-test-tools/package.json index d99ffaa53040..5af0cfd22e40 100644 --- a/packages/rspack-test-tools/package.json +++ b/packages/rspack-test-tools/package.json @@ -65,7 +65,7 @@ "terser-webpack-plugin": "^5.3.14", "webpack": "5.99.9", "webpack-merge": "6.0.1", - "webpack-sources": "3.2.3" + "webpack-sources": "3.3.0" }, "devDependencies": { "@rspack/cli": "workspace:*", diff --git a/packages/rspack/package.json b/packages/rspack/package.json index 684b7f1849c4..5138144cfff6 100644 --- a/packages/rspack/package.json +++ b/packages/rspack/package.json @@ -59,7 +59,7 @@ "tsx": "^4.19.4", "typescript": "^5.8.3", "watchpack": "^2.4.3", - "webpack-sources": "3.2.3", + "webpack-sources": "3.3.0", "zod": "^3.24.4", "zod-validation-error": "3.4.1", "tinypool": "^1.0.2" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 16002a2bbd20..d7108a8e6e6b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -338,8 +338,8 @@ importers: specifier: ^2.4.3 version: 2.4.3 webpack-sources: - specifier: 3.2.3 - version: 3.2.3 + specifier: 3.3.0 + version: 3.3.0 zod: specifier: ^3.24.4 version: 3.24.4 @@ -480,8 +480,8 @@ importers: specifier: 6.0.1 version: 6.0.1 webpack-sources: - specifier: 3.2.3 - version: 3.2.3 + specifier: 3.3.0 + version: 3.3.0 devDependencies: '@rspack/cli': specifier: workspace:* @@ -839,8 +839,8 @@ importers: specifier: ^2.4.3 version: 2.4.3 webpack-sources: - specifier: 3.2.3 - version: 3.2.3 + specifier: 3.3.0 + version: 3.3.0 devDependencies: '@babel/preset-react': specifier: ^7.27.1 @@ -7841,6 +7841,10 @@ packages: resolution: {integrity: sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==} engines: {node: '>=10.13.0'} + webpack-sources@3.3.0: + resolution: {integrity: sha512-77R0RDmJfj9dyv5p3bM5pOHa+X8/ZkO9c7kpDstigkC4nIDobadsfSGCwB4bKhMVxqAok8tajaoR8rirM7+VFQ==} + engines: {node: '>=10.13.0'} + webpack@5.99.9: resolution: {integrity: sha512-brOPwM3JnmOa+7kd3NsmOUOwbDAj8FT9xDsG3IW0MgbN9yZV7Oi/s/+MNQ/EcSMqw7qfoRyXPoeEWT8zLVdVGg==} engines: {node: '>=10.13.0'} @@ -15900,6 +15904,8 @@ snapshots: webpack-sources@3.2.3: {} + webpack-sources@3.3.0: {} + webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17)): dependencies: '@types/eslint-scope': 3.7.7 diff --git a/tests/webpack-test/package.json b/tests/webpack-test/package.json index 6d89460f6369..bd25bc1dd177 100644 --- a/tests/webpack-test/package.json +++ b/tests/webpack-test/package.json @@ -55,7 +55,7 @@ "tapable": "2.2.2", "wast-loader": "^1.14.1", "watchpack": "^2.4.3", - "webpack-sources": "3.2.3", + "webpack-sources": "3.3.0", "toml": "^3.0.0" } } \ No newline at end of file From 5336d8633e934f38f19c19b3a5fd1faccc30a30d Mon Sep 17 00:00:00 2001 From: harpsealjs Date: Sat, 24 May 2025 18:46:35 +0800 Subject: [PATCH 32/50] test: ignore test cases with `NO_PLAN` status when calculating webpack test coverage (#10457) test: calculate webpack test coverage ratio --- tests/webpack-test/HotTestCases.template.js | 647 +++++++++--------- .../StatsTestCases.basictest.js.snap | 40 ++ .../cases/chunks/runtime/test.filter.js | 3 +- .../load-module-cycle-multiple/test.filter.js | 3 +- .../errors/load-module-cycle/test.filter.js | 3 +- .../errors/load-module-error/test.filter.js | 3 +- .../test.filter.js | 4 +- .../cases/large/big-assets/test.filter.js | 2 +- .../large/many-replacements/test.filter.js | 2 +- .../cases/loaders/issue-10725/test.filter.js | 3 +- .../cases/loaders/issue-2299/test.filter.js | 3 +- .../cases/loaders/issue-4959/test.filter.js | 3 +- .../harmony-injecting-order/test.filter.js | 3 +- .../cases/parsing/issue-758/test.filter.js | 3 +- .../parsing/precreated-ast/test.filter.js | 3 +- .../cases/parsing/typeof/test.filter.js | 12 +- .../cases/resolving/issue-2986/test.filter.js | 2 +- .../inside-class/test.filter.js | 4 - .../global-options/test.filter.js | 2 +- .../asset-modules/http-url/test.filter.js | 2 +- .../asset-modules/ignore/test.filter.js | 2 +- .../query-and-custom-condition/test.filter.js | 2 +- .../asset-url/target-node3/test.filter.js | 2 +- .../managed-items-unsafe-cache/test.filter.js | 4 +- .../managed-items/test.filter.js | 4 +- .../order-multiple-entries/test.filter.js | 4 +- .../configCases/clean/dry/test.filter.js | 2 +- .../clean/ignore-hook/test.filter.js | 2 +- .../configCases/clean/link/test.filter.js | 2 +- .../require-context-id/test.filter.js | 2 +- .../context-exclusion/simple/test.filter.js | 2 +- .../context-replacement/e/test.filter.js | 3 +- .../test.filter.js | 2 +- .../css/css-modules-in-node/test.filter.js | 2 +- .../localization/test.filter.js | 2 +- .../test.filter.js | 2 +- .../remove-export/test.filter.js | 2 +- .../delegated-hash/simple/test.filter.js | 2 +- .../delegated/simple/test.filter.js | 2 +- .../chunk-and-module/test.filter.js | 2 +- .../deprecations/chunk-files/test.filter.js | 2 +- .../deprecations/config/test.filter.js | 2 +- .../invalid-dependencies/test.filter.js | 2 +- .../non-unique-hash/test.filter.js | 4 +- .../3-use-dll-with-hashid/test.filter.js | 2 +- .../entry/depend-on-advanced/test.filter.js | 2 +- .../entry/weird-names/test.filter.js | 2 +- .../entry/weird-names2/test.filter.js | 2 +- .../asset-options-validation/test.filter.js | 2 +- .../errors/case-emit/test.filter.js | 2 +- .../test.filter.js | 2 +- .../deterministic-module-ids/test.filter.js | 2 +- .../hashed-module-ids/test.filter.js | 2 +- .../inner-graph/issue-12669/test.filter.js | 4 +- .../json/tree-shaking-default/test.filter.js | 4 +- .../configCases/layer/rules/test.filter.js | 4 +- .../test.filter.js | 2 +- .../loaders/options/test.filter.js | 4 +- .../loaders/pr-14384/test.filter.js | 2 +- .../mangle-with-object-prop/test.filter.js | 4 +- .../optimization/chunk/test.filter.js | 4 +- .../hashed-module-ids/test.filter.js | 4 +- .../parsing/context/test.filter.js | 2 +- .../harmony-this-concat/test.filter.js | 2 +- .../parsing/issue-14545/test.filter.js | 2 +- .../parsing/issue-2942/test.filter.js | 2 +- .../parsing/optional-chaining/test.filter.js | 4 +- .../parsing/optional/test.filter.js | 4 +- .../parsing/require-ignore/test.filter.js | 4 +- .../parsing/requirejs/test.filter.js | 4 +- .../parsing/system.import/test.filter.js | 4 +- .../banner-plugin-hashing/test.filter.js | 2 +- .../lib-manifest-plugin/test.filter.js | 4 +- .../plugins/min-chunk-size/test.filter.js | 4 +- .../mini-css-extract-plugin/test.filter.js | 4 +- .../plugins/profiling-plugin/test.filter.js | 4 +- .../plugins/progress-plugin/test.filter.js | 4 +- .../process-assets/html-plugin/test.filter.js | 4 +- .../load-module/test.filter.js | 4 +- .../records/issue-295/test.filter.js | 4 +- .../records/issue-2991/test.filter.js | 4 +- .../records/issue-7339/test.filter.js | 4 +- .../records/issue-7492/test.filter.js | 4 +- .../records/stable-sort/test.filter.js | 4 +- .../require/module-require/test.filter.js | 4 +- .../resolve-merging/override/test.filter.js | 4 +- .../test.filter.js | 4 +- .../empty-context-module/test.filter.js | 2 +- .../issue-11335-context-module/test.filter.js | 2 +- .../resolve/only-module/test.filter.js | 2 +- .../resolving/prefer-absolute/test.filter.js | 2 +- .../rule-set/chaining/test.filter.js | 4 +- .../rule-set/compiler/test.filter.js | 4 +- .../rule-set/custom/test.filter.js | 4 +- .../simple-use-array-fn/test.filter.js | 4 +- .../simple-use-fn-array/test.filter.js | 4 +- .../rule-set/simple/test.filter.js | 4 +- .../scope-hoisting/dll-plugin/test.filter.js | 4 +- .../test.filter.js | 4 +- .../test.filter.js | 4 +- .../side-effects/url/test.filter.js | 4 +- .../context-module-source-path/test.filter.js | 4 +- .../exclude-modules-source-map/test.filter.js | 4 +- .../test.filter.js | 4 +- .../configCases/utils/lazy-set/test.filter.js | 4 +- .../configCases/wasm/identical/test.filter.js | 2 +- .../missing-wasm-experiment/test.filter.js | 4 +- .../test.filter.js | 4 +- .../test.filter.js | 4 +- .../web/node-source-global/test.filter.js | 2 +- .../worker/self-import/test.filter.js | 2 +- .../loader-import-module/css/test.filter.js | 3 +- .../runtime/root-error/test.filter.js | 3 +- tests/webpack-test/lib/util/filterUtil.js | 30 +- .../webpack-test/scripts/test-metric-util.js | 13 +- .../aggressive-splitting-entry/test.filter.js | 3 +- .../named-chunks-plugin-async/test.filter.js | 3 +- .../test.filter.js | 6 +- .../cache/add-defines/test.filter.js | 10 +- .../child-compilation-cache/test.filter.js | 3 +- .../cache/loader-import-module/test.filter.js | 5 +- .../cache/managedPath/test.filter.js | 4 +- .../unsafe-cache-duplicates/test.filter.js | 4 +- .../test.filter.js | 3 +- .../automatic-prefetch-plugin/test.filter.js | 3 +- .../plugins/define-plugin/test.filter.js | 3 +- .../dll-reference-plugin/test.filter.js | 4 +- .../plugins/profiling-plugin/test.filter.js | 3 +- .../watch-ignore-plugin/test.filter.js | 3 +- .../resolve/in-loader/test.filter.js | 3 +- 130 files changed, 568 insertions(+), 567 deletions(-) diff --git a/tests/webpack-test/HotTestCases.template.js b/tests/webpack-test/HotTestCases.template.js index 184a286a949e..28fc0647a487 100644 --- a/tests/webpack-test/HotTestCases.template.js +++ b/tests/webpack-test/HotTestCases.template.js @@ -9,6 +9,7 @@ const rimraf = require("rimraf"); const checkArrayExpectation = require("./checkArrayExpectation"); const createLazyTestEnv = require("./helpers/createLazyTestEnv"); const FakeDocument = require("./helpers/FakeDocument"); +const { createFilteredDescribe } = require("./lib/util/filterUtil") const casesPath = path.join(__dirname, "hotCases"); let categories = fs @@ -28,12 +29,8 @@ const describeCases = config => { for (const testName of category.tests) { const testDirectory = path.join(casesPath, category.name, testName); const filterPath = path.join(testDirectory, "test.filter.js"); - if (fs.existsSync(filterPath) && !require(filterPath)(config)) { - // eslint-disable-next-line jest/no-disabled-tests - describe.skip(testName, () => { - it("filtered", () => {}); - }); - continue; + if (!createFilteredDescribe(testName, filterPath, config)) { + return; } describe(testName, () => { let compiler; @@ -42,354 +39,354 @@ const describeCases = config => { compiler = undefined; }); - it(`${testName} should compile`, done => { - const webpack = require("@rspack/core"); - const outputDirectory = path.join( + it(`${testName} should compile`, done => { + const webpack = require("@rspack/core"); + const outputDirectory = path.join( + __dirname, + "js", + `hot-cases-${config.name}`, + category.name, + testName + ); + rimraf.sync(outputDirectory); + const recordsPath = path.join(outputDirectory, "records.json"); + const fakeUpdateLoaderOptions = { + updateIndex: 0 + }; + const configPath = path.join(testDirectory, "webpack.config.js"); + let options = {}; + if (fs.existsSync(configPath)) options = require(configPath); + if (typeof options === "function") { + options = options({ config }); + } + if (!options.mode) options.mode = "development"; + if (!options.devtool) options.devtool = false; + if (!options.context) options.context = testDirectory; + if (!options.entry) options.entry = "./index.js"; + if (!options.output) options.output = {}; + if (!options.output.path) options.output.path = outputDirectory; + if (!options.output.filename) + options.output.filename = "bundle.js"; + if (!options.output.chunkFilename) + options.output.chunkFilename = "[name].chunk.[fullhash].js"; + if (options.output.pathinfo === undefined) + options.output.pathinfo = true; + if (options.output.publicPath === undefined) + options.output.publicPath = "https://test.cases/path/"; + if (options.output.library === undefined) + options.output.library = { type: "commonjs2" }; + if (!options.optimization) options.optimization = {}; + if (!options.optimization.moduleIds) + options.optimization.moduleIds = "named"; + if (!options.module) options.module = {}; + if (!options.module.rules) options.module.rules = []; + options.module.rules.push({ + loader: path.join( __dirname, - "js", - `hot-cases-${config.name}`, - category.name, - testName + "hotCases", + "fake-update-loader.js" + ), + enforce: "pre" + }); + if (!options.target) options.target = config.target; + if (!options.plugins) options.plugins = []; + options.plugins.push( + new webpack.HotModuleReplacementPlugin(), + new webpack.LoaderOptionsPlugin(fakeUpdateLoaderOptions) + ); + if (!options.recordsPath) options.recordsPath = recordsPath; + let testConfig = {}; + try { + // try to load a test file + testConfig = Object.assign( + testConfig, + require(path.join(testDirectory, "test.config.js")) ); - rimraf.sync(outputDirectory); - const recordsPath = path.join(outputDirectory, "records.json"); - const fakeUpdateLoaderOptions = { - updateIndex: 0 - }; - const configPath = path.join(testDirectory, "webpack.config.js"); - let options = {}; - if (fs.existsSync(configPath)) options = require(configPath); - if (typeof options === "function") { - options = options({ config }); - } - if (!options.mode) options.mode = "development"; - if (!options.devtool) options.devtool = false; - if (!options.context) options.context = testDirectory; - if (!options.entry) options.entry = "./index.js"; - if (!options.output) options.output = {}; - if (!options.output.path) options.output.path = outputDirectory; - if (!options.output.filename) - options.output.filename = "bundle.js"; - if (!options.output.chunkFilename) - options.output.chunkFilename = "[name].chunk.[fullhash].js"; - if (options.output.pathinfo === undefined) - options.output.pathinfo = true; - if (options.output.publicPath === undefined) - options.output.publicPath = "https://test.cases/path/"; - if (options.output.library === undefined) - options.output.library = { type: "commonjs2" }; - if (!options.optimization) options.optimization = {}; - if (!options.optimization.moduleIds) - options.optimization.moduleIds = "named"; - if (!options.module) options.module = {}; - if (!options.module.rules) options.module.rules = []; - options.module.rules.push({ - loader: path.join( - __dirname, - "hotCases", - "fake-update-loader.js" - ), - enforce: "pre" + } catch (_err) { + // ignored + } + + const onCompiled = (err, stats) => { + if (err) return done(err); + const jsonStats = stats.toJson({ + errorDetails: true }); - if (!options.target) options.target = config.target; - if (!options.plugins) options.plugins = []; - options.plugins.push( - new webpack.HotModuleReplacementPlugin(), - new webpack.LoaderOptionsPlugin(fakeUpdateLoaderOptions) - ); - if (!options.recordsPath) options.recordsPath = recordsPath; - let testConfig = {}; - try { - // try to load a test file - testConfig = Object.assign( - testConfig, - require(path.join(testDirectory, "test.config.js")) - ); - } catch (_err) { - // ignored + if ( + checkArrayExpectation( + testDirectory, + jsonStats, + "error", + "Error", + options, + done + ) + ) { + return; + } + if ( + checkArrayExpectation( + testDirectory, + jsonStats, + "warning", + "Warning", + options, + done + ) + ) { + return; } - const onCompiled = (err, stats) => { - if (err) return done(err); - const jsonStats = stats.toJson({ - errorDetails: true - }); - if ( - checkArrayExpectation( - testDirectory, - jsonStats, - "error", - "Error", - options, - done - ) - ) { - return; - } - if ( - checkArrayExpectation( - testDirectory, - jsonStats, - "warning", - "Warning", - options, - done - ) - ) { - return; - } - - const urlToPath = url => { - if (url.startsWith("https://test.cases/path/")) - url = url.slice(24); - return path.resolve(outputDirectory, `./${url}`); - }; - const urlToRelativePath = url => { - if (url.startsWith("https://test.cases/path/")) - url = url.slice(24); - return `./${url}`; - }; - const window = { - _elements: [], - fetch: async url => { - try { - const buffer = await new Promise((resolve, reject) => { - fs.readFile(urlToPath(url), (err, b) => - err ? reject(err) : resolve(b) - ); - }); + const urlToPath = url => { + if (url.startsWith("https://test.cases/path/")) + url = url.slice(24); + return path.resolve(outputDirectory, `./${url}`); + }; + const urlToRelativePath = url => { + if (url.startsWith("https://test.cases/path/")) + url = url.slice(24); + return `./${url}`; + }; + const window = { + _elements: [], + fetch: async url => { + try { + const buffer = await new Promise((resolve, reject) => { + fs.readFile(urlToPath(url), (err, b) => + err ? reject(err) : resolve(b) + ); + }); + return { + status: 200, + ok: true, + json: async () => JSON.parse(buffer.toString("utf-8")) + }; + } catch (err) { + if (err.code === "ENOENT") { return { - status: 200, - ok: true, - json: async () => JSON.parse(buffer.toString("utf-8")) + status: 404, + ok: false }; - } catch (err) { - if (err.code === "ENOENT") { - return { - status: 404, - ok: false - }; - } - throw err; } - }, - importScripts: url => { - expect(url).toMatch(/^https:\/\/test\.cases\/path\//); - _require(urlToRelativePath(url)); - }, - document: { - createElement(type) { - const ele = { - _type: type, - getAttribute(name) { - return this[name]; - }, - setAttribute(name, value) { - this[name] = value; - }, - removeAttribute(name) { - delete this[name]; - }, - parentNode: { - removeChild(node) { - window._elements = window._elements.filter( - item => item !== node - ); - } - } - }; - ele.sheet = - type === "link" - ? new FakeDocument.FakeSheet(ele, outputDirectory) - : {}; - return ele; - }, - head: { - appendChild(element) { - window._elements.push(element); - - if (element._type === "script") { - // run it - Promise.resolve().then(() => { - _require(urlToRelativePath(element.src)); - }); - } else if (element._type === "link") { - Promise.resolve().then(() => { - if (element.onload) { - // run it - element.onload({ type: "load" }); - } - }); - } + throw err; + } + }, + importScripts: url => { + expect(url).toMatch(/^https:\/\/test\.cases\/path\//); + _require(urlToRelativePath(url)); + }, + document: { + createElement(type) { + const ele = { + _type: type, + getAttribute(name) { + return this[name]; + }, + setAttribute(name, value) { + this[name] = value; }, - insertBefore(element, before) { - window._elements.push(element); + removeAttribute(name) { + delete this[name]; + }, + parentNode: { + removeChild(node) { + window._elements = window._elements.filter( + item => item !== node + ); + } + } + }; + ele.sheet = + type === "link" + ? new FakeDocument.FakeSheet(ele, outputDirectory) + : {}; + return ele; + }, + head: { + appendChild(element) { + window._elements.push(element); - if (element._type === "script") { - // run it - Promise.resolve().then(() => { - _require(urlToRelativePath(element.src)); - }); - } else if (element._type === "link") { - // run it - Promise.resolve().then(() => { + if (element._type === "script") { + // run it + Promise.resolve().then(() => { + _require(urlToRelativePath(element.src)); + }); + } else if (element._type === "link") { + Promise.resolve().then(() => { + if (element.onload) { + // run it element.onload({ type: "load" }); - }); - } + } + }); } }, - getElementsByTagName(name) { - if (name === "head") return [this.head]; - if (name === "script" || name === "link") { - return window._elements.filter( - item => item._type === name - ); - } + insertBefore(element, before) { + window._elements.push(element); - throw new Error("Not supported"); + if (element._type === "script") { + // run it + Promise.resolve().then(() => { + _require(urlToRelativePath(element.src)); + }); + } else if (element._type === "link") { + // run it + Promise.resolve().then(() => { + element.onload({ type: "load" }); + }); + } } }, - Worker: require("./helpers/createFakeWorker")({ - outputDirectory - }), - EventSource: require("./helpers/EventSourceForNode"), - location: { - href: "https://test.cases/path/index.html", - origin: "https://test.cases", - toString() { - return "https://test.cases/path/index.html"; + getElementsByTagName(name) { + if (name === "head") return [this.head]; + if (name === "script" || name === "link") { + return window._elements.filter( + item => item._type === name + ); } + + throw new Error("Not supported"); + } + }, + Worker: require("./helpers/createFakeWorker")({ + outputDirectory + }), + EventSource: require("./helpers/EventSourceForNode"), + location: { + href: "https://test.cases/path/index.html", + origin: "https://test.cases", + toString() { + return "https://test.cases/path/index.html"; } - }; + } + }; - const moduleScope = { - window - }; + const moduleScope = { + window + }; - if (testConfig.moduleScope) { - testConfig.moduleScope(moduleScope, options); - } + if (testConfig.moduleScope) { + testConfig.moduleScope(moduleScope, options); + } - function _next(callback) { - fakeUpdateLoaderOptions.updateIndex++; - compiler.run((err, stats) => { - if (err) return callback(err); - const jsonStats = stats.toJson({ - errorDetails: true - }); - if ( - checkArrayExpectation( - testDirectory, - jsonStats, - "error", - `errors${fakeUpdateLoaderOptions.updateIndex}`, - "Error", - options, - callback - ) - ) { - return; - } - if ( - checkArrayExpectation( - testDirectory, - jsonStats, - "warning", - `warnings${fakeUpdateLoaderOptions.updateIndex}`, - "Warning", - options, - callback - ) - ) { - return; - } - callback(null, jsonStats); + function _next(callback) { + fakeUpdateLoaderOptions.updateIndex++; + compiler.run((err, stats) => { + if (err) return callback(err); + const jsonStats = stats.toJson({ + errorDetails: true }); - } + if ( + checkArrayExpectation( + testDirectory, + jsonStats, + "error", + `errors${fakeUpdateLoaderOptions.updateIndex}`, + "Error", + options, + callback + ) + ) { + return; + } + if ( + checkArrayExpectation( + testDirectory, + jsonStats, + "warning", + `warnings${fakeUpdateLoaderOptions.updateIndex}`, + "Warning", + options, + callback + ) + ) { + return; + } + callback(null, jsonStats); + }); + } - function _require(module) { - if (module.startsWith("./")) { - const p = path.join(outputDirectory, module); - if (module.endsWith(".css")) { - return fs.readFileSync(p, "utf-8"); - } - if (module.endsWith(".json")) { - return JSON.parse(fs.readFileSync(p, "utf-8")); - } - const fn = vm.runInThisContext( - "(function(require, module, exports, __dirname, __filename, it, beforeEach, afterEach, expect, jest, self, window, fetch, document, importScripts, Worker, EventSource, NEXT, STATS) {" + - "global.expect = expect;" + - `function nsObj(m) { Object.defineProperty(m, Symbol.toStringTag, { value: "Module" }); return m; }${fs.readFileSync( - p, - "utf-8" - )}\n})`, - p - ); - const m = { - exports: {} - }; - fn.call( - m.exports, - _require, - m, - m.exports, - outputDirectory, - p, - _it, - _beforeEach, - _afterEach, - expect, - jest, - window, - window, - window.fetch, - window.document, - window.importScripts, - window.Worker, - window.EventSource, - _next, - jsonStats - ); - return m.exports; + function _require(module) { + if (module.startsWith("./")) { + const p = path.join(outputDirectory, module); + if (module.endsWith(".css")) { + return fs.readFileSync(p, "utf-8"); } - return require(module); - } - let promise = Promise.resolve(); - const info = stats.toJson({ all: false, entrypoints: true }); - if (config.target === "web") { - for (const file of info.entrypoints.main.assets) { - if (file.name.endsWith(".css")) { - const link = window.document.createElement("link"); - link.href = path.join(outputDirectory, file.name); - window.document.head.appendChild(link); - } else { - _require(`./${file.name}`); - } + if (module.endsWith(".json")) { + return JSON.parse(fs.readFileSync(p, "utf-8")); } - } else { - const assets = info.entrypoints.main.assets; - const result = _require( - `./${assets[assets.length - 1].name}` + const fn = vm.runInThisContext( + "(function(require, module, exports, __dirname, __filename, it, beforeEach, afterEach, expect, jest, self, window, fetch, document, importScripts, Worker, EventSource, NEXT, STATS) {" + + "global.expect = expect;" + + `function nsObj(m) { Object.defineProperty(m, Symbol.toStringTag, { value: "Module" }); return m; }${fs.readFileSync( + p, + "utf-8" + )}\n})`, + p ); - if (typeof result === "object" && "then" in result) - promise = promise.then(() => result); + const m = { + exports: {} + }; + fn.call( + m.exports, + _require, + m, + m.exports, + outputDirectory, + p, + _it, + _beforeEach, + _afterEach, + expect, + jest, + window, + window, + window.fetch, + window.document, + window.importScripts, + window.Worker, + window.EventSource, + _next, + jsonStats + ); + return m.exports; } - promise.then( - () => { - if (getNumberOfTests() < 1) - return done(new Error("No tests exported by test case")); - - done(); - }, - err => { - console.log(err); - done(err); + return require(module); + } + let promise = Promise.resolve(); + const info = stats.toJson({ all: false, entrypoints: true }); + if (config.target === "web") { + for (const file of info.entrypoints.main.assets) { + if (file.name.endsWith(".css")) { + const link = window.document.createElement("link"); + link.href = path.join(outputDirectory, file.name); + window.document.head.appendChild(link); + } else { + _require(`./${file.name}`); } + } + } else { + const assets = info.entrypoints.main.assets; + const result = _require( + `./${assets[assets.length - 1].name}` ); - }; - compiler = webpack(options); - compiler.run(onCompiled); - }, 20000); + if (typeof result === "object" && "then" in result) + promise = promise.then(() => result); + } + promise.then( + () => { + if (getNumberOfTests() < 1) + return done(new Error("No tests exported by test case")); + + done(); + }, + err => { + console.log(err); + done(err); + } + ); + }; + compiler = webpack(options); + compiler.run(onCompiled); + }, 20000); const { it: _it, diff --git a/tests/webpack-test/__snapshots__/StatsTestCases.basictest.js.snap b/tests/webpack-test/__snapshots__/StatsTestCases.basictest.js.snap index 0d740f562273..986666fe51e8 100644 --- a/tests/webpack-test/__snapshots__/StatsTestCases.basictest.js.snap +++ b/tests/webpack-test/__snapshots__/StatsTestCases.basictest.js.snap @@ -2914,6 +2914,46 @@ WARNING in ./index.js Rspack x.x.x compiled with 1 warning in X.23" `; +exports[`StatsTestCases should print correct stats for wasm-explorer-examples-sync 1`] = ` +"assets by path *.wasm xx KiB + asset a0f3fcadb09a1a9b.module.wasm xx bytes [emitted] [immutable] + asset 4d75fb9d421cb1ec.module.wasm xx bytes [emitted] [immutable] + asset 448bdf8d3829b42d.module.wasm xx bytes [emitted] [immutable] + asset 28c603ffa1d25701.module.wasm xx bytes [emitted] [immutable] + asset 4f244726a350135b.module.wasm xx bytes [emitted] [immutable] + asset 934e4a526f464eac.module.wasm xx bytes [emitted] [immutable] +assets by path *.js xx KiB + asset bundle.js xx KiB [emitted] (name: main) + asset 718.bundle.js xx KiB [emitted] + asset 159.bundle.js xx bytes [emitted] (id hint: vendors) +chunk (runtime: main) 159.bundle.js (id hint: vendors) xx bytes [rendered] split chunk (cache group: defaultVendors) + ./node_modules/env.js xx bytes [built] [code generated] +chunk (runtime: main) 28c603ffa1d25701.module.wasm, 448bdf8d3829b42d.module.wasm, 4d75fb9d421cb1ec.module.wasm, 4f244726a350135b.module.wasm, 718.bundle.js, 934e4a526f464eac.module.wasm, a0f3fcadb09a1a9b.module.wasm xx KiB (javascript) xx KiB (wasm) [rendered] + ./Q_rsqrt.wasm xx bytes (wasm) xx bytes (javascript) [dependent] [built] [code generated] + ./duff.wasm xx bytes (wasm) xx bytes (javascript) [dependent] [built] [code generated] + ./fact.wasm xx bytes (wasm) xx bytes (javascript) [dependent] [built] [code generated] + ./fast-math.wasm xx bytes (wasm) xx bytes (javascript) [dependent] [built] [code generated] + ./popcnt.wasm xx bytes (wasm) xx bytes (javascript) [dependent] [built] [code generated] + ./testFunction.wasm xx bytes (wasm) xx bytes (javascript) [dependent] [built] [code generated] + ./tests.js xx KiB [built] [code generated] +chunk (runtime: main) bundle.js (main) xx bytes (javascript) xx KiB (runtime) [entry] [rendered] + ./index.js xx bytes [built] [code generated] +runtime modules xx KiB 11 modules +cacheable modules xx KiB (wasm) xx KiB (javascript) + webassembly modules xx KiB (wasm) xx bytes (javascript) + ./Q_rsqrt.wasm xx bytes (wasm) xx bytes (javascript) [built] [code generated] + ./testFunction.wasm xx bytes (wasm) xx bytes (javascript) [built] [code generated] + ./fact.wasm xx bytes (wasm) xx bytes (javascript) [built] [code generated] + ./popcnt.wasm xx bytes (wasm) xx bytes (javascript) [built] [code generated] + ./fast-math.wasm xx bytes (wasm) xx bytes (javascript) [built] [code generated] + ./duff.wasm xx bytes (wasm) xx bytes (javascript) [built] [code generated] + javascript modules xx KiB + ./index.js xx bytes [built] [code generated] + ./tests.js xx KiB [built] [code generated] + ./node_modules/env.js xx bytes [built] [code generated] +Rspack x.x.x compiled successfully in X.23" +`; + exports[`StatsTestCases should print correct stats for worker-public-path 1`] = ` "asset main-xxx.js xx KiB [emitted] [immutable] (name: main) asset 464-xxx.js xx bytes [emitted] [immutable] diff --git a/tests/webpack-test/cases/chunks/runtime/test.filter.js b/tests/webpack-test/cases/chunks/runtime/test.filter.js index ae4a6be69f41..d9fb904f917d 100644 --- a/tests/webpack-test/cases/chunks/runtime/test.filter.js +++ b/tests/webpack-test/cases/chunks/runtime/test.filter.js @@ -6,6 +6,5 @@ module.exports = function(config) { }; */ -module.exports = () => {return "flagIncludedChunks"} +module.exports = () => "NOPLAN: support flagIncludedChunks" - \ No newline at end of file diff --git a/tests/webpack-test/cases/errors/load-module-cycle-multiple/test.filter.js b/tests/webpack-test/cases/errors/load-module-cycle-multiple/test.filter.js index f5d807a56fae..1c92487eebe9 100644 --- a/tests/webpack-test/cases/errors/load-module-cycle-multiple/test.filter.js +++ b/tests/webpack-test/cases/errors/load-module-cycle-multiple/test.filter.js @@ -1,4 +1,3 @@ -module.exports = () => {return "https://github.com/web-infra-dev/rspack/issues/3738"} +module.exports = () => "TODO: https://github.com/web-infra-dev/rspack/issues/3738" - \ No newline at end of file diff --git a/tests/webpack-test/cases/errors/load-module-cycle/test.filter.js b/tests/webpack-test/cases/errors/load-module-cycle/test.filter.js index f5d807a56fae..1c92487eebe9 100644 --- a/tests/webpack-test/cases/errors/load-module-cycle/test.filter.js +++ b/tests/webpack-test/cases/errors/load-module-cycle/test.filter.js @@ -1,4 +1,3 @@ -module.exports = () => {return "https://github.com/web-infra-dev/rspack/issues/3738"} +module.exports = () => "TODO: https://github.com/web-infra-dev/rspack/issues/3738" - \ No newline at end of file diff --git a/tests/webpack-test/cases/errors/load-module-error/test.filter.js b/tests/webpack-test/cases/errors/load-module-error/test.filter.js index f5d807a56fae..1c92487eebe9 100644 --- a/tests/webpack-test/cases/errors/load-module-error/test.filter.js +++ b/tests/webpack-test/cases/errors/load-module-error/test.filter.js @@ -1,4 +1,3 @@ -module.exports = () => {return "https://github.com/web-infra-dev/rspack/issues/3738"} +module.exports = () => "TODO: https://github.com/web-infra-dev/rspack/issues/3738" - \ No newline at end of file diff --git a/tests/webpack-test/cases/json/import-assertions-type-json/test.filter.js b/tests/webpack-test/cases/json/import-assertions-type-json/test.filter.js index 9c880ab58b9b..aad0b62f1ed9 100644 --- a/tests/webpack-test/cases/json/import-assertions-type-json/test.filter.js +++ b/tests/webpack-test/cases/json/import-assertions-type-json/test.filter.js @@ -1,3 +1 @@ -module.exports = () => { - return "Rspack don't support import assertions since it's deprecated"; -}; +module.exports = () => "NOPLAN: Rspack don't support import assertions since it's deprecated"; diff --git a/tests/webpack-test/cases/large/big-assets/test.filter.js b/tests/webpack-test/cases/large/big-assets/test.filter.js index 6eaa0fdb7aa6..14460f966eb1 100644 --- a/tests/webpack-test/cases/large/big-assets/test.filter.js +++ b/tests/webpack-test/cases/large/big-assets/test.filter.js @@ -3,4 +3,4 @@ // }; // Already pass this test, but this test is too slow, and create a lot of big files, so we always skip this test -module.exports = () => "Already pass this test, but this test is too slow, and create a lot of big files, so we always skip this test" +module.exports = () => "NOPLAN: Already pass this test, but this test is too slow, and create a lot of big files, so we always skip this test" diff --git a/tests/webpack-test/cases/large/many-replacements/test.filter.js b/tests/webpack-test/cases/large/many-replacements/test.filter.js index 6eaa0fdb7aa6..14460f966eb1 100644 --- a/tests/webpack-test/cases/large/many-replacements/test.filter.js +++ b/tests/webpack-test/cases/large/many-replacements/test.filter.js @@ -3,4 +3,4 @@ // }; // Already pass this test, but this test is too slow, and create a lot of big files, so we always skip this test -module.exports = () => "Already pass this test, but this test is too slow, and create a lot of big files, so we always skip this test" +module.exports = () => "NOPLAN: Already pass this test, but this test is too slow, and create a lot of big files, so we always skip this test" diff --git a/tests/webpack-test/cases/loaders/issue-10725/test.filter.js b/tests/webpack-test/cases/loaders/issue-10725/test.filter.js index a04da078522e..23932c6c29b6 100644 --- a/tests/webpack-test/cases/loaders/issue-10725/test.filter.js +++ b/tests/webpack-test/cases/loaders/issue-10725/test.filter.js @@ -1,4 +1,3 @@ -module.exports = () => {return "blocked by this.loadModule https://github.com/web-infra-dev/rspack/issues/3738"} +module.exports = () => "TODO: blocked by this.loadModule https://github.com/web-infra-dev/rspack/issues/3738" - \ No newline at end of file diff --git a/tests/webpack-test/cases/loaders/issue-2299/test.filter.js b/tests/webpack-test/cases/loaders/issue-2299/test.filter.js index dedf5b868e92..bd465aa45a9f 100644 --- a/tests/webpack-test/cases/loaders/issue-2299/test.filter.js +++ b/tests/webpack-test/cases/loaders/issue-2299/test.filter.js @@ -1,3 +1,2 @@ -module.exports = () => {return "blocked by this.loadModule https://github.com/web-infra-dev/rspack/issues/3738"} - \ No newline at end of file +module.exports = () => "TODO: blocked by this.loadModule https://github.com/web-infra-dev/rspack/issues/3738" diff --git a/tests/webpack-test/cases/loaders/issue-4959/test.filter.js b/tests/webpack-test/cases/loaders/issue-4959/test.filter.js index a04da078522e..23932c6c29b6 100644 --- a/tests/webpack-test/cases/loaders/issue-4959/test.filter.js +++ b/tests/webpack-test/cases/loaders/issue-4959/test.filter.js @@ -1,4 +1,3 @@ -module.exports = () => {return "blocked by this.loadModule https://github.com/web-infra-dev/rspack/issues/3738"} +module.exports = () => "TODO: blocked by this.loadModule https://github.com/web-infra-dev/rspack/issues/3738" - \ No newline at end of file diff --git a/tests/webpack-test/cases/parsing/harmony-injecting-order/test.filter.js b/tests/webpack-test/cases/parsing/harmony-injecting-order/test.filter.js index a68847dce73a..f445da3075b1 100644 --- a/tests/webpack-test/cases/parsing/harmony-injecting-order/test.filter.js +++ b/tests/webpack-test/cases/parsing/harmony-injecting-order/test.filter.js @@ -1,3 +1,2 @@ -module.exports = () => {return "__webpack_amd_options__ module variable"} +module.exports = () => "NOPLAN: __webpack_amd_options__ module variable" - \ No newline at end of file diff --git a/tests/webpack-test/cases/parsing/issue-758/test.filter.js b/tests/webpack-test/cases/parsing/issue-758/test.filter.js index c1e761ebcbf9..62408da5831c 100644 --- a/tests/webpack-test/cases/parsing/issue-758/test.filter.js +++ b/tests/webpack-test/cases/parsing/issue-758/test.filter.js @@ -1,4 +1,3 @@ -module.exports = () => {return "https://github.com/web-infra-dev/rspack/issues/4313"} +module.exports = () => "TODO: https://github.com/web-infra-dev/rspack/issues/4313" - \ No newline at end of file diff --git a/tests/webpack-test/cases/parsing/precreated-ast/test.filter.js b/tests/webpack-test/cases/parsing/precreated-ast/test.filter.js index 5320a59ff4de..6d4fa3f0a347 100644 --- a/tests/webpack-test/cases/parsing/precreated-ast/test.filter.js +++ b/tests/webpack-test/cases/parsing/precreated-ast/test.filter.js @@ -1,4 +1,3 @@ -module.exports = () => {return "https://github.com/web-infra-dev/rspack/issues/4442"} +module.exports = () => "TODO: https://github.com/web-infra-dev/rspack/issues/4442" - \ No newline at end of file diff --git a/tests/webpack-test/cases/parsing/typeof/test.filter.js b/tests/webpack-test/cases/parsing/typeof/test.filter.js index bdb645c1968a..2bca5f81753e 100644 --- a/tests/webpack-test/cases/parsing/typeof/test.filter.js +++ b/tests/webpack-test/cases/parsing/typeof/test.filter.js @@ -1,9 +1,7 @@ const { FilteredStatus } = require("../../../lib/util/filterUtil"); -module.exports = () => { - return [ - FilteredStatus.PARTIAL_PASS, - "require.include", - "support amd" - ]; -}; +module.exports = () => [ + FilteredStatus.PARTIAL_PASS, + "require.include", + "support amd" +]; diff --git a/tests/webpack-test/cases/resolving/issue-2986/test.filter.js b/tests/webpack-test/cases/resolving/issue-2986/test.filter.js index f742d1177939..b1b6b1bc88e6 100644 --- a/tests/webpack-test/cases/resolving/issue-2986/test.filter.js +++ b/tests/webpack-test/cases/resolving/issue-2986/test.filter.js @@ -1 +1 @@ -module.exports = () => {return "https://github.com/web-infra-dev/rspack/issues/4348"} +module.exports = () => "TODO: https://github.com/web-infra-dev/rspack/issues/4348" diff --git a/tests/webpack-test/cases/scope-hoisting/inside-class/test.filter.js b/tests/webpack-test/cases/scope-hoisting/inside-class/test.filter.js index 961dbdc8bb58..c21c15a3ecd7 100644 --- a/tests/webpack-test/cases/scope-hoisting/inside-class/test.filter.js +++ b/tests/webpack-test/cases/scope-hoisting/inside-class/test.filter.js @@ -1,12 +1,8 @@ -/* var supportsES6 = require("../../../helpers/supportsES6"); module.exports = function (config) { return supportsES6(); }; -*/ -module.exports = () => {return true} - diff --git a/tests/webpack-test/configCases/asset-modules/global-options/test.filter.js b/tests/webpack-test/configCases/asset-modules/global-options/test.filter.js index 67623a805a02..410616654abc 100644 --- a/tests/webpack-test/configCases/asset-modules/global-options/test.filter.js +++ b/tests/webpack-test/configCases/asset-modules/global-options/test.filter.js @@ -1 +1 @@ -module.exports = () => { return 'https://github.com/web-infra-dev/rspack/issues/8488' } +module.exports = () => "TODO: https://github.com/web-infra-dev/rspack/issues/8488" diff --git a/tests/webpack-test/configCases/asset-modules/http-url/test.filter.js b/tests/webpack-test/configCases/asset-modules/http-url/test.filter.js index a848d6b7533c..4cdd93601374 100644 --- a/tests/webpack-test/configCases/asset-modules/http-url/test.filter.js +++ b/tests/webpack-test/configCases/asset-modules/http-url/test.filter.js @@ -1 +1 @@ -module.exports = () => { return 'TODO: https://github.com/web-infra-dev/rspack/issues/8490' } +module.exports = () => 'TODO: https://github.com/web-infra-dev/rspack/issues/8490' diff --git a/tests/webpack-test/configCases/asset-modules/ignore/test.filter.js b/tests/webpack-test/configCases/asset-modules/ignore/test.filter.js index 328ea433cd34..d1ed5b8b83dc 100644 --- a/tests/webpack-test/configCases/asset-modules/ignore/test.filter.js +++ b/tests/webpack-test/configCases/asset-modules/ignore/test.filter.js @@ -1 +1 @@ -module.exports = () => { return 'TODO: https://github.com/web-infra-dev/rspack/issues/8531' } +module.exports = () => 'TODO: https://github.com/web-infra-dev/rspack/issues/8531' diff --git a/tests/webpack-test/configCases/asset-modules/query-and-custom-condition/test.filter.js b/tests/webpack-test/configCases/asset-modules/query-and-custom-condition/test.filter.js index 1a977c67cd04..9a6c36ca86dc 100644 --- a/tests/webpack-test/configCases/asset-modules/query-and-custom-condition/test.filter.js +++ b/tests/webpack-test/configCases/asset-modules/query-and-custom-condition/test.filter.js @@ -1 +1 @@ -module.exports = () => { return 'TODO: https://github.com/web-infra-dev/rspack/issues/8488' } +module.exports = () => 'TODO: https://github.com/web-infra-dev/rspack/issues/8488' diff --git a/tests/webpack-test/configCases/asset-url/target-node3/test.filter.js b/tests/webpack-test/configCases/asset-url/target-node3/test.filter.js index 2809acc0b462..7222a9118acc 100644 --- a/tests/webpack-test/configCases/asset-url/target-node3/test.filter.js +++ b/tests/webpack-test/configCases/asset-url/target-node3/test.filter.js @@ -1 +1 @@ -module.exports = () => { return "TODO: parser walk IIFE not supported" } +module.exports = () => "TODO: parser walk IIFE not supported" diff --git a/tests/webpack-test/configCases/cache-dependencies/managed-items-unsafe-cache/test.filter.js b/tests/webpack-test/configCases/cache-dependencies/managed-items-unsafe-cache/test.filter.js index 041ab4522d40..7ff9886f4ba8 100644 --- a/tests/webpack-test/configCases/cache-dependencies/managed-items-unsafe-cache/test.filter.js +++ b/tests/webpack-test/configCases/cache-dependencies/managed-items-unsafe-cache/test.filter.js @@ -1,3 +1 @@ -module.exports = () => { - return "NOPLAN: support module.unsafeCache and snapshot.managedPaths"; -}; +module.exports = () => "NOPLAN: support module.unsafeCache and snapshot.managedPaths"; diff --git a/tests/webpack-test/configCases/cache-dependencies/managed-items/test.filter.js b/tests/webpack-test/configCases/cache-dependencies/managed-items/test.filter.js index 041ab4522d40..7ff9886f4ba8 100644 --- a/tests/webpack-test/configCases/cache-dependencies/managed-items/test.filter.js +++ b/tests/webpack-test/configCases/cache-dependencies/managed-items/test.filter.js @@ -1,3 +1 @@ -module.exports = () => { - return "NOPLAN: support module.unsafeCache and snapshot.managedPaths"; -}; +module.exports = () => "NOPLAN: support module.unsafeCache and snapshot.managedPaths"; diff --git a/tests/webpack-test/configCases/chunk-index/order-multiple-entries/test.filter.js b/tests/webpack-test/configCases/chunk-index/order-multiple-entries/test.filter.js index 3496d3ca6317..5f2bf0886dc6 100644 --- a/tests/webpack-test/configCases/chunk-index/order-multiple-entries/test.filter.js +++ b/tests/webpack-test/configCases/chunk-index/order-multiple-entries/test.filter.js @@ -1,4 +1,2 @@ // enable when support compilation.moduleGraph(unimplemented).getPreOrderIndex(unimplemented) -module.exports = () => { - return 'TODO: https://github.com/web-infra-dev/rspack/issues/8548'; -}; +module.exports = () => 'TODO: https://github.com/web-infra-dev/rspack/issues/8548'; diff --git a/tests/webpack-test/configCases/clean/dry/test.filter.js b/tests/webpack-test/configCases/clean/dry/test.filter.js index 0f3473f25a60..03ca4bde41aa 100644 --- a/tests/webpack-test/configCases/clean/dry/test.filter.js +++ b/tests/webpack-test/configCases/clean/dry/test.filter.js @@ -1 +1 @@ -module.exports = () => { return 'TODO: https://github.com/web-infra-dev/rspack/issues/8549' } +module.exports = () => 'TODO: https://github.com/web-infra-dev/rspack/issues/8549' diff --git a/tests/webpack-test/configCases/clean/ignore-hook/test.filter.js b/tests/webpack-test/configCases/clean/ignore-hook/test.filter.js index f78cacd46f19..5dc2b43db7b6 100644 --- a/tests/webpack-test/configCases/clean/ignore-hook/test.filter.js +++ b/tests/webpack-test/configCases/clean/ignore-hook/test.filter.js @@ -1 +1 @@ -module.exports = () => { return 'TODO: https://github.com/web-infra-dev/rspack/issues/8603' } +module.exports = () => 'TODO: https://github.com/web-infra-dev/rspack/issues/8603' diff --git a/tests/webpack-test/configCases/clean/link/test.filter.js b/tests/webpack-test/configCases/clean/link/test.filter.js index fa663956db02..e00361ca83ad 100644 --- a/tests/webpack-test/configCases/clean/link/test.filter.js +++ b/tests/webpack-test/configCases/clean/link/test.filter.js @@ -16,4 +16,4 @@ // } // }; -module.exports = () => { return "FIXME: link is not supported when clean" } +module.exports = () => "FIXME: link is not supported when clean" diff --git a/tests/webpack-test/configCases/code-generation/require-context-id/test.filter.js b/tests/webpack-test/configCases/code-generation/require-context-id/test.filter.js index 82e3f9a13499..04201dd1dfcb 100644 --- a/tests/webpack-test/configCases/code-generation/require-context-id/test.filter.js +++ b/tests/webpack-test/configCases/code-generation/require-context-id/test.filter.js @@ -1 +1 @@ -module.exports = () => { return "NOPLAN: optimization.moduleIds = 'hashed' is deprecated in webpack" } +module.exports = () => "NOPLAN: optimization.moduleIds = 'hashed' is deprecated in webpack" diff --git a/tests/webpack-test/configCases/context-exclusion/simple/test.filter.js b/tests/webpack-test/configCases/context-exclusion/simple/test.filter.js index e2341bb60400..1494a16fac2a 100644 --- a/tests/webpack-test/configCases/context-exclusion/simple/test.filter.js +++ b/tests/webpack-test/configCases/context-exclusion/simple/test.filter.js @@ -1 +1 @@ -module.exports = () => { return "NOPLAN: ContextExclusionPlugin already instead of IgnorePlugin" } +module.exports = () => "NOPLAN: ContextExclusionPlugin already instead of IgnorePlugin" diff --git a/tests/webpack-test/configCases/context-replacement/e/test.filter.js b/tests/webpack-test/configCases/context-replacement/e/test.filter.js index 9b7648130f29..63a154e3f677 100644 --- a/tests/webpack-test/configCases/context-replacement/e/test.filter.js +++ b/tests/webpack-test/configCases/context-replacement/e/test.filter.js @@ -1,2 +1 @@ -// TODO: Should create a issue for this test -module.exports = () => { return "FIXME: Cannot find module 'replaced'" } +module.exports = () => "FIXME: Cannot find module 'replaced'" diff --git a/tests/webpack-test/configCases/css/css-modules-broken-keyframes/test.filter.js b/tests/webpack-test/configCases/css/css-modules-broken-keyframes/test.filter.js index d191122f7704..5da656bb311d 100644 --- a/tests/webpack-test/configCases/css/css-modules-broken-keyframes/test.filter.js +++ b/tests/webpack-test/configCases/css/css-modules-broken-keyframes/test.filter.js @@ -1 +1 @@ -module.exports = () => "webpack.ids.DeterministicModuleIdsPlugin"; +module.exports = () => "NOPLAN: support webpack.ids.DeterministicModuleIdsPlugin"; diff --git a/tests/webpack-test/configCases/css/css-modules-in-node/test.filter.js b/tests/webpack-test/configCases/css/css-modules-in-node/test.filter.js index 1524ce95730f..451517eb2006 100644 --- a/tests/webpack-test/configCases/css/css-modules-in-node/test.filter.js +++ b/tests/webpack-test/configCases/css/css-modules-in-node/test.filter.js @@ -1,3 +1,3 @@ // do not support webpack.ids.DeterministicModuleIdsPlugin -// TODO: Should create a issue for this test + module.exports = () => "TODO: DeterministicModuleIdsPlugin is not exposed"; diff --git a/tests/webpack-test/configCases/custom-source-type/localization/test.filter.js b/tests/webpack-test/configCases/custom-source-type/localization/test.filter.js index 28a3fe901820..0dbbc79dfa4d 100644 --- a/tests/webpack-test/configCases/custom-source-type/localization/test.filter.js +++ b/tests/webpack-test/configCases/custom-source-type/localization/test.filter.js @@ -1 +1 @@ -module.exports = () => { return "NOPLAN: normalModuleFactory.hooks not supported" } +module.exports = () => "NOPLAN: normalModuleFactory.hooks not supported" diff --git a/tests/webpack-test/configCases/deep-scope-analysis/remove-export-scope-hoisting/test.filter.js b/tests/webpack-test/configCases/deep-scope-analysis/remove-export-scope-hoisting/test.filter.js index 99081c17b772..9ca27a1ea0a5 100644 --- a/tests/webpack-test/configCases/deep-scope-analysis/remove-export-scope-hoisting/test.filter.js +++ b/tests/webpack-test/configCases/deep-scope-analysis/remove-export-scope-hoisting/test.filter.js @@ -1 +1 @@ -module.exports = () => { return "NOPLAN: compilation.hooks.dependencyReferencedExports not supported" } +module.exports = () => "NOPLAN: compilation.hooks.dependencyReferencedExports not supported" diff --git a/tests/webpack-test/configCases/deep-scope-analysis/remove-export/test.filter.js b/tests/webpack-test/configCases/deep-scope-analysis/remove-export/test.filter.js index 99081c17b772..9ca27a1ea0a5 100644 --- a/tests/webpack-test/configCases/deep-scope-analysis/remove-export/test.filter.js +++ b/tests/webpack-test/configCases/deep-scope-analysis/remove-export/test.filter.js @@ -1 +1 @@ -module.exports = () => { return "NOPLAN: compilation.hooks.dependencyReferencedExports not supported" } +module.exports = () => "NOPLAN: compilation.hooks.dependencyReferencedExports not supported" diff --git a/tests/webpack-test/configCases/delegated-hash/simple/test.filter.js b/tests/webpack-test/configCases/delegated-hash/simple/test.filter.js index 8e55a0c5c41c..6e8401ab7b13 100644 --- a/tests/webpack-test/configCases/delegated-hash/simple/test.filter.js +++ b/tests/webpack-test/configCases/delegated-hash/simple/test.filter.js @@ -1 +1 @@ -module.exports = () => { return "TODO: DelegatedPlugin is not exposed" } +module.exports = () => "TODO: DelegatedPlugin is not exposed" diff --git a/tests/webpack-test/configCases/delegated/simple/test.filter.js b/tests/webpack-test/configCases/delegated/simple/test.filter.js index 8e55a0c5c41c..6e8401ab7b13 100644 --- a/tests/webpack-test/configCases/delegated/simple/test.filter.js +++ b/tests/webpack-test/configCases/delegated/simple/test.filter.js @@ -1 +1 @@ -module.exports = () => { return "TODO: DelegatedPlugin is not exposed" } +module.exports = () => "TODO: DelegatedPlugin is not exposed" diff --git a/tests/webpack-test/configCases/deprecations/chunk-and-module/test.filter.js b/tests/webpack-test/configCases/deprecations/chunk-and-module/test.filter.js index bd73686be7ed..dc31951f3738 100644 --- a/tests/webpack-test/configCases/deprecations/chunk-and-module/test.filter.js +++ b/tests/webpack-test/configCases/deprecations/chunk-and-module/test.filter.js @@ -1 +1 @@ -module.exports = () => { return "TODO: chunk API not be full supported" } +module.exports = () => "TODO: chunk API not be full supported" diff --git a/tests/webpack-test/configCases/deprecations/chunk-files/test.filter.js b/tests/webpack-test/configCases/deprecations/chunk-files/test.filter.js index 13eed001147f..3e2e574eabb7 100644 --- a/tests/webpack-test/configCases/deprecations/chunk-files/test.filter.js +++ b/tests/webpack-test/configCases/deprecations/chunk-files/test.filter.js @@ -1 +1 @@ -module.exports = () => { return "TODO: chunk files API not be full supported" } \ No newline at end of file +module.exports = () => "TODO: chunk files API not be full supported" \ No newline at end of file diff --git a/tests/webpack-test/configCases/deprecations/config/test.filter.js b/tests/webpack-test/configCases/deprecations/config/test.filter.js index 23ab45b78dd5..8abb0251e284 100644 --- a/tests/webpack-test/configCases/deprecations/config/test.filter.js +++ b/tests/webpack-test/configCases/deprecations/config/test.filter.js @@ -1 +1 @@ -module.exports = () => { return "FIXME: missing deprecation DEP_WEBPACK_CONFIGURATION_OPTIMIZATION_NO_EMIT_ON_ERRORS" } +module.exports = () => "FIXME: missing deprecation DEP_WEBPACK_CONFIGURATION_OPTIMIZATION_NO_EMIT_ON_ERRORS" diff --git a/tests/webpack-test/configCases/deprecations/invalid-dependencies/test.filter.js b/tests/webpack-test/configCases/deprecations/invalid-dependencies/test.filter.js index c8dbc6e2752c..881a5a96b79f 100644 --- a/tests/webpack-test/configCases/deprecations/invalid-dependencies/test.filter.js +++ b/tests/webpack-test/configCases/deprecations/invalid-dependencies/test.filter.js @@ -1 +1 @@ -module.exports = () => { return "TODO: module.addCacheDependencies not supported" } +module.exports = () => "TODO: module.addCacheDependencies not supported" diff --git a/tests/webpack-test/configCases/deprecations/non-unique-hash/test.filter.js b/tests/webpack-test/configCases/deprecations/non-unique-hash/test.filter.js index 6847147e9a1e..5ef2194246f7 100644 --- a/tests/webpack-test/configCases/deprecations/non-unique-hash/test.filter.js +++ b/tests/webpack-test/configCases/deprecations/non-unique-hash/test.filter.js @@ -1,2 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return "TODO: compilation.hooks.afterModuleHash not supported" } + +module.exports = () => "TODO: compilation.hooks.afterModuleHash not supported" diff --git a/tests/webpack-test/configCases/dll-plugin/3-use-dll-with-hashid/test.filter.js b/tests/webpack-test/configCases/dll-plugin/3-use-dll-with-hashid/test.filter.js index 9f26d177c011..04035c98da34 100644 --- a/tests/webpack-test/configCases/dll-plugin/3-use-dll-with-hashid/test.filter.js +++ b/tests/webpack-test/configCases/dll-plugin/3-use-dll-with-hashid/test.filter.js @@ -1 +1 @@ -module.exports = () => { return "NOPLAN: moduleIds: hashed has been deprecated" } +module.exports = () => "NOPLAN: moduleIds: hashed has been deprecated" diff --git a/tests/webpack-test/configCases/entry/depend-on-advanced/test.filter.js b/tests/webpack-test/configCases/entry/depend-on-advanced/test.filter.js index 1f22f8a465e5..7cb0282afff5 100644 --- a/tests/webpack-test/configCases/entry/depend-on-advanced/test.filter.js +++ b/tests/webpack-test/configCases/entry/depend-on-advanced/test.filter.js @@ -1 +1 @@ -module.exports = () => { return "TODO: compilation.hooks.afterSeal not supported" } \ No newline at end of file +module.exports = () => "TODO: compilation.hooks.afterSeal not supported" diff --git a/tests/webpack-test/configCases/entry/weird-names/test.filter.js b/tests/webpack-test/configCases/entry/weird-names/test.filter.js index 4125e7ebcba0..9ba9f893420c 100644 --- a/tests/webpack-test/configCases/entry/weird-names/test.filter.js +++ b/tests/webpack-test/configCases/entry/weird-names/test.filter.js @@ -1 +1 @@ -module.exports = () => { return "FIXME: entry path parsed failed" } +module.exports = () => "FIXME: entry path parsed failed" diff --git a/tests/webpack-test/configCases/entry/weird-names2/test.filter.js b/tests/webpack-test/configCases/entry/weird-names2/test.filter.js index 4125e7ebcba0..9ba9f893420c 100644 --- a/tests/webpack-test/configCases/entry/weird-names2/test.filter.js +++ b/tests/webpack-test/configCases/entry/weird-names2/test.filter.js @@ -1 +1 @@ -module.exports = () => { return "FIXME: entry path parsed failed" } +module.exports = () => "FIXME: entry path parsed failed" diff --git a/tests/webpack-test/configCases/errors/asset-options-validation/test.filter.js b/tests/webpack-test/configCases/errors/asset-options-validation/test.filter.js index 2b1352a273ad..83c9f45fb43b 100644 --- a/tests/webpack-test/configCases/errors/asset-options-validation/test.filter.js +++ b/tests/webpack-test/configCases/errors/asset-options-validation/test.filter.js @@ -1 +1 @@ -module.exports = () => { return "FIXME: missing error" } +module.exports = () => "FIXME: missing error" diff --git a/tests/webpack-test/configCases/errors/case-emit/test.filter.js b/tests/webpack-test/configCases/errors/case-emit/test.filter.js index 2b1352a273ad..83c9f45fb43b 100644 --- a/tests/webpack-test/configCases/errors/case-emit/test.filter.js +++ b/tests/webpack-test/configCases/errors/case-emit/test.filter.js @@ -1 +1 @@ -module.exports = () => { return "FIXME: missing error" } +module.exports = () => "FIXME: missing error" diff --git a/tests/webpack-test/configCases/errors/exception-in-chunk-renderer/test.filter.js b/tests/webpack-test/configCases/errors/exception-in-chunk-renderer/test.filter.js index 4128a25e8fd5..a262713f0ace 100644 --- a/tests/webpack-test/configCases/errors/exception-in-chunk-renderer/test.filter.js +++ b/tests/webpack-test/configCases/errors/exception-in-chunk-renderer/test.filter.js @@ -1 +1 @@ -module.exports = () => { return "TODO: compilation.mainTemplate.hooks.requireExtensions not supported" } +module.exports = () => "TODO: compilation.mainTemplate.hooks.requireExtensions not supported" diff --git a/tests/webpack-test/configCases/hash-length/deterministic-module-ids/test.filter.js b/tests/webpack-test/configCases/hash-length/deterministic-module-ids/test.filter.js index 8389728670af..52ceb93ab7e9 100644 --- a/tests/webpack-test/configCases/hash-length/deterministic-module-ids/test.filter.js +++ b/tests/webpack-test/configCases/hash-length/deterministic-module-ids/test.filter.js @@ -1 +1 @@ -module.exports = () => { return "TODO: DeterministicModuleIdsPlugin is not exposed" } +module.exports = () => "TODO: DeterministicModuleIdsPlugin is not exposed" diff --git a/tests/webpack-test/configCases/hash-length/hashed-module-ids/test.filter.js b/tests/webpack-test/configCases/hash-length/hashed-module-ids/test.filter.js index 2cd6356f0d6f..ff3819a6a763 100644 --- a/tests/webpack-test/configCases/hash-length/hashed-module-ids/test.filter.js +++ b/tests/webpack-test/configCases/hash-length/hashed-module-ids/test.filter.js @@ -1 +1 @@ -module.exports = () => { return "NOPLAN: HashedModuleIdsPlugin has been deprecated" } +module.exports = () => "NOPLAN: HashedModuleIdsPlugin has been deprecated" diff --git a/tests/webpack-test/configCases/inner-graph/issue-12669/test.filter.js b/tests/webpack-test/configCases/inner-graph/issue-12669/test.filter.js index 1106626cb691..e4e2dc2466b1 100644 --- a/tests/webpack-test/configCases/inner-graph/issue-12669/test.filter.js +++ b/tests/webpack-test/configCases/inner-graph/issue-12669/test.filter.js @@ -1,2 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return "FIXME: exports is not as expected" } + +module.exports = () => "FIXME: exports is not as expected" diff --git a/tests/webpack-test/configCases/json/tree-shaking-default/test.filter.js b/tests/webpack-test/configCases/json/tree-shaking-default/test.filter.js index b0662f0c1ed0..ed542aba913f 100644 --- a/tests/webpack-test/configCases/json/tree-shaking-default/test.filter.js +++ b/tests/webpack-test/configCases/json/tree-shaking-default/test.filter.js @@ -1,2 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return "NOPLAN: Ignore the json named exports warning, this violates standards, but other bundlers support it without warning." } + +module.exports = () => "NOPLAN: Ignore the json named exports warning, this violates standards, but other bundlers support it without warning." diff --git a/tests/webpack-test/configCases/layer/rules/test.filter.js b/tests/webpack-test/configCases/layer/rules/test.filter.js index 13e315d9c618..e5634c6417d6 100644 --- a/tests/webpack-test/configCases/layer/rules/test.filter.js +++ b/tests/webpack-test/configCases/layer/rules/test.filter.js @@ -1,2 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return "FIXME: externals is not invalid type" } + +module.exports = () => "FIXME: externals is not invalid type" diff --git a/tests/webpack-test/configCases/library/modern-module-reexport-type/test.filter.js b/tests/webpack-test/configCases/library/modern-module-reexport-type/test.filter.js index 7c8be93f3fe9..c173e0fedc45 100644 --- a/tests/webpack-test/configCases/library/modern-module-reexport-type/test.filter.js +++ b/tests/webpack-test/configCases/library/modern-module-reexport-type/test.filter.js @@ -3,4 +3,4 @@ // return supportsOptionalChaining(); // }; -module.exports = () => { return "FIXME: build timeout on CI" } +module.exports = () => "FIXME: build timeout on CI" diff --git a/tests/webpack-test/configCases/loaders/options/test.filter.js b/tests/webpack-test/configCases/loaders/options/test.filter.js index ea5b412d4f6f..3655faf772fd 100644 --- a/tests/webpack-test/configCases/loaders/options/test.filter.js +++ b/tests/webpack-test/configCases/loaders/options/test.filter.js @@ -1,2 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return "FIXME: missing error" } + +module.exports = () => "FIXME: missing error" diff --git a/tests/webpack-test/configCases/loaders/pr-14384/test.filter.js b/tests/webpack-test/configCases/loaders/pr-14384/test.filter.js index 9269d3346f30..308521ddf312 100644 --- a/tests/webpack-test/configCases/loaders/pr-14384/test.filter.js +++ b/tests/webpack-test/configCases/loaders/pr-14384/test.filter.js @@ -1 +1 @@ -module.exports = () => { return "TODO: Rspack does not export `NormalModule` and support `beforeLoaders` from JS side and whether to implemented is tracked here: https://github.com/orgs/web-infra-dev/projects/9" } \ No newline at end of file +module.exports = () => "TODO: Rspack does not export `NormalModule` and support `beforeLoaders` from JS side and whether to implemented is tracked here: https://github.com/orgs/web-infra-dev/projects/9" \ No newline at end of file diff --git a/tests/webpack-test/configCases/mangle/mangle-with-object-prop/test.filter.js b/tests/webpack-test/configCases/mangle/mangle-with-object-prop/test.filter.js index 350f472a4a2b..0b78d4e913ff 100644 --- a/tests/webpack-test/configCases/mangle/mangle-with-object-prop/test.filter.js +++ b/tests/webpack-test/configCases/mangle/mangle-with-object-prop/test.filter.js @@ -1,2 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return "FIXME: mangle result not as expected" } + +module.exports = () => "FIXME: mangle result not as expected" diff --git a/tests/webpack-test/configCases/optimization/chunk/test.filter.js b/tests/webpack-test/configCases/optimization/chunk/test.filter.js index 0df8da3992cd..16d48ea92192 100644 --- a/tests/webpack-test/configCases/optimization/chunk/test.filter.js +++ b/tests/webpack-test/configCases/optimization/chunk/test.filter.js @@ -1,2 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return "TODO: DeterministicChunkIdsPlugin is not exposed" } + +module.exports = () => "TODO: DeterministicChunkIdsPlugin is not exposed" diff --git a/tests/webpack-test/configCases/optimization/hashed-module-ids/test.filter.js b/tests/webpack-test/configCases/optimization/hashed-module-ids/test.filter.js index 95b82bb07f31..3fb7d2ce7b9a 100644 --- a/tests/webpack-test/configCases/optimization/hashed-module-ids/test.filter.js +++ b/tests/webpack-test/configCases/optimization/hashed-module-ids/test.filter.js @@ -1,2 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return "NOPLAN: moduleIds: 'hashed' has been deprecated" } + +module.exports = () => "NOPLAN: moduleIds: 'hashed' has been deprecated" diff --git a/tests/webpack-test/configCases/parsing/context/test.filter.js b/tests/webpack-test/configCases/parsing/context/test.filter.js index 95b52e94bd10..ba9a403c3810 100644 --- a/tests/webpack-test/configCases/parsing/context/test.filter.js +++ b/tests/webpack-test/configCases/parsing/context/test.filter.js @@ -1 +1 @@ -module.exports = () => { return "TODO: not support module.unknownContextRegExp/unknownContextCritical/exprContextRegExp" } +module.exports = () => "TODO: not support module.unknownContextRegExp / unknownContextCritical / exprContextRegExp" diff --git a/tests/webpack-test/configCases/parsing/harmony-this-concat/test.filter.js b/tests/webpack-test/configCases/parsing/harmony-this-concat/test.filter.js index 66178af3f889..1ab046a1f195 100644 --- a/tests/webpack-test/configCases/parsing/harmony-this-concat/test.filter.js +++ b/tests/webpack-test/configCases/parsing/harmony-this-concat/test.filter.js @@ -1 +1 @@ -module.exports = () => { return "TODO: not support module.strictThisContextOnImports" } +module.exports = () => "TODO: not support module.strictThisContextOnImports" diff --git a/tests/webpack-test/configCases/parsing/issue-14545/test.filter.js b/tests/webpack-test/configCases/parsing/issue-14545/test.filter.js index 95b52e94bd10..ba9a403c3810 100644 --- a/tests/webpack-test/configCases/parsing/issue-14545/test.filter.js +++ b/tests/webpack-test/configCases/parsing/issue-14545/test.filter.js @@ -1 +1 @@ -module.exports = () => { return "TODO: not support module.unknownContextRegExp/unknownContextCritical/exprContextRegExp" } +module.exports = () => "TODO: not support module.unknownContextRegExp / unknownContextCritical / exprContextRegExp" diff --git a/tests/webpack-test/configCases/parsing/issue-2942/test.filter.js b/tests/webpack-test/configCases/parsing/issue-2942/test.filter.js index 3b9c1d87cff0..5bb4b839de08 100644 --- a/tests/webpack-test/configCases/parsing/issue-2942/test.filter.js +++ b/tests/webpack-test/configCases/parsing/issue-2942/test.filter.js @@ -1 +1 @@ -module.exports = () => { return "NOPLAN: support parser.system to parse systemjs" } +module.exports = () => "NOPLAN: support parser.system to parse systemjs" diff --git a/tests/webpack-test/configCases/parsing/optional-chaining/test.filter.js b/tests/webpack-test/configCases/parsing/optional-chaining/test.filter.js index fcc07bd7f047..55ad962888ef 100644 --- a/tests/webpack-test/configCases/parsing/optional-chaining/test.filter.js +++ b/tests/webpack-test/configCases/parsing/optional-chaining/test.filter.js @@ -5,5 +5,5 @@ // return supportsOptionalChaining(); // }; -// TODO: Should create a issue for this test -module.exports = () => { return "FIXME: expect number" } + +module.exports = () => "FIXME: expect number" diff --git a/tests/webpack-test/configCases/parsing/optional/test.filter.js b/tests/webpack-test/configCases/parsing/optional/test.filter.js index f9150e4825fc..90da0a0f1d4b 100644 --- a/tests/webpack-test/configCases/parsing/optional/test.filter.js +++ b/tests/webpack-test/configCases/parsing/optional/test.filter.js @@ -1,2 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return "FIXME: Module not found" } + +module.exports = () => "FIXME: Module not found" diff --git a/tests/webpack-test/configCases/parsing/require-ignore/test.filter.js b/tests/webpack-test/configCases/parsing/require-ignore/test.filter.js index 5449d7d7c1d1..2aca5b8a67fb 100644 --- a/tests/webpack-test/configCases/parsing/require-ignore/test.filter.js +++ b/tests/webpack-test/configCases/parsing/require-ignore/test.filter.js @@ -1,2 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return "TODO: support require magic comments webpackIgnore" } + +module.exports = () => "TODO: support require magic comments webpackIgnore" diff --git a/tests/webpack-test/configCases/parsing/requirejs/test.filter.js b/tests/webpack-test/configCases/parsing/requirejs/test.filter.js index b93378950033..c43020992e15 100644 --- a/tests/webpack-test/configCases/parsing/requirejs/test.filter.js +++ b/tests/webpack-test/configCases/parsing/requirejs/test.filter.js @@ -1,2 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return "NOPLAN: support requirejs" } + +module.exports = () => "NOPLAN: support requirejs" diff --git a/tests/webpack-test/configCases/parsing/system.import/test.filter.js b/tests/webpack-test/configCases/parsing/system.import/test.filter.js index 61cbb7b2cdf3..ee74b59bfa12 100644 --- a/tests/webpack-test/configCases/parsing/system.import/test.filter.js +++ b/tests/webpack-test/configCases/parsing/system.import/test.filter.js @@ -1,2 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return "NOPLAN: support systemjs" } + +module.exports = () => "NOPLAN: support systemjs" diff --git a/tests/webpack-test/configCases/plugins/banner-plugin-hashing/test.filter.js b/tests/webpack-test/configCases/plugins/banner-plugin-hashing/test.filter.js index 306f917f1fc4..3a7ddc4ed317 100644 --- a/tests/webpack-test/configCases/plugins/banner-plugin-hashing/test.filter.js +++ b/tests/webpack-test/configCases/plugins/banner-plugin-hashing/test.filter.js @@ -1 +1 @@ -module.exports = () => { return "FIXME: expect to have full hash" } +module.exports = () => "FIXME: expect to have full hash" diff --git a/tests/webpack-test/configCases/plugins/lib-manifest-plugin/test.filter.js b/tests/webpack-test/configCases/plugins/lib-manifest-plugin/test.filter.js index 46c4e7b98d36..3e436017a0aa 100644 --- a/tests/webpack-test/configCases/plugins/lib-manifest-plugin/test.filter.js +++ b/tests/webpack-test/configCases/plugins/lib-manifest-plugin/test.filter.js @@ -1,2 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return "TODO: LibManifestPlugin is not exposed" } + +module.exports = () => "TODO: LibManifestPlugin is not exposed" diff --git a/tests/webpack-test/configCases/plugins/min-chunk-size/test.filter.js b/tests/webpack-test/configCases/plugins/min-chunk-size/test.filter.js index 3af9c521c161..0ae93aab94aa 100644 --- a/tests/webpack-test/configCases/plugins/min-chunk-size/test.filter.js +++ b/tests/webpack-test/configCases/plugins/min-chunk-size/test.filter.js @@ -1,2 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return "NOPLAN: support MinChunkSizePlugin" } + +module.exports = () => "NOPLAN: support MinChunkSizePlugin" diff --git a/tests/webpack-test/configCases/plugins/mini-css-extract-plugin/test.filter.js b/tests/webpack-test/configCases/plugins/mini-css-extract-plugin/test.filter.js index 9cf1eebfb979..19360e438ef7 100644 --- a/tests/webpack-test/configCases/plugins/mini-css-extract-plugin/test.filter.js +++ b/tests/webpack-test/configCases/plugins/mini-css-extract-plugin/test.filter.js @@ -1,2 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return "FIXME: too much comments" } + +module.exports = () => "FIXME: too much comments" diff --git a/tests/webpack-test/configCases/plugins/profiling-plugin/test.filter.js b/tests/webpack-test/configCases/plugins/profiling-plugin/test.filter.js index e93bb07bbf57..d54adb8a3a80 100644 --- a/tests/webpack-test/configCases/plugins/profiling-plugin/test.filter.js +++ b/tests/webpack-test/configCases/plugins/profiling-plugin/test.filter.js @@ -2,5 +2,5 @@ // return !process.env.CI; // }; -// TODO: Should create a issue for this test -module.exports = () => { return "NOPLAN: support webpack.debug.ProfilingPlugin" } + +module.exports = () => "NOPLAN: support webpack.debug.ProfilingPlugin" diff --git a/tests/webpack-test/configCases/plugins/progress-plugin/test.filter.js b/tests/webpack-test/configCases/plugins/progress-plugin/test.filter.js index 0eb802c4a87a..d5943ca688f9 100644 --- a/tests/webpack-test/configCases/plugins/progress-plugin/test.filter.js +++ b/tests/webpack-test/configCases/plugins/progress-plugin/test.filter.js @@ -1,2 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return "TODO: compilation.hooks.optimize is not supported and ProgressPlugin.getReporter is not supported" } + +module.exports = () => "TODO: compilation.hooks.optimize is not supported and ProgressPlugin.getReporter is not supported" diff --git a/tests/webpack-test/configCases/process-assets/html-plugin/test.filter.js b/tests/webpack-test/configCases/process-assets/html-plugin/test.filter.js index 6d56444b9601..703423b036ab 100644 --- a/tests/webpack-test/configCases/process-assets/html-plugin/test.filter.js +++ b/tests/webpack-test/configCases/process-assets/html-plugin/test.filter.js @@ -1,2 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return "TODO: RealContentHashPlugin.getCompilationHooks is not supported" } + +module.exports = () => "TODO: RealContentHashPlugin.getCompilationHooks is not supported" diff --git a/tests/webpack-test/configCases/race-conditions/load-module/test.filter.js b/tests/webpack-test/configCases/race-conditions/load-module/test.filter.js index d390295a2c62..7c48245fd735 100644 --- a/tests/webpack-test/configCases/race-conditions/load-module/test.filter.js +++ b/tests/webpack-test/configCases/race-conditions/load-module/test.filter.js @@ -1,2 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return "TODO: support loadModule" } + +module.exports = () => "TODO: support loadModule" diff --git a/tests/webpack-test/configCases/records/issue-295/test.filter.js b/tests/webpack-test/configCases/records/issue-295/test.filter.js index cd933d36276a..2643963798fa 100644 --- a/tests/webpack-test/configCases/records/issue-295/test.filter.js +++ b/tests/webpack-test/configCases/records/issue-295/test.filter.js @@ -1,2 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return "NOPLAN: support recordsPath" } + +module.exports = () => "NOPLAN: support recordsPath" diff --git a/tests/webpack-test/configCases/records/issue-2991/test.filter.js b/tests/webpack-test/configCases/records/issue-2991/test.filter.js index cd933d36276a..2643963798fa 100644 --- a/tests/webpack-test/configCases/records/issue-2991/test.filter.js +++ b/tests/webpack-test/configCases/records/issue-2991/test.filter.js @@ -1,2 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return "NOPLAN: support recordsPath" } + +module.exports = () => "NOPLAN: support recordsPath" diff --git a/tests/webpack-test/configCases/records/issue-7339/test.filter.js b/tests/webpack-test/configCases/records/issue-7339/test.filter.js index 5d14484991fd..2b6f642662c5 100644 --- a/tests/webpack-test/configCases/records/issue-7339/test.filter.js +++ b/tests/webpack-test/configCases/records/issue-7339/test.filter.js @@ -1,2 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return "NOPLAN: support recordsOutputPath" } + +module.exports = () => "NOPLAN: support recordsOutputPath" diff --git a/tests/webpack-test/configCases/records/issue-7492/test.filter.js b/tests/webpack-test/configCases/records/issue-7492/test.filter.js index cd933d36276a..2643963798fa 100644 --- a/tests/webpack-test/configCases/records/issue-7492/test.filter.js +++ b/tests/webpack-test/configCases/records/issue-7492/test.filter.js @@ -1,2 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return "NOPLAN: support recordsPath" } + +module.exports = () => "NOPLAN: support recordsPath" diff --git a/tests/webpack-test/configCases/records/stable-sort/test.filter.js b/tests/webpack-test/configCases/records/stable-sort/test.filter.js index cd933d36276a..2643963798fa 100644 --- a/tests/webpack-test/configCases/records/stable-sort/test.filter.js +++ b/tests/webpack-test/configCases/records/stable-sort/test.filter.js @@ -1,2 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return "NOPLAN: support recordsPath" } + +module.exports = () => "NOPLAN: support recordsPath" diff --git a/tests/webpack-test/configCases/require/module-require/test.filter.js b/tests/webpack-test/configCases/require/module-require/test.filter.js index 91b81b9944b2..ec7c1768403a 100644 --- a/tests/webpack-test/configCases/require/module-require/test.filter.js +++ b/tests/webpack-test/configCases/require/module-require/test.filter.js @@ -1,2 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return "FIXME: missing warnings" } + +module.exports = () => "FIXME: missing warnings" diff --git a/tests/webpack-test/configCases/resolve-merging/override/test.filter.js b/tests/webpack-test/configCases/resolve-merging/override/test.filter.js index d2528d6fab68..6c5e2234f965 100644 --- a/tests/webpack-test/configCases/resolve-merging/override/test.filter.js +++ b/tests/webpack-test/configCases/resolve-merging/override/test.filter.js @@ -1,2 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return "FIXME: expect 'required' to be 'style'" } + +module.exports = () => "FIXME: expect 'required' to be 'style'" diff --git a/tests/webpack-test/configCases/resolve/context-resolve-with-ignore/test.filter.js b/tests/webpack-test/configCases/resolve/context-resolve-with-ignore/test.filter.js index eca37eb0a208..df3ffe5f1da6 100644 --- a/tests/webpack-test/configCases/resolve/context-resolve-with-ignore/test.filter.js +++ b/tests/webpack-test/configCases/resolve/context-resolve-with-ignore/test.filter.js @@ -1,2 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return "TODO: suport await import with magic comments" } + +module.exports = () => "TODO: suport await import with magic comments" diff --git a/tests/webpack-test/configCases/resolve/empty-context-module/test.filter.js b/tests/webpack-test/configCases/resolve/empty-context-module/test.filter.js index 07b5a95ad7af..aad8022e1812 100644 --- a/tests/webpack-test/configCases/resolve/empty-context-module/test.filter.js +++ b/tests/webpack-test/configCases/resolve/empty-context-module/test.filter.js @@ -1 +1 @@ -module.exports = () => { return "TODO: suport await import with magic comments" } +module.exports = () => "TODO: suport await import with magic comments" diff --git a/tests/webpack-test/configCases/resolve/issue-11335-context-module/test.filter.js b/tests/webpack-test/configCases/resolve/issue-11335-context-module/test.filter.js index 07b5a95ad7af..aad8022e1812 100644 --- a/tests/webpack-test/configCases/resolve/issue-11335-context-module/test.filter.js +++ b/tests/webpack-test/configCases/resolve/issue-11335-context-module/test.filter.js @@ -1 +1 @@ -module.exports = () => { return "TODO: suport await import with magic comments" } +module.exports = () => "TODO: suport await import with magic comments" diff --git a/tests/webpack-test/configCases/resolve/only-module/test.filter.js b/tests/webpack-test/configCases/resolve/only-module/test.filter.js index 6d562c741175..ff6f53a875b6 100644 --- a/tests/webpack-test/configCases/resolve/only-module/test.filter.js +++ b/tests/webpack-test/configCases/resolve/only-module/test.filter.js @@ -1 +1 @@ -module.exports = () => { return "NOPLAN: support alias onlyModule" } \ No newline at end of file +module.exports = () => "NOPLAN: support alias onlyModule" \ No newline at end of file diff --git a/tests/webpack-test/configCases/resolving/prefer-absolute/test.filter.js b/tests/webpack-test/configCases/resolving/prefer-absolute/test.filter.js index 3be21243c3cc..ea4c5b4eda74 100644 --- a/tests/webpack-test/configCases/resolving/prefer-absolute/test.filter.js +++ b/tests/webpack-test/configCases/resolving/prefer-absolute/test.filter.js @@ -1 +1 @@ -module.exports = () => { return "TODO: support resolve plugins" } +module.exports = () => "TODO: support resolve plugins" diff --git a/tests/webpack-test/configCases/rule-set/chaining/test.filter.js b/tests/webpack-test/configCases/rule-set/chaining/test.filter.js index 8d1037c45ed0..030c6f3186b2 100644 --- a/tests/webpack-test/configCases/rule-set/chaining/test.filter.js +++ b/tests/webpack-test/configCases/rule-set/chaining/test.filter.js @@ -1,2 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return "TODO: missing deprecations" } + +module.exports = () => "TODO: missing deprecations" diff --git a/tests/webpack-test/configCases/rule-set/compiler/test.filter.js b/tests/webpack-test/configCases/rule-set/compiler/test.filter.js index 62ec2ee8d0c4..3f5d096c56e9 100644 --- a/tests/webpack-test/configCases/rule-set/compiler/test.filter.js +++ b/tests/webpack-test/configCases/rule-set/compiler/test.filter.js @@ -1,2 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return "FIXME: expect loader not matched" } + +module.exports = () => "FIXME: expect loader not matched" diff --git a/tests/webpack-test/configCases/rule-set/custom/test.filter.js b/tests/webpack-test/configCases/rule-set/custom/test.filter.js index d984c7b2986c..58b2b21a90e7 100644 --- a/tests/webpack-test/configCases/rule-set/custom/test.filter.js +++ b/tests/webpack-test/configCases/rule-set/custom/test.filter.js @@ -1,2 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return "FIXME: expect 'call-a.js' to be 'a.js'" } + +module.exports = () => "FIXME: expect 'call-a.js' to be 'a.js'" diff --git a/tests/webpack-test/configCases/rule-set/simple-use-array-fn/test.filter.js b/tests/webpack-test/configCases/rule-set/simple-use-array-fn/test.filter.js index 8d1037c45ed0..030c6f3186b2 100644 --- a/tests/webpack-test/configCases/rule-set/simple-use-array-fn/test.filter.js +++ b/tests/webpack-test/configCases/rule-set/simple-use-array-fn/test.filter.js @@ -1,2 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return "TODO: missing deprecations" } + +module.exports = () => "TODO: missing deprecations" diff --git a/tests/webpack-test/configCases/rule-set/simple-use-fn-array/test.filter.js b/tests/webpack-test/configCases/rule-set/simple-use-fn-array/test.filter.js index 6354783da44e..b45aba1ec482 100644 --- a/tests/webpack-test/configCases/rule-set/simple-use-fn-array/test.filter.js +++ b/tests/webpack-test/configCases/rule-set/simple-use-fn-array/test.filter.js @@ -1,2 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return "FIXME: Cannot read properties of undefined (reading 'startsWith')" } + +module.exports = () => "FIXME: Cannot read properties of undefined(reading 'startsWith')" diff --git a/tests/webpack-test/configCases/rule-set/simple/test.filter.js b/tests/webpack-test/configCases/rule-set/simple/test.filter.js index 8d1037c45ed0..030c6f3186b2 100644 --- a/tests/webpack-test/configCases/rule-set/simple/test.filter.js +++ b/tests/webpack-test/configCases/rule-set/simple/test.filter.js @@ -1,2 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return "TODO: missing deprecations" } + +module.exports = () => "TODO: missing deprecations" diff --git a/tests/webpack-test/configCases/scope-hoisting/dll-plugin/test.filter.js b/tests/webpack-test/configCases/scope-hoisting/dll-plugin/test.filter.js index ecd04ef8a787..29a5e21767a1 100644 --- a/tests/webpack-test/configCases/scope-hoisting/dll-plugin/test.filter.js +++ b/tests/webpack-test/configCases/scope-hoisting/dll-plugin/test.filter.js @@ -1,2 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return "FIXME: build timeout" } + +module.exports = () => "FIXME: build timeout" diff --git a/tests/webpack-test/configCases/sharing/consume-module-ignore-warnings/test.filter.js b/tests/webpack-test/configCases/sharing/consume-module-ignore-warnings/test.filter.js index c23340226016..31686c50b767 100644 --- a/tests/webpack-test/configCases/sharing/consume-module-ignore-warnings/test.filter.js +++ b/tests/webpack-test/configCases/sharing/consume-module-ignore-warnings/test.filter.js @@ -1,2 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return "FIXME: Unsatisfied version 1.1.1 from container-a of shared singleton module singleton (required =1.1.0)" } + +module.exports = () => "FIXME: Unsatisfied version 1.1.1 from container - a of shared singleton module singleton (required = 1.1.0) " diff --git a/tests/webpack-test/configCases/sharing/consume-multiple-versions-ignore-warnings/test.filter.js b/tests/webpack-test/configCases/sharing/consume-multiple-versions-ignore-warnings/test.filter.js index 891643df354c..5b9143b0c0c4 100644 --- a/tests/webpack-test/configCases/sharing/consume-multiple-versions-ignore-warnings/test.filter.js +++ b/tests/webpack-test/configCases/sharing/consume-multiple-versions-ignore-warnings/test.filter.js @@ -1,2 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return "FIXME: No satisfying version(=1.2.3 = 3.2.1) of shared module shared2 found in shared scope default." } + +module.exports = () => "FIXME: No satisfying version(=1.2.3 = 3.2.1) of shared module shared2 found in shared scope default." diff --git a/tests/webpack-test/configCases/side-effects/url/test.filter.js b/tests/webpack-test/configCases/side-effects/url/test.filter.js index b98ffffb5933..d0d42b36a0d9 100644 --- a/tests/webpack-test/configCases/side-effects/url/test.filter.js +++ b/tests/webpack-test/configCases/side-effects/url/test.filter.js @@ -1,2 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return "FIXME: not contain orphan: true" } + +module.exports = () => "FIXME: not contain orphan: true" diff --git a/tests/webpack-test/configCases/source-map/context-module-source-path/test.filter.js b/tests/webpack-test/configCases/source-map/context-module-source-path/test.filter.js index 8829e3c25c25..aef3ffc44e33 100644 --- a/tests/webpack-test/configCases/source-map/context-module-source-path/test.filter.js +++ b/tests/webpack-test/configCases/source-map/context-module-source-path/test.filter.js @@ -1,2 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return "FIXME: context module aboslute resource path" } + +module.exports = () => "FIXME: context module aboslute resource path" diff --git a/tests/webpack-test/configCases/source-map/exclude-modules-source-map/test.filter.js b/tests/webpack-test/configCases/source-map/exclude-modules-source-map/test.filter.js index 209ebf8ceaad..fe0983f4503f 100644 --- a/tests/webpack-test/configCases/source-map/exclude-modules-source-map/test.filter.js +++ b/tests/webpack-test/configCases/source-map/exclude-modules-source-map/test.filter.js @@ -1,2 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return "TODO: support exclude of EvalSourceMapDevToolPlugin" } + +module.exports = () => "TODO: support exclude of EvalSourceMapDevToolPlugin" diff --git a/tests/webpack-test/configCases/source-map/source-map-with-profiling-plugin/test.filter.js b/tests/webpack-test/configCases/source-map/source-map-with-profiling-plugin/test.filter.js index 4eacdd9531ab..4761bc74fe48 100644 --- a/tests/webpack-test/configCases/source-map/source-map-with-profiling-plugin/test.filter.js +++ b/tests/webpack-test/configCases/source-map/source-map-with-profiling-plugin/test.filter.js @@ -2,5 +2,5 @@ // return !process.env.CI; // }; -// TODO: Should create a issue for this test -module.exports = () => { return "NOPLAN: support ProfilingPlugin" } + +module.exports = () => "NOPLAN: support ProfilingPlugin" diff --git a/tests/webpack-test/configCases/utils/lazy-set/test.filter.js b/tests/webpack-test/configCases/utils/lazy-set/test.filter.js index d96651d945fe..89b6c0c9dfdd 100644 --- a/tests/webpack-test/configCases/utils/lazy-set/test.filter.js +++ b/tests/webpack-test/configCases/utils/lazy-set/test.filter.js @@ -1,2 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return "TODO: compilation.fileDependencies is a proxy" } + +module.exports = () => "TODO: compilation.fileDependencies is a proxy" diff --git a/tests/webpack-test/configCases/wasm/identical/test.filter.js b/tests/webpack-test/configCases/wasm/identical/test.filter.js index df6b346a8474..2a5d35be4890 100644 --- a/tests/webpack-test/configCases/wasm/identical/test.filter.js +++ b/tests/webpack-test/configCases/wasm/identical/test.filter.js @@ -4,4 +4,4 @@ // return supportsWebAssembly(); // }; -module.exports = () => { return "TODO: support AsyncWebAssemblyModulesPlugin.getCompilationHooks" } +module.exports = () => "TODO: support AsyncWebAssemblyModulesPlugin.getCompilationHooks" diff --git a/tests/webpack-test/configCases/wasm/missing-wasm-experiment/test.filter.js b/tests/webpack-test/configCases/wasm/missing-wasm-experiment/test.filter.js index ea5b412d4f6f..3655faf772fd 100644 --- a/tests/webpack-test/configCases/wasm/missing-wasm-experiment/test.filter.js +++ b/tests/webpack-test/configCases/wasm/missing-wasm-experiment/test.filter.js @@ -1,2 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return "FIXME: missing error" } + +module.exports = () => "FIXME: missing error" diff --git a/tests/webpack-test/configCases/wasm/wasm-in-initial-chunk-error/test.filter.js b/tests/webpack-test/configCases/wasm/wasm-in-initial-chunk-error/test.filter.js index b67df184ba9d..09d2234b4d79 100644 --- a/tests/webpack-test/configCases/wasm/wasm-in-initial-chunk-error/test.filter.js +++ b/tests/webpack-test/configCases/wasm/wasm-in-initial-chunk-error/test.filter.js @@ -4,5 +4,5 @@ // return supportsWebAssembly(); // }; -// TODO: Should create a issue for this test -module.exports = () => { return "TODO: support sync wasm" } + +module.exports = () => "TODO: support sync wasm" diff --git a/tests/webpack-test/configCases/web/node-source-future-defaults/test.filter.js b/tests/webpack-test/configCases/web/node-source-future-defaults/test.filter.js index 91b81b9944b2..ec7c1768403a 100644 --- a/tests/webpack-test/configCases/web/node-source-future-defaults/test.filter.js +++ b/tests/webpack-test/configCases/web/node-source-future-defaults/test.filter.js @@ -1,2 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return "FIXME: missing warnings" } + +module.exports = () => "FIXME: missing warnings" diff --git a/tests/webpack-test/configCases/web/node-source-global/test.filter.js b/tests/webpack-test/configCases/web/node-source-global/test.filter.js index 29b2dba04e89..8bfab37c9f8b 100644 --- a/tests/webpack-test/configCases/web/node-source-global/test.filter.js +++ b/tests/webpack-test/configCases/web/node-source-global/test.filter.js @@ -1 +1 @@ -module.exports = () => { return "FIXME: expect 'test' but got undefined" } +module.exports = () => "FIXME: expect 'test' but got undefined" diff --git a/tests/webpack-test/configCases/worker/self-import/test.filter.js b/tests/webpack-test/configCases/worker/self-import/test.filter.js index 3e5dcec1b113..27b31f49e310 100644 --- a/tests/webpack-test/configCases/worker/self-import/test.filter.js +++ b/tests/webpack-test/configCases/worker/self-import/test.filter.js @@ -4,4 +4,4 @@ // }; // Missing warning `This prevents using hashes of each other and should be avoided` -module.exports = () => { return "FIXME: missing warning" } +module.exports = () => "FIXME: missing warning" diff --git a/tests/webpack-test/hotCases/loader-import-module/css/test.filter.js b/tests/webpack-test/hotCases/loader-import-module/css/test.filter.js index bc746154a3f8..f427081e6f97 100644 --- a/tests/webpack-test/hotCases/loader-import-module/css/test.filter.js +++ b/tests/webpack-test/hotCases/loader-import-module/css/test.filter.js @@ -1,2 +1 @@ -// TODO: it just stucked... -module.exports = () => { return false } +module.exports = () => "FIXME: timeout" diff --git a/tests/webpack-test/hotCases/runtime/root-error/test.filter.js b/tests/webpack-test/hotCases/runtime/root-error/test.filter.js index aa7f955dd668..59287270b26f 100644 --- a/tests/webpack-test/hotCases/runtime/root-error/test.filter.js +++ b/tests/webpack-test/hotCases/runtime/root-error/test.filter.js @@ -1,3 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return false } +module.exports = () => "FIXME: recovery failed" diff --git a/tests/webpack-test/lib/util/filterUtil.js b/tests/webpack-test/lib/util/filterUtil.js index 39bd7be19367..5c29f7999016 100644 --- a/tests/webpack-test/lib/util/filterUtil.js +++ b/tests/webpack-test/lib/util/filterUtil.js @@ -1,10 +1,11 @@ const fs = require("fs"); const FilteredStatus = { - TODO: "TODO", + UNCHECKED: "UNCHECKED", // failed with reason that we don't know + TODO: "TODO", // failed by some features that we don't support + FIXME: "FIXME", // failed by some bug + NO_PLAN: "NO_PLAN", // failed by some features that we won't support PARTIAL_PASS: "PARTIAL_PASS", - FAILED: "FAILED", - NO_PLAN: "NO_PLAN", PASS: "PASS" } @@ -15,7 +16,11 @@ function validateFilteredStatus(status) { function createFilteredDescribe(testName, filterPath, config = {}) { let flag = true; if (fs.existsSync(filterPath)) { - flag = require(filterPath)(config) + try { + flag = require(filterPath)(config) + } catch (e) { + console.error(`get filter flag failed from '${filterPath}': ${e.message}`) + } } let shouldRun = flag === true || (Array.isArray(flag) && flag.includes(FilteredStatus.PARTIAL_PASS)) let filteredName = normalizeFilteredTestName(flag, testName); @@ -30,13 +35,20 @@ function normalizeFilterFlag(flag, testName) { return { status: FilteredStatus.PASS, reason: "" }; } if (flag === false) { - return { status: FilteredStatus.TODO, reason: "TODO" }; - } - if (flag === -1) { - return { status: FilteredStatus.NO_PLAN, reason: "No plan" }; + return { status: FilteredStatus.UNCHECKED, reason: "UNKNOWN" }; } if (typeof flag === 'string') { - return { status: FilteredStatus.FAILED, reason: flag } + let status = flag.split(":")[0] || "FAILED"; + let reason = flag.split(":")[1] || "UNKNOWN"; + if (status === "TODO") { + return { status: FilteredStatus.TODO, reason } + } else if (status === "NOPLAN") { + return { status: FilteredStatus.NO_PLAN, reason } + } else if (status === "FIXME") { + return { status: FilteredStatus.FIXME, reason } + } else { + return { status: FilteredStatus.UNCHECKED, reason } + } } if (Array.isArray(flag)) { const [status, reason = "empty"] = flag; diff --git a/tests/webpack-test/scripts/test-metric-util.js b/tests/webpack-test/scripts/test-metric-util.js index c35e9a5f3caf..1b22f133d0d1 100644 --- a/tests/webpack-test/scripts/test-metric-util.js +++ b/tests/webpack-test/scripts/test-metric-util.js @@ -11,7 +11,7 @@ function extractTestMetric(jsonObj) { const passedTests = jsonObj.numPassedTests; const avgTestPerCase = passedTests / (fullPass + partialPass * 0.5); - const totalTests = Math.round(passedTests + (partialPass * 0.5 * avgTestPerCase) + (total - fullPass - partialPass) * avgTestPerCase); + const totalTests = Math.round(passedTests + (partialPass * 0.5 * avgTestPerCase) + (total - fullPass - partialPass - noPlan) * avgTestPerCase); // in theory, if we could get correct stats of failedTests and failedTestSuites // the stats generated by jest should be valid, so we don't need to check any more @@ -62,11 +62,12 @@ function renderTestToMarkdown(testFullName) { let extra = ""; if (decoded !== null) { icon = decoded.status === FilteredStatus.TODO ? "⚪️" - : decoded.status === FilteredStatus.NO_PLAN ? "⚫️" - : decoded.status === FilteredStatus.FAILED ? "🔴" - : decoded.status === FilteredStatus.PARTIAL_PASS ? "🟡" - : decoded.status === FilteredStatus.PASS ? "🟢" - : "ERROR" + : decoded.status === FilteredStatus.NO_PLAN ? "⚫️" + : decoded.status === FilteredStatus.UNCHECKED ? "🔴" + : decoded.status === FilteredStatus.FIXME ? "🔴" + : decoded.status === FilteredStatus.PARTIAL_PASS ? "🟡" + : decoded.status === FilteredStatus.PASS ? "🟢" + : "ERROR" fullName = decoded.fullName; extra = `: ${decoded.reason}` } diff --git a/tests/webpack-test/statsCases/aggressive-splitting-entry/test.filter.js b/tests/webpack-test/statsCases/aggressive-splitting-entry/test.filter.js index aa7f955dd668..68ea0e440c15 100644 --- a/tests/webpack-test/statsCases/aggressive-splitting-entry/test.filter.js +++ b/tests/webpack-test/statsCases/aggressive-splitting-entry/test.filter.js @@ -1,3 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return false } +module.exports = () => "NOPLAN: support AggressiveSplittingPlugin" diff --git a/tests/webpack-test/statsCases/named-chunks-plugin-async/test.filter.js b/tests/webpack-test/statsCases/named-chunks-plugin-async/test.filter.js index aa7f955dd668..87c8432d087d 100644 --- a/tests/webpack-test/statsCases/named-chunks-plugin-async/test.filter.js +++ b/tests/webpack-test/statsCases/named-chunks-plugin-async/test.filter.js @@ -1,3 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return false } +module.exports = () => "NOPLAN: support NamedChunkIdsPlugin" diff --git a/tests/webpack-test/statsCases/wasm-explorer-examples-sync/test.filter.js b/tests/webpack-test/statsCases/wasm-explorer-examples-sync/test.filter.js index 249faaf40dfa..fc3c24e0652e 100644 --- a/tests/webpack-test/statsCases/wasm-explorer-examples-sync/test.filter.js +++ b/tests/webpack-test/statsCases/wasm-explorer-examples-sync/test.filter.js @@ -1,11 +1,7 @@ -/** var supportsWebAssembly = require("../../helpers/supportsWebAssembly"); -module.exports = function(config) { +module.exports = function (config) { return supportsWebAssembly(); }; -*/ -// TODO: Should create a issue for this test -module.exports = () => { return false } diff --git a/tests/webpack-test/watchCases/cache/add-defines/test.filter.js b/tests/webpack-test/watchCases/cache/add-defines/test.filter.js index 6dc0e0a010ce..c8e0e2e3d95c 100644 --- a/tests/webpack-test/watchCases/cache/add-defines/test.filter.js +++ b/tests/webpack-test/watchCases/cache/add-defines/test.filter.js @@ -1,7 +1,5 @@ -/*module.exports = function (config) { - return !(config.experiments && config.experiments.cacheUnaffected); -}; -*/ -// TODO: Should create a issue for this test -module.exports = () => { return false } +// module.exports = function (config) { +// return !(config.experiments && config.experiments.cacheUnaffected); +// }; +module.exports = () => "FIXME: timeout" diff --git a/tests/webpack-test/watchCases/cache/child-compilation-cache/test.filter.js b/tests/webpack-test/watchCases/cache/child-compilation-cache/test.filter.js index aa7f955dd668..4682a5226cac 100644 --- a/tests/webpack-test/watchCases/cache/child-compilation-cache/test.filter.js +++ b/tests/webpack-test/watchCases/cache/child-compilation-cache/test.filter.js @@ -1,3 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return false } +module.exports = () => "NOPLAN: cache is different with webpack" diff --git a/tests/webpack-test/watchCases/cache/loader-import-module/test.filter.js b/tests/webpack-test/watchCases/cache/loader-import-module/test.filter.js index 507859202e52..801f667a4874 100644 --- a/tests/webpack-test/watchCases/cache/loader-import-module/test.filter.js +++ b/tests/webpack-test/watchCases/cache/loader-import-module/test.filter.js @@ -1,5 +1,2 @@ -// TODO: Should create a issue for this test -// FIXME: A jest worker process (pid=75037) was terminated by another process: signal=SIGABRT, exitCode=null. Operating system logs may contain more information on why this occurred. -// TODO: confirm -module.exports = () => { return false } +module.exports = () => "FIXME: panic" diff --git a/tests/webpack-test/watchCases/cache/managedPath/test.filter.js b/tests/webpack-test/watchCases/cache/managedPath/test.filter.js index cb2b36c59248..4682a5226cac 100644 --- a/tests/webpack-test/watchCases/cache/managedPath/test.filter.js +++ b/tests/webpack-test/watchCases/cache/managedPath/test.filter.js @@ -1,4 +1,2 @@ -// TODO: Should create a issue for this test -// FIXME: A jest worker process (pid=75037) was terminated by another process: signal=SIGABRT, exitCode=null. Operating system logs may contain more information on why this occurred. -module.exports = () => { return false } +module.exports = () => "NOPLAN: cache is different with webpack" diff --git a/tests/webpack-test/watchCases/cache/unsafe-cache-duplicates/test.filter.js b/tests/webpack-test/watchCases/cache/unsafe-cache-duplicates/test.filter.js index 70fe33d2a390..4682a5226cac 100644 --- a/tests/webpack-test/watchCases/cache/unsafe-cache-duplicates/test.filter.js +++ b/tests/webpack-test/watchCases/cache/unsafe-cache-duplicates/test.filter.js @@ -1,4 +1,2 @@ -// TODO: Should create a issue for this test -// FIXME: timeout -module.exports = () => { return false } +module.exports = () => "NOPLAN: cache is different with webpack" diff --git a/tests/webpack-test/watchCases/plugins/automatic-prefetch-plugin-9485/test.filter.js b/tests/webpack-test/watchCases/plugins/automatic-prefetch-plugin-9485/test.filter.js index aa7f955dd668..dc7f8f19bebd 100644 --- a/tests/webpack-test/watchCases/plugins/automatic-prefetch-plugin-9485/test.filter.js +++ b/tests/webpack-test/watchCases/plugins/automatic-prefetch-plugin-9485/test.filter.js @@ -1,3 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return false } +module.exports = () => "NOPLAN: support AutomaticPrefetchPlugin" diff --git a/tests/webpack-test/watchCases/plugins/automatic-prefetch-plugin/test.filter.js b/tests/webpack-test/watchCases/plugins/automatic-prefetch-plugin/test.filter.js index aa7f955dd668..dc7f8f19bebd 100644 --- a/tests/webpack-test/watchCases/plugins/automatic-prefetch-plugin/test.filter.js +++ b/tests/webpack-test/watchCases/plugins/automatic-prefetch-plugin/test.filter.js @@ -1,3 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return false } +module.exports = () => "NOPLAN: support AutomaticPrefetchPlugin" diff --git a/tests/webpack-test/watchCases/plugins/define-plugin/test.filter.js b/tests/webpack-test/watchCases/plugins/define-plugin/test.filter.js index aa7f955dd668..dfc4c560df6c 100644 --- a/tests/webpack-test/watchCases/plugins/define-plugin/test.filter.js +++ b/tests/webpack-test/watchCases/plugins/define-plugin/test.filter.js @@ -1,3 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return false } +module.exports = () => "TODO: support DefinePlugin.runtimeValue" diff --git a/tests/webpack-test/watchCases/plugins/dll-reference-plugin/test.filter.js b/tests/webpack-test/watchCases/plugins/dll-reference-plugin/test.filter.js index aa7f955dd668..e5ec670854ac 100644 --- a/tests/webpack-test/watchCases/plugins/dll-reference-plugin/test.filter.js +++ b/tests/webpack-test/watchCases/plugins/dll-reference-plugin/test.filter.js @@ -1,3 +1,3 @@ -// TODO: Should create a issue for this test -module.exports = () => { return false } + +module.exports = () => "NOPLAN: support ModuleConcatenationPlugin" diff --git a/tests/webpack-test/watchCases/plugins/profiling-plugin/test.filter.js b/tests/webpack-test/watchCases/plugins/profiling-plugin/test.filter.js index aa7f955dd668..e59e883d96e8 100644 --- a/tests/webpack-test/watchCases/plugins/profiling-plugin/test.filter.js +++ b/tests/webpack-test/watchCases/plugins/profiling-plugin/test.filter.js @@ -1,3 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return false } +module.exports = () => "NOPLAN: support ProfilingPlugin" diff --git a/tests/webpack-test/watchCases/plugins/watch-ignore-plugin/test.filter.js b/tests/webpack-test/watchCases/plugins/watch-ignore-plugin/test.filter.js index aa7f955dd668..864de97dd99f 100644 --- a/tests/webpack-test/watchCases/plugins/watch-ignore-plugin/test.filter.js +++ b/tests/webpack-test/watchCases/plugins/watch-ignore-plugin/test.filter.js @@ -1,3 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return false } +module.exports = () => "NOPLAN: support WatchIgnorePlugin" diff --git a/tests/webpack-test/watchCases/resolve/in-loader/test.filter.js b/tests/webpack-test/watchCases/resolve/in-loader/test.filter.js index aa7f955dd668..0fabf339ce32 100644 --- a/tests/webpack-test/watchCases/resolve/in-loader/test.filter.js +++ b/tests/webpack-test/watchCases/resolve/in-loader/test.filter.js @@ -1,3 +1,2 @@ -// TODO: Should create a issue for this test -module.exports = () => { return false } +module.exports = () => "FIXME: timeout" From 015c80dce612dafcb68d8cf5192817a750d3356a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 24 May 2025 21:31:08 +0800 Subject: [PATCH 33/50] chore(deps): update dependency zod to ^3.25.28 (#10461) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- packages/rspack/package.json | 2 +- pnpm-lock.yaml | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/rspack/package.json b/packages/rspack/package.json index 5138144cfff6..0a68968039b4 100644 --- a/packages/rspack/package.json +++ b/packages/rspack/package.json @@ -60,7 +60,7 @@ "typescript": "^5.8.3", "watchpack": "^2.4.3", "webpack-sources": "3.3.0", - "zod": "^3.24.4", + "zod": "^3.25.28", "zod-validation-error": "3.4.1", "tinypool": "^1.0.2" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d7108a8e6e6b..cea323a1babf 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -341,11 +341,11 @@ importers: specifier: 3.3.0 version: 3.3.0 zod: - specifier: ^3.24.4 - version: 3.24.4 + specifier: ^3.25.28 + version: 3.25.28 zod-validation-error: specifier: 3.4.1 - version: 3.4.1(zod@3.24.4) + version: 3.4.1(zod@3.25.28) packages/rspack-cli: dependencies: @@ -8042,8 +8042,8 @@ packages: peerDependencies: zod: ^3.24.4 - zod@3.24.4: - resolution: {integrity: sha512-OdqJE9UDRPwWsrHjLN2F8bPxvwJBK22EHLWtanu0LSYr5YqzsaaW3RMgmjwr8Rypg5k+meEJdSPXJZXE/yqOMg==} + zod@3.25.28: + resolution: {integrity: sha512-/nt/67WYKnr5by3YS7LroZJbtcCBurDKKPBPWWzaxvVCGuG/NOsiKkrjoOhI8mJ+SQUXEbUzeB3S+6XDUEEj7Q==} zwitch@2.0.4: resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==} @@ -16077,11 +16077,11 @@ snapshots: yoctocolors-cjs@2.1.2: {} - zod-validation-error@3.4.1(zod@3.24.4): + zod-validation-error@3.4.1(zod@3.25.28): dependencies: - zod: 3.24.4 + zod: 3.25.28 - zod@3.24.4: {} + zod@3.25.28: {} zwitch@2.0.4: {} From 97d26628639ef71306600e59f0a703ca572463c6 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 24 May 2025 21:31:26 +0800 Subject: [PATCH 34/50] chore(deps): update dependency @rslib/core to v0.8.0 (#10459) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- packages/create-rspack/package.json | 2 +- packages/rspack-cli/package.json | 2 +- packages/rspack/package.json | 2 +- pnpm-lock.yaml | 228 +++++++++++++++++++++------- 4 files changed, 176 insertions(+), 58 deletions(-) diff --git a/packages/create-rspack/package.json b/packages/create-rspack/package.json index 07b0501bbb9d..a81f11ce974f 100644 --- a/packages/create-rspack/package.json +++ b/packages/create-rspack/package.json @@ -27,7 +27,7 @@ "create-rstack": "1.4.5" }, "devDependencies": { - "@rslib/core": "0.7.0", + "@rslib/core": "0.8.0", "typescript": "^5.8.3" }, "publishConfig": { diff --git a/packages/rspack-cli/package.json b/packages/rspack-cli/package.json index f1efaccf7a33..dbff7497d9a4 100644 --- a/packages/rspack-cli/package.json +++ b/packages/rspack-cli/package.json @@ -43,7 +43,7 @@ "yargs": "17.7.2" }, "devDependencies": { - "@rslib/core": "0.7.0", + "@rslib/core": "0.8.0", "@rspack/core": "workspace:*", "@types/interpret": "^1.1.3", "@types/rechoir": "^0.6.4", diff --git a/packages/rspack/package.json b/packages/rspack/package.json index 0a68968039b4..5fab919a0acf 100644 --- a/packages/rspack/package.json +++ b/packages/rspack/package.json @@ -48,7 +48,7 @@ "devDependencies": { "@swc/core": "1.11.24", "@swc/types": "0.1.21", - "@rslib/core": "0.7.0", + "@rslib/core": "0.8.0", "@types/graceful-fs": "4.1.9", "@types/watchpack": "^2.4.4", "@types/webpack-sources": "3.2.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index cea323a1babf..ff7a0311c93f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -147,8 +147,8 @@ importers: version: 1.4.5 devDependencies: '@rslib/core': - specifier: 0.7.0 - version: 0.7.0(@microsoft/api-extractor@7.52.5(@types/node@20.17.50))(typescript@5.8.3) + specifier: 0.8.0 + version: 0.8.0(@microsoft/api-extractor@7.52.5(@types/node@20.17.50))(typescript@5.8.3) typescript: specifier: ^5.8.3 version: 5.8.3 @@ -296,8 +296,8 @@ importers: version: 1.0.30001718 devDependencies: '@rslib/core': - specifier: 0.7.0 - version: 0.7.0(@microsoft/api-extractor@7.52.5(@types/node@20.17.50))(typescript@5.8.3) + specifier: 0.8.0 + version: 0.8.0(@microsoft/api-extractor@7.52.5(@types/node@20.17.50))(typescript@5.8.3) '@swc/core': specifier: 1.11.24 version: 1.11.24(@swc/helpers@0.5.17) @@ -375,8 +375,8 @@ importers: version: 17.7.2 devDependencies: '@rslib/core': - specifier: 0.7.0 - version: 0.7.0(@microsoft/api-extractor@7.52.5(@types/node@20.17.50))(typescript@5.8.3) + specifier: 0.8.0 + version: 0.8.0(@microsoft/api-extractor@7.52.5(@types/node@20.17.50))(typescript@5.8.3) '@rspack/core': specifier: workspace:* version: link:../rspack @@ -1109,62 +1109,62 @@ packages: '@asamuzakjp/css-color@2.8.2': resolution: {integrity: sha512-RtWv9jFN2/bLExuZgFFZ0I3pWWeezAHGgrmjqGGWclATl1aDe3yhCUaI0Ilkp6OCk9zX7+FjvDasEX8Q9Rxc5w==} - '@ast-grep/napi-darwin-arm64@0.38.1': - resolution: {integrity: sha512-1YG5PgqfcDleO/5AFsbEDjkOYGLyth2oWpAUhz/JE7mzPdax586O/oBcISPDP2jV7QUGIV5TJ8J8Feft/No1gg==} + '@ast-grep/napi-darwin-arm64@0.37.0': + resolution: {integrity: sha512-QAiIiaAbLvMEg/yBbyKn+p1gX2/FuaC0SMf7D7capm/oG4xGMzdeaQIcSosF4TCxxV+hIH4Bz9e4/u7w6Bnk3Q==} engines: {node: '>= 10'} cpu: [arm64] os: [darwin] - '@ast-grep/napi-darwin-x64@0.38.1': - resolution: {integrity: sha512-2ubMVa8BZaqmwsPTDpScIWTorQfXug8XIBI+1TsbUgpVQFTQREZ5U0s7M3uOJ/bQqxx+14easGX4Z/IyH6heuA==} + '@ast-grep/napi-darwin-x64@0.37.0': + resolution: {integrity: sha512-zvcvdgekd4ySV3zUbUp8HF5nk5zqwiMXTuVzTUdl/w08O7JjM6XPOIVT+d2o/MqwM9rsXdzdergY5oY2RdhSPA==} engines: {node: '>= 10'} cpu: [x64] os: [darwin] - '@ast-grep/napi-linux-arm64-gnu@0.38.1': - resolution: {integrity: sha512-fUr02gEA4mweG7xfHch66/LlAyyOwiGHczUlfST9g84vThMGY/YEqjgiMwuUlynglvYzW/Cr9Wd1zEapvnW6zA==} + '@ast-grep/napi-linux-arm64-gnu@0.37.0': + resolution: {integrity: sha512-L7Sj0lXy8X+BqSMgr1LB8cCoWk0rericdeu+dC8/c8zpsav5Oo2IQKY1PmiZ7H8IHoFBbURLf8iklY9wsD+cyA==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] - '@ast-grep/napi-linux-arm64-musl@0.38.1': - resolution: {integrity: sha512-Cm0BbMcHPqg2IrUL2Rn1WdLcFzi8L2iqm62+hKs6334ht7OgFezt3YhoLgzP75bstNNlGT9NJuSk1m6/Fxa0HA==} + '@ast-grep/napi-linux-arm64-musl@0.37.0': + resolution: {integrity: sha512-LF9sAvYy6es/OdyJDO3RwkX3I82Vkfsng1sqUBcoWC1jVb1wX5YVzHtpQox9JrEhGl+bNp7FYxB4Qba9OdA5GA==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] - '@ast-grep/napi-linux-x64-gnu@0.38.1': - resolution: {integrity: sha512-EThfZGW8OekPIS1rHJj6MpU9d14YZQazp24bb7QWcyyfo4lbe9etexLuF7ujbGF/rMovhi2TRbF/Tn0HvuJBpg==} + '@ast-grep/napi-linux-x64-gnu@0.37.0': + resolution: {integrity: sha512-TViz5/klqre6aSmJzswEIjApnGjJzstG/SE8VDWsrftMBMYt2PTu3MeluZVwzSqDao8doT/P+6U11dU05UOgxw==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - '@ast-grep/napi-linux-x64-musl@0.38.1': - resolution: {integrity: sha512-PnI1RRP9yn+yyGUjxCXzgiUktEDH/gUyfV3tEFZEjqWzTZFUd7TdkC7hB6HlIHFrJ2ykXWUBMwXRR3k/2XDaMw==} + '@ast-grep/napi-linux-x64-musl@0.37.0': + resolution: {integrity: sha512-/BcCH33S9E3ovOAEoxYngUNXgb+JLg991sdyiNP2bSoYd30a9RHrG7CYwW6fMgua3ijQ474eV6cq9yZO1bCpXg==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - '@ast-grep/napi-win32-arm64-msvc@0.38.1': - resolution: {integrity: sha512-Q6xEk2KTjZIYuDi3sIgHYF87i6uhly6g5kJC7G2loW1Io9GApHKqpLBuDdTSApwzwbwQgfyeLDPdHvwu5P1y5A==} + '@ast-grep/napi-win32-arm64-msvc@0.37.0': + resolution: {integrity: sha512-TjQA4cFoIEW2bgjLkaL9yqT4XWuuLa5MCNd0VCDhGRDMNQ9+rhwi9eLOWRaap3xzT7g+nlbcEHL3AkVCD2+b3A==} engines: {node: '>= 10'} cpu: [arm64] os: [win32] - '@ast-grep/napi-win32-ia32-msvc@0.38.1': - resolution: {integrity: sha512-k2GnuAv30+XATjgEUZNb2gtWU7g7H4CvsSwaZLgvlpsKfMTIXf9julksh8M5WkU5F4WIx40wEUQeDALoKO/Ltw==} + '@ast-grep/napi-win32-ia32-msvc@0.37.0': + resolution: {integrity: sha512-uNmVka8fJCdYsyOlF9aZqQMLTatEYBynjChVTzUfFMDfmZ0bihs/YTqJVbkSm8TZM7CUX82apvn50z/dX5iWRA==} engines: {node: '>= 10'} cpu: [ia32] os: [win32] - '@ast-grep/napi-win32-x64-msvc@0.38.1': - resolution: {integrity: sha512-bbV/GNY4QCEahpo5MvRXkUg7m1wDamfQzaS2f0ncUr7ZW2ML6RC0qR7yQy3eLCvpdZl3cXUBnGydEsMe3hTnvw==} + '@ast-grep/napi-win32-x64-msvc@0.37.0': + resolution: {integrity: sha512-vCiFOT3hSCQuHHfZ933GAwnPzmL0G04JxQEsBRfqONywyT8bSdDc/ECpAfr3S9VcS4JZ9/F6tkePKW/Om2Dq2g==} engines: {node: '>= 10'} cpu: [x64] os: [win32] - '@ast-grep/napi@0.38.1': - resolution: {integrity: sha512-7OxLNxyugFYRMNksdyQXo806BDHA+SClHmGD7H5IJXeiRS4ICEV5NAYiLxr1NAOOKVwwFk0yFQj0YZ2BkH8joA==} + '@ast-grep/napi@0.37.0': + resolution: {integrity: sha512-Hb4o6h1Pf6yRUAX07DR4JVY7dmQw+RVQMW5/m55GoiAT/VRoKCWBtIUPPOnqDVhbx1Cjfil9b6EDrgJsUAujEQ==} engines: {node: '>= 10'} '@babel/code-frame@7.26.2': @@ -2676,6 +2676,11 @@ packages: engines: {node: '>=16.10.0'} hasBin: true + '@rsbuild/core@1.3.20': + resolution: {integrity: sha512-5VxOddgGHaq5x4ONdKOZvLYLj8dhVfCAz+cERNLXrKLzBISouY1A9TJcbZBK4xoH/0DJrDtDzapNA+dI9Jr07Q==} + engines: {node: '>=16.10.0'} + hasBin: true + '@rsbuild/plugin-react@1.3.1': resolution: {integrity: sha512-1PfE0CZDwiSIUFaMFOEprwsHK6oo29zU6DdtFH2D49uLcpUdOUvU1u2p00RCVO1CIgnAjRajLS7dnPdQUwFOuQ==} peerDependencies: @@ -2686,8 +2691,8 @@ packages: peerDependencies: '@rsbuild/core': 1.x - '@rslib/core@0.7.0': - resolution: {integrity: sha512-FWP2OkpQ30MWcxYd6L9RhAUl9fxW0MpYbEPZRQ1Cop/9awldM+ZrJsnhnz4ySTsqpTxCTBcsYGReGKY19TwR6w==} + '@rslib/core@0.8.0': + resolution: {integrity: sha512-VAhoyCX2HcHr7Yuxbu2ED1l1Lr6+WSM8mKl5nMBdk/SPhMZGMb887wcsnC4dC+AN9zDPdebHSnrRclV55JaPow==} engines: {node: '>=16.7.0'} hasBin: true peerDependencies: @@ -2699,6 +2704,11 @@ packages: typescript: optional: true + '@rspack/binding-darwin-arm64@1.3.10': + resolution: {integrity: sha512-0k/j8OeMSVm5u5Nzckp9Ie7S7hprnvNegebnGr+L6VCyD7sMqm4m+4rLHs99ZklYdH0dZtY2+LrzrtjUZCqfew==} + cpu: [arm64] + os: [darwin] + '@rspack/binding-darwin-arm64@1.3.11': resolution: {integrity: sha512-sGoFDXYNinubhEiPSjtA/ua3qhMj6VVBPTSDvprZj+MT18YV7tQQtwBpm+8sbqJ1P5y+a3mzsP3IphRWyIQyXw==} cpu: [arm64] @@ -2709,6 +2719,11 @@ packages: cpu: [arm64] os: [darwin] + '@rspack/binding-darwin-x64@1.3.10': + resolution: {integrity: sha512-jOyqYW/18cgxw60wK5oqJvM194pbD4H99xaif89McNtLkH3npFvBkXBHVWWuOHGoXNX0LhRpHcI89p9b9THQZQ==} + cpu: [x64] + os: [darwin] + '@rspack/binding-darwin-x64@1.3.11': resolution: {integrity: sha512-4zgOkCLxhp4Ki98GuDaZgz4exXcE4+sgvXY/xA/A5FGPVRbfQLQ5psSOk0F/gvMua1r15E66loQRJpuzUK6bTA==} cpu: [x64] @@ -2719,6 +2734,11 @@ packages: cpu: [x64] os: [darwin] + '@rspack/binding-linux-arm64-gnu@1.3.10': + resolution: {integrity: sha512-zhF5ZNaT/7pxrm8xD3dWG1b4x+FO3LbVeZZG448CjpSo5T57kPD+SaGUU1GcPpn6mexf795x0SVS49aH7/e3Dg==} + cpu: [arm64] + os: [linux] + '@rspack/binding-linux-arm64-gnu@1.3.11': resolution: {integrity: sha512-NIOaIfYUmJs1XL4lbGVtcMm1KlA/6ZR6oAbs2ekofKXtJYAFQgnLTf7ZFmIwVjS0mP78BmeSNcIM6pd2w5id4w==} cpu: [arm64] @@ -2729,6 +2749,11 @@ packages: cpu: [arm64] os: [linux] + '@rspack/binding-linux-arm64-musl@1.3.10': + resolution: {integrity: sha512-o3x7IrOSCHK6lcRvdZgsSuOG1CHRQR00xiyLW7kkWmNm7t417LC9xdFWKIK62C5fKXGC5YcTbUkDMnQujespkg==} + cpu: [arm64] + os: [linux] + '@rspack/binding-linux-arm64-musl@1.3.11': resolution: {integrity: sha512-CRRAQ379uzA2QfD9HHNtxuuqzGksUapMVcTLY5NIXWfvHLUJShdlSJQv3UQcqgAJNrMY7Ex1PnoQs1jZgUiqZA==} cpu: [arm64] @@ -2739,6 +2764,11 @@ packages: cpu: [arm64] os: [linux] + '@rspack/binding-linux-x64-gnu@1.3.10': + resolution: {integrity: sha512-FMSi28VZhXMr15picOHFynULhqZ/FODPxRIS6uNrvPRYcbNuiO1v+VHV6X88mhOMmJ/aVF6OwjUO/o2l1FVa9Q==} + cpu: [x64] + os: [linux] + '@rspack/binding-linux-x64-gnu@1.3.11': resolution: {integrity: sha512-k3OyvLneX2ZeL8z/OzPojpImqy6PgqKJD+NtOvcr/TgbgADHZ3xQttf6B2X+qnZMAgOZ+RTeTkOFrvsg9AEKmA==} cpu: [x64] @@ -2749,6 +2779,11 @@ packages: cpu: [x64] os: [linux] + '@rspack/binding-linux-x64-musl@1.3.10': + resolution: {integrity: sha512-e0xbY9SlbRGIFz41v1yc0HfREvmgMnLV1bLmTSPK8wI2suIEJ7iYYqsocHOAOk86qLZcxVrTnL6EjUcNaRTWlg==} + cpu: [x64] + os: [linux] + '@rspack/binding-linux-x64-musl@1.3.11': resolution: {integrity: sha512-2agcELyyQ95jWGCW0YWD0TvAcN40yUjmxn9NXQBLHPX5Eb07NaHXairMsvV9vqQsPsq0nxxfd9Wsow18Y5r/Hw==} cpu: [x64] @@ -2759,6 +2794,11 @@ packages: cpu: [x64] os: [linux] + '@rspack/binding-win32-arm64-msvc@1.3.10': + resolution: {integrity: sha512-YHJPvEujWeWjU6EUF6sDpaec9rsOtKVvy16YCtGaxRpDQXqfuxibnp6Ge0ZTTrY+joRiWehRA9OUI+3McqI+QA==} + cpu: [arm64] + os: [win32] + '@rspack/binding-win32-arm64-msvc@1.3.11': resolution: {integrity: sha512-sjGoChazu0krigT/LVwGUsgCv3D3s/4cR/3P4VzuDNVlb4pbh1CDa642Fr0TceqAXCeKW5GiL/EQOfZ4semtcQ==} cpu: [arm64] @@ -2769,6 +2809,11 @@ packages: cpu: [arm64] os: [win32] + '@rspack/binding-win32-ia32-msvc@1.3.10': + resolution: {integrity: sha512-2iwSBzVBC89ZSk56MYwgirh3bda2WKmL9I3qPajiTEivChXpX7jp83jAtGE6CPqPYcccYz6nrURTHNUZhqXxVw==} + cpu: [ia32] + os: [win32] + '@rspack/binding-win32-ia32-msvc@1.3.11': resolution: {integrity: sha512-tjywW84oQLSqRmvQZ+fXP7e3eNmjScYrlWEPAQFjf08N19iAJ9UOGuuFw8Fk5ZmrlNZ2Qo9ASSOI7Nnwx2aZYg==} cpu: [ia32] @@ -2779,6 +2824,11 @@ packages: cpu: [ia32] os: [win32] + '@rspack/binding-win32-x64-msvc@1.3.10': + resolution: {integrity: sha512-ehWJ9Y5Zezj/+uJpiWbt29RZaRIM00f91PWuabM6/sKmHJhdCEE21u5iI3B8DeW/EjJsH8zkI69YYAxJWwGn9A==} + cpu: [x64] + os: [win32] + '@rspack/binding-win32-x64-msvc@1.3.11': resolution: {integrity: sha512-pPy3yU6SAMfEPY7ki1KAetiDFfRbkYMiX3F89P9kX01UAePkLRNsjacHF4w7N3EsBsWn1FlGaYZdlzmOI5pg2Q==} cpu: [x64] @@ -2789,12 +2839,24 @@ packages: cpu: [x64] os: [win32] + '@rspack/binding@1.3.10': + resolution: {integrity: sha512-9TjO+Ig5U4VqdYWpBsv01n4d2KsgFfdXGIE7zdHXDDbry0avL0J4109ESqSeP9uC+Bi7ZCF53iaxJRvZDflNVQ==} + '@rspack/binding@1.3.11': resolution: {integrity: sha512-BbMfZHqfH+CzFtZDg+v9nbKifJIJDUPD6KuoWlHq581koKvD3UMx6oVrj9w13JvO2xWNPeHclmqWAFgoD7faEQ==} '@rspack/binding@1.3.9': resolution: {integrity: sha512-3FFen1/0F2aP5uuCm8vPaJOrzM3karCPNMsc5gLCGfEy2rsK38Qinf9W4p1bw7+FhjOTzoSdkX+LFHeMDVxJhw==} + '@rspack/core@1.3.10': + resolution: {integrity: sha512-YomvSRGuMUQgCE2rNMdff2q1Z0YpZw/z6m5+PVTMSs9l/q69YKUzpbpSD8YyB5i1DddrRxC2RE34DkrBuwlREQ==} + engines: {node: '>=16.0.0'} + peerDependencies: + '@swc/helpers': '>=0.5.1' + peerDependenciesMeta: + '@swc/helpers': + optional: true + '@rspack/core@1.3.11': resolution: {integrity: sha512-aSYPtT1gum5MCfcFANdTroJ4JwzozuL3wX0twMGNAB7amq6+nZrbsUKWjcHgneCeZdahxzrKdyYef3FHaJ7lEA==} engines: {node: '>=16.0.0'} @@ -6764,8 +6826,8 @@ packages: rrweb-cssom@0.8.0: resolution: {integrity: sha512-guoltQEx+9aMf2gDZ0s62EcV8lsXR+0w8915TC3ITdn2YueuNjdAYh/levpU9nFaoChh9RUS5ZdQMrKfVEN9tw==} - rsbuild-plugin-dts@0.7.0: - resolution: {integrity: sha512-1N3lIeKmEXrcu5jxw8RFUhc5rN35WVHR+j2Hw5gE5mhPCMtGpCpMKeSPUoRdWbfNuzjmSlln6nCLoMRdMAv+oA==} + rsbuild-plugin-dts@0.8.0: + resolution: {integrity: sha512-OF+rh7nBwekVLJgBB+jcBouhgfN0gvnjF16fVKG2wTG8qlq9YaxaAg1shErycyGyBq/FxG7zuMVDP8OWuHOmmQ==} engines: {node: '>=16.7.0'} peerDependencies: '@microsoft/api-extractor': ^7 @@ -8198,44 +8260,44 @@ snapshots: '@csstools/css-tokenizer': 3.0.3 lru-cache: 11.0.2 - '@ast-grep/napi-darwin-arm64@0.38.1': + '@ast-grep/napi-darwin-arm64@0.37.0': optional: true - '@ast-grep/napi-darwin-x64@0.38.1': + '@ast-grep/napi-darwin-x64@0.37.0': optional: true - '@ast-grep/napi-linux-arm64-gnu@0.38.1': + '@ast-grep/napi-linux-arm64-gnu@0.37.0': optional: true - '@ast-grep/napi-linux-arm64-musl@0.38.1': + '@ast-grep/napi-linux-arm64-musl@0.37.0': optional: true - '@ast-grep/napi-linux-x64-gnu@0.38.1': + '@ast-grep/napi-linux-x64-gnu@0.37.0': optional: true - '@ast-grep/napi-linux-x64-musl@0.38.1': + '@ast-grep/napi-linux-x64-musl@0.37.0': optional: true - '@ast-grep/napi-win32-arm64-msvc@0.38.1': + '@ast-grep/napi-win32-arm64-msvc@0.37.0': optional: true - '@ast-grep/napi-win32-ia32-msvc@0.38.1': + '@ast-grep/napi-win32-ia32-msvc@0.37.0': optional: true - '@ast-grep/napi-win32-x64-msvc@0.38.1': + '@ast-grep/napi-win32-x64-msvc@0.37.0': optional: true - '@ast-grep/napi@0.38.1': + '@ast-grep/napi@0.37.0': optionalDependencies: - '@ast-grep/napi-darwin-arm64': 0.38.1 - '@ast-grep/napi-darwin-x64': 0.38.1 - '@ast-grep/napi-linux-arm64-gnu': 0.38.1 - '@ast-grep/napi-linux-arm64-musl': 0.38.1 - '@ast-grep/napi-linux-x64-gnu': 0.38.1 - '@ast-grep/napi-linux-x64-musl': 0.38.1 - '@ast-grep/napi-win32-arm64-msvc': 0.38.1 - '@ast-grep/napi-win32-ia32-msvc': 0.38.1 - '@ast-grep/napi-win32-x64-msvc': 0.38.1 + '@ast-grep/napi-darwin-arm64': 0.37.0 + '@ast-grep/napi-darwin-x64': 0.37.0 + '@ast-grep/napi-linux-arm64-gnu': 0.37.0 + '@ast-grep/napi-linux-arm64-musl': 0.37.0 + '@ast-grep/napi-linux-x64-gnu': 0.37.0 + '@ast-grep/napi-linux-x64-musl': 0.37.0 + '@ast-grep/napi-win32-arm64-msvc': 0.37.0 + '@ast-grep/napi-win32-ia32-msvc': 0.37.0 + '@ast-grep/napi-win32-x64-msvc': 0.37.0 '@babel/code-frame@7.26.2': dependencies: @@ -9764,6 +9826,14 @@ snapshots: core-js: 3.42.0 jiti: 2.4.2 + '@rsbuild/core@1.3.20': + dependencies: + '@rspack/core': 1.3.10(@swc/helpers@0.5.17) + '@rspack/lite-tapable': 1.0.1 + '@swc/helpers': 0.5.17 + core-js: 3.42.0 + jiti: 2.4.2 + '@rsbuild/plugin-react@1.3.1(@rsbuild/core@1.3.19)': dependencies: '@rsbuild/core': 1.3.19 @@ -9781,69 +9851,108 @@ snapshots: reduce-configs: 1.1.0 sass-embedded: 1.86.1 - '@rslib/core@0.7.0(@microsoft/api-extractor@7.52.5(@types/node@20.17.50))(typescript@5.8.3)': + '@rslib/core@0.8.0(@microsoft/api-extractor@7.52.5(@types/node@20.17.50))(typescript@5.8.3)': dependencies: - '@rsbuild/core': 1.3.19 - rsbuild-plugin-dts: 0.7.0(@microsoft/api-extractor@7.52.5(@types/node@20.17.50))(@rsbuild/core@1.3.19)(typescript@5.8.3) + '@rsbuild/core': 1.3.20 + rsbuild-plugin-dts: 0.8.0(@microsoft/api-extractor@7.52.5(@types/node@20.17.50))(@rsbuild/core@1.3.20)(typescript@5.8.3) tinyglobby: 0.2.13 optionalDependencies: '@microsoft/api-extractor': 7.52.5(@types/node@20.17.50) typescript: 5.8.3 + '@rspack/binding-darwin-arm64@1.3.10': + optional: true + '@rspack/binding-darwin-arm64@1.3.11': optional: true '@rspack/binding-darwin-arm64@1.3.9': optional: true + '@rspack/binding-darwin-x64@1.3.10': + optional: true + '@rspack/binding-darwin-x64@1.3.11': optional: true '@rspack/binding-darwin-x64@1.3.9': optional: true + '@rspack/binding-linux-arm64-gnu@1.3.10': + optional: true + '@rspack/binding-linux-arm64-gnu@1.3.11': optional: true '@rspack/binding-linux-arm64-gnu@1.3.9': optional: true + '@rspack/binding-linux-arm64-musl@1.3.10': + optional: true + '@rspack/binding-linux-arm64-musl@1.3.11': optional: true '@rspack/binding-linux-arm64-musl@1.3.9': optional: true + '@rspack/binding-linux-x64-gnu@1.3.10': + optional: true + '@rspack/binding-linux-x64-gnu@1.3.11': optional: true '@rspack/binding-linux-x64-gnu@1.3.9': optional: true + '@rspack/binding-linux-x64-musl@1.3.10': + optional: true + '@rspack/binding-linux-x64-musl@1.3.11': optional: true '@rspack/binding-linux-x64-musl@1.3.9': optional: true + '@rspack/binding-win32-arm64-msvc@1.3.10': + optional: true + '@rspack/binding-win32-arm64-msvc@1.3.11': optional: true '@rspack/binding-win32-arm64-msvc@1.3.9': optional: true + '@rspack/binding-win32-ia32-msvc@1.3.10': + optional: true + '@rspack/binding-win32-ia32-msvc@1.3.11': optional: true '@rspack/binding-win32-ia32-msvc@1.3.9': optional: true + '@rspack/binding-win32-x64-msvc@1.3.10': + optional: true + '@rspack/binding-win32-x64-msvc@1.3.11': optional: true '@rspack/binding-win32-x64-msvc@1.3.9': optional: true + '@rspack/binding@1.3.10': + optionalDependencies: + '@rspack/binding-darwin-arm64': 1.3.10 + '@rspack/binding-darwin-x64': 1.3.10 + '@rspack/binding-linux-arm64-gnu': 1.3.10 + '@rspack/binding-linux-arm64-musl': 1.3.10 + '@rspack/binding-linux-x64-gnu': 1.3.10 + '@rspack/binding-linux-x64-musl': 1.3.10 + '@rspack/binding-win32-arm64-msvc': 1.3.10 + '@rspack/binding-win32-ia32-msvc': 1.3.10 + '@rspack/binding-win32-x64-msvc': 1.3.10 + '@rspack/binding@1.3.11': optionalDependencies: '@rspack/binding-darwin-arm64': 1.3.11 @@ -9869,6 +9978,15 @@ snapshots: '@rspack/binding-win32-ia32-msvc': 1.3.9 '@rspack/binding-win32-x64-msvc': 1.3.9 + '@rspack/core@1.3.10(@swc/helpers@0.5.17)': + dependencies: + '@module-federation/runtime-tools': 0.13.1 + '@rspack/binding': 1.3.10 + '@rspack/lite-tapable': 1.0.1 + caniuse-lite: 1.0.30001718 + optionalDependencies: + '@swc/helpers': 0.5.17 + '@rspack/core@1.3.11(@swc/helpers@0.5.17)': dependencies: '@module-federation/runtime-tools': 0.13.1 @@ -14805,10 +14923,10 @@ snapshots: rrweb-cssom@0.8.0: {} - rsbuild-plugin-dts@0.7.0(@microsoft/api-extractor@7.52.5(@types/node@20.17.50))(@rsbuild/core@1.3.19)(typescript@5.8.3): + rsbuild-plugin-dts@0.8.0(@microsoft/api-extractor@7.52.5(@types/node@20.17.50))(@rsbuild/core@1.3.20)(typescript@5.8.3): dependencies: - '@ast-grep/napi': 0.38.1 - '@rsbuild/core': 1.3.19 + '@ast-grep/napi': 0.37.0 + '@rsbuild/core': 1.3.20 magic-string: 0.30.17 picocolors: 1.1.1 tinyglobby: 0.2.13 From 3191c8f187ed6dbfa858fa332f78f11beb6f332e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 25 May 2025 14:51:24 +0800 Subject: [PATCH 35/50] chore(deps): update rust crate color-backtrace to 0.7.0 (#10462) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- crates/node_binding/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c8ac690a222c..3625d2b089cb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -644,9 +644,9 @@ dependencies = [ [[package]] name = "color-backtrace" -version = "0.6.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "150fd80a270c0671379f388c8204deb6a746bb4eac8a6c03fe2460b2c0127ea0" +checksum = "2123a5984bd52ca861c66f66a9ab9883b27115c607f801f86c1bc2a84eb69f0f" dependencies = [ "backtrace", "termcolor", diff --git a/crates/node_binding/Cargo.toml b/crates/node_binding/Cargo.toml index c3b23ec40579..4955dbf121e4 100644 --- a/crates/node_binding/Cargo.toml +++ b/crates/node_binding/Cargo.toml @@ -41,7 +41,7 @@ tracing-subscriber = { workspace = true } napi = { workspace = true, features = ["async", "tokio_rt", "serde-json", "anyhow", "napi7", "compat-mode"] } napi-derive = { workspace = true, features = ["compat-mode"] } -color-backtrace = "0.6.1" +color-backtrace = "0.7.0" derive_more = { workspace = true, features = ["debug"] } futures = { workspace = true } From e18d705fc7ec7701fa570e05e383425f279bc368 Mon Sep 17 00:00:00 2001 From: Qingyu Wang <40660121+colinaaa@users.noreply.github.com> Date: Mon, 26 May 2025 10:45:36 +0800 Subject: [PATCH 36/50] fix(zod/v4): drop `z.record()` with single argument (#10468) --- .../src/builtin-plugin/html-plugin/options.ts | 6 ++-- packages/rspack/src/config/zod.ts | 35 ++++++++++++------- packages/rspack/src/lib/DllReferencePlugin.ts | 1 + 3 files changed, 28 insertions(+), 14 deletions(-) diff --git a/packages/rspack/src/builtin-plugin/html-plugin/options.ts b/packages/rspack/src/builtin-plugin/html-plugin/options.ts index cec444eeec63..9d2c0c9fcad3 100644 --- a/packages/rspack/src/builtin-plugin/html-plugin/options.ts +++ b/packages/rspack/src/builtin-plugin/html-plugin/options.ts @@ -139,7 +139,7 @@ const pluginOptionsSchema = z.object({ .optional(), templateContent: z.string().or(templateRenderFunction).optional(), templateParameters: z - .record(z.string()) + .record(z.string(), z.string()) .or(z.boolean()) .or(templateParamFunction) .optional(), @@ -164,7 +164,9 @@ const pluginOptionsSchema = z.object({ minify: z.boolean().optional(), title: z.string().optional(), favicon: z.string().optional(), - meta: z.record(z.string().or(z.record(z.string()))).optional(), + meta: z + .record(z.string(), z.string().or(z.record(z.string(), z.string()))) + .optional(), hash: z.boolean().optional() }) satisfies z.ZodType; diff --git a/packages/rspack/src/config/zod.ts b/packages/rspack/src/config/zod.ts index 1722bce12326..20801ceea5fe 100644 --- a/packages/rspack/src/config/zod.ts +++ b/packages/rspack/src/config/zod.ts @@ -185,6 +185,7 @@ const entryDescription = z.strictObject({ const entryUnnamed = entryItem satisfies z.ZodType; const entryObject = z.record( + z.string(), entryItem.or(entryDescription) ) satisfies z.ZodType; @@ -388,6 +389,7 @@ const output = z.strictObject({ //#region Resolve const resolveAlias = z .record( + z.string(), z .literal(false) .or(z.string()) @@ -420,7 +422,9 @@ const baseResolveOptions = z.strictObject({ tsConfig: resolveTsConfig.optional(), fullySpecified: z.boolean().optional(), exportsFields: z.array(z.string()).optional(), - extensionAlias: z.record(z.string().or(z.array(z.string()))).optional(), + extensionAlias: z + .record(z.string(), z.string().or(z.array(z.string()))) + .optional(), aliasFields: z.array(z.string()).optional(), restrictions: z.array(z.string()).optional(), roots: z.array(z.string()).optional(), @@ -428,7 +432,7 @@ const baseResolveOptions = z.strictObject({ }) satisfies z.ZodType; const resolveOptions: z.ZodType = baseResolveOptions.extend({ - byDependency: z.lazy(() => z.record(resolveOptions)).optional() + byDependency: z.lazy(() => z.record(z.string(), resolveOptions)).optional() }); //#endregion @@ -458,7 +462,9 @@ const ruleSetLoader = z.string() satisfies z.ZodType; const ruleSetLoaderOptions = z .string() - .or(z.record(z.any())) satisfies z.ZodType; + .or( + z.record(z.string(), z.any()) + ) satisfies z.ZodType; const ruleSetLoaderWithOptions = new ZodRspackCrossChecker({ @@ -531,15 +537,15 @@ const baseRuleSetRule = z.strictObject({ resourceQuery: ruleSetCondition.optional(), scheme: ruleSetCondition.optional(), mimetype: ruleSetCondition.optional(), - descriptionData: z.record(ruleSetCondition).optional(), - with: z.record(ruleSetCondition).optional(), + descriptionData: z.record(z.string(), ruleSetCondition).optional(), + with: z.record(z.string(), ruleSetCondition).optional(), type: z.string().optional(), layer: z.string().optional(), loader: ruleSetLoader.optional(), options: ruleSetLoaderOptions.optional(), use: ruleSetUse.optional(), - parser: z.record(z.any()).optional(), - generator: z.record(z.any()).optional(), + parser: z.record(z.string(), z.any()).optional(), + generator: z.record(z.string(), z.any()).optional(), resolve: resolveOptions.optional(), sideEffects: z.boolean().optional(), enforce: z.literal("pre").or(z.literal("post")).optional() @@ -947,7 +953,7 @@ const externalObjectValue = new ZodRspackCrossChecker< } } ], - default: z.record(z.string().or(z.string().array())) + default: z.record(z.string(), z.string().or(z.string().array())) }); // #region Externals @@ -958,6 +964,7 @@ const externalItemValue = z .or(externalObjectValue) satisfies z.ZodType; const externalItemObjectUnknown = z.record( + z.string(), externalItemValue ) satisfies z.ZodType; @@ -1293,7 +1300,9 @@ const optimizationSplitChunksChunks = z .args(z.instanceof(Chunk, { message: "Input not instance of Chunk" })) .returns(z.boolean()) ); -const optimizationSplitChunksSizes = z.number().or(z.record(z.number())); +const optimizationSplitChunksSizes = z + .number() + .or(z.record(z.string(), z.number())); const optimizationSplitChunksDefaultSizeTypes = z.array(z.string()); const sharedOptimizationSplitChunksCacheGroup = { chunks: optimizationSplitChunksChunks.optional(), @@ -1471,12 +1480,12 @@ const buildHttpOptions = z.object({ // frozen: z.boolean().optional(), httpClient: z .function() - .args(z.string(), z.record(z.string())) + .args(z.string(), z.record(z.string(), z.string())) .returns( z.promise( z.object({ status: z.number(), - headers: z.record(z.string()), + headers: z.record(z.string(), z.string()), body: z.instanceof(Buffer) }) ) @@ -1547,7 +1556,9 @@ const profile = z.boolean() satisfies z.ZodType; //#endregion //#region Amd -const amd = z.literal(false).or(z.record(z.any())) satisfies z.ZodType; +const amd = z + .literal(false) + .or(z.record(z.string(), z.any())) satisfies z.ZodType; //#endregion //#region Bail diff --git a/packages/rspack/src/lib/DllReferencePlugin.ts b/packages/rspack/src/lib/DllReferencePlugin.ts index 487e0a0d6728..24cf319a37dd 100644 --- a/packages/rspack/src/lib/DllReferencePlugin.ts +++ b/packages/rspack/src/lib/DllReferencePlugin.ts @@ -144,6 +144,7 @@ const dllReferencePluginOptionsContentItem = z.object({ }); const dllReferencePluginOptionsContent = z.record( + z.string(), dllReferencePluginOptionsContentItem ) satisfies z.ZodType; From 16ad00822e69494507004ae56b47f8557f9a2f66 Mon Sep 17 00:00:00 2001 From: neverland Date: Mon, 26 May 2025 10:59:59 +0800 Subject: [PATCH 37/50] docs: add info option and JSDoc for copy plugin (#10463) --- crates/node_binding/binding.d.ts | 82 +++++++++++++++++++ .../src/raw_options/raw_builtins/raw_copy.rs | 54 ++++++++++++ packages/rspack/etc/core.api.md | 10 +-- .../src/builtin-plugin/CopyRspackPlugin.ts | 5 +- .../en/plugins/rspack/copy-rspack-plugin.mdx | 54 ++++++++++-- .../zh/plugins/rspack/copy-rspack-plugin.mdx | 56 +++++++++++-- 6 files changed, 241 insertions(+), 20 deletions(-) diff --git a/crates/node_binding/binding.d.ts b/crates/node_binding/binding.d.ts index 2b80896a485c..dfc89aacb8ab 100644 --- a/crates/node_binding/binding.d.ts +++ b/crates/node_binding/binding.d.ts @@ -1628,20 +1628,93 @@ export interface RawContextReplacementPluginOptions { } export interface RawCopyGlobOptions { + /** + * Whether the match is case sensitive + * @default true + */ caseSensitiveMatch?: boolean + /** + * Whether to match files starting with `.` + * @default true + */ dot?: boolean + /** + * An array of strings in glob format, which can be used to ignore specific paths + * @default undefined + */ ignore?: Array } export interface RawCopyPattern { + /** + * The source path of the copy operation, which can be an absolute path, a relative + * path, or a glob pattern. It can refer to a file or a directory. If a relative path + * is passed, it is relative to the `context` option. + * @default undefined + */ from: string + /** + * The destination path of the copy operation, which can be an absolute path, a + * relative path, or a template string. If not specified, it is equal to Rspack's + * `output.path`. + * @default Rspack's `output.path` + */ to?: string | ((pathData: { context: string; absoluteFilename?: string }) => string | Promise) + /** + * `context` is a path to be prepended to `from` and removed from the start of the + * result paths. `context` can be an absolute path or a relative path. If it is a + * relative path, then it will be converted to an absolute path based on Rspack's + * `context`. + * `context` should be explicitly set only when `from` contains a glob. Otherwise, + * `context` is automatically set based on whether `from` is a file or a directory: + * - If `from` is a file, then `context` is its directory. The result path will be + * the filename alone. + * - If `from` is a directory, then `context` equals `from`. The result paths will + * be the paths of the directory's contents (including nested contents), relative + * to the directory. + * @default Rspack's `context` + */ context?: string + /** + * Specify the type of [to](#to), which can be a directory, a file, or a template + * name in Rspack. If not specified, it will be automatically inferred. + * The automatic inference rules are as follows: + * - `dir`: If `to` has no extension, or ends on `/`. + * - `file`: If `to` is not a directory and is not a template. + * - `template`: If `to` contains a template pattern. + * @default undefined + */ toType?: string + /** + * Whether to ignore the error if there are missing files or directories. + * @default false + */ noErrorOnMissing: boolean + /** + * Whether to force the copy operation to overwrite the destination file if it + * already exists. + * @default false + */ force: boolean + /** + * The priority of the copy operation. The higher the priority, the earlier the copy + * operation will be executed. When `force` is set to `true`, if a matching file is + * found, the one with higher priority will overwrite the one with lower priority. + * @default 0 + */ priority: number + /** + * Set the glob options for the copy operation. + * @default undefined + */ globOptions: RawCopyGlobOptions + /** + * Allows to add some assets info to the copied files, which may affect some behaviors + * in the build process. For example, by default, the copied JS and CSS files will be + * minified by Rspack's minimizer, if you want to skip minification for copied files, + * you can set `info.minimized` to `true`. + * @default undefined + */ info?: RawInfo /** * Determines whether to copy file permissions from the source to the destination. @@ -1650,10 +1723,15 @@ export interface RawCopyPattern { * @default false */ copyPermissions?: boolean + /** + * Allows to modify the file contents. + * @default undefined + */ transform?: { transformer: (input: Buffer, absoluteFilename: string) => string | Buffer | Promise | Promise } | ((input: Buffer, absoluteFilename: string) => string | Buffer | Promise | Promise) } export interface RawCopyRspackPluginOptions { + /** An array of objects that describe the copy operations to be performed. */ patterns: Array } @@ -1934,6 +2012,10 @@ export interface RawIncremental { export interface RawInfo { immutable?: boolean + /** + * Whether to skip minification for the copied files. + * @default false + */ minimized?: boolean chunkHash?: Array contentHash?: Array diff --git a/crates/node_binding/src/raw_options/raw_builtins/raw_copy.rs b/crates/node_binding/src/raw_options/raw_builtins/raw_copy.rs index 0e53a15db193..19b611ee8070 100644 --- a/crates/node_binding/src/raw_options/raw_builtins/raw_copy.rs +++ b/crates/node_binding/src/raw_options/raw_builtins/raw_copy.rs @@ -28,24 +28,69 @@ pub struct RawToOptions { #[derive(Debug, Clone)] #[napi(object, object_to_js = false)] pub struct RawCopyPattern { + /// The source path of the copy operation, which can be an absolute path, a relative + /// path, or a glob pattern. It can refer to a file or a directory. If a relative path + /// is passed, it is relative to the `context` option. + /// @default undefined pub from: String, + /// The destination path of the copy operation, which can be an absolute path, a + /// relative path, or a template string. If not specified, it is equal to Rspack's + /// `output.path`. + /// @default Rspack's `output.path` #[debug(skip)] #[napi( ts_type = "string | ((pathData: { context: string; absoluteFilename?: string }) => string | Promise)" )] pub to: Option, + /// `context` is a path to be prepended to `from` and removed from the start of the + /// result paths. `context` can be an absolute path or a relative path. If it is a + /// relative path, then it will be converted to an absolute path based on Rspack's + /// `context`. + /// `context` should be explicitly set only when `from` contains a glob. Otherwise, + /// `context` is automatically set based on whether `from` is a file or a directory: + /// - If `from` is a file, then `context` is its directory. The result path will be + /// the filename alone. + /// - If `from` is a directory, then `context` equals `from`. The result paths will + /// be the paths of the directory's contents (including nested contents), relative + /// to the directory. + /// @default Rspack's `context` pub context: Option, + /// Specify the type of [to](#to), which can be a directory, a file, or a template + /// name in Rspack. If not specified, it will be automatically inferred. + /// The automatic inference rules are as follows: + /// - `dir`: If `to` has no extension, or ends on `/`. + /// - `file`: If `to` is not a directory and is not a template. + /// - `template`: If `to` contains a template pattern. + /// @default undefined pub to_type: Option, + /// Whether to ignore the error if there are missing files or directories. + /// @default false pub no_error_on_missing: bool, + /// Whether to force the copy operation to overwrite the destination file if it + /// already exists. + /// @default false pub force: bool, + /// The priority of the copy operation. The higher the priority, the earlier the copy + /// operation will be executed. When `force` is set to `true`, if a matching file is + /// found, the one with higher priority will overwrite the one with lower priority. + /// @default 0 pub priority: i32, + /// Set the glob options for the copy operation. + /// @default undefined pub glob_options: RawCopyGlobOptions, + /// Allows to add some assets info to the copied files, which may affect some behaviors + /// in the build process. For example, by default, the copied JS and CSS files will be + /// minified by Rspack's minimizer, if you want to skip minification for copied files, + /// you can set `info.minimized` to `true`. + /// @default undefined pub info: Option, /// Determines whether to copy file permissions from the source to the destination. /// When set to true, the plugin will preserve executable permissions and other file modes. /// This is particularly useful when copying scripts or executable files. /// @default false pub copy_permissions: Option, + /// Allows to modify the file contents. + /// @default undefined #[debug(skip)] #[napi( ts_type = "{ transformer: (input: Buffer, absoluteFilename: string) => string | Buffer | Promise | Promise } | ((input: Buffer, absoluteFilename: string) => string | Buffer | Promise | Promise)" @@ -57,6 +102,8 @@ pub struct RawCopyPattern { #[napi(object)] pub struct RawInfo { pub immutable: Option, + /// Whether to skip minification for the copied files. + /// @default false pub minimized: Option, pub chunk_hash: Option>, pub content_hash: Option>, @@ -75,14 +122,21 @@ pub struct RawRelated { #[derive(Debug, Clone)] #[napi(object)] pub struct RawCopyGlobOptions { + /// Whether the match is case sensitive + /// @default true pub case_sensitive_match: Option, + /// Whether to match files starting with `.` + /// @default true pub dot: Option, + /// An array of strings in glob format, which can be used to ignore specific paths + /// @default undefined pub ignore: Option>, } #[derive(Debug)] #[napi(object, object_to_js = false)] pub struct RawCopyRspackPluginOptions { + /// An array of objects that describe the copy operations to be performed. pub patterns: Vec, } diff --git a/packages/rspack/etc/core.api.md b/packages/rspack/etc/core.api.md index fac6ba477d19..f1a1a895a7c9 100644 --- a/packages/rspack/etc/core.api.md +++ b/packages/rspack/etc/core.api.md @@ -27,7 +27,7 @@ import { EntryDependency } from '@rspack/binding'; import { RawEvalDevToolModulePluginOptions as EvalDevToolModulePluginOptions } from '@rspack/binding'; import { EventEmitter } from 'events'; import { ExternalModule } from '@rspack/binding'; -import { ExternalObject } from '@rspack/binding'; +import type { ExternalObject } from '@rspack/binding'; import { fs } from 'fs'; import { default as fs_2 } from 'graceful-fs'; import { HookMap } from '@rspack/lite-tapable'; @@ -44,7 +44,7 @@ import type { JsBuildMeta } from '@rspack/binding'; import { JsChunk } from '@rspack/binding'; import type { JsChunkGraph } from '@rspack/binding'; import type { JsChunkGroup } from '@rspack/binding'; -import { JsCompilation } from '@rspack/binding'; +import type { JsCompilation } from '@rspack/binding'; import type { JsExportsInfo } from '@rspack/binding'; import { JsHtmlPluginTag } from '@rspack/binding'; import { JsLoaderItem } from '@rspack/binding'; @@ -54,7 +54,7 @@ import { JsRsdoctorChunkGraph } from '@rspack/binding'; import { JsRsdoctorModuleGraph } from '@rspack/binding'; import { JsRsdoctorModuleIdsPatch } from '@rspack/binding'; import { JsRsdoctorModuleSourcesPatch } from '@rspack/binding'; -import { JsRuntimeModule } from '@rspack/binding'; +import type { JsRuntimeModule } from '@rspack/binding'; import type { JsStats } from '@rspack/binding'; import type { JsStatsCompilation } from '@rspack/binding'; import type { JsStatsError } from '@rspack/binding'; @@ -1623,9 +1623,7 @@ export const CopyRspackPlugin: { // @public (undocumented) export type CopyRspackPluginOptions = { - patterns: (string | ({ - from: string; - } & Partial))[]; + patterns: (string | (Pick & Partial>))[]; }; // @public (undocumented) diff --git a/packages/rspack/src/builtin-plugin/CopyRspackPlugin.ts b/packages/rspack/src/builtin-plugin/CopyRspackPlugin.ts index 5885406f09c0..3897d224c551 100644 --- a/packages/rspack/src/builtin-plugin/CopyRspackPlugin.ts +++ b/packages/rspack/src/builtin-plugin/CopyRspackPlugin.ts @@ -7,11 +7,10 @@ import { import { create } from "./base"; export type CopyRspackPluginOptions = { + /** An array of objects that describe the copy operations to be performed. */ patterns: ( | string - | ({ - from: string; - } & Partial) + | (Pick & Partial>) )[]; }; diff --git a/website/docs/en/plugins/rspack/copy-rspack-plugin.mdx b/website/docs/en/plugins/rspack/copy-rspack-plugin.mdx index c9b2a40a4e2f..1ba1a64d9841 100644 --- a/website/docs/en/plugins/rspack/copy-rspack-plugin.mdx +++ b/website/docs/en/plugins/rspack/copy-rspack-plugin.mdx @@ -115,7 +115,9 @@ export default { - **Type:** `string` - **Default:** `undefined` -The source path of the copy operation, which can be an absolute path, a relative path, or a glob pattern. It can refer to a file or a directory. If a relative path is passed, it is relative to the [context](#context) option. +The source path of the copy operation, which can be an absolute path, a relative path, or a glob pattern. + +It can refer to a file or a directory. If a relative path is passed, it is relative to the [context](#context) option. ```js title="rspack.config.mjs" import { rspack } from '@rspack/core'; @@ -366,20 +368,20 @@ export default { ```ts type GlobOptions = { // Whether the match is case sensitive - // Default to true + // @default true caseSensitiveMatch?: boolean; // Whether to match files starting with `.` - // Default to true + // @default true dot?: boolean; - // Ignore specific paths // An array of strings in glob format, which can be used to ignore specific paths + // @default undefined ignore?: string[]; }; ``` - **Default:** `undefined` -Glob options. +Set the glob options for the copy operation. ```js title="rspack.config.mjs" export default { @@ -465,3 +467,45 @@ export default { ``` This is particularly useful when copying executable files, scripts, or any files where permissions are important. When set to `true`, the plugin will attempt to set the same permissions on the destination file as the source file has. + +### info + +- **Type:** + +```ts +type Info = { + immutable?: boolean; + // Whether to skip minification for the copied files. + // @default false + minimized?: boolean; + chunkHash?: string[]; + contentHash?: string[]; + development?: boolean; + hotModuleReplacement?: boolean; + related?: { + sourceMap?: string; + }; + version?: string; +}; +``` + +- **Default:** `undefined` + +Allows to add some assets info to the copied files, which may affect some behaviors in the build process. + +For example, by default, the copied JS and CSS files will be minified by Rspack's [minimizer](/config/optimization#optimizationminimizer), if you want to skip minification for copied files, you can set `info.minimized` to `true`. + +```js title="rspack.config.mjs" +export default { + plugins: [ + new rspack.CopyRspackPlugin({ + patterns: [ + { + from: 'src/file.js', + info: { minimized: true }, + }, + ], + }), + ], +}; +``` diff --git a/website/docs/zh/plugins/rspack/copy-rspack-plugin.mdx b/website/docs/zh/plugins/rspack/copy-rspack-plugin.mdx index 32748eac5e30..46a1748b791f 100644 --- a/website/docs/zh/plugins/rspack/copy-rspack-plugin.mdx +++ b/website/docs/zh/plugins/rspack/copy-rspack-plugin.mdx @@ -115,7 +115,9 @@ export default { - **类型:** `string` - **默认值:** `undefined` -拷贝的源路径,可以是绝对路径、相对路径、glob pattern,可以是文件或目录。若传入相对路径,则是相对于 [context](#context) 选项。 +拷贝的源路径,可以是绝对路径、相对路径、glob pattern,可以是文件或目录。 + +若传入相对路径,则是相对于 [context](#context) 选项。 ```js title="rspack.config.mjs" import path from 'node:path'; @@ -370,20 +372,20 @@ export default { ```ts type GlobOptions = { // 是否大小写敏感 - // 默认 true + // @default true caseSensitiveMatch?: boolean; // 是否匹配以 `.` 开头的文件 - // 默认 true + // @default true dot?: boolean; - // 忽略特定路径 - // glob 形式的字符串数组,可以使用该配置忽略部分特定路径 + // 忽略特定路径,可以是一个 glob 形式的字符串数组 + // @default undefined ignore?: string[]; }; ``` - **默认值:** `undefined` -glob 匹配的选项。 +设置拷贝时 glob 匹配的选项。 ```js title="rspack.config.mjs" export default { @@ -469,3 +471,45 @@ export default { ``` 这对于复制可执行文件、脚本或任何权限重要的文件特别有用。当设置为 `true` 时,插件将尝试在目标文件上设置与源文件相同的权限。 + +### info + +- **类型:** + +```ts +type Info = { + immutable?: boolean; + // 是否为拷贝的文件跳过压缩 + // @default false + minimized?: boolean; + chunkHash?: string[]; + contentHash?: string[]; + development?: boolean; + hotModuleReplacement?: boolean; + related?: { + sourceMap?: string; + }; + version?: string; +}; +``` + +- **默认值:** `undefined` + +允许你为拷贝的文件添加一些 assets info,这些信息可能会影响构建流程中的某些行为。 + +例如,默认情况下,被拷贝的 JS、CSS 文件会经过 Rspack 的 [minimizer](/config/optimization#optimizationminimizer) 进行压缩,如果你希望被拷贝的文件跳过压缩,可以设置 `info.minimized` 为 `true`。 + +```js title="rspack.config.mjs" +export default { + plugins: [ + new rspack.CopyRspackPlugin({ + patterns: [ + { + from: 'src/file.js', + info: { minimized: true }, + }, + ], + }), + ], +}; +``` From 587e3afeff5d9559a00fb07906f6d2b708533cd8 Mon Sep 17 00:00:00 2001 From: Rintaro Itokawa Date: Mon, 26 May 2025 12:03:10 +0900 Subject: [PATCH 38/50] chore(infra): add `onlyBuiltDependencies` (#10469) --- package.json | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 076659670986..979faf42c9ba 100644 --- a/package.json +++ b/package.json @@ -87,6 +87,13 @@ "patchedDependencies": { "graceful-fs": "patches/graceful-fs.patch", "rollup-plugin-dts": "patches/rollup-plugin-dts.patch" - } + }, + "onlyBuiltDependencies": [ + "@biomejs/biome", + "@swc/core", + "core-js", + "es5-ext", + "esbuild" + ] } } From 330f80db58217d32bc6c22136d556ee415368428 Mon Sep 17 00:00:00 2001 From: neverland Date: Mon, 26 May 2025 12:07:22 +0800 Subject: [PATCH 39/50] fix(core): remove Node 10 compatibility code (#10464) * fix(core): remove Node 10 compatibility code * fix --- .../rspack/src/util/bindingVersionCheck.ts | 21 ++++--------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/packages/rspack/src/util/bindingVersionCheck.ts b/packages/rspack/src/util/bindingVersionCheck.ts index 591a4b4aedca..5cd12158fbc6 100644 --- a/packages/rspack/src/util/bindingVersionCheck.ts +++ b/packages/rspack/src/util/bindingVersionCheck.ts @@ -1,4 +1,4 @@ -import { readFileSync, readdirSync } from "node:fs"; +import { readdirSync } from "node:fs"; import path from "node:path"; const NodePlatformArchToAbi: Record< @@ -35,22 +35,9 @@ const NodePlatformArchToAbi: Record< }; function isMusl() { - // For Node 10 - if (!process.report || typeof process.report.getReport !== "function") { - try { - const lddPath = require("node:child_process") - .execSync("which ldd") - .toString() - .trim(); - return readFileSync(lddPath, "utf8").includes("musl"); - } catch (e) { - return true; - } - } else { - // @ts-expect-error getReport returns an object containing header object - const { glibcVersionRuntime } = process.report.getReport().header; - return !glibcVersionRuntime; - } + // @ts-expect-error getReport returns an object containing header object + const { glibcVersionRuntime } = process.report.getReport().header; + return !glibcVersionRuntime; } const BINDING_VERSION = require("@rspack/binding/package.json").version; From ec8157517141a56bcda5ad72c5dd603cbc348caf Mon Sep 17 00:00:00 2001 From: neverland Date: Mon, 26 May 2025 12:07:57 +0800 Subject: [PATCH 40/50] perf: lazy load watchpack and some Node built-in modules (#10465) perf: lazy load watchpack --- packages/rspack/src/ExecuteModulePlugin.ts | 3 +- .../src/builtin-plugin/HttpUriPlugin.ts | 8 ++++- .../rspack/src/node/NodeWatchFileSystem.ts | 33 +++++++++---------- 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/packages/rspack/src/ExecuteModulePlugin.ts b/packages/rspack/src/ExecuteModulePlugin.ts index 54d5332eceae..1533c18fd78c 100644 --- a/packages/rspack/src/ExecuteModulePlugin.ts +++ b/packages/rspack/src/ExecuteModulePlugin.ts @@ -1,5 +1,3 @@ -import vm from "node:vm"; - import { RuntimeGlobals } from "."; import type { Compiler } from "./Compiler"; @@ -13,6 +11,7 @@ export default class ExecuteModulePlugin { compilation.hooks.executeModule.tap( "executeModule", (options, context) => { + const vm = require("node:vm"); const moduleObject = options.moduleObject; const source = options.codeGenerationResult.get("javascript"); if (source === undefined) return; diff --git a/packages/rspack/src/builtin-plugin/HttpUriPlugin.ts b/packages/rspack/src/builtin-plugin/HttpUriPlugin.ts index bccf08db49ef..9c6660c7ce89 100644 --- a/packages/rspack/src/builtin-plugin/HttpUriPlugin.ts +++ b/packages/rspack/src/builtin-plugin/HttpUriPlugin.ts @@ -1,5 +1,4 @@ import path from "node:path"; -import { createBrotliDecompress, createGunzip, createInflate } from "node:zlib"; import { type BuiltinPlugin, BuiltinPluginName, @@ -45,10 +44,17 @@ export type HttpUriPluginOptions = { const getHttp = memoize(() => require("node:http")); const getHttps = memoize(() => require("node:https")); + function fetch(url: string, options: { headers: Record }) { const parsedURL = new URL(url); const send: typeof import("node:http") = parsedURL.protocol === "https:" ? getHttps() : getHttp(); + const { + createBrotliDecompress, + createGunzip, + createInflate + } = require("node:zlib"); + return new Promise<{ res: IncomingMessage; body: Buffer }>( (resolve, reject) => { send diff --git a/packages/rspack/src/node/NodeWatchFileSystem.ts b/packages/rspack/src/node/NodeWatchFileSystem.ts index 6260c1c8cf6b..362619ca0bbb 100644 --- a/packages/rspack/src/node/NodeWatchFileSystem.ts +++ b/packages/rspack/src/node/NodeWatchFileSystem.ts @@ -9,7 +9,7 @@ */ import util from "node:util"; -import Watchpack from "watchpack"; +import type Watchpack from "watchpack"; import type { FileSystemInfoEntry, @@ -21,14 +21,13 @@ import type { export default class NodeWatchFileSystem implements WatchFileSystem { inputFileSystem: InputFileSystem; watcherOptions: Watchpack.WatchOptions; - watcher: Watchpack; + watcher?: Watchpack; constructor(inputFileSystem: InputFileSystem) { this.inputFileSystem = inputFileSystem; this.watcherOptions = { aggregateTimeout: 0 }; - this.watcher = new Watchpack(this.watcherOptions); } watch( @@ -67,27 +66,27 @@ export default class NodeWatchFileSystem implements WatchFileSystem { if (typeof callbackUndelayed !== "function" && callbackUndelayed) { throw new Error("Invalid arguments: 'callbackUndelayed'"); } + const oldWatcher = this.watcher; + const Watchpack = require("watchpack"); this.watcher = new Watchpack(options); if (callbackUndelayed) { - this.watcher.once("change", callbackUndelayed); + this.watcher?.once("change", callbackUndelayed); } const fetchTimeInfo = () => { const fileTimeInfoEntries = new Map(); const contextTimeInfoEntries = new Map(); - if (this.watcher) { - this.watcher.collectTimeInfoEntries( - fileTimeInfoEntries, - contextTimeInfoEntries - ); - } + this.watcher?.collectTimeInfoEntries( + fileTimeInfoEntries, + contextTimeInfoEntries + ); return { fileTimeInfoEntries, contextTimeInfoEntries }; }; - this.watcher.once("aggregated", (changes, removals) => { + this.watcher?.once("aggregated", (changes, removals) => { // pause emitting events (avoids clearing aggregated changes and removals on timeout) - this.watcher.pause(); + this.watcher?.pause(); if (this.inputFileSystem?.purge) { const fs = this.inputFileSystem; @@ -109,7 +108,7 @@ export default class NodeWatchFileSystem implements WatchFileSystem { ); }); - this.watcher.watch({ files, directories, missing, startTime }); + this.watcher?.watch({ files, directories, missing, startTime }); if (oldWatcher) { oldWatcher.close(); @@ -135,7 +134,7 @@ export default class NodeWatchFileSystem implements WatchFileSystem { fs.purge?.(item); } } - return items; + return items ?? new Set(); }, "Watcher.getAggregatedRemovals is deprecated in favor of Watcher.getInfo since that's more performant.", "DEP_WEBPACK_WATCHER_GET_AGGREGATED_REMOVALS" @@ -149,7 +148,7 @@ export default class NodeWatchFileSystem implements WatchFileSystem { fs.purge?.(item); } } - return items; + return items ?? new Set(); }, "Watcher.getAggregatedChanges is deprecated in favor of Watcher.getInfo since that's more performant.", "DEP_WEBPACK_WATCHER_GET_AGGREGATED_CHANGES" @@ -169,8 +168,8 @@ export default class NodeWatchFileSystem implements WatchFileSystem { "DEP_WEBPACK_WATCHER_CONTEXT_TIME_INFO_ENTRIES" ), getInfo: () => { - const removals = this.watcher?.aggregatedRemovals; - const changes = this.watcher?.aggregatedChanges; + const removals = this.watcher?.aggregatedRemovals ?? new Set(); + const changes = this.watcher?.aggregatedChanges ?? new Set(); if (this.inputFileSystem?.purge) { const fs = this.inputFileSystem; if (removals) { From c9c6f7cd9eecedffb9a4f43a1297474d8b22161a Mon Sep 17 00:00:00 2001 From: Cong-Cong Pan Date: Mon, 26 May 2025 13:14:34 +0800 Subject: [PATCH 41/50] fix: http build redirect to another url (#10471) --- .../src/http_uri/http_cache.rs | 9 ------- .../rspack_plugin_schemes/src/http_uri/mod.rs | 25 +++++++++++++++--- .../configCases/build-http/redirect/index.js | 5 ++++ .../build-http/redirect/lock-files/lock.json | 12 +++++++++ ...sset__images_file_5fb8a694480bf741d1b4.png | Bin 0 -> 95 bytes .../build-http/redirect/rspack.config.js | 22 +++++++++++++++ 6 files changed, 61 insertions(+), 12 deletions(-) create mode 100644 packages/rspack-test-tools/tests/configCases/build-http/redirect/index.js create mode 100644 packages/rspack-test-tools/tests/configCases/build-http/redirect/lock-files/lock.json create mode 100644 packages/rspack-test-tools/tests/configCases/build-http/redirect/lock-files/test/https___raw.githubusercontent.com/_web-infra-dev_rspack_main_packages_rspack-test-tools_tests_configCases_asset__images_file_5fb8a694480bf741d1b4.png create mode 100644 packages/rspack-test-tools/tests/configCases/build-http/redirect/rspack.config.js diff --git a/crates/rspack_plugin_schemes/src/http_uri/http_cache.rs b/crates/rspack_plugin_schemes/src/http_uri/http_cache.rs index 76564a696c2e..1c7365ede8e0 100644 --- a/crates/rspack_plugin_schemes/src/http_uri/http_cache.rs +++ b/crates/rspack_plugin_schemes/src/http_uri/http_cache.rs @@ -417,15 +417,6 @@ impl HttpCache { } pub async fn fetch_content(url: &str, options: &HttpUriPluginOptions) -> Result { - // Check if the URL is allowed - if !options.allowed_uris.is_allowed(url) { - return Err(anyhow::anyhow!( - "{} doesn't match the allowedUris policy. These URIs are allowed:\n{}", - url, - options.allowed_uris.get_allowed_uris_description() - )); - } - let http_cache = HttpCache::new( options.cache_location.clone(), options.lockfile_location.clone(), diff --git a/crates/rspack_plugin_schemes/src/http_uri/mod.rs b/crates/rspack_plugin_schemes/src/http_uri/mod.rs index 6c385065bfea..f4fb42c7b083 100644 --- a/crates/rspack_plugin_schemes/src/http_uri/mod.rs +++ b/crates/rspack_plugin_schemes/src/http_uri/mod.rs @@ -13,7 +13,10 @@ use rspack_core::{ NormalModuleFactoryResolveForScheme, NormalModuleFactoryResolveInScheme, NormalModuleReadResource, Plugin, PluginContext, ResourceData, Scheme, }; -use rspack_error::{miette, AnyhowResultToRspackResultExt, Result}; +use rspack_error::{ + miette::{self, diagnostic}, + AnyhowResultToRspackResultExt, Result, +}; use rspack_fs::WritableFileSystem; use rspack_hook::{plugin, plugin_hook}; use rspack_util::asset_condition::{AssetCondition, AssetConditions}; @@ -27,6 +30,22 @@ static EXTERNAL_HTTP_REQUEST: Lazy = pub struct HttpUriPlugin { options: HttpUriPluginOptions, } + +async fn get_info(url: &str, options: &HttpUriPluginOptions) -> miette::Result { + // Check if the URL is allowed + if !options.allowed_uris.is_allowed(url) { + return Err( + diagnostic!( + "{} doesn't match the allowedUris policy. These URIs are allowed:\n{}", + url, + options.allowed_uris.get_allowed_uris_description(), + ) + .into(), + ); + } + resolve_content(url, options).await +} + // recursively handle http redirect async fn resolve_content( url: &str, @@ -52,7 +71,7 @@ impl HttpUriPlugin { url: &Url, mimetype: Option, ) -> Result { - let resolved_result = resolve_content(url.as_str(), &self.options).await?; + let resolved_result = get_info(url.as_str(), &self.options).await?; let context = get_resource_context(&resolved_result.entry.resolved); resource_data.set_context(context); @@ -154,7 +173,7 @@ async fn read_resource(&self, resource_data: &ResourceData) -> Result { + expect(/[\da-f]{16}\.png$/.test(url)).toBe(true); +}); diff --git a/packages/rspack-test-tools/tests/configCases/build-http/redirect/lock-files/lock.json b/packages/rspack-test-tools/tests/configCases/build-http/redirect/lock-files/lock.json new file mode 100644 index 000000000000..c82e06dfd8c2 --- /dev/null +++ b/packages/rspack-test-tools/tests/configCases/build-http/redirect/lock-files/lock.json @@ -0,0 +1,12 @@ +{ + "version": 1, + "entries": { + "https://raw.githubusercontent.com/web-infra-dev/rspack/main/packages/rspack-test-tools/tests/configCases/asset/_images/file.png": { + "resolved": "https://raw.githubusercontent.com/web-infra-dev/rspack/main/packages/rspack-test-tools/tests/configCases/asset/_images/file.png", + "integrity": "sha512-atUj9bZUhzadMFYTNmufaNze7iJSkXZuOyX69FQ5ygafYUAwwIylTHFP2/epRPrEibFRWov54NMZHhvLv+ap3w==", + "content_type": "image/png", + "valid_until": 1748223968250, + "etag": "W/\"70f400bdbff19f7b1859bc4856f593134cfad96dd1f157b19647bdce9bef5433\"" + } + } +} \ No newline at end of file diff --git a/packages/rspack-test-tools/tests/configCases/build-http/redirect/lock-files/test/https___raw.githubusercontent.com/_web-infra-dev_rspack_main_packages_rspack-test-tools_tests_configCases_asset__images_file_5fb8a694480bf741d1b4.png b/packages/rspack-test-tools/tests/configCases/build-http/redirect/lock-files/test/https___raw.githubusercontent.com/_web-infra-dev_rspack_main_packages_rspack-test-tools_tests_configCases_asset__images_file_5fb8a694480bf741d1b4.png new file mode 100644 index 0000000000000000000000000000000000000000..1914264c08781d1f30ee0b8482bccf44586f2dc1 GIT binary patch literal 95 zcmeAS@N?(olHy`uVBq!ia0vp^j3CU&3?x-=hn)ga%mF?ju0VQumF+E%TuG2$FoVOh l8)-lem#2$k2*>s01R$Gz9%CSj!PC{xWt~$(697H@6ZHT9 literal 0 HcmV?d00001 diff --git a/packages/rspack-test-tools/tests/configCases/build-http/redirect/rspack.config.js b/packages/rspack-test-tools/tests/configCases/build-http/redirect/rspack.config.js new file mode 100644 index 000000000000..d824c92f903a --- /dev/null +++ b/packages/rspack-test-tools/tests/configCases/build-http/redirect/rspack.config.js @@ -0,0 +1,22 @@ +const path = require("path"); + +/** @type {import("@rspack/core").Configuration} */ +module.exports = { + mode: "development", + module: { + rules: [ + { + test: /\.png$/, + type: "asset/resource" + } + ] + }, + experiments: { + buildHttp: { + allowedUris: ["https://github.com"], + lockfileLocation: path.resolve(__dirname, "./lock-files/lock.json"), + cacheLocation: path.resolve(__dirname, "./lock-files/test") + }, + css: false + } +}; From 34cc8e123246308cfd748c9c0916ec6d7b225416 Mon Sep 17 00:00:00 2001 From: jinrui Date: Mon, 26 May 2025 14:01:48 +0800 Subject: [PATCH 42/50] refactor: rewrite module executor (#10402) * refactor: rewrite module executor * test: add import module cycle-dependency * docs: add comment * fix: merge same resolve error * test: enable importModule webpack-test * fix: remove useless code * revert "fix: merge same resolve error" --- crates/node_binding/binding.d.ts | 2 +- crates/node_binding/src/compilation/mod.rs | 4 +- .../rspack_core/src/compiler/compilation.rs | 13 +- crates/rspack_core/src/compiler/make/mod.rs | 19 +- .../src/compiler/make/repair/mod.rs | 8 +- .../src/compiler/module_executor/context.rs | 32 ++ .../src/compiler/module_executor/ctrl.rs | 370 +----------------- .../src/compiler/module_executor/entry.rs | 134 +++++-- .../src/compiler/module_executor/execute.rs | 255 ++++++------ .../src/compiler/module_executor/mod.rs | 235 ++++------- .../module_executor/module_tracker.rs | 218 +++++++++++ .../src/compiler/module_executor/overwrite.rs | 102 ++--- crates/rspack_core/src/utils/task_loop.rs | 10 - .../rspack_plugin_extract_css/src/plugin.rs | 45 +-- .../css-extract/rebuild-module/test.filter.js | 3 + .../cycle-dependency/index.js | 5 + .../cycle-dependency/lib/add_one.js | 5 + .../cycle-dependency/lib/index.js | 2 + .../cycle-dependency/lib/utils.js | 3 + .../cycle-dependency/loader.js | 6 + .../cycle-dependency/rspack.config.js | 7 + .../factorize/import-module/stats.err | 2 + .../__snapshots__/web/1.snap.txt | 1 + packages/rspack/src/Compiler.ts | 6 +- packages/rspack/src/loader-runner/index.ts | 6 +- .../import-module-cycle-multiple/index.js | 20 +- .../import-module-cycle-multiple/loader.js | 12 +- .../test.filter.js | 1 - .../cases/errors/import-module-cycle/index.js | 12 +- .../errors/import-module-cycle/test.filter.js | 1 - 30 files changed, 690 insertions(+), 849 deletions(-) create mode 100644 crates/rspack_core/src/compiler/module_executor/context.rs create mode 100644 crates/rspack_core/src/compiler/module_executor/module_tracker.rs create mode 100644 packages/rspack-test-tools/tests/configCases/css-extract/rebuild-module/test.filter.js create mode 100644 packages/rspack-test-tools/tests/configCases/loader-import-module/cycle-dependency/index.js create mode 100644 packages/rspack-test-tools/tests/configCases/loader-import-module/cycle-dependency/lib/add_one.js create mode 100644 packages/rspack-test-tools/tests/configCases/loader-import-module/cycle-dependency/lib/index.js create mode 100644 packages/rspack-test-tools/tests/configCases/loader-import-module/cycle-dependency/lib/utils.js create mode 100644 packages/rspack-test-tools/tests/configCases/loader-import-module/cycle-dependency/loader.js create mode 100644 packages/rspack-test-tools/tests/configCases/loader-import-module/cycle-dependency/rspack.config.js delete mode 100644 tests/webpack-test/cases/errors/import-module-cycle-multiple/test.filter.js delete mode 100644 tests/webpack-test/cases/errors/import-module-cycle/test.filter.js diff --git a/crates/node_binding/binding.d.ts b/crates/node_binding/binding.d.ts index dfc89aacb8ab..d6598b803cb2 100644 --- a/crates/node_binding/binding.d.ts +++ b/crates/node_binding/binding.d.ts @@ -274,7 +274,7 @@ export declare class JsCompilation { * Using async and mutable reference to `Compilation` at the same time would likely to cause data races. */ rebuildModule(moduleIdentifiers: Array, f: any): void - importModule(request: string, layer: string | undefined | null, publicPath: JsFilename | undefined | null, baseUri: string | undefined | null, originalModule: string | undefined | null, originalModuleContext: string | undefined | null, callback: any): void + importModule(request: string, layer: string | undefined | null, publicPath: JsFilename | undefined | null, baseUri: string | undefined | null, originalModule: string, originalModuleContext: string | undefined | null, callback: any): void get entries(): JsEntries addRuntimeModule(chunk: JsChunk, runtimeModule: JsAddingRuntimeModule): void get moduleGraph(): JsModuleGraph diff --git a/crates/node_binding/src/compilation/mod.rs b/crates/node_binding/src/compilation/mod.rs index 8ed69628190a..1c4d42e85e84 100644 --- a/crates/node_binding/src/compilation/mod.rs +++ b/crates/node_binding/src/compilation/mod.rs @@ -605,7 +605,7 @@ impl JsCompilation { layer: Option, public_path: Option, base_uri: Option, - original_module: Option, + original_module: String, original_module_context: Option, callback: Function<'static>, ) -> Result<()> { @@ -625,7 +625,7 @@ impl JsCompilation { public_path.map(|p| p.into()), base_uri, original_module_context.map(rspack_core::Context::from), - original_module.map(ModuleIdentifier::from), + ModuleIdentifier::from(original_module), ) .await; diff --git a/crates/rspack_core/src/compiler/compilation.rs b/crates/rspack_core/src/compiler/compilation.rs index 7232d486eef3..ace8a8f6eff3 100644 --- a/crates/rspack_core/src/compiler/compilation.rs +++ b/crates/rspack_core/src/compiler/compilation.rs @@ -61,8 +61,6 @@ use crate::{ define_hook!(CompilationAddEntry: Series(compilation: &mut Compilation, entry_name: Option<&str>)); define_hook!(CompilationBuildModule: Series(compiler_id: CompilerId, compilation_id: CompilationId, module: &mut BoxModule),tracing=false); -// NOTE: This is a Rspack-specific hook and has not been standardized yet. Do not expose it to the JS side. -define_hook!(CompilationUpdateModuleGraph: Series(params: &mut Vec, artifact: &MakeArtifact)); define_hook!(CompilationRevokedModules: Series(revoked_modules: &IdentifierSet)); define_hook!(CompilationStillValidModule: Series(compiler_id: CompilerId, compilation_id: CompilationId, module: &mut BoxModule)); define_hook!(CompilationSucceedModule: Series(compiler_id: CompilerId, compilation_id: CompilationId, module: &mut BoxModule),tracing=false); @@ -100,7 +98,6 @@ define_hook!(CompilationAfterSeal: Series(compilation: &mut Compilation),tracing pub struct CompilationHooks { pub add_entry: CompilationAddEntryHook, pub build_module: CompilationBuildModuleHook, - pub update_module_graph: CompilationUpdateModuleGraphHook, pub revoked_modules: CompilationRevokedModulesHook, pub still_valid_module: CompilationStillValidModuleHook, pub succeed_module: CompilationSucceedModuleHook, @@ -935,10 +932,6 @@ impl Compilation { ) -> Result { let artifact = std::mem::take(&mut self.make_artifact); - if let Some(module_executor) = &mut self.module_executor { - module_executor.rebuild_origins = Some(module_identifiers.clone()); - } - self.make_artifact = update_module_graph( self, artifact, @@ -946,10 +939,6 @@ impl Compilation { ) .await?; - if let Some(module_executor) = &mut self.module_executor { - module_executor.rebuild_origins = None; - } - let module_graph = self.get_module_graph(); Ok(f(module_identifiers .into_iter() @@ -1371,7 +1360,7 @@ impl Compilation { // sync assets to compilation from module_executor if let Some(module_executor) = &mut self.module_executor { let mut module_executor = std::mem::take(module_executor); - module_executor.hook_after_finish_modules(self).await; + module_executor.hook_after_finish_modules(self).await?; self.module_executor = Some(module_executor); } diff --git a/crates/rspack_core/src/compiler/make/mod.rs b/crates/rspack_core/src/compiler/make/mod.rs index d599ce35107c..6fade55f2a5e 100644 --- a/crates/rspack_core/src/compiler/make/mod.rs +++ b/crates/rspack_core/src/compiler/make/mod.rs @@ -1,4 +1,4 @@ -pub mod cutout; +mod cutout; pub mod repair; use rspack_collections::IdentifierSet; @@ -177,6 +177,11 @@ impl MakeArtifact { }); module_diagnostics.chain(dep_diagnostics).collect() } + + pub fn reset_temporary_data(&mut self) { + self.built_modules = Default::default(); + self.revoked_modules = Default::default(); + } } #[derive(Debug, Clone)] @@ -219,8 +224,7 @@ pub async fn make_module_graph( } // reset temporary data - artifact.built_modules = Default::default(); - artifact.revoked_modules = Default::default(); + artifact.reset_temporary_data(); artifact = update_module_graph(compilation, artifact, params).await?; Ok(artifact) } @@ -228,18 +232,11 @@ pub async fn make_module_graph( pub async fn update_module_graph( compilation: &Compilation, mut artifact: MakeArtifact, - mut params: Vec, + params: Vec, ) -> Result { artifact.state = MakeArtifactState::Initialized; let mut cutout = Cutout::default(); - compilation - .plugin_driver - .compilation_hooks - .update_module_graph - .call(&mut params, &artifact) - .await?; - let build_dependencies = cutout.cutout_artifact(&mut artifact, params); compilation diff --git a/crates/rspack_core/src/compiler/make/repair/mod.rs b/crates/rspack_core/src/compiler/make/repair/mod.rs index cd2d24bcef22..630045e22341 100644 --- a/crates/rspack_core/src/compiler/make/repair/mod.rs +++ b/crates/rspack_core/src/compiler/make/repair/mod.rs @@ -21,6 +21,7 @@ use crate::{ SharedPluginDriver, }; +#[derive(Debug)] pub struct MakeTaskContext { pub compiler_id: CompilerId, // compilation info @@ -62,11 +63,6 @@ impl MakeTaskContext { } } - pub fn transform_to_make_artifact(self) -> MakeArtifact { - let Self { artifact, .. } = self; - artifact - } - // TODO use module graph with make artifact pub fn get_module_graph_mut(partial: &mut ModuleGraphPartial) -> ModuleGraph { ModuleGraph::new(vec![], Some(partial)) @@ -160,5 +156,5 @@ pub async fn repair( let mut ctx = MakeTaskContext::new(compilation, artifact, compilation.cache.clone()); run_task_loop(&mut ctx, init_tasks).await?; - Ok(ctx.transform_to_make_artifact()) + Ok(ctx.artifact) } diff --git a/crates/rspack_core/src/compiler/module_executor/context.rs b/crates/rspack_core/src/compiler/module_executor/context.rs new file mode 100644 index 000000000000..55bfcb35199b --- /dev/null +++ b/crates/rspack_core/src/compiler/module_executor/context.rs @@ -0,0 +1,32 @@ +use rustc_hash::{FxHashMap as HashMap, FxHashSet as HashSet}; + +use super::module_tracker::ModuleTracker; +use crate::{make::repair::MakeTaskContext, DependencyId, ModuleIdentifier}; + +/// The meta data for import_module. +/// +/// If the meta data is same, we can assume that it is a same entry. +#[derive(Debug, Hash, PartialEq, Eq, Clone)] +pub struct ImportModuleMeta { + pub origin_module_identifier: ModuleIdentifier, + pub request: String, + pub layer: Option, +} + +/// A task context for module executor. +#[derive(Debug)] +pub struct ExecutorTaskContext { + /// The make task context. + pub origin_context: MakeTaskContext, + /// module tracker. + pub tracker: ModuleTracker, + /// entries. + /// + /// All of the import module entry and their dependency id. + pub entries: HashMap, + /// The entry deps used during the current compilation. + /// + /// When Module Executor stops, entries that are not in use + /// and whose origin_module_identifier has been revoked are removed. + pub executed_entry_deps: HashSet, +} diff --git a/crates/rspack_core/src/compiler/module_executor/ctrl.rs b/crates/rspack_core/src/compiler/module_executor/ctrl.rs index 39af764f0198..37047aa7f1cd 100644 --- a/crates/rspack_core/src/compiler/module_executor/ctrl.rs +++ b/crates/rspack_core/src/compiler/module_executor/ctrl.rs @@ -1,369 +1,41 @@ -use std::collections::VecDeque; +use tokio::sync::mpsc::UnboundedReceiver; -use rspack_collections::IdentifierMap; -use rustc_hash::{FxHashMap as HashMap, FxHashSet as HashSet}; -use tokio::sync::mpsc::{error::TryRecvError, UnboundedReceiver}; - -use super::{ - entry::EntryTask, - execute::{BeforeExecuteBuildTask, ExecuteTask}, -}; -use crate::{ - compiler::make::repair::MakeTaskContext, - utils::task_loop::{Task, TaskResult, TaskType}, - Dependency, DependencyId, LoaderImportDependency, ModuleIdentifier, -}; +use super::{context::ExecutorTaskContext, entry::EntryTask}; +use crate::utils::task_loop::{Task, TaskResult, TaskType}; -#[derive(Debug)] -struct UnfinishCounter { - is_building: bool, - unfinished_child_module_count: usize, -} - -impl UnfinishCounter { - fn new() -> Self { - UnfinishCounter { - is_building: true, - unfinished_child_module_count: 0, - } - } - - fn set_unfinished_child_module_count(&mut self, count: usize) { - self.is_building = false; - self.unfinished_child_module_count = count; - } - - fn minus_one(&mut self) { - if self.is_building || self.unfinished_child_module_count == 0 { - panic!("UnfinishDepCount Error") - } - self.unfinished_child_module_count -= 1; - } - - fn is_finished(&self) -> bool { - !self.is_building && self.unfinished_child_module_count == 0 - } -} - -#[derive(Debug, Default)] -struct ExecuteTaskList(Vec>>); - -impl ExecuteTaskList { - fn add_task(&mut self, task: ExecuteTask) { - self.0.push(Box::new(task)); - if self.0.len() > 10000 { - // TODO change to Err - panic!("ExecuteTaskList exceeds limit and may contain circular build dependencies.") - } - } - - fn into_vec(self) -> Vec>> { - self.0 - } -} - -#[derive(Debug)] -pub enum ExecuteParam { - DependencyId(DependencyId), - Entry(Box, Option), -} - -// send event can only use in sync task +/// Event for CtrlTask #[derive(Debug)] pub enum Event { - StartBuild(ModuleIdentifier), - // origin_module_identifier and current dependency id and target_module_identifier - FinishDeps( - Option, - DependencyId, - Option, - ), - // current_module_identifier and sub dependency count - FinishModule(ModuleIdentifier, usize), - ExecuteModule(ExecuteParam, ExecuteTask, Option), - Stop(), + /// Trigger a import module task + ImportModule(EntryTask), + /// Stop + Stop, } +/// A background task to make task loop without exit and dynamically add entry tasks. #[derive(Debug)] pub struct CtrlTask { pub event_receiver: UnboundedReceiver, - execute_task_map: HashMap, - running_module_map: IdentifierMap, -} - -impl CtrlTask { - pub fn new(event_receiver: UnboundedReceiver) -> Self { - Self { - event_receiver, - execute_task_map: Default::default(), - running_module_map: Default::default(), - } - } } #[async_trait::async_trait] -impl Task for CtrlTask { +impl Task for CtrlTask { fn get_task_type(&self) -> TaskType { TaskType::Async } - async fn background_run(mut self: Box) -> TaskResult { - while let Some(event) = self.event_receiver.recv().await { - tracing::debug!("CtrlTask async receive {:?}", event); - match event { - Event::StartBuild(module_identifier) => { - self - .running_module_map - .insert(module_identifier, UnfinishCounter::new()); - } - Event::FinishDeps(origin_module_identifier, dep_id, target_module_graph) => { - if let Some(target_module_graph) = target_module_graph { - if self.running_module_map.contains_key(&target_module_graph) - && Some(target_module_graph) != origin_module_identifier - { - continue; - } - } - - // target module finished - let Some(origin_module_identifier) = origin_module_identifier else { - // origin_module_identifier is none means entry dep - let mut tasks = self - .execute_task_map - .remove(&dep_id) - .expect("should have execute task") - .into_vec(); - tasks.push(self); - return Ok(tasks); - }; - - let value = self - .running_module_map - .get_mut(&origin_module_identifier) - .expect("should have counter"); - value.minus_one(); - if value.is_finished() { - return Ok(vec![Box::new(FinishModuleTask { - ctrl_task: self, - module_identifier: origin_module_identifier, - })]); - } - } - Event::FinishModule(mid, size) => { - let value = self - .running_module_map - .get_mut(&mid) - .expect("should have counter"); - value.set_unfinished_child_module_count(size); - if value.is_finished() { - return Ok(vec![Box::new(FinishModuleTask { - ctrl_task: self, - module_identifier: mid, - })]); - } - } - Event::ExecuteModule(param, execute_task, before_execute_task) => { - match param { - ExecuteParam::Entry(dep, layer) => { - let dep_id = dep.id(); - if let Some(tasks) = self.execute_task_map.get_mut(dep_id) { - tasks.add_task(execute_task) - } else { - let mut list = ExecuteTaskList::default(); - list.add_task(execute_task); - self.execute_task_map.insert(*dep_id, list); - return Ok(if let Some(before_execute_task) = before_execute_task { - vec![ - Box::new(before_execute_task), - Box::new(EntryTask { dep, layer }), - self, - ] - } else { - vec![Box::new(EntryTask { dep, layer }), self] - }); - } - } - ExecuteParam::DependencyId(dep_id) => { - if let Some(tasks) = self.execute_task_map.get_mut(&dep_id) { - tasks.add_task(execute_task) - } else { - return Ok(if let Some(before_execute_task) = before_execute_task { - vec![Box::new(before_execute_task), Box::new(execute_task), self] - } else { - vec![Box::new(execute_task), self] - }); - } - } - }; - } - Event::Stop() => { - return Ok(vec![]); - } + async fn background_run(mut self: Box) -> TaskResult { + let Some(event) = self.event_receiver.recv().await else { + // if channel has been closed, finish this task + return Ok(vec![]); + }; + tracing::debug!("CtrlTask async receive {:?}", event); + match event { + // return self to keep CtrlTask still run. + Event::ImportModule(entry_task) => return Ok(vec![Box::new(entry_task), self]), + Event::Stop => { + return Ok(vec![]); } } - // if channel has been closed, finish this task - Ok(vec![]) - } -} - -#[derive(Debug)] -struct FinishModuleTask { - ctrl_task: Box, - module_identifier: ModuleIdentifier, -} -#[async_trait::async_trait] -impl Task for FinishModuleTask { - fn get_task_type(&self) -> TaskType { - TaskType::Sync - } - - async fn main_run(self: Box, context: &mut MakeTaskContext) -> TaskResult { - let Self { - mut ctrl_task, - module_identifier, - } = *self; - let mut res: Vec>> = vec![]; - let module_graph = - MakeTaskContext::get_module_graph_mut(&mut context.artifact.module_graph_partial); - let mut queue = VecDeque::new(); - queue.push_back(module_identifier); - - // clean ctrl task events - loop { - let event = ctrl_task.event_receiver.try_recv(); - tracing::debug!("CtrlTask sync receive {:?}", event); - let Ok(event) = event else { - if matches!(event, Err(TryRecvError::Empty)) { - break; - } else { - panic!("clean ctrl_task event failed"); - } - }; - - match event { - Event::StartBuild(module_identifier) => { - ctrl_task - .running_module_map - .insert(module_identifier, UnfinishCounter::new()); - } - Event::FinishDeps(origin_module_identifier, dep_id, target_module_graph) => { - if let Some(target_module_graph) = target_module_graph { - if ctrl_task - .running_module_map - .contains_key(&target_module_graph) - && Some(target_module_graph) != origin_module_identifier - { - continue; - } - } - - // target module finished - let Some(origin_module_identifier) = origin_module_identifier else { - // origin_module_identifier is none means entry dep - let execute_task = ctrl_task - .execute_task_map - .remove(&dep_id) - .expect("should have execute task") - .into_vec(); - res.extend(execute_task); - continue; - }; - - let value = ctrl_task - .running_module_map - .get_mut(&origin_module_identifier) - .expect("should have counter"); - value.minus_one(); - if value.is_finished() { - queue.push_back(origin_module_identifier); - } - } - Event::FinishModule(mid, size) => { - let value = ctrl_task - .running_module_map - .get_mut(&mid) - .expect("should have counter"); - value.set_unfinished_child_module_count(size); - if value.is_finished() { - queue.push_back(mid); - } - } - Event::ExecuteModule(param, execute_task, before_execute_build_task) => { - match param { - ExecuteParam::Entry(dep, layer) => { - let dep_id = dep.id(); - if let Some(tasks) = ctrl_task.execute_task_map.get_mut(dep_id) { - tasks.add_task(execute_task) - } else { - let mut list = ExecuteTaskList::default(); - list.add_task(execute_task); - ctrl_task.execute_task_map.insert(*dep_id, list); - if let Some(before_execute_build_task) = before_execute_build_task { - res.push(Box::new(before_execute_build_task)); - } - res.push(Box::new(EntryTask { dep, layer })); - } - } - ExecuteParam::DependencyId(dep_id) => { - if let Some(tasks) = ctrl_task.execute_task_map.get_mut(&dep_id) { - tasks.add_task(execute_task) - } else { - if let Some(before_execute_build_task) = before_execute_build_task { - res.push(Box::new(before_execute_build_task)); - } - res.push(Box::new(execute_task)); - } - } - }; - } - Event::Stop() => { - return Ok(vec![]); - } - } - } - - while let Some(module_identifier) = queue.pop_front() { - tracing::debug!("finish build module {:?}", module_identifier); - ctrl_task.running_module_map.remove(&module_identifier); - - let mgm = module_graph - .module_graph_module_by_identifier(&module_identifier) - .expect("should have mgm"); - - let mut original_module_identifiers = HashSet::default(); - for dep_id in mgm.incoming_connections() { - let connection = module_graph - .connection_by_dependency_id(dep_id) - .expect("should have connection"); - if let Some(original_module_identifier) = &connection.original_module_identifier { - // skip self reference - if original_module_identifier != &module_identifier { - original_module_identifiers.insert(*original_module_identifier); - } - } else { - // entry - let execute_task = ctrl_task - .execute_task_map - .remove(&connection.dependency_id) - .expect("should have execute task") - .into_vec(); - res.extend(execute_task); - } - } - - for id in original_module_identifiers { - let value = ctrl_task - .running_module_map - .get_mut(&id) - .expect("should have counter"); - value.minus_one(); - if value.is_finished() { - queue.push_back(id); - } - } - } - - res.push(ctrl_task); - Ok(res) } } diff --git a/crates/rspack_core/src/compiler/module_executor/entry.rs b/crates/rspack_core/src/compiler/module_executor/entry.rs index 825af5b58fdd..dcd2bdf53b84 100644 --- a/crates/rspack_core/src/compiler/module_executor/entry.rs +++ b/crates/rspack_core/src/compiler/module_executor/entry.rs @@ -1,52 +1,112 @@ +use std::collections::hash_map::Entry; + +use super::{ + context::{ExecutorTaskContext, ImportModuleMeta}, + execute::{ExecuteResultSender, ExecuteTask}, + overwrite::overwrite_tasks, +}; use crate::{ compiler::make::repair::{factorize::FactorizeTask, MakeTaskContext}, utils::task_loop::{Task, TaskResult, TaskType}, - Dependency, LoaderImportDependency, ModuleProfile, + Context, Dependency, LoaderImportDependency, ModuleProfile, PublicPath, }; +/// A task for generate import module entry. #[derive(Debug)] pub struct EntryTask { - pub dep: Box, - pub layer: Option, + pub meta: ImportModuleMeta, + pub origin_module_context: Option, + pub public_path: Option, + pub base_uri: Option, + pub result_sender: ExecuteResultSender, } #[async_trait::async_trait] -impl Task for EntryTask { +impl Task for EntryTask { fn get_task_type(&self) -> TaskType { TaskType::Sync } - async fn main_run(self: Box, context: &mut MakeTaskContext) -> TaskResult { - let Self { dep, layer } = *self; - let mut module_graph = - MakeTaskContext::get_module_graph_mut(&mut context.artifact.module_graph_partial); - - module_graph.add_dependency(dep.clone()); - Ok(vec![Box::new(FactorizeTask { - compiler_id: context.compiler_id, - compilation_id: context.compilation_id, - module_factory: context - .dependency_factories - .get(dep.dependency_type()) - .unwrap_or_else(|| { - panic!( - "should have dependency_factories for dependency_type: {}", - dep.dependency_type() - ) - }) - .clone(), - original_module_identifier: None, - original_module_source: None, - issuer: None, - issuer_layer: layer, - original_module_context: None, - dependencies: vec![dep], - resolve_options: None, - options: context.compiler_options.clone(), - current_profile: context - .compiler_options - .profile - .then(Box::::default), - resolver_factory: context.resolver_factory.clone(), - })]) + async fn main_run( + self: Box, + context: &mut ExecutorTaskContext, + ) -> TaskResult { + let Self { + meta, + origin_module_context, + public_path, + base_uri, + result_sender, + } = *self; + let ExecutorTaskContext { + entries, + origin_context, + tracker, + executed_entry_deps, + } = context; + + let task = ExecuteTask { + meta: meta.clone(), + public_path, + base_uri, + result_sender, + }; + let mut res = vec![]; + let (dep_id, is_new) = match entries.entry(meta.clone()) { + Entry::Vacant(v) => { + // not exist, generate a new dependency + let dep = Box::new(LoaderImportDependency::new( + meta.request, + origin_module_context.unwrap_or(Context::from("")), + )); + let dep_id = *dep.id(); + + let mut mg = + MakeTaskContext::get_module_graph_mut(&mut origin_context.artifact.module_graph_partial); + mg.add_dependency(dep.clone()); + + res.extend(overwrite_tasks(vec![Box::new(FactorizeTask { + compiler_id: origin_context.compiler_id, + compilation_id: origin_context.compilation_id, + module_factory: origin_context + .dependency_factories + .get(dep.dependency_type()) + .unwrap_or_else(|| { + panic!( + "should have dependency_factories for dependency_type: {}", + dep.dependency_type() + ) + }) + .clone(), + original_module_identifier: None, + original_module_source: None, + issuer: None, + issuer_layer: meta.layer.clone(), + original_module_context: None, + dependencies: vec![dep], + resolve_options: None, + options: origin_context.compiler_options.clone(), + current_profile: origin_context + .compiler_options + .profile + .then(Box::::default), + resolver_factory: origin_context.resolver_factory.clone(), + })])); + (*v.insert(dep_id), true) + } + Entry::Occupied(v) => (*v.get(), false), + }; + + // mark as executed + executed_entry_deps.insert(dep_id); + + res.extend(tracker.on_entry(is_new, dep_id, |error| match error { + Some(error) => { + task.finish_with_error(error); + None + } + None => Some(Box::new(task)), + })); + + Ok(res) } } diff --git a/crates/rspack_core/src/compiler/module_executor/execute.rs b/crates/rspack_core/src/compiler/module_executor/execute.rs index 1d214f93a960..f55c32f9dc27 100644 --- a/crates/rspack_core/src/compiler/module_executor/execute.rs +++ b/crates/rspack_core/src/compiler/module_executor/execute.rs @@ -1,18 +1,18 @@ -use std::{iter::once, sync::atomic::AtomicU32}; +use std::{collections::VecDeque, iter::once, sync::atomic::AtomicU32}; use itertools::Itertools; use rspack_collections::{DatabaseItem, Identifier, IdentifierSet, UkeySet}; -use rspack_error::RspackSeverity; +use rspack_error::{Error, RspackSeverity}; use rspack_paths::ArcPath; use rustc_hash::{FxHashMap as HashMap, FxHashSet as HashSet}; use tokio::sync::oneshot::Sender; +use super::context::{ExecutorTaskContext, ImportModuleMeta}; use crate::{ - compiler::make::repair::MakeTaskContext, utils::task_loop::{Task, TaskResult, TaskType}, Chunk, ChunkGraph, ChunkKind, CodeGenerationDataAssetInfo, CodeGenerationDataFilename, - CodeGenerationResult, CompilationAsset, CompilationAssets, DependencyId, EntryOptions, - Entrypoint, ModuleType, PublicPath, RuntimeSpec, SourceType, + CodeGenerationResult, CompilationAsset, CompilationAssets, EntryOptions, Entrypoint, + FactorizeInfo, ModuleType, PublicPath, RuntimeSpec, SourceType, }; #[derive(Debug, Clone)] @@ -40,106 +40,77 @@ pub struct ExecuteModuleResult { pub id: ExecuteModuleId, } -#[derive(Debug)] -pub struct BeforeExecuteBuildTask { - pub entry_dep_id: DependencyId, -} - -#[async_trait::async_trait] -impl Task for BeforeExecuteBuildTask { - fn get_task_type(&self) -> TaskType { - TaskType::Sync - } - - async fn main_run(self: Box, context: &mut MakeTaskContext) -> TaskResult { - let Self { entry_dep_id } = *self; - let mut mg = MakeTaskContext::get_module_graph_mut(&mut context.artifact.module_graph_partial); - let entry_module_identifier = *mg - .module_identifier_by_dependency_id(&entry_dep_id) - .expect("should have module"); - - let mut queue = vec![entry_module_identifier]; - let mut visited = IdentifierSet::default(); - while let Some(module_identifier) = queue.pop() { - queue.extend( - mg.get_ordered_outgoing_connections(&module_identifier) - .map(|c| *c.module_identifier()) - .filter(|id| !visited.contains(id)), - ); - visited.insert(module_identifier); - } - for module_identifier in visited { - mg.revoke_module(&module_identifier); - } - Ok(vec![]) - } -} +pub type ExecuteResultSender = Sender<( + ExecuteModuleResult, + CompilationAssets, + IdentifierSet, + Vec, +)>; #[derive(Debug)] pub struct ExecuteTask { - pub entry_dep_id: DependencyId, - pub layer: Option, + pub meta: ImportModuleMeta, pub public_path: Option, pub base_uri: Option, - pub result_sender: Sender<( - ExecuteModuleResult, - CompilationAssets, - IdentifierSet, - Vec, - )>, + pub result_sender: ExecuteResultSender, } + +impl ExecuteTask { + pub fn finish_with_error(self, error: Error) { + let id = EXECUTE_MODULE_ID.fetch_add(1, std::sync::atomic::Ordering::Relaxed); + self + .result_sender + .send(( + ExecuteModuleResult { + id, + error: Some(error.to_string()), + ..Default::default() + }, + Default::default(), + Default::default(), + Default::default(), + )) + .expect("should send result success"); + } +} + #[async_trait::async_trait] -impl Task for ExecuteTask { +impl Task for ExecuteTask { fn get_task_type(&self) -> TaskType { TaskType::Sync } - async fn main_run(self: Box, context: &mut MakeTaskContext) -> TaskResult { + async fn main_run( + self: Box, + context: &mut ExecutorTaskContext, + ) -> TaskResult { let Self { - entry_dep_id, - layer, + meta, public_path, base_uri, result_sender, } = *self; - let mut compilation = context.transform_to_temp_compilation(); - let main_compilation_plugin_driver = compilation.plugin_driver.clone(); - compilation.plugin_driver = compilation.buildtime_plugin_driver.clone(); + let ExecutorTaskContext { + origin_context, + entries, + .. + } = context; let id = EXECUTE_MODULE_ID.fetch_add(1, std::sync::atomic::Ordering::Relaxed); + let mut execute_result = ExecuteModuleResult { + cacheable: true, + id, + ..Default::default() + }; - if compilation - .make_artifact - .diagnostics() - .iter() - .any(|d| matches!(d.severity(), RspackSeverity::Error)) - { - let execute_result = compilation.get_module_graph().modules().iter().fold( - ExecuteModuleResult { - cacheable: false, - id, - ..Default::default() - }, - |mut res, (_, module)| { - let build_info = &module.build_info(); - res - .file_dependencies - .extend(build_info.file_dependencies.iter().cloned()); - res - .context_dependencies - .extend(build_info.context_dependencies.iter().cloned()); - res - .missing_dependencies - .extend(build_info.missing_dependencies.iter().cloned()); - res - .build_dependencies - .extend(build_info.build_dependencies.iter().cloned()); - res - }, - ); - - context.recovery_from_temp_compilation(compilation); + let entry_dep_id = entries.get(&meta).expect("should have dep_id"); + // collect module info + let mg = origin_context.artifact.get_module_graph(); + let Some(entry_module_identifier) = + mg.module_identifier_by_dependency_id(entry_dep_id).copied() + else { + // no entry module, entry dependency factorize failed. result_sender .send(( execute_result, @@ -150,32 +121,84 @@ impl Task for ExecuteTask { .expect("should send result success"); return Ok(vec![]); - } - - let mg = compilation.get_module_graph_mut(); - // TODO remove expect and return Err - let entry_module_identifier = mg - .get_module_by_dependency_id(&entry_dep_id) - .expect("should have module") - .identifier(); - let mut queue = vec![entry_module_identifier]; + }; + let make_failed_module = &origin_context.artifact.make_failed_module; + let make_failed_dependencies = &origin_context.artifact.make_failed_dependencies; + let mut queue = VecDeque::from(vec![entry_module_identifier]); let mut assets = CompilationAssets::default(); let mut modules = IdentifierSet::default(); + let mut has_error = false; - while let Some(m) = queue.pop() { + while let Some(m) = queue.pop_front() { modules.insert(m); let module = mg.module_by_identifier(&m).expect("should have module"); - for (name, asset) in module.build_info().assets.as_ref() { + let build_info = module.build_info(); + execute_result + .file_dependencies + .extend(build_info.file_dependencies.iter().cloned()); + execute_result + .context_dependencies + .extend(build_info.context_dependencies.iter().cloned()); + execute_result + .missing_dependencies + .extend(build_info.missing_dependencies.iter().cloned()); + execute_result + .build_dependencies + .extend(build_info.build_dependencies.iter().cloned()); + if !build_info.cacheable { + execute_result.cacheable = false; + } + for (name, asset) in build_info.assets.as_ref() { assets.insert(name.clone(), asset.clone()); } - for c in mg.get_outgoing_connections(&m) { - // TODO: handle circle - if !modules.contains(c.module_identifier()) { - queue.push(*c.module_identifier()); + if !has_error && make_failed_module.contains(&m) { + let diagnostics = module.diagnostics(); + if diagnostics + .iter() + .any(|d| matches!(d.severity(), RspackSeverity::Error)) + { + has_error = true; + } + } + + for dep_id in module.get_dependencies() { + if !has_error && make_failed_dependencies.contains(dep_id) { + let dep = mg.dependency_by_id(dep_id).expect("should dep exist"); + let diagnostics = FactorizeInfo::get_from(dep) + .expect("should have factorize info") + .diagnostics(); + if diagnostics + .iter() + .any(|d| matches!(d.severity(), RspackSeverity::Error)) + { + has_error = true; + } + } + if let Some(c) = mg.connection_by_dependency_id(dep_id) { + if !modules.contains(c.module_identifier()) { + queue.push_back(*c.module_identifier()); + } } } } + if has_error { + result_sender + .send(( + execute_result, + CompilationAssets::default(), + IdentifierSet::default(), + vec![], + )) + .expect("should send result success"); + + return Ok(vec![]); + } + + let mut compilation = origin_context.transform_to_temp_compilation(); + let main_compilation_plugin_driver = compilation.plugin_driver.clone(); + compilation.plugin_driver = compilation.buildtime_plugin_driver.clone(); + tracing::debug!("modules: {:?}", &modules); let mut chunk_graph = ChunkGraph::default(); @@ -201,7 +224,7 @@ impl Task for ExecuteTask { filename: None, library: None, depend_on: None, - layer, + layer: meta.layer, }), }); @@ -300,34 +323,6 @@ impl Task for ExecuteTask { ) .await; - let module_graph = compilation.get_module_graph(); - let mut execute_result = modules.iter().fold( - ExecuteModuleResult { - cacheable: true, - id, - ..Default::default() - }, - |mut res, m| { - let module = module_graph.module_by_identifier(m).expect("unreachable"); - let build_info = &module.build_info(); - res - .file_dependencies - .extend(build_info.file_dependencies.iter().cloned()); - res - .context_dependencies - .extend(build_info.context_dependencies.iter().cloned()); - res - .missing_dependencies - .extend(build_info.missing_dependencies.iter().cloned()); - res - .build_dependencies - .extend(build_info.build_dependencies.iter().cloned()); - if !build_info.cacheable { - res.cacheable = false; - } - res - }, - ); match exports { Ok(_) => { for m in modules.iter() { @@ -373,7 +368,7 @@ impl Task for ExecuteTask { } }) .collect_vec(); - context.recovery_from_temp_compilation(compilation); + origin_context.recovery_from_temp_compilation(compilation); result_sender .send(( execute_result, diff --git a/crates/rspack_core/src/compiler/module_executor/mod.rs b/crates/rspack_core/src/compiler/module_executor/mod.rs index a7f0a3428600..e05eaf1272c9 100644 --- a/crates/rspack_core/src/compiler/module_executor/mod.rs +++ b/crates/rspack_core/src/compiler/module_executor/mod.rs @@ -1,14 +1,16 @@ +mod context; mod ctrl; mod entry; mod execute; +mod module_tracker; mod overwrite; use std::sync::Arc; -use dashmap::{mapref::entry::Entry, DashMap}; -use execute::BeforeExecuteBuildTask; +use context::{ExecutorTaskContext, ImportModuleMeta}; +use entry::EntryTask; pub use execute::{ExecuteModuleId, ExecutedRuntimeModule}; -use rspack_collections::{Identifier, IdentifierDashMap, IdentifierDashSet, IdentifierSet}; +use rspack_collections::{Identifier, IdentifierDashMap, IdentifierDashSet}; use rspack_error::Result; use rustc_hash::{FxHashMap as HashMap, FxHashSet as HashSet}; use tokio::{ @@ -20,38 +22,26 @@ use tokio::{ }; use self::{ - ctrl::{CtrlTask, Event, ExecuteParam}, - execute::{ExecuteModuleResult, ExecuteTask}, - overwrite::OverwriteTask, -}; -use super::make::{ - cutout::Cutout, - repair::{repair, MakeTaskContext}, - MakeArtifact, MakeParam, + ctrl::{CtrlTask, Event}, + execute::ExecuteModuleResult, }; +use super::make::{repair::MakeTaskContext, update_module_graph, MakeArtifact, MakeParam}; use crate::{ - cache::MemoryCache, task_loop::run_task_loop_with_event, Compilation, CompilationAsset, Context, - Dependency, DependencyId, LoaderImportDependency, PublicPath, + cache::MemoryCache, task_loop::run_task_loop, Compilation, CompilationAsset, Context, + DependencyId, PublicPath, }; -#[derive(Debug)] -struct DepStatus { - id: DependencyId, - should_update: bool, -} - #[derive(Debug, Default)] pub struct ModuleExecutor { - cutout: Cutout, - request_dep_map: DashMap<(String, Option), DepStatus>, + // data pub make_artifact: MakeArtifact, - pub rebuild_origins: Option, + pub entries: HashMap, + // temporary data, used by hook_after_finish_modules event_sender: Option>, - stop_receiver: Option>, + stop_receiver: Option>, module_assets: IdentifierDashMap>, code_generated_modules: IdentifierDashSet, - module_code_generated_modules: IdentifierDashMap, pub executed_runtime_modules: IdentifierDashMap, } @@ -66,42 +56,17 @@ impl ModuleExecutor { if !compilation.removed_files.is_empty() { params.push(MakeParam::RemovedFiles(compilation.removed_files.clone())); } - make_artifact.built_modules = Default::default(); - make_artifact.revoked_modules = Default::default(); - - compilation - .plugin_driver - .compilation_hooks - .update_module_graph - .call(&mut params, &make_artifact) - .await?; + make_artifact.reset_temporary_data(); - // Modules imported by `importModule` are passively loaded. - let mut build_dependencies = self.cutout.cutout_artifact(&mut make_artifact, params); + // update the module affected by modified_files + make_artifact = update_module_graph(compilation, make_artifact, params).await?; - compilation - .plugin_driver - .compilation_hooks - .revoked_modules - .call(&make_artifact.revoked_modules) - .await?; - - let mut build_dependencies_id = build_dependencies - .iter() - .map(|(id, _)| *id) - .collect::>(); - for mut dep_status in self.request_dep_map.iter_mut() { - if build_dependencies_id.contains(&dep_status.id) { - dep_status.should_update = true; - build_dependencies_id.remove(&dep_status.id); - } - } - build_dependencies.retain(|dep| build_dependencies_id.contains(&dep.0)); - make_artifact = repair(compilation, make_artifact, build_dependencies) - .await - .unwrap_or_default(); - - let mut ctx = MakeTaskContext::new(compilation, make_artifact, Arc::new(MemoryCache)); + let mut ctx = ExecutorTaskContext { + origin_context: MakeTaskContext::new(compilation, make_artifact, Arc::new(MemoryCache)), + tracker: Default::default(), + entries: std::mem::take(&mut self.entries), + executed_entry_deps: Default::default(), + }; let (event_sender, event_receiver) = unbounded_channel(); let (stop_sender, stop_receiver) = oneshot::channel(); self.event_sender = Some(event_sender.clone()); @@ -109,42 +74,47 @@ impl ModuleExecutor { // avoid coop budget consumed to zero cause hang risk // related to https://tokio.rs/blog/2020-04-preemption tokio::spawn(task::unconstrained(async move { - let _ = run_task_loop_with_event( - &mut ctx, - vec![Box::new(CtrlTask::new(event_receiver))], - |_, task| { - Box::new(OverwriteTask { - origin_task: task, - event_sender: event_sender.clone(), - }) - }, - ) - .await; + let _ = run_task_loop(&mut ctx, vec![Box::new(CtrlTask { event_receiver })]).await; - stop_sender - .send(ctx.transform_to_make_artifact()) - .expect("should success"); + // ignore error, stop_receiver may be dropped if make stage occur error. + let _ = stop_sender.send(ctx); })); Ok(()) } - pub async fn hook_after_finish_modules(&mut self, compilation: &mut Compilation) { + pub async fn hook_after_finish_modules(&mut self, compilation: &mut Compilation) -> Result<()> { let sender = std::mem::take(&mut self.event_sender); sender .expect("should have sender") - .send(Event::Stop()) + .send(Event::Stop) .expect("should success"); let stop_receiver = std::mem::take(&mut self.stop_receiver); - if let Ok(make_artifact) = stop_receiver.expect("should have receiver").await { - self.make_artifact = make_artifact; - } else { + let Ok(ctx) = stop_receiver.expect("should have receiver").await else { panic!("receive make artifact failed"); - } + }; + self.make_artifact = ctx.origin_context.artifact; + self.entries = ctx.entries; - let cutout = std::mem::take(&mut self.cutout); - cutout.fix_artifact(&mut self.make_artifact); + // clean removed entries + let removed_module = compilation + .make_artifact + .revoked_modules + .iter() + .chain(self.make_artifact.revoked_modules.iter()) + .collect::>(); + self.entries.retain(|k, v| { + !removed_module.contains(&k.origin_module_identifier) || ctx.executed_entry_deps.contains(v) + }); + self.make_artifact = update_module_graph( + compilation, + std::mem::take(&mut self.make_artifact), + vec![MakeParam::BuildEntryAndClean( + self.entries.values().copied().collect(), + )], + ) + .await?; let mut mg = compilation.make_artifact.get_module_graph_mut(); let module_assets = std::mem::take(&mut self.module_assets); @@ -155,8 +125,6 @@ impl ModuleExecutor { } } - // let module_code_generation_modules = std::mem::take(&mut self.module_code_generated_modules); - let diagnostics = self.make_artifact.diagnostics(); compilation.extend_diagnostics(diagnostics); @@ -166,22 +134,8 @@ impl ModuleExecutor { } // remove useless *_dependencies incremental info - self - .make_artifact - .file_dependencies - .reset_incremental_info(); - self - .make_artifact - .context_dependencies - .reset_incremental_info(); - self - .make_artifact - .missing_dependencies - .reset_incremental_info(); - self - .make_artifact - .build_dependencies - .reset_incremental_info(); + self.make_artifact.reset_dependencies_incremental_info(); + Ok(()) } #[allow(clippy::too_many_arguments)] @@ -191,97 +145,42 @@ impl ModuleExecutor { layer: Option, public_path: Option, base_uri: Option, - original_module_context: Option, - original_module_identifier: Option, + origin_module_context: Option, + origin_module_identifier: Identifier, ) -> ExecuteModuleResult { let sender = self .event_sender .as_ref() .expect("should have event sender"); - let is_entry_rebuild = self - .rebuild_origins - .as_ref() - .is_some_and(|set| original_module_identifier.is_some_and(|i| set.contains(&i))); - let (param, dep_id) = match self.request_dep_map.entry((request.clone(), layer.clone())) { - Entry::Vacant(v) => { - let dep = LoaderImportDependency::new( - request.clone(), - original_module_context.unwrap_or(Context::from("")), - ); - let dep_id = *dep.id(); - v.insert(DepStatus { - id: dep_id, - should_update: false, - }); - (ExecuteParam::Entry(Box::new(dep), layer.clone()), dep_id) - } - Entry::Occupied(mut v) => { - let dep_status = v.get_mut(); - let dep_id = dep_status.id; - if dep_status.should_update { - let dep = LoaderImportDependency::new_with_id( - dep_id, - request.clone(), - original_module_context.unwrap_or(Context::from("")), - ); - dep_status.should_update = false; - (ExecuteParam::Entry(Box::new(dep), layer.clone()), dep_id) - } else if is_entry_rebuild { - let dep = LoaderImportDependency::new_with_id( - dep_id, - request.clone(), - original_module_context.unwrap_or(Context::from("")), - ); - (ExecuteParam::Entry(Box::new(dep), layer.clone()), dep_id) - } else { - (ExecuteParam::DependencyId(dep_id), dep_id) - } - } + let meta = ImportModuleMeta { + origin_module_identifier, + request, + layer, }; - let (tx, rx) = oneshot::channel(); sender - .send(Event::ExecuteModule( - param, - ExecuteTask { - entry_dep_id: dep_id, - layer, - public_path, - base_uri, - result_sender: tx, - }, - if is_entry_rebuild { - Some(BeforeExecuteBuildTask { - entry_dep_id: dep_id, - }) - } else { - None - }, - )) + .send(Event::ImportModule(EntryTask { + meta, + origin_module_context, + public_path, + base_uri, + result_sender: tx, + })) .expect("should success"); let (execute_result, assets, code_generated_modules, executed_runtime_modules) = rx.await.expect("should receiver success"); - if execute_result.error.is_none() - && let Some(original_module_identifier) = original_module_identifier - { + if execute_result.error.is_none() { self .module_assets - .entry(original_module_identifier) + .entry(origin_module_identifier) .or_default() .extend(assets); } for id in code_generated_modules { self.code_generated_modules.insert(id); - if let Some(original_module_identifier) = original_module_identifier { - self - .module_code_generated_modules - .entry(original_module_identifier) - .or_default() - .insert(id); - } } for runtime_module in executed_runtime_modules { diff --git a/crates/rspack_core/src/compiler/module_executor/module_tracker.rs b/crates/rspack_core/src/compiler/module_executor/module_tracker.rs new file mode 100644 index 000000000000..77c90187ce68 --- /dev/null +++ b/crates/rspack_core/src/compiler/module_executor/module_tracker.rs @@ -0,0 +1,218 @@ +use std::collections::{hash_map::Entry, VecDeque}; + +use rspack_collections::{IdentifierMap, IdentifierSet}; +use rspack_error::{miette::diagnostic, Error}; +use rustc_hash::FxHashMap as HashMap; + +use super::context::ExecutorTaskContext; +use crate::{ + make::repair::MakeTaskContext, task_loop::Task, DependencyId, ModuleIdentifier, ModuleIssuer, +}; + +type BoxTask = Box>; + +/// Tracks whether a module and its submodules have been built. +#[derive(Debug, Default)] +pub struct ModuleTracker { + /// A map to record unfinished modules and its unfinished submodules count. + /// + /// If a module not in this map, it means the module and its submodules have already been built. + /// If the submodules count is usize::MAX means the module is building. + unfinished_module: IdentifierMap, + + /// Entry dependency id to target box task. + /// + /// when entry dependency submodules are built, + /// 1. if reused_unfinished_module is empty, return box task directly. + /// 2. if reused_unfinished_module is not empty, add box task to pending_callbacks. + entry_finish_task: HashMap, + + /// Reused and unfinished modules. + /// + /// When cycle use module(B -> A -> B) or multi entries use same module(A -> B, C -> B) + /// will add the unfinished module(B) to this set. + /// The box task can be return only when the set is empty. + reused_unfinished_module: IdentifierSet, + + /// Pending box tasks. + /// + /// List the box task waiting for reused_unfinished_module to be cleared. + pending_tasks: Vec, +} + +impl ModuleTracker { + /// Calculate runnable tasks. + /// + /// This method will determine whether the ready_tasks and self.pending tasks are runnable. + /// Return all tasks only if self.reused_unfinished_module is empty, otherwise leave ready tasks pending. + fn calc_runnable_tasks(&mut self, mut ready_tasks: Vec) -> Vec { + if self.reused_unfinished_module.is_empty() { + ready_tasks.extend(std::mem::take(&mut self.pending_tasks)); + ready_tasks + } else { + self.pending_tasks.extend(ready_tasks); + vec![] + } + } + + /// Set a module as finished. Returns runnable box tasks. + /// + /// This method removes the module from the tracker and + /// recursively checks the status of all unfinished parent modules of this module. + /// Call this method when a module and its submodules are built. + fn finish_module( + &mut self, + context: &mut MakeTaskContext, + mid: ModuleIdentifier, + ) -> Vec { + let mut queue = VecDeque::from(vec![mid]); + let mut tasks = vec![]; + let module_graph = context.artifact.get_module_graph(); + while let Some(module_identifier) = queue.pop_front() { + tracing::debug!("finish build module {:?}", module_identifier); + let count = self.unfinished_module.remove(&module_identifier); + debug_assert_eq!(count, Some(0)); + + self.reused_unfinished_module.remove(&module_identifier); + + let mgm = module_graph + .module_graph_module_by_identifier(&module_identifier) + .expect("should have mgm"); + + match mgm.issuer() { + ModuleIssuer::Unset => { + panic!("can not access unset module issuer"); + } + ModuleIssuer::None => { + // no origin module, module is a entry module + for dep_id in mgm.incoming_connections() { + let connection = module_graph + .connection_by_dependency_id(dep_id) + .expect("should have connection"); + if let Some(task) = self.entry_finish_task.remove(&connection.dependency_id) { + tasks.push(task); + } + } + } + ModuleIssuer::Some(mid) => { + if let Some(count) = self.unfinished_module.get_mut(mid) { + *count -= 1; + if count == &0 { + queue.push_back(*mid); + } + } + } + }; + } + + self.calc_runnable_tasks(tasks) + } + + /// Set a dependency as finished. Returns runnable box tasks. + /// + /// If origin_mid is None, the method directly returns the runnable box task. + /// If origin_mid exists, origin_mid's unfinished submodules will be minus one, + /// and trigger self.finish_module if submodules count becomes 0. + /// Call this method when a dependency processing is complete. + fn finish_dep( + &mut self, + context: &mut MakeTaskContext, + origin_mid: Option, + dep_id: DependencyId, + ) -> Vec { + let Some(origin_mid) = origin_mid else { + // entry + if let Some(task) = self.entry_finish_task.remove(&dep_id) { + return self.calc_runnable_tasks(vec![task]); + } + return vec![]; + }; + let count = self + .unfinished_module + .get_mut(&origin_mid) + .expect("should factorize parent module unfinished"); + *count -= 1; + if count == &0 { + self.finish_module(context, origin_mid) + } else { + vec![] + } + } + + /// Handle factorize task failed. + pub fn on_factorize_failed( + &mut self, + context: &mut MakeTaskContext, + origin_mid: Option, + dep_id: DependencyId, + ) -> Vec { + self.finish_dep(context, origin_mid, dep_id) + } + + /// Handle add task with resolved module. + pub fn on_add_resolved_module( + &mut self, + context: &mut MakeTaskContext, + origin_mid: Option, + dep_id: DependencyId, + mid: ModuleIdentifier, + ) -> Vec { + if self.unfinished_module.contains_key(&mid) { + self.reused_unfinished_module.insert(mid); + } + self.finish_dep(context, origin_mid, dep_id) + } + + /// Handle add task with module need build + pub fn on_add(&mut self, mid: ModuleIdentifier) { + // will build module + self.unfinished_module.insert(mid, usize::MAX); + } + + /// Handle process dependencies task. + pub fn on_process_dependencies( + &mut self, + context: &mut MakeTaskContext, + mid: ModuleIdentifier, + child_count: usize, + ) -> Vec { + self.unfinished_module.insert(mid, child_count); + if child_count == 0 { + self.finish_module(context, mid) + } else { + vec![] + } + } + + /// Handle entry task. + pub fn on_entry( + &mut self, + is_new: bool, + dep_id: DependencyId, + get_task: impl FnOnce(Option) -> Option, + ) -> Vec { + let Entry::Vacant(entry) = self.entry_finish_task.entry(dep_id) else { + // entry task already exist means have circular build dependency + let _ = get_task(Some( + diagnostic!( + "task exist for {:?}, maybe have a circular build dependency", + dep_id + ) + .into(), + )); + return vec![]; + }; + + let Some(task) = get_task(None) else { + return vec![]; + }; + if is_new { + // insert it and wait for it to factorize. + entry.insert(task); + vec![] + } else { + // The target module is complete and the task can be run. + self.calc_runnable_tasks(vec![task]) + } + } +} diff --git a/crates/rspack_core/src/compiler/module_executor/overwrite.rs b/crates/rspack_core/src/compiler/module_executor/overwrite.rs index 125685abfe1c..cc041224db0b 100644 --- a/crates/rspack_core/src/compiler/module_executor/overwrite.rs +++ b/crates/rspack_core/src/compiler/module_executor/overwrite.rs @@ -1,6 +1,4 @@ -use tokio::sync::mpsc::UnboundedSender; - -use super::ctrl::Event; +use super::context::ExecutorTaskContext; use crate::{ compiler::make::repair::{ add::AddTask, factorize::FactorizeResultTask, process_dependencies::ProcessDependenciesTask, @@ -9,77 +7,91 @@ use crate::{ utils::task_loop::{Task, TaskResult, TaskType}, }; -#[derive(Debug)] -pub struct OverwriteTask { - pub origin_task: Box>, - pub event_sender: UnboundedSender, +/// Transform tasks with MakeTaskContext to tasks with ExecutorTaskContext. +pub fn overwrite_tasks( + tasks: Vec>>, +) -> Vec>> { + tasks + .into_iter() + .map(|task| Box::new(OverwriteTask(task)) as Box>) + .collect() } +/// A wrapped task to run MakeTaskContext task. +/// +/// This task will intercept the result of the inner task and trigger tracker.on_* +#[derive(Debug)] +pub struct OverwriteTask(Box>); + #[async_trait::async_trait] -impl Task for OverwriteTask { +impl Task for OverwriteTask { fn get_task_type(&self) -> TaskType { - self.origin_task.get_task_type() + self.0.get_task_type() } - async fn main_run(self: Box, context: &mut MakeTaskContext) -> TaskResult { - let Self { - origin_task, - event_sender, - } = *self; - // process dependencies - if let Some(process_dependencies_task) = origin_task - .as_any() - .downcast_ref::() - { - let original_module_identifier = process_dependencies_task.original_module_identifier; - let res = origin_task.main_run(context).await?; - event_sender - .send(Event::FinishModule(original_module_identifier, res.len())) - .expect("should success"); - return Ok(res); - } - + async fn main_run( + self: Box, + context: &mut ExecutorTaskContext, + ) -> TaskResult { + let origin_task = self.0; + let ExecutorTaskContext { + origin_context, + tracker, + .. + } = context; // factorize result task if let Some(factorize_result_task) = origin_task.as_any().downcast_ref::() { let dep_id = *factorize_result_task.dependencies[0].id(); let original_module_identifier = factorize_result_task.original_module_identifier; - let res = origin_task.main_run(context).await?; + let mut res = overwrite_tasks(origin_task.main_run(origin_context).await?); if res.is_empty() { - event_sender - .send(Event::FinishDeps(original_module_identifier, dep_id, None)) - .expect("should success"); + res.extend(tracker.on_factorize_failed(origin_context, original_module_identifier, dep_id)) } return Ok(res); } + // add task if let Some(add_task) = origin_task.as_any().downcast_ref::() { let dep_id = *add_task.dependencies[0].id(); let original_module_identifier = add_task.original_module_identifier; let target_module_identifier = add_task.module.identifier(); - let res = origin_task.main_run(context).await?; + let mut res = overwrite_tasks(origin_task.main_run(origin_context).await?); if res.is_empty() { - event_sender - .send(Event::FinishDeps( - original_module_identifier, - dep_id, - Some(target_module_identifier), - )) - .expect("should success"); + res.extend(tracker.on_add_resolved_module( + origin_context, + original_module_identifier, + dep_id, + target_module_identifier, + )); } else { - event_sender - .send(Event::StartBuild(target_module_identifier)) - .expect("should success"); + tracker.on_add(target_module_identifier); } return Ok(res); } + // process dependencies + if let Some(process_dependencies_task) = origin_task + .as_any() + .downcast_ref::() + { + let original_module_identifier = process_dependencies_task.original_module_identifier; + let mut res = overwrite_tasks(origin_task.main_run(origin_context).await?); + res.extend(tracker.on_process_dependencies( + origin_context, + original_module_identifier, + res.len(), + )); + return Ok(res); + } + // other task - origin_task.main_run(context).await + Ok(overwrite_tasks(origin_task.main_run(origin_context).await?)) } - async fn background_run(self: Box) -> TaskResult { - self.origin_task.background_run().await + async fn background_run(self: Box) -> TaskResult { + let origin_task = self.0; + Ok(overwrite_tasks(origin_task.background_run().await?)) } } diff --git a/crates/rspack_core/src/utils/task_loop.rs b/crates/rspack_core/src/utils/task_loop.rs index 1ad13a88c042..b2fb22b63cad 100644 --- a/crates/rspack_core/src/utils/task_loop.rs +++ b/crates/rspack_core/src/utils/task_loop.rs @@ -55,15 +55,6 @@ pub trait Task: Debug + Send + Any + AsAny { pub async fn run_task_loop( ctx: &mut Ctx, init_tasks: Vec>>, -) -> Result<()> { - run_task_loop_with_event(ctx, init_tasks, |_, task| task).await -} - -/// Run task loop with event -pub async fn run_task_loop_with_event( - ctx: &mut Ctx, - init_tasks: Vec>>, - before_task_run: impl Fn(&mut Ctx, Box>) -> Box>, ) -> Result<()> { // create channel to receive async task result let (tx, mut rx) = mpsc::unbounded_channel::>(); @@ -79,7 +70,6 @@ pub async fn run_task_loop_with_event( } if let Some(task) = task { - let task = before_task_run(ctx, task); match task.get_task_type() { TaskType::Async => { let tx = tx.clone(); diff --git a/crates/rspack_plugin_extract_css/src/plugin.rs b/crates/rspack_plugin_extract_css/src/plugin.rs index 4659eec1c34c..cccf94dc2762 100644 --- a/crates/rspack_plugin_extract_css/src/plugin.rs +++ b/crates/rspack_plugin_extract_css/src/plugin.rs @@ -10,17 +10,16 @@ use rspack_cacheable::cacheable; use rspack_collections::{DatabaseItem, IdentifierMap, IdentifierSet, UkeySet}; use rspack_core::{ get_undo_path, - make::{MakeArtifact, MakeParam}, rspack_sources::{ BoxSource, CachedSource, ConcatSource, RawStringSource, SourceExt, SourceMap, SourceMapSource, WithoutOriginalOptions, }, ApplyContext, AssetInfo, Chunk, ChunkGraph, ChunkGroupUkey, ChunkKind, ChunkUkey, Compilation, CompilationContentHash, CompilationParams, CompilationRenderManifest, - CompilationRuntimeRequirementInTree, CompilationUpdateModuleGraph, CompilerCompilation, - CompilerOptions, DependencyType, Filename, Module, ModuleGraph, ModuleIdentifier, ModuleType, - NormalModuleFactoryParser, ParserAndGenerator, ParserOptions, PathData, Plugin, PluginContext, - RenderManifestEntry, RuntimeGlobals, SourceType, + CompilationRuntimeRequirementInTree, CompilerCompilation, CompilerOptions, DependencyType, + Filename, Module, ModuleGraph, ModuleIdentifier, ModuleType, NormalModuleFactoryParser, + ParserAndGenerator, ParserOptions, PathData, Plugin, PluginContext, RenderManifestEntry, + RuntimeGlobals, SourceType, }; use rspack_error::{Diagnostic, Result}; use rspack_hash::RspackHash; @@ -702,36 +701,6 @@ async fn nmf_parser( Ok(()) } -#[plugin_hook(CompilationUpdateModuleGraph for PluginCssExtract)] -async fn update_module_graph( - &self, - params: &mut Vec, - make_artifact: &MakeArtifact, -) -> rspack_error::Result<()> { - let mg = make_artifact.get_module_graph(); - let mut css_modules = IdentifierSet::default(); - for param in params.iter() { - if let MakeParam::ForceBuildModules(module_identifiers) = ¶m { - css_modules.extend( - module_identifiers - .iter() - .flat_map(|m| mg.get_outgoing_connections(m)) - .filter_map(|c| { - let module_identifier = c.module_identifier(); - let module = mg.module_by_identifier(module_identifier)?; - if *module.module_type() == *MODULE_TYPE { - Some(*module_identifier) - } else { - None - } - }), - ); - } - } - params.push(MakeParam::ForceBuildModules(css_modules)); - Ok(()) -} - #[async_trait::async_trait] impl Plugin for PluginCssExtract { fn apply(&self, ctx: PluginContext<&mut ApplyContext>, _options: &CompilerOptions) -> Result<()> { @@ -762,12 +731,6 @@ impl Plugin for PluginCssExtract { .parser .tap(nmf_parser::new(self)); - ctx - .context - .compilation_hooks - .update_module_graph - .tap(update_module_graph::new(self)); - Ok(()) } } diff --git a/packages/rspack-test-tools/tests/configCases/css-extract/rebuild-module/test.filter.js b/packages/rspack-test-tools/tests/configCases/css-extract/rebuild-module/test.filter.js new file mode 100644 index 000000000000..55a36c5fed73 --- /dev/null +++ b/packages/rspack-test-tools/tests/configCases/css-extract/rebuild-module/test.filter.js @@ -0,0 +1,3 @@ +module.exports = () => { + return false; +}; diff --git a/packages/rspack-test-tools/tests/configCases/loader-import-module/cycle-dependency/index.js b/packages/rspack-test-tools/tests/configCases/loader-import-module/cycle-dependency/index.js new file mode 100644 index 000000000000..29b3fed8424a --- /dev/null +++ b/packages/rspack-test-tools/tests/configCases/loader-import-module/cycle-dependency/index.js @@ -0,0 +1,5 @@ +import lib from "./loader.js!./lib"; + +it("should cycle dependency works", () => { + expect(lib).toBe(2); +}); diff --git a/packages/rspack-test-tools/tests/configCases/loader-import-module/cycle-dependency/lib/add_one.js b/packages/rspack-test-tools/tests/configCases/loader-import-module/cycle-dependency/lib/add_one.js new file mode 100644 index 000000000000..4c53f886fb6f --- /dev/null +++ b/packages/rspack-test-tools/tests/configCases/loader-import-module/cycle-dependency/lib/add_one.js @@ -0,0 +1,5 @@ +import { add } from "./index"; + +export function add_one(a) { + return add(a, 1); +} diff --git a/packages/rspack-test-tools/tests/configCases/loader-import-module/cycle-dependency/lib/index.js b/packages/rspack-test-tools/tests/configCases/loader-import-module/cycle-dependency/lib/index.js new file mode 100644 index 000000000000..226f4dcf2642 --- /dev/null +++ b/packages/rspack-test-tools/tests/configCases/loader-import-module/cycle-dependency/lib/index.js @@ -0,0 +1,2 @@ +export { add_one } from "./add_one"; +export { add } from "./utils"; diff --git a/packages/rspack-test-tools/tests/configCases/loader-import-module/cycle-dependency/lib/utils.js b/packages/rspack-test-tools/tests/configCases/loader-import-module/cycle-dependency/lib/utils.js new file mode 100644 index 000000000000..b65331a6a444 --- /dev/null +++ b/packages/rspack-test-tools/tests/configCases/loader-import-module/cycle-dependency/lib/utils.js @@ -0,0 +1,3 @@ +export function add(a, b) { + return a + b; +} diff --git a/packages/rspack-test-tools/tests/configCases/loader-import-module/cycle-dependency/loader.js b/packages/rspack-test-tools/tests/configCases/loader-import-module/cycle-dependency/loader.js new file mode 100644 index 000000000000..8f6d65862b5e --- /dev/null +++ b/packages/rspack-test-tools/tests/configCases/loader-import-module/cycle-dependency/loader.js @@ -0,0 +1,6 @@ +const fs = require("fs"); + +module.exports = async function (code) { + const exports = await this.importModule(this.resourcePath, {}); + return `export default ${exports.add_one(1)}`; +}; diff --git a/packages/rspack-test-tools/tests/configCases/loader-import-module/cycle-dependency/rspack.config.js b/packages/rspack-test-tools/tests/configCases/loader-import-module/cycle-dependency/rspack.config.js new file mode 100644 index 000000000000..3e8a4bed64b0 --- /dev/null +++ b/packages/rspack-test-tools/tests/configCases/loader-import-module/cycle-dependency/rspack.config.js @@ -0,0 +1,7 @@ +/** @type {import("@rspack/core").Configuration} */ +module.exports = { + output: { + publicPath: "/public/" + }, + entry: "./index.js" +}; diff --git a/packages/rspack-test-tools/tests/diagnosticsCases/factorize/import-module/stats.err b/packages/rspack-test-tools/tests/diagnosticsCases/factorize/import-module/stats.err index d6a483c8a5be..e6b28e4d06bf 100644 --- a/packages/rspack-test-tools/tests/diagnosticsCases/factorize/import-module/stats.err +++ b/packages/rspack-test-tools/tests/diagnosticsCases/factorize/import-module/stats.err @@ -1 +1,3 @@ ERROR in × Module not found: Can't resolve './non-existent-module' in '/tests/diagnosticsCases/factorize/import-module' + +ERROR in × Module not found: Can't resolve './non-existent-module' in '/tests/diagnosticsCases/factorize/import-module' diff --git a/packages/rspack-test-tools/tests/hotCases/loader/import-module-1/__snapshots__/web/1.snap.txt b/packages/rspack-test-tools/tests/hotCases/loader/import-module-1/__snapshots__/web/1.snap.txt index c3242f500668..8cd74d76ef6c 100644 --- a/packages/rspack-test-tools/tests/hotCases/loader/import-module-1/__snapshots__/web/1.snap.txt +++ b/packages/rspack-test-tools/tests/hotCases/loader/import-module-1/__snapshots__/web/1.snap.txt @@ -2,6 +2,7 @@ ## Changed Files - a.js +- a.js ## Asset Files - Bundle: bundle.js diff --git a/packages/rspack/src/Compiler.ts b/packages/rspack/src/Compiler.ts index f936f0236be0..5d4be20b47d9 100644 --- a/packages/rspack/src/Compiler.ts +++ b/packages/rspack/src/Compiler.ts @@ -1015,8 +1015,10 @@ class Compiler { * Note: This is not a webpack public API, maybe removed in future. * @internal */ - __internal__getModuleExecutionResult(id: number) { - return this.#moduleExecutionResultsMap.get(id); + __internal__takeModuleExecutionResult(id: number) { + const result = this.#moduleExecutionResultsMap.get(id); + this.#moduleExecutionResultsMap.delete(id); + return result; } /** diff --git a/packages/rspack/src/loader-runner/index.ts b/packages/rspack/src/loader-runner/index.ts index fd5d0ba0de7f..ddf2452cdf64 100644 --- a/packages/rspack/src/loader-runner/index.ts +++ b/packages/rspack/src/loader-runner/index.ts @@ -372,11 +372,11 @@ export async function runLoaders( }); if (res.error) { onError( - compiler.__internal__getModuleExecutionResult(res.id) ?? - new Error(err) + compiler.__internal__takeModuleExecutionResult(res.id) ?? + new Error(res.error) ); } else { - onDone(compiler.__internal__getModuleExecutionResult(res.id)); + onDone(compiler.__internal__takeModuleExecutionResult(res.id)); } } }; diff --git a/tests/webpack-test/cases/errors/import-module-cycle-multiple/index.js b/tests/webpack-test/cases/errors/import-module-cycle-multiple/index.js index 054ea2e1af63..3b1dd9f1356e 100644 --- a/tests/webpack-test/cases/errors/import-module-cycle-multiple/index.js +++ b/tests/webpack-test/cases/errors/import-module-cycle-multiple/index.js @@ -1,31 +1,21 @@ it("should error importModule when a cycle with 2 modules is requested", () => { expect(require("./loader!./2/a")).toEqual([ - ["./b.json", [ - ["./a.json", "err: There is a circular build dependency, which makes it impossible to create this module"] - ]] + ["./b.json", [["./a.json", [["./b.json", "err"]]]]] ]); }); it("should error importModule when a cycle with 3 modules is requested", () => { expect(require("./loader!./3/a")).toEqual([ - ["./b.json", [ - ["./c.json", [ - ["./a.json", "err: There is a circular build dependency, which makes it impossible to create this module"] - ]] - ]] + ["./b.json", [["./c.json", [["./a.json", [["./b.json", "err"]]]]]]] ]); }); it("should error importModule when requesting itself", () => { expect(require("./loader!./1/a")).toEqual([ - ["./a.json", "err: There is a circular build dependency, which makes it impossible to create this module"] + ["./a.json", [["./a.json", "err"]]] ]); }); it("should not report a cycle when importModule is used twice", () => { expect(require("./loader!./4/a")).toEqual([ - ["./b.json", [ - ["./c.json", []] - ]], - ["./b.json", [ - ["./c.json", []] - ]] + ["./b.json", [["./c.json", []]]], + ["./b.json", [["./c.json", []]]] ]); }); diff --git a/tests/webpack-test/cases/errors/import-module-cycle-multiple/loader.js b/tests/webpack-test/cases/errors/import-module-cycle-multiple/loader.js index b3c01e2919f0..9a98b223d6db 100644 --- a/tests/webpack-test/cases/errors/import-module-cycle-multiple/loader.js +++ b/tests/webpack-test/cases/errors/import-module-cycle-multiple/loader.js @@ -5,19 +5,19 @@ exports.default = function (source) { const refs = Array.isArray(content) ? content : [content]; const callback = this.async(); const importReferencedModules = async () => { - const loadedRefs = [] - for(const ref of refs) { + const loadedRefs = []; + for (const ref of refs) { try { const source = await this.importModule("../loader!" + ref); loadedRefs.push([ref, source]); - } catch(err) { - loadedRefs.push([ref, `err: ${err && err.message}`]); + } catch (err) { + loadedRefs.push([ref, `err`]); } } return loadedRefs; - } + }; - importReferencedModules().then((loadResults) => { + importReferencedModules().then(loadResults => { callback(null, JSON.stringify(loadResults)); }); }; diff --git a/tests/webpack-test/cases/errors/import-module-cycle-multiple/test.filter.js b/tests/webpack-test/cases/errors/import-module-cycle-multiple/test.filter.js deleted file mode 100644 index 1e2be9e14a72..000000000000 --- a/tests/webpack-test/cases/errors/import-module-cycle-multiple/test.filter.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = () => "FIXME: dead loop of importModule"; diff --git a/tests/webpack-test/cases/errors/import-module-cycle/index.js b/tests/webpack-test/cases/errors/import-module-cycle/index.js index 3d5f92f00874..052921dc2ec6 100644 --- a/tests/webpack-test/cases/errors/import-module-cycle/index.js +++ b/tests/webpack-test/cases/errors/import-module-cycle/index.js @@ -1,15 +1,9 @@ it("should error importModule when a cycle with 2 modules is requested", () => { - expect(require("./loader!./2/a")).toMatch( - /^source: err: There is a circular build dependency/ - ); + expect(require("./loader!./2/a")).toMatch("circular build dependency"); }); it("should error importModule when a cycle with 3 modules is requested", () => { - expect(require("./loader!./3/a")).toMatch( - /^source: source: err: There is a circular build dependency/ - ); + expect(require("./loader!./3/a")).toMatch("circular build dependency"); }); it("should error importModule when requesting itself", () => { - expect(require("./loader!./1/a")).toMatch( - /^err: There is a circular build dependency/ - ); + expect(require("./loader!./1/a")).toMatch("circular build dependency"); }); diff --git a/tests/webpack-test/cases/errors/import-module-cycle/test.filter.js b/tests/webpack-test/cases/errors/import-module-cycle/test.filter.js deleted file mode 100644 index 1e2be9e14a72..000000000000 --- a/tests/webpack-test/cases/errors/import-module-cycle/test.filter.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = () => "FIXME: dead loop of importModule"; From 1473292c1e49cedf9765e6f3eaa13720555e8ef8 Mon Sep 17 00:00:00 2001 From: jinrui Date: Mon, 26 May 2025 15:47:38 +0800 Subject: [PATCH 43/50] refactor: rename TaskType::Sync to Main & TaskType::Async to background (#10473) --- .../src/compiler/make/repair/add.rs | 2 +- .../src/compiler/make/repair/build.rs | 4 ++-- .../src/compiler/make/repair/factorize.rs | 4 ++-- .../make/repair/process_dependencies.rs | 2 +- .../src/compiler/module_executor/ctrl.rs | 2 +- .../src/compiler/module_executor/entry.rs | 2 +- .../src/compiler/module_executor/execute.rs | 2 +- crates/rspack_core/src/utils/task_loop.rs | 20 +++++++++---------- 8 files changed, 19 insertions(+), 19 deletions(-) diff --git a/crates/rspack_core/src/compiler/make/repair/add.rs b/crates/rspack_core/src/compiler/make/repair/add.rs index aec2f34565ca..6e4675ddf699 100644 --- a/crates/rspack_core/src/compiler/make/repair/add.rs +++ b/crates/rspack_core/src/compiler/make/repair/add.rs @@ -19,7 +19,7 @@ pub struct AddTask { #[async_trait::async_trait] impl Task for AddTask { fn get_task_type(&self) -> TaskType { - TaskType::Sync + TaskType::Main } async fn main_run(self: Box, context: &mut MakeTaskContext) -> TaskResult { let module_identifier = self.module.identifier(); diff --git a/crates/rspack_core/src/compiler/make/repair/build.rs b/crates/rspack_core/src/compiler/make/repair/build.rs index e26cf0f98551..b41ccbb2d2f5 100644 --- a/crates/rspack_core/src/compiler/make/repair/build.rs +++ b/crates/rspack_core/src/compiler/make/repair/build.rs @@ -24,7 +24,7 @@ pub struct BuildTask { #[async_trait::async_trait] impl Task for BuildTask { fn get_task_type(&self) -> TaskType { - TaskType::Async + TaskType::Background } async fn background_run(self: Box) -> TaskResult { let Self { @@ -86,7 +86,7 @@ struct BuildResultTask { #[async_trait::async_trait] impl Task for BuildResultTask { fn get_task_type(&self) -> TaskType { - TaskType::Sync + TaskType::Main } async fn main_run(self: Box, context: &mut MakeTaskContext) -> TaskResult { let BuildResultTask { diff --git a/crates/rspack_core/src/compiler/make/repair/factorize.rs b/crates/rspack_core/src/compiler/make/repair/factorize.rs index c796870d4d1c..9cd92f609d76 100644 --- a/crates/rspack_core/src/compiler/make/repair/factorize.rs +++ b/crates/rspack_core/src/compiler/make/repair/factorize.rs @@ -32,7 +32,7 @@ pub struct FactorizeTask { #[async_trait::async_trait] impl Task for FactorizeTask { fn get_task_type(&self) -> TaskType { - TaskType::Async + TaskType::Background } async fn background_run(self: Box) -> TaskResult { if let Some(current_profile) = &self.current_profile { @@ -157,7 +157,7 @@ pub struct FactorizeResultTask { #[async_trait::async_trait] impl Task for FactorizeResultTask { fn get_task_type(&self) -> TaskType { - TaskType::Sync + TaskType::Main } async fn main_run(self: Box, context: &mut MakeTaskContext) -> TaskResult { let FactorizeResultTask { diff --git a/crates/rspack_core/src/compiler/make/repair/process_dependencies.rs b/crates/rspack_core/src/compiler/make/repair/process_dependencies.rs index 969a99b90ca4..5a298436961f 100644 --- a/crates/rspack_core/src/compiler/make/repair/process_dependencies.rs +++ b/crates/rspack_core/src/compiler/make/repair/process_dependencies.rs @@ -16,7 +16,7 @@ pub struct ProcessDependenciesTask { #[async_trait::async_trait] impl Task for ProcessDependenciesTask { fn get_task_type(&self) -> TaskType { - TaskType::Sync + TaskType::Main } async fn main_run(self: Box, context: &mut MakeTaskContext) -> TaskResult { diff --git a/crates/rspack_core/src/compiler/module_executor/ctrl.rs b/crates/rspack_core/src/compiler/module_executor/ctrl.rs index 37047aa7f1cd..e4da5ecdad11 100644 --- a/crates/rspack_core/src/compiler/module_executor/ctrl.rs +++ b/crates/rspack_core/src/compiler/module_executor/ctrl.rs @@ -21,7 +21,7 @@ pub struct CtrlTask { #[async_trait::async_trait] impl Task for CtrlTask { fn get_task_type(&self) -> TaskType { - TaskType::Async + TaskType::Background } async fn background_run(mut self: Box) -> TaskResult { diff --git a/crates/rspack_core/src/compiler/module_executor/entry.rs b/crates/rspack_core/src/compiler/module_executor/entry.rs index dcd2bdf53b84..2d3086fa0514 100644 --- a/crates/rspack_core/src/compiler/module_executor/entry.rs +++ b/crates/rspack_core/src/compiler/module_executor/entry.rs @@ -23,7 +23,7 @@ pub struct EntryTask { #[async_trait::async_trait] impl Task for EntryTask { fn get_task_type(&self) -> TaskType { - TaskType::Sync + TaskType::Main } async fn main_run( diff --git a/crates/rspack_core/src/compiler/module_executor/execute.rs b/crates/rspack_core/src/compiler/module_executor/execute.rs index f55c32f9dc27..e4f976f82f52 100644 --- a/crates/rspack_core/src/compiler/module_executor/execute.rs +++ b/crates/rspack_core/src/compiler/module_executor/execute.rs @@ -77,7 +77,7 @@ impl ExecuteTask { #[async_trait::async_trait] impl Task for ExecuteTask { fn get_task_type(&self) -> TaskType { - TaskType::Sync + TaskType::Main } async fn main_run( diff --git a/crates/rspack_core/src/utils/task_loop.rs b/crates/rspack_core/src/utils/task_loop.rs index b2fb22b63cad..accc4eb6d00d 100644 --- a/crates/rspack_core/src/utils/task_loop.rs +++ b/crates/rspack_core/src/utils/task_loop.rs @@ -23,10 +23,10 @@ pub type TaskResult = Result>>>; /// Task type pub enum TaskType { - /// Sync Task - Sync, - /// Async Task - Async, + /// Main Task + Main, + /// Background Task + Background, } /// Used for define tasks @@ -36,8 +36,8 @@ pub enum TaskType { pub trait Task: Debug + Send + Any + AsAny { /// Return the task type /// - /// Return `TaskType::Sync` will run `self::sync_run` - /// Return `TaskType::Async` will run `self::async_run` + /// Return `TaskType::Main` will run `self::main_run` + /// Return `TaskType::Background` will run `self::background_run` fn get_task_type(&self) -> TaskType; /// can be running in main thread @@ -71,7 +71,7 @@ pub async fn run_task_loop( if let Some(task) = task { match task.get_task_type() { - TaskType::Async => { + TaskType::Background => { let tx = tx.clone(); let is_expected_shutdown = is_expected_shutdown.clone(); active_task_count += 1; @@ -85,7 +85,7 @@ pub async fn run_task_loop( .in_current_span(), )); } - TaskType::Sync => { + TaskType::Main => { // merge sync task result directly match task.main_run(ctx).await { Ok(r) => queue.extend(r), @@ -144,7 +144,7 @@ mod test { #[async_trait::async_trait] impl Task for SyncTask { fn get_task_type(&self) -> TaskType { - TaskType::Sync + TaskType::Main } async fn main_run(self: Box, context: &mut Context) -> TaskResult { if context.sync_return_error { @@ -170,7 +170,7 @@ mod test { #[async_trait::async_trait] impl Task for AsyncTask { fn get_task_type(&self) -> TaskType { - TaskType::Async + TaskType::Background } async fn background_run(self: Box) -> TaskResult { tokio::time::sleep(std::time::Duration::from_millis(10)).await; From edabf27529e108f27a80f6639ee468c32c3337f8 Mon Sep 17 00:00:00 2001 From: harpsealjs Date: Mon, 26 May 2025 16:04:14 +0800 Subject: [PATCH 44/50] fix: check directory before reading when running clean options (#10472) * fix: check directory before reading * fix: check directory before reading * fix: check directory before reading --- crates/rspack_core/src/utils/fs_trim.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/crates/rspack_core/src/utils/fs_trim.rs b/crates/rspack_core/src/utils/fs_trim.rs index 6147ac103b45..fc095892c597 100644 --- a/crates/rspack_core/src/utils/fs_trim.rs +++ b/crates/rspack_core/src/utils/fs_trim.rs @@ -62,6 +62,19 @@ pub async fn trim_dir<'a>( dir: &'a Utf8Path, keep: KeepPattern<'a>, ) -> FsResult<()> { + if let Ok(metadata) = fs.stat(dir).await { + // not a directory, try to remove it + if !metadata.is_directory { + if !keep.try_match(dir).await? { + fs.remove_file(dir).await?; + } + return Ok(()); + } + } else { + // not exists, no need to trim + return Ok(()); + } + let mut queue = vec![dir.to_owned()]; let mut visited = vec![]; while let Some(current_dir) = queue.pop() { @@ -69,7 +82,6 @@ pub async fn trim_dir<'a>( visited.push(current_dir); continue; } - let items = fs.read_dir(¤t_dir).await?; for item in &items { let path = current_dir.join(item); From 3fa4a88892661961b8a674a3d1397b3680eb4a31 Mon Sep 17 00:00:00 2001 From: Hana Date: Mon, 26 May 2025 18:10:51 +0800 Subject: [PATCH 45/50] feat(napi): support returning custom error code (#10476) --- crates/node_binding/src/compilation/mod.rs | 50 ++++++++++++++-------- crates/node_binding/src/error.rs | 35 +++++++++++++-- crates/node_binding/src/lib.rs | 16 ++++--- crates/node_binding/src/utils.rs | 7 ++- 4 files changed, 79 insertions(+), 29 deletions(-) diff --git a/crates/node_binding/src/compilation/mod.rs b/crates/node_binding/src/compilation/mod.rs index 1c4d42e85e84..3ee4c25f3e3a 100644 --- a/crates/node_binding/src/compilation/mod.rs +++ b/crates/node_binding/src/compilation/mod.rs @@ -24,10 +24,10 @@ use rustc_hash::FxHashMap; use super::PathWithInfo; use crate::{ - entry::JsEntryOptions, utils::callbackify, AssetInfo, EntryDependency, JsAddingRuntimeModule, - JsAsset, JsChunk, JsChunkGraph, JsChunkGroupWrapper, JsChunkWrapper, JsCompatSource, JsFilename, - JsModuleGraph, JsPathData, JsRspackDiagnostic, JsRspackError, JsStats, - JsStatsOptimizationBailout, ModuleObject, RspackResultToNapiResultExt, ToJsCompatSource, + entry::JsEntryOptions, utils::callbackify, AssetInfo, EntryDependency, ErrorCode, + JsAddingRuntimeModule, JsAsset, JsChunk, JsChunkGraph, JsChunkGroupWrapper, JsChunkWrapper, + JsCompatSource, JsFilename, JsModuleGraph, JsPathData, JsRspackDiagnostic, JsRspackError, + JsStats, JsStatsOptimizationBailout, ModuleObject, RspackResultToNapiResultExt, ToJsCompatSource, COMPILER_REFERENCES, }; @@ -569,8 +569,10 @@ impl JsCompilation { reference: Reference, module_identifiers: Vec, f: Function<'static>, - ) -> Result<()> { - let compilation = self.as_mut()?; + ) -> Result<(), ErrorCode> { + let compilation = self + .as_mut() + .map_err(|err| napi::Error::new(err.status.into(), err.reason.clone()))?; callbackify( f, @@ -608,8 +610,10 @@ impl JsCompilation { original_module: String, original_module_context: Option, callback: Function<'static>, - ) -> Result<()> { - let compilation = self.as_ref()?; + ) -> Result<(), ErrorCode> { + let compilation = self + .as_ref() + .map_err(|err| napi::Error::new(err.status.into(), err.reason.clone()))?; callbackify( callback, @@ -705,19 +709,23 @@ impl JsCompilation { reference: Reference, js_args: Vec<(String, &mut EntryDependency, Option)>, f: Function<'static>, - ) -> napi::Result<()> { - let compilation = self.as_mut()?; + ) -> napi::Result<(), ErrorCode> { + let compilation = self + .as_mut() + .map_err(|err| napi::Error::new(err.status.into(), err.reason.clone()))?; let Some(mut compiler_reference) = COMPILER_REFERENCES.with(|ref_cell| { let references = ref_cell.borrow_mut(); references.get(&compilation.compiler_id()).cloned() }) else { - return Err(napi::Error::from_reason( + return Err(napi::Error::new( + napi::Status::GenericFailure.into(), "Unable to addEntry now. The Compiler has been garbage collected by JavaScript.", )); }; let Some(js_compiler) = compiler_reference.get_mut() else { - return Err(napi::Error::from_reason( + return Err(napi::Error::new( + napi::Status::GenericFailure.into(), "Unable to addEntry now. The Compiler has been garbage collected by JavaScript.", )); }; @@ -752,7 +760,8 @@ impl JsCompilation { }; Ok((dependency, options)) }) - .collect::>>()?; + .collect::>>() + .map_err(|err| napi::Error::new(err.status.into(), err.reason.clone()))?; callbackify( f, @@ -802,19 +811,23 @@ impl JsCompilation { reference: Reference, js_args: Vec<(String, &mut EntryDependency, Option)>, f: Function<'static>, - ) -> napi::Result<()> { - let compilation = self.as_mut()?; + ) -> napi::Result<(), ErrorCode> { + let compilation = self + .as_mut() + .map_err(|err| napi::Error::new(err.status.into(), err.reason.clone()))?; let Some(mut compiler_reference) = COMPILER_REFERENCES.with(|ref_cell| { let references = ref_cell.borrow_mut(); references.get(&compilation.compiler_id()).cloned() }) else { - return Err(napi::Error::from_reason( + return Err(napi::Error::new( + napi::Status::GenericFailure.into(), "Unable to addInclude now. The Compiler has been garbage collected by JavaScript.", )); }; let Some(js_compiler) = compiler_reference.get_mut() else { - return Err(napi::Error::from_reason( + return Err(napi::Error::new( + napi::Status::GenericFailure.into(), "Unable to addInclude now. The Compiler has been garbage collected by JavaScript.", )); }; @@ -849,7 +862,8 @@ impl JsCompilation { }; Ok((dependency, options)) }) - .collect::>>()?; + .collect::>>() + .map_err(|err| napi::Error::new(err.status.into(), err.reason.clone()))?; callbackify( f, diff --git a/crates/node_binding/src/error.rs b/crates/node_binding/src/error.rs index ba03819ca0b3..6970c86945eb 100644 --- a/crates/node_binding/src/error.rs +++ b/crates/node_binding/src/error.rs @@ -1,6 +1,26 @@ use napi_derive::napi; use rspack_error::{miette, Diagnostic, Result, RspackSeverity}; +pub enum ErrorCode { + Napi(napi::Status), + Custom(String), +} + +impl From for ErrorCode { + fn from(value: napi::Status) -> Self { + Self::Napi(value) + } +} + +impl AsRef for ErrorCode { + fn as_ref(&self) -> &str { + match self { + ErrorCode::Napi(status) => status.as_ref(), + ErrorCode::Custom(code) => code.as_str(), + } + } +} + #[napi(object)] pub struct JsRspackDiagnostic { pub severity: JsRspackSeverity, @@ -83,9 +103,9 @@ impl JsRspackError { } } -pub trait RspackResultToNapiResultExt { - fn to_napi_result(self) -> napi::Result; - fn to_napi_result_with_message(self, f: impl FnOnce(E) -> String) -> napi::Result; +pub trait RspackResultToNapiResultExt = napi::Status> { + fn to_napi_result(self) -> napi::Result; + fn to_napi_result_with_message(self, f: impl FnOnce(E) -> String) -> napi::Result; } impl RspackResultToNapiResultExt for Result { @@ -96,3 +116,12 @@ impl RspackResultToNapiResultExt for Result { self.map_err(|e| napi::Error::from_reason(f(e))) } } + +impl RspackResultToNapiResultExt for Result { + fn to_napi_result(self) -> napi::Result { + self.map_err(|e| napi::Error::new(napi::Status::GenericFailure.into(), e.to_string())) + } + fn to_napi_result_with_message(self, f: impl FnOnce(E) -> String) -> napi::Result { + self.map_err(|e| napi::Error::new(napi::Status::GenericFailure.into(), f(e))) + } +} diff --git a/crates/node_binding/src/lib.rs b/crates/node_binding/src/lib.rs index 96cab43705fe..c3e569768f1b 100644 --- a/crates/node_binding/src/lib.rs +++ b/crates/node_binding/src/lib.rs @@ -215,7 +215,11 @@ impl JsCompiler { /// Build with the given option passed to the constructor #[napi(ts_args_type = "callback: (err: null | Error) => void")] - pub fn build(&mut self, reference: Reference, f: Function<'static>) -> Result<()> { + pub fn build( + &mut self, + reference: Reference, + f: Function<'static>, + ) -> Result<(), ErrorCode> { unsafe { self.run(reference, |compiler, guard| { callbackify( @@ -243,7 +247,7 @@ impl JsCompiler { changed_files: Vec, removed_files: Vec, f: Function<'static>, - ) -> Result<()> { + ) -> Result<(), ErrorCode> { use std::collections::HashSet; unsafe { @@ -297,8 +301,8 @@ impl JsCompiler { unsafe fn run( &mut self, mut reference: Reference, - f: impl FnOnce(&'static mut Compiler, RunGuard) -> Result, - ) -> Result { + f: impl FnOnce(&'static mut Compiler, RunGuard) -> Result, + ) -> Result { if self.state.running() { return Err(concurrent_compiler_error()); } @@ -350,9 +354,9 @@ impl ObjectFinalize for JsCompiler { } } -fn concurrent_compiler_error() -> Error { +fn concurrent_compiler_error() -> Error { Error::new( - napi::Status::GenericFailure, + ErrorCode::Napi(Status::GenericFailure), "ConcurrentCompilationError: You ran rspack twice. Each instance only supports a single concurrent compilation at a time.", ) } diff --git a/crates/node_binding/src/utils.rs b/crates/node_binding/src/utils.rs index 89ff1913037b..cf70853a6d01 100644 --- a/crates/node_binding/src/utils.rs +++ b/crates/node_binding/src/utils.rs @@ -3,11 +3,13 @@ use rspack_napi::napi::{ bindgen_prelude::*, threadsafe_function::ThreadsafeFunctionCallMode, Result, }; +use crate::ErrorCode; + pub fn callbackify( f: Function<'static>, fut: F, call_js_back: impl FnOnce() + 'static, -) -> Result<()> +) -> Result<(), ErrorCode> where R: 'static + ToNapiValue, F: 'static + Send + Future>, @@ -26,7 +28,8 @@ where } Ok(ctx.value) }, - )?; + ) + .map_err(|err| napi::Error::new(ErrorCode::Napi(err.status), err.reason.clone()))?; napi::bindgen_prelude::spawn(async move { let res = fut.await; From a5098e5c54d18dea99ec27e58790a335228e7b2b Mon Sep 17 00:00:00 2001 From: CPunisher <1343316114@qq.com> Date: Mon, 26 May 2025 19:09:49 +0800 Subject: [PATCH 46/50] fix(wasm): never refer to handles of workers (#10478) * hack code * typo * format --- crates/node_binding/package.json | 3 +-- crates/node_binding/rspack.wasi.cjs | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/crates/node_binding/package.json b/crates/node_binding/package.json index 7cb1b01b691d..83419e54e219 100644 --- a/crates/node_binding/package.json +++ b/crates/node_binding/package.json @@ -47,8 +47,7 @@ "aarch64-unknown-linux-gnu", "aarch64-apple-darwin", "aarch64-unknown-linux-musl", - "aarch64-pc-windows-msvc", - "wasm32-wasip1-threads" + "aarch64-pc-windows-msvc" ], "wasm": { "initialMemory": 16384, diff --git a/crates/node_binding/rspack.wasi.cjs b/crates/node_binding/rspack.wasi.cjs index de1d4e0cc209..c06d6f7c52ac 100644 --- a/crates/node_binding/rspack.wasi.cjs +++ b/crates/node_binding/rspack.wasi.cjs @@ -65,6 +65,29 @@ const { instance: __napiInstance, module: __wasiModule, napiModule: __napiModule worker.onmessage = ({ data }) => { __wasmCreateOnMessageForFsProxy(__nodeFs)(data) } + + // The main thread of Node.js waits for all the active handles before exiting. + // But Rust threads are never waited without `thread::join`. + // So here we hack the code of Node.js to prevent the workers from being referenced (active). + // According to https://github.com/nodejs/node/blob/19e0d472728c79d418b74bddff588bea70a403d0/lib/internal/worker.js#L415, + // a worker is consist of two handles: kPublicPort and kHandle. + { + const kPublicPort = Object.getOwnPropertySymbols(worker).find(s => + s.toString().includes("kPublicPort") + ); + if (kPublicPort) { + worker[kPublicPort].ref = () => {}; + } + + const kHandle = Object.getOwnPropertySymbols(worker).find(s => + s.toString().includes("kHandle") + ); + if (kPublicPort) { + worker[kHandle].ref = () => {}; + } + + worker.unref(); + } return worker }, overwriteImports(importObject) { From 890ae6dfbe8f3f27496612fcfe5a779f0e029587 Mon Sep 17 00:00:00 2001 From: Wei Date: Mon, 26 May 2025 19:19:20 +0800 Subject: [PATCH 47/50] =?UTF-8?q?feat:=20initialize=C2=A0Rstest=20built-in?= =?UTF-8?q?=20plugin=20(#10452)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.lock | 15 +++ Cargo.toml | 1 + crates/node_binding/Cargo.toml | 1 + crates/node_binding/binding.d.ts | 5 + crates/node_binding/src/lib.rs | 2 + .../src/raw_options/raw_builtins/mod.rs | 12 ++- crates/node_binding/src/rstest.rs | 17 ++++ .../src/dependency/dependency_type.rs | 2 + crates/rspack_core/src/init_fragment.rs | 1 + .../src/visitors/dependency/parser/mod.rs | 2 +- crates/rspack_plugin_rstest/Cargo.toml | 21 ++++ crates/rspack_plugin_rstest/LICENSE | 22 +++++ crates/rspack_plugin_rstest/README.md | 11 +++ crates/rspack_plugin_rstest/src/lib.rs | 6 ++ .../src/module_path_name_dependency.rs | 97 +++++++++++++++++++ .../rspack_plugin_rstest/src/parser_plugin.rs | 39 ++++++++ crates/rspack_plugin_rstest/src/plugin.rs | 97 +++++++++++++++++++ .../tests/configCases/plugins/rstest/index.js | 19 ++++ .../plugins/rstest/rspack.config.js | 50 ++++++++++ .../configCases/plugins/rstest/src/bar.js | 1 + .../configCases/plugins/rstest/src/baz.js | 2 + .../configCases/plugins/rstest/src/foo.js | 3 + .../configCases/plugins/rstest/src/index.js | 12 +++ .../configCases/plugins/rstest/test.config.js | 7 ++ packages/rspack/etc/core.api.md | 13 +++ .../scripts/check-documentation-coverage.ts | 3 +- .../rspack/src/builtin-plugin/RstestPlugin.ts | 18 ++++ packages/rspack/src/builtin-plugin/index.ts | 1 + packages/rspack/src/exports.ts | 1 + 29 files changed, 477 insertions(+), 4 deletions(-) create mode 100644 crates/node_binding/src/rstest.rs create mode 100644 crates/rspack_plugin_rstest/Cargo.toml create mode 100644 crates/rspack_plugin_rstest/LICENSE create mode 100644 crates/rspack_plugin_rstest/README.md create mode 100644 crates/rspack_plugin_rstest/src/lib.rs create mode 100644 crates/rspack_plugin_rstest/src/module_path_name_dependency.rs create mode 100644 crates/rspack_plugin_rstest/src/parser_plugin.rs create mode 100644 crates/rspack_plugin_rstest/src/plugin.rs create mode 100644 packages/rspack-test-tools/tests/configCases/plugins/rstest/index.js create mode 100644 packages/rspack-test-tools/tests/configCases/plugins/rstest/rspack.config.js create mode 100644 packages/rspack-test-tools/tests/configCases/plugins/rstest/src/bar.js create mode 100644 packages/rspack-test-tools/tests/configCases/plugins/rstest/src/baz.js create mode 100644 packages/rspack-test-tools/tests/configCases/plugins/rstest/src/foo.js create mode 100644 packages/rspack-test-tools/tests/configCases/plugins/rstest/src/index.js create mode 100644 packages/rspack-test-tools/tests/configCases/plugins/rstest/test.config.js create mode 100644 packages/rspack/src/builtin-plugin/RstestPlugin.ts diff --git a/Cargo.lock b/Cargo.lock index 3625d2b089cb..7a1ca5abcba8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4536,6 +4536,7 @@ dependencies = [ "rspack_plugin_remove_duplicate_modules", "rspack_plugin_remove_empty_chunks", "rspack_plugin_rsdoctor", + "rspack_plugin_rstest", "rspack_plugin_runtime", "rspack_plugin_runtime_chunk", "rspack_plugin_schemes", @@ -5139,6 +5140,20 @@ dependencies = [ "tracing", ] +[[package]] +name = "rspack_plugin_rstest" +version = "0.2.0" +dependencies = [ + "async-trait", + "rspack_cacheable", + "rspack_core", + "rspack_error", + "rspack_hook", + "rspack_plugin_javascript", + "swc_core", + "tracing", +] + [[package]] name = "rspack_plugin_runtime" version = "0.2.0" diff --git a/Cargo.toml b/Cargo.toml index 50b98ac749db..a55fb30d9a68 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -178,6 +178,7 @@ rspack_plugin_real_content_hash = { version = "0.2.0", path = "crates/rsp rspack_plugin_remove_duplicate_modules = { version = "0.2.0", path = "crates/rspack_plugin_remove_duplicate_modules" } rspack_plugin_remove_empty_chunks = { version = "0.2.0", path = "crates/rspack_plugin_remove_empty_chunks" } rspack_plugin_rsdoctor = { version = "0.2.0", path = "crates/rspack_plugin_rsdoctor" } +rspack_plugin_rstest = { version = "0.2.0", path = "crates/rspack_plugin_rstest" } rspack_plugin_runtime = { version = "0.2.0", path = "crates/rspack_plugin_runtime" } rspack_plugin_runtime_chunk = { version = "0.2.0", path = "crates/rspack_plugin_runtime_chunk" } rspack_plugin_schemes = { version = "0.2.0", path = "crates/rspack_plugin_schemes" } diff --git a/crates/node_binding/Cargo.toml b/crates/node_binding/Cargo.toml index 4955dbf121e4..48cf547c7d55 100644 --- a/crates/node_binding/Cargo.toml +++ b/crates/node_binding/Cargo.toml @@ -28,6 +28,7 @@ rspack_paths = { workspace = true } rspack_plugin_html = { workspace = true } rspack_plugin_javascript = { workspace = true } rspack_plugin_rsdoctor = { workspace = true } +rspack_plugin_rstest = { workspace = true } rspack_plugin_runtime = { workspace = true } rspack_util = { workspace = true } diff --git a/crates/node_binding/binding.d.ts b/crates/node_binding/binding.d.ts index d6598b803cb2..9ec8c7ca4ede 100644 --- a/crates/node_binding/binding.d.ts +++ b/crates/node_binding/binding.d.ts @@ -493,6 +493,7 @@ export declare enum BuiltinPluginName { CssExtractRspackPlugin = 'CssExtractRspackPlugin', SubresourceIntegrityPlugin = 'SubresourceIntegrityPlugin', RsdoctorPlugin = 'RsdoctorPlugin', + RstestPlugin = 'RstestPlugin', CircularDependencyRspackPlugin = 'CircularDependencyRspackPlugin', JsLoaderRspackPlugin = 'JsLoaderRspackPlugin', LazyCompilationPlugin = 'LazyCompilationPlugin', @@ -2431,6 +2432,10 @@ export interface RawRspackFuture { } +export interface RawRstestPluginOptions { + injectModulePathName: boolean +} + export interface RawRuleSetCondition { type: RawRuleSetConditionType string?: string diff --git a/crates/node_binding/src/lib.rs b/crates/node_binding/src/lib.rs index c3e569768f1b..986067f6c894 100644 --- a/crates/node_binding/src/lib.rs +++ b/crates/node_binding/src/lib.rs @@ -55,6 +55,7 @@ mod resolver; mod resolver_factory; mod resource_data; mod rsdoctor; +mod rstest; mod runtime; mod source; mod stats; @@ -95,6 +96,7 @@ pub use resource_data::*; pub use rsdoctor::*; use rspack_macros::rspack_version; use rspack_tracing::{ChromeTracer, StdoutTracer, Tracer}; +pub use rstest::*; pub use runtime::*; use rustc_hash::FxHashMap; pub use source::*; diff --git a/crates/node_binding/src/raw_options/raw_builtins/mod.rs b/crates/node_binding/src/raw_options/raw_builtins/mod.rs index f001c55621a1..852fc6c8f20e 100644 --- a/crates/node_binding/src/raw_options/raw_builtins/mod.rs +++ b/crates/node_binding/src/raw_options/raw_builtins/mod.rs @@ -78,6 +78,7 @@ use rspack_plugin_real_content_hash::RealContentHashPlugin; use rspack_plugin_remove_duplicate_modules::RemoveDuplicateModulesPlugin; use rspack_plugin_remove_empty_chunks::RemoveEmptyChunksPlugin; use rspack_plugin_rsdoctor::RsdoctorPlugin; +use rspack_plugin_rstest::RstestPlugin; use rspack_plugin_runtime::{ enable_chunk_loading_plugin, ArrayPushCallbackChunkFormatPlugin, BundlerInfoPlugin, ChunkPrefetchPreloadPlugin, CommonJsChunkFormatPlugin, ModuleChunkFormatPlugin, RuntimePlugin, @@ -119,8 +120,8 @@ use crate::{ entry::JsEntryPluginOptions, plugins::JsLoaderRspackPlugin, JsLoaderRunnerGetter, RawContextReplacementPluginOptions, RawDynamicEntryPluginOptions, RawEvalDevToolModulePluginOptions, RawExternalItemWrapper, RawExternalsPluginOptions, - RawHttpExternalsRspackPluginOptions, RawRsdoctorPluginOptions, RawSplitChunksOptions, - SourceMapDevToolPluginOptions, + RawHttpExternalsRspackPluginOptions, RawRsdoctorPluginOptions, RawRstestPluginOptions, + RawSplitChunksOptions, SourceMapDevToolPluginOptions, }; #[napi(string_enum)] @@ -207,6 +208,7 @@ pub enum BuiltinPluginName { CssExtractRspackPlugin, SubresourceIntegrityPlugin, RsdoctorPlugin, + RstestPlugin, CircularDependencyRspackPlugin, // rspack js adapter plugins @@ -705,6 +707,12 @@ impl<'a> BuiltinPlugin<'a> { let options = raw_options.into(); plugins.push(RsdoctorPlugin::new(options).boxed()); } + BuiltinPluginName::RstestPlugin => { + let raw_options = downcast_into::(self.options) + .map_err(|report| napi::Error::from_reason(report.to_string()))?; + let options = raw_options.into(); + plugins.push(RstestPlugin::new(options).boxed()); + } BuiltinPluginName::SubresourceIntegrityPlugin => { let raw_options = downcast_into::(self.options) .map_err(|report| napi::Error::from_reason(report.to_string()))?; diff --git a/crates/node_binding/src/rstest.rs b/crates/node_binding/src/rstest.rs new file mode 100644 index 000000000000..680f36cb8c23 --- /dev/null +++ b/crates/node_binding/src/rstest.rs @@ -0,0 +1,17 @@ +use derive_more::Debug; +use rspack_plugin_rstest::RstestPluginOptions; + +#[derive(Debug)] +#[napi(object, object_to_js = false)] +pub struct RawRstestPluginOptions { + // Inject __dirname and __filename to each module. + pub inject_module_path_name: bool, +} + +impl From for RstestPluginOptions { + fn from(value: RawRstestPluginOptions) -> Self { + Self { + module_path_name: value.inject_module_path_name, + } + } +} diff --git a/crates/rspack_core/src/dependency/dependency_type.rs b/crates/rspack_core/src/dependency/dependency_type.rs index 6127c0a5efc3..e46e8b3b1a0d 100644 --- a/crates/rspack_core/src/dependency/dependency_type.rs +++ b/crates/rspack_core/src/dependency/dependency_type.rs @@ -117,6 +117,7 @@ pub enum DependencyType { DllEntry, DelegatedSource, ExtractCSS, + Rstest, } impl DependencyType { @@ -190,6 +191,7 @@ impl DependencyType { DependencyType::ModuleDecorator => "module decorator", DependencyType::DelegatedSource => "delegated source", DependencyType::ExtractCSS => "extract css", + DependencyType::Rstest => "rstest", } } } diff --git a/crates/rspack_core/src/init_fragment.rs b/crates/rspack_core/src/init_fragment.rs index c186d9394ad8..b6337017f107 100644 --- a/crates/rspack_core/src/init_fragment.rs +++ b/crates/rspack_core/src/init_fragment.rs @@ -40,6 +40,7 @@ pub enum InitFragmentKey { ModuleDecorator(String /* module_id */), ESMFakeNamespaceObjectFragment(String), Const(String), + // ModuleName(String), } impl InitFragmentKey { diff --git a/crates/rspack_plugin_javascript/src/visitors/dependency/parser/mod.rs b/crates/rspack_plugin_javascript/src/visitors/dependency/parser/mod.rs index 961dcc7743bf..b90005d63c8c 100644 --- a/crates/rspack_plugin_javascript/src/visitors/dependency/parser/mod.rs +++ b/crates/rspack_plugin_javascript/src/visitors/dependency/parser/mod.rs @@ -219,7 +219,7 @@ pub struct JavascriptParser<'parser> { pub(crate) errors: Vec>, pub(crate) warning_diagnostics: Vec>, pub dependencies: Vec, - pub(crate) presentational_dependencies: Vec, + pub presentational_dependencies: Vec, // Vec> makes sense if T is a large type (see #3530, 1st comment). // #3530: https://github.com/rust-lang/rust-clippy/issues/3530 #[allow(clippy::vec_box)] diff --git a/crates/rspack_plugin_rstest/Cargo.toml b/crates/rspack_plugin_rstest/Cargo.toml new file mode 100644 index 000000000000..ce5fa10448cb --- /dev/null +++ b/crates/rspack_plugin_rstest/Cargo.toml @@ -0,0 +1,21 @@ +[package] +description = "Rstest native plugin" +edition = "2021" +license = "MIT" +name = "rspack_plugin_rstest" +repository = "https://github.com/web-infra-dev/rspack" +version = "0.2.0" +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +async-trait = { workspace = true } +rspack_cacheable = { workspace = true } +rspack_core = { workspace = true } +rspack_error = { workspace = true } +rspack_hook = { workspace = true } +rspack_plugin_javascript = { workspace = true } +swc_core = { workspace = true } +tracing = { workspace = true } + +[package.metadata.cargo-shear] +ignored = ["tracing"] diff --git a/crates/rspack_plugin_rstest/LICENSE b/crates/rspack_plugin_rstest/LICENSE new file mode 100644 index 000000000000..46310101ad8a --- /dev/null +++ b/crates/rspack_plugin_rstest/LICENSE @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2022-present Bytedance, Inc. and its affiliates. + + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/crates/rspack_plugin_rstest/README.md b/crates/rspack_plugin_rstest/README.md new file mode 100644 index 000000000000..6f86a31b97f9 --- /dev/null +++ b/crates/rspack_plugin_rstest/README.md @@ -0,0 +1,11 @@ +# Rstest native plugin + +Rstest native plugin of Rspack. + +## Functionality + +- [x] Inject `__dirname` and `__filename` in module. +- [ ] Rewriting static import. +- [ ] Hoisting mock function. +- [ ] Module mocking runtime. +- [ ] Mocking methods. \ No newline at end of file diff --git a/crates/rspack_plugin_rstest/src/lib.rs b/crates/rspack_plugin_rstest/src/lib.rs new file mode 100644 index 000000000000..70896438c06f --- /dev/null +++ b/crates/rspack_plugin_rstest/src/lib.rs @@ -0,0 +1,6 @@ +#![feature(let_chains)] +mod module_path_name_dependency; +mod parser_plugin; +mod plugin; + +pub use plugin::*; diff --git a/crates/rspack_plugin_rstest/src/module_path_name_dependency.rs b/crates/rspack_plugin_rstest/src/module_path_name_dependency.rs new file mode 100644 index 000000000000..e966ad8b4b65 --- /dev/null +++ b/crates/rspack_plugin_rstest/src/module_path_name_dependency.rs @@ -0,0 +1,97 @@ +use rspack_cacheable::{cacheable, cacheable_dyn}; +use rspack_core::{ + AsContextDependency, AsModuleDependency, DependencyCodeGeneration, DependencyTemplate, + DependencyTemplateType, DependencyType, InitFragmentExt, InitFragmentKey, InitFragmentStage, + Module, NormalInitFragment, TemplateContext, TemplateReplaceSource, +}; + +#[cacheable] +#[derive(Debug, Clone, PartialEq)] +pub enum NameType { + DirName, + FileName, +} + +#[cacheable] +#[derive(Debug, Clone)] +pub struct ModulePathNameDependency { + r#type: NameType, +} + +impl ModulePathNameDependency { + pub fn new(r#type: NameType) -> Self { + Self { r#type } + } +} + +#[cacheable_dyn] +impl DependencyCodeGeneration for ModulePathNameDependency { + fn dependency_template(&self) -> Option { + Some(ModulePathNameDependencyTemplate::template_type()) + } +} + +impl AsModuleDependency for ModulePathNameDependency {} +impl AsContextDependency for ModulePathNameDependency {} + +#[cacheable] +#[derive(Debug, Clone, Default)] +pub struct ModulePathNameDependencyTemplate; + +impl ModulePathNameDependencyTemplate { + pub fn template_type() -> DependencyTemplateType { + DependencyTemplateType::Dependency(DependencyType::Rstest) + } +} + +impl DependencyTemplate for ModulePathNameDependencyTemplate { + fn render( + &self, + dep: &dyn DependencyCodeGeneration, + _source: &mut TemplateReplaceSource, + code_generatable_context: &mut TemplateContext, + ) { + let TemplateContext { + module, + init_fragments, + .. + } = code_generatable_context; + + let m = module.as_normal_module(); + if let Some(m) = m { + let resource_path = &m.resource_resolved_data().resource_path; + let context = &m.get_context(); + + let dep = dep + .as_any() + .downcast_ref::() + .expect("ModulePathNameDependencyTemplate can only be applied to ModulePathNameDependency"); + + if dep.r#type == NameType::FileName { + if let Some(resource_path) = resource_path { + let init = NormalInitFragment::new( + format!("const __filename = '{}';\n", resource_path), + InitFragmentStage::StageConstants, + 0, + InitFragmentKey::Const(format!("retest __filename {}", m.id())), + None, + ); + + init_fragments.push(init.boxed()); + } + } else if dep.r#type == NameType::DirName { + if let Some(context) = context { + let init = NormalInitFragment::new( + format!("const __dirname = '{}';\n", context), + InitFragmentStage::StageConstants, + 0, + InitFragmentKey::Const(format!("retest __dirname {}", m.id())), + None, + ); + + init_fragments.push(init.boxed()); + } + } + } + } +} diff --git a/crates/rspack_plugin_rstest/src/parser_plugin.rs b/crates/rspack_plugin_rstest/src/parser_plugin.rs new file mode 100644 index 000000000000..9fbdabe1c590 --- /dev/null +++ b/crates/rspack_plugin_rstest/src/parser_plugin.rs @@ -0,0 +1,39 @@ +use rspack_plugin_javascript::JavascriptParserPlugin; + +use crate::module_path_name_dependency::{ModulePathNameDependency, NameType}; + +const DIR_NAME: &str = "__dirname"; +const FILE_NAME: &str = "__filename"; + +#[derive(Debug, Default)] +pub struct RstestParserPlugin; + +impl JavascriptParserPlugin for RstestParserPlugin { + fn identifier( + &self, + parser: &mut rspack_plugin_javascript::visitors::JavascriptParser, + ident: &swc_core::ecma::ast::Ident, + _for_name: &str, + ) -> Option { + let str = ident.sym.as_str(); + if !parser.is_unresolved_ident(str) { + return None; + } + + match str { + DIR_NAME => { + parser + .presentational_dependencies + .push(Box::new(ModulePathNameDependency::new(NameType::DirName))); + Some(true) + } + FILE_NAME => { + parser + .presentational_dependencies + .push(Box::new(ModulePathNameDependency::new(NameType::FileName))); + Some(true) + } + _ => None, + } + } +} diff --git a/crates/rspack_plugin_rstest/src/plugin.rs b/crates/rspack_plugin_rstest/src/plugin.rs new file mode 100644 index 000000000000..b045ff5dbfce --- /dev/null +++ b/crates/rspack_plugin_rstest/src/plugin.rs @@ -0,0 +1,97 @@ +use std::{ + sync::Arc, + time::{Duration, Instant}, +}; + +use async_trait::async_trait; +use rspack_core::{ + ApplyContext, Compilation, CompilationParams, CompilerCompilation, CompilerOptions, ModuleType, + NormalModuleFactoryParser, ParserAndGenerator, ParserOptions, Plugin, PluginContext, +}; +use rspack_error::Result; +use rspack_hook::{plugin, plugin_hook}; +use rspack_plugin_javascript::{ + parser_and_generator::JavaScriptParserAndGenerator, BoxJavascriptParserPlugin, +}; + +use crate::{ + module_path_name_dependency::ModulePathNameDependencyTemplate, parser_plugin::RstestParserPlugin, +}; + +#[derive(Debug)] +pub struct RstestPluginOptions { + pub module_path_name: bool, +} + +#[derive(Debug)] +pub struct ProgressPluginStateInfo { + pub value: String, + pub time: Instant, + pub duration: Option, +} + +#[plugin] +#[derive(Debug)] +pub struct RstestPlugin { + options: RstestPluginOptions, +} + +impl RstestPlugin { + pub fn new(options: RstestPluginOptions) -> Self { + Self::new_inner(options) + } +} + +#[plugin_hook(NormalModuleFactoryParser for RstestPlugin)] +async fn nmf_parser( + &self, + module_type: &ModuleType, + parser: &mut dyn ParserAndGenerator, + _parser_options: Option<&ParserOptions>, +) -> Result<()> { + if module_type.is_js_like() + && let Some(parser) = parser.downcast_mut::() + { + parser.add_parser_plugin(Box::::default() as BoxJavascriptParserPlugin); + } + + Ok(()) +} + +#[plugin_hook(CompilerCompilation for RstestPlugin)] +async fn compilation( + &self, + compilation: &mut Compilation, + _params: &mut CompilationParams, +) -> Result<()> { + compilation.set_dependency_template( + ModulePathNameDependencyTemplate::template_type(), + Arc::new(ModulePathNameDependencyTemplate::default()), + ); + Ok(()) +} + +#[async_trait] +impl Plugin for RstestPlugin { + fn name(&self) -> &'static str { + "rstest" + } + + fn apply(&self, ctx: PluginContext<&mut ApplyContext>, _options: &CompilerOptions) -> Result<()> { + if self.options.module_path_name { + ctx + .context + .compiler_hooks + .compilation + .tap(compilation::new(self)); + + ctx + .context + .normal_module_factory_hooks + .parser + .tap(nmf_parser::new(self)); + } + + Ok(()) + } +} diff --git a/packages/rspack-test-tools/tests/configCases/plugins/rstest/index.js b/packages/rspack-test-tools/tests/configCases/plugins/rstest/index.js new file mode 100644 index 000000000000..743e8754f823 --- /dev/null +++ b/packages/rspack-test-tools/tests/configCases/plugins/rstest/index.js @@ -0,0 +1,19 @@ +const fs = require('fs'); +const path = require('path'); + +it("Insert module path names with concatenateModules", () => { + const sourceDir = path.resolve(__dirname, "../../../../"); + const content = fs.readFileSync(path.resolve(__dirname, "modulePathName.js"), "utf-8"); + expect(content).toContain(`const foo_filename = '${path.resolve(sourceDir, "./configCases/plugins/rstest/src/foo.js")}'`); + expect(content).toMatch(`const bar_dirname = '${path.resolve(sourceDir, "./configCases/plugins/rstest/src")}'`); +}); + +it("Insert module path names without concatenateModules", () => { + const sourceDir = path.resolve(__dirname, "../../../../"); + const content = fs.readFileSync(path.resolve(__dirname, "modulePathNameWithoutConcatenate.js"), "utf-8"); + expect(content).toContain(`const __filename = '${path.resolve(sourceDir, "./configCases/plugins/rstest/src/foo.js")}'`); + expect(content).toMatch(`const __dirname = '${path.resolve(sourceDir, "./configCases/plugins/rstest/src")}'`); + + expect(content.match(/const __dirname = /g).length).toBe(2); + expect(content.match(/const __filename = /g).length).toBe(2); +}); diff --git a/packages/rspack-test-tools/tests/configCases/plugins/rstest/rspack.config.js b/packages/rspack-test-tools/tests/configCases/plugins/rstest/rspack.config.js new file mode 100644 index 000000000000..82e3451a5d19 --- /dev/null +++ b/packages/rspack-test-tools/tests/configCases/plugins/rstest/rspack.config.js @@ -0,0 +1,50 @@ +const { RstestPlugin } = require("@rspack/core"); + +module.exports = [ + { + entry: "./src/index.js", + target: "node", + node: { + __filename: false, + __dirname: false + }, + output: { + filename: "modulePathName.js" + }, + plugins: [ + new RstestPlugin({ + injectModulePathName: true + }) + ] + }, + { + entry: "./src/index.js", + target: "node", + node: { + __filename: false, + __dirname: false + }, + output: { + filename: "modulePathNameWithoutConcatenate.js" + }, + plugins: [ + new RstestPlugin({ + injectModulePathName: true + }) + ], + optimization: { + concatenateModules: false + } + }, + { + entry: { + main: "./index.js" + }, + output: { + filename: "[name].js" + }, + externalsPresets: { + node: true + } + } +]; diff --git a/packages/rspack-test-tools/tests/configCases/plugins/rstest/src/bar.js b/packages/rspack-test-tools/tests/configCases/plugins/rstest/src/bar.js new file mode 100644 index 000000000000..3b427937752c --- /dev/null +++ b/packages/rspack-test-tools/tests/configCases/plugins/rstest/src/bar.js @@ -0,0 +1 @@ +export const barValue = 'bar: ' + __dirname diff --git a/packages/rspack-test-tools/tests/configCases/plugins/rstest/src/baz.js b/packages/rspack-test-tools/tests/configCases/plugins/rstest/src/baz.js new file mode 100644 index 000000000000..a4a2a675a085 --- /dev/null +++ b/packages/rspack-test-tools/tests/configCases/plugins/rstest/src/baz.js @@ -0,0 +1,2 @@ +export const bazValue1 = 'baz: ' + __filename +export const bazValue2 = 'baz: ' + __dirname diff --git a/packages/rspack-test-tools/tests/configCases/plugins/rstest/src/foo.js b/packages/rspack-test-tools/tests/configCases/plugins/rstest/src/foo.js new file mode 100644 index 000000000000..17dba0163b2c --- /dev/null +++ b/packages/rspack-test-tools/tests/configCases/plugins/rstest/src/foo.js @@ -0,0 +1,3 @@ +export const fooValue1 = 'foo: ' + __filename +export const fooValue2 = 'foo: ' + __filename +export const fooValue3 = 'foo: ' + __filename diff --git a/packages/rspack-test-tools/tests/configCases/plugins/rstest/src/index.js b/packages/rspack-test-tools/tests/configCases/plugins/rstest/src/index.js new file mode 100644 index 000000000000..55b8bb25b7c7 --- /dev/null +++ b/packages/rspack-test-tools/tests/configCases/plugins/rstest/src/index.js @@ -0,0 +1,12 @@ +import { fooValue1, fooValue2, fooValue3 } from './foo' +import { barValue } from './bar' +import { bazValue1, bazValue2 } from './baz' + +console.log( + fooValue1, + fooValue2, + fooValue3, + barValue, + bazValue1, + bazValue2 +) diff --git a/packages/rspack-test-tools/tests/configCases/plugins/rstest/test.config.js b/packages/rspack-test-tools/tests/configCases/plugins/rstest/test.config.js new file mode 100644 index 000000000000..964d44756a72 --- /dev/null +++ b/packages/rspack-test-tools/tests/configCases/plugins/rstest/test.config.js @@ -0,0 +1,7 @@ +/** @type {import("../../../..").TConfigCaseConfig} */ +module.exports = { + findBundle: function (i) { + if (i === 0) return ["main.js"]; + return ["main.js"]; + } +}; diff --git a/packages/rspack/etc/core.api.md b/packages/rspack/etc/core.api.md index f1a1a895a7c9..e80878527efe 100644 --- a/packages/rspack/etc/core.api.md +++ b/packages/rspack/etc/core.api.md @@ -73,6 +73,7 @@ import { RawIgnorePluginOptions } from '@rspack/binding'; import { RawOptions } from '@rspack/binding'; import { RawProgressPluginOptions } from '@rspack/binding'; import { RawProvideOptions } from '@rspack/binding'; +import { RawRstestPluginOptions } from '@rspack/binding'; import { RawRuntimeChunkOptions } from '@rspack/binding'; import { RawSubresourceIntegrityPluginOptions } from '@rspack/binding'; import { readFileSync } from 'fs'; @@ -6295,6 +6296,7 @@ declare namespace rspackExports { ProvidePlugin, DefinePlugin, ProgressPlugin, + RstestPlugin, EntryPlugin, DynamicEntryPlugin, ExternalsPlugin, @@ -6717,6 +6719,17 @@ export type RspackSeverity = binding.JsRspackSeverity; // @public (undocumented) export const rspackVersion: string; +// @public (undocumented) +export const RstestPlugin: { + new (rstest: RawRstestPluginOptions): { + name: BuiltinPluginName; + _args: [rstest: RawRstestPluginOptions]; + affectedHooks: "done" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "compilation" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | "additionalPass" | undefined; + raw(compiler: Compiler_2): BuiltinPlugin; + apply(compiler: Compiler_2): void; + }; +}; + // @public (undocumented) type Rule = string | RegExp; diff --git a/packages/rspack/scripts/check-documentation-coverage.ts b/packages/rspack/scripts/check-documentation-coverage.ts index b5e07c19641a..ecf5c6f23cd3 100644 --- a/packages/rspack/scripts/check-documentation-coverage.ts +++ b/packages/rspack/scripts/check-documentation-coverage.ts @@ -112,7 +112,8 @@ function checkPluginsDocumentationCoverage() { "OriginEntryPlugin", "RuntimePlugin", // This plugin only provides hooks, should not be used separately "RsdoctorPlugin", // This plugin is not stable yet - "CssChunkingPlugin" // This plugin is not stable yet + "CssChunkingPlugin", // This plugin is not stable yet + "RstestPlugin" // This plugin is not stable yet ]; const undocumentedPlugins = Array.from(implementedPlugins).filter( diff --git a/packages/rspack/src/builtin-plugin/RstestPlugin.ts b/packages/rspack/src/builtin-plugin/RstestPlugin.ts new file mode 100644 index 000000000000..8da9f942fca7 --- /dev/null +++ b/packages/rspack/src/builtin-plugin/RstestPlugin.ts @@ -0,0 +1,18 @@ +import { + BuiltinPluginName, + type RawRstestPluginOptions +} from "@rspack/binding"; + +import { create } from "./base"; + +export type RstestPluginArgument = + | Partial> + | ((percentage: number, msg: string, ...args: string[]) => void) + | undefined; + +export const RstestPlugin = create( + BuiltinPluginName.RstestPlugin, + (rstest: RawRstestPluginOptions): RawRstestPluginOptions => { + return rstest; + } +); diff --git a/packages/rspack/src/builtin-plugin/index.ts b/packages/rspack/src/builtin-plugin/index.ts index c1a9f1a4ad64..7bc43870b8e9 100644 --- a/packages/rspack/src/builtin-plugin/index.ts +++ b/packages/rspack/src/builtin-plugin/index.ts @@ -51,6 +51,7 @@ export * from "./NaturalModuleIdsPlugin"; export * from "./NodeTargetPlugin"; export * from "./OccurrenceChunkIdsPlugin"; export * from "./ProgressPlugin"; +export * from "./RstestPlugin"; export * from "./ProvidePlugin"; export * from "./RealContentHashPlugin"; export * from "./RemoveEmptyChunksPlugin"; diff --git a/packages/rspack/src/exports.ts b/packages/rspack/src/exports.ts index 66b389a0b00c..5b86848244f2 100644 --- a/packages/rspack/src/exports.ts +++ b/packages/rspack/src/exports.ts @@ -106,6 +106,7 @@ export { IgnorePlugin, type IgnorePluginOptions } from "./builtin-plugin"; export { ProvidePlugin } from "./builtin-plugin"; export { DefinePlugin } from "./builtin-plugin"; export { ProgressPlugin } from "./builtin-plugin"; +export { RstestPlugin } from "./builtin-plugin"; export { EntryPlugin } from "./builtin-plugin"; export { DynamicEntryPlugin } from "./builtin-plugin"; export { ExternalsPlugin } from "./builtin-plugin"; From 64ad14d5b5d829fc7c7dd34feacee26e74eb7b46 Mon Sep 17 00:00:00 2001 From: neverland Date: Tue, 27 May 2025 09:17:44 +0800 Subject: [PATCH 48/50] fix(types): use latest webpack-sources types (#10481) --- package.json | 3 +- packages/rspack-test-tools/package.json | 1 - .../rspack/declarations/webpack-sources.d.ts | 130 ------------------ packages/rspack/etc/core.api.md | 78 ++++++----- packages/rspack/package.json | 1 - packages/rspack/prebundle.config.mjs | 20 +-- patches/webpack-sources@3.3.0.patch | 21 +++ pnpm-lock.yaml | 31 +---- 8 files changed, 82 insertions(+), 203 deletions(-) delete mode 100644 packages/rspack/declarations/webpack-sources.d.ts create mode 100644 patches/webpack-sources@3.3.0.patch diff --git a/package.json b/package.json index 979faf42c9ba..8a87a8d1cf17 100644 --- a/package.json +++ b/package.json @@ -86,7 +86,8 @@ "pnpm": { "patchedDependencies": { "graceful-fs": "patches/graceful-fs.patch", - "rollup-plugin-dts": "patches/rollup-plugin-dts.patch" + "rollup-plugin-dts": "patches/rollup-plugin-dts.patch", + "webpack-sources@3.3.0": "patches/webpack-sources@3.3.0.patch" }, "onlyBuiltDependencies": [ "@biomejs/biome", diff --git a/packages/rspack-test-tools/package.json b/packages/rspack-test-tools/package.json index 5af0cfd22e40..289871d2a9ef 100644 --- a/packages/rspack-test-tools/package.json +++ b/packages/rspack-test-tools/package.json @@ -81,7 +81,6 @@ "@types/jsdom": "^21.1.7", "@types/react": "^19.1.4", "@types/react-dom": "^19.1.5", - "@types/webpack-sources": "3.2.3", "@webdiscus/pug-loader": "^2.11.1", "acorn": "^8.14.1", "babel-loader": "^10.0.0", diff --git a/packages/rspack/declarations/webpack-sources.d.ts b/packages/rspack/declarations/webpack-sources.d.ts deleted file mode 100644 index 4c4524c413c0..000000000000 --- a/packages/rspack/declarations/webpack-sources.d.ts +++ /dev/null @@ -1,130 +0,0 @@ -declare class Hash { - constructor(); - - /** - * Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding} - */ - update(data: string | Buffer, inputEncoding?: string): Hash; - - /** - * Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding} - */ - digest(encoding?: string): string | Buffer; -} - -export type MapOptions = { columns?: boolean; module?: boolean }; - -export type RawSourceMap = { - version: number; - sources: string[]; - names: string[]; - sourceRoot?: string; - sourcesContent?: string[]; - mappings: string; - file: string; -}; - -export abstract class Source { - size(): number; - - map(options?: MapOptions): RawSourceMap | null; - - sourceAndMap(options?: MapOptions): { - source: string | Buffer; - map: Object; - }; - - updateHash(hash: Hash): void; - - source(): string | Buffer; - - buffer(): Buffer; -} - -export class RawSource extends Source { - constructor(source: string | Buffer, convertToString?: boolean); - - isBuffer(): boolean; -} - -export class OriginalSource extends Source { - constructor(source: string | Buffer, name: string); - - getName(): string; -} - -export class ReplaceSource extends Source { - constructor(source: Source, name?: string); - - replace(start: number, end: number, newValue: string, name?: string): void; - insert(pos: number, newValue: string, name?: string): void; - - getName(): string; - original(): string; - getReplacements(): { - start: number; - end: number; - content: string; - insertIndex: number; - name: string; - }[]; -} - -export class SourceMapSource extends Source { - constructor( - source: string | Buffer, - name: string, - sourceMap: Object | string | Buffer, - originalSource?: string | Buffer, - innerSourceMap?: Object | string | Buffer, - removeOriginalSource?: boolean - ); - - getArgsAsBuffers(): [ - Buffer, - string, - Buffer, - Buffer | undefined, - Buffer | undefined, - boolean - ]; -} - -export class ConcatSource extends Source { - constructor(...args: (string | Source)[]); - - getChildren(): Source[]; - - add(item: string | Source): void; - addAllSkipOptimizing(items: Source[]): void; -} - -export class PrefixSource extends Source { - constructor(prefix: string, source: string | Source); - - original(): Source; - getPrefix(): string; -} - -export class CachedSource extends Source { - constructor(source: Source); - constructor(source: Source | (() => Source), cachedData?: any); - - original(): Source; - originalLazy(): Source | (() => Source); - getCachedData(): any; -} - -export class SizeOnlySource extends Source { - constructor(size: number); -} - -interface SourceLike { - source(): string | Buffer; -} - -export class CompatSource extends Source { - constructor(sourceLike: SourceLike); - - static from(sourceLike: SourceLike): Source; -} diff --git a/packages/rspack/etc/core.api.md b/packages/rspack/etc/core.api.md index e80878527efe..5f4f18e61d82 100644 --- a/packages/rspack/etc/core.api.md +++ b/packages/rspack/etc/core.api.md @@ -12,6 +12,7 @@ import { AsyncDependenciesBlock } from '@rspack/binding'; import { AsyncParallelHook } from '@rspack/lite-tapable'; import { AsyncSeriesBailHook } from '@rspack/lite-tapable'; import * as binding from '@rspack/binding'; +import { Buffer as Buffer_2 } from 'buffer'; import { BuiltinPlugin } from '@rspack/binding'; import { BuiltinPluginName } from '@rspack/binding'; import { CacheFacade as CacheFacade_2 } from './lib/CacheFacade'; @@ -1200,13 +1201,13 @@ export class Compiler { // @internal __internal__get_module_execution_results_map(): Map; // @internal - __internal__getModuleExecutionResult(id: number): any; - // @internal __internal__rebuild(modifiedFiles?: ReadonlySet, removedFiles?: ReadonlySet, callback?: (error: Error | null) => void): void; // @internal __internal__registerBuiltinPlugin(plugin: binding.BuiltinPlugin): void; // @internal get __internal__ruleSet(): RuleSetCompiler; + // @internal + __internal__takeModuleExecutionResult(id: number): any; // (undocumented) cache: Cache_2; // (undocumented) @@ -2923,12 +2924,11 @@ interface HasDecorator { } // @public (undocumented) -class Hash { - constructor(); - - digest(encoding?: string): string | Buffer; - - update(data: string | Buffer, inputEncoding?: string): Hash; +interface Hash { + // (undocumented) + digest: (encoding?: string) => string | Buffer_2; + // (undocumented) + update: (data: string | Buffer_2, inputEncoding?: string) => Hash; } // @public (undocumented) @@ -4567,7 +4567,12 @@ type MakeDirectoryOptions = { }; // @public (undocumented) -type MapOptions = { columns?: boolean; module?: boolean }; +interface MapOptions { + // (undocumented) + columns?: boolean; + // (undocumented) + module?: boolean; +} // @public type Matcher = string | RegExp | (string | RegExp)[]; @@ -5788,15 +5793,22 @@ export type PublicPath = "auto" | Filename; type Purge = (files?: string | string[] | Set) => void; // @public (undocumented) -type RawSourceMap = { - version: number; - sources: string[]; - names: string[]; - sourceRoot?: string; - sourcesContent?: string[]; - mappings: string; - file: string; -}; +interface RawSourceMap { + // (undocumented) + file: string; + // (undocumented) + mappings: string; + // (undocumented) + names: string[]; + // (undocumented) + sourceRoot?: string; + // (undocumented) + sources: string[]; + // (undocumented) + sourcesContent?: string[]; + // (undocumented) + version: number; +} // @public (undocumented) interface ReactConfig { @@ -7136,29 +7148,30 @@ export const sharing: { export type SnapshotOptions = {}; // @public (undocumented) -abstract class Source { +class Source { + constructor(); // (undocumented) - buffer(): Buffer; - + buffer(): Buffer_2; // (undocumented) - map(options?: MapOptions): RawSourceMap | null; - + map(options?: MapOptions): null | RawSourceMap; // (undocumented) size(): number; - // (undocumented) - source(): string | Buffer; - + source(): SourceValue; // (undocumented) - sourceAndMap(options?: MapOptions): { - source: string | Buffer; - map: Object; - }; - + sourceAndMap(options?: MapOptions): SourceAndMap; // (undocumented) updateHash(hash: Hash): void; } +// @public (undocumented) +interface SourceAndMap { + // (undocumented) + map: null | RawSourceMap; + // (undocumented) + source: SourceValue; +} + // @public (undocumented) interface SourceMap { // (undocumented) @@ -7195,6 +7208,9 @@ export type SourceMapFilename = string; export { sources } +// @public (undocumented) +type SourceValue = string | Buffer_2; + // @public (undocumented) interface Span { // (undocumented) diff --git a/packages/rspack/package.json b/packages/rspack/package.json index 5fab919a0acf..d3788bbf8cbc 100644 --- a/packages/rspack/package.json +++ b/packages/rspack/package.json @@ -51,7 +51,6 @@ "@rslib/core": "0.8.0", "@types/graceful-fs": "4.1.9", "@types/watchpack": "^2.4.4", - "@types/webpack-sources": "3.2.3", "browserslist": "^4.24.5", "enhanced-resolve": "5.18.1", "graceful-fs": "^4.2.11", diff --git a/packages/rspack/prebundle.config.mjs b/packages/rspack/prebundle.config.mjs index 57430f9a2336..a6b5ee0fc671 100644 --- a/packages/rspack/prebundle.config.mjs +++ b/packages/rspack/prebundle.config.mjs @@ -1,10 +1,9 @@ // @ts-check import { copyFileSync, readFileSync, unlinkSync, writeFileSync } from "node:fs"; -import { dirname, join } from "node:path"; +import { join } from "node:path"; import { fileURLToPath } from "node:url"; const __filename = fileURLToPath(import.meta.url); -const __dirname = dirname(__filename); /** @type {import('prebundle').Config} */ export default { @@ -13,6 +12,10 @@ export default { name: "zod", copyDts: true }, + { + name: "webpack-sources", + copyDts: true + }, "graceful-fs", { name: "watchpack", @@ -60,19 +63,6 @@ export default { writeFileSync(join(distPath, "CachedInputFileSystem.d.ts"), ""); } }, - { - name: "webpack-sources", - ignoreDts: true, - afterBundle(task) { - const dtsInputPath = join( - __dirname, - "declarations/webpack-sources.d.ts" - ); - const dtsContent = readFileSync(dtsInputPath, "utf-8"); - const dtsOutputPath = join(task.distPath, "index.d.ts"); - writeFileSync(dtsOutputPath, dtsContent, "utf-8"); - } - }, { name: "@swc/types" } diff --git a/patches/webpack-sources@3.3.0.patch b/patches/webpack-sources@3.3.0.patch new file mode 100644 index 000000000000..08612561ce9f --- /dev/null +++ b/patches/webpack-sources@3.3.0.patch @@ -0,0 +1,21 @@ +# Ensure the types.d.ts can be parsed by api-extractor +diff --git a/types.d.ts b/types.d.ts +index 08fad8920a89c3af97a8f6f706c566634bcd6fc9..241925cb470f7a2ed1c3cb011d86d49037727601 100644 +--- a/types.d.ts ++++ b/types.d.ts +@@ -269,7 +269,7 @@ declare interface StreamChunksOptions { + finalSource?: boolean; + columns?: boolean; + } +-declare namespace exports { ++ + export namespace util { + export namespace stringBufferUtils { + export let disableDualStringBufferCaching: () => void; +@@ -318,6 +318,3 @@ declare namespace exports { + GeneratedSourceInfo, + StreamChunksOptions + }; +-} +- +-export = exports; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ff7a0311c93f..b4acc8724249 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,6 +11,9 @@ patchedDependencies: rollup-plugin-dts: hash: bc3f29f4636a594eb84c5e3f2d8cbd29c2e6b845f376603b718fb2d41bee6de8 path: patches/rollup-plugin-dts.patch + webpack-sources@3.3.0: + hash: 6c5cd9744a1ff9c2374c7ffac6703e74ec00b56bd6d104fb27e6e3c10451cec7 + path: patches/webpack-sources@3.3.0.patch importers: @@ -310,9 +313,6 @@ importers: '@types/watchpack': specifier: ^2.4.4 version: 2.4.4 - '@types/webpack-sources': - specifier: 3.2.3 - version: 3.2.3 browserslist: specifier: ^4.24.5 version: 4.24.5 @@ -339,7 +339,7 @@ importers: version: 2.4.3 webpack-sources: specifier: 3.3.0 - version: 3.3.0 + version: 3.3.0(patch_hash=6c5cd9744a1ff9c2374c7ffac6703e74ec00b56bd6d104fb27e6e3c10451cec7) zod: specifier: ^3.25.28 version: 3.25.28 @@ -481,7 +481,7 @@ importers: version: 6.0.1 webpack-sources: specifier: 3.3.0 - version: 3.3.0 + version: 3.3.0(patch_hash=6c5cd9744a1ff9c2374c7ffac6703e74ec00b56bd6d104fb27e6e3c10451cec7) devDependencies: '@rspack/cli': specifier: workspace:* @@ -522,9 +522,6 @@ importers: '@types/react-dom': specifier: ^19.1.5 version: 19.1.5(@types/react@19.1.4) - '@types/webpack-sources': - specifier: 3.2.3 - version: 3.2.3 '@webdiscus/pug-loader': specifier: ^2.11.1 version: 2.11.1(enhanced-resolve@5.18.1)(prismjs@1.29.0)(pug@3.0.3)(webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17))) @@ -840,7 +837,7 @@ importers: version: 2.4.3 webpack-sources: specifier: 3.3.0 - version: 3.3.0 + version: 3.3.0(patch_hash=6c5cd9744a1ff9c2374c7ffac6703e74ec00b56bd6d104fb27e6e3c10451cec7) devDependencies: '@babel/preset-react': specifier: ^7.27.1 @@ -3420,9 +3417,6 @@ packages: '@types/sockjs@0.3.36': resolution: {integrity: sha512-MK9V6NzAS1+Ud7JV9lJLFqW85VbC9dq3LmwZCuBe4wBDgKC0Kj/jd8Xl+nSviU+Qc3+m7umHHyHg//2KSa0a0Q==} - '@types/source-list-map@0.1.6': - resolution: {integrity: sha512-5JcVt1u5HDmlXkwOD2nslZVllBBc7HDuOICfiZah2Z0is8M8g+ddAEawbmd3VjedfDHBzxCaXLs07QEmb7y54g==} - '@types/stack-utils@2.0.3': resolution: {integrity: sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==} @@ -3444,9 +3438,6 @@ packages: '@types/webpack-bundle-analyzer@4.7.0': resolution: {integrity: sha512-c5i2ThslSNSG8W891BRvOd/RoCjI2zwph8maD22b1adtSns20j+0azDDMCK06DiVrzTgnwiDl5Ntmu1YRJw8Sg==} - '@types/webpack-sources@3.2.3': - resolution: {integrity: sha512-4nZOdMwSPHZ4pTEZzSp0AsTM4K7Qmu40UKW4tJDiOVs20UzYF9l+qUe4s0ftfN0pin06n+5cWWDJXH+sbhAiDw==} - '@types/ws@8.18.0': resolution: {integrity: sha512-8svvI3hMyvN0kKCJMvTJP/x6Y/EoQbepff882wL+Sn5QsXb3etnamgrJq4isrBxSJj5L2AuXcI0+bgkoAXGUJw==} @@ -10697,8 +10688,6 @@ snapshots: dependencies: '@types/node': 20.17.50 - '@types/source-list-map@0.1.6': {} - '@types/stack-utils@2.0.3': {} '@types/tough-cookie@4.0.5': {} @@ -10726,12 +10715,6 @@ snapshots: - uglify-js - webpack-cli - '@types/webpack-sources@3.2.3': - dependencies: - '@types/node': 20.17.50 - '@types/source-list-map': 0.1.6 - source-map: 0.7.4 - '@types/ws@8.18.0': dependencies: '@types/node': 20.17.50 @@ -16022,7 +16005,7 @@ snapshots: webpack-sources@3.2.3: {} - webpack-sources@3.3.0: {} + webpack-sources@3.3.0(patch_hash=6c5cd9744a1ff9c2374c7ffac6703e74ec00b56bd6d104fb27e6e3c10451cec7): {} webpack@5.99.9(@swc/core@1.11.24(@swc/helpers@0.5.17)): dependencies: From 8d8ddb1eccdbacde863f91a8241487e786171402 Mon Sep 17 00:00:00 2001 From: Sergey Nikitin Date: Tue, 27 May 2025 04:09:20 +0200 Subject: [PATCH 49/50] docs: Add Miro into the list of consumers (#10482) * docs: Add Miro into the list of consumers I am happy to say that in Miro we have migrated our biggest application to RSPack and it goes pretty well so far. We have migrated all operational parts including the dev server, production asset generation, Storybooks as well. This being said, I suggest adding the Miro in the list of companies that actively use RSPack now. * Update website/theme/components/Landingpage/WhoIsUsing/index.tsx --------- Co-authored-by: neverland --- website/project-words.txt | 1 + .../Landingpage/WhoIsUsing/assets/miro.svg | 26 +++++++++++++++++++ .../Landingpage/WhoIsUsing/index.tsx | 7 +++++ 3 files changed, 34 insertions(+) create mode 100644 website/theme/components/Landingpage/WhoIsUsing/assets/miro.svg diff --git a/website/project-words.txt b/website/project-words.txt index 0e56a487564d..ab54bb43d3b5 100644 --- a/website/project-words.txt +++ b/website/project-words.txt @@ -89,6 +89,7 @@ Llms magic-akari memfs mimalloc +miro modulegeneratorassetdataurl modulegeneratorassetdataurlencoding modulegeneratorassetdataurlmimetype diff --git a/website/theme/components/Landingpage/WhoIsUsing/assets/miro.svg b/website/theme/components/Landingpage/WhoIsUsing/assets/miro.svg new file mode 100644 index 000000000000..f934ce7100a3 --- /dev/null +++ b/website/theme/components/Landingpage/WhoIsUsing/assets/miro.svg @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/website/theme/components/Landingpage/WhoIsUsing/index.tsx b/website/theme/components/Landingpage/WhoIsUsing/index.tsx index 11ffc0a24ad4..39abcb545806 100644 --- a/website/theme/components/Landingpage/WhoIsUsing/index.tsx +++ b/website/theme/components/Landingpage/WhoIsUsing/index.tsx @@ -19,6 +19,7 @@ import intuitLogo from './assets/intuit.svg'; import khanAcademyLogo from './assets/khan-academy.svg'; import kuaishouLogo from './assets/kuaishou.svg'; import microsoftLogo from './assets/microsoft.svg'; +import miroLogo from './assets/miro.svg'; import nioLogo from './assets/nio.svg'; import sequoiaLogo from './assets/sequoia.svg'; import tiktokLogo from './assets/tiktok.svg'; @@ -143,6 +144,12 @@ const companyList: Company[] = [ url: 'https://verkada.com', width: 180, }, + { + name: 'Miro', + logo: miroLogo, + url: 'https://miro.com', + width: 120, + }, ]; const WhoIsUsing: React.FC = memo(() => { From 34a5fba94405198ad3c8393833e3b45f37e93689 Mon Sep 17 00:00:00 2001 From: jserfeng <1114550440@qq.com> Date: Tue, 27 May 2025 13:42:38 +0800 Subject: [PATCH 50/50] chore: release --- crates/node_binding/package.json | 4 ++-- npm/darwin-arm64/package.json | 4 ++-- npm/darwin-x64/package.json | 4 ++-- npm/linux-x64-gnu/package.json | 4 ++-- npm/wasm32-wasi/package.json | 4 ++-- npm/win32-x64-msvc/package.json | 4 ++-- package.json | 4 ++-- packages/create-rspack/package.json | 4 ++-- packages/rspack-cli/package.json | 2 +- packages/rspack-test-tools/package.json | 4 ++-- packages/rspack/package.json | 4 ++-- 11 files changed, 21 insertions(+), 21 deletions(-) diff --git a/crates/node_binding/package.json b/crates/node_binding/package.json index 83419e54e219..8040c637b178 100644 --- a/crates/node_binding/package.json +++ b/crates/node_binding/package.json @@ -1,6 +1,6 @@ { "name": "@rspack/binding", - "version": "1.3.11", + "version": "1.3.12", "license": "MIT", "description": "Node binding for rspack", "main": "binding.js", @@ -63,4 +63,4 @@ "@rspack/binding-wasm32-wasi": "workspace:*", "@rspack/binding-win32-x64-msvc": "workspace:*" } -} +} \ No newline at end of file diff --git a/npm/darwin-arm64/package.json b/npm/darwin-arm64/package.json index a9418c296cd5..cd9815a0ff37 100644 --- a/npm/darwin-arm64/package.json +++ b/npm/darwin-arm64/package.json @@ -1,6 +1,6 @@ { "name": "@rspack/binding-darwin-arm64", - "version": "1.3.11", + "version": "1.3.12", "license": "MIT", "description": "Node binding for rspack", "main": "rspack.darwin-arm64.node", @@ -23,4 +23,4 @@ "cpu": [ "arm64" ] -} +} \ No newline at end of file diff --git a/npm/darwin-x64/package.json b/npm/darwin-x64/package.json index 2a8d24c12f81..52e1dfdbef11 100644 --- a/npm/darwin-x64/package.json +++ b/npm/darwin-x64/package.json @@ -1,6 +1,6 @@ { "name": "@rspack/binding-darwin-x64", - "version": "1.3.11", + "version": "1.3.12", "license": "MIT", "description": "Node binding for rspack", "main": "rspack.darwin-x64.node", @@ -23,4 +23,4 @@ "cpu": [ "x64" ] -} +} \ No newline at end of file diff --git a/npm/linux-x64-gnu/package.json b/npm/linux-x64-gnu/package.json index 650fd46a2c30..7b567f3b7fcd 100644 --- a/npm/linux-x64-gnu/package.json +++ b/npm/linux-x64-gnu/package.json @@ -1,6 +1,6 @@ { "name": "@rspack/binding-linux-x64-gnu", - "version": "1.3.11", + "version": "1.3.12", "license": "MIT", "description": "Node binding for rspack", "main": "rspack.linux-x64-gnu.node", @@ -26,4 +26,4 @@ "libc": [ "glibc" ] -} +} \ No newline at end of file diff --git a/npm/wasm32-wasi/package.json b/npm/wasm32-wasi/package.json index 085c120d3e0f..84fd05c5653d 100644 --- a/npm/wasm32-wasi/package.json +++ b/npm/wasm32-wasi/package.json @@ -1,6 +1,6 @@ { "name": "@rspack/binding-wasm32-wasi", - "version": "1.3.11", + "version": "1.3.12", "license": "MIT", "description": "Node binding for rspack", "main": "rspack.wasi.cjs", @@ -25,4 +25,4 @@ "dependencies": { "@napi-rs/wasm-runtime": "^0.2.10" } -} +} \ No newline at end of file diff --git a/npm/win32-x64-msvc/package.json b/npm/win32-x64-msvc/package.json index 444729fcab70..5b82243a35e1 100644 --- a/npm/win32-x64-msvc/package.json +++ b/npm/win32-x64-msvc/package.json @@ -1,6 +1,6 @@ { "name": "@rspack/binding-win32-x64-msvc", - "version": "1.3.11", + "version": "1.3.12", "license": "MIT", "description": "Node binding for rspack", "main": "rspack.win32-x64-msvc.node", @@ -23,4 +23,4 @@ "cpu": [ "x64" ] -} +} \ No newline at end of file diff --git a/package.json b/package.json index 8a87a8d1cf17..acd197ae91a9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "monorepo", - "version": "1.3.11", + "version": "1.3.12", "license": "MIT", "description": "The fast Rust-based web bundler with webpack-compatible API", "private": true, @@ -97,4 +97,4 @@ "esbuild" ] } -} +} \ No newline at end of file diff --git a/packages/create-rspack/package.json b/packages/create-rspack/package.json index a81f11ce974f..f37954fa7598 100644 --- a/packages/create-rspack/package.json +++ b/packages/create-rspack/package.json @@ -1,6 +1,6 @@ { "name": "create-rspack", - "version": "1.3.11", + "version": "1.3.12", "homepage": "https://rspack.dev", "bugs": "https://github.com/web-infra-dev/rspack/issues", "repository": { @@ -34,4 +34,4 @@ "access": "public", "provenance": true } -} +} \ No newline at end of file diff --git a/packages/rspack-cli/package.json b/packages/rspack-cli/package.json index dbff7497d9a4..dd551f6d279d 100644 --- a/packages/rspack-cli/package.json +++ b/packages/rspack-cli/package.json @@ -1,6 +1,6 @@ { "name": "@rspack/cli", - "version": "1.3.11", + "version": "1.3.12", "description": "CLI for rspack", "homepage": "https://rspack.dev", "bugs": "https://github.com/web-infra-dev/rspack/issues", diff --git a/packages/rspack-test-tools/package.json b/packages/rspack-test-tools/package.json index 289871d2a9ef..bfc3e5cc2c68 100644 --- a/packages/rspack-test-tools/package.json +++ b/packages/rspack-test-tools/package.json @@ -1,6 +1,6 @@ { "name": "@rspack/test-tools", - "version": "1.3.11", + "version": "1.3.12", "license": "MIT", "description": "Test tools for rspack", "main": "dist/index.js", @@ -112,4 +112,4 @@ "peerDependencies": { "@rspack/core": ">=1.0.0" } -} +} \ No newline at end of file diff --git a/packages/rspack/package.json b/packages/rspack/package.json index d3788bbf8cbc..4857b5ae9065 100644 --- a/packages/rspack/package.json +++ b/packages/rspack/package.json @@ -1,6 +1,6 @@ { "name": "@rspack/core", - "version": "1.3.11", + "version": "1.3.12", "webpackVersion": "5.75.0", "license": "MIT", "description": "The fast Rust-based web bundler with webpack-compatible API", @@ -77,4 +77,4 @@ "optional": true } } -} +} \ No newline at end of file