From 3bc6c25eebe4e66575f90f97d40af3b62c334ada Mon Sep 17 00:00:00 2001 From: Leah Date: Tue, 4 Apr 2023 15:26:30 +0200 Subject: [PATCH] update snapshots --- .../next-dynamic/too-many-arguments/output.js | 11 ++-- .../next-font-loaders/export-let/output.js | 4 +- .../next-font-loaders/not-const/output.js | 4 +- .../options-object/output.js | 8 +-- .../next-font-loaders/spread-arg/output.js | 2 +- .../output.stderr | 2 +- .../client-graph/client-only/output.js | 4 +- .../get-server-side-props/output.stderr | 3 +- .../get-static-props/output.stderr | 3 +- .../client-graph/server-only/output.js | 4 +- .../client-graph/server-only/output.stderr | 2 +- .../client-graph/use-client/output.js | 7 ++- .../client-graph/use-client/output.stderr | 10 +-- .../server-graph/client-only/output.js | 4 +- .../server-graph/client-only/output.stderr | 2 +- .../get-server-side-props/output.stderr | 3 +- .../get-static-props/output.stderr | 3 +- .../server-graph/react-api/output.js | 2 +- .../server-graph/react-api/output.stderr | 62 +++++++++---------- .../server-graph/react-dom-api/output.js | 2 +- .../server-graph/react-dom-api/output.stderr | 22 +++---- .../react-dom-server-client/output.js | 6 +- .../react-dom-server-client/output.stderr | 4 +- .../errors/server-actions/11/output.stderr | 8 +-- .../errors/server-actions/4/output.stderr | 2 +- .../errors/server-actions/8/output.stderr | 8 --- .../errors/server-actions/9/output.stderr | 10 +-- .../default-import/output.js | 2 +- .../next-font-loaders/export-const/output.js | 4 +- .../next-font-loaders/exports/output.js | 4 +- .../next-font-loaders/font-options/output.js | 2 +- .../next-font-loaders/import-as/output.js | 2 +- .../next-font-loaders/many-args/output.js | 2 +- .../multiple-calls/output.js | 4 +- .../multiple-font-downloaders/output.js | 4 +- .../multiple-fonts/output.js | 4 +- .../multiple-imports/output.js | 4 +- .../next-font-loaders/no-args/output.js | 2 +- .../custom/simple/output.js | 8 +-- .../default/simple/output.js | 12 ++-- .../client-graph/client-entry/output.js | 12 ++-- .../remove-console/all/simple/output.js | 16 +++-- .../all/toplevel-override/output.js | 7 +-- .../server-actions/server/18/output.js | 16 +++-- .../server-actions/server/19/output.js | 8 ++- .../fixture/server-actions/server/8/output.js | 4 +- .../core/tests/loader/front/attr-1/output.js | 8 +-- .../loader/styled-components/1/output.js | 2 +- .../js/src/polyfill/app-polyfills.ts | 1 - ...ror resolving commonjs request-7e0ea5.txt} | 4 +- ...ror resolving commonjs request-bab04e.txt} | 4 +- ...ror resolving commonjs request-786567.txt} | 4 +- .../errors/too-many-arguments/output-turbo.js | 4 +- .../too-many-arguments/output-webpack.js | 4 +- .../output.stderr | 2 +- .../output.stderr | 4 +- .../output.stderr | 4 +- .../output.stderr | 2 +- .../output-data.js | 12 ++-- .../output-default.js | 4 +- .../output-data.js | 12 ++-- .../output-default.js | 4 +- .../output-data.js | 12 ++-- .../output-default.js | 4 +- .../output-data.js | 20 +++--- .../output-default.js | 6 +- .../getStaticProps/issue-30091/output-data.js | 8 +-- .../not-mix-up-bindings/output-data.js | 20 +++--- .../output-data.js | 10 ++- .../output-default.js | 12 ++-- .../output-data.js | 45 ++++++-------- .../output-default.js | 39 ++++-------- .../output-data.js | 2 +- .../output-data.js | 2 +- .../output-default.js | 4 +- .../output-data.js | 52 ++++++++-------- .../output-default.js | 50 +++++++-------- .../output-data.js | 4 +- .../output-data.js | 10 ++- .../output-default.js | 8 +-- .../support-full-re-export/output-data.js | 2 +- .../support-full-re-export/output-default.js | 2 +- .../fixtures/propTypes/complex/output-data.js | 5 +- .../propTypes/complex/output-default.js | 2 +- .../propTypes/simple/output-default.js | 9 +-- 85 files changed, 338 insertions(+), 384 deletions(-) rename packages/next-swc/crates/next-dev-tests/tests/integration/turbopack/basic/comptime/issues/{Error resolving commonjs request-3ad478.txt => Error resolving commonjs request-7e0ea5.txt} (95%) rename packages/next-swc/crates/next-dev-tests/tests/integration/webpack/chunks/__skipped__/weak-dependencies-context/issues/{Error resolving commonjs request-6f1be7.txt => Error resolving commonjs request-bab04e.txt} (95%) rename packages/next-swc/crates/next-dev-tests/tests/integration/webpack/chunks/__skipped__/weak-dependencies/issues/{Error resolving commonjs request-35f347.txt => Error resolving commonjs request-786567.txt} (95%) diff --git a/packages/next-swc/crates/core/tests/errors/next-dynamic/too-many-arguments/output.js b/packages/next-swc/crates/core/tests/errors/next-dynamic/too-many-arguments/output.js index b313c3ab6ac5b..d99b72796a656 100644 --- a/packages/next-swc/crates/core/tests/errors/next-dynamic/too-many-arguments/output.js +++ b/packages/next-swc/crates/core/tests/errors/next-dynamic/too-many-arguments/output.js @@ -1,7 +1,4 @@ -import dynamic from 'next/dynamic' - -const DynamicComponentWithCustomLoading = dynamic( - () => import('../components/hello'), - { loading: () =>

...

}, - "3rd" -) +import dynamic from 'next/dynamic'; +const DynamicComponentWithCustomLoading = dynamic(()=>import('../components/hello'), { + loading: ()=>

...

+}, '3rd'); diff --git a/packages/next-swc/crates/core/tests/errors/next-font-loaders/export-let/output.js b/packages/next-swc/crates/core/tests/errors/next-font-loaders/export-let/output.js index 95d8ec34da54c..973de0d93d02f 100644 --- a/packages/next-swc/crates/core/tests/errors/next-font-loaders/export-let/output.js +++ b/packages/next-swc/crates/core/tests/errors/next-font-loaders/export-let/output.js @@ -1,5 +1,5 @@ -import firaCode from '@next/font/google/target.css?{"path":"pages/test.tsx","import":"Abel","arguments":[],"variableName":"firaCode"}'; -import inter from '@next/font/google/target.css?{"path":"pages/test.tsx","import":"Inter","arguments":[],"variableName":"inter"}'; +import firaCode from '@next/font/google/target.css?{"arguments":[],"import":"Abel","path":"pages/test.tsx","variableName":"firaCode"}'; +import inter from '@next/font/google/target.css?{"arguments":[],"import":"Inter","path":"pages/test.tsx","variableName":"inter"}'; import React from 'react'; export { firaCode }; export { inter }; diff --git a/packages/next-swc/crates/core/tests/errors/next-font-loaders/not-const/output.js b/packages/next-swc/crates/core/tests/errors/next-font-loaders/not-const/output.js index 0bb18ca8d624d..425402c188945 100644 --- a/packages/next-swc/crates/core/tests/errors/next-font-loaders/not-const/output.js +++ b/packages/next-swc/crates/core/tests/errors/next-font-loaders/not-const/output.js @@ -1,4 +1,4 @@ -import inter1 from '@next/font/google/target.css?{"path":"pages/test.tsx","import":"Inter","arguments":[{"variant":"400"}],"variableName":"inter1"}'; -import inter2 from '@next/font/google/target.css?{"path":"pages/test.tsx","import":"Inter","arguments":[{"variant":"400"}],"variableName":"inter2"}'; +import inter1 from '@next/font/google/target.css?{"arguments":[{"variant":"400"}],"import":"Inter","path":"pages/test.tsx","variableName":"inter1"}'; +import inter2 from '@next/font/google/target.css?{"arguments":[{"variant":"400"}],"import":"Inter","path":"pages/test.tsx","variableName":"inter2"}'; var i = 10; var i2 = 20; diff --git a/packages/next-swc/crates/core/tests/errors/next-font-loaders/options-object/output.js b/packages/next-swc/crates/core/tests/errors/next-font-loaders/options-object/output.js index 7fac43692f14a..8c529fdc2bba0 100644 --- a/packages/next-swc/crates/core/tests/errors/next-font-loaders/options-object/output.js +++ b/packages/next-swc/crates/core/tests/errors/next-font-loaders/options-object/output.js @@ -1,7 +1,7 @@ -import a from '@next/font/google/target.css?{"path":"pages/test.tsx","import":"ABeeZee","arguments":[{}],"variableName":"a"}'; -import a from '@next/font/google/target.css?{"path":"pages/test.tsx","import":"ABeeZee","arguments":[{}],"variableName":"a"}'; -import a from '@next/font/google/target.css?{"path":"pages/test.tsx","import":"ABeeZee","arguments":[{}],"variableName":"a"}'; -import a from '@next/font/google/target.css?{"path":"pages/test.tsx","import":"ABeeZee","arguments":[{}],"variableName":"a"}'; +import a from '@next/font/google/target.css?{"arguments":[{}],"import":"ABeeZee","path":"pages/test.tsx","variableName":"a"}'; +import a from '@next/font/google/target.css?{"arguments":[{}],"import":"ABeeZee","path":"pages/test.tsx","variableName":"a"}'; +import a from '@next/font/google/target.css?{"arguments":[{}],"import":"ABeeZee","path":"pages/test.tsx","variableName":"a"}'; +import a from '@next/font/google/target.css?{"arguments":[{}],"import":"ABeeZee","path":"pages/test.tsx","variableName":"a"}'; const a = fn({ 10: 'hello' }); diff --git a/packages/next-swc/crates/core/tests/errors/next-font-loaders/spread-arg/output.js b/packages/next-swc/crates/core/tests/errors/next-font-loaders/spread-arg/output.js index 20ca40247accd..5ed2c34fcd864 100644 --- a/packages/next-swc/crates/core/tests/errors/next-font-loaders/spread-arg/output.js +++ b/packages/next-swc/crates/core/tests/errors/next-font-loaders/spread-arg/output.js @@ -1,2 +1,2 @@ -import inter from '@next/font/google/target.css?{"path":"pages/test.tsx","import":"Inter","arguments":[{},[]],"variableName":"inter"}'; +import inter from '@next/font/google/target.css?{"arguments":[{},[]],"import":"Inter","path":"pages/test.tsx","variableName":"inter"}'; const a = fn(...{}, ...[]); diff --git a/packages/next-swc/crates/core/tests/errors/next-ssg/server-side-after-static-props/output.stderr b/packages/next-swc/crates/core/tests/errors/next-ssg/server-side-after-static-props/output.stderr index 820696a2c5188..d687921cc6333 100644 --- a/packages/next-swc/crates/core/tests/errors/next-ssg/server-side-after-static-props/output.stderr +++ b/packages/next-swc/crates/core/tests/errors/next-ssg/server-side-after-static-props/output.stderr @@ -2,6 +2,6 @@ x You can not use getStaticProps or getStaticPaths with getServerSideProps. To use SSG, please remove getServerSideProps ,-[input.js:1:1] 1 | const getStaticProps = async () => {} - 2 | export { a as getServerSideProps } + 2 | export { a as getServerSideProps } : ^^^^^^^^^^^^^^^^^^ `---- diff --git a/packages/next-swc/crates/core/tests/errors/react-server-components/client-graph/client-only/output.js b/packages/next-swc/crates/core/tests/errors/react-server-components/client-graph/client-only/output.js index b7e34fed0ea2a..3ac3698ea087b 100644 --- a/packages/next-swc/crates/core/tests/errors/react-server-components/client-graph/client-only/output.js +++ b/packages/next-swc/crates/core/tests/errors/react-server-components/client-graph/client-only/output.js @@ -1,8 +1,8 @@ // This is a comment. -"use strict"; +'use strict'; /** * This is a comment. - */ import "client-only"; + */ import 'client-only'; export default function() { return null; } diff --git a/packages/next-swc/crates/core/tests/errors/react-server-components/client-graph/get-server-side-props/output.stderr b/packages/next-swc/crates/core/tests/errors/react-server-components/client-graph/get-server-side-props/output.stderr index c691cf773428e..15af30b8c7ead 100644 --- a/packages/next-swc/crates/core/tests/errors/react-server-components/client-graph/get-server-side-props/output.stderr +++ b/packages/next-swc/crates/core/tests/errors/react-server-components/client-graph/get-server-side-props/output.stderr @@ -1,7 +1,6 @@ x NEXT_RSC_ERR_INVALID_API: getServerSideProps ,-[input.js:1:1] - 1 | export function getServerSideProps (){ + 1 | export function getServerSideProps() {} : ^^^^^^^^^^^^^^^^^^ - 2 | } `---- diff --git a/packages/next-swc/crates/core/tests/errors/react-server-components/client-graph/get-static-props/output.stderr b/packages/next-swc/crates/core/tests/errors/react-server-components/client-graph/get-static-props/output.stderr index e36cc7eec714f..a9a4efd951863 100644 --- a/packages/next-swc/crates/core/tests/errors/react-server-components/client-graph/get-static-props/output.stderr +++ b/packages/next-swc/crates/core/tests/errors/react-server-components/client-graph/get-static-props/output.stderr @@ -1,7 +1,6 @@ x NEXT_RSC_ERR_INVALID_API: getStaticProps ,-[input.js:1:1] - 1 | export function getStaticProps (){ + 1 | export function getStaticProps() {} : ^^^^^^^^^^^^^^ - 2 | } `---- diff --git a/packages/next-swc/crates/core/tests/errors/react-server-components/client-graph/server-only/output.js b/packages/next-swc/crates/core/tests/errors/react-server-components/client-graph/server-only/output.js index 889d68cc97f20..4766155152a11 100644 --- a/packages/next-swc/crates/core/tests/errors/react-server-components/client-graph/server-only/output.js +++ b/packages/next-swc/crates/core/tests/errors/react-server-components/client-graph/server-only/output.js @@ -1,8 +1,8 @@ // This is a comment. -"use strict"; +'use strict'; /** * This is a comment. - */ import "server-only"; + */ import 'server-only'; export default function() { return null; } diff --git a/packages/next-swc/crates/core/tests/errors/react-server-components/client-graph/server-only/output.stderr b/packages/next-swc/crates/core/tests/errors/react-server-components/client-graph/server-only/output.stderr index e7e8a407948f2..5e1f3f9f38fe6 100644 --- a/packages/next-swc/crates/core/tests/errors/react-server-components/client-graph/server-only/output.stderr +++ b/packages/next-swc/crates/core/tests/errors/react-server-components/client-graph/server-only/output.stderr @@ -2,6 +2,6 @@ x NEXT_RSC_ERR_CLIENT_IMPORT: server-only ,-[input.js:8:1] 8 | - 9 | import "server-only" + 9 | import 'server-only' : ^^^^^^^^^^^^^^^^^^^^ `---- diff --git a/packages/next-swc/crates/core/tests/errors/react-server-components/client-graph/use-client/output.js b/packages/next-swc/crates/core/tests/errors/react-server-components/client-graph/use-client/output.js index da774a566f24e..840a45ad97feb 100644 --- a/packages/next-swc/crates/core/tests/errors/react-server-components/client-graph/use-client/output.js +++ b/packages/next-swc/crates/core/tests/errors/react-server-components/client-graph/use-client/output.js @@ -1,4 +1,5 @@ -import "react"; -export default function () { - return null; +import 'react'; +'use client'; +export default function() { + return null; } diff --git a/packages/next-swc/crates/core/tests/errors/react-server-components/client-graph/use-client/output.stderr b/packages/next-swc/crates/core/tests/errors/react-server-components/client-graph/use-client/output.stderr index cd82768b2fa26..7be30ea0e46fa 100644 --- a/packages/next-swc/crates/core/tests/errors/react-server-components/client-graph/use-client/output.stderr +++ b/packages/next-swc/crates/core/tests/errors/react-server-components/client-graph/use-client/output.stderr @@ -1,7 +1,7 @@ - x NEXT_RSC_ERR_CLIENT_DIRECTIVE - ,-[input.js:2:1] - 2 | - 3 | "use client" - : ^^^^^^^^^^^^ + x NEXT_RSC_ERR_CLIENT_DIRECTIVE_PAREN + ,-[input.js:1:1] + 1 | import 'react' + 2 | ;('use client') + : ^^^^^^^^^^^^^^ `---- diff --git a/packages/next-swc/crates/core/tests/errors/react-server-components/server-graph/client-only/output.js b/packages/next-swc/crates/core/tests/errors/react-server-components/server-graph/client-only/output.js index b7e34fed0ea2a..3ac3698ea087b 100644 --- a/packages/next-swc/crates/core/tests/errors/react-server-components/server-graph/client-only/output.js +++ b/packages/next-swc/crates/core/tests/errors/react-server-components/server-graph/client-only/output.js @@ -1,8 +1,8 @@ // This is a comment. -"use strict"; +'use strict'; /** * This is a comment. - */ import "client-only"; + */ import 'client-only'; export default function() { return null; } diff --git a/packages/next-swc/crates/core/tests/errors/react-server-components/server-graph/client-only/output.stderr b/packages/next-swc/crates/core/tests/errors/react-server-components/server-graph/client-only/output.stderr index 46b220fc0bdc1..9258cf9c26c5e 100644 --- a/packages/next-swc/crates/core/tests/errors/react-server-components/server-graph/client-only/output.stderr +++ b/packages/next-swc/crates/core/tests/errors/react-server-components/server-graph/client-only/output.stderr @@ -2,6 +2,6 @@ x NEXT_RSC_ERR_SERVER_IMPORT: client-only ,-[input.js:8:1] 8 | - 9 | import "client-only" + 9 | import 'client-only' : ^^^^^^^^^^^^^^^^^^^^ `---- diff --git a/packages/next-swc/crates/core/tests/errors/react-server-components/server-graph/get-server-side-props/output.stderr b/packages/next-swc/crates/core/tests/errors/react-server-components/server-graph/get-server-side-props/output.stderr index c691cf773428e..15af30b8c7ead 100644 --- a/packages/next-swc/crates/core/tests/errors/react-server-components/server-graph/get-server-side-props/output.stderr +++ b/packages/next-swc/crates/core/tests/errors/react-server-components/server-graph/get-server-side-props/output.stderr @@ -1,7 +1,6 @@ x NEXT_RSC_ERR_INVALID_API: getServerSideProps ,-[input.js:1:1] - 1 | export function getServerSideProps (){ + 1 | export function getServerSideProps() {} : ^^^^^^^^^^^^^^^^^^ - 2 | } `---- diff --git a/packages/next-swc/crates/core/tests/errors/react-server-components/server-graph/get-static-props/output.stderr b/packages/next-swc/crates/core/tests/errors/react-server-components/server-graph/get-static-props/output.stderr index e36cc7eec714f..a9a4efd951863 100644 --- a/packages/next-swc/crates/core/tests/errors/react-server-components/server-graph/get-static-props/output.stderr +++ b/packages/next-swc/crates/core/tests/errors/react-server-components/server-graph/get-static-props/output.stderr @@ -1,7 +1,6 @@ x NEXT_RSC_ERR_INVALID_API: getStaticProps ,-[input.js:1:1] - 1 | export function getStaticProps (){ + 1 | export function getStaticProps() {} : ^^^^^^^^^^^^^^ - 2 | } `---- diff --git a/packages/next-swc/crates/core/tests/errors/react-server-components/server-graph/react-api/output.js b/packages/next-swc/crates/core/tests/errors/react-server-components/server-graph/react-api/output.js index 39c2869473c37..1a8c93cd6e0fc 100644 --- a/packages/next-swc/crates/core/tests/errors/react-server-components/server-graph/react-api/output.js +++ b/packages/next-swc/crates/core/tests/errors/react-server-components/server-graph/react-api/output.js @@ -1,7 +1,7 @@ import { useState } from 'react'; import { createContext } from 'react'; import { useEffect, useImperativeHandle } from 'react'; -import { Component, createFactory, PureComponent, useDeferredValue, useInsertionEffect, useLayoutEffect, useReducer, useRef, useSyncExternalStore } from "react"; +import { Component, createFactory, PureComponent, useDeferredValue, useInsertionEffect, useLayoutEffect, useReducer, useRef, useSyncExternalStore } from 'react'; export default function() { return null; } diff --git a/packages/next-swc/crates/core/tests/errors/react-server-components/server-graph/react-api/output.stderr b/packages/next-swc/crates/core/tests/errors/react-server-components/server-graph/react-api/output.stderr index 5cf8615a23a28..38903b87918d7 100644 --- a/packages/next-swc/crates/core/tests/errors/react-server-components/server-graph/react-api/output.stderr +++ b/packages/next-swc/crates/core/tests/errors/react-server-components/server-graph/react-api/output.stderr @@ -29,71 +29,71 @@ x NEXT_RSC_ERR_REACT_API: Component ,-[input.js:7:1] 7 | import { - 8 | Component, - : ^^^^^^^^^ - 9 | createFactory, + 8 | Component, + : ^^^^^^^^^ + 9 | createFactory, `---- x NEXT_RSC_ERR_REACT_API: createFactory ,-[input.js:8:1] - 8 | Component, - 9 | createFactory, - : ^^^^^^^^^^^^^ - 10 | PureComponent, + 8 | Component, + 9 | createFactory, + : ^^^^^^^^^^^^^ + 10 | PureComponent, `---- x NEXT_RSC_ERR_REACT_API: PureComponent ,-[input.js:9:1] - 9 | createFactory, - 10 | PureComponent, - : ^^^^^^^^^^^^^ + 9 | createFactory, + 10 | PureComponent, + : ^^^^^^^^^^^^^ 11 | useDeferredValue, `---- x NEXT_RSC_ERR_REACT_API: useDeferredValue ,-[input.js:10:1] - 10 | PureComponent, + 10 | PureComponent, 11 | useDeferredValue, : ^^^^^^^^^^^^^^^^ - 12 | useInsertionEffect, + 12 | useInsertionEffect, `---- x NEXT_RSC_ERR_REACT_API: useInsertionEffect ,-[input.js:11:1] 11 | useDeferredValue, - 12 | useInsertionEffect, - : ^^^^^^^^^^^^^^^^^^ - 13 | useLayoutEffect, + 12 | useInsertionEffect, + : ^^^^^^^^^^^^^^^^^^ + 13 | useLayoutEffect, `---- x NEXT_RSC_ERR_REACT_API: useLayoutEffect ,-[input.js:12:1] - 12 | useInsertionEffect, - 13 | useLayoutEffect, - : ^^^^^^^^^^^^^^^ - 14 | useReducer, + 12 | useInsertionEffect, + 13 | useLayoutEffect, + : ^^^^^^^^^^^^^^^ + 14 | useReducer, `---- x NEXT_RSC_ERR_REACT_API: useReducer ,-[input.js:13:1] - 13 | useLayoutEffect, - 14 | useReducer, - : ^^^^^^^^^^ - 15 | useRef, + 13 | useLayoutEffect, + 14 | useReducer, + : ^^^^^^^^^^ + 15 | useRef, `---- x NEXT_RSC_ERR_REACT_API: useRef ,-[input.js:14:1] - 14 | useReducer, - 15 | useRef, - : ^^^^^^ - 16 | useSyncExternalStore + 14 | useReducer, + 15 | useRef, + : ^^^^^^ + 16 | useSyncExternalStore, `---- x NEXT_RSC_ERR_REACT_API: useSyncExternalStore ,-[input.js:15:1] - 15 | useRef, - 16 | useSyncExternalStore - : ^^^^^^^^^^^^^^^^^^^^ - 17 | } from "react" + 15 | useRef, + 16 | useSyncExternalStore, + : ^^^^^^^^^^^^^^^^^^^^ + 17 | } from 'react' `---- diff --git a/packages/next-swc/crates/core/tests/errors/react-server-components/server-graph/react-dom-api/output.js b/packages/next-swc/crates/core/tests/errors/react-server-components/server-graph/react-dom-api/output.js index ca0fe9d0d95e8..eeb4b9e95e909 100644 --- a/packages/next-swc/crates/core/tests/errors/react-server-components/server-graph/react-dom-api/output.js +++ b/packages/next-swc/crates/core/tests/errors/react-server-components/server-graph/react-dom-api/output.js @@ -1,4 +1,4 @@ -import { findDOMNode, flushSync, unstable_batchedUpdates } from "react-dom"; +import { findDOMNode, flushSync, unstable_batchedUpdates } from 'react-dom'; export default function() { return null; } diff --git a/packages/next-swc/crates/core/tests/errors/react-server-components/server-graph/react-dom-api/output.stderr b/packages/next-swc/crates/core/tests/errors/react-server-components/server-graph/react-dom-api/output.stderr index a8c7defff6c98..98676beb507a6 100644 --- a/packages/next-swc/crates/core/tests/errors/react-server-components/server-graph/react-dom-api/output.stderr +++ b/packages/next-swc/crates/core/tests/errors/react-server-components/server-graph/react-dom-api/output.stderr @@ -1,24 +1,18 @@ x NEXT_RSC_ERR_REACT_API: findDOMNode ,-[input.js:1:1] - 1 | import { - 2 | findDOMNode, - : ^^^^^^^^^^^ - 3 | flushSync, + 1 | import { findDOMNode, flushSync, unstable_batchedUpdates } from 'react-dom' + : ^^^^^^^^^^^ `---- x NEXT_RSC_ERR_REACT_API: flushSync - ,-[input.js:2:1] - 2 | findDOMNode, - 3 | flushSync, - : ^^^^^^^^^ - 4 | unstable_batchedUpdates, + ,-[input.js:1:1] + 1 | import { findDOMNode, flushSync, unstable_batchedUpdates } from 'react-dom' + : ^^^^^^^^^ `---- x NEXT_RSC_ERR_REACT_API: unstable_batchedUpdates - ,-[input.js:3:1] - 3 | flushSync, - 4 | unstable_batchedUpdates, - : ^^^^^^^^^^^^^^^^^^^^^^^ - 5 | } from "react-dom" + ,-[input.js:1:1] + 1 | import { findDOMNode, flushSync, unstable_batchedUpdates } from 'react-dom' + : ^^^^^^^^^^^^^^^^^^^^^^^ `---- diff --git a/packages/next-swc/crates/core/tests/errors/react-server-components/server-graph/react-dom-server-client/output.js b/packages/next-swc/crates/core/tests/errors/react-server-components/server-graph/react-dom-server-client/output.js index 6dccfaf7bbaa2..700e09c25e187 100644 --- a/packages/next-swc/crates/core/tests/errors/react-server-components/server-graph/react-dom-server-client/output.js +++ b/packages/next-swc/crates/core/tests/errors/react-server-components/server-graph/react-dom-server-client/output.js @@ -1,9 +1,9 @@ // This is a comment. -"use strict"; +'use strict'; /** * This is a comment. - */ import "react-dom/server"; -import "react-dom/client"; + */ import 'react-dom/server'; +import 'react-dom/client'; export default function() { return null; } diff --git a/packages/next-swc/crates/core/tests/errors/react-server-components/server-graph/react-dom-server-client/output.stderr b/packages/next-swc/crates/core/tests/errors/react-server-components/server-graph/react-dom-server-client/output.stderr index 5b5ca689576ac..c7e032f02fb00 100644 --- a/packages/next-swc/crates/core/tests/errors/react-server-components/server-graph/react-dom-server-client/output.stderr +++ b/packages/next-swc/crates/core/tests/errors/react-server-components/server-graph/react-dom-server-client/output.stderr @@ -2,13 +2,13 @@ x NEXT_RSC_ERR_SERVER_IMPORT: react-dom/server ,-[input.js:8:1] 8 | - 9 | import "react-dom/server" + 9 | import 'react-dom/server' : ^^^^^^^^^^^^^^^^^^^^^^^^^ `---- x NEXT_RSC_ERR_SERVER_IMPORT: react-dom/client ,-[input.js:10:1] 10 | - 11 | import "react-dom/client" + 11 | import 'react-dom/client' : ^^^^^^^^^^^^^^^^^^^^^^^^^ `---- diff --git a/packages/next-swc/crates/core/tests/errors/server-actions/11/output.stderr b/packages/next-swc/crates/core/tests/errors/server-actions/11/output.stderr index 7099e8261a064..e89591be0d662 100644 --- a/packages/next-swc/crates/core/tests/errors/server-actions/11/output.stderr +++ b/packages/next-swc/crates/core/tests/errors/server-actions/11/output.stderr @@ -1,7 +1,7 @@ x The "use server" directive must be at the top of the file, and cannot be wrapped in parentheses. - ,-[input.js:2:1] - 2 | - 3 | ('use sevrer') - : ^^^^^^^^^^^^^^ + ,-[input.js:1:1] + 1 | import 'react' + 2 | ;('use sevrer') + : ^^^^^^^^^^^^^^ `---- diff --git a/packages/next-swc/crates/core/tests/errors/server-actions/4/output.stderr b/packages/next-swc/crates/core/tests/errors/server-actions/4/output.stderr index 59c1b00e7c3b9..d7c5c97c7a97f 100644 --- a/packages/next-swc/crates/core/tests/errors/server-actions/4/output.stderr +++ b/packages/next-swc/crates/core/tests/errors/server-actions/4/output.stderr @@ -4,7 +4,7 @@ 2 | 3 | ,-> export default class Component { 4 | | render() { - 5 | | return null; + 5 | | return null 6 | | } 7 | `-> } `---- diff --git a/packages/next-swc/crates/core/tests/errors/server-actions/8/output.stderr b/packages/next-swc/crates/core/tests/errors/server-actions/8/output.stderr index a6e631a1655d0..e69de29bb2d1d 100644 --- a/packages/next-swc/crates/core/tests/errors/server-actions/8/output.stderr +++ b/packages/next-swc/crates/core/tests/errors/server-actions/8/output.stderr @@ -1,8 +0,0 @@ - - x The "use server" directive must be at the top of the function body. - ,-[input.js:7:1] - 7 | const x = 1 - 8 | 'use server' - : ^^^^^^^^^^^^ - 9 | } - `---- diff --git a/packages/next-swc/crates/core/tests/errors/server-actions/9/output.stderr b/packages/next-swc/crates/core/tests/errors/server-actions/9/output.stderr index dc83418eb15c0..70b9286eb4fde 100644 --- a/packages/next-swc/crates/core/tests/errors/server-actions/9/output.stderr +++ b/packages/next-swc/crates/core/tests/errors/server-actions/9/output.stderr @@ -1,7 +1,7 @@ - x The "use server" directive must be at the top of the file. - ,-[input.js:2:1] - 2 | - 3 | 'use server' - : ^^^^^^^^^^^^ + x The "use server" directive must be at the top of the file, and cannot be wrapped in parentheses. + ,-[input.js:1:1] + 1 | import 'my-module' + 2 | ;('use server') + : ^^^^^^^^^^^^^^ `---- diff --git a/packages/next-swc/crates/core/tests/fixture/next-font-loaders/default-import/output.js b/packages/next-swc/crates/core/tests/fixture/next-font-loaders/default-import/output.js index 3d993f6e21af6..fe18891b09fd5 100644 --- a/packages/next-swc/crates/core/tests/fixture/next-font-loaders/default-import/output.js +++ b/packages/next-swc/crates/core/tests/fixture/next-font-loaders/default-import/output.js @@ -1 +1 @@ -import font from 'cool-fonts/target.css?{"path":"pages/test.tsx","import":"","arguments":[{"prop":true}],"variableName":"font"}'; +import font from 'cool-fonts/target.css?{"arguments":[{"prop":true}],"import":"","path":"pages/test.tsx","variableName":"font"}'; diff --git a/packages/next-swc/crates/core/tests/fixture/next-font-loaders/export-const/output.js b/packages/next-swc/crates/core/tests/fixture/next-font-loaders/export-const/output.js index 95d8ec34da54c..973de0d93d02f 100644 --- a/packages/next-swc/crates/core/tests/fixture/next-font-loaders/export-const/output.js +++ b/packages/next-swc/crates/core/tests/fixture/next-font-loaders/export-const/output.js @@ -1,5 +1,5 @@ -import firaCode from '@next/font/google/target.css?{"path":"pages/test.tsx","import":"Abel","arguments":[],"variableName":"firaCode"}'; -import inter from '@next/font/google/target.css?{"path":"pages/test.tsx","import":"Inter","arguments":[],"variableName":"inter"}'; +import firaCode from '@next/font/google/target.css?{"arguments":[],"import":"Abel","path":"pages/test.tsx","variableName":"firaCode"}'; +import inter from '@next/font/google/target.css?{"arguments":[],"import":"Inter","path":"pages/test.tsx","variableName":"inter"}'; import React from 'react'; export { firaCode }; export { inter }; diff --git a/packages/next-swc/crates/core/tests/fixture/next-font-loaders/exports/output.js b/packages/next-swc/crates/core/tests/fixture/next-font-loaders/exports/output.js index 57f888312d33a..98e619a72fd31 100644 --- a/packages/next-swc/crates/core/tests/fixture/next-font-loaders/exports/output.js +++ b/packages/next-swc/crates/core/tests/fixture/next-font-loaders/exports/output.js @@ -1,5 +1,5 @@ -import firaCode from '@next/font/google/target.css?{"path":"pages/test.tsx","import":"Abel","arguments":[],"variableName":"firaCode"}'; -import inter from '@next/font/google/target.css?{"path":"pages/test.tsx","import":"Inter","arguments":[],"variableName":"inter"}'; +import firaCode from '@next/font/google/target.css?{"arguments":[],"import":"Abel","path":"pages/test.tsx","variableName":"firaCode"}'; +import inter from '@next/font/google/target.css?{"arguments":[],"import":"Inter","path":"pages/test.tsx","variableName":"inter"}'; import React from 'react'; export { firaCode }; export default inter; diff --git a/packages/next-swc/crates/core/tests/fixture/next-font-loaders/font-options/output.js b/packages/next-swc/crates/core/tests/fixture/next-font-loaders/font-options/output.js index bf5f1094c6a92..b58a82e09c35d 100644 --- a/packages/next-swc/crates/core/tests/fixture/next-font-loaders/font-options/output.js +++ b/packages/next-swc/crates/core/tests/fixture/next-font-loaders/font-options/output.js @@ -1,3 +1,3 @@ -import firaCode from '@next/font/google/target.css?{"path":"pages/test.tsx","import":"Fira_Code","arguments":[{"variant":"400","fallback":["system-ui",{"key":false},[]],"preload":true,"key":{"key2":{}}}],"variableName":"firaCode"}'; +import firaCode from '@next/font/google/target.css?{"arguments":[{"fallback":["system-ui",{"key":false},[]],"key":{"key2":{}},"preload":true,"variant":"400"}],"import":"Fira_Code","path":"pages/test.tsx","variableName":"firaCode"}'; import React from 'react'; console.log(firaCode); diff --git a/packages/next-swc/crates/core/tests/fixture/next-font-loaders/import-as/output.js b/packages/next-swc/crates/core/tests/fixture/next-font-loaders/import-as/output.js index a20154bf62db7..6a3869517ad1b 100644 --- a/packages/next-swc/crates/core/tests/fixture/next-font-loaders/import-as/output.js +++ b/packages/next-swc/crates/core/tests/fixture/next-font-loaders/import-as/output.js @@ -1,2 +1,2 @@ -import acme1 from 'cool-fonts/target.css?{"path":"pages/test.tsx","import":"Acme","arguments":[{"variant":"400"}],"variableName":"acme1"}'; +import acme1 from 'cool-fonts/target.css?{"arguments":[{"variant":"400"}],"import":"Acme","path":"pages/test.tsx","variableName":"acme1"}'; import React from 'react'; diff --git a/packages/next-swc/crates/core/tests/fixture/next-font-loaders/many-args/output.js b/packages/next-swc/crates/core/tests/fixture/next-font-loaders/many-args/output.js index d492c40275e2f..24abd45ceac95 100644 --- a/packages/next-swc/crates/core/tests/fixture/next-font-loaders/many-args/output.js +++ b/packages/next-swc/crates/core/tests/fixture/next-font-loaders/many-args/output.js @@ -1 +1 @@ -import geo from '@next/font/google/target.css?{"path":"pages/test.tsx","import":"Geo","arguments":["test",[1.0],{"a":2.0},3.0],"variableName":"geo"}'; +import geo from '@next/font/google/target.css?{"arguments":["test",[1.0],{"a":2.0},3.0],"import":"Geo","path":"pages/test.tsx","variableName":"geo"}'; diff --git a/packages/next-swc/crates/core/tests/fixture/next-font-loaders/multiple-calls/output.js b/packages/next-swc/crates/core/tests/fixture/next-font-loaders/multiple-calls/output.js index 0131db587509e..223c9d3693899 100644 --- a/packages/next-swc/crates/core/tests/fixture/next-font-loaders/multiple-calls/output.js +++ b/packages/next-swc/crates/core/tests/fixture/next-font-loaders/multiple-calls/output.js @@ -1,3 +1,3 @@ -import inter from '@next/font/google/target.css?{"path":"pages/test.tsx","import":"Inter","arguments":[{"variant":"900","display":"swap"}],"variableName":"inter"}'; -import inter from '@next/font/google/target.css?{"path":"pages/test.tsx","import":"Inter","arguments":[{"variant":"900","display":"swap"}],"variableName":"inter"}'; +import inter from '@next/font/google/target.css?{"arguments":[{"display":"swap","variant":"900"}],"import":"Inter","path":"pages/test.tsx","variableName":"inter"}'; +import inter from '@next/font/google/target.css?{"arguments":[{"display":"swap","variant":"900"}],"import":"Inter","path":"pages/test.tsx","variableName":"inter"}'; import React from 'react'; diff --git a/packages/next-swc/crates/core/tests/fixture/next-font-loaders/multiple-font-downloaders/output.js b/packages/next-swc/crates/core/tests/fixture/next-font-loaders/multiple-font-downloaders/output.js index 4f4bc102a82e0..15180a26383e5 100644 --- a/packages/next-swc/crates/core/tests/fixture/next-font-loaders/multiple-font-downloaders/output.js +++ b/packages/next-swc/crates/core/tests/fixture/next-font-loaders/multiple-font-downloaders/output.js @@ -1,3 +1,3 @@ -import inter from '@next/font/google/target.css?{"path":"pages/test.tsx","import":"Inter","arguments":[{"variant":"900"}],"variableName":"inter"}'; -import fira from 'cool-fonts/target.css?{"path":"pages/test.tsx","import":"Fira_Code","arguments":[{"variant":"400","display":"swap"}],"variableName":"fira"}'; +import inter from '@next/font/google/target.css?{"arguments":[{"variant":"900"}],"import":"Inter","path":"pages/test.tsx","variableName":"inter"}'; +import fira from 'cool-fonts/target.css?{"arguments":[{"display":"swap","variant":"400"}],"import":"Fira_Code","path":"pages/test.tsx","variableName":"fira"}'; import React from 'react'; diff --git a/packages/next-swc/crates/core/tests/fixture/next-font-loaders/multiple-fonts/output.js b/packages/next-swc/crates/core/tests/fixture/next-font-loaders/multiple-fonts/output.js index 64a37fd15b341..3b4ccb19bae68 100644 --- a/packages/next-swc/crates/core/tests/fixture/next-font-loaders/multiple-fonts/output.js +++ b/packages/next-swc/crates/core/tests/fixture/next-font-loaders/multiple-fonts/output.js @@ -1,3 +1,3 @@ -import firaCode from '@next/font/google/target.css?{"path":"pages/test.tsx","import":"Fira_Code","arguments":[{"variant":"400","fallback":["system-ui"]}],"variableName":"firaCode"}'; -import inter from '@next/font/google/target.css?{"path":"pages/test.tsx","import":"Inter","arguments":[{"variant":"900","display":"swap"}],"variableName":"inter"}'; +import firaCode from '@next/font/google/target.css?{"arguments":[{"fallback":["system-ui"],"variant":"400"}],"import":"Fira_Code","path":"pages/test.tsx","variableName":"firaCode"}'; +import inter from '@next/font/google/target.css?{"arguments":[{"display":"swap","variant":"900"}],"import":"Inter","path":"pages/test.tsx","variableName":"inter"}'; import React from 'react'; diff --git a/packages/next-swc/crates/core/tests/fixture/next-font-loaders/multiple-imports/output.js b/packages/next-swc/crates/core/tests/fixture/next-font-loaders/multiple-imports/output.js index 8ba10144df1bf..59e7b8b350faa 100644 --- a/packages/next-swc/crates/core/tests/fixture/next-font-loaders/multiple-imports/output.js +++ b/packages/next-swc/crates/core/tests/fixture/next-font-loaders/multiple-imports/output.js @@ -1,3 +1,3 @@ -import inter from '@next/font/google/target.css?{"path":"pages/test.tsx","import":"Inter","arguments":[{"variant":"900"}],"variableName":"inter"}'; -import fira from '@next/font/google/target.css?{"path":"pages/test.tsx","import":"Fira_Code","arguments":[{"variant":"400","display":"swap"}],"variableName":"fira"}'; +import inter from '@next/font/google/target.css?{"arguments":[{"variant":"900"}],"import":"Inter","path":"pages/test.tsx","variableName":"inter"}'; +import fira from '@next/font/google/target.css?{"arguments":[{"display":"swap","variant":"400"}],"import":"Fira_Code","path":"pages/test.tsx","variableName":"fira"}'; import React from 'react'; diff --git a/packages/next-swc/crates/core/tests/fixture/next-font-loaders/no-args/output.js b/packages/next-swc/crates/core/tests/fixture/next-font-loaders/no-args/output.js index 79cb8a45bd77e..9fd1b396a148c 100644 --- a/packages/next-swc/crates/core/tests/fixture/next-font-loaders/no-args/output.js +++ b/packages/next-swc/crates/core/tests/fixture/next-font-loaders/no-args/output.js @@ -1 +1 @@ -import fira from '@next/font/google/target.css?{"path":"pages/test.tsx","import":"Fira_Code","arguments":[],"variableName":"fira"}'; +import fira from '@next/font/google/target.css?{"arguments":[],"import":"Fira_Code","path":"pages/test.tsx","variableName":"fira"}'; diff --git a/packages/next-swc/crates/core/tests/fixture/react-remove-properties/custom/simple/output.js b/packages/next-swc/crates/core/tests/fixture/react-remove-properties/custom/simple/output.js index 9351a42563ae8..d2224111fc27e 100644 --- a/packages/next-swc/crates/core/tests/fixture/react-remove-properties/custom/simple/output.js +++ b/packages/next-swc/crates/core/tests/fixture/react-remove-properties/custom/simple/output.js @@ -1,11 +1,11 @@ export default function Home() { return
-
+
-

Hello World!

+

Hello World!

-
+
-
; + ; } diff --git a/packages/next-swc/crates/core/tests/fixture/react-remove-properties/default/simple/output.js b/packages/next-swc/crates/core/tests/fixture/react-remove-properties/default/simple/output.js index b5bd58e1c4ea4..03621e62b010b 100644 --- a/packages/next-swc/crates/core/tests/fixture/react-remove-properties/default/simple/output.js +++ b/packages/next-swc/crates/core/tests/fixture/react-remove-properties/default/simple/output.js @@ -1,11 +1,15 @@ export default function Home() { return
-
+
-

nested
}>Hello World!

+

nested
}> -

+ Hello World! -
; + + +
+ + ; } diff --git a/packages/next-swc/crates/core/tests/fixture/react-server-components/client-graph/client-entry/output.js b/packages/next-swc/crates/core/tests/fixture/react-server-components/client-graph/client-entry/output.js index 3d540b488d624..fb3d6987479c1 100644 --- a/packages/next-swc/crates/core/tests/fixture/react-server-components/client-graph/client-entry/output.js +++ b/packages/next-swc/crates/core/tests/fixture/react-server-components/client-graph/client-entry/output.js @@ -1,12 +1,12 @@ // This is a comment. -/* __next_internal_client_entry_do_not_use__ default auto */ "use strict"; +/* __next_internal_client_entry_do_not_use__ default auto */ 'use strict'; // This is a comment. -"foo"; -import "fs"; -"bar"; +'foo'; +import 'fs'; +'bar'; // This is a comment. 1 + 1; -"baz"; +'baz'; export default function() { - return null; + return null; } diff --git a/packages/next-swc/crates/core/tests/fixture/remove-console/all/simple/output.js b/packages/next-swc/crates/core/tests/fixture/remove-console/all/simple/output.js index ee23146e5d629..cc53ab3a58a93 100644 --- a/packages/next-swc/crates/core/tests/fixture/remove-console/all/simple/output.js +++ b/packages/next-swc/crates/core/tests/fixture/remove-console/all/simple/output.js @@ -5,32 +5,30 @@ export function shouldRemove() { } export function locallyDefinedConsole() { let console = { - log: ()=>{ - } + log: ()=>{} }; console.log(); } export function capturedConsole() { let console = { - log: ()=>{ - } + log: ()=>{} }; function innerFunc() { console.log(); } } export function overrideInParam(console) { - console.log(""); + console.log(''); } export function overrideInParamObjectPatPropAssign({ console }) { - console.log(""); + console.log(''); } export function overrideInParamObjectPatPropKeyValue({ c: console }) { - console.log(""); + console.log(''); } export function overrideInParamObjectPatPropKeyValueNested({ c: { console } }) { - console.log(""); + console.log(''); } export function overrideInParamArray([console]) { - console.log(""); + console.log(''); } diff --git a/packages/next-swc/crates/core/tests/fixture/remove-console/all/toplevel-override/output.js b/packages/next-swc/crates/core/tests/fixture/remove-console/all/toplevel-override/output.js index 2d3b8aa02a899..6f50e127c79b2 100644 --- a/packages/next-swc/crates/core/tests/fixture/remove-console/all/toplevel-override/output.js +++ b/packages/next-swc/crates/core/tests/fixture/remove-console/all/toplevel-override/output.js @@ -1,8 +1,7 @@ let console = { - log: (msg)=>{ - } + log: (msg)=>{} }; function func1() { - console.log("remove console test in function"); + console.log('remove console test in function'); } -console.log("remove console test at top level"); +console.log('remove console test at top level'); diff --git a/packages/next-swc/crates/core/tests/fixture/server-actions/server/18/output.js b/packages/next-swc/crates/core/tests/fixture/server-actions/server/18/output.js index 75fc896833ed1..d8d9bc8ebcf26 100644 --- a/packages/next-swc/crates/core/tests/fixture/server-actions/server/18/output.js +++ b/packages/next-swc/crates/core/tests/fixture/server-actions/server/18/output.js @@ -4,17 +4,25 @@ export function Item({ id1 , id2 }) { const v2 = id2; return <> - + ], $$ACTION_0}> - + ], $$ACTION_2}> + + Delete + + ; } diff --git a/packages/next-swc/crates/core/tests/fixture/server-actions/server/19/output.js b/packages/next-swc/crates/core/tests/fixture/server-actions/server/19/output.js index 43f2bedd2b795..86e8a4ee26457 100644 --- a/packages/next-swc/crates/core/tests/fixture/server-actions/server/19/output.js +++ b/packages/next-swc/crates/core/tests/fixture/server-actions/server/19/output.js @@ -1,9 +1,13 @@ /* __next_internal_action_entry_do_not_use__ $$ACTION_1 */ export function Item({ value }) { return <> - + ], $$ACTION_0}> + + Multiple + + ; } diff --git a/packages/next-swc/crates/core/tests/fixture/server-actions/server/8/output.js b/packages/next-swc/crates/core/tests/fixture/server-actions/server/8/output.js index e637adc3bfd95..70215d7ec2a19 100644 --- a/packages/next-swc/crates/core/tests/fixture/server-actions/server/8/output.js +++ b/packages/next-swc/crates/core/tests/fixture/server-actions/server/8/output.js @@ -1,6 +1,6 @@ /* __next_internal_action_entry_do_not_use__ $$ACTION_0 */ async function myAction(a, b, c) { // comment - "use strict"; + 'use strict'; console.log('a'); } myAction.$$typeof = Symbol.for("react.server.reference"); @@ -10,4 +10,4 @@ myAction.$$with_bound = false; export const $$ACTION_0 = myAction; export default function Page() { return ; -} \ No newline at end of file +} diff --git a/packages/next-swc/crates/core/tests/loader/front/attr-1/output.js b/packages/next-swc/crates/core/tests/loader/front/attr-1/output.js index f9d344fec6a57..6836fb79697a3 100644 --- a/packages/next-swc/crates/core/tests/loader/front/attr-1/output.js +++ b/packages/next-swc/crates/core/tests/loader/front/attr-1/output.js @@ -3,11 +3,11 @@ export default function Foo() { return /*#__PURE__*/ React.createElement("div", { render: function(v) { return /*#__PURE__*/ React.createElement("form", { - className: "jsx-eb368961fd3b0a99" + className: "jsx-3d44fb7892a1f38b" }); }, - className: "jsx-eb368961fd3b0a99" + className: "jsx-3d44fb7892a1f38b" }, React.createElement(_JSXStyle, { - id: "eb368961fd3b0a99" - }, "span.jsx-eb368961fd3b0a99{color:red}")); + id: "3d44fb7892a1f38b" + }, "span.jsx-3d44fb7892a1f38b{color:red}")); } diff --git a/packages/next-swc/crates/core/tests/loader/styled-components/1/output.js b/packages/next-swc/crates/core/tests/loader/styled-components/1/output.js index 06d94ef2d293a..265e361c1c56a 100644 --- a/packages/next-swc/crates/core/tests/loader/styled-components/1/output.js +++ b/packages/next-swc/crates/core/tests/loader/styled-components/1/output.js @@ -20,5 +20,5 @@ function _templateObject() { import styled from "styled-components"; export var foo = styled.input.withConfig({ displayName: "input__foo", - componentId: "sc-12c52e68-0" + componentId: "sc-21a13c03-0" })(_templateObject()); diff --git a/packages/next-swc/crates/next-core/js/src/polyfill/app-polyfills.ts b/packages/next-swc/crates/next-core/js/src/polyfill/app-polyfills.ts index d7b77ce77b8c3..20188edb6faa4 100644 --- a/packages/next-swc/crates/next-core/js/src/polyfill/app-polyfills.ts +++ b/packages/next-swc/crates/next-core/js/src/polyfill/app-polyfills.ts @@ -2,5 +2,4 @@ import 'next/dist/server/node-polyfill-fetch' import 'next/dist/server/node-polyfill-web-streams' import 'next/dist/server/node-polyfill-headers' import './async-local-storage' - ;(globalThis as any).__NEXT_USE_UNDICI = true diff --git a/packages/next-swc/crates/next-dev-tests/tests/integration/turbopack/basic/comptime/issues/Error resolving commonjs request-3ad478.txt b/packages/next-swc/crates/next-dev-tests/tests/integration/turbopack/basic/comptime/issues/Error resolving commonjs request-7e0ea5.txt similarity index 95% rename from packages/next-swc/crates/next-dev-tests/tests/integration/turbopack/basic/comptime/issues/Error resolving commonjs request-3ad478.txt rename to packages/next-swc/crates/next-dev-tests/tests/integration/turbopack/basic/comptime/issues/Error resolving commonjs request-7e0ea5.txt index d931626c81cee..af363d91089d9 100644 --- a/packages/next-swc/crates/next-dev-tests/tests/integration/turbopack/basic/comptime/issues/Error resolving commonjs request-3ad478.txt +++ b/packages/next-swc/crates/next-dev-tests/tests/integration/turbopack/basic/comptime/issues/Error resolving commonjs request-7e0ea5.txt @@ -16,8 +16,8 @@ PlainIssue { column: 5, }, end: SourcePos { - line: 3, - column: 35, + line: 4, + column: 0, }, }, ), diff --git a/packages/next-swc/crates/next-dev-tests/tests/integration/webpack/chunks/__skipped__/weak-dependencies-context/issues/Error resolving commonjs request-6f1be7.txt b/packages/next-swc/crates/next-dev-tests/tests/integration/webpack/chunks/__skipped__/weak-dependencies-context/issues/Error resolving commonjs request-bab04e.txt similarity index 95% rename from packages/next-swc/crates/next-dev-tests/tests/integration/webpack/chunks/__skipped__/weak-dependencies-context/issues/Error resolving commonjs request-6f1be7.txt rename to packages/next-swc/crates/next-dev-tests/tests/integration/webpack/chunks/__skipped__/weak-dependencies-context/issues/Error resolving commonjs request-bab04e.txt index 2e05c7c019329..137f332c0be87 100644 --- a/packages/next-swc/crates/next-dev-tests/tests/integration/webpack/chunks/__skipped__/weak-dependencies-context/issues/Error resolving commonjs request-6f1be7.txt +++ b/packages/next-swc/crates/next-dev-tests/tests/integration/webpack/chunks/__skipped__/weak-dependencies-context/issues/Error resolving commonjs request-bab04e.txt @@ -16,8 +16,8 @@ PlainIssue { column: 3, }, end: SourcePos { - line: 13, - column: 19, + line: 14, + column: 0, }, }, ), diff --git a/packages/next-swc/crates/next-dev-tests/tests/integration/webpack/chunks/__skipped__/weak-dependencies/issues/Error resolving commonjs request-35f347.txt b/packages/next-swc/crates/next-dev-tests/tests/integration/webpack/chunks/__skipped__/weak-dependencies/issues/Error resolving commonjs request-786567.txt similarity index 95% rename from packages/next-swc/crates/next-dev-tests/tests/integration/webpack/chunks/__skipped__/weak-dependencies/issues/Error resolving commonjs request-35f347.txt rename to packages/next-swc/crates/next-dev-tests/tests/integration/webpack/chunks/__skipped__/weak-dependencies/issues/Error resolving commonjs request-786567.txt index c66f95604b214..f87fa897038e5 100644 --- a/packages/next-swc/crates/next-dev-tests/tests/integration/webpack/chunks/__skipped__/weak-dependencies/issues/Error resolving commonjs request-35f347.txt +++ b/packages/next-swc/crates/next-dev-tests/tests/integration/webpack/chunks/__skipped__/weak-dependencies/issues/Error resolving commonjs request-786567.txt @@ -16,8 +16,8 @@ PlainIssue { column: 3, }, end: SourcePos { - line: 5, - column: 19, + line: 6, + column: 0, }, }, ), diff --git a/packages/next-swc/crates/next-transform-dynamic/tests/errors/too-many-arguments/output-turbo.js b/packages/next-swc/crates/next-transform-dynamic/tests/errors/too-many-arguments/output-turbo.js index 62d66923dbf88..d99b72796a656 100644 --- a/packages/next-swc/crates/next-transform-dynamic/tests/errors/too-many-arguments/output-turbo.js +++ b/packages/next-swc/crates/next-transform-dynamic/tests/errors/too-many-arguments/output-turbo.js @@ -1,4 +1,4 @@ import dynamic from 'next/dynamic'; const DynamicComponentWithCustomLoading = dynamic(()=>import('../components/hello'), { - loading: ()=>

...

-}, "3rd"); + loading: ()=>

...

+}, '3rd'); diff --git a/packages/next-swc/crates/next-transform-dynamic/tests/errors/too-many-arguments/output-webpack.js b/packages/next-swc/crates/next-transform-dynamic/tests/errors/too-many-arguments/output-webpack.js index 62d66923dbf88..d99b72796a656 100644 --- a/packages/next-swc/crates/next-transform-dynamic/tests/errors/too-many-arguments/output-webpack.js +++ b/packages/next-swc/crates/next-transform-dynamic/tests/errors/too-many-arguments/output-webpack.js @@ -1,4 +1,4 @@ import dynamic from 'next/dynamic'; const DynamicComponentWithCustomLoading = dynamic(()=>import('../components/hello'), { - loading: ()=>

...

-}, "3rd"); + loading: ()=>

...

+}, '3rd'); diff --git a/packages/next-swc/crates/next-transform-strip-page-exports/tests/errors/server-side-after-static-paths/output.stderr b/packages/next-swc/crates/next-transform-strip-page-exports/tests/errors/server-side-after-static-paths/output.stderr index 3ef8362e8da8f..b163d5113c19c 100644 --- a/packages/next-swc/crates/next-transform-strip-page-exports/tests/errors/server-side-after-static-paths/output.stderr +++ b/packages/next-swc/crates/next-transform-strip-page-exports/tests/errors/server-side-after-static-paths/output.stderr @@ -2,6 +2,6 @@ x You can not use getStaticProps or getStaticPaths with getServerSideProps. To use SSG, please remove getServerSideProps ,-[input.js:1:1] 1 | export async function getStaticPaths() {} - 2 | export const getServerSideProps = function getServerSideProps() {}; + 2 | export const getServerSideProps = function getServerSideProps() {} : ^^^^^^^^^^^^^^^^^^ `---- diff --git a/packages/next-swc/crates/next-transform-strip-page-exports/tests/errors/server-side-after-static-props/output.stderr b/packages/next-swc/crates/next-transform-strip-page-exports/tests/errors/server-side-after-static-props/output.stderr index ed2d07c6e9dc1..ece6d54e2cd16 100644 --- a/packages/next-swc/crates/next-transform-strip-page-exports/tests/errors/server-side-after-static-props/output.stderr +++ b/packages/next-swc/crates/next-transform-strip-page-exports/tests/errors/server-side-after-static-props/output.stderr @@ -1,7 +1,7 @@ x You can not use getStaticProps or getStaticPaths with getServerSideProps. To use SSG, please remove getServerSideProps ,-[input.js:1:1] - 1 | export const getStaticProps = async () => {}; - 2 | export { a as getServerSideProps }; + 1 | export const getStaticProps = async () => {} + 2 | export { a as getServerSideProps } : ^^^^^^^^^^^^^^^^^^ `---- diff --git a/packages/next-swc/crates/next-transform-strip-page-exports/tests/errors/static-paths-after-server-side/output.stderr b/packages/next-swc/crates/next-transform-strip-page-exports/tests/errors/static-paths-after-server-side/output.stderr index 4faeb4b62820f..c3f625e1d175d 100644 --- a/packages/next-swc/crates/next-transform-strip-page-exports/tests/errors/static-paths-after-server-side/output.stderr +++ b/packages/next-swc/crates/next-transform-strip-page-exports/tests/errors/static-paths-after-server-side/output.stderr @@ -1,7 +1,7 @@ x You can not use getStaticProps or getStaticPaths with getServerSideProps. To use SSG, please remove getServerSideProps ,-[input.js:1:1] - 1 | export { a as getServerSideProps } from "./input"; - 2 | export { getStaticPaths } from "a"; + 1 | export { a as getServerSideProps } from './input' + 2 | export { getStaticPaths } from 'a' : ^^^^^^^^^^^^^^ `---- diff --git a/packages/next-swc/crates/next-transform-strip-page-exports/tests/errors/static-props-after-server-side/output.stderr b/packages/next-swc/crates/next-transform-strip-page-exports/tests/errors/static-props-after-server-side/output.stderr index a6313f9f18373..80e4cf6ecb2b6 100644 --- a/packages/next-swc/crates/next-transform-strip-page-exports/tests/errors/static-props-after-server-side/output.stderr +++ b/packages/next-swc/crates/next-transform-strip-page-exports/tests/errors/static-props-after-server-side/output.stderr @@ -1,6 +1,6 @@ x You can not use getStaticProps or getStaticPaths with getServerSideProps. To use SSG, please remove getServerSideProps ,-[input.js:1:1] - 1 | export { getStaticProps, getServerSideProps }; + 1 | export { getStaticProps, getServerSideProps } : ^^^^^^^^^^^^^^^^^^ `---- diff --git a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getServerSideProps/destructuring-assignment-array/output-data.js b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getServerSideProps/destructuring-assignment-array/output-data.js index f1ddef4038b4e..c13a15a9a96b1 100644 --- a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getServerSideProps/destructuring-assignment-array/output-data.js +++ b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getServerSideProps/destructuring-assignment-array/output-data.js @@ -1,10 +1,10 @@ -import fs from "fs"; -import other from "other"; +import fs from 'fs'; +import other from 'other'; const [a, b, ...rest] = fs.promises; const [foo, bar] = other; export async function getServerSideProps() { - a; - b; - rest; - bar; + a; + b; + rest; + bar; } diff --git a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getServerSideProps/destructuring-assignment-array/output-default.js b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getServerSideProps/destructuring-assignment-array/output-default.js index 952dcff2aa822..d42aa2776c45c 100644 --- a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getServerSideProps/destructuring-assignment-array/output-default.js +++ b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getServerSideProps/destructuring-assignment-array/output-default.js @@ -1,6 +1,6 @@ -import other from "other"; +import other from 'other'; const [foo] = other; export var __N_SSP = true; export default function Home() { - return __jsx("div", null); + return __jsx("div", null); } diff --git a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/destructuring-assignment-array-expr/output-data.js b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/destructuring-assignment-array-expr/output-data.js index 0c5c0bb281b25..66a3b0809957f 100644 --- a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/destructuring-assignment-array-expr/output-data.js +++ b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/destructuring-assignment-array-expr/output-data.js @@ -1,10 +1,10 @@ -import fs from "fs"; -import other from "other"; +import fs from 'fs'; +import other from 'other'; const [a, b, ...rest] = fs.promises; const [foo, bar] = other; export async function getStaticProps() { - a; - b; - rest; - bar; + a; + b; + rest; + bar; } diff --git a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/destructuring-assignment-array-expr/output-default.js b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/destructuring-assignment-array-expr/output-default.js index f81f28fe3b97e..79b19dfc4f0d4 100644 --- a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/destructuring-assignment-array-expr/output-default.js +++ b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/destructuring-assignment-array-expr/output-default.js @@ -1,6 +1,6 @@ -import other from "other"; +import other from 'other'; const [foo] = other; export var __N_SSG = true; export default function Home() { - return __jsx("div", null); + return __jsx("div", null); } diff --git a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/destructuring-assignment-array/output-data.js b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/destructuring-assignment-array/output-data.js index 43a16ef1de135..84076264b35df 100644 --- a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/destructuring-assignment-array/output-data.js +++ b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/destructuring-assignment-array/output-data.js @@ -1,12 +1,12 @@ -import fs from "fs"; -import other from "other"; +import fs from 'fs'; +import other from 'other'; let a, b, rest; [a, b, ...rest] = fs.promises; let foo, bar; [foo, bar] = other; export async function getStaticProps() { - a; - b; - rest; - bar; + a; + b; + rest; + bar; } diff --git a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/destructuring-assignment-array/output-default.js b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/destructuring-assignment-array/output-default.js index b7ba6042dfaf5..f2317eaae722a 100644 --- a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/destructuring-assignment-array/output-default.js +++ b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/destructuring-assignment-array/output-default.js @@ -1,7 +1,7 @@ -import other from "other"; +import other from 'other'; let foo; [foo] = other; export var __N_SSG = true; export default function Home() { - return __jsx("div", null); + return __jsx("div", null); } diff --git a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/destructuring-assignment-object/output-data.js b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/destructuring-assignment-object/output-data.js index d792c0c64ea49..57733198796a8 100644 --- a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/destructuring-assignment-object/output-data.js +++ b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/destructuring-assignment-object/output-data.js @@ -1,12 +1,12 @@ -import fs from "fs"; -import other from "other"; -const { readFile, readdir, access: foo } = fs.promises; -const { a, b, cat: bar, ...rem } = other; +import fs from 'fs'; +import other from 'other'; +const { readFile , readdir , access: foo } = fs.promises; +const { a , b , cat: bar , ...rem } = other; export async function getStaticProps() { - readFile; - readdir; - foo; - b; - cat; - rem; + readFile; + readdir; + foo; + b; + cat; + rem; } diff --git a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/destructuring-assignment-object/output-default.js b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/destructuring-assignment-object/output-default.js index aad6c65b1dce1..6717b85ae22ef 100644 --- a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/destructuring-assignment-object/output-default.js +++ b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/destructuring-assignment-object/output-default.js @@ -1,6 +1,6 @@ -import other from "other"; -const { a, cat: bar } = other; +import other from 'other'; +const { a , cat: bar } = other; export var __N_SSG = true; export default function Home() { - return __jsx("div", null); + return __jsx("div", null); } diff --git a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/issue-30091/output-data.js b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/issue-30091/output-data.js index 096a3855dfc62..f59214bb8dd5b 100644 --- a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/issue-30091/output-data.js +++ b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/issue-30091/output-data.js @@ -1,6 +1,6 @@ export async function getStaticProps() { - await import("_http_common").then((http) => console.log(http)); - return { - props: {}, - }; + await import('_http_common').then((http)=>console.log(http)); + return { + props: {} + }; } diff --git a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/not-mix-up-bindings/output-data.js b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/not-mix-up-bindings/output-data.js index 28d9767ba12ca..282d6dbc5d2ad 100644 --- a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/not-mix-up-bindings/output-data.js +++ b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/not-mix-up-bindings/output-data.js @@ -1,14 +1,14 @@ function Function1() { - return { - a: function bug(a) { - return 2; - }, - }; + return { + a: function bug(a) { + return 2; + } + }; } function Function2() { - var bug = 1; - return { - bug, - }; + var bug = 1; + return { + bug + }; } -export { getStaticProps } from "a"; +export { getStaticProps } from 'a'; diff --git a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/not-remove-import-used-in-other-export/output-data.js b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/not-remove-import-used-in-other-export/output-data.js index 73c25a4753342..80a9c58558bdc 100644 --- a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/not-remove-import-used-in-other-export/output-data.js +++ b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/not-remove-import-used-in-other-export/output-data.js @@ -1,10 +1,8 @@ -import { foo, bar } from "thing"; - +import { foo, bar } from 'thing'; export function otherExport() { - foo; - bar; + foo; + bar; } - export async function getStaticProps() { - bar; + bar; } diff --git a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/not-remove-import-used-in-other-export/output-default.js b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/not-remove-import-used-in-other-export/output-default.js index aee6685064997..d502338420305 100644 --- a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/not-remove-import-used-in-other-export/output-default.js +++ b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/not-remove-import-used-in-other-export/output-default.js @@ -1,12 +1,10 @@ -import { foo, bar } from "thing"; - +import { foo, bar } from 'thing'; export var __N_SSG = true; export default function Home() { - foo; - return __jsx("div", null); + foo; + return __jsx("div", null); } - export function otherExport() { - foo; - bar; + foo; + bar; } diff --git a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/not-remove-import-used-in-render/output-data.js b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/not-remove-import-used-in-render/output-data.js index ec988e8ce41f5..2ed5f2111bce9 100644 --- a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/not-remove-import-used-in-render/output-data.js +++ b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/not-remove-import-used-in-render/output-data.js @@ -1,29 +1,20 @@ -import { - Root, - Children, - JSXMemberExpression, - AttributeValue, - AttributeJSX, - ValueInRender, - ValueInEffect, - UnusedInRender, -} from "../"; +import { Root, Children, JSXMemberExpression, AttributeValue, AttributeJSX, ValueInRender, ValueInEffect, UnusedInRender } from '../'; export async function getStaticProps() { - return { - props: { - // simulate import usage inside getStaticProps - used: [ - // these import references should not be removed - Root.value, - Children.value, - AttributeValue.value, - AttributeJSX.value, - ValueInRender.value, - ValueInEffect.value, - JSXMemberExpression.value, - // this import reference should be removed - UnusedInRender.value, - ], - }, - }; + return { + props: { + // simulate import usage inside getStaticProps + used: [ + // these import references should not be removed + Root.value, + Children.value, + AttributeValue.value, + AttributeJSX.value, + ValueInRender.value, + ValueInEffect.value, + JSXMemberExpression.value, + // this import reference should be removed + UnusedInRender.value + ] + } + }; } diff --git a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/not-remove-import-used-in-render/output-default.js b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/not-remove-import-used-in-render/output-default.js index 83420ec1282dd..8ce38b79406c2 100644 --- a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/not-remove-import-used-in-render/output-default.js +++ b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/not-remove-import-used-in-render/output-default.js @@ -1,32 +1,15 @@ -import { useState, useEffect } from "react"; -import { - Root, - Children, - JSXMemberExpression, - AttributeValue, - AttributeJSX, - ValueInRender, - ValueInEffect, -} from "../"; +import { useState, useEffect } from 'react'; +import { Root, Children, JSXMemberExpression, AttributeValue, AttributeJSX, ValueInRender, ValueInEffect } from '../'; export var __N_SSG = true; export default function Test() { - const [x, setX] = useState(ValueInRender.value); - useEffect(() => { - setX(ValueInEffect.value); - }, []); - return __jsx( - Root, - { - x: x, - }, - __jsx( - "div", - null, - __jsx(Children, { + const [x, setX] = useState(ValueInRender.value); + useEffect(()=>{ + setX(ValueInEffect.value); + }, []); + return __jsx(Root, { + x: x + }, __jsx("div", null, __jsx(Children, { attr: AttributeValue, - jsx: __jsx(AttributeJSX, null), - }), - __jsx(JSXMemberExpression.Deep.Property, null) - ) - ); + jsx: __jsx(AttributeJSX, null) + }), __jsx(JSXMemberExpression.Deep.Property, null))); } diff --git a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/remove-combined-named-export-specifiers/output-data.js b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/remove-combined-named-export-specifiers/output-data.js index 42914d680a144..74f1f217b0b50 100644 --- a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/remove-combined-named-export-specifiers/output-data.js +++ b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/remove-combined-named-export-specifiers/output-data.js @@ -1 +1 @@ -export { getStaticPaths, a as getStaticProps } from "."; +export { getStaticPaths, a as getStaticProps } from '.'; diff --git a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/remove-extra-named-export-specifiers/output-data.js b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/remove-extra-named-export-specifiers/output-data.js index 38b1d511e1d48..f599cca6da458 100644 --- a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/remove-extra-named-export-specifiers/output-data.js +++ b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/remove-extra-named-export-specifiers/output-data.js @@ -1 +1 @@ -export { getStaticPaths, a as getStaticProps, foo, bar as baz } from "."; +export { getStaticPaths, a as getStaticProps, foo, bar as baz } from '.'; diff --git a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/remove-extra-named-export-specifiers/output-default.js b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/remove-extra-named-export-specifiers/output-default.js index 7104a1d0d1aac..bf3bd37895e50 100644 --- a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/remove-extra-named-export-specifiers/output-default.js +++ b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/remove-extra-named-export-specifiers/output-default.js @@ -1,5 +1,5 @@ export var __N_SSG = true; -export { foo, bar as baz } from "."; +export { foo, bar as baz } from '.'; export default function Test() { - return __jsx("div", null); + return __jsx("div", null); } diff --git a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/remove-re-exported-function-declarations-dependents-variables-functions-imports/output-data.js b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/remove-re-exported-function-declarations-dependents-variables-functions-imports/output-data.js index 49661ed54cd51..360fe57e5fa6e 100644 --- a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/remove-re-exported-function-declarations-dependents-variables-functions-imports/output-data.js +++ b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/remove-re-exported-function-declarations-dependents-variables-functions-imports/output-data.js @@ -1,40 +1,40 @@ -import keep_me from "hello"; -import { keep_me2 } from "hello2"; -import * as keep_me3 from "hello3"; -import data_only1 from "data_only1"; -import { data_only2 } from "data_only2"; -import { data_only3, shared4 } from "shared4"; -import * as data_only4 from "data_only4"; -import { shared5 } from "shared5"; +import keep_me from 'hello'; +import { keep_me2 } from 'hello2'; +import * as keep_me3 from 'hello3'; +import data_only1 from 'data_only1'; +import { data_only2 } from 'data_only2'; +import { data_only3, shared4 } from 'shared4'; +import * as data_only4 from 'data_only4'; +import { shared5 } from 'shared5'; var leave_me_alone = 1; function dont_bug_me_either() {} -const data_inception = "hahaa"; +const data_inception = 'hahaa'; var data_var1 = 1; let data_var2 = 2; const data_var3 = data_inception + data_only4; function data_inception1() { - data_var2; - data_only2; + data_var2; + data_only2; } function data_abc() {} -const data_b = function () { - data_var3; - data_only3; +const data_b = function() { + data_var3; + data_only3; }; const data_b2 = function data_apples() {}; -const data_bla = () => { - data_inception1; +const data_bla = ()=>{ + data_inception1; }; function getStaticProps() { - data_abc(); - data_only1; - data_b; - data_b2; - data_bla(); - return { - props: { - data_var1, - }, - }; + data_abc(); + data_only1; + data_b; + data_b2; + data_bla(); + return { + props: { + data_var1 + } + }; } export { getStaticProps }; diff --git a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/remove-re-exported-function-declarations-dependents-variables-functions-imports/output-default.js b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/remove-re-exported-function-declarations-dependents-variables-functions-imports/output-default.js index 52a5c607a1307..816f3b83c5b5a 100644 --- a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/remove-re-exported-function-declarations-dependents-variables-functions-imports/output-default.js +++ b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/remove-re-exported-function-declarations-dependents-variables-functions-imports/output-default.js @@ -1,39 +1,39 @@ -import keep_me from "hello"; -import { keep_me2 } from "hello2"; -import * as keep_me3 from "hello3"; -import { shared4 } from "shared4"; -import default_only1 from "default_only1"; -import { default_only2 } from "default_only2"; -import { default_only3, shared5 } from "shared5"; -import * as default_only4 from "default_only4"; +import keep_me from 'hello'; +import { keep_me2 } from 'hello2'; +import * as keep_me3 from 'hello3'; +import { shared4 } from 'shared4'; +import default_only1 from 'default_only1'; +import { default_only2 } from 'default_only2'; +import { default_only3, shared5 } from 'shared5'; +import * as default_only4 from 'default_only4'; var leave_me_alone = 1; function dont_bug_me_either() {} -const default_inception = "hahaa"; +const default_inception = 'hahaa'; var default_var1 = 1; let default_var2 = 2; const default_var3 = default_inception + default_only4; function default_inception1() { - default_var2; - default_only2; + default_var2; + default_only2; } function default_abc() {} -const default_b = function () { - default_var3; - default_only3; +const default_b = function() { + default_var3; + default_only3; }; const default_b2 = function default_apples() {}; -const default_bla = () => { - default_inception1; +const default_bla = ()=>{ + default_inception1; }; export var __N_SSG = true; export default function Test() { - default_abc(); - default_only1; - default_b; - default_b2; - default_bla(); - const props = { - default_var1, - }; - return __jsx("div", null); + default_abc(); + default_only1; + default_b; + default_b2; + default_bla(); + const props = { + default_var1 + }; + return __jsx("div", null); } diff --git a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/remove-separate-named-export-specifiers/output-data.js b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/remove-separate-named-export-specifiers/output-data.js index e50be215a9b2e..d086e5138dae7 100644 --- a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/remove-separate-named-export-specifiers/output-data.js +++ b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/remove-separate-named-export-specifiers/output-data.js @@ -1,2 +1,2 @@ -export { getStaticPaths } from "./input"; -export { a as getStaticProps } from "./input"; +export { getStaticPaths } from './input'; +export { a as getStaticProps } from './input'; diff --git a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/support-export-named-as-default-with-other-specifiers-and-import/output-data.js b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/support-export-named-as-default-with-other-specifiers-and-import/output-data.js index 322406da7e52d..ccd5a9784a6d2 100644 --- a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/support-export-named-as-default-with-other-specifiers-and-import/output-data.js +++ b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/support-export-named-as-default-with-other-specifiers-and-import/output-data.js @@ -1,11 +1,9 @@ -import { createContext } from "react"; - +import { createContext } from 'react'; export const context = createContext(); - export function getStaticProps() { - return { - props: {}, - }; + return { + props: {} + }; } const a = 5; export { a }; diff --git a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/support-export-named-as-default-with-other-specifiers-and-import/output-default.js b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/support-export-named-as-default-with-other-specifiers-and-import/output-default.js index 5ab14ace53301..c3c1e00394b99 100644 --- a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/support-export-named-as-default-with-other-specifiers-and-import/output-default.js +++ b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/support-export-named-as-default-with-other-specifiers-and-import/output-default.js @@ -1,11 +1,9 @@ -import { useContext, createContext } from "react"; - +import { useContext, createContext } from 'react'; export var __N_SSG = true; export const context = createContext(); - function El() { - const value = useContext(context); - return __jsx("div", null); + const value = useContext(context); + return __jsx("div", null); } const a = 5; export { El as default, a }; diff --git a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/support-full-re-export/output-data.js b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/support-full-re-export/output-data.js index b037fd615f1b0..a34b20eb8a523 100644 --- a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/support-full-re-export/output-data.js +++ b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/support-full-re-export/output-data.js @@ -1 +1 @@ -export { getStaticProps } from "a"; +export { getStaticProps } from 'a'; diff --git a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/support-full-re-export/output-default.js b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/support-full-re-export/output-default.js index d06f18747a17e..45fafe12ed5f7 100644 --- a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/support-full-re-export/output-default.js +++ b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/getStaticProps/support-full-re-export/output-default.js @@ -1,2 +1,2 @@ export var __N_SSG = true; -export { default } from "a"; +export { default } from 'a'; diff --git a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/propTypes/complex/output-data.js b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/propTypes/complex/output-data.js index 4ed271e8cf824..517c68c2c0b11 100644 --- a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/propTypes/complex/output-data.js +++ b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/propTypes/complex/output-data.js @@ -1,5 +1,4 @@ -import { PropTypes } from "react"; - +import { PropTypes } from 'react'; const propTypes = identity({ - prop: PropTypes.bool, + prop: PropTypes.bool }); diff --git a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/propTypes/complex/output-default.js b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/propTypes/complex/output-default.js index f4305833191a0..7f88f064b2406 100644 --- a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/propTypes/complex/output-default.js +++ b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/propTypes/complex/output-default.js @@ -1,4 +1,4 @@ -import { PropTypes } from "react"; +import { PropTypes } from 'react'; export default function Page() { return __jsx("div", null); } diff --git a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/propTypes/simple/output-default.js b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/propTypes/simple/output-default.js index fd535e4f08366..c9da71a96d349 100644 --- a/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/propTypes/simple/output-default.js +++ b/packages/next-swc/crates/next-transform-strip-page-exports/tests/fixtures/propTypes/simple/output-default.js @@ -1,11 +1,8 @@ -import { PropTypes } from "react"; - +import { PropTypes } from 'react'; export default function Page() { - return __jsx("div", null); + return __jsx("div", null); } - Page.propTypes = { - prop: PropTypes.bool, + prop: PropTypes.bool }; - export function otherExport() {}