Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consolidate server actions transform errors into emit_error function #72811

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/next-custom-transforms/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ easy-error = "1.0.0"
either = "1"
fxhash = "0.2.1"
hex = "0.4.3"
indoc = { workspace = true }
once_cell = { workspace = true }
pathdiff = { workspace = true }
regex = "1.5"
Expand Down
423 changes: 227 additions & 196 deletions crates/next-custom-transforms/src/transforms/server_actions.rs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
x Server Actions must be async functions
x Server Actions must be async functions.
|
,-[input.js:3:1]
2 |
3 | export function foo() {}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
x The "use server" directive must be at the top of the file, and cannot be wrapped in parentheses.
|
,-[input.js:2:1]
1 | import 'react'
2 | ;('use sevrer')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
x "use cache" functions must be async functions.
|
,-[input.js:3:1]
2 |
3 | export default function () {}
: ^^^^^^^^^^^^^^
4 | export function foo() {}
`----
x "use cache" functions must be async functions.
|
,-[input.js:4:1]
3 | export default function () {}
4 | export function foo() {}
: ^^^
5 | export const bar = () => {}
`----
x "use cache" functions must be async functions.
|
,-[input.js:5:1]
4 | export function foo() {}
5 | export const bar = () => {}
: ^^^^^^^^
6 | export const baz = 42
`----
x Only async functions are allowed to be exported in a "use cache" file.
|
,-[input.js:6:1]
5 | export const bar = () => {}
6 | export const baz = 42
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
x "use cache" functions must be async functions.
|
,-[input.js:1:1]
1 | ,-> export default function () {
2 | | 'use cache'
3 | `-> }
`----
x "use cache" functions must be async functions.
|
,-[input.js:5:1]
4 |
5 | export function foo() {
: ^^^
6 | 'use cache'
`----
x "use cache" functions must be async functions.
|
,-[input.js:9:1]
8 |
9 | ,-> export const bar = () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
x Server Actions must be async functions
x Server Actions must be async functions.
|
,-[input.js:7:1]
6 |
7 | export function bar() {}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
x Only async functions are allowed to be exported in a "use server" file.
|
,-[input.js:3:1]
2 |
3 | export const x = 1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
x Only async functions are allowed to be exported in a "use server" file.
|
,-[input.js:3:1]
2 |
3 | ,-> export default class Component {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
x Only async functions are allowed to be exported in a "use server" file.
|
,-[input.js:3:1]
2 |
3 | export * from 'foo'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
x Server Actions must be async functions.
|
,-[input.js:3:1]
2 |
3 | export default () => {}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
x Server Actions must be async functions.
|
,-[input.js:1:1]
1 | ,-> const foo = () => {
2 | | 'use server'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
x The "use server" directive must be at the top of the function body.
|
,-[input.js:10:1]
9 | // prettier-ignore
10 | 'use server'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
x The "use server" directive must be at the top of the file.
|
,-[input.js:4:1]
3 | // prettier-ignore
4 | 'use server'
Expand Down
Loading