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

refactor: added more strict app segment config validation #70480

Merged
merged 1 commit into from
Oct 4, 2024

Conversation

wyattjoh
Copy link
Member

@wyattjoh wyattjoh commented Sep 25, 2024

This increases the strictness that Next.js uses while parsing configuration from applications as well as removing some legacy options (in preparation for Next.js 15).

  • Errors are now printing to the console while parsing app route segment configuration, improving the reliability of the parsed configuration
  • Breaking Pages and routes in App Router will no long support export const runtime = "experimental-edge", they will be required to switch to export const runtime = "edge". They were the same here anyways but this stabilizes it.
  • Enables the possibility of parsing the configuration values from client component files via direct AST traversal.

@ijjk
Copy link
Member

ijjk commented Sep 25, 2024

Tests Passed

@wyattjoh wyattjoh force-pushed the refactor/app-segment-config-validation branch from 1ebdb45 to c261a85 Compare September 25, 2024 18:17
@wyattjoh wyattjoh force-pushed the refactor/app-segment-config-validation branch from c261a85 to 026cc27 Compare September 26, 2024 17:01
@wyattjoh wyattjoh force-pushed the refactor/app-segment-config-validation branch from 026cc27 to c552009 Compare September 26, 2024 18:24
@wyattjoh wyattjoh force-pushed the refactor/app-segment-config-validation branch from c552009 to 998c585 Compare September 26, 2024 23:35
@wyattjoh wyattjoh force-pushed the refactor/app-segment-config-validation branch from 998c585 to 1ff36ff Compare September 26, 2024 23:46
@wyattjoh wyattjoh force-pushed the refactor/app-segment-config-validation branch from 1ff36ff to 351bbbc Compare September 27, 2024 00:02
@wyattjoh wyattjoh force-pushed the refactor/app-segment-config-validation branch from 351bbbc to 3686097 Compare September 27, 2024 18:23
@wyattjoh wyattjoh force-pushed the refactor/app-segment-config-validation branch from 3686097 to b8f312e Compare September 27, 2024 19:35
@wyattjoh wyattjoh force-pushed the refactor/app-segment-config-validation branch from b8f312e to 3edece9 Compare September 29, 2024 16:30
@wyattjoh wyattjoh force-pushed the refactor/app-segment-config-validation branch 2 times, most recently from 7a1b186 to 6f319f5 Compare September 29, 2024 17:03
@wyattjoh wyattjoh force-pushed the refactor/app-segment-config-validation branch from 6f319f5 to 80164aa Compare September 29, 2024 17:09
@wyattjoh wyattjoh force-pushed the refactor/app-segment-config-validation branch 2 times, most recently from aa1af00 to a44b164 Compare October 1, 2024 23:10
@ijjk ijjk added the tests label Oct 1, 2024
@wyattjoh wyattjoh force-pushed the refactor/app-segment-config-validation branch 3 times, most recently from d750e5a to 3d0e18a Compare October 2, 2024 15:27
Copy link

socket-security bot commented Oct 2, 2024

New dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/zod-validation-error@3.4.0 None 0 73.7 kB jmike

View full report↗︎

@wyattjoh wyattjoh force-pushed the refactor/app-segment-config-validation branch 15 times, most recently from cd8c4c3 to 6f99389 Compare October 3, 2024 02:39

if (staticInfo?.type === PAGE_TYPES.PAGES) {
if (
staticInfo.config?.config?.amp === true ||
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how come this is a doubly nested config?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pages/ supports the following:

export const config = { runtime: "edge" }

params: GetPageStaticInfoParams
): Promise<PageStaticInfo> {
if (params.pageType === PAGE_TYPES.APP) {
return getAppPageStaticInfo(params)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙏

@@ -148,45 +150,32 @@ export async function getStaticInfoIncludingLayouts({
dir = join(dir, '..')
}

// Reverse the layout files so we can use unshift to add them to the
// segments array.
layoutFiles.reverse()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this part is a little strange to me, could you clarify in the comment why we do this?

@wyattjoh wyattjoh force-pushed the refactor/app-segment-config-validation branch from 6f99389 to 64eae6e Compare October 4, 2024 19:32
@wyattjoh wyattjoh marked this pull request as ready for review October 4, 2024 19:32
@wyattjoh wyattjoh merged commit a20f750 into canary Oct 4, 2024
109 checks passed
@wyattjoh wyattjoh deleted the refactor/app-segment-config-validation branch October 4, 2024 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants