Unverified Commit 74b3f0f4 authored by Max Leiter's avatar Max Leiter Committed by GitHub

Server Action tests (#62655)

### What?
Backports some Server Action changes from Shu to 14.1.1.


[Improve the Server Actions SWC transform
](https://github.com/vercel/next.js/pull/62655/commits/bf6460e985c0ff8e41c03e000cbcb2638bcf99c7)

[Fix Server Reference being double
registered](https://github.com/vercel/next.js/pull/62655/commits/ef81b1099856bc7918dfa39e6d272cce53451eaf)


[Improve the Server Actions SWC transform (part
2)](https://github.com/vercel/next.js/pull/62655/commits/6e59c222a84f48edfc958d3327eb5448431e7784)

[Fix module-level Server Action creation with closure-closed
values](https://github.com/vercel/next.js/pull/62655/commits/51c6a07ec6a373eca3425ef565a53f4105112099)


[Rename internal utility naming for
clarification](https://github.com/vercel/next.js/pull/62655/commits/00d8e6e0612b7afddbce5f944a7330413e548871)

### Why?

### How?

---------
Co-authored-by: 's avatarShu Ding <g@shud.in>
Co-authored-by: 's avatarJJ Kasper <jj@jjsweb.site>
parent a6946b69
...@@ -5,6 +5,7 @@ on: ...@@ -5,6 +5,7 @@ on:
branches: ['canary', 'next-14-1'] branches: ['canary', 'next-14-1']
pull_request: pull_request:
types: [opened, synchronize] types: [opened, synchronize]
branches: ['canary', 'next-14-1']
env: env:
NAPI_CLI_VERSION: 2.14.7 NAPI_CLI_VERSION: 2.14.7
......
...@@ -829,10 +829,10 @@ async fn insert_next_shared_aliases( ...@@ -829,10 +829,10 @@ async fn insert_next_shared_aliases(
); );
import_map.insert_exact_alias( import_map.insert_exact_alias(
"private-next-rsc-action-proxy", "private-next-rsc-server-reference",
request_to_import_mapping( request_to_import_mapping(
project_path, 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( import_map.insert_exact_alias(
......
...@@ -86,7 +86,7 @@ impl ResolvePlugin for ExternalCjsModulesResolvePlugin { ...@@ -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 // 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()) { if never_external_regex.is_match(&request_value.request().unwrap_or_default()) {
return Ok(ResolveResultOption::none()); return Ok(ResolveResultOption::none());
......
/* __next_internal_client_entry_do_not_use__ default auto */ /* __next_internal_action_entry_do_not_use__ {"6d53ce510b2e36499b8f56038817b9bad86cabb4":"$$ACTION_0"} */ export async function $$ACTION_0() {} /* __next_internal_client_entry_do_not_use__ default auto */ /* __next_internal_action_entry_do_not_use__ {"6d53ce510b2e36499b8f56038817b9bad86cabb4":"$$ACTION_0"} */ export async function $$ACTION_0() {}
export default function App() { export default function App() {
var fn = createActionProxy("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_0); var fn = registerServerReference("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_0);
return <div>App</div>; return <div>App</div>;
} }
/* __next_internal_action_entry_do_not_use__ {"ab21efdafbe611287bc25c0462b1e0510d13e48b":"foo"} */ import { createActionProxy } from "private-next-rsc-action-proxy"; /* __next_internal_action_entry_do_not_use__ {"ab21efdafbe611287bc25c0462b1e0510d13e48b":"foo"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
export function foo() {} export function foo() {}
import { ensureServerEntryExports } from "private-next-rsc-action-validate"; import { ensureServerEntryExports } from "private-next-rsc-action-validate";
ensureServerEntryExports([ ensureServerEntryExports([
foo foo
]); ]);
createActionProxy("ab21efdafbe611287bc25c0462b1e0510d13e48b", foo); registerServerReference("ab21efdafbe611287bc25c0462b1e0510d13e48b", foo);
/* __next_internal_action_entry_do_not_use__ {"ac840dcaf5e8197cb02b7f3a43c119b7a770b272":"bar"} */ import { createActionProxy } from "private-next-rsc-action-proxy"; /* __next_internal_action_entry_do_not_use__ {"ac840dcaf5e8197cb02b7f3a43c119b7a770b272":"bar"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
'use strict'; 'use strict';
export function bar() {} export function bar() {}
...@@ -6,4 +6,4 @@ import { ensureServerEntryExports } from "private-next-rsc-action-validate"; ...@@ -6,4 +6,4 @@ import { ensureServerEntryExports } from "private-next-rsc-action-validate";
ensureServerEntryExports([ ensureServerEntryExports([
bar bar
]); ]);
createActionProxy("ac840dcaf5e8197cb02b7f3a43c119b7a770b272", bar); registerServerReference("ac840dcaf5e8197cb02b7f3a43c119b7a770b272", bar);
/* __next_internal_action_entry_do_not_use__ {"b78c261f135a7a852508c2920bd7228020ff4bd7":"x"} */ import { createActionProxy } from "private-next-rsc-action-proxy"; /* __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"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
export const x = 1; export const x = 1;
import { ensureServerEntryExports } from "private-next-rsc-action-validate"; import { ensureServerEntryExports } from "private-next-rsc-action-validate";
ensureServerEntryExports([ ensureServerEntryExports([
x x
]); ]);
createActionProxy("b78c261f135a7a852508c2920bd7228020ff4bd7", x); registerServerReference("b78c261f135a7a852508c2920bd7228020ff4bd7", x);
/* __next_internal_action_entry_do_not_use__ {} */ import { createActionProxy } from "private-next-rsc-action-proxy"; /* __next_internal_action_entry_do_not_use__ {} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
export default class Component { export default class Component {
render() { render() {
......
/* __next_internal_action_entry_do_not_use__ {} */ import { createActionProxy } from "private-next-rsc-action-proxy"; /* __next_internal_action_entry_do_not_use__ {} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
export * from 'foo'; export * from 'foo';
import { ensureServerEntryExports } from "private-next-rsc-action-validate"; import { ensureServerEntryExports } from "private-next-rsc-action-validate";
......
/* __next_internal_action_entry_do_not_use__ {} */ import { createActionProxy } from "private-next-rsc-action-proxy"; /* __next_internal_action_entry_do_not_use__ {"6d53ce510b2e36499b8f56038817b9bad86cabb4":"$$ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
export default (()=>{}); export default registerServerReference("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_0);
export async function $$ACTION_0() {}
import { ensureServerEntryExports } from "private-next-rsc-action-validate"; import { ensureServerEntryExports } from "private-next-rsc-action-validate";
ensureServerEntryExports([]); ensureServerEntryExports([]);
/* __next_internal_action_entry_do_not_use__ {"188d5d945750dc32e2c842b93c75a65763d4a922":"$$ACTION_1"} */ import { createActionProxy } from "private-next-rsc-action-proxy"; /* __next_internal_action_entry_do_not_use__ {"6d53ce510b2e36499b8f56038817b9bad86cabb4":"$$ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
const foo = createActionProxy("188d5d945750dc32e2c842b93c75a65763d4a922", $$ACTION_1); const foo = registerServerReference("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_0);
export async function $$ACTION_1() {} export async function $$ACTION_0() {}
/* __next_internal_action_entry_do_not_use__ {"188d5d945750dc32e2c842b93c75a65763d4a922":"$$ACTION_1"} */ import { createActionProxy } from "private-next-rsc-action-proxy"; /* __next_internal_action_entry_do_not_use__ {"6d53ce510b2e36499b8f56038817b9bad86cabb4":"$$ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
const foo = createActionProxy("188d5d945750dc32e2c842b93c75a65763d4a922", $$ACTION_1); const foo = registerServerReference("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_0);
export async function $$ACTION_1() { export async function $$ACTION_0() {
'use strict'; 'use strict';
} }
const bar = async ()=>{ const bar = async ()=>{
......
'use server'
let a, f
export async function action0(b, c, ...g) {
return async function action1(d) {
'use server'
let f
console.log(...window, { window })
console.log(a, b, action2)
async function action2(e) {
'use server'
console.log(a, c, d, e, f, g)
}
return [
action2,
async function action3(e) {
'use server'
action2(e)
console.log(a, c, d, e)
},
]
}
}
/* __next_internal_action_entry_do_not_use__ {"0090eaf4e1f08a2d94f6be401e54a2ded399b87c":"action0","188d5d945750dc32e2c842b93c75a65763d4a922":"$$ACTION_1","6d53ce510b2e36499b8f56038817b9bad86cabb4":"$$ACTION_0","9878bfa39811ca7650992850a8751f9591b6a557":"$$ACTION_2"} */ export var action0 = createServerReference("0090eaf4e1f08a2d94f6be401e54a2ded399b87c");
import { createServerReference } from "private-next-rsc-action-client-wrapper";
/* __next_internal_action_entry_do_not_use__ {"6d53ce510b2e36499b8f56038817b9bad86cabb4":"$$ACTION_0","9878bfa39811ca7650992850a8751f9591b6a557":"$$ACTION_2"} */ import { createActionProxy } from "private-next-rsc-action-proxy"; /* __next_internal_action_entry_do_not_use__ {"188d5d945750dc32e2c842b93c75a65763d4a922":"$$ACTION_1","6d53ce510b2e36499b8f56038817b9bad86cabb4":"$$ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
import deleteFromDb from 'db'; import deleteFromDb from 'db';
export function Item({ id1, id2 }) { export function Item({ id1, id2 }) {
var deleteItem = createActionProxy("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_0).bind(null, encryptActionBoundArgs("6d53ce510b2e36499b8f56038817b9bad86cabb4", [ var deleteItem = registerServerReference("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_0).bind(null, encryptActionBoundArgs("6d53ce510b2e36499b8f56038817b9bad86cabb4", [
id1, id1,
id2 id2
])); ]));
return <Button action={createActionProxy("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_0).bind(null, encryptActionBoundArgs("6d53ce510b2e36499b8f56038817b9bad86cabb4", [ return <Button action={deleteItem}>Delete</Button>;
id1,
id2
]))}>Delete</Button>;
} }
export async function $$ACTION_0($$ACTION_CLOSURE_BOUND) { export async function $$ACTION_0($$ACTION_CLOSURE_BOUND) {
var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_CLOSURE_BOUND); var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_CLOSURE_BOUND);
...@@ -21,14 +18,14 @@ export default function Home() { ...@@ -21,14 +18,14 @@ export default function Home() {
name: 'John', name: 'John',
test: 'test' test: 'test'
}; };
const action = createActionProxy("9878bfa39811ca7650992850a8751f9591b6a557", $$ACTION_2).bind(null, encryptActionBoundArgs("9878bfa39811ca7650992850a8751f9591b6a557", [ const action = registerServerReference("188d5d945750dc32e2c842b93c75a65763d4a922", $$ACTION_1).bind(null, encryptActionBoundArgs("188d5d945750dc32e2c842b93c75a65763d4a922", [
info.name, info.name,
info.test info.test
])); ]));
return null; return null;
} }
export async function $$ACTION_2($$ACTION_CLOSURE_BOUND) { export async function $$ACTION_1($$ACTION_CLOSURE_BOUND) {
var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("9878bfa39811ca7650992850a8751f9591b6a557", $$ACTION_CLOSURE_BOUND); var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("188d5d945750dc32e2c842b93c75a65763d4a922", $$ACTION_CLOSURE_BOUND);
console.log($$ACTION_ARG_0); console.log($$ACTION_ARG_0);
console.log($$ACTION_ARG_1); console.log($$ACTION_ARG_1);
} }
/* __next_internal_action_entry_do_not_use__ {"c18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default"} */ import { createActionProxy } from "private-next-rsc-action-proxy"; /* __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"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
export default async function foo() {} export default async function foo() {}
import { ensureServerEntryExports } from "private-next-rsc-action-validate"; import { ensureServerEntryExports } from "private-next-rsc-action-validate";
ensureServerEntryExports([ ensureServerEntryExports([
foo foo
]); ]);
createActionProxy("c18c215a6b7cdc64bf709f3a714ffdef1bf9651d", foo); registerServerReference("c18c215a6b7cdc64bf709f3a714ffdef1bf9651d", foo);
/* __next_internal_action_entry_do_not_use__ {"c18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default"} */ import { createActionProxy } from "private-next-rsc-action-proxy"; /* __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"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
export default async function $$ACTION_0() {} export default async function $$ACTION_0() {}
import { ensureServerEntryExports } from "private-next-rsc-action-validate"; import { ensureServerEntryExports } from "private-next-rsc-action-validate";
ensureServerEntryExports([ ensureServerEntryExports([
$$ACTION_0 $$ACTION_0
]); ]);
createActionProxy("c18c215a6b7cdc64bf709f3a714ffdef1bf9651d", $$ACTION_0); registerServerReference("c18c215a6b7cdc64bf709f3a714ffdef1bf9651d", $$ACTION_0);
/* __next_internal_action_entry_do_not_use__ {"c18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default"} */ import { createActionProxy } from "private-next-rsc-action-proxy"; /* __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"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
async function foo() {} async function foo() {}
export default foo; export default foo;
...@@ -6,4 +6,4 @@ import { ensureServerEntryExports } from "private-next-rsc-action-validate"; ...@@ -6,4 +6,4 @@ import { ensureServerEntryExports } from "private-next-rsc-action-validate";
ensureServerEntryExports([ ensureServerEntryExports([
foo foo
]); ]);
createActionProxy("c18c215a6b7cdc64bf709f3a714ffdef1bf9651d", foo); registerServerReference("c18c215a6b7cdc64bf709f3a714ffdef1bf9651d", foo);
/* __next_internal_action_entry_do_not_use__ {"ac840dcaf5e8197cb02b7f3a43c119b7a770b272":"bar","c18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default"} */ import { createActionProxy } from "private-next-rsc-action-proxy"; /* __next_internal_action_entry_do_not_use__ {"ac840dcaf5e8197cb02b7f3a43c119b7a770b272":"bar","c18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
const foo = async function() {}; const foo = async function() {};
export default foo; export default foo;
...@@ -9,5 +9,5 @@ ensureServerEntryExports([ ...@@ -9,5 +9,5 @@ ensureServerEntryExports([
foo, foo,
bar bar
]); ]);
createActionProxy("c18c215a6b7cdc64bf709f3a714ffdef1bf9651d", foo); registerServerReference("c18c215a6b7cdc64bf709f3a714ffdef1bf9651d", foo);
createActionProxy("ac840dcaf5e8197cb02b7f3a43c119b7a770b272", bar); registerServerReference("ac840dcaf5e8197cb02b7f3a43c119b7a770b272", bar);
/* __next_internal_action_entry_do_not_use__ {"ab21efdafbe611287bc25c0462b1e0510d13e48b":"foo"} */ import { createActionProxy } from "private-next-rsc-action-proxy"; /* __next_internal_action_entry_do_not_use__ {"ab21efdafbe611287bc25c0462b1e0510d13e48b":"foo"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
export async function foo() { export async function foo() {
async function bar() {} async function bar() {}
...@@ -7,4 +7,4 @@ import { ensureServerEntryExports } from "private-next-rsc-action-validate"; ...@@ -7,4 +7,4 @@ import { ensureServerEntryExports } from "private-next-rsc-action-validate";
ensureServerEntryExports([ ensureServerEntryExports([
foo foo
]); ]);
createActionProxy("ab21efdafbe611287bc25c0462b1e0510d13e48b", foo); registerServerReference("ab21efdafbe611287bc25c0462b1e0510d13e48b", foo);
/* __next_internal_action_entry_do_not_use__ {"c18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default"} */ import { createActionProxy } from "private-next-rsc-action-proxy"; /* __next_internal_action_entry_do_not_use__ {"188d5d945750dc32e2c842b93c75a65763d4a922":"$$ACTION_1","c18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
export default $$ACTION_0 = async (a, b)=>{ export default $$ACTION_0 = registerServerReference("188d5d945750dc32e2c842b93c75a65763d4a922", $$ACTION_1);
console.log(a, b);
};
var $$ACTION_0; var $$ACTION_0;
export async function $$ACTION_1(a, b) {
console.log(a, b);
}
import { ensureServerEntryExports } from "private-next-rsc-action-validate"; import { ensureServerEntryExports } from "private-next-rsc-action-validate";
ensureServerEntryExports([ ensureServerEntryExports([
$$ACTION_0 $$ACTION_0
]); ]);
createActionProxy("c18c215a6b7cdc64bf709f3a714ffdef1bf9651d", $$ACTION_0); registerServerReference("c18c215a6b7cdc64bf709f3a714ffdef1bf9651d", $$ACTION_0);
/* __next_internal_action_entry_do_not_use__ {"188d5d945750dc32e2c842b93c75a65763d4a922":"$$ACTION_1","9878bfa39811ca7650992850a8751f9591b6a557":"$$ACTION_2","9c0dd1f7c2b3f41d32e10f5c437de3d67ad32c6c":"$$ACTION_4"} */ import { createActionProxy } from "private-next-rsc-action-proxy"; /* __next_internal_action_entry_do_not_use__ {"188d5d945750dc32e2c842b93c75a65763d4a922":"$$ACTION_1","6d53ce510b2e36499b8f56038817b9bad86cabb4":"$$ACTION_0","9878bfa39811ca7650992850a8751f9591b6a557":"$$ACTION_2"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
import deleteFromDb from 'db'; import deleteFromDb from 'db';
const v1 = 'v1'; const v1 = 'v1';
export function Item({ id1, id2 }) { export function Item({ id1, id2 }) {
const v2 = id2; const v2 = id2;
const deleteItem = createActionProxy("188d5d945750dc32e2c842b93c75a65763d4a922", $$ACTION_1).bind(null, encryptActionBoundArgs("188d5d945750dc32e2c842b93c75a65763d4a922", [ const deleteItem = registerServerReference("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_0).bind(null, encryptActionBoundArgs("6d53ce510b2e36499b8f56038817b9bad86cabb4", [
id1, id1,
v2 v2
])); ]));
return <Button action={deleteItem}>Delete</Button>; return <Button action={deleteItem}>Delete</Button>;
} }
export async function $$ACTION_1($$ACTION_CLOSURE_BOUND) { export async function $$ACTION_0($$ACTION_CLOSURE_BOUND) {
var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("188d5d945750dc32e2c842b93c75a65763d4a922", $$ACTION_CLOSURE_BOUND); var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_CLOSURE_BOUND);
await deleteFromDb($$ACTION_ARG_0); await deleteFromDb($$ACTION_ARG_0);
await deleteFromDb(v1); await deleteFromDb(v1);
await deleteFromDb($$ACTION_ARG_1); await deleteFromDb($$ACTION_ARG_1);
} }
const f = (x)=>{ const f = (x)=>{
var g = createActionProxy("9878bfa39811ca7650992850a8751f9591b6a557", $$ACTION_2).bind(null, encryptActionBoundArgs("9878bfa39811ca7650992850a8751f9591b6a557", [ var g = registerServerReference("188d5d945750dc32e2c842b93c75a65763d4a922", $$ACTION_1).bind(null, encryptActionBoundArgs("188d5d945750dc32e2c842b93c75a65763d4a922", [
x x
])); ]));
}; };
export async function $$ACTION_2($$ACTION_CLOSURE_BOUND, y, ...z) { export async function $$ACTION_1($$ACTION_CLOSURE_BOUND, y, ...z) {
var [$$ACTION_ARG_0] = await decryptActionBoundArgs("9878bfa39811ca7650992850a8751f9591b6a557", $$ACTION_CLOSURE_BOUND); var [$$ACTION_ARG_0] = await decryptActionBoundArgs("188d5d945750dc32e2c842b93c75a65763d4a922", $$ACTION_CLOSURE_BOUND);
return $$ACTION_ARG_0 + y + z[0]; return $$ACTION_ARG_0 + y + z[0];
} }
const g = (x)=>{ const g = (x)=>{
f = createActionProxy("9c0dd1f7c2b3f41d32e10f5c437de3d67ad32c6c", $$ACTION_4).bind(null, encryptActionBoundArgs("9c0dd1f7c2b3f41d32e10f5c437de3d67ad32c6c", [ f = registerServerReference("9878bfa39811ca7650992850a8751f9591b6a557", $$ACTION_2).bind(null, encryptActionBoundArgs("9878bfa39811ca7650992850a8751f9591b6a557", [
x x
])); ]));
}; };
export async function $$ACTION_4($$ACTION_CLOSURE_BOUND, y, ...z) { export async function $$ACTION_2($$ACTION_CLOSURE_BOUND, y, ...z) {
var [$$ACTION_ARG_0] = await decryptActionBoundArgs("9c0dd1f7c2b3f41d32e10f5c437de3d67ad32c6c", $$ACTION_CLOSURE_BOUND); var [$$ACTION_ARG_0] = await decryptActionBoundArgs("9878bfa39811ca7650992850a8751f9591b6a557", $$ACTION_CLOSURE_BOUND);
return $$ACTION_ARG_0 + y + z[0]; return $$ACTION_ARG_0 + y + z[0];
} }
/* __next_internal_action_entry_do_not_use__ {"ab21efdafbe611287bc25c0462b1e0510d13e48b":"foo","ac840dcaf5e8197cb02b7f3a43c119b7a770b272":"bar"} */ import { createActionProxy } from "private-next-rsc-action-proxy"; /* __next_internal_action_entry_do_not_use__ {"6d53ce510b2e36499b8f56038817b9bad86cabb4":"$$ACTION_0","ab21efdafbe611287bc25c0462b1e0510d13e48b":"foo","ac840dcaf5e8197cb02b7f3a43c119b7a770b272":"bar"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
export const foo = async ()=>{}; export const foo = registerServerReference("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_0);
export async function $$ACTION_0() {}
const bar = async ()=>{}; const bar = async ()=>{};
export { bar }; export { bar };
import { ensureServerEntryExports } from "private-next-rsc-action-validate"; import { ensureServerEntryExports } from "private-next-rsc-action-validate";
...@@ -8,5 +9,5 @@ ensureServerEntryExports([ ...@@ -8,5 +9,5 @@ ensureServerEntryExports([
foo, foo,
bar bar
]); ]);
createActionProxy("ab21efdafbe611287bc25c0462b1e0510d13e48b", foo); registerServerReference("ab21efdafbe611287bc25c0462b1e0510d13e48b", foo);
createActionProxy("ac840dcaf5e8197cb02b7f3a43c119b7a770b272", bar); registerServerReference("ac840dcaf5e8197cb02b7f3a43c119b7a770b272", bar);
/* __next_internal_action_entry_do_not_use__ {"188d5d945750dc32e2c842b93c75a65763d4a922":"$$ACTION_1","56a859f462d35a297c46a1bbd1e6a9058c104ab8":"$$ACTION_3"} */ import { createActionProxy } from "private-next-rsc-action-proxy"; /* __next_internal_action_entry_do_not_use__ {"6d53ce510b2e36499b8f56038817b9bad86cabb4":"$$ACTION_0","9878bfa39811ca7650992850a8751f9591b6a557":"$$ACTION_2"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
import deleteFromDb from 'db'; import deleteFromDb from 'db';
const v1 = 'v1'; const v1 = 'v1';
...@@ -6,7 +6,7 @@ export function Item({ id1, id2 }) { ...@@ -6,7 +6,7 @@ export function Item({ id1, id2 }) {
const v2 = id2; const v2 = id2;
return <> return <>
<Button action={createActionProxy("188d5d945750dc32e2c842b93c75a65763d4a922", $$ACTION_1).bind(null, encryptActionBoundArgs("188d5d945750dc32e2c842b93c75a65763d4a922", [ <Button action={registerServerReference("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_0).bind(null, encryptActionBoundArgs("6d53ce510b2e36499b8f56038817b9bad86cabb4", [
id1, id1,
v2 v2
]))}> ]))}>
...@@ -15,7 +15,7 @@ export function Item({ id1, id2 }) { ...@@ -15,7 +15,7 @@ export function Item({ id1, id2 }) {
</Button> </Button>
<Button action={createActionProxy("56a859f462d35a297c46a1bbd1e6a9058c104ab8", $$ACTION_3).bind(null, encryptActionBoundArgs("56a859f462d35a297c46a1bbd1e6a9058c104ab8", [ <Button action={registerServerReference("9878bfa39811ca7650992850a8751f9591b6a557", $$ACTION_2).bind(null, encryptActionBoundArgs("9878bfa39811ca7650992850a8751f9591b6a557", [
id1, id1,
v2 v2
]))}> ]))}>
...@@ -26,14 +26,14 @@ export function Item({ id1, id2 }) { ...@@ -26,14 +26,14 @@ export function Item({ id1, id2 }) {
</>; </>;
} }
export async function $$ACTION_1($$ACTION_CLOSURE_BOUND) { export async function $$ACTION_0($$ACTION_CLOSURE_BOUND) {
var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("188d5d945750dc32e2c842b93c75a65763d4a922", $$ACTION_CLOSURE_BOUND); var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_CLOSURE_BOUND);
await deleteFromDb($$ACTION_ARG_0); await deleteFromDb($$ACTION_ARG_0);
await deleteFromDb(v1); await deleteFromDb(v1);
await deleteFromDb($$ACTION_ARG_1); await deleteFromDb($$ACTION_ARG_1);
} }
export async function $$ACTION_3($$ACTION_CLOSURE_BOUND) { export async function $$ACTION_2($$ACTION_CLOSURE_BOUND) {
var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("56a859f462d35a297c46a1bbd1e6a9058c104ab8", $$ACTION_CLOSURE_BOUND); var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("9878bfa39811ca7650992850a8751f9591b6a557", $$ACTION_CLOSURE_BOUND);
await deleteFromDb($$ACTION_ARG_0); await deleteFromDb($$ACTION_ARG_0);
await deleteFromDb(v1); await deleteFromDb(v1);
await deleteFromDb($$ACTION_ARG_1); await deleteFromDb($$ACTION_ARG_1);
......
/* __next_internal_action_entry_do_not_use__ {"188d5d945750dc32e2c842b93c75a65763d4a922":"$$ACTION_1"} */ import { createActionProxy } from "private-next-rsc-action-proxy"; /* __next_internal_action_entry_do_not_use__ {"6d53ce510b2e36499b8f56038817b9bad86cabb4":"$$ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
export function Item({ value }) { export function Item({ value }) {
return <> return <>
<Button action={createActionProxy("188d5d945750dc32e2c842b93c75a65763d4a922", $$ACTION_1).bind(null, encryptActionBoundArgs("188d5d945750dc32e2c842b93c75a65763d4a922", [ <Button action={registerServerReference("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_0).bind(null, encryptActionBoundArgs("6d53ce510b2e36499b8f56038817b9bad86cabb4", [
value value
]))}> ]))}>
...@@ -13,7 +13,7 @@ export function Item({ value }) { ...@@ -13,7 +13,7 @@ export function Item({ value }) {
</>; </>;
} }
export async function $$ACTION_1($$ACTION_CLOSURE_BOUND, value2) { export async function $$ACTION_0($$ACTION_CLOSURE_BOUND, value2) {
var [$$ACTION_ARG_0] = await decryptActionBoundArgs("188d5d945750dc32e2c842b93c75a65763d4a922", $$ACTION_CLOSURE_BOUND); var [$$ACTION_ARG_0] = await decryptActionBoundArgs("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_CLOSURE_BOUND);
return $$ACTION_ARG_0 * value2; return $$ACTION_ARG_0 * value2;
} }
/* __next_internal_action_entry_do_not_use__ {"6d53ce510b2e36499b8f56038817b9bad86cabb4":"$$ACTION_0","9878bfa39811ca7650992850a8751f9591b6a557":"$$ACTION_2"} */ import { createActionProxy } from "private-next-rsc-action-proxy"; /* __next_internal_action_entry_do_not_use__ {"188d5d945750dc32e2c842b93c75a65763d4a922":"$$ACTION_1","6d53ce510b2e36499b8f56038817b9bad86cabb4":"$$ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
var myAction = createActionProxy("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_0); var myAction = registerServerReference("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_0);
export async function $$ACTION_0(a, b, c) { export async function $$ACTION_0(a, b, c) {
console.log('a'); console.log('a');
} }
export default function Page() { export default function Page() {
return <Button action={createActionProxy("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_0)}>Delete</Button>; return <Button action={myAction}>Delete</Button>;
} }
export const action = withValidate(createActionProxy("9878bfa39811ca7650992850a8751f9591b6a557", $$ACTION_2)); export const action = withValidate(registerServerReference("188d5d945750dc32e2c842b93c75a65763d4a922", $$ACTION_1));
export async function $$ACTION_2() {} export async function $$ACTION_1() {}
/* __next_internal_action_entry_do_not_use__ {"c18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default"} */ import { createActionProxy } from "private-next-rsc-action-proxy"; /* __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"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
const [foo] = [ const [foo] = [
null null
...@@ -8,4 +8,4 @@ import { ensureServerEntryExports } from "private-next-rsc-action-validate"; ...@@ -8,4 +8,4 @@ import { ensureServerEntryExports } from "private-next-rsc-action-validate";
ensureServerEntryExports([ ensureServerEntryExports([
foo foo
]); ]);
createActionProxy("c18c215a6b7cdc64bf709f3a714ffdef1bf9651d", foo); registerServerReference("c18c215a6b7cdc64bf709f3a714ffdef1bf9651d", foo);
/* __next_internal_action_entry_do_not_use__ {"1383664d1dc2d9cfe33b88df3fa0eaffef8b99bc":"$$ACTION_5","188d5d945750dc32e2c842b93c75a65763d4a922":"$$ACTION_1","56a859f462d35a297c46a1bbd1e6a9058c104ab8":"$$ACTION_3"} */ import { createActionProxy } from "private-next-rsc-action-proxy"; /* __next_internal_action_entry_do_not_use__ {"188d5d945750dc32e2c842b93c75a65763d4a922":"$$ACTION_1","56a859f462d35a297c46a1bbd1e6a9058c104ab8":"$$ACTION_3","9878bfa39811ca7650992850a8751f9591b6a557":"$$ACTION_2"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
import { validator, another } from 'auth'; import { validator, another } from 'auth';
const x = 1; const x = 1;
export default function Page() { export default function Page() {
const y = 1; const y = 1;
return <Foo action={validator(createActionProxy("188d5d945750dc32e2c842b93c75a65763d4a922", $$ACTION_1).bind(null, encryptActionBoundArgs("188d5d945750dc32e2c842b93c75a65763d4a922", [ return <Foo action={validator(registerServerReference("188d5d945750dc32e2c842b93c75a65763d4a922", $$ACTION_1).bind(null, encryptActionBoundArgs("188d5d945750dc32e2c842b93c75a65763d4a922", [
y y
])))}/>; ])))}/>;
} }
...@@ -12,7 +12,7 @@ export async function $$ACTION_1($$ACTION_CLOSURE_BOUND, z) { ...@@ -12,7 +12,7 @@ export async function $$ACTION_1($$ACTION_CLOSURE_BOUND, z) {
var [$$ACTION_ARG_0] = await decryptActionBoundArgs("188d5d945750dc32e2c842b93c75a65763d4a922", $$ACTION_CLOSURE_BOUND); var [$$ACTION_ARG_0] = await decryptActionBoundArgs("188d5d945750dc32e2c842b93c75a65763d4a922", $$ACTION_CLOSURE_BOUND);
return x + $$ACTION_ARG_0 + z; return x + $$ACTION_ARG_0 + z;
} }
validator(createActionProxy("56a859f462d35a297c46a1bbd1e6a9058c104ab8", $$ACTION_3)); validator(registerServerReference("9878bfa39811ca7650992850a8751f9591b6a557", $$ACTION_2));
export async function $$ACTION_2() {}
another(validator(registerServerReference("56a859f462d35a297c46a1bbd1e6a9058c104ab8", $$ACTION_3)));
export async function $$ACTION_3() {} export async function $$ACTION_3() {}
another(validator(createActionProxy("1383664d1dc2d9cfe33b88df3fa0eaffef8b99bc", $$ACTION_5)));
export async function $$ACTION_5() {}
/* __next_internal_action_entry_do_not_use__ {"c18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default","f14702b5a021dd117f7ec7a3c838f397c2046d3b":"action"} */ import { createActionProxy } from "private-next-rsc-action-proxy"; /* __next_internal_action_entry_do_not_use__ {"6d53ce510b2e36499b8f56038817b9bad86cabb4":"$$ACTION_0","9878bfa39811ca7650992850a8751f9591b6a557":"$$ACTION_2","c18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default","f14702b5a021dd117f7ec7a3c838f397c2046d3b":"action"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
import { validator } from 'auth'; import { validator } from 'auth';
export const action = validator(async ()=>{}); export const action = validator(registerServerReference("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_0));
export default $$ACTION_0 = validator(async ()=>{}); export async function $$ACTION_0() {}
var $$ACTION_0; export default $$ACTION_1 = validator(registerServerReference("9878bfa39811ca7650992850a8751f9591b6a557", $$ACTION_2));
var $$ACTION_1;
export async function $$ACTION_2() {}
import { ensureServerEntryExports } from "private-next-rsc-action-validate"; import { ensureServerEntryExports } from "private-next-rsc-action-validate";
ensureServerEntryExports([ ensureServerEntryExports([
action, action,
$$ACTION_0 $$ACTION_1
]); ]);
createActionProxy("f14702b5a021dd117f7ec7a3c838f397c2046d3b", action); registerServerReference("f14702b5a021dd117f7ec7a3c838f397c2046d3b", action);
createActionProxy("c18c215a6b7cdc64bf709f3a714ffdef1bf9651d", $$ACTION_0); registerServerReference("c18c215a6b7cdc64bf709f3a714ffdef1bf9651d", $$ACTION_1);
/* __next_internal_action_entry_do_not_use__ {"6d53ce510b2e36499b8f56038817b9bad86cabb4":"$$ACTION_0","9878bfa39811ca7650992850a8751f9591b6a557":"$$ACTION_2"} */ import { createActionProxy } from "private-next-rsc-action-proxy"; /* __next_internal_action_entry_do_not_use__ {"188d5d945750dc32e2c842b93c75a65763d4a922":"$$ACTION_1","6d53ce510b2e36499b8f56038817b9bad86cabb4":"$$ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
export default function Page({ foo, x, y }) { export default function Page({ foo, x, y }) {
var action = createActionProxy("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_0).bind(null, encryptActionBoundArgs("6d53ce510b2e36499b8f56038817b9bad86cabb4", [ var action = registerServerReference("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_0).bind(null, encryptActionBoundArgs("6d53ce510b2e36499b8f56038817b9bad86cabb4", [
x x
])); ]));
createActionProxy("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_0).bind(null, encryptActionBoundArgs("6d53ce510b2e36499b8f56038817b9bad86cabb4", [ action.bind(null, foo[0], foo[1], foo.x, foo[y]);
x const action2 = registerServerReference("188d5d945750dc32e2c842b93c75a65763d4a922", $$ACTION_1).bind(null, encryptActionBoundArgs("188d5d945750dc32e2c842b93c75a65763d4a922", [
])).bind(null, foo[0], foo[1], foo.x, foo[y]);
const action2 = createActionProxy("9878bfa39811ca7650992850a8751f9591b6a557", $$ACTION_2).bind(null, encryptActionBoundArgs("9878bfa39811ca7650992850a8751f9591b6a557", [
x x
])); ]));
action2.bind(null, foo[0], foo[1], foo.x, foo[y]); action2.bind(null, foo[0], foo[1], foo.x, foo[y]);
...@@ -16,7 +14,7 @@ export async function $$ACTION_0($$ACTION_CLOSURE_BOUND, a, b, c, d) { ...@@ -16,7 +14,7 @@ export async function $$ACTION_0($$ACTION_CLOSURE_BOUND, a, b, c, d) {
var [$$ACTION_ARG_0] = await decryptActionBoundArgs("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_CLOSURE_BOUND); var [$$ACTION_ARG_0] = await decryptActionBoundArgs("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_CLOSURE_BOUND);
console.log(a, b, $$ACTION_ARG_0, c, d); console.log(a, b, $$ACTION_ARG_0, c, d);
} }
export async function $$ACTION_2($$ACTION_CLOSURE_BOUND, a, b, c, d) { export async function $$ACTION_1($$ACTION_CLOSURE_BOUND, a, b, c, d) {
var [$$ACTION_ARG_0] = await decryptActionBoundArgs("9878bfa39811ca7650992850a8751f9591b6a557", $$ACTION_CLOSURE_BOUND); var [$$ACTION_ARG_0] = await decryptActionBoundArgs("188d5d945750dc32e2c842b93c75a65763d4a922", $$ACTION_CLOSURE_BOUND);
console.log(a, b, $$ACTION_ARG_0, c, d); console.log(a, b, $$ACTION_ARG_0, c, d);
} }
/* __next_internal_action_entry_do_not_use__ {"6d53ce510b2e36499b8f56038817b9bad86cabb4":"$$ACTION_0"} */ import { createActionProxy } from "private-next-rsc-action-proxy"; /* __next_internal_action_entry_do_not_use__ {"6d53ce510b2e36499b8f56038817b9bad86cabb4":"$$ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
export default function Page({ foo, x, y }) { export default function Page({ foo, x, y }) {
var action = createActionProxy("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_0).bind(null, encryptActionBoundArgs("6d53ce510b2e36499b8f56038817b9bad86cabb4", [ var action = registerServerReference("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_0).bind(null, encryptActionBoundArgs("6d53ce510b2e36499b8f56038817b9bad86cabb4", [
foo foo
])); ]));
} }
......
/* __next_internal_action_entry_do_not_use__ {"188d5d945750dc32e2c842b93c75a65763d4a922":"$$ACTION_1","6d53ce510b2e36499b8f56038817b9bad86cabb4":"$$ACTION_0"} */ import { createActionProxy } from "private-next-rsc-action-proxy"; /* __next_internal_action_entry_do_not_use__ {"188d5d945750dc32e2c842b93c75a65763d4a922":"$$ACTION_1","6d53ce510b2e36499b8f56038817b9bad86cabb4":"$$ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
import deleteFromDb from 'db'; import deleteFromDb from 'db';
export function Item({ id1, id2 }) { export function Item({ id1, id2 }) {
id1++; id1++;
return (()=>{ return (()=>{
id1++; id1++;
return <Button action={createActionProxy("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_0).bind(null, encryptActionBoundArgs("6d53ce510b2e36499b8f56038817b9bad86cabb4", [ return <Button action={deleteItem}>Delete</Button>;
id1,
id2
]))}>Delete</Button>;
})(); })();
var deleteItem = createActionProxy("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_0).bind(null, encryptActionBoundArgs("6d53ce510b2e36499b8f56038817b9bad86cabb4", [ var deleteItem = registerServerReference("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_0).bind(null, encryptActionBoundArgs("6d53ce510b2e36499b8f56038817b9bad86cabb4", [
id1, id1,
id2 id2
])); ]));
...@@ -25,17 +22,11 @@ export async function $$ACTION_0($$ACTION_CLOSURE_BOUND) { ...@@ -25,17 +22,11 @@ export async function $$ACTION_0($$ACTION_CLOSURE_BOUND) {
export function Item2({ id1, id2 }) { export function Item2({ id1, id2 }) {
id1++; id1++;
const temp = []; const temp = [];
temp.push(<Button action={createActionProxy("188d5d945750dc32e2c842b93c75a65763d4a922", $$ACTION_1).bind(null, encryptActionBoundArgs("188d5d945750dc32e2c842b93c75a65763d4a922", [ temp.push(<Button action={deleteItem}>Delete</Button>);
id1,
id2
]))}>Delete</Button>);
id1++; id1++;
temp.push(<Button action={createActionProxy("188d5d945750dc32e2c842b93c75a65763d4a922", $$ACTION_1).bind(null, encryptActionBoundArgs("188d5d945750dc32e2c842b93c75a65763d4a922", [ temp.push(<Button action={deleteItem}>Delete</Button>);
id1,
id2
]))}>Delete</Button>);
return temp; return temp;
var deleteItem = createActionProxy("188d5d945750dc32e2c842b93c75a65763d4a922", $$ACTION_1).bind(null, encryptActionBoundArgs("188d5d945750dc32e2c842b93c75a65763d4a922", [ var deleteItem = registerServerReference("188d5d945750dc32e2c842b93c75a65763d4a922", $$ACTION_1).bind(null, encryptActionBoundArgs("188d5d945750dc32e2c842b93c75a65763d4a922", [
id1, id1,
id2 id2
])); ]));
......
/* __next_internal_action_entry_do_not_use__ {"188d5d945750dc32e2c842b93c75a65763d4a922":"$$ACTION_1"} */ import { createActionProxy } from "private-next-rsc-action-proxy"; /* __next_internal_action_entry_do_not_use__ {"6d53ce510b2e36499b8f56038817b9bad86cabb4":"$$ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
const noop = (action)=>action; const noop = (action)=>action;
export const log = noop(createActionProxy("188d5d945750dc32e2c842b93c75a65763d4a922", $$ACTION_1)); export const log = noop(registerServerReference("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_0));
export async function $$ACTION_1(data) { export async function $$ACTION_0(data) {
console.log(data); console.log(data);
} }
// Rules here: // Rules here:
// 1. Each exported function should still be exported, but as a reference `createActionProxy(...)`. // 1. Each exported function should still be exported, but as a reference `registerServerReference(...)`.
// 2. Actual action functions should be renamed to `$$ACTION_...` and got exported. // 2. Actual action functions should be renamed to `$$ACTION_...` and got exported.
async function foo() { async function foo() {
......
// Rules here: // Rules here:
// 1. Each exported function should still be exported, but as a reference `createActionProxy(...)`. // 1. Each exported function should still be exported, but as a reference `registerServerReference(...)`.
// 2. Actual action functions should be renamed to `$$ACTION_...` and got exported. // 2. Actual action functions should be renamed to `$$ACTION_...` and got exported.
/* __next_internal_action_entry_do_not_use__ {"1383664d1dc2d9cfe33b88df3fa0eaffef8b99bc":"$$ACTION_5","188d5d945750dc32e2c842b93c75a65763d4a922":"$$ACTION_1","6d53ce510b2e36499b8f56038817b9bad86cabb4":"$$ACTION_0","9878bfa39811ca7650992850a8751f9591b6a557":"$$ACTION_2","9c0dd1f7c2b3f41d32e10f5c437de3d67ad32c6c":"$$ACTION_4"} */ import { createActionProxy } from "private-next-rsc-action-proxy"; /* __next_internal_action_entry_do_not_use__ {"188d5d945750dc32e2c842b93c75a65763d4a922":"$$ACTION_1","56a859f462d35a297c46a1bbd1e6a9058c104ab8":"$$ACTION_3","6d53ce510b2e36499b8f56038817b9bad86cabb4":"$$ACTION_0","9878bfa39811ca7650992850a8751f9591b6a557":"$$ACTION_2","9c0dd1f7c2b3f41d32e10f5c437de3d67ad32c6c":"$$ACTION_4"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
var foo = createActionProxy("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_0); var foo = registerServerReference("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_0);
export async function $$ACTION_0() { export async function $$ACTION_0() {
console.log(1); console.log(1);
} }
export { foo }; export { foo };
export var bar = createActionProxy("188d5d945750dc32e2c842b93c75a65763d4a922", $$ACTION_1); export var bar = registerServerReference("188d5d945750dc32e2c842b93c75a65763d4a922", $$ACTION_1);
export async function $$ACTION_1() { export async function $$ACTION_1() {
console.log(2); console.log(2);
} }
export default createActionProxy("9878bfa39811ca7650992850a8751f9591b6a557", $$ACTION_2); export default registerServerReference("9878bfa39811ca7650992850a8751f9591b6a557", $$ACTION_2);
export async function $$ACTION_2() { export async function $$ACTION_2() {
'use server';
console.log(3); console.log(3);
} }
export const qux = createActionProxy("9c0dd1f7c2b3f41d32e10f5c437de3d67ad32c6c", $$ACTION_4); export const qux = registerServerReference("56a859f462d35a297c46a1bbd1e6a9058c104ab8", $$ACTION_3);
export async function $$ACTION_4() { export async function $$ACTION_3() {
console.log(4); console.log(4);
} }
export const quux = createActionProxy("1383664d1dc2d9cfe33b88df3fa0eaffef8b99bc", $$ACTION_5); export const quux = registerServerReference("9c0dd1f7c2b3f41d32e10f5c437de3d67ad32c6c", $$ACTION_4);
export async function $$ACTION_5() { export async function $$ACTION_4() {
console.log(5); console.log(5);
} }
let a, f
function Comp(b, c, ...g) {
return async function action1(d) {
'use server'
let f
console.log(...window, { window })
console.log(a, b, action2)
async function action2(e) {
'use server'
console.log(a, c, d, e, f, g)
}
return [
action2,
async function action3(e) {
'use server'
action2(e)
console.log(a, c, d, e)
},
]
}
}
/* __next_internal_action_entry_do_not_use__ {"188d5d945750dc32e2c842b93c75a65763d4a922":"$$ACTION_1","6d53ce510b2e36499b8f56038817b9bad86cabb4":"$$ACTION_0","9878bfa39811ca7650992850a8751f9591b6a557":"$$ACTION_2"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
let a, f;
function Comp(b, c, ...g) {
return registerServerReference("9878bfa39811ca7650992850a8751f9591b6a557", $$ACTION_2).bind(null, encryptActionBoundArgs("9878bfa39811ca7650992850a8751f9591b6a557", [
c,
g,
b
]));
}
export async function $$ACTION_0($$ACTION_CLOSURE_BOUND, e) {
var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2, $$ACTION_ARG_3] = await decryptActionBoundArgs("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_CLOSURE_BOUND);
console.log(a, $$ACTION_ARG_0, $$ACTION_ARG_1, e, $$ACTION_ARG_2, $$ACTION_ARG_3);
}
export async function $$ACTION_1($$ACTION_CLOSURE_BOUND, e) {
var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("188d5d945750dc32e2c842b93c75a65763d4a922", $$ACTION_CLOSURE_BOUND);
$$ACTION_ARG_0(e);
console.log(a, $$ACTION_ARG_1, $$ACTION_ARG_2, e);
}
export async function $$ACTION_2($$ACTION_CLOSURE_BOUND, d) {
var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("9878bfa39811ca7650992850a8751f9591b6a557", $$ACTION_CLOSURE_BOUND);
let f;
console.log(...window, {
window
});
console.log(a, $$ACTION_ARG_2, action2);
var action2 = registerServerReference("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_0).bind(null, encryptActionBoundArgs("6d53ce510b2e36499b8f56038817b9bad86cabb4", [
$$ACTION_ARG_0,
d,
f,
$$ACTION_ARG_1
]));
return [
action2,
registerServerReference("188d5d945750dc32e2c842b93c75a65763d4a922", $$ACTION_1).bind(null, encryptActionBoundArgs("188d5d945750dc32e2c842b93c75a65763d4a922", [
action2,
$$ACTION_ARG_0,
d
]))
];
}
\ No newline at end of file
'use server'
export const dec = async (value) => {
return value - 1
}
// Test case for https://github.com/vercel/next.js/issues/54655
export default dec
/* __next_internal_action_entry_do_not_use__ {"28baf972d345b86b747ad0df73d75a0088a42214":"dec","6d53ce510b2e36499b8f56038817b9bad86cabb4":"$$ACTION_0","c18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
export const dec = registerServerReference("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_0);
export async function $$ACTION_0(value) {
return value - 1;
}
// Test case for https://github.com/vercel/next.js/issues/54655
export default dec;
import { ensureServerEntryExports } from "private-next-rsc-action-validate";
ensureServerEntryExports([
dec,
dec
]);
registerServerReference("28baf972d345b86b747ad0df73d75a0088a42214", dec);
registerServerReference("c18c215a6b7cdc64bf709f3a714ffdef1bf9651d", dec);
\ No newline at end of file
// app/send.ts // app/send.ts
/* __next_internal_action_entry_do_not_use__ {"e10665baac148856374b2789aceb970f66fec33e":"myAction"} */ import { createActionProxy } from "private-next-rsc-action-proxy"; /* __next_internal_action_entry_do_not_use__ {"e10665baac148856374b2789aceb970f66fec33e":"myAction"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
export async function myAction(a, b, c) { export async function myAction(a, b, c) {
console.log('a'); console.log('a');
...@@ -8,4 +8,4 @@ import { ensureServerEntryExports } from "private-next-rsc-action-validate"; ...@@ -8,4 +8,4 @@ import { ensureServerEntryExports } from "private-next-rsc-action-validate";
ensureServerEntryExports([ ensureServerEntryExports([
myAction myAction
]); ]);
createActionProxy("e10665baac148856374b2789aceb970f66fec33e", myAction); registerServerReference("e10665baac148856374b2789aceb970f66fec33e", myAction);
'use server'
let a, f
export async function action0(b, c, ...g) {
return async function action1(d) {
'use server'
let f
console.log(...window, { window })
console.log(a, b, action2)
async function action2(e) {
'use server'
console.log(a, c, d, e, f, g)
}
return [
action2,
async function action3(e) {
'use server'
action2(e)
console.log(a, c, d, e)
},
]
}
}
/* __next_internal_action_entry_do_not_use__ {"0090eaf4e1f08a2d94f6be401e54a2ded399b87c":"action0","188d5d945750dc32e2c842b93c75a65763d4a922":"$$ACTION_1","6d53ce510b2e36499b8f56038817b9bad86cabb4":"$$ACTION_0","9878bfa39811ca7650992850a8751f9591b6a557":"$$ACTION_2"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
let a, f;
export async function action0(b, c, ...g) {
return registerServerReference("9878bfa39811ca7650992850a8751f9591b6a557", $$ACTION_2).bind(null, encryptActionBoundArgs("9878bfa39811ca7650992850a8751f9591b6a557", [
c,
g,
b
]));
}
export async function $$ACTION_0($$ACTION_CLOSURE_BOUND, e) {
var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2, $$ACTION_ARG_3] = await decryptActionBoundArgs("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_CLOSURE_BOUND);
console.log(a, $$ACTION_ARG_0, $$ACTION_ARG_1, e, $$ACTION_ARG_2, $$ACTION_ARG_3);
}
export async function $$ACTION_1($$ACTION_CLOSURE_BOUND, e) {
var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("188d5d945750dc32e2c842b93c75a65763d4a922", $$ACTION_CLOSURE_BOUND);
$$ACTION_ARG_0(e);
console.log(a, $$ACTION_ARG_1, $$ACTION_ARG_2, e);
}
export async function $$ACTION_2($$ACTION_CLOSURE_BOUND, d) {
var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("9878bfa39811ca7650992850a8751f9591b6a557", $$ACTION_CLOSURE_BOUND);
let f;
console.log(...window, {
window
});
console.log(a, $$ACTION_ARG_2, action2);
var action2 = registerServerReference("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_0).bind(null, encryptActionBoundArgs("6d53ce510b2e36499b8f56038817b9bad86cabb4", [
$$ACTION_ARG_0,
d,
f,
$$ACTION_ARG_1
]));
return [
action2,
registerServerReference("188d5d945750dc32e2c842b93c75a65763d4a922", $$ACTION_1).bind(null, encryptActionBoundArgs("188d5d945750dc32e2c842b93c75a65763d4a922", [
action2,
$$ACTION_ARG_0,
d
]))
];
}
import { ensureServerEntryExports } from "private-next-rsc-action-validate";
ensureServerEntryExports([
action0
]);
registerServerReference("0090eaf4e1f08a2d94f6be401e54a2ded399b87c", action0);
/* __next_internal_action_entry_do_not_use__ {"1ab723c80dcca470e0410b4b2a2fc2bf21f41476":"c","6e7bc104e4d6e7fda190c4a51be969cfd0be6d6d":"a","d1f7eb64271d7c601dfef7d4d7053de1c2ca4338":"b"} */ import { createActionProxy } from "private-next-rsc-action-proxy"; /* __next_internal_action_entry_do_not_use__ {"1ab723c80dcca470e0410b4b2a2fc2bf21f41476":"c","6d53ce510b2e36499b8f56038817b9bad86cabb4":"$$ACTION_0","6e7bc104e4d6e7fda190c4a51be969cfd0be6d6d":"a","d1f7eb64271d7c601dfef7d4d7053de1c2ca4338":"b"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
export async function a() {} export async function a() {}
export async function b() {} export async function b() {}
export async function c() {} export async function c() {}
function d() {} function d() {}
function Foo() { function Foo() {
async function e() {} var e = registerServerReference("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_0);
} }
export async function $$ACTION_0() {}
import { ensureServerEntryExports } from "private-next-rsc-action-validate"; import { ensureServerEntryExports } from "private-next-rsc-action-validate";
ensureServerEntryExports([ ensureServerEntryExports([
a, a,
b, b,
c c
]); ]);
createActionProxy("6e7bc104e4d6e7fda190c4a51be969cfd0be6d6d", a); registerServerReference("6e7bc104e4d6e7fda190c4a51be969cfd0be6d6d", a);
createActionProxy("d1f7eb64271d7c601dfef7d4d7053de1c2ca4338", b); registerServerReference("d1f7eb64271d7c601dfef7d4d7053de1c2ca4338", b);
createActionProxy("1ab723c80dcca470e0410b4b2a2fc2bf21f41476", c); registerServerReference("1ab723c80dcca470e0410b4b2a2fc2bf21f41476", c);
/* __next_internal_action_entry_do_not_use__ {"6d53ce510b2e36499b8f56038817b9bad86cabb4":"$$ACTION_0"} */ import { createActionProxy } from "private-next-rsc-action-proxy"; /* __next_internal_action_entry_do_not_use__ {"6d53ce510b2e36499b8f56038817b9bad86cabb4":"$$ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
import deleteFromDb from 'db'; import deleteFromDb from 'db';
const v1 = 'v1'; const v1 = 'v1';
export function Item({ id1, id2, id3, id4 }) { export function Item({ id1, id2, id3, id4 }) {
const v2 = id2; const v2 = id2;
var deleteItem = createActionProxy("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_0).bind(null, encryptActionBoundArgs("6d53ce510b2e36499b8f56038817b9bad86cabb4", [ var deleteItem = registerServerReference("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_0).bind(null, encryptActionBoundArgs("6d53ce510b2e36499b8f56038817b9bad86cabb4", [
id1, id1,
v2, v2,
id3, id3,
id4.x id4.x
])); ]));
return <Button action={createActionProxy("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_0).bind(null, encryptActionBoundArgs("6d53ce510b2e36499b8f56038817b9bad86cabb4", [ return <Button action={deleteItem}>Delete</Button>;
id1,
v2,
id3,
id4.x
]))}>Delete</Button>;
} }
export async function $$ACTION_0($$ACTION_CLOSURE_BOUND) { export async function $$ACTION_0($$ACTION_CLOSURE_BOUND) {
var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2, $$ACTION_ARG_3] = await decryptActionBoundArgs("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_CLOSURE_BOUND); var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2, $$ACTION_ARG_3] = await decryptActionBoundArgs("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_CLOSURE_BOUND);
......
/* __next_internal_action_entry_do_not_use__ {"6d53ce510b2e36499b8f56038817b9bad86cabb4":"$$ACTION_0"} */ import { createActionProxy } from "private-next-rsc-action-proxy"; /* __next_internal_action_entry_do_not_use__ {"6d53ce510b2e36499b8f56038817b9bad86cabb4":"$$ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
import f, { f1, f2 } from 'foo'; import f, { f1, f2 } from 'foo';
const f3 = 1; const f3 = 1;
...@@ -19,7 +19,7 @@ export function y(p, [p1, { p2 }], ...p3) { ...@@ -19,7 +19,7 @@ export function y(p, [p1, { p2 }], ...p3) {
if (true) { if (true) {
const f8 = 1; const f8 = 1;
} }
var action = createActionProxy("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_0).bind(null, encryptActionBoundArgs("6d53ce510b2e36499b8f56038817b9bad86cabb4", [ var action = registerServerReference("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_0).bind(null, encryptActionBoundArgs("6d53ce510b2e36499b8f56038817b9bad86cabb4", [
f2, f2,
f11, f11,
p, p,
...@@ -27,14 +27,7 @@ export function y(p, [p1, { p2 }], ...p3) { ...@@ -27,14 +27,7 @@ export function y(p, [p1, { p2 }], ...p3) {
p2, p2,
p3 p3
])); ]));
return <Button action={createActionProxy("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_0).bind(null, encryptActionBoundArgs("6d53ce510b2e36499b8f56038817b9bad86cabb4", [ return <Button action={action}>Delete</Button>;
f2,
f11,
p,
p1,
p2,
p3
]))}>Delete</Button>;
} }
export async function $$ACTION_0($$ACTION_CLOSURE_BOUND) { export async function $$ACTION_0($$ACTION_CLOSURE_BOUND) {
var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2, $$ACTION_ARG_3, $$ACTION_ARG_4, $$ACTION_ARG_5] = await decryptActionBoundArgs("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_CLOSURE_BOUND); var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2, $$ACTION_ARG_3, $$ACTION_ARG_4, $$ACTION_ARG_5] = await decryptActionBoundArgs("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_CLOSURE_BOUND);
......
/* __next_internal_action_entry_do_not_use__ {"1383664d1dc2d9cfe33b88df3fa0eaffef8b99bc":"$$ACTION_5","188d5d945750dc32e2c842b93c75a65763d4a922":"$$ACTION_1","56a859f462d35a297c46a1bbd1e6a9058c104ab8":"$$ACTION_3","6d53ce510b2e36499b8f56038817b9bad86cabb4":"$$ACTION_0"} */ import { createActionProxy } from "private-next-rsc-action-proxy"; /* __next_internal_action_entry_do_not_use__ {"188d5d945750dc32e2c842b93c75a65763d4a922":"$$ACTION_1","56a859f462d35a297c46a1bbd1e6a9058c104ab8":"$$ACTION_3","6d53ce510b2e36499b8f56038817b9bad86cabb4":"$$ACTION_0","9c0dd1f7c2b3f41d32e10f5c437de3d67ad32c6c":"$$ACTION_4"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
import deleteFromDb from 'db'; import deleteFromDb from 'db';
export function Item1(product, foo, bar) { export function Item1(product, foo, bar) {
const a = createActionProxy("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_0).bind(null, encryptActionBoundArgs("6d53ce510b2e36499b8f56038817b9bad86cabb4", [ const a = registerServerReference("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_0).bind(null, encryptActionBoundArgs("6d53ce510b2e36499b8f56038817b9bad86cabb4", [
product.id, product.id,
product?.foo, product?.foo,
product.bar.baz, product.bar.baz,
...@@ -17,7 +17,7 @@ export async function $$ACTION_0($$ACTION_CLOSURE_BOUND) { ...@@ -17,7 +17,7 @@ export async function $$ACTION_0($$ACTION_CLOSURE_BOUND) {
await deleteFromDb($$ACTION_ARG_3.id, $$ACTION_ARG_3?.foo, $$ACTION_ARG_3.bar.baz, $$ACTION_ARG_3[$$ACTION_ARG_4, $$ACTION_ARG_5]); await deleteFromDb($$ACTION_ARG_3.id, $$ACTION_ARG_3?.foo, $$ACTION_ARG_3.bar.baz, $$ACTION_ARG_3[$$ACTION_ARG_4, $$ACTION_ARG_5]);
} }
export function Item2(product, foo, bar) { export function Item2(product, foo, bar) {
var deleteItem2 = createActionProxy("188d5d945750dc32e2c842b93c75a65763d4a922", $$ACTION_1).bind(null, encryptActionBoundArgs("188d5d945750dc32e2c842b93c75a65763d4a922", [ var deleteItem2 = registerServerReference("188d5d945750dc32e2c842b93c75a65763d4a922", $$ACTION_1).bind(null, encryptActionBoundArgs("188d5d945750dc32e2c842b93c75a65763d4a922", [
product.id, product.id,
product?.foo, product?.foo,
product.bar.baz, product.bar.baz,
...@@ -25,21 +25,14 @@ export function Item2(product, foo, bar) { ...@@ -25,21 +25,14 @@ export function Item2(product, foo, bar) {
foo, foo,
bar bar
])); ]));
return <Button action={createActionProxy("188d5d945750dc32e2c842b93c75a65763d4a922", $$ACTION_1).bind(null, encryptActionBoundArgs("188d5d945750dc32e2c842b93c75a65763d4a922", [ return <Button action={deleteItem2}>Delete</Button>;
product.id,
product?.foo,
product.bar.baz,
product,
foo,
bar
]))}>Delete</Button>;
} }
export async function $$ACTION_1($$ACTION_CLOSURE_BOUND) { export async function $$ACTION_1($$ACTION_CLOSURE_BOUND) {
var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2, $$ACTION_ARG_3, $$ACTION_ARG_4, $$ACTION_ARG_5] = await decryptActionBoundArgs("188d5d945750dc32e2c842b93c75a65763d4a922", $$ACTION_CLOSURE_BOUND); var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2, $$ACTION_ARG_3, $$ACTION_ARG_4, $$ACTION_ARG_5] = await decryptActionBoundArgs("188d5d945750dc32e2c842b93c75a65763d4a922", $$ACTION_CLOSURE_BOUND);
await deleteFromDb($$ACTION_ARG_3.id, $$ACTION_ARG_3?.foo, $$ACTION_ARG_3.bar.baz, $$ACTION_ARG_3[$$ACTION_ARG_4, $$ACTION_ARG_5]); await deleteFromDb($$ACTION_ARG_3.id, $$ACTION_ARG_3?.foo, $$ACTION_ARG_3.bar.baz, $$ACTION_ARG_3[$$ACTION_ARG_4, $$ACTION_ARG_5]);
} }
export function Item3(product, foo, bar) { export function Item3(product, foo, bar) {
const deleteItem3 = createActionProxy("56a859f462d35a297c46a1bbd1e6a9058c104ab8", $$ACTION_3).bind(null, encryptActionBoundArgs("56a859f462d35a297c46a1bbd1e6a9058c104ab8", [ const deleteItem3 = registerServerReference("56a859f462d35a297c46a1bbd1e6a9058c104ab8", $$ACTION_3).bind(null, encryptActionBoundArgs("56a859f462d35a297c46a1bbd1e6a9058c104ab8", [
product.id, product.id,
product?.foo, product?.foo,
product.bar.baz, product.bar.baz,
...@@ -54,7 +47,7 @@ export async function $$ACTION_3($$ACTION_CLOSURE_BOUND) { ...@@ -54,7 +47,7 @@ export async function $$ACTION_3($$ACTION_CLOSURE_BOUND) {
await deleteFromDb($$ACTION_ARG_3.id, $$ACTION_ARG_3?.foo, $$ACTION_ARG_3.bar.baz, $$ACTION_ARG_3[$$ACTION_ARG_4, $$ACTION_ARG_5]); await deleteFromDb($$ACTION_ARG_3.id, $$ACTION_ARG_3?.foo, $$ACTION_ARG_3.bar.baz, $$ACTION_ARG_3[$$ACTION_ARG_4, $$ACTION_ARG_5]);
} }
export function Item4(product, foo, bar) { export function Item4(product, foo, bar) {
const deleteItem4 = createActionProxy("1383664d1dc2d9cfe33b88df3fa0eaffef8b99bc", $$ACTION_5).bind(null, encryptActionBoundArgs("1383664d1dc2d9cfe33b88df3fa0eaffef8b99bc", [ const deleteItem4 = registerServerReference("9c0dd1f7c2b3f41d32e10f5c437de3d67ad32c6c", $$ACTION_4).bind(null, encryptActionBoundArgs("9c0dd1f7c2b3f41d32e10f5c437de3d67ad32c6c", [
product.id, product.id,
product?.foo, product?.foo,
product.bar.baz, product.bar.baz,
...@@ -64,7 +57,7 @@ export function Item4(product, foo, bar) { ...@@ -64,7 +57,7 @@ export function Item4(product, foo, bar) {
])); ]));
return <Button action={deleteItem4}>Delete</Button>; return <Button action={deleteItem4}>Delete</Button>;
} }
export async function $$ACTION_5($$ACTION_CLOSURE_BOUND) { export async function $$ACTION_4($$ACTION_CLOSURE_BOUND) {
var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2, $$ACTION_ARG_3, $$ACTION_ARG_4, $$ACTION_ARG_5] = await decryptActionBoundArgs("1383664d1dc2d9cfe33b88df3fa0eaffef8b99bc", $$ACTION_CLOSURE_BOUND); var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2, $$ACTION_ARG_3, $$ACTION_ARG_4, $$ACTION_ARG_5] = await decryptActionBoundArgs("9c0dd1f7c2b3f41d32e10f5c437de3d67ad32c6c", $$ACTION_CLOSURE_BOUND);
await deleteFromDb($$ACTION_ARG_3.id, $$ACTION_ARG_3?.foo, $$ACTION_ARG_3.bar.baz, $$ACTION_ARG_3[$$ACTION_ARG_4, $$ACTION_ARG_5]); await deleteFromDb($$ACTION_ARG_3.id, $$ACTION_ARG_3?.foo, $$ACTION_ARG_3.bar.baz, $$ACTION_ARG_3[$$ACTION_ARG_4, $$ACTION_ARG_5]);
} }
/* __next_internal_action_entry_do_not_use__ {"6d53ce510b2e36499b8f56038817b9bad86cabb4":"$$ACTION_0"} */ import { createActionProxy } from "private-next-rsc-action-proxy"; /* __next_internal_action_entry_do_not_use__ {"6d53ce510b2e36499b8f56038817b9bad86cabb4":"$$ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
var myAction = createActionProxy("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_0); var myAction = registerServerReference("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_0);
export async function $$ACTION_0(a, b, c) { export async function $$ACTION_0(a, b, c) {
// comment // comment
'use strict'; 'use strict';
console.log('a'); console.log('a');
} }
export default function Page() { export default function Page() {
return <Button action={createActionProxy("6d53ce510b2e36499b8f56038817b9bad86cabb4", $$ACTION_0)}>Delete</Button>; return <Button action={myAction}>Delete</Button>;
} }
// app/send.ts // app/send.ts
/* __next_internal_action_entry_do_not_use__ {"050e3854b72b19e3c7e3966a67535543a90bf7e0":"baz","ab21efdafbe611287bc25c0462b1e0510d13e48b":"foo","c18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default"} */ import { createActionProxy } from "private-next-rsc-action-proxy"; /* __next_internal_action_entry_do_not_use__ {"050e3854b72b19e3c7e3966a67535543a90bf7e0":"baz","ab21efdafbe611287bc25c0462b1e0510d13e48b":"foo","c18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
async function foo() {} async function foo() {}
export { foo }; export { foo };
...@@ -13,6 +13,6 @@ ensureServerEntryExports([ ...@@ -13,6 +13,6 @@ ensureServerEntryExports([
bar, bar,
qux qux
]); ]);
createActionProxy("ab21efdafbe611287bc25c0462b1e0510d13e48b", foo); registerServerReference("ab21efdafbe611287bc25c0462b1e0510d13e48b", foo);
createActionProxy("050e3854b72b19e3c7e3966a67535543a90bf7e0", bar); registerServerReference("050e3854b72b19e3c7e3966a67535543a90bf7e0", bar);
createActionProxy("c18c215a6b7cdc64bf709f3a714ffdef1bf9651d", qux); registerServerReference("c18c215a6b7cdc64bf709f3a714ffdef1bf9651d", qux);
...@@ -148,7 +148,7 @@ export function createWebpackAliases({ ...@@ -148,7 +148,7 @@ export function createWebpackAliases({
'next/dist/build/webpack/loaders/next-flight-loader/action-client-wrapper', 'next/dist/build/webpack/loaders/next-flight-loader/action-client-wrapper',
[RSC_ACTION_PROXY_ALIAS]: [RSC_ACTION_PROXY_ALIAS]:
'next/dist/build/webpack/loaders/next-flight-loader/action-proxy', 'next/dist/build/webpack/loaders/next-flight-loader/server-reference',
[RSC_ACTION_ENCRYPTION_ALIAS]: [RSC_ACTION_ENCRYPTION_ALIAS]:
'next/dist/server/app-render/action-encryption', 'next/dist/server/app-render/action-encryption',
......
...@@ -197,7 +197,7 @@ export function makeExternalHandler({ ...@@ -197,7 +197,7 @@ export function makeExternalHandler({
} }
const notExternalModules = const notExternalModules =
/^(?: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$)/ /^(?: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 (notExternalModules.test(request)) { if (notExternalModules.test(request)) {
return return
} }
......
...@@ -11,6 +11,8 @@ import type { BuildManifest } from '../../server/get-page-files' ...@@ -11,6 +11,8 @@ import type { BuildManifest } from '../../server/get-page-files'
import type { RequestData } from '../../server/web/types' import type { RequestData } from '../../server/web/types'
import type { NextConfigComplete } from '../../server/config-shared' import type { NextConfigComplete } from '../../server/config-shared'
import { PAGE_TYPES } from '../../lib/page-types' import { PAGE_TYPES } from '../../lib/page-types'
import { setReferenceManifestsSingleton } from '../../server/app-render/action-encryption-utils'
import { createServerModuleMap } from '../../server/app-render/action-utils'
declare const incrementalCacheHandler: any declare const incrementalCacheHandler: any
// OPTIONAL_IMPORT:incrementalCacheHandler // OPTIONAL_IMPORT:incrementalCacheHandler
...@@ -44,6 +46,17 @@ const subresourceIntegrityManifest = sriEnabled ...@@ -44,6 +46,17 @@ const subresourceIntegrityManifest = sriEnabled
: undefined : undefined
const nextFontManifest = maybeJSONParse(self.__NEXT_FONT_MANIFEST) const nextFontManifest = maybeJSONParse(self.__NEXT_FONT_MANIFEST)
if (rscManifest && rscServerManifest) {
setReferenceManifestsSingleton({
clientReferenceManifest: rscManifest,
serverActionsManifest: rscServerManifest,
serverModuleMap: createServerModuleMap({
serverActionsManifest: rscServerManifest,
pageName: 'VAR_PAGE',
}),
})
}
const render = getRender({ const render = getRender({
pagesType: PAGE_TYPES.APP, pagesType: PAGE_TYPES.APP,
dev, dev,
......
/* eslint-disable import/no-extraneous-dependencies */
import { registerServerReference } from 'react-server-dom-webpack/server.edge'
export function createActionProxy(id: string, action: any) {
return registerServerReference(action, id, null)
}
/* eslint-disable import/no-extraneous-dependencies */
import { registerServerReference as flightRegisterServerReference } from 'react-server-dom-webpack/server.edge'
const SERVER_REFERENCE_TAG = Symbol.for('react.server.reference')
function isServerReference(reference: any) {
return reference && reference.$$typeof === SERVER_REFERENCE_TAG
}
export function registerServerReference(id: string, action: any) {
// Avoid registering the same action twice
if (isServerReference(action)) {
return action
}
return flightRegisterServerReference(action, id, null)
}
...@@ -40,7 +40,7 @@ export const ROOT_DIR_ALIAS = 'private-next-root-dir' ...@@ -40,7 +40,7 @@ export const ROOT_DIR_ALIAS = 'private-next-root-dir'
export const APP_DIR_ALIAS = 'private-next-app-dir' export const APP_DIR_ALIAS = 'private-next-app-dir'
export const RSC_MOD_REF_PROXY_ALIAS = 'private-next-rsc-mod-ref-proxy' export const RSC_MOD_REF_PROXY_ALIAS = 'private-next-rsc-mod-ref-proxy'
export const RSC_ACTION_VALIDATE_ALIAS = 'private-next-rsc-action-validate' export const RSC_ACTION_VALIDATE_ALIAS = 'private-next-rsc-action-validate'
export const RSC_ACTION_PROXY_ALIAS = 'private-next-rsc-action-proxy' export const RSC_ACTION_PROXY_ALIAS = 'private-next-rsc-server-reference'
export const RSC_ACTION_ENCRYPTION_ALIAS = 'private-next-rsc-action-encryption' export const RSC_ACTION_ENCRYPTION_ALIAS = 'private-next-rsc-action-encryption'
export const RSC_ACTION_CLIENT_WRAPPER_ALIAS = export const RSC_ACTION_CLIENT_WRAPPER_ALIAS =
'private-next-rsc-action-client-wrapper' 'private-next-rsc-action-client-wrapper'
......
import type { ActionManifest } from '../../build/webpack/plugins/flight-client-entry-plugin'
// This function creates a Flight-acceptable server module map proxy from our
// Server Reference Manifest similar to our client module map.
// This is because our manifest contains a lot of internal Next.js data that
// are relevant to the runtime, workers, etc. that React doesn't need to know.
export function createServerModuleMap({
serverActionsManifest,
pageName,
}: {
serverActionsManifest: ActionManifest
pageName: string
}) {
return new Proxy(
{},
{
get: (_, id: string) => {
return {
id: serverActionsManifest[
process.env.NEXT_RUNTIME === 'edge' ? 'edge' : 'node'
][id].workers['app' + pageName],
name: id,
chunks: [],
}
},
}
)
}
...@@ -80,6 +80,7 @@ import { DetachedPromise } from '../../lib/detached-promise' ...@@ -80,6 +80,7 @@ import { DetachedPromise } from '../../lib/detached-promise'
import { isDynamicServerError } from '../../client/components/hooks-server-context' import { isDynamicServerError } from '../../client/components/hooks-server-context'
import { useFlightResponse } from './use-flight-response' import { useFlightResponse } from './use-flight-response'
import { isStaticGenBailoutError } from '../../client/components/static-generation-bailout' import { isStaticGenBailoutError } from '../../client/components/static-generation-bailout'
import { createServerModuleMap } from './action-utils'
import { getStackWithoutErrorMessage } from '../../lib/format-server-error' import { getStackWithoutErrorMessage } from '../../lib/format-server-error'
export type GetDynamicParamFromSegment = ( export type GetDynamicParamFromSegment = (
...@@ -590,27 +591,10 @@ async function renderToHTMLOrFlightImpl( ...@@ -590,27 +591,10 @@ async function renderToHTMLOrFlightImpl(
// TODO: fix this typescript // TODO: fix this typescript
const clientReferenceManifest = renderOpts.clientReferenceManifest! const clientReferenceManifest = renderOpts.clientReferenceManifest!
const workerName = 'app' + renderOpts.page const serverModuleMap = createServerModuleMap({
const serverModuleMap: { serverActionsManifest,
[id: string]: { pageName: renderOpts.page,
id: string })
chunks: string[]
name: string
}
} = new Proxy(
{},
{
get: (_, id: string) => {
return {
id: serverActionsManifest[
process.env.NEXT_RUNTIME === 'edge' ? 'edge' : 'node'
][id].workers[workerName],
name: id,
chunks: [],
}
},
}
)
setReferenceManifestsSingleton({ setReferenceManifestsSingleton({
clientReferenceManifest, clientReferenceManifest,
......
...@@ -12,6 +12,7 @@ import type { ...@@ -12,6 +12,7 @@ import type {
} from 'next/types' } from 'next/types'
import type { RouteModule } from './future/route-modules/route-module' import type { RouteModule } from './future/route-modules/route-module'
import type { BuildManifest } from './get-page-files' import type { BuildManifest } from './get-page-files'
import type { ActionManifest } from '../build/webpack/plugins/flight-client-entry-plugin'
import { import {
BUILD_MANIFEST, BUILD_MANIFEST,
...@@ -26,6 +27,9 @@ import { getTracer } from './lib/trace/tracer' ...@@ -26,6 +27,9 @@ import { getTracer } from './lib/trace/tracer'
import { LoadComponentsSpan } from './lib/trace/constants' import { LoadComponentsSpan } from './lib/trace/constants'
import { evalManifest, loadManifest } from './load-manifest' import { evalManifest, loadManifest } from './load-manifest'
import { wait } from '../lib/wait' import { wait } from '../lib/wait'
import { setReferenceManifestsSingleton } from './app-render/action-encryption-utils'
import { createServerModuleMap } from './app-render/action-utils'
export type ManifestItem = { export type ManifestItem = {
id: number | string id: number | string
files: string[] files: string[]
...@@ -132,15 +136,13 @@ async function loadComponentsImpl<N = any>({ ...@@ -132,15 +136,13 @@ async function loadComponentsImpl<N = any>({
Promise.resolve().then(() => requirePage('/_app', distDir, false)), Promise.resolve().then(() => requirePage('/_app', distDir, false)),
]) ])
} }
const ComponentMod = await Promise.resolve().then(() =>
requirePage(page, distDir, isAppPath)
)
// Make sure to avoid loading the manifest for Route Handlers // Make sure to avoid loading the manifest for Route Handlers
const hasClientManifest = const hasClientManifest =
isAppPath && isAppPath &&
(page.endsWith('/page') || page === '/not-found' || page === '/_not-found') (page.endsWith('/page') || page === '/not-found' || page === '/_not-found')
// Load the manifest files first
const [ const [
buildManifest, buildManifest,
reactLoadableManifest, reactLoadableManifest,
...@@ -165,12 +167,30 @@ async function loadComponentsImpl<N = any>({ ...@@ -165,12 +167,30 @@ async function loadComponentsImpl<N = any>({
) )
: undefined, : undefined,
isAppPath isAppPath
? loadManifestWithRetries( ? (loadManifestWithRetries(
join(distDir, 'server', SERVER_REFERENCE_MANIFEST + '.json') join(distDir, 'server', SERVER_REFERENCE_MANIFEST + '.json')
).catch(() => null) ).catch(() => null) as Promise<ActionManifest | null>)
: null, : null,
]) ])
// Before requring the actual page module, we have to set the reference manifests
// to our global store so Server Action's encryption util can access to them
// at the top level of the page module.
if (serverActionsManifest && clientReferenceManifest) {
setReferenceManifestsSingleton({
clientReferenceManifest,
serverActionsManifest,
serverModuleMap: createServerModuleMap({
serverActionsManifest,
pageName: page,
}),
})
}
const ComponentMod = await Promise.resolve().then(() =>
requirePage(page, distDir, isAppPath)
)
const Component = interopDefault(ComponentMod) const Component = interopDefault(ComponentMod)
const Document = interopDefault(DocumentMod) const Document = interopDefault(DocumentMod)
const App = interopDefault(AppMod) const App = interopDefault(AppMod)
......
...@@ -981,6 +981,7 @@ createNextDescribe( ...@@ -981,6 +981,7 @@ createNextDescribe(
const res = await next.fetch('/encryption') const res = await next.fetch('/encryption')
const html = await res.text() const html = await res.text()
expect(html).not.toContain('qwerty123') expect(html).not.toContain('qwerty123')
expect(html).not.toContain('some-module-level-encryption-value')
}) })
}) })
......
// Test top-level encryption (happens during the module load phase)
function wrapAction(value) {
return async function () {
'use server'
console.log(value)
}
}
const action = wrapAction('some-module-level-encryption-value')
// Test runtime encryption (happens during the rendering phase)
export default function Page() { export default function Page() {
const secret = 'my password is qwerty123' const secret = 'my password is qwerty123'
...@@ -6,6 +17,7 @@ export default function Page() { ...@@ -6,6 +17,7 @@ export default function Page() {
action={async () => { action={async () => {
'use server' 'use server'
console.log(secret) console.log(secret)
await action()
return 'success' return 'success'
}} }}
> >
......
...@@ -7,10 +7,13 @@ export async function slowInc(value) { ...@@ -7,10 +7,13 @@ export async function slowInc(value) {
return value + 1 return value + 1
} }
export default async function dec(value) { export const dec = async (value) => {
return value - 1 return value - 1
} }
// Test case for https://github.com/vercel/next.js/issues/54655
export default dec
export async function redirectAction(formData) { export async function redirectAction(formData) {
'use server' 'use server'
redirect( redirect(
...@@ -20,3 +23,6 @@ export async function redirectAction(formData) { ...@@ -20,3 +23,6 @@ export async function redirectAction(formData) {
formData.get('hidden-info') formData.get('hidden-info')
) )
} }
// Test case for https://github.com/vercel/next.js/issues/61183
export const dummyServerAction = () => new Promise((r) => setTimeout(r, 2000))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment