MCPcopy
hub / github.com/vercel/next.js / ncc_stream_browserify

Function ncc_stream_browserify

packages/next/taskfile.js:774–797  ·  view source on GitHub ↗
(task, opts)

Source from the content-addressed store, hash-verified

772}
773
774export async function ncc_stream_browserify(task, opts) {
775 await task
776 .source(relative(__dirname, require.resolve('stream-browserify/')))
777 .ncc({
778 packageName: 'stream-browserify',
779 mainFields: ['browser', 'main'],
780 target: 'es5',
781 })
782 .target('src/compiled/stream-browserify')
783
784 // while ncc'ing readable-stream the browser mapping does not replace the
785 // require('stream') with require('events').EventEmitter correctly so we
786 // patch this manually as leaving require('stream') causes a circular
787 // reference breaking the browser polyfill
788 const outputFile = join(__dirname, 'src/compiled/stream-browserify/index.js')
789
790 await fs.writeFile(
791 outputFile,
792 (await fs.readFile(outputFile, 'utf8')).replace(
793 `require("stream")`,
794 `require("events").EventEmitter`
795 )
796 )
797}
798
799export async function ncc_stream_http(task, opts) {
800 await task

Callers

nothing calls this directly

Calls 8

targetMethod · 0.80
resolveMethod · 0.65
writeFileMethod · 0.65
replaceMethod · 0.65
relativeFunction · 0.50
joinFunction · 0.50
sourceMethod · 0.45
readFileMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…