Unverified Commit 669c52e3 authored by Janka Uryga's avatar Janka Uryga Committed by GitHub

typechecking inputs/outputs in action transform tests (#75935)

This PR attempts to add typechecking to the server actions tests
fixtures in order to add an extra layer of validation against compiler
bugs. (there's a couple!). Unfortunately the tests were pretty
loosey-goosey around undefined variables, so there's a lot of noise in
adding missing imports for `Button` etc. i tried to call out the
interesting changes via PR comments.

Note that this is a bit limited, because we often have to rely on
typescript inferring some sensible types for the outputs -- see e.g. the
issue with `24/output.js` mentioned below. In case typescript can't
infer sensible types for something, we can just exclude that file from
checking. this seems to be pretty rare, so i think it's okay.

We should also definitely add typechecking to the other fixture folders,
but this PR is already big, so i want to do that piecemeal.

### TODO
- [x] invoke the typechecker in CI
- added a `check-compiler-fixtures` script that runs as part of
`types-and-precompiled` (open to feedback, maybe this isn't the right
place?)
- [x] figure out how to make `tsc` error on
`crates/next-custom-transforms/tests/fixture/server-actions/server-graph/51/output.js`,
where we're referencing a non-existent variable `$$RSC_SERVER_ACTION_0`.
right now, it emits no errors
- this is a compiler bug, and i want to catch bugs like this in the
future
  - solution: https://github.com/vercel/next.js/pull/75944
- [x] figure out why `tsc` is complaining about a type mismatch in
`crates/next-custom-transforms/tests/fixture/server-actions/server-graph/24/output.js`
- we can work around this by loosening the types for
`registerServerReference`, but i'd rather we didn't have to do that
- this seems to be a bizarre TS behavior where `fn.bind(...)` makes all
the params optional in JS files. ignoring this for now
parent 871ca31e
'use server' 'use server'
export const { sampleFunction } = someObject import ANYTHING from 'anything'
export const { sampleFunction2 } = fn()
export let { 0: sampleFunction3, 1: sampleFunction4 } = [g(), g()] export const { sampleFunction } = ANYTHING
export const { sampleFunction2 } = ANYTHING()
export let { 0: sampleFunction3, 1: sampleFunction4 } = [ANYTHING(), ANYTHING()]
...@@ -6,6 +6,7 @@ export async function action0(b, c, ...g) { ...@@ -6,6 +6,7 @@ export async function action0(b, c, ...g) {
return async function action1(d) { return async function action1(d) {
'use server' 'use server'
let f let f
// @ts-expect-error: window is not iterable
console.log(...window, { window }) console.log(...window, { window })
console.log(a, b, action2) console.log(a, b, action2)
......
/// <reference types="./next" />
/// <reference types="./modules" />
declare module 'database' {
export const db: {
serialize<T>(cb: () => T): T
run(
statement: string,
args: Record<string, any>,
onComplete: (this: { lastID: string }, error?: Error) => void
): void
}
}
declare module 'db' {
export default function deleteFromDb(arg: any, ...args: any[]): Promise<void>
}
declare module 'auth' {
export function validator<TFn extends (...args: any[]) => any>(fn: TFn): TFn
export function another<TFn extends (...args: any[]) => any>(fn: TFn): TFn
}
declare module 'anything' {
const ANYTHING: any
export default ANYTHING
}
declare module 'foo' {
const f: any
export default f
export const f1: any
export const f2: any
}
declare module 'components' {
import React from 'react'
export function Button(
props: {
action: () => Promise<any>
} & React.ComponentProps<'button'>
): React.ReactNode
export function Form(
props: React.PropsWithChildren<{ action: () => Promise<any> }>
): React.ReactNode
export function Client(props: Record<string, any>): React.ReactNode
}
declare module 'navigation' {
export function redirect(href: string): void
}
declare module 'private-next-rsc-action-encryption' {
export function encryptActionBoundArgs(
actionId: string,
...args: any[]
): Promise<string>
export function decryptActionBoundArgs(
actionId: string,
encryptedPromise: Promise<string>
): Promise<any[]>
}
declare module 'private-next-rsc-server-reference' {
export function registerServerReference<T extends (...args: any[]) => any>(
reference: T,
id: string,
exportName: string | null
): T
}
declare module 'private-next-rsc-action-client-wrapper' {
export function callServer(
actionId: string,
actionArgs: unknown[]
): Promise<unknown>
export function findSourceMapURL(filename: string): string | null
const createServerReference: (
id: string,
callServer: any,
encodeFormAction?: any,
findSourceMapURL?: any,
functionName?: string
) => (...args: unknown[]) => Promise<unknown>
}
declare module 'private-next-rsc-action-validate' {
function ensureServerEntryExports(actions: unknown[]): void
}
declare module 'private-next-rsc-cache-wrapper' {
export function cache<TFn extends (...args: any[]) => Promise<any>>(
kind: string,
id: string,
boundArgsLength: number,
fn: TFn
): TFn
}
import { Button } from 'components'
import deleteFromDb from 'db' import deleteFromDb from 'db'
export function Item({ id1, id2 }) { export function Item({ id1, id2 }) {
......
/* __next_internal_action_entry_do_not_use__ {"406a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","4090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; /* __next_internal_action_entry_do_not_use__ {"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"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
import { Button } from 'components';
import deleteFromDb from 'db'; import deleteFromDb from 'db';
export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_0 = async function deleteItem($$ACTION_CLOSURE_BOUND) { export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_0 = async function deleteItem($$ACTION_CLOSURE_BOUND) {
var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND);
......
import { Button } from 'components'
import deleteFromDb from 'db' import deleteFromDb from 'db'
const v1 = 'v1' const v1 = 'v1'
...@@ -13,7 +14,7 @@ export function Item({ id1, id2 }) { ...@@ -13,7 +14,7 @@ export function Item({ id1, id2 }) {
return <Button action={deleteItem}>Delete</Button> return <Button action={deleteItem}>Delete</Button>
} }
const f = (x) => { let f = (x) => {
async function g(y, ...z) { async function g(y, ...z) {
'use server' 'use server'
return x + y + z[0] return x + y + z[0]
...@@ -23,6 +24,14 @@ const f = (x) => { ...@@ -23,6 +24,14 @@ const f = (x) => {
const g = (x) => { const g = (x) => {
f = async (y, ...z) => { f = async (y, ...z) => {
'use server' 'use server'
return x + y + z[0] return (
x +
y +
// can't be a `ts-expect-error` because the type of `z` changes to `any` in the output
// and it stops being an error
//
// @ts-ignore: incompatible argument types
z[0]
)
} }
} }
/* __next_internal_action_entry_do_not_use__ {"406a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7f1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","7f90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; /* __next_internal_action_entry_do_not_use__ {"406a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$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 { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
import { Button } from 'components';
import deleteFromDb from 'db'; import deleteFromDb from 'db';
const v1 = 'v1'; const v1 = 'v1';
export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_0 = async function deleteItem($$ACTION_CLOSURE_BOUND) { export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_0 = async function deleteItem($$ACTION_CLOSURE_BOUND) {
...@@ -17,12 +18,16 @@ export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_1 = a ...@@ -17,12 +18,16 @@ export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_1 = a
var [$$ACTION_ARG_0] = await decryptActionBoundArgs("7f90b5db271335765a4b0eab01f044b381b5ebd5cd", $$ACTION_CLOSURE_BOUND); var [$$ACTION_ARG_0] = await decryptActionBoundArgs("7f90b5db271335765a4b0eab01f044b381b5ebd5cd", $$ACTION_CLOSURE_BOUND);
return $$ACTION_ARG_0 + y + z[0]; return $$ACTION_ARG_0 + y + z[0];
}; };
const f = (x)=>{ let f = (x)=>{
var g = registerServerReference($$RSC_SERVER_ACTION_1, "7f90b5db271335765a4b0eab01f044b381b5ebd5cd", null).bind(null, encryptActionBoundArgs("7f90b5db271335765a4b0eab01f044b381b5ebd5cd", x)); var g = registerServerReference($$RSC_SERVER_ACTION_1, "7f90b5db271335765a4b0eab01f044b381b5ebd5cd", null).bind(null, encryptActionBoundArgs("7f90b5db271335765a4b0eab01f044b381b5ebd5cd", x));
}; };
export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_2 = async function f($$ACTION_CLOSURE_BOUND, y, ...z) { export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_2 = async function f($$ACTION_CLOSURE_BOUND, y, ...z) {
var [$$ACTION_ARG_0] = await decryptActionBoundArgs("7f1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", $$ACTION_CLOSURE_BOUND); var [$$ACTION_ARG_0] = await decryptActionBoundArgs("7f1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", $$ACTION_CLOSURE_BOUND);
return $$ACTION_ARG_0 + y + z[0]; return $$ACTION_ARG_0 + y + // can't be a `ts-expect-error` because the type of `z` changes to `any` in the output
// and it stops being an error
//
// @ts-ignore: incompatible argument types
z[0];
}; };
const g = (x)=>{ const g = (x)=>{
f = registerServerReference($$RSC_SERVER_ACTION_2, "7f1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", null).bind(null, encryptActionBoundArgs("7f1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", x)); f = registerServerReference($$RSC_SERVER_ACTION_2, "7f1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", null).bind(null, encryptActionBoundArgs("7f1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", x));
......
import { Button } from 'components'
import deleteFromDb from 'db' import deleteFromDb from 'db'
const v1 = 'v1' const v1 = 'v1'
......
/* __next_internal_action_entry_do_not_use__ {"406a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","4090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; /* __next_internal_action_entry_do_not_use__ {"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"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
import { Button } from 'components';
import deleteFromDb from 'db'; import deleteFromDb from 'db';
const v1 = 'v1'; const v1 = 'v1';
export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_0 = async function action($$ACTION_CLOSURE_BOUND) { export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_0 = async function action($$ACTION_CLOSURE_BOUND) {
......
import { Button } from 'components'
export function Item({ value }) { export function Item({ value }) {
return ( return (
<> <>
......
/* __next_internal_action_entry_do_not_use__ {"606a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; /* __next_internal_action_entry_do_not_use__ {"606a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
import { Button } from 'components';
export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_0 = async function action($$ACTION_CLOSURE_BOUND, value2) { export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_0 = async function action($$ACTION_CLOSURE_BOUND, value2) {
var [$$ACTION_ARG_0] = await decryptActionBoundArgs("606a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); var [$$ACTION_ARG_0] = await decryptActionBoundArgs("606a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND);
return $$ACTION_ARG_0 * value2; return $$ACTION_ARG_0 * value2;
......
import { validator } from 'auth'
import { Button } from 'components'
async function myAction(a, b, c) { async function myAction(a, b, c) {
'use server' 'use server'
console.log('a') console.log('a')
...@@ -8,6 +11,6 @@ export default function Page() { ...@@ -8,6 +11,6 @@ export default function Page() {
} }
// TODO: should use `action` as function name? // TODO: should use `action` as function name?
export const action = withValidate(async () => { export const action = validator(async () => {
'use server' 'use server'
}) })
/*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ /* __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"; /* __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"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
export const $$RSC_SERVER_ACTION_0 = async function myAction(a, b, c) { import { validator } from 'auth';
import { Button } from 'components';
export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_0 = async function myAction(a, b, c) {
console.log('a'); console.log('a');
}; };
var myAction = registerServerReference($$RSC_SERVER_ACTION_0, "706a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null); var myAction = registerServerReference($$RSC_SERVER_ACTION_0, "706a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null);
...@@ -9,4 +11,4 @@ export default function Page() { ...@@ -9,4 +11,4 @@ export default function Page() {
} }
export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_1 = async function() {}; export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_1 = async function() {};
// TODO: should use `action` as function name? // TODO: should use `action` as function name?
export const action = withValidate(registerServerReference($$RSC_SERVER_ACTION_1, "0090b5db271335765a4b0eab01f044b381b5ebd5cd", null)); export const action = validator(registerServerReference($$RSC_SERVER_ACTION_1, "0090b5db271335765a4b0eab01f044b381b5ebd5cd", null));
'use server' 'use server'
/** @type {[any]} */
const [foo] = [null] const [foo] = [null]
export default foo export default foo
/* __next_internal_action_entry_do_not_use__ {"7fc18c215a6b7cdc64bf709f3a714ffdef1bf9651d":"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"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
const [foo] = [ /** @type {[any]} */ const [foo] = [
null null
]; ];
export default /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ foo; export default /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ foo;
......
import { validator, another } from 'auth' import { validator, another } from 'auth'
import { Button } from 'components'
const x = 1 const x = 1
export default function Page() { export default function Page() {
const y = 1 const y = 1
return ( return (
<Foo <Button
// TODO: should use `action` as function name? // TODO: should use `action` as function name?
action={validator(async function (z) { action={validator(async function (z) {
'use server' 'use server'
......
/* __next_internal_action_entry_do_not_use__ {"001c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","0090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","606a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ 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","606a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
import { validator, another } from 'auth'; import { validator, another } from 'auth';
import { Button } from 'components';
const x = 1; const x = 1;
export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_0 = async function($$ACTION_CLOSURE_BOUND, z) { export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_0 = async function($$ACTION_CLOSURE_BOUND, z) {
var [$$ACTION_ARG_0] = await decryptActionBoundArgs("606a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); var [$$ACTION_ARG_0] = await decryptActionBoundArgs("606a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND);
...@@ -8,7 +9,7 @@ export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_0 = a ...@@ -8,7 +9,7 @@ export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_0 = a
}; };
export default function Page() { export default function Page() {
const y = 1; const y = 1;
return <Foo // TODO: should use `action` as function name? return <Button // TODO: should use `action` as function name?
action={validator(registerServerReference($$RSC_SERVER_ACTION_0, "606a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null).bind(null, encryptActionBoundArgs("606a88810ecce4a4e8b59d53b8327d7e98bbf251d7", y)))}/>; action={validator(registerServerReference($$RSC_SERVER_ACTION_0, "606a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null).bind(null, encryptActionBoundArgs("606a88810ecce4a4e8b59d53b8327d7e98bbf251d7", y)))}/>;
} }
export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_1 = async function() {}; export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_1 = async function() {};
......
import { Button } from 'components'
import deleteFromDb from 'db' import deleteFromDb from 'db'
export function Item({ id1, id2 }) { export function Item({ id1, id2 }) {
...@@ -26,6 +27,8 @@ export function Item2({ id1, id2 }) { ...@@ -26,6 +27,8 @@ export function Item2({ id1, id2 }) {
return temp return temp
// FIXME: invalid transformation of hoisted functions (https://github.com/vercel/next.js/issues/57392)
// (remove output.js from `tsconfig.json#exclude` to see the error)
async function deleteItem() { async function deleteItem() {
'use server' 'use server'
await deleteFromDb(id1) await deleteFromDb(id1)
......
/* __next_internal_action_entry_do_not_use__ {"406a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","4090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; /* __next_internal_action_entry_do_not_use__ {"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"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
import { Button } from 'components';
import deleteFromDb from 'db'; import deleteFromDb from 'db';
export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_0 = async function deleteItem($$ACTION_CLOSURE_BOUND) { export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_0 = async function deleteItem($$ACTION_CLOSURE_BOUND) {
var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND);
...@@ -14,7 +15,9 @@ export function Item({ id1, id2 }) { ...@@ -14,7 +15,9 @@ export function Item({ id1, id2 }) {
})(); })();
var deleteItem = registerServerReference($$RSC_SERVER_ACTION_0, "406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null).bind(null, encryptActionBoundArgs("406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", id1, id2)); var deleteItem = registerServerReference($$RSC_SERVER_ACTION_0, "406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null).bind(null, encryptActionBoundArgs("406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", id1, id2));
} }
export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_1 = async function deleteItem($$ACTION_CLOSURE_BOUND) { export const // FIXME: invalid transformation of hoisted functions (https://github.com/vercel/next.js/issues/57392)
// (remove output.js from `tsconfig.json#exclude` to see the error)
/*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_1 = async function deleteItem($$ACTION_CLOSURE_BOUND) {
var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("4090b5db271335765a4b0eab01f044b381b5ebd5cd", $$ACTION_CLOSURE_BOUND); var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("4090b5db271335765a4b0eab01f044b381b5ebd5cd", $$ACTION_CLOSURE_BOUND);
await deleteFromDb($$ACTION_ARG_0); await deleteFromDb($$ACTION_ARG_0);
await deleteFromDb($$ACTION_ARG_1); await deleteFromDb($$ACTION_ARG_1);
......
...@@ -4,9 +4,12 @@ function Comp(b, c, ...g) { ...@@ -4,9 +4,12 @@ function Comp(b, c, ...g) {
return async function action1(d) { return async function action1(d) {
'use server' 'use server'
let f let f
// @ts-expect-error: window is not iterable
console.log(...window, { window }) console.log(...window, { window })
console.log(a, b, action2) console.log(a, b, action2)
// FIXME: invalid transformation of hoisted functions (https://github.com/vercel/next.js/issues/57392)
// (remove output.js from `tsconfig.json#exclude` to see the error)
async function action2(e) { async function action2(e) {
'use server' 'use server'
console.log(a, c, d, e, f, g) console.log(a, c, d, e, f, g)
......
/* __next_internal_action_entry_do_not_use__ {"601c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","606a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","6090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; /* __next_internal_action_entry_do_not_use__ {"601c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","606a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","6090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
let a, f; let a, f;
export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_0 = async function action2($$ACTION_CLOSURE_BOUND, e) { export const // FIXME: invalid transformation of hoisted functions (https://github.com/vercel/next.js/issues/57392)
// (remove output.js from `tsconfig.json#exclude` to see the error)
/*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$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("606a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2, $$ACTION_ARG_3] = await decryptActionBoundArgs("606a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND);
console.log(a, $$ACTION_ARG_0, $$ACTION_ARG_1, e, $$ACTION_ARG_2, $$ACTION_ARG_3); console.log(a, $$ACTION_ARG_0, $$ACTION_ARG_1, e, $$ACTION_ARG_2, $$ACTION_ARG_3);
}; };
...@@ -13,6 +15,7 @@ export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_1 = a ...@@ -13,6 +15,7 @@ export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_1 = a
export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_2 = async function action1($$ACTION_CLOSURE_BOUND, d) { export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_2 = async function action1($$ACTION_CLOSURE_BOUND, d) {
var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("601c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", $$ACTION_CLOSURE_BOUND); var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("601c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", $$ACTION_CLOSURE_BOUND);
let f; let f;
// @ts-expect-error: window is not iterable
console.log(...window, { console.log(...window, {
window window
}); });
......
...@@ -6,9 +6,12 @@ export async function action0(b, c, ...g) { ...@@ -6,9 +6,12 @@ export async function action0(b, c, ...g) {
return async function action1(d) { return async function action1(d) {
'use server' 'use server'
let f let f
// @ts-expect-error: window is not iterable
console.log(...window, { window }) console.log(...window, { window })
console.log(a, b, action2) console.log(a, b, action2)
// FIXME: invalid transformation of hoisted functions (https://github.com/vercel/next.js/issues/57392)
// (remove output.js from `tsconfig.json#exclude` to see the error)
async function action2(e) { async function action2(e) {
'use server' 'use server'
console.log(a, c, d, e, f, g) console.log(a, c, d, e, f, g)
......
/* __next_internal_action_entry_do_not_use__ {"601c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","606a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","6090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","7f0090eaf4e1f08a2d94f6be401e54a2ded399b87c":"action0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; /* __next_internal_action_entry_do_not_use__ {"601c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","606a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","6090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","7f0090eaf4e1f08a2d94f6be401e54a2ded399b87c":"action0"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
let a, f; let a, f;
export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_0 = async function action2($$ACTION_CLOSURE_BOUND, e) { export const // FIXME: invalid transformation of hoisted functions (https://github.com/vercel/next.js/issues/57392)
// (remove output.js from `tsconfig.json#exclude` to see the error)
/*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$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("606a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2, $$ACTION_ARG_3] = await decryptActionBoundArgs("606a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND);
console.log(a, $$ACTION_ARG_0, $$ACTION_ARG_1, e, $$ACTION_ARG_2, $$ACTION_ARG_3); console.log(a, $$ACTION_ARG_0, $$ACTION_ARG_1, e, $$ACTION_ARG_2, $$ACTION_ARG_3);
}; };
...@@ -13,6 +15,7 @@ export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_1 = a ...@@ -13,6 +15,7 @@ export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_1 = a
export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_2 = async function action1($$ACTION_CLOSURE_BOUND, d) { export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_2 = async function action1($$ACTION_CLOSURE_BOUND, d) {
var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("601c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", $$ACTION_CLOSURE_BOUND); var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("601c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", $$ACTION_CLOSURE_BOUND);
let f; let f;
// @ts-expect-error: window is not iterable
console.log(...window, { console.log(...window, {
window window
}); });
......
...@@ -10,5 +10,6 @@ async function Component({ foo }) { ...@@ -10,5 +10,6 @@ async function Component({ foo }) {
} }
const data = await fn() const data = await fn()
// @ts-expect-error: data is not a valid react child
return <div>{data}</div> return <div>{data}</div>
} }
...@@ -15,6 +15,7 @@ async function Component({ foo }) { ...@@ -15,6 +15,7 @@ async function Component({ foo }) {
const a = 123; const a = 123;
var fn = $$RSC_SERVER_REF_1.bind(null, encryptActionBoundArgs("c03128060c414d59f8552e4788b846c0d2b7f74743", a, foo)); var fn = $$RSC_SERVER_REF_1.bind(null, encryptActionBoundArgs("c03128060c414d59f8552e4788b846c0d2b7f74743", a, foo));
const data = await fn(); const data = await fn();
// @ts-expect-error: data is not a valid react child
return <div>{data}</div>; return <div>{data}</div>;
} }
var $$RSC_SERVER_REF_1 = registerServerReference($$RSC_SERVER_CACHE_0, "c03128060c414d59f8552e4788b846c0d2b7f74743", null); var $$RSC_SERVER_REF_1 = registerServerReference($$RSC_SERVER_CACHE_0, "c03128060c414d59f8552e4788b846c0d2b7f74743", null);
import { Form } from 'components'
async function Component({ a }) { async function Component({ a }) {
const b = 1 const b = 1
...@@ -16,8 +18,8 @@ async function Component({ a }) { ...@@ -16,8 +18,8 @@ async function Component({ a }) {
} }
return ( return (
<form action={action}> <Form action={action}>
<button>Submit</button> <button>Submit</button>
</form> </Form>
) )
} }
/* __next_internal_action_entry_do_not_use__ {"601c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","e03128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; /* __next_internal_action_entry_do_not_use__ {"601c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","e03128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; import { cache as $$cache__ } from "private-next-rsc-cache-wrapper";
import { Form } from 'components';
export var /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_CACHE_0 = $$cache__("default", "e03128060c414d59f8552e4788b846c0d2b7f74743", 2, async function cache([$$ACTION_ARG_0, $$ACTION_ARG_1], e) { export var /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_CACHE_0 = $$cache__("default", "e03128060c414d59f8552e4788b846c0d2b7f74743", 2, async function cache([$$ACTION_ARG_0, $$ACTION_ARG_1], e) {
const f = $$ACTION_ARG_0 + e; const f = $$ACTION_ARG_0 + e;
return [ return [
...@@ -23,8 +24,8 @@ export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_2 = a ...@@ -23,8 +24,8 @@ export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_2 = a
async function Component({ a }) { async function Component({ a }) {
const b = 1; const b = 1;
var action = registerServerReference($$RSC_SERVER_ACTION_2, "601c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", null).bind(null, encryptActionBoundArgs("601c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", a, b)); var action = registerServerReference($$RSC_SERVER_ACTION_2, "601c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", null).bind(null, encryptActionBoundArgs("601c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", a, b));
return <form action={action}> return <Form action={action}>
<button>Submit</button> <button>Submit</button>
</form>; </Form>;
} }
var $$RSC_SERVER_REF_1 = registerServerReference($$RSC_SERVER_CACHE_0, "e03128060c414d59f8552e4788b846c0d2b7f74743", null); var $$RSC_SERVER_REF_1 = registerServerReference($$RSC_SERVER_CACHE_0, "e03128060c414d59f8552e4788b846c0d2b7f74743", null);
...@@ -10,5 +10,6 @@ export async function Component({ foo }) { ...@@ -10,5 +10,6 @@ export async function Component({ foo }) {
} }
const data = await fn() const data = await fn()
// @ts-expect-error: data is not a valid react child
return <div>{data}</div> return <div>{data}</div>
} }
...@@ -12,6 +12,7 @@ export var /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_CACHE_1 = $$ca ...@@ -12,6 +12,7 @@ export var /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_CACHE_1 = $$ca
const a = 123; const a = 123;
var fn = registerServerReference($$RSC_SERVER_ACTION_0, "406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null).bind(null, encryptActionBoundArgs("406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", a, foo)); var fn = registerServerReference($$RSC_SERVER_ACTION_0, "406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null).bind(null, encryptActionBoundArgs("406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", a, foo));
const data = await fn(); const data = await fn();
// @ts-expect-error: data is not a valid react child
return <div>{data}</div>; return <div>{data}</div>;
}); });
Object.defineProperty($$RSC_SERVER_CACHE_1, "name", { Object.defineProperty($$RSC_SERVER_CACHE_1, "name", {
......
...@@ -10,5 +10,6 @@ async function Component({ foo }) { ...@@ -10,5 +10,6 @@ async function Component({ foo }) {
} }
const data = await fn() const data = await fn()
// @ts-expect-error: data is not a valid react child
return <div>{data}</div> return <div>{data}</div>
} }
...@@ -15,6 +15,7 @@ async function Component({ foo }) { ...@@ -15,6 +15,7 @@ async function Component({ foo }) {
const a = 123; const a = 123;
const fn = $$RSC_SERVER_REF_1.bind(null, encryptActionBoundArgs("c03128060c414d59f8552e4788b846c0d2b7f74743", a, foo)); const fn = $$RSC_SERVER_REF_1.bind(null, encryptActionBoundArgs("c03128060c414d59f8552e4788b846c0d2b7f74743", a, foo));
const data = await fn(); const data = await fn();
// @ts-expect-error: data is not a valid react child
return <div>{data}</div>; return <div>{data}</div>;
} }
var $$RSC_SERVER_REF_1 = registerServerReference($$RSC_SERVER_CACHE_0, "c03128060c414d59f8552e4788b846c0d2b7f74743", null); var $$RSC_SERVER_REF_1 = registerServerReference($$RSC_SERVER_CACHE_0, "c03128060c414d59f8552e4788b846c0d2b7f74743", null);
import { Foo } from './client' import { Button } from 'components'
const secret = 'my password is qwerty123' const secret = 'my password is qwerty123'
...@@ -8,7 +8,7 @@ async function getCachedRandom(x, children) { ...@@ -8,7 +8,7 @@ async function getCachedRandom(x, children) {
x, x,
y: Math.random(), y: Math.random(),
z: ( z: (
<Foo <Button
action={async () => { action={async () => {
'use server' 'use server'
......
/* __next_internal_action_entry_do_not_use__ {"406a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","e0951c375b4a6a6e89d67b743ec5808127cfde405d":"$$RSC_SERVER_CACHE_1"} */ import { registerServerReference } from "private-next-rsc-server-reference"; /* __next_internal_action_entry_do_not_use__ {"406a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$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 { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; import { cache as $$cache__ } from "private-next-rsc-cache-wrapper";
import { Foo } from './client'; import { Button } from 'components';
const secret = 'my password is qwerty123'; const secret = 'my password is qwerty123';
export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_0 = async function action($$ACTION_CLOSURE_BOUND) { export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_0 = async function action($$ACTION_CLOSURE_BOUND) {
var [$$ACTION_ARG_0] = await decryptActionBoundArgs("406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); var [$$ACTION_ARG_0] = await decryptActionBoundArgs("406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND);
...@@ -11,7 +11,7 @@ export var /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_CACHE_1 = $$ca ...@@ -11,7 +11,7 @@ export var /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_CACHE_1 = $$ca
return { return {
x, x,
y: Math.random(), y: Math.random(),
z: <Foo action={registerServerReference($$RSC_SERVER_ACTION_0, "406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null).bind(null, encryptActionBoundArgs("406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", x))}/>, z: <Button action={registerServerReference($$RSC_SERVER_ACTION_0, "406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null).bind(null, encryptActionBoundArgs("406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", x))}/>,
r: children r: children
}; };
}); });
......
import { Form } from './form' import { Form } from 'components'
export default function Page() { export default function Page() {
const foo = async () => { const foo = async () => {
......
/* __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"; /* __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 { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
import { Form } from './form'; import { Form } from 'components';
export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_0 = async function foo() { export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_0 = async function foo() {
return 'declarator arrow function expression'; return 'declarator arrow function expression';
}; };
......
...@@ -25,13 +25,13 @@ async function f4(a, b, c, d, e) { ...@@ -25,13 +25,13 @@ async function f4(a, b, c, d, e) {
} }
// Should be 0 111111 0, which is "7e" in hex. // Should be 0 111111 0, which is "7e" in hex.
async function f4(a, b, c, d, e, f) { async function f5(a, b, c, d, e, f) {
'use server' 'use server'
return [a, b, c, d, e, f] return [a, b, c, d, e, f]
} }
// Should be 1 111111 1, which is "ff" in hex. // Should be 1 111111 1, which is "ff" in hex.
async function f5(a, b, c, d, e, f, g) { async function f6(a, b, c, d, e, f, g) {
'use cache' 'use cache'
return [a, b, c, d, e, f, g] return [a, b, c, d, e, f, g]
} }
...@@ -47,7 +47,7 @@ export const // Should be 0 111110 0, which is "7c" in hex. ...@@ -47,7 +47,7 @@ export const // Should be 0 111110 0, which is "7c" in hex.
}; };
var f4 = registerServerReference($$RSC_SERVER_ACTION_3, "7c9ed0cc47abc4e1c64320cf42b74ae60b58c40f00", null); var f4 = registerServerReference($$RSC_SERVER_ACTION_3, "7c9ed0cc47abc4e1c64320cf42b74ae60b58c40f00", null);
export const // Should be 0 111111 0, which is "7e" in hex. export const // Should be 0 111111 0, which is "7e" in hex.
/*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_4 = async function f4(a, b, c, d, e, f) { /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_4 = async function f5(a, b, c, d, e, f) {
return [ return [
a, a,
b, b,
...@@ -57,9 +57,9 @@ export const // Should be 0 111111 0, which is "7e" in hex. ...@@ -57,9 +57,9 @@ export const // Should be 0 111111 0, which is "7e" in hex.
f f
]; ];
}; };
var f4 = registerServerReference($$RSC_SERVER_ACTION_4, "7ea9b2939c1f39073a6bed227fd20233064c8b7869", null); var f5 = registerServerReference($$RSC_SERVER_ACTION_4, "7ea9b2939c1f39073a6bed227fd20233064c8b7869", null);
export var // Should be 1 111111 1, which is "ff" in hex. export var // Should be 1 111111 1, which is "ff" in hex.
/*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_CACHE_5 = $$cache__("default", "ff471a5eb0be1c31686dd4ba938a80328b80b1615d", 0, async function f5(a, b, c, d, e, f, g) { /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_CACHE_5 = $$cache__("default", "ff471a5eb0be1c31686dd4ba938a80328b80b1615d", 0, async function f6(a, b, c, d, e, f, g) {
return [ return [
a, a,
b, b,
...@@ -71,7 +71,7 @@ export var // Should be 1 111111 1, which is "ff" in hex. ...@@ -71,7 +71,7 @@ export var // Should be 1 111111 1, which is "ff" in hex.
]; ];
}); });
Object.defineProperty($$RSC_SERVER_CACHE_5, "name", { Object.defineProperty($$RSC_SERVER_CACHE_5, "name", {
"value": "f5", "value": "f6",
"writable": false "writable": false
}); });
var f5 = registerServerReference($$RSC_SERVER_CACHE_5, "ff471a5eb0be1c31686dd4ba938a80328b80b1615d", null); var f6 = registerServerReference($$RSC_SERVER_CACHE_5, "ff471a5eb0be1c31686dd4ba938a80328b80b1615d", null);
import { redirect } from 'next/navigation' import { redirect } from 'navigation'
async function action(formData) { async function action(formData) {
'use server' 'use server'
......
/* __next_internal_action_entry_do_not_use__ {"406a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$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"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
import { redirect } from 'next/navigation'; import { redirect } from 'navigation';
export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_0 = async function action(formData) { export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_0 = async function action(formData) {
redirect('/header?name=' + formData.get('name') + '&hidden-info=' + formData.get('hidden-info')); redirect('/header?name=' + formData.get('name') + '&hidden-info=' + formData.get('hidden-info'));
}; };
......
import { Button } from 'components'
import deleteFromDb from 'db' import deleteFromDb from 'db'
const v1 = 'v1' const v1 = 'v1'
......
/* __next_internal_action_entry_do_not_use__ {"406a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$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"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
import { Button } from 'components';
import deleteFromDb from 'db'; import deleteFromDb from 'db';
const v1 = 'v1'; const v1 = 'v1';
export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_0 = async function deleteItem($$ACTION_CLOSURE_BOUND) { export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_0 = async function deleteItem($$ACTION_CLOSURE_BOUND) {
......
'use cache' 'use cache'
// FIXME: this produces incorrect output, with
//
// Object.defineProperty($$RSC_SERVER_ACTION_0, ...)
//
// where `$$RSC_SERVER_ACTION_0` doesn't exist.
// but why is typescript not complaining about an undefined variable there?
export default async function (a, b, c) { export default async function (a, b, c) {
'use server' 'use server'
......
import { Client } from 'components'
export async function Component(a) { export async function Component(a) {
const b = 1 const b = 1
......
/* __next_internal_action_entry_do_not_use__ {"409651a98a9dccd7ffbe72ff5cf0f38546ca1252ab":"$$RSC_SERVER_ACTION_5","60a9b2939c1f39073a6bed227fd20233064c8b7869":"$$RSC_SERVER_ACTION_4","c069348c79fce073bae2f70f139565a2fda1c74c74":"$$RSC_SERVER_CACHE_2","e03128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference"; /* __next_internal_action_entry_do_not_use__ {"409651a98a9dccd7ffbe72ff5cf0f38546ca1252ab":"$$RSC_SERVER_ACTION_5","60a9b2939c1f39073a6bed227fd20233064c8b7869":"$$RSC_SERVER_ACTION_4","c069348c79fce073bae2f70f139565a2fda1c74c74":"$$RSC_SERVER_CACHE_2","e03128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
import { cache as $$cache__ } from "private-next-rsc-cache-wrapper"; import { cache as $$cache__ } from "private-next-rsc-cache-wrapper";
import { Client } from 'components';
export var /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_CACHE_0 = $$cache__("default", "e03128060c414d59f8552e4788b846c0d2b7f74743", 2, async function([$$ACTION_ARG_0, $$ACTION_ARG_1], c) { export var /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_CACHE_0 = $$cache__("default", "e03128060c414d59f8552e4788b846c0d2b7f74743", 2, async function([$$ACTION_ARG_0, $$ACTION_ARG_1], c) {
return $$ACTION_ARG_0 + $$ACTION_ARG_1 + c; return $$ACTION_ARG_0 + $$ACTION_ARG_1 + c;
}); });
......
'use server' 'use server'
import { db } from './database' import { db } from 'database'
export const createItem = async (title) => { export const createItem = async (title) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
......
/* __next_internal_action_entry_do_not_use__ {"00b98e10c56c1bee7af6ff753c91a4c70ab0419f0a":"test","7f7a40999f9833d2bb66a82d6a20a7f2a7810315f8":"createItem"} */ import { registerServerReference } from "private-next-rsc-server-reference"; /* __next_internal_action_entry_do_not_use__ {"00b98e10c56c1bee7af6ff753c91a4c70ab0419f0a":"test","7f7a40999f9833d2bb66a82d6a20a7f2a7810315f8":"createItem"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
import { db } from './database'; import { db } from 'database';
export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ createItem = async (title)=>{ export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ createItem = async (title)=>{
return new Promise((resolve, reject)=>{ return new Promise((resolve, reject)=>{
db.serialize(()=>{ db.serialize(()=>{
......
import ANYTHING from 'anything'
import f, { f1, f2 } from 'foo' import f, { f1, f2 } from 'foo'
import { Button } from 'components'
const f3 = 1 const f3 = 1
var f4 var f4
...@@ -16,7 +18,7 @@ const [ ...@@ -16,7 +18,7 @@ const [
...f17 ...f17
}, },
...f18 ...f18
] = [] ] = ANYTHING
if (true) { if (true) {
const g19 = 1 const g19 = 1
...@@ -28,6 +30,7 @@ function x() { ...@@ -28,6 +30,7 @@ function x() {
} }
export function y(p, [p1, { p2 }], ...p3) { export function y(p, [p1, { p2 }], ...p3) {
/** @type {any} */
const f2 = 1 const f2 = 1
const f11 = 1 const f11 = 1
const f19 = 1 const f19 = 1
...@@ -66,7 +69,9 @@ export function y(p, [p1, { p2 }], ...p3) { ...@@ -66,7 +69,9 @@ export function y(p, [p1, { p2 }], ...p3) {
p1, p1,
p2, p2,
p3, p3,
// @ts-expect-error: deliberately undefined variable
g19, g19,
// @ts-expect-error: deliberately undefined variable
g20, g20,
globalThis globalThis
) )
......
/* __next_internal_action_entry_do_not_use__ {"406a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$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"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
import ANYTHING from 'anything';
import f, { f1, f2 } from 'foo'; import f, { f1, f2 } from 'foo';
import { Button } from 'components';
const f3 = 1; const f3 = 1;
var f4; var f4;
let f5; let f5;
const [f6, [f7, ...f8], { f9 }, { f10, f11: [f12], f13: f14, f15: { f16 }, ...f17 }, ...f18] = []; const [f6, [f7, ...f8], { f9 }, { f10, f11: [f12], f13: f14, f15: { f16 }, ...f17 }, ...f18] = ANYTHING;
if (true) { if (true) {
const g191 = 1; const g191 = 1;
} }
...@@ -19,10 +21,12 @@ export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_0 = a ...@@ -19,10 +21,12 @@ export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_0 = a
const f18 = 1; const f18 = 1;
const f19 = 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); 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, // @ts-expect-error: deliberately undefined variable
g19, // @ts-expect-error: deliberately undefined variable
g20, globalThis);
}; };
export function y(p, [p1, { p2 }], ...p3) { export function y(p, [p1, { p2 }], ...p3) {
const f2 = 1; /** @type {any} */ const f2 = 1;
const f11 = 1; const f11 = 1;
const f19 = 1; const f19 = 1;
if (true) { if (true) {
......
import { Button } from 'components'
import deleteFromDb from 'db' import deleteFromDb from 'db'
export function Item1(product, foo, bar) { export function Item1(product, foo, bar) {
...@@ -7,7 +8,10 @@ export function Item1(product, foo, bar) { ...@@ -7,7 +8,10 @@ export function Item1(product, foo, bar) {
product.id, product.id,
product?.foo, product?.foo,
product.bar.baz, product.bar.baz,
product[(foo, bar)] product[
// @ts-expect-error: deliberate useless comma
(foo, bar)
]
) )
} }
return <Button action={a}>Delete</Button> return <Button action={a}>Delete</Button>
...@@ -20,7 +24,10 @@ export function Item2(product, foo, bar) { ...@@ -20,7 +24,10 @@ export function Item2(product, foo, bar) {
product.id, product.id,
product?.foo, product?.foo,
product.bar.baz, product.bar.baz,
product[(foo, bar)] product[
// @ts-expect-error: deliberate useless comma
(foo, bar)
]
) )
} }
return <Button action={deleteItem2}>Delete</Button> return <Button action={deleteItem2}>Delete</Button>
...@@ -33,7 +40,10 @@ export function Item3(product, foo, bar) { ...@@ -33,7 +40,10 @@ export function Item3(product, foo, bar) {
product.id, product.id,
product?.foo, product?.foo,
product.bar.baz, product.bar.baz,
product[(foo, bar)] product[
// @ts-expect-error: deliberate useless comma
(foo, bar)
]
) )
} }
return <Button action={deleteItem3}>Delete</Button> return <Button action={deleteItem3}>Delete</Button>
...@@ -46,7 +56,10 @@ export function Item4(product, foo, bar) { ...@@ -46,7 +56,10 @@ export function Item4(product, foo, bar) {
product.id, product.id,
product?.foo, product?.foo,
product.bar.baz, product.bar.baz,
product[(foo, bar)] product[
// @ts-expect-error: deliberate useless comma
(foo, bar)
]
) )
} }
return <Button action={deleteItem4}>Delete</Button> return <Button action={deleteItem4}>Delete</Button>
......
/* __next_internal_action_entry_do_not_use__ {"401c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","406a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","4090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","409ed0cc47abc4e1c64320cf42b74ae60b58c40f00":"$$RSC_SERVER_ACTION_3"} */ 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","409ed0cc47abc4e1c64320cf42b74ae60b58c40f00":"$$RSC_SERVER_ACTION_3"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
import { Button } from 'components';
import deleteFromDb from 'db'; import deleteFromDb from 'db';
export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_0 = async function deleteItem1($$ACTION_CLOSURE_BOUND) { export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_0 = async function deleteItem1($$ACTION_CLOSURE_BOUND) {
var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND); var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$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]); await deleteFromDb($$ACTION_ARG_0.id, $$ACTION_ARG_0?.foo, $$ACTION_ARG_0.bar.baz, $$ACTION_ARG_0[// @ts-expect-error: deliberate useless comma
$$ACTION_ARG_1, $$ACTION_ARG_2]);
}; };
export function Item1(product, foo, bar) { export function Item1(product, foo, bar) {
const a = registerServerReference($$RSC_SERVER_ACTION_0, "406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null).bind(null, encryptActionBoundArgs("406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", product, foo, bar)); const a = registerServerReference($$RSC_SERVER_ACTION_0, "406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null).bind(null, encryptActionBoundArgs("406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", product, foo, bar));
...@@ -11,7 +13,8 @@ export function Item1(product, foo, bar) { ...@@ -11,7 +13,8 @@ export function Item1(product, foo, bar) {
} }
export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_1 = async function deleteItem2($$ACTION_CLOSURE_BOUND) { export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_1 = async function deleteItem2($$ACTION_CLOSURE_BOUND) {
var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("4090b5db271335765a4b0eab01f044b381b5ebd5cd", $$ACTION_CLOSURE_BOUND); var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("4090b5db271335765a4b0eab01f044b381b5ebd5cd", $$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]); await deleteFromDb($$ACTION_ARG_0.id, $$ACTION_ARG_0?.foo, $$ACTION_ARG_0.bar.baz, $$ACTION_ARG_0[// @ts-expect-error: deliberate useless comma
$$ACTION_ARG_1, $$ACTION_ARG_2]);
}; };
export function Item2(product, foo, bar) { export function Item2(product, foo, bar) {
var deleteItem2 = registerServerReference($$RSC_SERVER_ACTION_1, "4090b5db271335765a4b0eab01f044b381b5ebd5cd", null).bind(null, encryptActionBoundArgs("4090b5db271335765a4b0eab01f044b381b5ebd5cd", product, foo, bar)); var deleteItem2 = registerServerReference($$RSC_SERVER_ACTION_1, "4090b5db271335765a4b0eab01f044b381b5ebd5cd", null).bind(null, encryptActionBoundArgs("4090b5db271335765a4b0eab01f044b381b5ebd5cd", product, foo, bar));
...@@ -19,7 +22,8 @@ export function Item2(product, foo, bar) { ...@@ -19,7 +22,8 @@ export function Item2(product, foo, bar) {
} }
export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_2 = async function deleteItem3($$ACTION_CLOSURE_BOUND) { export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_2 = async function deleteItem3($$ACTION_CLOSURE_BOUND) {
var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("401c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", $$ACTION_CLOSURE_BOUND); var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("401c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", $$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]); await deleteFromDb($$ACTION_ARG_0.id, $$ACTION_ARG_0?.foo, $$ACTION_ARG_0.bar.baz, $$ACTION_ARG_0[// @ts-expect-error: deliberate useless comma
$$ACTION_ARG_1, $$ACTION_ARG_2]);
}; };
export function Item3(product, foo, bar) { export function Item3(product, foo, bar) {
const deleteItem3 = registerServerReference($$RSC_SERVER_ACTION_2, "401c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", null).bind(null, encryptActionBoundArgs("401c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", product, foo, bar)); const deleteItem3 = registerServerReference($$RSC_SERVER_ACTION_2, "401c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", null).bind(null, encryptActionBoundArgs("401c36b06e398c97abe5d5d7ae8c672bfddf4e1b91", product, foo, bar));
...@@ -27,7 +31,8 @@ export function Item3(product, foo, bar) { ...@@ -27,7 +31,8 @@ export function Item3(product, foo, bar) {
} }
export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_3 = async function deleteItem4($$ACTION_CLOSURE_BOUND) { export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_3 = async function deleteItem4($$ACTION_CLOSURE_BOUND) {
var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("409ed0cc47abc4e1c64320cf42b74ae60b58c40f00", $$ACTION_CLOSURE_BOUND); var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("409ed0cc47abc4e1c64320cf42b74ae60b58c40f00", $$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]); await deleteFromDb($$ACTION_ARG_0.id, $$ACTION_ARG_0?.foo, $$ACTION_ARG_0.bar.baz, $$ACTION_ARG_0[// @ts-expect-error: deliberate useless comma
$$ACTION_ARG_1, $$ACTION_ARG_2]);
}; };
export function Item4(product, foo, bar) { export function Item4(product, foo, bar) {
const deleteItem4 = registerServerReference($$RSC_SERVER_ACTION_3, "409ed0cc47abc4e1c64320cf42b74ae60b58c40f00", null).bind(null, encryptActionBoundArgs("409ed0cc47abc4e1c64320cf42b74ae60b58c40f00", product, foo, bar)); const deleteItem4 = registerServerReference($$RSC_SERVER_ACTION_3, "409ed0cc47abc4e1c64320cf42b74ae60b58c40f00", null).bind(null, encryptActionBoundArgs("409ed0cc47abc4e1c64320cf42b74ae60b58c40f00", product, foo, bar));
......
import { Button } from 'components'
async function myAction(a, b, c) { async function myAction(a, b, c) {
// comment // comment
'use strict' 'use strict'
......
/*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ /* __next_internal_action_entry_do_not_use__ {"706a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$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"; import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
export const $$RSC_SERVER_ACTION_0 = async function myAction(a, b, c) { import { Button } from 'components';
export const /*#__TURBOPACK_DISABLE_EXPORT_MERGING__*/ $$RSC_SERVER_ACTION_0 = async function myAction(a, b, c) {
// comment // comment
'use strict'; 'use strict';
console.log('a'); console.log('a');
......
{
"compilerOptions": {
"noEmit": true,
"rootDir": ".",
"allowJs": true,
"checkJs": true,
"lib": ["ESNext", "DOM"],
"skipLibCheck": true,
"strict": true,
"jsx": "preserve",
// most of the code is untyped
"noImplicitAny": false,
"noImplicitThis": false,
"target": "ESNext",
"esModuleInterop": true,
"module": "Preserve",
"moduleResolution": "bundler",
"moduleDetection": "force"
},
"files": ["./index.ts"], // loads ambient declarations for modules used in tests
"include": ["./**/*/input.js", "./**/*/output.js"],
"exclude": [
// FIXME: invalid transformation of hoisted functions (https://github.com/vercel/next.js/issues/57392)
"./server-graph/25/output.js",
"./server-graph/28/output.js",
"./server-graph/30/output.js",
// Excluded because of weird TS behavior around `action.bind(...)` making args optional
// (but only if no JSDoc type annotations are present)
"./server-graph/24/output.js"
]
}
...@@ -42,7 +42,8 @@ ...@@ -42,7 +42,8 @@
"lint-eslint": "cross-env ESLINT_USE_FLAT_CONFIG=false eslint . --ext js,jsx,mjs,ts,tsx,mts,mdx --config .eslintrc.json --no-eslintrc", "lint-eslint": "cross-env ESLINT_USE_FLAT_CONFIG=false eslint . --ext js,jsx,mjs,ts,tsx,mts,mdx --config .eslintrc.json --no-eslintrc",
"lint-ast-grep": "ast-grep scan", "lint-ast-grep": "ast-grep scan",
"lint-no-typescript": "run-p prettier-check lint-eslint lint-language", "lint-no-typescript": "run-p prettier-check lint-eslint lint-language",
"types-and-precompiled": "run-p lint-typescript check-precompiled validate-externals-doc", "types-and-precompiled": "run-p lint-typescript check-precompiled validate-externals-doc check-compiler-fixtures",
"check-compiler-fixtures": "find crates/next-custom-transforms/tests/fixture -type f -name 'tsconfig.json' -exec /bin/sh -c 'echo \"project: $1\"; pnpm tsc --noEmit --project \"$1\"' -- {} \\;",
"validate-externals-doc": "node ./scripts/validate-externals-doc.js", "validate-externals-doc": "node ./scripts/validate-externals-doc.js",
"lint": "run-p test-types lint-typescript prettier-check lint-eslint lint-ast-grep lint-language", "lint": "run-p test-types lint-typescript prettier-check lint-eslint lint-ast-grep lint-language",
"lint-fix": "pnpm prettier-fix && pnpm lint-eslint --fix", "lint-fix": "pnpm prettier-fix && pnpm lint-eslint --fix",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment