-
Notifications
You must be signed in to change notification settings - Fork 27.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Differentiate error messages in server function transforms
- Loading branch information
1 parent
8d29d4b
commit 0d28d70
Showing
15 changed files
with
139 additions
and
56 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
6 changes: 6 additions & 0 deletions
6
crates/next-custom-transforms/tests/errors/server-actions/server-graph/14/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 @@ | ||
'use cache' | ||
|
||
export default function () {} | ||
export function foo() {} | ||
export const bar = () => {} | ||
export const baz = 42 |
Empty file.
27 changes: 27 additions & 0 deletions
27
crates/next-custom-transforms/tests/errors/server-actions/server-graph/14/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,27 @@ | ||
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 | ||
: ^^^^^^^^^^^^^^^^^^^^^ | ||
`---- |
11 changes: 11 additions & 0 deletions
11
crates/next-custom-transforms/tests/errors/server-actions/server-graph/15/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,11 @@ | ||
export default function () { | ||
'use cache' | ||
} | ||
|
||
export function foo() { | ||
'use cache' | ||
} | ||
|
||
export const bar = () => { | ||
'use cache' | ||
} |
3 changes: 3 additions & 0 deletions
3
crates/next-custom-transforms/tests/errors/server-actions/server-graph/15/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 default function() {} | ||
export function foo() {} | ||
export const bar = ()=>{}; |
20 changes: 20 additions & 0 deletions
20
crates/next-custom-transforms/tests/errors/server-actions/server-graph/15/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,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 = () => { | ||
10 | | 'use cache' | ||
11 | `-> } | ||
`---- |
8 changes: 0 additions & 8 deletions
8
crates/next-custom-transforms/tests/errors/server-actions/server-graph/3/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 |
---|---|---|
@@ -1,8 +0,0 @@ | ||
/* __next_internal_action_entry_do_not_use__ {"b78c261f135a7a852508c2920bd7228020ff4bd7":"x"} */ import { registerServerReference } from "private-next-rsc-server-reference"; | ||
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; | ||
export const x = 1; | ||
import { ensureServerEntryExports } from "private-next-rsc-action-validate"; | ||
ensureServerEntryExports([ | ||
x | ||
]); | ||
registerServerReference(x, "b78c261f135a7a852508c2920bd7228020ff4bd7", null); | ||
7 changes: 0 additions & 7 deletions
7
crates/next-custom-transforms/tests/errors/server-actions/server-graph/4/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 |
---|---|---|
@@ -1,7 +0,0 @@ | ||
/* __next_internal_action_entry_do_not_use__ {} */ import { registerServerReference } from "private-next-rsc-server-reference"; | ||
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; | ||
export default class Component { | ||
render() { | ||
return null; | ||
} | ||
} | ||
3 changes: 0 additions & 3 deletions
3
crates/next-custom-transforms/tests/errors/server-actions/server-graph/5/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 |
---|---|---|
@@ -1,3 +0,0 @@ | ||
/* __next_internal_action_entry_do_not_use__ {} */ import { registerServerReference } from "private-next-rsc-server-reference"; | ||
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; | ||
export * from 'foo'; | ||
14 changes: 12 additions & 2 deletions
14
crates/next-custom-transforms/tests/errors/server-actions/server-graph/6/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 |
---|---|---|
@@ -1,3 +1,13 @@ | ||
/* __next_internal_action_entry_do_not_use__ {} */ import { registerServerReference } from "private-next-rsc-server-reference"; | ||
/* __next_internal_action_entry_do_not_use__ {"c18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default"} */ import { registerServerReference } from "private-next-rsc-server-reference"; | ||
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; | ||
export default (()=>{}); | ||
export default $$RSC_SERVER_ACTION_0 = ()=>{}; | ||
var $$RSC_SERVER_ACTION_0; | ||
Object.defineProperty($$RSC_SERVER_ACTION_0, "name", { | ||
"value": "default", | ||
"writable": false | ||
}); | ||
import { ensureServerEntryExports } from "private-next-rsc-action-validate"; | ||
ensureServerEntryExports([ | ||
$$RSC_SERVER_ACTION_0 | ||
]); | ||
registerServerReference($$RSC_SERVER_ACTION_0, "c18c215a6b7cdc64bf709f3a714ffdef1bf9651d", null); |
4 changes: 2 additions & 2 deletions
4
crates/next-custom-transforms/tests/errors/server-actions/server-graph/6/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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
x Only async functions are allowed to be exported in a "use server" file. | ||
x Server Actions must be async functions. | ||
,-[input.js:3:1] | ||
2 | | ||
3 | export default () => {} | ||
: ^^^^^^^^^^^^^^^^^^^^^^^ | ||
: ^^^^^^^^ | ||
`---- |
5 changes: 1 addition & 4 deletions
5
crates/next-custom-transforms/tests/errors/server-actions/server-graph/7/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 |
---|---|---|
@@ -1,4 +1 @@ | ||
/* __next_internal_action_entry_do_not_use__ {"6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; | ||
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; | ||
export const $$RSC_SERVER_ACTION_0 = async function foo() {}; | ||
const foo = registerServerReference($$RSC_SERVER_ACTION_0, "6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null); | ||
const foo = ()=>{}; |
2 changes: 1 addition & 1 deletion
2
crates/next-custom-transforms/tests/errors/server-actions/server-graph/7/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
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