-
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.
Support named exports for server references (#46558)
NEXT-424 Note that this change also prepares for upcoming PRs to support arrow functions. ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/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` - [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm build && pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
- Loading branch information
Showing
3 changed files
with
146 additions
and
16 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
11 changes: 11 additions & 0 deletions
11
packages/next-swc/crates/core/tests/fixture/server-actions/9/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 @@ | ||
// app/send.ts | ||
"use server"; | ||
|
||
async function foo () {} | ||
export { foo } | ||
|
||
async function bar() {} | ||
export { bar as baz } | ||
|
||
async function qux() {} | ||
export { qux as default } |
19 changes: 19 additions & 0 deletions
19
packages/next-swc/crates/core/tests/fixture/server-actions/9/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,19 @@ | ||
// app/send.ts | ||
/* __next_internal_action_entry_do_not_use__ foo,bar,qux */ async function foo() {} | ||
foo.$$typeof = Symbol.for("react.server.reference"); | ||
foo.$$filepath = "/app/item.js"; | ||
foo.$$name = "foo"; | ||
foo.$$bound = []; | ||
export { foo }; | ||
async function bar() {} | ||
bar.$$typeof = Symbol.for("react.server.reference"); | ||
bar.$$filepath = "/app/item.js"; | ||
bar.$$name = "bar"; | ||
bar.$$bound = []; | ||
export { bar as baz }; | ||
async function qux() {} | ||
qux.$$typeof = Symbol.for("react.server.reference"); | ||
qux.$$filepath = "/app/item.js"; | ||
qux.$$name = "qux"; | ||
qux.$$bound = []; | ||
export { qux as default }; |