-
Notifications
You must be signed in to change notification settings - Fork 27.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test fixtures demonstrating export statement validation bugs
- Loading branch information
1 parent
2c1f68e
commit 5e1b67f
Showing
20 changed files
with
155 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
...m-transforms/tests/errors/react-server-components/client-graph/generate-metadata/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export function generateMetadata() {} | ||
|
||
export default function () { | ||
return null | ||
} |
4 changes: 4 additions & 0 deletions
4
...-transforms/tests/errors/react-server-components/client-graph/generate-metadata/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export function generateMetadata() {} | ||
export default function() { | ||
return null; | ||
} |
8 changes: 8 additions & 0 deletions
8
...nsforms/tests/errors/react-server-components/client-graph/generate-metadata/output.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
x You are attempting to export "generateMetadata" from a component marked with "use client", which is disallowed. Either remove the export, or the "use client" directive. Read more: https:// | ||
| nextjs.org/docs/app/api-reference/directives/use-client | ||
| | ||
| | ||
,-[input.js:1:1] | ||
1 | export function generateMetadata() {} | ||
: ^^^^^^^^^^^^^^^^ | ||
`---- |
5 changes: 5 additions & 0 deletions
5
...ext-custom-transforms/tests/errors/react-server-components/client-graph/metadata/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export const metadata = {} | ||
|
||
export default function () { | ||
return null | ||
} |
4 changes: 4 additions & 0 deletions
4
...xt-custom-transforms/tests/errors/react-server-components/client-graph/metadata/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export const metadata = {}; | ||
export default function() { | ||
return null; | ||
} |
8 changes: 8 additions & 0 deletions
8
...ustom-transforms/tests/errors/react-server-components/client-graph/metadata/output.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
x You are attempting to export "metadata" from a component marked with "use client", which is disallowed. Either remove the export, or the "use client" directive. Read more: https://nextjs.org/ | ||
| docs/app/api-reference/directives/use-client | ||
| | ||
| | ||
,-[input.js:1:1] | ||
1 | export const metadata = {} | ||
: ^^^^^^^^ | ||
`---- |
9 changes: 9 additions & 0 deletions
9
...ext-custom-transforms/tests/errors/react-server-components/client-graph/multiple/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export const metadata = {} | ||
|
||
export function generateMetadata() {} | ||
|
||
export function getServerSideProps() {} | ||
|
||
export default function () { | ||
return null | ||
} |
6 changes: 6 additions & 0 deletions
6
...xt-custom-transforms/tests/errors/react-server-components/client-graph/multiple/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export const metadata = {}; | ||
export function generateMetadata() {} | ||
export function getServerSideProps() {} | ||
export default function() { | ||
return null; | ||
} |
17 changes: 17 additions & 0 deletions
17
...ustom-transforms/tests/errors/react-server-components/client-graph/multiple/output.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
x You are attempting to export "getServerSideProps" from a component marked with "use client", which is disallowed. Either remove the export, or the "use client" directive. Read more: https:// | ||
| nextjs.org/docs/app/api-reference/directives/use-client | ||
| | ||
| | ||
,-[input.js:5:1] | ||
4 | | ||
5 | export function getServerSideProps() {} | ||
: ^^^^^^^^^^^^^^^^^^ | ||
`---- | ||
x "getServerSideProps" is not supported in app/. Read more: https://nextjs.org/docs/app/building-your-application/data-fetching | ||
| | ||
| | ||
,-[input.js:5:1] | ||
4 | | ||
5 | export function getServerSideProps() {} | ||
: ^^^^^^^^^^^^^^^^^^ | ||
`---- |
5 changes: 5 additions & 0 deletions
5
...t-custom-transforms/tests/errors/react-server-components/server-graph/dynamic-io/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export const runtime = 'edge' | ||
export const dynamic = 'force-dynamic' | ||
export const dynamicParams = false | ||
export const fetchCache = 'force-no-store' | ||
export const revalidate = 1 |
5 changes: 5 additions & 0 deletions
5
...-custom-transforms/tests/errors/react-server-components/server-graph/dynamic-io/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export const runtime = 'edge'; | ||
export const dynamic = 'force-dynamic'; | ||
export const dynamicParams = false; | ||
export const fetchCache = 'force-no-store'; | ||
export const revalidate = 1; |
30 changes: 30 additions & 0 deletions
30
...tom-transforms/tests/errors/react-server-components/server-graph/dynamic-io/output.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
x "fetchCache" is not compatible with `nextConfig.experimental.dynamicIO`. Please remove it. | ||
,-[input.js:5:1] | ||
4 | export const fetchCache = 'force-no-store' | ||
5 | export const revalidate = 1 | ||
: ^^^^^^^^^^ | ||
`---- | ||
x "dynamic" is not compatible with `nextConfig.experimental.dynamicIO`. Please remove it. | ||
,-[input.js:5:1] | ||
4 | export const fetchCache = 'force-no-store' | ||
5 | export const revalidate = 1 | ||
: ^^^^^^^^^^ | ||
`---- | ||
x "dynamicParams" is not compatible with `nextConfig.experimental.dynamicIO`. Please remove it. | ||
,-[input.js:5:1] | ||
4 | export const fetchCache = 'force-no-store' | ||
5 | export const revalidate = 1 | ||
: ^^^^^^^^^^ | ||
`---- | ||
x "revalidate" is not compatible with `nextConfig.experimental.dynamicIO`. Please remove it. | ||
,-[input.js:5:1] | ||
4 | export const fetchCache = 'force-no-store' | ||
5 | export const revalidate = 1 | ||
: ^^^^^^^^^^ | ||
`---- | ||
x "runtime" is not compatible with `nextConfig.experimental.dynamicIO`. Please remove it. | ||
,-[input.js:5:1] | ||
4 | export const fetchCache = 'force-no-store' | ||
5 | export const revalidate = 1 | ||
: ^^^^^^^^^^ | ||
`---- |
6 changes: 6 additions & 0 deletions
6
...m-transforms/tests/errors/react-server-components/server-graph/generate-metadata/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// generateMetadata without metadata is ok. | ||
export function generateMetadata() {} | ||
|
||
export default function () { | ||
return null | ||
} |
5 changes: 5 additions & 0 deletions
5
...-transforms/tests/errors/react-server-components/server-graph/generate-metadata/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// generateMetadata without metadata is ok. | ||
export function generateMetadata() {} | ||
export default function() { | ||
return null; | ||
} |
7 changes: 7 additions & 0 deletions
7
...m-transforms/tests/errors/react-server-components/server-graph/metadata-conflict/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export const metadata = {} | ||
|
||
export function generateMetadata() {} | ||
|
||
export default function () { | ||
return null | ||
} |
5 changes: 5 additions & 0 deletions
5
...-transforms/tests/errors/react-server-components/server-graph/metadata-conflict/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export const metadata = {}; | ||
export function generateMetadata() {} | ||
export default function() { | ||
return null; | ||
} |
8 changes: 8 additions & 0 deletions
8
...nsforms/tests/errors/react-server-components/server-graph/metadata-conflict/output.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
x "metadata" and "generateMetadata" cannot be exported at the same time, please keep one of them. Read more: https://nextjs.org/docs/app/api-reference/file-conventions/metadata | ||
| | ||
| | ||
,-[input.js:3:1] | ||
2 | | ||
3 | export function generateMetadata() {} | ||
: ^^^^^^^^^^^^^^^^ | ||
`---- |
6 changes: 6 additions & 0 deletions
6
...ext-custom-transforms/tests/errors/react-server-components/server-graph/metadata/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// metadata without generateMetadata is ok. | ||
export const metadata = {} | ||
|
||
export default function () { | ||
return null | ||
} |
5 changes: 5 additions & 0 deletions
5
...xt-custom-transforms/tests/errors/react-server-components/server-graph/metadata/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// metadata without generateMetadata is ok. | ||
export const metadata = {}; | ||
export default function() { | ||
return null; | ||
} |