Skip to content

Commit

Permalink
refactor: remove unused cssHeadDataCompression config (#8555)
Browse files Browse the repository at this point in the history
  • Loading branch information
JSerFeng authored Nov 28, 2024
1 parent 3050931 commit 21edaba
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 21 deletions.
1 change: 0 additions & 1 deletion crates/node_binding/binding.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1742,7 +1742,6 @@ export interface RawOutputOptions {
crossOriginLoading: RawCrossOriginLoading
cssFilename: JsFilename
cssChunkFilename: JsFilename
cssHeadDataCompression: boolean
hotUpdateMainFilename: string
hotUpdateChunkFilename: string
hotUpdateGlobal: string
Expand Down
2 changes: 0 additions & 2 deletions crates/rspack_binding_options/src/options/raw_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ pub struct RawOutputOptions {
pub cross_origin_loading: RawCrossOriginLoading,
pub css_filename: JsFilename,
pub css_chunk_filename: JsFilename,
pub css_head_data_compression: bool,
pub hot_update_main_filename: String,
pub hot_update_chunk_filename: String,
pub hot_update_global: String,
Expand Down Expand Up @@ -137,7 +136,6 @@ impl TryFrom<RawOutputOptions> for OutputOptions {
cross_origin_loading: value.cross_origin_loading.into(),
css_filename: value.css_filename.into(),
css_chunk_filename: value.css_chunk_filename.into(),
css_head_data_compression: value.css_head_data_compression,
hot_update_main_filename: value.hot_update_main_filename.into(),
hot_update_chunk_filename: value.hot_update_chunk_filename.into(),
hot_update_global: value.hot_update_global,
Expand Down
1 change: 0 additions & 1 deletion crates/rspack_core/src/options/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ pub struct OutputOptions {
pub cross_origin_loading: CrossOriginLoading,
pub css_filename: Filename,
pub css_chunk_filename: Filename,
pub css_head_data_compression: bool,
pub hot_update_main_filename: FilenameTemplate,
pub hot_update_chunk_filename: FilenameTemplate,
pub hot_update_global: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,6 @@ Object {
crossOriginLoading: false,
cssChunkFilename: [name].css,
cssFilename: [name].css,
cssHeadDataCompression: true,
devtoolFallbackModuleFilenameTemplate: undefined,
devtoolModuleFilenameTemplate: undefined,
devtoolNamespace: @rspack/test-tools,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ module.exports = {
+ "moduleIds": "named",
+ "nodeEnv": "development",
@@ ... @@
- "cssHeadDataCompression": true,
+ "cssHeadDataCompression": false,
@@ ... @@
- "pathinfo": false,
+ "pathinfo": true,
@@ ... @@
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ module.exports = {
+ "moduleIds": "named",
+ "nodeEnv": "development",
@@ ... @@
- "cssHeadDataCompression": true,
+ "cssHeadDataCompression": false,
@@ ... @@
- "pathinfo": false,
+ "pathinfo": true,
@@ ... @@
Expand Down
10 changes: 4 additions & 6 deletions packages/rspack/etc/core.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4208,8 +4208,6 @@ export interface OutputNormalized {
// (undocumented)
cssFilename?: CssFilename;
// (undocumented)
cssHeadDataCompression?: boolean;
// (undocumented)
devtoolFallbackModuleFilenameTemplate?: DevtoolFallbackModuleFilenameTemplate;
// (undocumented)
devtoolModuleFilenameTemplate?: DevtoolModuleFilenameTemplate;
Expand Down Expand Up @@ -5960,6 +5958,7 @@ export const rspackOptions: z.ZodObject<{
umdNamedDefine?: boolean | undefined;
} | undefined;
wasmLoading?: string | false | undefined;
cssHeadDataCompression?: boolean | undefined;
auxiliaryComment?: string | {
root?: string | undefined;
commonjs?: string | undefined;
Expand Down Expand Up @@ -6005,7 +6004,6 @@ export const rspackOptions: z.ZodObject<{
devtoolFallbackModuleFilenameTemplate?: string | ((args_0: any) => any) | undefined;
charset?: boolean | undefined;
chunkLoadTimeout?: number | undefined;
cssHeadDataCompression?: boolean | undefined;
compareBeforeEmit?: boolean | undefined;
libraryExport?: string | string[] | undefined;
libraryTarget?: string | undefined;
Expand Down Expand Up @@ -6056,6 +6054,7 @@ export const rspackOptions: z.ZodObject<{
umdNamedDefine?: boolean | undefined;
} | undefined;
wasmLoading?: string | false | undefined;
cssHeadDataCompression?: boolean | undefined;
auxiliaryComment?: string | {
root?: string | undefined;
commonjs?: string | undefined;
Expand Down Expand Up @@ -6101,7 +6100,6 @@ export const rspackOptions: z.ZodObject<{
devtoolFallbackModuleFilenameTemplate?: string | ((args_0: any) => any) | undefined;
charset?: boolean | undefined;
chunkLoadTimeout?: number | undefined;
cssHeadDataCompression?: boolean | undefined;
compareBeforeEmit?: boolean | undefined;
libraryExport?: string | string[] | undefined;
libraryTarget?: string | undefined;
Expand Down Expand Up @@ -8630,6 +8628,7 @@ export const rspackOptions: z.ZodObject<{
umdNamedDefine?: boolean | undefined;
} | undefined;
wasmLoading?: string | false | undefined;
cssHeadDataCompression?: boolean | undefined;
auxiliaryComment?: string | {
root?: string | undefined;
commonjs?: string | undefined;
Expand Down Expand Up @@ -8675,7 +8674,6 @@ export const rspackOptions: z.ZodObject<{
devtoolFallbackModuleFilenameTemplate?: string | ((args_0: any) => any) | undefined;
charset?: boolean | undefined;
chunkLoadTimeout?: number | undefined;
cssHeadDataCompression?: boolean | undefined;
compareBeforeEmit?: boolean | undefined;
libraryExport?: string | string[] | undefined;
libraryTarget?: string | undefined;
Expand Down Expand Up @@ -9253,6 +9251,7 @@ export const rspackOptions: z.ZodObject<{
umdNamedDefine?: boolean | undefined;
} | undefined;
wasmLoading?: string | false | undefined;
cssHeadDataCompression?: boolean | undefined;
auxiliaryComment?: string | {
root?: string | undefined;
commonjs?: string | undefined;
Expand Down Expand Up @@ -9298,7 +9297,6 @@ export const rspackOptions: z.ZodObject<{
devtoolFallbackModuleFilenameTemplate?: string | ((args_0: any) => any) | undefined;
charset?: boolean | undefined;
chunkLoadTimeout?: number | undefined;
cssHeadDataCompression?: boolean | undefined;
compareBeforeEmit?: boolean | undefined;
libraryExport?: string | string[] | undefined;
libraryTarget?: string | undefined;
Expand Down
1 change: 0 additions & 1 deletion packages/rspack/src/config/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ function getRawOutput(output: OutputNormalized): RawOptions["output"] {
crossOriginLoading: getRawCrossOriginLoading(output.crossOriginLoading!),
cssFilename: output.cssFilename!,
cssChunkFilename: output.cssChunkFilename!,
cssHeadDataCompression: output.cssHeadDataCompression!,
hotUpdateChunkFilename: output.hotUpdateChunkFilename!,
hotUpdateMainFilename: output.hotUpdateMainFilename!,
hotUpdateGlobal: output.hotUpdateGlobal!,
Expand Down
1 change: 0 additions & 1 deletion packages/rspack/src/config/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,6 @@ const applyOutputDefaults = (
const uniqueNameId = Template.toIdentifier(output.uniqueName);
F(output, "hotUpdateGlobal", () => `webpackHotUpdate${uniqueNameId}`);
F(output, "chunkLoadingGlobal", () => `webpackChunk${uniqueNameId}`);
D(output, "cssHeadDataCompression", !development);
D(output, "assetModuleFilename", "[hash][ext][query]");
D(output, "webassemblyModuleFilename", "[hash].module.wasm");
D(output, "compareBeforeEmit", true);
Expand Down
10 changes: 8 additions & 2 deletions packages/rspack/src/config/normalization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* https://github.com/webpack/webpack/blob/main/LICENSE
*/

import util from "node:util";
import type { Compilation } from "../Compilation";
import type {
AssetModuleFilename,
Expand Down Expand Up @@ -115,6 +116,13 @@ export const getNormalizedRspackOptions = (
)(config.entry)
: getNormalizedEntryStatic(config.entry),
output: nestedConfig(config.output, output => {
if ("cssHeadDataCompression" in output) {
util.deprecate(
() => {},
"cssHeadDataCompression is not used now, see https://github.com/web-infra-dev/rspack/pull/8534, this option could be removed in the future"
)();
}

const { library } = output;
const libraryAsName = library;
const libraryBase =
Expand All @@ -138,7 +146,6 @@ export const getNormalizedRspackOptions = (
chunkLoading: output.chunkLoading,
chunkFilename: output.chunkFilename,
crossOriginLoading: output.crossOriginLoading,
cssHeadDataCompression: output.cssHeadDataCompression,
cssFilename: output.cssFilename,
cssChunkFilename: output.cssChunkFilename,
hotUpdateMainFilename: output.hotUpdateMainFilename,
Expand Down Expand Up @@ -524,7 +531,6 @@ export interface OutputNormalized {
environment?: Environment;
charset?: boolean;
chunkLoadTimeout?: number;
cssHeadDataCompression?: boolean;
compareBeforeEmit?: boolean;
}

Expand Down
1 change: 1 addition & 0 deletions packages/rspack/src/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ export type Output = {
cssFilename?: CssFilename;

/**
* @deprecated this config is unused, and will be removed in the future.
* Rspack adds some metadata in CSS to parse CSS modules, and this configuration determines whether to compress these metadata.
*
* The value is `true` in production mode.
Expand Down

2 comments on commit 21edaba

@rspack-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Benchmark detail: Open

Name Base (2024-11-28 9b70e3a) Current Change
10000_big_production-mode_disable-minimize + exec 42.8 s ± 992 ms 42.5 s ± 853 ms -0.81 %
10000_development-mode + exec 1.8 s ± 38 ms 1.81 s ± 31 ms +0.42 %
10000_development-mode_hmr + exec 648 ms ± 11 ms 649 ms ± 13 ms +0.24 %
10000_production-mode + exec 2.4 s ± 24 ms 2.41 s ± 34 ms +0.39 %
arco-pro_development-mode + exec 1.75 s ± 60 ms 1.74 s ± 59 ms -0.79 %
arco-pro_development-mode_hmr + exec 426 ms ± 2.4 ms 426 ms ± 2.5 ms +0.02 %
arco-pro_production-mode + exec 3.14 s ± 78 ms 3.09 s ± 101 ms -1.53 %
arco-pro_production-mode_generate-package-json-webpack-plugin + exec 3.14 s ± 85 ms 3.18 s ± 56 ms +1.00 %
threejs_development-mode_10x + exec 1.63 s ± 20 ms 1.61 s ± 15 ms -0.95 %
threejs_development-mode_10x_hmr + exec 812 ms ± 8.2 ms 799 ms ± 9.4 ms -1.58 %
threejs_production-mode_10x + exec 4.93 s ± 27 ms 4.93 s ± 48 ms -0.04 %
10000_big_production-mode_disable-minimize + rss memory 13461 MiB ± 268 MiB 13579 MiB ± 174 MiB +0.88 %
10000_development-mode + rss memory 803 MiB ± 57.1 MiB 772 MiB ± 12.3 MiB -3.91 %
10000_development-mode_hmr + rss memory 2077 MiB ± 208 MiB 2051 MiB ± 471 MiB -1.26 %
10000_production-mode + rss memory 661 MiB ± 25.9 MiB 672 MiB ± 39.3 MiB +1.60 %
arco-pro_development-mode + rss memory 725 MiB ± 34.1 MiB 737 MiB ± 37 MiB +1.63 %
arco-pro_development-mode_hmr + rss memory 929 MiB ± 99.5 MiB 940 MiB ± 72.9 MiB +1.11 %
arco-pro_production-mode + rss memory 848 MiB ± 72.3 MiB 884 MiB ± 71.6 MiB +4.27 %
arco-pro_production-mode_generate-package-json-webpack-plugin + rss memory 866 MiB ± 73.3 MiB 879 MiB ± 34.8 MiB +1.54 %
threejs_development-mode_10x + rss memory 838 MiB ± 47.5 MiB 807 MiB ± 50.8 MiB -3.70 %
threejs_development-mode_10x_hmr + rss memory 2157 MiB ± 476 MiB 2113 MiB ± 240 MiB -2.03 %
threejs_production-mode_10x + rss memory 1019 MiB ± 75.9 MiB 1054 MiB ± 83.5 MiB +3.45 %

@rspack-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Ran ecosystem CI: Open

suite result
modernjs ❌ failure
_selftest ✅ success
rsdoctor ✅ success
rspress ✅ success
rslib ❌ failure
rsbuild ✅ success
examples ✅ success
devserver ✅ success
nuxt ✅ success

Please sign in to comment.