Unverified Commit 952ecb2c authored by Jiachi Liu's avatar Jiachi Liu Committed by GitHub

Codemod for Async Request API (#69572)

parent b72c99d0
......@@ -26,6 +26,108 @@ Replacing `<transform>` and `<path>` with appropriate values.
### 15.0
#### Migrate to async Dynamic APIs
##### `next-async-request-api`
```bash filename="Terminal"
npx @next/codemod@latest next-async-request-api .
```
This codemod will transform APIs `cookies()`, `headers()` and `draftMode()` from `next/headers` to be properly awaited or wrapped with `React.use()` if needed.
If it's not able to be migrated, will either add a type cast or a TODO comment based on the file is a TypeScript or JavaScript file.
For example:
```tsx
import { cookies, headers } from 'next/headers'
const token = cookies().get('token')
function useToken() {
const token = cookies().get('token')
return token
}
export default function Page() {
const name = cookies().get('name')
}
function getHeader() {
return headers().get('x-foo')
}
```
Transforms into:
```tsx
import { use } from 'react'
import { cookies, headers, type UnsafeUnwrappedCookies } from 'next/headers'
const token = (await cookies()).get('token')
function useToken() {
const token = use(cookies()).get('token')
return token
}
export default function Page() {
const name = (await cookies()).get('name')
}
function getHeader() {
return (headers() as UnsafeUnwrappedCookies).get('x-foo')
}
```
If there's access to the entry handler `params` and `searchParams` in the route entry default handler (`page.js`, `layout.js`, `route.js` or Metadata API routes) or `generateMetadata` export API,
it will transform the access to the property from sync to async, and await or wrap these properties with `React.use()` if needed.
For example:
```tsx
// page.tsx
export default function Page({
params,
searchParams,
}: {
params: { slug: string }
searchParams: { [key: string]: string | undefined }
}) {
const { value } = searchParams
if (value === 'foo') {
// ...
}
}
export function generateMetadata({ params }: { params: { slug: string } }) {
return {
title: `My Page - ${slug}`,
}
}
```
Transforms into:
```tsx
// page.tsx
export default function Page(props: {
params: { slug: string }
searchParams: { [key: string]: string | undefined }
}) {
const { value } = await props.searchParams
if (value === 'foo') {
// ...
}
}
export function generateMetadata(props: { params: { slug: string } }) {
const { slug } = await props.params
return {
title: `My Page - ${slug}`,
}
}
```
#### Replace `geo` and `ip` properties of `NextRequest` with `@vercel/functions`
##### `next-request-geo-ip`
......
......@@ -164,6 +164,10 @@ const TRANSFORMER_INQUIRER_CHOICES = [
name: 'built-in-next-font: Uninstall `@next/font` and transform imports to `next/font`',
value: 'built-in-next-font',
},
{
name: 'next-async-request-api: Transforms usage of Next.js async Request APIs',
value: 'next-async-request-api',
},
{
name: 'next-request-geo-ip: Install `@vercel/functions` to replace `geo` and `ip` properties on `NextRequest`',
value: 'next-request-geo-ip',
......
......@@ -19,6 +19,7 @@
},
"files": [
"transforms/*.js",
"transforms/lib/**/*.js",
"bin/*.js",
"lib/**/*.js",
"lib/cra-to-next/gitignore"
......
import { cookies } from 'next/headers'
export async function MyComponent() {
const name = cookies().get('name')
callback(name)
}
function callback(name: any) {
console.log(name)
}
import { cookies } from 'next/headers'
export async function MyComponent() {
const name = (await cookies()).get('name')
callback(name)
}
function callback(name: any) {
console.log(name)
}
import { draftMode } from 'next/headers'
export async function MyComponent() {
draftMode().enable()
}
import { draftMode } from 'next/headers'
export async function MyComponent() {
(await draftMode()).enable()
}
// If it's sync default export, convert to async and await the function call
import { draftMode } from 'next/headers'
export default function MyComponent() {
draftMode().enable()
}
// If it's sync default export, convert to async and await the function call
import { draftMode } from 'next/headers'
export default async function MyComponent() {
(await draftMode()).enable()
}
import { draftMode } from 'next/headers'
export default async function MyComponent() {
draftMode().enable()
}
export async function MyComponent2() {
draftMode().enable()
}
import { draftMode } from 'next/headers'
export default async function MyComponent() {
(await draftMode()).enable()
}
export async function MyComponent2() {
(await draftMode()).enable()
}
\ No newline at end of file
import { draftMode } from 'next/headers'
export function MyComponent2() {
draftMode().enable()
}
export function useDraftModeEnabled() {
draftMode().enable()
}
import { use } from "react";
import { draftMode, type UnsafeUnwrappedDraftMode } from 'next/headers';
export function MyComponent2() {
(draftMode() as unknown as UnsafeUnwrappedDraftMode).enable()
}
export function useDraftModeEnabled() {
use(draftMode()).enable()
}
import React from 'react'
import { draftMode } from 'next/headers'
export default function Page() {
return <button disabled={draftMode().isEnabled}>Enable Draft Mode</button>
}
import React from 'react'
import { draftMode } from 'next/headers'
export default async function Page() {
return <button disabled={(await draftMode()).isEnabled}>Enable Draft Mode</button>;
}
// Already imported the type
import { draftMode, type UnsafeUnwrappedDraftMode } from 'next/headers'
export function MyComponent2() {
draftMode().enable()
}
// Already imported the type
import { draftMode, type UnsafeUnwrappedDraftMode } from 'next/headers'
export function MyComponent2() {
(draftMode() as unknown as UnsafeUnwrappedDraftMode).enable()
}
import { headers } from 'next/headers'
export function GET(): Response {
headers()
}
import { headers } from 'next/headers'
export async function GET(): Promise<Response> {
await headers()
}
export default function Page({
params: { slug },
searchParams: { search },
}: {
params: { slug: string }
searchParams: any
}): JSX.Element {
// Access to the destructed properties
slug
search
return <div>Page</div>
}
export default async function Page(
props: {
params: Promise<{ slug: string }>
searchParams: Promise<any>
}
): Promise<JSX.Element> {
const searchParams = await props.searchParams;
const {
search
} = searchParams;
const params = await props.params;
const {
slug
} = params;
// Access to the destructed properties
slug
search
return <div>Page</div>
}
import { headers } from 'next/headers'
export function MyComp() {
return headers()
}
export function MyComp2() {
return headers()
}
export function MyComp3() {
return headers()
}
import { headers, type UnsafeUnwrappedHeaders } from 'next/headers';
export function MyComp() {
return (headers() as unknown as UnsafeUnwrappedHeaders);
}
export function MyComp2() {
return (headers() as unknown as UnsafeUnwrappedHeaders);
}
export function MyComp3() {
return (headers() as unknown as UnsafeUnwrappedHeaders);
}
import { headers } from 'next/headers'
export function MyComp() {
headers()
}
export function generateContentfulMetadata() {
headers()
}
import { headers, type UnsafeUnwrappedHeaders } from 'next/headers';
export function MyComp() {
(headers() as unknown as UnsafeUnwrappedHeaders)
}
export function generateContentfulMetadata() {
(headers() as unknown as UnsafeUnwrappedHeaders)
}
import { cookies } from "next/headers";
async function MyComponent() {
callSomething(cookies());
}
import { cookies } from "next/headers";
async function MyComponent() {
callSomething(await cookies());
}
import { headers } from "next/headers";
async function MyComponent() {
callSomething(headers());
}
import { headers } from "next/headers";
async function MyComponent() {
callSomething(await headers());
}
import { cookies } from "next/headers";
export default async function Page() {
callSomething(cookies());
}
import { cookies } from "next/headers";
export default async function Page() {
callSomething(await cookies());
}
import { cookies } from "next/headers";
async function MyComponent() {
function asyncFunction() {
callSomething(cookies());
}
}
import { cookies } from "next/headers";
async function MyComponent() {
function asyncFunction() {
callSomething(/* TODO: please manually await this call, codemod cannot transform due to undetermined async scope */
cookies());
}
}
import { cookies } from "next/headers";
function MyComponent() {
callSomething(cookies());
}
import { cookies } from "next/headers";
function MyComponent() {
callSomething(/* TODO: please manually await this call, codemod cannot transform due to undetermined async scope */
cookies());
}
import { cookies } from 'next/headers'
export const myFun = async (): Promise<any> => {
const name = cookies().get('name')
}
import { cookies } from 'next/headers'
export const myFun = async (): Promise<any> => {
const name = (await cookies()).get('name')
}
import {
cookies as myCookies,
headers as myHeaders,
draftMode as myDraftMode,
} from 'next/headers'
export const myFun = async (): Promise<any> => {
const name = myCookies().get('name')
}
export const myFun2 = async (): Promise<any> => {
await myHeaders()
}
export const myFun3 = async (): Promise<any> => {
await myDraftMode()
}
import {
cookies as myCookies,
headers as myHeaders,
draftMode as myDraftMode,
} from 'next/headers'
export const myFun = async (): Promise<any> => {
const name = (await myCookies()).get('name')
}
export const myFun2 = async (): Promise<any> => {
await myHeaders()
}
export const myFun3 = async (): Promise<any> => {
await myDraftMode()
}
import React from 'react'
import { headers, cookies, draftMode } from 'next/headers'
export function MyDraftComponent() {
if (draftMode().isEnabled) {
return null
}
return <p>page</p>
}
export function MyCookiesComponent() {
const c = cookies()
return c.get('name')
}
export function MyHeadersComponent() {
const h = headers()
return <p>{h.get('x-foo')}</p>
}
import React from 'react'
import {
headers,
cookies,
draftMode,
type UnsafeUnwrappedHeaders,
type UnsafeUnwrappedCookies,
type UnsafeUnwrappedDraftMode,
} from 'next/headers';
export function MyDraftComponent() {
if ((draftMode() as unknown as UnsafeUnwrappedDraftMode).isEnabled) {
return null
}
return <p>page</p>
}
export function MyCookiesComponent() {
const c = (cookies() as unknown as UnsafeUnwrappedCookies)
return c.get('name')
}
export function MyHeadersComponent() {
const h = (headers() as unknown as UnsafeUnwrappedHeaders)
return <p>{h.get('x-foo')}</p>
}
import React from 'react'
import {
headers,
cookies,
draftMode,
} from 'next/headers'
export function MyDraftComponent() {
if (draftMode().isEnabled) {
return null
}
return <p>page</p>
}
export function MyCookiesComponent() {
const c = cookies()
return c.get('name')
}
export function MyHeadersComponent() {
const h = headers()
return (
<p>{h.get('x-foo')}</p>
)
}
import React from 'react'
import {
headers,
cookies,
draftMode,
} from 'next/headers'
export function MyDraftComponent() {
if (/* TODO: please manually await this call, codemod cannot transform due to undetermined async scope */
draftMode().isEnabled) {
return null
}
return <p>page</p>
}
export function MyCookiesComponent() {
const c = /* TODO: please manually await this call, codemod cannot transform due to undetermined async scope */
cookies()
return c.get('name')
}
export function MyHeadersComponent() {
const h = /* TODO: please manually await this call, codemod cannot transform due to undetermined async scope */
headers()
return (
<p>{h.get('x-foo')}</p>
)
}
import { headers } from 'next/headers'
export const GET = function () {
headers()
}
export function POST() {
headers()
}
export async function DELETE() {
headers()
}
import { headers } from 'next/headers'
export const GET = async function() {
await headers()
}
export async function POST() {
await headers()
}
export async function DELETE() {
await headers()
}
import { headers } from 'next/headers'
export async function generateMetadata() {
await headers()
}
import { headers } from 'next/headers'
export const generateMetadata = function () {
headers()
}
import { headers } from 'next/headers'
export const generateMetadata = async function() {
await headers()
}
import { draftMode } from 'next/headers'
export async function generateMetadata(props: any) {
const params = await props.params
await getMostRecentChangelog(params.slug, draftMode().isEnabled)
}
import { draftMode } from 'next/headers'
export async function generateMetadata(props: any) {
const params = await props.params
await getMostRecentChangelog(params.slug, (await draftMode()).isEnabled)
}
export function LocalComponent(callback) {
function cookies() {
return 'local-cookies'
}
callback(cookies())
}
export function LocalComponent(callback) {
function cookies() {
return 'local-cookies'
}
callback(cookies())
}
'use client'
import { cookies } from "mylib";
export default function Page() {
usingCookiesWillErrorInClient(cookies());
}
'use client'
import { cookies } from "mylib";
export default function Page() {
usingCookiesWillErrorInClient(cookies());
}
export default async function Page({ params }: { params: { slug: string } }) {
// usage of `params`
globalThis.f1(params)
globalThis.f2(params)
}
export default async function Page(props: { params: Promise<{ slug: string }> }) {
const params = await props.params;
// usage of `params`
globalThis.f1(params)
globalThis.f2(params)
}
export default async function Page({
searchParams,
}: {
searchParams: { [key: string]: string }
}) {
globalThis.f1(searchParams)
globalThis.f2(searchParams)
}
export default async function Page(
props: {
searchParams: Promise<{ [key: string]: string }>
}
) {
const searchParams = await props.searchParams;
globalThis.f1(searchParams)
globalThis.f2(searchParams)
}
export default function Page({ params }: { params: { slug: string } }) {
// usage of `params`
globalThis.f1(params)
globalThis.f2(params)
}
export default async function Page(props: { params: Promise<{ slug: string }> }) {
const params = await props.params;
// usage of `params`
globalThis.f1(params)
globalThis.f2(params)
}
'use client'
import { useState } from 'react'
export default function Page({ params }: { params: { slug: string } }) {
const [text, setText] = useState('')
// usage of `params`
globalThis.f1(params)
globalThis.f2(params)
}
'use client';
import { use } from "react";
import { useState } from 'react'
export default function Page(props: { params: Promise<{ slug: string }> }) {
const params = use(props.params);
const [text, setText] = useState('')
// usage of `params`
globalThis.f1(params)
globalThis.f2(params)
}
'use client'
import { useState } from 'react'
interface PageProps {
params: { slug: string }
searchParams: any
}
export default function Page({ params }: PageProps) {
const [text, setText] = useState('')
// usage of `params`
globalThis.f1(params)
globalThis.f2(params)
}
'use client';
import { use } from "react";
import { useState } from 'react'
interface PageProps {
params: Promise<{ slug: string }>
searchParams: Promise<any>
}
export default function Page(props: PageProps) {
const params = use(props.params);
const [text, setText] = useState('')
// usage of `params`
globalThis.f1(params)
globalThis.f2(params)
}
interface PageProps {
params: {
id: string
name: string
}
}
export default function Page({ params: { id, name } }: PageProps) {
globalThis.f1(id)
globalThis.f2(name)
}
interface PageProps {
params: Promise<{
id: string
name: string
}>
}
export default async function Page(props: PageProps) {
const params = await props.params;
const {
id,
name
} = params;
globalThis.f1(id)
globalThis.f2(name)
}
export default function Layout({ params }) {
// if there's any usage of `searchParams`
f1(params);
f2(params);
}
export default async function Layout(props) {
const params = await props.params;
// if there's any usage of `searchParams`
f1(params);
f2(params);
}
export default async function Page({ params }) {
// if there's any usage of `searchParams`
f1(params);
f2(params);
}
export default async function Page(props) {
const params = await props.params;
// if there's any usage of `searchParams`
f1(params);
f2(params);
}
export default async props => {
const params = await props.params;
f1(params)
f2(params)
};
export default function Page({ params }: { params: any }) {
function generateProps() {
const props = { a: 1 }
props.a = 2
return props
}
return <div>hello {params.name} {generateProps().a}</div>
}
export default async function Page(props0: { params: Promise<any> }) {
const params = await props0.params;
function generateProps() {
const props = { a: 1 }
props.a = 2
return props
}
return <div>hello {params.name} {generateProps().a}</div>
}
// TODO: handle variable declaration
// export const GET = function ({ params }: any) {
// call(params.foo)
// }
export function POST({ params }: any) {
call(params.foo)
}
export async function DELETE({ params }: any) {
call(params.foo)
}
// TODO: handle variable declaration
// export const GET = function ({ params }: any) {
// call(params.foo)
// }
export async function POST(props: any) {
const params = await props.params;
call(params.foo)
}
export async function DELETE(props: any) {
const params = await props.params;
call(params.foo)
}
export function generateMetadata({
params,
}: {
params: { slug: string }
}): Metadata {
params.slug
}
export async function generateMetadata(
props: {
params: Promise<{ slug: string }>
}
): Promise<Metadata> {
const params = await props.params;
params.slug
}
export async function Page({ params }) {
// if there's any usage of `searchParams`
f1(params);
f2(params);
}
export async function Page({ params }) {
// if there's any usage of `searchParams`
f1(params);
f2(params);
}
/* global jest */
jest.autoMockOff()
const defineTest = require('jscodeshift/dist/testUtils').defineTest
const { readdirSync } = require('fs')
const { join } = require('path')
const testFileRegex = /\.input\.(j|t)sx?$/
const fixtureDir = 'next-async-request-api-dynamic-apis'
const transformName = 'next-async-request-api'
const fixtureDirPath = join(__dirname, '..', '__testfixtures__', fixtureDir)
const fixtures = readdirSync(fixtureDirPath)
.filter(file => testFileRegex.test(file))
for (const file of fixtures) {
const isTsx = file.endsWith('.tsx')
const fixture = file.replace(testFileRegex, '')
const prefix = `${fixtureDir}/${fixture}`;
defineTest(__dirname, transformName, null, prefix, {
parser: isTsx ? 'tsx' : 'babel',
});
}
/* global jest */
jest.autoMockOff()
const defineTest = require('jscodeshift/dist/testUtils').defineTest
const { readdirSync } = require('fs')
const { join } = require('path')
const testFileRegex = /\.input\.(j|t)sx?$/
const fixtureDir = 'next-async-request-api-dynamic-props'
const transformName = 'next-async-request-api'
const fixtureDirPath = join(__dirname, '..', '__testfixtures__', fixtureDir)
const fixtures = readdirSync(fixtureDirPath)
.filter(file => testFileRegex.test(file))
for (const file of fixtures) {
const isTsx = file.endsWith('.tsx')
const fixture = file.replace(testFileRegex, '')
const prefix = `${fixtureDir}/${fixture}`;
defineTest(__dirname, transformName, null, prefix, {
parser: isTsx ? 'tsx' : 'babel',
});
}
import type { API, FileInfo } from 'jscodeshift'
import { transformDynamicProps } from './next-async-dynamic-prop'
import { transformDynamicAPI } from './next-async-dynamic-api'
export default function transform(file: FileInfo, api: API) {
const filePath = file.path
// if it's node_modules or types file, skip
if (/node_modules/.test(filePath) || /\.d\.(m|c)?ts$/.test(filePath)) {
return file.source
}
const transforms = [transformDynamicProps, transformDynamicAPI]
return transforms.reduce<string>((source, transformFn) => {
const result = transformFn(source, api, file.path)
if (!result) {
return source
}
return result
}, file.source)
}
import type {
API,
ASTPath,
Collection,
FunctionDeclaration,
JSCodeshift,
Node,
} from 'jscodeshift'
export const TARGET_NAMED_EXPORTS = new Set([
// For custom route
'GET',
'HEAD',
'POST',
'PUT',
'DELETE',
'PATCH',
'OPTIONS',
// For page and layout
'generateMetadata',
])
export const TARGET_PROP_NAMES = new Set(['params', 'searchParams'])
export function isFunctionType(
type: string
): type is
| 'FunctionDeclaration'
| 'FunctionExpression'
| 'ArrowFunctionExpression' {
return (
type === 'FunctionDeclaration' ||
type === 'FunctionExpression' ||
type === 'ArrowFunctionExpression'
)
}
export function isMatchedFunctionExported(
path: ASTPath<FunctionDeclaration>,
j: API['jscodeshift']
): boolean {
const matchedFunctionNameFilter = (idName) => TARGET_NAMED_EXPORTS.has(idName)
const directNamedExport = j(path).closest(j.ExportNamedDeclaration, {
declaration: {
type: 'FunctionDeclaration',
id: {
name: matchedFunctionNameFilter,
},
},
})
if (directNamedExport.size() > 0) {
return true
}
// Check for default export (`export default function() {}`)
const isDefaultExport = j(path).closest(j.ExportDefaultDeclaration).size() > 0
if (isDefaultExport) {
return true
}
// Look for named export elsewhere in the file (`export { <named> }`)
const root = j(path).closestScope().closest(j.Program)
const isNamedExport =
root
.find(j.ExportNamedDeclaration, {
specifiers: [
{
type: 'ExportSpecifier',
exported: {
name: matchedFunctionNameFilter,
},
},
],
})
.size() > 0
// Look for variable export but still function, e.g. `export const <named> = function() {}`,
// also check if variable is a function or arrow function
const isVariableExport =
root
.find(j.ExportNamedDeclaration, {
declaration: {
declarations: [
{
type: 'VariableDeclarator',
id: {
type: 'Identifier',
name: matchedFunctionNameFilter,
},
init: {
type: isFunctionType,
},
},
],
},
})
.size() > 0
if (isVariableExport) return true
return isNamedExport
}
export function determineClientDirective(
root: Collection<any>,
j: JSCodeshift,
source: string
) {
const hasStringDirective =
root
.find(j.Literal)
.filter((path) => {
const expr = path.node
return (
expr.value === 'use client' && path.parentPath.node.type === 'Program'
)
})
.size() > 0
// 'use client';
const hasStringDirectiveWithSemicolon =
root
.find(j.StringLiteral)
.filter((path) => {
const expr = path.node
return (
expr.type === 'StringLiteral' &&
expr.value === 'use client' &&
path.parentPath.node.type === 'Program'
)
})
.size() > 0
if (hasStringDirective || hasStringDirectiveWithSemicolon) return true
// Since the client detection is not reliable with AST in jscodeshift,
// determine if 'use client' or "use client" is leading in the source code.
const trimmedSource = source.trim()
const containsClientDirective =
/^'use client'/.test(trimmedSource) || /^"use client"/g.test(trimmedSource)
return containsClientDirective
}
export function isPromiseType(typeAnnotation) {
return (
typeAnnotation.type === 'TSTypeReference' &&
typeAnnotation.typeName.name === 'Promise'
)
}
export function turnFunctionReturnTypeToAsync(
node: Node,
j: API['jscodeshift']
) {
if (
j.FunctionDeclaration.check(node) ||
j.FunctionExpression.check(node) ||
j.ArrowFunctionExpression.check(node)
) {
if (node.returnType) {
const returnTypeAnnotation = node.returnType.typeAnnotation
const isReturnTypePromise = isPromiseType(returnTypeAnnotation)
// Turn <return type> to Promise<return type>
// e.g. () => { slug: string } to () => Promise<{ slug: string }>
// e.g. Anything to Promise<Anything>
if (!isReturnTypePromise) {
if (
node.returnType &&
j.TSTypeAnnotation.check(node.returnType) &&
(j.TSTypeReference.check(node.returnType.typeAnnotation) ||
j.TSUnionType.check(node.returnType.typeAnnotation) ||
j.TSTypePredicate.check(node.returnType.typeAnnotation))
) {
// Change the return type to Promise<void>
node.returnType.typeAnnotation = j.tsTypeReference(
j.identifier('Promise'),
// @ts-ignore ignore the super strict type checking on the type annotation
j.tsTypeParameterInstantiation([returnTypeAnnotation])
)
}
}
}
}
}
export function insertReactUseImport(root: Collection<any>, j: API['j']) {
const hasReactUseImport =
root
.find(j.ImportSpecifier, {
imported: {
type: 'Identifier',
name: 'use',
},
})
.size() > 0
if (!hasReactUseImport) {
const reactImportDeclaration = root.find(j.ImportDeclaration, {
source: {
type: 'Literal',
value: 'react',
},
})
if (reactImportDeclaration.size() > 0) {
// Add 'use' to existing 'react' import declaration
reactImportDeclaration
.get()
.node.specifiers.push(j.importSpecifier(j.identifier('use')))
} else {
// Final all type imports to 'react'
const reactImport = root.find(j.ImportDeclaration, {
source: {
type: 'Literal',
value: 'react',
},
})
if (reactImport.size() > 0) {
reactImport
.get()
.node.specifiers.push(j.importSpecifier(j.identifier('use')))
} else {
// Add new import declaration for 'react' and 'use'
root
.get()
.node.program.body.unshift(
j.importDeclaration(
[j.importSpecifier(j.identifier('use'))],
j.literal('react')
)
)
}
}
}
}
function findSubScopeArgumentIdentifier(
path: ASTPath<any>,
j: API['j'],
argName: string
) {
const defCount = j(path).find(j.Identifier, { name: argName }).size()
return defCount > 0
}
export function generateUniqueIdentifier(
defaultIdName: string,
path: ASTPath<any>,
j: API['j']
): ReturnType<typeof j.identifier> {
let idName = defaultIdName
let idNameSuffix = 0
while (findSubScopeArgumentIdentifier(path, j, idName)) {
idName = defaultIdName + idNameSuffix
idNameSuffix++
}
const propsIdentifier = j.identifier(idName)
return propsIdentifier
}
export { default } from './lib/async-request-api/index'
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