Skip to content

Commit

Permalink
fix: fixed typings
Browse files Browse the repository at this point in the history
  • Loading branch information
wyattjoh committed Apr 15, 2024
1 parent 9bbaa11 commit 12070da
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 20 deletions.
7 changes: 2 additions & 5 deletions packages/next/src/build/utils.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import type {
ExperimentalPPRConfig,
NextConfig,
NextConfigComplete,
} from '../server/config-shared'
import type { NextConfig, NextConfigComplete } from '../server/config-shared'
import type { ExperimentalPPRConfig } from '../server/lib/experimental/ppr'
import type { AppBuildManifest } from './webpack/plugins/app-build-manifest-plugin'
import type { AssetBinding } from './webpack/loaders/get-module-build-info'
import type {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import type { StaticGenerationStore } from '../../client/components/static-gener
import type { AsyncLocalStorage } from 'async_hooks'
import type { IncrementalCache } from '../lib/incremental-cache'
import type { RenderOptsPartial } from '../app-render/types'
import type { FetchMetric } from '../base-http'

import { createPrerenderState } from '../../server/app-render/dynamic-rendering'
import type { FetchMetric } from '../base-http'

export type StaticGenerationContext = {
urlPathname: string
Expand Down
10 changes: 1 addition & 9 deletions packages/next/src/server/config-shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import type { WEB_VITALS } from '../shared/lib/utils'
import type { NextParsedUrlQuery } from './request-meta'
import type { SizeLimit } from '../../types'
import type { SwrDelta } from './lib/revalidate'
import type { ExperimentalPPRConfig } from './lib/experimental/ppr'

export type NextConfigComplete = Required<NextConfig> & {
images: Required<ImageConfigComplete>
Expand Down Expand Up @@ -180,15 +181,6 @@ export interface NextJsWebpackConfig {
): any
}

/**
* If set to `incremental`, only those leaf pages that export
* `experimental_ppr = true` will have partial prerendering enabled. If any
* page exports this value as `false` or does not export it at all will not
* have partial prerendering enabled. If set to a boolean, it the options for
* `experimental_ppr` will be ignored.
*/
export type ExperimentalPPRConfig = boolean | 'incremental'

export interface ExperimentalConfig {
prerenderEarlyExit?: boolean
linkNoTouchStart?: boolean
Expand Down
15 changes: 12 additions & 3 deletions packages/next/src/server/lib/experimental/ppr.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import type { AppConfig } from '../../../build/utils'
import type { ExperimentalPPRConfig } from '../../config-shared'
/**
* If set to `incremental`, only those leaf pages that export
* `experimental_ppr = true` will have partial prerendering enabled. If any
* page exports this value as `false` or does not export it at all will not
* have partial prerendering enabled. If set to a boolean, it the options for
* `experimental_ppr` will be ignored.
*/

export type ExperimentalPPRConfig = boolean | 'incremental'

/**
* Returns true if partial prerendering is enabled for the application.
Expand All @@ -26,7 +33,9 @@ export function isPPREnabled(
*/
export function isPPRSupported(
config: ExperimentalPPRConfig | undefined,
appConfig: AppConfig
appConfig: {
experimental_ppr?: boolean
}
): boolean {
// If the config is undefined or false, partial prerendering is disabled.
if (typeof config === 'undefined' || config === false) {
Expand Down
4 changes: 2 additions & 2 deletions test/unit/incremental-cache/file-system-cache.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { promises as fs } from 'node:fs'
import { fileURLToPath } from 'node:url'
import FileSystemCache from 'next/src/server/lib/incremental-cache/file-system-cache'
import { nodeFs } from 'next/src/server/lib/node-fs-methods'
import FileSystemCache from 'next/dist/server/lib/incremental-cache/file-system-cache'
import { nodeFs } from 'next/dist/server/lib/node-fs-methods'

const cacheDir = fileURLToPath(new URL('./cache', import.meta.url))

Expand Down

0 comments on commit 12070da

Please sign in to comment.