PHP 8.2.30
Preview: pipeline.js Size: 1.09 KB
/opt/alt/alt-nodejs24/root/usr/lib/node_modules/npm/node_modules.bundled/make-fetch-happen/lib/pipeline.js

'use strict'

const MinipassPipeline = require('minipass-pipeline')

class CachingMinipassPipeline extends MinipassPipeline {
  #events = []
  #data = new Map()

  constructor (opts, ...streams) {
    // CRITICAL: do NOT pass the streams to the call to super(), this will start
    // the flow of data and potentially cause the events we need to catch to emit
    // before we've finished our own setup. instead we call super() with no args,
    // finish our setup, and then push the streams into ourselves to start the
    // data flow
    super()
    this.#events = opts.events

    /* istanbul ignore next - coverage disabled because this is pointless to test here */
    if (streams.length) {
      this.push(...streams)
    }
  }

  on (event, handler) {
    if (this.#events.includes(event) && this.#data.has(event)) {
      return handler(...this.#data.get(event))
    }

    return super.on(event, handler)
  }

  emit (event, ...data) {
    if (this.#events.includes(event)) {
      this.#data.set(event, data)
    }

    return super.emit(event, ...data)
  }
}

module.exports = CachingMinipassPipeline

Directory Contents

Dirs: 1 × Files: 5

Name Size Perms Modified Actions
cache DIR
- drwxr-xr-x 2026-04-16 07:28:02
Edit Download
3.85 KB lrw-r--r-- 2026-03-17 12:21:20
Edit Download
1.15 KB lrw-r--r-- 2026-03-17 12:21:20
Edit Download
1.65 KB lrw-r--r-- 2026-03-17 12:21:20
Edit Download
1.09 KB lrw-r--r-- 2026-03-17 12:21:20
Edit Download
4.67 KB lrw-r--r-- 2026-03-17 12:21:20
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).