Skip to content
Draft
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
1 change: 1 addition & 0 deletions .config/eslintignore.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export default globalIgnores([
'test/e2e/app-dir/server-source-maps/fixtures/default/external-pkg/sourcemapped.js',
'test/development/next-lint-eslint-formatter-compact/**/*.js',
'test/e2e/app-dir/app-external/app/mixed/import/mixed-mod.mjs',
'test/e2e/babel/fixture/lib/mycomponent.js',
'turbopack/crates/*/tests/**/*',
'turbopack/crates/*/js/src/compiled',
// Eval fixtures are deliberately imperfect code for agents to fix.
Expand Down
2 changes: 1 addition & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export default defineConfig([
jsx: true,
},
babelOptions: {
presets: ['next/babel'],
presets: ['./packages/next/babel'],
caller: {
supportsTopLevelAwait: true,
},
Expand Down
22 changes: 4 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,13 @@
"check-precompiled": "./scripts/check-pre-compiled.sh",
"lint-staged": "lint-staged",
"next-with-deps": "./scripts/next-with-deps.sh",
"next": "cross-env NEXT_PRIVATE_LOCAL_DEV=1 NEXT_TELEMETRY_DISABLED=1 NODE_OPTIONS=\"--trace-deprecation --enable-source-maps\" next",
"create-next-app": "packages/create-next-app/dist/index.js",
"next": "cross-env NEXT_PRIVATE_LOCAL_DEV=1 NEXT_TELEMETRY_DISABLED=1 NODE_OPTIONS=\"--trace-deprecation --enable-source-maps\" packages/next/dist/bin/next",
"next-no-sourcemaps": "echo 'No longer supported. Use `pnpm next --disable-source-maps` instead'; exit 1;",
"debug": "cross-env NEXT_PRIVATE_LOCAL_DEV=1 NEXT_TELEMETRY_DISABLED=1 node --inspect --trace-deprecation --enable-source-maps packages/next/dist/bin/next",
"debug-brk": "cross-env NEXT_PRIVATE_LOCAL_DEV=1 NEXT_TELEMETRY_DISABLED=1 node --inspect-brk --trace-deprecation --enable-source-maps packages/next/dist/bin/next",
"pnpm:devPreinstall": "node scripts/create-next-bin-placeholder.mjs",
"postinstall": "node scripts/git-configure.mjs && node scripts/install-native.mjs",
"postinstall": "node scripts/git-configure.mjs && node scripts/install-native.mjs && node scripts/create-next-self-symlink.mjs",
"version": "pnpm install --no-frozen-lockfile && git add .",
"prepare": "husky",
"sync-react": "node ./scripts/sync-react.js",
Expand Down Expand Up @@ -126,18 +127,7 @@
"@jest/expect-utils": "29.7.0",
"@mdx-js/loader": "2.2.1",
"@mdx-js/react": "2.2.1",
"@next/bundle-analyzer": "workspace:*",
"@next/env": "workspace:*",
"@next/eslint-plugin-next": "workspace:*",
"@next/font": "workspace:*",
"@next/mdx": "workspace:*",
"@next/playwright": "workspace:*",
"@next/plugin-storybook": "workspace:*",
"@next/polyfill-module": "workspace:*",
"@next/polyfill-nomodule": "workspace:*",
"@next/swc": "workspace:*",
"@next/third-parties": "workspace:*",
"@opentelemetry/api": "1.4.1",
"@opentelemetry/api": "1.6.0",
"@picocss/pico": "1.5.10",
"@rspack/core": "1.6.7",
"@slack/web-api": "7.9.1",
Expand Down Expand Up @@ -168,7 +158,6 @@
"@types/yargs": "16.0.11",
"@vercel/agent-eval": "0.9.5",
"@vercel/blob": "2.3.2",
"@vercel/devlow-bench": "workspace:*",
"@vercel/kv": "3.0.0",
"@vercel/og": "0.11.1",
"abort-controller": "3.0.0",
Expand All @@ -181,15 +170,13 @@
"cookie": "0.4.1",
"cors": "2.8.5",
"coveralls": "3.0.3",
"create-next-app": "workspace:*",
"critters": "0.0.6",
"cross-env": "6.0.3",
"cross-spawn": "6.0.5",
"dd-trace": "4.12.0",
"es5-ext": "0.10.53",
"escape-string-regexp": "2.0.0",
"eslint": "9.37.0",
"eslint-config-next": "workspace:*",
"eslint-formatter-codeframe": "7.32.1",
"eslint-plugin-eslint-plugin": "5.2.1",
"eslint-plugin-import": "2.31.0",
Expand Down Expand Up @@ -237,7 +224,6 @@
"minimatch": "3.0.4",
"moment": "^2.24.0",
"nanoid": "3.1.30",
"next": "workspace:*",
"node-fetch": "2.6.7",
"node-plop": "0.31.1",
"npm-run-all": "4.1.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/font/src/google/loader.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { AdjustFontFallback, FontLoader } from 'next/font'
import type { AdjustFontFallback, FontLoader } from '../types'
// @ts-ignore
import * as Log from 'next/dist/build/output/log'
import { validateGoogleFontFunctionCall } from './validate-google-font-function-call'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Font } from 'fontkit'
import type { AdjustFontFallback } from 'next/font'
import type { AdjustFontFallback } from '../types'

// The font metadata of the fallback fonts, retrieved with fontkit on system font files
// The average width is calculated with the calcAverageWidth function below
Expand Down
2 changes: 1 addition & 1 deletion packages/font/src/local/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ try {
const mod = require('../fontkit').default
fontFromBuffer = mod.default || mod
} catch {}
import type { AdjustFontFallback, FontLoader } from 'next/font'
import type { AdjustFontFallback, FontLoader } from '../types'

import { promisify } from 'util'
import { pickFontFileForFallbackGeneration } from './pick-font-file-for-fallback-generation'
Expand Down
31 changes: 31 additions & 0 deletions packages/font/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
export type AdjustFontFallback = {
fallbackFont: string
ascentOverride?: string
descentOverride?: string
lineGapOverride?: string
sizeAdjust?: string
}

export type FontLoader = (options: {
functionName: string
variableName: string
data: any[]
emitFontFile: (
content: Buffer,
ext: string,
preload: boolean,
isUsingSizeAdjust?: boolean
) => string
resolve: (src: string) => string
isDev: boolean
isServer: boolean
loaderContext: any
}) => Promise<{
css: string
fallbackFonts?: string[]
variable?: string
adjustFontFallback?: AdjustFontFallback
weight?: string
style?: string
}>

export type CssVariable = `--${string}`

export type Display = 'auto' | 'block' | 'swap' | 'fallback' | 'optional'
Expand Down
34 changes: 4 additions & 30 deletions packages/next/font/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,4 @@
export type AdjustFontFallback = {
fallbackFont: string
ascentOverride?: string
descentOverride?: string
lineGapOverride?: string
sizeAdjust?: string
}

export type FontLoader = (options: {
functionName: string
variableName: string
data: any[]
emitFontFile: (
content: Buffer,
ext: string,
preload: boolean,
isUsingSizeAdjust?: boolean
) => string
resolve: (src: string) => string
isDev: boolean
isServer: boolean
loaderContext: any
}) => Promise<{
css: string
fallbackFonts?: string[]
variable?: string
adjustFontFallback?: AdjustFontFallback
weight?: string
style?: string
}>
export {
AdjustFontFallback,
FontLoader,
} from 'next/dist/compiled/@next/font/dist/types'
25 changes: 20 additions & 5 deletions packages/next/next-devtools.webpack-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,26 @@ module.exports = ({ dev, ...rest }) => {
resolve: {
alias: {
// TODO: Get dedicated React version for NDT to uncouple development.
react: `next/dist/compiled/react${bundledReactChannel}`,
'react-dom$': `next/dist/compiled/react-dom${bundledReactChannel}`,
'react-dom/client$': `next/dist/compiled/react-dom${bundledReactChannel}/client`,
'react-is$': `next/dist/compiled/react-is${bundledReactChannel}`,
scheduler$: `next/dist/compiled/scheduler${bundledReactChannel}`,
react: path.join(
__dirname,
`dist/compiled/react${bundledReactChannel}`
),
'react-dom$': path.join(
__dirname,
`dist/compiled/react-dom${bundledReactChannel}`
),
'react-dom/client$': path.join(
__dirname,
`dist/compiled/react-dom${bundledReactChannel}/client`
),
'react-is$': path.join(
__dirname,
`dist/compiled/react-is${bundledReactChannel}`
),
scheduler$: path.join(
__dirname,
`dist/compiled/scheduler${bundledReactChannel}`
),
},
extensions: ['.ts', '.tsx', '.js', '.json'],
},
Expand Down
Loading
Loading