-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <_JSXStyle id={"abb4c2202db1a207"}>{"div.jsx-abb4c2202db1a207{color:red}"}
-
- ;
-});
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/attribute-generation-modes/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/attribute-generation-modes/input.js
deleted file mode 100644
index 1454a4c30cda1..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/attribute-generation-modes/input.js
+++ /dev/null
@@ -1,166 +0,0 @@
-import styles from './styles'
-
-const styles2 = require('./styles2')
-
-// external only
-export const Test1 = () => (
-
-)
-
-// external and static
-export const Test2 = () => (
-
-
external and static
-
-
-
-)
-
-// external and dynamic
-export const Test3 = ({ color }) => (
-
-
external and dynamic
-
-
-
-)
-
-// external, static and dynamic
-export const Test4 = ({ color }) => (
-
-
external, static and dynamic
-
-
-
-
-)
-
-// static only
-export const Test5 = () => (
-
-)
-
-// static and dynamic
-export const Test6 = ({ color }) => (
-
-
static and dynamic
-
-
-
-)
-
-// dynamic only
-export const Test7 = ({ color }) => (
-
-)
-
-// dynamic with scoped compound variable
-export const Test8 = ({ color }) => {
- if (color) {
- const innerProps = { color }
-
- return (
-
-
dynamic with scoped compound variable
-
-
- )
- }
-}
-
-// dynamic with compound variable
-export const Test9 = ({ color }) => {
- const innerProps = { color }
-
- return (
-
-
dynamic with compound variable
-
-
- )
-}
-
-const foo = 'red'
-
-// dynamic with constant variable
-export const Test10 = () => (
-
-
dynamic with constant variable
-
-
-)
-
-// dynamic with complex scope
-export const Test11 = ({ color }) => {
- const items = Array.from({ length: 5 }).map((item, i) => (
-
-
- Item #{i + 1}
-
- ))
-
- return
-}
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/attribute-generation-modes/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/attribute-generation-modes/output.js
deleted file mode 100644
index 92e7f7bfe84c1..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/attribute-generation-modes/output.js
+++ /dev/null
@@ -1,228 +0,0 @@
-import _JSXStyle from "styled-jsx/style";
-import styles from './styles';
-const styles2 = require('./styles2');
-// external only
-export const Test1 = ()=>
-
-
external only
-
- <_JSXStyle id={styles.__hash}>{styles}
-
- <_JSXStyle id={styles2.__hash}>{styles2}
-
-
;
-// external and static
-export const Test2 = ()=>
-
-
external and static
-
- <_JSXStyle id={"81a68341e430a972"}>{"p.jsx-81a68341e430a972{color:red}"}
-
- <_JSXStyle id={styles.__hash}>{styles}
-
-
;
-// external and dynamic
-export const Test3 = ({ color })=>
-
-
external and dynamic
-
- <_JSXStyle id={"f08108daf927b99d"} dynamic={[
- color
- ]}>{`p.__jsx-style-dynamic-selector{color:${color}}`}
-
- <_JSXStyle id={styles.__hash}>{styles}
-
-
;
-// external, static and dynamic
-export const Test4 = ({ color })=>
-
-
external, static and dynamic
-
- <_JSXStyle id={"ceba8c9ce34e3d0c"}>{"p.jsx-ceba8c9ce34e3d0c{display:inline-block}"}
-
- <_JSXStyle id={"9779eebad83219f8"} dynamic={[
- color
- ]}>{`p.__jsx-style-dynamic-selector{color:${color}}`}
-
- <_JSXStyle id={styles.__hash}>{styles}
-
-
;
-// static only
-export const Test5 = ()=>
-
-
static only
-
- <_JSXStyle id={"ceba8c9ce34e3d0c"}>{"p.jsx-df0159ebd3f9fb6f{display:inline-block}"}
-
- <_JSXStyle id={"81a68341e430a972"}>{"p.jsx-df0159ebd3f9fb6f{color:red}"}
-
-
;
-// static and dynamic
-export const Test6 = ({ color })=>
-
-
static and dynamic
-
- <_JSXStyle id={"ceba8c9ce34e3d0c"}>{"p.jsx-ceba8c9ce34e3d0c{display:inline-block}"}
-
- <_JSXStyle id={"9779eebad83219f8"} dynamic={[
- color
- ]}>{`p.__jsx-style-dynamic-selector{color:${color}}`}
-
-
;
-// dynamic only
-export const Test7 = ({ color })=>
-
-
dynamic only
-
- <_JSXStyle id={"f08108daf927b99d"} dynamic={[
- color
- ]}>{`p.__jsx-style-dynamic-selector{color:${color}}`}
-
-
;
-// dynamic with scoped compound variable
-export const Test8 = ({ color })=>{
- if (color) {
- const innerProps = {
- color
- };
- return
-
-
dynamic with scoped compound variable
-
- <_JSXStyle id={"62256c563b89bfae"} dynamic={[
- innerProps.color
- ]}>{`p.__jsx-style-dynamic-selector{color:${innerProps.color}}`}
-
-
;
- }
-};
-// dynamic with compound variable
-export const Test9 = ({ color })=>{
- const innerProps = {
- color
- };
- return
-
-
dynamic with compound variable
-
- <_JSXStyle id={"708723e452f192e4"} dynamic={[
- innerProps.color
- ]}>{`p.__jsx-style-dynamic-selector{color:${innerProps.color}}`}
-
-
;
-};
-const foo = 'red';
-// dynamic with constant variable
-export const Test10 = ()=>
-
-
dynamic with constant variable
-
- <_JSXStyle id={"f849b7a02be96503"}>{`p.jsx-f849b7a02be96503{color:${foo}}`}
-
-
;
-// dynamic with complex scope
-export const Test11 = ({ color })=>{
- const items = Array.from({
- length: 5
- }).map((item, i)=>
-
- <_JSXStyle id={"a2585dff420632b1"} dynamic={[
- color
- ]}>{`.item.__jsx-style-dynamic-selector{color:${color}}`}
-
- Item #{i + 1}
-
- );
- return
;
-};
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/class/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/class/input.js
deleted file mode 100644
index 7488d661bc84c..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/class/input.js
+++ /dev/null
@@ -1,14 +0,0 @@
-export default class {
- render() {
- return (
-
- )
- }
-}
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/class/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/class/output.js
deleted file mode 100644
index cc8252d40c17c..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/class/output.js
+++ /dev/null
@@ -1,12 +0,0 @@
-import _JSXStyle from "styled-jsx/style";
-export default class {
- render() {
- return
-
-
test
-
- <_JSXStyle id={"b2b86d63f35d25ee"}>{"p.jsx-b2b86d63f35d25ee{color:red}"}
-
-
;
- }
-}
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/comments/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/comments/input.js
deleted file mode 100644
index 0ba7a187731c1..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/comments/input.js
+++ /dev/null
@@ -1,18 +0,0 @@
-export default class {
- render() {
- return (
-
- )
- }
-}
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/comments/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/comments/output.js
deleted file mode 100644
index 7e87f083a0a79..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/comments/output.js
+++ /dev/null
@@ -1,12 +0,0 @@
-import _JSXStyle from "styled-jsx/style";
-export default class {
- render() {
- return
-
-
test
-
- <_JSXStyle id={"1952086b0a5ae64c"}>{"p.jsx-1952086b0a5ae64c{color:red}"}
-
-
;
- }
-}
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/component-attribute/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/component-attribute/input.js
deleted file mode 100644
index 7531db885849b..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/component-attribute/input.js
+++ /dev/null
@@ -1,11 +0,0 @@
-const Test = () => (
-
- test
-
-
-
-)
\ No newline at end of file
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/component-attribute/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/component-attribute/output.js
deleted file mode 100644
index cdc5e031093f8..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/component-attribute/output.js
+++ /dev/null
@@ -1,10 +0,0 @@
-import _JSXStyle from "styled-jsx/style";
-const Test = ()=>
-
- test
-
-
-
- <_JSXStyle id={"a9535d7d5f32c3c4"}>{"span.jsx-a9535d7d5f32c3c4{color:red}"}
-
-
;
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/conflicts/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/conflicts/input.js
deleted file mode 100644
index ba7ab50bfe80c..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/conflicts/input.js
+++ /dev/null
@@ -1,16 +0,0 @@
-
-// TODO
-
-// export const _JSXStyle = '_JSXStyle-literal'
-// export default function() {
-// return (
-//
-// )
-// }
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/conflicts/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/conflicts/output.js
deleted file mode 100644
index 874cf34f5305b..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/conflicts/output.js
+++ /dev/null
@@ -1,14 +0,0 @@
-// TODO
-// export const _JSXStyle = '_JSXStyle-literal'
-// export default function() {
-// return (
-//
-// )
-// }
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/css-selector-after-pseudo/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/css-selector-after-pseudo/input.js
deleted file mode 100644
index a2e54d09b1cb5..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/css-selector-after-pseudo/input.js
+++ /dev/null
@@ -1,18 +0,0 @@
-function NavigationItem({
- active,
- className,
-}) {
- return (
-
-
-
- );
-}
-
-export default NavigationItem;
\ No newline at end of file
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/css-selector-after-pseudo/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/css-selector-after-pseudo/output.js
deleted file mode 100644
index 038e73e4b66f8..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/css-selector-after-pseudo/output.js
+++ /dev/null
@@ -1,11 +0,0 @@
-import _JSXStyle from "styled-jsx/style";
-function NavigationItem({ active , className }) {
- return
-
- <_JSXStyle id={"2342aae4628612c6"}>{'.navigation-item.jsx-2342aae4628612c6 a::after{content:attr(data-text);content:attr(data-text)/""}'}
-
- ;
-}
-export default NavigationItem;
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/css-tag-same-file/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/css-tag-same-file/input.js
deleted file mode 100644
index a455a91246b58..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/css-tag-same-file/input.js
+++ /dev/null
@@ -1,25 +0,0 @@
-import css from 'styled-jsx/css'
-
-export default ({ children }) => (
-
-)
-
-const styles = css`
- p {
- color: red;
- }
-`
-
-class Test extends React.Component {
- render() {
- return (
-
-
{this.props.children}
-
-
- )
- }
-}
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/css-tag-same-file/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/css-tag-same-file/output.js
deleted file mode 100644
index ffc1a2bf670fb..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/css-tag-same-file/output.js
+++ /dev/null
@@ -1,21 +0,0 @@
-import _JSXStyle from "styled-jsx/style";
-export default (({ children })=>
-
-
{children}
-
- <_JSXStyle id={styles.__hash}>{styles}
-
-
);
-const styles = new String("p.jsx-556239d258b6d66a{color:red}");
-styles.__hash = "556239d258b6d66a";
-class Test extends React.Component {
- render() {
- return
-
-
{this.props.children}
-
- <_JSXStyle id={styles.__hash}>{styles}
-
-
;
- }
-}
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/different-jsx-ids/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/different-jsx-ids/input.js
deleted file mode 100644
index d5769d3e9c1f4..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/different-jsx-ids/input.js
+++ /dev/null
@@ -1,23 +0,0 @@
-const color = 'red'
-const otherColor = 'green'
-
-const A = () => (
-
-)
-
-const B = () => (
-
-)
-
-export default () => (
-
-)
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/different-jsx-ids/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/different-jsx-ids/output.js
deleted file mode 100644
index 09f34b112c95a..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/different-jsx-ids/output.js
+++ /dev/null
@@ -1,24 +0,0 @@
-import _JSXStyle from "styled-jsx/style";
-const color = 'red';
-const otherColor = 'green';
-const A = ()=>
-
-
test
-
- <_JSXStyle id={"8522d6f4b7f930d2"}>{`p.jsx-8522d6f4b7f930d2{color:${color}}`}
-
-
;
-const B = ()=>
-
-
test
-
- <_JSXStyle id={"d1ed441bb35f699d"}>{`p.jsx-d1ed441bb35f699d{color:${otherColor}}`}
-
-
;
-export default (()=>
);
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/dynamic-element-class/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/dynamic-element-class/input.js
deleted file mode 100644
index 5b8abce8c999f..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/dynamic-element-class/input.js
+++ /dev/null
@@ -1,32 +0,0 @@
-export default class {
- render() {
- const Element = 'div'
-
- return (
-
- dynamic element
-
-
- )
- }
-}
-
-const Element2 = 'div'
-export const Test2 = class {
- render() {
- return (
-
- dynamic element
-
-
- )
- }
-}
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/dynamic-element-class/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/dynamic-element-class/output.js
deleted file mode 100644
index 310fcb426c5d7..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/dynamic-element-class/output.js
+++ /dev/null
@@ -1,25 +0,0 @@
-import _JSXStyle from "styled-jsx/style";
-export default class {
- render() {
- const Element = 'div';
- return
-
- dynamic element
-
- <_JSXStyle id={"f825b24bbab5b83b"}>{".root.jsx-f825b24bbab5b83b{background:red}"}
-
- ;
- }
-}
-const Element2 = 'div';
-export const Test2 = class {
- render() {
- return
-
- dynamic element
-
- <_JSXStyle id={"f825b24bbab5b83b"}>{".root.jsx-f825b24bbab5b83b{background:red}"}
-
- ;
- }
-};
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/dynamic-element-external/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/dynamic-element-external/input.js
deleted file mode 100644
index 128078563e40b..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/dynamic-element-external/input.js
+++ /dev/null
@@ -1,12 +0,0 @@
-import styles from './styles2'
-
-export default ({ level = 1 }) => {
- const Element = `h${level}`
-
- return (
-
- dynamic element
-
-
- )
-}
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/dynamic-element-external/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/dynamic-element-external/output.js
deleted file mode 100644
index e96530e253354..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/dynamic-element-external/output.js
+++ /dev/null
@@ -1,12 +0,0 @@
-import _JSXStyle from "styled-jsx/style";
-import styles from './styles2';
-export default (({ level =1 })=>{
- const Element = `h${level}`;
- return
-
- dynamic element
-
- <_JSXStyle id={styles.__hash}>{styles}
-
- ;
-});
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/dynamic-element/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/dynamic-element/input.js
deleted file mode 100644
index 17854bdd2bbae..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/dynamic-element/input.js
+++ /dev/null
@@ -1,56 +0,0 @@
-export default ({ level = 1 }) => {
- const Element = `h${level}`
-
- return (
-
- dynamic element
-
-
- )
-}
-
-export const TestLowerCase = ({ level = 1 }) => {
- const element = `h${level}`
-
- return (
-
- dynamic element
-
-
- )
-}
-
-const Element2 = 'div'
-export const Test2 = () => {
- return (
-
- dynamic element
-
-
- )
-}
-
-export const Test3 = ({Component = 'div'}) => {
- return (
-
- dynamic element
-
-
- );
-}
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/dynamic-element/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/dynamic-element/output.js
deleted file mode 100644
index fe05a5238005d..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/dynamic-element/output.js
+++ /dev/null
@@ -1,40 +0,0 @@
-import _JSXStyle from "styled-jsx/style";
-export default (({ level =1 })=>{
- const Element = `h${level}`;
- return
-
- dynamic element
-
- <_JSXStyle id={"fca64cc3f069b519"}>{".root.jsx-fca64cc3f069b519{background:red}"}
-
- ;
-});
-export const TestLowerCase = ({ level =1 })=>{
- const element = `h${level}`;
- return
-
- dynamic element
-
- <_JSXStyle id={"fca64cc3f069b519"}>{".root.jsx-fca64cc3f069b519{background:red}"}
-
- ;
-};
-const Element2 = 'div';
-export const Test2 = ()=>{
- return
-
- dynamic element
-
- <_JSXStyle id={"fca64cc3f069b519"}>{".root.jsx-fca64cc3f069b519{background:red}"}
-
- ;
-};
-export const Test3 = ({ Component ='div' })=>{
- return
-
- dynamic element
-
- <_JSXStyle id={"f825b24bbab5b83b"}>{".root.jsx-f825b24bbab5b83b{background:red}"}
-
- ;
-};
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/dynamic-this-in-arrow/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/dynamic-this-in-arrow/input.js
deleted file mode 100644
index 1a3c67dc60869..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/dynamic-this-in-arrow/input.js
+++ /dev/null
@@ -1,41 +0,0 @@
-// TODO
-// import React, { Component } from 'react'
-
-// export default class Index extends Component {
-// static getInitialProps() {
-// return { color: 'aquamarine' }
-// }
-
-// render() {
-// return (
-//
-// {[1, 2].map(idx => (
-//
-// {[3, 4].map(idx2 => (
-//
{this.props.color}
-// ))}
-//
-// ))}
-// {[1, 2].map(idx => (
-//
-//
-// {this.props.color}
-//
-//
-//
-//
{this.props.color} hello there
-//
-//
-//
-//
-//
-// ))}
-//
-//
-// )
-// }
-// }
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/dynamic-this-in-arrow/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/dynamic-this-in-arrow/output.js
deleted file mode 100644
index 11fc44ff6c8a5..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/dynamic-this-in-arrow/output.js
+++ /dev/null
@@ -1,39 +0,0 @@
-// TODO
-// import React, { Component } from 'react'
-// export default class Index extends Component {
-// static getInitialProps() {
-// return { color: 'aquamarine' }
-// }
-// render() {
-// return (
-//
-// {[1, 2].map(idx => (
-//
-// {[3, 4].map(idx2 => (
-//
{this.props.color}
-// ))}
-//
-// ))}
-// {[1, 2].map(idx => (
-//
-//
-// {this.props.color}
-//
-//
-//
-//
{this.props.color} hello there
-//
-//
-//
-//
-//
-// ))}
-//
-//
-// )
-// }
-// }
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/exported-jsx-style/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/exported-jsx-style/input.js
deleted file mode 100644
index 119d097f61c55..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/exported-jsx-style/input.js
+++ /dev/null
@@ -1 +0,0 @@
-// module.exports = () =>
\ No newline at end of file
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/exported-jsx-style/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/exported-jsx-style/output.js
deleted file mode 100644
index 79908ec112773..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/exported-jsx-style/output.js
+++ /dev/null
@@ -1 +0,0 @@
-// module.exports = () =>
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/exported-non-jsx-style/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/exported-non-jsx-style/input.js
deleted file mode 100644
index 5539580cf93a7..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/exported-non-jsx-style/input.js
+++ /dev/null
@@ -1 +0,0 @@
-// module.exports = () =>
\ No newline at end of file
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/exported-non-jsx-style/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/exported-non-jsx-style/output.js
deleted file mode 100644
index 42b1f9876f857..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/exported-non-jsx-style/output.js
+++ /dev/null
@@ -1 +0,0 @@
-// module.exports = () =>
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/expressions/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/expressions/input.js
deleted file mode 100644
index d7c579f19102f..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/expressions/input.js
+++ /dev/null
@@ -1,90 +0,0 @@
-const darken = c => c
-const color = 'red'
-const otherColor = 'green'
-const mediumScreen = '680px'
-const animationDuration = '200ms'
-const animationName = 'my-cool-animation'
-const obj = { display: 'block' }
-
-export default ({ display }) => (
-
-
test
-
-
-
-
- // TODO: the next two should have the same hash
-
-
-
-
-
-
-
-
-
- // TODO: causes bad syntax
- {/* */}
-
-)
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/expressions/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/expressions/output.js
deleted file mode 100644
index b7d0155346bde..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/expressions/output.js
+++ /dev/null
@@ -1,91 +0,0 @@
-import _JSXStyle from "styled-jsx/style";
-const darken = (c)=>c;
-const color = 'red';
-const otherColor = 'green';
-const mediumScreen = '680px';
-const animationDuration = '200ms';
-const animationName = 'my-cool-animation';
-const obj = {
- display: 'block'
-};
-export default (({ display })=>
-
-
test
-
- <_JSXStyle id={"cb56eab0db38d266"}>{`p.${color}.jsx-b452af554142d27{color:${otherColor};display:${obj.display}}`}
-
- <_JSXStyle id={"94239b6d6b42c9b5"}>{"p.jsx-b452af554142d27{color:red}"}
-
- <_JSXStyle id={"e66306ac259712aa"}>{`body{background:${color}}`}
-
- <_JSXStyle id={"e66306ac259712aa"}>{`body{background:${color}}`}
-
- // TODO: the next two should have the same hash
-
- <_JSXStyle id={"f08108daf927b99d"}>{`p.jsx-b452af554142d27{color:${color}}`}
-
- <_JSXStyle id={"f08108daf927b99d"}>{`p.jsx-b452af554142d27{color:${color}}`}
-
- <_JSXStyle id={"72e421eb2017491a"} dynamic={[
- darken(color)
- ]}>{`p.__jsx-style-dynamic-selector{color:${darken(color)}}`}
-
- <_JSXStyle id={"d05e300c372f73ee"} dynamic={[
- darken(color) + 2
- ]}>{`p.__jsx-style-dynamic-selector{color:${darken(color) + 2}}`}
-
- <_JSXStyle id={"7c5c5bde49d6c65d"}>{`@media(min-width:${mediumScreen}){p.jsx-b452af554142d27{color:green}p.jsx-b452af554142d27{color:${`red`}}}p.jsx-b452af554142d27{color:red}`}
-
- <_JSXStyle id={"c5506be0b4762e0b"}>{`p.jsx-b452af554142d27{-webkit-animation-duration:${animationDuration};-moz-animation-duration:${animationDuration};-o-animation-duration:${animationDuration};animation-duration:${animationDuration}}`}
-
- <_JSXStyle id={"ed798aa885be9084"}>{`p.jsx-b452af554142d27{-webkit-animation:${animationDuration} forwards ${animationName};-moz-animation:${animationDuration} forwards ${animationName};-o-animation:${animationDuration} forwards ${animationName};animation:${animationDuration} forwards ${animationName}}div.jsx-b452af554142d27{background:${color}}`}
-
-
-
- <_JSXStyle id={"469c0b1cc43512b8"} dynamic={[
- display ? 'block' : 'none'
- ]}>{`span.__jsx-style-dynamic-selector{display:${display ? 'block' : 'none'}}`}
-
- // TODO: causes bad syntax
-
- {}
-
-
);
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/external-nested-scope/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/external-nested-scope/input.js
deleted file mode 100644
index a6f92b0c0ab90..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/external-nested-scope/input.js
+++ /dev/null
@@ -1,5 +0,0 @@
-import css from 'styled-jsx/css'
-
-function test() {
- css.resolve`div { color: red }`
-}
\ No newline at end of file
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/external-nested-scope/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/external-nested-scope/output.js
deleted file mode 100644
index ec88815709af2..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/external-nested-scope/output.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import _JSXStyle from "styled-jsx/style";
-function test() {
- ({
- styles: <_JSXStyle id={"abb4c2202db1a207"}>{"div.jsx-abb4c2202db1a207{color:red}"},
- className: "jsx-abb4c2202db1a207"
- });
-}
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/external-stylesheet-global/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/external-stylesheet-global/input.js
deleted file mode 100644
index 67fdae9bb899b..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/external-stylesheet-global/input.js
+++ /dev/null
@@ -1,19 +0,0 @@
-import styles, { foo as styles3 } from './styles'
-
-const styles2 = require('./styles2')
-
-export default () =>
-
-
test
-
woot
-
woot
-
-
-
-
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/external-stylesheet-global/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/external-stylesheet-global/output.js
deleted file mode 100644
index 862421061d48d..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/external-stylesheet-global/output.js
+++ /dev/null
@@ -1,18 +0,0 @@
-import _JSXStyle from "styled-jsx/style";
-import styles, { foo as styles3 } from './styles';
-const styles2 = require('./styles2');
-export default (()=>
-
-
test
-
-
woot
-
-
woot
-
- <_JSXStyle id={styles2.__hash}>{styles2}
-
- <_JSXStyle id={styles3.__hash}>{styles3}
-
- <_JSXStyle id={styles.__hash}>{styles}
-
-
);
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/external-stylesheet-multi-line/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/external-stylesheet-multi-line/input.js
deleted file mode 100644
index 89c6b449a2946..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/external-stylesheet-multi-line/input.js
+++ /dev/null
@@ -1,9 +0,0 @@
-import styles from './styles'
-
-export default () =>
-
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/external-stylesheet-multi-line/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/external-stylesheet-multi-line/output.js
deleted file mode 100644
index f8b2e5133e5e7..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/external-stylesheet-multi-line/output.js
+++ /dev/null
@@ -1,9 +0,0 @@
-import _JSXStyle from "styled-jsx/style";
-import styles from './styles';
-export default (()=>
-
-
test
-
- <_JSXStyle id={styles.__hash}>{styles}
-
-
);
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/external-stylesheet/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/external-stylesheet/input.js
deleted file mode 100644
index 4b820d12c1675..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/external-stylesheet/input.js
+++ /dev/null
@@ -1,41 +0,0 @@
-import styles from './styles'
-const styles2 = require('./styles2')
-import { foo as styles3 } from './styles'
-
-export default () => (
-
-
test
-
woot
-
-
-
woot
-
-
-
-)
-
-export const Test = () => (
-
-
test
-
woot
-
-
woot
-
-
-)
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/external-stylesheet/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/external-stylesheet/output.js
deleted file mode 100644
index c22231857c55b..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/external-stylesheet/output.js
+++ /dev/null
@@ -1,34 +0,0 @@
-import _JSXStyle from "styled-jsx/style";
-import styles from './styles';
-const styles2 = require('./styles2');
-import { foo as styles3 } from './styles';
-export default (()=>
-
-
test
-
-
woot
-
- <_JSXStyle id={styles2.__hash}>{styles2}
-
- <_JSXStyle id={styles3.__hash}>{styles3}
-
-
woot
-
- <_JSXStyle id={"bee92b62eadf8a14"}>{"p.jsx-bee92b62eadf8a14{color:red}div.jsx-bee92b62eadf8a14{color:green}"}
-
- <_JSXStyle id={styles.__hash}>{styles}
-
-
);
-export const Test = ()=>
-
-
test
-
-
woot
-
- <_JSXStyle id={styles3.__hash}>{styles3}
-
-
woot
-
- <_JSXStyle id={"bee92b62eadf8a14"}>{"p.jsx-bee92b62eadf8a14{color:red}div.jsx-bee92b62eadf8a14{color:green}"}
-
-
;
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/fragment/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/fragment/input.js
deleted file mode 100644
index fc5a60bf569bf..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/fragment/input.js
+++ /dev/null
@@ -1,51 +0,0 @@
-import React from 'react'
-
-export default () => (
- <>
-
Testing!!!
-
Bar
- <>
-
Title...
-
- hello
- <>
- foo
- bar
- >
- world
-
- >
-
- >
-)
-
-function Component1() {
- return (
- <>
-
test
- >
- )
-}
-
-function Component2() {
- return (
-
-
-
- )
-}
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/fragment/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/fragment/output.js
deleted file mode 100644
index a0946ccb7bcae..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/fragment/output.js
+++ /dev/null
@@ -1,47 +0,0 @@
-import _JSXStyle from "styled-jsx/style";
-import React from 'react';
-export default (()=><>
-
-
Testing!!!
-
-
Bar
-
- <>
-
-
Title...
-
-
-
- hello
-
- <>
-
- foo
-
- bar
-
- >
-
- world
-
-
-
- >
-
- <_JSXStyle id={"6dd5f97e085c0297"}>{"p.jsx-6dd5f97e085c0297{color:cyan}.foo.jsx-6dd5f97e085c0297{font-size:18px;color:hotpink}#head.jsx-6dd5f97e085c0297{text-decoration:underline}"}
-
- >);
-function Component1() {
- return <>
-
-
test
-
- >;
-}
-function Component2() {
- return
-
- <_JSXStyle id={"678f41ca6d3b294b"}>{"div.jsx-678f41ca6d3b294b{color:red}"}
-
-
;
-}
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/global-child-selector/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/global-child-selector/input.js
deleted file mode 100644
index e3cdeef058a8a..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/global-child-selector/input.js
+++ /dev/null
@@ -1,10 +0,0 @@
-const Test = () => (
-
- test
-
-
-)
\ No newline at end of file
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/global-child-selector/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/global-child-selector/output.js
deleted file mode 100644
index 521e38dde02be..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/global-child-selector/output.js
+++ /dev/null
@@ -1,8 +0,0 @@
-import _JSXStyle from "styled-jsx/style";
-const Test = ()=>
-
- test
-
- <_JSXStyle id={"5a206f122d1cb32e"}>{"div.jsx-5a206f122d1cb32e>span{color:red}"}
-
-
;
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/global-redundant/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/global-redundant/input.js
deleted file mode 100644
index 645ca01c3e9df..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/global-redundant/input.js
+++ /dev/null
@@ -1,12 +0,0 @@
-export default function IndexPage() {
- return (
-
- should be blue.
-
-
- );
-}
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/global-redundant/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/global-redundant/output.js
deleted file mode 100644
index 82762e584a3eb..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/global-redundant/output.js
+++ /dev/null
@@ -1,10 +0,0 @@
-import _JSXStyle from "styled-jsx/style";
-export default function IndexPage() {
- return
-
- should be blue.
-
- <_JSXStyle id={"b6abd0684ba81871"}>{"div{color:blue}"}
-
-
;
-}
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/global/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/global/input.js
deleted file mode 100644
index 75178bdb77c46..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/global/input.js
+++ /dev/null
@@ -1,22 +0,0 @@
-const Test = () => (
-
-
-
-)
-
-const Test2 = () =>
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/global/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/global/output.js
deleted file mode 100644
index 0e54f9efefe19..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/global/output.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import _JSXStyle from "styled-jsx/style";
-const Test = ()=>
-
- <_JSXStyle id={"d47d6adadf14e957"}>{"body{color:red}:hover{color:red;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;-webkit-animation:foo 1s ease-out;-moz-animation:foo 1s ease-out;-o-animation:foo 1s ease-out;animation:foo 1s ease-out}div a{display:none}[data-test]>div{color:red}"}
-
-
;
-const Test2 = ()=><_JSXStyle id={"94239b6d6b42c9b5"}>{"p{color:red}"};
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/issue-30480/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/issue-30480/input.js
deleted file mode 100644
index c9a5fb9504616..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/issue-30480/input.js
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-export default ({ breakPoint }) => (
-
-
-
-)
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/issue-30480/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/issue-30480/output.js
deleted file mode 100644
index a199bc3ffbe34..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/issue-30480/output.js
+++ /dev/null
@@ -1,15 +0,0 @@
-import _JSXStyle from "styled-jsx/style";
-export default (({ breakPoint })=>
-
- <_JSXStyle id={"5d2a0e645566ce9c"} dynamic={[
- breakPoint
- ]}>{`@media(${breakPoint}){}`}
-
-
);
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/issue-30570/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/issue-30570/input.js
deleted file mode 100644
index 30339e7991704..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/issue-30570/input.js
+++ /dev/null
@@ -1,15 +0,0 @@
-export default function IndexPage() {
- return (
-
-
Hello World.
-
-
-
- );
- }
\ No newline at end of file
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/issue-30570/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/issue-30570/output.js
deleted file mode 100644
index 8a59df276c308..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/issue-30570/output.js
+++ /dev/null
@@ -1,12 +0,0 @@
-import _JSXStyle from "styled-jsx/style";
-export default function IndexPage() {
- return
-
-
Hello World.
-
-
-
- <_JSXStyle id={"bbdada4ef17d18ef"}>{"@supports((display:flex)or (display:-webkit-box)or (display:-webkit-flex)or (display:-moz-box)or (display:-ms-flexbox)){h1{color:hotpink}}"}
-
- ;
-}
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/issue-31562-interpolation-in-mdea/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/issue-31562-interpolation-in-mdea/input.js
deleted file mode 100644
index 39b930b9c7c20..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/issue-31562-interpolation-in-mdea/input.js
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-export default class {
- render() {
- return (
-
- )
- }
- }
-
\ No newline at end of file
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/issue-31562-interpolation-in-mdea/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/issue-31562-interpolation-in-mdea/output.js
deleted file mode 100644
index c82016f21c0b6..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/issue-31562-interpolation-in-mdea/output.js
+++ /dev/null
@@ -1,43 +0,0 @@
-import _JSXStyle from "styled-jsx/style";
-export default class {
- render() {
- return
-
-
test
-
- <_JSXStyle id={"60bda1963c17b640"} dynamic={[
- Typography.base.size.default,
- Typography.base.lineHeight,
- Target.mediumPlus,
- Typography.base.size.mediumPlus,
- Target.largePlus,
- Typography.base.size.largePlus
- ]}>{`html{font-size:${Typography.base.size.default};line-height:${Typography.base.lineHeight}}@media ${Target.mediumPlus}{html{font-size:${Typography.base.size.mediumPlus}}}@media ${Target.largePlus}{html{font-size:${Typography.base.size.largePlus}}}`}
-
-
;
- }
-}
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/mixed-global-scoped/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/mixed-global-scoped/input.js
deleted file mode 100644
index 403ed46ac292f..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/mixed-global-scoped/input.js
+++ /dev/null
@@ -1,9 +0,0 @@
-const Test = () =>
-
-export default () => (
-
-)
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/mixed-global-scoped/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/mixed-global-scoped/output.js
deleted file mode 100644
index bb98a20afbc34..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/mixed-global-scoped/output.js
+++ /dev/null
@@ -1,11 +0,0 @@
-import _JSXStyle from "styled-jsx/style";
-const Test = ()=><_JSXStyle id={"94239b6d6b42c9b5"}>{"p{color:red}"};
-export default (()=>
-
-
test
-
- <_JSXStyle id={"b7efb453c85593c1"}>{"body{background:red}"}
-
- <_JSXStyle id={"94239b6d6b42c9b5"}>{"p.jsx-3822e6e1fb9fa41a{color:red}"}
-
-
);
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/multiple-jsx/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/multiple-jsx/input.js
deleted file mode 100644
index 0b1de33780068..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/multiple-jsx/input.js
+++ /dev/null
@@ -1,43 +0,0 @@
-const attrs = {
- id: 'test'
-}
-
-const Test1 = () => (
-
- test
-
-
-
-)
-
-const Test2 = () =>
test
-
-const Test3 = () => (
-
- test
-
-
-)
-
-export default class {
- render () {
- return (
-
- )
- }
-}
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/multiple-jsx/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/multiple-jsx/output.js
deleted file mode 100644
index 5efae23c519e4..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/multiple-jsx/output.js
+++ /dev/null
@@ -1,32 +0,0 @@
-import _JSXStyle from "styled-jsx/style";
-const attrs = {
- id: 'test'
-};
-const Test1 = ()=>
-
- test
-
-
-
- <_JSXStyle id={"a9535d7d5f32c3c4"}>{"span.jsx-a9535d7d5f32c3c4{color:red}"}
-
-
;
-const Test2 = ()=>
test ;
-const Test3 = ()=>
-
- test
-
- <_JSXStyle id={"a9535d7d5f32c3c4"}>{"span.jsx-a9535d7d5f32c3c4{color:red}"}
-
-
;
-export default class {
- render() {
- return
-
-
test
-
- <_JSXStyle id={"b2b86d63f35d25ee"}>{"p.jsx-b2b86d63f35d25ee{color:red}"}
-
-
;
- }
-}
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/nested-style-tags/index.js b/packages/next-swc/crates/styled_jsx/tests/fixture/nested-style-tags/index.js
deleted file mode 100644
index e69de29bb2d1d..0000000000000
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/nested-style-tags/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/nested-style-tags/output.js
deleted file mode 100644
index e69de29bb2d1d..0000000000000
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/non-styled-jsx-style/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/non-styled-jsx-style/input.js
deleted file mode 100644
index d4a7da9eec1a8..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/non-styled-jsx-style/input.js
+++ /dev/null
@@ -1,7 +0,0 @@
-export default () => (
-
-)
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/non-styled-jsx-style/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/non-styled-jsx-style/output.js
deleted file mode 100644
index 5977ac8dd5cd8..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/non-styled-jsx-style/output.js
+++ /dev/null
@@ -1,12 +0,0 @@
-import _JSXStyle from "styled-jsx/style";
-export default (()=>
-
-
woot
-
-
-
- <_JSXStyle id={"94239b6d6b42c9b5"}>{"p.jsx-94239b6d6b42c9b5{color:red}"}
-
-
);
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/not-styled-jsx-tagged-templates/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/not-styled-jsx-tagged-templates/input.js
deleted file mode 100644
index 212202d499a3a..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/not-styled-jsx-tagged-templates/input.js
+++ /dev/null
@@ -1,30 +0,0 @@
-import css from 'hell'
-
-const color = 'red'
-
-const bar = css`
- div {
- font-size: 3em;
- }
-`
-export const uh = bar
-
-export const foo = css`div { color: ${color}}`
-
-export default css`
- div {
- font-size: 3em;
- }
- p {
- color: ${color};
- }
-`
-
-const Title = styled.h1`
- color: red;
- font-size: 50px;
-`
-
-const AnotherTitle = Title.extend`color: blue;`
-
-export const Component = () =>
My page
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/not-styled-jsx-tagged-templates/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/not-styled-jsx-tagged-templates/output.js
deleted file mode 100644
index 4d147784a9f4c..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/not-styled-jsx-tagged-templates/output.js
+++ /dev/null
@@ -1,24 +0,0 @@
-import css from 'hell';
-const color = 'red';
-const bar = css`
- div {
- font-size: 3em;
- }
-`;
-export const uh = bar;
-export const foo = css`div { color: ${color}}`;
-export default css`
- div {
- font-size: 3em;
- }
- p {
- color: ${color};
- }
-`;
-const Title = styled.h1`
- color: red;
- font-size: 50px;
-`;
-const AnotherTitle = Title.extend`color: blue;`;
-export const Component = ()=>
My page
-;
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/number-after-placeholder/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/number-after-placeholder/input.js
deleted file mode 100644
index 99aecf43d93d8..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/number-after-placeholder/input.js
+++ /dev/null
@@ -1,17 +0,0 @@
-import Link from "next/link";
-
-export default function IndexPage() {
- return (
-
- Hello World.{" "}
-
-
Abound
-
-
-
- );
-}
\ No newline at end of file
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/number-after-placeholder/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/number-after-placeholder/output.js
deleted file mode 100644
index babf14f306ed8..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/number-after-placeholder/output.js
+++ /dev/null
@@ -1,17 +0,0 @@
-import _JSXStyle from "styled-jsx/style";
-import Link from "next/link";
-export default function IndexPage() {
- return
-
- Hello World.{" "}
-
-
-
-
Abound
-
-
-
- <_JSXStyle id={"9a4b3442d519aae9"}>{`a.jsx-9a4b3442d519aae9{color:${"#abcdef"}12}`}
-
-
;
-}
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/one-off-global-selectors/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/one-off-global-selectors/input.js
deleted file mode 100644
index 96aca2778f692..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/one-off-global-selectors/input.js
+++ /dev/null
@@ -1,10 +0,0 @@
-export default () => (
-
-)
\ No newline at end of file
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/one-off-global-selectors/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/one-off-global-selectors/output.js
deleted file mode 100644
index 479aff6f659b5..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/one-off-global-selectors/output.js
+++ /dev/null
@@ -1,8 +0,0 @@
-import _JSXStyle from "styled-jsx/style";
-export default (()=>
-
-
test
-
- <_JSXStyle id={"c7c3a8e231c9215a"}>{".container.jsx-c7c3a8e231c9215a>*{color:red}"}
-
-
);
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/source-maps/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/source-maps/input.js
deleted file mode 100644
index e14ced8ae0f78..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/source-maps/input.js
+++ /dev/null
@@ -1,8 +0,0 @@
-// TODO: needs sourcemaps
-// export default () => (
-//
-//
test
-//
woot
-//
-//
-// )
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/source-maps/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/source-maps/output.js
deleted file mode 100644
index e14ced8ae0f78..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/source-maps/output.js
+++ /dev/null
@@ -1,8 +0,0 @@
-// TODO: needs sourcemaps
-// export default () => (
-//
-//
test
-//
woot
-//
-//
-// )
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/stateless/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/stateless/input.js
deleted file mode 100644
index e00df987c1d57..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/stateless/input.js
+++ /dev/null
@@ -1,8 +0,0 @@
-export default () => (
-
-)
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/stateless/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/stateless/output.js
deleted file mode 100644
index 53d2bfccf343d..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/stateless/output.js
+++ /dev/null
@@ -1,12 +0,0 @@
-import _JSXStyle from "styled-jsx/style";
-export default (()=>
-
-
test
-
-
woot
-
-
woot
-
- <_JSXStyle id={"94239b6d6b42c9b5"}>{"p.jsx-94239b6d6b42c9b5{color:red}"}
-
-
);
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/styles-external-invalid/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/styles-external-invalid/input.js
deleted file mode 100644
index 5842604db3a6b..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/styles-external-invalid/input.js
+++ /dev/null
@@ -1,13 +0,0 @@
-// TODO
-// import css from 'styled-jsx/css'
-
-// const color = 'red'
-
-// export const foo = css`div { color: ${color}}`
-
-// const props = { color: 'red ' }
-
-// export default css`
-// div { font-size: 3em; color: ${props.color} }
-// p { color: ${this.props.color};}
-// `
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/styles-external-invalid/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/styles-external-invalid/output.js
deleted file mode 100644
index 587369e43fc16..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/styles-external-invalid/output.js
+++ /dev/null
@@ -1,9 +0,0 @@
-// TODO
-// import css from 'styled-jsx/css'
-// const color = 'red'
-// export const foo = css`div { color: ${color}}`
-// const props = { color: 'red ' }
-// export default css`
-// div { font-size: 3em; color: ${props.color} }
-// p { color: ${this.props.color};}
-// `
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/styles-external-invalid2/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/styles-external-invalid2/input.js
deleted file mode 100644
index 82b0f957c0483..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/styles-external-invalid2/input.js
+++ /dev/null
@@ -1,11 +0,0 @@
-// TODO
-// import css from 'styled-jsx/css'
-
-// const color = 'red'
-
-// export const foo = css`div { color: ${color}}`
-
-// export default css`
-// div { font-size: 3em }
-// p { color: ${props.color};}
-// `
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/styles-external-invalid2/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/styles-external-invalid2/output.js
deleted file mode 100644
index 8f616ffc69542..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/styles-external-invalid2/output.js
+++ /dev/null
@@ -1,8 +0,0 @@
-// TODO
-// import css from 'styled-jsx/css'
-// const color = 'red'
-// export const foo = css`div { color: ${color}}`
-// export default css`
-// div { font-size: 3em }
-// p { color: ${props.color};}
-// `
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/styles/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/styles/input.js
deleted file mode 100644
index 7cbd27576cf26..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/styles/input.js
+++ /dev/null
@@ -1,57 +0,0 @@
-import css, { resolve, global } from 'styled-jsx/css'
-import colors, { size } from './constants'
-const color = 'red'
-
-const bar = css`
- div {
- font-size: 3em;
- }
-`
-
-const baz = css.global`
- div {
- font-size: 3em;
- }
-`
-
-const a = global`
- div {
- font-size: ${size}em;
- }
-`
-
-export const uh = bar
-
-export const foo = css`div { color: ${color}}`
-
-css.resolve`
- div {
- color: ${colors.green.light};
- }
- a { color: red }
-`
-
-const b = resolve`
- div {
- color: ${colors.green.light};
- }
- a { color: red }
-`
-
-const dynamic = colors => {
- const b = resolve`
- div {
- color: ${colors.green.light};
- }
- a { color: red }
- `
-}
-
-export default css.resolve`
- div {
- font-size: 3em;
- }
- p {
- color: ${color};
- }
-`
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/styles/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/styles/output.js
deleted file mode 100644
index ca761e9026328..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/styles/output.js
+++ /dev/null
@@ -1,39 +0,0 @@
-import _JSXStyle from "styled-jsx/style";
-import colors, { size } from './constants';
-const color = 'red';
-const bar = new String("div.jsx-aaed0341accea8f{font-size:3em}");
-bar.__hash = "aaed0341accea8f";
-const baz = new String("div{font-size:3em}");
-baz.__hash = "aaed0341accea8f";
-const a = new String(`div{font-size:${size}em}`);
-a.__hash = "b4e02b3e84cc50c";
-export const uh = bar;
-export const foo = new String(`div.jsx-1a001e3709d54ba4{color:${color}}`);
-foo.__hash = "1a001e3709d54ba4";
-({
- styles: <_JSXStyle id={"38ae14c4ec5e0907"}>{`div.jsx-38ae14c4ec5e0907{color:${colors.green.light}}a.jsx-38ae14c4ec5e0907{color:red}`},
- className: "jsx-38ae14c4ec5e0907"
-});
-const b = {
- styles: <_JSXStyle id={"38ae14c4ec5e0907"}>{`div.jsx-38ae14c4ec5e0907{color:${colors.green.light}}a.jsx-38ae14c4ec5e0907{color:red}`},
- className: "jsx-38ae14c4ec5e0907"
-};
-const dynamic = (colors)=>{
- const b = {
- styles: <_JSXStyle id={"b68d3b38146e2a7d"} dynamic={[
- colors.green.light
- ]}>{`div.__jsx-style-dynamic-selector{color:${colors.green.light}}a.__jsx-style-dynamic-selector{color:red}`},
- className: _JSXStyle.dynamic([
- [
- "b68d3b38146e2a7d",
- [
- colors.green.light
- ]
- ]
- ])
- };
-};
-export default {
- styles: <_JSXStyle id={"e14aa5a1efa47449"}>{`div.jsx-e14aa5a1efa47449{font-size:3em}p.jsx-e14aa5a1efa47449{color:${color}}`},
- className: "jsx-e14aa5a1efa47449"
-};
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/styles2/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/styles2/input.js
deleted file mode 100644
index 6e82bca12d972..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/styles2/input.js
+++ /dev/null
@@ -1,6 +0,0 @@
-// TODO: support common js
-// import css from 'styled-jsx/css'
-
-// module.exports = css`
-// div { font-size: 3em }
-// `
\ No newline at end of file
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/styles2/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/styles2/output.js
deleted file mode 100644
index cd7ba2952ca51..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/styles2/output.js
+++ /dev/null
@@ -1,5 +0,0 @@
-// TODO: support common js
-// import css from 'styled-jsx/css'
-// module.exports = css`
-// div { font-size: 3em }
-// `
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/too-many/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/too-many/input.js
deleted file mode 100644
index 86905e5ffd65f..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/too-many/input.js
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-export const Red = ({
- Component = 'button',
-}) => {
-
- return (
-
-
- {/* Dynamic Styles */}
-
-
- );
-};
-
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/too-many/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/too-many/output.js
deleted file mode 100644
index 4a79e8cbc9b52..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/too-many/output.js
+++ /dev/null
@@ -1,49 +0,0 @@
-import _JSXStyle from "styled-jsx/style";
-export const Red = ({ Component ='button' })=>{
- return
-
-
-
- {}
-
- <_JSXStyle id={"1a9f9e2fa701f7ec"} dynamic={[
- e1,
- e2,
- e3,
- e4,
- e5,
- e6,
- e7,
- e8,
- e9,
- e10,
- e11,
- e12,
- e13,
- e14,
- e15
- ]}>{`.button.__jsx-style-dynamic-selector{--button-1:${e1};--button-2:${e2};--button-3:${e3};--button-4:${e4};--button-5:${e5};--button-6:${e6};--button-7:${e7};--button-8:${e8};--button-9:${e9};--button-10:${e10};--button-11:${e11};--button-12:${e12};--button-13:${e13};--button-14:${e14};--button-15:${e15}}`}
-
- ;
-};
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/tpl-escape-1/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/tpl-escape-1/input.js
deleted file mode 100644
index f01a4f41211d1..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/tpl-escape-1/input.js
+++ /dev/null
@@ -1,14 +0,0 @@
-export default class {
- render() {
- return (
-
- )
- }
-}
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/tpl-escape-1/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/tpl-escape-1/output.js
deleted file mode 100644
index 47b810056b46a..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/tpl-escape-1/output.js
+++ /dev/null
@@ -1,12 +0,0 @@
-import _JSXStyle from "styled-jsx/style";
-export default class {
- render() {
- return
-
-
test
-
- <_JSXStyle id={"1f6cef12199c3a8f"}>{'p.jsx-1f6cef12199c3a8f{content:"`"}'}
-
-
;
- }
-}
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/tpl-escape-2/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/tpl-escape-2/input.js
deleted file mode 100644
index d6ddd44472ad9..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/tpl-escape-2/input.js
+++ /dev/null
@@ -1,17 +0,0 @@
-export default function Home({ fontFamily }) {
- return (
-
-
-
- )
-}
\ No newline at end of file
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/tpl-escape-2/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/tpl-escape-2/output.js
deleted file mode 100644
index afa05a46883cc..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/tpl-escape-2/output.js
+++ /dev/null
@@ -1,17 +0,0 @@
-import _JSXStyle from "styled-jsx/style";
-export default function Home({ fontFamily }) {
- return
-
- <_JSXStyle id={"3892513b52a23034"} dynamic={[
- fontFamily
- ]}>{`body{font-family:${fontFamily}}code:before,code:after{content:"\`"}`}
-
-
;
-}
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/tpl-placeholder-1-as-property/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/tpl-placeholder-1-as-property/input.js
deleted file mode 100644
index 578f25c5578ed..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/tpl-placeholder-1-as-property/input.js
+++ /dev/null
@@ -1,17 +0,0 @@
-export default class {
- render() {
- return (
-
- )
- }
- }
-
\ No newline at end of file
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/tpl-placeholder-1-as-property/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/tpl-placeholder-1-as-property/output.js
deleted file mode 100644
index 9f0e2f459754c..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/tpl-placeholder-1-as-property/output.js
+++ /dev/null
@@ -1,29 +0,0 @@
-import _JSXStyle from "styled-jsx/style";
-export default class {
- render() {
- return
-
-
test
-
- <_JSXStyle id={"fc144a5ba38f1ea7"} dynamic={[
- inputSize ? 'height: calc(2 * var(--a)) !important;' : ''
- ]}>{`@media only screen{a.__jsx-style-dynamic-selector{${inputSize ? 'height: calc(2 * var(--a)) !important;' : ''}
- }}`}
-
-
;
- }
-}
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/tpl-placeholder-2-as-part-of-value/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/tpl-placeholder-2-as-part-of-value/input.js
deleted file mode 100644
index 3524c05ce1bf3..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/tpl-placeholder-2-as-part-of-value/input.js
+++ /dev/null
@@ -1,21 +0,0 @@
-export default class {
- render() {
- return (
-
- )
- }
- }
-
\ No newline at end of file
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/tpl-placeholder-2-as-part-of-value/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/tpl-placeholder-2-as-part-of-value/output.js
deleted file mode 100644
index 99940aee33e0c..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/tpl-placeholder-2-as-part-of-value/output.js
+++ /dev/null
@@ -1,34 +0,0 @@
-import _JSXStyle from "styled-jsx/style";
-export default class {
- render() {
- return
-
-
test
-
- <_JSXStyle id={"73606d02cbadabf"} dynamic={[
- a[b],
- -1 * (c || 0),
- d
- ]}>{`.a:hover .b.__jsx-style-dynamic-selector{a:${a[b]}px!important;b:translate3d(0,${-1 * (c || 0)}px,-${d}px)scale(1)!important}`}
-
-
;
- }
-}
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/tpl-placeholder-3-as-value/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/tpl-placeholder-3-as-value/input.js
deleted file mode 100644
index 4528b59e6d23e..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/tpl-placeholder-3-as-value/input.js
+++ /dev/null
@@ -1,17 +0,0 @@
-export default class {
- render() {
- return (
-
- )
- }
- }
-
\ No newline at end of file
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/tpl-placeholder-3-as-value/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/tpl-placeholder-3-as-value/output.js
deleted file mode 100644
index d30c5e9bcc888..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/tpl-placeholder-3-as-value/output.js
+++ /dev/null
@@ -1,28 +0,0 @@
-import _JSXStyle from "styled-jsx/style";
-export default class {
- render() {
- return
-
-
test
-
- <_JSXStyle id={"e37942245bf0eb35"} dynamic={[
- a
- ]}>{`@media only screen{a.__jsx-style-dynamic-selector{color:${a}}}`}
-
-
;
- }
-}
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/tpl-placeholder-4-as-part-of-value-in-multiple/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/tpl-placeholder-4-as-part-of-value-in-multiple/input.js
deleted file mode 100644
index 492bf86a32be4..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/tpl-placeholder-4-as-part-of-value-in-multiple/input.js
+++ /dev/null
@@ -1,17 +0,0 @@
-export default class {
- render() {
- return (
-
- )
- }
- }
-
\ No newline at end of file
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/tpl-placeholder-4-as-part-of-value-in-multiple/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/tpl-placeholder-4-as-part-of-value-in-multiple/output.js
deleted file mode 100644
index 3a6fd3fbbe32d..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/tpl-placeholder-4-as-part-of-value-in-multiple/output.js
+++ /dev/null
@@ -1,31 +0,0 @@
-import _JSXStyle from "styled-jsx/style";
-export default class {
- render() {
- return
-
-
test
-
- <_JSXStyle id={"b9b97de593829e6"} dynamic={[
- a || 'var(--c)',
- b || 'inherit'
- ]}>{`.a:hover .b.__jsx-style-dynamic-selector{display:inline-block;padding:0 ${a || 'var(--c)'};color:${b || 'inherit'}}`}
-
-
;
- }
-}
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/tpl-placeholder-5-values-of-multiple-properties/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/tpl-placeholder-5-values-of-multiple-properties/input.js
deleted file mode 100644
index bd1739e0be203..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/tpl-placeholder-5-values-of-multiple-properties/input.js
+++ /dev/null
@@ -1,16 +0,0 @@
-export default class {
- render() {
- return (
-
- )
- }
- }
-
\ No newline at end of file
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/tpl-placeholder-5-values-of-multiple-properties/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/tpl-placeholder-5-values-of-multiple-properties/output.js
deleted file mode 100644
index 58f95cabf3159..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/tpl-placeholder-5-values-of-multiple-properties/output.js
+++ /dev/null
@@ -1,31 +0,0 @@
-import _JSXStyle from "styled-jsx/style";
-export default class {
- render() {
- return
-
-
test
-
- <_JSXStyle id={"23692842dc904882"} dynamic={[
- a ? '100%' : '200px',
- b ? '0' : '8px 20px'
- ]}>{`.item.__jsx-style-dynamic-selector{max-width:${a ? '100%' : '200px'};padding:${b ? '0' : '8px 20px'}}`}
-
-
;
- }
-}
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/transform-css-complex-selector/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/transform-css-complex-selector/input.js
deleted file mode 100644
index 5f3e7a94daf51..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/transform-css-complex-selector/input.js
+++ /dev/null
@@ -1,116 +0,0 @@
-export default () => (
-
-)
\ No newline at end of file
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/transform-css-complex-selector/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/transform-css-complex-selector/output.js
deleted file mode 100644
index 37a9d1b4826cf..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/transform-css-complex-selector/output.js
+++ /dev/null
@@ -1,8 +0,0 @@
-import _JSXStyle from "styled-jsx/style";
-export default (()=>
-
-
test
-
- <_JSXStyle id={"713499aa363d6373"}>{"p.jsx-713499aa363d6373 a.jsx-713499aa363d6373 span.jsx-713499aa363d6373{color:red}p.jsx-713499aa363d6373 span{background:blue}p.jsx-713499aa363d6373 a[title=\"'w ' ' t'\"].jsx-713499aa363d6373{margin:auto}p.jsx-713499aa363d6373 span:not(.test){color:green}p.jsx-713499aa363d6373,h1.jsx-713499aa363d6373{color:blue;-webkit-animation:hahaha 3s ease forwards infinite;-moz-animation:hahaha 3s ease forwards infinite;-o-animation:hahaha 3s ease forwards infinite;animation:hahaha 3s ease forwards infinite;-webkit-animation-name:hahaha;-moz-animation-name:hahaha;-o-animation-name:hahaha;animation-name:hahaha;-webkit-animation-delay:100ms;-moz-animation-delay:100ms;-o-animation-delay:100ms;animation-delay:100ms}p.jsx-713499aa363d6373{-webkit-animation:hahaha 1s,hehehe 2s;-moz-animation:hahaha 1s,hehehe 2s;-o-animation:hahaha 1s,hehehe 2s;animation:hahaha 1s,hehehe 2s}p.jsx-713499aa363d6373:hover{color:red}p.jsx-713499aa363d6373::before{color:red}.jsx-713499aa363d6373:hover{color:red}.jsx-713499aa363d6373::before{color:red}.jsx-713499aa363d6373:hover p.jsx-713499aa363d6373{color:red}p.jsx-713499aa363d6373+a.jsx-713499aa363d6373{color:red}p.jsx-713499aa363d6373~a.jsx-713499aa363d6373{color:red}p.jsx-713499aa363d6373>a.jsx-713499aa363d6373{color:red}@-webkit-keyframes hahaha{from{top:0}to{top:100}}@-moz-keyframes hahaha{from{top:0}to{top:100}}@-o-keyframes hahaha{from{top:0}to{top:100}}@keyframes hahaha{from{top:0}to{top:100}}@-webkit-keyframes hehehe{from{left:0}to{left:100}}@-moz-keyframes hehehe{from{left:0}to{left:100}}@-o-keyframes hehehe{from{left:0}to{left:100}}@keyframes hehehe{from{left:0}to{left:100}}@media(min-width:500px){.test.jsx-713499aa363d6373{color:red}}.test.jsx-713499aa363d6373{display:block}.inline-flex.jsx-713499aa363d6373{display:-webkit-inline-box;display:-webkit-inline-flex;display:-moz-inline-box;display:-ms-inline-flexbox;display:inline-flex}.flex.jsx-713499aa363d6373{display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex}.test.jsx-713499aa363d6373{-webkit-box-shadow:0 0 10px black,inset 0 0 5px black;-moz-box-shadow:0 0 10px black,inset 0 0 5px black;box-shadow:0 0 10px black,inset 0 0 5px black}.test[title=\",\"].jsx-713499aa363d6373{display:inline-block}.test.is-status.jsx-713499aa363d6373 .test.jsx-713499aa363d6373{color:red}.a-selector.jsx-713499aa363d6373:hover,.a-selector.jsx-713499aa363d6373:focus{outline:none}"}
-
-
);
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/transform-css-global/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/transform-css-global/input.js
deleted file mode 100644
index b5c87c4b95bdd..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/transform-css-global/input.js
+++ /dev/null
@@ -1,32 +0,0 @@
-export default () => (
-
-)
\ No newline at end of file
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/transform-css-global/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/transform-css-global/output.js
deleted file mode 100644
index a9e2480b87afc..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/transform-css-global/output.js
+++ /dev/null
@@ -1,8 +0,0 @@
-import _JSXStyle from "styled-jsx/style";
-export default (()=>
-
-
test
-
- <_JSXStyle id={"53fd644ab080300c"}>{'html.jsx-53fd644ab080300c{background-image:-webkit-linear-gradient(bottom,rgba(255,255,255,.8),rgba(255,255,255,.8)),url(/static/background.svg);background-image:-moz-linear-gradient(bottom,rgba(255,255,255,.8),rgba(255,255,255,.8)),url(/static/background.svg);background-image:-o-linear-gradient(bottom,rgba(255,255,255,.8),rgba(255,255,255,.8)),url(/static/background.svg);background-image:linear-gradient(0deg,rgba(255,255,255,.8),rgba(255,255,255,.8)),url(/static/background.svg)}p{color:blue}p{color:blue}p,a.jsx-53fd644ab080300c{color:blue}.foo+a{color:red}body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif}'}
-
-
);
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/transform-css-media-query/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/transform-css-media-query/input.js
deleted file mode 100644
index 978d21aacb43f..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/transform-css-media-query/input.js
+++ /dev/null
@@ -1,24 +0,0 @@
-export default () => (
-
-)
\ No newline at end of file
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/transform-css-media-query/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/transform-css-media-query/output.js
deleted file mode 100644
index 555929a70b252..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/transform-css-media-query/output.js
+++ /dev/null
@@ -1,8 +0,0 @@
-import _JSXStyle from "styled-jsx/style";
-export default (()=>
-
-
test
-
- <_JSXStyle id={"1f7963ae04c6466a"}>{'@media(min-width:1px)and (max-width:768px){[class*="grid__col--"].jsx-1f7963ae04c6466a{margin-top:12px;margin-bottom:12px}}@media(max-width:64em){.test.jsx-1f7963ae04c6466a{margin-bottom:1em}@supports(-moz-appearance:none)and (display:contents){.test.jsx-1f7963ae04c6466a{margin-bottom:2rem}}}'}
-
-
);
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/transform-css-normal/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/transform-css-normal/input.js
deleted file mode 100644
index c1964abbf0b2c..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/transform-css-normal/input.js
+++ /dev/null
@@ -1,22 +0,0 @@
-export default () => (
-
-)
\ No newline at end of file
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/transform-css-normal/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/transform-css-normal/output.js
deleted file mode 100644
index 6efb20adad800..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/transform-css-normal/output.js
+++ /dev/null
@@ -1,8 +0,0 @@
-import _JSXStyle from "styled-jsx/style";
-export default (()=>
-
-
test
-
- <_JSXStyle id={"1a19bb4817c105dd"}>{'p.jsx-1a19bb4817c105dd{color:red}p.jsx-1a19bb4817c105dd{color:red}*.jsx-1a19bb4817c105dd{color:blue}[href="woot"].jsx-1a19bb4817c105dd{color:red}'}
-
-
);
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/transform-css-nth-1/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/transform-css-nth-1/input.js
deleted file mode 100644
index 1a119aab50846..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/transform-css-nth-1/input.js
+++ /dev/null
@@ -1,10 +0,0 @@
-export default () => (
-
- )
\ No newline at end of file
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/transform-css-nth-1/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/transform-css-nth-1/output.js
deleted file mode 100644
index 5351dd0980a28..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/transform-css-nth-1/output.js
+++ /dev/null
@@ -1,8 +0,0 @@
-import _JSXStyle from "styled-jsx/style";
-export default (()=>
-
-
test
-
- <_JSXStyle id={"938ca197692ef624"}>{"li.jsx-938ca197692ef624:nth-child(2){color:lime}"}
-
-
);
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/transform-css/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/transform-css/input.js
deleted file mode 100644
index 410a080a9924a..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/transform-css/input.js
+++ /dev/null
@@ -1,176 +0,0 @@
-export default () => (
-
-)
\ No newline at end of file
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/transform-css/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/transform-css/output.js
deleted file mode 100644
index 1420b4c3e9530..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/transform-css/output.js
+++ /dev/null
@@ -1,8 +0,0 @@
-import _JSXStyle from "styled-jsx/style";
-export default (()=>
-
-
test
-
- <_JSXStyle id={"768337a97aceabd1"}>{'html.jsx-768337a97aceabd1{background-image:-webkit-linear-gradient(bottom,rgba(255,255,255,.8),rgba(255,255,255,.8)),url(/static/background.svg);background-image:-moz-linear-gradient(bottom,rgba(255,255,255,.8),rgba(255,255,255,.8)),url(/static/background.svg);background-image:-o-linear-gradient(bottom,rgba(255,255,255,.8),rgba(255,255,255,.8)),url(/static/background.svg);background-image:linear-gradient(0deg,rgba(255,255,255,.8),rgba(255,255,255,.8)),url(/static/background.svg)}p{color:blue}p{color:blue}p,a.jsx-768337a97aceabd1{color:blue}.foo+a{color:red}body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif}p.jsx-768337a97aceabd1{color:red}p.jsx-768337a97aceabd1{color:red}*.jsx-768337a97aceabd1{color:blue}[href="woot"].jsx-768337a97aceabd1{color:red}p.jsx-768337a97aceabd1 a.jsx-768337a97aceabd1 span.jsx-768337a97aceabd1{color:red}p.jsx-768337a97aceabd1 span{background:blue}p.jsx-768337a97aceabd1 a[title="\'w \' \' t\'"].jsx-768337a97aceabd1{margin:auto}p.jsx-768337a97aceabd1 span:not(.test){color:green}p.jsx-768337a97aceabd1,h1.jsx-768337a97aceabd1{color:blue;-webkit-animation:hahaha 3s ease forwards infinite;-moz-animation:hahaha 3s ease forwards infinite;-o-animation:hahaha 3s ease forwards infinite;animation:hahaha 3s ease forwards infinite;-webkit-animation-name:hahaha;-moz-animation-name:hahaha;-o-animation-name:hahaha;animation-name:hahaha;-webkit-animation-delay:100ms;-moz-animation-delay:100ms;-o-animation-delay:100ms;animation-delay:100ms}p.jsx-768337a97aceabd1{-webkit-animation:hahaha 1s,hehehe 2s;-moz-animation:hahaha 1s,hehehe 2s;-o-animation:hahaha 1s,hehehe 2s;animation:hahaha 1s,hehehe 2s}p.jsx-768337a97aceabd1:hover{color:red}p.jsx-768337a97aceabd1::before{color:red}.jsx-768337a97aceabd1:hover{color:red}.jsx-768337a97aceabd1::before{color:red}.jsx-768337a97aceabd1:hover p.jsx-768337a97aceabd1{color:red}p.jsx-768337a97aceabd1+a.jsx-768337a97aceabd1{color:red}p.jsx-768337a97aceabd1~a.jsx-768337a97aceabd1{color:red}p.jsx-768337a97aceabd1>a.jsx-768337a97aceabd1{color:red}@-webkit-keyframes hahaha{from{top:0}to{top:100}}@-moz-keyframes hahaha{from{top:0}to{top:100}}@-o-keyframes hahaha{from{top:0}to{top:100}}@keyframes hahaha{from{top:0}to{top:100}}@-webkit-keyframes hehehe{from{left:0}to{left:100}}@-moz-keyframes hehehe{from{left:0}to{left:100}}@-o-keyframes hehehe{from{left:0}to{left:100}}@keyframes hehehe{from{left:0}to{left:100}}@media(min-width:500px){.test.jsx-768337a97aceabd1{color:red}}.test.jsx-768337a97aceabd1{display:block}.inline-flex.jsx-768337a97aceabd1{display:-webkit-inline-box;display:-webkit-inline-flex;display:-moz-inline-box;display:-ms-inline-flexbox;display:inline-flex}.flex.jsx-768337a97aceabd1{display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex}.test.jsx-768337a97aceabd1{-webkit-box-shadow:0 0 10px black,inset 0 0 5px black;-moz-box-shadow:0 0 10px black,inset 0 0 5px black;box-shadow:0 0 10px black,inset 0 0 5px black}.test[title=","].jsx-768337a97aceabd1{display:inline-block}.test.is-status.jsx-768337a97aceabd1 .test.jsx-768337a97aceabd1{color:red}.a-selector.jsx-768337a97aceabd1:hover,.a-selector.jsx-768337a97aceabd1:focus{outline:none}@media(min-width:1px)and (max-width:768px){[class*="grid__col--"].jsx-768337a97aceabd1{margin-top:12px;margin-bottom:12px}}@media(max-width:64em){.test.jsx-768337a97aceabd1{margin-bottom:1em}@supports(-moz-appearance:none)and (display:contents){.test.jsx-768337a97aceabd1{margin-bottom:2rem}}}'}
-
-
);
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/whitespace/input.js b/packages/next-swc/crates/styled_jsx/tests/fixture/whitespace/input.js
deleted file mode 100644
index 8a6d778285d88..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/whitespace/input.js
+++ /dev/null
@@ -1,12 +0,0 @@
-export default () => (
-
-)
\ No newline at end of file
diff --git a/packages/next-swc/crates/styled_jsx/tests/fixture/whitespace/output.js b/packages/next-swc/crates/styled_jsx/tests/fixture/whitespace/output.js
deleted file mode 100644
index 53d2bfccf343d..0000000000000
--- a/packages/next-swc/crates/styled_jsx/tests/fixture/whitespace/output.js
+++ /dev/null
@@ -1,12 +0,0 @@
-import _JSXStyle from "styled-jsx/style";
-export default (()=>
-
-
test
-
-
woot
-
-
woot
-
- <_JSXStyle id={"94239b6d6b42c9b5"}>{"p.jsx-94239b6d6b42c9b5{color:red}"}
-
-
);
diff --git a/packages/next-swc/crates/wasm/Cargo.toml b/packages/next-swc/crates/wasm/Cargo.toml
index 6a46d53d82317..3ffccc38cf603 100644
--- a/packages/next-swc/crates/wasm/Cargo.toml
+++ b/packages/next-swc/crates/wasm/Cargo.toml
@@ -45,7 +45,7 @@ swc_core = { features = [
"ecma_parser_typescript",
"ecma_utils",
"ecma_visit"
-], version = "0.39.7" }
+], version = "0.40.7" }
# Workaround a bug
diff --git a/packages/next-swc/package.json b/packages/next-swc/package.json
index a2eb7579095e1..d84f7b905268b 100644
--- a/packages/next-swc/package.json
+++ b/packages/next-swc/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/swc",
- "version": "12.3.2-canary.32",
+ "version": "12.3.2-canary.33",
"private": true,
"scripts": {
"build-native": "napi build --platform -p next-swc-napi --cargo-name next_swc_napi --features plugin --js false native",
diff --git a/packages/next/build/entries.ts b/packages/next/build/entries.ts
index ca99f1eb8d164..b35b6dfab2641 100644
--- a/packages/next/build/entries.ts
+++ b/packages/next/build/entries.ts
@@ -207,7 +207,7 @@ export function getEdgeServerEntry(opts: {
// The Edge bundle includes the server in its entrypoint, so it has to
// be in the SSR layer — we later convert the page request to the RSC layer
// via a webpack rule.
- layer: undefined,
+ layer: WEBPACK_LAYERS.client,
}
}
diff --git a/packages/next/build/index.ts b/packages/next/build/index.ts
index f5bee9cdc7f73..7bb43e991ab93 100644
--- a/packages/next/build/index.ts
+++ b/packages/next/build/index.ts
@@ -303,10 +303,9 @@ export default async function build(
const publicDir = path.join(dir, 'public')
const isAppDirEnabled = !!config.experimental.appDir
if (isAppDirEnabled) {
- process.env.HAS_APP_DIR = '1'
+ process.env.NEXT_PREBUNDLED_REACT = '1'
}
const { pagesDir, appDir } = findPagesDir(dir, isAppDirEnabled)
-
const hasPublicDir = await fileExists(publicDir)
telemetry.record(
@@ -1365,148 +1364,152 @@ export default async function build(
if (pageType === 'app' && originalAppPath) {
appNormalizedPaths.set(originalAppPath, page)
-
// TODO-APP: handle prerendering with edge
- // runtime
if (pageRuntime === 'experimental-edge') {
- return
- }
-
- if (
- workerResult.encodedPrerenderRoutes &&
- workerResult.prerenderRoutes
- ) {
- appStaticPaths.set(
- originalAppPath,
+ isStatic = false
+ isSsg = false
+ } else {
+ if (
+ workerResult.encodedPrerenderRoutes &&
workerResult.prerenderRoutes
- )
- appStaticPathsEncoded.set(
+ ) {
+ appStaticPaths.set(
+ originalAppPath,
+ workerResult.prerenderRoutes
+ )
+ appStaticPathsEncoded.set(
+ originalAppPath,
+ workerResult.encodedPrerenderRoutes
+ )
+ ssgPageRoutes = workerResult.prerenderRoutes
+ isSsg = true
+ }
+ if (
+ !isDynamicRoute(page) &&
+ workerResult.appConfig?.revalidate !== 0
+ ) {
+ appStaticPaths.set(originalAppPath, [page])
+ appStaticPathsEncoded.set(originalAppPath, [page])
+ isStatic = true
+ }
+ if (workerResult.prerenderFallback) {
+ // whether or not to allow requests for paths not
+ // returned from generateStaticParams
+ appDynamicParamPaths.add(originalAppPath)
+ }
+ appDefaultConfigs.set(
originalAppPath,
- workerResult.encodedPrerenderRoutes
+ workerResult.appConfig || {}
)
}
- if (!isDynamicRoute(page)) {
- appStaticPaths.set(originalAppPath, [page])
- appStaticPathsEncoded.set(originalAppPath, [page])
- }
- if (workerResult.prerenderFallback) {
- // whether or not to allow requests for paths not
- // returned from generateStaticParams
- appDynamicParamPaths.add(originalAppPath)
+ } else {
+ if (pageRuntime === SERVER_RUNTIME.edge) {
+ if (workerResult.hasStaticProps) {
+ console.warn(
+ `"getStaticProps" is not yet supported fully with "experimental-edge", detected on ${page}`
+ )
+ }
+ // TODO: add handling for statically rendering edge
+ // pages and allow edge with Prerender outputs
+ workerResult.isStatic = false
+ workerResult.hasStaticProps = false
}
- appDefaultConfigs.set(
- originalAppPath,
- workerResult.appConfig || {}
- )
- return
- }
- if (pageRuntime === SERVER_RUNTIME.edge) {
- if (workerResult.hasStaticProps) {
- console.warn(
- `"getStaticProps" is not yet supported fully with "experimental-edge", detected on ${page}`
+ if (config.outputFileTracing) {
+ pageTraceIncludes.set(
+ page,
+ workerResult.traceIncludes || []
+ )
+ pageTraceExcludes.set(
+ page,
+ workerResult.traceExcludes || []
)
}
- // TODO: add handling for statically rendering edge
- // pages and allow edge with Prerender outputs
- workerResult.isStatic = false
- workerResult.hasStaticProps = false
- }
- if (config.outputFileTracing) {
- pageTraceIncludes.set(
- page,
- workerResult.traceIncludes || []
- )
- pageTraceExcludes.set(
- page,
- workerResult.traceExcludes || []
- )
- }
-
- if (
- workerResult.isStatic === false &&
- (workerResult.isHybridAmp || workerResult.isAmpOnly)
- ) {
- hasSsrAmpPages = true
- }
+ if (
+ workerResult.isStatic === false &&
+ (workerResult.isHybridAmp || workerResult.isAmpOnly)
+ ) {
+ hasSsrAmpPages = true
+ }
- if (workerResult.isHybridAmp) {
- isHybridAmp = true
- hybridAmpPages.add(page)
- }
+ if (workerResult.isHybridAmp) {
+ isHybridAmp = true
+ hybridAmpPages.add(page)
+ }
- if (workerResult.isNextImageImported) {
- isNextImageImported = true
- }
+ if (workerResult.isNextImageImported) {
+ isNextImageImported = true
+ }
- if (workerResult.hasStaticProps) {
- ssgPages.add(page)
- isSsg = true
+ if (workerResult.hasStaticProps) {
+ ssgPages.add(page)
+ isSsg = true
- if (
- workerResult.prerenderRoutes &&
- workerResult.encodedPrerenderRoutes
- ) {
- additionalSsgPaths.set(
- page,
- workerResult.prerenderRoutes
- )
- additionalSsgPathsEncoded.set(
- page,
+ if (
+ workerResult.prerenderRoutes &&
workerResult.encodedPrerenderRoutes
- )
- ssgPageRoutes = workerResult.prerenderRoutes
+ ) {
+ additionalSsgPaths.set(
+ page,
+ workerResult.prerenderRoutes
+ )
+ additionalSsgPathsEncoded.set(
+ page,
+ workerResult.encodedPrerenderRoutes
+ )
+ ssgPageRoutes = workerResult.prerenderRoutes
+ }
+
+ if (workerResult.prerenderFallback === 'blocking') {
+ ssgBlockingFallbackPages.add(page)
+ } else if (workerResult.prerenderFallback === true) {
+ ssgStaticFallbackPages.add(page)
+ }
+ } else if (workerResult.hasServerProps) {
+ serverPropsPages.add(page)
+ } else if (
+ workerResult.isStatic &&
+ !isServerComponent &&
+ (await customAppGetInitialPropsPromise) === false
+ ) {
+ staticPages.add(page)
+ isStatic = true
+ } else if (isServerComponent) {
+ // This is a static server component page that doesn't have
+ // gSP or gSSP. We still treat it as a SSG page.
+ ssgPages.add(page)
+ isSsg = true
}
- if (workerResult.prerenderFallback === 'blocking') {
- ssgBlockingFallbackPages.add(page)
- } else if (workerResult.prerenderFallback === true) {
- ssgStaticFallbackPages.add(page)
+ if (hasPages404 && page === '/404') {
+ if (
+ !workerResult.isStatic &&
+ !workerResult.hasStaticProps
+ ) {
+ throw new Error(
+ `\`pages/404\` ${STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR}`
+ )
+ }
+ // we need to ensure the 404 lambda is present since we use
+ // it when _app has getInitialProps
+ if (
+ (await customAppGetInitialPropsPromise) &&
+ !workerResult.hasStaticProps
+ ) {
+ staticPages.delete(page)
+ }
}
- } else if (workerResult.hasServerProps) {
- serverPropsPages.add(page)
- } else if (
- workerResult.isStatic &&
- !isServerComponent &&
- (await customAppGetInitialPropsPromise) === false
- ) {
- staticPages.add(page)
- isStatic = true
- } else if (isServerComponent) {
- // This is a static server component page that doesn't have
- // gSP or gSSP. We still treat it as a SSG page.
- ssgPages.add(page)
- isSsg = true
- }
- if (hasPages404 && page === '/404') {
if (
+ STATIC_STATUS_PAGES.includes(page) &&
!workerResult.isStatic &&
!workerResult.hasStaticProps
) {
throw new Error(
- `\`pages/404\` ${STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR}`
+ `\`pages${page}\` ${STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR}`
)
}
- // we need to ensure the 404 lambda is present since we use
- // it when _app has getInitialProps
- if (
- (await customAppGetInitialPropsPromise) &&
- !workerResult.hasStaticProps
- ) {
- staticPages.delete(page)
- }
- }
-
- if (
- STATIC_STATUS_PAGES.includes(page) &&
- !workerResult.isStatic &&
- !workerResult.hasStaticProps
- ) {
- throw new Error(
- `\`pages${page}\` ${STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR}`
- )
}
} catch (err) {
if (
@@ -2151,6 +2154,13 @@ export default async function build(
}
} else {
hasDynamicData = true
+ // we might have determined during prerendering that this page
+ // used dynamic data
+ pageInfos.set(route, {
+ ...(pageInfos.get(route) as PageInfo),
+ isSsg: false,
+ static: false,
+ })
}
})
diff --git a/packages/next/build/utils.ts b/packages/next/build/utils.ts
index 8165f4a417f21..f30bd6143dc46 100644
--- a/packages/next/build/utils.ts
+++ b/packages/next/build/utils.ts
@@ -54,7 +54,7 @@ import {
} from './webpack/require-hook'
loadRequireHook()
-if (process.env.HAS_APP_DIR) {
+if (process.env.NEXT_PREBUNDLED_REACT) {
overrideBuiltInReactPackages()
}
@@ -412,7 +412,7 @@ export async function printTreeView(
(pageInfo?.ssgPageDurations?.reduce((a, b) => a + (b || 0), 0) || 0)
const symbol =
- routerType === 'app' || item === '/_app' || item === '/_app.server'
+ item === '/_app' || item === '/_app.server'
? ' '
: pageInfo?.static
? '○'
@@ -427,7 +427,7 @@ export async function printTreeView(
if (pageInfo?.initialRevalidateSeconds) usedSymbols.add('ISR')
messages.push([
- `${border} ${routerType === 'pages' ? `${symbol} ` : ''}${
+ `${border} ${symbol} ${
pageInfo?.initialRevalidateSeconds
? `${item} (ISR: ${pageInfo?.initialRevalidateSeconds} Seconds)`
: item
diff --git a/packages/next/build/webpack-config.ts b/packages/next/build/webpack-config.ts
index 375f2c760c338..be420d888ab33 100644
--- a/packages/next/build/webpack-config.ts
+++ b/packages/next/build/webpack-config.ts
@@ -125,9 +125,11 @@ function isResourceInPackages(resource: string, packageNames?: string[]) {
)
}
-const builtInReactImports = [
+const bundledReactImports = [
'react',
'react/jsx-runtime',
+ 'react/jsx-dev-runtime',
+ // 'react-dom',
'next/dist/compiled/react-server-dom-webpack/server.browser',
]
@@ -593,6 +595,11 @@ export default async function getBaseWebpackConfig(
'You are using the experimental Node.js Runtime with `experimental.runtime`.'
)
}
+ if (config.experimental.appDir) {
+ Log.warn(
+ 'You are using the experimental app directory with `experimental.appDir`, the API might change.'
+ )
+ }
}
const babelConfigFile = await BABEL_CONFIG_FILES.reduce(
@@ -1013,7 +1020,7 @@ export default async function getBaseWebpackConfig(
const crossOrigin = config.crossOrigin
const looseEsmExternals = config.experimental?.esmExternals === 'loose'
- const optoutBundlingPackages = EXTERNAL_PACKAGES.concat(
+ const optOutBundlingPackages = EXTERNAL_PACKAGES.concat(
...(config.experimental.serverComponentsExternalPackages || [])
)
@@ -1048,7 +1055,7 @@ export default async function getBaseWebpackConfig(
// Special internal modules that must be bundled for Server Components.
if (layer === WEBPACK_LAYERS.server) {
- if (builtInReactImports.includes(request)) {
+ if (bundledReactImports.includes(request)) {
return
}
}
@@ -1183,18 +1190,31 @@ export default async function getBaseWebpackConfig(
if (layer === WEBPACK_LAYERS.server) {
// All packages should be bundled for the server layer if they're not opted out.
// This option takes priority over the transpilePackages option.
- if (
- isResourceInPackages(
- res,
- config.experimental.serverComponentsExternalPackages
- )
- ) {
+ if (isResourceInPackages(res, optOutBundlingPackages)) {
return `${externalType} ${request}`
}
return
}
+ // Treat react packages as external for SSR layer,
+ // then let require-hook mapping them to internals.
+ if (layer === WEBPACK_LAYERS.client) {
+ if (
+ [
+ 'react',
+ 'react/jsx-runtime',
+ 'react/jsx-dev-runtime',
+ 'react-dom',
+ 'scheduler',
+ ].includes(request)
+ ) {
+ return `commonjs next/dist/compiled/${request}`
+ } else {
+ return
+ }
+ }
+
if (shouldBeBundled) return
// Anything else that is standard JavaScript within `node_modules`
@@ -1541,30 +1561,7 @@ export default async function getBaseWebpackConfig(
},
module: {
rules: [
- // TODO: FIXME: do NOT webpack 5 support with this
- // x-ref: https://github.com/webpack/webpack/issues/11467
- ...(!config.experimental.fullySpecified
- ? [
- {
- test: /\.m?js/,
- resolve: {
- fullySpecified: false,
- },
- } as any,
- ]
- : []),
- ...(hasAppDir && isEdgeServer
- ? [
- // The Edge bundle includes the server in its entrypoint, so it has to
- // be in the SSR layer — here we convert the actual page request to
- // the RSC layer via a webpack rule.
- {
- resourceQuery: /__edge_ssr_entry__/,
- layer: WEBPACK_LAYERS.server,
- },
- ]
- : []),
- ...(hasAppDir && !isClient
+ ...(hasAppDir && !isClient && !isEdgeServer
? [
{
issuerLayer: WEBPACK_LAYERS.server,
@@ -1573,7 +1570,10 @@ export default async function getBaseWebpackConfig(
// bundling, don't resolve it.
if (
!codeCondition.test.test(req) ||
- isResourceInPackages(req, optoutBundlingPackages)
+ isResourceInPackages(
+ req,
+ config.experimental.serverComponentsExternalPackages
+ )
) {
return false
}
@@ -1586,13 +1586,39 @@ export default async function getBaseWebpackConfig(
// If missing the alias override here, the default alias will be used which aliases
// react to the direct file path, not the package name. In that case the condition
// will be ignored completely.
- react: 'react',
- 'react-dom': 'react-dom',
+ react: 'next/dist/compiled/react',
+ 'react-dom$': isClient
+ ? 'next/dist/compiled/react-dom/index'
+ : 'next/dist/compiled/react-dom/server-rendering-stub',
+ 'react-dom/client$': 'next/dist/compiled/react-dom/client',
},
},
},
]
: []),
+ // TODO: FIXME: do NOT webpack 5 support with this
+ // x-ref: https://github.com/webpack/webpack/issues/11467
+ ...(!config.experimental.fullySpecified
+ ? [
+ {
+ test: /\.m?js/,
+ resolve: {
+ fullySpecified: false,
+ },
+ } as any,
+ ]
+ : []),
+ ...(hasAppDir && isEdgeServer
+ ? [
+ // The Edge bundle includes the server in its entrypoint, so it has to
+ // be in the SSR layer — here we convert the actual page request to
+ // the RSC layer via a webpack rule.
+ {
+ resourceQuery: /__edge_ssr_entry__/,
+ layer: WEBPACK_LAYERS.server,
+ },
+ ]
+ : []),
...(hasServerComponents && !isClient
? [
// RSC server compilation loaders
@@ -1615,7 +1641,12 @@ export default async function getBaseWebpackConfig(
? [
{
test: codeCondition.test,
- include: [appDir],
+ issuerLayer(layer: string) {
+ return (
+ layer === WEBPACK_LAYERS.client ||
+ layer === WEBPACK_LAYERS.server
+ )
+ },
resolve: {
alias: {
// Alias `next/dynamic` to React.lazy implementation for RSC
@@ -1632,12 +1663,12 @@ export default async function getBaseWebpackConfig(
{
// test: codeCondition.test,
issuerLayer: WEBPACK_LAYERS.server,
- test: (req: string) => {
+ test(req: string) {
// If it's not a source code file, or has been opted out of
// bundling, don't resolve it.
if (
!codeCondition.test.test(req) ||
- isResourceInPackages(req, optoutBundlingPackages)
+ isResourceInPackages(req, optOutBundlingPackages)
) {
return false
}
diff --git a/packages/next/build/webpack/loaders/next-font-loader/index.ts b/packages/next/build/webpack/loaders/next-font-loader/index.ts
index 6edc12b4dddc6..de340cddd0d55 100644
--- a/packages/next/build/webpack/loaders/next-font-loader/index.ts
+++ b/packages/next/build/webpack/loaders/next-font-loader/index.ts
@@ -1,10 +1,12 @@
import type { FontLoader } from '../../../../font'
+import { promises as fs } from 'fs'
import path from 'path'
import loaderUtils from 'next/dist/compiled/loader-utils3'
import postcssFontLoaderPlugn from './postcss-font-loader'
import { promisify } from 'util'
import chalk from 'next/dist/compiled/chalk'
+import { CONFIG_FILES } from '../../../../shared/lib/constants'
export default async function nextFontLoader(this: any) {
const fontLoaderSpan = this.currentTraceSpan.traceChild('next-font-loader')
@@ -17,6 +19,24 @@ export default async function nextFontLoader(this: any) {
postcss: getPostcss,
} = this.getOptions()
+ const nextConfigPaths = CONFIG_FILES.map((config) =>
+ path.join(this.rootContext, config)
+ )
+ // Add next.config.js as a dependency, loaders must rerun in case options changed
+ await Promise.all(
+ nextConfigPaths.map(async (configPath) => {
+ const hasConfig = await fs.access(configPath).then(
+ () => true,
+ () => false
+ )
+ if (hasConfig) {
+ this.addDependency(configPath)
+ } else {
+ this.addMissingDependency(configPath)
+ }
+ })
+ )
+
const emitFontFile = (content: Buffer, ext: string, preload: boolean) => {
const opts = { context: this.rootContext, content }
const interpolatedName = loaderUtils.interpolateName(
@@ -55,7 +75,7 @@ export default async function nextFontLoader(this: any) {
path.dirname(
path.join(this.rootContext, relativeFilePathFromRoot)
),
- src
+ src.startsWith('.') ? src : `./${src}`
),
fs: this.fs,
})
diff --git a/packages/next/build/webpack/loaders/next-serverless-loader/utils.ts b/packages/next/build/webpack/loaders/next-serverless-loader/utils.ts
index c1973f7341eaf..98e4834a59159 100644
--- a/packages/next/build/webpack/loaders/next-serverless-loader/utils.ts
+++ b/packages/next/build/webpack/loaders/next-serverless-loader/utils.ts
@@ -108,19 +108,19 @@ export function interpolateDynamicPath(
if (paramIdx > -1) {
let paramValue: string
+ const value = params[param]
- if (Array.isArray(params[param])) {
- paramValue = (params[param] as string[])
- .map((v) => v && encodeURIComponent(v))
- .join('/')
+ if (Array.isArray(value)) {
+ paramValue = value.map((v) => v && encodeURIComponent(v)).join('/')
+ } else if (value) {
+ paramValue = encodeURIComponent(value)
} else {
- paramValue =
- params[param] && encodeURIComponent(params[param] as string)
+ paramValue = ''
}
pathname =
pathname.slice(0, paramIdx) +
- (paramValue || '') +
+ paramValue +
pathname.slice(paramIdx + builtParam.length)
}
}
@@ -293,7 +293,7 @@ export function getUtils({
// favor named matches if available
const routeKeyNames = Object.keys(routeKeys || {})
- const filterLocaleItem = (val: string | string[]) => {
+ const filterLocaleItem = (val: string | string[] | undefined) => {
if (i18n) {
// locale items can be included in route-matches
// for fallback SSG pages so ensure they are
@@ -604,7 +604,7 @@ export function getUtils({
),
interpolateDynamicPath: (
pathname: string,
- params: Record
+ params: Record
) => interpolateDynamicPath(pathname, params, defaultRouteRegex),
}
}
diff --git a/packages/next/build/webpack/plugins/flight-client-entry-plugin.ts b/packages/next/build/webpack/plugins/flight-client-entry-plugin.ts
index 4427f89bd3d7e..41c983490cdca 100644
--- a/packages/next/build/webpack/plugins/flight-client-entry-plugin.ts
+++ b/packages/next/build/webpack/plugins/flight-client-entry-plugin.ts
@@ -67,6 +67,7 @@ export class FlightClientEntryPlugin {
compiler.hooks.afterCompile.tap(PLUGIN_NAME, (compilation) => {
traverseModules(compilation, (mod) => {
+ // const modId = compilation.chunkGraph.getModuleId(mod) + ''
// The module must has request, and resource so it's not a new entry created with loader.
// Using the client layer module, which doesn't have `rsc` tag in buildInfo.
if (mod.request && mod.resource && !mod.buildInfo.rsc) {
@@ -76,17 +77,17 @@ export class FlightClientEntryPlugin {
}
})
- const recordModule = (id: number | string, mod: any) => {
+ const recordModule = (modId: string, mod: any) => {
const modResource = mod.resourceResolveData?.path || mod.resource
if (
- mod.resourceResolveData?.context?.issuerLayer ===
- WEBPACK_LAYERS.server
+ mod.resourceResolveData?.context?.issuerLayer !==
+ WEBPACK_LAYERS.client
) {
return
}
- if (typeof id !== 'undefined' && modResource) {
+ if (typeof modId !== 'undefined' && modResource) {
// Note that this isn't that reliable as webpack is still possible to assign
// additional queries to make sure there's no conflict even using the `named`
// module ID strategy.
@@ -99,16 +100,16 @@ export class FlightClientEntryPlugin {
if (this.isEdgeServer) {
edgeServerModuleIds.set(
ssrNamedModuleId.replace(/\/next\/dist\/esm\//, '/next/dist/'),
- id
+ modId
)
} else {
- serverModuleIds.set(ssrNamedModuleId, id)
+ serverModuleIds.set(ssrNamedModuleId, modId)
}
}
}
traverseModules(compilation, (mod, _chunk, _chunkGroup, modId) => {
- recordModule(modId, mod)
+ recordModule(modId + '', mod)
})
})
}
@@ -230,9 +231,10 @@ export class FlightClientEntryPlugin {
function collectModule(entryName: string, mod: any) {
const resource = mod.resource
- if (resource) {
- if (regexCSS.test(resource)) {
- cssImportsForChunk[entryName].push(resource)
+ const modId = resource // compilation.chunkGraph.getModuleId(mod) + ''
+ if (modId) {
+ if (regexCSS.test(modId)) {
+ cssImportsForChunk[entryName].push(modId)
}
}
}
@@ -348,18 +350,20 @@ export class FlightClientEntryPlugin {
// native or installed js module: -> raw request, e.g. next/head
// client js or css: -> user request
const rawRequest = mod.rawRequest
-
// Request could be undefined or ''
if (!rawRequest) return
const isCSS = regexCSS.test(rawRequest)
- const modRequest: string | undefined =
+ const isLocal =
!isCSS &&
!rawRequest.startsWith('.') &&
!rawRequest.startsWith('/') &&
!rawRequest.startsWith(APP_DIR_ALIAS)
- ? rawRequest
- : mod.resourceResolveData?.path + mod.resourceResolveData?.query
+
+ const modRequest: string | undefined = isLocal
+ ? rawRequest // compilation.chunkGraph.getModuleId(mod) + ''
+ : mod.resourceResolveData?.path + mod.resourceResolveData?.query
+ // console.log('modId:after', modRequest)
// Ensure module is not walked again if it's already been visited
if (!visitedBySegment[layoutOrPageRequest]) {
@@ -501,9 +505,9 @@ export class FlightClientEntryPlugin {
{
// By using the same entry name
name: entryName,
- // Layer should be undefined for the SSR modules
- // This ensures the client components are
- layer: undefined,
+ // Layer should be client for the SSR modules
+ // This ensures the client components are bundled on client layer
+ layer: WEBPACK_LAYERS.client,
}
)
diff --git a/packages/next/build/webpack/plugins/flight-manifest-plugin.ts b/packages/next/build/webpack/plugins/flight-manifest-plugin.ts
index 89ec15471bcd2..81dc53caeaada 100644
--- a/packages/next/build/webpack/plugins/flight-manifest-plugin.ts
+++ b/packages/next/build/webpack/plugins/flight-manifest-plugin.ts
@@ -186,6 +186,8 @@ export class FlightManifestPlugin {
context,
mod.resourceResolveData?.path || resource
)
+ // if (resource.includes('script'))
+ // console.log('ssrNamedModuleId', ssrNamedModuleId, modId)
if (!ssrNamedModuleId.startsWith('.'))
// TODO use getModuleId instead
ssrNamedModuleId = `./${ssrNamedModuleId.replace(/\\/g, '/')}`
@@ -317,7 +319,7 @@ export class FlightManifestPlugin {
// TODO: Update type so that it doesn't have to be cast.
) as Iterable
for (const mod of chunkModules) {
- const modId = compilation.chunkGraph.getModuleId(mod)
+ const modId: string = compilation.chunkGraph.getModuleId(mod) + ''
recordModule(chunk, modId, mod)
diff --git a/packages/next/build/webpack/plugins/wellknown-errors-plugin/parseNotFoundError.ts b/packages/next/build/webpack/plugins/wellknown-errors-plugin/parseNotFoundError.ts
index a33478e7d5de5..ee0c0627c1fc9 100644
--- a/packages/next/build/webpack/plugins/wellknown-errors-plugin/parseNotFoundError.ts
+++ b/packages/next/build/webpack/plugins/wellknown-errors-plugin/parseNotFoundError.ts
@@ -85,7 +85,7 @@ export async function getNotFoundError(
.filter(
(name) =>
name &&
- !/next-(middleware|client-pages|flight-(client|server))-loader\.js/.test(
+ !/next-(middleware|client-pages|flight-(client|server|client-entry))-loader\.js/.test(
name
)
)
diff --git a/packages/next/build/webpack/plugins/wellknown-errors-plugin/parseRSC.ts b/packages/next/build/webpack/plugins/wellknown-errors-plugin/parseRSC.ts
index 7995032ac9726..0c78ff1d82f6d 100644
--- a/packages/next/build/webpack/plugins/wellknown-errors-plugin/parseRSC.ts
+++ b/packages/next/build/webpack/plugins/wellknown-errors-plugin/parseRSC.ts
@@ -25,14 +25,20 @@ export function formatRSCErrorMessage(
'\n\nMaybe one of these should be marked as a client entry with "use client":\n'
} else if (NEXT_RSC_ERR_SERVER_IMPORT.test(message)) {
const matches = message.match(NEXT_RSC_ERR_SERVER_IMPORT)
- if (matches && matches[1] === 'react-dom/server') {
- // If importing "react-dom/server", we should show a different error.
- formattedMessage = `\n\nYou're importing a component that imports react-dom/server. To fix it, render or return the content directly as a Server Component instead for perf and security.`
- } else {
- formattedMessage = message.replace(
- NEXT_RSC_ERR_SERVER_IMPORT,
- `\n\nYou're importing a component that imports $1. It only works in a Client Component but none of its parents are marked with "use client", so they're Server Components by default.\n\n`
- )
+ switch (matches && matches[1]) {
+ case 'react-dom/server':
+ // If importing "react-dom/server", we should show a different error.
+ formattedMessage = `\n\nYou're importing a component that imports react-dom/server. To fix it, render or return the content directly as a Server Component instead for perf and security.`
+ break
+ case 'next/router':
+ // If importing "next/router", we should tell them to use "next/navigation".
+ formattedMessage = `\n\nYou have a Server Component that imports next/router. Use next/navigation instead.`
+ break
+ default:
+ formattedMessage = message.replace(
+ NEXT_RSC_ERR_SERVER_IMPORT,
+ `\n\nYou're importing a component that imports $1. It only works in a Client Component but none of its parents are marked with "use client", so they're Server Components by default.\n\n`
+ )
}
formattedVerboseMessage =
'\n\nMaybe one of these should be marked as a client entry "use client":\n'
diff --git a/packages/next/client/app-index.tsx b/packages/next/client/app-index.tsx
index 7578677a474e7..d4d3bf13fe0c1 100644
--- a/packages/next/client/app-index.tsx
+++ b/packages/next/client/app-index.tsx
@@ -8,7 +8,8 @@ import { createFromReadableStream } from 'next/dist/compiled/react-server-dom-we
import measureWebVitals from './performance-relayer'
import { HeadManagerContext } from '../shared/lib/head-manager-context'
-import HotReload from './components/react-dev-overlay/hot-reloader'
+import HotReload from './components/react-dev-overlay/hot-reloader-client'
+import { GlobalLayoutRouterContext } from '../shared/lib/app-router-context'
///
@@ -186,15 +187,24 @@ export function hydrate() {
const reactRoot = (ReactDOMClient as any).createRoot(reactRootElement)
reactRoot.render(
- {},
+ focusAndScrollRef: {
+ apply: false,
},
}}
- initialTree={rootLayoutMissingTagsError.tree}
- />
+ >
+
+
)
return
diff --git a/packages/next/client/components/app-router.tsx b/packages/next/client/components/app-router.tsx
index 024dd1ab77b08..09491dc8a7c60 100644
--- a/packages/next/client/components/app-router.tsx
+++ b/packages/next/client/components/app-router.tsx
@@ -37,12 +37,12 @@ function urlToUrlWithoutFlightMarker(url: string): URL {
}
const HotReloader:
- | typeof import('./react-dev-overlay/hot-reloader').default
+ | typeof import('./react-dev-overlay/hot-reloader-client').default
| null =
process.env.NODE_ENV === 'production'
? null
- : (require('./react-dev-overlay/hot-reloader')
- .default as typeof import('./react-dev-overlay/hot-reloader').default)
+ : (require('./react-dev-overlay/hot-reloader-client')
+ .default as typeof import('./react-dev-overlay/hot-reloader-client').default)
/**
* Fetch the flight data for the provided url. Takes in the current router state to decide what to render server-side.
diff --git a/packages/next/client/components/react-dev-overlay/client.ts b/packages/next/client/components/react-dev-overlay/client.ts
deleted file mode 100644
index 726747a8346ce..0000000000000
--- a/packages/next/client/components/react-dev-overlay/client.ts
+++ /dev/null
@@ -1,71 +0,0 @@
-import { Dispatch, ReducerAction } from 'react'
-import type { errorOverlayReducer } from './internal/error-overlay-reducer'
-import {
- ACTION_BUILD_OK,
- ACTION_BUILD_ERROR,
- ACTION_REFRESH,
- ACTION_UNHANDLED_ERROR,
- ACTION_UNHANDLED_REJECTION,
-} from './internal/error-overlay-reducer'
-import { parseStack } from './internal/helpers/parseStack'
-
-export type DispatchFn = Dispatch>
-
-export function onUnhandledError(dispatch: DispatchFn, ev: ErrorEvent) {
- const error = ev?.error
- if (!error || !(error instanceof Error) || typeof error.stack !== 'string') {
- // A non-error was thrown, we don't have anything to show. :-(
- return
- }
-
- if (
- error.message.match(/(hydration|content does not match|did not match)/i)
- ) {
- error.message += `\n\nSee more info here: https://nextjs.org/docs/messages/react-hydration-error`
- }
-
- const e = error
- dispatch({
- type: ACTION_UNHANDLED_ERROR,
- reason: error,
- frames: parseStack(e.stack!),
- })
-}
-
-export function onUnhandledRejection(
- dispatch: DispatchFn,
- ev: PromiseRejectionEvent
-) {
- const reason = ev?.reason
- if (
- !reason ||
- !(reason instanceof Error) ||
- typeof reason.stack !== 'string'
- ) {
- // A non-error was thrown, we don't have anything to show. :-(
- return
- }
-
- const e = reason
- dispatch({
- type: ACTION_UNHANDLED_REJECTION,
- reason: reason,
- frames: parseStack(e.stack!),
- })
-}
-
-export function onBuildOk(dispatch: DispatchFn) {
- dispatch({ type: ACTION_BUILD_OK })
-}
-
-export function onBuildError(dispatch: DispatchFn, message: string) {
- dispatch({ type: ACTION_BUILD_ERROR, message })
-}
-
-export function onRefresh(dispatch: DispatchFn) {
- dispatch({ type: ACTION_REFRESH })
-}
-
-export { getErrorByType } from './internal/helpers/getErrorByType'
-export { getServerError } from './internal/helpers/nodeStackFrames'
-export { default as ReactDevOverlay } from './internal/ReactDevOverlay'
diff --git a/packages/next/client/components/react-dev-overlay/hot-reloader.tsx b/packages/next/client/components/react-dev-overlay/hot-reloader-client.tsx
similarity index 52%
rename from packages/next/client/components/react-dev-overlay/hot-reloader.tsx
rename to packages/next/client/components/react-dev-overlay/hot-reloader-client.tsx
index 128507a72a5bd..750fb7da79ac4 100644
--- a/packages/next/client/components/react-dev-overlay/hot-reloader.tsx
+++ b/packages/next/client/components/react-dev-overlay/hot-reloader-client.tsx
@@ -1,76 +1,52 @@
import type { ReactNode } from 'react'
-import type { FlightRouterState } from '../../../server/app-render'
import React, {
useCallback,
- useContext,
useEffect,
- useRef,
+ useReducer,
+ useMemo,
// @ts-expect-error TODO-APP: startTransition exists
startTransition,
} from 'react'
-import { GlobalLayoutRouterContext } from '../../../shared/lib/app-router-context'
-import {
- onBuildError,
- onBuildOk,
- onRefresh,
- onUnhandledError,
- onUnhandledRejection,
- ReactDevOverlay,
-} from './client'
-import type { DispatchFn } from './client'
import stripAnsi from 'next/dist/compiled/strip-ansi'
import formatWebpackMessages from '../../dev/error-overlay/format-webpack-messages'
import { useRouter } from '../navigation'
+import { errorOverlayReducer } from './internal/error-overlay-reducer'
import {
- errorOverlayReducer,
- OverlayState,
+ ACTION_BUILD_OK,
+ ACTION_BUILD_ERROR,
+ ACTION_REFRESH,
+ ACTION_UNHANDLED_ERROR,
+ ACTION_UNHANDLED_REJECTION,
} from './internal/error-overlay-reducer'
-
-function getSocketProtocol(assetPrefix: string): string {
- let protocol = window.location.protocol
-
- try {
- // assetPrefix is a url
- protocol = new URL(assetPrefix).protocol
- } catch (_) {}
-
- return protocol === 'http:' ? 'ws' : 'wss'
+import { parseStack } from './internal/helpers/parseStack'
+import ReactDevOverlay from './internal/ReactDevOverlay'
+import { useErrorHandler } from './internal/helpers/use-error-handler'
+import {
+ useSendMessage,
+ useWebsocket,
+ useWebsocketPing,
+} from './internal/helpers/use-websocket'
+
+interface Dispatcher {
+ onBuildOk(): void
+ onBuildError(message: string): void
+ onRefresh(): void
}
-// const TIMEOUT = 5000
-
// TODO-APP: add actual type
type PongEvent = any
let mostRecentCompilationHash: any = null
let __nextDevClientId = Math.round(Math.random() * 100 + Date.now())
let hadRuntimeError = false
-let hadRootlayoutError = false
// let startLatency = undefined
-function onFastRefresh(dispatch: DispatchFn, hasUpdates: boolean) {
- onBuildOk(dispatch)
+function onFastRefresh(dispatcher: Dispatcher, hasUpdates: boolean) {
+ dispatcher.onBuildOk()
if (hasUpdates) {
- onRefresh(dispatch)
+ dispatcher.onRefresh()
}
-
- // if (startLatency) {
- // const endLatency = Date.now()
- // const latency = endLatency - startLatency
- // console.log(`[Fast Refresh] done in ${latency}ms`)
- // sendMessage(
- // JSON.stringify({
- // event: 'client-hmr-latency',
- // id: __nextDevClientId,
- // startTime: startLatency,
- // endTime: endLatency,
- // })
- // )
- // // if (self.__NEXT_HMR_LATENCY_CB) {
- // // self.__NEXT_HMR_LATENCY_CB(latency)
- // // }
- // }
}
// There is a newer version of the code available.
@@ -93,21 +69,21 @@ function canApplyUpdates() {
// @ts-expect-error module.hot exists
return module.hot.status() === 'idle'
}
-// function afterApplyUpdates(fn: any) {
-// if (canApplyUpdates()) {
-// fn()
-// } else {
-// function handler(status: any) {
-// if (status === 'idle') {
-// // @ts-expect-error module.hot exists
-// module.hot.removeStatusHandler(handler)
-// fn()
-// }
-// }
-// // @ts-expect-error module.hot exists
-// module.hot.addStatusHandler(handler)
-// }
-// }
+function afterApplyUpdates(fn: any) {
+ if (canApplyUpdates()) {
+ fn()
+ } else {
+ function handler(status: any) {
+ if (status === 'idle') {
+ // @ts-expect-error module.hot exists
+ module.hot.removeStatusHandler(handler)
+ fn()
+ }
+ }
+ // @ts-expect-error module.hot exists
+ module.hot.addStatusHandler(handler)
+ }
+}
function performFullReload(err: any, sendMessage: any) {
const stackTrace =
@@ -130,23 +106,15 @@ function performFullReload(err: any, sendMessage: any) {
function tryApplyUpdates(
onHotUpdateSuccess: (hasUpdates: boolean) => void,
sendMessage: any,
- dispatch: DispatchFn
+ dispatcher: Dispatcher
) {
- // @ts-expect-error module.hot exists
- if (!module.hot) {
- // HotModuleReplacementPlugin is not in Webpack configuration.
- console.error('HotModuleReplacementPlugin is not in Webpack configuration.')
- // window.location.reload();
- return
- }
-
if (!isUpdateAvailable() || !canApplyUpdates()) {
- onBuildOk(dispatch)
+ dispatcher.onBuildOk()
return
}
function handleApplyUpdates(err: any, updatedModules: any) {
- if (err || hadRuntimeError || hadRootlayoutError || !updatedModules) {
+ if (err || hadRuntimeError || !updatedModules) {
if (err) {
console.warn(
'[Fast Refresh] performing full reload\n\n' +
@@ -174,20 +142,20 @@ function tryApplyUpdates(
if (isUpdateAvailable()) {
// While we were updating, there was a new update! Do it again.
tryApplyUpdates(
- hasUpdates ? () => onBuildOk(dispatch) : onHotUpdateSuccess,
+ hasUpdates ? () => dispatcher.onBuildOk() : onHotUpdateSuccess,
sendMessage,
- dispatch
+ dispatcher
)
} else {
- onBuildOk(dispatch)
- // if (process.env.__NEXT_TEST_MODE) {
- // afterApplyUpdates(() => {
- // if (self.__NEXT_HMR_CB) {
- // self.__NEXT_HMR_CB()
- // self.__NEXT_HMR_CB = null
- // }
- // })
- // }
+ dispatcher.onBuildOk()
+ if (process.env.__NEXT_TEST_MODE) {
+ afterApplyUpdates(() => {
+ if (self.__NEXT_HMR_CB) {
+ self.__NEXT_HMR_CB()
+ self.__NEXT_HMR_CB = null
+ }
+ })
+ }
}
}
@@ -207,13 +175,12 @@ function processMessage(
e: any,
sendMessage: any,
router: ReturnType,
- dispatch: DispatchFn
+ dispatcher: Dispatcher
) {
const obj = JSON.parse(e.data)
switch (obj.action) {
case 'building': {
- // startLatency = Date.now()
console.log('[Fast Refresh] rebuilding')
break
}
@@ -242,7 +209,7 @@ function processMessage(
})
// Only show the first error.
- onBuildError(dispatch, formatted.errors[0])
+ dispatcher.onBuildError(formatted.errors[0])
// Also log them to the console.
for (let i = 0; i < formatted.errors.length; i++) {
@@ -251,12 +218,12 @@ function processMessage(
// Do not attempt to reload now.
// We will reload on next success instead.
- // if (process.env.__NEXT_TEST_MODE) {
- // if (self.__NEXT_HMR_CB) {
- // self.__NEXT_HMR_CB(formatted.errors[0])
- // self.__NEXT_HMR_CB = null
- // }
- // }
+ if (process.env.__NEXT_TEST_MODE) {
+ if (self.__NEXT_HMR_CB) {
+ self.__NEXT_HMR_CB(formatted.errors[0])
+ self.__NEXT_HMR_CB = null
+ }
+ }
return
}
@@ -296,10 +263,10 @@ function processMessage(
function onSuccessfulHotUpdate(hasUpdates: any) {
// Only dismiss it when we're sure it's a hot update.
// Otherwise it would flicker right before the reload.
- onFastRefresh(dispatch, hasUpdates)
+ onFastRefresh(dispatcher, hasUpdates)
},
sendMessage,
- dispatch
+ dispatcher
)
}
return
@@ -323,10 +290,10 @@ function processMessage(
function onSuccessfulHotUpdate(hasUpdates: any) {
// Only dismiss it when we're sure it's a hot update.
// Otherwise it would flicker right before the reload.
- onFastRefresh(dispatch, hasUpdates)
+ onFastRefresh(dispatcher, hasUpdates)
},
sendMessage,
- dispatch
+ dispatcher
)
}
return
@@ -339,12 +306,12 @@ function processMessage(
clientId: __nextDevClientId,
})
)
- if (hadRuntimeError || hadRootlayoutError) {
+ if (hadRuntimeError) {
return window.location.reload()
}
startTransition(() => {
router.refresh()
- onRefresh(dispatch)
+ dispatcher.onRefresh()
})
return
@@ -359,34 +326,13 @@ function processMessage(
return window.location.reload()
}
case 'removedPage': {
- // const [page] = obj.data
- // if (page === window.next.router.pathname) {
- // sendMessage(
- // JSON.stringify({
- // event: 'client-removed-page',
- // clientId: window.__nextDevClientId,
- // page,
- // })
- // )
- // return window.location.reload()
- // }
+ // TODO-APP: potentially only refresh if the currently viewed page was removed.
+ router.refresh()
return
}
case 'addedPage': {
- // const [page] = obj.data
- // if (
- // page === window.next.router.pathname &&
- // typeof window.next.router.components[page] === 'undefined'
- // ) {
- // sendMessage(
- // JSON.stringify({
- // event: 'client-added-page',
- // clientId: window.__nextDevClientId,
- // page,
- // })
- // )
- // return window.location.reload()
- // }
+ // TODO-APP: potentially only refresh if the currently viewed page was added.
+ router.refresh()
return
}
case 'pong': {
@@ -394,25 +340,7 @@ function processMessage(
if (invalid) {
// Payload can be invalid even if the page does exist.
// So, we check if it can be created.
- fetch(location.href, {
- credentials: 'same-origin',
- }).then((pageRes) => {
- if (pageRes.status === 200) {
- // Page exists now, reload
- location.reload()
- } else {
- // TODO-APP: fix this
- // Page doesn't exist
- // if (
- // self.__NEXT_DATA__.page === Router.pathname &&
- // Router.pathname !== '/_error'
- // ) {
- // // We are still on the page,
- // // reload to show 404 error page
- // location.reload()
- // }
- }
- })
+ router.refresh()
}
return
}
@@ -425,115 +353,96 @@ function processMessage(
export default function HotReload({
assetPrefix,
children,
- initialState,
- initialTree,
}: {
assetPrefix: string
children?: ReactNode
- initialState?: Partial
- initialTree?: FlightRouterState
}) {
- if (initialState?.rootLayoutMissingTagsError) {
- hadRootlayoutError = true
- }
- const stacktraceLimitRef = useRef()
- const [state, dispatch] = React.useReducer(errorOverlayReducer, {
+ const [state, dispatch] = useReducer(errorOverlayReducer, {
nextId: 1,
buildError: null,
errors: [],
- ...initialState,
})
-
- const handleOnUnhandledError = useCallback((ev) => {
- if (
- ev.error &&
- ev.error.digest &&
- (ev.error.digest.startsWith('NEXT_REDIRECT') ||
- ev.error.digest === 'NEXT_NOT_FOUND')
- ) {
- ev.preventDefault()
- return
+ const dispatcher = useMemo((): Dispatcher => {
+ return {
+ onBuildOk(): void {
+ dispatch({ type: ACTION_BUILD_OK })
+ },
+ onBuildError(message: string): void {
+ dispatch({ type: ACTION_BUILD_ERROR, message })
+ },
+ onRefresh(): void {
+ dispatch({ type: ACTION_REFRESH })
+ },
}
+ }, [dispatch])
- hadRuntimeError = true
- onUnhandledError(dispatch, ev)
- }, [])
- const handleOnUnhandledRejection = useCallback((ev) => {
- hadRuntimeError = true
- onUnhandledRejection(dispatch, ev)
- }, [])
-
- const { tree } = useContext(GlobalLayoutRouterContext) ?? {
- tree: initialTree,
- }
- const router = useRouter()
-
- const webSocketRef = useRef()
- const sendMessage = useCallback((data) => {
- const socket = webSocketRef.current
- if (!socket || socket.readyState !== socket.OPEN) return
- return socket.send(data)
- }, [])
-
- useEffect(() => {
- try {
- const limit = Error.stackTraceLimit
- Error.stackTraceLimit = 50
- stacktraceLimitRef.current = limit
- } catch {}
-
- window.addEventListener('error', handleOnUnhandledError)
- window.addEventListener('unhandledrejection', handleOnUnhandledRejection)
- return () => {
- if (stacktraceLimitRef.current !== undefined) {
- try {
- Error.stackTraceLimit = stacktraceLimitRef.current
- } catch {}
- stacktraceLimitRef.current = undefined
+ const handleOnUnhandledError = useCallback(
+ (ev: WindowEventMap['error']): void => {
+ if (
+ ev.error &&
+ ev.error.digest &&
+ (ev.error.digest.startsWith('NEXT_REDIRECT') ||
+ ev.error.digest === 'NEXT_NOT_FOUND')
+ ) {
+ ev.preventDefault()
+ return
}
- window.removeEventListener('error', handleOnUnhandledError)
- window.removeEventListener(
- 'unhandledrejection',
- handleOnUnhandledRejection
- )
- }
- }, [handleOnUnhandledError, handleOnUnhandledRejection])
+ hadRuntimeError = true
+ const error = ev?.error
+ if (
+ !error ||
+ !(error instanceof Error) ||
+ typeof error.stack !== 'string'
+ ) {
+ // A non-error was thrown, we don't have anything to show. :-(
+ return
+ }
- useEffect(() => {
- if (webSocketRef.current) {
- return
- }
+ if (
+ error.message.match(/(hydration|content does not match|did not match)/i)
+ ) {
+ error.message += `\n\nSee more info here: https://nextjs.org/docs/messages/react-hydration-error`
+ }
- const { hostname, port } = window.location
- const protocol = getSocketProtocol(assetPrefix)
- const normalizedAssetPrefix = assetPrefix.replace(/^\/+/, '')
+ const e = error
+ dispatch({
+ type: ACTION_UNHANDLED_ERROR,
+ reason: error,
+ frames: parseStack(e.stack!),
+ })
+ },
+ []
+ )
+ const handleOnUnhandledRejection = useCallback(
+ (ev: WindowEventMap['unhandledrejection']): void => {
+ hadRuntimeError = true
+ const reason = ev?.reason
+ if (
+ !reason ||
+ !(reason instanceof Error) ||
+ typeof reason.stack !== 'string'
+ ) {
+ // A non-error was thrown, we don't have anything to show. :-(
+ return
+ }
- let url = `${protocol}://${hostname}:${port}${
- normalizedAssetPrefix ? `/${normalizedAssetPrefix}` : ''
- }`
+ const e = reason
+ dispatch({
+ type: ACTION_UNHANDLED_REJECTION,
+ reason: reason,
+ frames: parseStack(e.stack!),
+ })
+ },
+ []
+ )
+ useErrorHandler(handleOnUnhandledError, handleOnUnhandledRejection)
- if (normalizedAssetPrefix.startsWith('http')) {
- url = `${protocol}://${normalizedAssetPrefix.split('://')[1]}`
- }
+ const webSocketRef = useWebsocket(assetPrefix)
+ useWebsocketPing(webSocketRef)
+ const sendMessage = useSendMessage(webSocketRef)
- webSocketRef.current = new window.WebSocket(`${url}/_next/webpack-hmr`)
- }, [assetPrefix])
- useEffect(() => {
- // Taken from on-demand-entries-client.js
- // TODO-APP: check 404 case
- const interval = setInterval(() => {
- sendMessage(
- JSON.stringify({
- event: 'ping',
- // TODO-APP: fix case for dynamic parameters, this will be resolved wrong currently.
- tree,
- appDirRoute: true,
- })
- )
- }, 2500)
- return () => clearInterval(interval)
- }, [tree, sendMessage])
+ const router = useRouter()
useEffect(() => {
const handler = (event: MessageEvent) => {
if (
@@ -545,32 +454,19 @@ export default function HotReload({
}
try {
- processMessage(event, sendMessage, router, dispatch)
+ processMessage(event, sendMessage, router, dispatcher)
} catch (ex) {
console.warn('Invalid HMR message: ' + event.data + '\n', ex)
}
}
- if (webSocketRef.current) {
- webSocketRef.current.addEventListener('message', handler)
+ const websocket = webSocketRef.current
+ if (websocket) {
+ websocket.addEventListener('message', handler)
}
- return () =>
- webSocketRef.current &&
- webSocketRef.current.removeEventListener('message', handler)
- }, [sendMessage, router])
- // useEffect(() => {
- // const interval = setInterval(function () {
- // if (
- // lastActivityRef.current &&
- // Date.now() - lastActivityRef.current > TIMEOUT
- // ) {
- // handleDisconnect()
- // }
- // }, 2500)
-
- // return () => clearInterval(interval)
- // })
+ return () => websocket && websocket.removeEventListener('message', handler)
+ }, [sendMessage, router, webSocketRef, dispatcher])
return {children}
}
diff --git a/packages/next/client/components/react-dev-overlay/internal/helpers/get-socket-protocol.ts b/packages/next/client/components/react-dev-overlay/internal/helpers/get-socket-protocol.ts
new file mode 100644
index 0000000000000..a8a13cdc2bf76
--- /dev/null
+++ b/packages/next/client/components/react-dev-overlay/internal/helpers/get-socket-protocol.ts
@@ -0,0 +1,10 @@
+export function getSocketProtocol(assetPrefix: string): string {
+ let protocol = window.location.protocol
+
+ try {
+ // assetPrefix is a url
+ protocol = new URL(assetPrefix).protocol
+ } catch (_) {}
+
+ return protocol === 'http:' ? 'ws' : 'wss'
+}
diff --git a/packages/next/client/components/react-dev-overlay/internal/helpers/use-error-handler.ts b/packages/next/client/components/react-dev-overlay/internal/helpers/use-error-handler.ts
new file mode 100644
index 0000000000000..d5867de015dca
--- /dev/null
+++ b/packages/next/client/components/react-dev-overlay/internal/helpers/use-error-handler.ts
@@ -0,0 +1,35 @@
+import { useEffect, useRef } from 'react'
+
+export function useErrorHandler(
+ handleOnUnhandledError: (event: WindowEventMap['error']) => void,
+ handleOnUnhandledRejection: (
+ event: WindowEventMap['unhandledrejection']
+ ) => void
+) {
+ const stacktraceLimitRef = useRef()
+
+ useEffect(() => {
+ try {
+ const limit = Error.stackTraceLimit
+ Error.stackTraceLimit = 50
+ stacktraceLimitRef.current = limit
+ } catch {}
+
+ window.addEventListener('error', handleOnUnhandledError)
+ window.addEventListener('unhandledrejection', handleOnUnhandledRejection)
+ return () => {
+ if (stacktraceLimitRef.current !== undefined) {
+ try {
+ Error.stackTraceLimit = stacktraceLimitRef.current
+ } catch {}
+ stacktraceLimitRef.current = undefined
+ }
+
+ window.removeEventListener('error', handleOnUnhandledError)
+ window.removeEventListener(
+ 'unhandledrejection',
+ handleOnUnhandledRejection
+ )
+ }
+ }, [handleOnUnhandledError, handleOnUnhandledRejection])
+}
diff --git a/packages/next/client/components/react-dev-overlay/internal/helpers/use-websocket.ts b/packages/next/client/components/react-dev-overlay/internal/helpers/use-websocket.ts
new file mode 100644
index 0000000000000..91405df55e1b6
--- /dev/null
+++ b/packages/next/client/components/react-dev-overlay/internal/helpers/use-websocket.ts
@@ -0,0 +1,66 @@
+import { useCallback, useContext, useEffect, useRef } from 'react'
+import { GlobalLayoutRouterContext } from '../../../../../shared/lib/app-router-context'
+import { getSocketProtocol } from './get-socket-protocol'
+
+export function useWebsocket(assetPrefix: string) {
+ const webSocketRef = useRef()
+
+ useEffect(() => {
+ if (webSocketRef.current) {
+ return
+ }
+
+ const { hostname, port } = window.location
+ const protocol = getSocketProtocol(assetPrefix)
+ const normalizedAssetPrefix = assetPrefix.replace(/^\/+/, '')
+
+ let url = `${protocol}://${hostname}:${port}${
+ normalizedAssetPrefix ? `/${normalizedAssetPrefix}` : ''
+ }`
+
+ if (normalizedAssetPrefix.startsWith('http')) {
+ url = `${protocol}://${normalizedAssetPrefix.split('://')[1]}`
+ }
+
+ webSocketRef.current = new window.WebSocket(`${url}/_next/webpack-hmr`)
+ }, [assetPrefix])
+
+ return webSocketRef
+}
+
+export function useSendMessage(webSocketRef: ReturnType) {
+ const sendMessage = useCallback(
+ (data) => {
+ const socket = webSocketRef.current
+ if (!socket || socket.readyState !== socket.OPEN) {
+ return
+ }
+ return socket.send(data)
+ },
+ [webSocketRef]
+ )
+ return sendMessage
+}
+
+export function useWebsocketPing(
+ websocketRef: ReturnType
+) {
+ const sendMessage = useSendMessage(websocketRef)
+ const { tree } = useContext(GlobalLayoutRouterContext)
+
+ useEffect(() => {
+ // Taken from on-demand-entries-client.js
+ // TODO-APP: check 404 case
+ const interval = setInterval(() => {
+ sendMessage(
+ JSON.stringify({
+ event: 'ping',
+ // TODO-APP: fix case for dynamic parameters, this will be resolved wrong currently.
+ tree,
+ appDirRoute: true,
+ })
+ )
+ }, 2500)
+ return () => clearInterval(interval)
+ }, [tree, sendMessage])
+}
diff --git a/packages/next/client/image.tsx b/packages/next/client/image.tsx
index da4910cadd5a5..bced56ead3475 100644
--- a/packages/next/client/image.tsx
+++ b/packages/next/client/image.tsx
@@ -299,7 +299,7 @@ function handleLoading(
onLoadingCompleteRef.current(img)
}
if (process.env.NODE_ENV !== 'production') {
- if (img.getAttribute('data-nimg') === 'future-fill') {
+ if (img.getAttribute('data-nimg') === 'fill') {
if (
!img.getAttribute('sizes') ||
img.getAttribute('sizes') === '100vw'
@@ -378,7 +378,7 @@ const ImageElement = ({
width={widthInt}
height={heightInt}
decoding="async"
- data-nimg={`future${fill ? '-fill' : ''}`}
+ data-nimg={fill ? 'fill' : '1'}
className={className}
// @ts-ignore - TODO: upgrade to `@types/react@17`
loading={loading}
diff --git a/packages/next/client/script.tsx b/packages/next/client/script.tsx
index ee3b4aec0db8b..52080d4027bc6 100644
--- a/packages/next/client/script.tsx
+++ b/packages/next/client/script.tsx
@@ -259,7 +259,7 @@ function Script(props: ScriptProps): JSX.Element | null {
// For the app directory, we need React Float to preload these scripts.
if (appDir) {
// Before interactive scripts need to be loaded by Next.js' runtime instead
- // of native