Unverified Commit 1f52cb42 authored by Niklas Mischkulnig's avatar Niklas Mischkulnig Committed by GitHub

Turbopack: shorten CSS module class names (#97944)

The class names were unnecessarily long.

Use the same as the lightningcss default:
`[hash]_[local]` which is
`<hash of the full file path>_<original class name or identifier>`

Keep the previous longer mechanism to aid in debugging in dev
Co-authored-by: 's avatarvercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com>
parent 6d6228c0
...@@ -385,6 +385,7 @@ pub async fn get_client_module_options_context( ...@@ -385,6 +385,7 @@ pub async fn get_client_module_options_context(
source_maps, source_maps,
module_css_condition: Some(module_styles_rule_condition()), module_css_condition: Some(module_styles_rule_condition()),
lightningcss_features: *next_config.lightningcss_feature_flags().await?, lightningcss_features: *next_config.lightningcss_feature_flags().await?,
module_css_debuggable_idents: next_mode.is_development(),
..Default::default() ..Default::default()
}, },
static_url_tag: Some(rcstr!("client")), static_url_tag: Some(rcstr!("client")),
......
...@@ -561,6 +561,7 @@ pub async fn get_server_module_options_context( ...@@ -561,6 +561,7 @@ pub async fn get_server_module_options_context(
source_maps, source_maps,
module_css_condition: Some(module_styles_rule_condition()), module_css_condition: Some(module_styles_rule_condition()),
lightningcss_features: *next_config.lightningcss_feature_flags().await?, lightningcss_features: *next_config.lightningcss_feature_flags().await?,
module_css_debuggable_idents: next_mode.is_development(),
..Default::default() ..Default::default()
}, },
follow_reexports: true, follow_reexports: true,
......
...@@ -17,7 +17,7 @@ describe('experimental-lightningcss with default mode', () => { ...@@ -17,7 +17,7 @@ describe('experimental-lightningcss with default mode', () => {
// lightningcss produces different class names in turbo mode // lightningcss produces different class names in turbo mode
if (isTurbopack) { if (isTurbopack) {
// swc_css does not include `-module` in the class name, while lightningcss does. // Turbopack keeps the filename in CSS Module class names during development.
expect($('p').attr('class')).toBe( expect($('p').attr('class')).toBe(
'search-keyword style-module__hlQ3RG__blue' 'search-keyword style-module__hlQ3RG__blue'
) )
......
...@@ -21,7 +21,7 @@ describe('Basic CSS Module Support', () => { ...@@ -21,7 +21,7 @@ describe('Basic CSS Module Support', () => {
if (isTurbopack) { if (isTurbopack) {
expect( expect(
cssContent.replace(/\/\*.*?\*\//g, '').trim() cssContent.replace(/\/\*.*?\*\//g, '').trim()
).toMatchInlineSnapshot(`".index-module__KWKY6G__redText{color:red}"`) ).toMatchInlineSnapshot(`".KWKY6G_redText{color:red}"`)
} else { } else {
expect( expect(
cssContent.replace(/\/\*.*?\*\//g, '').trim() cssContent.replace(/\/\*.*?\*\//g, '').trim()
...@@ -46,7 +46,7 @@ describe('Basic CSS Module Support', () => { ...@@ -46,7 +46,7 @@ describe('Basic CSS Module Support', () => {
if (isTurbopack) { if (isTurbopack) {
expect($('#verify-red').attr('class')).toMatchInlineSnapshot( expect($('#verify-red').attr('class')).toMatchInlineSnapshot(
`"index-module__KWKY6G__redText"` `"KWKY6G_redText"`
) )
} else { } else {
expect($('#verify-red').attr('class')).toMatchInlineSnapshot( expect($('#verify-red').attr('class')).toMatchInlineSnapshot(
...@@ -73,7 +73,7 @@ describe('3rd Party CSS Module Support', () => { ...@@ -73,7 +73,7 @@ describe('3rd Party CSS Module Support', () => {
expect( expect(
cssContent.replace(/\/\*.*?\*\//g, '').trim() cssContent.replace(/\/\*.*?\*\//g, '').trim()
).toMatchInlineSnapshot( ).toMatchInlineSnapshot(
`".index-module__KWKY6G__foo{position:relative}:is(.index-module__KWKY6G__foo .bar,.index-module__KWKY6G__foo .baz){height:100%;overflow:hidden}.index-module__KWKY6G__foo .lol{width:80%}.index-module__KWKY6G__foo>.lel{width:80%}"` `".KWKY6G_foo{position:relative}:is(.KWKY6G_foo .bar,.KWKY6G_foo .baz){height:100%;overflow:hidden}.KWKY6G_foo .lol{width:80%}.KWKY6G_foo>.lel{width:80%}"`
) )
} else { } else {
expect( expect(
...@@ -101,7 +101,7 @@ describe('3rd Party CSS Module Support', () => { ...@@ -101,7 +101,7 @@ describe('3rd Party CSS Module Support', () => {
if (isTurbopack) { if (isTurbopack) {
expect($('#verify-div').attr('class')).toMatchInlineSnapshot( expect($('#verify-div').attr('class')).toMatchInlineSnapshot(
`"index-module__KWKY6G__foo"` `"KWKY6G_foo"`
) )
} else { } else {
expect($('#verify-div').attr('class')).toMatchInlineSnapshot( expect($('#verify-div').attr('class')).toMatchInlineSnapshot(
...@@ -137,7 +137,7 @@ describe('Valid CSS Module Usage from within node_modules', () => { ...@@ -137,7 +137,7 @@ describe('Valid CSS Module Usage from within node_modules', () => {
const cssPreload = $('#nm-div') const cssPreload = $('#nm-div')
if (isTurbopack) { if (isTurbopack) {
expect(cssPreload.text()).toMatchInlineSnapshot( expect(cssPreload.text()).toMatchInlineSnapshot(
`"{"message":"Why hello there","default":{"message":"Why hello there"}} {"redText":"index-module__PIKFPa__redText","default":{"redText":"index-module__PIKFPa__redText"}}"` `"{"message":"Why hello there","default":{"message":"Why hello there"}} {"redText":"PIKFPa_redText","default":{"redText":"PIKFPa_redText"}}"`
) )
} else { } else {
expect(cssPreload.text()).toMatchInlineSnapshot( expect(cssPreload.text()).toMatchInlineSnapshot(
...@@ -158,7 +158,7 @@ describe('Valid CSS Module Usage from within node_modules', () => { ...@@ -158,7 +158,7 @@ describe('Valid CSS Module Usage from within node_modules', () => {
if (isTurbopack) { if (isTurbopack) {
expect( expect(
cssContent.replace(/\/\*.*?\*\//g, '').trim() cssContent.replace(/\/\*.*?\*\//g, '').trim()
).toMatchInlineSnapshot(`".index-module__PIKFPa__redText{color:red}"`) ).toMatchInlineSnapshot(`".PIKFPa_redText{color:red}"`)
} else { } else {
expect( expect(
cssContent.replace(/\/\*.*?\*\//g, '').trim() cssContent.replace(/\/\*.*?\*\//g, '').trim()
...@@ -220,7 +220,7 @@ describe('CSS Module Composes Usage (Basic)', () => { ...@@ -220,7 +220,7 @@ describe('CSS Module Composes Usage (Basic)', () => {
expect( expect(
cssContent.replace(/\/\*.*?\*\//g, '').trim() cssContent.replace(/\/\*.*?\*\//g, '').trim()
).toMatchInlineSnapshot( ).toMatchInlineSnapshot(
`".index-module__KWKY6G__className{color:#ff0;background:red}.index-module__KWKY6G__subClass{background:#00f;}"` `".KWKY6G_className{color:#ff0;background:red}.KWKY6G_subClass{background:#00f;}"`
) )
} else { } else {
expect( expect(
...@@ -282,7 +282,7 @@ describe('Dynamic Route CSS Module Usage', () => { ...@@ -282,7 +282,7 @@ describe('Dynamic Route CSS Module Usage', () => {
if (isTurbopack) { if (isTurbopack) {
expect( expect(
cssContent.replace(/\/\*.*?\*\//g, '').trim() cssContent.replace(/\/\*.*?\*\//g, '').trim()
).toMatchInlineSnapshot(`".index-module__9fTRMq__home{background:red}"`) ).toMatchInlineSnapshot(`"._9fTRMq_home{background:red}"`)
} else { } else {
expect( expect(
cssContent.replace(/\/\*.*?\*\//g, '').trim() cssContent.replace(/\/\*.*?\*\//g, '').trim()
...@@ -320,8 +320,8 @@ describe('Catch-all Route CSS Module Usage', () => { ...@@ -320,8 +320,8 @@ describe('Catch-all Route CSS Module Usage', () => {
if (isTurbopack) { if (isTurbopack) {
expect(cssContent.replace(/\/\*.*?\*\/\n?/g, '').trim()) expect(cssContent.replace(/\/\*.*?\*\/\n?/g, '').trim())
.toMatchInlineSnapshot(` .toMatchInlineSnapshot(`
".index-module__vy7_gG__home{background:red} ".vy7_gG_home{background:red}
.\\35 5css-module__c9Qeqa__home{color:green}" .c9Qeqa_home{color:green}"
`) `)
} else { } else {
expect( expect(
......
...@@ -28,7 +28,7 @@ describe('CSS Modules Production', () => { ...@@ -28,7 +28,7 @@ describe('CSS Modules Production', () => {
if (isTurbopack) { if (isTurbopack) {
expect( expect(
cssContent.replace(/\/\*.*?\*\//g, '').trim() cssContent.replace(/\/\*.*?\*\//g, '').trim()
).toMatchInlineSnapshot(`".index-module__KWKY6G__redText{color:red}"`) ).toMatchInlineSnapshot(`".KWKY6G_redText{color:red}"`)
} else { } else {
expect( expect(
cssContent.replace(/\/\*.*?\*\//g, '').trim() cssContent.replace(/\/\*.*?\*\//g, '').trim()
...@@ -53,7 +53,7 @@ describe('CSS Modules Production', () => { ...@@ -53,7 +53,7 @@ describe('CSS Modules Production', () => {
if (isTurbopack) { if (isTurbopack) {
expect($('#verify-red').attr('class')).toMatchInlineSnapshot( expect($('#verify-red').attr('class')).toMatchInlineSnapshot(
`"index-module__KWKY6G__redText"` `"KWKY6G_redText"`
) )
} else { } else {
expect($('#verify-red').attr('class')).toMatchInlineSnapshot( expect($('#verify-red').attr('class')).toMatchInlineSnapshot(
...@@ -89,7 +89,7 @@ describe('CSS Modules Production', () => { ...@@ -89,7 +89,7 @@ describe('CSS Modules Production', () => {
expect( expect(
cssContent.replace(/\/\*.*?\*\//g, '').trim() cssContent.replace(/\/\*.*?\*\//g, '').trim()
).toMatchInlineSnapshot( ).toMatchInlineSnapshot(
`".index-module__KWKY6G__foo{position:relative}:is(.index-module__KWKY6G__foo .bar,.index-module__KWKY6G__foo .baz){height:100%;overflow:hidden}.index-module__KWKY6G__foo .lol{width:80%}.index-module__KWKY6G__foo>.lel{width:80%}"` `".KWKY6G_foo{position:relative}:is(.KWKY6G_foo .bar,.KWKY6G_foo .baz){height:100%;overflow:hidden}.KWKY6G_foo .lol{width:80%}.KWKY6G_foo>.lel{width:80%}"`
) )
} else { } else {
expect( expect(
...@@ -117,7 +117,7 @@ describe('CSS Modules Production', () => { ...@@ -117,7 +117,7 @@ describe('CSS Modules Production', () => {
if (isTurbopack) { if (isTurbopack) {
expect($('#verify-div').attr('class')).toMatchInlineSnapshot( expect($('#verify-div').attr('class')).toMatchInlineSnapshot(
`"index-module__KWKY6G__foo"` `"KWKY6G_foo"`
) )
} else { } else {
expect($('#verify-div').attr('class')).toMatchInlineSnapshot( expect($('#verify-div').attr('class')).toMatchInlineSnapshot(
...@@ -203,7 +203,7 @@ describe('CSS Modules Production', () => { ...@@ -203,7 +203,7 @@ describe('CSS Modules Production', () => {
const cssPreload = $('#nm-div') const cssPreload = $('#nm-div')
if (isTurbopack) { if (isTurbopack) {
expect(cssPreload.text()).toMatchInlineSnapshot( expect(cssPreload.text()).toMatchInlineSnapshot(
`"{"message":"Why hello there","default":{"message":"Why hello there"}} {"redText":"index-module__PIKFPa__redText","default":{"redText":"index-module__PIKFPa__redText"}}"` `"{"message":"Why hello there","default":{"message":"Why hello there"}} {"redText":"PIKFPa_redText","default":{"redText":"PIKFPa_redText"}}"`
) )
} else { } else {
expect(cssPreload.text()).toMatchInlineSnapshot( expect(cssPreload.text()).toMatchInlineSnapshot(
...@@ -224,7 +224,7 @@ describe('CSS Modules Production', () => { ...@@ -224,7 +224,7 @@ describe('CSS Modules Production', () => {
if (isTurbopack) { if (isTurbopack) {
expect( expect(
cssContent.replace(/\/\*.*?\*\//g, '').trim() cssContent.replace(/\/\*.*?\*\//g, '').trim()
).toMatchInlineSnapshot(`".index-module__PIKFPa__redText{color:red}"`) ).toMatchInlineSnapshot(`".PIKFPa_redText{color:red}"`)
} else { } else {
expect( expect(
cssContent.replace(/\/\*.*?\*\//g, '').trim() cssContent.replace(/\/\*.*?\*\//g, '').trim()
...@@ -310,7 +310,7 @@ describe('CSS Modules Production', () => { ...@@ -310,7 +310,7 @@ describe('CSS Modules Production', () => {
expect( expect(
cssContent.replace(/\/\*.*?\*\//g, '').trim() cssContent.replace(/\/\*.*?\*\//g, '').trim()
).toMatchInlineSnapshot( ).toMatchInlineSnapshot(
`".index-module__KWKY6G__className{color:#ff0;background:red}.index-module__KWKY6G__subClass{background:#00f;}"` `".KWKY6G_className{color:#ff0;background:red}.KWKY6G_subClass{background:#00f;}"`
) )
} else { } else {
expect( expect(
...@@ -400,7 +400,7 @@ describe('CSS Modules Production', () => { ...@@ -400,7 +400,7 @@ describe('CSS Modules Production', () => {
if (isTurbopack) { if (isTurbopack) {
expect( expect(
cssContent.replace(/\/\*.*?\*\//g, '').trim() cssContent.replace(/\/\*.*?\*\//g, '').trim()
).toMatchInlineSnapshot(`".index-module__9fTRMq__home{background:red}"`) ).toMatchInlineSnapshot(`"._9fTRMq_home{background:red}"`)
} else { } else {
expect( expect(
cssContent.replace(/\/\*.*?\*\//g, '').trim() cssContent.replace(/\/\*.*?\*\//g, '').trim()
...@@ -447,8 +447,8 @@ describe('CSS Modules Production', () => { ...@@ -447,8 +447,8 @@ describe('CSS Modules Production', () => {
if (isTurbopack) { if (isTurbopack) {
expect(cssContent.replace(/\/\*.*?\*\/\n?/g, '').trim()) expect(cssContent.replace(/\/\*.*?\*\/\n?/g, '').trim())
.toMatchInlineSnapshot(` .toMatchInlineSnapshot(`
".index-module__vy7_gG__home{background:red} ".vy7_gG_home{background:red}
.\\35 5css-module__c9Qeqa__home{color:green}" .c9Qeqa_home{color:green}"
`) `)
} else { } else {
expect( expect(
......
...@@ -43,6 +43,7 @@ pub struct CssModule { ...@@ -43,6 +43,7 @@ pub struct CssModule {
ty: CssModuleType, ty: CssModuleType,
environment: Option<ResolvedVc<Environment>>, environment: Option<ResolvedVc<Environment>>,
lightningcss_features: LightningCssFeatureFlags, lightningcss_features: LightningCssFeatureFlags,
module_css_debuggable_idents: bool,
/// The path of `source`, precomputed so that `ResolveOrigin::origin_path` is synchronous. /// The path of `source`, precomputed so that `ResolveOrigin::origin_path` is synchronous.
origin_path: FileSystemPath, origin_path: FileSystemPath,
} }
...@@ -58,6 +59,7 @@ impl CssModule { ...@@ -58,6 +59,7 @@ impl CssModule {
import_context: Option<ResolvedVc<ImportContext>>, import_context: Option<ResolvedVc<ImportContext>>,
environment: Option<ResolvedVc<Environment>>, environment: Option<ResolvedVc<Environment>>,
lightningcss_features: LightningCssFeatureFlags, lightningcss_features: LightningCssFeatureFlags,
module_css_debuggable_idents: bool,
) -> Result<Vc<Self>> { ) -> Result<Vc<Self>> {
Ok(Self::cell(CssModule { Ok(Self::cell(CssModule {
origin_path: source.ident().await?.path.clone(), origin_path: source.ident().await?.path.clone(),
...@@ -67,6 +69,7 @@ impl CssModule { ...@@ -67,6 +69,7 @@ impl CssModule {
ty, ty,
environment, environment,
lightningcss_features, lightningcss_features,
module_css_debuggable_idents,
})) }))
} }
...@@ -90,6 +93,7 @@ impl ParseCss for CssModule { ...@@ -90,6 +93,7 @@ impl ParseCss for CssModule {
this.ty, this.ty,
this.environment.as_deref().copied(), this.environment.as_deref().copied(),
this.lightningcss_features, this.lightningcss_features,
this.module_css_debuggable_idents,
)) ))
} }
} }
......
...@@ -369,6 +369,7 @@ pub async fn parse_css( ...@@ -369,6 +369,7 @@ pub async fn parse_css(
ty: CssModuleType, ty: CssModuleType,
environment: Option<ResolvedVc<Environment>>, environment: Option<ResolvedVc<Environment>>,
feature_flags: LightningCssFeatureFlags, feature_flags: LightningCssFeatureFlags,
module_css_debuggable_idents: bool,
) -> Result<Vc<ParseCssResult>> { ) -> Result<Vc<ParseCssResult>> {
let span = tracing::info_span!( let span = tracing::info_span!(
"parse css", "parse css",
...@@ -394,6 +395,7 @@ pub async fn parse_css( ...@@ -394,6 +395,7 @@ pub async fn parse_css(
ty, ty,
environment, environment,
feature_flags, feature_flags,
module_css_debuggable_idents,
) )
.await? .await?
} }
...@@ -466,6 +468,7 @@ async fn process_content( ...@@ -466,6 +468,7 @@ async fn process_content(
ty: CssModuleType, ty: CssModuleType,
environment: Option<ResolvedVc<Environment>>, environment: Option<ResolvedVc<Environment>>,
feature_flags: LightningCssFeatureFlags, feature_flags: LightningCssFeatureFlags,
module_css_debuggable_idents: bool,
) -> Result<Vc<ParseCssResult>> { ) -> Result<Vc<ParseCssResult>> {
#[allow(clippy::needless_lifetimes)] #[allow(clippy::needless_lifetimes)]
fn without_warnings<'i>(config: ParserOptions<'i>) -> ParserOptions<'static> { fn without_warnings<'i>(config: ParserOptions<'i>) -> ParserOptions<'static> {
...@@ -497,13 +500,21 @@ async fn process_content( ...@@ -497,13 +500,21 @@ async fn process_content(
css_modules: match ty { css_modules: match ty {
CssModuleType::Module => Some(lightningcss::css_modules::Config { CssModuleType::Module => Some(lightningcss::css_modules::Config {
pattern: Pattern { pattern: Pattern {
segments: smallvec![ segments: if module_css_debuggable_idents {
Segment::Name, smallvec![
Segment::Literal(Cow::Borrowed("__")), Segment::Name,
Segment::Hash, Segment::Literal(Cow::Borrowed("__")),
Segment::Literal(Cow::Borrowed("__")), Segment::Hash,
Segment::Local, Segment::Literal(Cow::Borrowed("__")),
], Segment::Local,
]
} else {
smallvec![
Segment::Hash,
Segment::Literal(Cow::Borrowed("_")),
Segment::Local,
]
},
}, },
dashed_idents: false, dashed_idents: false,
grid: false, grid: false,
......
/* [project]/turbopack/crates/turbopack-tests/tests/snapshot/css/css-modules/input/style.module.css [test] (css) */ /* [project]/turbopack/crates/turbopack-tests/tests/snapshot/css/css-modules/input/style.module.css [test] (css) */
.style-module__cu3fEW__module-style { .cu3fEW_module-style {
grid-template-areas: "checkbox avatar content actions menu"; grid-template-areas: "checkbox avatar content actions menu";
} }
......
...@@ -10,7 +10,7 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$ ...@@ -10,7 +10,7 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/css-modules/input/style.module.css [test] (css module)", ((__turbopack_context__) => { "[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/css-modules/input/style.module.css [test] (css module)", ((__turbopack_context__) => {
__turbopack_context__.v({ __turbopack_context__.v({
"module-style": "style-module__cu3fEW__module-style", "module-style": "cu3fEW_module-style",
}); });
}), }),
]); ]);
......
...@@ -3,5 +3,5 @@ ...@@ -3,5 +3,5 @@
"sources": [], "sources": [],
"sections": [ "sections": [
{"offset": {"line": 4, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/css-modules/input/index.js"],"sourcesContent":["import style from './style.module.css'\n\nconsole.log(style, import('./style.module.css'))\n"],"names":["console","log"],"mappings":";AAAA;;AAEAA,QAAQC,GAAG,CAAC,0NAAK"}}, {"offset": {"line": 4, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/css-modules/input/index.js"],"sourcesContent":["import style from './style.module.css'\n\nconsole.log(style, import('./style.module.css'))\n"],"names":["console","log"],"mappings":";AAAA;;AAEAA,QAAQC,GAAG,CAAC,0NAAK"}},
{"offset": {"line": 11, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/css-modules/input/style.module.css [test] (css module)"],"sourcesContent":["__turbopack_context__.v({\n \"module-style\": \"style-module__cu3fEW__module-style\",\n});\n"],"names":[],"mappings":"AAAA;AACA;AACA"}}] {"offset": {"line": 11, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/css-modules/input/style.module.css [test] (css module)"],"sourcesContent":["__turbopack_context__.v({\n \"module-style\": \"cu3fEW_module-style\",\n});\n"],"names":[],"mappings":"AAAA;AACA;AACA"}}]
} }
\ No newline at end of file
...@@ -24,24 +24,24 @@ ...@@ -24,24 +24,24 @@
} }
/* [project]/turbopack/crates/turbopack-tests/tests/snapshot/css/css/input/node_modules/foo/style.module.css [test] (css) */ /* [project]/turbopack/crates/turbopack-tests/tests/snapshot/css/css/input/node_modules/foo/style.module.css [test] (css) */
.style-module__CEkn7G__foo-module-style { .CEkn7G_foo-module-style {
color: #00f; color: #00f;
} }
/* [project]/turbopack/crates/turbopack-tests/tests/snapshot/css/css/input/style.module.css [test] (css) */ /* [project]/turbopack/crates/turbopack-tests/tests/snapshot/css/css/input/style.module.css [test] (css) */
.style-module__Iu_hLa__module-style { .Iu_hLa_module-style {
color: #f0f; color: #f0f;
} }
.style-module__Iu_hLa__module-style > h1, .style-module__Iu_hLa__module-style + .style-module__Iu_hLa__inner { .Iu_hLa_module-style > h1, .Iu_hLa_module-style + .Iu_hLa_inner {
background: purple; background: purple;
} }
.style-module__Iu_hLa__composed-module-style { .Iu_hLa_composed-module-style {
color: green; color: green;
} }
.style-module__Iu_hLa__another-composed-module-style { .Iu_hLa_another-composed-module-style {
color: #ff0; color: #ff0;
} }
......
...@@ -15,16 +15,16 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$ ...@@ -15,16 +15,16 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/css/input/node_modules/foo/style.module.css [test] (css module)", ((__turbopack_context__) => { "[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/css/input/node_modules/foo/style.module.css [test] (css module)", ((__turbopack_context__) => {
__turbopack_context__.v({ __turbopack_context__.v({
"foo-module-style": "style-module__CEkn7G__foo-module-style", "foo-module-style": "CEkn7G_foo-module-style",
}); });
}), }),
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/css/input/style.module.css [test] (css module)", ((__turbopack_context__) => { "[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/css/input/style.module.css [test] (css module)", ((__turbopack_context__) => {
__turbopack_context__.v({ __turbopack_context__.v({
"another-composed-module-style": "style-module__Iu_hLa__another-composed-module-style" + " " + __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/css/input/node_modules/foo/style.module.css [test] (css module)")["foo-module-style"], "another-composed-module-style": "Iu_hLa_another-composed-module-style" + " " + __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/css/input/node_modules/foo/style.module.css [test] (css module)")["foo-module-style"],
"composed-module-style": "style-module__Iu_hLa__composed-module-style" + " " + __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/css/input/node_modules/foo/style.module.css [test] (css module)")["foo-module-style"], "composed-module-style": "Iu_hLa_composed-module-style" + " " + __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/css/input/node_modules/foo/style.module.css [test] (css module)")["foo-module-style"],
"inner": "style-module__Iu_hLa__inner", "inner": "Iu_hLa_inner",
"module-style": "style-module__Iu_hLa__module-style", "module-style": "Iu_hLa_module-style",
}); });
}), }),
]); ]);
......
...@@ -3,6 +3,6 @@ ...@@ -3,6 +3,6 @@
"sources": [], "sources": [],
"sections": [ "sections": [
{"offset": {"line": 4, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/css/input/index.js"],"sourcesContent":["import 'foo/style.css'\nimport 'foo'\nimport './style.css'\nimport fooStyle from 'foo/style.module.css'\nimport style from './style.module.css'\n\nconsole.log(style, fooStyle, import('foo'))\n"],"names":["console","log"],"mappings":";AAGA;AACA;;;;;;AAEAA,QAAQC,GAAG,CAAC,+MAAK,EAAE,sOAAQ"}}, {"offset": {"line": 4, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/css/input/index.js"],"sourcesContent":["import 'foo/style.css'\nimport 'foo'\nimport './style.css'\nimport fooStyle from 'foo/style.module.css'\nimport style from './style.module.css'\n\nconsole.log(style, fooStyle, import('foo'))\n"],"names":["console","log"],"mappings":";AAGA;AACA;;;;;;AAEAA,QAAQC,GAAG,CAAC,+MAAK,EAAE,sOAAQ"}},
{"offset": {"line": 16, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/css/input/node_modules/foo/style.module.css [test] (css module)"],"sourcesContent":["__turbopack_context__.v({\n \"foo-module-style\": \"style-module__CEkn7G__foo-module-style\",\n});\n"],"names":[],"mappings":"AAAA;AACA;AACA","ignoreList":[0]}}, {"offset": {"line": 16, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/css/input/node_modules/foo/style.module.css [test] (css module)"],"sourcesContent":["__turbopack_context__.v({\n \"foo-module-style\": \"CEkn7G_foo-module-style\",\n});\n"],"names":[],"mappings":"AAAA;AACA;AACA","ignoreList":[0]}},
{"offset": {"line": 22, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/css/input/style.module.css [test] (css module)"],"sourcesContent":["__turbopack_context__.v({\n \"another-composed-module-style\": \"style-module__Iu_hLa__another-composed-module-style\" + \" \" + __turbopack_context__.i(\"[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/css/input/node_modules/foo/style.module.css [test] (css module)\")[\"foo-module-style\"],\n \"composed-module-style\": \"style-module__Iu_hLa__composed-module-style\" + \" \" + __turbopack_context__.i(\"[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/css/input/node_modules/foo/style.module.css [test] (css module)\")[\"foo-module-style\"],\n \"inner\": \"style-module__Iu_hLa__inner\",\n \"module-style\": \"style-module__Iu_hLa__module-style\",\n});\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA"}}] {"offset": {"line": 22, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/css/input/style.module.css [test] (css module)"],"sourcesContent":["__turbopack_context__.v({\n \"another-composed-module-style\": \"Iu_hLa_another-composed-module-style\" + \" \" + __turbopack_context__.i(\"[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/css/input/node_modules/foo/style.module.css [test] (css module)\")[\"foo-module-style\"],\n \"composed-module-style\": \"Iu_hLa_composed-module-style\" + \" \" + __turbopack_context__.i(\"[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/css/input/node_modules/foo/style.module.css [test] (css module)\")[\"foo-module-style\"],\n \"inner\": \"Iu_hLa_inner\",\n \"module-style\": \"Iu_hLa_module-style\",\n});\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA"}}]
} }
\ No newline at end of file
/* [project]/turbopack/crates/turbopack-tests/tests/snapshot/css/embed-url/input/style.module.css [test] (css) */ /* [project]/turbopack/crates/turbopack-tests/tests/snapshot/css/embed-url/input/style.module.css [test] (css) */
.style-module__3oVw9q__module-style { ._3oVw9q_module-style {
cursor: url("../static/image.3mjyqwrpci25r.png"); cursor: url("../static/image.3mjyqwrpci25r.png");
background-image: url("../static/image.3mjyqwrpci25r.png"); background-image: url("../static/image.3mjyqwrpci25r.png");
list-style-image: url("../static/image.3mjyqwrpci25r.png"); list-style-image: url("../static/image.3mjyqwrpci25r.png");
......
...@@ -11,7 +11,7 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$ ...@@ -11,7 +11,7 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/embed-url/input/style.module.css [test] (css module)", ((__turbopack_context__) => { "[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/embed-url/input/style.module.css [test] (css module)", ((__turbopack_context__) => {
__turbopack_context__.v({ __turbopack_context__.v({
"module-style": "style-module__3oVw9q__module-style", "module-style": "_3oVw9q_module-style",
}); });
}), }),
]); ]);
......
...@@ -3,5 +3,5 @@ ...@@ -3,5 +3,5 @@
"sources": [], "sources": [],
"sections": [ "sections": [
{"offset": {"line": 4, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/embed-url/input/index.js"],"sourcesContent":["import style from './style.module.css'\nimport './style.css'\n\nconsole.log(style, import('./style.module.css'), import('./style.css'))\n"],"names":["console","log"],"mappings":";AAAA;;;AAGAA,QAAQC,GAAG,CAAC,wNAAK"}}, {"offset": {"line": 4, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/embed-url/input/index.js"],"sourcesContent":["import style from './style.module.css'\nimport './style.css'\n\nconsole.log(style, import('./style.module.css'), import('./style.css'))\n"],"names":["console","log"],"mappings":";AAAA;;;AAGAA,QAAQC,GAAG,CAAC,wNAAK"}},
{"offset": {"line": 12, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/embed-url/input/style.module.css [test] (css module)"],"sourcesContent":["__turbopack_context__.v({\n \"module-style\": \"style-module__3oVw9q__module-style\",\n});\n"],"names":[],"mappings":"AAAA;AACA;AACA"}}] {"offset": {"line": 12, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/embed-url/input/style.module.css [test] (css module)"],"sourcesContent":["__turbopack_context__.v({\n \"module-style\": \"_3oVw9q_module-style\",\n});\n"],"names":[],"mappings":"AAAA;AACA;AACA"}}]
} }
\ No newline at end of file
.style{color:#ff0} .style{color:#ff0}
.style-module__1v6dfa__module-style{color:#f0f}.style-module__1v6dfa__module-style>h1,.style-module__1v6dfa__module-style+.style-module__1v6dfa__inner{background:purple} ._1v6dfa_module-style{color:#f0f}._1v6dfa_module-style>h1,._1v6dfa_module-style+._1v6dfa_inner{background:purple}
/*# sourceMappingURL=1do3_crates_turbopack-tests_tests_snapshot_css_minification_input_0sk3hln-l5sj4._.css.map*/ /*# sourceMappingURL=1do3_crates_turbopack-tests_tests_snapshot_css_minification_input_0sk3hln-l5sj4._.css.map*/
\ No newline at end of file
...@@ -3,5 +3,5 @@ ...@@ -3,5 +3,5 @@
"sources": [], "sources": [],
"sections": [ "sections": [
{"offset": {"line": 0, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/minification/input/style.css"],"sourcesContent":[".style {\n color: yellow;\n}\n"],"names":[],"mappings":"AAAA"}}, {"offset": {"line": 0, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/minification/input/style.css"],"sourcesContent":[".style {\n color: yellow;\n}\n"],"names":[],"mappings":"AAAA"}},
{"offset": {"line": 1, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/minification/input/style.module.css"],"sourcesContent":[".module-style {\n color: magenta;\n > h1,\n + .inner {\n background: purple;\n }\n}\n"],"names":[],"mappings":"AAAA,+CAEE"}}] {"offset": {"line": 1, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/minification/input/style.module.css"],"sourcesContent":[".module-style {\n color: magenta;\n > h1,\n + .inner {\n background: purple;\n }\n}\n"],"names":[],"mappings":"AAAA,iCAEE"}}]
} }
\ No newline at end of file
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["output/1do3_crates_turbopack-tests_tests_snapshot_css_minification_input_1x1qn-bq9_gdc._.js","[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/minification/input/index.js [test] (ecmascript)",s=>{"use strict";s.s([]),console.log(s.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/minification/input/style.module.css [test] (css module)").default)},"[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/minification/input/style.module.css [test] (css module)",s=>{s.v({inner:"style-module__1v6dfa__inner","module-style":"style-module__1v6dfa__module-style"})}]); (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["output/1do3_crates_turbopack-tests_tests_snapshot_css_minification_input_1x1qn-bq9_gdc._.js","[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/minification/input/index.js [test] (ecmascript)",s=>{"use strict";s.s([]),console.log(s.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/minification/input/style.module.css [test] (css module)").default)},"[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/minification/input/style.module.css [test] (css module)",s=>{s.v({inner:"_1v6dfa_inner","module-style":"_1v6dfa_module-style"})}]);
//# sourceMappingURL=1do3_crates_turbopack-tests_tests_snapshot_css_minification_input_1x1qn-bq9_gdc._.js.map //# sourceMappingURL=1do3_crates_turbopack-tests_tests_snapshot_css_minification_input_1x1qn-bq9_gdc._.js.map
\ No newline at end of file
{"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/minification/input/index.js","turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/minification/input/style.module.css [test] (css module)"],"sourcesContent":["import './style.css'\nimport style from './style.module.css'\n\nconsole.log(style)\n","__turbopack_context__.v({\n \"inner\": \"style-module__1v6dfa__inner\",\n \"module-style\": \"style-module__1v6dfa__module-style\",\n});\n"],"names":["console","log"],"mappings":"+RAGAA,QAAQC,GAAG,CAFX,AAEY,EAFZ,CAAA,CAAA,yHAEY,OAAK,+HCHjB,EAAA,CAAA,CAAA,CACA,MAAA,8BACA,eAAA,oCACA"} {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/minification/input/index.js","turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/minification/input/style.module.css [test] (css module)"],"sourcesContent":["import './style.css'\nimport style from './style.module.css'\n\nconsole.log(style)\n","__turbopack_context__.v({\n \"inner\": \"_1v6dfa_inner\",\n \"module-style\": \"_1v6dfa_module-style\",\n});\n"],"names":["console","log"],"mappings":"+RAGAA,QAAQC,GAAG,CAFX,AAEY,EAFZ,CAAA,CAAA,yHAEY,OAAK,+HCHjB,EAAA,CAAA,CAAA,CACA,MAAA,gBACA,eAAA,sBACA"}
\ No newline at end of file \ No newline at end of file
...@@ -9,8 +9,8 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbo ...@@ -9,8 +9,8 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbo
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/cssmodules/composes/input/index.module.css [test] (css module)", ((__turbopack_context__) => { "[project]/turbopack/crates/turbopack-tests/tests/snapshot/cssmodules/composes/input/index.module.css [test] (css module)", ((__turbopack_context__) => {
__turbopack_context__.v({ __turbopack_context__.v({
"className": "index-module__H6xp9G__className", "className": "H6xp9G_className",
"subClass": "index-module__H6xp9G__subClass" + " " + "index-module__H6xp9G__className", "subClass": "H6xp9G_subClass" + " " + "H6xp9G_className",
}); });
}), }),
]); ]);
......
...@@ -3,5 +3,5 @@ ...@@ -3,5 +3,5 @@
"sources": [], "sources": [],
"sections": [ "sections": [
{"offset": {"line": 4, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/cssmodules/composes/input/index.js"],"sourcesContent":["import { subClass } from './index.module.css'\n"],"names":[],"mappings":";AAAA"}}, {"offset": {"line": 4, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/cssmodules/composes/input/index.js"],"sourcesContent":["import { subClass } from './index.module.css'\n"],"names":[],"mappings":";AAAA"}},
{"offset": {"line": 10, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/cssmodules/composes/input/index.module.css [test] (css module)"],"sourcesContent":["__turbopack_context__.v({\n \"className\": \"index-module__H6xp9G__className\",\n \"subClass\": \"index-module__H6xp9G__subClass\" + \" \" + \"index-module__H6xp9G__className\",\n});\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA"}}] {"offset": {"line": 10, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/cssmodules/composes/input/index.module.css [test] (css module)"],"sourcesContent":["__turbopack_context__.v({\n \"className\": \"H6xp9G_className\",\n \"subClass\": \"H6xp9G_subClass\" + \" \" + \"H6xp9G_className\",\n});\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA"}}]
} }
\ No newline at end of file
/* [project]/turbopack/crates/turbopack-tests/tests/snapshot/cssmodules/composes/input/index.module.css [test] (css) */ /* [project]/turbopack/crates/turbopack-tests/tests/snapshot/cssmodules/composes/input/index.module.css [test] (css) */
.index-module__H6xp9G__className { .H6xp9G_className {
color: #ff0; color: #ff0;
background: red; background: red;
} }
.index-module__H6xp9G__subClass { .H6xp9G_subClass {
background: #00f; background: #00f;
} }
......
...@@ -9,13 +9,13 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbo ...@@ -9,13 +9,13 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbo
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/cssmodules/relative-uri-import/input/index.module.css [test] (css module)", ((__turbopack_context__) => { "[project]/turbopack/crates/turbopack-tests/tests/snapshot/cssmodules/relative-uri-import/input/index.module.css [test] (css module)", ((__turbopack_context__) => {
__turbopack_context__.v({ __turbopack_context__.v({
"bar": "index-module__jZ0vmq__bar" + " " + __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/cssmodules/relative-uri-import/input/other.module.css [test] (css module)")["foo"], "bar": "jZ0vmq_bar" + " " + __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/cssmodules/relative-uri-import/input/other.module.css [test] (css module)")["foo"],
}); });
}), }),
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/cssmodules/relative-uri-import/input/other.module.css [test] (css module)", ((__turbopack_context__) => { "[project]/turbopack/crates/turbopack-tests/tests/snapshot/cssmodules/relative-uri-import/input/other.module.css [test] (css module)", ((__turbopack_context__) => {
__turbopack_context__.v({ __turbopack_context__.v({
"foo": "other-module__NjlEuq__foo", "foo": "NjlEuq_foo",
}); });
}), }),
]); ]);
......
...@@ -3,6 +3,6 @@ ...@@ -3,6 +3,6 @@
"sources": [], "sources": [],
"sections": [ "sections": [
{"offset": {"line": 4, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/cssmodules/relative-uri-import/input/index.js"],"sourcesContent":["import { foo } from './index.module.css'\n"],"names":[],"mappings":";AAAA"}}, {"offset": {"line": 4, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/cssmodules/relative-uri-import/input/index.js"],"sourcesContent":["import { foo } from './index.module.css'\n"],"names":[],"mappings":";AAAA"}},
{"offset": {"line": 10, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/cssmodules/relative-uri-import/input/index.module.css [test] (css module)"],"sourcesContent":["__turbopack_context__.v({\n \"bar\": \"index-module__jZ0vmq__bar\" + \" \" + __turbopack_context__.i(\"[project]/turbopack/crates/turbopack-tests/tests/snapshot/cssmodules/relative-uri-import/input/other.module.css [test] (css module)\")[\"foo\"],\n});\n"],"names":[],"mappings":"AAAA;AACA;AACA"}}, {"offset": {"line": 10, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/cssmodules/relative-uri-import/input/index.module.css [test] (css module)"],"sourcesContent":["__turbopack_context__.v({\n \"bar\": \"jZ0vmq_bar\" + \" \" + __turbopack_context__.i(\"[project]/turbopack/crates/turbopack-tests/tests/snapshot/cssmodules/relative-uri-import/input/other.module.css [test] (css module)\")[\"foo\"],\n});\n"],"names":[],"mappings":"AAAA;AACA;AACA"}},
{"offset": {"line": 16, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/cssmodules/relative-uri-import/input/other.module.css [test] (css module)"],"sourcesContent":["__turbopack_context__.v({\n \"foo\": \"other-module__NjlEuq__foo\",\n});\n"],"names":[],"mappings":"AAAA;AACA;AACA"}}] {"offset": {"line": 16, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/cssmodules/relative-uri-import/input/other.module.css [test] (css module)"],"sourcesContent":["__turbopack_context__.v({\n \"foo\": \"NjlEuq_foo\",\n});\n"],"names":[],"mappings":"AAAA;AACA;AACA"}}]
} }
\ No newline at end of file
/* [project]/turbopack/crates/turbopack-tests/tests/snapshot/cssmodules/relative-uri-import/input/other.module.css [test] (css) */ /* [project]/turbopack/crates/turbopack-tests/tests/snapshot/cssmodules/relative-uri-import/input/other.module.css [test] (css) */
.other-module__NjlEuq__foo { .NjlEuq_foo {
background-color: red; background-color: red;
} }
/* [project]/turbopack/crates/turbopack-tests/tests/snapshot/cssmodules/relative-uri-import/input/index.module.css [test] (css) */ /* [project]/turbopack/crates/turbopack-tests/tests/snapshot/cssmodules/relative-uri-import/input/index.module.css [test] (css) */
.index-module__jZ0vmq__bar { .jZ0vmq_bar {
} }
......
...@@ -255,6 +255,7 @@ async fn apply_module_type( ...@@ -255,6 +255,7 @@ async fn apply_module_type(
ty, ty,
environment, environment,
lightningcss_features, lightningcss_features,
module_css_debuggable_idents,
} => ResolvedVc::upcast( } => ResolvedVc::upcast(
CssModule::new( CssModule::new(
*source, *source,
...@@ -263,6 +264,7 @@ async fn apply_module_type( ...@@ -263,6 +264,7 @@ async fn apply_module_type(
css_import_context.map(|c| *c), css_import_context.map(|c| *c),
environment.as_deref().copied(), environment.as_deref().copied(),
*lightningcss_features, *lightningcss_features,
*module_css_debuggable_idents,
) )
.to_resolved() .to_resolved()
.await?, .await?,
......
...@@ -260,6 +260,7 @@ impl ModuleOptions { ...@@ -260,6 +260,7 @@ impl ModuleOptions {
source_maps: css_source_maps, source_maps: css_source_maps,
ref module_css_condition, ref module_css_condition,
lightningcss_features, lightningcss_features,
module_css_debuggable_idents,
.. ..
}, },
ref static_url_tag, ref static_url_tag,
...@@ -861,6 +862,7 @@ impl ModuleOptions { ...@@ -861,6 +862,7 @@ impl ModuleOptions {
ty: CssModuleType::Module, ty: CssModuleType::Module,
environment, environment,
lightningcss_features, lightningcss_features,
module_css_debuggable_idents,
})], })],
), ),
ModuleRule::new( ModuleRule::new(
...@@ -872,6 +874,7 @@ impl ModuleOptions { ...@@ -872,6 +874,7 @@ impl ModuleOptions {
ty: CssModuleType::Default, ty: CssModuleType::Default,
environment, environment,
lightningcss_features, lightningcss_features,
module_css_debuggable_idents,
})], })],
), ),
]); ]);
...@@ -936,6 +939,7 @@ impl ModuleOptions { ...@@ -936,6 +939,7 @@ impl ModuleOptions {
ty: CssModuleType::Module, ty: CssModuleType::Module,
environment, environment,
lightningcss_features, lightningcss_features,
module_css_debuggable_idents,
})], })],
), ),
// Ecmascript CSS Modules referencing the actual CSS module to include it // Ecmascript CSS Modules referencing the actual CSS module to include it
...@@ -950,6 +954,7 @@ impl ModuleOptions { ...@@ -950,6 +954,7 @@ impl ModuleOptions {
ty: CssModuleType::Module, ty: CssModuleType::Module,
environment, environment,
lightningcss_features, lightningcss_features,
module_css_debuggable_idents,
})], })],
), ),
// Ecmascript CSS Modules referencing the actual CSS module to list the classes // Ecmascript CSS Modules referencing the actual CSS module to list the classes
...@@ -964,6 +969,7 @@ impl ModuleOptions { ...@@ -964,6 +969,7 @@ impl ModuleOptions {
ty: CssModuleType::Module, ty: CssModuleType::Module,
environment, environment,
lightningcss_features, lightningcss_features,
module_css_debuggable_idents,
})], })],
), ),
ModuleRule::new( ModuleRule::new(
...@@ -979,6 +985,7 @@ impl ModuleOptions { ...@@ -979,6 +985,7 @@ impl ModuleOptions {
ty: CssModuleType::Default, ty: CssModuleType::Default,
environment, environment,
lightningcss_features, lightningcss_features,
module_css_debuggable_idents,
})], })],
), ),
]); ]);
......
...@@ -317,6 +317,9 @@ pub struct CssOptionsContext { ...@@ -317,6 +317,9 @@ pub struct CssOptionsContext {
/// User-specified lightningcss feature flags (include/exclude bitmasks). /// User-specified lightningcss feature flags (include/exclude bitmasks).
pub lightningcss_features: turbopack_css::LightningCssFeatureFlags, pub lightningcss_features: turbopack_css::LightningCssFeatureFlags,
/// Include the file name in CSS Module class names for easier debugging.
pub module_css_debuggable_idents: bool,
pub placeholder_for_future_extensions: (), pub placeholder_for_future_extensions: (),
} }
......
...@@ -143,6 +143,7 @@ pub enum ModuleType { ...@@ -143,6 +143,7 @@ pub enum ModuleType {
ty: CssModuleType, ty: CssModuleType,
environment: Option<ResolvedVc<Environment>>, environment: Option<ResolvedVc<Environment>>,
lightningcss_features: turbopack_css::LightningCssFeatureFlags, lightningcss_features: turbopack_css::LightningCssFeatureFlags,
module_css_debuggable_idents: bool,
}, },
StaticUrlJs { StaticUrlJs {
/// The tag that is passed to ChunkingContext::asset_url /// The tag that is passed to ChunkingContext::asset_url
...@@ -283,6 +284,8 @@ impl ConfiguredModuleType { ...@@ -283,6 +284,8 @@ impl ConfiguredModuleType {
ty: CssModuleType::Default, ty: CssModuleType::Default,
environment, environment,
lightningcss_features, lightningcss_features,
// This is global CSS, so the CSS Module naming pattern is unused.
module_css_debuggable_idents: false,
}), }),
ConfiguredModuleType::CssModule => ModuleRuleEffect::ModuleType(ModuleType::CssModule), ConfiguredModuleType::CssModule => ModuleRuleEffect::ModuleType(ModuleType::CssModule),
ConfiguredModuleType::Json => { ConfiguredModuleType::Json => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment