From 6acbb23380fd309bb2cbaa89298b4b93fb971213 Mon Sep 17 00:00:00 2001 From: npm CLI robot Date: Fri, 19 May 2023 06:45:02 -0700 Subject: [PATCH] deps: upgrade npm to 9.6.7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/48062 Reviewed-By: Luke Karrys Reviewed-By: Michaël Zasso Reviewed-By: Marco Ippolito Reviewed-By: Jiawen Geng Reviewed-By: Luigi Pinca --- deps/npm/docs/content/commands/npm-ls.md | 2 +- deps/npm/docs/content/commands/npm.md | 2 +- .../content/configuring-npm/package-json.md | 2 +- deps/npm/docs/content/using-npm/config.md | 22 +- deps/npm/docs/output/commands/npm-ls.html | 2 +- deps/npm/docs/output/commands/npm.html | 2 +- .../output/configuring-npm/package-json.html | 2 +- deps/npm/docs/output/using-npm/config.html | 22 +- deps/npm/lib/commands/cache.js | 3 +- deps/npm/lib/utils/config/definitions.js | 3 + deps/npm/lib/utils/exit-handler.js | 4 +- deps/npm/man/man1/npm-ls.1 | 2 +- deps/npm/man/man1/npm.1 | 2 +- deps/npm/man/man5/npm-json.5 | 2 +- deps/npm/man/man5/package-json.5 | 2 +- deps/npm/man/man7/config.7 | 22 +- .../node_modules/@npmcli/config/lib/index.js | 25 +- .../node_modules/@npmcli/config/package.json | 2 +- .../@npmcli/package-json/lib/index.js | 157 ++++++++-- .../@npmcli/package-json/lib/normalize.js | 284 ++++++++++++++++++ .../@npmcli/package-json/package.json | 14 +- .../@npmcli/run-script/lib/run-script-pkg.js | 4 + .../@npmcli/run-script/lib/signal-manager.js | 14 +- .../@npmcli/run-script/package.json | 6 +- .../node_modules/cacache/lib/content/write.js | 32 +- deps/npm/node_modules/cacache/package.json | 6 +- .../node_modules/glob/dist/cjs/package.json | 4 +- .../glob/dist/cjs/src/glob.d.ts.map | 2 +- .../node_modules/glob/dist/cjs/src/glob.js | 7 +- .../glob/dist/cjs/src/glob.js.map | 2 +- .../node_modules/glob/dist/mjs/glob.d.ts.map | 2 +- deps/npm/node_modules/glob/dist/mjs/glob.js | 7 +- .../node_modules/glob/dist/mjs/glob.js.map | 2 +- .../node_modules/glob/dist/mjs/package.json | 2 +- deps/npm/node_modules/glob/package.json | 4 +- .../node_modules/libnpmpublish/lib/publish.js | 53 +++- .../node_modules/libnpmpublish/package.json | 2 +- .../path-scurry/dist/cjs/index.js | 49 ++- .../path-scurry/dist/mjs/index.js | 49 ++- .../npm/node_modules/path-scurry/package.json | 8 +- .../postcss-selector-parser/API.md | 7 +- .../postcss-selector-parser/dist/parser.js | 4 + .../postcss-selector-parser/package.json | 2 +- .../lib/internal/streams/add-abort-signal.js | 30 +- .../lib/internal/streams/compose.js | 143 ++++++--- .../lib/internal/streams/destroy.js | 19 +- .../lib/internal/streams/duplexify.js | 2 - .../lib/internal/streams/end-of-stream.js | 81 ++++- .../lib/internal/streams/operators.js | 25 +- .../lib/internal/streams/pipeline.js | 113 ++++++- .../lib/internal/streams/utils.js | 30 +- .../lib/internal/validators.js | 119 +++++++- .../readable-stream/lib/ours/primordials.js | 1 + .../readable-stream/lib/stream/promises.js | 11 +- .../node_modules/readable-stream/package.json | 2 +- .../npm/node_modules/semver/classes/semver.js | 2 +- deps/npm/node_modules/semver/package.json | 6 +- .../signal-exit/dist/cjs/index.js | 1 - .../signal-exit/dist/mjs/index.js | 1 - .../npm/node_modules/signal-exit/package.json | 2 +- deps/npm/node_modules/sigstore/README.md | 78 ++--- .../node_modules/sigstore/dist/ca/index.d.ts | 5 +- .../node_modules/sigstore/dist/ca/index.js | 19 +- .../sigstore/dist/ca/verify/chain.d.ts | 2 +- .../sigstore/dist/ca/verify/chain.js | 11 +- .../sigstore/dist/ca/verify/index.js | 5 +- .../node_modules/sigstore/dist/config.d.ts | 24 +- deps/npm/node_modules/sigstore/dist/config.js | 19 +- .../npm/node_modules/sigstore/dist/error.d.ts | 2 +- .../sigstore/dist/external/fulcio.d.ts | 13 +- .../sigstore/dist/external/fulcio.js | 4 +- .../sigstore/dist/external/index.d.ts | 1 + .../sigstore/dist/external/index.js | 4 +- .../sigstore/dist/external/rekor.d.ts | 5 +- .../sigstore/dist/external/rekor.js | 4 +- .../sigstore/dist/external/tsa.d.ts | 18 ++ .../sigstore/dist/external/tsa.js | 47 +++ deps/npm/node_modules/sigstore/dist/sign.d.ts | 17 +- deps/npm/node_modules/sigstore/dist/sign.js | 53 +++- .../sigstore/dist/sigstore-utils.js | 7 +- .../node_modules/sigstore/dist/sigstore.d.ts | 3 + .../node_modules/sigstore/dist/sigstore.js | 19 +- .../sigstore/dist/tlog/index.d.ts | 16 +- .../node_modules/sigstore/dist/tlog/index.js | 13 +- .../node_modules/sigstore/dist/tsa/index.d.ts | 13 + .../node_modules/sigstore/dist/tsa/index.js | 47 +++ .../node_modules/sigstore/dist/tuf/index.d.ts | 13 +- .../node_modules/sigstore/dist/tuf/index.js | 49 ++- .../node_modules/sigstore/dist/tuf/target.js | 2 +- .../sigstore/dist/types/fetch.d.ts | 6 + .../node_modules/sigstore/dist/types/fetch.js | 2 + .../sigstore/dist/types/sigstore/index.d.ts | 20 +- .../sigstore/dist/types/sigstore/index.js | 48 ++- deps/npm/node_modules/sigstore/dist/verify.js | 4 +- .../sigstore/dist/x509/verify.d.ts | 2 +- .../node_modules/sigstore/dist/x509/verify.js | 36 ++- deps/npm/node_modules/sigstore/package.json | 44 +-- .../store/public-good-instance-root.json | 157 +--------- deps/npm/node_modules/tuf-js/dist/fetcher.js | 3 + deps/npm/node_modules/tuf-js/dist/updater.js | 8 + deps/npm/node_modules/tuf-js/package.json | 10 +- deps/npm/package.json | 16 +- .../tap-snapshots/test/lib/docs.js.test.cjs | 22 +- 103 files changed, 1702 insertions(+), 623 deletions(-) create mode 100644 deps/npm/node_modules/@npmcli/package-json/lib/normalize.js create mode 100644 deps/npm/node_modules/sigstore/dist/external/tsa.d.ts create mode 100644 deps/npm/node_modules/sigstore/dist/external/tsa.js create mode 100644 deps/npm/node_modules/sigstore/dist/tsa/index.d.ts create mode 100644 deps/npm/node_modules/sigstore/dist/tsa/index.js create mode 100644 deps/npm/node_modules/sigstore/dist/types/fetch.d.ts create mode 100644 deps/npm/node_modules/sigstore/dist/types/fetch.js diff --git a/deps/npm/docs/content/commands/npm-ls.md b/deps/npm/docs/content/commands/npm-ls.md index b712738b3dd294..1ba7a4b73d5000 100644 --- a/deps/npm/docs/content/commands/npm-ls.md +++ b/deps/npm/docs/content/commands/npm-ls.md @@ -27,7 +27,7 @@ packages will *also* show the paths to the specified packages. For example, running `npm ls promzard` in npm's source tree will show: ```bash -npm@9.6.6 /path/to/npm +npm@9.6.7 /path/to/npm └─┬ init-package-json@0.0.4 └── promzard@0.1.5 ``` diff --git a/deps/npm/docs/content/commands/npm.md b/deps/npm/docs/content/commands/npm.md index 91356999e3a8d7..347e7d40993c88 100644 --- a/deps/npm/docs/content/commands/npm.md +++ b/deps/npm/docs/content/commands/npm.md @@ -14,7 +14,7 @@ Note: This command is unaware of workspaces. ### Version -9.6.6 +9.6.7 ### Description diff --git a/deps/npm/docs/content/configuring-npm/package-json.md b/deps/npm/docs/content/configuring-npm/package-json.md index ac5a5740ed3bfd..ff06a872d38c5d 100644 --- a/deps/npm/docs/content/configuring-npm/package-json.md +++ b/deps/npm/docs/content/configuring-npm/package-json.md @@ -323,7 +323,7 @@ This should be a module relative to the root of your package folder. For most modules, it makes the most sense to have a main script and often not much else. -If `main` is not set it defaults to `index.js` in the package's root folder. +If `main` is not set, it defaults to `index.js` in the package's root folder. ### browser diff --git a/deps/npm/docs/content/using-npm/config.md b/deps/npm/docs/content/using-npm/config.md index ae46b1eb438e2f..51983cbbe16718 100644 --- a/deps/npm/docs/content/using-npm/config.md +++ b/deps/npm/docs/content/using-npm/config.md @@ -289,16 +289,6 @@ npm exec --package yo --package generator-node --call "yo node" ``` -#### `ci-name` - -* Default: The name of the current CI system, or `null` when not on a known CI - platform. -* Type: null or String - -The name of a continuous integration system. If not set explicitly, npm will -detect the current CI environment using the -[`ci-info`](http://npm.im/ci-info) module. - #### `cidr` * Default: null @@ -1514,6 +1504,18 @@ It is _not_ the path to a certificate file, though you can set a registry-scoped "certfile" path like "//other-registry.tld/:certfile=/path/to/cert.pem". +#### `ci-name` + +* Default: The name of the current CI system, or `null` when not on a known CI + platform. +* Type: null or String +* DEPRECATED: This config is deprecated and will not be changeable in future + version of npm. + +The name of a continuous integration system. If not set explicitly, npm will +detect the current CI environment using the +[`ci-info`](http://npm.im/ci-info) module. + #### `dev` * Default: false diff --git a/deps/npm/docs/output/commands/npm-ls.html b/deps/npm/docs/output/commands/npm-ls.html index 5fa3e0c1cc9430..4aeaf0cb69c526 100644 --- a/deps/npm/docs/output/commands/npm-ls.html +++ b/deps/npm/docs/output/commands/npm-ls.html @@ -160,7 +160,7 @@

Description

the results to only the paths to the packages named. Note that nested packages will also show the paths to the specified packages. For example, running npm ls promzard in npm's source tree will show:

-
npm@9.6.6 /path/to/npm
+
npm@9.6.7 /path/to/npm
 └─┬ init-package-json@0.0.4
   └── promzard@0.1.5
 
diff --git a/deps/npm/docs/output/commands/npm.html b/deps/npm/docs/output/commands/npm.html index 18c1361e596677..0cfc2ef24f9661 100644 --- a/deps/npm/docs/output/commands/npm.html +++ b/deps/npm/docs/output/commands/npm.html @@ -150,7 +150,7 @@

Table of contents

Note: This command is unaware of workspaces.

Version

-

9.6.6

+

9.6.7

Description

npm is the package manager for the Node JavaScript platform. It puts modules in place so that node can find them, and manages dependency diff --git a/deps/npm/docs/output/configuring-npm/package-json.html b/deps/npm/docs/output/configuring-npm/package-json.html index 22255659969e8f..2e1bd00abda30d 100644 --- a/deps/npm/docs/output/configuring-npm/package-json.html +++ b/deps/npm/docs/output/configuring-npm/package-json.html @@ -391,7 +391,7 @@

main

This should be a module relative to the root of your package folder.

For most modules, it makes the most sense to have a main script and often not much else.

-

If main is not set it defaults to index.js in the package's root folder.

+

If main is not set, it defaults to index.js in the package's root folder.

browser

If your module is meant to be used client-side the browser field should be used instead of the main field. This is helpful to hint users that it might diff --git a/deps/npm/docs/output/using-npm/config.html b/deps/npm/docs/output/using-npm/config.html index 5d62af0a4c8384..ba718decd27ed1 100644 --- a/deps/npm/docs/output/using-npm/config.html +++ b/deps/npm/docs/output/using-npm/config.html @@ -142,7 +142,7 @@

config

Table of contents

-
+

Description

@@ -378,15 +378,6 @@

call

custom command to be run along with the installed packages.

npm exec --package yo --package generator-node --call "yo node"
 
-

ci-name

-
    -
  • Default: The name of the current CI system, or null when not on a known CI -platform.
  • -
  • Type: null or String
  • -
-

The name of a continuous integration system. If not set explicitly, npm will -detect the current CI environment using the -ci-info module.

cidr

  • Default: null
  • @@ -1413,6 +1404,17 @@

    cert

    It is not the path to a certificate file, though you can set a registry-scoped "certfile" path like "//other-registry.tld/:certfile=/path/to/cert.pem".

    +

    ci-name

    +
      +
    • Default: The name of the current CI system, or null when not on a known CI +platform.
    • +
    • Type: null or String
    • +
    • DEPRECATED: This config is deprecated and will not be changeable in future +version of npm.
    • +
    +

    The name of a continuous integration system. If not set explicitly, npm will +detect the current CI environment using the +ci-info module.

    dev

    • Default: false
    • diff --git a/deps/npm/lib/commands/cache.js b/deps/npm/lib/commands/cache.js index 9965f7085d9ad6..66b432dfc13a66 100644 --- a/deps/npm/lib/commands/cache.js +++ b/deps/npm/lib/commands/cache.js @@ -76,7 +76,7 @@ class Cache extends BaseCommand { async completion (opts) { const argv = opts.conf.argv.remain if (argv.length === 2) { - return ['add', 'clean', 'verify', 'ls', 'delete'] + return ['add', 'clean', 'verify', 'ls'] } // TODO - eventually... @@ -85,7 +85,6 @@ class Cache extends BaseCommand { case 'clean': case 'add': case 'ls': - case 'delete': return [] } } diff --git a/deps/npm/lib/utils/config/definitions.js b/deps/npm/lib/utils/config/definitions.js index 373989dbea0d5f..78c341eabeffa7 100644 --- a/deps/npm/lib/utils/config/definitions.js +++ b/deps/npm/lib/utils/config/definitions.js @@ -439,6 +439,9 @@ define('ci-name', { platform. `, type: [null, String], + deprecated: ` + This config is deprecated and will not be changeable in future version of npm. + `, description: ` The name of a continuous integration system. If not set explicitly, npm will detect the current CI environment using the diff --git a/deps/npm/lib/utils/exit-handler.js b/deps/npm/lib/utils/exit-handler.js index b5d6cd030fb5c3..25cecd170a584c 100644 --- a/deps/npm/lib/utils/exit-handler.js +++ b/deps/npm/lib/utils/exit-handler.js @@ -131,8 +131,8 @@ const exitHandler = err => { log.level = level } - let exitCode - let noLogMessage + let exitCode = process.exitCode || 0 + let noLogMessage = exitCode !== 0 let jsonError if (err) { diff --git a/deps/npm/man/man1/npm-ls.1 b/deps/npm/man/man1/npm-ls.1 index 07e8c22eeb5e4b..fe605158b7aaa9 100644 --- a/deps/npm/man/man1/npm-ls.1 +++ b/deps/npm/man/man1/npm-ls.1 @@ -20,7 +20,7 @@ Positional arguments are \fBname@version-range\fR identifiers, which will limit .P .RS 2 .nf -npm@9.6.6 /path/to/npm +npm@9.6.7 /path/to/npm └─┬ init-package-json@0.0.4 └── promzard@0.1.5 .fi diff --git a/deps/npm/man/man1/npm.1 b/deps/npm/man/man1/npm.1 index 9dcf8d2caa05ad..1fcb52d7b3952b 100644 --- a/deps/npm/man/man1/npm.1 +++ b/deps/npm/man/man1/npm.1 @@ -12,7 +12,7 @@ npm Note: This command is unaware of workspaces. .SS "Version" .P -9.6.6 +9.6.7 .SS "Description" .P npm is the package manager for the Node JavaScript platform. It puts modules in place so that node can find them, and manages dependency conflicts intelligently. diff --git a/deps/npm/man/man5/npm-json.5 b/deps/npm/man/man5/npm-json.5 index 290a10e369c57c..c646afa88dfedc 100644 --- a/deps/npm/man/man5/npm-json.5 +++ b/deps/npm/man/man5/npm-json.5 @@ -303,7 +303,7 @@ This should be a module relative to the root of your package folder. .P For most modules, it makes the most sense to have a main script and often not much else. .P -If \fBmain\fR is not set it defaults to \fBindex.js\fR in the package's root folder. +If \fBmain\fR is not set, it defaults to \fBindex.js\fR in the package's root folder. .SS "browser" .P If your module is meant to be used client-side the browser field should be used instead of the main field. This is helpful to hint users that it might rely on primitives that aren't available in Node.js modules. (e.g. \fBwindow\fR) diff --git a/deps/npm/man/man5/package-json.5 b/deps/npm/man/man5/package-json.5 index 290a10e369c57c..c646afa88dfedc 100644 --- a/deps/npm/man/man5/package-json.5 +++ b/deps/npm/man/man5/package-json.5 @@ -303,7 +303,7 @@ This should be a module relative to the root of your package folder. .P For most modules, it makes the most sense to have a main script and often not much else. .P -If \fBmain\fR is not set it defaults to \fBindex.js\fR in the package's root folder. +If \fBmain\fR is not set, it defaults to \fBindex.js\fR in the package's root folder. .SS "browser" .P If your module is meant to be used client-side the browser field should be used instead of the main field. This is helpful to hint users that it might rely on primitives that aren't available in Node.js modules. (e.g. \fBwindow\fR) diff --git a/deps/npm/man/man7/config.7 b/deps/npm/man/man7/config.7 index 471e2d9a9a82c9..e20d300946a863 100644 --- a/deps/npm/man/man7/config.7 +++ b/deps/npm/man/man7/config.7 @@ -320,16 +320,6 @@ Optional companion option for \fBnpm exec\fR, \fBnpx\fR that allows for specifyi npm exec --package yo --package generator-node --call "yo node" .fi .RE -.SS "\fBci-name\fR" -.RS 0 -.IP \(bu 4 -Default: The name of the current CI system, or \fBnull\fR when not on a known CI platform. -.IP \(bu 4 -Type: null or String -.RE 0 - -.P -The name of a continuous integration system. If not set explicitly, npm will detect the current CI environment using the \fB\fBci-info\fR\fR \fI\(lahttp://npm.im/ci-info\(ra\fR module. .SS "\fBcidr\fR" .RS 0 .IP \(bu 4 @@ -1757,6 +1747,18 @@ cert="-----BEGIN CERTIFICATE-----\[rs]nXXXX\[rs]nXXXX\[rs]n-----END CERTIFICATE- .RE .P It is \fInot\fR the path to a certificate file, though you can set a registry-scoped "certfile" path like "//other-registry.tld/:certfile=/path/to/cert.pem". +.SS "\fBci-name\fR" +.RS 0 +.IP \(bu 4 +Default: The name of the current CI system, or \fBnull\fR when not on a known CI platform. +.IP \(bu 4 +Type: null or String +.IP \(bu 4 +DEPRECATED: This config is deprecated and will not be changeable in future version of npm. +.RE 0 + +.P +The name of a continuous integration system. If not set explicitly, npm will detect the current CI environment using the \fB\fBci-info\fR\fR \fI\(lahttp://npm.im/ci-info\(ra\fR module. .SS "\fBdev\fR" .RS 0 .IP \(bu 4 diff --git a/deps/npm/node_modules/@npmcli/config/lib/index.js b/deps/npm/node_modules/@npmcli/config/lib/index.js index 9bba1d6977ae39..b7b848dea151c8 100644 --- a/deps/npm/node_modules/@npmcli/config/lib/index.js +++ b/deps/npm/node_modules/@npmcli/config/lib/index.js @@ -524,21 +524,28 @@ class Config { } const typeDesc = typeDescription(type) - const oneOrMore = typeDesc.indexOf(Array) !== -1 const mustBe = typeDesc .filter(m => m !== undefined && m !== Array) - const oneOf = mustBe.length === 1 && oneOrMore ? ' one or more' - : mustBe.length > 1 && oneOrMore ? ' one or more of:' - : mustBe.length > 1 ? ' one of:' - : '' - const msg = 'Must be' + oneOf + const msg = 'Must be' + this.#getOneOfKeywords(mustBe, typeDesc) const desc = mustBe.length === 1 ? mustBe[0] - : mustBe.filter(m => m !== Array) - .map(n => typeof n === 'string' ? n : JSON.stringify(n)) - .join(', ') + : [...new Set(mustBe.map(n => typeof n === 'string' ? n : JSON.stringify(n)))].join(', ') log.warn('invalid config', msg, desc) } + #getOneOfKeywords (mustBe, typeDesc) { + let keyword + if (mustBe.length === 1 && typeDesc.includes(Array)) { + keyword = ' one or more' + } else if (mustBe.length > 1 && typeDesc.includes(Array)) { + keyword = ' one or more of:' + } else if (mustBe.length > 1) { + keyword = ' one of:' + } else { + keyword = '' + } + return keyword + } + #loadObject (obj, where, source, er = null) { // obj is the raw data read from the file const conf = this.data.get(where) diff --git a/deps/npm/node_modules/@npmcli/config/package.json b/deps/npm/node_modules/@npmcli/config/package.json index f34d20f1e4dd83..e68d5166901451 100644 --- a/deps/npm/node_modules/@npmcli/config/package.json +++ b/deps/npm/node_modules/@npmcli/config/package.json @@ -1,6 +1,6 @@ { "name": "@npmcli/config", - "version": "6.1.6", + "version": "6.1.7", "files": [ "bin/", "lib/" diff --git a/deps/npm/node_modules/@npmcli/package-json/lib/index.js b/deps/npm/node_modules/@npmcli/package-json/lib/index.js index e98308f3d3b843..34e415b45d49fe 100644 --- a/deps/npm/node_modules/@npmcli/package-json/lib/index.js +++ b/deps/npm/node_modules/@npmcli/package-json/lib/index.js @@ -1,18 +1,12 @@ -const fs = require('fs') -const promisify = require('util').promisify -const readFile = promisify(fs.readFile) -const writeFile = promisify(fs.writeFile) +const { readFile, writeFile } = require('fs/promises') const { resolve } = require('path') const updateDeps = require('./update-dependencies.js') const updateScripts = require('./update-scripts.js') const updateWorkspaces = require('./update-workspaces.js') +const normalize = require('./normalize.js') const parseJSON = require('json-parse-even-better-errors') -const _filename = Symbol('filename') -const _manifest = Symbol('manifest') -const _readFileContent = Symbol('readFileContent') - // a list of handy specialized helper functions that take // care of special cases that are handled by the npm cli const knownSteps = new Set([ @@ -29,42 +23,111 @@ const knownKeys = new Set([ ]) class PackageJson { + static normalizeSteps = Object.freeze([ + '_id', + '_attributes', + 'bundledDependencies', + 'bundleDependencies', + 'optionalDedupe', + 'scripts', + 'funding', + 'bin', + ]) + + static prepareSteps = Object.freeze([ + '_attributes', + 'bundledDependencies', + 'bundleDependencies', + 'gypfile', + 'serverjs', + 'scriptpath', + 'authors', + 'readme', + 'mans', + 'binDir', + 'gitHead', + 'fillTypes', + 'normalizeData', + 'binRefs', + ]) + + // default behavior, just loads and parses static async load (path) { return await new PackageJson(path).load() } + // read-package-json compatible behavior + static async prepare (path, opts) { + return await new PackageJson(path).prepare(opts) + } + + // read-package-json-fast compatible behavior + static async normalize (path, opts) { + return await new PackageJson(path).normalize(opts) + } + + #filename + #path + #manifest = {} + #readFileContent = '' + #fromIndex = false + constructor (path) { - this[_filename] = resolve(path, 'package.json') - this[_manifest] = {} - this[_readFileContent] = '' + this.#path = path + this.#filename = resolve(path, 'package.json') } - async load () { + async load (parseIndex) { + let parseErr try { - this[_readFileContent] = - await readFile(this[_filename], 'utf8') + this.#readFileContent = + await readFile(this.#filename, 'utf8') } catch (err) { - throw new Error('package.json not found') + err.message = `Could not read package.json: ${err}` + if (!parseIndex) { + throw err + } + parseErr = err + } + + if (parseErr) { + const indexFile = resolve(this.#path, 'index.js') + let indexFileContent + try { + indexFileContent = await readFile(indexFile, 'utf8') + } catch (err) { + throw parseErr + } + try { + this.#manifest = fromComment(indexFileContent) + } catch (err) { + throw parseErr + } + this.#fromIndex = true + return this } try { - this[_manifest] = - parseJSON(this[_readFileContent]) + this.#manifest = parseJSON(this.#readFileContent) } catch (err) { - throw new Error(`Invalid package.json: ${err}`) + err.message = `Invalid package.json: ${err}` + throw err } - return this } get content () { - return this[_manifest] + return this.#manifest + } + + get path () { + return this.#path } update (content) { // validates both current manifest and content param const invalidContent = - typeof this[_manifest] !== 'object' + typeof this.#manifest !== 'object' || typeof content !== 'object' if (invalidContent) { throw Object.assign( @@ -74,13 +137,13 @@ class PackageJson { } for (const step of knownSteps) { - this[_manifest] = step({ content, originalContent: this[_manifest] }) + this.#manifest = step({ content, originalContent: this.#manifest }) } // unknown properties will just be overwitten for (const [key, value] of Object.entries(content)) { if (!knownKeys.has(key)) { - this[_manifest][key] = value + this.#manifest[key] = value } } @@ -88,22 +151,62 @@ class PackageJson { } async save () { + if (this.#fromIndex) { + throw new Error('No package.json to save to') + } const { [Symbol.for('indent')]: indent, [Symbol.for('newline')]: newline, - } = this[_manifest] + } = this.#manifest const format = indent === undefined ? ' ' : indent const eol = newline === undefined ? '\n' : newline const fileContent = `${ - JSON.stringify(this[_manifest], null, format) + JSON.stringify(this.#manifest, null, format) }\n` .replace(/\n/g, eol) - if (fileContent.trim() !== this[_readFileContent].trim()) { - return await writeFile(this[_filename], fileContent) + if (fileContent.trim() !== this.#readFileContent.trim()) { + return await writeFile(this.#filename, fileContent) } } + + async normalize (opts = {}) { + if (!opts.steps) { + opts.steps = this.constructor.normalizeSteps + } + await this.load() + await normalize(this, opts) + return this + } + + async prepare (opts = {}) { + if (!opts.steps) { + opts.steps = this.constructor.prepareSteps + } + await this.load(true) + await normalize(this, opts) + return this + } +} + +// /**package { "name": "foo", "version": "1.2.3", ... } **/ +function fromComment (data) { + data = data.split(/^\/\*\*package(?:\s|$)/m) + + if (data.length < 2) { + throw new Error('File has no package in comments') + } + data = data[1] + data = data.split(/\*\*\/$/m) + + if (data.length < 2) { + throw new Error('File has no package in comments') + } + data = data[0] + data = data.replace(/^\s*\*/mg, '') + + return parseJSON(data) } module.exports = PackageJson diff --git a/deps/npm/node_modules/@npmcli/package-json/lib/normalize.js b/deps/npm/node_modules/@npmcli/package-json/lib/normalize.js new file mode 100644 index 00000000000000..bc101cd4fde1b0 --- /dev/null +++ b/deps/npm/node_modules/@npmcli/package-json/lib/normalize.js @@ -0,0 +1,284 @@ +const fs = require('fs/promises') +const { glob } = require('glob') +const normalizePackageBin = require('npm-normalize-package-bin') +const normalizePackageData = require('normalize-package-data') +const path = require('path') + +const normalize = async (pkg, { strict, steps }) => { + const data = pkg.content + const scripts = data.scripts || {} + + // remove attributes that start with "_" + if (steps.includes('_attributes')) { + for (const key in data) { + if (key.startsWith('_')) { + delete pkg.content[key] + } + } + } + + // build the "_id" attribute + if (steps.includes('_id')) { + if (data.name && data.version) { + data._id = `${data.name}@${data.version}` + } + } + + // fix bundledDependencies typo + if (steps.includes('bundledDependencies')) { + if (data.bundleDependencies === undefined && data.bundledDependencies !== undefined) { + data.bundleDependencies = data.bundledDependencies + } + delete data.bundledDependencies + } + // expand "bundleDependencies: true or translate from object" + if (steps.includes('bundleDependencies')) { + const bd = data.bundleDependencies + if (bd === true) { + data.bundleDependencies = Object.keys(data.dependencies || {}) + } else if (bd && typeof bd === 'object') { + if (!Array.isArray(bd)) { + data.bundleDependencies = Object.keys(bd) + } + } else { + delete data.bundleDependencies + } + } + + // it was once common practice to list deps both in optionalDependencies and + // in dependencies, to support npm versions that did not know about + // optionalDependencies. This is no longer a relevant need, so duplicating + // the deps in two places is unnecessary and excessive. + if (steps.includes('optionalDedupe')) { + if (data.dependencies && + data.optionalDependencies && typeof data.optionalDependencies === 'object') { + for (const name in data.optionalDependencies) { + delete data.dependencies[name] + } + if (!Object.keys(data.dependencies).length) { + delete data.dependencies + } + } + } + + // add "install" attribute if any "*.gyp" files exist + if (steps.includes('gypfile')) { + if (!scripts.install && !scripts.preinstall && data.gypfile !== false) { + const files = await glob('*.gyp', { cwd: pkg.path }) + if (files.length) { + scripts.install = 'node-gyp rebuild' + data.scripts = scripts + data.gypfile = true + } + } + } + + // add "start" attribute if "server.js" exists + if (steps.includes('serverjs') && !scripts.start) { + try { + await fs.access(path.join(pkg.path, 'server.js')) + scripts.start = 'node server.js' + data.scripts = scripts + } catch { + // do nothing + } + } + + // strip "node_modules/.bin" from scripts entries + if (steps.includes('scripts') || steps.includes('scriptpath')) { + const spre = /^(\.[/\\])?node_modules[/\\].bin[\\/]/ + if (typeof data.scripts === 'object') { + for (const name in data.scripts) { + if (typeof data.scripts[name] !== 'string') { + delete data.scripts[name] + } else if (steps.includes('scriptpath')) { + data.scripts[name] = data.scripts[name].replace(spre, '') + } + } + } else { + delete data.scripts + } + } + + if (steps.includes('funding')) { + if (data.funding && typeof data.funding === 'string') { + data.funding = { url: data.funding } + } + } + + // populate "authors" attribute + if (steps.includes('authors') && !data.contributors) { + try { + const authorData = await fs.readFile(path.join(pkg.path, 'AUTHORS'), 'utf8') + const authors = authorData.split(/\r?\n/g) + .map(line => line.replace(/^\s*#.*$/, '').trim()) + .filter(line => line) + data.contributors = authors + } catch { + // do nothing + } + } + + // populate "readme" attribute + if (steps.includes('readme') && !data.readme) { + const mdre = /\.m?a?r?k?d?o?w?n?$/i + const files = await glob('{README,README.*}', { cwd: pkg.path, nocase: true, mark: true }) + let readmeFile + for (const file of files) { + // don't accept directories. + if (!file.endsWith(path.sep)) { + if (file.match(mdre)) { + readmeFile = file + break + } + if (file.endsWith('README')) { + readmeFile = file + } + } + } + if (readmeFile) { + const readmeData = await fs.readFile(path.join(pkg.path, readmeFile), 'utf8') + data.readme = readmeData + data.readmeFilename = readmeFile + } + } + + // expand directories.man + if (steps.includes('mans') && !data.man && data.directories?.man) { + const manDir = data.directories.man + const cwd = path.resolve(pkg.path, manDir) + const files = await glob('**/*.[0-9]', { cwd }) + data.man = files.map(man => + path.relative(pkg.path, path.join(cwd, man)).split(path.sep).join('/') + ) + } + + if (steps.includes('bin') || steps.includes('binDir') || steps.includes('binRefs')) { + normalizePackageBin(data) + } + + // expand "directories.bin" + if (steps.includes('binDir') && data.directories?.bin) { + const binsDir = path.resolve(pkg.path, path.join('.', path.join('/', data.directories.bin))) + const bins = await glob('**', { cwd: binsDir }) + data.bin = bins.reduce((acc, binFile) => { + if (binFile && !binFile.startsWith('.')) { + const binName = path.basename(binFile) + acc[binName] = path.join(data.directories.bin, binFile) + } + return acc + }, {}) + // *sigh* + normalizePackageBin(data) + } + + // populate "gitHead" attribute + if (steps.includes('gitHead') && !data.gitHead) { + let head + try { + head = await fs.readFile(path.resolve(pkg.path, '.git/HEAD'), 'utf8') + } catch (err) { + // do nothing + } + let headData + if (head) { + if (head.startsWith('ref: ')) { + const headRef = head.replace(/^ref: /, '').trim() + const headFile = path.resolve(pkg.path, '.git', headRef) + try { + headData = await fs.readFile(headFile, 'utf8') + headData = headData.replace(/^ref: /, '').trim() + } catch (err) { + // do nothing + } + if (!headData) { + const packFile = path.resolve(pkg.path, '.git/packed-refs') + try { + let refs = await fs.readFile(packFile, 'utf8') + if (refs) { + refs = refs.split('\n') + for (let i = 0; i < refs.length; i++) { + const match = refs[i].match(/^([0-9a-f]{40}) (.+)$/) + if (match && match[2].trim() === headRef) { + headData = match[1] + break + } + } + } + } catch { + // do nothing + } + } + } else { + headData = head.trim() + } + } + if (headData) { + data.gitHead = headData + } + } + + // populate "types" attribute + if (steps.includes('fillTypes')) { + const index = data.main || 'index.js' + + if (typeof index !== 'string') { + throw new TypeError('The "main" attribute must be of type string.') + } + + // TODO exports is much more complicated than this in verbose format + // We need to support for instance + + // "exports": { + // ".": [ + // { + // "default": "./lib/npm.js" + // }, + // "./lib/npm.js" + // ], + // "./package.json": "./package.json" + // }, + // as well as conditional exports + + // if (data.exports && typeof data.exports === 'string') { + // index = data.exports + // } + + // if (data.exports && data.exports['.']) { + // index = data.exports['.'] + // if (typeof index !== 'string') { + // } + // } + const extless = path.join(path.dirname(index), path.basename(index, path.extname(index))) + const dts = `./${extless}.d.ts` + const hasDTSFields = 'types' in data || 'typings' in data + if (!hasDTSFields) { + try { + await fs.access(path.join(pkg.path, dts)) + data.types = dts.split(path.sep).join('/') + } catch { + // do nothing + } + } + } + + // "normalizeData" from read-package-json + if (steps.includes('normalizeData')) { + normalizePackageData(data, strict) + } + + // Warn if the bin references don't point to anything. This might be better + // in normalize-package-data if it had access to the file path. + if (steps.includes('binRefs') && data.bin instanceof Object) { + for (const key in data.bin) { + const binPath = path.resolve(pkg.path, data.bin[key]) + try { + await fs.access(binPath) + } catch { + delete data.bin[key] + } + } + } +} + +module.exports = normalize diff --git a/deps/npm/node_modules/@npmcli/package-json/package.json b/deps/npm/node_modules/@npmcli/package-json/package.json index faae7891a1e728..61607c5bb6ae70 100644 --- a/deps/npm/node_modules/@npmcli/package-json/package.json +++ b/deps/npm/node_modules/@npmcli/package-json/package.json @@ -1,6 +1,6 @@ { "name": "@npmcli/package-json", - "version": "3.0.0", + "version": "3.1.0", "description": "Programmatic API to update package.json", "main": "lib/index.js", "files": [ @@ -24,12 +24,15 @@ "author": "GitHub Inc.", "license": "ISC", "devDependencies": { - "@npmcli/eslint-config": "^3.0.1", - "@npmcli/template-oss": "4.5.1", + "@npmcli/eslint-config": "^4.0.0", + "@npmcli/template-oss": "4.15.1", "tap": "^16.0.1" }, "dependencies": { - "json-parse-even-better-errors": "^3.0.0" + "glob": "^10.2.2", + "json-parse-even-better-errors": "^3.0.0", + "normalize-package-data": "^5.0.0", + "npm-normalize-package-bin": "^3.0.1" }, "repository": { "type": "git", @@ -40,7 +43,8 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.5.1" + "version": "4.15.1", + "publish": "true" }, "tap": { "nyc-arg": [ diff --git a/deps/npm/node_modules/@npmcli/run-script/lib/run-script-pkg.js b/deps/npm/node_modules/@npmcli/run-script/lib/run-script-pkg.js index cbb0a0b3a5e733..a5518285d1af1b 100644 --- a/deps/npm/node_modules/@npmcli/run-script/lib/run-script-pkg.js +++ b/deps/npm/node_modules/@npmcli/run-script/lib/run-script-pkg.js @@ -94,7 +94,11 @@ const runScriptPkg = async options => { return p.catch(er => { const { signal } = er if (stdio === 'inherit' && signal) { + // by the time we reach here, the child has already exited. we send the + // signal back to ourselves again so that npm will exit with the same + // status as the child process.kill(process.pid, signal) + // just in case we don't die, reject after 500ms // this also keeps the node process open long enough to actually // get the signal, rather than terminating gracefully. diff --git a/deps/npm/node_modules/@npmcli/run-script/lib/signal-manager.js b/deps/npm/node_modules/@npmcli/run-script/lib/signal-manager.js index 7e10f859e0a689..efc00b488063ff 100644 --- a/deps/npm/node_modules/@npmcli/run-script/lib/signal-manager.js +++ b/deps/npm/node_modules/@npmcli/run-script/lib/signal-manager.js @@ -1,17 +1,19 @@ const runningProcs = new Set() let handlersInstalled = false +// NOTE: these signals aren't actually forwarded anywhere. they're trapped and +// ignored until all child processes have exited. in our next breaking change +// we should rename this const forwardedSignals = [ 'SIGINT', 'SIGTERM', ] -const handleSignal = signal => { - for (const proc of runningProcs) { - proc.kill(signal) - } -} - +// no-op, this is so receiving the signal doesn't cause us to exit immediately +// instead, we exit after all children have exited when we re-send the signal +// to ourselves. see the catch handler at the bottom of run-script-pkg.js +// istanbul ignore next - this function does nothing +const handleSignal = () => {} const setupListeners = () => { for (const signal of forwardedSignals) { process.on(signal, handleSignal) diff --git a/deps/npm/node_modules/@npmcli/run-script/package.json b/deps/npm/node_modules/@npmcli/run-script/package.json index cdcf6fb0fcf823..38f6f72fa6ad90 100644 --- a/deps/npm/node_modules/@npmcli/run-script/package.json +++ b/deps/npm/node_modules/@npmcli/run-script/package.json @@ -1,6 +1,6 @@ { "name": "@npmcli/run-script", - "version": "6.0.1", + "version": "6.0.2", "description": "Run a lifecycle script for a package (descendant of npm-lifecycle)", "author": "GitHub Inc.", "license": "ISC", @@ -16,7 +16,7 @@ }, "devDependencies": { "@npmcli/eslint-config": "^4.0.0", - "@npmcli/template-oss": "4.14.1", + "@npmcli/template-oss": "4.15.1", "require-inject": "^1.4.4", "tap": "^16.0.1" }, @@ -41,7 +41,7 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.14.1", + "version": "4.15.1", "publish": "true" }, "tap": { diff --git a/deps/npm/node_modules/cacache/lib/content/write.js b/deps/npm/node_modules/cacache/lib/content/write.js index b6f5c5623b58b4..71461465812878 100644 --- a/deps/npm/node_modules/cacache/lib/content/write.js +++ b/deps/npm/node_modules/cacache/lib/content/write.js @@ -15,6 +15,9 @@ const fsm = require('fs-minipass') module.exports = write +// Cache of move operations in process so we don't duplicate +const moveOperations = new Map() + async function write (cache, data, opts = {}) { const { algorithms, size, integrity } = opts @@ -159,16 +162,27 @@ async function makeTmp (cache, opts) { async function moveToDestination (tmp, cache, sri, opts) { const destination = contentPath(cache, sri) const destDir = path.dirname(destination) - - await fs.mkdir(destDir, { recursive: true }) - try { - await moveFile(tmp.target, destination, { overwrite: false }) - tmp.moved = true - } catch (err) { - if (!err.message.startsWith('The destination file exists')) { - throw Object.assign(err, { code: 'EEXIST' }) - } + if (moveOperations.has(destination)) { + return moveOperations.get(destination) } + moveOperations.set( + destination, + fs.mkdir(destDir, { recursive: true }) + .then(async () => { + await moveFile(tmp.target, destination, { overwrite: false }) + tmp.moved = true + return tmp.moved + }) + .catch(err => { + if (!err.message.startsWith('The destination file exists')) { + throw Object.assign(err, { code: 'EEXIST' }) + } + }).finally(() => { + moveOperations.delete(destination) + }) + + ) + return moveOperations.get(destination) } function sizeError (expected, found) { diff --git a/deps/npm/node_modules/cacache/package.json b/deps/npm/node_modules/cacache/package.json index b8ee783388d847..db17e3a41bc5e4 100644 --- a/deps/npm/node_modules/cacache/package.json +++ b/deps/npm/node_modules/cacache/package.json @@ -1,6 +1,6 @@ { "name": "cacache", - "version": "17.1.0", + "version": "17.1.2", "cache-version": { "content": "2", "index": "5" @@ -60,7 +60,7 @@ }, "devDependencies": { "@npmcli/eslint-config": "^4.0.0", - "@npmcli/template-oss": "4.14.1", + "@npmcli/template-oss": "4.15.1", "tap": "^16.0.0" }, "engines": { @@ -69,7 +69,7 @@ "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", "windowsCI": false, - "version": "4.14.1", + "version": "4.15.1", "publish": "true" }, "author": "GitHub Inc.", diff --git a/deps/npm/node_modules/glob/dist/cjs/package.json b/deps/npm/node_modules/glob/dist/cjs/package.json index e225638de741d7..8762de67dc4d55 100644 --- a/deps/npm/node_modules/glob/dist/cjs/package.json +++ b/deps/npm/node_modules/glob/dist/cjs/package.json @@ -2,7 +2,7 @@ "author": "Isaac Z. Schlueter (http://blog.izs.me/)", "name": "glob", "description": "the most correct and second fastest glob implementation in JavaScript", - "version": "10.2.2", + "version": "10.2.4", "bin": "./dist/cjs/src/bin.js", "repository": { "type": "git", @@ -63,7 +63,7 @@ "foreground-child": "^3.1.0", "jackspeak": "^2.0.3", "minimatch": "^9.0.0", - "minipass": "^5.0.0", + "minipass": "^5.0.0 || ^6.0.0", "path-scurry": "^1.7.0" }, "devDependencies": { diff --git a/deps/npm/node_modules/glob/dist/cjs/src/glob.d.ts.map b/deps/npm/node_modules/glob/dist/cjs/src/glob.d.ts.map index bd44bbf49d5949..b0ea3b71e222ad 100644 --- a/deps/npm/node_modules/glob/dist/cjs/src/glob.d.ts.map +++ b/deps/npm/node_modules/glob/dist/cjs/src/glob.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../../../src/glob.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAoB,MAAM,WAAW,CAAA;AACvD,OAAO,EAAE,QAAQ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,CAAC,CAAC;IAa9C;;OAEG;IACH,UAAU,IAAI,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;IAalD;;;OAGG;IACH,WAAW,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC;IAGlD,CAAC,MAAM,CAAC,QAAQ,CAAC;IAIjB;;;OAGG;IACH,OAAO,IAAI,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC;IAGnD,CAAC,MAAM,CAAC,aAAa,CAAC;CAGvB"} \ No newline at end of file diff --git a/deps/npm/node_modules/glob/dist/cjs/src/glob.js b/deps/npm/node_modules/glob/dist/cjs/src/glob.js index a05d9f0eb39637..e7ad4deb980d30 100644 --- a/deps/npm/node_modules/glob/dist/cjs/src/glob.js +++ b/deps/npm/node_modules/glob/dist/cjs/src/glob.js @@ -130,6 +130,11 @@ class Glob { }); } this.nocase = this.scurry.nocase; + // If you do nocase:true on a case-sensitive file system, then + // we need to use regexps instead of strings for non-magic + // path portions, because statting `aBc` won't return results + // for the file `AbC` for example. + const nocaseMagicOnly = this.platform === 'darwin' || this.platform === 'win32'; const mmo = { // default nocase based on platform ...opts, @@ -137,7 +142,7 @@ class Glob { matchBase: this.matchBase, nobrace: this.nobrace, nocase: this.nocase, - nocaseMagicOnly: true, + nocaseMagicOnly, nocomment: true, noext: this.noext, nonegate: true, diff --git a/deps/npm/node_modules/glob/dist/cjs/src/glob.js.map b/deps/npm/node_modules/glob/dist/cjs/src/glob.js.map index aae70b0e4479f3..bf6fb4d0f0b724 100644 --- a/deps/npm/node_modules/glob/dist/cjs/src/glob.js.map +++ b/deps/npm/node_modules/glob/dist/cjs/src/glob.js.map @@ -1 +1 @@ -{"version":3,"file":"glob.js","sourceRoot":"","sources":["../../../src/glob.ts"],"names":[],"mappings":";;;AAAA,yCAAuD;AAEvD,6CAOoB;AACpB,6BAAm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,CAAC;QACf,OAAO,IAAI,CAAC,WAAW,EAAE,CAAA;IAC3B,CAAC;IAED;;;OAGG;IACH,OAAO;QACL,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAA;IAC9C,CAAC;IACD,CAAC,MAAM,CAAC,aAAa,CAAC;QACpB,OAAO,IAAI,CAAC,OAAO,EAAE,CAAA;IACvB,CAAC;CACF;AA3PD,oBA2PC","sourcesContent":["import { Minimatch, MinimatchOptions } from 'minimatch'\nimport { Minipass } from 'minipass'\nimport {\n FSOption,\n Path,\n PathScurry,\n PathScurryDarwin,\n PathScurryPosix,\n PathScurryWin32,\n} from 'path-scurry'\nimport { fileURLToPath } from 'url'\nimport { IgnoreLike } from './ignore.js'\nimport { Pattern } from './pattern.js'\nimport { GlobStream, GlobWalker } from './walker.js'\n\nexport type MatchSet = Minimatch['set']\nexport type GlobParts = Exclude\n\n// if no process global, just call it linux.\n// so we default to case-sensitive, / separators\nconst defaultPlatform: NodeJS.Platform =\n typeof process === 'object' &&\n process &&\n typeof process.platform === 'string'\n ? process.platform\n : 'linux'\n\n/**\n * A `GlobOptions` object may be provided to any of the exported methods, and\n * must be provided to the `Glob` constructor.\n *\n * All options are optional, boolean, and false by default, unless otherwise\n * noted.\n *\n * All resolved options are added to the Glob object as properties.\n *\n * If you are running many `glob` operations, you can pass a Glob object as the\n * `options` argument to a subsequent operation to share the previously loaded\n * cache.\n */\nexport interface GlobOptions {\n /**\n * Set to `true` to always receive absolute paths for\n * matched files. Set to `false` to always return relative paths.\n *\n * When this option is not set, absolute paths are returned for patterns\n * that are absolute, and otherwise paths are returned that are relative\n * to the `cwd` setting.\n *\n * This does _not_ make an extra system call to get\n * the realpath, it only does string path resolution.\n *\n * Conflicts with {@link withFileTypes}\n */\n absolute?: boolean\n\n /**\n * Set to false to enable {@link windowsPathsNoEscape}\n *\n * @deprecated\n */\n allowWindowsEscape?: boolean\n\n /**\n * The current working directory in which to search. Defaults to\n * `process.cwd()`.\n *\n * May be eiher a string path or a `file://` URL object or string.\n */\n cwd?: string | URL\n\n /**\n * Include `.dot` files in normal matches and `globstar`\n * matches. Note that an explicit dot in a portion of the pattern\n * will always match dot files.\n */\n dot?: boolean\n\n /**\n * Prepend all relative path strings with `./` (or `.\\` on Windows).\n *\n * Without this option, returned relative paths are \"bare\", so instead of\n * returning `'./foo/bar'`, they are returned as `'foo/bar'`.\n *\n * Relative patterns starting with `'../'` are not prepended with `./`, even\n * if this option is set.\n */\n dotRelative?: boolean\n\n /**\n * Follow symlinked directories when expanding `**`\n * patterns. This can result in a lot of duplicate references in\n * the presence of cyclic links, and make performance quite bad.\n *\n * By default, a `**` in a pattern will follow 1 symbolic link if\n * it is not the first item in the pattern, or none if it is the\n * first item in the pattern, following the same behavior as Bash.\n */\n follow?: boolean\n\n /**\n * string or string[], or an object with `ignore` and `ignoreChildren`\n * methods.\n *\n * If a string or string[] is provided, then this is treated as a glob\n * pattern or array of glob patterns to exclude from matches. To ignore all\n * children within a directory, as well as the entry itself, append `'/**'`\n * to the ignore pattern.\n *\n * **Note** `ignore` patterns are _always_ in `dot:true` mode, regardless of\n * any other settings.\n *\n * If an object is provided that has `ignored(path)` and/or\n * `childrenIgnored(path)` methods, then these methods will be called to\n * determine whether any Path is a match or if its children should be\n * traversed, respectively.\n */\n ignore?: string | string[] | IgnoreLike\n\n /**\n * Treat brace expansion like `{a,b}` as a \"magic\" pattern. Has no\n * effect if {@link nobrace} is set.\n *\n * Only has effect on the {@link hasMagic} function.\n */\n magicalBraces?: boolean\n\n /**\n * Add a `/` character to directory matches. Note that this requires\n * additional stat calls in some cases.\n */\n mark?: boolean\n\n /**\n * Perform a basename-only match if the pattern does not contain any slash\n * characters. That is, `*.js` would be treated as equivalent to\n * `**\\/*.js`, matching all js files in all directories.\n */\n matchBase?: boolean\n\n /**\n * Limit the directory traversal to a given depth below the cwd.\n * Note that this does NOT prevent traversal to sibling folders,\n * root patterns, and so on. It only limits the maximum folder depth\n * that the walk will descend, relative to the cwd.\n */\n maxDepth?: number\n\n /**\n * Do not expand `{a,b}` and `{1..3}` brace sets.\n */\n nobrace?: boolean\n\n /**\n * Perform a case-insensitive match. This defaults to `true` on macOS and\n * Windows systems, and `false` on all others.\n *\n * **Note** `nocase` should only be explicitly set when it is\n * known that the filesystem's case sensitivity differs from the\n * platform default. If set `true` on case-sensitive file\n * systems, or `false` on case-insensitive file systems, then the\n * walk may return more or less results than expected.\n */\n nocase?: boolean\n\n /**\n * Do not match directories, only files. (Note: to match\n * _only_ directories, put a `/` at the end of the pattern.)\n */\n nodir?: boolean\n\n /**\n * Do not match \"extglob\" patterns such as `+(a|b)`.\n */\n noext?: boolean\n\n /**\n * Do not match `**` against multiple filenames. (Ie, treat it as a normal\n * `*` instead.)\n *\n * Conflicts with {@link matchBase}\n */\n noglobstar?: boolean\n\n /**\n * Defaults to value of `process.platform` if available, or `'linux'` if\n * not. Setting `platform:'win32'` on non-Windows systems may cause strange\n * behavior.\n */\n platform?: NodeJS.Platform\n\n /**\n * Set to true to call `fs.realpath` on all of the\n * results. In the case of an entry that cannot be resolved, the\n * entry is omitted. This incurs a slight performance penalty, of\n * course, because of the added system calls.\n */\n realpath?: boolean\n\n /**\n *\n * A string path resolved against the `cwd` option, which\n * is used as the starting point for absolute patterns that start\n * with `/`, (but not drive letters or UNC paths on Windows).\n *\n * Note that this _doesn't_ necessarily limit the walk to the\n * `root` directory, and doesn't affect the cwd starting point for\n * non-absolute patterns. A pattern containing `..` will still be\n * able to traverse out of the root directory, if it is not an\n * actual root directory on the filesystem, and any non-absolute\n * patterns will be matched in the `cwd`. For example, the\n * pattern `/../*` with `{root:'/some/path'}` will return all\n * files in `/some`, not all files in `/some/path`. The pattern\n * `*` with `{root:'/some/path'}` will return all the entries in\n * the cwd, not the entries in `/some/path`.\n *\n * To start absolute and non-absolute patterns in the same\n * path, you can use `{root:''}`. However, be aware that on\n * Windows systems, a pattern like `x:/*` or `//host/share/*` will\n * _always_ start in the `x:/` or `//host/share` directory,\n * regardless of the `root` setting.\n */\n root?: string\n\n /**\n * A [PathScurry](http://npm.im/path-scurry) object used\n * to traverse the file system. If the `nocase` option is set\n * explicitly, then any provided `scurry` object must match this\n * setting.\n */\n scurry?: PathScurry\n\n /**\n * Call `lstat()` on all entries, whether required or not to determine\n * if it's a valid match. When used with {@link withFileTypes}, this means\n * that matches will include data such as modified time, permissions, and\n * so on. Note that this will incur a performance cost due to the added\n * system calls.\n */\n stat?: boolean\n\n /**\n * An AbortSignal which will cancel the Glob walk when\n * triggered.\n */\n signal?: AbortSignal\n\n /**\n * Use `\\\\` as a path separator _only_, and\n * _never_ as an escape character. If set, all `\\\\` characters are\n * replaced with `/` in the pattern.\n *\n * Note that this makes it **impossible** to match against paths\n * containing literal glob pattern characters, but allows matching\n * with patterns constructed using `path.join()` and\n * `path.resolve()` on Windows platforms, mimicking the (buggy!)\n * behavior of Glob v7 and before on Windows. Please use with\n * caution, and be mindful of [the caveat below about Windows\n * paths](#windows). (For legacy reasons, this is also set if\n * `allowWindowsEscape` is set to the exact value `false`.)\n */\n windowsPathsNoEscape?: boolean\n\n /**\n * Return [PathScurry](http://npm.im/path-scurry)\n * `Path` objects instead of strings. These are similar to a\n * NodeJS `Dirent` object, but with additional methods and\n * properties.\n *\n * Conflicts with {@link absolute}\n */\n withFileTypes?: boolean\n\n /**\n * An fs implementation to override some or all of the defaults. See\n * http://npm.im/path-scurry for details about what can be overridden.\n */\n fs?: FSOption\n\n /**\n * Just passed along to Minimatch. Note that this makes all pattern\n * matching operations slower and *extremely* noisy.\n */\n debug?: boolean\n\n /**\n * Return `/` delimited paths, even on Windows.\n *\n * On posix systems, this has no effect. But, on Windows, it means that\n * paths will be `/` delimited, and absolute paths will be their full\n * resolved UNC forms, eg instead of `'C:\\\\foo\\\\bar'`, it would return\n * `'//?/C:/foo/bar'`\n */\n posix?: boolean\n}\n\nexport type GlobOptionsWithFileTypesTrue = GlobOptions & {\n withFileTypes: true\n // string options not relevant if returning Path objects.\n absolute?: undefined\n mark?: undefined\n posix?: undefined\n}\n\nexport type GlobOptionsWithFileTypesFalse = GlobOptions & {\n withFileTypes?: false\n}\n\nexport type GlobOptionsWithFileTypesUnset = GlobOptions & {\n withFileTypes?: undefined\n}\n\nexport type Result = Opts extends GlobOptionsWithFileTypesTrue\n ? Path\n : Opts extends GlobOptionsWithFileTypesFalse\n ? string\n : Opts extends GlobOptionsWithFileTypesUnset\n ? string\n : string | Path\nexport type Results = Result[]\n\nexport type FileTypes = Opts extends GlobOptionsWithFileTypesTrue\n ? true\n : Opts extends GlobOptionsWithFileTypesFalse\n ? false\n : Opts extends GlobOptionsWithFileTypesUnset\n ? false\n : boolean\n\n/**\n * An object that can perform glob pattern traversals.\n */\nexport class Glob implements GlobOptions {\n absolute?: boolean\n cwd: string\n root?: string\n dot: boolean\n dotRelative: boolean\n follow: boolean\n ignore?: string | string[] | IgnoreLike\n magicalBraces: boolean\n mark?: boolean\n matchBase: boolean\n maxDepth: number\n nobrace: boolean\n nocase: boolean\n nodir: boolean\n noext: boolean\n noglobstar: boolean\n pattern: string[]\n platform: NodeJS.Platform\n realpath: boolean\n scurry: PathScurry\n stat: boolean\n signal?: AbortSignal\n windowsPathsNoEscape: boolean\n withFileTypes: FileTypes\n\n /**\n * The options provided to the constructor.\n */\n opts: Opts\n\n /**\n * An array of parsed immutable {@link Pattern} objects.\n */\n patterns: Pattern[]\n\n /**\n * All options are stored as properties on the `Glob` object.\n *\n * See {@link GlobOptions} for full options descriptions.\n *\n * Note that a previous `Glob` object can be passed as the\n * `GlobOptions` to another `Glob` instantiation to re-use settings\n * and caches with a new pattern.\n *\n * Traversal functions can be called multiple times to run the walk\n * again.\n */\n constructor(pattern: string | string[], opts: Opts) {\n this.withFileTypes = !!opts.withFileTypes as FileTypes\n this.signal = opts.signal\n this.follow = !!opts.follow\n this.dot = !!opts.dot\n this.dotRelative = !!opts.dotRelative\n this.nodir = !!opts.nodir\n this.mark = !!opts.mark\n if (!opts.cwd) {\n this.cwd = ''\n } else if (opts.cwd instanceof URL || opts.cwd.startsWith('file://')) {\n opts.cwd = fileURLToPath(opts.cwd)\n }\n this.cwd = opts.cwd || ''\n this.root = opts.root\n this.magicalBraces = !!opts.magicalBraces\n this.nobrace = !!opts.nobrace\n this.noext = !!opts.noext\n this.realpath = !!opts.realpath\n this.absolute = opts.absolute\n\n this.noglobstar = !!opts.noglobstar\n this.matchBase = !!opts.matchBase\n this.maxDepth =\n typeof opts.maxDepth === 'number' ? opts.maxDepth : Infinity\n this.stat = !!opts.stat\n this.ignore = opts.ignore\n\n if (this.withFileTypes && this.absolute !== undefined) {\n throw new Error('cannot set absolute and withFileTypes:true')\n }\n\n if (typeof pattern === 'string') {\n pattern = [pattern]\n }\n\n this.windowsPathsNoEscape =\n !!opts.windowsPathsNoEscape ||\n (opts as GlobOptions).allowWindowsEscape === false\n\n if (this.windowsPathsNoEscape) {\n pattern = pattern.map(p => p.replace(/\\\\/g, '/'))\n }\n\n if (this.matchBase) {\n if (opts.noglobstar) {\n throw new TypeError('base matching requires globstar')\n }\n pattern = pattern.map(p => (p.includes('/') ? p : `./**/${p}`))\n }\n\n this.pattern = pattern\n\n this.platform = opts.platform || defaultPlatform\n this.opts = { ...opts, platform: this.platform }\n if (opts.scurry) {\n this.scurry = opts.scurry\n if (\n opts.nocase !== undefined &&\n opts.nocase !== opts.scurry.nocase\n ) {\n throw new Error('nocase option contradicts provided scurry option')\n }\n } else {\n const Scurry =\n opts.platform === 'win32'\n ? PathScurryWin32\n : opts.platform === 'darwin'\n ? PathScurryDarwin\n : opts.platform\n ? PathScurryPosix\n : PathScurry\n this.scurry = new Scurry(this.cwd, {\n nocase: opts.nocase,\n fs: opts.fs,\n })\n }\n this.nocase = this.scurry.nocase\n\n const mmo: MinimatchOptions = {\n // default nocase based on platform\n ...opts,\n dot: this.dot,\n matchBase: this.matchBase,\n nobrace: this.nobrace,\n nocase: this.nocase,\n nocaseMagicOnly: true,\n nocomment: true,\n noext: this.noext,\n nonegate: true,\n optimizationLevel: 2,\n platform: this.platform,\n windowsPathsNoEscape: this.windowsPathsNoEscape,\n debug: !!this.opts.debug,\n }\n\n const mms = this.pattern.map(p => new Minimatch(p, mmo))\n const [matchSet, globParts] = mms.reduce(\n (set: [MatchSet, GlobParts], m) => {\n set[0].push(...m.set)\n set[1].push(...m.globParts)\n return set\n },\n [[], []]\n )\n this.patterns = matchSet.map((set, i) => {\n return new Pattern(set, globParts[i], 0, this.platform)\n })\n }\n\n /**\n * Returns a Promise that resolves to the results array.\n */\n async walk(): Promise>\n async walk(): Promise<(string | Path)[]> {\n // Walkers always return array of Path objects, so we just have to\n // coerce them into the right shape. It will have already called\n // realpath() if the option was set to do so, so we know that's cached.\n // start out knowing the cwd, at least\n return [\n ...(await new GlobWalker(this.patterns, this.scurry.cwd, {\n ...this.opts,\n maxDepth:\n this.maxDepth !== Infinity\n ? this.maxDepth + this.scurry.cwd.depth()\n : Infinity,\n platform: this.platform,\n nocase: this.nocase,\n }).walk()),\n ]\n }\n\n /**\n * synchronous {@link Glob.walk}\n */\n walkSync(): Results\n walkSync(): (string | Path)[] {\n return [\n ...new GlobWalker(this.patterns, this.scurry.cwd, {\n ...this.opts,\n maxDepth:\n this.maxDepth !== Infinity\n ? this.maxDepth + this.scurry.cwd.depth()\n : Infinity,\n platform: this.platform,\n nocase: this.nocase,\n }).walkSync(),\n ]\n }\n\n /**\n * Stream results asynchronously.\n */\n stream(): Minipass, Result>\n stream(): Minipass {\n return new GlobStream(this.patterns, this.scurry.cwd, {\n ...this.opts,\n maxDepth:\n this.maxDepth !== Infinity\n ? this.maxDepth + this.scurry.cwd.depth()\n : Infinity,\n platform: this.platform,\n nocase: this.nocase,\n }).stream()\n }\n\n /**\n * Stream results synchronously.\n */\n streamSync(): Minipass, Result>\n streamSync(): Minipass {\n return new GlobStream(this.patterns, this.scurry.cwd, {\n ...this.opts,\n maxDepth:\n this.maxDepth !== Infinity\n ? this.maxDepth + this.scurry.cwd.depth()\n : Infinity,\n platform: this.platform,\n nocase: this.nocase,\n }).streamSync()\n }\n\n /**\n * Default sync iteration function. Returns a Generator that\n * iterates over the results.\n */\n iterateSync(): Generator, void, void> {\n return this.streamSync()[Symbol.iterator]()\n }\n [Symbol.iterator]() {\n return this.iterateSync()\n }\n\n /**\n * Default async iteration function. Returns an AsyncGenerator that\n * iterates over the results.\n */\n iterate(): AsyncGenerator, void, void> {\n return this.stream()[Symbol.asyncIterator]()\n }\n [Symbol.asyncIterator]() {\n return this.iterate()\n }\n}\n"]} \ No newline at end of file +{"version":3,"file":"glob.js","sourceRoot":"","sources":["../../../src/glob.ts"],"names":[],"mappings":";;;AAAA,yCAAuD;AAEvD,6CAOoB;AACpB,6BAAmC;AAEnC,6CAAsC;AACtC,2CAAoD;AAKpD,4CAA4C;AAC5C,gDAAgD;AAChD,MAAM,eAAe,GACnB,OAAO,OAAO,KAAK,QAAQ;IAC3B,OAAO;IACP,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ;IAClC,CAAC,CAAC,OAAO,CAAC,QAAQ;IAClB,CAAC,CAAC,OAAO,CAAA;AAgTb;;GAEG;AACH,MAAa,IAAI;IACf,QAAQ,CAAU;IAClB,GAAG,CAAQ;IACX,IAAI,CAAS;IACb,GAAG,CAAS;IACZ,WAAW,CAAS;IACpB,MAAM,CAAS;IACf,MAAM,CAAiC;IACvC,aAAa,CAAS;IACtB,IAAI,CAAU;IACd,SAAS,CAAS;IAClB,QAAQ,CAAQ;IAChB,OAAO,CAAS;IAChB,MAAM,CAAS;IACf,KAAK,CAAS;IACd,KAAK,CAAS;IACd,UAAU,CAAS;IACnB,OAAO,CAAU;IACjB,QAAQ,CAAiB;IACzB,QAAQ,CAAS;IACjB,MAAM,CAAY;IAClB,IAAI,CAAS;IACb,MAAM,CAAc;IACpB,oBAAoB,CAAS;IAC7B,aAAa,CAAiB;IAE9B;;OAEG;IACH,IAAI,CAAM;IAEV;;OAEG;IACH,QAAQ,CAAW;IAEnB;;;;;;;;;;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AM,EAAE,CAAA;IACb,CAAC;IAMD,UAAU;QACR,OAAO,IAAI,sBAAU,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE;YACpD,GAAG,IAAI,CAAC,IAAI;YACZ,QAAQ,EACN,IAAI,CAAC,QAAQ,KAAK,QAAQ;gBACxB,CAAC,CAAC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE;gBACzC,CAAC,CAAC,QAAQ;YACd,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,MAAM,EAAE,IAAI,CAAC,MAAM;SACpB,CAAC,CAAC,UAAU,EAAE,CAAA;IACjB,CAAC;IAED;;;OAGG;IACH,WAAW;QACT,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAA;IAC7C,CAAC;IACD,CAAC,MAAM,CAAC,QAAQ,CAAC;QACf,OAAO,IAAI,CAAC,WAAW,EAAE,CAAA;IAC3B,CAAC;IAED;;;OAGG;IACH,OAAO;QACL,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAA;IAC9C,CAAC;IACD,CAAC,MAAM,CAAC,aAAa,CAAC;QACpB,OAAO,IAAI,CAAC,OAAO,EAAE,CAAA;IACvB,CAAC;CACF;AAlQD,oBAkQC","sourcesContent":["import { Minimatch, MinimatchOptions } from 'minimatch'\nimport { Minipass } from 'minipass'\nimport {\n FSOption,\n Path,\n PathScurry,\n PathScurryDarwin,\n PathScurryPosix,\n PathScurryWin32,\n} from 'path-scurry'\nimport { fileURLToPath } from 'url'\nimport { IgnoreLike } from './ignore.js'\nimport { Pattern } from './pattern.js'\nimport { GlobStream, GlobWalker } from './walker.js'\n\nexport type MatchSet = Minimatch['set']\nexport type GlobParts = Exclude\n\n// if no process global, just call it linux.\n// so we default to case-sensitive, / separators\nconst defaultPlatform: NodeJS.Platform =\n typeof process === 'object' &&\n process &&\n typeof process.platform === 'string'\n ? process.platform\n : 'linux'\n\n/**\n * A `GlobOptions` object may be provided to any of the exported methods, and\n * must be provided to the `Glob` constructor.\n *\n * All options are optional, boolean, and false by default, unless otherwise\n * noted.\n *\n * All resolved options are added to the Glob object as properties.\n *\n * If you are running many `glob` operations, you can pass a Glob object as the\n * `options` argument to a subsequent operation to share the previously loaded\n * cache.\n */\nexport interface GlobOptions {\n /**\n * Set to `true` to always receive absolute paths for\n * matched files. Set to `false` to always return relative paths.\n *\n * When this option is not set, absolute paths are returned for patterns\n * that are absolute, and otherwise paths are returned that are relative\n * to the `cwd` setting.\n *\n * This does _not_ make an extra system call to get\n * the realpath, it only does string path resolution.\n *\n * Conflicts with {@link withFileTypes}\n */\n absolute?: boolean\n\n /**\n * Set to false to enable {@link windowsPathsNoEscape}\n *\n * @deprecated\n */\n allowWindowsEscape?: boolean\n\n /**\n * The current working directory in which to search. Defaults to\n * `process.cwd()`.\n *\n * May be eiher a string path or a `file://` URL object or string.\n */\n cwd?: string | URL\n\n /**\n * Include `.dot` files in normal matches and `globstar`\n * matches. Note that an explicit dot in a portion of the pattern\n * will always match dot files.\n */\n dot?: boolean\n\n /**\n * Prepend all relative path strings with `./` (or `.\\` on Windows).\n *\n * Without this option, returned relative paths are \"bare\", so instead of\n * returning `'./foo/bar'`, they are returned as `'foo/bar'`.\n *\n * Relative patterns starting with `'../'` are not prepended with `./`, even\n * if this option is set.\n */\n dotRelative?: boolean\n\n /**\n * Follow symlinked directories when expanding `**`\n * patterns. This can result in a lot of duplicate references in\n * the presence of cyclic links, and make performance quite bad.\n *\n * By default, a `**` in a pattern will follow 1 symbolic link if\n * it is not the first item in the pattern, or none if it is the\n * first item in the pattern, following the same behavior as Bash.\n */\n follow?: boolean\n\n /**\n * string or string[], or an object with `ignore` and `ignoreChildren`\n * methods.\n *\n * If a string or string[] is provided, then this is treated as a glob\n * pattern or array of glob patterns to exclude from matches. To ignore all\n * children within a directory, as well as the entry itself, append `'/**'`\n * to the ignore pattern.\n *\n * **Note** `ignore` patterns are _always_ in `dot:true` mode, regardless of\n * any other settings.\n *\n * If an object is provided that has `ignored(path)` and/or\n * `childrenIgnored(path)` methods, then these methods will be called to\n * determine whether any Path is a match or if its children should be\n * traversed, respectively.\n */\n ignore?: string | string[] | IgnoreLike\n\n /**\n * Treat brace expansion like `{a,b}` as a \"magic\" pattern. Has no\n * effect if {@link nobrace} is set.\n *\n * Only has effect on the {@link hasMagic} function.\n */\n magicalBraces?: boolean\n\n /**\n * Add a `/` character to directory matches. Note that this requires\n * additional stat calls in some cases.\n */\n mark?: boolean\n\n /**\n * Perform a basename-only match if the pattern does not contain any slash\n * characters. That is, `*.js` would be treated as equivalent to\n * `**\\/*.js`, matching all js files in all directories.\n */\n matchBase?: boolean\n\n /**\n * Limit the directory traversal to a given depth below the cwd.\n * Note that this does NOT prevent traversal to sibling folders,\n * root patterns, and so on. It only limits the maximum folder depth\n * that the walk will descend, relative to the cwd.\n */\n maxDepth?: number\n\n /**\n * Do not expand `{a,b}` and `{1..3}` brace sets.\n */\n nobrace?: boolean\n\n /**\n * Perform a case-insensitive match. This defaults to `true` on macOS and\n * Windows systems, and `false` on all others.\n *\n * **Note** `nocase` should only be explicitly set when it is\n * known that the filesystem's case sensitivity differs from the\n * platform default. If set `true` on case-sensitive file\n * systems, or `false` on case-insensitive file systems, then the\n * walk may return more or less results than expected.\n */\n nocase?: boolean\n\n /**\n * Do not match directories, only files. (Note: to match\n * _only_ directories, put a `/` at the end of the pattern.)\n */\n nodir?: boolean\n\n /**\n * Do not match \"extglob\" patterns such as `+(a|b)`.\n */\n noext?: boolean\n\n /**\n * Do not match `**` against multiple filenames. (Ie, treat it as a normal\n * `*` instead.)\n *\n * Conflicts with {@link matchBase}\n */\n noglobstar?: boolean\n\n /**\n * Defaults to value of `process.platform` if available, or `'linux'` if\n * not. Setting `platform:'win32'` on non-Windows systems may cause strange\n * behavior.\n */\n platform?: NodeJS.Platform\n\n /**\n * Set to true to call `fs.realpath` on all of the\n * results. In the case of an entry that cannot be resolved, the\n * entry is omitted. This incurs a slight performance penalty, of\n * course, because of the added system calls.\n */\n realpath?: boolean\n\n /**\n *\n * A string path resolved against the `cwd` option, which\n * is used as the starting point for absolute patterns that start\n * with `/`, (but not drive letters or UNC paths on Windows).\n *\n * Note that this _doesn't_ necessarily limit the walk to the\n * `root` directory, and doesn't affect the cwd starting point for\n * non-absolute patterns. A pattern containing `..` will still be\n * able to traverse out of the root directory, if it is not an\n * actual root directory on the filesystem, and any non-absolute\n * patterns will be matched in the `cwd`. For example, the\n * pattern `/../*` with `{root:'/some/path'}` will return all\n * files in `/some`, not all files in `/some/path`. The pattern\n * `*` with `{root:'/some/path'}` will return all the entries in\n * the cwd, not the entries in `/some/path`.\n *\n * To start absolute and non-absolute patterns in the same\n * path, you can use `{root:''}`. However, be aware that on\n * Windows systems, a pattern like `x:/*` or `//host/share/*` will\n * _always_ start in the `x:/` or `//host/share` directory,\n * regardless of the `root` setting.\n */\n root?: string\n\n /**\n * A [PathScurry](http://npm.im/path-scurry) object used\n * to traverse the file system. If the `nocase` option is set\n * explicitly, then any provided `scurry` object must match this\n * setting.\n */\n scurry?: PathScurry\n\n /**\n * Call `lstat()` on all entries, whether required or not to determine\n * if it's a valid match. When used with {@link withFileTypes}, this means\n * that matches will include data such as modified time, permissions, and\n * so on. Note that this will incur a performance cost due to the added\n * system calls.\n */\n stat?: boolean\n\n /**\n * An AbortSignal which will cancel the Glob walk when\n * triggered.\n */\n signal?: AbortSignal\n\n /**\n * Use `\\\\` as a path separator _only_, and\n * _never_ as an escape character. If set, all `\\\\` characters are\n * replaced with `/` in the pattern.\n *\n * Note that this makes it **impossible** to match against paths\n * containing literal glob pattern characters, but allows matching\n * with patterns constructed using `path.join()` and\n * `path.resolve()` on Windows platforms, mimicking the (buggy!)\n * behavior of Glob v7 and before on Windows. Please use with\n * caution, and be mindful of [the caveat below about Windows\n * paths](#windows). (For legacy reasons, this is also set if\n * `allowWindowsEscape` is set to the exact value `false`.)\n */\n windowsPathsNoEscape?: boolean\n\n /**\n * Return [PathScurry](http://npm.im/path-scurry)\n * `Path` objects instead of strings. These are similar to a\n * NodeJS `Dirent` object, but with additional methods and\n * properties.\n *\n * Conflicts with {@link absolute}\n */\n withFileTypes?: boolean\n\n /**\n * An fs implementation to override some or all of the defaults. See\n * http://npm.im/path-scurry for details about what can be overridden.\n */\n fs?: FSOption\n\n /**\n * Just passed along to Minimatch. Note that this makes all pattern\n * matching operations slower and *extremely* noisy.\n */\n debug?: boolean\n\n /**\n * Return `/` delimited paths, even on Windows.\n *\n * On posix systems, this has no effect. But, on Windows, it means that\n * paths will be `/` delimited, and absolute paths will be their full\n * resolved UNC forms, eg instead of `'C:\\\\foo\\\\bar'`, it would return\n * `'//?/C:/foo/bar'`\n */\n posix?: boolean\n}\n\nexport type GlobOptionsWithFileTypesTrue = GlobOptions & {\n withFileTypes: true\n // string options not relevant if returning Path objects.\n absolute?: undefined\n mark?: undefined\n posix?: undefined\n}\n\nexport type GlobOptionsWithFileTypesFalse = GlobOptions & {\n withFileTypes?: false\n}\n\nexport type GlobOptionsWithFileTypesUnset = GlobOptions & {\n withFileTypes?: undefined\n}\n\nexport type Result = Opts extends GlobOptionsWithFileTypesTrue\n ? Path\n : Opts extends GlobOptionsWithFileTypesFalse\n ? string\n : Opts extends GlobOptionsWithFileTypesUnset\n ? string\n : string | Path\nexport type Results = Result[]\n\nexport type FileTypes = Opts extends GlobOptionsWithFileTypesTrue\n ? true\n : Opts extends GlobOptionsWithFileTypesFalse\n ? false\n : Opts extends GlobOptionsWithFileTypesUnset\n ? false\n : boolean\n\n/**\n * An object that can perform glob pattern traversals.\n */\nexport class Glob implements GlobOptions {\n absolute?: boolean\n cwd: string\n root?: string\n dot: boolean\n dotRelative: boolean\n follow: boolean\n ignore?: string | string[] | IgnoreLike\n magicalBraces: boolean\n mark?: boolean\n matchBase: boolean\n maxDepth: number\n nobrace: boolean\n nocase: boolean\n nodir: boolean\n noext: boolean\n noglobstar: boolean\n pattern: string[]\n platform: NodeJS.Platform\n realpath: boolean\n scurry: PathScurry\n stat: boolean\n signal?: AbortSignal\n windowsPathsNoEscape: boolean\n withFileTypes: FileTypes\n\n /**\n * The options provided to the constructor.\n */\n opts: Opts\n\n /**\n * An array of parsed immutable {@link Pattern} objects.\n */\n patterns: Pattern[]\n\n /**\n * All options are stored as properties on the `Glob` object.\n *\n * See {@link GlobOptions} for full options descriptions.\n *\n * Note that a previous `Glob` object can be passed as the\n * `GlobOptions` to another `Glob` instantiation to re-use settings\n * and caches with a new pattern.\n *\n * Traversal functions can be called multiple times to run the walk\n * again.\n */\n constructor(pattern: string | string[], opts: Opts) {\n this.withFileTypes = !!opts.withFileTypes as FileTypes\n this.signal = opts.signal\n this.follow = !!opts.follow\n this.dot = !!opts.dot\n this.dotRelative = !!opts.dotRelative\n this.nodir = !!opts.nodir\n this.mark = !!opts.mark\n if (!opts.cwd) {\n this.cwd = ''\n } else if (opts.cwd instanceof URL || opts.cwd.startsWith('file://')) {\n opts.cwd = fileURLToPath(opts.cwd)\n }\n this.cwd = opts.cwd || ''\n this.root = opts.root\n this.magicalBraces = !!opts.magicalBraces\n this.nobrace = !!opts.nobrace\n this.noext = !!opts.noext\n this.realpath = !!opts.realpath\n this.absolute = opts.absolute\n\n this.noglobstar = !!opts.noglobstar\n this.matchBase = !!opts.matchBase\n this.maxDepth =\n typeof opts.maxDepth === 'number' ? opts.maxDepth : Infinity\n this.stat = !!opts.stat\n this.ignore = opts.ignore\n\n if (this.withFileTypes && this.absolute !== undefined) {\n throw new Error('cannot set absolute and withFileTypes:true')\n }\n\n if (typeof pattern === 'string') {\n pattern = [pattern]\n }\n\n this.windowsPathsNoEscape =\n !!opts.windowsPathsNoEscape ||\n (opts as GlobOptions).allowWindowsEscape === false\n\n if (this.windowsPathsNoEscape) {\n pattern = pattern.map(p => p.replace(/\\\\/g, '/'))\n }\n\n if (this.matchBase) {\n if (opts.noglobstar) {\n throw new TypeError('base matching requires globstar')\n }\n pattern = pattern.map(p => (p.includes('/') ? p : `./**/${p}`))\n }\n\n this.pattern = pattern\n\n this.platform = opts.platform || defaultPlatform\n this.opts = { ...opts, platform: this.platform }\n if (opts.scurry) {\n this.scurry = opts.scurry\n if (\n opts.nocase !== undefined &&\n opts.nocase !== opts.scurry.nocase\n ) {\n throw new Error('nocase option contradicts provided scurry option')\n }\n } else {\n const Scurry =\n opts.platform === 'win32'\n ? PathScurryWin32\n : opts.platform === 'darwin'\n ? PathScurryDarwin\n : opts.platform\n ? PathScurryPosix\n : PathScurry\n this.scurry = new Scurry(this.cwd, {\n nocase: opts.nocase,\n fs: opts.fs,\n })\n }\n this.nocase = this.scurry.nocase\n\n // If you do nocase:true on a case-sensitive file system, then\n // we need to use regexps instead of strings for non-magic\n // path portions, because statting `aBc` won't return results\n // for the file `AbC` for example.\n const nocaseMagicOnly =\n this.platform === 'darwin' || this.platform === 'win32'\n\n const mmo: MinimatchOptions = {\n // default nocase based on platform\n ...opts,\n dot: this.dot,\n matchBase: this.matchBase,\n nobrace: this.nobrace,\n nocase: this.nocase,\n nocaseMagicOnly,\n nocomment: true,\n noext: this.noext,\n nonegate: true,\n optimizationLevel: 2,\n platform: this.platform,\n windowsPathsNoEscape: this.windowsPathsNoEscape,\n debug: !!this.opts.debug,\n }\n\n const mms = this.pattern.map(p => new Minimatch(p, mmo))\n const [matchSet, globParts] = mms.reduce(\n (set: [MatchSet, GlobParts], m) => {\n set[0].push(...m.set)\n set[1].push(...m.globParts)\n return set\n },\n [[], []]\n )\n this.patterns = matchSet.map((set, i) => {\n return new Pattern(set, globParts[i], 0, this.platform)\n })\n }\n\n /**\n * Returns a Promise that resolves to the results array.\n */\n async walk(): Promise>\n async walk(): Promise<(string | Path)[]> {\n // Walkers always return array of Path objects, so we just have to\n // coerce them into the right shape. It will have already called\n // realpath() if the option was set to do so, so we know that's cached.\n // start out knowing the cwd, at least\n return [\n ...(await new GlobWalker(this.patterns, this.scurry.cwd, {\n ...this.opts,\n maxDepth:\n this.maxDepth !== Infinity\n ? this.maxDepth + this.scurry.cwd.depth()\n : Infinity,\n platform: this.platform,\n nocase: this.nocase,\n }).walk()),\n ]\n }\n\n /**\n * synchronous {@link Glob.walk}\n */\n walkSync(): Results\n walkSync(): (string | Path)[] {\n return [\n ...new GlobWalker(this.patterns, this.scurry.cwd, {\n ...this.opts,\n maxDepth:\n this.maxDepth !== Infinity\n ? this.maxDepth + this.scurry.cwd.depth()\n : Infinity,\n platform: this.platform,\n nocase: this.nocase,\n }).walkSync(),\n ]\n }\n\n /**\n * Stream results asynchronously.\n */\n stream(): Minipass, Result>\n stream(): Minipass {\n return new GlobStream(this.patterns, this.scurry.cwd, {\n ...this.opts,\n maxDepth:\n this.maxDepth !== Infinity\n ? this.maxDepth + this.scurry.cwd.depth()\n : Infinity,\n platform: this.platform,\n nocase: this.nocase,\n }).stream()\n }\n\n /**\n * Stream results synchronously.\n */\n streamSync(): Minipass, Result>\n streamSync(): Minipass {\n return new GlobStream(this.patterns, this.scurry.cwd, {\n ...this.opts,\n maxDepth:\n this.maxDepth !== Infinity\n ? this.maxDepth + this.scurry.cwd.depth()\n : Infinity,\n platform: this.platform,\n nocase: this.nocase,\n }).streamSync()\n }\n\n /**\n * Default sync iteration function. Returns a Generator that\n * iterates over the results.\n */\n iterateSync(): Generator, void, void> {\n return this.streamSync()[Symbol.iterator]()\n }\n [Symbol.iterator]() {\n return this.iterateSync()\n }\n\n /**\n * Default async iteration function. Returns an AsyncGenerator that\n * iterates over the results.\n */\n iterate(): AsyncGenerator, void, void> {\n return this.stream()[Symbol.asyncIterator]()\n }\n [Symbol.asyncIterator]() {\n return this.iterate()\n }\n}\n"]} \ No newline at end of file diff --git a/deps/npm/node_modules/glob/dist/mjs/glob.d.ts.map b/deps/npm/node_modules/glob/dist/mjs/glob.d.ts.map index e5423682233478..b06e4633443c87 100644 --- a/deps/npm/node_modules/glob/dist/mjs/glob.d.ts.map +++ b/deps/npm/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C,OAAO,CAAC,IAAI,CAAC,CAAC;IAmBpC;;OAEG;IACH,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAezB;;OAEG;IACH,MAAM,IAAI,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;IAa9C;;OAEG;IACH,UAAU,IAAI,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;IAalD;;;OAGG;IACH,WAAW,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC;IAGlD,CAAC,MAAM,CAAC,QAAQ,CAAC;IAIjB;;;OAGG;IACH,OAAO,IAAI,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC;IAGnD,CAAC,MAAM,CAAC,aAAa,CAAC;CAGvB"} \ No newline at end of file diff --git a/deps/npm/node_modules/glob/dist/mjs/glob.js b/deps/npm/node_modules/glob/dist/mjs/glob.js index a246019cd35f95..f158065746e586 100644 --- a/deps/npm/node_modules/glob/dist/mjs/glob.js +++ b/deps/npm/node_modules/glob/dist/mjs/glob.js @@ -127,6 +127,11 @@ export class Glob { }); } this.nocase = this.scurry.nocase; + // If you do nocase:true on a case-sensitive file system, then + // we need to use regexps instead of strings for non-magic + // path portions, because statting `aBc` won't return results + // for the file `AbC` for example. + const nocaseMagicOnly = this.platform === 'darwin' || this.platform === 'win32'; const mmo = { // default nocase based on platform ...opts, @@ -134,7 +139,7 @@ export class Glob { matchBase: this.matchBase, nobrace: this.nobrace, nocase: this.nocase, - nocaseMagicOnly: true, + nocaseMagicOnly, nocomment: true, noext: this.noext, nonegate: true, diff --git a/deps/npm/node_modules/glob/dist/mjs/glob.js.map b/deps/npm/node_modules/glob/dist/mjs/glob.js.map index 8917735ad9296f..93eb61df16f5ca 100644 --- a/deps/npm/node_modules/glob/dist/mjs/glob.js.map +++ b/de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,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE;gBACzC,CAAC,CAAC,QAAQ;YACd,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,MAAM,EAAE,IAAI,CAAC,MAAM;SACpB,CAAC,CAAC,UAAU,EAAE,CAAA;IACjB,CAAC;IAED;;;OAGG;IACH,WAAW;QACT,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAA;IAC7C,CAAC;IACD,CAAC,MAAM,CAAC,QAAQ,CAAC;QACf,OAAO,IAAI,CAAC,WAAW,EAAE,CAAA;IAC3B,CAAC;IAED;;;OAGG;IACH,OAAO;QACL,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAA;IAC9C,CAAC;IACD,CAAC,MAAM,CAAC,aAAa,CAAC;QACpB,OAAO,IAAI,CAAC,OAAO,EAAE,CAAA;IACvB,CAAC;CACF","sourcesContent":["import { Minimatch, MinimatchOptions } from 'minimatch'\nimport { Minipass } from 'minipass'\nimport {\n FSOption,\n Path,\n PathScurry,\n PathScurryDarwin,\n PathScurryPosix,\n PathScurryWin32,\n} from 'path-scurry'\nimport { fileURLToPath } from 'url'\nimport { IgnoreLike } from './ignore.js'\nimport { Pattern } from './pattern.js'\nimport { GlobStream, GlobWalker } from './walker.js'\n\nexport type MatchSet = Minimatch['set']\nexport type GlobParts = Exclude\n\n// if no process global, just call it linux.\n// so we default to case-sensitive, / separators\nconst defaultPlatform: NodeJS.Platform =\n typeof process === 'object' &&\n process &&\n typeof process.platform === 'string'\n ? process.platform\n : 'linux'\n\n/**\n * A `GlobOptions` object may be provided to any of the exported methods, and\n * must be provided to the `Glob` constructor.\n *\n * All options are optional, boolean, and false by default, unless otherwise\n * noted.\n *\n * All resolved options are added to the Glob object as properties.\n *\n * If you are running many `glob` operations, you can pass a Glob object as the\n * `options` argument to a subsequent operation to share the previously loaded\n * cache.\n */\nexport interface GlobOptions {\n /**\n * Set to `true` to always receive absolute paths for\n * matched files. Set to `false` to always return relative paths.\n *\n * When this option is not set, absolute paths are returned for patterns\n * that are absolute, and otherwise paths are returned that are relative\n * to the `cwd` setting.\n *\n * This does _not_ make an extra system call to get\n * the realpath, it only does string path resolution.\n *\n * Conflicts with {@link withFileTypes}\n */\n absolute?: boolean\n\n /**\n * Set to false to enable {@link windowsPathsNoEscape}\n *\n * @deprecated\n */\n allowWindowsEscape?: boolean\n\n /**\n * The current working directory in which to search. Defaults to\n * `process.cwd()`.\n *\n * May be eiher a string path or a `file://` URL object or string.\n */\n cwd?: string | URL\n\n /**\n * Include `.dot` files in normal matches and `globstar`\n * matches. Note that an explicit dot in a portion of the pattern\n * will always match dot files.\n */\n dot?: boolean\n\n /**\n * Prepend all relative path strings with `./` (or `.\\` on Windows).\n *\n * Without this option, returned relative paths are \"bare\", so instead of\n * returning `'./foo/bar'`, they are returned as `'foo/bar'`.\n *\n * Relative patterns starting with `'../'` are not prepended with `./`, even\n * if this option is set.\n */\n dotRelative?: boolean\n\n /**\n * Follow symlinked directories when expanding `**`\n * patterns. This can result in a lot of duplicate references in\n * the presence of cyclic links, and make performance quite bad.\n *\n * By default, a `**` in a pattern will follow 1 symbolic link if\n * it is not the first item in the pattern, or none if it is the\n * first item in the pattern, following the same behavior as Bash.\n */\n follow?: boolean\n\n /**\n * string or string[], or an object with `ignore` and `ignoreChildren`\n * methods.\n *\n * If a string or string[] is provided, then this is treated as a glob\n * pattern or array of glob patterns to exclude from matches. To ignore all\n * children within a directory, as well as the entry itself, append `'/**'`\n * to the ignore pattern.\n *\n * **Note** `ignore` patterns are _always_ in `dot:true` mode, regardless of\n * any other settings.\n *\n * If an object is provided that has `ignored(path)` and/or\n * `childrenIgnored(path)` methods, then these methods will be called to\n * determine whether any Path is a match or if its children should be\n * traversed, respectively.\n */\n ignore?: string | string[] | IgnoreLike\n\n /**\n * Treat brace expansion like `{a,b}` as a \"magic\" pattern. Has no\n * effect if {@link nobrace} is set.\n *\n * Only has effect on the {@link hasMagic} function.\n */\n magicalBraces?: boolean\n\n /**\n * Add a `/` character to directory matches. Note that this requires\n * additional stat calls in some cases.\n */\n mark?: boolean\n\n /**\n * Perform a basename-only match if the pattern does not contain any slash\n * characters. That is, `*.js` would be treated as equivalent to\n * `**\\/*.js`, matching all js files in all directories.\n */\n matchBase?: boolean\n\n /**\n * Limit the directory traversal to a given depth below the cwd.\n * Note that this does NOT prevent traversal to sibling folders,\n * root patterns, and so on. It only limits the maximum folder depth\n * that the walk will descend, relative to the cwd.\n */\n maxDepth?: number\n\n /**\n * Do not expand `{a,b}` and `{1..3}` brace sets.\n */\n nobrace?: boolean\n\n /**\n * Perform a case-insensitive match. This defaults to `true` on macOS and\n * Windows systems, and `false` on all others.\n *\n * **Note** `nocase` should only be explicitly set when it is\n * known that the filesystem's case sensitivity differs from the\n * platform default. If set `true` on case-sensitive file\n * systems, or `false` on case-insensitive file systems, then the\n * walk may return more or less results than expected.\n */\n nocase?: boolean\n\n /**\n * Do not match directories, only files. (Note: to match\n * _only_ directories, put a `/` at the end of the pattern.)\n */\n nodir?: boolean\n\n /**\n * Do not match \"extglob\" patterns such as `+(a|b)`.\n */\n noext?: boolean\n\n /**\n * Do not match `**` against multiple filenames. (Ie, treat it as a normal\n * `*` instead.)\n *\n * Conflicts with {@link matchBase}\n */\n noglobstar?: boolean\n\n /**\n * Defaults to value of `process.platform` if available, or `'linux'` if\n * not. Setting `platform:'win32'` on non-Windows systems may cause strange\n * behavior.\n */\n platform?: NodeJS.Platform\n\n /**\n * Set to true to call `fs.realpath` on all of the\n * results. In the case of an entry that cannot be resolved, the\n * entry is omitted. This incurs a slight performance penalty, of\n * course, because of the added system calls.\n */\n realpath?: boolean\n\n /**\n *\n * A string path resolved against the `cwd` option, which\n * is used as the starting point for absolute patterns that start\n * with `/`, (but not drive letters or UNC paths on Windows).\n *\n * Note that this _doesn't_ necessarily limit the walk to the\n * `root` directory, and doesn't affect the cwd starting point for\n * non-absolute patterns. A pattern containing `..` will still be\n * able to traverse out of the root directory, if it is not an\n * actual root directory on the filesystem, and any non-absolute\n * patterns will be matched in the `cwd`. For example, the\n * pattern `/../*` with `{root:'/some/path'}` will return all\n * files in `/some`, not all files in `/some/path`. The pattern\n * `*` with `{root:'/some/path'}` will return all the entries in\n * the cwd, not the entries in `/some/path`.\n *\n * To start absolute and non-absolute patterns in the same\n * path, you can use `{root:''}`. However, be aware that on\n * Windows systems, a pattern like `x:/*` or `//host/share/*` will\n * _always_ start in the `x:/` or `//host/share` directory,\n * regardless of the `root` setting.\n */\n root?: string\n\n /**\n * A [PathScurry](http://npm.im/path-scurry) object used\n * to traverse the file system. If the `nocase` option is set\n * explicitly, then any provided `scurry` object must match this\n * setting.\n */\n scurry?: PathScurry\n\n /**\n * Call `lstat()` on all entries, whether required or not to determine\n * if it's a valid match. When used with {@link withFileTypes}, this means\n * that matches will include data such as modified time, permissions, and\n * so on. Note that this will incur a performance cost due to the added\n * system calls.\n */\n stat?: boolean\n\n /**\n * An AbortSignal which will cancel the Glob walk when\n * triggered.\n */\n signal?: AbortSignal\n\n /**\n * Use `\\\\` as a path separator _only_, and\n * _never_ as an escape character. If set, all `\\\\` characters are\n * replaced with `/` in the pattern.\n *\n * Note that this makes it **impossible** to match against paths\n * containing literal glob pattern characters, but allows matching\n * with patterns constructed using `path.join()` and\n * `path.resolve()` on Windows platforms, mimicking the (buggy!)\n * behavior of Glob v7 and before on Windows. Please use with\n * caution, and be mindful of [the caveat below about Windows\n * paths](#windows). (For legacy reasons, this is also set if\n * `allowWindowsEscape` is set to the exact value `false`.)\n */\n windowsPathsNoEscape?: boolean\n\n /**\n * Return [PathScurry](http://npm.im/path-scurry)\n * `Path` objects instead of strings. These are similar to a\n * NodeJS `Dirent` object, but with additional methods and\n * properties.\n *\n * Conflicts with {@link absolute}\n */\n withFileTypes?: boolean\n\n /**\n * An fs implementation to override some or all of the defaults. See\n * http://npm.im/path-scurry for details about what can be overridden.\n */\n fs?: FSOption\n\n /**\n * Just passed along to Minimatch. Note that this makes all pattern\n * matching operations slower and *extremely* noisy.\n */\n debug?: boolean\n\n /**\n * Return `/` delimited paths, even on Windows.\n *\n * On posix systems, this has no effect. But, on Windows, it means that\n * paths will be `/` delimited, and absolute paths will be their full\n * resolved UNC forms, eg instead of `'C:\\\\foo\\\\bar'`, it would return\n * `'//?/C:/foo/bar'`\n */\n posix?: boolean\n}\n\nexport type GlobOptionsWithFileTypesTrue = GlobOptions & {\n withFileTypes: true\n // string options not relevant if returning Path objects.\n absolute?: undefined\n mark?: undefined\n posix?: undefined\n}\n\nexport type GlobOptionsWithFileTypesFalse = GlobOptions & {\n withFileTypes?: false\n}\n\nexport type GlobOptionsWithFileTypesUnset = GlobOptions & {\n withFileTypes?: undefined\n}\n\nexport type Result = Opts extends GlobOptionsWithFileTypesTrue\n ? Path\n : Opts extends GlobOptionsWithFileTypesFalse\n ? string\n : Opts extends GlobOptionsWithFileTypesUnset\n ? string\n : string | Path\nexport type Results = Result[]\n\nexport type FileTypes = Opts extends GlobOptionsWithFileTypesTrue\n ? true\n : Opts extends GlobOptionsWithFileTypesFalse\n ? false\n : Opts extends GlobOptionsWithFileTypesUnset\n ? false\n : boolean\n\n/**\n * An object that can perform glob pattern traversals.\n */\nexport class Glob implements GlobOptions {\n absolute?: boolean\n cwd: string\n root?: string\n dot: boolean\n dotRelative: boolean\n follow: boolean\n ignore?: string | string[] | IgnoreLike\n magicalBraces: boolean\n mark?: boolean\n matchBase: boolean\n maxDepth: number\n nobrace: boolean\n nocase: boolean\n nodir: boolean\n noext: boolean\n noglobstar: boolean\n pattern: string[]\n platform: NodeJS.Platform\n realpath: boolean\n scurry: PathScurry\n stat: boolean\n signal?: AbortSignal\n windowsPathsNoEscape: boolean\n withFileTypes: FileTypes\n\n /**\n * The options provided to the constructor.\n */\n opts: Opts\n\n /**\n * An array of parsed immutable {@link Pattern} objects.\n */\n patterns: Pattern[]\n\n /**\n * All options are stored as properties on the `Glob` object.\n *\n * See {@link GlobOptions} for full options descriptions.\n *\n * Note that a previous `Glob` object can be passed as the\n * `GlobOptions` to another `Glob` instantiation to re-use settings\n * and caches with a new pattern.\n *\n * Traversal functions can be called multiple times to run the walk\n * again.\n */\n constructor(pattern: string | string[], opts: Opts) {\n this.withFileTypes = !!opts.withFileTypes as FileTypes\n this.signal = opts.signal\n this.follow = !!opts.follow\n this.dot = !!opts.dot\n this.dotRelative = !!opts.dotRelative\n this.nodir = !!opts.nodir\n this.mark = !!opts.mark\n if (!opts.cwd) {\n this.cwd = ''\n } else if (opts.cwd instanceof URL || opts.cwd.startsWith('file://')) {\n opts.cwd = fileURLToPath(opts.cwd)\n }\n this.cwd = opts.cwd || ''\n this.root = opts.root\n this.magicalBraces = !!opts.magicalBraces\n this.nobrace = !!opts.nobrace\n this.noext = !!opts.noext\n this.realpath = !!opts.realpath\n this.absolute = opts.absolute\n\n this.noglobstar = !!opts.noglobstar\n this.matchBase = !!opts.matchBase\n this.maxDepth =\n typeof opts.maxDepth === 'number' ? opts.maxDepth : Infinity\n this.stat = !!opts.stat\n this.ignore = opts.ignore\n\n if (this.withFileTypes && this.absolute !== undefined) {\n throw new Error('cannot set absolute and withFileTypes:true')\n }\n\n if (typeof pattern === 'string') {\n pattern = [pattern]\n }\n\n this.windowsPathsNoEscape =\n !!opts.windowsPathsNoEscape ||\n (opts as GlobOptions).allowWindowsEscape === false\n\n if (this.windowsPathsNoEscape) {\n pattern = pattern.map(p => p.replace(/\\\\/g, '/'))\n }\n\n if (this.matchBase) {\n if (opts.noglobstar) {\n throw new TypeError('base matching requires globstar')\n }\n pattern = pattern.map(p => (p.includes('/') ? p : `./**/${p}`))\n }\n\n this.pattern = pattern\n\n this.platform = opts.platform || defaultPlatform\n this.opts = { ...opts, platform: this.platform }\n if (opts.scurry) {\n this.scurry = opts.scurry\n if (\n opts.nocase !== undefined &&\n opts.nocase !== opts.scurry.nocase\n ) {\n throw new Error('nocase option contradicts provided scurry option')\n }\n } else {\n const Scurry =\n opts.platform === 'win32'\n ? PathScurryWin32\n : opts.platform === 'darwin'\n ? PathScurryDarwin\n : opts.platform\n ? PathScurryPosix\n : PathScurry\n this.scurry = new Scurry(this.cwd, {\n nocase: opts.nocase,\n fs: opts.fs,\n })\n }\n this.nocase = this.scurry.nocase\n\n const mmo: MinimatchOptions = {\n // default nocase based on platform\n ...opts,\n dot: this.dot,\n matchBase: this.matchBase,\n nobrace: this.nobrace,\n nocase: this.nocase,\n nocaseMagicOnly: true,\n nocomment: true,\n noext: this.noext,\n nonegate: true,\n optimizationLevel: 2,\n platform: this.platform,\n windowsPathsNoEscape: this.windowsPathsNoEscape,\n debug: !!this.opts.debug,\n }\n\n const mms = this.pattern.map(p => new Minimatch(p, mmo))\n const [matchSet, globParts] = mms.reduce(\n (set: [MatchSet, GlobParts], m) => {\n set[0].push(...m.set)\n set[1].push(...m.globParts)\n return set\n },\n [[], []]\n )\n this.patterns = matchSet.map((set, i) => {\n return new Pattern(set, globParts[i], 0, this.platform)\n })\n }\n\n /**\n * Returns a Promise that resolves to the results array.\n */\n async walk(): Promise>\n async walk(): Promise<(string | Path)[]> {\n // Walkers always return array of Path objects, so we just have to\n // coerce them into the right shape. It will have already called\n // realpath() if the option was set to do so, so we know that's cached.\n // start out knowing the cwd, at least\n return [\n ...(await new GlobWalker(this.patterns, this.scurry.cwd, {\n ...this.opts,\n maxDepth:\n this.maxDepth !== Infinity\n ? this.maxDepth + this.scurry.cwd.depth()\n : Infinity,\n platform: this.platform,\n nocase: this.nocase,\n }).walk()),\n ]\n }\n\n /**\n * synchronous {@link Glob.walk}\n */\n walkSync(): Results\n walkSync(): (string | Path)[] {\n return [\n ...new GlobWalker(this.patterns, this.scurry.cwd, {\n ...this.opts,\n maxDepth:\n this.maxDepth !== Infinity\n ? this.maxDepth + this.scurry.cwd.depth()\n : Infinity,\n platform: this.platform,\n nocase: this.nocase,\n }).walkSync(),\n ]\n }\n\n /**\n * Stream results asynchronously.\n */\n stream(): Minipass, Result>\n stream(): Minipass {\n return new GlobStream(this.patterns, this.scurry.cwd, {\n ...this.opts,\n maxDepth:\n this.maxDepth !== Infinity\n ? this.maxDepth + this.scurry.cwd.depth()\n : Infinity,\n platform: this.platform,\n nocase: this.nocase,\n }).stream()\n }\n\n /**\n * Stream results synchronously.\n */\n streamSync(): Minipass, Result>\n streamSync(): Minipass {\n return new GlobStream(this.patterns, this.scurry.cwd, {\n ...this.opts,\n maxDepth:\n this.maxDepth !== Infinity\n ? this.maxDepth + this.scurry.cwd.depth()\n : Infinity,\n platform: this.platform,\n nocase: this.nocase,\n }).streamSync()\n }\n\n /**\n * Default sync iteration function. Returns a Generator that\n * iterates over the results.\n */\n iterateSync(): Generator, void, void> {\n return this.streamSync()[Symbol.iterator]()\n }\n [Symbol.iterator]() {\n return this.iterateSync()\n }\n\n /**\n * Default async iteration function. Returns an AsyncGenerator that\n * iterates over the results.\n */\n iterate(): AsyncGenerator, void, void> {\n return this.stream()[Symbol.asyncIterator]()\n }\n [Symbol.asyncIterator]() {\n return this.iterate()\n }\n}\n"]} \ No newline at end of file +{"version":3,"file":"glob.js","sourceRoot":"","sources":["../../src/glob.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAoB,MAAM,WAAW,CAAA;AAEvD,OAAO,EAGL,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,eAAe,GAChB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAA;AAEnC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAKpD,4CAA4C;AAC5C,gDAAgD;AAChD,MAAM,eAAe,GACnB,OAAO,OAAO,KAAK,QAAQ;IAC3B,OAAO;IACP,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ;IAClC,CAAC,CAAC,OAAO,CAAC,QAAQ;IAClB,CAAC,CAAC,OAAO,C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,IAAI,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAA;IAC9C,CAAC;IACD,CAAC,MAAM,CAAC,aAAa,CAAC;QACpB,OAAO,IAAI,CAAC,OAAO,EAAE,CAAA;IACvB,CAAC;CACF","sourcesContent":["import { Minimatch, MinimatchOptions } from 'minimatch'\nimport { Minipass } from 'minipass'\nimport {\n FSOption,\n Path,\n PathScurry,\n PathScurryDarwin,\n PathScurryPosix,\n PathScurryWin32,\n} from 'path-scurry'\nimport { fileURLToPath } from 'url'\nimport { IgnoreLike } from './ignore.js'\nimport { Pattern } from './pattern.js'\nimport { GlobStream, GlobWalker } from './walker.js'\n\nexport type MatchSet = Minimatch['set']\nexport type GlobParts = Exclude\n\n// if no process global, just call it linux.\n// so we default to case-sensitive, / separators\nconst defaultPlatform: NodeJS.Platform =\n typeof process === 'object' &&\n process &&\n typeof process.platform === 'string'\n ? process.platform\n : 'linux'\n\n/**\n * A `GlobOptions` object may be provided to any of the exported methods, and\n * must be provided to the `Glob` constructor.\n *\n * All options are optional, boolean, and false by default, unless otherwise\n * noted.\n *\n * All resolved options are added to the Glob object as properties.\n *\n * If you are running many `glob` operations, you can pass a Glob object as the\n * `options` argument to a subsequent operation to share the previously loaded\n * cache.\n */\nexport interface GlobOptions {\n /**\n * Set to `true` to always receive absolute paths for\n * matched files. Set to `false` to always return relative paths.\n *\n * When this option is not set, absolute paths are returned for patterns\n * that are absolute, and otherwise paths are returned that are relative\n * to the `cwd` setting.\n *\n * This does _not_ make an extra system call to get\n * the realpath, it only does string path resolution.\n *\n * Conflicts with {@link withFileTypes}\n */\n absolute?: boolean\n\n /**\n * Set to false to enable {@link windowsPathsNoEscape}\n *\n * @deprecated\n */\n allowWindowsEscape?: boolean\n\n /**\n * The current working directory in which to search. Defaults to\n * `process.cwd()`.\n *\n * May be eiher a string path or a `file://` URL object or string.\n */\n cwd?: string | URL\n\n /**\n * Include `.dot` files in normal matches and `globstar`\n * matches. Note that an explicit dot in a portion of the pattern\n * will always match dot files.\n */\n dot?: boolean\n\n /**\n * Prepend all relative path strings with `./` (or `.\\` on Windows).\n *\n * Without this option, returned relative paths are \"bare\", so instead of\n * returning `'./foo/bar'`, they are returned as `'foo/bar'`.\n *\n * Relative patterns starting with `'../'` are not prepended with `./`, even\n * if this option is set.\n */\n dotRelative?: boolean\n\n /**\n * Follow symlinked directories when expanding `**`\n * patterns. This can result in a lot of duplicate references in\n * the presence of cyclic links, and make performance quite bad.\n *\n * By default, a `**` in a pattern will follow 1 symbolic link if\n * it is not the first item in the pattern, or none if it is the\n * first item in the pattern, following the same behavior as Bash.\n */\n follow?: boolean\n\n /**\n * string or string[], or an object with `ignore` and `ignoreChildren`\n * methods.\n *\n * If a string or string[] is provided, then this is treated as a glob\n * pattern or array of glob patterns to exclude from matches. To ignore all\n * children within a directory, as well as the entry itself, append `'/**'`\n * to the ignore pattern.\n *\n * **Note** `ignore` patterns are _always_ in `dot:true` mode, regardless of\n * any other settings.\n *\n * If an object is provided that has `ignored(path)` and/or\n * `childrenIgnored(path)` methods, then these methods will be called to\n * determine whether any Path is a match or if its children should be\n * traversed, respectively.\n */\n ignore?: string | string[] | IgnoreLike\n\n /**\n * Treat brace expansion like `{a,b}` as a \"magic\" pattern. Has no\n * effect if {@link nobrace} is set.\n *\n * Only has effect on the {@link hasMagic} function.\n */\n magicalBraces?: boolean\n\n /**\n * Add a `/` character to directory matches. Note that this requires\n * additional stat calls in some cases.\n */\n mark?: boolean\n\n /**\n * Perform a basename-only match if the pattern does not contain any slash\n * characters. That is, `*.js` would be treated as equivalent to\n * `**\\/*.js`, matching all js files in all directories.\n */\n matchBase?: boolean\n\n /**\n * Limit the directory traversal to a given depth below the cwd.\n * Note that this does NOT prevent traversal to sibling folders,\n * root patterns, and so on. It only limits the maximum folder depth\n * that the walk will descend, relative to the cwd.\n */\n maxDepth?: number\n\n /**\n * Do not expand `{a,b}` and `{1..3}` brace sets.\n */\n nobrace?: boolean\n\n /**\n * Perform a case-insensitive match. This defaults to `true` on macOS and\n * Windows systems, and `false` on all others.\n *\n * **Note** `nocase` should only be explicitly set when it is\n * known that the filesystem's case sensitivity differs from the\n * platform default. If set `true` on case-sensitive file\n * systems, or `false` on case-insensitive file systems, then the\n * walk may return more or less results than expected.\n */\n nocase?: boolean\n\n /**\n * Do not match directories, only files. (Note: to match\n * _only_ directories, put a `/` at the end of the pattern.)\n */\n nodir?: boolean\n\n /**\n * Do not match \"extglob\" patterns such as `+(a|b)`.\n */\n noext?: boolean\n\n /**\n * Do not match `**` against multiple filenames. (Ie, treat it as a normal\n * `*` instead.)\n *\n * Conflicts with {@link matchBase}\n */\n noglobstar?: boolean\n\n /**\n * Defaults to value of `process.platform` if available, or `'linux'` if\n * not. Setting `platform:'win32'` on non-Windows systems may cause strange\n * behavior.\n */\n platform?: NodeJS.Platform\n\n /**\n * Set to true to call `fs.realpath` on all of the\n * results. In the case of an entry that cannot be resolved, the\n * entry is omitted. This incurs a slight performance penalty, of\n * course, because of the added system calls.\n */\n realpath?: boolean\n\n /**\n *\n * A string path resolved against the `cwd` option, which\n * is used as the starting point for absolute patterns that start\n * with `/`, (but not drive letters or UNC paths on Windows).\n *\n * Note that this _doesn't_ necessarily limit the walk to the\n * `root` directory, and doesn't affect the cwd starting point for\n * non-absolute patterns. A pattern containing `..` will still be\n * able to traverse out of the root directory, if it is not an\n * actual root directory on the filesystem, and any non-absolute\n * patterns will be matched in the `cwd`. For example, the\n * pattern `/../*` with `{root:'/some/path'}` will return all\n * files in `/some`, not all files in `/some/path`. The pattern\n * `*` with `{root:'/some/path'}` will return all the entries in\n * the cwd, not the entries in `/some/path`.\n *\n * To start absolute and non-absolute patterns in the same\n * path, you can use `{root:''}`. However, be aware that on\n * Windows systems, a pattern like `x:/*` or `//host/share/*` will\n * _always_ start in the `x:/` or `//host/share` directory,\n * regardless of the `root` setting.\n */\n root?: string\n\n /**\n * A [PathScurry](http://npm.im/path-scurry) object used\n * to traverse the file system. If the `nocase` option is set\n * explicitly, then any provided `scurry` object must match this\n * setting.\n */\n scurry?: PathScurry\n\n /**\n * Call `lstat()` on all entries, whether required or not to determine\n * if it's a valid match. When used with {@link withFileTypes}, this means\n * that matches will include data such as modified time, permissions, and\n * so on. Note that this will incur a performance cost due to the added\n * system calls.\n */\n stat?: boolean\n\n /**\n * An AbortSignal which will cancel the Glob walk when\n * triggered.\n */\n signal?: AbortSignal\n\n /**\n * Use `\\\\` as a path separator _only_, and\n * _never_ as an escape character. If set, all `\\\\` characters are\n * replaced with `/` in the pattern.\n *\n * Note that this makes it **impossible** to match against paths\n * containing literal glob pattern characters, but allows matching\n * with patterns constructed using `path.join()` and\n * `path.resolve()` on Windows platforms, mimicking the (buggy!)\n * behavior of Glob v7 and before on Windows. Please use with\n * caution, and be mindful of [the caveat below about Windows\n * paths](#windows). (For legacy reasons, this is also set if\n * `allowWindowsEscape` is set to the exact value `false`.)\n */\n windowsPathsNoEscape?: boolean\n\n /**\n * Return [PathScurry](http://npm.im/path-scurry)\n * `Path` objects instead of strings. These are similar to a\n * NodeJS `Dirent` object, but with additional methods and\n * properties.\n *\n * Conflicts with {@link absolute}\n */\n withFileTypes?: boolean\n\n /**\n * An fs implementation to override some or all of the defaults. See\n * http://npm.im/path-scurry for details about what can be overridden.\n */\n fs?: FSOption\n\n /**\n * Just passed along to Minimatch. Note that this makes all pattern\n * matching operations slower and *extremely* noisy.\n */\n debug?: boolean\n\n /**\n * Return `/` delimited paths, even on Windows.\n *\n * On posix systems, this has no effect. But, on Windows, it means that\n * paths will be `/` delimited, and absolute paths will be their full\n * resolved UNC forms, eg instead of `'C:\\\\foo\\\\bar'`, it would return\n * `'//?/C:/foo/bar'`\n */\n posix?: boolean\n}\n\nexport type GlobOptionsWithFileTypesTrue = GlobOptions & {\n withFileTypes: true\n // string options not relevant if returning Path objects.\n absolute?: undefined\n mark?: undefined\n posix?: undefined\n}\n\nexport type GlobOptionsWithFileTypesFalse = GlobOptions & {\n withFileTypes?: false\n}\n\nexport type GlobOptionsWithFileTypesUnset = GlobOptions & {\n withFileTypes?: undefined\n}\n\nexport type Result = Opts extends GlobOptionsWithFileTypesTrue\n ? Path\n : Opts extends GlobOptionsWithFileTypesFalse\n ? string\n : Opts extends GlobOptionsWithFileTypesUnset\n ? string\n : string | Path\nexport type Results = Result[]\n\nexport type FileTypes = Opts extends GlobOptionsWithFileTypesTrue\n ? true\n : Opts extends GlobOptionsWithFileTypesFalse\n ? false\n : Opts extends GlobOptionsWithFileTypesUnset\n ? false\n : boolean\n\n/**\n * An object that can perform glob pattern traversals.\n */\nexport class Glob implements GlobOptions {\n absolute?: boolean\n cwd: string\n root?: string\n dot: boolean\n dotRelative: boolean\n follow: boolean\n ignore?: string | string[] | IgnoreLike\n magicalBraces: boolean\n mark?: boolean\n matchBase: boolean\n maxDepth: number\n nobrace: boolean\n nocase: boolean\n nodir: boolean\n noext: boolean\n noglobstar: boolean\n pattern: string[]\n platform: NodeJS.Platform\n realpath: boolean\n scurry: PathScurry\n stat: boolean\n signal?: AbortSignal\n windowsPathsNoEscape: boolean\n withFileTypes: FileTypes\n\n /**\n * The options provided to the constructor.\n */\n opts: Opts\n\n /**\n * An array of parsed immutable {@link Pattern} objects.\n */\n patterns: Pattern[]\n\n /**\n * All options are stored as properties on the `Glob` object.\n *\n * See {@link GlobOptions} for full options descriptions.\n *\n * Note that a previous `Glob` object can be passed as the\n * `GlobOptions` to another `Glob` instantiation to re-use settings\n * and caches with a new pattern.\n *\n * Traversal functions can be called multiple times to run the walk\n * again.\n */\n constructor(pattern: string | string[], opts: Opts) {\n this.withFileTypes = !!opts.withFileTypes as FileTypes\n this.signal = opts.signal\n this.follow = !!opts.follow\n this.dot = !!opts.dot\n this.dotRelative = !!opts.dotRelative\n this.nodir = !!opts.nodir\n this.mark = !!opts.mark\n if (!opts.cwd) {\n this.cwd = ''\n } else if (opts.cwd instanceof URL || opts.cwd.startsWith('file://')) {\n opts.cwd = fileURLToPath(opts.cwd)\n }\n this.cwd = opts.cwd || ''\n this.root = opts.root\n this.magicalBraces = !!opts.magicalBraces\n this.nobrace = !!opts.nobrace\n this.noext = !!opts.noext\n this.realpath = !!opts.realpath\n this.absolute = opts.absolute\n\n this.noglobstar = !!opts.noglobstar\n this.matchBase = !!opts.matchBase\n this.maxDepth =\n typeof opts.maxDepth === 'number' ? opts.maxDepth : Infinity\n this.stat = !!opts.stat\n this.ignore = opts.ignore\n\n if (this.withFileTypes && this.absolute !== undefined) {\n throw new Error('cannot set absolute and withFileTypes:true')\n }\n\n if (typeof pattern === 'string') {\n pattern = [pattern]\n }\n\n this.windowsPathsNoEscape =\n !!opts.windowsPathsNoEscape ||\n (opts as GlobOptions).allowWindowsEscape === false\n\n if (this.windowsPathsNoEscape) {\n pattern = pattern.map(p => p.replace(/\\\\/g, '/'))\n }\n\n if (this.matchBase) {\n if (opts.noglobstar) {\n throw new TypeError('base matching requires globstar')\n }\n pattern = pattern.map(p => (p.includes('/') ? p : `./**/${p}`))\n }\n\n this.pattern = pattern\n\n this.platform = opts.platform || defaultPlatform\n this.opts = { ...opts, platform: this.platform }\n if (opts.scurry) {\n this.scurry = opts.scurry\n if (\n opts.nocase !== undefined &&\n opts.nocase !== opts.scurry.nocase\n ) {\n throw new Error('nocase option contradicts provided scurry option')\n }\n } else {\n const Scurry =\n opts.platform === 'win32'\n ? PathScurryWin32\n : opts.platform === 'darwin'\n ? PathScurryDarwin\n : opts.platform\n ? PathScurryPosix\n : PathScurry\n this.scurry = new Scurry(this.cwd, {\n nocase: opts.nocase,\n fs: opts.fs,\n })\n }\n this.nocase = this.scurry.nocase\n\n // If you do nocase:true on a case-sensitive file system, then\n // we need to use regexps instead of strings for non-magic\n // path portions, because statting `aBc` won't return results\n // for the file `AbC` for example.\n const nocaseMagicOnly =\n this.platform === 'darwin' || this.platform === 'win32'\n\n const mmo: MinimatchOptions = {\n // default nocase based on platform\n ...opts,\n dot: this.dot,\n matchBase: this.matchBase,\n nobrace: this.nobrace,\n nocase: this.nocase,\n nocaseMagicOnly,\n nocomment: true,\n noext: this.noext,\n nonegate: true,\n optimizationLevel: 2,\n platform: this.platform,\n windowsPathsNoEscape: this.windowsPathsNoEscape,\n debug: !!this.opts.debug,\n }\n\n const mms = this.pattern.map(p => new Minimatch(p, mmo))\n const [matchSet, globParts] = mms.reduce(\n (set: [MatchSet, GlobParts], m) => {\n set[0].push(...m.set)\n set[1].push(...m.globParts)\n return set\n },\n [[], []]\n )\n this.patterns = matchSet.map((set, i) => {\n return new Pattern(set, globParts[i], 0, this.platform)\n })\n }\n\n /**\n * Returns a Promise that resolves to the results array.\n */\n async walk(): Promise>\n async walk(): Promise<(string | Path)[]> {\n // Walkers always return array of Path objects, so we just have to\n // coerce them into the right shape. It will have already called\n // realpath() if the option was set to do so, so we know that's cached.\n // start out knowing the cwd, at least\n return [\n ...(await new GlobWalker(this.patterns, this.scurry.cwd, {\n ...this.opts,\n maxDepth:\n this.maxDepth !== Infinity\n ? this.maxDepth + this.scurry.cwd.depth()\n : Infinity,\n platform: this.platform,\n nocase: this.nocase,\n }).walk()),\n ]\n }\n\n /**\n * synchronous {@link Glob.walk}\n */\n walkSync(): Results\n walkSync(): (string | Path)[] {\n return [\n ...new GlobWalker(this.patterns, this.scurry.cwd, {\n ...this.opts,\n maxDepth:\n this.maxDepth !== Infinity\n ? this.maxDepth + this.scurry.cwd.depth()\n : Infinity,\n platform: this.platform,\n nocase: this.nocase,\n }).walkSync(),\n ]\n }\n\n /**\n * Stream results asynchronously.\n */\n stream(): Minipass, Result>\n stream(): Minipass {\n return new GlobStream(this.patterns, this.scurry.cwd, {\n ...this.opts,\n maxDepth:\n this.maxDepth !== Infinity\n ? this.maxDepth + this.scurry.cwd.depth()\n : Infinity,\n platform: this.platform,\n nocase: this.nocase,\n }).stream()\n }\n\n /**\n * Stream results synchronously.\n */\n streamSync(): Minipass, Result>\n streamSync(): Minipass {\n return new GlobStream(this.patterns, this.scurry.cwd, {\n ...this.opts,\n maxDepth:\n this.maxDepth !== Infinity\n ? this.maxDepth + this.scurry.cwd.depth()\n : Infinity,\n platform: this.platform,\n nocase: this.nocase,\n }).streamSync()\n }\n\n /**\n * Default sync iteration function. Returns a Generator that\n * iterates over the results.\n */\n iterateSync(): Generator, void, void> {\n return this.streamSync()[Symbol.iterator]()\n }\n [Symbol.iterator]() {\n return this.iterateSync()\n }\n\n /**\n * Default async iteration function. Returns an AsyncGenerator that\n * iterates over the results.\n */\n iterate(): AsyncGenerator, void, void> {\n return this.stream()[Symbol.asyncIterator]()\n }\n [Symbol.asyncIterator]() {\n return this.iterate()\n }\n}\n"]} \ No newline at end of file diff --git a/deps/npm/node_modules/glob/dist/mjs/package.json b/deps/npm/node_modules/glob/dist/mjs/package.json index ff3441b45957b2..e066bfabfb543c 100644 --- a/deps/npm/node_modules/glob/dist/mjs/package.json +++ b/deps/npm/node_modules/glob/dist/mjs/package.json @@ -1,4 +1,4 @@ { - "version": "10.2.1", + "version": "10.2.3", "type": "module" } diff --git a/deps/npm/node_modules/glob/package.json b/deps/npm/node_modules/glob/package.json index b04d087e28d898..e11e8e33025795 100644 --- a/deps/npm/node_modules/glob/package.json +++ b/deps/npm/node_modules/glob/package.json @@ -2,7 +2,7 @@ "author": "Isaac Z. Schlueter (http://blog.izs.me/)", "name": "glob", "description": "the most correct and second fastest glob implementation in JavaScript", - "version": "10.2.2", + "version": "10.2.4", "bin": "./dist/cjs/src/bin.js", "repository": { "type": "git", @@ -63,7 +63,7 @@ "foreground-child": "^3.1.0", "jackspeak": "^2.0.3", "minimatch": "^9.0.0", - "minipass": "^5.0.0", + "minipass": "^5.0.0 || ^6.0.0", "path-scurry": "^1.7.0" }, "devDependencies": { diff --git a/deps/npm/node_modules/libnpmpublish/lib/publish.js b/deps/npm/node_modules/libnpmpublish/lib/publish.js index 89ca01662cdb57..79c00eb68ad0c8 100644 --- a/deps/npm/node_modules/libnpmpublish/lib/publish.js +++ b/deps/npm/node_modules/libnpmpublish/lib/publish.js @@ -42,15 +42,25 @@ Remove the 'private' field from the package.json to publish it.`), ) } - const metadata = await buildMetadata(reg, pubManifest, tarballData, spec, opts) + const { metadata, transparencyLogUrl } = await buildMetadata( + reg, + pubManifest, + tarballData, + spec, + opts + ) try { - return await npmFetch(spec.escapedName, { + const res = await npmFetch(spec.escapedName, { ...opts, method: 'PUT', body: metadata, ignoreBody: true, }) + if (transparencyLogUrl) { + res.transparencyLogUrl = transparencyLogUrl + } + return res } catch (err) { if (err.code !== 'E409') { throw err @@ -64,12 +74,17 @@ Remove the 'private' field from the package.json to publish it.`), query: { write: true }, }) const newMetadata = patchMetadata(current, metadata) - return npmFetch(spec.escapedName, { + const res = await npmFetch(spec.escapedName, { ...opts, method: 'PUT', body: newMetadata, ignoreBody: true, }) + /* istanbul ignore next */ + if (transparencyLogUrl) { + res.transparencyLogUrl = transparencyLogUrl + } + return res } } @@ -138,6 +153,7 @@ const buildMetadata = async (registry, manifest, tarballData, spec, opts) => { } // Handle case where --provenance flag was set to true + let transparencyLogUrl if (provenance === true) { const subject = { name: npa.toPurl(spec), @@ -161,8 +177,23 @@ const buildMetadata = async (registry, manifest, tarballData, spec, opts) => { ) } - const visibility = - await npmFetch.json(`${registry}/-/package/${spec.escapedName}/visibility`, opts) + // Some registries (e.g. GH packages) require auth to check visibility, + // and always return 404 when no auth is supplied. In this case we assume + // the package is always private and require `--access public` to publish + // with provenance. + let visibility = { public: false } + if (opts.provenance === true && opts.access !== 'public') { + try { + const res = await npmFetch + .json(`${registry}/-/package/${spec.escapedName}/visibility`, opts) + visibility = res + } catch (err) { + if (err.code !== 'E404') { + throw err + } + } + } + if (!visibility.public && opts.provenance === true && opts.access !== 'public') { throw Object.assign( /* eslint-disable-next-line max-len */ @@ -178,8 +209,11 @@ const buildMetadata = async (registry, manifest, tarballData, spec, opts) => { const tlogEntry = provenanceBundle?.verificationMaterial?.tlogEntries[0] /* istanbul ignore else */ if (tlogEntry) { - const logUrl = `${TLOG_BASE_URL}?logIndex=${tlogEntry.logIndex}` - log.notice('publish', `Provenance statement published to transparency log: ${logUrl}`) + transparencyLogUrl = `${TLOG_BASE_URL}?logIndex=${tlogEntry.logIndex}` + log.notice( + 'publish', + `Provenance statement published to transparency log: ${transparencyLogUrl}` + ) } const serializedBundle = JSON.stringify(provenanceBundle) @@ -190,7 +224,10 @@ const buildMetadata = async (registry, manifest, tarballData, spec, opts) => { } } - return root + return { + metadata: root, + transparencyLogUrl, + } } const patchMetadata = (current, newData) => { diff --git a/deps/npm/node_modules/libnpmpublish/package.json b/deps/npm/node_modules/libnpmpublish/package.json index 2034ef85e47390..a4adbe2a50f154 100644 --- a/deps/npm/node_modules/libnpmpublish/package.json +++ b/deps/npm/node_modules/libnpmpublish/package.json @@ -1,6 +1,6 @@ { "name": "libnpmpublish", - "version": "7.1.4", + "version": "7.2.0", "description": "Programmatic API for the bits behind npm publish and unpublish", "author": "GitHub Inc.", "main": "lib/index.js", diff --git a/deps/npm/node_modules/path-scurry/dist/cjs/index.js b/deps/npm/node_modules/path-scurry/dist/cjs/index.js index d209f0e8330492..8044c7e581d2e4 100644 --- a/deps/npm/node_modules/path-scurry/dist/cjs/index.js +++ b/deps/npm/node_modules/path-scurry/dist/cjs/index.js @@ -159,6 +159,7 @@ class ChildrenCache extends lru_cache_1.LRUCache { } } exports.ChildrenCache = ChildrenCache; +const setAsCwd = Symbol('PathScurry setAsCwd'); /** * Path objects are sort of like a super-powered * {@link https://nodejs.org/docs/latest/api/fs.html#class-fsdirent fs.Dirent} @@ -291,6 +292,16 @@ class PathBase { #children; #linkTarget; #realpath; + /** + * This property is for compatibility with the Dirent class as of + * Node v20, where Dirent['path'] refers to the path of the directory + * that was passed to readdir. So, somewhat counterintuitively, this + * property refers to the *parent* path, not the path object itself. + * For root entries, it's the path to the entry itself. + */ + get path() { + return (this.parent || this).fullpath(); + } /** * Do not create new Path objects directly. They should always be accessed * via the PathScurry class or other methods on the Path class. @@ -438,8 +449,7 @@ class PathBase { return (this.#relative = this.name); } const pv = p.relative(); - const rp = pv + (!pv || !p.parent ? '' : this.sep) + name; - return (this.#relative = rp); + return pv + (!pv || !p.parent ? '' : this.sep) + name; } /** * The relative path from the cwd, using / as the path separator. @@ -458,8 +468,7 @@ class PathBase { return (this.#relativePosix = this.fullpathPosix()); } const pv = p.relativePosix(); - const rp = pv + (!pv || !p.parent ? '' : '/') + name; - return (this.#relativePosix = rp); + return pv + (!pv || !p.parent ? '' : '/') + name; } /** * The fully resolved path string for this Path entry @@ -1111,6 +1120,33 @@ class PathBase { this.#markENOREALPATH(); } } + /** + * Internal method to mark this Path object as the scurry cwd, + * called by {@link PathScurry#chdir} + * + * @internal + */ + [setAsCwd](oldCwd) { + if (oldCwd === this) + return; + const changed = new Set([]); + let rp = []; + let p = this; + while (p && p.parent) { + changed.add(p); + p.#relative = rp.join(this.sep); + p.#relativePosix = rp.join('/'); + p = p.parent; + rp.push('..'); + } + // now un-memoize parents of old cwd + p = oldCwd; + while (p && p.parent && !changed.has(p)) { + p.#relative = undefined; + p.#relativePosix = undefined; + p = p.parent; + } + } } exports.PathBase = PathBase; /** @@ -1838,6 +1874,11 @@ class PathScurryBase { process(); return results; } + chdir(path = this.cwd) { + const oldCwd = this.cwd; + this.cwd = typeof path === 'string' ? this.cwd.resolve(path) : path; + this.cwd[setAsCwd](oldCwd); + } } exports.PathScurryBase = PathScurryBase; /** diff --git a/deps/npm/node_modules/path-scurry/dist/mjs/index.js b/deps/npm/node_modules/path-scurry/dist/mjs/index.js index 8490cf73124f3b..957f087c865147 100644 --- a/deps/npm/node_modules/path-scurry/dist/mjs/index.js +++ b/deps/npm/node_modules/path-scurry/dist/mjs/index.js @@ -131,6 +131,7 @@ export class ChildrenCache extends LRUCache { }); } } +const setAsCwd = Symbol('PathScurry setAsCwd'); /** * Path objects are sort of like a super-powered * {@link https://nodejs.org/docs/latest/api/fs.html#class-fsdirent fs.Dirent} @@ -263,6 +264,16 @@ export class PathBase { #children; #linkTarget; #realpath; + /** + * This property is for compatibility with the Dirent class as of + * Node v20, where Dirent['path'] refers to the path of the directory + * that was passed to readdir. So, somewhat counterintuitively, this + * property refers to the *parent* path, not the path object itself. + * For root entries, it's the path to the entry itself. + */ + get path() { + return (this.parent || this).fullpath(); + } /** * Do not create new Path objects directly. They should always be accessed * via the PathScurry class or other methods on the Path class. @@ -410,8 +421,7 @@ export class PathBase { return (this.#relative = this.name); } const pv = p.relative(); - const rp = pv + (!pv || !p.parent ? '' : this.sep) + name; - return (this.#relative = rp); + return pv + (!pv || !p.parent ? '' : this.sep) + name; } /** * The relative path from the cwd, using / as the path separator. @@ -430,8 +440,7 @@ export class PathBase { return (this.#relativePosix = this.fullpathPosix()); } const pv = p.relativePosix(); - const rp = pv + (!pv || !p.parent ? '' : '/') + name; - return (this.#relativePosix = rp); + return pv + (!pv || !p.parent ? '' : '/') + name; } /** * The fully resolved path string for this Path entry @@ -1083,6 +1092,33 @@ export class PathBase { this.#markENOREALPATH(); } } + /** + * Internal method to mark this Path object as the scurry cwd, + * called by {@link PathScurry#chdir} + * + * @internal + */ + [setAsCwd](oldCwd) { + if (oldCwd === this) + return; + const changed = new Set([]); + let rp = []; + let p = this; + while (p && p.parent) { + changed.add(p); + p.#relative = rp.join(this.sep); + p.#relativePosix = rp.join('/'); + p = p.parent; + rp.push('..'); + } + // now un-memoize parents of old cwd + p = oldCwd; + while (p && p.parent && !changed.has(p)) { + p.#relative = undefined; + p.#relativePosix = undefined; + p = p.parent; + } + } } /** * Path class used on win32 systems @@ -1807,6 +1843,11 @@ export class PathScurryBase { process(); return results; } + chdir(path = this.cwd) { + const oldCwd = this.cwd; + this.cwd = typeof path === 'string' ? this.cwd.resolve(path) : path; + this.cwd[setAsCwd](oldCwd); + } } /** * Windows implementation of {@link PathScurryBase} diff --git a/deps/npm/node_modules/path-scurry/package.json b/deps/npm/node_modules/path-scurry/package.json index bb282b966c53c1..677bf1ce9b6e58 100644 --- a/deps/npm/node_modules/path-scurry/package.json +++ b/deps/npm/node_modules/path-scurry/package.json @@ -1,6 +1,6 @@ { "name": "path-scurry", - "version": "1.7.0", + "version": "1.9.1", "description": "walk paths fast and efficiently", "author": "Isaac Z. Schlueter (https://blog.izs.me)", "main": "./dist/cjs/index.js", @@ -58,7 +58,7 @@ }, "devDependencies": { "@nodelib/fs.walk": "^1.2.8", - "@types/node": "^18.11.18", + "@types/node": "^20.1.4", "@types/tap": "^15.0.7", "c8": "^7.12.0", "eslint-config-prettier": "^8.6.0", @@ -81,7 +81,7 @@ "url": "git+https://github.com/isaacs/path-walker" }, "dependencies": { - "lru-cache": "^9.0.0", - "minipass": "^5.0.0" + "lru-cache": "^9.1.1", + "minipass": "^5.0.0 || ^6.0.0" } } diff --git a/deps/npm/node_modules/postcss-selector-parser/API.md b/deps/npm/node_modules/postcss-selector-parser/API.md index 36c7298fc9753c..64459e3376fba3 100644 --- a/deps/npm/node_modules/postcss-selector-parser/API.md +++ b/deps/npm/node_modules/postcss-selector-parser/API.md @@ -278,16 +278,13 @@ if (node.type === 'id') { } ``` -### `node.clone()` +### `node.clone([opts])` Returns a copy of a node, detached from any parent containers that the original might have had. ```js -const cloned = parser.id({value: 'search'}); -String(cloned); - -// => #search +const cloned = node.clone(); ``` ### `node.isAtPosition(line, column)` diff --git a/deps/npm/node_modules/postcss-selector-parser/dist/parser.js b/deps/npm/node_modules/postcss-selector-parser/dist/parser.js index 2a1e72c6c6c009..b4c75e3edc3fe6 100644 --- a/deps/npm/node_modules/postcss-selector-parser/dist/parser.js +++ b/deps/npm/node_modules/postcss-selector-parser/dist/parser.js @@ -609,6 +609,9 @@ var Parser = /*#__PURE__*/function () { _proto.unexpected = function unexpected() { return this.error("Unexpected '" + this.content() + "'. Escaping special characters with \\ may help.", this.currToken[_tokenize.FIELDS.START_POS]); }; + _proto.unexpectedPipe = function unexpectedPipe() { + return this.error("Unexpected '|'.", this.currToken[_tokenize.FIELDS.START_POS]); + }; _proto.namespace = function namespace() { var before = this.prevToken && this.content(this.prevToken) || true; if (this.nextToken[_tokenize.FIELDS.TYPE] === tokens.word) { @@ -618,6 +621,7 @@ var Parser = /*#__PURE__*/function () { this.position++; return this.universal(before); } + this.unexpectedPipe(); }; _proto.nesting = function nesting() { if (this.nextToken) { diff --git a/deps/npm/node_modules/postcss-selector-parser/package.json b/deps/npm/node_modules/postcss-selector-parser/package.json index ff9c40960f737a..dce071cdcb2b3a 100644 --- a/deps/npm/node_modules/postcss-selector-parser/package.json +++ b/deps/npm/node_modules/postcss-selector-parser/package.json @@ -1,6 +1,6 @@ { "name": "postcss-selector-parser", - "version": "6.0.12", + "version": "6.0.13", "devDependencies": { "@babel/cli": "^7.11.6", "@babel/core": "^7.11.6", diff --git a/deps/npm/node_modules/readable-stream/lib/internal/streams/add-abort-signal.js b/deps/npm/node_modules/readable-stream/lib/internal/streams/add-abort-signal.js index c6ba8b9c298f18..3a26a1d3e6d76d 100644 --- a/deps/npm/node_modules/readable-stream/lib/internal/streams/add-abort-signal.js +++ b/deps/npm/node_modules/readable-stream/lib/internal/streams/add-abort-signal.js @@ -1,6 +1,7 @@ 'use strict' const { AbortError, codes } = require('../../ours/errors') +const { isNodeStream, isWebStream, kControllerErrorFunction } = require('./utils') const eos = require('./end-of-stream') const { ERR_INVALID_ARG_TYPE } = codes @@ -12,13 +13,10 @@ const validateAbortSignal = (signal, name) => { throw new ERR_INVALID_ARG_TYPE(name, 'AbortSignal', signal) } } -function isNodeStream(obj) { - return !!(obj && typeof obj.pipe === 'function') -} module.exports.addAbortSignal = function addAbortSignal(signal, stream) { validateAbortSignal(signal, 'signal') - if (!isNodeStream(stream)) { - throw new ERR_INVALID_ARG_TYPE('stream', 'stream.Stream', stream) + if (!isNodeStream(stream) && !isWebStream(stream)) { + throw new ERR_INVALID_ARG_TYPE('stream', ['ReadableStream', 'WritableStream', 'Stream'], stream) } return module.exports.addAbortSignalNoValidate(signal, stream) } @@ -26,13 +24,21 @@ module.exports.addAbortSignalNoValidate = function (signal, stream) { if (typeof signal !== 'object' || !('aborted' in signal)) { return stream } - const onAbort = () => { - stream.destroy( - new AbortError(undefined, { - cause: signal.reason - }) - ) - } + const onAbort = isNodeStream(stream) + ? () => { + stream.destroy( + new AbortError(undefined, { + cause: signal.reason + }) + ) + } + : () => { + stream[kControllerErrorFunction]( + new AbortError(undefined, { + cause: signal.reason + }) + ) + } if (signal.aborted) { onAbort() } else { diff --git a/deps/npm/node_modules/readable-stream/lib/internal/streams/compose.js b/deps/npm/node_modules/readable-stream/lib/internal/streams/compose.js index 4a00aead883c2f..f565c12ef3620c 100644 --- a/deps/npm/node_modules/readable-stream/lib/internal/streams/compose.js +++ b/deps/npm/node_modules/readable-stream/lib/internal/streams/compose.js @@ -3,11 +3,20 @@ const { pipeline } = require('./pipeline') const Duplex = require('./duplex') const { destroyer } = require('./destroy') -const { isNodeStream, isReadable, isWritable } = require('./utils') +const { + isNodeStream, + isReadable, + isWritable, + isWebStream, + isTransformStream, + isWritableStream, + isReadableStream +} = require('./utils') const { AbortError, codes: { ERR_INVALID_ARG_VALUE, ERR_MISSING_ARGS } } = require('../../ours/errors') +const eos = require('./end-of-stream') module.exports = function compose(...streams) { if (streams.length === 0) { throw new ERR_MISSING_ARGS('streams') @@ -24,14 +33,17 @@ module.exports = function compose(...streams) { streams[idx] = Duplex.from(streams[idx]) } for (let n = 0; n < streams.length; ++n) { - if (!isNodeStream(streams[n])) { + if (!isNodeStream(streams[n]) && !isWebStream(streams[n])) { // TODO(ronag): Add checks for non streams. continue } - if (n < streams.length - 1 && !isReadable(streams[n])) { + if ( + n < streams.length - 1 && + !(isReadable(streams[n]) || isReadableStream(streams[n]) || isTransformStream(streams[n])) + ) { throw new ERR_INVALID_ARG_VALUE(`streams[${n}]`, orgStreams[n], 'must be readable') } - if (n > 0 && !isWritable(streams[n])) { + if (n > 0 && !(isWritable(streams[n]) || isWritableStream(streams[n]) || isTransformStream(streams[n]))) { throw new ERR_INVALID_ARG_VALUE(`streams[${n}]`, orgStreams[n], 'must be writable') } } @@ -53,8 +65,8 @@ module.exports = function compose(...streams) { } const head = streams[0] const tail = pipeline(streams, onfinished) - const writable = !!isWritable(head) - const readable = !!isReadable(tail) + const writable = !!(isWritable(head) || isWritableStream(head) || isTransformStream(head)) + const readable = !!(isReadable(tail) || isReadableStream(tail) || isTransformStream(tail)) // TODO(ronag): Avoid double buffering. // Implement Writable/Readable/Duplex traits. @@ -67,25 +79,49 @@ module.exports = function compose(...streams) { readable }) if (writable) { - d._write = function (chunk, encoding, callback) { - if (head.write(chunk, encoding)) { - callback() - } else { - ondrain = callback + if (isNodeStream(head)) { + d._write = function (chunk, encoding, callback) { + if (head.write(chunk, encoding)) { + callback() + } else { + ondrain = callback + } } - } - d._final = function (callback) { - head.end() - onfinish = callback - } - head.on('drain', function () { - if (ondrain) { - const cb = ondrain - ondrain = null - cb() + d._final = function (callback) { + head.end() + onfinish = callback } - }) - tail.on('finish', function () { + head.on('drain', function () { + if (ondrain) { + const cb = ondrain + ondrain = null + cb() + } + }) + } else if (isWebStream(head)) { + const writable = isTransformStream(head) ? head.writable : head + const writer = writable.getWriter() + d._write = async function (chunk, encoding, callback) { + try { + await writer.ready + writer.write(chunk).catch(() => {}) + callback() + } catch (err) { + callback(err) + } + } + d._final = async function (callback) { + try { + await writer.ready + writer.close().catch(() => {}) + onfinish = callback + } catch (err) { + callback(err) + } + } + } + const toRead = isTransformStream(tail) ? tail.readable : tail + eos(toRead, () => { if (onfinish) { const cb = onfinish onfinish = null @@ -94,25 +130,46 @@ module.exports = function compose(...streams) { }) } if (readable) { - tail.on('readable', function () { - if (onreadable) { - const cb = onreadable - onreadable = null - cb() - } - }) - tail.on('end', function () { - d.push(null) - }) - d._read = function () { - while (true) { - const buf = tail.read() - if (buf === null) { - onreadable = d._read - return + if (isNodeStream(tail)) { + tail.on('readable', function () { + if (onreadable) { + const cb = onreadable + onreadable = null + cb() + } + }) + tail.on('end', function () { + d.push(null) + }) + d._read = function () { + while (true) { + const buf = tail.read() + if (buf === null) { + onreadable = d._read + return + } + if (!d.push(buf)) { + return + } } - if (!d.push(buf)) { - return + } + } else if (isWebStream(tail)) { + const readable = isTransformStream(tail) ? tail.readable : tail + const reader = readable.getReader() + d._read = async function () { + while (true) { + try { + const { value, done } = await reader.read() + if (!d.push(value)) { + return + } + if (done) { + d.push(null) + return + } + } catch { + return + } } } } @@ -128,7 +185,9 @@ module.exports = function compose(...streams) { callback(err) } else { onclose = callback - destroyer(tail, err) + if (isNodeStream(tail)) { + destroyer(tail, err) + } } } return d diff --git a/deps/npm/node_modules/readable-stream/lib/internal/streams/destroy.js b/deps/npm/node_modules/readable-stream/lib/internal/streams/destroy.js index 768f2d79d3a893..db76c29f94bab0 100644 --- a/deps/npm/node_modules/readable-stream/lib/internal/streams/destroy.js +++ b/deps/npm/node_modules/readable-stream/lib/internal/streams/destroy.js @@ -36,7 +36,7 @@ function destroy(err, cb) { const w = this._writableState // With duplex streams we use the writable side for state. const s = w || r - if ((w && w.destroyed) || (r && r.destroyed)) { + if ((w !== null && w !== undefined && w.destroyed) || (r !== null && r !== undefined && r.destroyed)) { if (typeof cb === 'function') { cb() } @@ -107,14 +107,14 @@ function emitCloseNT(self) { if (r) { r.closeEmitted = true } - if ((w && w.emitClose) || (r && r.emitClose)) { + if ((w !== null && w !== undefined && w.emitClose) || (r !== null && r !== undefined && r.emitClose)) { self.emit('close') } } function emitErrorNT(self, err) { const r = self._readableState const w = self._writableState - if ((w && w.errorEmitted) || (r && r.errorEmitted)) { + if ((w !== null && w !== undefined && w.errorEmitted) || (r !== null && r !== undefined && r.errorEmitted)) { return } if (w) { @@ -162,10 +162,11 @@ function errorOrDestroy(stream, err, sync) { const r = stream._readableState const w = stream._writableState - if ((w && w.destroyed) || (r && r.destroyed)) { + if ((w !== null && w !== undefined && w.destroyed) || (r !== null && r !== undefined && r.destroyed)) { return this } - if ((r && r.autoDestroy) || (w && w.autoDestroy)) stream.destroy(err) + if ((r !== null && r !== undefined && r.autoDestroy) || (w !== null && w !== undefined && w.autoDestroy)) + stream.destroy(err) else if (err) { // Avoid V8 leak, https://github.com/nodejs/node/pull/34103#issuecomment-652002364 err.stack // eslint-disable-line no-unused-expressions @@ -228,16 +229,18 @@ function constructNT(stream) { } } try { - stream._construct(onConstruct) + stream._construct((err) => { + process.nextTick(onConstruct, err) + }) } catch (err) { - onConstruct(err) + process.nextTick(onConstruct, err) } } function emitConstructNT(stream) { stream.emit(kConstruct) } function isRequest(stream) { - return stream && stream.setHeader && typeof stream.abort === 'function' + return (stream === null || stream === undefined ? undefined : stream.setHeader) && typeof stream.abort === 'function' } function emitCloseLegacy(stream) { stream.emit('close') diff --git a/deps/npm/node_modules/readable-stream/lib/internal/streams/duplexify.js b/deps/npm/node_modules/readable-stream/lib/internal/streams/duplexify.js index 43300ddc8a45bc..599fb47ab53c2e 100644 --- a/deps/npm/node_modules/readable-stream/lib/internal/streams/duplexify.js +++ b/deps/npm/node_modules/readable-stream/lib/internal/streams/duplexify.js @@ -282,8 +282,6 @@ function _duplexify(pair) { cb(err) } else if (err) { d.destroy(err) - } else if (!readable && !writable) { - d.destroy() } } diff --git a/deps/npm/node_modules/readable-stream/lib/internal/streams/end-of-stream.js b/deps/npm/node_modules/readable-stream/lib/internal/streams/end-of-stream.js index 57dbaa48a3ca5a..043c9c4bdac518 100644 --- a/deps/npm/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +++ b/deps/npm/node_modules/readable-stream/lib/internal/streams/end-of-stream.js @@ -10,20 +10,23 @@ const process = require('process/') const { AbortError, codes } = require('../../ours/errors') const { ERR_INVALID_ARG_TYPE, ERR_STREAM_PREMATURE_CLOSE } = codes const { kEmptyObject, once } = require('../../ours/util') -const { validateAbortSignal, validateFunction, validateObject } = require('../validators') -const { Promise } = require('../../ours/primordials') +const { validateAbortSignal, validateFunction, validateObject, validateBoolean } = require('../validators') +const { Promise, PromisePrototypeThen } = require('../../ours/primordials') const { isClosed, isReadable, isReadableNodeStream, + isReadableStream, isReadableFinished, isReadableErrored, isWritable, isWritableNodeStream, + isWritableStream, isWritableFinished, isWritableErrored, isNodeStream, - willEmitClose: _willEmitClose + willEmitClose: _willEmitClose, + kIsClosedPromise } = require('./utils') function isRequest(stream) { return stream.setHeader && typeof stream.abort === 'function' @@ -42,6 +45,12 @@ function eos(stream, options, callback) { validateFunction(callback, 'callback') validateAbortSignal(options.signal, 'options.signal') callback = once(callback) + if (isReadableStream(stream) || isWritableStream(stream)) { + return eosWeb(stream, options, callback) + } + if (!isNodeStream(stream)) { + throw new ERR_INVALID_ARG_TYPE('stream', ['ReadableStream', 'WritableStream', 'Stream'], stream) + } const readable = (_options$readable = options.readable) !== null && _options$readable !== undefined ? _options$readable @@ -50,10 +59,6 @@ function eos(stream, options, callback) { (_options$writable = options.writable) !== null && _options$writable !== undefined ? _options$writable : isWritableNodeStream(stream) - if (!isNodeStream(stream)) { - // TODO: Webstreams. - throw new ERR_INVALID_ARG_TYPE('stream', 'Stream', stream) - } const wState = stream._writableState const rState = stream._readableState const onlegacyfinish = () => { @@ -117,6 +122,14 @@ function eos(stream, options, callback) { } callback.call(stream) } + const onclosed = () => { + closed = true + const errored = isWritableErrored(stream) || isReadableErrored(stream) + if (errored && typeof errored !== 'boolean') { + return callback.call(stream, errored) + } + callback.call(stream) + } const onrequest = () => { stream.req.on('finish', onfinish) } @@ -153,22 +166,22 @@ function eos(stream, options, callback) { (rState !== null && rState !== undefined && rState.errorEmitted) ) { if (!willEmitClose) { - process.nextTick(onclose) + process.nextTick(onclosed) } } else if ( !readable && (!willEmitClose || isReadable(stream)) && (writableFinished || isWritable(stream) === false) ) { - process.nextTick(onclose) + process.nextTick(onclosed) } else if ( !writable && (!willEmitClose || isWritable(stream)) && (readableFinished || isReadable(stream) === false) ) { - process.nextTick(onclose) + process.nextTick(onclosed) } else if (rState && stream.req && stream.aborted) { - process.nextTick(onclose) + process.nextTick(onclosed) } const cleanup = () => { callback = nop @@ -209,9 +222,53 @@ function eos(stream, options, callback) { } return cleanup } +function eosWeb(stream, options, callback) { + let isAborted = false + let abort = nop + if (options.signal) { + abort = () => { + isAborted = true + callback.call( + stream, + new AbortError(undefined, { + cause: options.signal.reason + }) + ) + } + if (options.signal.aborted) { + process.nextTick(abort) + } else { + const originalCallback = callback + callback = once((...args) => { + options.signal.removeEventListener('abort', abort) + originalCallback.apply(stream, args) + }) + options.signal.addEventListener('abort', abort) + } + } + const resolverFn = (...args) => { + if (!isAborted) { + process.nextTick(() => callback.apply(stream, args)) + } + } + PromisePrototypeThen(stream[kIsClosedPromise].promise, resolverFn, resolverFn) + return nop +} function finished(stream, opts) { + var _opts + let autoCleanup = false + if (opts === null) { + opts = kEmptyObject + } + if ((_opts = opts) !== null && _opts !== undefined && _opts.cleanup) { + validateBoolean(opts.cleanup, 'cleanup') + autoCleanup = opts.cleanup + } return new Promise((resolve, reject) => { - eos(stream, opts, (err) => { + const cleanup = eos(stream, opts, (err) => { + if (autoCleanup) { + cleanup() + } if (err) { reject(err) } else { diff --git a/deps/npm/node_modules/readable-stream/lib/internal/streams/operators.js b/deps/npm/node_modules/readable-stream/lib/internal/streams/operators.js index 323a74a17c32e9..869cacb39faca9 100644 --- a/deps/npm/node_modules/readable-stream/lib/internal/streams/operators.js +++ b/deps/npm/node_modules/readable-stream/lib/internal/streams/operators.js @@ -2,12 +2,15 @@ const AbortController = globalThis.AbortController || require('abort-controller').AbortController const { - codes: { ERR_INVALID_ARG_TYPE, ERR_MISSING_ARGS, ERR_OUT_OF_RANGE }, + codes: { ERR_INVALID_ARG_VALUE, ERR_INVALID_ARG_TYPE, ERR_MISSING_ARGS, ERR_OUT_OF_RANGE }, AbortError } = require('../../ours/errors') const { validateAbortSignal, validateInteger, validateObject } = require('../validators') const kWeakHandler = require('../../ours/primordials').Symbol('kWeak') const { finished } = require('./end-of-stream') +const staticCompose = require('./compose') +const { addAbortSignalNoValidate } = require('./add-abort-signal') +const { isWritable, isNodeStream } = require('./utils') const { ArrayPrototypePush, MathFloor, @@ -20,6 +23,23 @@ const { } = require('../../ours/primordials') const kEmpty = Symbol('kEmpty') const kEof = Symbol('kEof') +function compose(stream, options) { + if (options != null) { + validateObject(options, 'options') + } + if ((options === null || options === undefined ? undefined : options.signal) != null) { + validateAbortSignal(options.signal, 'options.signal') + } + if (isNodeStream(stream) && !isWritable(stream)) { + throw new ERR_INVALID_ARG_VALUE('stream', stream, 'must be writable') + } + const composedStream = staticCompose(this, stream) + if (options !== null && options !== undefined && options.signal) { + // Not validating as we already validated before + addAbortSignalNoValidate(options.signal, composedStream) + } + return composedStream +} function map(fn, options) { if (typeof fn !== 'function') { throw new ERR_INVALID_ARG_TYPE('fn', ['Function', 'AsyncFunction'], fn) @@ -424,7 +444,8 @@ module.exports.streamReturningOperators = { filter, flatMap, map, - take + take, + compose } module.exports.promiseReturningOperators = { every, diff --git a/deps/npm/node_modules/readable-stream/lib/internal/streams/pipeline.js b/deps/npm/node_modules/readable-stream/lib/internal/streams/pipeline.js index 016e96ee6ff247..8393ba5146991b 100644 --- a/deps/npm/node_modules/readable-stream/lib/internal/streams/pipeline.js +++ b/deps/npm/node_modules/readable-stream/lib/internal/streams/pipeline.js @@ -24,7 +24,16 @@ const { AbortError } = require('../../ours/errors') const { validateFunction, validateAbortSignal } = require('../validators') -const { isIterable, isReadable, isReadableNodeStream, isNodeStream } = require('./utils') +const { + isIterable, + isReadable, + isReadableNodeStream, + isNodeStream, + isTransformStream, + isWebStream, + isReadableStream, + isReadableEnded +} = require('./utils') const AbortController = globalThis.AbortController || require('abort-controller').AbortController let PassThrough let Readable @@ -74,7 +83,7 @@ async function* fromReadable(val) { } yield* Readable.prototype[SymbolAsyncIterator].call(val) } -async function pump(iterable, writable, finish, { end }) { +async function pumpToNode(iterable, writable, finish, { end }) { let error let onresolve = null const resume = (err) => { @@ -130,6 +139,31 @@ async function pump(iterable, writable, finish, { end }) { writable.off('drain', resume) } } +async function pumpToWeb(readable, writable, finish, { end }) { + if (isTransformStream(writable)) { + writable = writable.writable + } + // https://streams.spec.whatwg.org/#example-manual-write-with-backpressure + const writer = writable.getWriter() + try { + for await (const chunk of readable) { + await writer.ready + writer.write(chunk).catch(() => {}) + } + await writer.ready + if (end) { + await writer.close() + } + finish() + } catch (err) { + try { + await writer.abort(err) + finish(err) + } catch (err) { + finish(err) + } + } +} function pipeline(...streams) { return pipelineImpl(streams, once(popCallback(streams))) } @@ -215,13 +249,18 @@ function pipelineImpl(streams, callback, opts) { if (!isIterable(ret)) { throw new ERR_INVALID_RETURN_VALUE('Iterable, AsyncIterable or Stream', 'source', ret) } - } else if (isIterable(stream) || isReadableNodeStream(stream)) { + } else if (isIterable(stream) || isReadableNodeStream(stream) || isTransformStream(stream)) { ret = stream } else { ret = Duplex.from(stream) } } else if (typeof stream === 'function') { - ret = makeAsyncIterable(ret) + if (isTransformStream(ret)) { + var _ret + ret = makeAsyncIterable((_ret = ret) === null || _ret === undefined ? undefined : _ret.readable) + } else { + ret = makeAsyncIterable(ret) + } ret = stream(ret, { signal }) @@ -230,7 +269,7 @@ function pipelineImpl(streams, callback, opts) { throw new ERR_INVALID_RETURN_VALUE('AsyncIterable', `transform[${i - 1}]`, ret) } } else { - var _ret + var _ret2 if (!PassThrough) { PassThrough = require('./passthrough') } @@ -246,7 +285,7 @@ function pipelineImpl(streams, callback, opts) { // Handle Promises/A+ spec, `then` could be a getter that throws on // second use. - const then = (_ret = ret) === null || _ret === undefined ? undefined : _ret.then + const then = (_ret2 = ret) === null || _ret2 === undefined ? undefined : _ret2.then if (typeof then === 'function') { finishCount++ then.call( @@ -268,7 +307,13 @@ function pipelineImpl(streams, callback, opts) { ) } else if (isIterable(ret, true)) { finishCount++ - pump(ret, pt, finish, { + pumpToNode(ret, pt, finish, { + end + }) + } else if (isReadableStream(ret) || isTransformStream(ret)) { + const toRead = ret.readable || ret + finishCount++ + pumpToNode(toRead, pt, finish, { end }) } else { @@ -290,13 +335,47 @@ function pipelineImpl(streams, callback, opts) { if (isReadable(stream) && isLastStream) { lastStreamCleanup.push(cleanup) } + } else if (isTransformStream(ret) || isReadableStream(ret)) { + const toRead = ret.readable || ret + finishCount++ + pumpToNode(toRead, stream, finish, { + end + }) } else if (isIterable(ret)) { finishCount++ - pump(ret, stream, finish, { + pumpToNode(ret, stream, finish, { end }) } else { - throw new ERR_INVALID_ARG_TYPE('val', ['Readable', 'Iterable', 'AsyncIterable'], ret) + throw new ERR_INVALID_ARG_TYPE( + 'val', + ['Readable', 'Iterable', 'AsyncIterable', 'ReadableStream', 'TransformStream'], + ret + ) + } + ret = stream + } else if (isWebStream(stream)) { + if (isReadableNodeStream(ret)) { + finishCount++ + pumpToWeb(makeAsyncIterable(ret), stream, finish, { + end + }) + } else if (isReadableStream(ret) || isIterable(ret)) { + finishCount++ + pumpToWeb(ret, stream, finish, { + end + }) + } else if (isTransformStream(ret)) { + finishCount++ + pumpToWeb(ret.readable, stream, finish, { + end + }) + } else { + throw new ERR_INVALID_ARG_TYPE( + 'val', + ['Readable', 'Iterable', 'AsyncIterable', 'ReadableStream', 'TransformStream'], + ret + ) } ret = stream } else { @@ -320,16 +399,24 @@ function pipe(src, dst, finish, { end }) { } }) src.pipe(dst, { - end - }) + end: false + }) // If end is true we already will have a listener to end dst. + if (end) { // Compat. Before node v10.12.0 stdio used to throw an error so // pipe() did/does not end() stdio destinations. // Now they allow it but "secretly" don't close the underlying fd. - src.once('end', () => { + + function endFn() { ended = true dst.end() - }) + } + if (isReadableEnded(src)) { + // End the destination if the source has already ended. + process.nextTick(endFn) + } else { + src.once('end', endFn) + } } else { finish() } diff --git a/deps/npm/node_modules/readable-stream/lib/internal/streams/utils.js b/deps/npm/node_modules/readable-stream/lib/internal/streams/utils.js index f87e9fe68e6a82..e589ad96c6924e 100644 --- a/deps/npm/node_modules/readable-stream/lib/internal/streams/utils.js +++ b/deps/npm/node_modules/readable-stream/lib/internal/streams/utils.js @@ -1,10 +1,12 @@ 'use strict' -const { Symbol, SymbolAsyncIterator, SymbolIterator } = require('../../ours/primordials') +const { Symbol, SymbolAsyncIterator, SymbolIterator, SymbolFor } = require('../../ours/primordials') const kDestroyed = Symbol('kDestroyed') const kIsErrored = Symbol('kIsErrored') const kIsReadable = Symbol('kIsReadable') const kIsDisturbed = Symbol('kIsDisturbed') +const kIsClosedPromise = SymbolFor('nodejs.webstream.isClosedPromise') +const kControllerErrorFunction = SymbolFor('nodejs.webstream.controllerErrorFunction') function isReadableNodeStream(obj, strict = false) { var _obj$_readableState return !!( @@ -56,6 +58,24 @@ function isNodeStream(obj) { (typeof obj.pipe === 'function' && typeof obj.on === 'function')) ) } +function isReadableStream(obj) { + return !!( + obj && + !isNodeStream(obj) && + typeof obj.pipeThrough === 'function' && + typeof obj.getReader === 'function' && + typeof obj.cancel === 'function' + ) +} +function isWritableStream(obj) { + return !!(obj && !isNodeStream(obj) && typeof obj.getWriter === 'function' && typeof obj.abort === 'function') +} +function isTransformStream(obj) { + return !!(obj && !isNodeStream(obj) && typeof obj.readable === 'object' && typeof obj.writable === 'object') +} +function isWebStream(obj) { + return isReadableStream(obj) || isWritableStream(obj) || isTransformStream(obj) +} function isIterable(obj, isAsync) { if (obj == null) return false if (isAsync === true) return typeof obj[SymbolAsyncIterator] === 'function' @@ -274,22 +294,28 @@ module.exports = { kIsErrored, isReadable, kIsReadable, + kIsClosedPromise, + kControllerErrorFunction, isClosed, isDestroyed, isDuplexNodeStream, isFinished, isIterable, isReadableNodeStream, + isReadableStream, isReadableEnded, isReadableFinished, isReadableErrored, isNodeStream, + isWebStream, isWritable, isWritableNodeStream, + isWritableStream, isWritableEnded, isWritableFinished, isWritableErrored, isServerRequest, isServerResponse, - willEmitClose + willEmitClose, + isTransformStream } diff --git a/deps/npm/node_modules/readable-stream/lib/internal/validators.js b/deps/npm/node_modules/readable-stream/lib/internal/validators.js index f9e6e555971a1b..85b2e9cd593d9b 100644 --- a/deps/npm/node_modules/readable-stream/lib/internal/validators.js +++ b/deps/npm/node_modules/readable-stream/lib/internal/validators.js @@ -1,3 +1,5 @@ +/* eslint jsdoc/require-jsdoc: "error" */ + 'use strict' const { @@ -199,6 +201,13 @@ const validateOneOf = hideStackFrames((value, name, oneOf) => { function validateBoolean(value, name) { if (typeof value !== 'boolean') throw new ERR_INVALID_ARG_TYPE(name, 'boolean', value) } + +/** + * @param {any} options + * @param {string} key + * @param {boolean} defaultValue + * @returns {boolean} + */ function getOwnPropertyValueOrDefault(options, key, defaultValue) { return options == null || !ObjectPrototypeHasOwnProperty(options, key) ? defaultValue : options[key] } @@ -228,6 +237,24 @@ const validateObject = hideStackFrames((value, name, options = null) => { } }) +/** + * @callback validateDictionary - We are using the Web IDL Standard definition + * of "dictionary" here, which means any value + * whose Type is either Undefined, Null, or + * Object (which includes functions). + * @param {*} value + * @param {string} name + * @see https://webidl.spec.whatwg.org/#es-dictionary + * @see https://tc39.es/ecma262/#table-typeof-operator-results + */ + +/** @type {validateDictionary} */ +const validateDictionary = hideStackFrames((value, name) => { + if (value != null && typeof value !== 'object' && typeof value !== 'function') { + throw new ERR_INVALID_ARG_TYPE(name, 'a dictionary', value) + } +}) + /** * @callback validateArray * @param {*} value @@ -247,7 +274,36 @@ const validateArray = hideStackFrames((value, name, minLength = 0) => { } }) -// eslint-disable-next-line jsdoc/require-returns-check +/** + * @callback validateStringArray + * @param {*} value + * @param {string} name + * @returns {asserts value is string[]} + */ + +/** @type {validateStringArray} */ +function validateStringArray(value, name) { + validateArray(value, name) + for (let i = 0; i < value.length; i++) { + validateString(value[i], `${name}[${i}]`) + } +} + +/** + * @callback validateBooleanArray + * @param {*} value + * @param {string} name + * @returns {asserts value is boolean[]} + */ + +/** @type {validateBooleanArray} */ +function validateBooleanArray(value, name) { + validateArray(value, name) + for (let i = 0; i < value.length; i++) { + validateBoolean(value[i], `${name}[${i}]`) + } +} + /** * @param {*} signal * @param {string} [name='signal'] @@ -370,13 +426,71 @@ function validateUnion(value, name, union) { throw new ERR_INVALID_ARG_TYPE(name, `('${ArrayPrototypeJoin(union, '|')}')`, value) } } + +/* + The rules for the Link header field are described here: + https://www.rfc-editor.org/rfc/rfc8288.html#section-3 + + This regex validates any string surrounded by angle brackets + (not necessarily a valid URI reference) followed by zero or more + link-params separated by semicolons. +*/ +const linkValueRegExp = /^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/ + +/** + * @param {any} value + * @param {string} name + */ +function validateLinkHeaderFormat(value, name) { + if (typeof value === 'undefined' || !RegExpPrototypeExec(linkValueRegExp, value)) { + throw new ERR_INVALID_ARG_VALUE( + name, + value, + 'must be an array or string of format "; rel=preload; as=style"' + ) + } +} + +/** + * @param {any} hints + * @return {string} + */ +function validateLinkHeaderValue(hints) { + if (typeof hints === 'string') { + validateLinkHeaderFormat(hints, 'hints') + return hints + } else if (ArrayIsArray(hints)) { + const hintsLength = hints.length + let result = '' + if (hintsLength === 0) { + return result + } + for (let i = 0; i < hintsLength; i++) { + const link = hints[i] + validateLinkHeaderFormat(link, 'hints') + result += link + if (i !== hintsLength - 1) { + result += ', ' + } + } + return result + } + throw new ERR_INVALID_ARG_VALUE( + 'hints', + hints, + 'must be an array or string of format "; rel=preload; as=style"' + ) +} module.exports = { isInt32, isUint32, parseFileMode, validateArray, + validateStringArray, + validateBooleanArray, validateBoolean, validateBuffer, + validateDictionary, validateEncoding, validateFunction, validateInt32, @@ -391,5 +505,6 @@ module.exports = { validateUint32, validateUndefined, validateUnion, - validateAbortSignal + validateAbortSignal, + validateLinkHeaderValue } diff --git a/deps/npm/node_modules/readable-stream/lib/ours/primordials.js b/deps/npm/node_modules/readable-stream/lib/ours/primordials.js index 6a98b01681caf0..9464cc7fea6a12 100644 --- a/deps/npm/node_modules/readable-stream/lib/ours/primordials.js +++ b/deps/npm/node_modules/readable-stream/lib/ours/primordials.js @@ -90,6 +90,7 @@ module.exports = { return self.trim() }, Symbol, + SymbolFor: Symbol.for, SymbolAsyncIterator: Symbol.asyncIterator, SymbolHasInstance: Symbol.hasInstance, SymbolIterator: Symbol.iterator, diff --git a/deps/npm/node_modules/readable-stream/lib/stream/promises.js b/deps/npm/node_modules/readable-stream/lib/stream/promises.js index d44dd8ad0e0f3f..b85c51f47f1ce1 100644 --- a/deps/npm/node_modules/readable-stream/lib/stream/promises.js +++ b/deps/npm/node_modules/readable-stream/lib/stream/promises.js @@ -1,15 +1,22 @@ 'use strict' const { ArrayPrototypePop, Promise } = require('../ours/primordials') -const { isIterable, isNodeStream } = require('../internal/streams/utils') +const { isIterable, isNodeStream, isWebStream } = require('../internal/streams/utils') const { pipelineImpl: pl } = require('../internal/streams/pipeline') const { finished } = require('../internal/streams/end-of-stream') +require('stream') function pipeline(...streams) { return new Promise((resolve, reject) => { let signal let end const lastArg = streams[streams.length - 1] - if (lastArg && typeof lastArg === 'object' && !isNodeStream(lastArg) && !isIterable(lastArg)) { + if ( + lastArg && + typeof lastArg === 'object' && + !isNodeStream(lastArg) && + !isIterable(lastArg) && + !isWebStream(lastArg) + ) { const options = ArrayPrototypePop(streams) signal = options.signal end = options.end diff --git a/deps/npm/node_modules/readable-stream/package.json b/deps/npm/node_modules/readable-stream/package.json index 7df83d9eb990a9..c4f6504cc7cc66 100644 --- a/deps/npm/node_modules/readable-stream/package.json +++ b/deps/npm/node_modules/readable-stream/package.json @@ -1,6 +1,6 @@ { "name": "readable-stream", - "version": "4.3.0", + "version": "4.4.0", "description": "Node.js Streams, a user-land copy of the stream library from Node.js", "homepage": "https://github.com/nodejs/readable-stream", "license": "MIT", diff --git a/deps/npm/node_modules/semver/classes/semver.js b/deps/npm/node_modules/semver/classes/semver.js index 25ee889d1492af..99dbe82db4dc59 100644 --- a/deps/npm/node_modules/semver/classes/semver.js +++ b/deps/npm/node_modules/semver/classes/semver.js @@ -16,7 +16,7 @@ class SemVer { version = version.version } } else if (typeof version !== 'string') { - throw new TypeError(`Invalid Version: ${require('util').inspect(version)}`) + throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`) } if (version.length > MAX_LENGTH) { diff --git a/deps/npm/node_modules/semver/package.json b/deps/npm/node_modules/semver/package.json index 0a6095b8900a62..592404a3c9d1c0 100644 --- a/deps/npm/node_modules/semver/package.json +++ b/deps/npm/node_modules/semver/package.json @@ -1,6 +1,6 @@ { "name": "semver", - "version": "7.5.0", + "version": "7.5.1", "description": "The semantic version parser used by npm.", "main": "index.js", "scripts": { @@ -14,7 +14,7 @@ }, "devDependencies": { "@npmcli/eslint-config": "^4.0.0", - "@npmcli/template-oss": "4.13.0", + "@npmcli/template-oss": "4.14.1", "tap": "^16.0.0" }, "license": "ISC", @@ -53,7 +53,7 @@ "author": "GitHub Inc.", "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.13.0", + "version": "4.14.1", "engines": ">=10", "ciVersions": [ "10.0.0", diff --git a/deps/npm/node_modules/signal-exit/dist/cjs/index.js b/deps/npm/node_modules/signal-exit/dist/cjs/index.js index 5a9ea081d7a5f5..2e6c18316b9a5d 100644 --- a/deps/npm/node_modules/signal-exit/dist/cjs/index.js +++ b/deps/npm/node_modules/signal-exit/dist/cjs/index.js @@ -34,7 +34,6 @@ class Emitter { id = Math.random(); constructor() { if (global[kExitEmitter]) { - console.error('reusing global emitter'); return global[kExitEmitter]; } ObjectDefineProperty(global, kExitEmitter, { diff --git a/deps/npm/node_modules/signal-exit/dist/mjs/index.js b/deps/npm/node_modules/signal-exit/dist/mjs/index.js index cc86788031646a..1e8dea6d4930b6 100644 --- a/deps/npm/node_modules/signal-exit/dist/mjs/index.js +++ b/deps/npm/node_modules/signal-exit/dist/mjs/index.js @@ -30,7 +30,6 @@ class Emitter { id = Math.random(); constructor() { if (global[kExitEmitter]) { - console.error('reusing global emitter'); return global[kExitEmitter]; } ObjectDefineProperty(global, kExitEmitter, { diff --git a/deps/npm/node_modules/signal-exit/package.json b/deps/npm/node_modules/signal-exit/package.json index 5e7e3a74d95d87..455452f96a0b3f 100644 --- a/deps/npm/node_modules/signal-exit/package.json +++ b/deps/npm/node_modules/signal-exit/package.json @@ -1,6 +1,6 @@ { "name": "signal-exit", - "version": "4.0.1", + "version": "4.0.2", "description": "when you want to fire an event no matter how a process exits.", "main": "./dist/cjs/index.js", "module": "./dist/mjs/index.js", diff --git a/deps/npm/node_modules/sigstore/README.md b/deps/npm/node_modules/sigstore/README.md index 0f015c580b6663..fd9260fb107ef4 100644 --- a/deps/npm/node_modules/sigstore/README.md +++ b/deps/npm/node_modules/sigstore/README.md @@ -1,4 +1,4 @@ -# sigstore-js · [![npm version](https://img.shields.io/npm/v/sigstore.svg?style=flat)](https://www.npmjs.com/package/sigstore) [![CI Status](https://github.com/sigstore/sigstore-js/workflows/CI/badge.svg)](https://github.com/sigstore/sigstore-js/actions/workflows/ci.yml) [![Smoke Test Status](https://github.com/sigstore/sigstore-js/workflows/smoke-test/badge.svg)](https://github.com/sigstore/sigstore-js/actions/workflows/smoke-test.yml) +# sigstore · [![npm version](https://img.shields.io/npm/v/sigstore.svg?style=flat)](https://www.npmjs.com/package/sigstore) [![CI Status](https://github.com/sigstore/sigstore-js/workflows/CI/badge.svg)](https://github.com/sigstore/sigstore-js/actions/workflows/ci.yml) [![Smoke Test Status](https://github.com/sigstore/sigstore-js/workflows/smoke-test/badge.svg)](https://github.com/sigstore/sigstore-js/actions/workflows/smoke-test.yml) A JavaScript library for generating and verifying Sigstore signatures. One of the intended uses is to sign and verify npm packages but it can be used to sign @@ -40,6 +40,8 @@ necessary to verify the signature. * `options` `` * `fulcioURL` ``: The base URL of the Fulcio instance to use for retrieving the signing certificate. Defaults to `'https://fulcio.sigstore.dev'`. * `rekorURL` ``: The base URL of the Rekor instance to use when adding the signature to the transparency log. Defaults to `'https://rekor.sigstore.dev'`. + * `tsaServerURL` ``: The base URL of the Timestamp Authority instance to use when requesting a signed timestamp. If omitted, no timestamp will be requested. + * `tlogUpload` ``: Flag indicating whether or not the signature should be recorded on the Rekor transparency log. Defaults to `true`. * `identityToken` ``: The OIDC token identifying the signer. If no explicit token is supplied, an attempt will be made to retrieve one from the environment. ### attest(payload, payloadType[, options]) @@ -53,6 +55,8 @@ as well as the verification material necessary to verify the signature. * `options` `` * `fulcioURL` ``: The base URL of the Fulcio instance to use for retrieving the signing certificate. Defaults to `'https://fulcio.sigstore.dev'`. * `rekorURL` ``: The base URL of the Rekor instance to use when adding the signature to the transparency log. Defaults to `'https://rekor.sigstore.dev'`. + * `tsaServerURL` ``: The base URL of the Timestamp Authority instance to use when requesting a signed timestamp. If omitted, no timestamp will be requested. + * `tlogUpload` ``: Flag indicating whether or not the signed statement should be recorded on the Rekor transparency log. Defaults to `true`. * `identityToken` ``: The OIDC token identifying the signer. If no explicit token is supplied, an attempt will be made to retrieve one from the environment. @@ -76,9 +80,25 @@ Verifies the signature in the supplied bundle. The `tuf` object contains utility function for working with the Sigstore TUF repository. -#### getTarget(path[, options]) +#### client([options]) + +Returns a TUF client which can be used to retrieve targets from the Sigstore TUF repository. + +* `options` `` + * `tufMirrorURL` ``: Base URL for the Sigstore TUF repository. Defaults to `'https://tuf-repo-cdn.sigstore.dev'` + * `tufRootPath` ``: Path to the initial trusted root for the TUF repository. Defaults to the embedded root. + * `tufCachePath` ``: Absolute path to the directory to be used for caching downloaded TUF metadata and targets. Defaults to a directory named "sigstore-js" within the platform-specific application data directory. + +The returned object exposes a `getTarget(path)` function which returns the +contents of the target at the specified path in the Sigstore TUF repository. + +#### getTarget(path[, options]) (deprecated) Returns the contents of the target at the specified path in the Sigstore TUF repository. +This method has been deprecated and will be removed in the next major version. +You should use the TUF `client` function to retrieve a stateful TUF client and +then call `getTarget` against that object. This will avoid re-initializing the +internal TUF state between requests. * `path` ``: The [path-relative-url string](https://url.spec.whatwg.org/#path-relative-url-string) that uniquely identifies the target within the Sigstore TUF repository. * `options` `` @@ -135,63 +155,9 @@ It is the callers responsibility to make sure that this token has the correct sc If sigstore-js cannot detect ambient credentials, then it will prompt the user to go through the interactive flow. -## Development - -### Changesets -If you are contributing a user-facing or noteworthy change that should be added to the changelog, you should include a changeset with your PR by running the following command: - -```console -npx changeset add -``` - -Follow the prompts to specify whether the change is a major, minor or patch change. This will create a file in the `.changesets` directory of the repo. This change should be committed and included with your PR. - -### Updating Rekor Types - -Update the git `REF` in `hack/generate-rekor-types` from the [sigstore/rekor][1] repository. - -Generate TypeScript types (should update files in scr/types/rekor/\_\_generated\_\_): - -``` -npm run codegen:rekor -``` - -### Release Steps - -Whenever a new changeset is merged to the "main" branch, the `release` workflow will open a PR (or append to the existing PR if one is already open) with the all of the pending changesets. - -Publishing a release simply requires that you approve/merge this PR. This will trigger the publishing of the package to the npm registry and the creation of the GitHub release. - -## Licensing - -`sigstore-js` is licensed under the Apache 2.0 License. - -## Contributing - -See [the contributing docs][7] for details. - -## Code of Conduct -Everyone interacting with this project is expected to follow the [sigstore Code of Conduct][8]. - -## Security - -Should you discover any security issues, please refer to sigstore's [security process][9]. - -## Info - -`sigstore-js` is developed as part of the [`sigstore`][6] project. - -We also use a [slack channel][10]! Click [here][11] for the invite link. [1]: https://github.com/sigstore/rekor [2]: https://github.com/sigstore/protobuf-specs/blob/9b722b68a717778ba4f11543afa4ef93205ab502/protos/sigstore_bundle.proto#L63-L84 [3]: https://github.com/secure-systems-lab/dsse [4]: https://github.com/sigstore/cosign -[5]: https://github.com/sigstore/protobuf-specs -[6]: https://sigstore.dev -[7]: https://github.com/sigstore/.github/blob/main/CONTRIBUTING.md -[8]: https://github.com/sigstore/.github/blob/main/CODE_OF_CONDUCT.md -[9]: https://github.com/sigstore/.github/blob/main/SECURITY.md -[10]: https://sigstore.slack.com -[11]: https://join.slack.com/t/sigstore/shared_invite/zt-mhs55zh0-XmY3bcfWn4XEyMqUUutbUQ diff --git a/deps/npm/node_modules/sigstore/dist/ca/index.d.ts b/deps/npm/node_modules/sigstore/dist/ca/index.d.ts index 0ee0bf4ae67b2b..3a6347293aaa8b 100644 --- a/deps/npm/node_modules/sigstore/dist/ca/index.d.ts +++ b/deps/npm/node_modules/sigstore/dist/ca/index.d.ts @@ -1,12 +1,13 @@ /// /// import { KeyObject } from 'crypto'; +import type { FetchOptions } from '../types/fetch'; export interface CA { createSigningCertificate: (identityToken: string, publicKey: KeyObject, challenge: Buffer) => Promise; } -export interface CAClientOptions { +export type CAClientOptions = { fulcioBaseURL: string; -} +} & FetchOptions; export declare class CAClient implements CA { private fulcio; constructor(options: CAClientOptions); diff --git a/deps/npm/node_modules/sigstore/dist/ca/index.js b/deps/npm/node_modules/sigstore/dist/ca/index.js index 7e0f9e0c5c4c0b..340dd46609aad2 100644 --- a/deps/npm/node_modules/sigstore/dist/ca/index.js +++ b/deps/npm/node_modules/sigstore/dist/ca/index.js @@ -6,13 +6,26 @@ const external_1 = require("../external"); const format_1 = require("./format"); class CAClient { constructor(options) { - this.fulcio = new external_1.Fulcio({ baseURL: options.fulcioBaseURL }); + this.fulcio = new external_1.Fulcio({ + baseURL: options.fulcioBaseURL, + retry: options.retry, + timeout: options.timeout, + }); } async createSigningCertificate(identityToken, publicKey, challenge) { const request = (0, format_1.toCertificateRequest)(identityToken, publicKey, challenge); try { - const certificate = await this.fulcio.createSigningCertificate(request); - return certificate.signedCertificateEmbeddedSct.chain.certificates; + const resp = await this.fulcio.createSigningCertificate(request); + // Account for the fact that the response may contain either a + // signedCertificateEmbeddedSct or a signedCertificateDetachedSct. + const cert = resp.signedCertificateEmbeddedSct + ? resp.signedCertificateEmbeddedSct + : resp.signedCertificateDetachedSct; + // Return the first certificate in the chain, which is the signing + // certificate. Specifically not returning the rest of the chain to + // mitigate the risk of errors when verifying the certificate chain. + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + return cert.chain.certificates.slice(0, 1); } catch (err) { throw new error_1.InternalError({ diff --git a/deps/npm/node_modules/sigstore/dist/ca/verify/chain.d.ts b/deps/npm/node_modules/sigstore/dist/ca/verify/chain.d.ts index 7ccc0dcf8d15c8..0a79b42f714a0f 100644 --- a/deps/npm/node_modules/sigstore/dist/ca/verify/chain.d.ts +++ b/deps/npm/node_modules/sigstore/dist/ca/verify/chain.d.ts @@ -1,3 +1,3 @@ import * as sigstore from '../../types/sigstore'; import { x509Certificate } from '../../x509/cert'; -export declare function verifyChain(bundleCerts: sigstore.X509Certificate[], certificateAuthorities: sigstore.CertificateAuthority[]): x509Certificate[]; +export declare function verifyChain(certificate: sigstore.X509Certificate, certificateAuthorities: sigstore.CertificateAuthority[]): x509Certificate[]; diff --git a/deps/npm/node_modules/sigstore/dist/ca/verify/chain.js b/deps/npm/node_modules/sigstore/dist/ca/verify/chain.js index 0f6f7146957284..3246c7a154e2d9 100644 --- a/deps/npm/node_modules/sigstore/dist/ca/verify/chain.js +++ b/deps/npm/node_modules/sigstore/dist/ca/verify/chain.js @@ -19,12 +19,11 @@ limitations under the License. const error_1 = require("../../error"); const cert_1 = require("../../x509/cert"); const verify_1 = require("../../x509/verify"); -function verifyChain(bundleCerts, certificateAuthorities) { - const certs = parseCerts(bundleCerts); - const signingCert = certs[0]; +function verifyChain(certificate, certificateAuthorities) { + const untrustedCert = cert_1.x509Certificate.parse(certificate.rawBytes); // Filter the list of certificate authorities to those which are valid for the // signing certificate's notBefore date. - const validCAs = filterCertificateAuthorities(certificateAuthorities, signingCert.notBefore); + const validCAs = filterCertificateAuthorities(certificateAuthorities, untrustedCert.notBefore); if (validCAs.length === 0) { throw new error_1.VerificationError('No valid certificate authorities'); } @@ -34,9 +33,9 @@ function verifyChain(bundleCerts, certificateAuthorities) { const trustedCerts = parseCerts(ca.certChain?.certificates || []); try { trustedChain = (0, verify_1.verifyCertificateChain)({ + untrustedCert, trustedCerts, - certs, - validAt: signingCert.notBefore, + validAt: untrustedCert.notBefore, }); return true; } diff --git a/deps/npm/node_modules/sigstore/dist/ca/verify/index.js b/deps/npm/node_modules/sigstore/dist/ca/verify/index.js index 9c42f3094338f8..32f85c828fe5a4 100644 --- a/deps/npm/node_modules/sigstore/dist/ca/verify/index.js +++ b/deps/npm/node_modules/sigstore/dist/ca/verify/index.js @@ -6,8 +6,9 @@ const sct_1 = require("./sct"); const signer_1 = require("./signer"); function verifySigningCertificate(bundle, trustedRoot, options) { // Check that a trusted certificate chain can be found for the signing - // certificate in the bundle - const trustedChain = (0, chain_1.verifyChain)(bundle.verificationMaterial.content.x509CertificateChain.certificates, trustedRoot.certificateAuthorities); + // certificate in the bundle. Only the first certificate in the bundle's + // chain is used -- everything else must come from the trusted root. + const trustedChain = (0, chain_1.verifyChain)(bundle.verificationMaterial.content.x509CertificateChain.certificates[0], trustedRoot.certificateAuthorities); // Unless disabled, verify the SCTs in the signing certificate if (options.ctlogOptions.disable === false) { (0, sct_1.verifySCTs)(trustedChain, trustedRoot.ctlogs, options.ctlogOptions); diff --git a/deps/npm/node_modules/sigstore/dist/config.d.ts b/deps/npm/node_modules/sigstore/dist/config.d.ts index 227013f7aa4e48..46be669a181842 100644 --- a/deps/npm/node_modules/sigstore/dist/config.d.ts +++ b/deps/npm/node_modules/sigstore/dist/config.d.ts @@ -1,7 +1,9 @@ import { CA } from './ca'; import { Provider } from './identity'; import { TLog } from './tlog'; +import { TSA } from './tsa'; import * as sigstore from './types/sigstore'; +import type { FetchOptions, Retry } from './types/fetch'; import type { KeySelector } from './verify'; interface CAOptions { fulcioURL?: string; @@ -9,6 +11,9 @@ interface CAOptions { interface TLogOptions { rekorURL?: string; } +interface TSAOptions { + tsaServerURL?: string; +} export interface IdentityProviderOptions { identityToken?: string; oidcIssuer?: string; @@ -16,12 +21,14 @@ export interface IdentityProviderOptions { oidcClientSecret?: string; oidcRedirectURL?: string; } -export interface TUFOptions { +export type TUFOptions = { tufMirrorURL?: string; tufRootPath?: string; tufCachePath?: string; -} -export type SignOptions = CAOptions & TLogOptions & IdentityProviderOptions; +} & FetchOptions; +export type SignOptions = { + tlogUpload?: boolean; +} & CAOptions & TLogOptions & TSAOptions & FetchOptions & IdentityProviderOptions; export type VerifyOptions = { ctLogThreshold?: number; tlogThreshold?: number; @@ -33,12 +40,11 @@ export type VerifyOptions = { } & TLogOptions & TUFOptions; export declare const DEFAULT_FULCIO_URL = "https://fulcio.sigstore.dev"; export declare const DEFAULT_REKOR_URL = "https://rekor.sigstore.dev"; -export declare function createCAClient(options: { - fulcioURL?: string; -}): CA; -export declare function createTLogClient(options: { - rekorURL?: string; -}): TLog; +export declare const DEFAULT_RETRY: Retry; +export declare const DEFAULT_TIMEOUT = 5000; +export declare function createCAClient(options: CAOptions & FetchOptions): CA; +export declare function createTLogClient(options: TLogOptions & FetchOptions): TLog; +export declare function createTSAClient(options: TSAOptions & FetchOptions): TSA | undefined; export declare function artifactVerificationOptions(options: VerifyOptions): sigstore.RequiredArtifactVerificationOptions; export declare function identityProviders(options: IdentityProviderOptions): Provider[]; export {}; diff --git a/deps/npm/node_modules/sigstore/dist/config.js b/deps/npm/node_modules/sigstore/dist/config.js index 7e6e42d9bf3693..1a22c5fef313b7 100644 --- a/deps/npm/node_modules/sigstore/dist/config.js +++ b/deps/npm/node_modules/sigstore/dist/config.js @@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.identityProviders = exports.artifactVerificationOptions = exports.createTLogClient = exports.createCAClient = exports.DEFAULT_REKOR_URL = exports.DEFAULT_FULCIO_URL = void 0; +exports.identityProviders = exports.artifactVerificationOptions = exports.createTSAClient = exports.createTLogClient = exports.createCAClient = exports.DEFAULT_TIMEOUT = exports.DEFAULT_RETRY = exports.DEFAULT_REKOR_URL = exports.DEFAULT_FULCIO_URL = void 0; /* Copyright 2023 The Sigstore Authors. @@ -45,21 +45,38 @@ limitations under the License. const ca_1 = require("./ca"); const identity_1 = __importDefault(require("./identity")); const tlog_1 = require("./tlog"); +const tsa_1 = require("./tsa"); const sigstore = __importStar(require("./types/sigstore")); exports.DEFAULT_FULCIO_URL = 'https://fulcio.sigstore.dev'; exports.DEFAULT_REKOR_URL = 'https://rekor.sigstore.dev'; +exports.DEFAULT_RETRY = { retries: 2 }; +exports.DEFAULT_TIMEOUT = 5000; function createCAClient(options) { return new ca_1.CAClient({ fulcioBaseURL: options.fulcioURL || exports.DEFAULT_FULCIO_URL, + retry: options.retry ?? exports.DEFAULT_RETRY, + timeout: options.timeout ?? exports.DEFAULT_TIMEOUT, }); } exports.createCAClient = createCAClient; function createTLogClient(options) { return new tlog_1.TLogClient({ rekorBaseURL: options.rekorURL || exports.DEFAULT_REKOR_URL, + retry: options.retry ?? exports.DEFAULT_RETRY, + timeout: options.timeout ?? exports.DEFAULT_TIMEOUT, }); } exports.createTLogClient = createTLogClient; +function createTSAClient(options) { + return options.tsaServerURL + ? new tsa_1.TSAClient({ + tsaBaseURL: options.tsaServerURL, + retry: options.retry ?? exports.DEFAULT_RETRY, + timeout: options.timeout ?? exports.DEFAULT_TIMEOUT, + }) + : undefined; +} +exports.createTSAClient = createTSAClient; // Assembles the AtifactVerificationOptions from the supplied VerifyOptions. function artifactVerificationOptions(options) { // The trusted signers are only used if the options contain a certificate diff --git a/deps/npm/node_modules/sigstore/dist/error.d.ts b/deps/npm/node_modules/sigstore/dist/error.d.ts index 011fc4d75fe773..c03bbc31697745 100644 --- a/deps/npm/node_modules/sigstore/dist/error.d.ts +++ b/deps/npm/node_modules/sigstore/dist/error.d.ts @@ -8,7 +8,7 @@ export declare class ValidationError extends BaseError { } export declare class PolicyError extends BaseError { } -type InternalErrorCode = 'TLOG_FETCH_ENTRY_ERROR' | 'TLOG_CREATE_ENTRY_ERROR' | 'CA_CREATE_SIGNING_CERTIFICATE_ERROR' | 'TUF_FIND_TARGET_ERROR' | 'TUF_REFRESH_METADATA_ERROR' | 'TUF_DOWNLOAD_TARGET_ERROR' | 'TUF_READ_TARGET_ERROR'; +type InternalErrorCode = 'TLOG_FETCH_ENTRY_ERROR' | 'TLOG_CREATE_ENTRY_ERROR' | 'CA_CREATE_SIGNING_CERTIFICATE_ERROR' | 'TSA_CREATE_TIMESTAMP_ERROR' | 'TUF_FIND_TARGET_ERROR' | 'TUF_REFRESH_METADATA_ERROR' | 'TUF_DOWNLOAD_TARGET_ERROR' | 'TUF_READ_TARGET_ERROR'; export declare class InternalError extends BaseError { code: InternalErrorCode; constructor({ code, message, cause, }: { diff --git a/deps/npm/node_modules/sigstore/dist/external/fulcio.d.ts b/deps/npm/node_modules/sigstore/dist/external/fulcio.d.ts index 91fe53e69f9387..64b0fc5e347982 100644 --- a/deps/npm/node_modules/sigstore/dist/external/fulcio.d.ts +++ b/deps/npm/node_modules/sigstore/dist/external/fulcio.d.ts @@ -1,6 +1,7 @@ -export interface FulcioOptions { +import type { FetchOptions } from '../types/fetch'; +export type FulcioOptions = { baseURL: string; -} +} & FetchOptions; export interface SigningCertificateRequest { credentials: { oidcIdentityToken: string; @@ -14,10 +15,16 @@ export interface SigningCertificateRequest { }; } export interface SigningCertificateResponse { - signedCertificateEmbeddedSct: { + signedCertificateEmbeddedSct?: { + chain: { + certificates: string[]; + }; + }; + signedCertificateDetachedSct?: { chain: { certificates: string[]; }; + signedCertificateTimestamp: string; }; } /** diff --git a/deps/npm/node_modules/sigstore/dist/external/fulcio.js b/deps/npm/node_modules/sigstore/dist/external/fulcio.js index 288ca32caaea78..aeb48d58d8d83e 100644 --- a/deps/npm/node_modules/sigstore/dist/external/fulcio.js +++ b/deps/npm/node_modules/sigstore/dist/external/fulcio.js @@ -28,8 +28,8 @@ const error_1 = require("./error"); class Fulcio { constructor(options) { this.fetch = make_fetch_happen_1.default.defaults({ - retry: { retries: 2 }, - timeout: 5000, + retry: options.retry, + timeout: options.timeout, headers: { 'Content-Type': 'application/json', 'User-Agent': util_1.ua.getUserAgent(), diff --git a/deps/npm/node_modules/sigstore/dist/external/index.d.ts b/deps/npm/node_modules/sigstore/dist/external/index.d.ts index 07251e93579b18..ef28eca4a951dd 100644 --- a/deps/npm/node_modules/sigstore/dist/external/index.d.ts +++ b/deps/npm/node_modules/sigstore/dist/external/index.d.ts @@ -1,3 +1,4 @@ export { HTTPError } from './error'; export { Fulcio } from './fulcio'; export { Rekor } from './rekor'; +export { TimestampAuthority } from './tsa'; diff --git a/deps/npm/node_modules/sigstore/dist/external/index.js b/deps/npm/node_modules/sigstore/dist/external/index.js index da5f0840012791..f40816e9b7ca40 100644 --- a/deps/npm/node_modules/sigstore/dist/external/index.js +++ b/deps/npm/node_modules/sigstore/dist/external/index.js @@ -1,6 +1,6 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.Rekor = exports.Fulcio = exports.HTTPError = void 0; +exports.TimestampAuthority = exports.Rekor = exports.Fulcio = exports.HTTPError = void 0; /* Copyright 2022 The Sigstore Authors. @@ -22,3 +22,5 @@ var fulcio_1 = require("./fulcio"); Object.defineProperty(exports, "Fulcio", { enumerable: true, get: function () { return fulcio_1.Fulcio; } }); var rekor_1 = require("./rekor"); Object.defineProperty(exports, "Rekor", { enumerable: true, get: function () { return rekor_1.Rekor; } }); +var tsa_1 = require("./tsa"); +Object.defineProperty(exports, "TimestampAuthority", { enumerable: true, get: function () { return tsa_1.TimestampAuthority; } }); diff --git a/deps/npm/node_modules/sigstore/dist/external/rekor.d.ts b/deps/npm/node_modules/sigstore/dist/external/rekor.d.ts index 55a909f11a35d9..fde9a50a5b5399 100644 --- a/deps/npm/node_modules/sigstore/dist/external/rekor.d.ts +++ b/deps/npm/node_modules/sigstore/dist/external/rekor.d.ts @@ -1,7 +1,8 @@ import { Entry, EntryKind } from '../tlog'; -export interface RekorOptions { +import type { FetchOptions } from '../types/fetch'; +export type RekorOptions = { baseURL: string; -} +} & FetchOptions; export interface SearchIndex { email?: string; hash?: string; diff --git a/deps/npm/node_modules/sigstore/dist/external/rekor.js b/deps/npm/node_modules/sigstore/dist/external/rekor.js index 6bb085c44cecd5..80650ce02ff9b1 100644 --- a/deps/npm/node_modules/sigstore/dist/external/rekor.js +++ b/deps/npm/node_modules/sigstore/dist/external/rekor.js @@ -28,8 +28,8 @@ const error_1 = require("./error"); class Rekor { constructor(options) { this.fetch = make_fetch_happen_1.default.defaults({ - retry: { retries: 2 }, - timeout: 5000, + retry: options.retry, + timeout: options.timeout, headers: { Accept: 'application/json', 'User-Agent': util_1.ua.getUserAgent(), diff --git a/deps/npm/node_modules/sigstore/dist/external/tsa.d.ts b/deps/npm/node_modules/sigstore/dist/external/tsa.d.ts new file mode 100644 index 00000000000000..9b5f31151a83d8 --- /dev/null +++ b/deps/npm/node_modules/sigstore/dist/external/tsa.d.ts @@ -0,0 +1,18 @@ +/// +import type { FetchOptions } from '../types/fetch'; +export interface TimestampRequest { + artifactHash: string; + hashAlgorithm: string; + certificates?: boolean; + nonce?: number; + tsaPolicyOID?: string; +} +export type TimestampAuthorityOptions = { + baseURL: string; +} & FetchOptions; +export declare class TimestampAuthority { + private fetch; + private baseUrl; + constructor(options: TimestampAuthorityOptions); + createTimestamp(request: TimestampRequest): Promise; +} diff --git a/deps/npm/node_modules/sigstore/dist/external/tsa.js b/deps/npm/node_modules/sigstore/dist/external/tsa.js new file mode 100644 index 00000000000000..5277d7d3f97071 --- /dev/null +++ b/deps/npm/node_modules/sigstore/dist/external/tsa.js @@ -0,0 +1,47 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TimestampAuthority = void 0; +/* +Copyright 2023 The Sigstore Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +const make_fetch_happen_1 = __importDefault(require("make-fetch-happen")); +const util_1 = require("../util"); +const error_1 = require("./error"); +class TimestampAuthority { + constructor(options) { + this.fetch = make_fetch_happen_1.default.defaults({ + retry: options.retry, + timeout: options.timeout, + headers: { + 'Content-Type': 'application/json', + 'User-Agent': util_1.ua.getUserAgent(), + }, + }); + this.baseUrl = options.baseURL; + } + async createTimestamp(request) { + const url = `${this.baseUrl}/api/v1/timestamp`; + const response = await this.fetch(url, { + method: 'POST', + body: JSON.stringify(request), + }); + (0, error_1.checkStatus)(response); + return response.buffer(); + } +} +exports.TimestampAuthority = TimestampAuthority; diff --git a/deps/npm/node_modules/sigstore/dist/sign.d.ts b/deps/npm/node_modules/sigstore/dist/sign.d.ts index 7d8b4f0de464ec..7d903c06e120a0 100644 --- a/deps/npm/node_modules/sigstore/dist/sign.d.ts +++ b/deps/npm/node_modules/sigstore/dist/sign.d.ts @@ -1,23 +1,28 @@ /// -import { CA } from './ca'; -import { Provider } from './identity'; -import { TLog } from './tlog'; import { SignerFunc } from './types/signature'; -import { Bundle } from './types/sigstore'; +import * as sigstore from './types/sigstore'; +import type { CA } from './ca'; +import type { Provider } from './identity'; +import type { TLog } from './tlog'; +import type { TSA } from './tsa'; export interface SignOptions { ca: CA; tlog: TLog; + tsa?: TSA; identityProviders: Provider[]; + tlogUpload?: boolean; signer?: SignerFunc; } export declare class Signer { private ca; private tlog; + private tsa?; + private tlogUpload; private signer; private identityProviders; constructor(options: SignOptions); - signBlob(payload: Buffer): Promise; - signAttestation(payload: Buffer, payloadType: string): Promise; + signBlob(payload: Buffer): Promise; + signAttestation(payload: Buffer, payloadType: string): Promise; private signWithEphemeralKey; private getIdentityToken; } diff --git a/deps/npm/node_modules/sigstore/dist/sign.js b/deps/npm/node_modules/sigstore/dist/sign.js index 97c3da04b065b7..96e6272750b493 100644 --- a/deps/npm/node_modules/sigstore/dist/sign.js +++ b/deps/npm/node_modules/sigstore/dist/sign.js @@ -1,13 +1,39 @@ "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.Signer = void 0; +const sigstore = __importStar(require("./types/sigstore")); const util_1 = require("./util"); class Signer { constructor(options) { this.identityProviders = []; this.ca = options.ca; this.tlog = options.tlog; + this.tsa = options.tsa; this.identityProviders = options.identityProviders; + this.tlogUpload = options.tlogUpload ?? true; this.signer = options.signer || this.signWithEphemeralKey.bind(this); } async signBlob(payload) { @@ -15,8 +41,18 @@ class Signer { const sigMaterial = await this.signer(payload); // Calculate artifact digest const digest = util_1.crypto.hash(payload); - // Create Rekor entry - return this.tlog.createMessageSignatureEntry(digest, sigMaterial); + // Create a Rekor entry (if tlogUpload is enabled) + const entry = this.tlogUpload + ? await this.tlog.createMessageSignatureEntry(digest, sigMaterial) + : undefined; + return sigstore.toMessageSignatureBundle({ + digest, + signature: sigMaterial, + tlogEntry: entry, + timestamp: this.tsa + ? await this.tsa.createTimestamp(sigMaterial.signature) + : undefined, + }); } async signAttestation(payload, payloadType) { // Pre-authentication encoding to be signed @@ -33,7 +69,18 @@ class Signer { }, ], }; - return this.tlog.createDSSEEntry(envelope, sigMaterial); + // Create a Rekor entry (if tlogUpload is enabled) + const entry = this.tlogUpload + ? await this.tlog.createDSSEEntry(envelope, sigMaterial) + : undefined; + return sigstore.toDSSEBundle({ + envelope, + signature: sigMaterial, + tlogEntry: entry, + timestamp: this.tsa + ? await this.tsa.createTimestamp(sigMaterial.signature) + : undefined, + }); } async signWithEphemeralKey(payload) { // Create emphemeral key pair diff --git a/deps/npm/node_modules/sigstore/dist/sigstore-utils.js b/deps/npm/node_modules/sigstore/dist/sigstore-utils.js index 79918a806b17db..13410520472294 100644 --- a/deps/npm/node_modules/sigstore/dist/sigstore-utils.js +++ b/deps/npm/node_modules/sigstore/dist/sigstore-utils.js @@ -67,9 +67,14 @@ async function createRekorEntry(dsseEnvelope, publicKey, options = {}) { const envelope = sigstore.Envelope.fromJSON(dsseEnvelope); const tlog = (0, config_1.createTLogClient)(options); const sigMaterial = (0, signature_1.extractSignatureMaterial)(envelope, publicKey); - const bundle = await tlog.createDSSEEntry(envelope, sigMaterial, { + const entry = await tlog.createDSSEEntry(envelope, sigMaterial, { fetchOnConflict: true, }); + const bundle = sigstore.toDSSEBundle({ + envelope, + signature: sigMaterial, + tlogEntry: entry, + }); return sigstore.Bundle.toJSON(bundle); } exports.createRekorEntry = createRekorEntry; diff --git a/deps/npm/node_modules/sigstore/dist/sigstore.d.ts b/deps/npm/node_modules/sigstore/dist/sigstore.d.ts index 97a64f61fd1d0e..d4fba2be9d01b9 100644 --- a/deps/npm/node_modules/sigstore/dist/sigstore.d.ts +++ b/deps/npm/node_modules/sigstore/dist/sigstore.d.ts @@ -1,15 +1,18 @@ /// import * as config from './config'; +import * as tuf from './tuf'; import * as sigstore from './types/sigstore'; export declare function sign(payload: Buffer, options?: config.SignOptions): Promise; export declare function attest(payload: Buffer, payloadType: string, options?: config.SignOptions): Promise; export declare function verify(bundle: sigstore.SerializedBundle, payload?: Buffer, options?: config.VerifyOptions): Promise; declare const tufUtils: { + client: (options?: config.TUFOptions) => Promise; getTarget: (path: string, options?: config.TUFOptions) => Promise; }; export type { SignOptions, VerifyOptions } from './config'; export { InternalError, PolicyError, ValidationError, VerificationError, } from './error'; export * as utils from './sigstore-utils'; +export type { TUF } from './tuf'; export type { SerializedBundle as Bundle, SerializedEnvelope as Envelope, } from './types/sigstore'; export { tufUtils as tuf }; export declare const DEFAULT_FULCIO_URL = "https://fulcio.sigstore.dev"; diff --git a/deps/npm/node_modules/sigstore/dist/sigstore.js b/deps/npm/node_modules/sigstore/dist/sigstore.js index f45270217b0171..8d245e17b2a0c8 100644 --- a/deps/npm/node_modules/sigstore/dist/sigstore.js +++ b/deps/npm/node_modules/sigstore/dist/sigstore.js @@ -52,6 +52,7 @@ async function sign(payload, options = {}) { ca, tlog, identityProviders: idps, + tlogUpload: options.tlogUpload, }); const bundle = await signer.signBlob(payload); return sigstore.Bundle.toJSON(bundle); @@ -60,11 +61,14 @@ exports.sign = sign; async function attest(payload, payloadType, options = {}) { const ca = config.createCAClient(options); const tlog = config.createTLogClient(options); + const tsa = config.createTSAClient(options); const idps = config.identityProviders(options); const signer = new sign_1.Signer({ ca, tlog, + tsa, identityProviders: idps, + tlogUpload: options.tlogUpload, }); const bundle = await signer.signAttestation(payload, payloadType); return sigstore.Bundle.toJSON(bundle); @@ -75,6 +79,8 @@ async function verify(bundle, payload, options = {}) { mirrorURL: options.tufMirrorURL, rootPath: options.tufRootPath, cachePath: options.tufCachePath, + retry: options.retry ?? config.DEFAULT_RETRY, + timeout: options.timeout ?? config.DEFAULT_TIMEOUT, }); const verifier = new verify_1.Verifier(trustedRoot, options.keySelector); const deserializedBundle = sigstore.bundleFromJSON(bundle); @@ -83,12 +89,21 @@ async function verify(bundle, payload, options = {}) { } exports.verify = verify; const tufUtils = { - getTarget: (path, options = {}) => { - return tuf.getTarget(path, { + client: (options = {}) => { + const t = new tuf.TUFClient({ mirrorURL: options.tufMirrorURL, rootPath: options.tufRootPath, cachePath: options.tufCachePath, + retry: options.retry ?? config.DEFAULT_RETRY, + timeout: options.timeout ?? config.DEFAULT_TIMEOUT, }); + return t.refresh().then(() => t); + }, + /* + * @deprecated Use tufUtils.client instead. + */ + getTarget: (path, options = {}) => { + return tufUtils.client(options).then((t) => t.getTarget(path)); }, }; exports.tuf = tufUtils; diff --git a/deps/npm/node_modules/sigstore/dist/tlog/index.d.ts b/deps/npm/node_modules/sigstore/dist/tlog/index.d.ts index 9d9cc77c70d657..7ef070c6337654 100644 --- a/deps/npm/node_modules/sigstore/dist/tlog/index.d.ts +++ b/deps/npm/node_modules/sigstore/dist/tlog/index.d.ts @@ -1,21 +1,23 @@ /// import { SignatureMaterial } from '../types/signature'; -import { Bundle, Envelope } from '../types/sigstore'; +import * as sigstore from '../types/sigstore'; +import { Entry } from './types'; +import type { FetchOptions } from '../types/fetch'; interface CreateEntryOptions { fetchOnConflict?: boolean; } export { Entry, EntryKind, HashedRekordKind } from './types'; export interface TLog { - createMessageSignatureEntry: (digest: Buffer, sigMaterial: SignatureMaterial) => Promise; - createDSSEEntry: (envelope: Envelope, sigMaterial: SignatureMaterial, options?: CreateEntryOptions) => Promise; + createMessageSignatureEntry: (digest: Buffer, sigMaterial: SignatureMaterial) => Promise; + createDSSEEntry: (envelope: sigstore.Envelope, sigMaterial: SignatureMaterial, options?: CreateEntryOptions) => Promise; } -export interface TLogClientOptions { +export type TLogClientOptions = { rekorBaseURL: string; -} +} & FetchOptions; export declare class TLogClient implements TLog { private rekor; constructor(options: TLogClientOptions); - createMessageSignatureEntry(digest: Buffer, sigMaterial: SignatureMaterial, options?: CreateEntryOptions): Promise; - createDSSEEntry(envelope: Envelope, sigMaterial: SignatureMaterial, options?: CreateEntryOptions): Promise; + createMessageSignatureEntry(digest: Buffer, sigMaterial: SignatureMaterial, options?: CreateEntryOptions): Promise; + createDSSEEntry(envelope: sigstore.Envelope, sigMaterial: SignatureMaterial, options?: CreateEntryOptions): Promise; private createEntry; } diff --git a/deps/npm/node_modules/sigstore/dist/tlog/index.js b/deps/npm/node_modules/sigstore/dist/tlog/index.js index 4193e55752ff00..7f5f531983b37d 100644 --- a/deps/npm/node_modules/sigstore/dist/tlog/index.js +++ b/deps/npm/node_modules/sigstore/dist/tlog/index.js @@ -18,21 +18,22 @@ limitations under the License. */ const error_1 = require("../error"); const external_1 = require("../external"); -const sigstore_1 = require("../types/sigstore"); const format_1 = require("./format"); class TLogClient { constructor(options) { - this.rekor = new external_1.Rekor({ baseURL: options.rekorBaseURL }); + this.rekor = new external_1.Rekor({ + baseURL: options.rekorBaseURL, + retry: options.retry, + timeout: options.timeout, + }); } async createMessageSignatureEntry(digest, sigMaterial, options = {}) { const proposedEntry = (0, format_1.toProposedHashedRekordEntry)(digest, sigMaterial); - const entry = await this.createEntry(proposedEntry, options.fetchOnConflict); - return sigstore_1.bundle.toMessageSignatureBundle(digest, sigMaterial, entry); + return this.createEntry(proposedEntry, options.fetchOnConflict); } async createDSSEEntry(envelope, sigMaterial, options = {}) { const proposedEntry = (0, format_1.toProposedIntotoEntry)(envelope, sigMaterial); - const entry = await this.createEntry(proposedEntry, options.fetchOnConflict); - return sigstore_1.bundle.toDSSEBundle(envelope, sigMaterial, entry); + return this.createEntry(proposedEntry, options.fetchOnConflict); } async createEntry(proposedEntry, fetchOnConflict = false) { let entry; diff --git a/deps/npm/node_modules/sigstore/dist/tsa/index.d.ts b/deps/npm/node_modules/sigstore/dist/tsa/index.d.ts new file mode 100644 index 00000000000000..e94b20c075e557 --- /dev/null +++ b/deps/npm/node_modules/sigstore/dist/tsa/index.d.ts @@ -0,0 +1,13 @@ +/// +import type { FetchOptions } from '../types/fetch'; +export interface TSA { + createTimestamp: (signature: Buffer) => Promise; +} +export type TSAClientOptions = { + tsaBaseURL: string; +} & FetchOptions; +export declare class TSAClient implements TSA { + private tsa; + constructor(options: TSAClientOptions); + createTimestamp(signature: Buffer): Promise; +} diff --git a/deps/npm/node_modules/sigstore/dist/tsa/index.js b/deps/npm/node_modules/sigstore/dist/tsa/index.js new file mode 100644 index 00000000000000..4951b24a93f4fe --- /dev/null +++ b/deps/npm/node_modules/sigstore/dist/tsa/index.js @@ -0,0 +1,47 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TSAClient = void 0; +/* +Copyright 2022 The Sigstore Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +const error_1 = require("../error"); +const external_1 = require("../external"); +const util_1 = require("../util"); +class TSAClient { + constructor(options) { + this.tsa = new external_1.TimestampAuthority({ + baseURL: options.tsaBaseURL, + retry: options.retry, + timeout: options.timeout, + }); + } + async createTimestamp(signature) { + const request = { + artifactHash: util_1.crypto.hash(signature).toString('base64'), + hashAlgorithm: 'sha256', + }; + try { + return await this.tsa.createTimestamp(request); + } + catch (err) { + throw new error_1.InternalError({ + code: 'TSA_CREATE_TIMESTAMP_ERROR', + message: 'error creating timestamp', + cause: err, + }); + } + } +} +exports.TSAClient = TSAClient; diff --git a/deps/npm/node_modules/sigstore/dist/tuf/index.d.ts b/deps/npm/node_modules/sigstore/dist/tuf/index.d.ts index 53b9c094d57d3e..12b6b7a423ef5d 100644 --- a/deps/npm/node_modules/sigstore/dist/tuf/index.d.ts +++ b/deps/npm/node_modules/sigstore/dist/tuf/index.d.ts @@ -1,8 +1,17 @@ import * as sigstore from '../types/sigstore'; -export interface TUFOptions { +import type { FetchOptions } from '../types/fetch'; +export type TUFOptions = { cachePath?: string; mirrorURL?: string; rootPath?: string; +} & FetchOptions; +export interface TUF { + getTarget(targetName: string): Promise; } export declare function getTrustedRoot(options?: TUFOptions): Promise; -export declare function getTarget(targetName: string, options?: TUFOptions): Promise; +export declare class TUFClient implements TUF { + private updater; + constructor(options: TUFOptions); + refresh(): Promise; + getTarget(targetName: string): Promise; +} diff --git a/deps/npm/node_modules/sigstore/dist/tuf/index.js b/deps/npm/node_modules/sigstore/dist/tuf/index.js index 89923d63fa6577..86a081de9f3afb 100644 --- a/deps/npm/node_modules/sigstore/dist/tuf/index.js +++ b/deps/npm/node_modules/sigstore/dist/tuf/index.js @@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.getTarget = exports.getTrustedRoot = void 0; +exports.TUFClient = exports.getTrustedRoot = void 0; /* Copyright 2023 The Sigstore Authors. @@ -53,20 +53,28 @@ const DEFAULT_CACHE_DIR = util_1.appdata.appDataPath('sigstore-js'); const DEFAULT_MIRROR_URL = 'https://tuf-repo-cdn.sigstore.dev'; const DEFAULT_TUF_ROOT_PATH = '../../store/public-good-instance-root.json'; async function getTrustedRoot(options = {}) { - const trustedRoot = await getTarget(TRUSTED_ROOT_TARGET, options); + const client = new TUFClient(options); + const trustedRoot = await client.getTarget(TRUSTED_ROOT_TARGET); return sigstore.TrustedRoot.fromJSON(JSON.parse(trustedRoot)); } exports.getTrustedRoot = getTrustedRoot; -async function getTarget(targetName, options = {}) { - const cachePath = options.cachePath || DEFAULT_CACHE_DIR; - const tufRootPath = options.rootPath || require.resolve(DEFAULT_TUF_ROOT_PATH); - const mirrorURL = options.mirrorURL || DEFAULT_MIRROR_URL; - initTufCache(cachePath, tufRootPath); - const remote = initRemoteConfig(cachePath, mirrorURL); - const repoClient = initClient(cachePath, remote); - return (0, target_1.readTarget)(repoClient, targetName); +class TUFClient { + constructor(options) { + const cachePath = options.cachePath || DEFAULT_CACHE_DIR; + const tufRootPath = options.rootPath || require.resolve(DEFAULT_TUF_ROOT_PATH); + const mirrorURL = options.mirrorURL || DEFAULT_MIRROR_URL; + initTufCache(cachePath, tufRootPath); + const remote = initRemoteConfig(cachePath, mirrorURL); + this.updater = initClient(cachePath, remote, options); + } + async refresh() { + return this.updater.refresh(); + } + getTarget(targetName) { + return (0, target_1.readTarget)(this.updater, targetName); + } } -exports.getTarget = getTarget; +exports.TUFClient = TUFClient; // Initializes the TUF cache directory structure including the initial // root.json file. If the cache directory does not exist, it will be // created. If the targets directory does not exist, it will be created. @@ -102,12 +110,29 @@ function initRemoteConfig(rootDir, mirrorURL) { } return remoteConfig; } -function initClient(cachePath, remote) { +function initClient(cachePath, remote, options) { const baseURL = remote.mirror; + const config = { + fetchTimeout: options.timeout, + }; + // tuf-js only supports a number for fetchRetries so we have to + // convert the boolean and object options to a number. + if (typeof options.retry !== 'undefined') { + if (typeof options.retry === 'number') { + config.fetchRetries = options.retry; + } + else if (typeof options.retry === 'object') { + config.fetchRetries = options.retry.retries; + } + else if (options.retry === true) { + config.fetchRetries = 1; + } + } return new tuf_js_1.Updater({ metadataBaseUrl: baseURL, targetBaseUrl: `${baseURL}/targets`, metadataDir: cachePath, targetDir: path_1.default.join(cachePath, 'targets'), + config, }); } diff --git a/deps/npm/node_modules/sigstore/dist/tuf/target.js b/deps/npm/node_modules/sigstore/dist/tuf/target.js index b79411c3dd0a4a..d7df61e5a40761 100644 --- a/deps/npm/node_modules/sigstore/dist/tuf/target.js +++ b/deps/npm/node_modules/sigstore/dist/tuf/target.js @@ -46,7 +46,7 @@ exports.readTarget = readTarget; async function getTargetPath(tuf, target) { let targetInfo; try { - targetInfo = await tuf.refresh().then(() => tuf.getTargetInfo(target)); + targetInfo = await tuf.getTargetInfo(target); } catch (err) { throw new error_1.InternalError({ diff --git a/deps/npm/node_modules/sigstore/dist/types/fetch.d.ts b/deps/npm/node_modules/sigstore/dist/types/fetch.d.ts new file mode 100644 index 00000000000000..510aeee6a37d72 --- /dev/null +++ b/deps/npm/node_modules/sigstore/dist/types/fetch.d.ts @@ -0,0 +1,6 @@ +import type { MakeFetchHappenOptions } from 'make-fetch-happen'; +export type Retry = MakeFetchHappenOptions['retry']; +export type FetchOptions = { + retry?: Retry; + timeout?: number | undefined; +}; diff --git a/deps/npm/node_modules/sigstore/dist/types/fetch.js b/deps/npm/node_modules/sigstore/dist/types/fetch.js new file mode 100644 index 00000000000000..c8ad2e549bdc68 --- /dev/null +++ b/deps/npm/node_modules/sigstore/dist/types/fetch.js @@ -0,0 +1,2 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/deps/npm/node_modules/sigstore/dist/types/sigstore/index.d.ts b/deps/npm/node_modules/sigstore/dist/types/sigstore/index.d.ts index e80e6b15e60aa7..1eeaac215b9a9f 100644 --- a/deps/npm/node_modules/sigstore/dist/types/sigstore/index.d.ts +++ b/deps/npm/node_modules/sigstore/dist/types/sigstore/index.d.ts @@ -1,10 +1,10 @@ /// import { ArtifactVerificationOptions, Bundle, Envelope, TransparencyLogEntry, VerificationMaterial } from '@sigstore/protobuf-specs'; -import { Entry } from '../../tlog'; import { x509Certificate } from '../../x509/cert'; -import { SignatureMaterial } from '../signature'; import { WithRequired } from '../utility'; import { ValidBundle } from './validate'; +import type { Entry } from '../../tlog'; +import type { SignatureMaterial } from '../signature'; export * from '@sigstore/protobuf-specs'; export * from './serialized'; export * from './validate'; @@ -28,8 +28,16 @@ export type CAArtifactVerificationOptions = WithRequired; export declare function isVerifiableTransparencyLogEntry(entry: TransparencyLogEntry): entry is VerifiableTransparencyLogEntry; -export declare const bundle: { - toDSSEBundle: (envelope: Envelope, signature: SignatureMaterial, rekorEntry: Entry) => Bundle; - toMessageSignatureBundle: (digest: Buffer, signature: SignatureMaterial, rekorEntry: Entry) => Bundle; -}; +export declare function toDSSEBundle({ envelope, signature, tlogEntry, timestamp, }: { + envelope: Envelope; + signature: SignatureMaterial; + tlogEntry?: Entry; + timestamp?: Buffer; +}): Bundle; +export declare function toMessageSignatureBundle({ digest, signature, tlogEntry, timestamp, }: { + digest: Buffer; + signature: SignatureMaterial; + tlogEntry?: Entry; + timestamp?: Buffer; +}): Bundle; export declare function signingCertificate(bundle: Bundle): x509Certificate | undefined; diff --git a/deps/npm/node_modules/sigstore/dist/types/sigstore/index.js b/deps/npm/node_modules/sigstore/dist/types/sigstore/index.js index 9fcdb42bdcf343..544db63b002bf8 100644 --- a/deps/npm/node_modules/sigstore/dist/types/sigstore/index.js +++ b/deps/npm/node_modules/sigstore/dist/types/sigstore/index.js @@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.signingCertificate = exports.bundle = exports.isVerifiableTransparencyLogEntry = exports.isCAVerificationOptions = exports.isBundleWithCertificateChain = exports.isBundleWithVerificationMaterial = exports.bundleFromJSON = void 0; +exports.signingCertificate = exports.toMessageSignatureBundle = exports.toDSSEBundle = exports.isVerifiableTransparencyLogEntry = exports.isCAVerificationOptions = exports.isBundleWithCertificateChain = exports.isBundleWithVerificationMaterial = exports.bundleFromJSON = void 0; /* Copyright 2023 The Sigstore Authors. @@ -69,16 +69,20 @@ function isVerifiableTransparencyLogEntry(entry) { entry.kindVersion !== undefined); } exports.isVerifiableTransparencyLogEntry = isVerifiableTransparencyLogEntry; -exports.bundle = { - toDSSEBundle: (envelope, signature, rekorEntry) => ({ +function toDSSEBundle({ envelope, signature, tlogEntry, timestamp, }) { + return { mediaType: BUNDLE_MEDIA_TYPE, - content: { - $case: 'dsseEnvelope', - dsseEnvelope: envelope, - }, - verificationMaterial: toVerificationMaterial(signature, rekorEntry), - }), - toMessageSignatureBundle: (digest, signature, rekorEntry) => ({ + content: { $case: 'dsseEnvelope', dsseEnvelope: envelope }, + verificationMaterial: toVerificationMaterial({ + signature, + tlogEntry, + timestamp, + }), + }; +} +exports.toDSSEBundle = toDSSEBundle; +function toMessageSignatureBundle({ digest, signature, tlogEntry, timestamp, }) { + return { mediaType: BUNDLE_MEDIA_TYPE, content: { $case: 'messageSignature', @@ -90,9 +94,14 @@ exports.bundle = { signature: signature.signature, }, }, - verificationMaterial: toVerificationMaterial(signature, rekorEntry), - }), -}; + verificationMaterial: toVerificationMaterial({ + signature, + tlogEntry, + timestamp, + }), + }; +} +exports.toMessageSignatureBundle = toMessageSignatureBundle; function toTransparencyLogEntry(entry) { const set = Buffer.from(entry.verification.signedEntryTimestamp, 'base64'); const logID = Buffer.from(entry.logID, 'hex'); @@ -116,13 +125,15 @@ function toTransparencyLogEntry(entry) { canonicalizedBody: Buffer.from(entry.body, 'base64'), }; } -function toVerificationMaterial(signature, entry) { +function toVerificationMaterial({ signature, tlogEntry, timestamp, }) { return { content: signature.certificates ? toVerificationMaterialx509CertificateChain(signature.certificates) : toVerificationMaterialPublicKey(signature.key.id || ''), - tlogEntries: [toTransparencyLogEntry(entry)], - timestampVerificationData: undefined, + tlogEntries: tlogEntry ? [toTransparencyLogEntry(tlogEntry)] : [], + timestampVerificationData: timestamp + ? toTimestampVerificationData(timestamp) + : undefined, }; } function toVerificationMaterialx509CertificateChain(certificates) { @@ -138,6 +149,11 @@ function toVerificationMaterialx509CertificateChain(certificates) { function toVerificationMaterialPublicKey(hint) { return { $case: 'publicKey', publicKey: { hint } }; } +function toTimestampVerificationData(timestamp) { + return { + rfc3161Timestamps: [{ signedTimestamp: timestamp }], + }; +} function signingCertificate(bundle) { if (!isBundleWithCertificateChain(bundle)) { return undefined; diff --git a/deps/npm/node_modules/sigstore/dist/verify.js b/deps/npm/node_modules/sigstore/dist/verify.js index 9d21b553ac5232..49f63d93abb268 100644 --- a/deps/npm/node_modules/sigstore/dist/verify.js +++ b/deps/npm/node_modules/sigstore/dist/verify.js @@ -41,7 +41,9 @@ class Verifier { if (sigstore.isBundleWithCertificateChain(bundle)) { this.verifySigningCertificate(bundle, options); } - this.verifyTLogEntries(bundle, options); + if (options.tlogOptions.disable === false) { + this.verifyTLogEntries(bundle, options); + } } // Performs bundle signature verification. Determines the type of the bundle // content and delegates to the appropriate signature verification function. diff --git a/deps/npm/node_modules/sigstore/dist/x509/verify.d.ts b/deps/npm/node_modules/sigstore/dist/x509/verify.d.ts index 04c324dca01c06..b12594adb2ea88 100644 --- a/deps/npm/node_modules/sigstore/dist/x509/verify.d.ts +++ b/deps/npm/node_modules/sigstore/dist/x509/verify.d.ts @@ -1,7 +1,7 @@ import { x509Certificate } from './cert'; interface VerifyCertificateChainOptions { trustedCerts: x509Certificate[]; - certs: x509Certificate[]; + untrustedCert: x509Certificate; validAt?: Date; } export declare function verifyCertificateChain(opts: VerifyCertificateChainOptions): x509Certificate[]; diff --git a/deps/npm/node_modules/sigstore/dist/x509/verify.js b/deps/npm/node_modules/sigstore/dist/x509/verify.js index cc34a9ea23abe0..b4c7f39912a847 100644 --- a/deps/npm/node_modules/sigstore/dist/x509/verify.js +++ b/deps/npm/node_modules/sigstore/dist/x509/verify.js @@ -24,15 +24,15 @@ function verifyCertificateChain(opts) { exports.verifyCertificateChain = verifyCertificateChain; class CertificateChainVerifier { constructor(opts) { - this.certs = opts.certs; + this.untrustedCert = opts.untrustedCert; this.trustedCerts = opts.trustedCerts; - this.localCerts = dedupeCertificates([...opts.trustedCerts, ...opts.certs]); + this.localCerts = dedupeCertificates([ + ...opts.trustedCerts, + opts.untrustedCert, + ]); this.validAt = opts.validAt || new Date(); } verify() { - if (this.certs.length === 0) { - throw new error_1.VerificationError('No certificates provided'); - } // Construct certificate path from leaf to root const certificatePath = this.sort(); // Perform validation checks on each certificate in the path @@ -41,7 +41,7 @@ class CertificateChainVerifier { return certificatePath; } sort() { - const leafCert = this.localCerts[this.localCerts.length - 1]; + const leafCert = this.untrustedCert; // Construct all possible paths from the leaf let paths = this.buildPaths(leafCert); // Filter for paths which contain a trusted certificate @@ -52,7 +52,9 @@ class CertificateChainVerifier { // Find the shortest of possible paths const path = paths.reduce((prev, curr) => prev.length < curr.length ? prev : curr); // Construct chain from shortest path - return [leafCert, ...path]; + // Removes the last certificate in the path, which will be a second copy + // of the root certificate given that the root is self-signed. + return [leafCert, ...path].slice(0, -1); } // Recursively build all possible paths from the leaf to the root buildPaths(certificate) { @@ -123,8 +125,8 @@ class CertificateChainVerifier { return issuers; } checkPath(path) { - if (path.length < 2) { - throw new error_1.VerificationError('Certificate chain must contain at least two certificates'); + if (path.length < 1) { + throw new error_1.VerificationError('Certificate chain must contain at least one certificate'); } // Check that all certificates are valid at the check date const validForDate = path.every((cert) => cert.validForDate(this.validAt)); @@ -143,6 +145,22 @@ class CertificateChainVerifier { throw new error_1.VerificationError('Incorrect certificate name chaining'); } } + // Check pathlength constraints + for (let i = 0; i < path.length; i++) { + const cert = path[i]; + // If the certificate is a CA, check the path length + if (cert.extBasicConstraints?.isCA) { + const pathLength = cert.extBasicConstraints.pathLenConstraint; + // The path length, if set, indicates how many intermediate + // certificates (NOT including the leaf) are allowed to follow. The + // pathLength constraint of any intermediate CA certificate MUST be + // greater than or equal to it's own depth in the chain (with an + // adjustment for the leaf certificate) + if (pathLength !== undefined && pathLength < i - 1) { + throw new error_1.VerificationError('Path length constraint exceeded'); + } + } + } } } // Remove duplicate certificates from the array diff --git a/deps/npm/node_modules/sigstore/package.json b/deps/npm/node_modules/sigstore/package.json index 2df3467186765e..2ca34e2a445ad2 100644 --- a/deps/npm/node_modules/sigstore/package.json +++ b/deps/npm/node_modules/sigstore/package.json @@ -1,58 +1,40 @@ { "name": "sigstore", - "version": "1.4.0", + "version": "1.5.2", "description": "code-signing for npm packages", "main": "dist/index.js", "types": "dist/index.d.ts", "scripts": { - "build": "tsc", - "test": "jest", - "test:watch": "jest --watch", - "test:ci": "jest --maxWorkers=2 --coverage", - "lint": "eslint --fix --ext .ts src/**", - "lint:check": "eslint --max-warnings 0 --ext .ts src/**", - "format": "prettier --write \"src/**/*\"", - "release": "npm run build && changeset publish", - "codegen:rekor": "./hack/generate-rekor-types" + "build": "tsc --build", + "test": "jest" }, "bin": { "sigstore": "bin/sigstore.js" }, - "repository": { - "type": "git", - "url": "git+https://github.com/sigstore/sigstore-js.git" - }, - "publishConfig": { - "provenance": true - }, "files": [ "dist", "store" ], "author": "bdehamer@github.com", "license": "Apache-2.0", + "repository": { + "type": "git", + "url": "git+https://github.com/sigstore/sigstore-js.git" + }, "bugs": { "url": "https://github.com/sigstore/sigstore-js/issues" }, - "homepage": "https://github.com/sigstore/sigstore-js#readme", + "homepage": "https://github.com/sigstore/sigstore-js/tree/main/packages/client#readme", + "publishConfig": { + "provenance": true + }, "devDependencies": { - "@changesets/cli": "^2.26.0", "@total-typescript/shoehorn": "^0.1.0", - "@tsconfig/node14": "^1.0.3", "@tufjs/repo-mock": "^1.1.0", - "@types/jest": "^29.4.0", "@types/make-fetch-happen": "^10.0.0", - "@types/node": "^18.6.5", - "@typescript-eslint/eslint-plugin": "^5.26.0", - "@typescript-eslint/parser": "^5.26.0", - "eslint": "^8.16.0", - "eslint-config-prettier": "^8.5.0", - "eslint-plugin-prettier": "^4.0.0", - "jest": "^29.4.1", - "json-schema-to-typescript": "^12.0.0", + "@types/node": "^20.0.0", + "json-schema-to-typescript": "^13.0.0", "nock": "^13.2.4", - "prettier": "^2.6.2", - "ts-jest": "^29.0.5", "typescript": "^5.0.2" }, "dependencies": { diff --git a/deps/npm/node_modules/sigstore/store/public-good-instance-root.json b/deps/npm/node_modules/sigstore/store/public-good-instance-root.json index 38f80f940473ac..e95c7e88cdf092 100644 --- a/deps/npm/node_modules/sigstore/store/public-good-instance-root.json +++ b/deps/npm/node_modules/sigstore/store/public-good-instance-root.json @@ -1,156 +1 @@ -{ - "signed": { - "_type": "root", - "spec_version": "1.0", - "version": 5, - "expires": "2023-04-18T18:13:43Z", - "keys": { - "25a0eb450fd3ee2bd79218c963dce3f1cc6118badf251bf149f0bd07d5cabe99": { - "keytype": "ecdsa-sha2-nistp256", - "scheme": "ecdsa-sha2-nistp256", - "keyid_hash_algorithms": [ - "sha256", - "sha512" - ], - "keyval": { - "public": "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEEXsz3SZXFb8jMV42j6pJlyjbjR8K\nN3Bwocexq6LMIb5qsWKOQvLN16NUefLc4HswOoumRsVVaajSpQS6fobkRw==\n-----END PUBLIC KEY-----\n" - } - }, - "2e61cd0cbf4a8f45809bda9f7f78c0d33ad11842ff94ae340873e2664dc843de": { - "keytype": "ecdsa-sha2-nistp256", - "scheme": "ecdsa-sha2-nistp256", - "keyid_hash_algorithms": [ - "sha256", - "sha512" - ], - "keyval": { - "public": "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE0ghrh92Lw1Yr3idGV5WqCtMDB8Cx\n+D8hdC4w2ZLNIplVRoVGLskYa3gheMyOjiJ8kPi15aQ2//7P+oj7UvJPGw==\n-----END PUBLIC KEY-----\n" - } - }, - "45b283825eb184cabd582eb17b74fc8ed404f68cf452acabdad2ed6f90ce216b": { - "keytype": "ecdsa-sha2-nistp256", - "scheme": "ecdsa-sha2-nistp256", - "keyid_hash_algorithms": [ - "sha256", - "sha512" - ], - "keyval": { - "public": "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAELrWvNt94v4R085ELeeCMxHp7PldF\n0/T1GxukUh2ODuggLGJE0pc1e8CSBf6CS91Fwo9FUOuRsjBUld+VqSyCdQ==\n-----END PUBLIC KEY-----\n" - } - }, - "7f7513b25429a64473e10ce3ad2f3da372bbdd14b65d07bbaf547e7c8bbbe62b": { - "keytype": "ecdsa-sha2-nistp256", - "scheme": "ecdsa-sha2-nistp256", - "keyid_hash_algorithms": [ - "sha256", - "sha512" - ], - "keyval": { - "public": "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEinikSsAQmYkNeH5eYq/CnIzLaacO\nxlSaawQDOwqKy/tCqxq5xxPSJc21K4WIhs9GyOkKfzueY3GILzcMJZ4cWw==\n-----END PUBLIC KEY-----\n" - } - }, - "e1863ba02070322ebc626dcecf9d881a3a38c35c3b41a83765b6ad6c37eaec2a": { - "keytype": "ecdsa-sha2-nistp256", - "scheme": "ecdsa-sha2-nistp256", - "keyid_hash_algorithms": [ - "sha256", - "sha512" - ], - "keyval": { - "public": "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEWRiGr5+j+3J5SsH+Ztr5nE2H2wO7\nBV+nO3s93gLca18qTOzHY1oWyAGDykMSsGTUBSt9D+An0KfKsD2mfSM42Q==\n-----END PUBLIC KEY-----\n" - } - }, - "f5312f542c21273d9485a49394386c4575804770667f2ddb59b3bf0669fddd2f": { - "keytype": "ecdsa-sha2-nistp256", - "scheme": "ecdsa-sha2-nistp256", - "keyid_hash_algorithms": [ - "sha256", - "sha512" - ], - "keyval": { - "public": "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEzBzVOmHCPojMVLSI364WiiV8NPrD\n6IgRxVliskz/v+y3JER5mcVGcONliDcWMC5J2lfHmjPNPhb4H7xm8LzfSA==\n-----END PUBLIC KEY-----\n" - } - }, - "ff51e17fcf253119b7033f6f57512631da4a0969442afcf9fc8b141c7f2be99c": { - "keytype": "ecdsa-sha2-nistp256", - "scheme": "ecdsa-sha2-nistp256", - "keyid_hash_algorithms": [ - "sha256", - "sha512" - ], - "keyval": { - "public": "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEy8XKsmhBYDI8Jc0GwzBxeKax0cm5\nSTKEU65HPFunUn41sT8pi0FjM4IkHz/YUmwmLUO0Wt7lxhj6BkLIK4qYAw==\n-----END PUBLIC KEY-----\n" - } - } - }, - "roles": { - "root": { - "keyids": [ - "ff51e17fcf253119b7033f6f57512631da4a0969442afcf9fc8b141c7f2be99c", - "25a0eb450fd3ee2bd79218c963dce3f1cc6118badf251bf149f0bd07d5cabe99", - "f5312f542c21273d9485a49394386c4575804770667f2ddb59b3bf0669fddd2f", - "7f7513b25429a64473e10ce3ad2f3da372bbdd14b65d07bbaf547e7c8bbbe62b", - "2e61cd0cbf4a8f45809bda9f7f78c0d33ad11842ff94ae340873e2664dc843de" - ], - "threshold": 3 - }, - "snapshot": { - "keyids": [ - "45b283825eb184cabd582eb17b74fc8ed404f68cf452acabdad2ed6f90ce216b" - ], - "threshold": 1 - }, - "targets": { - "keyids": [ - "ff51e17fcf253119b7033f6f57512631da4a0969442afcf9fc8b141c7f2be99c", - "25a0eb450fd3ee2bd79218c963dce3f1cc6118badf251bf149f0bd07d5cabe99", - "f5312f542c21273d9485a49394386c4575804770667f2ddb59b3bf0669fddd2f", - "7f7513b25429a64473e10ce3ad2f3da372bbdd14b65d07bbaf547e7c8bbbe62b", - "2e61cd0cbf4a8f45809bda9f7f78c0d33ad11842ff94ae340873e2664dc843de" - ], - "threshold": 3 - }, - "timestamp": { - "keyids": [ - "e1863ba02070322ebc626dcecf9d881a3a38c35c3b41a83765b6ad6c37eaec2a" - ], - "threshold": 1 - } - }, - "consistent_snapshot": true - }, - "signatures": [ - { - "keyid": "ff51e17fcf253119b7033f6f57512631da4a0969442afcf9fc8b141c7f2be99c", - "sig": "3045022100fc1c2be509ce50ea917bbad1d9efe9d96c8c2ebea04af2717aa3d9c6fe617a75022012eef282a19f2d8bd4818aa333ef48a06489f49d4d34a20b8fe8fc867bb25a7a" - }, - { - "keyid": "25a0eb450fd3ee2bd79218c963dce3f1cc6118badf251bf149f0bd07d5cabe99", - "sig": "30450221008a4392ae5057fc00778b651e61fea244766a4ae58db84d9f1d3810720ab0f3b702207c49e59e8031318caf02252ecea1281cecc1e5986c309a9cef61f455ecf7165d" - }, - { - "keyid": "7f7513b25429a64473e10ce3ad2f3da372bbdd14b65d07bbaf547e7c8bbbe62b", - "sig": "3046022100da1b8dc5d53aaffbbfac98de3e23ee2d2ad3446a7bed09fac0f88bae19be2587022100b681c046afc3919097dfe794e0d819be891e2e850aade315bec06b0c4dea221b" - }, - { - "keyid": "2e61cd0cbf4a8f45809bda9f7f78c0d33ad11842ff94ae340873e2664dc843de", - "sig": "3046022100b534e0030e1b271133ecfbdf3ba9fbf3becb3689abea079a2150afbb63cdb7c70221008c39a718fd9495f249b4ab8788d5b9dc269f0868dbe38b272f48207359d3ded9" - }, - { - "keyid": "2f64fb5eac0cf94dd39bb45308b98920055e9a0d8e012a7220787834c60aef97", - "sig": "3045022100fc1c2be509ce50ea917bbad1d9efe9d96c8c2ebea04af2717aa3d9c6fe617a75022012eef282a19f2d8bd4818aa333ef48a06489f49d4d34a20b8fe8fc867bb25a7a" - }, - { - "keyid": "eaf22372f417dd618a46f6c627dbc276e9fd30a004fc94f9be946e73f8bd090b", - "sig": "30450221008a4392ae5057fc00778b651e61fea244766a4ae58db84d9f1d3810720ab0f3b702207c49e59e8031318caf02252ecea1281cecc1e5986c309a9cef61f455ecf7165d" - }, - { - "keyid": "f505595165a177a41750a8e864ed1719b1edfccd5a426fd2c0ffda33ce7ff209", - "sig": "3046022100da1b8dc5d53aaffbbfac98de3e23ee2d2ad3446a7bed09fac0f88bae19be2587022100b681c046afc3919097dfe794e0d819be891e2e850aade315bec06b0c4dea221b" - }, - { - "keyid": "75e867ab10e121fdef32094af634707f43ddd79c6bab8ad6c5ab9f03f4ea8c90", - "sig": "3046022100b534e0030e1b271133ecfbdf3ba9fbf3becb3689abea079a2150afbb63cdb7c70221008c39a718fd9495f249b4ab8788d5b9dc269f0868dbe38b272f48207359d3ded9" - } - ] -} \ No newline at end of file +{"signed":{"_type":"root","spec_version":"1.0","version":7,"expires":"2023-10-04T13:08:11Z","keys":{"25a0eb450fd3ee2bd79218c963dce3f1cc6118badf251bf149f0bd07d5cabe99":{"keytype":"ecdsa-sha2-nistp256","scheme":"ecdsa-sha2-nistp256","keyid_hash_algorithms":["sha256","sha512"],"keyval":{"public":"-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEEXsz3SZXFb8jMV42j6pJlyjbjR8K\nN3Bwocexq6LMIb5qsWKOQvLN16NUefLc4HswOoumRsVVaajSpQS6fobkRw==\n-----END PUBLIC KEY-----\n"}},"2e61cd0cbf4a8f45809bda9f7f78c0d33ad11842ff94ae340873e2664dc843de":{"keytype":"ecdsa-sha2-nistp256","scheme":"ecdsa-sha2-nistp256","keyid_hash_algorithms":["sha256","sha512"],"keyval":{"public":"-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE0ghrh92Lw1Yr3idGV5WqCtMDB8Cx\n+D8hdC4w2ZLNIplVRoVGLskYa3gheMyOjiJ8kPi15aQ2//7P+oj7UvJPGw==\n-----END PUBLIC KEY-----\n"}},"45b283825eb184cabd582eb17b74fc8ed404f68cf452acabdad2ed6f90ce216b":{"keytype":"ecdsa-sha2-nistp256","scheme":"ecdsa-sha2-nistp256","keyid_hash_algorithms":["sha256","sha512"],"keyval":{"public":"-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAELrWvNt94v4R085ELeeCMxHp7PldF\n0/T1GxukUh2ODuggLGJE0pc1e8CSBf6CS91Fwo9FUOuRsjBUld+VqSyCdQ==\n-----END PUBLIC KEY-----\n"}},"7f7513b25429a64473e10ce3ad2f3da372bbdd14b65d07bbaf547e7c8bbbe62b":{"keytype":"ecdsa-sha2-nistp256","scheme":"ecdsa-sha2-nistp256","keyid_hash_algorithms":["sha256","sha512"],"keyval":{"public":"-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEinikSsAQmYkNeH5eYq/CnIzLaacO\nxlSaawQDOwqKy/tCqxq5xxPSJc21K4WIhs9GyOkKfzueY3GILzcMJZ4cWw==\n-----END PUBLIC KEY-----\n"}},"e1863ba02070322ebc626dcecf9d881a3a38c35c3b41a83765b6ad6c37eaec2a":{"keytype":"ecdsa-sha2-nistp256","scheme":"ecdsa-sha2-nistp256","keyid_hash_algorithms":["sha256","sha512"],"keyval":{"public":"-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEWRiGr5+j+3J5SsH+Ztr5nE2H2wO7\nBV+nO3s93gLca18qTOzHY1oWyAGDykMSsGTUBSt9D+An0KfKsD2mfSM42Q==\n-----END PUBLIC KEY-----\n"}},"f5312f542c21273d9485a49394386c4575804770667f2ddb59b3bf0669fddd2f":{"keytype":"ecdsa-sha2-nistp256","scheme":"ecdsa-sha2-nistp256","keyid_hash_algorithms":["sha256","sha512"],"keyval":{"public":"-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEzBzVOmHCPojMVLSI364WiiV8NPrD\n6IgRxVliskz/v+y3JER5mcVGcONliDcWMC5J2lfHmjPNPhb4H7xm8LzfSA==\n-----END PUBLIC KEY-----\n"}},"ff51e17fcf253119b7033f6f57512631da4a0969442afcf9fc8b141c7f2be99c":{"keytype":"ecdsa-sha2-nistp256","scheme":"ecdsa-sha2-nistp256","keyid_hash_algorithms":["sha256","sha512"],"keyval":{"public":"-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEy8XKsmhBYDI8Jc0GwzBxeKax0cm5\nSTKEU65HPFunUn41sT8pi0FjM4IkHz/YUmwmLUO0Wt7lxhj6BkLIK4qYAw==\n-----END PUBLIC KEY-----\n"}}},"roles":{"root":{"keyids":["ff51e17fcf253119b7033f6f57512631da4a0969442afcf9fc8b141c7f2be99c","25a0eb450fd3ee2bd79218c963dce3f1cc6118badf251bf149f0bd07d5cabe99","f5312f542c21273d9485a49394386c4575804770667f2ddb59b3bf0669fddd2f","7f7513b25429a64473e10ce3ad2f3da372bbdd14b65d07bbaf547e7c8bbbe62b","2e61cd0cbf4a8f45809bda9f7f78c0d33ad11842ff94ae340873e2664dc843de"],"threshold":3},"snapshot":{"keyids":["45b283825eb184cabd582eb17b74fc8ed404f68cf452acabdad2ed6f90ce216b"],"threshold":1},"targets":{"keyids":["ff51e17fcf253119b7033f6f57512631da4a0969442afcf9fc8b141c7f2be99c","25a0eb450fd3ee2bd79218c963dce3f1cc6118badf251bf149f0bd07d5cabe99","f5312f542c21273d9485a49394386c4575804770667f2ddb59b3bf0669fddd2f","7f7513b25429a64473e10ce3ad2f3da372bbdd14b65d07bbaf547e7c8bbbe62b","2e61cd0cbf4a8f45809bda9f7f78c0d33ad11842ff94ae340873e2664dc843de"],"threshold":3},"timestamp":{"keyids":["e1863ba02070322ebc626dcecf9d881a3a38c35c3b41a83765b6ad6c37eaec2a"],"threshold":1}},"consistent_snapshot":true},"signatures":[{"keyid":"25a0eb450fd3ee2bd79218c963dce3f1cc6118badf251bf149f0bd07d5cabe99","sig":"3046022100c0610c0055ce5c4a52d054d7322e7b514d55baf44423d63aa4daa077cc60fd1f022100a097f2803f090fb66c42ead915a2c46ebe7db53a32bf18f2188275cc936f8bdd"},{"keyid":"f5312f542c21273d9485a49394386c4575804770667f2ddb59b3bf0669fddd2f","sig":"304502203134f0468810299d5493a867c40630b341296b92e59c29821311d353343bb3a4022100e667ae3d304e7e3da0894c7425f6b9ecd917106841280e5cf6f3496ad5f8f68e"},{"keyid":"7f7513b25429a64473e10ce3ad2f3da372bbdd14b65d07bbaf547e7c8bbbe62b","sig":"3045022037fe5f45426f21eaaf4730d2136f2b1611d6379688f79b9d1e3f61719997135c022100b63b022d7b79d4694b96f416d88aa4d7b1a3bff8a01f4fb51e0f42137c7d2d06"},{"keyid":"2e61cd0cbf4a8f45809bda9f7f78c0d33ad11842ff94ae340873e2664dc843de","sig":"3044022007cc8fcc4940809f2751ad5b535f4c5f53f5b4952f5b5696b09668e743306ac1022006dfcdf94e94c92163eeb1b47796db62cedaa730aa13aa61b573fe23714730f2"}]} diff --git a/deps/npm/node_modules/tuf-js/dist/fetcher.js b/deps/npm/node_modules/tuf-js/dist/fetcher.js index 7a7405ac53e720..d3dcf53eeb8697 100644 --- a/deps/npm/node_modules/tuf-js/dist/fetcher.js +++ b/deps/npm/node_modules/tuf-js/dist/fetcher.js @@ -4,11 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) { }; Object.defineProperty(exports, "__esModule", { value: true }); exports.DefaultFetcher = exports.BaseFetcher = void 0; +const debug_1 = __importDefault(require("debug")); const fs_1 = __importDefault(require("fs")); const make_fetch_happen_1 = __importDefault(require("make-fetch-happen")); const util_1 = __importDefault(require("util")); const error_1 = require("./error"); const tmpfile_1 = require("./utils/tmpfile"); +const log = (0, debug_1.default)('tuf:fetch'); class BaseFetcher { // Download file from given URL. The file is downloaded to a temporary // location and then passed to the given handler. The handler is responsible @@ -58,6 +60,7 @@ class DefaultFetcher extends BaseFetcher { this.retries = options.retries; } async fetch(url) { + log('GET %s', url); const response = await (0, make_fetch_happen_1.default)(url, { timeout: this.timeout, retry: this.retries, diff --git a/deps/npm/node_modules/tuf-js/dist/updater.js b/deps/npm/node_modules/tuf-js/dist/updater.js index 68243e554facb0..71fa4981e31229 100644 --- a/deps/npm/node_modules/tuf-js/dist/updater.js +++ b/deps/npm/node_modules/tuf-js/dist/updater.js @@ -22,9 +22,13 @@ var __importStar = (this && this.__importStar) || function (mod) { __setModuleDefault(result, mod); return result; }; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.Updater = void 0; const models_1 = require("@tufjs/models"); +const debug_1 = __importDefault(require("debug")); const fs = __importStar(require("fs")); const path = __importStar(require("path")); const config_1 = require("./config"); @@ -32,6 +36,7 @@ const error_1 = require("./error"); const fetcher_1 = require("./fetcher"); const store_1 = require("./store"); const url = __importStar(require("./utils/url")); +const log = (0, debug_1.default)('tuf:cache'); class Updater { constructor(options) { const { metadataDir, metadataBaseUrl, targetDir, targetBaseUrl, fetcher, config, } = options; @@ -86,6 +91,7 @@ class Updater { // Verify hashes and length of downloaded file await targetInfo.verify(fs.createReadStream(fileName)); // Copy file to target path + log('WRITE %s', targetPath); fs.copyFileSync(fileName, targetPath); }); return targetPath; @@ -107,6 +113,7 @@ class Updater { } loadLocalMetadata(fileName) { const filePath = path.join(this.dir, `${fileName}.json`); + log('READ %s', filePath); return fs.readFileSync(filePath); } // Sequentially load and persist on local disk every newer root metadata @@ -300,6 +307,7 @@ class Updater { async persistMetadata(metaDataName, bytesData) { try { const filePath = path.join(this.dir, `${metaDataName}.json`); + log('WRITE %s', filePath); fs.writeFileSync(filePath, bytesData.toString('utf8')); } catch (error) { diff --git a/deps/npm/node_modules/tuf-js/package.json b/deps/npm/node_modules/tuf-js/package.json index ab84004c49403b..c1134af2b2ff3d 100644 --- a/deps/npm/node_modules/tuf-js/package.json +++ b/deps/npm/node_modules/tuf-js/package.json @@ -1,6 +1,6 @@ { "name": "tuf-js", - "version": "1.1.5", + "version": "1.1.6", "description": "JavaScript implementation of The Update Framework (TUF)", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -29,14 +29,16 @@ "homepage": "https://github.com/theupdateframework/tuf-js/tree/main/packages/client#readme", "devDependencies": { "@tufjs/repo-mock": "1.3.1", + "@types/debug": "^4.1.7", "@types/make-fetch-happen": "^10.0.1", - "@types/node": "^18.16.3", + "@types/node": "^20.1.1", "nock": "^13.3.1", "typescript": "^5.0.4" }, "dependencies": { - "make-fetch-happen": "^11.1.0", - "@tufjs/models": "1.0.4" + "@tufjs/models": "1.0.4", + "debug": "^4.3.4", + "make-fetch-happen": "^11.1.0" }, "engines": { "node": "^14.17.0 || ^16.13.0 || >=18.0.0" diff --git a/deps/npm/package.json b/deps/npm/package.json index 9486e8c6ef3099..148a2a3b9e56a4 100644 --- a/deps/npm/package.json +++ b/deps/npm/package.json @@ -1,5 +1,5 @@ { - "version": "9.6.6", + "version": "9.6.7", "name": "npm", "description": "a package manager for JavaScript", "workspaces": [ @@ -54,13 +54,13 @@ "dependencies": { "@isaacs/string-locale-compare": "^1.1.0", "@npmcli/arborist": "^6.2.9", - "@npmcli/config": "^6.1.6", + "@npmcli/config": "^6.1.7", "@npmcli/map-workspaces": "^3.0.4", - "@npmcli/package-json": "^3.0.0", - "@npmcli/run-script": "^6.0.1", + "@npmcli/package-json": "^3.1.0", + "@npmcli/run-script": "^6.0.2", "abbrev": "^2.0.0", "archy": "~1.0.0", - "cacache": "^17.1.0", + "cacache": "^17.1.2", "chalk": "^4.1.2", "ci-info": "^3.8.0", "cli-columns": "^4.0.0", @@ -68,7 +68,7 @@ "columnify": "^1.6.0", "fastest-levenshtein": "^1.0.16", "fs-minipass": "^3.0.2", - "glob": "^10.2.2", + "glob": "^10.2.4", "graceful-fs": "^4.2.11", "hosted-git-info": "^6.1.1", "ini": "^4.1.0", @@ -82,7 +82,7 @@ "libnpmhook": "^9.0.3", "libnpmorg": "^5.0.4", "libnpmpack": "^5.0.17", - "libnpmpublish": "^7.1.4", + "libnpmpublish": "^7.2.0", "libnpmsearch": "^6.0.2", "libnpmteam": "^5.0.3", "libnpmversion": "^4.0.2", @@ -109,7 +109,7 @@ "read": "^2.1.0", "read-package-json": "^6.0.3", "read-package-json-fast": "^3.0.2", - "semver": "^7.5.0", + "semver": "^7.5.1", "ssri": "^10.0.4", "tar": "^6.1.14", "text-table": "~0.2.0", diff --git a/deps/npm/tap-snapshots/test/lib/docs.js.test.cjs b/deps/npm/tap-snapshots/test/lib/docs.js.test.cjs index 85c6bf7956e9cb..d7a943500e49e5 100644 --- a/deps/npm/tap-snapshots/test/lib/docs.js.test.cjs +++ b/deps/npm/tap-snapshots/test/lib/docs.js.test.cjs @@ -332,16 +332,6 @@ npm exec --package yo --package generator-node --call "yo node" \`\`\` -#### \`ci-name\` - -* Default: The name of the current CI system, or \`null\` when not on a known CI - platform. -* Type: null or String - -The name of a continuous integration system. If not set explicitly, npm will -detect the current CI environment using the -[\`ci-info\`](http://npm.im/ci-info) module. - #### \`cidr\` * Default: null @@ -1557,6 +1547,18 @@ It is _not_ the path to a certificate file, though you can set a registry-scoped "certfile" path like "//other-registry.tld/:certfile=/path/to/cert.pem". +#### \`ci-name\` + +* Default: The name of the current CI system, or \`null\` when not on a known CI + platform. +* Type: null or String +* DEPRECATED: This config is deprecated and will not be changeable in future + version of npm. + +The name of a continuous integration system. If not set explicitly, npm will +detect the current CI environment using the +[\`ci-info\`](http://npm.im/ci-info) module. + #### \`dev\` * Default: false