Skip to content

Commit

Permalink
deps: hoist minipass-fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
reggi committed Oct 2, 2024
1 parent be1e6da commit 20dd44f
Show file tree
Hide file tree
Showing 41 changed files with 1,716 additions and 89 deletions.
11 changes: 6 additions & 5 deletions node_modules/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
!/@sigstore/sign/node_modules/@npmcli/fs
!/@sigstore/sign/node_modules/cacache
!/@sigstore/sign/node_modules/make-fetch-happen
!/@sigstore/sign/node_modules/minipass-fetch
!/@sigstore/sign/node_modules/proc-log
!/@sigstore/sign/node_modules/ssri
!/@sigstore/sign/node_modules/unique-filename
Expand Down Expand Up @@ -138,13 +139,12 @@
!/just-diff
!/lru-cache
!/make-fetch-happen
!/make-fetch-happen/node_modules/
/make-fetch-happen/node_modules/*
!/make-fetch-happen/node_modules/minipass-fetch
!/make-fetch-happen/node_modules/minizlib
!/minimatch
!/minipass-collect
!/minipass-fetch
!/minipass-fetch/node_modules/
/minipass-fetch/node_modules/*
!/minipass-fetch/node_modules/minizlib
!/minipass-flush
!/minipass-flush/node_modules/
/minipass-flush/node_modules/*
Expand Down Expand Up @@ -177,6 +177,7 @@
!/node-gyp/node_modules/cacache
!/node-gyp/node_modules/isexe
!/node-gyp/node_modules/make-fetch-happen
!/node-gyp/node_modules/minipass-fetch
!/node-gyp/node_modules/nopt
!/node-gyp/node_modules/proc-log
!/node-gyp/node_modules/ssri
Expand Down Expand Up @@ -204,7 +205,6 @@
!/npm-registry-fetch
!/npm-registry-fetch/node_modules/
/npm-registry-fetch/node_modules/*
!/npm-registry-fetch/node_modules/minipass-fetch
!/npm-registry-fetch/node_modules/minizlib
!/npm-user-validate
!/p-map
Expand Down Expand Up @@ -273,6 +273,7 @@
!/tuf-js/node_modules/@npmcli/fs
!/tuf-js/node_modules/cacache
!/tuf-js/node_modules/make-fetch-happen
!/tuf-js/node_modules/minipass-fetch
!/tuf-js/node_modules/proc-log
!/tuf-js/node_modules/ssri
!/tuf-js/node_modules/unique-filename
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
{
"name": "minipass-fetch",
"version": "4.0.0",
"version": "3.0.5",
"description": "An implementation of window.fetch in Node.js using Minipass streams",
"license": "MIT",
"main": "lib/index.js",
"scripts": {
"test:tls-fixtures": "./test/fixtures/tls/setup.sh",
"test": "tap",
"snap": "tap",
"lint": "npm run eslint",
"lint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"",
"postlint": "template-oss-check",
"lintfix": "npm run eslint -- --fix",
"lintfix": "npm run lint -- --fix",
"posttest": "npm run lint",
"template-oss-apply": "template-oss-apply --force",
"eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""
"template-oss-apply": "template-oss-apply --force"
},
"tap": {
"coverage-map": "map.js",
Expand All @@ -24,8 +23,8 @@
]
},
"devDependencies": {
"@npmcli/eslint-config": "^5.0.0",
"@npmcli/template-oss": "4.23.3",
"@npmcli/eslint-config": "^4.0.0",
"@npmcli/template-oss": "4.22.0",
"@ungap/url-search-params": "^0.2.2",
"abort-controller": "^3.0.0",
"abortcontroller-polyfill": "~1.7.3",
Expand All @@ -39,7 +38,7 @@
"dependencies": {
"minipass": "^7.0.3",
"minipass-sized": "^1.0.3",
"minizlib": "^3.0.1"
"minizlib": "^2.1.2"
},
"optionalDependencies": {
"encoding": "^0.1.13"
Expand All @@ -59,12 +58,12 @@
"lib/"
],
"engines": {
"node": "^18.17.0 || >=20.5.0"
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
},
"author": "GitHub Inc.",
"templateOSS": {
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
"version": "4.23.3",
"version": "4.22.0",
"publish": "true"
}
}
19 changes: 10 additions & 9 deletions node_modules/minipass-fetch/package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
{
"name": "minipass-fetch",
"version": "3.0.5",
"version": "4.0.0",
"description": "An implementation of window.fetch in Node.js using Minipass streams",
"license": "MIT",
"main": "lib/index.js",
"scripts": {
"test:tls-fixtures": "./test/fixtures/tls/setup.sh",
"test": "tap",
"snap": "tap",
"lint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"",
"lint": "npm run eslint",
"postlint": "template-oss-check",
"lintfix": "npm run lint -- --fix",
"lintfix": "npm run eslint -- --fix",
"posttest": "npm run lint",
"template-oss-apply": "template-oss-apply --force"
"template-oss-apply": "template-oss-apply --force",
"eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""
},
"tap": {
"coverage-map": "map.js",
Expand All @@ -23,8 +24,8 @@
]
},
"devDependencies": {
"@npmcli/eslint-config": "^4.0.0",
"@npmcli/template-oss": "4.22.0",
"@npmcli/eslint-config": "^5.0.0",
"@npmcli/template-oss": "4.23.3",
"@ungap/url-search-params": "^0.2.2",
"abort-controller": "^3.0.0",
"abortcontroller-polyfill": "~1.7.3",
Expand All @@ -38,7 +39,7 @@
"dependencies": {
"minipass": "^7.0.3",
"minipass-sized": "^1.0.3",
"minizlib": "^2.1.2"
"minizlib": "^3.0.1"
},
"optionalDependencies": {
"encoding": "^0.1.13"
Expand All @@ -58,12 +59,12 @@
"lib/"
],
"engines": {
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
"node": "^18.17.0 || >=20.5.0"
},
"author": "GitHub Inc.",
"templateOSS": {
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
"version": "4.22.0",
"version": "4.23.3",
"publish": "true"
}
}
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
{
"name": "minipass-fetch",
"version": "4.0.0",
"version": "3.0.5",
"description": "An implementation of window.fetch in Node.js using Minipass streams",
"license": "MIT",
"main": "lib/index.js",
"scripts": {
"test:tls-fixtures": "./test/fixtures/tls/setup.sh",
"test": "tap",
"snap": "tap",
"lint": "npm run eslint",
"lint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"",
"postlint": "template-oss-check",
"lintfix": "npm run eslint -- --fix",
"lintfix": "npm run lint -- --fix",
"posttest": "npm run lint",
"template-oss-apply": "template-oss-apply --force",
"eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""
"template-oss-apply": "template-oss-apply --force"
},
"tap": {
"coverage-map": "map.js",
Expand All @@ -24,8 +23,8 @@
]
},
"devDependencies": {
"@npmcli/eslint-config": "^5.0.0",
"@npmcli/template-oss": "4.23.3",
"@npmcli/eslint-config": "^4.0.0",
"@npmcli/template-oss": "4.22.0",
"@ungap/url-search-params": "^0.2.2",
"abort-controller": "^3.0.0",
"abortcontroller-polyfill": "~1.7.3",
Expand All @@ -39,7 +38,7 @@
"dependencies": {
"minipass": "^7.0.3",
"minipass-sized": "^1.0.3",
"minizlib": "^3.0.1"
"minizlib": "^2.1.2"
},
"optionalDependencies": {
"encoding": "^0.1.13"
Expand All @@ -59,12 +58,12 @@
"lib/"
],
"engines": {
"node": "^18.17.0 || >=20.5.0"
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
},
"author": "GitHub Inc.",
"templateOSS": {
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
"version": "4.23.3",
"version": "4.22.0",
"publish": "true"
}
}
28 changes: 28 additions & 0 deletions node_modules/tuf-js/node_modules/minipass-fetch/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
The MIT License (MIT)

Copyright (c) Isaac Z. Schlueter and Contributors
Copyright (c) 2016 David Frank

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

---

Note: This is a derivative work based on "node-fetch" by David Frank,
modified and distributed under the terms of the MIT license above.
https://github.com/bitinn/node-fetch
17 changes: 17 additions & 0 deletions node_modules/tuf-js/node_modules/minipass-fetch/lib/abort-error.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
'use strict'
class AbortError extends Error {
constructor (message) {
super(message)
this.code = 'FETCH_ABORTED'
this.type = 'aborted'
Error.captureStackTrace(this, this.constructor)
}

get name () {
return 'AbortError'
}

// don't allow name to be overridden, but don't throw either
set name (s) {}
}
module.exports = AbortError
97 changes: 97 additions & 0 deletions node_modules/tuf-js/node_modules/minipass-fetch/lib/blob.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
'use strict'
const { Minipass } = require('minipass')
const TYPE = Symbol('type')
const BUFFER = Symbol('buffer')

class Blob {
constructor (blobParts, options) {
this[TYPE] = ''

const buffers = []
let size = 0

if (blobParts) {
const a = blobParts
const length = Number(a.length)
for (let i = 0; i < length; i++) {
const element = a[i]
const buffer = element instanceof Buffer ? element
: ArrayBuffer.isView(element)
? Buffer.from(element.buffer, element.byteOffset, element.byteLength)
: element instanceof ArrayBuffer ? Buffer.from(element)
: element instanceof Blob ? element[BUFFER]
: typeof element === 'string' ? Buffer.from(element)
: Buffer.from(String(element))
size += buffer.length
buffers.push(buffer)
}
}

this[BUFFER] = Buffer.concat(buffers, size)

const type = options && options.type !== undefined
&& String(options.type).toLowerCase()
if (type && !/[^\u0020-\u007E]/.test(type)) {
this[TYPE] = type
}
}

get size () {
return this[BUFFER].length
}

get type () {
return this[TYPE]
}

text () {
return Promise.resolve(this[BUFFER].toString())
}

arrayBuffer () {
const buf = this[BUFFER]
const off = buf.byteOffset
const len = buf.byteLength
const ab = buf.buffer.slice(off, off + len)
return Promise.resolve(ab)
}

stream () {
return new Minipass().end(this[BUFFER])
}

slice (start, end, type) {
const size = this.size
const relativeStart = start === undefined ? 0
: start < 0 ? Math.max(size + start, 0)
: Math.min(start, size)
const relativeEnd = end === undefined ? size
: end < 0 ? Math.max(size + end, 0)
: Math.min(end, size)
const span = Math.max(relativeEnd - relativeStart, 0)

const buffer = this[BUFFER]
const slicedBuffer = buffer.slice(
relativeStart,
relativeStart + span
)
const blob = new Blob([], { type })
blob[BUFFER] = slicedBuffer
return blob
}

get [Symbol.toStringTag] () {
return 'Blob'
}

static get BUFFER () {
return BUFFER
}
}

Object.defineProperties(Blob.prototype, {
size: { enumerable: true },
type: { enumerable: true },
})

module.exports = Blob
Loading

0 comments on commit 20dd44f

Please sign in to comment.