Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

codemod: fix missing route transform #70959

Merged
merged 2 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export async function GET(req, { params }) {
f1(params)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export async function GET(req, props) {
const params = await props.params;
f1(params)
}
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading