Skip to content

Commit

Permalink
Import from internal modules in next/server
Browse files Browse the repository at this point in the history
This entrypoint relied on public `next/*` entrypoints.
We want to get rid of public `next/dist/*` entrypoints eventually, so we should start using internal modules.
  • Loading branch information
eps1lon committed Aug 4, 2024
1 parent aee6f67 commit 92bdcae
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
20 changes: 10 additions & 10 deletions packages/next/server.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ declare global {
var AsyncLocalStorage: typeof NodeAsyncLocalStorage
}

export { NextFetchEvent } from 'next/dist/server/web/spec-extension/fetch-event'
export { NextRequest } from 'next/dist/server/web/spec-extension/request'
export { NextResponse } from 'next/dist/server/web/spec-extension/response'
export { NextMiddleware, MiddlewareConfig } from 'next/dist/server/web/types'
export { userAgentFromString } from 'next/dist/server/web/spec-extension/user-agent'
export { userAgent } from 'next/dist/server/web/spec-extension/user-agent'
export { URLPattern } from 'next/dist/compiled/@edge-runtime/primitives/url'
export { ImageResponse } from 'next/dist/server/web/spec-extension/image-response'
export type { ImageResponseOptions } from 'next/dist/compiled/@vercel/og/types'
export { unstable_after } from 'next/dist/server/after'
export { NextFetchEvent } from './dist/server/web/spec-extension/fetch-event'
export { NextRequest } from './dist/server/web/spec-extension/request'
export { NextResponse } from './dist/server/web/spec-extension/response'
export { NextMiddleware, MiddlewareConfig } from './dist/server/web/types'
export { userAgentFromString } from './dist/server/web/spec-extension/user-agent'
export { userAgent } from './dist/server/web/spec-extension/user-agent'
export { URLPattern } from './dist/compiled/@edge-runtime/primitives/url'
export { ImageResponse } from './dist/server/web/spec-extension/image-response'
export type { ImageResponseOptions } from './dist/compiled/@vercel/og/types'
export { unstable_after } from './dist/server/after'
16 changes: 7 additions & 9 deletions packages/next/server.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
const serverExports = {
NextRequest: require('next/dist/server/web/spec-extension/request')
.NextRequest,
NextResponse: require('next/dist/server/web/spec-extension/response')
NextRequest: require('./dist/server/web/spec-extension/request').NextRequest,
NextResponse: require('./dist/server/web/spec-extension/response')
.NextResponse,
ImageResponse: require('next/dist/server/web/spec-extension/image-response')
ImageResponse: require('./dist/server/web/spec-extension/image-response')
.ImageResponse,
userAgentFromString: require('next/dist/server/web/spec-extension/user-agent')
userAgentFromString: require('./dist/server/web/spec-extension/user-agent')
.userAgentFromString,
userAgent: require('next/dist/server/web/spec-extension/user-agent')
.userAgent,
URLPattern: require('next/dist/server/web/spec-extension/url-pattern')
userAgent: require('./dist/server/web/spec-extension/user-agent').userAgent,
URLPattern: require('./dist/server/web/spec-extension/url-pattern')
.URLPattern,
unstable_after: require('next/dist/server/after').unstable_after,
unstable_after: require('./dist/server/after').unstable_after,
}

// https://nodejs.org/api/esm.html#commonjs-namespaces
Expand Down

0 comments on commit 92bdcae

Please sign in to comment.