diff --git a/docs/api-reference/next.config.js/headers.md b/docs/api-reference/next.config.js/headers.md index d64c01c676b79..9cc6183514580 100644 --- a/docs/api-reference/next.config.js/headers.md +++ b/docs/api-reference/next.config.js/headers.md @@ -83,7 +83,7 @@ module.exports = { }, ], }, - ], + ] }, } ``` @@ -109,7 +109,7 @@ module.exports = { }, ], }, - ], + ] }, } ``` @@ -135,7 +135,7 @@ module.exports = { }, ], }, - ], + ] }, } ``` @@ -157,7 +157,7 @@ module.exports = { }, ], }, - ], + ] }, } ``` diff --git a/packages/next/build/swc/src/styled_jsx/mod.rs b/packages/next/build/swc/src/styled_jsx/mod.rs index 2a6c318758559..2abf9985e7a60 100644 --- a/packages/next/build/swc/src/styled_jsx/mod.rs +++ b/packages/next/build/swc/src/styled_jsx/mod.rs @@ -419,7 +419,7 @@ impl StyledJSXTransformer { let placeholder = if i == quasis.len() - 1 { String::new() } else { - format!("__styled-jsx-placeholder__{}", i) + format!("__styled-jsx-placeholder-{}__", i) }; s = format!("{}{}{}", s, quasis[i].raw.value, placeholder) } diff --git a/packages/next/build/swc/src/styled_jsx/transform_css.rs b/packages/next/build/swc/src/styled_jsx/transform_css.rs index 4288f05669d13..b998b4548af1b 100644 --- a/packages/next/build/swc/src/styled_jsx/transform_css.rs +++ b/packages/next/build/swc/src/styled_jsx/transform_css.rs @@ -74,12 +74,12 @@ pub fn transform_css( return Ok(string_literal_expr(&s)); } - let mut parts: Vec<&str> = s.split("__styled-jsx-placeholder__").collect(); + let mut parts: Vec<&str> = s.split("__styled-jsx-placeholder-").collect(); let mut final_expressions = vec![]; for i in 1..parts.len() { let (num_len, expression_index) = read_number(&parts[i]); final_expressions.push(style_info.expressions[expression_index].clone()); - let substr = &parts[i][num_len..]; + let substr = &parts[i][(num_len + 2)..]; parts[i] = substr; } diff --git a/packages/next/build/swc/tests/fixture/styled-jsx/number-after-placeholder/input.js b/packages/next/build/swc/tests/fixture/styled-jsx/number-after-placeholder/input.js new file mode 100644 index 0000000000000..99aecf43d93d8 --- /dev/null +++ b/packages/next/build/swc/tests/fixture/styled-jsx/number-after-placeholder/input.js @@ -0,0 +1,17 @@ +import Link from "next/link"; + +export default function IndexPage() { + return ( +
+ Hello World.{" "} + + Abound + + +
+ ); +} \ No newline at end of file diff --git a/packages/next/build/swc/tests/fixture/styled-jsx/number-after-placeholder/output.js b/packages/next/build/swc/tests/fixture/styled-jsx/number-after-placeholder/output.js new file mode 100644 index 0000000000000..f506959dc6cd1 --- /dev/null +++ b/packages/next/build/swc/tests/fixture/styled-jsx/number-after-placeholder/output.js @@ -0,0 +1,17 @@ +import _JSXStyle from "styled-jsx/style"; +import Link from "next/link"; +export default function IndexPage() { + return
+ + Hello World.{" "} + + + + Abound + + + + <_JSXStyle id={"bc8a8bae32099ce8"}>{`a.jsx-bc8a8bae32099ce8 {color:${"#abcdef"}12}`} + +
; +}; diff --git a/packages/next/native/next-swc.darwin-arm64.node b/packages/next/native/next-swc.darwin-arm64.node index e4fd9ee77bbaf..5cf8ec0ff627a 100644 Binary files a/packages/next/native/next-swc.darwin-arm64.node and b/packages/next/native/next-swc.darwin-arm64.node differ diff --git a/packages/next/native/next-swc.darwin-x64.node b/packages/next/native/next-swc.darwin-x64.node index e77aa182eb1b7..2b04246cb1548 100644 Binary files a/packages/next/native/next-swc.darwin-x64.node and b/packages/next/native/next-swc.darwin-x64.node differ diff --git a/packages/next/native/next-swc.linux-x64-gnu.node b/packages/next/native/next-swc.linux-x64-gnu.node index 46988d4ce3af1..f334eb0d8cc12 100644 Binary files a/packages/next/native/next-swc.linux-x64-gnu.node and b/packages/next/native/next-swc.linux-x64-gnu.node differ diff --git a/packages/next/native/next-swc.win32-x64-msvc.node b/packages/next/native/next-swc.win32-x64-msvc.node index 432b45131dafd..4f2dec354fc2c 100644 Binary files a/packages/next/native/next-swc.win32-x64-msvc.node and b/packages/next/native/next-swc.win32-x64-msvc.node differ