Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
next-swc: Emit errors and add tests to next-ssg (#32254)
## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have helpful link attached, see `contributing.md` ## Documentation / Examples - [ ] Make sure the linting passes by running `yarn lint`
- Loading branch information
1 parent
f221f88
commit b0bd0ee
Showing
14 changed files
with
110 additions
and
28 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
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
2 changes: 2 additions & 0 deletions
2
packages/next-swc/crates/core/tests/errors/next-ssg/server-side-after-static-paths/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,2 @@ | ||
export async function getStaticPaths() {} | ||
export const getServerSideProps = function getServerSideProps() {} |
3 changes: 3 additions & 0 deletions
3
packages/next-swc/crates/core/tests/errors/next-ssg/server-side-after-static-paths/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,3 @@ | ||
export var __N_SSG = true; | ||
export const getServerSideProps = function getServerSideProps() { | ||
} |
6 changes: 6 additions & 0 deletions
6
...s/next-swc/crates/core/tests/errors/next-ssg/server-side-after-static-paths/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,6 @@ | ||
error: You can not use getStaticProps or getStaticPaths with getServerSideProps. To use SSG, please remove getServerSideProps | ||
--> input.js:2:14 | ||
| | ||
2 | export const getServerSideProps = function getServerSideProps() {} | ||
| ^^^^^^^^^^^^^^^^^^ | ||
|
3 changes: 3 additions & 0 deletions
3
packages/next-swc/crates/core/tests/errors/next-ssg/server-side-after-static-props/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,3 @@ | ||
const getStaticProps = async () => {} | ||
export { a as getServerSideProps } | ||
|
Empty file.
6 changes: 6 additions & 0 deletions
6
...s/next-swc/crates/core/tests/errors/next-ssg/server-side-after-static-props/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,6 @@ | ||
error: You can not use getStaticProps or getStaticPaths with getServerSideProps. To use SSG, please remove getServerSideProps | ||
--> input.js:2:15 | ||
| | ||
2 | export { a as getServerSideProps } | ||
| ^^^^^^^^^^^^^^^^^^ | ||
|
4 changes: 4 additions & 0 deletions
4
packages/next-swc/crates/core/tests/errors/next-ssg/static-paths-after-server-side/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,4 @@ | ||
export { a as getServerSideProps } from './input' | ||
export { getStaticPaths } from 'a' | ||
|
||
|
Empty file.
6 changes: 6 additions & 0 deletions
6
...s/next-swc/crates/core/tests/errors/next-ssg/static-paths-after-server-side/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,6 @@ | ||
error: You can not use getStaticProps or getStaticPaths with getServerSideProps. To use SSG, please remove getServerSideProps | ||
--> input.js:2:10 | ||
| | ||
2 | export { getStaticPaths } from 'a' | ||
| ^^^^^^^^^^^^^^ | ||
|
1 change: 1 addition & 0 deletions
1
packages/next-swc/crates/core/tests/errors/next-ssg/static-props-after-server-side/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 @@ | ||
export { getStaticProps, getServerSideProps } |
Empty file.
6 changes: 6 additions & 0 deletions
6
...s/next-swc/crates/core/tests/errors/next-ssg/static-props-after-server-side/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,6 @@ | ||
error: You can not use getStaticProps or getStaticPaths with getServerSideProps. To use SSG, please remove getServerSideProps | ||
--> input.js:1:26 | ||
| | ||
1 | export { getStaticProps, getServerSideProps } | ||
| ^^^^^^^^^^^^^^^^^^ | ||
|