Skip to content

Commit

Permalink
delete unsued exports files
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi committed Feb 6, 2024
1 parent 138b73e commit 0ba1c20
Show file tree
Hide file tree
Showing 13 changed files with 15 additions and 33 deletions.
7 changes: 2 additions & 5 deletions packages/next/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@ const serverExports = {
.userAgentFromString,
userAgent: require('next/dist/server/web/spec-extension/user-agent')
.userAgent,
}

if (typeof URLPattern !== 'undefined') {
// eslint-disable-next-line no-undef
serverExports.URLPattern = URLPattern
URLPattern: require('next/dist/server/web/spec-extension/url-pattern')
.URLPattern,
}

// https://nodejs.org/api/esm.html#commonjs-namespaces
Expand Down
2 changes: 0 additions & 2 deletions packages/next/src/server/web/exports/image-response.ts

This file was deleted.

11 changes: 5 additions & 6 deletions packages/next/src/server/web/exports/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// Alias index file of next/server for edge runtime for tree-shaking purpose

export { default as ImageResponse } from './image-response'
export { default as NextRequest } from './next-request'
export { default as NextResponse } from './next-response'
export { default as userAgent } from './user-agent'
export { default as userAgentFromString } from './user-agent-from-string'
export { default as URLPattern } from './url-pattern'
export { ImageResponse } from '../spec-extension/image-response'
export { NextRequest } from '../spec-extension/request'
export { NextResponse } from '../spec-extension/response'
export { userAgent, userAgentFromString } from '../spec-extension/user-agent'
export { URLPattern } from '../spec-extension/url-pattern'
2 changes: 0 additions & 2 deletions packages/next/src/server/web/exports/next-request.ts

This file was deleted.

2 changes: 0 additions & 2 deletions packages/next/src/server/web/exports/next-response.ts

This file was deleted.

2 changes: 0 additions & 2 deletions packages/next/src/server/web/exports/revalidate-path.ts

This file was deleted.

2 changes: 0 additions & 2 deletions packages/next/src/server/web/exports/revalidate-tag.ts

This file was deleted.

2 changes: 0 additions & 2 deletions packages/next/src/server/web/exports/unstable-cache.ts

This file was deleted.

2 changes: 0 additions & 2 deletions packages/next/src/server/web/exports/unstable-no-store.ts

This file was deleted.

This file was deleted.

2 changes: 0 additions & 2 deletions packages/next/src/server/web/exports/user-agent.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ const GlobalURLPattern =
// @ts-expect-error: URLPattern is not available in Node.js
typeof URLPattern === 'undefined' ? undefined : URLPattern

export default GlobalURLPattern
export { GlobalURLPattern as URLPattern }
10 changes: 7 additions & 3 deletions test/e2e/app-dir/app-external/app-external.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ createNextDescribe(
buildCommand: 'yarn build',
skipDeployment: true,
},
({ next }) => {
({ next, isNextStart }) => {
it('should be able to opt-out 3rd party packages being bundled in server components', async () => {
await next.fetch('/react-server/optout').then(async (response) => {
const result = await resolveStreamResponse(response)
Expand Down Expand Up @@ -249,8 +249,12 @@ createNextDescribe(
const html = await next.render('/test-middleware')
expect(html).toContain('it works')

const middlewareBundle = await next.readFile('.next/server/middleware.js')
expect(middlewareBundle).not.toContain('image-response')
if (isNextStart) {
const middlewareBundle = await next.readFile(
'.next/server/middleware.js'
)
expect(middlewareBundle).not.toContain('image-response')
}
})

it('should use the same async storages if imported directly', async () => {
Expand Down

0 comments on commit 0ba1c20

Please sign in to comment.