From 75036c69386f32a25dcc049777aaabe5c8d7a19e Mon Sep 17 00:00:00 2001 From: Shu Ding Date: Fri, 18 Oct 2024 02:13:36 +0200 Subject: [PATCH 1/4] information byte and optimization --- .../src/transforms/server_actions.rs | 174 +++++++++++------- .../server-actions/client-graph/1/output.js | 4 +- .../server-actions/server-graph/1/output.js | 4 +- .../server-actions/server-graph/2/output.js | 4 +- .../server-actions/server-graph/3/output.js | 4 +- .../server-actions/server-graph/6/output.js | 4 +- .../server-actions/server-graph/7/output.js | 4 +- .../server-actions/server-graph/8/output.js | 4 +- .../fixture/server-actions/client/1/output.js | 6 +- .../fixture/server-actions/client/2/output.js | 4 +- .../fixture/server-actions/client/3/output.js | 10 +- .../fixture/server-actions/client/4/output.js | 4 +- .../fixture/server-actions/client/5/output.js | 4 +- .../fixture/server-actions/client/6/output.js | 6 +- .../fixture/server-actions/server/1/output.js | 10 +- .../server-actions/server/10/output.js | 4 +- .../server-actions/server/11/output.js | 4 +- .../server-actions/server/12/output.js | 4 +- .../server-actions/server/13/output.js | 6 +- .../server-actions/server/14/output.js | 4 +- .../server-actions/server/15/output.js | 6 +- .../server-actions/server/16/output.js | 14 +- .../server-actions/server/17/output.js | 8 +- .../server-actions/server/18/output.js | 10 +- .../server-actions/server/19/output.js | 6 +- .../fixture/server-actions/server/2/output.js | 6 +- .../server-actions/server/20/output.js | 4 +- .../server-actions/server/21/output.js | 10 +- .../server-actions/server/22/output.js | 10 +- .../server-actions/server/23/output.js | 10 +- .../server-actions/server/24/output.js | 6 +- .../server-actions/server/25/output.js | 10 +- .../server-actions/server/26/output.js | 4 +- .../server-actions/server/27/output.js | 12 +- .../server-actions/server/28/output.js | 14 +- .../server-actions/server/29/output.js | 8 +- .../fixture/server-actions/server/3/output.js | 4 +- .../server-actions/server/30/output.js | 16 +- .../server-actions/server/31/output.js | 6 +- .../server-actions/server/32/output.js | 6 +- .../server-actions/server/33/output.js | 6 +- .../server-actions/server/34/output.js | 10 +- .../server-actions/server/35/output.js | 6 +- .../server-actions/server/36/output.js | 18 +- .../server-actions/server/37/output.js | 6 +- .../server-actions/server/38/output.js | 6 +- .../server-actions/server/39/output.js | 10 +- .../fixture/server-actions/server/4/output.js | 10 +- .../server-actions/server/40/output.js | 14 +- .../server-actions/server/41/output.js | 10 +- .../server-actions/server/42/output.js | 10 +- .../server-actions/server/43/output.js | 10 +- .../fixture/server-actions/server/44/input.js | 37 ++++ .../server-actions/server/44/output.js | 65 +++++++ .../fixture/server-actions/server/5/output.js | 6 +- .../fixture/server-actions/server/6/output.js | 6 +- .../fixture/server-actions/server/7/output.js | 18 +- .../fixture/server-actions/server/8/output.js | 4 +- .../fixture/server-actions/server/9/output.js | 8 +- .../next-flight-action-entry-loader.ts | 18 +- .../next/src/build/webpack/loaders/utils.ts | 20 +- .../plugins/flight-client-entry-plugin.ts | 64 ++++--- 62 files changed, 471 insertions(+), 329 deletions(-) create mode 100644 crates/next-custom-transforms/tests/fixture/server-actions/server/44/input.js create mode 100644 crates/next-custom-transforms/tests/fixture/server-actions/server/44/output.js diff --git a/crates/next-custom-transforms/src/transforms/server_actions.rs b/crates/next-custom-transforms/src/transforms/server_actions.rs index 85ced02aa9235..91ac7c69a54da 100644 --- a/crates/next-custom-transforms/src/transforms/server_actions.rs +++ b/crates/next-custom-transforms/src/transforms/server_actions.rs @@ -124,6 +124,89 @@ struct ServerActions { } impl ServerActions { + fn generate_server_reference_id( + &self, + export_name: &str, + is_cache: bool, + params: Option<&Vec>, + ) -> String { + // Attach a checksum to the action using sha1: + // $$id = special_byte + sha1('hash_salt' + 'file_name' + ':' + 'export_name'); + // Currently encoded as hex. + + let mut hasher = Sha1::new(); + hasher.update(self.config.hash_salt.as_bytes()); + hasher.update(self.file_name.as_bytes()); + hasher.update(b":"); + hasher.update(export_name.as_bytes()); + let mut result = hasher.finalize().to_vec(); + + // Prepend an extra byte to the ID, with the following format: + // 0 000000 0 + // ^type ^arg mask ^rest args + // + // The type bit represents if the action is a cache function or not. + // For cache functions, the type bit is set to 1. Otherwise, it's 0. + // + // The arg mask bit is used to determine which arguments are used by + // the function itself, up to 6 arguments. The bit is set to 1 if the + // argument is used, or being spread or destructured (so it can be + // indirectly or partially used). The bit is set to 0 otherwise. + // + // The rest args bit is used to determine if there's a ...rest argument + // in the function signature. If there is, the bit is set to 1. + // + // For example: + // + // async function foo(a, foo, b, bar, ...baz) { + // 'use cache'; + // return a + b; + // } + // + // will have it encoded as [1][101011][1]. The first bit is set to 1 + // because it's a cache function. The second part has 1010 because the + // only arguments used are `a` and `b`. The subsequent 11 bits are set + // to 1 because there's a ...rest argument starting from the 5th. The + // last bit is set to 1 as well for the same reason. + let type_bit = if is_cache { 1u8 } else { 0u8 }; + let mut arg_mask = 0u8; + let mut rest_args = 0u8; + + if let Some(params) = params { + // TODO: For the current implementation, we don't track if an + // argument ident is actually referenced in the function body. + // Instead, we go with the easy route and assume defined ones are + // used. This can be improved in the future. + for (i, param) in params.iter().enumerate() { + if let Pat::Rest(_) = param { + // If there's a ...rest argument, we set the rest args bit + // to 1 and set the arg mask to 0b111111. + arg_mask = 0b111111; + rest_args = 0b1; + break; + } + if i < 6 { + arg_mask |= 0b1 << (5 - i); + } else { + // More than 6 arguments, we set the rest args bit to 1. + // This is rare for a Server Action, usually. + rest_args = 0b1; + break; + } + } + } else { + // If we can't determine the arguments (e.g. not staticaly analyzable), + // we assume all arguments are used. + arg_mask = 0b111111; + rest_args = 0b1; + } + + result.push(type_bit << 7 | arg_mask << 1 | rest_args); + result.rotate_right(1); + + hex_encode(result) + } + // Check if the function or arrow function is an action function fn get_body_info(&mut self, maybe_body: Option<&mut BlockStmt>) -> (bool, Option) { let mut is_action_fn = false; @@ -195,11 +278,7 @@ impl ServerActions { self.export_actions.push(action_name.to_string()); let action_ident = Ident::new(action_name.clone().into(), arrow.span, self.private_ctxt); - let action_id = generate_action_id( - &self.config.hash_salt, - &self.file_name, - action_name.to_string().as_str(), - ); + let action_id = self.generate_server_reference_id(&action_name, false, Some(&arrow.params)); let register_action_expr = bind_args_to_ref_expr( annotate_ident_as_server_reference(action_ident.clone(), action_id.clone()), @@ -208,7 +287,7 @@ impl ServerActions { .cloned() .map(|id| Some(id.as_arg())) .collect(), - action_id, + action_id.clone(), ); if let BlockStmtOrExpr::BlockStmt(block) = &mut *arrow.body { @@ -262,12 +341,7 @@ impl ServerActions { span: DUMMY_SP, callee: quote_ident!("decryptActionBoundArgs").as_callee(), args: vec![ - generate_action_id( - &self.config.hash_salt, - &self.file_name, - &action_name, - ) - .as_arg(), + action_id.as_arg(), quote_ident!("$$ACTION_CLOSURE_BOUND").as_arg(), ], ..Default::default() @@ -350,7 +424,11 @@ impl ServerActions { self.export_actions.push(action_name.to_string()); let action_ident = Ident::new(action_name.clone(), function.span, self.private_ctxt); - let action_id = generate_action_id(&self.config.hash_salt, &self.file_name, &action_name); + let action_id = self.generate_server_reference_id( + &action_name, + false, + Some(&function.params.iter().map(|p| p.pat.clone()).collect()), + ); let register_action_expr = bind_args_to_ref_expr( annotate_ident_as_server_reference(action_ident.clone(), action_id.clone()), @@ -359,7 +437,7 @@ impl ServerActions { .cloned() .map(|id| Some(id.as_arg())) .collect(), - action_id, + action_id.clone(), ); function.body.visit_mut_with(&mut ClosureReplacer { @@ -411,12 +489,7 @@ impl ServerActions { span: DUMMY_SP, callee: quote_ident!("decryptActionBoundArgs").as_callee(), args: vec![ - generate_action_id( - &self.config.hash_salt, - &self.file_name, - &action_name, - ) - .as_arg(), + action_id.as_arg(), quote_ident!("$$ACTION_CLOSURE_BOUND").as_arg(), ], ..Default::default() @@ -478,7 +551,7 @@ impl ServerActions { } let reference_id = - generate_action_id(&self.config.hash_salt, &self.file_name, &export_name); + self.generate_server_reference_id(&export_name, true, Some(&arrow.params)); if let BlockStmtOrExpr::BlockStmt(block) = &mut *arrow.body { block.visit_mut_with(&mut ClosureReplacer { @@ -531,12 +604,7 @@ impl ServerActions { span: DUMMY_SP, callee: quote_ident!("decryptActionBoundArgs").as_callee(), args: vec![ - generate_action_id( - &self.config.hash_salt, - &self.file_name, - &export_name, - ) - .as_arg(), + reference_id.clone().as_arg(), quote_ident!("$$ACTION_CLOSURE_BOUND").as_arg(), ], ..Default::default() @@ -677,7 +745,11 @@ impl ServerActions { self.export_actions.push(cache_name.to_string()); } - let reference_id = generate_action_id(&self.config.hash_salt, &self.file_name, &cache_name); + let reference_id = self.generate_server_reference_id( + &cache_name, + true, + Some(&function.params.iter().map(|p| p.pat.clone()).collect()), + ); let register_action_expr = annotate_ident_as_server_reference(cache_ident.clone(), reference_id.clone()); @@ -732,12 +804,7 @@ impl ServerActions { span: DUMMY_SP, callee: quote_ident!("decryptActionBoundArgs").as_callee(), args: vec![ - generate_action_id( - &self.config.hash_salt, - &self.file_name, - &cache_name, - ) - .as_arg(), + reference_id.clone().as_arg(), quote_ident!("$$ACTION_CLOSURE_BOUND").as_arg(), ], ..Default::default() @@ -1531,8 +1598,11 @@ impl VisitMut for ServerActions { if self.in_action_file || self.in_cache_file.is_some() { for (ident, export_name) in self.exported_idents.iter() { if !self.config.is_react_server_layer { - let action_id = - generate_action_id(&self.config.hash_salt, &self.file_name, export_name); + let ref_id = self.generate_server_reference_id( + export_name, + self.in_cache_file.is_some(), + None, + ); let call_expr_span = Span::dummy_with_cmt(); self.comments.add_pure_comment(call_expr_span.lo); @@ -1546,7 +1616,7 @@ impl VisitMut for ServerActions { create_ref_ident.clone(), ))), args: vec![ - action_id.as_arg(), + ref_id.as_arg(), call_server_ident.clone().as_arg(), Expr::undefined(DUMMY_SP).as_arg(), find_source_map_url_ident.clone().as_arg(), @@ -1576,7 +1646,7 @@ impl VisitMut for ServerActions { create_ref_ident.clone(), ))), args: vec![ - action_id.as_arg(), + ref_id.as_arg(), call_server_ident.clone().as_arg(), Expr::undefined(DUMMY_SP).as_arg(), find_source_map_url_ident.clone().as_arg(), @@ -1592,15 +1662,11 @@ impl VisitMut for ServerActions { new.push(export_expr); } } else if self.in_cache_file.is_none() { - let action_id = - generate_action_id(&self.config.hash_salt, &self.file_name, export_name); + let cache_id = self.generate_server_reference_id(export_name, true, None); self.annotations.push(Stmt::Expr(ExprStmt { span: DUMMY_SP, - expr: Box::new(annotate_ident_as_server_reference( - ident.clone(), - action_id, - )), + expr: Box::new(annotate_ident_as_server_reference(ident.clone(), cache_id)), })); } } @@ -1674,12 +1740,7 @@ impl VisitMut for ServerActions { let actions = actions .into_iter() - .map(|name| { - ( - generate_action_id(&self.config.hash_salt, &self.file_name, &name), - name, - ) - }) + .map(|name| (self.generate_server_reference_id(&name, false, None), name)) .collect::(); // Prepend a special comment to the top of the file. self.comments.add_leading( @@ -1910,19 +1971,6 @@ fn attach_name_to_expr(ident: Ident, expr: Expr, extra_items: &mut Vec String { - // Attach a checksum to the action using sha1: - // $$id = sha1('hash_salt' + 'file_name' + ':' + 'export_name'); - let mut hasher = Sha1::new(); - hasher.update(hash_salt.as_bytes()); - hasher.update(file_name.as_bytes()); - hasher.update(b":"); - hasher.update(export_name.as_bytes()); - let result = hasher.finalize(); - - hex_encode(result) -} - fn annotate_ident_as_server_reference(ident: Ident, action_id: String) -> Expr { // registerServerReference(reference, id, null) Expr::Call(CallExpr { diff --git a/crates/next-custom-transforms/tests/errors/server-actions/client-graph/1/output.js b/crates/next-custom-transforms/tests/errors/server-actions/client-graph/1/output.js index 0ad22420ae493..5f5b4bcdfe37f 100644 --- a/crates/next-custom-transforms/tests/errors/server-actions/client-graph/1/output.js +++ b/crates/next-custom-transforms/tests/errors/server-actions/client-graph/1/output.js @@ -1,5 +1,5 @@ -/* __next_internal_client_entry_do_not_use__ default auto */ /* __next_internal_action_entry_do_not_use__ {"6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ export default function App() { - var fn = registerServerReference($$RSC_SERVER_ACTION_0, "6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null); +/* __next_internal_client_entry_do_not_use__ default auto */ /* __next_internal_action_entry_do_not_use__ {"7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ export default function App() { + var fn = registerServerReference($$RSC_SERVER_ACTION_0, "006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null); return
App
; } export async function $$RSC_SERVER_ACTION_0() {} diff --git a/crates/next-custom-transforms/tests/errors/server-actions/server-graph/1/output.js b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/1/output.js index 01b76c30cb1b6..896613e39e44d 100644 --- a/crates/next-custom-transforms/tests/errors/server-actions/server-graph/1/output.js +++ b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/1/output.js @@ -1,8 +1,8 @@ -/* __next_internal_action_entry_do_not_use__ {"ab21efdafbe611287bc25c0462b1e0510d13e48b":"foo"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7fab21efdafbe611287bc25c0462b1e0510d13e48b":"foo"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; export function foo() {} import { ensureServerEntryExports } from "private-next-rsc-action-validate"; ensureServerEntryExports([ foo ]); -registerServerReference(foo, "ab21efdafbe611287bc25c0462b1e0510d13e48b", null); +registerServerReference(foo, "ffab21efdafbe611287bc25c0462b1e0510d13e48b", null); diff --git a/crates/next-custom-transforms/tests/errors/server-actions/server-graph/2/output.js b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/2/output.js index 31450221dc7b6..252494b69910f 100644 --- a/crates/next-custom-transforms/tests/errors/server-actions/server-graph/2/output.js +++ b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/2/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"ac840dcaf5e8197cb02b7f3a43c119b7a770b272":"bar"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7fac840dcaf5e8197cb02b7f3a43c119b7a770b272":"bar"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; 'use strict'; export function bar() {} @@ -6,4 +6,4 @@ import { ensureServerEntryExports } from "private-next-rsc-action-validate"; ensureServerEntryExports([ bar ]); -registerServerReference(bar, "ac840dcaf5e8197cb02b7f3a43c119b7a770b272", null); +registerServerReference(bar, "ffac840dcaf5e8197cb02b7f3a43c119b7a770b272", null); diff --git a/crates/next-custom-transforms/tests/errors/server-actions/server-graph/3/output.js b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/3/output.js index 720e5a317895c..f117d9dd53b77 100644 --- a/crates/next-custom-transforms/tests/errors/server-actions/server-graph/3/output.js +++ b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/3/output.js @@ -1,8 +1,8 @@ -/* __next_internal_action_entry_do_not_use__ {"b78c261f135a7a852508c2920bd7228020ff4bd7":"x"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7fb78c261f135a7a852508c2920bd7228020ff4bd7":"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); +registerServerReference(x, "ffb78c261f135a7a852508c2920bd7228020ff4bd7", null); diff --git a/crates/next-custom-transforms/tests/errors/server-actions/server-graph/6/output.js b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/6/output.js index 7a65ca48369ae..7b5e53871fabe 100644 --- a/crates/next-custom-transforms/tests/errors/server-actions/server-graph/6/output.js +++ b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/6/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; -export default registerServerReference($$RSC_SERVER_ACTION_0, "6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null); +export default registerServerReference($$RSC_SERVER_ACTION_0, "006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null); export async function $$RSC_SERVER_ACTION_0() {} diff --git a/crates/next-custom-transforms/tests/errors/server-actions/server-graph/7/output.js b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/7/output.js index 12e411109bf19..1b4a7833acb99 100644 --- a/crates/next-custom-transforms/tests/errors/server-actions/server-graph/7/output.js +++ b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/7/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; -const foo = registerServerReference($$RSC_SERVER_ACTION_0, "6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null); +const foo = registerServerReference($$RSC_SERVER_ACTION_0, "006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null); export async function $$RSC_SERVER_ACTION_0() {} diff --git a/crates/next-custom-transforms/tests/errors/server-actions/server-graph/8/output.js b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/8/output.js index c4b2b45a6996e..9ac3267402e39 100644 --- a/crates/next-custom-transforms/tests/errors/server-actions/server-graph/8/output.js +++ b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/8/output.js @@ -1,6 +1,6 @@ -/* __next_internal_action_entry_do_not_use__ {"6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; -const foo = registerServerReference($$RSC_SERVER_ACTION_0, "6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null); +const foo = registerServerReference($$RSC_SERVER_ACTION_0, "006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null); export async function $$RSC_SERVER_ACTION_0() { 'use strict'; } diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/client/1/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/client/1/output.js index fc7f21eff86dd..d937777c9c1e6 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/client/1/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/client/1/output.js @@ -1,4 +1,4 @@ // app/send.ts -/* __next_internal_action_entry_do_not_use__ {"c18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default","e10665baac148856374b2789aceb970f66fec33e":"myAction"} */ import { createServerReference, callServer, findSourceMapURL } from "private-next-rsc-action-client-wrapper"; -export var myAction = /*#__PURE__*/ createServerReference("e10665baac148856374b2789aceb970f66fec33e", callServer, void 0, findSourceMapURL, "myAction"); -export default /*#__PURE__*/ createServerReference("c18c215a6b7cdc64bf709f3a714ffdef1bf9651d", callServer, void 0, findSourceMapURL, "default"); +/* __next_internal_action_entry_do_not_use__ {"7fc18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default","7fe10665baac148856374b2789aceb970f66fec33e":"myAction"} */ import { createServerReference, callServer, findSourceMapURL } from "private-next-rsc-action-client-wrapper"; +export var myAction = /*#__PURE__*/ createServerReference("7fe10665baac148856374b2789aceb970f66fec33e", callServer, void 0, findSourceMapURL, "myAction"); +export default /*#__PURE__*/ createServerReference("7fc18c215a6b7cdc64bf709f3a714ffdef1bf9651d", callServer, void 0, findSourceMapURL, "default"); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/client/2/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/client/2/output.js index acf440a6ed4ee..3a85bb2c0107d 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/client/2/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/client/2/output.js @@ -1,3 +1,3 @@ // app/send.ts -/* __next_internal_action_entry_do_not_use__ {"ab21efdafbe611287bc25c0462b1e0510d13e48b":"foo"} */ import { createServerReference, callServer, findSourceMapURL } from "private-next-rsc-action-client-wrapper"; -export var foo = /*#__PURE__*/ createServerReference("ab21efdafbe611287bc25c0462b1e0510d13e48b", callServer, void 0, findSourceMapURL, "foo"); +/* __next_internal_action_entry_do_not_use__ {"7fab21efdafbe611287bc25c0462b1e0510d13e48b":"foo"} */ import { createServerReference, callServer, findSourceMapURL } from "private-next-rsc-action-client-wrapper"; +export var foo = /*#__PURE__*/ createServerReference("7fab21efdafbe611287bc25c0462b1e0510d13e48b", callServer, void 0, findSourceMapURL, "foo"); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/client/3/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/client/3/output.js index da69b38a030c3..6da7ba6824bec 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/client/3/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/client/3/output.js @@ -1,5 +1,5 @@ -/* __next_internal_action_entry_do_not_use__ {"a0c73dd6f5af839e3335c6b19262ecb86cca6af4":"sampleFunction2","bd336abe00c3c59da66acb696fc8e151d8e54ea4":"sampleFunction","d4f2e95bc745b6500b439c0847003511748c8ece":"sampleFunction3","f03b256ee88a51700367acee3082894e25e6e7d9":"sampleFunction4"} */ import { createServerReference, callServer, findSourceMapURL } from "private-next-rsc-action-client-wrapper"; -export var sampleFunction = /*#__PURE__*/ createServerReference("bd336abe00c3c59da66acb696fc8e151d8e54ea4", callServer, void 0, findSourceMapURL, "sampleFunction"); -export var sampleFunction2 = /*#__PURE__*/ createServerReference("a0c73dd6f5af839e3335c6b19262ecb86cca6af4", callServer, void 0, findSourceMapURL, "sampleFunction2"); -export var sampleFunction3 = /*#__PURE__*/ createServerReference("d4f2e95bc745b6500b439c0847003511748c8ece", callServer, void 0, findSourceMapURL, "sampleFunction3"); -export var sampleFunction4 = /*#__PURE__*/ createServerReference("f03b256ee88a51700367acee3082894e25e6e7d9", callServer, void 0, findSourceMapURL, "sampleFunction4"); +/* __next_internal_action_entry_do_not_use__ {"7fa0c73dd6f5af839e3335c6b19262ecb86cca6af4":"sampleFunction2","7fbd336abe00c3c59da66acb696fc8e151d8e54ea4":"sampleFunction","7fd4f2e95bc745b6500b439c0847003511748c8ece":"sampleFunction3","7ff03b256ee88a51700367acee3082894e25e6e7d9":"sampleFunction4"} */ import { createServerReference, callServer, findSourceMapURL } from "private-next-rsc-action-client-wrapper"; +export var sampleFunction = /*#__PURE__*/ createServerReference("7fbd336abe00c3c59da66acb696fc8e151d8e54ea4", callServer, void 0, findSourceMapURL, "sampleFunction"); +export var sampleFunction2 = /*#__PURE__*/ createServerReference("7fa0c73dd6f5af839e3335c6b19262ecb86cca6af4", callServer, void 0, findSourceMapURL, "sampleFunction2"); +export var sampleFunction3 = /*#__PURE__*/ createServerReference("7fd4f2e95bc745b6500b439c0847003511748c8ece", callServer, void 0, findSourceMapURL, "sampleFunction3"); +export var sampleFunction4 = /*#__PURE__*/ createServerReference("7ff03b256ee88a51700367acee3082894e25e6e7d9", callServer, void 0, findSourceMapURL, "sampleFunction4"); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/client/4/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/client/4/output.js index aad83b202d0da..bce4e0b29e293 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/client/4/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/client/4/output.js @@ -1,2 +1,2 @@ -/* __next_internal_action_entry_do_not_use__ {"ac840dcaf5e8197cb02b7f3a43c119b7a770b272":"bar"} */ import { createServerReference, callServer, findSourceMapURL } from "private-next-rsc-action-client-wrapper"; -export var bar = /*#__PURE__*/ createServerReference("ac840dcaf5e8197cb02b7f3a43c119b7a770b272", callServer, void 0, findSourceMapURL, "bar"); +/* __next_internal_action_entry_do_not_use__ {"7fac840dcaf5e8197cb02b7f3a43c119b7a770b272":"bar"} */ import { createServerReference, callServer, findSourceMapURL } from "private-next-rsc-action-client-wrapper"; +export var bar = /*#__PURE__*/ createServerReference("7fac840dcaf5e8197cb02b7f3a43c119b7a770b272", callServer, void 0, findSourceMapURL, "bar"); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/client/5/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/client/5/output.js index 5f4193468a504..96cbc1efc4c7a 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/client/5/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/client/5/output.js @@ -1,2 +1,2 @@ -/* __next_internal_action_entry_do_not_use__ {"0090eaf4e1f08a2d94f6be401e54a2ded399b87c":"action0","1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { createServerReference, callServer, findSourceMapURL } from "private-next-rsc-action-client-wrapper"; -export var action0 = /*#__PURE__*/ createServerReference("0090eaf4e1f08a2d94f6be401e54a2ded399b87c", callServer, void 0, findSourceMapURL, "action0"); +/* __next_internal_action_entry_do_not_use__ {"7f0090eaf4e1f08a2d94f6be401e54a2ded399b87c":"action0","7f1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7f90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { createServerReference, callServer, findSourceMapURL } from "private-next-rsc-action-client-wrapper"; +export var action0 = /*#__PURE__*/ createServerReference("7f0090eaf4e1f08a2d94f6be401e54a2ded399b87c", callServer, void 0, findSourceMapURL, "action0"); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/client/6/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/client/6/output.js index c10b22c39eb79..d5aab1d82898a 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/client/6/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/client/6/output.js @@ -1,3 +1,3 @@ -/* __next_internal_action_entry_do_not_use__ {"ab21efdafbe611287bc25c0462b1e0510d13e48b":"foo","ac840dcaf5e8197cb02b7f3a43c119b7a770b272":"bar"} */ import { createServerReference, callServer, findSourceMapURL } from "private-next-rsc-action-client-wrapper"; -export var foo = /*#__PURE__*/ createServerReference("ab21efdafbe611287bc25c0462b1e0510d13e48b", callServer, void 0, findSourceMapURL, "foo"); -export var bar = /*#__PURE__*/ createServerReference("ac840dcaf5e8197cb02b7f3a43c119b7a770b272", callServer, void 0, findSourceMapURL, "bar"); +/* __next_internal_action_entry_do_not_use__ {"7fab21efdafbe611287bc25c0462b1e0510d13e48b":"foo","7fac840dcaf5e8197cb02b7f3a43c119b7a770b272":"bar"} */ import { createServerReference, callServer, findSourceMapURL } from "private-next-rsc-action-client-wrapper"; +export var foo = /*#__PURE__*/ createServerReference("ffab21efdafbe611287bc25c0462b1e0510d13e48b", callServer, void 0, findSourceMapURL, "foo"); +export var bar = /*#__PURE__*/ createServerReference("ffac840dcaf5e8197cb02b7f3a43c119b7a770b272", callServer, void 0, findSourceMapURL, "bar"); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/1/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/1/output.js index db3182526d9ef..10c94fb4d40a3 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/1/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/1/output.js @@ -1,15 +1,15 @@ -/* __next_internal_action_entry_do_not_use__ {"6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7f90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import deleteFromDb from 'db'; export function Item({ id1, id2 }) { - var deleteItem = registerServerReference($$RSC_SERVER_ACTION_0, "6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null).bind(null, encryptActionBoundArgs("6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", [ + var deleteItem = registerServerReference($$RSC_SERVER_ACTION_0, "006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null).bind(null, encryptActionBoundArgs("006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", [ id1, id2 ])); return ; } export async function $$RSC_SERVER_ACTION_0($$ACTION_CLOSURE_BOUND) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); await deleteFromDb($$ACTION_ARG_0); await deleteFromDb($$ACTION_ARG_1); } @@ -18,14 +18,14 @@ export default function Home() { name: 'John', test: 'test' }; - const action = registerServerReference($$RSC_SERVER_ACTION_1, "90b5db271335765a4b0eab01f044b381b5ebd5cd", null).bind(null, encryptActionBoundArgs("90b5db271335765a4b0eab01f044b381b5ebd5cd", [ + const action = registerServerReference($$RSC_SERVER_ACTION_1, "0090b5db271335765a4b0eab01f044b381b5ebd5cd", null).bind(null, encryptActionBoundArgs("0090b5db271335765a4b0eab01f044b381b5ebd5cd", [ info.name, info.test ])); return null; } export async function $$RSC_SERVER_ACTION_1($$ACTION_CLOSURE_BOUND) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("90b5db271335765a4b0eab01f044b381b5ebd5cd", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("0090b5db271335765a4b0eab01f044b381b5ebd5cd", $$ACTION_CLOSURE_BOUND); console.log($$ACTION_ARG_0); console.log($$ACTION_ARG_1); } diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/10/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/10/output.js index 9f6837fc25e39..d2a7b1d5c4a7d 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/10/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/10/output.js @@ -1,8 +1,8 @@ -/* __next_internal_action_entry_do_not_use__ {"c18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7fc18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; export default async function foo() {} import { ensureServerEntryExports } from "private-next-rsc-action-validate"; ensureServerEntryExports([ foo ]); -registerServerReference(foo, "c18c215a6b7cdc64bf709f3a714ffdef1bf9651d", null); +registerServerReference(foo, "ffc18c215a6b7cdc64bf709f3a714ffdef1bf9651d", null); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/11/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/11/output.js index 8136f99f6e750..eaf807d614f66 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/11/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/11/output.js @@ -1,8 +1,8 @@ -/* __next_internal_action_entry_do_not_use__ {"c18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7fc18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; export default async function $$RSC_SERVER_ACTION_0() {} import { ensureServerEntryExports } from "private-next-rsc-action-validate"; ensureServerEntryExports([ $$RSC_SERVER_ACTION_0 ]); -registerServerReference($$RSC_SERVER_ACTION_0, "c18c215a6b7cdc64bf709f3a714ffdef1bf9651d", null); +registerServerReference($$RSC_SERVER_ACTION_0, "ffc18c215a6b7cdc64bf709f3a714ffdef1bf9651d", null); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/12/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/12/output.js index e26854b05431a..b21a8547ba9fd 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/12/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/12/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"c18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7fc18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; async function foo() {} export default foo; @@ -6,4 +6,4 @@ import { ensureServerEntryExports } from "private-next-rsc-action-validate"; ensureServerEntryExports([ foo ]); -registerServerReference(foo, "c18c215a6b7cdc64bf709f3a714ffdef1bf9651d", null); +registerServerReference(foo, "ffc18c215a6b7cdc64bf709f3a714ffdef1bf9651d", null); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/13/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/13/output.js index 062de8df3b921..150869f76ca14 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/13/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/13/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"ac840dcaf5e8197cb02b7f3a43c119b7a770b272":"bar","c18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7fac840dcaf5e8197cb02b7f3a43c119b7a770b272":"bar","7fc18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; const foo = async function() {}; export default foo; @@ -9,5 +9,5 @@ ensureServerEntryExports([ foo, bar ]); -registerServerReference(foo, "c18c215a6b7cdc64bf709f3a714ffdef1bf9651d", null); -registerServerReference(bar, "ac840dcaf5e8197cb02b7f3a43c119b7a770b272", null); +registerServerReference(foo, "ffc18c215a6b7cdc64bf709f3a714ffdef1bf9651d", null); +registerServerReference(bar, "ffac840dcaf5e8197cb02b7f3a43c119b7a770b272", null); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/14/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/14/output.js index d0e615e2a5f00..0852956d3fd00 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/14/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/14/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"ab21efdafbe611287bc25c0462b1e0510d13e48b":"foo"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7fab21efdafbe611287bc25c0462b1e0510d13e48b":"foo"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; export async function foo() { async function bar() {} @@ -7,4 +7,4 @@ import { ensureServerEntryExports } from "private-next-rsc-action-validate"; ensureServerEntryExports([ foo ]); -registerServerReference(foo, "ab21efdafbe611287bc25c0462b1e0510d13e48b", null); +registerServerReference(foo, "ffab21efdafbe611287bc25c0462b1e0510d13e48b", null); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/15/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/15/output.js index 805de1fbcea41..ac92fb46296a8 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/15/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/15/output.js @@ -1,6 +1,6 @@ -/* __next_internal_action_entry_do_not_use__ {"90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","c18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7f90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","7fc18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; -export default $$RSC_SERVER_ACTION_0 = registerServerReference($$RSC_SERVER_ACTION_1, "90b5db271335765a4b0eab01f044b381b5ebd5cd", null); +export default $$RSC_SERVER_ACTION_0 = registerServerReference($$RSC_SERVER_ACTION_1, "6090b5db271335765a4b0eab01f044b381b5ebd5cd", null); var $$RSC_SERVER_ACTION_0; export async function $$RSC_SERVER_ACTION_1(a, b) { console.log(a, b); @@ -9,4 +9,4 @@ import { ensureServerEntryExports } from "private-next-rsc-action-validate"; ensureServerEntryExports([ $$RSC_SERVER_ACTION_0 ]); -registerServerReference($$RSC_SERVER_ACTION_0, "c18c215a6b7cdc64bf709f3a714ffdef1bf9651d", null); +registerServerReference($$RSC_SERVER_ACTION_0, "ffc18c215a6b7cdc64bf709f3a714ffdef1bf9651d", null); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/16/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/16/output.js index 7a4b446a6b6c7..dd65500350770 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/16/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/16/output.js @@ -1,36 +1,36 @@ -/* __next_internal_action_entry_do_not_use__ {"1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7f1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7f90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import deleteFromDb from 'db'; const v1 = 'v1'; export function Item({ id1, id2 }) { const v2 = id2; - const deleteItem = registerServerReference($$RSC_SERVER_ACTION_0, "6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null).bind(null, encryptActionBoundArgs("6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", [ + const deleteItem = registerServerReference($$RSC_SERVER_ACTION_0, "006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null).bind(null, encryptActionBoundArgs("006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", [ id1, v2 ])); return ; } export async function $$RSC_SERVER_ACTION_0($$ACTION_CLOSURE_BOUND) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); await deleteFromDb($$ACTION_ARG_0); await deleteFromDb(v1); await deleteFromDb($$ACTION_ARG_1); } const f = (x)=>{ - var g = registerServerReference($$RSC_SERVER_ACTION_1, "90b5db271335765a4b0eab01f044b381b5ebd5cd", null).bind(null, encryptActionBoundArgs("90b5db271335765a4b0eab01f044b381b5ebd5cd", [ + var g = registerServerReference($$RSC_SERVER_ACTION_1, "7f90b5db271335765a4b0eab01f044b381b5ebd5cd", null).bind(null, encryptActionBoundArgs("7f90b5db271335765a4b0eab01f044b381b5ebd5cd", [ x ])); }; export async function $$RSC_SERVER_ACTION_1($$ACTION_CLOSURE_BOUND, y, ...z) { - var [$$ACTION_ARG_0] = await decryptActionBoundArgs("90b5db271335765a4b0eab01f044b381b5ebd5cd", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0] = await decryptActionBoundArgs("7f90b5db271335765a4b0eab01f044b381b5ebd5cd", $$ACTION_CLOSURE_BOUND); return $$ACTION_ARG_0 + y + z[0]; } const g = (x)=>{ - f = registerServerReference($$RSC_SERVER_ACTION_2, "1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", null).bind(null, encryptActionBoundArgs("1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", [ + f = registerServerReference($$RSC_SERVER_ACTION_2, "7f1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", null).bind(null, encryptActionBoundArgs("7f1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", [ x ])); }; export async function $$RSC_SERVER_ACTION_2($$ACTION_CLOSURE_BOUND, y, ...z) { - var [$$ACTION_ARG_0] = await decryptActionBoundArgs("1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0] = await decryptActionBoundArgs("7f1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", $$ACTION_CLOSURE_BOUND); return $$ACTION_ARG_0 + y + z[0]; } diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/17/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/17/output.js index dd77088277017..bf7bf7f98a1ba 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/17/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/17/output.js @@ -1,6 +1,6 @@ -/* __next_internal_action_entry_do_not_use__ {"6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","ab21efdafbe611287bc25c0462b1e0510d13e48b":"foo","ac840dcaf5e8197cb02b7f3a43c119b7a770b272":"bar"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7fab21efdafbe611287bc25c0462b1e0510d13e48b":"foo","7fac840dcaf5e8197cb02b7f3a43c119b7a770b272":"bar"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; -export const foo = registerServerReference($$RSC_SERVER_ACTION_0, "6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null); +export const foo = registerServerReference($$RSC_SERVER_ACTION_0, "006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null); export async function $$RSC_SERVER_ACTION_0() {} const bar = async ()=>{}; export { bar }; @@ -9,5 +9,5 @@ ensureServerEntryExports([ foo, bar ]); -registerServerReference(foo, "ab21efdafbe611287bc25c0462b1e0510d13e48b", null); -registerServerReference(bar, "ac840dcaf5e8197cb02b7f3a43c119b7a770b272", null); +registerServerReference(foo, "ffab21efdafbe611287bc25c0462b1e0510d13e48b", null); +registerServerReference(bar, "ffac840dcaf5e8197cb02b7f3a43c119b7a770b272", null); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/18/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/18/output.js index b3083ea4e8eb1..e38af9276270a 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/18/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/18/output.js @@ -1,17 +1,17 @@ -/* __next_internal_action_entry_do_not_use__ {"1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7f1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import deleteFromDb from 'db'; const v1 = 'v1'; export function Item({ id1, id2 }) { const v2 = id2; return <> - - ; } -export const action = withValidate(registerServerReference($$RSC_SERVER_ACTION_1, "90b5db271335765a4b0eab01f044b381b5ebd5cd", null)); +export const action = withValidate(registerServerReference($$RSC_SERVER_ACTION_1, "0090b5db271335765a4b0eab01f044b381b5ebd5cd", null)); export async function $$RSC_SERVER_ACTION_1() {} diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/20/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/20/output.js index 7d761f618f36c..64f883294cb9b 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/20/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/20/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"c18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7fc18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; const [foo] = [ null @@ -8,4 +8,4 @@ import { ensureServerEntryExports } from "private-next-rsc-action-validate"; ensureServerEntryExports([ foo ]); -registerServerReference(foo, "c18c215a6b7cdc64bf709f3a714ffdef1bf9651d", null); +registerServerReference(foo, "ffc18c215a6b7cdc64bf709f3a714ffdef1bf9651d", null); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/21/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/21/output.js index 9f53ba95b064f..4d90f5b3c3245 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/21/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/21/output.js @@ -1,18 +1,18 @@ -/* __next_internal_action_entry_do_not_use__ {"1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","9ed0cc47abc4e1c64320cf42b74ae60b58c40f00":"$$RSC_SERVER_ACTION_3"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7f1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","7f90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","7f9ed0cc47abc4e1c64320cf42b74ae60b58c40f00":"$$RSC_SERVER_ACTION_3"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { validator, another } from 'auth'; const x = 1; export default function Page() { const y = 1; - return ; } export async function $$RSC_SERVER_ACTION_1($$ACTION_CLOSURE_BOUND, z) { - var [$$ACTION_ARG_0] = await decryptActionBoundArgs("90b5db271335765a4b0eab01f044b381b5ebd5cd", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0] = await decryptActionBoundArgs("4090b5db271335765a4b0eab01f044b381b5ebd5cd", $$ACTION_CLOSURE_BOUND); return x + $$ACTION_ARG_0 + z; } -validator(registerServerReference($$RSC_SERVER_ACTION_2, "1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", null)); +validator(registerServerReference($$RSC_SERVER_ACTION_2, "001c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", null)); export async function $$RSC_SERVER_ACTION_2() {} -another(validator(registerServerReference($$RSC_SERVER_ACTION_3, "9ed0cc47abc4e1c64320cf42b74ae60b58c40f00", null))); +another(validator(registerServerReference($$RSC_SERVER_ACTION_3, "009ed0cc47abc4e1c64320cf42b74ae60b58c40f00", null))); export async function $$RSC_SERVER_ACTION_3() {} diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/22/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/22/output.js index 55c9df4878f4e..b40405a7a8462 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/22/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/22/output.js @@ -1,9 +1,9 @@ -/* __next_internal_action_entry_do_not_use__ {"1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","c18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default","f14702b5a021dd117f7ec7a3c838f397c2046d3b":"action"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7f1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7fc18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default","7ff14702b5a021dd117f7ec7a3c838f397c2046d3b":"action"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { validator } from 'auth'; -export const action = validator(registerServerReference($$RSC_SERVER_ACTION_0, "6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null)); +export const action = validator(registerServerReference($$RSC_SERVER_ACTION_0, "006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null)); export async function $$RSC_SERVER_ACTION_0() {} -export default $$RSC_SERVER_ACTION_1 = validator(registerServerReference($$RSC_SERVER_ACTION_2, "1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", null)); +export default $$RSC_SERVER_ACTION_1 = validator(registerServerReference($$RSC_SERVER_ACTION_2, "001c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", null)); var $$RSC_SERVER_ACTION_1; export async function $$RSC_SERVER_ACTION_2() {} import { ensureServerEntryExports } from "private-next-rsc-action-validate"; @@ -11,5 +11,5 @@ ensureServerEntryExports([ action, $$RSC_SERVER_ACTION_1 ]); -registerServerReference(action, "f14702b5a021dd117f7ec7a3c838f397c2046d3b", null); -registerServerReference($$RSC_SERVER_ACTION_1, "c18c215a6b7cdc64bf709f3a714ffdef1bf9651d", null); +registerServerReference(action, "fff14702b5a021dd117f7ec7a3c838f397c2046d3b", null); +registerServerReference($$RSC_SERVER_ACTION_1, "ffc18c215a6b7cdc64bf709f3a714ffdef1bf9651d", null); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/23/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/23/output.js index 41a6df665af0c..85b3b8dfb33cc 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/23/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/23/output.js @@ -1,20 +1,20 @@ -/* __next_internal_action_entry_do_not_use__ {"6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7f90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; export default function Page({ foo, x, y }) { - var action = registerServerReference($$RSC_SERVER_ACTION_0, "6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null).bind(null, encryptActionBoundArgs("6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", [ + var action = registerServerReference($$RSC_SERVER_ACTION_0, "786a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null).bind(null, encryptActionBoundArgs("786a88810ecce4a4e8b59d53b8327d7e98bbf251d7", [ x ])); action.bind(null, foo[0], foo[1], foo.x, foo[y]); - const action2 = registerServerReference($$RSC_SERVER_ACTION_1,"90b5db271335765a4b0eab01f044b381b5ebd5cd", null).bind(null, encryptActionBoundArgs("90b5db271335765a4b0eab01f044b381b5ebd5cd", [ + const action2 = registerServerReference($$RSC_SERVER_ACTION_1, "7890b5db271335765a4b0eab01f044b381b5ebd5cd", null).bind(null, encryptActionBoundArgs("7890b5db271335765a4b0eab01f044b381b5ebd5cd", [ x ])); action2.bind(null, foo[0], foo[1], foo.x, foo[y]); } export async function $$RSC_SERVER_ACTION_0($$ACTION_CLOSURE_BOUND, a, b, c, d) { - var [$$ACTION_ARG_0] = await decryptActionBoundArgs("6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0] = await decryptActionBoundArgs("786a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); console.log(a, b, $$ACTION_ARG_0, c, d); } export async function $$RSC_SERVER_ACTION_1($$ACTION_CLOSURE_BOUND, a, b, c, d) { - var [$$ACTION_ARG_0] = await decryptActionBoundArgs("90b5db271335765a4b0eab01f044b381b5ebd5cd", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0] = await decryptActionBoundArgs("7890b5db271335765a4b0eab01f044b381b5ebd5cd", $$ACTION_CLOSURE_BOUND); console.log(a, b, $$ACTION_ARG_0, c, d); } diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/24/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/24/output.js index 4f9cc41dc2e07..c4d1959dca17f 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/24/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/24/output.js @@ -1,11 +1,11 @@ -/* __next_internal_action_entry_do_not_use__ {"6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; export default function Page({ foo, x, y }) { - var action = registerServerReference($$RSC_SERVER_ACTION_0, "6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null).bind(null, encryptActionBoundArgs("6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", [ + var action = registerServerReference($$RSC_SERVER_ACTION_0, "786a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null).bind(null, encryptActionBoundArgs("786a88810ecce4a4e8b59d53b8327d7e98bbf251d7", [ foo ])); } export async function $$RSC_SERVER_ACTION_0($$ACTION_CLOSURE_BOUND, a, b, c, { d }) { - var [$$ACTION_ARG_0] = await decryptActionBoundArgs("6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0] = await decryptActionBoundArgs("786a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); console.log(a, b, $$ACTION_ARG_0, d); } diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/25/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/25/output.js index 9573b61ddf9c3..00b8fc5125aaf 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/25/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/25/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7f90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import deleteFromDb from 'db'; export function Item({ id1, id2 }) { @@ -7,13 +7,13 @@ export function Item({ id1, id2 }) { id1++; return ; })(); - var deleteItem = registerServerReference($$RSC_SERVER_ACTION_0, "6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null).bind(null, encryptActionBoundArgs("6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", [ + var deleteItem = registerServerReference($$RSC_SERVER_ACTION_0, "006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null).bind(null, encryptActionBoundArgs("006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", [ id1, id2 ])); } export async function $$RSC_SERVER_ACTION_0($$ACTION_CLOSURE_BOUND) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); await deleteFromDb($$ACTION_ARG_0); await deleteFromDb($$ACTION_ARG_1); } @@ -26,13 +26,13 @@ export function Item2({ id1, id2 }) { id1++; temp.push(); return temp; - var deleteItem = registerServerReference($$RSC_SERVER_ACTION_1, "90b5db271335765a4b0eab01f044b381b5ebd5cd", null).bind(null, encryptActionBoundArgs("90b5db271335765a4b0eab01f044b381b5ebd5cd", [ + var deleteItem = registerServerReference($$RSC_SERVER_ACTION_1, "0090b5db271335765a4b0eab01f044b381b5ebd5cd", null).bind(null, encryptActionBoundArgs("0090b5db271335765a4b0eab01f044b381b5ebd5cd", [ id1, id2 ])); } export async function $$RSC_SERVER_ACTION_1($$ACTION_CLOSURE_BOUND) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("90b5db271335765a4b0eab01f044b381b5ebd5cd", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("0090b5db271335765a4b0eab01f044b381b5ebd5cd", $$ACTION_CLOSURE_BOUND); await deleteFromDb($$ACTION_ARG_0); await deleteFromDb($$ACTION_ARG_1); } diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/26/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/26/output.js index 93fb9da457e42..0ef4f14eb4c44 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/26/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/26/output.js @@ -1,7 +1,7 @@ -/* __next_internal_action_entry_do_not_use__ {"6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; const noop = (action)=>action; -export const log = noop(registerServerReference($$RSC_SERVER_ACTION_0, "6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null)); +export const log = noop(registerServerReference($$RSC_SERVER_ACTION_0, "406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null)); export async function $$RSC_SERVER_ACTION_0(data) { console.log(data); } diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/27/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/27/output.js index d60eb618c1027..e290978889c9a 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/27/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/27/output.js @@ -1,26 +1,26 @@ // Rules here: // 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. -/* __next_internal_action_entry_do_not_use__ {"1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","9ed0cc47abc4e1c64320cf42b74ae60b58c40f00":"$$RSC_SERVER_ACTION_3","a9b2939c1f39073a6bed227fd20233064c8b7869":"$$RSC_SERVER_ACTION_4"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7f1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7f90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","7f9ed0cc47abc4e1c64320cf42b74ae60b58c40f00":"$$RSC_SERVER_ACTION_3","7fa9b2939c1f39073a6bed227fd20233064c8b7869":"$$RSC_SERVER_ACTION_4"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; -var foo = registerServerReference($$RSC_SERVER_ACTION_0, "6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null); +var foo = registerServerReference($$RSC_SERVER_ACTION_0, "006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null); export async function $$RSC_SERVER_ACTION_0() { console.log(1); } export { foo }; -export var bar = registerServerReference($$RSC_SERVER_ACTION_1, "90b5db271335765a4b0eab01f044b381b5ebd5cd", null); +export var bar = registerServerReference($$RSC_SERVER_ACTION_1, "0090b5db271335765a4b0eab01f044b381b5ebd5cd", null); export async function $$RSC_SERVER_ACTION_1() { console.log(2); } -export default registerServerReference($$RSC_SERVER_ACTION_2, "1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", null); +export default registerServerReference($$RSC_SERVER_ACTION_2, "001c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", null); export async function $$RSC_SERVER_ACTION_2() { console.log(3); } -export const qux = registerServerReference($$RSC_SERVER_ACTION_3, "9ed0cc47abc4e1c64320cf42b74ae60b58c40f00", null); +export const qux = registerServerReference($$RSC_SERVER_ACTION_3, "009ed0cc47abc4e1c64320cf42b74ae60b58c40f00", null); export async function $$RSC_SERVER_ACTION_3() { console.log(4); } -export const quux = registerServerReference($$RSC_SERVER_ACTION_4, "a9b2939c1f39073a6bed227fd20233064c8b7869", null); +export const quux = registerServerReference($$RSC_SERVER_ACTION_4, "00a9b2939c1f39073a6bed227fd20233064c8b7869", null); export async function $$RSC_SERVER_ACTION_4() { console.log(5); } diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/28/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/28/output.js index f2ef81a4cecf0..c7abe3c3e8b67 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/28/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/28/output.js @@ -1,30 +1,30 @@ -/* __next_internal_action_entry_do_not_use__ {"1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7f1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7f90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ 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($$RSC_SERVER_ACTION_2, "1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", null).bind(null, encryptActionBoundArgs("1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", [ + return registerServerReference($$RSC_SERVER_ACTION_2, "401c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", null).bind(null, encryptActionBoundArgs("401c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", [ b, c, g ])); } export async function $$RSC_SERVER_ACTION_0($$ACTION_CLOSURE_BOUND, e) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2, $$ACTION_ARG_3] = await decryptActionBoundArgs("6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2, $$ACTION_ARG_3] = await decryptActionBoundArgs("406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); console.log(a, $$ACTION_ARG_0, $$ACTION_ARG_1, e, $$ACTION_ARG_2, $$ACTION_ARG_3); } export async function $$RSC_SERVER_ACTION_1($$ACTION_CLOSURE_BOUND, e) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("90b5db271335765a4b0eab01f044b381b5ebd5cd", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("4090b5db271335765a4b0eab01f044b381b5ebd5cd", $$ACTION_CLOSURE_BOUND); $$ACTION_ARG_0(e); console.log(a, $$ACTION_ARG_1, $$ACTION_ARG_2, e); } export async function $$RSC_SERVER_ACTION_2($$ACTION_CLOSURE_BOUND, d) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("401c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", $$ACTION_CLOSURE_BOUND); let f; console.log(...window, { window }); console.log(a, $$ACTION_ARG_0, action2); - var action2 = registerServerReference($$RSC_SERVER_ACTION_0, "6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null).bind(null, encryptActionBoundArgs("6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", [ + var action2 = registerServerReference($$RSC_SERVER_ACTION_0, "406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null).bind(null, encryptActionBoundArgs("406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", [ $$ACTION_ARG_1, d, f, @@ -32,7 +32,7 @@ export async function $$RSC_SERVER_ACTION_2($$ACTION_CLOSURE_BOUND, d) { ])); return [ action2, - registerServerReference($$RSC_SERVER_ACTION_1, "90b5db271335765a4b0eab01f044b381b5ebd5cd", null).bind(null, encryptActionBoundArgs("90b5db271335765a4b0eab01f044b381b5ebd5cd", [ + registerServerReference($$RSC_SERVER_ACTION_1, "4090b5db271335765a4b0eab01f044b381b5ebd5cd", null).bind(null, encryptActionBoundArgs("4090b5db271335765a4b0eab01f044b381b5ebd5cd", [ action2, $$ACTION_ARG_1, d diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/29/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/29/output.js index 29265f8485ba7..379d0932cad3a 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/29/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/29/output.js @@ -1,6 +1,6 @@ -/* __next_internal_action_entry_do_not_use__ {"28baf972d345b86b747ad0df73d75a0088a42214":"dec","6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","c18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7f28baf972d345b86b747ad0df73d75a0088a42214":"dec","7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7fc18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; -export const dec = registerServerReference($$RSC_SERVER_ACTION_0, "6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null); +export const dec = registerServerReference($$RSC_SERVER_ACTION_0, "406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null); export async function $$RSC_SERVER_ACTION_0(value) { return value - 1; } @@ -11,5 +11,5 @@ ensureServerEntryExports([ dec, dec ]); -registerServerReference(dec, "28baf972d345b86b747ad0df73d75a0088a42214", null); -registerServerReference(dec, "c18c215a6b7cdc64bf709f3a714ffdef1bf9651d", null); +registerServerReference(dec, "ff28baf972d345b86b747ad0df73d75a0088a42214", null); +registerServerReference(dec, "ffc18c215a6b7cdc64bf709f3a714ffdef1bf9651d", null); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/3/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/3/output.js index 443d04812d7e1..2117fe76cf7d1 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/3/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/3/output.js @@ -1,5 +1,5 @@ // app/send.ts -/* __next_internal_action_entry_do_not_use__ {"e10665baac148856374b2789aceb970f66fec33e":"myAction"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7fe10665baac148856374b2789aceb970f66fec33e":"myAction"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; export async function myAction(a, b, c) { console.log('a'); @@ -8,4 +8,4 @@ import { ensureServerEntryExports } from "private-next-rsc-action-validate"; ensureServerEntryExports([ myAction ]); -registerServerReference(myAction, "e10665baac148856374b2789aceb970f66fec33e", null); +registerServerReference(myAction, "ffe10665baac148856374b2789aceb970f66fec33e", null); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/30/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/30/output.js index ffc86c3419dd8..94d0272165643 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/30/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/30/output.js @@ -1,30 +1,30 @@ -/* __next_internal_action_entry_do_not_use__ {"0090eaf4e1f08a2d94f6be401e54a2ded399b87c":"action0","1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7f0090eaf4e1f08a2d94f6be401e54a2ded399b87c":"action0","7f1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7f90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ 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($$RSC_SERVER_ACTION_2, "1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", null).bind(null, encryptActionBoundArgs("1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", [ + return registerServerReference($$RSC_SERVER_ACTION_2, "401c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", null).bind(null, encryptActionBoundArgs("401c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", [ b, c, g ])); } export async function $$RSC_SERVER_ACTION_0($$ACTION_CLOSURE_BOUND, e) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2, $$ACTION_ARG_3] = await decryptActionBoundArgs("6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2, $$ACTION_ARG_3] = await decryptActionBoundArgs("406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); console.log(a, $$ACTION_ARG_0, $$ACTION_ARG_1, e, $$ACTION_ARG_2, $$ACTION_ARG_3); } export async function $$RSC_SERVER_ACTION_1($$ACTION_CLOSURE_BOUND, e) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("90b5db271335765a4b0eab01f044b381b5ebd5cd", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("4090b5db271335765a4b0eab01f044b381b5ebd5cd", $$ACTION_CLOSURE_BOUND); $$ACTION_ARG_0(e); console.log(a, $$ACTION_ARG_1, $$ACTION_ARG_2, e); } export async function $$RSC_SERVER_ACTION_2($$ACTION_CLOSURE_BOUND, d) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("401c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", $$ACTION_CLOSURE_BOUND); let f; console.log(...window, { window }); console.log(a, $$ACTION_ARG_0, action2); - var action2 = registerServerReference($$RSC_SERVER_ACTION_0, "6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null).bind(null, encryptActionBoundArgs("6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", [ + var action2 = registerServerReference($$RSC_SERVER_ACTION_0, "406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null).bind(null, encryptActionBoundArgs("406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", [ $$ACTION_ARG_1, d, f, @@ -32,7 +32,7 @@ export async function $$RSC_SERVER_ACTION_2($$ACTION_CLOSURE_BOUND, d) { ])); return [ action2, - registerServerReference($$RSC_SERVER_ACTION_1, "90b5db271335765a4b0eab01f044b381b5ebd5cd", null).bind(null, encryptActionBoundArgs("90b5db271335765a4b0eab01f044b381b5ebd5cd", [ + registerServerReference($$RSC_SERVER_ACTION_1, "4090b5db271335765a4b0eab01f044b381b5ebd5cd", null).bind(null, encryptActionBoundArgs("4090b5db271335765a4b0eab01f044b381b5ebd5cd", [ action2, $$ACTION_ARG_1, d @@ -43,4 +43,4 @@ import { ensureServerEntryExports } from "private-next-rsc-action-validate"; ensureServerEntryExports([ action0 ]); -registerServerReference(action0, "0090eaf4e1f08a2d94f6be401e54a2ded399b87c", null); +registerServerReference(action0, "ff0090eaf4e1f08a2d94f6be401e54a2ded399b87c", null); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/31/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/31/output.js index e4c3902986354..f64d02d824199 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/31/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/31/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"abf760c735ba66c4c26a2913864dd7e28fb88a91":"action2","f14702b5a021dd117f7ec7a3c838f397c2046d3b":"action"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7fabf760c735ba66c4c26a2913864dd7e28fb88a91":"action2","7ff14702b5a021dd117f7ec7a3c838f397c2046d3b":"action"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; export const action = { async f (x) { @@ -21,5 +21,5 @@ ensureServerEntryExports([ action, action2 ]); -registerServerReference(action, "f14702b5a021dd117f7ec7a3c838f397c2046d3b", null); -registerServerReference(action2, "abf760c735ba66c4c26a2913864dd7e28fb88a91", null); \ No newline at end of file +registerServerReference(action, "fff14702b5a021dd117f7ec7a3c838f397c2046d3b", null); +registerServerReference(action2, "ffabf760c735ba66c4c26a2913864dd7e28fb88a91", null); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/32/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/32/output.js index 3d03a4fcc3855..c440a0ba18892 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/32/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/32/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; export function Component() { const data = [ @@ -16,7 +16,7 @@ export function Component() { current: 1 } }; - var action = registerServerReference($$RSC_SERVER_ACTION_0, "6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null).bind(null, encryptActionBoundArgs("6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", [ + var action = registerServerReference($$RSC_SERVER_ACTION_0, "006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null).bind(null, encryptActionBoundArgs("006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", [ data, baz.value, foo @@ -24,7 +24,7 @@ export function Component() { return
; } export async function $$RSC_SERVER_ACTION_0($$ACTION_CLOSURE_BOUND) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); console.log($$ACTION_ARG_0.at(1), $$ACTION_ARG_1, $$ACTION_ARG_1.current); console.log($$ACTION_ARG_2.push.call($$ACTION_ARG_2, 5)); } diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/33/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/33/output.js index d946877ad2236..372326947d0e0 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/33/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/33/output.js @@ -1,11 +1,11 @@ -/* __next_internal_action_entry_do_not_use__ {"3128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7f3128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; const v = 'world'; -export var $$RSC_SERVER_CACHE_0 = $$cache__("default", "3128060c414d59f8552e4788b846c0d2b7f74743", async function fn() { +export var $$RSC_SERVER_CACHE_0 = $$cache__("default", "803128060c414d59f8552e4788b846c0d2b7f74743", async function fn() { return 'hello, ' + v; }); -var fn = registerServerReference($$RSC_SERVER_CACHE_0, "3128060c414d59f8552e4788b846c0d2b7f74743", null); +var fn = registerServerReference($$RSC_SERVER_CACHE_0, "803128060c414d59f8552e4788b846c0d2b7f74743", null); export async function Component() { const data = await fn(); return
{data}
; diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/34/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/34/output.js index 5ac2d6476edd8..5b406befdce4c 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/34/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/34/output.js @@ -1,8 +1,8 @@ -/* __next_internal_action_entry_do_not_use__ {"3128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0","951c375b4a6a6e89d67b743ec5808127cfde405d":"$$RSC_SERVER_CACHE_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7f3128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0","7f951c375b4a6a6e89d67b743ec5808127cfde405d":"$$RSC_SERVER_CACHE_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; -export var $$RSC_SERVER_CACHE_0 = $$cache__("default", "3128060c414d59f8552e4788b846c0d2b7f74743", async function foo() {}); -export var foo = registerServerReference($$RSC_SERVER_CACHE_0, "3128060c414d59f8552e4788b846c0d2b7f74743", null); -export var $$RSC_SERVER_CACHE_1 = $$cache__("default", "951c375b4a6a6e89d67b743ec5808127cfde405d", async function() {}); -const bar = registerServerReference($$RSC_SERVER_CACHE_1, "951c375b4a6a6e89d67b743ec5808127cfde405d", null); +export var $$RSC_SERVER_CACHE_0 = $$cache__("default", "803128060c414d59f8552e4788b846c0d2b7f74743", async function foo() {}); +export var foo = registerServerReference($$RSC_SERVER_CACHE_0, "803128060c414d59f8552e4788b846c0d2b7f74743", null); +export var $$RSC_SERVER_CACHE_1 = $$cache__("default", "80951c375b4a6a6e89d67b743ec5808127cfde405d", async function() {}); +const bar = registerServerReference($$RSC_SERVER_CACHE_1, "80951c375b4a6a6e89d67b743ec5808127cfde405d", null); export { bar }; diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/35/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/35/output.js index c8abbfed26710..d72877ec1a54f 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/35/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/35/output.js @@ -1,7 +1,7 @@ -/* __next_internal_action_entry_do_not_use__ {"3128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7f3128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; -export var $$RSC_SERVER_CACHE_0 = $$cache__("default", "3128060c414d59f8552e4788b846c0d2b7f74743", async function() { +export var $$RSC_SERVER_CACHE_0 = $$cache__("default", "803128060c414d59f8552e4788b846c0d2b7f74743", async function() { return 'data'; }); -export const my_fn = registerServerReference($$RSC_SERVER_CACHE_0, "3128060c414d59f8552e4788b846c0d2b7f74743", null); +export const my_fn = registerServerReference($$RSC_SERVER_CACHE_0, "803128060c414d59f8552e4788b846c0d2b7f74743", null); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/36/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/36/output.js index bc293332ceb89..83fa4ad8c8f86 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/36/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/36/output.js @@ -1,19 +1,19 @@ -/* __next_internal_action_entry_do_not_use__ {"3128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0","4acc55633206134002149ce873fe498be64a6fef":"$$RSC_SERVER_CACHE_4","69348c79fce073bae2f70f139565a2fda1c74c74":"$$RSC_SERVER_CACHE_2","951c375b4a6a6e89d67b743ec5808127cfde405d":"$$RSC_SERVER_CACHE_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7f3128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0","7f4acc55633206134002149ce873fe498be64a6fef":"$$RSC_SERVER_CACHE_4","7f69348c79fce073bae2f70f139565a2fda1c74c74":"$$RSC_SERVER_CACHE_2","7f951c375b4a6a6e89d67b743ec5808127cfde405d":"$$RSC_SERVER_CACHE_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; -export var $$RSC_SERVER_CACHE_0 = $$cache__("default", "3128060c414d59f8552e4788b846c0d2b7f74743", async function foo() { +export var $$RSC_SERVER_CACHE_0 = $$cache__("default", "803128060c414d59f8552e4788b846c0d2b7f74743", async function foo() { return 'data A'; }); -export var foo = registerServerReference($$RSC_SERVER_CACHE_0, "3128060c414d59f8552e4788b846c0d2b7f74743", null); -export var $$RSC_SERVER_CACHE_1 = $$cache__("default", "951c375b4a6a6e89d67b743ec5808127cfde405d", async function bar() { +export var foo = registerServerReference($$RSC_SERVER_CACHE_0, "803128060c414d59f8552e4788b846c0d2b7f74743", null); +export var $$RSC_SERVER_CACHE_1 = $$cache__("default", "80951c375b4a6a6e89d67b743ec5808127cfde405d", async function bar() { return 'data B'; }); -export var bar = registerServerReference($$RSC_SERVER_CACHE_1, "951c375b4a6a6e89d67b743ec5808127cfde405d", null); -export var $$RSC_SERVER_CACHE_2 = $$cache__("default", "69348c79fce073bae2f70f139565a2fda1c74c74", async function Cached({ children }) { +export var bar = registerServerReference($$RSC_SERVER_CACHE_1, "80951c375b4a6a6e89d67b743ec5808127cfde405d", null); +export var $$RSC_SERVER_CACHE_2 = $$cache__("default", "c069348c79fce073bae2f70f139565a2fda1c74c74", async function Cached({ children }) { return children; }); -export default registerServerReference($$RSC_SERVER_CACHE_2, "69348c79fce073bae2f70f139565a2fda1c74c74", null); -export var $$RSC_SERVER_CACHE_4 = $$cache__("default", "4acc55633206134002149ce873fe498be64a6fef", async function $$RSC_SERVER_CACHE_3() { +export default registerServerReference($$RSC_SERVER_CACHE_2, "c069348c79fce073bae2f70f139565a2fda1c74c74", null); +export var $$RSC_SERVER_CACHE_4 = $$cache__("default", "804acc55633206134002149ce873fe498be64a6fef", async function $$RSC_SERVER_CACHE_3() { return 'data C'; }); -export const baz = registerServerReference($$RSC_SERVER_CACHE_4, "4acc55633206134002149ce873fe498be64a6fef", null); +export const baz = registerServerReference($$RSC_SERVER_CACHE_4, "804acc55633206134002149ce873fe498be64a6fef", null); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/37/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/37/output.js index 6c87b5a00e67c..52f282c94b34f 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/37/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/37/output.js @@ -1,10 +1,10 @@ -/* __next_internal_action_entry_do_not_use__ {"3128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7f3128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; -export var $$RSC_SERVER_CACHE_0 = $$cache__("default", "3128060c414d59f8552e4788b846c0d2b7f74743", async function fn() { +export var $$RSC_SERVER_CACHE_0 = $$cache__("default", "803128060c414d59f8552e4788b846c0d2b7f74743", async function fn() { return 'foo'; }); -var fn = registerServerReference($$RSC_SERVER_CACHE_0, "3128060c414d59f8552e4788b846c0d2b7f74743", null); +var fn = registerServerReference($$RSC_SERVER_CACHE_0, "803128060c414d59f8552e4788b846c0d2b7f74743", null); async function Component() { const data = await fn(); return
{data}
; diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/38/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/38/output.js index b0b725ebaa0b0..8b683ab72cf44 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/38/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/38/output.js @@ -1,7 +1,7 @@ -/* __next_internal_action_entry_do_not_use__ {"3128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7f3128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; -export var $$RSC_SERVER_CACHE_0 = $$cache__("x", "3128060c414d59f8552e4788b846c0d2b7f74743", async function foo() { +export var $$RSC_SERVER_CACHE_0 = $$cache__("x", "803128060c414d59f8552e4788b846c0d2b7f74743", async function foo() { return 'data'; }); -export var foo = registerServerReference($$RSC_SERVER_CACHE_0, "3128060c414d59f8552e4788b846c0d2b7f74743", null); +export var foo = registerServerReference($$RSC_SERVER_CACHE_0, "803128060c414d59f8552e4788b846c0d2b7f74743", null); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/39/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/39/output.js index 212eabc90711d..f2bd13a8f4884 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/39/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/39/output.js @@ -1,8 +1,8 @@ -/* __next_internal_action_entry_do_not_use__ {"3128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7f3128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; -export var $$RSC_SERVER_CACHE_0 = $$cache__("default", "3128060c414d59f8552e4788b846c0d2b7f74743", async function fn($$ACTION_CLOSURE_BOUND) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("3128060c414d59f8552e4788b846c0d2b7f74743", $$ACTION_CLOSURE_BOUND); +export var $$RSC_SERVER_CACHE_0 = $$cache__("default", "803128060c414d59f8552e4788b846c0d2b7f74743", async function fn($$ACTION_CLOSURE_BOUND) { + var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("803128060c414d59f8552e4788b846c0d2b7f74743", $$ACTION_CLOSURE_BOUND); console.log($$ACTION_ARG_0); return { foo: $$ACTION_ARG_1 @@ -10,11 +10,11 @@ export var $$RSC_SERVER_CACHE_0 = $$cache__("default", "3128060c414d59f8552e4788 }); async function Component({ foo }) { const a = 123; - var fn = $$RSC_SERVER_REF_1.bind(null, encryptActionBoundArgs("3128060c414d59f8552e4788b846c0d2b7f74743", [ + var fn = $$RSC_SERVER_REF_1.bind(null, encryptActionBoundArgs("803128060c414d59f8552e4788b846c0d2b7f74743", [ a, foo ])); const data = await fn(); return
{data}
; } -var $$RSC_SERVER_REF_1 = registerServerReference($$RSC_SERVER_CACHE_0, "3128060c414d59f8552e4788b846c0d2b7f74743", null); +var $$RSC_SERVER_REF_1 = registerServerReference($$RSC_SERVER_CACHE_0, "803128060c414d59f8552e4788b846c0d2b7f74743", null); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/4/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/4/output.js index 1ca03b07bec91..47abc8fff847e 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/4/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/4/output.js @@ -1,11 +1,11 @@ -/* __next_internal_action_entry_do_not_use__ {"1ab723c80dcca470e0410b4b2a2fc2bf21f41476":"c","6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","6e7bc104e4d6e7fda190c4a51be969cfd0be6d6d":"a","d1f7eb64271d7c601dfef7d4d7053de1c2ca4338":"b"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7f1ab723c80dcca470e0410b4b2a2fc2bf21f41476":"c","7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7f6e7bc104e4d6e7fda190c4a51be969cfd0be6d6d":"a","7fd1f7eb64271d7c601dfef7d4d7053de1c2ca4338":"b"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; export async function a() {} export async function b() {} export async function c() {} function d() {} function Foo() { - var e = registerServerReference($$RSC_SERVER_ACTION_0, "6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null); + var e = registerServerReference($$RSC_SERVER_ACTION_0, "006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null); } export async function $$RSC_SERVER_ACTION_0() {} import { ensureServerEntryExports } from "private-next-rsc-action-validate"; @@ -14,6 +14,6 @@ ensureServerEntryExports([ b, c ]); -registerServerReference(a, "6e7bc104e4d6e7fda190c4a51be969cfd0be6d6d", null); -registerServerReference(b, "d1f7eb64271d7c601dfef7d4d7053de1c2ca4338", null); -registerServerReference(c, "1ab723c80dcca470e0410b4b2a2fc2bf21f41476", null); +registerServerReference(a, "ff6e7bc104e4d6e7fda190c4a51be969cfd0be6d6d", null); +registerServerReference(b, "ffd1f7eb64271d7c601dfef7d4d7053de1c2ca4338", null); +registerServerReference(c, "ff1ab723c80dcca470e0410b4b2a2fc2bf21f41476", null); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/40/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/40/output.js index 0083868e37291..a5eb2d49c4c0a 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/40/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/40/output.js @@ -1,8 +1,8 @@ -/* __next_internal_action_entry_do_not_use__ {"1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","3128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7f1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","7f3128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; -export var $$RSC_SERVER_CACHE_0 = $$cache__("default", "3128060c414d59f8552e4788b846c0d2b7f74743", async function cache($$ACTION_CLOSURE_BOUND, e) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("3128060c414d59f8552e4788b846c0d2b7f74743", $$ACTION_CLOSURE_BOUND); +export var $$RSC_SERVER_CACHE_0 = $$cache__("default", "c03128060c414d59f8552e4788b846c0d2b7f74743", async function cache($$ACTION_CLOSURE_BOUND, e) { + var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("c03128060c414d59f8552e4788b846c0d2b7f74743", $$ACTION_CLOSURE_BOUND); const f = $$ACTION_ARG_0 + e; return [ f, @@ -13,7 +13,7 @@ export var $$RSC_SERVER_CACHE_0 = $$cache__("default", "3128060c414d59f8552e4788 }); async function Component({ a }) { const b = 1; - var action = registerServerReference($$RSC_SERVER_ACTION_2, "1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", null).bind(null, encryptActionBoundArgs("1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", [ + var action = registerServerReference($$RSC_SERVER_ACTION_2, "401c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", null).bind(null, encryptActionBoundArgs("401c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", [ a, b ])); @@ -21,11 +21,11 @@ async function Component({ a }) {
; } -var $$RSC_SERVER_REF_1 = registerServerReference($$RSC_SERVER_CACHE_0, "3128060c414d59f8552e4788b846c0d2b7f74743", null); +var $$RSC_SERVER_REF_1 = registerServerReference($$RSC_SERVER_CACHE_0, "c03128060c414d59f8552e4788b846c0d2b7f74743", null); export async function $$RSC_SERVER_ACTION_2($$ACTION_CLOSURE_BOUND, c) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("401c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", $$ACTION_CLOSURE_BOUND); const d = $$ACTION_ARG_0 + $$ACTION_ARG_1 + c; - var cache = $$RSC_SERVER_REF_1.bind(null, encryptActionBoundArgs("3128060c414d59f8552e4788b846c0d2b7f74743", [ + var cache = $$RSC_SERVER_REF_1.bind(null, encryptActionBoundArgs("c03128060c414d59f8552e4788b846c0d2b7f74743", [ d, $$ACTION_ARG_0 ])); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/41/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/41/output.js index 9a13361a3e348..66f1a38fa38fe 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/41/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/41/output.js @@ -1,18 +1,18 @@ -/* __next_internal_action_entry_do_not_use__ {"6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","951c375b4a6a6e89d67b743ec5808127cfde405d":"$$RSC_SERVER_CACHE_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7f951c375b4a6a6e89d67b743ec5808127cfde405d":"$$RSC_SERVER_CACHE_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; -export var $$RSC_SERVER_CACHE_1 = $$cache__("default", "951c375b4a6a6e89d67b743ec5808127cfde405d", async function Component({ foo }) { +export var $$RSC_SERVER_CACHE_1 = $$cache__("default", "c0951c375b4a6a6e89d67b743ec5808127cfde405d", async function Component({ foo }) { const a = 123; - var fn = registerServerReference($$RSC_SERVER_ACTION_0, "6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null).bind(null, encryptActionBoundArgs("6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", [ + var fn = registerServerReference($$RSC_SERVER_ACTION_0, "006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null).bind(null, encryptActionBoundArgs("006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", [ a, foo ])); const data = await fn(); return
{data}
; }); -export var Component = registerServerReference($$RSC_SERVER_CACHE_1, "951c375b4a6a6e89d67b743ec5808127cfde405d", null); +export var Component = registerServerReference($$RSC_SERVER_CACHE_1, "c0951c375b4a6a6e89d67b743ec5808127cfde405d", null); export async function $$RSC_SERVER_ACTION_0($$ACTION_CLOSURE_BOUND) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); console.log($$ACTION_ARG_0); return { foo: $$ACTION_ARG_1 diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/42/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/42/output.js index bf2adbbf270d9..668e0446bd80d 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/42/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/42/output.js @@ -1,8 +1,8 @@ -/* __next_internal_action_entry_do_not_use__ {"3128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7f3128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; -export var $$RSC_SERVER_CACHE_0 = $$cache__("default", "3128060c414d59f8552e4788b846c0d2b7f74743", async function($$ACTION_CLOSURE_BOUND) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("3128060c414d59f8552e4788b846c0d2b7f74743", $$ACTION_CLOSURE_BOUND); +export var $$RSC_SERVER_CACHE_0 = $$cache__("default", "803128060c414d59f8552e4788b846c0d2b7f74743", async function($$ACTION_CLOSURE_BOUND) { + var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("803128060c414d59f8552e4788b846c0d2b7f74743", $$ACTION_CLOSURE_BOUND); console.log($$ACTION_ARG_0); return { foo: $$ACTION_ARG_1 @@ -10,11 +10,11 @@ export var $$RSC_SERVER_CACHE_0 = $$cache__("default", "3128060c414d59f8552e4788 }); async function Component({ foo }) { const a = 123; - const fn = $$RSC_SERVER_REF_1.bind(null, encryptActionBoundArgs("3128060c414d59f8552e4788b846c0d2b7f74743", [ + const fn = $$RSC_SERVER_REF_1.bind(null, encryptActionBoundArgs("803128060c414d59f8552e4788b846c0d2b7f74743", [ a, foo ])); const data = await fn(); return
{data}
; } -var $$RSC_SERVER_REF_1 = registerServerReference($$RSC_SERVER_CACHE_0, "3128060c414d59f8552e4788b846c0d2b7f74743", null); +var $$RSC_SERVER_REF_1 = registerServerReference($$RSC_SERVER_CACHE_0, "803128060c414d59f8552e4788b846c0d2b7f74743", null); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/43/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/43/output.js index 88ff154df7994..5607dbce7c4d2 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/43/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/43/output.js @@ -1,20 +1,20 @@ -/* __next_internal_action_entry_do_not_use__ {"6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","951c375b4a6a6e89d67b743ec5808127cfde405d":"$$RSC_SERVER_CACHE_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7f951c375b4a6a6e89d67b743ec5808127cfde405d":"$$RSC_SERVER_CACHE_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; import { Foo } from './client'; const secret = 'my password is qwerty123'; -export var $$RSC_SERVER_CACHE_1 = $$cache__("default", "951c375b4a6a6e89d67b743ec5808127cfde405d", async function getCachedRandom(x, children) { +export var $$RSC_SERVER_CACHE_1 = $$cache__("default", "e0951c375b4a6a6e89d67b743ec5808127cfde405d", async function getCachedRandom(x, children) { return { x, y: Math.random(), - z: , r: children }; }); -var getCachedRandom = registerServerReference($$RSC_SERVER_CACHE_1, "951c375b4a6a6e89d67b743ec5808127cfde405d", null); +var getCachedRandom = registerServerReference($$RSC_SERVER_CACHE_1, "e0951c375b4a6a6e89d67b743ec5808127cfde405d", null); export async function $$RSC_SERVER_ACTION_0($$ACTION_CLOSURE_BOUND) { - var [$$ACTION_ARG_0] = await decryptActionBoundArgs("6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0] = await decryptActionBoundArgs("006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); console.log(secret, $$ACTION_ARG_0); } diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/44/input.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/44/input.js new file mode 100644 index 0000000000000..7514f59607168 --- /dev/null +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/44/input.js @@ -0,0 +1,37 @@ +// This is for testing the "information byte" of Server Action / Cache IDs. + +// Should be 1 110000 0, which is "e0" in hex. +async function f1(a, b) { + 'use cache' + return [a, b] +} + +// Should be 0 110000 1, which is "60" in hex. +async function f2(a, b) { + 'use server' + return [a, b] +} + +// Should be 1 111111 1, which is "ff" in hex. +async function f3(a, b, ...rest) { + 'use cache' + return [a, b, rest] +} + +// Should be 0 111110 0, which is "7c" in hex. +async function f4(a, b, c, d, e) { + 'use server' + return [a, b, c, d, e] +} + +// Should be 0 111111 0, which is "7e" in hex. +async function f4(a, b, c, d, e, f) { + 'use server' + return [a, b, c, d, e, f] +} + +// Should be 1 111111 1, which is "ff" in hex. +async function f5(a, b, c, d, e, f, g) { + 'use cache' + return [a, b, c, d, e, f, g] +} diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/44/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/44/output.js new file mode 100644 index 0000000000000..e64d199a5c4c2 --- /dev/null +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/44/output.js @@ -0,0 +1,65 @@ +// This is for testing the "information byte" of Server Action / Cache IDs. +// Should be 1 110000 0, which is "e0" in hex. +/* __next_internal_action_entry_do_not_use__ {"7f3128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0","7f471a5eb0be1c31686dd4ba938a80328b80b1615d":"$$RSC_SERVER_CACHE_5","7f69348c79fce073bae2f70f139565a2fda1c74c74":"$$RSC_SERVER_CACHE_2","7f90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","7f9ed0cc47abc4e1c64320cf42b74ae60b58c40f00":"$$RSC_SERVER_ACTION_3","7fa9b2939c1f39073a6bed227fd20233064c8b7869":"$$RSC_SERVER_ACTION_4"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; +import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; +export var $$RSC_SERVER_CACHE_0 = $$cache__("default", "e03128060c414d59f8552e4788b846c0d2b7f74743", async function f1(a, b) { + return [ + a, + b + ]; +}); +var f1 = registerServerReference($$RSC_SERVER_CACHE_0, "e03128060c414d59f8552e4788b846c0d2b7f74743", null); +var f2 = // Should be 0 110000 1, which is "60" in hex. +registerServerReference($$RSC_SERVER_ACTION_1, "6090b5db271335765a4b0eab01f044b381b5ebd5cd", null); +export async function $$RSC_SERVER_ACTION_1(a, b) { + return [ + a, + b + ]; +} +export var $$RSC_SERVER_CACHE_2 = $$cache__("default", "ff69348c79fce073bae2f70f139565a2fda1c74c74", // Should be 1 111111 1, which is "ff" in hex. +async function f3(a, b, ...rest) { + return [ + a, + b, + rest + ]; +}); +var f3 = registerServerReference($$RSC_SERVER_CACHE_2, "ff69348c79fce073bae2f70f139565a2fda1c74c74", null); +var f4 = // Should be 0 111110 0, which is "7c" in hex. +registerServerReference($$RSC_SERVER_ACTION_3, "7c9ed0cc47abc4e1c64320cf42b74ae60b58c40f00", null); +export async function $$RSC_SERVER_ACTION_3(a, b, c, d, e) { + return [ + a, + b, + c, + d, + e + ]; +} +var f4 = // Should be 0 111111 0, which is "7e" in hex. +registerServerReference($$RSC_SERVER_ACTION_4, "7ea9b2939c1f39073a6bed227fd20233064c8b7869", null); +export async function $$RSC_SERVER_ACTION_4(a, b, c, d, e, f) { + return [ + a, + b, + c, + d, + e, + f + ]; +} +export var $$RSC_SERVER_CACHE_5 = $$cache__("default", "ff471a5eb0be1c31686dd4ba938a80328b80b1615d", // Should be 1 111111 1, which is "ff" in hex. +async function f5(a, b, c, d, e, f, g) { + return [ + a, + b, + c, + d, + e, + f, + g + ]; +}); +var f5 = registerServerReference($$RSC_SERVER_CACHE_5, "ff471a5eb0be1c31686dd4ba938a80328b80b1615d", null); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/5/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/5/output.js index df3c005f70cc3..acac5bca064a1 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/5/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/5/output.js @@ -1,10 +1,10 @@ -/* __next_internal_action_entry_do_not_use__ {"6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import deleteFromDb from 'db'; const v1 = 'v1'; export function Item({ id1, id2, id3, id4 }) { const v2 = id2; - var deleteItem = registerServerReference($$RSC_SERVER_ACTION_0, "6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null).bind(null, encryptActionBoundArgs("6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", [ + var deleteItem = registerServerReference($$RSC_SERVER_ACTION_0, "006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null).bind(null, encryptActionBoundArgs("006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", [ id1, v2, id3, @@ -13,7 +13,7 @@ export function Item({ id1, id2, id3, id4 }) { return ; } export async function $$RSC_SERVER_ACTION_0($$ACTION_CLOSURE_BOUND) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2, $$ACTION_ARG_3] = await decryptActionBoundArgs("6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2, $$ACTION_ARG_3] = await decryptActionBoundArgs("006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); await deleteFromDb($$ACTION_ARG_0); await deleteFromDb(v1); await deleteFromDb($$ACTION_ARG_1); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/6/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/6/output.js index d25de0bface7c..f84d387dc8953 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/6/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/6/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import f, { f1, f2 } from 'foo'; const f3 = 1; @@ -19,7 +19,7 @@ export function y(p, [p1, { p2 }], ...p3) { if (true) { const f8 = 1; } - var action = registerServerReference($$RSC_SERVER_ACTION_0, "6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null).bind(null, encryptActionBoundArgs("6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", [ + var action = registerServerReference($$RSC_SERVER_ACTION_0, "006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null).bind(null, encryptActionBoundArgs("006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", [ f2, f11, p, @@ -30,7 +30,7 @@ export function y(p, [p1, { p2 }], ...p3) { return ; } export async function $$RSC_SERVER_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("6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2, $$ACTION_ARG_3, $$ACTION_ARG_4, $$ACTION_ARG_5] = await decryptActionBoundArgs("006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); const f17 = 1; if (true) { const f18 = 1; diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/7/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/7/output.js index 754dacb16650a..297b44181df4e 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/7/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/7/output.js @@ -1,8 +1,8 @@ -/* __next_internal_action_entry_do_not_use__ {"6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","9ed0cc47abc4e1c64320cf42b74ae60b58c40f00":"$$RSC_SERVER_ACTION_3","a9b2939c1f39073a6bed227fd20233064c8b7869":"$$RSC_SERVER_ACTION_4"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7f90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","7f9ed0cc47abc4e1c64320cf42b74ae60b58c40f00":"$$RSC_SERVER_ACTION_3","7fa9b2939c1f39073a6bed227fd20233064c8b7869":"$$RSC_SERVER_ACTION_4"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import deleteFromDb from 'db'; export function Item1(product, foo, bar) { - const a = registerServerReference($$RSC_SERVER_ACTION_0, "6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null).bind(null, encryptActionBoundArgs("6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", [ + const a = registerServerReference($$RSC_SERVER_ACTION_0, "006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null).bind(null, encryptActionBoundArgs("006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", [ product, foo, bar @@ -10,11 +10,11 @@ export function Item1(product, foo, bar) { return ; } export async function $$RSC_SERVER_ACTION_0($$ACTION_CLOSURE_BOUND) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); await deleteFromDb($$ACTION_ARG_0.id, $$ACTION_ARG_0?.foo, $$ACTION_ARG_0.bar.baz, $$ACTION_ARG_0[$$ACTION_ARG_1, $$ACTION_ARG_2]); } export function Item2(product, foo, bar) { - var deleteItem2 = registerServerReference($$RSC_SERVER_ACTION_1, "90b5db271335765a4b0eab01f044b381b5ebd5cd", null).bind(null, encryptActionBoundArgs("90b5db271335765a4b0eab01f044b381b5ebd5cd", [ + var deleteItem2 = registerServerReference($$RSC_SERVER_ACTION_1, "0090b5db271335765a4b0eab01f044b381b5ebd5cd", null).bind(null, encryptActionBoundArgs("0090b5db271335765a4b0eab01f044b381b5ebd5cd", [ product, foo, bar @@ -22,11 +22,11 @@ export function Item2(product, foo, bar) { return ; } export async function $$RSC_SERVER_ACTION_1($$ACTION_CLOSURE_BOUND) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("90b5db271335765a4b0eab01f044b381b5ebd5cd", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("0090b5db271335765a4b0eab01f044b381b5ebd5cd", $$ACTION_CLOSURE_BOUND); await deleteFromDb($$ACTION_ARG_0.id, $$ACTION_ARG_0?.foo, $$ACTION_ARG_0.bar.baz, $$ACTION_ARG_0[$$ACTION_ARG_1, $$ACTION_ARG_2]); } export function Item3(product, foo, bar) { - const deleteItem3 = registerServerReference($$RSC_SERVER_ACTION_3, "9ed0cc47abc4e1c64320cf42b74ae60b58c40f00", null).bind(null, encryptActionBoundArgs("9ed0cc47abc4e1c64320cf42b74ae60b58c40f00", [ + const deleteItem3 = registerServerReference($$RSC_SERVER_ACTION_3, "009ed0cc47abc4e1c64320cf42b74ae60b58c40f00", null).bind(null, encryptActionBoundArgs("009ed0cc47abc4e1c64320cf42b74ae60b58c40f00", [ product, foo, bar @@ -34,11 +34,11 @@ export function Item3(product, foo, bar) { return ; } export async function $$RSC_SERVER_ACTION_3($$ACTION_CLOSURE_BOUND) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("9ed0cc47abc4e1c64320cf42b74ae60b58c40f00", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("009ed0cc47abc4e1c64320cf42b74ae60b58c40f00", $$ACTION_CLOSURE_BOUND); await deleteFromDb($$ACTION_ARG_0.id, $$ACTION_ARG_0?.foo, $$ACTION_ARG_0.bar.baz, $$ACTION_ARG_0[$$ACTION_ARG_1, $$ACTION_ARG_2]); } export function Item4(product, foo, bar) { - const deleteItem4 = registerServerReference($$RSC_SERVER_ACTION_4, "a9b2939c1f39073a6bed227fd20233064c8b7869", null).bind(null, encryptActionBoundArgs("a9b2939c1f39073a6bed227fd20233064c8b7869", [ + const deleteItem4 = registerServerReference($$RSC_SERVER_ACTION_4, "00a9b2939c1f39073a6bed227fd20233064c8b7869", null).bind(null, encryptActionBoundArgs("00a9b2939c1f39073a6bed227fd20233064c8b7869", [ product, foo, bar @@ -46,6 +46,6 @@ export function Item4(product, foo, bar) { return ; } export async function $$RSC_SERVER_ACTION_4($$ACTION_CLOSURE_BOUND) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("a9b2939c1f39073a6bed227fd20233064c8b7869", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("00a9b2939c1f39073a6bed227fd20233064c8b7869", $$ACTION_CLOSURE_BOUND); await deleteFromDb($$ACTION_ARG_0.id, $$ACTION_ARG_0?.foo, $$ACTION_ARG_0.bar.baz, $$ACTION_ARG_0[$$ACTION_ARG_1, $$ACTION_ARG_2]); } diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/8/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/8/output.js index 4a80bff6cc40e..85bc1f6c3150c 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/8/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/8/output.js @@ -1,6 +1,6 @@ -/* __next_internal_action_entry_do_not_use__ {"6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; -var myAction = registerServerReference($$RSC_SERVER_ACTION_0, "6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null); +var myAction = registerServerReference($$RSC_SERVER_ACTION_0, "706a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null); export async function $$RSC_SERVER_ACTION_0(a, b, c) { // comment 'use strict'; diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/9/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/9/output.js index b64224de832ca..76253b2046cf9 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/9/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/9/output.js @@ -1,5 +1,5 @@ // app/send.ts -/* __next_internal_action_entry_do_not_use__ {"050e3854b72b19e3c7e3966a67535543a90bf7e0":"baz","ab21efdafbe611287bc25c0462b1e0510d13e48b":"foo","c18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7f050e3854b72b19e3c7e3966a67535543a90bf7e0":"baz","7fab21efdafbe611287bc25c0462b1e0510d13e48b":"foo","7fc18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; async function foo() {} export { foo }; @@ -13,6 +13,6 @@ ensureServerEntryExports([ bar, qux ]); -registerServerReference(foo, "ab21efdafbe611287bc25c0462b1e0510d13e48b", null); -registerServerReference(bar, "050e3854b72b19e3c7e3966a67535543a90bf7e0", null); -registerServerReference(qux, "c18c215a6b7cdc64bf709f3a714ffdef1bf9651d", null); +registerServerReference(foo, "ffab21efdafbe611287bc25c0462b1e0510d13e48b", null); +registerServerReference(bar, "ff050e3854b72b19e3c7e3966a67535543a90bf7e0", null); +registerServerReference(qux, "ffc18c215a6b7cdc64bf709f3a714ffdef1bf9651d", null); diff --git a/packages/next/src/build/webpack/loaders/next-flight-action-entry-loader.ts b/packages/next/src/build/webpack/loaders/next-flight-action-entry-loader.ts index b18f17e5d03e0..09bbd45b88532 100644 --- a/packages/next/src/build/webpack/loaders/next-flight-action-entry-loader.ts +++ b/packages/next/src/build/webpack/loaders/next-flight-action-entry-loader.ts @@ -1,20 +1,18 @@ -import { generateActionId } from './utils' - export type NextFlightActionEntryLoaderOptions = { actions: string - encryptionKey: string } function nextFlightActionEntryLoader(this: any) { - const { actions, encryptionKey }: NextFlightActionEntryLoaderOptions = - this.getOptions() + const { actions }: NextFlightActionEntryLoaderOptions = this.getOptions() - const actionList = JSON.parse(actions) as [string, string[]][] + const actionList = JSON.parse(actions) as [ + string, + [id: string, name: string][], + ][] const individualActions = actionList - .map(([path, names]) => { - return names.map((name) => { - const id = generateActionId(encryptionKey, path, name) - return [id, path, name] as [string, string, string] + .map(([path, actionsFromModule]) => { + return actionsFromModule.map(([id, name]) => { + return [id, path, name] }) }) .flat() diff --git a/packages/next/src/build/webpack/loaders/utils.ts b/packages/next/src/build/webpack/loaders/utils.ts index b98db333b0505..6a734518bce90 100644 --- a/packages/next/src/build/webpack/loaders/utils.ts +++ b/packages/next/src/build/webpack/loaders/utils.ts @@ -1,5 +1,4 @@ import type webpack from 'webpack' -import { createHash } from 'crypto' import { RSC_MODULE_TYPES } from '../../../shared/lib/constants' const imageExtensions = ['jpg', 'jpeg', 'png', 'webp', 'avif', 'ico', 'svg'] @@ -44,28 +43,19 @@ export function isCSSMod(mod: { ) } +// Gives { id: name } record of actions from the build info. export function getActionsFromBuildInfo(mod: { resource: string buildInfo?: any -}): undefined | string[] { - return mod.buildInfo?.rsc?.actions +}): undefined | Record { + return mod.buildInfo?.rsc?.actionIds } -export function generateActionId( - hashSalt: string, - filePath: string, - exportName: string -) { - return createHash('sha1') - .update(hashSalt + filePath + ':' + exportName) - .digest('hex') -} - -export function encodeToBase64(obj: T): string { +export function encodeToBase64(obj: T): string { return Buffer.from(JSON.stringify(obj)).toString('base64') } -export function decodeFromBase64(str: string): T { +export function decodeFromBase64(str: string): T { return JSON.parse(Buffer.from(str, 'base64').toString('utf8')) } diff --git a/packages/next/src/build/webpack/plugins/flight-client-entry-plugin.ts b/packages/next/src/build/webpack/plugins/flight-client-entry-plugin.ts index 95525bc8636d1..5e23d5c5b4d8a 100644 --- a/packages/next/src/build/webpack/plugins/flight-client-entry-plugin.ts +++ b/packages/next/src/build/webpack/plugins/flight-client-entry-plugin.ts @@ -25,7 +25,6 @@ import { } from '../../../shared/lib/constants' import { getActionsFromBuildInfo, - generateActionId, isClientComponentEntryModule, isCSSMod, regexCSS, @@ -64,6 +63,8 @@ type Actions = { } } +type ActionIdNamePair = [id: string, name: string] + export type ActionManifest = { // Assign a unique encryption key during production build. encryptionKey: string @@ -283,14 +284,17 @@ export class FlightClientEntryPlugin { const addActionEntryList: Array> = [] - const actionMapsPerEntry: Record> = {} - const createdActions = new Set() + const actionMapsPerEntry: Record< + string, + Map + > = {} + const createdActionIds = new Set() // For each SC server compilation entry, we need to create its corresponding // client component entry. forEachEntryModule(compilation, ({ name, entryModule }) => { const internalClientComponentEntryImports: ClientComponentImports = {} - const actionEntryImports = new Map() + const actionEntryImports = new Map() const clientEntriesToInject = [] const mergedCSSimports: CssImports = {} @@ -310,8 +314,8 @@ export class FlightClientEntryPlugin { resolvedModule: connection.resolvedModule, }) - actionImports.forEach(([dep, names]) => - actionEntryImports.set(dep, names) + actionImports.forEach(([dep, actions]) => + actionEntryImports.set(dep, actions) ) const isAbsoluteRequest = path.isAbsolute(entryRequest) @@ -429,7 +433,7 @@ export class FlightClientEntryPlugin { actions: actionEntryImports, entryName: name, bundlePath: name, - createdActions, + createdActionIds, }) ) } @@ -458,7 +462,10 @@ export class FlightClientEntryPlugin { await Promise.all(addActionEntryList) const addedClientActionEntryList: Promise[] = [] - const actionMapsPerClientEntry: Record> = {} + const actionMapsPerClientEntry: Record< + string, + Map + > = {} // We need to create extra action entries that are created from the // client layer. @@ -492,13 +499,12 @@ export class FlightClientEntryPlugin { // This is to avoid duplicate action instances and make sure the module // state is shared. let remainingClientImportedActions = false - const remainingActionEntryImports = new Map() - for (const [dep, actionNames] of actionEntryImports) { + const remainingActionEntryImports = new Map() + for (const [dep, actions] of actionEntryImports) { const remainingActionNames = [] - for (const actionName of actionNames) { - const id = name + '@' + dep + '@' + actionName - if (!createdActions.has(id)) { - remainingActionNames.push(actionName) + for (const action of actions) { + if (!createdActionIds.has(action[0])) { + remainingActionNames.push(action) } } if (remainingActionNames.length > 0) { @@ -516,7 +522,7 @@ export class FlightClientEntryPlugin { entryName: name, bundlePath: name, fromClient: true, - createdActions, + createdActionIds, }) ) } @@ -533,7 +539,7 @@ export class FlightClientEntryPlugin { dependencies: ReturnType[] }) { // action file path -> action names - const collectedActions = new Map() + const collectedActions = new Map() // Keep track of checked modules to avoid infinite loops with recursive imports. const visitedModule = new Set() @@ -558,7 +564,7 @@ export class FlightClientEntryPlugin { const actions = getActionsFromBuildInfo(mod) if (actions) { - collectedActions.set(modResource, actions) + collectedActions.set(modResource, Object.entries(actions)) } // Collect used exported actions transversely. @@ -617,14 +623,14 @@ export class FlightClientEntryPlugin { }): { cssImports: CssImports clientComponentImports: ClientComponentImports - actionImports: [string, string[]][] + actionImports: [string, ActionIdNamePair[]][] } { // Keep track of checked modules to avoid infinite loops with recursive imports. const visitedOfClientComponentsTraverse = new Set() // Info to collect. const clientComponentImports: ClientComponentImports = {} - const actionImports: [string, string[]][] = [] + const actionImports: [string, ActionIdNamePair[]][] = [] const CSSImports = new Set() const filterClientComponents = ( @@ -652,7 +658,7 @@ export class FlightClientEntryPlugin { const actions = getActionsFromBuildInfo(mod) if (actions) { - actionImports.push([modResource, actions]) + actionImports.push([modResource, Object.entries(actions)]) } if (isCSSMod(mod)) { @@ -839,20 +845,20 @@ export class FlightClientEntryPlugin { entryName, bundlePath, fromClient, - createdActions, + createdActionIds, }: { compiler: webpack.Compiler compilation: webpack.Compilation - actions: Map + actions: Map entryName: string bundlePath: string - createdActions: Set + createdActionIds: Set fromClient?: boolean }) { const actionsArray = Array.from(actions.entries()) - for (const [dep, actionNames] of actions) { - for (const actionName of actionNames) { - createdActions.add(entryName + '@' + dep + '@' + actionName) + for (const [, actionsFromModule] of actions) { + for (const [id] of actionsFromModule) { + createdActionIds.add(id) } } @@ -862,7 +868,6 @@ export class FlightClientEntryPlugin { const actionLoader = `next-flight-action-entry-loader?${stringify({ actions: JSON.stringify(actionsArray), - encryptionKey: this.encryptionKey, __client_imported__: fromClient, })}!` @@ -870,9 +875,8 @@ export class FlightClientEntryPlugin { ? pluginState.edgeServerActions : pluginState.serverActions - for (const [actionFilePath, actionNames] of actionsArray) { - for (const name of actionNames) { - const id = generateActionId(this.encryptionKey, actionFilePath, name) + for (const [, actionsFromModule] of actionsArray) { + for (const [id] of actionsFromModule) { if (typeof currentCompilerServerActions[id] === 'undefined') { currentCompilerServerActions[id] = { workers: {}, From b25a14a1a2be22bc333c52e6a5642c4d81ab2b16 Mon Sep 17 00:00:00 2001 From: Shu Ding Date: Fri, 25 Oct 2024 16:12:45 +0200 Subject: [PATCH 2/4] resolve conflicts --- .../src/transforms/server_actions.rs | 69 +++++++--------- .../fixture/server-actions/client/5/output.js | 7 +- .../fixture/server-actions/client/7/output.js | 4 +- .../fixture/server-actions/client/8/output.js | 4 +- .../fixture/server-actions/server/1/output.js | 20 +---- .../server-actions/server/15/output.js | 10 +-- .../server-actions/server/16/output.js | 27 +------ .../server-actions/server/17/output.js | 9 +-- .../server-actions/server/18/output.js | 31 +------ .../server-actions/server/19/output.js | 9 +-- .../fixture/server-actions/server/2/output.js | 14 +--- .../server-actions/server/21/output.js | 29 ++----- .../server-actions/server/22/output.js | 20 +---- .../server-actions/server/23/output.js | 19 +---- .../server-actions/server/24/output.js | 9 +-- .../server-actions/server/25/output.js | 17 +--- .../server-actions/server/26/output.js | 7 +- .../server-actions/server/27/output.js | 32 ++------ .../server-actions/server/28/output.js | 29 +------ .../server-actions/server/29/output.js | 9 +-- .../server-actions/server/30/output.js | 29 +------ .../server-actions/server/32/output.js | 10 +-- .../server-actions/server/33/output.js | 6 +- .../server-actions/server/34/output.js | 28 +++---- .../server-actions/server/35/output.js | 6 +- .../server-actions/server/36/output.js | 36 ++------- .../server-actions/server/37/output.js | 6 +- .../server-actions/server/38/output.js | 6 +- .../server-actions/server/40/output.js | 17 +--- .../server-actions/server/41/output.js | 21 +---- .../server-actions/server/43/output.js | 18 +---- .../fixture/server-actions/server/44/input.js | 39 --------- .../server-actions/server/44/output.js | 80 ++----------------- .../server-actions/server/45/output.js | 6 +- .../fixture/server-actions/server/46/input.js | 37 +++++++++ .../server-actions/server/46/output.js | 77 ++++++++++++++++++ .../fixture/server-actions/server/5/output.js | 15 +--- .../fixture/server-actions/server/6/output.js | 14 +--- .../fixture/server-actions/server/7/output.js | 48 ++--------- .../fixture/server-actions/server/8/output.js | 7 +- 40 files changed, 239 insertions(+), 642 deletions(-) create mode 100644 crates/next-custom-transforms/tests/fixture/server-actions/server/46/input.js create mode 100644 crates/next-custom-transforms/tests/fixture/server-actions/server/46/output.js diff --git a/crates/next-custom-transforms/src/transforms/server_actions.rs b/crates/next-custom-transforms/src/transforms/server_actions.rs index 48e4199cb6116..2ec42ea98d13b 100644 --- a/crates/next-custom-transforms/src/transforms/server_actions.rs +++ b/crates/next-custom-transforms/src/transforms/server_actions.rs @@ -213,6 +213,24 @@ impl ServerActions { hex_encode(result) } + fn gen_action_ident(&mut self) -> JsWord { + let id: JsWord = format!("$$RSC_SERVER_ACTION_{0}", self.reference_index).into(); + self.reference_index += 1; + id + } + + fn gen_cache_ident(&mut self) -> JsWord { + let id: JsWord = format!("$$RSC_SERVER_CACHE_{0}", self.reference_index).into(); + self.reference_index += 1; + id + } + + fn gen_ref_ident(&mut self) -> JsWord { + let id: JsWord = format!("$$RSC_SERVER_REF_{0}", self.reference_index).into(); + self.reference_index += 1; + id + } + // Check if the function or arrow function is an action or cache function fn get_body_info(&mut self, maybe_body: Option<&mut BlockStmt>) -> (bool, Option) { let mut is_action_fn = false; @@ -284,7 +302,7 @@ impl ServerActions { ids_from_closure: Vec, arrow: &mut ArrowExpr, ) -> Box { - let action_name = gen_action_ident(&mut self.reference_index).to_string(); + let action_name = self.gen_action_ident().to_string(); self.has_action = true; self.export_actions.push(action_name.to_string()); @@ -442,7 +460,7 @@ impl ServerActions { function: &mut Box, fn_name: Option, ) -> Box { - let action_name: JsWord = gen_action_ident(&mut self.reference_index); + let action_name: JsWord = self.gen_action_ident(); self.has_action = true; self.export_actions.push(action_name.to_string()); @@ -579,7 +597,7 @@ impl ServerActions { cache_type: &str, arrow: &mut ArrowExpr, ) -> Box { - let cache_name: JsWord = gen_cache_ident(&mut self.reference_index); + let cache_name: JsWord = self.gen_cache_ident(); let cache_ident = private_ident!(cache_name.clone()); let export_name: JsWord = cache_name; @@ -744,7 +762,7 @@ impl ServerActions { // register action expression to the top-level, and return the bind // expression inline. if !bound_args.is_empty() { - let ref_ident = private_ident!(gen_ref_ident(&mut self.reference_index)); + let ref_ident = private_ident!(self.gen_ref_ident()); let ref_decl = VarDecl { span: DUMMY_SP, @@ -779,7 +797,7 @@ impl ServerActions { cache_type: &str, function: &mut Box, ) -> Box { - let cache_name: JsWord = gen_cache_ident(&mut self.reference_index); + let cache_name: JsWord = self.gen_cache_ident(); let cache_ident = private_ident!(cache_name.clone()); self.has_cache = true; @@ -919,7 +937,7 @@ impl ServerActions { // register action expression to the top-level, and return the bind // expression inline. if !bound_args.is_empty() { - let ref_ident = private_ident!(gen_ref_ident(&mut self.reference_index)); + let ref_ident = private_ident!(self.gen_ref_ident()); let ref_decl = VarDecl { span: DUMMY_SP, @@ -1555,11 +1573,8 @@ impl VisitMut for ServerActions { // Use the span from the function expression let span = f.function.span; - let new_ident = Ident::new( - gen_action_ident(&mut self.reference_index), - span, - self.private_ctxt, - ); + let new_ident = + Ident::new(self.gen_action_ident(), span, self.private_ctxt); f.ident = Some(new_ident.clone()); @@ -1581,11 +1596,8 @@ impl VisitMut for ServerActions { // Use the span of the arrow function let span = arrow.span; - let new_ident = Ident::new( - gen_action_ident(&mut self.reference_index), - span, - self.private_ctxt, - ); + let new_ident = + Ident::new(self.gen_action_ident(), span, self.private_ctxt); self.exported_idents .push((new_ident.clone(), "default".into())); @@ -1605,11 +1617,8 @@ impl VisitMut for ServerActions { // Determining a useful span here is tricky. let span = call.span; - let new_ident = Ident::new( - gen_action_ident(&mut self.reference_index), - span, - self.private_ctxt, - ); + let new_ident = + Ident::new(self.gen_action_ident(), span, self.private_ctxt); self.exported_idents .push((new_ident.clone(), "default".into())); @@ -2101,24 +2110,6 @@ fn retain_names_from_declared_idents( *child_names = retained_names; } -fn gen_action_ident(cnt: &mut u32) -> JsWord { - let id: JsWord = format!("$$RSC_SERVER_ACTION_{cnt}").into(); - *cnt += 1; - id -} - -fn gen_cache_ident(cnt: &mut u32) -> JsWord { - let id: JsWord = format!("$$RSC_SERVER_CACHE_{cnt}").into(); - *cnt += 1; - id -} - -fn gen_ref_ident(cnt: &mut u32) -> JsWord { - let id: JsWord = format!("$$RSC_SERVER_REF_{cnt}").into(); - *cnt += 1; - id -} - fn wrap_cache_expr(expr: Box, name: &str, id: &str) -> Box { // expr -> $$cache__("name", "id", expr) Box::new(Expr::Call(CallExpr { diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/client/5/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/client/5/output.js index 950dc47fddd36..6f99ff70a9d7e 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/client/5/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/client/5/output.js @@ -1,7 +1,2 @@ -<<<<<<< HEAD -/* __next_internal_action_entry_do_not_use__ {"7f0090eaf4e1f08a2d94f6be401e54a2ded399b87c":"action0","7f1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7f90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { createServerReference, callServer, findSourceMapURL } from "private-next-rsc-action-client-wrapper"; +/* __next_internal_action_entry_do_not_use__ {"7f0090eaf4e1f08a2d94f6be401e54a2ded399b87c":"action0"} */ import { createServerReference, callServer, findSourceMapURL } from "private-next-rsc-action-client-wrapper"; export var action0 = /*#__PURE__*/ createServerReference("7f0090eaf4e1f08a2d94f6be401e54a2ded399b87c", callServer, void 0, findSourceMapURL, "action0"); -======= -/* __next_internal_action_entry_do_not_use__ {"0090eaf4e1f08a2d94f6be401e54a2ded399b87c":"action0"} */ import { createServerReference, callServer, findSourceMapURL } from "private-next-rsc-action-client-wrapper"; -export var action0 = /*#__PURE__*/ createServerReference("0090eaf4e1f08a2d94f6be401e54a2ded399b87c", callServer, void 0, findSourceMapURL, "action0"); ->>>>>>> canary diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/client/7/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/client/7/output.js index 3d0b3a767238a..04213db961e9d 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/client/7/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/client/7/output.js @@ -1,2 +1,2 @@ -/* __next_internal_action_entry_do_not_use__ {"c18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default"} */ import { createServerReference, callServer, findSourceMapURL } from "private-next-rsc-action-client-wrapper"; -export default /*#__PURE__*/ createServerReference("c18c215a6b7cdc64bf709f3a714ffdef1bf9651d", callServer, void 0, findSourceMapURL, "default"); +/* __next_internal_action_entry_do_not_use__ {"7fc18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default"} */ import { createServerReference, callServer, findSourceMapURL } from "private-next-rsc-action-client-wrapper"; +export default /*#__PURE__*/ createServerReference("7fc18c215a6b7cdc64bf709f3a714ffdef1bf9651d", callServer, void 0, findSourceMapURL, "default"); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/client/8/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/client/8/output.js index aad83b202d0da..bce4e0b29e293 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/client/8/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/client/8/output.js @@ -1,2 +1,2 @@ -/* __next_internal_action_entry_do_not_use__ {"ac840dcaf5e8197cb02b7f3a43c119b7a770b272":"bar"} */ import { createServerReference, callServer, findSourceMapURL } from "private-next-rsc-action-client-wrapper"; -export var bar = /*#__PURE__*/ createServerReference("ac840dcaf5e8197cb02b7f3a43c119b7a770b272", callServer, void 0, findSourceMapURL, "bar"); +/* __next_internal_action_entry_do_not_use__ {"7fac840dcaf5e8197cb02b7f3a43c119b7a770b272":"bar"} */ import { createServerReference, callServer, findSourceMapURL } from "private-next-rsc-action-client-wrapper"; +export var bar = /*#__PURE__*/ createServerReference("7fac840dcaf5e8197cb02b7f3a43c119b7a770b272", callServer, void 0, findSourceMapURL, "bar"); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/1/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/1/output.js index 8ed0dcb4eb5d0..ef34367ebf286 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/1/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/1/output.js @@ -2,7 +2,7 @@ import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import deleteFromDb from 'db'; export const $$RSC_SERVER_ACTION_0 = async function deleteItem($$ACTION_CLOSURE_BOUND) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); await deleteFromDb($$ACTION_ARG_0); await deleteFromDb($$ACTION_ARG_1); }; @@ -13,19 +13,11 @@ export function Item({ id1, id2 }) { ])); return ; } -<<<<<<< HEAD -export async function $$RSC_SERVER_ACTION_0($$ACTION_CLOSURE_BOUND) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); - await deleteFromDb($$ACTION_ARG_0); - await deleteFromDb($$ACTION_ARG_1); -} -======= export const $$RSC_SERVER_ACTION_1 = async function action($$ACTION_CLOSURE_BOUND) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("90b5db271335765a4b0eab01f044b381b5ebd5cd", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("0090b5db271335765a4b0eab01f044b381b5ebd5cd", $$ACTION_CLOSURE_BOUND); console.log($$ACTION_ARG_0); console.log($$ACTION_ARG_1); }; ->>>>>>> canary export default function Home() { const info = { name: 'John', @@ -37,11 +29,3 @@ export default function Home() { ])); return null; } -<<<<<<< HEAD -export async function $$RSC_SERVER_ACTION_1($$ACTION_CLOSURE_BOUND) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("0090b5db271335765a4b0eab01f044b381b5ebd5cd", $$ACTION_CLOSURE_BOUND); - console.log($$ACTION_ARG_0); - console.log($$ACTION_ARG_1); -} -======= ->>>>>>> canary diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/15/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/15/output.js index f3bba55f931f2..69cf76f35caaa 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/15/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/15/output.js @@ -1,14 +1,6 @@ -<<<<<<< HEAD -/* __next_internal_action_entry_do_not_use__ {"7f90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","7fc18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default"} */ import { registerServerReference } from "private-next-rsc-server-reference"; -import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; -export default $$RSC_SERVER_ACTION_0 = registerServerReference($$RSC_SERVER_ACTION_1, "6090b5db271335765a4b0eab01f044b381b5ebd5cd", null); -var $$RSC_SERVER_ACTION_0; -export async function $$RSC_SERVER_ACTION_1(a, b) { -======= -/* __next_internal_action_entry_do_not_use__ {"c18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7fc18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; export default $$RSC_SERVER_ACTION_0 = async (a, b)=>{ ->>>>>>> canary console.log(a, b); }; var $$RSC_SERVER_ACTION_0; diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/16/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/16/output.js index 152fd617fa777..138a117224642 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/16/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/16/output.js @@ -3,7 +3,7 @@ import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc import deleteFromDb from 'db'; const v1 = 'v1'; export const $$RSC_SERVER_ACTION_0 = async function deleteItem($$ACTION_CLOSURE_BOUND) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); await deleteFromDb($$ACTION_ARG_0); await deleteFromDb(v1); await deleteFromDb($$ACTION_ARG_1); @@ -16,31 +16,17 @@ export function Item({ id1, id2 }) { ])); return ; } -<<<<<<< HEAD -export async function $$RSC_SERVER_ACTION_0($$ACTION_CLOSURE_BOUND) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); - await deleteFromDb($$ACTION_ARG_0); - await deleteFromDb(v1); - await deleteFromDb($$ACTION_ARG_1); -} -======= export const $$RSC_SERVER_ACTION_1 = async function g($$ACTION_CLOSURE_BOUND, y, ...z) { - var [$$ACTION_ARG_0] = await decryptActionBoundArgs("90b5db271335765a4b0eab01f044b381b5ebd5cd", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0] = await decryptActionBoundArgs("7f90b5db271335765a4b0eab01f044b381b5ebd5cd", $$ACTION_CLOSURE_BOUND); return $$ACTION_ARG_0 + y + z[0]; }; ->>>>>>> canary const f = (x)=>{ var g = registerServerReference($$RSC_SERVER_ACTION_1, "7f90b5db271335765a4b0eab01f044b381b5ebd5cd", null).bind(null, encryptActionBoundArgs("7f90b5db271335765a4b0eab01f044b381b5ebd5cd", [ x ])); }; -<<<<<<< HEAD -export async function $$RSC_SERVER_ACTION_1($$ACTION_CLOSURE_BOUND, y, ...z) { - var [$$ACTION_ARG_0] = await decryptActionBoundArgs("7f90b5db271335765a4b0eab01f044b381b5ebd5cd", $$ACTION_CLOSURE_BOUND); -======= export const $$RSC_SERVER_ACTION_2 = async function f($$ACTION_CLOSURE_BOUND, y, ...z) { - var [$$ACTION_ARG_0] = await decryptActionBoundArgs("1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", $$ACTION_CLOSURE_BOUND); ->>>>>>> canary + var [$$ACTION_ARG_0] = await decryptActionBoundArgs("7f1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", $$ACTION_CLOSURE_BOUND); return $$ACTION_ARG_0 + y + z[0]; }; const g = (x)=>{ @@ -48,10 +34,3 @@ const g = (x)=>{ x ])); }; -<<<<<<< HEAD -export async function $$RSC_SERVER_ACTION_2($$ACTION_CLOSURE_BOUND, y, ...z) { - var [$$ACTION_ARG_0] = await decryptActionBoundArgs("7f1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", $$ACTION_CLOSURE_BOUND); - return $$ACTION_ARG_0 + y + z[0]; -} -======= ->>>>>>> canary diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/17/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/17/output.js index b97e054763560..e4b74ac605501 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/17/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/17/output.js @@ -1,13 +1,6 @@ -<<<<<<< HEAD -/* __next_internal_action_entry_do_not_use__ {"7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7fab21efdafbe611287bc25c0462b1e0510d13e48b":"foo","7fac840dcaf5e8197cb02b7f3a43c119b7a770b272":"bar"} */ import { registerServerReference } from "private-next-rsc-server-reference"; -import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; -export const foo = registerServerReference($$RSC_SERVER_ACTION_0, "006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null); -export async function $$RSC_SERVER_ACTION_0() {} -======= -/* __next_internal_action_entry_do_not_use__ {"ab21efdafbe611287bc25c0462b1e0510d13e48b":"foo","ac840dcaf5e8197cb02b7f3a43c119b7a770b272":"bar"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7fab21efdafbe611287bc25c0462b1e0510d13e48b":"foo","7fac840dcaf5e8197cb02b7f3a43c119b7a770b272":"bar"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; export const foo = async ()=>{}; ->>>>>>> canary const bar = async ()=>{}; export { bar }; import { ensureServerEntryExports } from "private-next-rsc-action-validate"; diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/18/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/18/output.js index 5272a1863c83c..b8da0056cd80d 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/18/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/18/output.js @@ -1,19 +1,15 @@ -<<<<<<< HEAD -/* __next_internal_action_entry_do_not_use__ {"7f1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; -======= -/* __next_internal_action_entry_do_not_use__ {"6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; ->>>>>>> canary +/* __next_internal_action_entry_do_not_use__ {"7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7f90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import deleteFromDb from 'db'; const v1 = 'v1'; export const $$RSC_SERVER_ACTION_0 = async function action($$ACTION_CLOSURE_BOUND) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); await deleteFromDb($$ACTION_ARG_0); await deleteFromDb(v1); await deleteFromDb($$ACTION_ARG_1); }; export const $$RSC_SERVER_ACTION_1 = async function action($$ACTION_CLOSURE_BOUND) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("90b5db271335765a4b0eab01f044b381b5ebd5cd", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("0090b5db271335765a4b0eab01f044b381b5ebd5cd", $$ACTION_CLOSURE_BOUND); await deleteFromDb($$ACTION_ARG_0); await deleteFromDb(v1); await deleteFromDb($$ACTION_ARG_1); @@ -27,11 +23,7 @@ export function Item({ id1, id2 }) { ]))}> Delete -<<<<<<< HEAD - ; } -<<<<<<< HEAD -export async function $$RSC_SERVER_ACTION_0($$ACTION_CLOSURE_BOUND) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); - await deleteFromDb($$ACTION_ARG_0); - await deleteFromDb(v1); - await deleteFromDb($$ACTION_ARG_1); -} -export async function $$RSC_SERVER_ACTION_2($$ACTION_CLOSURE_BOUND) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("001c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", $$ACTION_CLOSURE_BOUND); - await deleteFromDb($$ACTION_ARG_0); - await deleteFromDb(v1); - await deleteFromDb($$ACTION_ARG_1); -} -======= ->>>>>>> canary diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/19/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/19/output.js index b683e0962d845..46e72233fec3b 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/19/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/19/output.js @@ -1,7 +1,7 @@ /* __next_internal_action_entry_do_not_use__ {"7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$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 action($$ACTION_CLOSURE_BOUND, value2) { - var [$$ACTION_ARG_0] = await decryptActionBoundArgs("6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0] = await decryptActionBoundArgs("406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); return $$ACTION_ARG_0 * value2; }; export function Item({ value }) { @@ -13,10 +13,3 @@ export function Item({ value }) { ; } -<<<<<<< HEAD -export async function $$RSC_SERVER_ACTION_0($$ACTION_CLOSURE_BOUND, value2) { - var [$$ACTION_ARG_0] = await decryptActionBoundArgs("406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); - return $$ACTION_ARG_0 * value2; -} -======= ->>>>>>> canary diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/2/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/2/output.js index 808aed18f1a05..95f6c8afe1f7f 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/2/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/2/output.js @@ -1,22 +1,12 @@ /* __next_internal_action_entry_do_not_use__ {"7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7f90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; -<<<<<<< HEAD -var myAction = registerServerReference($$RSC_SERVER_ACTION_0, "706a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null); -export async function $$RSC_SERVER_ACTION_0(a, b, c) { -======= export const $$RSC_SERVER_ACTION_0 = async function myAction(a, b, c) { ->>>>>>> canary console.log('a'); }; -var myAction = registerServerReference($$RSC_SERVER_ACTION_0, "6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null); +var myAction = registerServerReference($$RSC_SERVER_ACTION_0, "706a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null); export default function Page() { return ; } -<<<<<<< HEAD -export const action = withValidate(registerServerReference($$RSC_SERVER_ACTION_1, "0090b5db271335765a4b0eab01f044b381b5ebd5cd", null)); -export async function $$RSC_SERVER_ACTION_1() {} -======= export const $$RSC_SERVER_ACTION_1 = async function() {}; // TODO: should use `action` as function name? -export const action = withValidate(registerServerReference($$RSC_SERVER_ACTION_1, "90b5db271335765a4b0eab01f044b381b5ebd5cd", null)); ->>>>>>> canary +export const action = withValidate(registerServerReference($$RSC_SERVER_ACTION_1, "0090b5db271335765a4b0eab01f044b381b5ebd5cd", null)); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/21/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/21/output.js index 1426ce5cd9d33..61ae0d6cdb76c 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/21/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/21/output.js @@ -1,38 +1,19 @@ -<<<<<<< HEAD -/* __next_internal_action_entry_do_not_use__ {"7f1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","7f90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","7f9ed0cc47abc4e1c64320cf42b74ae60b58c40f00":"$$RSC_SERVER_ACTION_3"} */ import { registerServerReference } from "private-next-rsc-server-reference"; -======= -/* __next_internal_action_entry_do_not_use__ {"1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; ->>>>>>> canary +/* __next_internal_action_entry_do_not_use__ {"7f1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7f90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { validator, another } from 'auth'; const x = 1; export const $$RSC_SERVER_ACTION_0 = async function($$ACTION_CLOSURE_BOUND, z) { - var [$$ACTION_ARG_0] = await decryptActionBoundArgs("6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0] = await decryptActionBoundArgs("406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); return x + $$ACTION_ARG_0 + z; }; export default function Page() { const y = 1; -<<<<<<< HEAD - return ; -} -export async function $$RSC_SERVER_ACTION_1($$ACTION_CLOSURE_BOUND, z) { - var [$$ACTION_ARG_0] = await decryptActionBoundArgs("4090b5db271335765a4b0eab01f044b381b5ebd5cd", $$ACTION_CLOSURE_BOUND); - return x + $$ACTION_ARG_0 + z; -} -validator(registerServerReference($$RSC_SERVER_ACTION_2, "001c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", null)); -export async function $$RSC_SERVER_ACTION_2() {} -another(validator(registerServerReference($$RSC_SERVER_ACTION_3, "009ed0cc47abc4e1c64320cf42b74ae60b58c40f00", null))); -export async function $$RSC_SERVER_ACTION_3() {} -======= return ; } export const $$RSC_SERVER_ACTION_1 = async function() {}; -validator(registerServerReference($$RSC_SERVER_ACTION_1, "90b5db271335765a4b0eab01f044b381b5ebd5cd", null)); +validator(registerServerReference($$RSC_SERVER_ACTION_1, "0090b5db271335765a4b0eab01f044b381b5ebd5cd", null)); export const $$RSC_SERVER_ACTION_2 = async function() {}; -another(validator(registerServerReference($$RSC_SERVER_ACTION_2, "1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", null))); ->>>>>>> canary +another(validator(registerServerReference($$RSC_SERVER_ACTION_2, "001c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", null))); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/22/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/22/output.js index 37ec5a6640eea..704ca8386ddda 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/22/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/22/output.js @@ -1,14 +1,4 @@ -<<<<<<< HEAD -/* __next_internal_action_entry_do_not_use__ {"7f1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7fc18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default","7ff14702b5a021dd117f7ec7a3c838f397c2046d3b":"action"} */ import { registerServerReference } from "private-next-rsc-server-reference"; -import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; -import { validator } from 'auth'; -export const action = validator(registerServerReference($$RSC_SERVER_ACTION_0, "006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null)); -export async function $$RSC_SERVER_ACTION_0() {} -export default $$RSC_SERVER_ACTION_1 = validator(registerServerReference($$RSC_SERVER_ACTION_2, "001c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", null)); -var $$RSC_SERVER_ACTION_1; -export async function $$RSC_SERVER_ACTION_2() {} -======= -/* __next_internal_action_entry_do_not_use__ {"c18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default","f14702b5a021dd117f7ec7a3c838f397c2046d3b":"action"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7fc18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default","7ff14702b5a021dd117f7ec7a3c838f397c2046d3b":"action"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { validator } from 'auth'; export const action = validator(async ()=>{}); @@ -18,16 +8,10 @@ Object.defineProperty($$RSC_SERVER_ACTION_0, "name", { "value": "default", "writable": false }); ->>>>>>> canary import { ensureServerEntryExports } from "private-next-rsc-action-validate"; ensureServerEntryExports([ action, $$RSC_SERVER_ACTION_0 ]); -<<<<<<< HEAD registerServerReference(action, "fff14702b5a021dd117f7ec7a3c838f397c2046d3b", null); -registerServerReference($$RSC_SERVER_ACTION_1, "ffc18c215a6b7cdc64bf709f3a714ffdef1bf9651d", null); -======= -registerServerReference(action, "f14702b5a021dd117f7ec7a3c838f397c2046d3b", null); -registerServerReference($$RSC_SERVER_ACTION_0, "c18c215a6b7cdc64bf709f3a714ffdef1bf9651d", null); ->>>>>>> canary +registerServerReference($$RSC_SERVER_ACTION_0, "ffc18c215a6b7cdc64bf709f3a714ffdef1bf9651d", null); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/23/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/23/output.js index f2883ee7ec5fe..e350fba5d4e5e 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/23/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/23/output.js @@ -1,11 +1,11 @@ /* __next_internal_action_entry_do_not_use__ {"7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7f90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ 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 action($$ACTION_CLOSURE_BOUND, a, b, c, d) { - var [$$ACTION_ARG_0] = await decryptActionBoundArgs("6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0] = await decryptActionBoundArgs("786a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); console.log(a, b, $$ACTION_ARG_0, c, d); }; export const $$RSC_SERVER_ACTION_1 = async function action2($$ACTION_CLOSURE_BOUND, a, b, c, d) { - var [$$ACTION_ARG_0] = await decryptActionBoundArgs("90b5db271335765a4b0eab01f044b381b5ebd5cd", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0] = await decryptActionBoundArgs("7890b5db271335765a4b0eab01f044b381b5ebd5cd", $$ACTION_CLOSURE_BOUND); console.log(a, b, $$ACTION_ARG_0, c, d); }; export default function Page({ foo, x, y }) { @@ -13,23 +13,8 @@ export default function Page({ foo, x, y }) { x ])); action.bind(null, foo[0], foo[1], foo.x, foo[y]); -<<<<<<< HEAD const action2 = registerServerReference($$RSC_SERVER_ACTION_1, "7890b5db271335765a4b0eab01f044b381b5ebd5cd", null).bind(null, encryptActionBoundArgs("7890b5db271335765a4b0eab01f044b381b5ebd5cd", [ -======= - const action2 = registerServerReference($$RSC_SERVER_ACTION_1, "90b5db271335765a4b0eab01f044b381b5ebd5cd", null).bind(null, encryptActionBoundArgs("90b5db271335765a4b0eab01f044b381b5ebd5cd", [ ->>>>>>> canary x ])); action2.bind(null, foo[0], foo[1], foo.x, foo[y]); } -<<<<<<< HEAD -export async function $$RSC_SERVER_ACTION_0($$ACTION_CLOSURE_BOUND, a, b, c, d) { - var [$$ACTION_ARG_0] = await decryptActionBoundArgs("786a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); - console.log(a, b, $$ACTION_ARG_0, c, d); -} -export async function $$RSC_SERVER_ACTION_1($$ACTION_CLOSURE_BOUND, a, b, c, d) { - var [$$ACTION_ARG_0] = await decryptActionBoundArgs("7890b5db271335765a4b0eab01f044b381b5ebd5cd", $$ACTION_CLOSURE_BOUND); - console.log(a, b, $$ACTION_ARG_0, c, d); -} -======= ->>>>>>> canary diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/24/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/24/output.js index 342ddc3a6c20b..1425f367372e6 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/24/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/24/output.js @@ -1,7 +1,7 @@ /* __next_internal_action_entry_do_not_use__ {"7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$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 action($$ACTION_CLOSURE_BOUND, a, b, c, { d }) { - var [$$ACTION_ARG_0] = await decryptActionBoundArgs("6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0] = await decryptActionBoundArgs("786a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); console.log(a, b, $$ACTION_ARG_0, d); }; export default function Page({ foo, x, y }) { @@ -9,10 +9,3 @@ export default function Page({ foo, x, y }) { foo ])); } -<<<<<<< HEAD -export async function $$RSC_SERVER_ACTION_0($$ACTION_CLOSURE_BOUND, a, b, c, { d }) { - var [$$ACTION_ARG_0] = await decryptActionBoundArgs("786a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); - console.log(a, b, $$ACTION_ARG_0, d); -} -======= ->>>>>>> canary diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/25/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/25/output.js index ce9dabd0f72a9..8259aa6d290de 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/25/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/25/output.js @@ -2,7 +2,7 @@ import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import deleteFromDb from 'db'; export const $$RSC_SERVER_ACTION_0 = async function deleteItem($$ACTION_CLOSURE_BOUND) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); await deleteFromDb($$ACTION_ARG_0); await deleteFromDb($$ACTION_ARG_1); }; @@ -17,13 +17,8 @@ export function Item({ id1, id2 }) { id2 ])); } -<<<<<<< HEAD -export async function $$RSC_SERVER_ACTION_0($$ACTION_CLOSURE_BOUND) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); -======= export const $$RSC_SERVER_ACTION_1 = async function deleteItem($$ACTION_CLOSURE_BOUND) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("90b5db271335765a4b0eab01f044b381b5ebd5cd", $$ACTION_CLOSURE_BOUND); ->>>>>>> canary + var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("0090b5db271335765a4b0eab01f044b381b5ebd5cd", $$ACTION_CLOSURE_BOUND); await deleteFromDb($$ACTION_ARG_0); await deleteFromDb($$ACTION_ARG_1); }; @@ -41,11 +36,3 @@ export function Item2({ id1, id2 }) { id2 ])); } -<<<<<<< HEAD -export async function $$RSC_SERVER_ACTION_1($$ACTION_CLOSURE_BOUND) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("0090b5db271335765a4b0eab01f044b381b5ebd5cd", $$ACTION_CLOSURE_BOUND); - await deleteFromDb($$ACTION_ARG_0); - await deleteFromDb($$ACTION_ARG_1); -} -======= ->>>>>>> canary diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/26/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/26/output.js index b339c9a28e91a..05d5b504d5ff7 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/26/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/26/output.js @@ -1,13 +1,8 @@ /* __next_internal_action_entry_do_not_use__ {"7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; const noop = (action)=>action; -<<<<<<< HEAD -export const log = noop(registerServerReference($$RSC_SERVER_ACTION_0, "406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null)); -export async function $$RSC_SERVER_ACTION_0(data) { -======= export const $$RSC_SERVER_ACTION_0 = async function(data) { ->>>>>>> canary console.log(data); }; // TODO: should use `log` as function name? -export const log = noop(registerServerReference($$RSC_SERVER_ACTION_0, "6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null)); +export const log = noop(registerServerReference($$RSC_SERVER_ACTION_0, "406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null)); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/27/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/27/output.js index 930a173a03775..1c701e9e239a6 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/27/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/27/output.js @@ -3,46 +3,24 @@ // 2. Actual action functions should be renamed to `$$ACTION_...` and got exported. /* __next_internal_action_entry_do_not_use__ {"7f1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7f90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","7f9ed0cc47abc4e1c64320cf42b74ae60b58c40f00":"$$RSC_SERVER_ACTION_3","7fa9b2939c1f39073a6bed227fd20233064c8b7869":"$$RSC_SERVER_ACTION_4"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; -<<<<<<< HEAD -var foo = registerServerReference($$RSC_SERVER_ACTION_0, "006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null); -export async function $$RSC_SERVER_ACTION_0() { -======= export const $$RSC_SERVER_ACTION_0 = async function foo() { ->>>>>>> canary console.log(1); }; -var foo = registerServerReference($$RSC_SERVER_ACTION_0, "6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null); +var foo = registerServerReference($$RSC_SERVER_ACTION_0, "006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null); export { foo }; -<<<<<<< HEAD -export var bar = registerServerReference($$RSC_SERVER_ACTION_1, "0090b5db271335765a4b0eab01f044b381b5ebd5cd", null); -export async function $$RSC_SERVER_ACTION_1() { - console.log(2); -} -export default registerServerReference($$RSC_SERVER_ACTION_2, "001c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", null); -export async function $$RSC_SERVER_ACTION_2() { - console.log(3); -} -export const qux = registerServerReference($$RSC_SERVER_ACTION_3, "009ed0cc47abc4e1c64320cf42b74ae60b58c40f00", null); -export async function $$RSC_SERVER_ACTION_3() { - console.log(4); -} -export const quux = registerServerReference($$RSC_SERVER_ACTION_4, "00a9b2939c1f39073a6bed227fd20233064c8b7869", null); -export async function $$RSC_SERVER_ACTION_4() { -======= export const $$RSC_SERVER_ACTION_1 = async function bar() { console.log(2); }; -export var bar = registerServerReference($$RSC_SERVER_ACTION_1, "90b5db271335765a4b0eab01f044b381b5ebd5cd", null); +export var bar = registerServerReference($$RSC_SERVER_ACTION_1, "0090b5db271335765a4b0eab01f044b381b5ebd5cd", null); export const $$RSC_SERVER_ACTION_2 = async function baz() { console.log(3); }; -export default registerServerReference($$RSC_SERVER_ACTION_2, "1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", null); +export default registerServerReference($$RSC_SERVER_ACTION_2, "001c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", null); export const $$RSC_SERVER_ACTION_3 = async function qux() { console.log(4); }; -export const qux = registerServerReference($$RSC_SERVER_ACTION_3, "9ed0cc47abc4e1c64320cf42b74ae60b58c40f00", null); +export const qux = registerServerReference($$RSC_SERVER_ACTION_3, "009ed0cc47abc4e1c64320cf42b74ae60b58c40f00", null); export const $$RSC_SERVER_ACTION_4 = async function quuux() { ->>>>>>> canary console.log(5); }; -export const quux = registerServerReference($$RSC_SERVER_ACTION_4, "a9b2939c1f39073a6bed227fd20233064c8b7869", null); +export const quux = registerServerReference($$RSC_SERVER_ACTION_4, "00a9b2939c1f39073a6bed227fd20233064c8b7869", null); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/28/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/28/output.js index e32652e51169c..83d8e194a353a 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/28/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/28/output.js @@ -1,38 +1,17 @@ /* __next_internal_action_entry_do_not_use__ {"7f1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7f90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; let a, f; -<<<<<<< HEAD -function Comp(b, c, ...g) { - return registerServerReference($$RSC_SERVER_ACTION_2, "401c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", null).bind(null, encryptActionBoundArgs("401c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", [ - b, - c, - g - ])); -} -export async function $$RSC_SERVER_ACTION_0($$ACTION_CLOSURE_BOUND, e) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2, $$ACTION_ARG_3] = await decryptActionBoundArgs("406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); - console.log(a, $$ACTION_ARG_0, $$ACTION_ARG_1, e, $$ACTION_ARG_2, $$ACTION_ARG_3); -} -export async function $$RSC_SERVER_ACTION_1($$ACTION_CLOSURE_BOUND, e) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("4090b5db271335765a4b0eab01f044b381b5ebd5cd", $$ACTION_CLOSURE_BOUND); - $$ACTION_ARG_0(e); - console.log(a, $$ACTION_ARG_1, $$ACTION_ARG_2, e); -} -export async function $$RSC_SERVER_ACTION_2($$ACTION_CLOSURE_BOUND, d) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("401c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", $$ACTION_CLOSURE_BOUND); -======= export const $$RSC_SERVER_ACTION_0 = async function action2($$ACTION_CLOSURE_BOUND, e) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2, $$ACTION_ARG_3] = await decryptActionBoundArgs("6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2, $$ACTION_ARG_3] = await decryptActionBoundArgs("406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); console.log(a, $$ACTION_ARG_0, $$ACTION_ARG_1, e, $$ACTION_ARG_2, $$ACTION_ARG_3); }; export const $$RSC_SERVER_ACTION_1 = async function action3($$ACTION_CLOSURE_BOUND, e) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("90b5db271335765a4b0eab01f044b381b5ebd5cd", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("4090b5db271335765a4b0eab01f044b381b5ebd5cd", $$ACTION_CLOSURE_BOUND); $$ACTION_ARG_0(e); console.log(a, $$ACTION_ARG_1, $$ACTION_ARG_2, e); }; export const $$RSC_SERVER_ACTION_2 = async function action1($$ACTION_CLOSURE_BOUND, d) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", $$ACTION_CLOSURE_BOUND); ->>>>>>> canary + var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("401c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", $$ACTION_CLOSURE_BOUND); let f; console.log(...window, { window @@ -54,7 +33,7 @@ export const $$RSC_SERVER_ACTION_2 = async function action1($$ACTION_CLOSURE_BOU ]; }; function Comp(b, c, ...g) { - return registerServerReference($$RSC_SERVER_ACTION_2, "1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", null).bind(null, encryptActionBoundArgs("1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", [ + return registerServerReference($$RSC_SERVER_ACTION_2, "401c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", null).bind(null, encryptActionBoundArgs("401c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", [ b, c, g diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/29/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/29/output.js index fc0f74b5095e1..f73f282415a82 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/29/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/29/output.js @@ -1,13 +1,6 @@ -<<<<<<< HEAD -/* __next_internal_action_entry_do_not_use__ {"7f28baf972d345b86b747ad0df73d75a0088a42214":"dec","7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7fc18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default"} */ import { registerServerReference } from "private-next-rsc-server-reference"; -import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; -export const dec = registerServerReference($$RSC_SERVER_ACTION_0, "406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null); -export async function $$RSC_SERVER_ACTION_0(value) { -======= -/* __next_internal_action_entry_do_not_use__ {"28baf972d345b86b747ad0df73d75a0088a42214":"dec","c18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7f28baf972d345b86b747ad0df73d75a0088a42214":"dec","7fc18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; export const dec = async (value)=>{ ->>>>>>> canary return value - 1; }; // Test case for https://github.com/vercel/next.js/issues/54655 diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/30/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/30/output.js index 2b11fde79f542..a4bdd1d8e39c7 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/30/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/30/output.js @@ -1,38 +1,17 @@ /* __next_internal_action_entry_do_not_use__ {"7f0090eaf4e1f08a2d94f6be401e54a2ded399b87c":"action0","7f1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7f90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; let a, f; -<<<<<<< HEAD -export async function action0(b, c, ...g) { - return registerServerReference($$RSC_SERVER_ACTION_2, "401c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", null).bind(null, encryptActionBoundArgs("401c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", [ - b, - c, - g - ])); -} -export async function $$RSC_SERVER_ACTION_0($$ACTION_CLOSURE_BOUND, e) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2, $$ACTION_ARG_3] = await decryptActionBoundArgs("406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); - console.log(a, $$ACTION_ARG_0, $$ACTION_ARG_1, e, $$ACTION_ARG_2, $$ACTION_ARG_3); -} -export async function $$RSC_SERVER_ACTION_1($$ACTION_CLOSURE_BOUND, e) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("4090b5db271335765a4b0eab01f044b381b5ebd5cd", $$ACTION_CLOSURE_BOUND); - $$ACTION_ARG_0(e); - console.log(a, $$ACTION_ARG_1, $$ACTION_ARG_2, e); -} -export async function $$RSC_SERVER_ACTION_2($$ACTION_CLOSURE_BOUND, d) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("401c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", $$ACTION_CLOSURE_BOUND); -======= export const $$RSC_SERVER_ACTION_0 = async function action2($$ACTION_CLOSURE_BOUND, e) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2, $$ACTION_ARG_3] = await decryptActionBoundArgs("6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2, $$ACTION_ARG_3] = await decryptActionBoundArgs("406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); console.log(a, $$ACTION_ARG_0, $$ACTION_ARG_1, e, $$ACTION_ARG_2, $$ACTION_ARG_3); }; export const $$RSC_SERVER_ACTION_1 = async function action3($$ACTION_CLOSURE_BOUND, e) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("90b5db271335765a4b0eab01f044b381b5ebd5cd", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("4090b5db271335765a4b0eab01f044b381b5ebd5cd", $$ACTION_CLOSURE_BOUND); $$ACTION_ARG_0(e); console.log(a, $$ACTION_ARG_1, $$ACTION_ARG_2, e); }; export const $$RSC_SERVER_ACTION_2 = async function action1($$ACTION_CLOSURE_BOUND, d) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", $$ACTION_CLOSURE_BOUND); ->>>>>>> canary + var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("401c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", $$ACTION_CLOSURE_BOUND); let f; console.log(...window, { window @@ -54,7 +33,7 @@ export const $$RSC_SERVER_ACTION_2 = async function action1($$ACTION_CLOSURE_BOU ]; }; export async function action0(b, c, ...g) { - return registerServerReference($$RSC_SERVER_ACTION_2, "1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", null).bind(null, encryptActionBoundArgs("1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", [ + return registerServerReference($$RSC_SERVER_ACTION_2, "401c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", null).bind(null, encryptActionBoundArgs("401c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", [ b, c, g diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/32/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/32/output.js index b22cff19ca3fa..60cfcd957a31d 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/32/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/32/output.js @@ -1,7 +1,7 @@ /* __next_internal_action_entry_do_not_use__ {"7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$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 action($$ACTION_CLOSURE_BOUND) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); console.log($$ACTION_ARG_0.at(1), $$ACTION_ARG_1, $$ACTION_ARG_1.current); console.log($$ACTION_ARG_2.push.call($$ACTION_ARG_2, 5)); }; @@ -28,11 +28,3 @@ export function Component() { ])); return
; } -<<<<<<< HEAD -export async function $$RSC_SERVER_ACTION_0($$ACTION_CLOSURE_BOUND) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); - console.log($$ACTION_ARG_0.at(1), $$ACTION_ARG_1, $$ACTION_ARG_1.current); - console.log($$ACTION_ARG_2.push.call($$ACTION_ARG_2, 5)); -} -======= ->>>>>>> canary diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/33/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/33/output.js index f5b281f850ec6..3a6e7d58e76ba 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/33/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/33/output.js @@ -5,15 +5,11 @@ const v = 'world'; export var $$RSC_SERVER_CACHE_0 = $$cache__("default", "803128060c414d59f8552e4788b846c0d2b7f74743", async function fn() { return 'hello, ' + v; }); -<<<<<<< HEAD -var fn = registerServerReference($$RSC_SERVER_CACHE_0, "803128060c414d59f8552e4788b846c0d2b7f74743", null); -======= Object.defineProperty($$RSC_SERVER_CACHE_0, "name", { "value": "fn", "writable": false }); -var fn = registerServerReference($$RSC_SERVER_CACHE_0, "3128060c414d59f8552e4788b846c0d2b7f74743", null); ->>>>>>> canary +var fn = registerServerReference($$RSC_SERVER_CACHE_0, "803128060c414d59f8552e4788b846c0d2b7f74743", null); export async function Component() { const data = await fn(); return
{data}
; diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/34/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/34/output.js index b1098a5dcf1da..24c73d3f8322e 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/34/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/34/output.js @@ -1,52 +1,42 @@ -<<<<<<< HEAD -/* __next_internal_action_entry_do_not_use__ {"7f3128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0","7f951c375b4a6a6e89d67b743ec5808127cfde405d":"$$RSC_SERVER_CACHE_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7f12a8d21b6362b4cc8f5b15560525095bc48dba80":"$$RSC_SERVER_CACHE_3","7f3128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0","7f69348c79fce073bae2f70f139565a2fda1c74c74":"$$RSC_SERVER_CACHE_2","7f951c375b4a6a6e89d67b743ec5808127cfde405d":"$$RSC_SERVER_CACHE_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; -export var $$RSC_SERVER_CACHE_0 = $$cache__("default", "803128060c414d59f8552e4788b846c0d2b7f74743", async function foo() {}); -export var foo = registerServerReference($$RSC_SERVER_CACHE_0, "803128060c414d59f8552e4788b846c0d2b7f74743", null); -export var $$RSC_SERVER_CACHE_1 = $$cache__("default", "80951c375b4a6a6e89d67b743ec5808127cfde405d", async function() {}); -const bar = registerServerReference($$RSC_SERVER_CACHE_1, "80951c375b4a6a6e89d67b743ec5808127cfde405d", null); -======= -/* __next_internal_action_entry_do_not_use__ {"12a8d21b6362b4cc8f5b15560525095bc48dba80":"$$RSC_SERVER_CACHE_3","3128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0","69348c79fce073bae2f70f139565a2fda1c74c74":"$$RSC_SERVER_CACHE_2","951c375b4a6a6e89d67b743ec5808127cfde405d":"$$RSC_SERVER_CACHE_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; -import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; -import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; -export var $$RSC_SERVER_CACHE_0 = $$cache__("default", "3128060c414d59f8552e4788b846c0d2b7f74743", async function() { +export var $$RSC_SERVER_CACHE_0 = $$cache__("default", "803128060c414d59f8552e4788b846c0d2b7f74743", async function() { return 'foo'; }); Object.defineProperty($$RSC_SERVER_CACHE_0, "name", { "value": "foo", "writable": false }); -const foo = registerServerReference($$RSC_SERVER_CACHE_0, "3128060c414d59f8552e4788b846c0d2b7f74743", null); ->>>>>>> canary +const foo = registerServerReference($$RSC_SERVER_CACHE_0, "803128060c414d59f8552e4788b846c0d2b7f74743", null); export { bar }; -export var $$RSC_SERVER_CACHE_1 = $$cache__("default", "951c375b4a6a6e89d67b743ec5808127cfde405d", async function bar() { +export var $$RSC_SERVER_CACHE_1 = $$cache__("default", "80951c375b4a6a6e89d67b743ec5808127cfde405d", async function bar() { return 'bar'; }); Object.defineProperty($$RSC_SERVER_CACHE_1, "name", { "value": "bar", "writable": false }); -var bar = registerServerReference($$RSC_SERVER_CACHE_1, "951c375b4a6a6e89d67b743ec5808127cfde405d", null); +var bar = registerServerReference($$RSC_SERVER_CACHE_1, "80951c375b4a6a6e89d67b743ec5808127cfde405d", null); // Should not be wrapped in $$cache__. const qux = async function qux() { return 'qux'; }; -export var $$RSC_SERVER_CACHE_2 = $$cache__("default", "69348c79fce073bae2f70f139565a2fda1c74c74", async function baz() { +export var $$RSC_SERVER_CACHE_2 = $$cache__("default", "8069348c79fce073bae2f70f139565a2fda1c74c74", async function baz() { return qux() + 'baz'; }); Object.defineProperty($$RSC_SERVER_CACHE_2, "name", { "value": "baz", "writable": false }); -const baz = registerServerReference($$RSC_SERVER_CACHE_2, "69348c79fce073bae2f70f139565a2fda1c74c74", null); -export var $$RSC_SERVER_CACHE_3 = $$cache__("default", "12a8d21b6362b4cc8f5b15560525095bc48dba80", async function() { +const baz = registerServerReference($$RSC_SERVER_CACHE_2, "8069348c79fce073bae2f70f139565a2fda1c74c74", null); +export var $$RSC_SERVER_CACHE_3 = $$cache__("default", "8012a8d21b6362b4cc8f5b15560525095bc48dba80", async function() { return 'quux'; }); Object.defineProperty($$RSC_SERVER_CACHE_3, "name", { "value": "quux", "writable": false }); -const quux = registerServerReference($$RSC_SERVER_CACHE_3, "12a8d21b6362b4cc8f5b15560525095bc48dba80", null); +const quux = registerServerReference($$RSC_SERVER_CACHE_3, "8012a8d21b6362b4cc8f5b15560525095bc48dba80", null); export { foo, baz }; export default quux; diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/35/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/35/output.js index 46d787ad3fc78..d2a8bd2fa2a56 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/35/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/35/output.js @@ -4,12 +4,8 @@ import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; export var $$RSC_SERVER_CACHE_0 = $$cache__("default", "803128060c414d59f8552e4788b846c0d2b7f74743", async function() { return 'data'; }); -<<<<<<< HEAD -export const my_fn = registerServerReference($$RSC_SERVER_CACHE_0, "803128060c414d59f8552e4788b846c0d2b7f74743", null); -======= Object.defineProperty($$RSC_SERVER_CACHE_0, "name", { "value": "my_fn", "writable": false }); -export const my_fn = registerServerReference($$RSC_SERVER_CACHE_0, "3128060c414d59f8552e4788b846c0d2b7f74743", null); ->>>>>>> canary +export const my_fn = registerServerReference($$RSC_SERVER_CACHE_0, "803128060c414d59f8552e4788b846c0d2b7f74743", null); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/36/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/36/output.js index 0975be92c14cd..493ec6abfebc5 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/36/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/36/output.js @@ -1,55 +1,35 @@ -<<<<<<< HEAD -/* __next_internal_action_entry_do_not_use__ {"7f3128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0","7f4acc55633206134002149ce873fe498be64a6fef":"$$RSC_SERVER_CACHE_4","7f69348c79fce073bae2f70f139565a2fda1c74c74":"$$RSC_SERVER_CACHE_2","7f951c375b4a6a6e89d67b743ec5808127cfde405d":"$$RSC_SERVER_CACHE_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; -======= -/* __next_internal_action_entry_do_not_use__ {"12a8d21b6362b4cc8f5b15560525095bc48dba80":"$$RSC_SERVER_CACHE_3","3128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0","69348c79fce073bae2f70f139565a2fda1c74c74":"$$RSC_SERVER_CACHE_2","951c375b4a6a6e89d67b743ec5808127cfde405d":"$$RSC_SERVER_CACHE_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; ->>>>>>> canary +/* __next_internal_action_entry_do_not_use__ {"7f12a8d21b6362b4cc8f5b15560525095bc48dba80":"$$RSC_SERVER_CACHE_3","7f3128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0","7f69348c79fce073bae2f70f139565a2fda1c74c74":"$$RSC_SERVER_CACHE_2","7f951c375b4a6a6e89d67b743ec5808127cfde405d":"$$RSC_SERVER_CACHE_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; export var $$RSC_SERVER_CACHE_0 = $$cache__("default", "803128060c414d59f8552e4788b846c0d2b7f74743", async function foo() { return 'data A'; }); -<<<<<<< HEAD -export var foo = registerServerReference($$RSC_SERVER_CACHE_0, "803128060c414d59f8552e4788b846c0d2b7f74743", null); -export var $$RSC_SERVER_CACHE_1 = $$cache__("default", "80951c375b4a6a6e89d67b743ec5808127cfde405d", async function bar() { - return 'data B'; -}); -export var bar = registerServerReference($$RSC_SERVER_CACHE_1, "80951c375b4a6a6e89d67b743ec5808127cfde405d", null); -export var $$RSC_SERVER_CACHE_2 = $$cache__("default", "c069348c79fce073bae2f70f139565a2fda1c74c74", async function Cached({ children }) { - return children; -}); -export default registerServerReference($$RSC_SERVER_CACHE_2, "c069348c79fce073bae2f70f139565a2fda1c74c74", null); -export var $$RSC_SERVER_CACHE_4 = $$cache__("default", "804acc55633206134002149ce873fe498be64a6fef", async function $$RSC_SERVER_CACHE_3() { - return 'data C'; -}); -export const baz = registerServerReference($$RSC_SERVER_CACHE_4, "804acc55633206134002149ce873fe498be64a6fef", null); -======= Object.defineProperty($$RSC_SERVER_CACHE_0, "name", { "value": "foo", "writable": false }); -export var foo = registerServerReference($$RSC_SERVER_CACHE_0, "3128060c414d59f8552e4788b846c0d2b7f74743", null); -export var $$RSC_SERVER_CACHE_1 = $$cache__("default", "951c375b4a6a6e89d67b743ec5808127cfde405d", async function bar() { +export var foo = registerServerReference($$RSC_SERVER_CACHE_0, "803128060c414d59f8552e4788b846c0d2b7f74743", null); +export var $$RSC_SERVER_CACHE_1 = $$cache__("default", "80951c375b4a6a6e89d67b743ec5808127cfde405d", async function bar() { return 'data B'; }); Object.defineProperty($$RSC_SERVER_CACHE_1, "name", { "value": "bar", "writable": false }); -export var bar = registerServerReference($$RSC_SERVER_CACHE_1, "951c375b4a6a6e89d67b743ec5808127cfde405d", null); -export var $$RSC_SERVER_CACHE_2 = $$cache__("default", "69348c79fce073bae2f70f139565a2fda1c74c74", async function Cached({ children }) { +export var bar = registerServerReference($$RSC_SERVER_CACHE_1, "80951c375b4a6a6e89d67b743ec5808127cfde405d", null); +export var $$RSC_SERVER_CACHE_2 = $$cache__("default", "c069348c79fce073bae2f70f139565a2fda1c74c74", async function Cached({ children }) { return children; }); Object.defineProperty($$RSC_SERVER_CACHE_2, "name", { "value": "Cached", "writable": false }); -export default registerServerReference($$RSC_SERVER_CACHE_2, "69348c79fce073bae2f70f139565a2fda1c74c74", null); -export var $$RSC_SERVER_CACHE_3 = $$cache__("default", "12a8d21b6362b4cc8f5b15560525095bc48dba80", async function baz() { +export default registerServerReference($$RSC_SERVER_CACHE_2, "c069348c79fce073bae2f70f139565a2fda1c74c74", null); +export var $$RSC_SERVER_CACHE_3 = $$cache__("default", "8012a8d21b6362b4cc8f5b15560525095bc48dba80", async function baz() { return 'data C'; }); Object.defineProperty($$RSC_SERVER_CACHE_3, "name", { "value": "baz", "writable": false }); -export const baz = registerServerReference($$RSC_SERVER_CACHE_3, "12a8d21b6362b4cc8f5b15560525095bc48dba80", null); ->>>>>>> canary +export const baz = registerServerReference($$RSC_SERVER_CACHE_3, "8012a8d21b6362b4cc8f5b15560525095bc48dba80", null); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/37/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/37/output.js index 1d20f6eb4a7b2..5619738eb1b03 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/37/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/37/output.js @@ -4,15 +4,11 @@ import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; export var $$RSC_SERVER_CACHE_0 = $$cache__("default", "803128060c414d59f8552e4788b846c0d2b7f74743", async function fn() { return 'foo'; }); -<<<<<<< HEAD -var fn = registerServerReference($$RSC_SERVER_CACHE_0, "803128060c414d59f8552e4788b846c0d2b7f74743", null); -======= Object.defineProperty($$RSC_SERVER_CACHE_0, "name", { "value": "fn", "writable": false }); -var fn = registerServerReference($$RSC_SERVER_CACHE_0, "3128060c414d59f8552e4788b846c0d2b7f74743", null); ->>>>>>> canary +var fn = registerServerReference($$RSC_SERVER_CACHE_0, "803128060c414d59f8552e4788b846c0d2b7f74743", null); async function Component() { const data = await fn(); return
{data}
; diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/38/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/38/output.js index dbad3dc8449cf..29f2ec0d8fb4e 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/38/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/38/output.js @@ -4,12 +4,8 @@ import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; export var $$RSC_SERVER_CACHE_0 = $$cache__("x", "803128060c414d59f8552e4788b846c0d2b7f74743", async function foo() { return 'data'; }); -<<<<<<< HEAD -export var foo = registerServerReference($$RSC_SERVER_CACHE_0, "803128060c414d59f8552e4788b846c0d2b7f74743", null); -======= Object.defineProperty($$RSC_SERVER_CACHE_0, "name", { "value": "foo", "writable": false }); -export var foo = registerServerReference($$RSC_SERVER_CACHE_0, "3128060c414d59f8552e4788b846c0d2b7f74743", null); ->>>>>>> canary +export var foo = registerServerReference($$RSC_SERVER_CACHE_0, "803128060c414d59f8552e4788b846c0d2b7f74743", null); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/40/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/40/output.js index dd9b64dffe91d..26212bc8c12f7 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/40/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/40/output.js @@ -16,9 +16,9 @@ Object.defineProperty($$RSC_SERVER_CACHE_0, "name", { "writable": false }); export const $$RSC_SERVER_ACTION_2 = async function action($$ACTION_CLOSURE_BOUND, c) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("401c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", $$ACTION_CLOSURE_BOUND); const d = $$ACTION_ARG_0 + $$ACTION_ARG_1 + c; - var cache = $$RSC_SERVER_REF_1.bind(null, encryptActionBoundArgs("3128060c414d59f8552e4788b846c0d2b7f74743", [ + var cache = $$RSC_SERVER_REF_1.bind(null, encryptActionBoundArgs("c03128060c414d59f8552e4788b846c0d2b7f74743", [ d, $$ACTION_ARG_0 ])); @@ -34,17 +34,4 @@ async function Component({ a }) {
; } -<<<<<<< HEAD var $$RSC_SERVER_REF_1 = registerServerReference($$RSC_SERVER_CACHE_0, "c03128060c414d59f8552e4788b846c0d2b7f74743", null); -export async function $$RSC_SERVER_ACTION_2($$ACTION_CLOSURE_BOUND, c) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("401c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", $$ACTION_CLOSURE_BOUND); - const d = $$ACTION_ARG_0 + $$ACTION_ARG_1 + c; - var cache = $$RSC_SERVER_REF_1.bind(null, encryptActionBoundArgs("c03128060c414d59f8552e4788b846c0d2b7f74743", [ - d, - $$ACTION_ARG_0 - ])); - return cache(d); -} -======= -var $$RSC_SERVER_REF_1 = registerServerReference($$RSC_SERVER_CACHE_0, "3128060c414d59f8552e4788b846c0d2b7f74743", null); ->>>>>>> canary diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/41/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/41/output.js index ab217cef30bc1..43a3cc5e1a064 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/41/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/41/output.js @@ -1,18 +1,14 @@ /* __next_internal_action_entry_do_not_use__ {"7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7f951c375b4a6a6e89d67b743ec5808127cfde405d":"$$RSC_SERVER_CACHE_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; -<<<<<<< HEAD -export var $$RSC_SERVER_CACHE_1 = $$cache__("default", "c0951c375b4a6a6e89d67b743ec5808127cfde405d", async function Component({ foo }) { -======= export const $$RSC_SERVER_ACTION_0 = async function fn($$ACTION_CLOSURE_BOUND) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); console.log($$ACTION_ARG_0); return { foo: $$ACTION_ARG_1 }; }; -export var $$RSC_SERVER_CACHE_1 = $$cache__("default", "951c375b4a6a6e89d67b743ec5808127cfde405d", async function Component({ foo }) { ->>>>>>> canary +export var $$RSC_SERVER_CACHE_1 = $$cache__("default", "c0951c375b4a6a6e89d67b743ec5808127cfde405d", async function Component({ foo }) { const a = 123; var fn = registerServerReference($$RSC_SERVER_ACTION_0, "006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null).bind(null, encryptActionBoundArgs("006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", [ a, @@ -21,19 +17,8 @@ export var $$RSC_SERVER_CACHE_1 = $$cache__("default", "951c375b4a6a6e89d67b743e const data = await fn(); return
{data}
; }); -<<<<<<< HEAD -export var Component = registerServerReference($$RSC_SERVER_CACHE_1, "c0951c375b4a6a6e89d67b743ec5808127cfde405d", null); -export async function $$RSC_SERVER_ACTION_0($$ACTION_CLOSURE_BOUND) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); - console.log($$ACTION_ARG_0); - return { - foo: $$ACTION_ARG_1 - }; -} -======= Object.defineProperty($$RSC_SERVER_CACHE_1, "name", { "value": "Component", "writable": false }); -export var Component = registerServerReference($$RSC_SERVER_CACHE_1, "951c375b4a6a6e89d67b743ec5808127cfde405d", null); ->>>>>>> canary +export var Component = registerServerReference($$RSC_SERVER_CACHE_1, "c0951c375b4a6a6e89d67b743ec5808127cfde405d", null); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/43/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/43/output.js index d28680bd73d49..3329123ad8233 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/43/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/43/output.js @@ -3,15 +3,11 @@ import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; import { Foo } from './client'; const secret = 'my password is qwerty123'; -<<<<<<< HEAD -export var $$RSC_SERVER_CACHE_1 = $$cache__("default", "e0951c375b4a6a6e89d67b743ec5808127cfde405d", async function getCachedRandom(x, children) { -======= export const $$RSC_SERVER_ACTION_0 = async function action($$ACTION_CLOSURE_BOUND) { - var [$$ACTION_ARG_0] = await decryptActionBoundArgs("6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0] = await decryptActionBoundArgs("006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); console.log(secret, $$ACTION_ARG_0); }; -export var $$RSC_SERVER_CACHE_1 = $$cache__("default", "951c375b4a6a6e89d67b743ec5808127cfde405d", async function getCachedRandom(x, children) { ->>>>>>> canary +export var $$RSC_SERVER_CACHE_1 = $$cache__("default", "e0951c375b4a6a6e89d67b743ec5808127cfde405d", async function getCachedRandom(x, children) { return { x, y: Math.random(), @@ -21,16 +17,8 @@ export var $$RSC_SERVER_CACHE_1 = $$cache__("default", "951c375b4a6a6e89d67b743e r: children }; }); -<<<<<<< HEAD -var getCachedRandom = registerServerReference($$RSC_SERVER_CACHE_1, "e0951c375b4a6a6e89d67b743ec5808127cfde405d", null); -export async function $$RSC_SERVER_ACTION_0($$ACTION_CLOSURE_BOUND) { - var [$$ACTION_ARG_0] = await decryptActionBoundArgs("006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); - console.log(secret, $$ACTION_ARG_0); -} -======= Object.defineProperty($$RSC_SERVER_CACHE_1, "name", { "value": "getCachedRandom", "writable": false }); -var getCachedRandom = registerServerReference($$RSC_SERVER_CACHE_1, "951c375b4a6a6e89d67b743ec5808127cfde405d", null); ->>>>>>> canary +var getCachedRandom = registerServerReference($$RSC_SERVER_CACHE_1, "e0951c375b4a6a6e89d67b743ec5808127cfde405d", null); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/44/input.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/44/input.js index 7d384da17c90d..740a0cbc7a40a 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/44/input.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/44/input.js @@ -1,41 +1,3 @@ -<<<<<<< HEAD -// This is for testing the "information byte" of Server Action / Cache IDs. - -// Should be 1 110000 0, which is "e0" in hex. -async function f1(a, b) { - 'use cache' - return [a, b] -} - -// Should be 0 110000 1, which is "60" in hex. -async function f2(a, b) { - 'use server' - return [a, b] -} - -// Should be 1 111111 1, which is "ff" in hex. -async function f3(a, b, ...rest) { - 'use cache' - return [a, b, rest] -} - -// Should be 0 111110 0, which is "7c" in hex. -async function f4(a, b, c, d, e) { - 'use server' - return [a, b, c, d, e] -} - -// Should be 0 111111 0, which is "7e" in hex. -async function f4(a, b, c, d, e, f) { - 'use server' - return [a, b, c, d, e, f] -} - -// Should be 1 111111 1, which is "ff" in hex. -async function f5(a, b, c, d, e, f, g) { - 'use cache' - return [a, b, c, d, e, f, g] -======= import { Form } from './form' export default function Page() { @@ -78,5 +40,4 @@ export default function Page() { /> ) ->>>>>>> canary } diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/44/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/44/output.js index a102ed1db3adf..43f02fbfec364 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/44/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/44/output.js @@ -1,71 +1,4 @@ -<<<<<<< HEAD -// This is for testing the "information byte" of Server Action / Cache IDs. -// Should be 1 110000 0, which is "e0" in hex. -/* __next_internal_action_entry_do_not_use__ {"7f3128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0","7f471a5eb0be1c31686dd4ba938a80328b80b1615d":"$$RSC_SERVER_CACHE_5","7f69348c79fce073bae2f70f139565a2fda1c74c74":"$$RSC_SERVER_CACHE_2","7f90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","7f9ed0cc47abc4e1c64320cf42b74ae60b58c40f00":"$$RSC_SERVER_ACTION_3","7fa9b2939c1f39073a6bed227fd20233064c8b7869":"$$RSC_SERVER_ACTION_4"} */ import { registerServerReference } from "private-next-rsc-server-reference"; -import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; -import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; -export var $$RSC_SERVER_CACHE_0 = $$cache__("default", "e03128060c414d59f8552e4788b846c0d2b7f74743", async function f1(a, b) { - return [ - a, - b - ]; -}); -var f1 = registerServerReference($$RSC_SERVER_CACHE_0, "e03128060c414d59f8552e4788b846c0d2b7f74743", null); -var f2 = // Should be 0 110000 1, which is "60" in hex. -registerServerReference($$RSC_SERVER_ACTION_1, "6090b5db271335765a4b0eab01f044b381b5ebd5cd", null); -export async function $$RSC_SERVER_ACTION_1(a, b) { - return [ - a, - b - ]; -} -export var $$RSC_SERVER_CACHE_2 = $$cache__("default", "ff69348c79fce073bae2f70f139565a2fda1c74c74", // Should be 1 111111 1, which is "ff" in hex. -async function f3(a, b, ...rest) { - return [ - a, - b, - rest - ]; -}); -var f3 = registerServerReference($$RSC_SERVER_CACHE_2, "ff69348c79fce073bae2f70f139565a2fda1c74c74", null); -var f4 = // Should be 0 111110 0, which is "7c" in hex. -registerServerReference($$RSC_SERVER_ACTION_3, "7c9ed0cc47abc4e1c64320cf42b74ae60b58c40f00", null); -export async function $$RSC_SERVER_ACTION_3(a, b, c, d, e) { - return [ - a, - b, - c, - d, - e - ]; -} -var f4 = // Should be 0 111111 0, which is "7e" in hex. -registerServerReference($$RSC_SERVER_ACTION_4, "7ea9b2939c1f39073a6bed227fd20233064c8b7869", null); -export async function $$RSC_SERVER_ACTION_4(a, b, c, d, e, f) { - return [ - a, - b, - c, - d, - e, - f - ]; -} -export var $$RSC_SERVER_CACHE_5 = $$cache__("default", "ff471a5eb0be1c31686dd4ba938a80328b80b1615d", // Should be 1 111111 1, which is "ff" in hex. -async function f5(a, b, c, d, e, f, g) { - return [ - a, - b, - c, - d, - e, - f, - g - ]; -}); -var f5 = registerServerReference($$RSC_SERVER_CACHE_5, "ff471a5eb0be1c31686dd4ba938a80328b80b1615d", null); -======= -/* __next_internal_action_entry_do_not_use__ {"1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","9ed0cc47abc4e1c64320cf42b74ae60b58c40f00":"$$RSC_SERVER_ACTION_3","a9b2939c1f39073a6bed227fd20233064c8b7869":"$$RSC_SERVER_ACTION_4"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7f1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7f90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","7f9ed0cc47abc4e1c64320cf42b74ae60b58c40f00":"$$RSC_SERVER_ACTION_3","7fa9b2939c1f39073a6bed227fd20233064c8b7869":"$$RSC_SERVER_ACTION_4"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { Form } from './form'; export const $$RSC_SERVER_ACTION_0 = async function foo() { @@ -84,14 +17,13 @@ export const $$RSC_SERVER_ACTION_4 = async function baz() { return 'named function expression'; }; export default function Page() { - const foo = registerServerReference($$RSC_SERVER_ACTION_0, "6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null); - var bar = registerServerReference($$RSC_SERVER_ACTION_1, "90b5db271335765a4b0eab01f044b381b5ebd5cd", null); + const foo = registerServerReference($$RSC_SERVER_ACTION_0, "006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null); + var bar = registerServerReference($$RSC_SERVER_ACTION_1, "0090b5db271335765a4b0eab01f044b381b5ebd5cd", null); return <>
- - - + + + ; } ->>>>>>> canary diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/45/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/45/output.js index 5661cb7b69c30..93440549e1211 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/45/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/45/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"3128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"7f3128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; // Expect no error here, this is allowed to be sync because it's not exported. @@ -7,11 +7,11 @@ function Foo() { console.log(v); return v; } -export var $$RSC_SERVER_CACHE_0 = $$cache__("default", "3128060c414d59f8552e4788b846c0d2b7f74743", async function bar() { +export var $$RSC_SERVER_CACHE_0 = $$cache__("default", "803128060c414d59f8552e4788b846c0d2b7f74743", async function bar() { return ; }); Object.defineProperty($$RSC_SERVER_CACHE_0, "name", { "value": "bar", "writable": false }); -export var bar = registerServerReference($$RSC_SERVER_CACHE_0, "3128060c414d59f8552e4788b846c0d2b7f74743", null); +export var bar = registerServerReference($$RSC_SERVER_CACHE_0, "803128060c414d59f8552e4788b846c0d2b7f74743", null); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/46/input.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/46/input.js new file mode 100644 index 0000000000000..7514f59607168 --- /dev/null +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/46/input.js @@ -0,0 +1,37 @@ +// This is for testing the "information byte" of Server Action / Cache IDs. + +// Should be 1 110000 0, which is "e0" in hex. +async function f1(a, b) { + 'use cache' + return [a, b] +} + +// Should be 0 110000 1, which is "60" in hex. +async function f2(a, b) { + 'use server' + return [a, b] +} + +// Should be 1 111111 1, which is "ff" in hex. +async function f3(a, b, ...rest) { + 'use cache' + return [a, b, rest] +} + +// Should be 0 111110 0, which is "7c" in hex. +async function f4(a, b, c, d, e) { + 'use server' + return [a, b, c, d, e] +} + +// Should be 0 111111 0, which is "7e" in hex. +async function f4(a, b, c, d, e, f) { + 'use server' + return [a, b, c, d, e, f] +} + +// Should be 1 111111 1, which is "ff" in hex. +async function f5(a, b, c, d, e, f, g) { + 'use cache' + return [a, b, c, d, e, f, g] +} diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/46/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/46/output.js new file mode 100644 index 0000000000000..17da5b88c0d23 --- /dev/null +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/46/output.js @@ -0,0 +1,77 @@ +// This is for testing the "information byte" of Server Action / Cache IDs. +// Should be 1 110000 0, which is "e0" in hex. +/* __next_internal_action_entry_do_not_use__ {"7f3128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0","7f471a5eb0be1c31686dd4ba938a80328b80b1615d":"$$RSC_SERVER_CACHE_5","7f69348c79fce073bae2f70f139565a2fda1c74c74":"$$RSC_SERVER_CACHE_2","7f90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","7f9ed0cc47abc4e1c64320cf42b74ae60b58c40f00":"$$RSC_SERVER_ACTION_3","7fa9b2939c1f39073a6bed227fd20233064c8b7869":"$$RSC_SERVER_ACTION_4"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; +import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; +export var $$RSC_SERVER_CACHE_0 = $$cache__("default", "e03128060c414d59f8552e4788b846c0d2b7f74743", async function f1(a, b) { + return [ + a, + b + ]; +}); +Object.defineProperty($$RSC_SERVER_CACHE_0, "name", { + "value": "f1", + "writable": false +}); +var f1 = registerServerReference($$RSC_SERVER_CACHE_0, "e03128060c414d59f8552e4788b846c0d2b7f74743", null); +export const // Should be 0 110000 1, which is "60" in hex. +$$RSC_SERVER_ACTION_1 = async function f2(a, b) { + return [ + a, + b + ]; +}; +var f2 = registerServerReference($$RSC_SERVER_ACTION_1, "6090b5db271335765a4b0eab01f044b381b5ebd5cd", null); +export var $$RSC_SERVER_CACHE_2 = $$cache__("default", "ff69348c79fce073bae2f70f139565a2fda1c74c74", // Should be 1 111111 1, which is "ff" in hex. +async function f3(a, b, ...rest) { + return [ + a, + b, + rest + ]; +}); +Object.defineProperty($$RSC_SERVER_CACHE_2, "name", { + "value": "f3", + "writable": false +}); +var f3 = registerServerReference($$RSC_SERVER_CACHE_2, "ff69348c79fce073bae2f70f139565a2fda1c74c74", null); +export const // Should be 0 111110 0, which is "7c" in hex. +$$RSC_SERVER_ACTION_3 = async function f4(a, b, c, d, e) { + return [ + a, + b, + c, + d, + e + ]; +}; +var f4 = registerServerReference($$RSC_SERVER_ACTION_3, "7c9ed0cc47abc4e1c64320cf42b74ae60b58c40f00", null); +export const // Should be 0 111111 0, which is "7e" in hex. +$$RSC_SERVER_ACTION_4 = async function f4(a, b, c, d, e, f) { + return [ + a, + b, + c, + d, + e, + f + ]; +}; +var f4 = registerServerReference($$RSC_SERVER_ACTION_4, "7ea9b2939c1f39073a6bed227fd20233064c8b7869", null); +export var $$RSC_SERVER_CACHE_5 = $$cache__("default", "ff471a5eb0be1c31686dd4ba938a80328b80b1615d", // Should be 1 111111 1, which is "ff" in hex. +async function f5(a, b, c, d, e, f, g) { + return [ + a, + b, + c, + d, + e, + f, + g + ]; +}); +Object.defineProperty($$RSC_SERVER_CACHE_5, "name", { + "value": "f5", + "writable": false +}); +var f5 = registerServerReference($$RSC_SERVER_CACHE_5, "ff471a5eb0be1c31686dd4ba938a80328b80b1615d", null); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/5/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/5/output.js index 235946ca214f8..d35b856f0efcd 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/5/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/5/output.js @@ -3,7 +3,7 @@ import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc import deleteFromDb from 'db'; const v1 = 'v1'; export const $$RSC_SERVER_ACTION_0 = async function deleteItem($$ACTION_CLOSURE_BOUND) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2, $$ACTION_ARG_3] = await decryptActionBoundArgs("6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2, $$ACTION_ARG_3] = await decryptActionBoundArgs("006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); await deleteFromDb($$ACTION_ARG_0); await deleteFromDb(v1); await deleteFromDb($$ACTION_ARG_1); @@ -22,16 +22,3 @@ export function Item({ id1, id2, id3, id4 }) { ])); return ; } -<<<<<<< HEAD -export async function $$RSC_SERVER_ACTION_0($$ACTION_CLOSURE_BOUND) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2, $$ACTION_ARG_3] = await decryptActionBoundArgs("006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); - await deleteFromDb($$ACTION_ARG_0); - await deleteFromDb(v1); - await deleteFromDb($$ACTION_ARG_1); - await deleteFromDb({ - id3: $$ACTION_ARG_2 - }); - await deleteFromDb($$ACTION_ARG_3); -} -======= ->>>>>>> canary diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/6/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/6/output.js index 258b0660cc79c..d7e0e6ebff481 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/6/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/6/output.js @@ -13,7 +13,7 @@ function x() { const g201 = 1; } export const $$RSC_SERVER_ACTION_0 = async function action($$ACTION_CLOSURE_BOUND) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2, $$ACTION_ARG_3, $$ACTION_ARG_4, $$ACTION_ARG_5] = await decryptActionBoundArgs("6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2, $$ACTION_ARG_3, $$ACTION_ARG_4, $$ACTION_ARG_5] = await decryptActionBoundArgs("006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); const f17 = 1; if (true) { const f18 = 1; @@ -38,15 +38,3 @@ export function y(p, [p1, { p2 }], ...p3) { ])); return ; } -<<<<<<< HEAD -export async function $$RSC_SERVER_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("006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); - const f17 = 1; - if (true) { - const f18 = 1; - const f19 = 1; - } - console.log(f, f1, $$ACTION_ARG_0, f3, f4, f5, f6, f7, f8, $$ACTION_ARG_0(f9), f12, $$ACTION_ARG_1, f16.x, f17, f18, $$ACTION_ARG_2, $$ACTION_ARG_3, $$ACTION_ARG_4, $$ACTION_ARG_5, g19, g20, globalThis); -} -======= ->>>>>>> canary diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/7/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/7/output.js index 8d1f9002ef51a..227bc36d3a7e6 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/7/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/7/output.js @@ -1,12 +1,8 @@ -<<<<<<< HEAD -/* __next_internal_action_entry_do_not_use__ {"7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7f90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","7f9ed0cc47abc4e1c64320cf42b74ae60b58c40f00":"$$RSC_SERVER_ACTION_3","7fa9b2939c1f39073a6bed227fd20233064c8b7869":"$$RSC_SERVER_ACTION_4"} */ import { registerServerReference } from "private-next-rsc-server-reference"; -======= -/* __next_internal_action_entry_do_not_use__ {"1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","9ed0cc47abc4e1c64320cf42b74ae60b58c40f00":"$$RSC_SERVER_ACTION_3"} */ import { registerServerReference } from "private-next-rsc-server-reference"; ->>>>>>> canary +/* __next_internal_action_entry_do_not_use__ {"7f1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7f90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","7f9ed0cc47abc4e1c64320cf42b74ae60b58c40f00":"$$RSC_SERVER_ACTION_3"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import deleteFromDb from 'db'; export const $$RSC_SERVER_ACTION_0 = async function deleteItem1($$ACTION_CLOSURE_BOUND) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); + var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); await deleteFromDb($$ACTION_ARG_0.id, $$ACTION_ARG_0?.foo, $$ACTION_ARG_0.bar.baz, $$ACTION_ARG_0[$$ACTION_ARG_1, $$ACTION_ARG_2]); }; export function Item1(product, foo, bar) { @@ -17,13 +13,8 @@ export function Item1(product, foo, bar) { ])); return ; } -<<<<<<< HEAD -export async function $$RSC_SERVER_ACTION_0($$ACTION_CLOSURE_BOUND) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); -======= export const $$RSC_SERVER_ACTION_1 = async function deleteItem2($$ACTION_CLOSURE_BOUND) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("90b5db271335765a4b0eab01f044b381b5ebd5cd", $$ACTION_CLOSURE_BOUND); ->>>>>>> canary + var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("0090b5db271335765a4b0eab01f044b381b5ebd5cd", $$ACTION_CLOSURE_BOUND); await deleteFromDb($$ACTION_ARG_0.id, $$ACTION_ARG_0?.foo, $$ACTION_ARG_0.bar.baz, $$ACTION_ARG_0[$$ACTION_ARG_1, $$ACTION_ARG_2]); }; export function Item2(product, foo, bar) { @@ -34,52 +25,27 @@ export function Item2(product, foo, bar) { ])); return ; } -<<<<<<< HEAD -export async function $$RSC_SERVER_ACTION_1($$ACTION_CLOSURE_BOUND) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("0090b5db271335765a4b0eab01f044b381b5ebd5cd", $$ACTION_CLOSURE_BOUND); -======= export const $$RSC_SERVER_ACTION_2 = async function deleteItem3($$ACTION_CLOSURE_BOUND) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", $$ACTION_CLOSURE_BOUND); ->>>>>>> canary + var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("001c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", $$ACTION_CLOSURE_BOUND); await deleteFromDb($$ACTION_ARG_0.id, $$ACTION_ARG_0?.foo, $$ACTION_ARG_0.bar.baz, $$ACTION_ARG_0[$$ACTION_ARG_1, $$ACTION_ARG_2]); }; export function Item3(product, foo, bar) { -<<<<<<< HEAD - const deleteItem3 = registerServerReference($$RSC_SERVER_ACTION_3, "009ed0cc47abc4e1c64320cf42b74ae60b58c40f00", null).bind(null, encryptActionBoundArgs("009ed0cc47abc4e1c64320cf42b74ae60b58c40f00", [ -======= - const deleteItem3 = registerServerReference($$RSC_SERVER_ACTION_2, "1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", null).bind(null, encryptActionBoundArgs("1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", [ ->>>>>>> canary + const deleteItem3 = registerServerReference($$RSC_SERVER_ACTION_2, "001c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", null).bind(null, encryptActionBoundArgs("001c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", [ product, foo, bar ])); return ; } -<<<<<<< HEAD -export async function $$RSC_SERVER_ACTION_3($$ACTION_CLOSURE_BOUND) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("009ed0cc47abc4e1c64320cf42b74ae60b58c40f00", $$ACTION_CLOSURE_BOUND); -======= export const $$RSC_SERVER_ACTION_3 = async function deleteItem4($$ACTION_CLOSURE_BOUND) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("9ed0cc47abc4e1c64320cf42b74ae60b58c40f00", $$ACTION_CLOSURE_BOUND); ->>>>>>> canary + var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("009ed0cc47abc4e1c64320cf42b74ae60b58c40f00", $$ACTION_CLOSURE_BOUND); await deleteFromDb($$ACTION_ARG_0.id, $$ACTION_ARG_0?.foo, $$ACTION_ARG_0.bar.baz, $$ACTION_ARG_0[$$ACTION_ARG_1, $$ACTION_ARG_2]); }; export function Item4(product, foo, bar) { -<<<<<<< HEAD - const deleteItem4 = registerServerReference($$RSC_SERVER_ACTION_4, "00a9b2939c1f39073a6bed227fd20233064c8b7869", null).bind(null, encryptActionBoundArgs("00a9b2939c1f39073a6bed227fd20233064c8b7869", [ -======= - const deleteItem4 = registerServerReference($$RSC_SERVER_ACTION_3, "9ed0cc47abc4e1c64320cf42b74ae60b58c40f00", null).bind(null, encryptActionBoundArgs("9ed0cc47abc4e1c64320cf42b74ae60b58c40f00", [ ->>>>>>> canary + const deleteItem4 = registerServerReference($$RSC_SERVER_ACTION_3, "009ed0cc47abc4e1c64320cf42b74ae60b58c40f00", null).bind(null, encryptActionBoundArgs("009ed0cc47abc4e1c64320cf42b74ae60b58c40f00", [ product, foo, bar ])); return ; } -<<<<<<< HEAD -export async function $$RSC_SERVER_ACTION_4($$ACTION_CLOSURE_BOUND) { - var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("00a9b2939c1f39073a6bed227fd20233064c8b7869", $$ACTION_CLOSURE_BOUND); - await deleteFromDb($$ACTION_ARG_0.id, $$ACTION_ARG_0?.foo, $$ACTION_ARG_0.bar.baz, $$ACTION_ARG_0[$$ACTION_ARG_1, $$ACTION_ARG_2]); -} -======= ->>>>>>> canary diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/8/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/8/output.js index d99de389440c3..2e5866b09d30b 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/8/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/8/output.js @@ -1,16 +1,11 @@ /* __next_internal_action_entry_do_not_use__ {"7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; -<<<<<<< HEAD -var myAction = registerServerReference($$RSC_SERVER_ACTION_0, "706a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null); -export async function $$RSC_SERVER_ACTION_0(a, b, c) { -======= export const $$RSC_SERVER_ACTION_0 = async function myAction(a, b, c) { ->>>>>>> canary // comment 'use strict'; console.log('a'); }; -var myAction = registerServerReference($$RSC_SERVER_ACTION_0, "6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null); +var myAction = registerServerReference($$RSC_SERVER_ACTION_0, "706a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null); export default function Page() { return ; } From 94248e45d559b72e8faad5a7ab8519f3642dfc23 Mon Sep 17 00:00:00 2001 From: Shu Ding Date: Mon, 28 Oct 2024 03:28:15 +0100 Subject: [PATCH 3/4] fix --- .../src/transforms/server_actions.rs | 357 ++++++++++++++---- .../server-actions/server-graph/1/output.js | 4 +- .../server-actions/server-graph/2/output.js | 4 +- .../server-actions/server-graph/6/output.js | 4 +- .../server-actions/server-graph/8/output.js | 2 +- .../fixture/server-actions/client/1/output.js | 6 +- .../fixture/server-actions/client/6/output.js | 4 +- .../fixture/server-actions/client/7/output.js | 4 +- .../fixture/server-actions/client/8/output.js | 4 +- .../fixture/server-actions/server/1/output.js | 2 +- .../server-actions/server/10/output.js | 4 +- .../server-actions/server/11/output.js | 4 +- .../server-actions/server/12/output.js | 2 +- .../server-actions/server/13/output.js | 4 +- .../server-actions/server/14/output.js | 4 +- .../server-actions/server/15/output.js | 4 +- .../server-actions/server/16/output.js | 2 +- .../server-actions/server/17/output.js | 4 +- .../server-actions/server/18/output.js | 2 +- .../server-actions/server/19/output.js | 2 +- .../fixture/server-actions/server/2/output.js | 2 +- .../server-actions/server/20/output.js | 2 +- .../server-actions/server/21/output.js | 2 +- .../server-actions/server/22/output.js | 4 +- .../server-actions/server/23/output.js | 2 +- .../server-actions/server/24/output.js | 2 +- .../server-actions/server/25/output.js | 2 +- .../server-actions/server/26/output.js | 2 +- .../server-actions/server/27/output.js | 2 +- .../server-actions/server/28/output.js | 2 +- .../server-actions/server/29/output.js | 4 +- .../fixture/server-actions/server/3/output.js | 4 +- .../server-actions/server/30/output.js | 4 +- .../server-actions/server/31/output.js | 4 +- .../server-actions/server/32/output.js | 2 +- .../server-actions/server/33/output.js | 2 +- .../server-actions/server/34/output.js | 2 +- .../server-actions/server/35/output.js | 2 +- .../server-actions/server/36/output.js | 2 +- .../server-actions/server/37/output.js | 2 +- .../server-actions/server/38/output.js | 2 +- .../server-actions/server/39/output.js | 2 +- .../fixture/server-actions/server/4/output.js | 8 +- .../server-actions/server/40/output.js | 2 +- .../server-actions/server/41/output.js | 2 +- .../server-actions/server/42/output.js | 2 +- .../server-actions/server/43/output.js | 2 +- .../server-actions/server/44/output.js | 2 +- .../server-actions/server/45/output.js | 2 +- .../fixture/server-actions/server/46/input.js | 2 +- .../server-actions/server/46/output.js | 4 +- .../fixture/server-actions/server/47/input.js | 23 ++ .../server-actions/server/47/output.js | 16 + .../fixture/server-actions/server/48/input.js | 45 +++ .../server-actions/server/48/output.js | 47 +++ .../fixture/server-actions/server/49/input.js | 13 + .../server-actions/server/49/output.js | 11 + .../fixture/server-actions/server/5/output.js | 2 +- .../fixture/server-actions/server/50/input.js | 13 + .../server-actions/server/50/output.js | 15 + .../fixture/server-actions/server/51/input.js | 35 ++ .../server-actions/server/51/output.js | 29 ++ .../fixture/server-actions/server/6/output.js | 2 +- .../fixture/server-actions/server/7/output.js | 2 +- .../fixture/server-actions/server/8/output.js | 2 +- .../fixture/server-actions/server/9/output.js | 6 +- 66 files changed, 603 insertions(+), 161 deletions(-) create mode 100644 crates/next-custom-transforms/tests/fixture/server-actions/server/47/input.js create mode 100644 crates/next-custom-transforms/tests/fixture/server-actions/server/47/output.js create mode 100644 crates/next-custom-transforms/tests/fixture/server-actions/server/48/input.js create mode 100644 crates/next-custom-transforms/tests/fixture/server-actions/server/48/output.js create mode 100644 crates/next-custom-transforms/tests/fixture/server-actions/server/49/input.js create mode 100644 crates/next-custom-transforms/tests/fixture/server-actions/server/49/output.js create mode 100644 crates/next-custom-transforms/tests/fixture/server-actions/server/50/input.js create mode 100644 crates/next-custom-transforms/tests/fixture/server-actions/server/50/output.js create mode 100644 crates/next-custom-transforms/tests/fixture/server-actions/server/51/input.js create mode 100644 crates/next-custom-transforms/tests/fixture/server-actions/server/51/output.js diff --git a/crates/next-custom-transforms/src/transforms/server_actions.rs b/crates/next-custom-transforms/src/transforms/server_actions.rs index 2ec42ea98d13b..96b08be3f7c41 100644 --- a/crates/next-custom-transforms/src/transforms/server_actions.rs +++ b/crates/next-custom-transforms/src/transforms/server_actions.rs @@ -115,13 +115,16 @@ struct ServerActions { rewrite_default_fn_expr_to_proxy_expr: Option>, rewrite_expr_to_proxy_expr: Option>, - // (ident, export name) - exported_idents: Vec<(Ident, String)>, + exported_idents: Vec<( + /* ident */ Ident, + /* name */ String, + /* id */ String, + )>, annotations: Vec, extra_items: Vec, hoisted_extra_items: Vec, - export_actions: Vec, + export_actions: Vec<(/* name */ String, /* id */ String)>, private_ctxt: SyntaxContext, @@ -207,7 +210,7 @@ impl ServerActions { rest_args = 0b1; } - result.push(type_bit << 7 | arg_mask << 1 | rest_args); + result.push((type_bit << 7) | (arg_mask << 1) | rest_args); result.rotate_right(1); hex_encode(result) @@ -284,7 +287,8 @@ impl ServerActions { } } - if self.in_exported_expr { + // Self-annotations take precedence over module-level annotations. + if self.in_exported_expr && !is_action_fn && cache_type.is_none() { if self.in_action_file { // All export functions in a server file are actions is_action_fn = true; @@ -304,12 +308,13 @@ impl ServerActions { ) -> Box { let action_name = self.gen_action_ident().to_string(); - self.has_action = true; - self.export_actions.push(action_name.to_string()); - let action_ident = Ident::new(action_name.clone().into(), arrow.span, self.private_ctxt); let action_id = self.generate_server_reference_id(&action_name, false, Some(&arrow.params)); + self.has_action = true; + self.export_actions + .push((action_name.to_string(), action_id.clone())); + let register_action_expr = bind_args_to_ref_expr( annotate_ident_as_server_reference(action_ident.clone(), action_id.clone(), arrow.span), ids_from_closure @@ -462,9 +467,6 @@ impl ServerActions { ) -> Box { let action_name: JsWord = self.gen_action_ident(); - self.has_action = true; - self.export_actions.push(action_name.to_string()); - let action_ident = Ident::new(action_name.clone(), function.span, self.private_ctxt); let action_id = self.generate_server_reference_id( &action_name, @@ -472,6 +474,10 @@ impl ServerActions { Some(&function.params.iter().map(|p| p.pat.clone()).collect()), ); + self.has_action = true; + self.export_actions + .push((action_name.to_string(), action_id.clone())); + let register_action_expr = bind_args_to_ref_expr( annotate_ident_as_server_reference( action_ident.clone(), @@ -601,13 +607,14 @@ impl ServerActions { let cache_ident = private_ident!(cache_name.clone()); let export_name: JsWord = cache_name; - self.has_cache = true; - self.has_action = true; - self.export_actions.push(export_name.to_string()); - let reference_id = self.generate_server_reference_id(&export_name, true, Some(&arrow.params)); + self.has_cache = true; + self.has_action = true; + self.export_actions + .push((export_name.to_string(), reference_id.clone())); + if let BlockStmtOrExpr::BlockStmt(block) = &mut *arrow.body { block.visit_mut_with(&mut ClosureReplacer { used_ids: &ids_from_closure, @@ -800,16 +807,17 @@ impl ServerActions { let cache_name: JsWord = self.gen_cache_ident(); let cache_ident = private_ident!(cache_name.clone()); - self.has_cache = true; - self.has_action = true; - self.export_actions.push(cache_name.to_string()); - let reference_id = self.generate_server_reference_id( &cache_name, true, Some(&function.params.iter().map(|p| p.pat.clone()).collect()), ); + self.has_cache = true; + self.has_action = true; + self.export_actions + .push((cache_name.to_string(), reference_id.clone())); + let register_action_expr = annotate_ident_as_server_reference( cache_ident.clone(), reference_id.clone(), @@ -1483,13 +1491,17 @@ impl VisitMut for ServerActions { } } + // Only track exported identifiers in action files or cache files. + let is_cache_file = self.in_cache_file.is_some(); + let should_track_exports = self.in_action_file || is_cache_file; + let old_annotations = self.annotations.take(); let mut new = Vec::with_capacity(stmts.len()); for mut stmt in stmts.take() { // For server boundary files, it's not allowed to export things other than async // functions. - if self.in_action_file || self.in_cache_file.is_some() { + if should_track_exports { let mut disallowed_export_span = DUMMY_SP; // Currently only function exports are allowed. @@ -1498,18 +1510,57 @@ impl VisitMut for ServerActions { match decl { Decl::Fn(f) => { // export function foo() {} - self.exported_idents - .push((f.ident.clone(), f.ident.sym.to_string())); + + let (is_action_fn, is_cache_fn) = + has_body_directive(&f.function.body); + + let ref_id = if is_action_fn { + false + } else if is_cache_fn { + true + } else { + is_cache_file + }; + + // If it's a self-annotated cache function, we need to skip + // collecting the exported ident. Otherwise it will be double- + // annotated. + // TODO(shu): This is a workaround. We should have a better way + // to skip self-annotated exports here. + if !(is_cache_fn && self.config.is_react_server_layer) { + self.exported_idents.push(( + f.ident.clone(), + f.ident.sym.to_string(), + self.generate_server_reference_id( + &f.ident.sym.to_string(), + ref_id, + Some( + &f.function + .params + .iter() + .map(|p| p.pat.clone()) + .collect(), + ), + ), + )); + } } Decl::Var(var) => { // export const foo = 1 let mut idents: Vec = Vec::new(); collect_idents_in_var_decls(&var.decls, &mut idents); - self.exported_idents.extend( - idents - .into_iter() - .map(|ident| (ident.clone(), ident.to_id().0.to_string())), - ); + + for ident in &idents { + self.exported_idents.push(( + ident.clone(), + ident.sym.to_string(), + self.generate_server_reference_id( + &ident.sym.to_string(), + is_cache_file, + None, + ), + )); + } for decl in &mut var.decls { if let Some(init) = &decl.init { @@ -1541,17 +1592,38 @@ impl VisitMut for ServerActions { export_name { // export { foo as bar } - self.exported_idents - .push((ident.clone(), sym.to_string())); + self.exported_idents.push(( + ident.clone(), + sym.to_string(), + self.generate_server_reference_id( + &sym.to_string(), + is_cache_file, + None, + ), + )); } else if let ModuleExportName::Str(str) = export_name { // export { foo as "bar" } - self.exported_idents - .push((ident.clone(), str.value.to_string())); + self.exported_idents.push(( + ident.clone(), + str.value.to_string(), + self.generate_server_reference_id( + &str.value.to_string(), + is_cache_file, + None, + ), + )); } } else { // export { foo } - self.exported_idents - .push((ident.clone(), ident.sym.to_string())); + self.exported_idents.push(( + ident.clone(), + ident.sym.to_string(), + self.generate_server_reference_id( + &ident.sym.to_string(), + is_cache_file, + None, + ), + )); } } else { disallowed_export_span = named.span; @@ -1565,23 +1637,62 @@ impl VisitMut for ServerActions { .. })) => match decl { DefaultDecl::Fn(f) => { - if let Some(ident) = &f.ident { - // export default function foo() {} - self.exported_idents.push((ident.clone(), "default".into())); - } else { - // export default function() {} - // Use the span from the function expression - let span = f.function.span; + let (is_action_fn, is_cache_fn) = has_body_directive(&f.function.body); - let new_ident = - Ident::new(self.gen_action_ident(), span, self.private_ctxt); - - f.ident = Some(new_ident.clone()); - - self.exported_idents - .push((new_ident.clone(), "default".into())); + let is_cache = if is_action_fn { + false + } else if is_cache_fn { + true + } else { + is_cache_file + }; + + // If it's a self-annotated cache function, we need to skip + // collecting the exported ident. Otherwise it will be double- + // annotated. + // TODO(shu): This is a workaround. We should have a better way + // to skip self-annotated exports here. + if !(is_cache_fn && self.config.is_react_server_layer) { + let ref_id = self.generate_server_reference_id( + "default".into(), + is_cache, + Some( + &f.function.params.iter().map(|p| p.pat.clone()).collect(), + ), + ); - assign_name_to_ident(&new_ident, "default", &mut self.extra_items); + if let Some(ident) = &f.ident { + // export default function foo() {} + self.exported_idents.push(( + ident.clone(), + "default".into(), + ref_id, + )); + } else { + // export default function() {} + // Use the span from the function expression + let span = f.function.span; + + let new_ident = Ident::new( + self.gen_action_ident(), + span, + self.private_ctxt, + ); + + f.ident = Some(new_ident.clone()); + + self.exported_idents.push(( + new_ident.clone(), + "default".into(), + ref_id, + )); + + assign_name_to_ident( + &new_ident, + "default", + &mut self.extra_items, + ); + } } } _ => { @@ -1596,21 +1707,67 @@ impl VisitMut for ServerActions { // Use the span of the arrow function let span = arrow.span; - let new_ident = - Ident::new(self.gen_action_ident(), span, self.private_ctxt); + let (is_action_fn, is_cache_fn) = + has_body_directive(&if let BlockStmtOrExpr::BlockStmt(block) = + &*arrow.body + { + Some(block.clone()) + } else { + None + }); - self.exported_idents - .push((new_ident.clone(), "default".into())); + let is_cache = if is_action_fn { + false + } else if is_cache_fn { + true + } else { + is_cache_file + }; + + // If it's a self-annotated cache function, we need to skip + // collecting the exported ident. Otherwise it will be double- + // annotated. + // TODO(shu): This is a workaround. We should have a better way + // to skip self-annotated exports here. + if !(is_cache_fn && self.config.is_react_server_layer) { + let new_ident = Ident::new( + self.gen_action_ident(), + span, + self.private_ctxt, + ); + + self.exported_idents.push(( + new_ident.clone(), + "default".into(), + self.generate_server_reference_id( + "default".into(), + is_cache, + Some(&arrow.params), + ), + )); - create_var_declarator(&new_ident, &mut self.extra_items); - assign_name_to_ident(&new_ident, "default", &mut self.extra_items); + create_var_declarator(&new_ident, &mut self.extra_items); + assign_name_to_ident( + &new_ident, + "default", + &mut self.extra_items, + ); - *default_expr.expr = - assign_arrow_expr(&new_ident, Expr::Arrow(arrow.clone())); + *default_expr.expr = + assign_arrow_expr(&new_ident, Expr::Arrow(arrow.clone())); + } } Expr::Ident(ident) => { // export default foo - self.exported_idents.push((ident.clone(), "default".into())); + self.exported_idents.push(( + ident.clone(), + "default".into(), + self.generate_server_reference_id( + "default".into(), + is_cache_file, + None, + ), + )); } Expr::Call(call) => { // export default fn() @@ -1620,8 +1777,15 @@ impl VisitMut for ServerActions { let new_ident = Ident::new(self.gen_action_ident(), span, self.private_ctxt); - self.exported_idents - .push((new_ident.clone(), "default".into())); + self.exported_idents.push(( + new_ident.clone(), + "default".into(), + self.generate_server_reference_id( + "default".into(), + is_cache_file, + None, + ), + )); create_var_declarator(&new_ident, &mut self.extra_items); assign_name_to_ident(&new_ident, "default", &mut self.extra_items); @@ -1693,9 +1857,7 @@ impl VisitMut for ServerActions { let call_server_ident = private_ident!("callServer"); let find_source_map_url_ident = private_ident!("findSourceMapURL"); - if (self.in_action_file || self.in_cache_file.is_some()) - && !self.config.is_react_server_layer - { + if should_track_exports && !self.config.is_react_server_layer { // import { // createServerReference, // callServer, @@ -1737,15 +1899,9 @@ impl VisitMut for ServerActions { } // If it's a "use server" or a "use cache" file, all exports need to be annotated. - if self.in_action_file || self.in_cache_file.is_some() { - for (ident, export_name) in self.exported_idents.iter() { + if should_track_exports { + for (ident, export_name, ref_id) in self.exported_idents.iter() { if !self.config.is_react_server_layer { - let ref_id = self.generate_server_reference_id( - export_name, - self.in_cache_file.is_some(), - None, - ); - if export_name == "default" { self.comments.add_pure_comment(ident.span.lo); @@ -1758,7 +1914,7 @@ impl VisitMut for ServerActions { create_ref_ident.clone(), ))), args: vec![ - ref_id.as_arg(), + ref_id.clone().as_arg(), call_server_ident.clone().as_arg(), Expr::undefined(DUMMY_SP).as_arg(), find_source_map_url_ident.clone().as_arg(), @@ -1791,7 +1947,7 @@ impl VisitMut for ServerActions { create_ref_ident.clone(), ))), args: vec![ - ref_id.as_arg(), + ref_id.clone().as_arg(), call_server_ident.clone().as_arg(), Expr::undefined(DUMMY_SP).as_arg(), find_source_map_url_ident.clone().as_arg(), @@ -1807,27 +1963,29 @@ impl VisitMut for ServerActions { new.push(export_expr); } } else if self.in_cache_file.is_none() { - let cache_id = self.generate_server_reference_id(export_name, true, None); - self.annotations.push(Stmt::Expr(ExprStmt { span: DUMMY_SP, expr: Box::new(annotate_ident_as_server_reference( ident.clone(), - cache_id, + ref_id.to_string(), ident.span, )), })); } } + // Ensure that the exports are functions by appending a runtime check: + // + // import { ensureServerEntryExports } from 'private-next-rsc-action-validate' + // ensureServerEntryExports([action1, action2, ...]) + // + // But it's only needed for the server layer, because on the client + // layer they're transformed into references already. if self.config.is_react_server_layer { new.append(&mut self.extra_items); // For "use cache" files, there's no need to do extra annotations. if self.in_cache_file.is_none() && !self.exported_idents.is_empty() { - // Ensure that the exports are valid by appending a check - // import { ensureServerEntryExports } from 'private-next-rsc-action-validate' - // ensureServerEntryExports([action1, action2, ...]) let ensure_ident = private_ident!("ensureServerEntryExports"); new.push(ModuleItem::ModuleDecl(ModuleDecl::Import(ImportDecl { span: DUMMY_SP, @@ -1858,7 +2016,7 @@ impl VisitMut for ServerActions { elems: self .exported_idents .iter() - .map(|(ident, _span)| { + .map(|(ident, _, _)| { Some(ExprOrSpread { spread: None, expr: Box::new(Expr::Ident(ident.clone())), @@ -1884,13 +2042,19 @@ impl VisitMut for ServerActions { if self.in_action_file || self.in_cache_file.is_some() && !self.config.is_react_server_layer { - actions.extend(self.exported_idents.iter().map(|e| e.1.clone())); + actions.extend( + self.exported_idents + .iter() + .map(|e| (e.1.clone(), e.2.clone())), + ); }; + // Make it a hashmap of id -> name. let actions = actions .into_iter() - .map(|name| (self.generate_server_reference_id(&name, false, None), name)) + .map(|a| (a.1, a.0)) .collect::(); + // Prepend a special comment to the top of the file. self.comments.add_leading( self.start_pos, @@ -2487,6 +2651,37 @@ fn remove_server_directive_index_in_module( }); } +// Check if the function or arrow function has any action or cache directives, +// without mutating the function body or erroring out. +// This is used to quickly determine if we need to use the module-level +// directives for this function or not. +fn has_body_directive(maybe_body: &Option) -> (bool, bool) { + let mut is_action_fn = false; + let mut is_cache_fn = false; + + if let Some(body) = maybe_body { + for stmt in body.stmts.iter() { + match stmt { + Stmt::Expr(ExprStmt { + expr: box Expr::Lit(Lit::Str(Str { value, .. })), + .. + }) => { + if value == "use server" { + is_action_fn = true; + break; + } else if value == "use cache" || value.starts_with("use cache: ") { + is_cache_fn = true; + break; + } + } + _ => break, + } + } + } + + (is_action_fn, is_cache_fn) +} + fn remove_server_directive_index_in_fn( stmts: &mut Vec, is_action_fn: &mut bool, diff --git a/crates/next-custom-transforms/tests/errors/server-actions/server-graph/1/output.js b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/1/output.js index 896613e39e44d..025c36246e3fc 100644 --- a/crates/next-custom-transforms/tests/errors/server-actions/server-graph/1/output.js +++ b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/1/output.js @@ -1,8 +1,8 @@ -/* __next_internal_action_entry_do_not_use__ {"7fab21efdafbe611287bc25c0462b1e0510d13e48b":"foo"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"00ab21efdafbe611287bc25c0462b1e0510d13e48b":"foo"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; export function foo() {} import { ensureServerEntryExports } from "private-next-rsc-action-validate"; ensureServerEntryExports([ foo ]); -registerServerReference(foo, "ffab21efdafbe611287bc25c0462b1e0510d13e48b", null); +registerServerReference(foo, "00ab21efdafbe611287bc25c0462b1e0510d13e48b", null); diff --git a/crates/next-custom-transforms/tests/errors/server-actions/server-graph/2/output.js b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/2/output.js index 252494b69910f..e9f6847c43eb4 100644 --- a/crates/next-custom-transforms/tests/errors/server-actions/server-graph/2/output.js +++ b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/2/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"7fac840dcaf5e8197cb02b7f3a43c119b7a770b272":"bar"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"00ac840dcaf5e8197cb02b7f3a43c119b7a770b272":"bar"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; 'use strict'; export function bar() {} @@ -6,4 +6,4 @@ import { ensureServerEntryExports } from "private-next-rsc-action-validate"; ensureServerEntryExports([ bar ]); -registerServerReference(bar, "ffac840dcaf5e8197cb02b7f3a43c119b7a770b272", null); +registerServerReference(bar, "00ac840dcaf5e8197cb02b7f3a43c119b7a770b272", null); diff --git a/crates/next-custom-transforms/tests/errors/server-actions/server-graph/6/output.js b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/6/output.js index 5766b830cd95e..ede9aaeb162ff 100644 --- a/crates/next-custom-transforms/tests/errors/server-actions/server-graph/6/output.js +++ b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/6/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"7fc18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"00c18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; export default $$RSC_SERVER_ACTION_0 = ()=>{}; var $$RSC_SERVER_ACTION_0; @@ -10,4 +10,4 @@ import { ensureServerEntryExports } from "private-next-rsc-action-validate"; ensureServerEntryExports([ $$RSC_SERVER_ACTION_0 ]); -registerServerReference($$RSC_SERVER_ACTION_0, "ffc18c215a6b7cdc64bf709f3a714ffdef1bf9651d", null); +registerServerReference($$RSC_SERVER_ACTION_0, "00c18c215a6b7cdc64bf709f3a714ffdef1bf9651d", null); diff --git a/crates/next-custom-transforms/tests/errors/server-actions/server-graph/8/output.js b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/8/output.js index cc07fe2af5d73..52754aa562f9f 100644 --- a/crates/next-custom-transforms/tests/errors/server-actions/server-graph/8/output.js +++ b/crates/next-custom-transforms/tests/errors/server-actions/server-graph/8/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"006a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$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() { 'use strict'; diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/client/1/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/client/1/output.js index d937777c9c1e6..c19f55642934b 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/client/1/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/client/1/output.js @@ -1,4 +1,4 @@ // app/send.ts -/* __next_internal_action_entry_do_not_use__ {"7fc18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default","7fe10665baac148856374b2789aceb970f66fec33e":"myAction"} */ import { createServerReference, callServer, findSourceMapURL } from "private-next-rsc-action-client-wrapper"; -export var myAction = /*#__PURE__*/ createServerReference("7fe10665baac148856374b2789aceb970f66fec33e", callServer, void 0, findSourceMapURL, "myAction"); -export default /*#__PURE__*/ createServerReference("7fc18c215a6b7cdc64bf709f3a714ffdef1bf9651d", callServer, void 0, findSourceMapURL, "default"); +/* __next_internal_action_entry_do_not_use__ {"00c18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default","70e10665baac148856374b2789aceb970f66fec33e":"myAction"} */ import { createServerReference, callServer, findSourceMapURL } from "private-next-rsc-action-client-wrapper"; +export var myAction = /*#__PURE__*/ createServerReference("70e10665baac148856374b2789aceb970f66fec33e", callServer, void 0, findSourceMapURL, "myAction"); +export default /*#__PURE__*/ createServerReference("00c18c215a6b7cdc64bf709f3a714ffdef1bf9651d", callServer, void 0, findSourceMapURL, "default"); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/client/6/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/client/6/output.js index d5aab1d82898a..d495141ce7749 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/client/6/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/client/6/output.js @@ -1,3 +1,3 @@ -/* __next_internal_action_entry_do_not_use__ {"7fab21efdafbe611287bc25c0462b1e0510d13e48b":"foo","7fac840dcaf5e8197cb02b7f3a43c119b7a770b272":"bar"} */ import { createServerReference, callServer, findSourceMapURL } from "private-next-rsc-action-client-wrapper"; -export var foo = /*#__PURE__*/ createServerReference("ffab21efdafbe611287bc25c0462b1e0510d13e48b", callServer, void 0, findSourceMapURL, "foo"); +/* __next_internal_action_entry_do_not_use__ {"80ab21efdafbe611287bc25c0462b1e0510d13e48b":"foo","ffac840dcaf5e8197cb02b7f3a43c119b7a770b272":"bar"} */ import { createServerReference, callServer, findSourceMapURL } from "private-next-rsc-action-client-wrapper"; +export var foo = /*#__PURE__*/ createServerReference("80ab21efdafbe611287bc25c0462b1e0510d13e48b", callServer, void 0, findSourceMapURL, "foo"); export var bar = /*#__PURE__*/ createServerReference("ffac840dcaf5e8197cb02b7f3a43c119b7a770b272", callServer, void 0, findSourceMapURL, "bar"); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/client/7/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/client/7/output.js index 04213db961e9d..30647bb277b15 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/client/7/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/client/7/output.js @@ -1,2 +1,2 @@ -/* __next_internal_action_entry_do_not_use__ {"7fc18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default"} */ import { createServerReference, callServer, findSourceMapURL } from "private-next-rsc-action-client-wrapper"; -export default /*#__PURE__*/ createServerReference("7fc18c215a6b7cdc64bf709f3a714ffdef1bf9651d", callServer, void 0, findSourceMapURL, "default"); +/* __next_internal_action_entry_do_not_use__ {"00c18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default"} */ import { createServerReference, callServer, findSourceMapURL } from "private-next-rsc-action-client-wrapper"; +export default /*#__PURE__*/ createServerReference("00c18c215a6b7cdc64bf709f3a714ffdef1bf9651d", callServer, void 0, findSourceMapURL, "default"); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/client/8/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/client/8/output.js index bce4e0b29e293..2eda815b72dd6 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/client/8/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/client/8/output.js @@ -1,2 +1,2 @@ -/* __next_internal_action_entry_do_not_use__ {"7fac840dcaf5e8197cb02b7f3a43c119b7a770b272":"bar"} */ import { createServerReference, callServer, findSourceMapURL } from "private-next-rsc-action-client-wrapper"; -export var bar = /*#__PURE__*/ createServerReference("7fac840dcaf5e8197cb02b7f3a43c119b7a770b272", callServer, void 0, findSourceMapURL, "bar"); +/* __next_internal_action_entry_do_not_use__ {"80ac840dcaf5e8197cb02b7f3a43c119b7a770b272":"bar"} */ import { createServerReference, callServer, findSourceMapURL } from "private-next-rsc-action-client-wrapper"; +export var bar = /*#__PURE__*/ createServerReference("80ac840dcaf5e8197cb02b7f3a43c119b7a770b272", callServer, void 0, findSourceMapURL, "bar"); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/1/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/1/output.js index ef34367ebf286..ac3dd5fe69bfb 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/1/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/1/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7f90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"006a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","0090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import deleteFromDb from 'db'; export const $$RSC_SERVER_ACTION_0 = async function deleteItem($$ACTION_CLOSURE_BOUND) { diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/10/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/10/output.js index d2a7b1d5c4a7d..51d06ea1032a0 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/10/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/10/output.js @@ -1,8 +1,8 @@ -/* __next_internal_action_entry_do_not_use__ {"7fc18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"00c18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; export default async function foo() {} import { ensureServerEntryExports } from "private-next-rsc-action-validate"; ensureServerEntryExports([ foo ]); -registerServerReference(foo, "ffc18c215a6b7cdc64bf709f3a714ffdef1bf9651d", null); +registerServerReference(foo, "00c18c215a6b7cdc64bf709f3a714ffdef1bf9651d", null); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/11/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/11/output.js index d559acda6b0d6..efbd7926c6041 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/11/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/11/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"7fc18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"00c18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; export default async function $$RSC_SERVER_ACTION_0() {} Object.defineProperty($$RSC_SERVER_ACTION_0, "name", { @@ -9,4 +9,4 @@ import { ensureServerEntryExports } from "private-next-rsc-action-validate"; ensureServerEntryExports([ $$RSC_SERVER_ACTION_0 ]); -registerServerReference($$RSC_SERVER_ACTION_0, "ffc18c215a6b7cdc64bf709f3a714ffdef1bf9651d", null); +registerServerReference($$RSC_SERVER_ACTION_0, "00c18c215a6b7cdc64bf709f3a714ffdef1bf9651d", null); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/12/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/12/output.js index b21a8547ba9fd..0d49affe971e2 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/12/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/12/output.js @@ -6,4 +6,4 @@ import { ensureServerEntryExports } from "private-next-rsc-action-validate"; ensureServerEntryExports([ foo ]); -registerServerReference(foo, "ffc18c215a6b7cdc64bf709f3a714ffdef1bf9651d", null); +registerServerReference(foo, "7fc18c215a6b7cdc64bf709f3a714ffdef1bf9651d", null); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/13/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/13/output.js index 150869f76ca14..607bb18b65e2c 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/13/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/13/output.js @@ -9,5 +9,5 @@ ensureServerEntryExports([ foo, bar ]); -registerServerReference(foo, "ffc18c215a6b7cdc64bf709f3a714ffdef1bf9651d", null); -registerServerReference(bar, "ffac840dcaf5e8197cb02b7f3a43c119b7a770b272", null); +registerServerReference(foo, "7fc18c215a6b7cdc64bf709f3a714ffdef1bf9651d", null); +registerServerReference(bar, "7fac840dcaf5e8197cb02b7f3a43c119b7a770b272", null); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/14/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/14/output.js index 0852956d3fd00..36bc1df43d2c5 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/14/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/14/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"7fab21efdafbe611287bc25c0462b1e0510d13e48b":"foo"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"00ab21efdafbe611287bc25c0462b1e0510d13e48b":"foo"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; export async function foo() { async function bar() {} @@ -7,4 +7,4 @@ import { ensureServerEntryExports } from "private-next-rsc-action-validate"; ensureServerEntryExports([ foo ]); -registerServerReference(foo, "ffab21efdafbe611287bc25c0462b1e0510d13e48b", null); +registerServerReference(foo, "00ab21efdafbe611287bc25c0462b1e0510d13e48b", null); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/15/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/15/output.js index 69cf76f35caaa..46f10d2286844 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/15/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/15/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"7fc18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"60c18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; export default $$RSC_SERVER_ACTION_0 = async (a, b)=>{ console.log(a, b); @@ -12,4 +12,4 @@ import { ensureServerEntryExports } from "private-next-rsc-action-validate"; ensureServerEntryExports([ $$RSC_SERVER_ACTION_0 ]); -registerServerReference($$RSC_SERVER_ACTION_0, "ffc18c215a6b7cdc64bf709f3a714ffdef1bf9651d", null); +registerServerReference($$RSC_SERVER_ACTION_0, "60c18c215a6b7cdc64bf709f3a714ffdef1bf9651d", null); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/16/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/16/output.js index 138a117224642..b56b6299995e9 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/16/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/16/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"7f1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7f90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"006a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7f1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","7f90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import deleteFromDb from 'db'; const v1 = 'v1'; diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/17/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/17/output.js index e4b74ac605501..de20684b09f56 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/17/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/17/output.js @@ -8,5 +8,5 @@ ensureServerEntryExports([ foo, bar ]); -registerServerReference(foo, "ffab21efdafbe611287bc25c0462b1e0510d13e48b", null); -registerServerReference(bar, "ffac840dcaf5e8197cb02b7f3a43c119b7a770b272", null); +registerServerReference(foo, "7fab21efdafbe611287bc25c0462b1e0510d13e48b", null); +registerServerReference(bar, "7fac840dcaf5e8197cb02b7f3a43c119b7a770b272", null); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/18/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/18/output.js index b8da0056cd80d..e54ef92a61beb 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/18/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/18/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7f90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"006a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","0090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import deleteFromDb from 'db'; const v1 = 'v1'; diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/19/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/19/output.js index 46e72233fec3b..eed57d0f897df 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/19/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/19/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"406a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$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 action($$ACTION_CLOSURE_BOUND, value2) { var [$$ACTION_ARG_0] = await decryptActionBoundArgs("406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/2/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/2/output.js index 95f6c8afe1f7f..9b3a89fe4819d 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/2/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/2/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7f90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"0090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","706a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$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 myAction(a, b, c) { console.log('a'); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/20/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/20/output.js index 64f883294cb9b..e44165fbac5f8 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/20/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/20/output.js @@ -8,4 +8,4 @@ import { ensureServerEntryExports } from "private-next-rsc-action-validate"; ensureServerEntryExports([ foo ]); -registerServerReference(foo, "ffc18c215a6b7cdc64bf709f3a714ffdef1bf9651d", null); +registerServerReference(foo, "7fc18c215a6b7cdc64bf709f3a714ffdef1bf9651d", null); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/21/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/21/output.js index 61ae0d6cdb76c..41f1a9dd7ab18 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/21/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/21/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"7f1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7f90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"001c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","0090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","406a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { validator, another } from 'auth'; const x = 1; diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/22/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/22/output.js index 704ca8386ddda..cc01d76437af7 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/22/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/22/output.js @@ -13,5 +13,5 @@ ensureServerEntryExports([ action, $$RSC_SERVER_ACTION_0 ]); -registerServerReference(action, "fff14702b5a021dd117f7ec7a3c838f397c2046d3b", null); -registerServerReference($$RSC_SERVER_ACTION_0, "ffc18c215a6b7cdc64bf709f3a714ffdef1bf9651d", null); +registerServerReference(action, "7ff14702b5a021dd117f7ec7a3c838f397c2046d3b", null); +registerServerReference($$RSC_SERVER_ACTION_0, "7fc18c215a6b7cdc64bf709f3a714ffdef1bf9651d", null); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/23/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/23/output.js index e350fba5d4e5e..11263e3d3bbb0 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/23/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/23/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7f90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"786a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7890b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ 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 action($$ACTION_CLOSURE_BOUND, a, b, c, d) { var [$$ACTION_ARG_0] = await decryptActionBoundArgs("786a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/24/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/24/output.js index 1425f367372e6..53f1878c6018b 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/24/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/24/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"786a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$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 action($$ACTION_CLOSURE_BOUND, a, b, c, { d }) { var [$$ACTION_ARG_0] = await decryptActionBoundArgs("786a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/25/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/25/output.js index 8259aa6d290de..536bcd26abc7e 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/25/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/25/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7f90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"006a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","0090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import deleteFromDb from 'db'; export const $$RSC_SERVER_ACTION_0 = async function deleteItem($$ACTION_CLOSURE_BOUND) { diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/26/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/26/output.js index 05d5b504d5ff7..91e265804cbb6 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/26/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/26/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"406a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; const noop = (action)=>action; export const $$RSC_SERVER_ACTION_0 = async function(data) { diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/27/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/27/output.js index 1c701e9e239a6..1c4ba8e67eab9 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/27/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/27/output.js @@ -1,7 +1,7 @@ // Rules here: // 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. -/* __next_internal_action_entry_do_not_use__ {"7f1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7f90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","7f9ed0cc47abc4e1c64320cf42b74ae60b58c40f00":"$$RSC_SERVER_ACTION_3","7fa9b2939c1f39073a6bed227fd20233064c8b7869":"$$RSC_SERVER_ACTION_4"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"001c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","006a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","0090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","009ed0cc47abc4e1c64320cf42b74ae60b58c40f00":"$$RSC_SERVER_ACTION_3","00a9b2939c1f39073a6bed227fd20233064c8b7869":"$$RSC_SERVER_ACTION_4"} */ 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() { console.log(1); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/28/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/28/output.js index 83d8e194a353a..2cee737c199c5 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/28/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/28/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"7f1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7f90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"401c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","406a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","4090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; let a, f; export const $$RSC_SERVER_ACTION_0 = async function action2($$ACTION_CLOSURE_BOUND, e) { diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/29/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/29/output.js index f73f282415a82..5dbd8edbc96f8 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/29/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/29/output.js @@ -10,5 +10,5 @@ ensureServerEntryExports([ dec, dec ]); -registerServerReference(dec, "ff28baf972d345b86b747ad0df73d75a0088a42214", null); -registerServerReference(dec, "ffc18c215a6b7cdc64bf709f3a714ffdef1bf9651d", null); +registerServerReference(dec, "7f28baf972d345b86b747ad0df73d75a0088a42214", null); +registerServerReference(dec, "7fc18c215a6b7cdc64bf709f3a714ffdef1bf9651d", null); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/3/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/3/output.js index 2117fe76cf7d1..f6947f77ffac0 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/3/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/3/output.js @@ -1,5 +1,5 @@ // app/send.ts -/* __next_internal_action_entry_do_not_use__ {"7fe10665baac148856374b2789aceb970f66fec33e":"myAction"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"70e10665baac148856374b2789aceb970f66fec33e":"myAction"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; export async function myAction(a, b, c) { console.log('a'); @@ -8,4 +8,4 @@ import { ensureServerEntryExports } from "private-next-rsc-action-validate"; ensureServerEntryExports([ myAction ]); -registerServerReference(myAction, "ffe10665baac148856374b2789aceb970f66fec33e", null); +registerServerReference(myAction, "70e10665baac148856374b2789aceb970f66fec33e", null); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/30/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/30/output.js index a4bdd1d8e39c7..9137c825df167 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/30/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/30/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"7f0090eaf4e1f08a2d94f6be401e54a2ded399b87c":"action0","7f1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7f90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"401c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","406a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","4090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","7f0090eaf4e1f08a2d94f6be401e54a2ded399b87c":"action0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; let a, f; export const $$RSC_SERVER_ACTION_0 = async function action2($$ACTION_CLOSURE_BOUND, e) { @@ -43,4 +43,4 @@ import { ensureServerEntryExports } from "private-next-rsc-action-validate"; ensureServerEntryExports([ action0 ]); -registerServerReference(action0, "ff0090eaf4e1f08a2d94f6be401e54a2ded399b87c", null); +registerServerReference(action0, "7f0090eaf4e1f08a2d94f6be401e54a2ded399b87c", null); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/31/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/31/output.js index f64d02d824199..0fd39627004aa 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/31/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/31/output.js @@ -21,5 +21,5 @@ ensureServerEntryExports([ action, action2 ]); -registerServerReference(action, "fff14702b5a021dd117f7ec7a3c838f397c2046d3b", null); -registerServerReference(action2, "ffabf760c735ba66c4c26a2913864dd7e28fb88a91", null); +registerServerReference(action, "7ff14702b5a021dd117f7ec7a3c838f397c2046d3b", null); +registerServerReference(action2, "7fabf760c735ba66c4c26a2913864dd7e28fb88a91", null); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/32/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/32/output.js index 60cfcd957a31d..ff157bbc4f32e 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/32/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/32/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"006a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$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 action($$ACTION_CLOSURE_BOUND) { var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/33/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/33/output.js index 3a6e7d58e76ba..086e124ba08ae 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/33/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/33/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"7f3128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"803128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; const v = 'world'; diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/34/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/34/output.js index 24c73d3f8322e..e334026349c47 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/34/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/34/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"7f12a8d21b6362b4cc8f5b15560525095bc48dba80":"$$RSC_SERVER_CACHE_3","7f3128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0","7f69348c79fce073bae2f70f139565a2fda1c74c74":"$$RSC_SERVER_CACHE_2","7f951c375b4a6a6e89d67b743ec5808127cfde405d":"$$RSC_SERVER_CACHE_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"8012a8d21b6362b4cc8f5b15560525095bc48dba80":"$$RSC_SERVER_CACHE_3","803128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0","8069348c79fce073bae2f70f139565a2fda1c74c74":"$$RSC_SERVER_CACHE_2","80951c375b4a6a6e89d67b743ec5808127cfde405d":"$$RSC_SERVER_CACHE_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; export var $$RSC_SERVER_CACHE_0 = $$cache__("default", "803128060c414d59f8552e4788b846c0d2b7f74743", async function() { diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/35/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/35/output.js index d2a8bd2fa2a56..93a7191cab2e4 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/35/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/35/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"7f3128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"803128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; export var $$RSC_SERVER_CACHE_0 = $$cache__("default", "803128060c414d59f8552e4788b846c0d2b7f74743", async function() { diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/36/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/36/output.js index 493ec6abfebc5..1c60a0901a298 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/36/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/36/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"7f12a8d21b6362b4cc8f5b15560525095bc48dba80":"$$RSC_SERVER_CACHE_3","7f3128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0","7f69348c79fce073bae2f70f139565a2fda1c74c74":"$$RSC_SERVER_CACHE_2","7f951c375b4a6a6e89d67b743ec5808127cfde405d":"$$RSC_SERVER_CACHE_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"8012a8d21b6362b4cc8f5b15560525095bc48dba80":"$$RSC_SERVER_CACHE_3","803128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0","80951c375b4a6a6e89d67b743ec5808127cfde405d":"$$RSC_SERVER_CACHE_1","c069348c79fce073bae2f70f139565a2fda1c74c74":"$$RSC_SERVER_CACHE_2"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; export var $$RSC_SERVER_CACHE_0 = $$cache__("default", "803128060c414d59f8552e4788b846c0d2b7f74743", async function foo() { diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/37/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/37/output.js index 5619738eb1b03..217f29d74b34d 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/37/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/37/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"7f3128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"803128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; export var $$RSC_SERVER_CACHE_0 = $$cache__("default", "803128060c414d59f8552e4788b846c0d2b7f74743", async function fn() { diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/38/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/38/output.js index 29f2ec0d8fb4e..cac59ff51f644 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/38/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/38/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"7f3128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"803128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; export var $$RSC_SERVER_CACHE_0 = $$cache__("x", "803128060c414d59f8552e4788b846c0d2b7f74743", async function foo() { diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/39/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/39/output.js index 48b76bb086fff..e809fc3d8331d 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/39/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/39/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"7f3128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"803128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; export var $$RSC_SERVER_CACHE_0 = $$cache__("default", "803128060c414d59f8552e4788b846c0d2b7f74743", async function fn($$ACTION_CLOSURE_BOUND) { diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/4/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/4/output.js index 7ee263c1214db..9d426b74da7c0 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/4/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/4/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"7f1ab723c80dcca470e0410b4b2a2fc2bf21f41476":"c","7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7f6e7bc104e4d6e7fda190c4a51be969cfd0be6d6d":"a","7fd1f7eb64271d7c601dfef7d4d7053de1c2ca4338":"b"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"001ab723c80dcca470e0410b4b2a2fc2bf21f41476":"c","006a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","006e7bc104e4d6e7fda190c4a51be969cfd0be6d6d":"a","00d1f7eb64271d7c601dfef7d4d7053de1c2ca4338":"b"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; export async function a() {} export async function b() {} @@ -14,6 +14,6 @@ ensureServerEntryExports([ b, c ]); -registerServerReference(a, "ff6e7bc104e4d6e7fda190c4a51be969cfd0be6d6d", null); -registerServerReference(b, "ffd1f7eb64271d7c601dfef7d4d7053de1c2ca4338", null); -registerServerReference(c, "ff1ab723c80dcca470e0410b4b2a2fc2bf21f41476", null); +registerServerReference(a, "006e7bc104e4d6e7fda190c4a51be969cfd0be6d6d", null); +registerServerReference(b, "00d1f7eb64271d7c601dfef7d4d7053de1c2ca4338", null); +registerServerReference(c, "001ab723c80dcca470e0410b4b2a2fc2bf21f41476", null); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/40/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/40/output.js index 26212bc8c12f7..2a1761af52fbc 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/40/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/40/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"7f1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","7f3128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"401c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","c03128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; export var $$RSC_SERVER_CACHE_0 = $$cache__("default", "c03128060c414d59f8552e4788b846c0d2b7f74743", async function cache($$ACTION_CLOSURE_BOUND, e) { diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/41/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/41/output.js index 43a3cc5e1a064..94bef357b693a 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/41/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/41/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7f951c375b4a6a6e89d67b743ec5808127cfde405d":"$$RSC_SERVER_CACHE_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"006a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","c0951c375b4a6a6e89d67b743ec5808127cfde405d":"$$RSC_SERVER_CACHE_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; export const $$RSC_SERVER_ACTION_0 = async function fn($$ACTION_CLOSURE_BOUND) { diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/42/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/42/output.js index 668e0446bd80d..11ca54947cece 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/42/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/42/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"7f3128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"803128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; export var $$RSC_SERVER_CACHE_0 = $$cache__("default", "803128060c414d59f8552e4788b846c0d2b7f74743", async function($$ACTION_CLOSURE_BOUND) { diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/43/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/43/output.js index 3329123ad8233..2b8ed9d10e340 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/43/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/43/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7f951c375b4a6a6e89d67b743ec5808127cfde405d":"$$RSC_SERVER_CACHE_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"006a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","e0951c375b4a6a6e89d67b743ec5808127cfde405d":"$$RSC_SERVER_CACHE_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; import { Foo } from './client'; diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/44/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/44/output.js index 43f02fbfec364..c381f6670ab49 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/44/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/44/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"7f1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7f90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","7f9ed0cc47abc4e1c64320cf42b74ae60b58c40f00":"$$RSC_SERVER_ACTION_3","7fa9b2939c1f39073a6bed227fd20233064c8b7869":"$$RSC_SERVER_ACTION_4"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"001c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","006a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","0090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","009ed0cc47abc4e1c64320cf42b74ae60b58c40f00":"$$RSC_SERVER_ACTION_3","00a9b2939c1f39073a6bed227fd20233064c8b7869":"$$RSC_SERVER_ACTION_4"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { Form } from './form'; export const $$RSC_SERVER_ACTION_0 = async function foo() { diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/45/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/45/output.js index 93440549e1211..1c75a5c34554d 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/45/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/45/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"7f3128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"803128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; // Expect no error here, this is allowed to be sync because it's not exported. diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/46/input.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/46/input.js index 7514f59607168..1ee0ad17b6006 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/46/input.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/46/input.js @@ -6,7 +6,7 @@ async function f1(a, b) { return [a, b] } -// Should be 0 110000 1, which is "60" in hex. +// Should be 0 110000 0, which is "60" in hex. async function f2(a, b) { 'use server' return [a, b] diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/46/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/46/output.js index 17da5b88c0d23..c2bde673e8829 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/46/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/46/output.js @@ -1,6 +1,6 @@ // This is for testing the "information byte" of Server Action / Cache IDs. // Should be 1 110000 0, which is "e0" in hex. -/* __next_internal_action_entry_do_not_use__ {"7f3128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0","7f471a5eb0be1c31686dd4ba938a80328b80b1615d":"$$RSC_SERVER_CACHE_5","7f69348c79fce073bae2f70f139565a2fda1c74c74":"$$RSC_SERVER_CACHE_2","7f90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","7f9ed0cc47abc4e1c64320cf42b74ae60b58c40f00":"$$RSC_SERVER_ACTION_3","7fa9b2939c1f39073a6bed227fd20233064c8b7869":"$$RSC_SERVER_ACTION_4"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"6090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","7c9ed0cc47abc4e1c64320cf42b74ae60b58c40f00":"$$RSC_SERVER_ACTION_3","7ea9b2939c1f39073a6bed227fd20233064c8b7869":"$$RSC_SERVER_ACTION_4","e03128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0","ff471a5eb0be1c31686dd4ba938a80328b80b1615d":"$$RSC_SERVER_CACHE_5","ff69348c79fce073bae2f70f139565a2fda1c74c74":"$$RSC_SERVER_CACHE_2"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; export var $$RSC_SERVER_CACHE_0 = $$cache__("default", "e03128060c414d59f8552e4788b846c0d2b7f74743", async function f1(a, b) { @@ -14,7 +14,7 @@ Object.defineProperty($$RSC_SERVER_CACHE_0, "name", { "writable": false }); var f1 = registerServerReference($$RSC_SERVER_CACHE_0, "e03128060c414d59f8552e4788b846c0d2b7f74743", null); -export const // Should be 0 110000 1, which is "60" in hex. +export const // Should be 0 110000 0, which is "60" in hex. $$RSC_SERVER_ACTION_1 = async function f2(a, b) { return [ a, diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/47/input.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/47/input.js new file mode 100644 index 0000000000000..8a45f34130a3d --- /dev/null +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/47/input.js @@ -0,0 +1,23 @@ +import { redirect } from 'next/navigation' + +async function action(formData) { + 'use server' + redirect( + '/header?name=' + + formData.get('name') + + '&hidden-info=' + + formData.get('hidden-info') + ) +} + +export default function Form() { + return ( + + + + + + ) +} diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/47/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/47/output.js new file mode 100644 index 0000000000000..aca93544a6413 --- /dev/null +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/47/output.js @@ -0,0 +1,16 @@ +/* __next_internal_action_entry_do_not_use__ {"406a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; +import { redirect } from 'next/navigation'; +export const $$RSC_SERVER_ACTION_0 = async function action(formData) { + redirect('/header?name=' + formData.get('name') + '&hidden-info=' + formData.get('hidden-info')); +}; +var action = registerServerReference($$RSC_SERVER_ACTION_0, "406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null); +export default function Form() { + return
+ + + +
; +} diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/48/input.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/48/input.js new file mode 100644 index 0000000000000..f2a39377871e4 --- /dev/null +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/48/input.js @@ -0,0 +1,45 @@ +'use server' + +// Should be 0 111000 0, which is "70" in hex. +export async function action(a, b, c) { + return ( +
+ {a} + {b} + {c} +
+ ) +} + +// Should be 0 111111 1, which is "7f" in hex. +export default async function action2(a, b, ...c) { + return ( +
+ {a} + {b} + {c} +
+ ) +} + +// Should be 0 111111 1, which is "60" in hex. +export async function action3(a, b) { + 'use server' + return ( +
+ {a} + {b} +
+ ) +} + +// Should be 1 110000 0, which is "e0" in hex. +export async function cache(a, b) { + 'use cache' + return ( +
+ {a} + {b} +
+ ) +} diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/48/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/48/output.js new file mode 100644 index 0000000000000..fbb5634dfae0a --- /dev/null +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/48/output.js @@ -0,0 +1,47 @@ +/* __next_internal_action_entry_do_not_use__ {"60079087479e4c103d815f273878c7d1b8e902cc39":"action3","70f14702b5a021dd117f7ec7a3c838f397c2046d3b":"action","7fc18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"default","e03128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; +import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; +// Should be 0 111000 0, which is "70" in hex. +export async function action(a, b, c) { + return
+ {a} + {b} + {c} +
; +} +// Should be 0 111111 1, which is "7f" in hex. +export default async function action2(a, b, ...c) { + return
+ {a} + {b} + {c} +
; +} +// Should be 0 111111 1, which is "60" in hex. +export async function action3(a, b) { + return
+ {a} + {b} +
; +} +export var $$RSC_SERVER_CACHE_0 = $$cache__("default", "e03128060c414d59f8552e4788b846c0d2b7f74743", async function cache(a, b) { + return
+ {a} + {b} +
; +}); +Object.defineProperty($$RSC_SERVER_CACHE_0, "name", { + "value": "cache", + "writable": false +}); +// Should be 1 110000 0, which is "e0" in hex. +export var cache = registerServerReference($$RSC_SERVER_CACHE_0, "e03128060c414d59f8552e4788b846c0d2b7f74743", null); +import { ensureServerEntryExports } from "private-next-rsc-action-validate"; +ensureServerEntryExports([ + action, + action2, + action3 +]); +registerServerReference(action, "70f14702b5a021dd117f7ec7a3c838f397c2046d3b", null); +registerServerReference(action2, "7fc18c215a6b7cdc64bf709f3a714ffdef1bf9651d", null); +registerServerReference(action3, "60079087479e4c103d815f273878c7d1b8e902cc39", null); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/49/input.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/49/input.js new file mode 100644 index 0000000000000..2109d425783d1 --- /dev/null +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/49/input.js @@ -0,0 +1,13 @@ +'use server' + +export default async (a, b, c) => { + 'use cache' + + return ( +
+ {a} + {b} + {c} +
+ ) +} diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/49/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/49/output.js new file mode 100644 index 0000000000000..241d76da05d22 --- /dev/null +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/49/output.js @@ -0,0 +1,11 @@ +/* __next_internal_action_entry_do_not_use__ {"f03128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; +import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; +export var $$RSC_SERVER_CACHE_0 = $$cache__("default", "f03128060c414d59f8552e4788b846c0d2b7f74743", async function(a, b, c) { + return
+ {a} + {b} + {c} +
; +}); +export default registerServerReference($$RSC_SERVER_CACHE_0, "f03128060c414d59f8552e4788b846c0d2b7f74743", null); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/5/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/5/output.js index d35b856f0efcd..a7406c49f8658 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/5/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/5/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"006a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import deleteFromDb from 'db'; const v1 = 'v1'; diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/50/input.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/50/input.js new file mode 100644 index 0000000000000..2d4a72ba13a61 --- /dev/null +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/50/input.js @@ -0,0 +1,13 @@ +'use server' + +export default async function (a, b, c) { + 'use cache' + + return ( +
+ {a} + {b} + {c} +
+ ) +} diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/50/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/50/output.js new file mode 100644 index 0000000000000..2f8a608608490 --- /dev/null +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/50/output.js @@ -0,0 +1,15 @@ +/* __next_internal_action_entry_do_not_use__ {"f03128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; +import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; +export var $$RSC_SERVER_CACHE_0 = $$cache__("default", "f03128060c414d59f8552e4788b846c0d2b7f74743", async function(a, b, c) { + return
+ {a} + {b} + {c} +
; +}); +Object.defineProperty($$RSC_SERVER_CACHE_0, "name", { + "value": "default", + "writable": false +}); +export default registerServerReference($$RSC_SERVER_CACHE_0, "f03128060c414d59f8552e4788b846c0d2b7f74743", null); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/51/input.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/51/input.js new file mode 100644 index 0000000000000..63a74d7121b7b --- /dev/null +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/51/input.js @@ -0,0 +1,35 @@ +'use cache' + +export default async function (a, b, c) { + 'use server' + + return ( +
+ {a} + {b} + {c} +
+ ) +} + +export async function foo(a, b) { + 'use server' + + return ( +
+ {a} + {b} +
+ ) +} + +export const bar = async (a, b) => { + 'use server' + + return ( +
+ {a} + {b} +
+ ) +} diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/51/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/51/output.js new file mode 100644 index 0000000000000..7406874b1a6ab --- /dev/null +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/51/output.js @@ -0,0 +1,29 @@ +/* __next_internal_action_entry_do_not_use__ {"601c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","609ed0cc47abc4e1c64320cf42b74ae60b58c40f00":"$$RSC_SERVER_ACTION_3","7090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; +import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; +export const $$RSC_SERVER_ACTION_1 = async function $$RSC_SERVER_ACTION_0(a, b, c) { + return
+ {a} + {b} + {c} +
; +}; +export default registerServerReference($$RSC_SERVER_ACTION_1, "7090b5db271335765a4b0eab01f044b381b5ebd5cd", null); +Object.defineProperty($$RSC_SERVER_ACTION_0, "name", { + "value": "default", + "writable": false +}); +export const $$RSC_SERVER_ACTION_2 = async function foo(a, b) { + return
+ {a} + {b} +
; +}; +export var foo = registerServerReference($$RSC_SERVER_ACTION_2, "601c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", null); +export const $$RSC_SERVER_ACTION_3 = async function bar(a, b) { + return
+ {a} + {b} +
; +}; +export const bar = registerServerReference($$RSC_SERVER_ACTION_3, "609ed0cc47abc4e1c64320cf42b74ae60b58c40f00", null); diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/6/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/6/output.js index d7e0e6ebff481..499dd2c17ef3a 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/6/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/6/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"006a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import f, { f1, f2 } from 'foo'; const f3 = 1; diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/7/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/7/output.js index 227bc36d3a7e6..e691fe34bed92 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/7/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/7/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"7f1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7f90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","7f9ed0cc47abc4e1c64320cf42b74ae60b58c40f00":"$$RSC_SERVER_ACTION_3"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"001c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","006a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","0090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","009ed0cc47abc4e1c64320cf42b74ae60b58c40f00":"$$RSC_SERVER_ACTION_3"} */ import { registerServerReference } from "private-next-rsc-server-reference"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import deleteFromDb from 'db'; export const $$RSC_SERVER_ACTION_0 = async function deleteItem1($$ACTION_CLOSURE_BOUND) { diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/8/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/8/output.js index 2e5866b09d30b..290f7f414d8b4 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/8/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/8/output.js @@ -1,4 +1,4 @@ -/* __next_internal_action_entry_do_not_use__ {"7f6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; +/* __next_internal_action_entry_do_not_use__ {"706a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$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 myAction(a, b, c) { // comment diff --git a/crates/next-custom-transforms/tests/fixture/server-actions/server/9/output.js b/crates/next-custom-transforms/tests/fixture/server-actions/server/9/output.js index 76253b2046cf9..d369550a96f8c 100644 --- a/crates/next-custom-transforms/tests/fixture/server-actions/server/9/output.js +++ b/crates/next-custom-transforms/tests/fixture/server-actions/server/9/output.js @@ -13,6 +13,6 @@ ensureServerEntryExports([ bar, qux ]); -registerServerReference(foo, "ffab21efdafbe611287bc25c0462b1e0510d13e48b", null); -registerServerReference(bar, "ff050e3854b72b19e3c7e3966a67535543a90bf7e0", null); -registerServerReference(qux, "ffc18c215a6b7cdc64bf709f3a714ffdef1bf9651d", null); +registerServerReference(foo, "7fab21efdafbe611287bc25c0462b1e0510d13e48b", null); +registerServerReference(bar, "7f050e3854b72b19e3c7e3966a67535543a90bf7e0", null); +registerServerReference(qux, "7fc18c215a6b7cdc64bf709f3a714ffdef1bf9651d", null); From 3440354c3bb16728bfe50f8d7bd8ccebb0593b1f Mon Sep 17 00:00:00 2001 From: Shu Ding Date: Mon, 28 Oct 2024 03:39:42 +0100 Subject: [PATCH 4/4] fix clippy --- .../src/transforms/server_actions.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/crates/next-custom-transforms/src/transforms/server_actions.rs b/crates/next-custom-transforms/src/transforms/server_actions.rs index 96b08be3f7c41..2207a2f5aab75 100644 --- a/crates/next-custom-transforms/src/transforms/server_actions.rs +++ b/crates/next-custom-transforms/src/transforms/server_actions.rs @@ -1532,7 +1532,7 @@ impl VisitMut for ServerActions { f.ident.clone(), f.ident.sym.to_string(), self.generate_server_reference_id( - &f.ident.sym.to_string(), + f.ident.sym.as_ref(), ref_id, Some( &f.function @@ -1555,7 +1555,7 @@ impl VisitMut for ServerActions { ident.clone(), ident.sym.to_string(), self.generate_server_reference_id( - &ident.sym.to_string(), + ident.sym.as_ref(), is_cache_file, None, ), @@ -1596,7 +1596,7 @@ impl VisitMut for ServerActions { ident.clone(), sym.to_string(), self.generate_server_reference_id( - &sym.to_string(), + sym.as_ref(), is_cache_file, None, ), @@ -1607,7 +1607,7 @@ impl VisitMut for ServerActions { ident.clone(), str.value.to_string(), self.generate_server_reference_id( - &str.value.to_string(), + str.value.as_ref(), is_cache_file, None, ), @@ -1619,7 +1619,7 @@ impl VisitMut for ServerActions { ident.clone(), ident.sym.to_string(), self.generate_server_reference_id( - &ident.sym.to_string(), + ident.sym.as_ref(), is_cache_file, None, ), @@ -1654,7 +1654,7 @@ impl VisitMut for ServerActions { // to skip self-annotated exports here. if !(is_cache_fn && self.config.is_react_server_layer) { let ref_id = self.generate_server_reference_id( - "default".into(), + "default", is_cache, Some( &f.function.params.iter().map(|p| p.pat.clone()).collect(), @@ -1740,7 +1740,7 @@ impl VisitMut for ServerActions { new_ident.clone(), "default".into(), self.generate_server_reference_id( - "default".into(), + "default", is_cache, Some(&arrow.params), ), @@ -1763,7 +1763,7 @@ impl VisitMut for ServerActions { ident.clone(), "default".into(), self.generate_server_reference_id( - "default".into(), + "default", is_cache_file, None, ), @@ -1781,7 +1781,7 @@ impl VisitMut for ServerActions { new_ident.clone(), "default".into(), self.generate_server_reference_id( - "default".into(), + "default", is_cache_file, None, ),