-
Notifications
You must be signed in to change notification settings - Fork 27.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2637d43
commit 43d71ae
Showing
13 changed files
with
657 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...rc/transforms/__testfixtures__/next-async-request-api-dynamic-apis/async-api-16.output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import { cookies } from "next/headers"; | ||
|
||
function MyComponent() { | ||
callSomething(/* TODO: please manually await this call, codemod cannot transform due to undetermined async scope */ | ||
callSomething(/* TODO: please manually await this call, if it's a server component, you can turn it to async function */ | ||
cookies()); | ||
} |
13 changes: 13 additions & 0 deletions
13
...rc/transforms/__testfixtures__/next-async-request-api-dynamic-apis/async-api-19.input.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { cookies, headers } from 'next/headers' | ||
|
||
export function myFun() { | ||
return async function () { | ||
cookies().get('name') | ||
} | ||
} | ||
|
||
export function myFun2() { | ||
return function () { | ||
headers() | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...c/transforms/__testfixtures__/next-async-request-api-dynamic-apis/async-api-19.output.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { cookies, headers, type UnsafeUnwrappedHeaders } from 'next/headers'; | ||
|
||
export function myFun() { | ||
return async function () { | ||
(await cookies()).get('name') | ||
}; | ||
} | ||
|
||
export function myFun2() { | ||
return function () { | ||
(headers() as unknown as UnsafeUnwrappedHeaders) | ||
}; | ||
} |
7 changes: 7 additions & 0 deletions
7
...rc/transforms/__testfixtures__/next-async-request-api-dynamic-apis/async-api-20.input.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { cookies } from 'cookies' | ||
|
||
export function MyCls() { | ||
return async function Page() { | ||
return (await cookies()).get('token') | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
...c/transforms/__testfixtures__/next-async-request-api-dynamic-apis/async-api-20.output.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { cookies } from 'cookies' | ||
|
||
export function MyCls() { | ||
return async function Page() { | ||
return (await cookies()).get('token') | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
...rc/transforms/__testfixtures__/next-async-request-api-dynamic-apis/async-api-21.input.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const nextHeaders = 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') |
8 changes: 8 additions & 0 deletions
8
...c/transforms/__testfixtures__/next-async-request-api-dynamic-apis/async-api-21.output.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
const nextHeaders = /* 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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.