Unverified Commit 47030ae2 authored by Jiachi Liu's avatar Jiachi Liu Committed by GitHub

codemod: fix missing route transform (#70959)

parent 979ac407
export async function GET(req, props) {
const params = await props.params;
f1(params)
}
......@@ -43,7 +43,12 @@ describe('next-async-request-api - dynamic-props', () => {
// Override test fixture input filename with `page.tsx` to always match the expected output,
// otherwise fallback to the original filename.
const overrideFilename = /[\\/]origin-name-/.test(inputPath) ? inputPath : 'page.tsx'
const overrideFilename = /[\\/]origin-name-\d{2}-/.test(inputPath)
// extract the <name> from `origin-name-<name>-<number>.input.js`
? inputPath
.replace(/origin-name-(\d{2})-/, '')
.replace(/\.input\./, '.')
: 'page.tsx'
it(`transforms correctly ${prefix}`, () => {
runInlineTest(
......
......@@ -151,7 +151,7 @@ function applyUseAndRenameAccessedProp(
return modified
}
const MATCHED_FILE_PATTERNS = /([\\/]|^)(page|layout)\.(t|j)sx?$/
const MATCHED_FILE_PATTERNS = /([\\/]|^)(page|layout|route)\.(t|j)sx?$/
function modifyTypes(
paramTypeAnnotation: any,
......
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