Skip to content

Commit

Permalink
Merge branch 'canary' into ci/update-e2e-concurrency
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Oct 20, 2023
2 parents 0a3c318 + f9bd6f7 commit 6917cc6
Show file tree
Hide file tree
Showing 12 changed files with 5 additions and 138 deletions.
1 change: 0 additions & 1 deletion packages/next/src/export/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import type {
WorkerRenderOpts,
} from './types'

import '../server/node-polyfill-web-streams'
import '../server/node-environment'

process.env.NEXT_IS_EXPORT_WORKER = 'true'
Expand Down
23 changes: 2 additions & 21 deletions packages/next/src/server/app-render/action-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,27 +40,8 @@ import type { AppRenderContext, GenerateFlight } from './app-render'

function nodeToWebReadableStream(nodeReadable: import('stream').Readable) {
if (process.env.NEXT_RUNTIME !== 'edge') {
const { Readable } = require('stream')
if ('toWeb' in Readable && typeof Readable.toWeb === 'function') {
return Readable.toWeb(nodeReadable)
}

const iterator = nodeReadable[Symbol.asyncIterator]()

return new ReadableStream({
pull: async (controller) => {
const { value, done } = await iterator.next()

if (done) {
controller.close()
} else {
controller.enqueue(value)
}
},
cancel: () => {
iterator.return?.()
},
})
const { Readable } = require('stream') as typeof import('stream')
return Readable.toWeb(nodeReadable) as ReadableStream
} else {
throw new Error('Invalid runtime')
}
Expand Down
2 changes: 0 additions & 2 deletions packages/next/src/server/lib/incremental-cache/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import FileSystemCache from './file-system-cache'
import path from '../../../shared/lib/isomorphic/path'
import { normalizePagePath } from '../../../shared/lib/page-path/normalize-page-path'

import '../../node-polyfill-web-streams'

import {
CACHE_ONE_YEAR,
NEXT_CACHE_REVALIDATED_TAGS_HEADER,
Expand Down
2 changes: 0 additions & 2 deletions packages/next/src/server/lib/router-utils/resolve-routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ import {
} from '../../../shared/lib/router/utils/prepare-destination'
import { createRequestResponseMocks } from '../mock-request'

import '../../node-polyfill-web-streams'

const debug = setupDebug('next:router-server:resolve-routes')

export function getResolveRoutes(
Expand Down
1 change: 0 additions & 1 deletion packages/next/src/server/next-server.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import './node-environment'
import './require-hook'
import './node-polyfill-web-streams'
import './node-polyfill-crypto'

import type { TLSSocket } from 'tls'
Expand Down
37 changes: 0 additions & 37 deletions packages/next/src/server/node-polyfill-web-streams.ts

This file was deleted.

2 changes: 0 additions & 2 deletions packages/next/src/server/pipe-readable.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import type { ServerResponse } from 'node:http'

import './node-polyfill-web-streams'

import {
ResponseAbortedName,
createAbortController,
Expand Down
2 changes: 0 additions & 2 deletions packages/next/src/server/render.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,6 @@ let postProcessHTML: typeof import('./post-process').postProcessHTML

const DOCTYPE = '<!DOCTYPE html>'

import './node-polyfill-web-streams'

if (process.env.NEXT_RUNTIME !== 'edge') {
tryGetPreviewData =
require('./api-utils/node/try-get-preview-data').tryGetPreviewData
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import type { FlightRouterState } from '../app-render/types'

import '../node-polyfill-web-streams'

import { nonNullable } from '../../lib/non-nullable'
import { getTracer } from '../lib/trace/tracer'
import { AppRenderSpan } from '../lib/trace/constants'
Expand Down
21 changes: 0 additions & 21 deletions test/__mocks__/node-polyfill-web-streams.js

This file was deleted.

24 changes: 0 additions & 24 deletions test/lib/mocks-require-hook.js

This file was deleted.

26 changes: 3 additions & 23 deletions test/lib/next-test-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,7 @@ export function initNextServerScript(
return new Promise((resolve, reject) => {
const instance = spawn(
'node',
[
...((opts && opts.nodeArgs) || []),
'-r',
require.resolve('./mocks-require-hook'),
'--no-deprecation',
scriptPath,
],
[...((opts && opts.nodeArgs) || []), '--no-deprecation', scriptPath],
{
env,
cwd: opts && opts.cwd,
Expand Down Expand Up @@ -225,14 +219,7 @@ export function runNextCommand(
console.log(`Running command "next ${argv.join(' ')}"`)
const instance = spawn(
'node',
[
...(options.nodeArgs || []),
'-r',
require.resolve('./mocks-require-hook'),
'--no-deprecation',
nextBin,
...argv,
],
[...(options.nodeArgs || []), '--no-deprecation', nextBin, ...argv],
{
...options.spawnOptions,
cwd,
Expand Down Expand Up @@ -354,14 +341,7 @@ export function runNextCommandDev(
return new Promise((resolve, reject) => {
const instance = spawn(
'node',
[
...nodeArgs,
'-r',
require.resolve('./mocks-require-hook'),
'--no-deprecation',
nextBin,
...argv,
],
[...nodeArgs, '--no-deprecation', nextBin, ...argv],
{
cwd,
env,
Expand Down

0 comments on commit 6917cc6

Please sign in to comment.