Skip to content

Commit

Permalink
Server Action tests (#62655)
Browse files Browse the repository at this point in the history
### What?
Backports some Server Action changes from Shu to 14.1.1.


[Improve the Server Actions SWC transform
](bf6460e)

[Fix Server Reference being double
registered](ef81b10)


[Improve the Server Actions SWC transform (part
2)](6e59c22)

[Fix module-level Server Action creation with closure-closed
values](51c6a07)


[Rename internal utility naming for
clarification](00d8e6e)

### Why?

### How?

---------

Co-authored-by: Shu Ding <[email protected]>
Co-authored-by: JJ Kasper <[email protected]>
  • Loading branch information
3 people authored Feb 28, 2024
1 parent a6946b6 commit 74b3f0f
Show file tree
Hide file tree
Showing 61 changed files with 601 additions and 440 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches: ['canary', 'next-14-1']
pull_request:
types: [opened, synchronize]
branches: ['canary', 'next-14-1']

env:
NAPI_CLI_VERSION: 2.14.7
Expand Down
4 changes: 2 additions & 2 deletions packages/next-swc/crates/next-core/src/next_import_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -829,10 +829,10 @@ async fn insert_next_shared_aliases(
);

import_map.insert_exact_alias(
"private-next-rsc-action-proxy",
"private-next-rsc-server-reference",
request_to_import_mapping(
project_path,
"next/dist/build/webpack/loaders/next-flight-loader/action-proxy",
"next/dist/build/webpack/loaders/next-flight-loader/server-reference",
),
);
import_map.insert_exact_alias(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl ResolvePlugin for ExternalCjsModulesResolvePlugin {
}

// from https://github.com/vercel/next.js/blob/8d1c619ad650f5d147207f267441caf12acd91d1/packages/next/src/build/handle-externals.ts#L188
let never_external_regex = lazy_regex::regex!("^(?:private-next-pages\\/|next\\/(?:dist\\/pages\\/|(?:app|document|link|image|legacy\\/image|constants|dynamic|script|navigation|headers|router)$)|string-hash|private-next-rsc-action-validate|private-next-rsc-action-client-wrapper|private-next-rsc-action-proxy$)");
let never_external_regex = lazy_regex::regex!("^(?:private-next-pages\\/|next\\/(?:dist\\/pages\\/|(?:app|document|link|image|legacy\\/image|constants|dynamic|script|navigation|headers|router)$)|string-hash|private-next-rsc-action-validate|private-next-rsc-action-client-wrapper|private-next-rsc-server-reference$)");

if never_external_regex.is_match(&request_value.request().unwrap_or_default()) {
return Ok(ResolveResultOption::none());
Expand Down
Loading

1 comment on commit 74b3f0f

@AkmaludinFitra
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit

Please sign in to comment.