diff --git a/packages/next-codemod/transforms/__testfixtures__/next-async-request-api-dynamic-apis/async-api-15.output.js b/packages/next-codemod/transforms/__testfixtures__/next-async-request-api-dynamic-apis/async-api-15.output.js index 0e96c3c6544a97..9df2c7518fc282 100644 --- a/packages/next-codemod/transforms/__testfixtures__/next-async-request-api-dynamic-apis/async-api-15.output.js +++ b/packages/next-codemod/transforms/__testfixtures__/next-async-request-api-dynamic-apis/async-api-15.output.js @@ -2,7 +2,7 @@ import { cookies } from "next/headers"; async function MyComponent() { function asyncFunction() { - callSomething(/* TODO: please manually await this call, if it's a server component, you can turn it to async function */ + callSomething(/* Next.js Dynamic Async API Codemod: Manually await this call, if it's a Server Component */ cookies()); } } diff --git a/packages/next-codemod/transforms/__testfixtures__/next-async-request-api-dynamic-apis/async-api-16.output.js b/packages/next-codemod/transforms/__testfixtures__/next-async-request-api-dynamic-apis/async-api-16.output.js index 17a937050c0b94..919eab3d308d96 100644 --- a/packages/next-codemod/transforms/__testfixtures__/next-async-request-api-dynamic-apis/async-api-16.output.js +++ b/packages/next-codemod/transforms/__testfixtures__/next-async-request-api-dynamic-apis/async-api-16.output.js @@ -1,6 +1,6 @@ import { cookies } from "next/headers"; function MyComponent() { - callSomething(/* TODO: please manually await this call, if it's a server component, you can turn it to async function */ + callSomething(/* Next.js Dynamic Async API Codemod: Manually await this call, if it's a Server Component */ cookies()); } diff --git a/packages/next-codemod/transforms/__testfixtures__/next-async-request-api-dynamic-apis/async-api-21.input.tsx b/packages/next-codemod/transforms/__testfixtures__/next-async-request-api-dynamic-apis/async-api-21.input.tsx index 3b05d6129ef63e..af37a76558f24e 100644 --- a/packages/next-codemod/transforms/__testfixtures__/next-async-request-api-dynamic-apis/async-api-21.input.tsx +++ b/packages/next-codemod/transforms/__testfixtures__/next-async-request-api-dynamic-apis/async-api-21.input.tsx @@ -4,4 +4,4 @@ function myFunc() { nextHeaders.cookies() } -const nextHeaders2 = /* The APIs under 'next/headers' are async now, need to be manually awaited. */ import('next/headers') \ No newline at end of file +const nextHeaders2 = /* Next.js Dynamic Async API Codemod: The APIs under 'next/headers' are async now, need to be manually awaited. */ import('next/headers') \ No newline at end of file diff --git a/packages/next-codemod/transforms/__testfixtures__/next-async-request-api-dynamic-apis/async-api-21.output.tsx b/packages/next-codemod/transforms/__testfixtures__/next-async-request-api-dynamic-apis/async-api-21.output.tsx index bf6e54ca0d54ce..fb9b4ee986c049 100644 --- a/packages/next-codemod/transforms/__testfixtures__/next-async-request-api-dynamic-apis/async-api-21.output.tsx +++ b/packages/next-codemod/transforms/__testfixtures__/next-async-request-api-dynamic-apis/async-api-21.output.tsx @@ -1,8 +1,8 @@ -const nextHeaders = /* The APIs under 'next/headers' are async now, need to be manually awaited. */ +const nextHeaders = /* Next.js Dynamic Async API Codemod: The APIs under 'next/headers' are async now, need to be manually awaited. */ import('next/headers') function myFunc() { nextHeaders.cookies() } -const nextHeaders2 = /* The APIs under 'next/headers' are async now, need to be manually awaited. */ import('next/headers') \ No newline at end of file +const nextHeaders2 = /* Next.js Dynamic Async API Codemod: The APIs under 'next/headers' are async now, need to be manually awaited. */ import('next/headers') \ No newline at end of file diff --git a/packages/next-codemod/transforms/__testfixtures__/next-async-request-api-dynamic-apis/async-api-type-cast-02.output.js b/packages/next-codemod/transforms/__testfixtures__/next-async-request-api-dynamic-apis/async-api-type-cast-02.output.js index 2dcad2941b6590..c6cc2068dec67a 100644 --- a/packages/next-codemod/transforms/__testfixtures__/next-async-request-api-dynamic-apis/async-api-type-cast-02.output.js +++ b/packages/next-codemod/transforms/__testfixtures__/next-async-request-api-dynamic-apis/async-api-type-cast-02.output.js @@ -6,7 +6,7 @@ import { } from 'next/headers' export function MyDraftComponent() { -if (/* TODO: please manually await this call, if it's a server component, you can turn it to async function */ +if (/* Next.js Dynamic Async API Codemod: Manually await this call, if it's a Server Component */ draftMode().isEnabled) { return null } @@ -15,13 +15,13 @@ draftMode().isEnabled) { } export function MyCookiesComponent() { - const c = /* TODO: please manually await this call, if it's a server component, you can turn it to async function */ + const c = /* Next.js Dynamic Async API Codemod: Manually await this call, if it's a Server Component */ cookies() return c.get('name') } export function MyHeadersComponent() { - const h = /* TODO: please manually await this call, if it's a server component, you can turn it to async function */ + const h = /* Next.js Dynamic Async API Codemod: Manually await this call, if it's a Server Component */ headers() return (

{h.get('x-foo')}

diff --git a/packages/next-codemod/transforms/__testfixtures__/next-async-request-api-dynamic-props/access-props-18.output.tsx b/packages/next-codemod/transforms/__testfixtures__/next-async-request-api-dynamic-props/access-props-18.output.tsx index 7d52cc3a95da34..d76fbecf6ab6cf 100644 --- a/packages/next-codemod/transforms/__testfixtures__/next-async-request-api-dynamic-props/access-props-18.output.tsx +++ b/packages/next-codemod/transforms/__testfixtures__/next-async-request-api-dynamic-props/access-props-18.output.tsx @@ -1,10 +1,10 @@ export default function Page(props: any) { - callback(/* 'props' is passed as an argument. Any asynchronous properties of 'props' must be awaited when accessed. */ + callback(/* Next.js Dynamic Async API Codemod: 'props' is passed as an argument. Any asynchronous properties of 'props' must be awaited when accessed. */ props, 1) } export function generateMetadata(props) { - callback2(/* 'props' is passed as an argument. Any asynchronous properties of 'props' must be awaited when accessed. */ + callback2(/* Next.js Dynamic Async API Codemod: 'props' is passed as an argument. Any asynchronous properties of 'props' must be awaited when accessed. */ props) } diff --git a/packages/next-codemod/transforms/lib/async-request-api/next-async-dynamic-api.ts b/packages/next-codemod/transforms/lib/async-request-api/next-async-dynamic-api.ts index 9c1ad6feab2cda..7ecc81aa56241f 100644 --- a/packages/next-codemod/transforms/lib/async-request-api/next-async-dynamic-api.ts +++ b/packages/next-codemod/transforms/lib/async-request-api/next-async-dynamic-api.ts @@ -11,7 +11,7 @@ import { insertCommentOnce, } from './utils' -const DYNAMIC_IMPORT_WARN_COMMENT = ` The APIs under 'next/headers' are async now, need to be manually awaited. ` +const DYNAMIC_IMPORT_WARN_COMMENT = ` Next.js Dynamic Async API Codemod: The APIs under 'next/headers' are async now, need to be manually awaited. ` function findDynamicImportsAndComment(root: Collection, j: API['j']) { let modified = false @@ -187,7 +187,7 @@ export function transformDynamicAPI( root, filePath, insertedTypes, - ` TODO: please manually await this call, if it's a server component, you can turn it to async function ` + ` Next.js Dynamic Async API Codemod: Manually await this call, if it's a Server Component ` ) } } else { @@ -198,7 +198,7 @@ export function transformDynamicAPI( root, filePath, insertedTypes, - ' TODO: please manually await this call, codemod cannot transform due to undetermined async scope ' + ' Next.js Dynamic Async API Codemod: please manually await this call, codemod cannot transform due to undetermined async scope ' ) } modified = true diff --git a/packages/next-codemod/transforms/lib/async-request-api/next-async-dynamic-prop.ts b/packages/next-codemod/transforms/lib/async-request-api/next-async-dynamic-prop.ts index c84768d8d3463e..f720e9217ea0a4 100644 --- a/packages/next-codemod/transforms/lib/async-request-api/next-async-dynamic-prop.ts +++ b/packages/next-codemod/transforms/lib/async-request-api/next-async-dynamic-prop.ts @@ -406,7 +406,7 @@ export function transformDynamicProps( const propPassedAsArg = args.find( (arg) => j.Identifier.check(arg) && arg.name === argName ) - const comment = ` '${argName}' is passed as an argument. Any asynchronous properties of 'props' must be awaited when accessed. ` + const comment = ` Next.js Dynamic Async API Codemod: '${argName}' is passed as an argument. Any asynchronous properties of 'props' must be awaited when accessed. ` insertCommentOnce(propPassedAsArg, j, comment) modified = true