diff --git a/.eslintrc.js b/.eslintrc.js index ca0e40e4b6ceee..a9a1761e6abcdf 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -95,7 +95,13 @@ module.exports = { ignorePattern: '.*', }, }], - 'comma-dangle': ['error', 'only-multiline'], + 'comma-dangle': ['error', { + arrays: 'always-multiline', + exports: 'only-multiline', + functions: 'only-multiline', + imports: 'only-multiline', + objects: 'only-multiline', + }], 'comma-spacing': 'error', 'comma-style': 'error', 'computed-property-spacing': 'error', diff --git a/.github/workflows/misc.yml b/.github/workflows/misc.yml index 2a50a2346a32a3..83c65225f0ac40 100644 --- a/.github/workflows/misc.yml +++ b/.github/workflows/misc.yml @@ -29,5 +29,5 @@ jobs: with: name: docs path: out/doc - - name: Check links - run: node tools/doc/checkLinks.js . + - name: Test + run: NODE=$(command -v node) make test-doc-ci TEST_CI_ARGS="-p actions" diff --git a/BUILDING.md b/BUILDING.md index f4ecd3d1f522bc..f019d674c3a728 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -613,7 +613,7 @@ packages: To install Node.js prerequisites using [Boxstarter WebLauncher](https://boxstarter.org/WebLauncher), open - + with Internet Explorer or Edge browser on the target machine. Alternatively, you can use PowerShell. Run those commands from an elevated @@ -623,7 +623,7 @@ PowerShell terminal: Set-ExecutionPolicy Unrestricted -Force iex ((New-Object System.Net.WebClient).DownloadString('https://boxstarter.org/bootstrapper.ps1')) get-boxstarter -Force -Install-BoxstarterPackage https://raw.githubusercontent.com/nodejs/node/master/tools/bootstrap/windows_boxstarter -DisableReboots +Install-BoxstarterPackage https://raw.githubusercontent.com/nodejs/node/HEAD/tools/bootstrap/windows_boxstarter -DisableReboots ``` The entire installation using Boxstarter will take up approximately 10 GB of diff --git a/CHANGELOG.md b/CHANGELOG.md index e7f7332c7dda91..c835836808544d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,7 +32,8 @@ release. -15.10.0
+15.11.0
+15.10.0
15.9.0
15.8.0
15.7.0
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 4c211405596cb4..d724027fd9aadb 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1,4 +1,4 @@ # Code of Conduct -* [Node.js Code of Conduct](https://github.com/nodejs/admin/blob/master/CODE_OF_CONDUCT.md) -* [Node.js Moderation Policy](https://github.com/nodejs/admin/blob/master/Moderation-Policy.md) +* [Node.js Code of Conduct](https://github.com/nodejs/admin/blob/HEAD/CODE_OF_CONDUCT.md) +* [Node.js Moderation Policy](https://github.com/nodejs/admin/blob/HEAD/Moderation-Policy.md) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8f75199a52cd8c..30db8cf9b12524 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,7 +8,7 @@ ## [Code of Conduct](./doc/guides/contributing/code-of-conduct.md) The Node.js project has a -[Code of Conduct](https://github.com/nodejs/admin/blob/master/CODE_OF_CONDUCT.md) +[Code of Conduct](https://github.com/nodejs/admin/blob/HEAD/CODE_OF_CONDUCT.md) to which all contributors must adhere. See [details on our policy on Code of Conduct](./doc/guides/contributing/code-of-conduct.md). diff --git a/Makefile b/Makefile index aa3eb1567d447e..9f1f58d8564be3 100644 --- a/Makefile +++ b/Makefile @@ -588,6 +588,11 @@ test-doc: doc-only lint-md ## Builds, lints, and verifies the docs. fi $(NODE) tools/doc/checkLinks.js . +.PHONY: test-doc-ci +test-doc-ci: doc-only + $(PYTHON) tools/test.py --shell $(NODE) $(TEST_CI_ARGS) $(PARALLEL_ARGS) doctool + $(NODE) tools/doc/checkLinks.js . + test-known-issues: all $(PYTHON) tools/test.py $(PARALLEL_ARGS) known_issues diff --git a/common.gypi b/common.gypi index dcb14b55050a83..0235880edf83bb 100644 --- a/common.gypi +++ b/common.gypi @@ -36,7 +36,7 @@ # Reset this number to 0 on major V8 upgrades. # Increment by one for each non-official patch applied to deps/v8. - 'v8_embedder_string': '-node.25', + 'v8_embedder_string': '-node.27', ##### V8 defaults for Node.js ##### diff --git a/deps/npm/.npmignore b/deps/npm/.npmignore index b90057457893ba..d1b1fde3d4e0d0 100644 --- a/deps/npm/.npmignore +++ b/deps/npm/.npmignore @@ -16,6 +16,7 @@ node_modules/npm-registry-mock # don't need these in the npm package. html/*.png +docs/nav.yml # don't ignore .npmignore files # these are used in some tests. diff --git a/deps/npm/AUTHORS b/deps/npm/AUTHORS index d731ad8ca64f03..e58d1dffaeaf1d 100644 --- a/deps/npm/AUTHORS +++ b/deps/npm/AUTHORS @@ -750,3 +750,8 @@ Gar dr-js Pavan Bellamkonda <31280326+pavanbellamkonda@users.noreply.github.com> Alexander Riccio +RA80533 <32469082+RA80533@users.noreply.github.com> +Ikko Ashimine +MrBrain295 <66077254+MrBrain295@users.noreply.github.com> +kumavis +Christof Lemke diff --git a/deps/npm/CHANGELOG.md b/deps/npm/CHANGELOG.md index 77322b9f587baf..22e6018f0a86c7 100644 --- a/deps/npm/CHANGELOG.md +++ b/deps/npm/CHANGELOG.md @@ -1,3 +1,212 @@ +## v7.6.0 (2021-02-25) + +### FEATURES + +* [`983d218f7`](https://github.com/npm/cli/commit/983d218f7e68e3c7866f2efa23ea2aff7ff3881e) + [#2750](https://github.com/npm/cli/issues/2750) + feat(explain): mark when dependency is bundled + ([@kumavis](https://github.com/kumavis)) + +### DEPENDENCIES + +* [`b9fa7e32a`](https://github.com/npm/cli/commit/b9fa7e32a63a3dc3a4865865c4ca737c862b9cf2) + chore(package-lock): resetdeps and `eslint@7.20.0` + ([@wraithgar](https://github.com/wraithgar)) +* [`28d036ae9`](https://github.com/npm/cli/commit/28d036ae9179f742bd0518e558a54f014a7a895e) + `arborist@2.2.5` + * fix: hidden lockfiles were not respected on Node v10.0-10.12 + +### DOCUMENTATION + +* [`ba1adef42`](https://github.com/npm/cli/commit/ba1adef4292123e87e26b59e0c6fd6f5ff1fe775) + [#2760](https://github.com/npm/cli/issues/2760) + chore(docs): capitalize all Instaces of "package" + ([@MrBrain295](https://github.com/MrBrain295)) +* [`8bfa05fa1`](https://github.com/npm/cli/commit/8bfa05fa1dfd4a64381c7ec750df6d174724e8c1) + [#2775](https://github.com/npm/cli/issues/2775) + chore(docs): add navigation configuration + ([@ethomson](https://github.com/ethomson)) +* [`238e474a4`](https://github.com/npm/cli/commit/238e474a48ddecc33c76eb3d2c4d0642cfe8829a) + [#2778](https://github.com/npm/cli/issues/2778) + chore(docs):update unpublish cooldown + ([@christoflemke](https://github.com/christoflemke)) + +## v7.5.6 (2021-02-22) + +### BUG FIXES + +* [`4e58274ed`](https://github.com/npm/cli/commit/4e58274ed0fd2dd29d3c8d6c7c47f37a37dc0f0f) + [#2742](https://github.com/npm/cli/issues/2742) + Do not print error banner for shell proxy commands + ([@isaacs](https://github.com/isaacs)) + +### DOCS + +* [`3c72ab441`](https://github.com/npm/cli/commit/3c72ab4412111c708736e3a7b8342150372a4af4) + [#2749](https://github.com/npm/cli/issues/2749) + Capitalize Package in a Heading + ([@MrBrain295](https://github.com/MrBrain295)) + +### DEPENDENCIES + +* [`f3ae6ed0d`](https://github.com/npm/cli/commit/f3ae6ed0d25ce80868f59353ef71c09ac77b1cf5) + `read-package-json@3.0.1`, `read-package-json-fast@2.0.2` +* [`9b311fe52`](https://github.com/npm/cli/commit/9b311fe522077c7f8a242b94b0e1dbe746992bef) + [#2736](https://github.com/npm/cli/issue/2736) `@npmcli/arborist@2.2.4`: + * Do not rely on underscore fields in `package.json` files + * Do not remove global packages when updating by name + * Keep `yarn.lock` and `package-lock.json` more in sync + +## v7.5.5 (2021-02-22) + +### BUG FIXES +* [`49c95375a`](https://github.com/npm/cli/commit/49c95375af49308e2db6ba28e91c65193754e091) + [#2688](https://github.com/npm/cli/issues/2688) + fix shrinkwrap in node v10.0 + ([@ljharb](https://github.com/ljharb)) +* [`00afa3161`](https://github.com/npm/cli/commit/00afa316195f2db903146110a07ffdaec9bb6aa2) + [#2718](https://github.com/npm/cli/issues/2718) + restore the prefix on output from `npm version ` + ([@nlf](https://github.com/nlf)) +* [`69e0c4e8c`](https://github.com/npm/cli/commit/69e0c4e8cd684c475a4450c40dfb32c995061aea) + [#2716](https://github.com/npm/cli/issues/2716) + throw an error when trying to dedupe in global mode + ([@nlf](https://github.com/nlf)) +* [`b018eb842`](https://github.com/npm/cli/commit/b018eb84266dc5a02274849135ca148cb59cc349) + [#2719](https://github.com/npm/cli/issues/2719) + obey silent loglevel in run-script + ([@wraithgar](https://github.com/wraithgar)) + +### DEPENDENCIES +* [`8c36697df`](https://github.com/npm/cli/commit/8c36697dfffe8b5e853fe889c9ead5578100c413) + `@npmcli/arborist@2.2.3` + * [#1875](https://github.com/npm/cli/issues/1875) + [arborist#230](https://github.com/npm/arborist/pull/230) + Set default advisory `severity`/`vulnerable_range` when missing from audit endpoint data + ([@isaacs](https://github.com/isaacs)) + * [npm/arborist#231](https://github.com/npm/arborist/pull/231) + skip optional deps with mismatched platform or engine + ([@nlf](https://github.com/nlf)) + * [#2251](https://github.com/npm/cli/issues/2251) + Unpack shrinkwrapped deps not already unpacked + ([@isaacs](https://github.com/isaacs), + [@nlf](https://github.com/nlf)) + * [#2714](https://github.com/npm/cli/issues/2714) + Do not write package.json if nothing changed + ([@isaacs](https://github.com/isaacs)) + * [npm/rfcs#324](https://github.com/npm/rfcs/issues/324) + Prefer peer over prod dep, if both specified + ([@isaacs](https://github.com/isaacs)) + * [npm/arborist#236](https://github.com/npm/arborist/issues/236) + Fix additional peerOptional conflict cases + ([@isaacs](https://github.com/isaacs)) +* [`d865b101f`](https://github.com/npm/cli/commit/d865b101f72142619531311645479f0596a68a1a) + `libnpmpack@2.0.1` + * respect silent loglevel +* [`e606953e5`](https://github.com/npm/cli/commit/e606953e5795803a7c4eddb4ea993735ef65ec95) + `libnpmversion@1.0.11` + * respect silent loglevel +* [`9c51005a1`](https://github.com/npm/cli/commit/9c51005a19fd4c3e7cd4c987d2e39d1b763036bf) + `npm-package-arg@8.1.1` + * do a better job of detecting git specifiers like `git@github.com:npm/cli` +* [`8b6bf0db4`](https://github.com/npm/cli/commit/8b6bf0db49a3378bd85a0d1ffdd19fbdd68a944a) + `pacote@11.2.7` + * respect silent loglevel + * fix INVALID_URL errors for certain git dependencies + +### TESTS +* [`80c2ac995`](https://github.com/npm/cli/commit/80c2ac995170a05b26856a2b72fe9c8163b2c999) + [#2717](https://github.com/npm/cli/issues/2717) + refactor publish tests + ([@wraithgar](https://github.com/wraithgar)) +* [`9d81e0ceb`](https://github.com/npm/cli/commit/9d81e0ceba7d69e0651662508415ee3705bddfd9) + [#2729](https://github.com/npm/cli/issues/2729) + fix typo in shrinkwrap tests + ([@eltociear](https://github.com/eltociear)) + +### DOCUMENTATION +* [`e3de7befb`](https://github.com/npm/cli/commit/e3de7befb3a9e2fcb7aac5b740d09b3b7d99d724) + [#2685](https://github.com/npm/cli/issues/2685) + docs(readme): add note back about branding/origin + ([@darcyclarke](https://github.com/darcyclarke)) +* [`38d87e7c2`](https://github.com/npm/cli/commit/38d87e7c24aea13b0f1c1157aad58d9d15bf8e63) + [#2698](https://github.com/npm/cli/issues/2698) + mention nodenv in README.md + ([@RA80533](https://github.com/RA80533)) +* [`af4422cdb`](https://github.com/npm/cli/commit/af4422cdbc110f93203667efc08b16f7aa74ac2f) + [#2711](https://github.com/npm/cli/issues/2711) + validate that the docs can be parsed by mdx + ([@ethomson](https://github.com/ethomson)) + + +## v7.5.4 (2021-02-12) + +### BUG FIXES + +* [`ef687f545`](https://github.com/npm/cli/commit/ef687f545b177d0496ce74faacf1bf738978355a) + [#2655](https://github.com/npm/cli/issues/2655) + fix(env): Do not clobber defined 'env' script + ([@isaacs](https://github.com/isaacs)) +* [`868954a72`](https://github.com/npm/cli/commit/868954a72c06ff2210b35e1e75571f4ec3357c43) + [#2654](https://github.com/npm/cli/issues/2654) + [fix] node v10.0 lacks `fs.promises` + ([@ljharb](https://github.com/ljharb)) + + +### DEPENDENCIES + +* [`14dd93853`](https://github.com/npm/cli/commit/14dd9385358b3815c2285526f7c2e53ed3c5e8da) + fix(package.json): resetdeps + ([@wraithgar](https://github.com/wraithgar)) +* [`39e4a6401`](https://github.com/npm/cli/commit/39e4a640130b85d62199a33cc2026b04390520ee) + `graceful-fs@4.2.6` +* [`96dffab98`](https://github.com/npm/cli/commit/96dffab988048164516d8cf73c1fbf66781f86df) + `eslint-plugin-promise@4.3.1` +* [`9a6e9d38a`](https://github.com/npm/cli/commit/9a6e9d38abccec793b6ac14871c2b639d62a6c41) + `@npmcli/run-script@1.8.3` + * fix fs.promises reference to run in node v10.0 +* [`584b746a2`](https://github.com/npm/cli/commit/584b746a2c8cdc697629298be27dd23d19de1231) + `@npmcli/git@2.0.5` +* [`6305ebde4`](https://github.com/npm/cli/commit/6305ebde43796737014aedbe019db8cd81dcbbec) + `make-fetch-happen@8.0.14` +* [`e99881117`](https://github.com/npm/cli/commit/e998811170ce5df00a725b2d683b4bff124c6792) + `libnpmversion@1.0.10` +* [`554d91cdf`](https://github.com/npm/cli/commit/554d91cdf82e9c92c2ac3752ed91e7081c2271e5) + chore(package-lock): rebuild package-lock + ([@wraithgar](https://github.com/wraithgar)) +* [`37e8cc507`](https://github.com/npm/cli/commit/37e8cc507b2ce0b89f92e7e77b1d909d1bf5513f) + `@npmcli/arborist@2.2.2` + * [#2505](https://github.com/npm/cli/issues/2505) properly install + dependenciess of linked dependencies + ([@ruyadorno](https://github.com/ruyadorno)) + * [#2504](https://github.com/npm/cli/issues/2504) Allow `--force` to + override conflicted optional peerDependencies + ([@isaacs](https://github.com/isaacs)) + * Ensure correct flags on shrinkwrapped module deps + ([@isaacs](https://github.com/isaacs)) + * Correct relative paths for global packages installed from tarball files + ([nlf](https://github.com/nlf)) +* [`7788ce47b`](https://github.com/npm/cli/commit/7788ce47bc264d9d951055da85f2b695eb8b3f15) + `@npmcli/map-workspaces@1.0.3` + +### TESTS + +* [`3a159d27e`](https://github.com/npm/cli/commit/3a159d27e976933098ec18fa9c3e474c85b5b332) + [#2681](https://github.com/npm/cli/issues/2681) + fix(tests): rewrite doctor tests + ([@ljharb](https://github.com/ljharb)) +* [`abcc96a20`](https://github.com/npm/cli/commit/abcc96a204ed581fc7cd603f47cdca0afe299530) + [#2682](https://github.com/npm/cli/issues/2682) + [tests] separate tests from linting and license validation + ([@ljharb](https://github.com/ljharb)) + +### DOCUMENTATION + +* [`7e1e84181`](https://github.com/npm/cli/commit/7e1e84181ccaca8a8b499a21b1aa7d731a14d5b7) + [#2662](https://github.com/npm/cli/issues/2662) + fix(docs): fix angle brackets in npm diff docs + ([@ethomson](https://github.com/ethomson)) + ## v7.5.3 (2021-02-08) ### BUG FIXES diff --git a/deps/npm/README.md b/deps/npm/README.md index 3b6b30513db5d2..8a649847ecaab6 100644 --- a/deps/npm/README.md +++ b/deps/npm/README.md @@ -27,6 +27,7 @@ If you're looking to manage multiple versions of **`node`** &/or **`npm`**, cons * [**`nave`**](https://github.com/isaacs/nave) * [**`n`**](https://github.com/tj/n) * [**`volta`**](https://github.com/volta-cli/volta) +* [**`nodenv`**](https://github.com/nodenv/nodenv) ### Usage @@ -51,3 +52,13 @@ npm * `npm` is configured to use the **npm Public Registry** at [https://registry.npmjs.org](https://registry.npmjs.org) by default; Usage of this registry is subject to **Terms of Use** available at [https://npmjs.com/policies/terms](https://npmjs.com/policies/terms) * You can configure `npm` to use any other compatible registry you prefer. You can read more about configuring third-party registries [here](https://docs.npmjs.com/cli/v7/using-npm/registry) + +### FAQ on Branding + +#### Is it "npm" or "NPM" or "Npm"? + +**`npm`** should never be capitalized unless it is being displayed in a location that is customarily all-capitals (ex. titles on `man` pages). + +#### Is "npm" an acronym for "Node Package Manager"? + +Contrary to popular belief, **`npm`** **is not** in fact an acronym for "Node Package Manager"; It is a recursive bacronymic abbreviation for **"npm is not an acronym"** (if the project was named "ninaa", then it would be an acronym). The precursor to **`npm`** was actually a bash utility named **"pm"**, which was the shortform name of **"pkgmakeinst"** - a bash function that installed various things on various platforms. If **`npm`** were to ever have been considered an acronym, it would be as "node pm" or, potentially "new pm". diff --git a/deps/npm/docs/content/commands/npm-diff.md b/deps/npm/docs/content/commands/npm-diff.md index 0ce5e8dc8baee6..0fe6a68fa2f0fe 100644 --- a/deps/npm/docs/content/commands/npm-diff.md +++ b/deps/npm/docs/content/commands/npm-diff.md @@ -82,11 +82,11 @@ of files for packages published to the npm registry. When using a single package name (with no version or tag specifier) as an argument, `npm diff` will work in a similar way to [`npm-outdated`](npm-outdated) and reach for the registry to figure out - what current published version of the package named will satisfy - its dependent declared semver-range. Once that specific version is known - `npm diff` will print diff patches comparing the current version of - found in the local file system with that specific version - returned by the registry. + what current published version of the package named `` + will satisfy its dependent declared semver-range. Once that specific + version is known `npm diff` will print diff patches comparing the + current version of `` found in the local file system with + that specific version returned by the registry. Given a package named `abbrev` that is currently installed: @@ -155,7 +155,7 @@ located within the folder `./lib/` and changed lines of code within the #### diff -* Type: Array +* Type: Array * Default: null Defines npm package specifiers to compare using the `npm diff` command. diff --git a/deps/npm/docs/content/commands/npm-unpublish.md b/deps/npm/docs/content/commands/npm-unpublish.md index e9d6e9045c6f9e..14813e94341f52 100644 --- a/deps/npm/docs/content/commands/npm-unpublish.md +++ b/deps/npm/docs/content/commands/npm-unpublish.md @@ -42,7 +42,7 @@ versions then the registry will remove the root package entry entirely. Even if you unpublish a package version, that specific name and version combination can never be reused. In order to publish the package again, you must use a new version number. If you unpublish the entire package, -you may not publish any new versions of that package until 24 hours have +you may not publish any new versions of that package until 28 days have passed. ### See Also diff --git a/deps/npm/docs/content/using-npm/developers.md b/deps/npm/docs/content/using-npm/developers.md index bce615cfeb3d14..a76808ca675e61 100644 --- a/deps/npm/docs/content/using-npm/developers.md +++ b/deps/npm/docs/content/using-npm/developers.md @@ -20,7 +20,7 @@ These are man pages. If you install npm, you should be able to then do `man npm-thing` to get the documentation on a particular topic, or `npm help thing` to see the same information. -### What is a package +### What is a Package A package is: @@ -93,7 +93,7 @@ You can use `npm init` in the root of your package in order to get you started with a pretty basic package.json file. See [`npm init`](/commands/npm-init) for more info. -### Keeping files *out* of your package +### Keeping files *out* of your Package Use a `.npmignore` file to keep stuff out of your package. If there's no `.npmignore` file, but there *is* a `.gitignore` file, then npm will ignore @@ -210,7 +210,7 @@ and then follow the prompts. This is documented better in [npm adduser](/commands/npm-adduser). -### Publish your package +### Publish your Package This part's easy. In the root of your folder, do this: diff --git a/deps/npm/docs/dockhand.js b/deps/npm/docs/dockhand.js index 41d01b1cff6856..7f2c90dae9b09b 100644 --- a/deps/npm/docs/dockhand.js +++ b/deps/npm/docs/dockhand.js @@ -4,6 +4,7 @@ const path = require('path'); const fs = require('fs'); const yaml = require('yaml'); const cmark = require('cmark-gfm'); +const mdx = require('@mdx-js/mdx'); const mkdirp = require('mkdirp'); const jsdom = require('jsdom'); const npm = require('../lib/npm.js') @@ -16,25 +17,121 @@ const outputRoot = path.join(docsRoot, 'output'); const template = fs.readFileSync('template.html').toString(); -walk(inputRoot); +const run = async function() { + try { + const navPaths = await getNavigationPaths(); + const fsPaths = await renderFilesystemPaths(); + + if (!ensureNavigationComplete(navPaths, fsPaths)) { + process.exit(1); + } + } + catch (error) { + console.error(error); + } +} + +run(); + +function ensureNavigationComplete(navPaths, fsPaths) { + const unmatchedNav = { }, unmatchedFs = { }; + + for (const navPath of navPaths) { + unmatchedNav[navPath] = true; + } + + for (let fsPath of fsPaths) { + fsPath = '/' + fsPath.replace(/\.md$/, ""); + + if (unmatchedNav[fsPath]) { + delete unmatchedNav[fsPath]; + } + else { + unmatchedFs[fsPath] = true; + } + } + + const missingNav = Object.keys(unmatchedNav).sort(); + const missingFs = Object.keys(unmatchedFs).sort() + + if (missingNav.length > 0 || missingFs.length > 0) { + let message = "Error: documentation navigation (nav.yml) does not match filesystem.\n"; + + if (missingNav.length > 0) { + message += "\nThe following path(s) exist on disk but are not present in nav.yml:\n\n"; + + for (const nav of missingNav) { + message += ` ${nav}\n`; + } + } + + if (missingNav.length > 0 && missingFs.length > 0) { + message += "\nThe following path(s) exist in nav.yml but are not present on disk:\n\n"; + + for (const fs of missingFs) { + message += ` ${fs}\n`; + } + } + + message += "\nUpdate nav.yml to ensure that all files are listed in the appropriate place."; + + console.error(message); + + return false; + } + + return true; +} + +function getNavigationPaths() { + const navFilename = path.join(docsRoot, 'nav.yml'); + const nav = yaml.parse(fs.readFileSync(navFilename).toString(), 'utf8'); + + return walkNavigation(nav); +} + +function walkNavigation(entries) { + const paths = [ ] + + for (const entry of entries) { + if (entry.children) { + paths.push(... walkNavigation(entry.children)); + } + else { + paths.push(entry.url); + } + } + + return paths; +} + +async function renderFilesystemPaths() { + return await walkFilesystem(inputRoot); +} + +async function walkFilesystem(root, dirRelative) { + const paths = [ ] -function walk(root, dirRelative) { const dirPath = dirRelative ? path.join(root, dirRelative) : root; + const children = fs.readdirSync(dirPath); - fs.readdirSync(dirPath).forEach((childFilename) => { + for (const childFilename of children) { const childRelative = dirRelative ? path.join(dirRelative, childFilename) : childFilename; const childPath = path.join(root, childRelative); if (fs.lstatSync(childPath).isDirectory()) { - walk(root, childRelative); + paths.push(... await walkFilesystem(root, childRelative)); } else { - translate(childRelative); + await renderFile(childRelative); + paths.push(childRelative); } - }); + } + + return paths; } -function translate(childPath) { +async function renderFile(childPath) { const inputPath = path.join(inputRoot, childPath); if (!inputPath.match(/\.md$/)) { @@ -70,6 +167,16 @@ function translate(childPath) { } }); + // Test that mdx can parse this markdown file. We don't actually + // use the output, it's just to ensure that the upstream docs + // site (docs.npmjs.com) can parse it when this file gets there. + try { + await mdx(md, { skipExport: true }); + } + catch (error) { + throw new MarkdownError(childPath, error); + } + // Inject this data into the template, using a mustache-like // replacement scheme. const html = template.replace(/\{\{\s*([\w\.]+)\s*\}\}/g, (token, key) => { @@ -98,7 +205,6 @@ function translate(childPath) { console.log(`warning: unknown token '${token}' in ${inputPath}`); return ''; } - console.log(key); return key; }); @@ -225,3 +331,11 @@ function headerLevel(node) { function debug(str) { console.log(str); } + +class MarkdownError extends Error { + constructor(file, inner) { + super(`failed to parse ${file}`); + this.file = file; + this.inner = inner; + } +} diff --git a/deps/npm/docs/output/commands/npm-diff.html b/deps/npm/docs/output/commands/npm-diff.html index 43840ea9a2984a..bc526a3e47e0ee 100644 --- a/deps/npm/docs/output/commands/npm-diff.html +++ b/deps/npm/docs/output/commands/npm-diff.html @@ -206,11 +206,11 @@

Description

When using a single package name (with no version or tag specifier) as an argument, npm diff will work in a similar way to npm-outdated and reach for the registry to figure out -what current published version of the package named will satisfy -its dependent declared semver-range. Once that specific version is known -npm diff will print diff patches comparing the current version of - found in the local file system with that specific version -returned by the registry.

+what current published version of the package named <pkg-name> +will satisfy its dependent declared semver-range. Once that specific +version is known npm diff will print diff patches comparing the +current version of <pkg-name> found in the local file system with +that specific version returned by the registry.

Given a package named abbrev that is currently installed:

npm diff --diff=abbrev
 
@@ -260,7 +260,7 @@

Filtering files

Configuration

diff

    -
  • Type: Array
  • +
  • Type: Array
  • Default: null

Defines npm package specifiers to compare using the npm diff command.

diff --git a/deps/npm/docs/output/commands/npm-ls.html b/deps/npm/docs/output/commands/npm-ls.html index 3496d20dcf16a2..aaa6f3ea28ca98 100644 --- a/deps/npm/docs/output/commands/npm-ls.html +++ b/deps/npm/docs/output/commands/npm-ls.html @@ -159,7 +159,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@7.5.3 /path/to/npm
+
npm@7.6.0 /path/to/npm
 └─┬ init-package-json@0.0.4
   └── promzard@0.1.5
 
diff --git a/deps/npm/docs/output/commands/npm-unpublish.html b/deps/npm/docs/output/commands/npm-unpublish.html index 75751d3408cfa1..3ec254a109d470 100644 --- a/deps/npm/docs/output/commands/npm-unpublish.html +++ b/deps/npm/docs/output/commands/npm-unpublish.html @@ -166,7 +166,7 @@

Description

Even if you unpublish a package version, that specific name and version combination can never be reused. In order to publish the package again, you must use a new version number. If you unpublish the entire package, -you may not publish any new versions of that package until 24 hours have +you may not publish any new versions of that package until 28 days have passed.

See Also

and then follow the prompts.

This is documented better in npm adduser.

-

Publish your package

+

Publish your Package

This part’s easy. In the root of your folder, do this:

npm publish
 
diff --git a/deps/npm/lib/access.js b/deps/npm/lib/access.js index 8a372d90cb55cd..10b1e21e0c5d7e 100644 --- a/deps/npm/lib/access.js +++ b/deps/npm/lib/access.js @@ -59,17 +59,17 @@ const access = async ([cmd, ...args], cb) => { return fn(args, { ...npm.flatOptions }) } -const completion = function (opts, cb) { - var argv = opts.conf.argv.remain +const completion = async (opts) => { + const argv = opts.conf.argv.remain if (argv.length === 2) - return cb(null, subcommands) + return subcommands switch (argv[2]) { case 'grant': if (argv.length === 3) - return cb(null, ['read-only', 'read-write']) + return ['read-only', 'read-write'] else - return cb(null, []) + return [] case 'public': case 'restricted': @@ -79,9 +79,9 @@ const completion = function (opts, cb) { case '2fa-required': case '2fa-not-required': case 'revoke': - return cb(null, []) + return [] default: - return cb(new Error(argv[2] + ' not recognized')) + throw new Error(argv[2] + ' not recognized') } } diff --git a/deps/npm/lib/adduser.js b/deps/npm/lib/adduser.js index b6c3321745667c..c68c2b80f8790b 100644 --- a/deps/npm/lib/adduser.js +++ b/deps/npm/lib/adduser.js @@ -15,8 +15,6 @@ const usage = usageUtil( 'npm adduser [--registry=url] [--scope=@orgname] [--always-auth]' ) -const completion = require('./utils/completion/none.js') - const cmd = (args, cb) => adduser(args).then(() => cb()).catch(cb) const getRegistry = ({ scope, registry }) => { @@ -74,4 +72,4 @@ const adduser = async (args) => { output(message) } -module.exports = Object.assign(cmd, { completion, usage }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/audit.js b/deps/npm/lib/audit.js index cb8ab5b3a43f5d..1b31401b1a6b0b 100644 --- a/deps/npm/lib/audit.js +++ b/deps/npm/lib/audit.js @@ -38,17 +38,17 @@ const usage = usageUtil( '[--force|--package-lock-only|--dry-run|--production|--only=(dev|prod)]' ) -const completion = (opts, cb) => { +const completion = async (opts) => { const argv = opts.conf.argv.remain if (argv.length === 2) - return cb(null, ['fix']) + return ['fix'] switch (argv[2]) { case 'fix': - return cb(null, []) + return [] default: - return cb(new Error(argv[2] + ' not recognized')) + throw new Error(argv[2] + ' not recognized') } } diff --git a/deps/npm/lib/bin.js b/deps/npm/lib/bin.js index 1d776365c2f45d..e627ce22f13a68 100644 --- a/deps/npm/lib/bin.js +++ b/deps/npm/lib/bin.js @@ -1,7 +1,6 @@ const npm = require('./npm.js') const output = require('./utils/output.js') const usageUtil = require('./utils/usage.js') -const completion = require('./utils/completion/none.js') const PATH = require('./utils/path.js') const cmd = (args, cb) => bin(args).then(() => cb()).catch(cb) const usage = usageUtil('bin', 'npm bin [-g]') @@ -11,4 +10,4 @@ const bin = async (args, cb) => { if (npm.flatOptions.global && !PATH.includes(b)) console.error('(not in PATH env variable)') } -module.exports = Object.assign(cmd, { usage, completion }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/birthday.js b/deps/npm/lib/birthday.js index 097ffd92542fec..6c71a9e7156689 100644 --- a/deps/npm/lib/birthday.js +++ b/deps/npm/lib/birthday.js @@ -1,21 +1,11 @@ -/* eslint-disable max-len */ -// happy birthday! 🎂 - -module.exports = (_, c) => { - const B = global[Buffer.from([66, 117, 102, 102, 101, 114])] - const f = B.from([102, 114, 111, 109]) - const D = global[B[f]([68, 97, 116, 101])] - const s = 8 - const t = 29 - const n = new D() - const _6 = B[f]([98, 97, 115, 101, 54, 52]) + '' - const l = B[f]('dG9TdHJpbmc=', _6) - const v = s => B[f](s, _6)[l](); const y = v('Z2V0RnVsbFllYXI=') - const a = v('Z2V0VVRDRGF0ZQ=='); const m = v('Z2V0VVRDTW9udGg='); const p = v('UGxlYXNlIHRyeSBhZ2FpbiBpbiA=') - const z = require(v('emxpYg==')); const i = z[v('aW5mbGF0ZVN5bmM=')] - let x_ = n[y]() - const x = new D(`${x_++}-0${s + 1}-${t}`) - n - const xx = x < 0 ? new D(`${x_}-0${s + 1}-${t}`) - n : x - - c(...(`${n[a]()}${n[m]()}` !== `${t}${s}` ? [`${p}${xx}ms`] : [null, console.log(i(B[f](B[f](JSON.parse(i(B[f]('eJw1U9Gx5DAIa4gPExsDtby5/ts4SXhnspNNAkIS8p8vtzzm32e+rp2t2007ae7HTuEWdq/VtvysHM/4rbTEdfEvLNhclqgL/Nv67AvVR+AAQHF9lguTllXrRtAmIvs9ZnJYpXXxdQ1QtzX6VnOA4JxMMBvwhZlF6DiaCL63+So3yykhCeMCDF6kCmheLaWUmHrtn5Opu4SCLYh0ilQIPvewupKylsXSJOclnZy55gm1V3bcK3RYSgd7GOCh5TvUQ2IB67Kdk0gHBsV5ek5LcchwF+WWathBoo9VUE7A6WJFfsMBX5wzD6VQGqm7HCPNkRxbJPZ82cSuaapZDKGG5ttJpXC18SBYTDPogtV94ViisUZpa+dXTrCJm/GrDtfO6uXAtdp8T+IZ/ksPJmI8bSgljH4LTV6QK6P6kkniJezk65dPeRzy9Gjh3zTeliZ0sYJJjZ9c0mCaWMrglj7IsHwGaUNaxGYuBPbNOViz6blxpk7E+QURA+n54qI1a5Ydv1QrUkeBocNFpKe8Z5ld71y29gAG78xg5zSS5/VMsat4ODL7a1BllY4OTKLhd+IruSB7/d9/b7zQBA==', _6))[l]()))[l](), _6))[l]())])) +const npm = require('./npm.js') +module.exports = (_, cb) => { + Object.defineProperty(npm, 'flatOptions', { + value: { + ...npm.flatOptions, + package: ['@npmcli/npm-birthday'], + yes: true, + }, + }) + return npm.commands.exec(['npm-birthday'], cb) } diff --git a/deps/npm/lib/bugs.js b/deps/npm/lib/bugs.js index 012f39efbd3408..09856313ce883e 100644 --- a/deps/npm/lib/bugs.js +++ b/deps/npm/lib/bugs.js @@ -7,7 +7,6 @@ const npm = require('./npm.js') const hostedFromMani = require('./utils/hosted-git-info-from-manifest.js') const usage = usageUtil('bugs', 'npm bugs []') -const completion = require('./utils/completion/none.js') const cmd = (args, cb) => bugs(args).then(() => cb()).catch(cb) @@ -44,4 +43,4 @@ const getBugs = async pkg => { await openUrl(url, `${mani.name} bug list available at the following URL`) } -module.exports = Object.assign(cmd, { usage, completion }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/cache.js b/deps/npm/lib/cache.js index 30d6aef863ac29..7b84353b4a19b6 100644 --- a/deps/npm/lib/cache.js +++ b/deps/npm/lib/cache.js @@ -19,17 +19,17 @@ const usage = usageUtil('cache', '\nnpm cache verify' ) -const completion = (opts, cb) => { +const completion = async (opts) => { const argv = opts.conf.argv.remain if (argv.length === 2) - return cb(null, ['add', 'clean', 'verify']) + return ['add', 'clean', 'verify'] // TODO - eventually... switch (argv[2]) { case 'verify': case 'clean': case 'add': - return cb(null, []) + return [] } } diff --git a/deps/npm/lib/ci.js b/deps/npm/lib/ci.js index 36410616fb9bfb..51c165accef7a6 100644 --- a/deps/npm/lib/ci.js +++ b/deps/npm/lib/ci.js @@ -11,7 +11,6 @@ const npm = require('./npm.js') const usageUtil = require('./utils/usage.js') const usage = usageUtil('ci', 'npm ci') -const completion = require('./utils/completion/none.js') const cmd = (args, cb) => ci().then(() => cb()).catch(cb) @@ -68,6 +67,7 @@ const ci = async () => { scriptShell, stdio: 'inherit', stdioString: true, + banner: log.level !== 'silent', event, }) } @@ -75,4 +75,4 @@ const ci = async () => { await reifyFinish(arb) } -module.exports = Object.assign(cmd, { completion, usage }) +module.exports = Object.assign(cmd, {usage}) diff --git a/deps/npm/lib/completion.js b/deps/npm/lib/completion.js index bdea338ff2c4b9..b31867d988a69a 100644 --- a/deps/npm/lib/completion.js +++ b/deps/npm/lib/completion.js @@ -28,8 +28,6 @@ // one per line for the shell completion method to consume in IFS=$'\n' mode // as an array. // -// TODO: make all the implementation completion methods promise-returning -// instead of callback-taking. const npm = require('./npm.js') const { types, shorthands } = require('./utils/config.js') @@ -52,9 +50,9 @@ const { promisify } = require('util') const cmd = (args, cb) => compl(args).then(() => cb()).catch(cb) // completion for the completion command -const completion = async (opts, cb) => { +const completion = async (opts) => { if (opts.w > 2) - return cb() + return const { resolve } = require('path') const [bashExists, zshExists] = await Promise.all([ @@ -68,7 +66,7 @@ const completion = async (opts, cb) => { if (bashExists) out.push(['>>', '~/.bashrc']) - cb(null, out) + return out } const compl = async args => { @@ -121,18 +119,16 @@ const compl = async args => { raw: args, } - const wrap = getWrap(opts) - if (partialWords.slice(0, -1).indexOf('--') === -1) { if (word.charAt(0) === '-') - return wrap(configCompl(opts)) + return wrap(opts, configCompl(opts)) if (words[w - 1] && words[w - 1].charAt(0) === '-' && !isFlag(words[w - 1])) { // awaiting a value for a non-bool config. // don't even try to do this for now - return wrap(configValueCompl(opts)) + return wrap(opts, configValueCompl(opts)) } } @@ -146,7 +142,7 @@ const compl = async args => { // check if there's a command already. const cmd = parsed.argv.remain[1] if (!cmd) - return wrap(cmdCompl(opts)) + return wrap(opts, cmdCompl(opts)) Object.keys(parsed).forEach(k => npm.config.set(k, parsed[k])) @@ -155,10 +151,8 @@ const compl = async args => { // otherwise, do nothing const impl = npm.commands[cmd] if (impl && impl.completion) { - // XXX promisify all the cmd.completion functions - return await new Promise((res, rej) => { - impl.completion(opts, (er, comps) => er ? rej(er) : res(wrap(comps))) - }) + const comps = await impl.completion(opts) + return wrap(opts, comps) } } @@ -215,7 +209,7 @@ const escape = w => !/\s+/.test(w) ? w // If any of the items are arrays, then join them with a space. // Ie, returning ['a', 'b c', ['d', 'e']] would allow it to expand // to: 'a', 'b c', or 'd' 'e' -const getWrap = opts => compls => { +const wrap = (opts, compls) => { if (!Array.isArray(compls)) compls = compls ? [compls] : [] diff --git a/deps/npm/lib/config.js b/deps/npm/lib/config.js index b32cf3359d33b4..e4da296de8f88a 100644 --- a/deps/npm/lib/config.js +++ b/deps/npm/lib/config.js @@ -26,7 +26,7 @@ const usage = usageUtil( const cmd = (args, cb) => config(args).then(() => cb()).catch(cb) -const completion = (opts, cb) => { +const completion = async (opts) => { const argv = opts.conf.argv.remain if (argv[1] !== 'config') argv.unshift('config') @@ -36,7 +36,7 @@ const completion = (opts, cb) => { if (opts.partialWord !== 'l') cmds.push('list') - return cb(null, cmds) + return cmds } const action = argv[2] @@ -44,19 +44,19 @@ const completion = (opts, cb) => { case 'set': // todo: complete with valid values, if possible. if (argv.length > 3) - return cb(null, []) + return [] // fallthrough /* eslint no-fallthrough:0 */ case 'get': case 'delete': case 'rm': - return cb(null, Object.keys(types)) + return Object.keys(types) case 'edit': case 'list': case 'ls': default: - return cb(null, []) + return [] } } diff --git a/deps/npm/lib/dedupe.js b/deps/npm/lib/dedupe.js index fe8243e21e43d2..2211fcac8b4819 100644 --- a/deps/npm/lib/dedupe.js +++ b/deps/npm/lib/dedupe.js @@ -5,11 +5,16 @@ const usageUtil = require('./utils/usage.js') const reifyFinish = require('./utils/reify-finish.js') const usage = usageUtil('dedupe', 'npm dedupe') -const completion = require('./utils/completion/none.js') const cmd = (args, cb) => dedupe(args).then(() => cb()).catch(cb) const dedupe = async (args) => { + if (npm.flatOptions.global) { + const er = new Error('`npm dedupe` does not work in global mode.') + er.code = 'EDEDUPEGLOBAL' + throw er + } + const dryRun = (args && args.dryRun) || npm.flatOptions.dryRun const where = npm.prefix const arb = new Arborist({ @@ -21,4 +26,4 @@ const dedupe = async (args) => { await reifyFinish(arb) } -module.exports = Object.assign(cmd, { usage, completion }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/deprecate.js b/deps/npm/lib/deprecate.js index e049986452b793..42d099b544e31d 100644 --- a/deps/npm/lib/deprecate.js +++ b/deps/npm/lib/deprecate.js @@ -17,19 +17,17 @@ const usage = usageUtil( 'npm deprecate [@] ' ) -const completion = (opts, cb) => { +const completion = async (opts) => { if (opts.conf.argv.remain.length > 1) - return cb(null, []) + return [] - return getIdentity(npm.flatOptions).then((username) => { - return libaccess.lsPackages(username, npm.flatOptions).then((packages) => { - return Object.keys(packages) - .filter((name) => packages[name] === 'write' && - (opts.conf.argv.remain.length === 0 || - name.startsWith(opts.conf.argv.remain[0])) - ) - }) - }).then((list) => cb(null, list), (err) => cb(err)) + const username = await getIdentity(npm.flatOptions) + const packages = await libaccess.lsPackages(username, npm.flatOptions) + return Object.keys(packages) + .filter((name) => + packages[name] === 'write' && + (opts.conf.argv.remain.length === 0 || + name.startsWith(opts.conf.argv.remain[0]))) } const cmd = (args, cb) => diff --git a/deps/npm/lib/diff.js b/deps/npm/lib/diff.js index af6760106e0065..9ef5a78a20ce9e 100644 --- a/deps/npm/lib/diff.js +++ b/deps/npm/lib/diff.js @@ -11,7 +11,6 @@ const pickManifest = require('npm-pick-manifest') const npm = require('./npm.js') const usageUtil = require('./utils/usage.js') const output = require('./utils/output.js') -const completion = require('./utils/completion/none.js') const readLocalPkg = require('./utils/read-local-package.js') const usage = usageUtil( @@ -263,4 +262,4 @@ const findVersionsByPackageName = async (specs) => { }) } -module.exports = Object.assign(cmd, { completion, usage }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/dist-tag.js b/deps/npm/lib/dist-tag.js index ae4b33ce864122..e958bb75442229 100644 --- a/deps/npm/lib/dist-tag.js +++ b/deps/npm/lib/dist-tag.js @@ -16,14 +16,14 @@ const usage = usageUtil( '\nnpm dist-tag ls []' ) -const completion = function (opts, cb) { +const completion = async (opts) => { const argv = opts.conf.argv.remain if (argv.length === 2) - return cb(null, ['add', 'rm', 'ls']) + return ['add', 'rm', 'ls'] switch (argv[2]) { default: - return cb() + return [] } } diff --git a/deps/npm/lib/docs.js b/deps/npm/lib/docs.js index b6a3df7f70fe99..fa0adb3d373091 100644 --- a/deps/npm/lib/docs.js +++ b/deps/npm/lib/docs.js @@ -7,7 +7,6 @@ const npm = require('./npm.js') const hostedFromMani = require('./utils/hosted-git-info-from-manifest.js') const usage = usageUtil('docs', 'npm docs [ [ ...]]') -const completion = require('./utils/completion/none.js') const cmd = (args, cb) => docs(args).then(() => cb()).catch(cb) @@ -37,4 +36,4 @@ const getDocs = async pkg => { await openUrl(url, `${mani.name} docs available at the following URL`) } -module.exports = Object.assign(cmd, { usage, completion }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/doctor.js b/deps/npm/lib/doctor.js index f42b19fa686b7e..e149aec1286d54 100644 --- a/deps/npm/lib/doctor.js +++ b/deps/npm/lib/doctor.js @@ -4,7 +4,6 @@ const chalk = require('chalk') const ansiTrim = require('./utils/ansi-trim.js') const table = require('text-table') const output = require('./utils/output.js') -const completion = require('./utils/completion/none.js') const usageUtil = require('./utils/usage.js') const usage = usageUtil('doctor', 'npm doctor') const { resolve } = require('path') @@ -285,4 +284,4 @@ const doctor = async args => { throw 'Some problems found. See above for recommendations.' } -module.exports = Object.assign(cmd, { completion, usage }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/exec.js b/deps/npm/lib/exec.js index e90ec0866e4dd7..dab65c23a37b27 100644 --- a/deps/npm/lib/exec.js +++ b/deps/npm/lib/exec.js @@ -21,8 +21,6 @@ const usage = usageUtil('exec', '-c --call= (may not be mixed with positional arguments)' ) -const completion = require('./utils/completion/installed-shallow.js') - const { promisify } = require('util') const read = promisify(require('read')) @@ -284,4 +282,4 @@ const getHash = packages => .digest('hex') .slice(0, 16) -module.exports = Object.assign(cmd, { completion, usage }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/explain.js b/deps/npm/lib/explain.js index 9176f2e6c2473a..a0a4427bccf2cc 100644 --- a/deps/npm/lib/explain.js +++ b/deps/npm/lib/explain.js @@ -30,7 +30,7 @@ const explain = async (args) => { const expls = [] for (const node of nodes) { - const { extraneous, dev, optional, devOptional, peer } = node + const { extraneous, dev, optional, devOptional, peer, inBundle } = node const expl = node.explain() if (extraneous) expl.extraneous = true @@ -39,6 +39,7 @@ const explain = async (args) => { expl.optional = optional expl.devOptional = devOptional expl.peer = peer + expl.bundled = inBundle } expls.push(expl) } diff --git a/deps/npm/lib/find-dupes.js b/deps/npm/lib/find-dupes.js index 95791637821446..19e7ea6a7c8cc5 100644 --- a/deps/npm/lib/find-dupes.js +++ b/deps/npm/lib/find-dupes.js @@ -3,7 +3,6 @@ const dedupe = require('./dedupe.js') const usageUtil = require('./utils/usage.js') const usage = usageUtil('find-dupes', 'npm find-dupes') -const completion = require('./utils/completion/none.js') const cmd = (args, cb) => dedupe({ dryRun: true }, cb) -module.exports = Object.assign(cmd, { usage, completion }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/get.js b/deps/npm/lib/get.js index ab2141e35721ae..8a416027d7fbaa 100644 --- a/deps/npm/lib/get.js +++ b/deps/npm/lib/get.js @@ -1,4 +1,5 @@ const npm = require('./npm.js') +const config = require('./config.js') const usageUtil = require('./utils/usage.js') const usage = usageUtil( @@ -6,7 +7,7 @@ const usage = usageUtil( 'npm get [ ...] (See `npm config`)' ) -const completion = npm.commands.config.completion +const completion = config.completion const cmd = (args, cb) => npm.commands.config(['get'].concat(args), cb) diff --git a/deps/npm/lib/help-search.js b/deps/npm/lib/help-search.js index d2a1818060b21b..b1847350480439 100644 --- a/deps/npm/lib/help-search.js +++ b/deps/npm/lib/help-search.js @@ -11,7 +11,6 @@ const didYouMean = require('./utils/did-you-mean.js') const { cmdList } = require('./utils/cmd-list.js') const usage = usageUtil('help-search', 'npm help-search ') -const completion = require('./utils/completion/none.js') const npmUsage = require('./utils/npm-usage.js') @@ -201,4 +200,4 @@ const formatResults = (args, results) => { return finalOut.trim() } -module.exports = Object.assign(cmd, { usage, completion }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/help.js b/deps/npm/lib/help.js index f6996166542f9b..6f215c76c1ead0 100644 --- a/deps/npm/lib/help.js +++ b/deps/npm/lib/help.js @@ -1,10 +1,24 @@ module.exports = help -help.completion = function (opts, cb) { +help.completion = async (opts) => { if (opts.conf.argv.remain.length > 2) - return cb(null, []) - getSections(cb) + return [] + const g = path.resolve(__dirname, '../man/man[0-9]/*.[0-9]') + const files = await new Promise((resolve, reject) => { + glob(g, function (er, files) { + if (er) + return reject(er) + resolve(files) + }) + }) + + return Object.keys(files.reduce(function (acc, file) { + file = path.basename(file).replace(/\.[0-9]+$/, '') + file = file.replace(/^npm-/, '') + acc[file] = true + return acc + }, { help: true })) } const npmUsage = require('./utils/npm-usage.js') @@ -175,18 +189,3 @@ function htmlMan (man) { } return 'file://' + path.resolve(__dirname, '..', 'docs', 'output', sect, f + '.html') } - -function getSections (cb) { - const g = path.resolve(__dirname, '../man/man[0-9]/*.[0-9]') - glob(g, function (er, files) { - if (er) - return cb(er) - - cb(null, Object.keys(files.reduce(function (acc, file) { - file = path.basename(file).replace(/\.[0-9]+$/, '') - file = file.replace(/^npm-/, '') - acc[file] = true - return acc - }, { help: true }))) - }) -} diff --git a/deps/npm/lib/hook.js b/deps/npm/lib/hook.js index e0e15243e03a58..7d69ccbf2aa4c1 100644 --- a/deps/npm/lib/hook.js +++ b/deps/npm/lib/hook.js @@ -13,8 +13,6 @@ const usage = usageUtil('hook', [ 'npm hook update ', ].join('\n')) -const completion = require('./utils/completion/none.js') - const cmd = (args, cb) => hook(args).then(() => cb()).catch(cb) const hook = async (args) => otplease(npm.flatOptions, opts => { @@ -127,4 +125,4 @@ const hookName = (hook) => { return target } -module.exports = Object.assign(cmd, { usage, completion }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/init.js b/deps/npm/lib/init.js index 60ea52e1674911..a029779f89638f 100644 --- a/deps/npm/lib/init.js +++ b/deps/npm/lib/init.js @@ -3,7 +3,6 @@ const npa = require('npm-package-arg') const npm = require('./npm.js') const usageUtil = require('./utils/usage.js') -const completion = require('./utils/completion/none.js') const output = require('./utils/output.js') const usage = usageUtil( @@ -86,4 +85,4 @@ const init = async args => { }) } -module.exports = Object.assign(cmd, { completion, usage }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/install.js b/deps/npm/lib/install.js index 303370594a0623..5f0137db1ceacb 100644 --- a/deps/npm/lib/install.js +++ b/deps/npm/lib/install.js @@ -57,6 +57,7 @@ const install = async args => { scriptShell, stdio: 'inherit', stdioString: true, + banner: log.level !== 'silent', event, }) } @@ -80,14 +81,14 @@ const usage = usageUtil( '[--save-prod|--save-dev|--save-optional|--save-peer] [--save-exact] [--no-save]' ) -const completion = async (opts, cb) => { +const completion = async (opts) => { const { partialWord } = opts // install can complete to a folder with a package.json, or any package. // if it has a slash, then it's gotta be a folder // if it starts with https?://, then just give up, because it's a url if (/^https?:\/\//.test(partialWord)) { // do not complete to URLs - return cb(null, []) + return [] } if (/\//.test(partialWord)) { @@ -125,19 +126,18 @@ const completion = async (opts, cb) => { const match = matches.filter(el => !el || el.isPackage).pop() if (match) { // Success - only one match and it is a package dir - return cb(null, [match.fullPath]) + return [match.fullPath] } else { // no matches - return cb(null, []) + return [] } } catch (er) { - return cb(null, []) // invalid dir: no matching + return [] // invalid dir: no matching } } // Note: there used to be registry completion here, // but it stopped making sense somewhere around // 50,000 packages on the registry - cb() } module.exports = Object.assign(cmd, { usage, completion }) diff --git a/deps/npm/lib/link.js b/deps/npm/lib/link.js index 84f36ada662016..0bb3d87b5e7d48 100644 --- a/deps/npm/lib/link.js +++ b/deps/npm/lib/link.js @@ -1,4 +1,6 @@ -const { readdir } = require('fs') +const fs = require('fs') +const util = require('util') +const readdir = util.promisify(fs.readdir) const { resolve } = require('path') const Arborist = require('@npmcli/arborist') @@ -10,9 +12,10 @@ const npm = require('./npm.js') const usageUtil = require('./utils/usage.js') const reifyFinish = require('./utils/reify-finish.js') -const completion = (opts, cb) => { +const completion = async (opts) => { const dir = npm.globalDir - readdir(dir, (er, files) => cb(er, files.filter(f => !/^[._-]/.test(f)))) + const files = await readdir(dir) + return files.filter(f => !/^[._-]/.test(f)) } const usage = usageUtil( diff --git a/deps/npm/lib/ll.js b/deps/npm/lib/ll.js index ada260e32936a4..1d5a6217da9c79 100644 --- a/deps/npm/lib/ll.js +++ b/deps/npm/lib/ll.js @@ -1,6 +1,9 @@ const { usage, completion } = require('./ls.js') const npm = require('./npm.js') -module.exports = Object.assign((args, cb) => { + +const cmd = (args, cb) => { npm.config.set('long', true) return npm.commands.ls(args, cb) -}, { usage, completion }) +} + +module.exports = Object.assign(cmd, { usage, completion }) diff --git a/deps/npm/lib/logout.js b/deps/npm/lib/logout.js index ba2eb92fee853f..d2762c1ba3e5fa 100644 --- a/deps/npm/lib/logout.js +++ b/deps/npm/lib/logout.js @@ -4,7 +4,6 @@ const getAuth = require('npm-registry-fetch/auth.js') const npmFetch = require('npm-registry-fetch') const npm = require('./npm.js') const usageUtil = require('./utils/usage.js') -const completion = require('./utils/completion/none.js') const usage = usageUtil( 'logout', @@ -42,4 +41,4 @@ const logout = async (args) => { await npm.config.save('user') } -module.exports = Object.assign(cmd, { completion, usage }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/npm.js b/deps/npm/lib/npm.js index 40aa9bbd9b5061..85dc67a78aac68 100644 --- a/deps/npm/lib/npm.js +++ b/deps/npm/lib/npm.js @@ -49,6 +49,7 @@ const makeCmd = cmd => { } const { types, defaults, shorthands } = require('./utils/config.js') +const { shellouts } = require('./utils/cmd-list.js') let warnedNonDashArg = false const _runCmd = Symbol('_runCmd') @@ -81,6 +82,10 @@ const npm = module.exports = new class extends EventEmitter { this.updateNotification = null } + get shelloutCommands () { + return shellouts + } + deref (c) { return deref(c) } diff --git a/deps/npm/lib/org.js b/deps/npm/lib/org.js index b7af3f3a3022a0..aa9c97d497bbfb 100644 --- a/deps/npm/lib/org.js +++ b/deps/npm/lib/org.js @@ -13,19 +13,19 @@ org.usage = 'npm org rm orgname username\n' + 'npm org ls orgname []' -org.completion = function (opts, cb) { +org.completion = async (opts) => { var argv = opts.conf.argv.remain if (argv.length === 2) - return cb(null, org.subcommands) + return org.subcommands switch (argv[2]) { case 'ls': case 'add': case 'rm': case 'set': - return cb(null, []) + return [] default: - return cb(new Error(argv[2] + ' not recognized')) + throw new Error(argv[2] + ' not recognized') } } diff --git a/deps/npm/lib/outdated.js b/deps/npm/lib/outdated.js index f9a3fed8c10d48..c10f63a12e3a27 100644 --- a/deps/npm/lib/outdated.js +++ b/deps/npm/lib/outdated.js @@ -17,7 +17,6 @@ const ansiTrim = require('./utils/ansi-trim.js') const usage = usageUtil('outdated', 'npm outdated [[<@scope>/] ...]' ) -const completion = require('./utils/completion/none.js') function cmd (args, cb) { outdated(args) @@ -287,4 +286,4 @@ function makeJSON (list, opts) { return JSON.stringify(out, null, 2) } -module.exports = Object.assign(cmd, { completion, usage }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/owner.js b/deps/npm/lib/owner.js index 0bfb0a6a5464a6..6dce3ec70f3965 100644 --- a/deps/npm/lib/owner.js +++ b/deps/npm/lib/owner.js @@ -16,18 +16,16 @@ const usage = usageUtil( '\nnpm owner ls [<@scope>/]' ) -const completion = function (opts, cb) { +const completion = async (opts) => { const argv = opts.conf.argv.remain if (argv.length > 3) - return cb(null, []) + return [] if (argv[1] !== 'owner') argv.unshift('owner') - if (argv.length === 2) { - var subs = ['add', 'rm', 'ls'] - return cb(null, subs) - } + if (argv.length === 2) + return ['add', 'rm', 'ls'] // reaches registry in order to autocomplete rm if (argv[2] === 'rm') { @@ -35,25 +33,16 @@ const completion = function (opts, cb) { ...npm.flatOptions, fullMetadata: true, } - readLocalPkg() - .then(pkgName => { - if (!pkgName) - return null - - const spec = npa(pkgName) - return pacote.packument(spec, opts) - }) - .then(data => { - if (data && data.maintainers && data.maintainers.length) - return data.maintainers.map(m => m.name) - - return [] - }) - .then(owners => { - return cb(null, owners) - }) - } else - cb(null, []) + const pkgName = await readLocalPkg() + if (!pkgName) + return [] + + const spec = npa(pkgName) + const data = await pacote.packument(spec, opts) + if (data && data.maintainers && data.maintainers.length) + return data.maintainers.map(m => m.name) + } + return [] } const UsageError = () => diff --git a/deps/npm/lib/pack.js b/deps/npm/lib/pack.js index 7a5c2edabcff99..ff906cc2bd5a13 100644 --- a/deps/npm/lib/pack.js +++ b/deps/npm/lib/pack.js @@ -10,7 +10,6 @@ const { getContents, logTar } = require('./utils/tar.js') const writeFile = util.promisify(require('fs').writeFile) const output = require('./utils/output.js') -const completion = require('./utils/completion/none.js') const usageUtil = require('./utils/usage.js') const usage = usageUtil('pack', 'npm pack [[<@scope>/]...] [--dry-run]') @@ -47,4 +46,4 @@ const pack_ = async (arg, opts) => { return pkgContents } -module.exports = Object.assign(cmd, { usage, completion }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/ping.js b/deps/npm/lib/ping.js index 7762be6d29aa4b..efa22631033c91 100644 --- a/deps/npm/lib/ping.js +++ b/deps/npm/lib/ping.js @@ -4,7 +4,6 @@ const output = require('./utils/output.js') const usageUtil = require('./utils/usage.js') const usage = usageUtil('ping', 'npm ping\nping registry') -const completion = require('./utils/completion/none.js') const cmd = (args, cb) => ping(args).then(() => cb()).catch(cb) const pingUtil = require('./utils/ping.js') @@ -25,4 +24,4 @@ const ping = async args => { log.notice('PONG', `${JSON.stringify(details, null, 2)}`) } -module.exports = Object.assign(cmd, { completion, usage }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/prefix.js b/deps/npm/lib/prefix.js index 0a991447346d64..d108b9d423afd5 100644 --- a/deps/npm/lib/prefix.js +++ b/deps/npm/lib/prefix.js @@ -1,8 +1,7 @@ const npm = require('./npm.js') const output = require('./utils/output.js') const usageUtil = require('./utils/usage.js') -const completion = require('./utils/completion/none.js') const cmd = (args, cb) => prefix(args).then(() => cb()).catch(cb) const usage = usageUtil('prefix', 'npm prefix [-g]') const prefix = async (args, cb) => output(npm.prefix) -module.exports = Object.assign(cmd, { usage, completion }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/profile.js b/deps/npm/lib/profile.js index 24f026ce85ec48..3727ac0c8bdd41 100644 --- a/deps/npm/lib/profile.js +++ b/deps/npm/lib/profile.js @@ -20,25 +20,25 @@ const usage = usageUtil( 'npm profile set ' ) -const completion = (opts, cb) => { +const completion = async (opts) => { var argv = opts.conf.argv.remain const subcommands = ['enable-2fa', 'disable-2fa', 'get', 'set'] if (!argv[2]) - return cb(null, subcommands) + return subcommands switch (argv[2]) { case 'enable-2fa': case 'enable-tfa': - return cb(null, ['auth-and-writes', 'auth-only']) + return ['auth-and-writes', 'auth-only'] case 'disable-2fa': case 'disable-tfa': case 'get': case 'set': - return cb(null, []) + return [] default: - return cb(new Error(argv[2] + ' not recognized')) + throw new Error(argv[2] + ' not recognized') } } diff --git a/deps/npm/lib/prune.js b/deps/npm/lib/prune.js index ea6ed4108aba28..228fd3eebb1786 100644 --- a/deps/npm/lib/prune.js +++ b/deps/npm/lib/prune.js @@ -8,7 +8,6 @@ const reifyFinish = require('./utils/reify-finish.js') const usage = usageUtil('prune', 'npm prune [[<@scope>/]...] [--production]' ) -const completion = require('./utils/completion/none.js') const cmd = (args, cb) => prune().then(() => cb()).catch(cb) @@ -22,4 +21,4 @@ const prune = async () => { await reifyFinish(arb) } -module.exports = Object.assign(cmd, { usage, completion }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/publish.js b/deps/npm/lib/publish.js index 190d381a8aeeb4..5ec66d42fa9a7c 100644 --- a/deps/npm/lib/publish.js +++ b/deps/npm/lib/publish.js @@ -18,7 +18,6 @@ const { getContents, logTar } = require('./utils/tar.js') // defaults and metadata, like git sha's and default scripts and all that. const readJson = util.promisify(require('read-package-json')) -const completion = require('./utils/completion/none.js') const usageUtil = require('./utils/usage.js') const usage = usageUtil('publish', 'npm publish [] [--tag ] [--access ] [--dry-run]' + @@ -85,6 +84,7 @@ const publish_ = async (arg, opts) => { path: spec.fetchSpec, stdio: 'inherit', pkg: manifest, + banner: log.level !== 'silent', }) } @@ -121,6 +121,7 @@ const publish_ = async (arg, opts) => { path: spec.fetchSpec, stdio: 'inherit', pkg: manifest, + banner: log.level !== 'silent', }) await runScript({ @@ -128,10 +129,11 @@ const publish_ = async (arg, opts) => { path: spec.fetchSpec, stdio: 'inherit', pkg: manifest, + banner: log.level !== 'silent', }) } return pkgContents } -module.exports = Object.assign(cmd, { usage, completion }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/repo.js b/deps/npm/lib/repo.js index 2dc3bcb1b846f6..e9074dca68d7ce 100644 --- a/deps/npm/lib/repo.js +++ b/deps/npm/lib/repo.js @@ -8,7 +8,6 @@ const hostedFromMani = require('./utils/hosted-git-info-from-manifest.js') const { URL } = require('url') const usage = usageUtil('repo', 'npm repo [ [ ...]]') -const completion = require('./utils/completion/none.js') const cmd = (args, cb) => repo(args).then(() => cb()).catch(cb) @@ -69,4 +68,4 @@ const unknownHostedUrl = url => { } } -module.exports = Object.assign(cmd, { usage, completion }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/restart.js b/deps/npm/lib/restart.js index 41f9c3a7568622..1462cf6051d0fb 100644 --- a/deps/npm/lib/restart.js +++ b/deps/npm/lib/restart.js @@ -1 +1,2 @@ -module.exports = require('./utils/lifecycle-cmd.js')('restart') +const npm = require('./npm.js') +module.exports = require('./utils/lifecycle-cmd.js')(npm, 'restart') diff --git a/deps/npm/lib/root.js b/deps/npm/lib/root.js index 27e357655c3c01..631aef83867d1e 100644 --- a/deps/npm/lib/root.js +++ b/deps/npm/lib/root.js @@ -1,8 +1,7 @@ const npm = require('./npm.js') const output = require('./utils/output.js') const usageUtil = require('./utils/usage.js') -const completion = require('./utils/completion/none.js') const cmd = (args, cb) => root(args).then(() => cb()).catch(cb) const usage = usageUtil('root', 'npm root [-g]') const root = async (args, cb) => output(npm.dir) -module.exports = Object.assign(cmd, { usage, completion }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/run-script.js b/deps/npm/lib/run-script.js index c095e6decd4032..4dfb854cad9fa1 100644 --- a/deps/npm/lib/run-script.js +++ b/deps/npm/lib/run-script.js @@ -1,5 +1,5 @@ -const run = require('@npmcli/run-script') -const { isServerPackage } = run +const runScript = require('@npmcli/run-script') +const { isServerPackage } = runScript const npm = require('./npm.js') const readJson = require('read-package-json-fast') const { resolve } = require('path') @@ -14,24 +14,22 @@ const usage = usageUtil( 'npm run-script [-- ]' ) -const completion = async (opts, cb) => { +const completion = async (opts) => { const argv = opts.conf.argv.remain if (argv.length === 2) { // find the script name const json = resolve(npm.localPrefix, 'package.json') const { scripts = {} } = await readJson(json).catch(er => ({})) - return cb(null, Object.keys(scripts)) + return Object.keys(scripts) } - // otherwise nothing to do, just let the system handle it - return cb() } const cmd = (args, cb) => { - const fn = args.length ? runScript : list + const fn = args.length ? doRun : list return fn(args).then(() => cb()).catch(cb) } -const runScript = async (args) => { +const doRun = async (args) => { const path = npm.localPrefix const event = args.shift() const { scriptShell } = npm.flatOptions @@ -41,7 +39,7 @@ const runScript = async (args) => { if (event === 'restart' && !scripts.restart) scripts.restart = 'npm stop --if-present && npm start' - else if (event === 'env') + else if (event === 'env' && !scripts.env) scripts.env = isWindowsShell ? 'SET' : 'env' pkg.scripts = scripts @@ -76,7 +74,7 @@ const runScript = async (args) => { } for (const [event, args] of events) { - await run({ + await runScript({ ...opts, event, args, diff --git a/deps/npm/lib/search.js b/deps/npm/lib/search.js index a3d806d2f1507e..3f8fd99fb8ad87 100644 --- a/deps/npm/lib/search.js +++ b/deps/npm/lib/search.js @@ -8,7 +8,6 @@ const packageFilter = require('./search/package-filter.js') const npm = require('./npm.js') const output = require('./utils/output.js') const usageUtil = require('./utils/usage.js') -const completion = require('./utils/completion/none.js') const usage = usageUtil( 'search', @@ -86,4 +85,4 @@ function prepareExcludes (searchexclude) { .filter(s => s) } -module.exports = Object.assign(cmd, { completion, usage }) +module.exports = Object.assign(cmd, { usage }) diff --git a/deps/npm/lib/set-script.js b/deps/npm/lib/set-script.js index f655c221078942..7bac6eca50604e 100644 --- a/deps/npm/lib/set-script.js +++ b/deps/npm/lib/set-script.js @@ -3,7 +3,6 @@ const usageUtil = require('./utils/usage.js') const { localPrefix } = require('./npm.js') const fs = require('fs') const usage = usageUtil('set-script', 'npm set-script [ -``` - -### UMD - -To load this module directly into older browsers you can use the [UMD (Universal Module Definition)](https://github.com/umdjs/umd) builds from any of the following CDNs: - -**Using [UNPKG](https://unpkg.com/uuid@latest/dist/umd/)**: - -```html - -``` - -**Using [jsDelivr](https://cdn.jsdelivr.net/npm/uuid@latest/dist/umd/)**: - -```html - +npm test ``` -**Using [cdnjs](https://cdnjs.com/libraries/uuid)**: - -```html - -``` - -These CDNs all provide the same [`uuidv4()`](#uuidv4options-buffer-offset) method: - -```html - -``` - -Methods for the other algorithms ([`uuidv1()`](#uuidv1options-buffer-offset), [`uuidv3()`](#uuidv3name-namespace-buffer-offset) and [`uuidv5()`](#uuidv5name-namespace-buffer-offset)) are available from the files `uuidv1.min.js`, `uuidv3.min.js` and `uuidv5.min.js` respectively. - -## "getRandomValues() not supported" - -This error occurs in environments where the standard [`crypto.getRandomValues()`](https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues) API is not supported. This issue can be resolved by adding an appropriate polyfill: - -### React Native / Expo - -1. Install [`react-native-get-random-values`](https://github.com/LinusU/react-native-get-random-values#readme) -1. Import it _before_ `uuid`. Since `uuid` might also appear as a transitive dependency of some other imports it's safest to just import `react-native-get-random-values` as the very first thing in your entry point: - -```javascript -import 'react-native-get-random-values'; -import { v4 as uuidv4 } from 'uuid'; -``` - -Note: If you are using Expo, you must be using at least `react-native-get-random-values@1.5.0` and `expo@39.0.0`. - -### Web Workers / Service Workers (Edge <= 18) - -[In Edge <= 18, Web Crypto is not supported in Web Workers or Service Workers](https://caniuse.com/#feat=cryptography) and we are not aware of a polyfill (let us know if you find one, please). - -## Upgrading From `uuid@7.x` - -### Only Named Exports Supported When Using with Node.js ESM - -`uuid@7.x` did not come with native ECMAScript Module (ESM) support for Node.js. Importing it in Node.js ESM consequently imported the CommonJS source with a default export. This library now comes with true Node.js ESM support and only provides named exports. - -Instead of doing: - -```javascript -import uuid from 'uuid'; -uuid.v4(); -``` - -you will now have to use the named exports: - -```javascript -import { v4 as uuidv4 } from 'uuid'; -uuidv4(); -``` - -### Deep Requires No Longer Supported - -Deep requires like `require('uuid/v4')` [which have been deprecated in `uuid@7.x`](#deep-requires-now-deprecated) are no longer supported. - -## Upgrading From `uuid@3.x` - -"_Wait... what happened to `uuid@4.x` - `uuid@6.x`?!?_" - -In order to avoid confusion with RFC [version 4](#uuidv4options-buffer-offset) and [version 5](#uuidv5name-namespace-buffer-offset) UUIDs, and a possible [version 6](http://gh.peabody.io/uuidv6/), releases 4 thru 6 of this module have been skipped. - -### Deep Requires Now Deprecated - -`uuid@3.x` encouraged the use of deep requires to minimize the bundle size of browser builds: - -```javascript -const uuidv4 = require('uuid/v4'); // <== NOW DEPRECATED! -uuidv4(); -``` - -As of `uuid@7.x` this library now provides ECMAScript modules builds, which allow packagers like Webpack and Rollup to do "tree-shaking" to remove dead code. Instead, use the `import` syntax: - -```javascript -import { v4 as uuidv4 } from 'uuid'; -uuidv4(); -``` - -... or for CommonJS: - -```javascript -const { v4: uuidv4 } = require('uuid'); -uuidv4(); -``` - -### Default Export Removed - -`uuid@3.x` was exporting the Version 4 UUID method as a default export: - -```javascript -const uuid = require('uuid'); // <== REMOVED! -``` - -This usage pattern was already discouraged in `uuid@3.x` and has been removed in `uuid@7.x`. - ---- Markdown generated from [README_js.md](README_js.md) by [![RunMD Logo](http://i.imgur.com/h0FVyzU.png)](https://github.com/broofa/runmd) \ No newline at end of file diff --git a/deps/npm/node_modules/request/node_modules/uuid/bin/uuid b/deps/npm/node_modules/uuid/bin/uuid similarity index 100% rename from deps/npm/node_modules/request/node_modules/uuid/bin/uuid rename to deps/npm/node_modules/uuid/bin/uuid diff --git a/deps/npm/node_modules/uuid/dist/bin/uuid b/deps/npm/node_modules/uuid/dist/bin/uuid deleted file mode 100755 index f38d2ee19e7d35..00000000000000 --- a/deps/npm/node_modules/uuid/dist/bin/uuid +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env node -require('../uuid-bin'); diff --git a/deps/npm/node_modules/uuid/dist/esm-browser/index.js b/deps/npm/node_modules/uuid/dist/esm-browser/index.js deleted file mode 100644 index 1db6f6d25b2b6a..00000000000000 --- a/deps/npm/node_modules/uuid/dist/esm-browser/index.js +++ /dev/null @@ -1,9 +0,0 @@ -export { default as v1 } from './v1.js'; -export { default as v3 } from './v3.js'; -export { default as v4 } from './v4.js'; -export { default as v5 } from './v5.js'; -export { default as NIL } from './nil.js'; -export { default as version } from './version.js'; -export { default as validate } from './validate.js'; -export { default as stringify } from './stringify.js'; -export { default as parse } from './parse.js'; \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/esm-browser/md5.js b/deps/npm/node_modules/uuid/dist/esm-browser/md5.js deleted file mode 100644 index 8b5d46a7e4c5c2..00000000000000 --- a/deps/npm/node_modules/uuid/dist/esm-browser/md5.js +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Browser-compatible JavaScript MD5 - * - * Modification of JavaScript MD5 - * https://github.com/blueimp/JavaScript-MD5 - * - * Copyright 2011, Sebastian Tschan - * https://blueimp.net - * - * Licensed under the MIT license: - * https://opensource.org/licenses/MIT - * - * Based on - * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message - * Digest Algorithm, as defined in RFC 1321. - * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009 - * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet - * Distributed under the BSD License - * See http://pajhome.org.uk/crypt/md5 for more info. - */ -function md5(bytes) { - if (typeof bytes === 'string') { - var msg = unescape(encodeURIComponent(bytes)); // UTF8 escape - - bytes = new Uint8Array(msg.length); - - for (var i = 0; i < msg.length; ++i) { - bytes[i] = msg.charCodeAt(i); - } - } - - return md5ToHexEncodedArray(wordsToMd5(bytesToWords(bytes), bytes.length * 8)); -} -/* - * Convert an array of little-endian words to an array of bytes - */ - - -function md5ToHexEncodedArray(input) { - var output = []; - var length32 = input.length * 32; - var hexTab = '0123456789abcdef'; - - for (var i = 0; i < length32; i += 8) { - var x = input[i >> 5] >>> i % 32 & 0xff; - var hex = parseInt(hexTab.charAt(x >>> 4 & 0x0f) + hexTab.charAt(x & 0x0f), 16); - output.push(hex); - } - - return output; -} -/** - * Calculate output length with padding and bit length - */ - - -function getOutputLength(inputLength8) { - return (inputLength8 + 64 >>> 9 << 4) + 14 + 1; -} -/* - * Calculate the MD5 of an array of little-endian words, and a bit length. - */ - - -function wordsToMd5(x, len) { - /* append padding */ - x[len >> 5] |= 0x80 << len % 32; - x[getOutputLength(len) - 1] = len; - var a = 1732584193; - var b = -271733879; - var c = -1732584194; - var d = 271733878; - - for (var i = 0; i < x.length; i += 16) { - var olda = a; - var oldb = b; - var oldc = c; - var oldd = d; - a = md5ff(a, b, c, d, x[i], 7, -680876936); - d = md5ff(d, a, b, c, x[i + 1], 12, -389564586); - c = md5ff(c, d, a, b, x[i + 2], 17, 606105819); - b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330); - a = md5ff(a, b, c, d, x[i + 4], 7, -176418897); - d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426); - c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341); - b = md5ff(b, c, d, a, x[i + 7], 22, -45705983); - a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416); - d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417); - c = md5ff(c, d, a, b, x[i + 10], 17, -42063); - b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162); - a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682); - d = md5ff(d, a, b, c, x[i + 13], 12, -40341101); - c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290); - b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329); - a = md5gg(a, b, c, d, x[i + 1], 5, -165796510); - d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632); - c = md5gg(c, d, a, b, x[i + 11], 14, 643717713); - b = md5gg(b, c, d, a, x[i], 20, -373897302); - a = md5gg(a, b, c, d, x[i + 5], 5, -701558691); - d = md5gg(d, a, b, c, x[i + 10], 9, 38016083); - c = md5gg(c, d, a, b, x[i + 15], 14, -660478335); - b = md5gg(b, c, d, a, x[i + 4], 20, -405537848); - a = md5gg(a, b, c, d, x[i + 9], 5, 568446438); - d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690); - c = md5gg(c, d, a, b, x[i + 3], 14, -187363961); - b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501); - a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467); - d = md5gg(d, a, b, c, x[i + 2], 9, -51403784); - c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473); - b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734); - a = md5hh(a, b, c, d, x[i + 5], 4, -378558); - d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463); - c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562); - b = md5hh(b, c, d, a, x[i + 14], 23, -35309556); - a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060); - d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353); - c = md5hh(c, d, a, b, x[i + 7], 16, -155497632); - b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640); - a = md5hh(a, b, c, d, x[i + 13], 4, 681279174); - d = md5hh(d, a, b, c, x[i], 11, -358537222); - c = md5hh(c, d, a, b, x[i + 3], 16, -722521979); - b = md5hh(b, c, d, a, x[i + 6], 23, 76029189); - a = md5hh(a, b, c, d, x[i + 9], 4, -640364487); - d = md5hh(d, a, b, c, x[i + 12], 11, -421815835); - c = md5hh(c, d, a, b, x[i + 15], 16, 530742520); - b = md5hh(b, c, d, a, x[i + 2], 23, -995338651); - a = md5ii(a, b, c, d, x[i], 6, -198630844); - d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415); - c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905); - b = md5ii(b, c, d, a, x[i + 5], 21, -57434055); - a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571); - d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606); - c = md5ii(c, d, a, b, x[i + 10], 15, -1051523); - b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799); - a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359); - d = md5ii(d, a, b, c, x[i + 15], 10, -30611744); - c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380); - b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649); - a = md5ii(a, b, c, d, x[i + 4], 6, -145523070); - d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379); - c = md5ii(c, d, a, b, x[i + 2], 15, 718787259); - b = md5ii(b, c, d, a, x[i + 9], 21, -343485551); - a = safeAdd(a, olda); - b = safeAdd(b, oldb); - c = safeAdd(c, oldc); - d = safeAdd(d, oldd); - } - - return [a, b, c, d]; -} -/* - * Convert an array bytes to an array of little-endian words - * Characters >255 have their high-byte silently ignored. - */ - - -function bytesToWords(input) { - if (input.length === 0) { - return []; - } - - var length8 = input.length * 8; - var output = new Uint32Array(getOutputLength(length8)); - - for (var i = 0; i < length8; i += 8) { - output[i >> 5] |= (input[i / 8] & 0xff) << i % 32; - } - - return output; -} -/* - * Add integers, wrapping at 2^32. This uses 16-bit operations internally - * to work around bugs in some JS interpreters. - */ - - -function safeAdd(x, y) { - var lsw = (x & 0xffff) + (y & 0xffff); - var msw = (x >> 16) + (y >> 16) + (lsw >> 16); - return msw << 16 | lsw & 0xffff; -} -/* - * Bitwise rotate a 32-bit number to the left. - */ - - -function bitRotateLeft(num, cnt) { - return num << cnt | num >>> 32 - cnt; -} -/* - * These functions implement the four basic operations the algorithm uses. - */ - - -function md5cmn(q, a, b, x, s, t) { - return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b); -} - -function md5ff(a, b, c, d, x, s, t) { - return md5cmn(b & c | ~b & d, a, b, x, s, t); -} - -function md5gg(a, b, c, d, x, s, t) { - return md5cmn(b & d | c & ~d, a, b, x, s, t); -} - -function md5hh(a, b, c, d, x, s, t) { - return md5cmn(b ^ c ^ d, a, b, x, s, t); -} - -function md5ii(a, b, c, d, x, s, t) { - return md5cmn(c ^ (b | ~d), a, b, x, s, t); -} - -export default md5; \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/esm-browser/nil.js b/deps/npm/node_modules/uuid/dist/esm-browser/nil.js deleted file mode 100644 index b36324c2aa3faa..00000000000000 --- a/deps/npm/node_modules/uuid/dist/esm-browser/nil.js +++ /dev/null @@ -1 +0,0 @@ -export default '00000000-0000-0000-0000-000000000000'; \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/esm-browser/parse.js b/deps/npm/node_modules/uuid/dist/esm-browser/parse.js deleted file mode 100644 index 7c5b1d5a6b0210..00000000000000 --- a/deps/npm/node_modules/uuid/dist/esm-browser/parse.js +++ /dev/null @@ -1,35 +0,0 @@ -import validate from './validate.js'; - -function parse(uuid) { - if (!validate(uuid)) { - throw TypeError('Invalid UUID'); - } - - var v; - var arr = new Uint8Array(16); // Parse ########-....-....-....-............ - - arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24; - arr[1] = v >>> 16 & 0xff; - arr[2] = v >>> 8 & 0xff; - arr[3] = v & 0xff; // Parse ........-####-....-....-............ - - arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8; - arr[5] = v & 0xff; // Parse ........-....-####-....-............ - - arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8; - arr[7] = v & 0xff; // Parse ........-....-....-####-............ - - arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8; - arr[9] = v & 0xff; // Parse ........-....-....-....-############ - // (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes) - - arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff; - arr[11] = v / 0x100000000 & 0xff; - arr[12] = v >>> 24 & 0xff; - arr[13] = v >>> 16 & 0xff; - arr[14] = v >>> 8 & 0xff; - arr[15] = v & 0xff; - return arr; -} - -export default parse; \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/esm-browser/regex.js b/deps/npm/node_modules/uuid/dist/esm-browser/regex.js deleted file mode 100644 index 3da8673a5cdf3c..00000000000000 --- a/deps/npm/node_modules/uuid/dist/esm-browser/regex.js +++ /dev/null @@ -1 +0,0 @@ -export default /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i; \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/esm-browser/rng.js b/deps/npm/node_modules/uuid/dist/esm-browser/rng.js deleted file mode 100644 index 8abbf2ea5b3fc5..00000000000000 --- a/deps/npm/node_modules/uuid/dist/esm-browser/rng.js +++ /dev/null @@ -1,19 +0,0 @@ -// Unique ID creation requires a high quality random # generator. In the browser we therefore -// require the crypto API and do not support built-in fallback to lower quality random number -// generators (like Math.random()). -var getRandomValues; -var rnds8 = new Uint8Array(16); -export default function rng() { - // lazy load so that environments that need to polyfill have a chance to do so - if (!getRandomValues) { - // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. Also, - // find the complete implementation of crypto (msCrypto) on IE11. - getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto); - - if (!getRandomValues) { - throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported'); - } - } - - return getRandomValues(rnds8); -} \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/esm-browser/sha1.js b/deps/npm/node_modules/uuid/dist/esm-browser/sha1.js deleted file mode 100644 index 940548baa840ab..00000000000000 --- a/deps/npm/node_modules/uuid/dist/esm-browser/sha1.js +++ /dev/null @@ -1,96 +0,0 @@ -// Adapted from Chris Veness' SHA1 code at -// http://www.movable-type.co.uk/scripts/sha1.html -function f(s, x, y, z) { - switch (s) { - case 0: - return x & y ^ ~x & z; - - case 1: - return x ^ y ^ z; - - case 2: - return x & y ^ x & z ^ y & z; - - case 3: - return x ^ y ^ z; - } -} - -function ROTL(x, n) { - return x << n | x >>> 32 - n; -} - -function sha1(bytes) { - var K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6]; - var H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0]; - - if (typeof bytes === 'string') { - var msg = unescape(encodeURIComponent(bytes)); // UTF8 escape - - bytes = []; - - for (var i = 0; i < msg.length; ++i) { - bytes.push(msg.charCodeAt(i)); - } - } else if (!Array.isArray(bytes)) { - // Convert Array-like to Array - bytes = Array.prototype.slice.call(bytes); - } - - bytes.push(0x80); - var l = bytes.length / 4 + 2; - var N = Math.ceil(l / 16); - var M = new Array(N); - - for (var _i = 0; _i < N; ++_i) { - var arr = new Uint32Array(16); - - for (var j = 0; j < 16; ++j) { - arr[j] = bytes[_i * 64 + j * 4] << 24 | bytes[_i * 64 + j * 4 + 1] << 16 | bytes[_i * 64 + j * 4 + 2] << 8 | bytes[_i * 64 + j * 4 + 3]; - } - - M[_i] = arr; - } - - M[N - 1][14] = (bytes.length - 1) * 8 / Math.pow(2, 32); - M[N - 1][14] = Math.floor(M[N - 1][14]); - M[N - 1][15] = (bytes.length - 1) * 8 & 0xffffffff; - - for (var _i2 = 0; _i2 < N; ++_i2) { - var W = new Uint32Array(80); - - for (var t = 0; t < 16; ++t) { - W[t] = M[_i2][t]; - } - - for (var _t = 16; _t < 80; ++_t) { - W[_t] = ROTL(W[_t - 3] ^ W[_t - 8] ^ W[_t - 14] ^ W[_t - 16], 1); - } - - var a = H[0]; - var b = H[1]; - var c = H[2]; - var d = H[3]; - var e = H[4]; - - for (var _t2 = 0; _t2 < 80; ++_t2) { - var s = Math.floor(_t2 / 20); - var T = ROTL(a, 5) + f(s, b, c, d) + e + K[s] + W[_t2] >>> 0; - e = d; - d = c; - c = ROTL(b, 30) >>> 0; - b = a; - a = T; - } - - H[0] = H[0] + a >>> 0; - H[1] = H[1] + b >>> 0; - H[2] = H[2] + c >>> 0; - H[3] = H[3] + d >>> 0; - H[4] = H[4] + e >>> 0; - } - - return [H[0] >> 24 & 0xff, H[0] >> 16 & 0xff, H[0] >> 8 & 0xff, H[0] & 0xff, H[1] >> 24 & 0xff, H[1] >> 16 & 0xff, H[1] >> 8 & 0xff, H[1] & 0xff, H[2] >> 24 & 0xff, H[2] >> 16 & 0xff, H[2] >> 8 & 0xff, H[2] & 0xff, H[3] >> 24 & 0xff, H[3] >> 16 & 0xff, H[3] >> 8 & 0xff, H[3] & 0xff, H[4] >> 24 & 0xff, H[4] >> 16 & 0xff, H[4] >> 8 & 0xff, H[4] & 0xff]; -} - -export default sha1; \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/esm-browser/stringify.js b/deps/npm/node_modules/uuid/dist/esm-browser/stringify.js deleted file mode 100644 index 310211158db7ae..00000000000000 --- a/deps/npm/node_modules/uuid/dist/esm-browser/stringify.js +++ /dev/null @@ -1,30 +0,0 @@ -import validate from './validate.js'; -/** - * Convert array of 16 byte values to UUID string format of the form: - * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX - */ - -var byteToHex = []; - -for (var i = 0; i < 256; ++i) { - byteToHex.push((i + 0x100).toString(16).substr(1)); -} - -function stringify(arr) { - var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; - // Note: Be careful editing this code! It's been tuned for performance - // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 - var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one - // of the following: - // - One or more input array values don't map to a hex octet (leading to - // "undefined" in the uuid) - // - Invalid input values for the RFC `version` or `variant` fields - - if (!validate(uuid)) { - throw TypeError('Stringified UUID is invalid'); - } - - return uuid; -} - -export default stringify; \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/esm-browser/v1.js b/deps/npm/node_modules/uuid/dist/esm-browser/v1.js deleted file mode 100644 index 1a22591ef1eb8f..00000000000000 --- a/deps/npm/node_modules/uuid/dist/esm-browser/v1.js +++ /dev/null @@ -1,95 +0,0 @@ -import rng from './rng.js'; -import stringify from './stringify.js'; // **`v1()` - Generate time-based UUID** -// -// Inspired by https://github.com/LiosK/UUID.js -// and http://docs.python.org/library/uuid.html - -var _nodeId; - -var _clockseq; // Previous uuid creation time - - -var _lastMSecs = 0; -var _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details - -function v1(options, buf, offset) { - var i = buf && offset || 0; - var b = buf || new Array(16); - options = options || {}; - var node = options.node || _nodeId; - var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not - // specified. We do this lazily to minimize issues related to insufficient - // system entropy. See #189 - - if (node == null || clockseq == null) { - var seedBytes = options.random || (options.rng || rng)(); - - if (node == null) { - // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1) - node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]]; - } - - if (clockseq == null) { - // Per 4.2.2, randomize (14 bit) clockseq - clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff; - } - } // UUID timestamps are 100 nano-second units since the Gregorian epoch, - // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so - // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs' - // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00. - - - var msecs = options.msecs !== undefined ? options.msecs : Date.now(); // Per 4.2.1.2, use count of uuid's generated during the current clock - // cycle to simulate higher resolution clock - - var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs) - - var dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression - - if (dt < 0 && options.clockseq === undefined) { - clockseq = clockseq + 1 & 0x3fff; - } // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new - // time interval - - - if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) { - nsecs = 0; - } // Per 4.2.1.2 Throw error if too many uuids are requested - - - if (nsecs >= 10000) { - throw new Error("uuid.v1(): Can't create more than 10M uuids/sec"); - } - - _lastMSecs = msecs; - _lastNSecs = nsecs; - _clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch - - msecs += 12219292800000; // `time_low` - - var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000; - b[i++] = tl >>> 24 & 0xff; - b[i++] = tl >>> 16 & 0xff; - b[i++] = tl >>> 8 & 0xff; - b[i++] = tl & 0xff; // `time_mid` - - var tmh = msecs / 0x100000000 * 10000 & 0xfffffff; - b[i++] = tmh >>> 8 & 0xff; - b[i++] = tmh & 0xff; // `time_high_and_version` - - b[i++] = tmh >>> 24 & 0xf | 0x10; // include version - - b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant) - - b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low` - - b[i++] = clockseq & 0xff; // `node` - - for (var n = 0; n < 6; ++n) { - b[i + n] = node[n]; - } - - return buf || stringify(b); -} - -export default v1; \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/esm-browser/v3.js b/deps/npm/node_modules/uuid/dist/esm-browser/v3.js deleted file mode 100644 index c9ab9a4cd78d32..00000000000000 --- a/deps/npm/node_modules/uuid/dist/esm-browser/v3.js +++ /dev/null @@ -1,4 +0,0 @@ -import v35 from './v35.js'; -import md5 from './md5.js'; -var v3 = v35('v3', 0x30, md5); -export default v3; \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/esm-browser/v35.js b/deps/npm/node_modules/uuid/dist/esm-browser/v35.js deleted file mode 100644 index 31dd8a1c89b167..00000000000000 --- a/deps/npm/node_modules/uuid/dist/esm-browser/v35.js +++ /dev/null @@ -1,64 +0,0 @@ -import stringify from './stringify.js'; -import parse from './parse.js'; - -function stringToBytes(str) { - str = unescape(encodeURIComponent(str)); // UTF8 escape - - var bytes = []; - - for (var i = 0; i < str.length; ++i) { - bytes.push(str.charCodeAt(i)); - } - - return bytes; -} - -export var DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8'; -export var URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8'; -export default function (name, version, hashfunc) { - function generateUUID(value, namespace, buf, offset) { - if (typeof value === 'string') { - value = stringToBytes(value); - } - - if (typeof namespace === 'string') { - namespace = parse(namespace); - } - - if (namespace.length !== 16) { - throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)'); - } // Compute hash of namespace and value, Per 4.3 - // Future: Use spread syntax when supported on all platforms, e.g. `bytes = - // hashfunc([...namespace, ... value])` - - - var bytes = new Uint8Array(16 + value.length); - bytes.set(namespace); - bytes.set(value, namespace.length); - bytes = hashfunc(bytes); - bytes[6] = bytes[6] & 0x0f | version; - bytes[8] = bytes[8] & 0x3f | 0x80; - - if (buf) { - offset = offset || 0; - - for (var i = 0; i < 16; ++i) { - buf[offset + i] = bytes[i]; - } - - return buf; - } - - return stringify(bytes); - } // Function#name is not settable on some platforms (#270) - - - try { - generateUUID.name = name; // eslint-disable-next-line no-empty - } catch (err) {} // For CommonJS default export support - - - generateUUID.DNS = DNS; - generateUUID.URL = URL; - return generateUUID; -} \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/esm-browser/v4.js b/deps/npm/node_modules/uuid/dist/esm-browser/v4.js deleted file mode 100644 index 404810a488de0a..00000000000000 --- a/deps/npm/node_modules/uuid/dist/esm-browser/v4.js +++ /dev/null @@ -1,24 +0,0 @@ -import rng from './rng.js'; -import stringify from './stringify.js'; - -function v4(options, buf, offset) { - options = options || {}; - var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` - - rnds[6] = rnds[6] & 0x0f | 0x40; - rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided - - if (buf) { - offset = offset || 0; - - for (var i = 0; i < 16; ++i) { - buf[offset + i] = rnds[i]; - } - - return buf; - } - - return stringify(rnds); -} - -export default v4; \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/esm-browser/v5.js b/deps/npm/node_modules/uuid/dist/esm-browser/v5.js deleted file mode 100644 index c08d96ba0bd928..00000000000000 --- a/deps/npm/node_modules/uuid/dist/esm-browser/v5.js +++ /dev/null @@ -1,4 +0,0 @@ -import v35 from './v35.js'; -import sha1 from './sha1.js'; -var v5 = v35('v5', 0x50, sha1); -export default v5; \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/esm-browser/validate.js b/deps/npm/node_modules/uuid/dist/esm-browser/validate.js deleted file mode 100644 index f1cdc7af49bcfc..00000000000000 --- a/deps/npm/node_modules/uuid/dist/esm-browser/validate.js +++ /dev/null @@ -1,7 +0,0 @@ -import REGEX from './regex.js'; - -function validate(uuid) { - return typeof uuid === 'string' && REGEX.test(uuid); -} - -export default validate; \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/esm-browser/version.js b/deps/npm/node_modules/uuid/dist/esm-browser/version.js deleted file mode 100644 index 77530e9cb0e355..00000000000000 --- a/deps/npm/node_modules/uuid/dist/esm-browser/version.js +++ /dev/null @@ -1,11 +0,0 @@ -import validate from './validate.js'; - -function version(uuid) { - if (!validate(uuid)) { - throw TypeError('Invalid UUID'); - } - - return parseInt(uuid.substr(14, 1), 16); -} - -export default version; \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/esm-node/index.js b/deps/npm/node_modules/uuid/dist/esm-node/index.js deleted file mode 100644 index 1db6f6d25b2b6a..00000000000000 --- a/deps/npm/node_modules/uuid/dist/esm-node/index.js +++ /dev/null @@ -1,9 +0,0 @@ -export { default as v1 } from './v1.js'; -export { default as v3 } from './v3.js'; -export { default as v4 } from './v4.js'; -export { default as v5 } from './v5.js'; -export { default as NIL } from './nil.js'; -export { default as version } from './version.js'; -export { default as validate } from './validate.js'; -export { default as stringify } from './stringify.js'; -export { default as parse } from './parse.js'; \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/esm-node/md5.js b/deps/npm/node_modules/uuid/dist/esm-node/md5.js deleted file mode 100644 index 4d68b040f6c192..00000000000000 --- a/deps/npm/node_modules/uuid/dist/esm-node/md5.js +++ /dev/null @@ -1,13 +0,0 @@ -import crypto from 'crypto'; - -function md5(bytes) { - if (Array.isArray(bytes)) { - bytes = Buffer.from(bytes); - } else if (typeof bytes === 'string') { - bytes = Buffer.from(bytes, 'utf8'); - } - - return crypto.createHash('md5').update(bytes).digest(); -} - -export default md5; \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/esm-node/nil.js b/deps/npm/node_modules/uuid/dist/esm-node/nil.js deleted file mode 100644 index b36324c2aa3faa..00000000000000 --- a/deps/npm/node_modules/uuid/dist/esm-node/nil.js +++ /dev/null @@ -1 +0,0 @@ -export default '00000000-0000-0000-0000-000000000000'; \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/esm-node/parse.js b/deps/npm/node_modules/uuid/dist/esm-node/parse.js deleted file mode 100644 index 6421c5d5a08e42..00000000000000 --- a/deps/npm/node_modules/uuid/dist/esm-node/parse.js +++ /dev/null @@ -1,35 +0,0 @@ -import validate from './validate.js'; - -function parse(uuid) { - if (!validate(uuid)) { - throw TypeError('Invalid UUID'); - } - - let v; - const arr = new Uint8Array(16); // Parse ########-....-....-....-............ - - arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24; - arr[1] = v >>> 16 & 0xff; - arr[2] = v >>> 8 & 0xff; - arr[3] = v & 0xff; // Parse ........-####-....-....-............ - - arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8; - arr[5] = v & 0xff; // Parse ........-....-####-....-............ - - arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8; - arr[7] = v & 0xff; // Parse ........-....-....-####-............ - - arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8; - arr[9] = v & 0xff; // Parse ........-....-....-....-############ - // (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes) - - arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff; - arr[11] = v / 0x100000000 & 0xff; - arr[12] = v >>> 24 & 0xff; - arr[13] = v >>> 16 & 0xff; - arr[14] = v >>> 8 & 0xff; - arr[15] = v & 0xff; - return arr; -} - -export default parse; \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/esm-node/regex.js b/deps/npm/node_modules/uuid/dist/esm-node/regex.js deleted file mode 100644 index 3da8673a5cdf3c..00000000000000 --- a/deps/npm/node_modules/uuid/dist/esm-node/regex.js +++ /dev/null @@ -1 +0,0 @@ -export default /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i; \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/esm-node/rng.js b/deps/npm/node_modules/uuid/dist/esm-node/rng.js deleted file mode 100644 index 80062449a297eb..00000000000000 --- a/deps/npm/node_modules/uuid/dist/esm-node/rng.js +++ /dev/null @@ -1,12 +0,0 @@ -import crypto from 'crypto'; -const rnds8Pool = new Uint8Array(256); // # of random values to pre-allocate - -let poolPtr = rnds8Pool.length; -export default function rng() { - if (poolPtr > rnds8Pool.length - 16) { - crypto.randomFillSync(rnds8Pool); - poolPtr = 0; - } - - return rnds8Pool.slice(poolPtr, poolPtr += 16); -} \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/esm-node/sha1.js b/deps/npm/node_modules/uuid/dist/esm-node/sha1.js deleted file mode 100644 index e23850b441a0c0..00000000000000 --- a/deps/npm/node_modules/uuid/dist/esm-node/sha1.js +++ /dev/null @@ -1,13 +0,0 @@ -import crypto from 'crypto'; - -function sha1(bytes) { - if (Array.isArray(bytes)) { - bytes = Buffer.from(bytes); - } else if (typeof bytes === 'string') { - bytes = Buffer.from(bytes, 'utf8'); - } - - return crypto.createHash('sha1').update(bytes).digest(); -} - -export default sha1; \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/esm-node/stringify.js b/deps/npm/node_modules/uuid/dist/esm-node/stringify.js deleted file mode 100644 index f9bca12026e21f..00000000000000 --- a/deps/npm/node_modules/uuid/dist/esm-node/stringify.js +++ /dev/null @@ -1,29 +0,0 @@ -import validate from './validate.js'; -/** - * Convert array of 16 byte values to UUID string format of the form: - * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX - */ - -const byteToHex = []; - -for (let i = 0; i < 256; ++i) { - byteToHex.push((i + 0x100).toString(16).substr(1)); -} - -function stringify(arr, offset = 0) { - // Note: Be careful editing this code! It's been tuned for performance - // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 - const uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one - // of the following: - // - One or more input array values don't map to a hex octet (leading to - // "undefined" in the uuid) - // - Invalid input values for the RFC `version` or `variant` fields - - if (!validate(uuid)) { - throw TypeError('Stringified UUID is invalid'); - } - - return uuid; -} - -export default stringify; \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/esm-node/v1.js b/deps/npm/node_modules/uuid/dist/esm-node/v1.js deleted file mode 100644 index ebf81acb7d3a87..00000000000000 --- a/deps/npm/node_modules/uuid/dist/esm-node/v1.js +++ /dev/null @@ -1,95 +0,0 @@ -import rng from './rng.js'; -import stringify from './stringify.js'; // **`v1()` - Generate time-based UUID** -// -// Inspired by https://github.com/LiosK/UUID.js -// and http://docs.python.org/library/uuid.html - -let _nodeId; - -let _clockseq; // Previous uuid creation time - - -let _lastMSecs = 0; -let _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details - -function v1(options, buf, offset) { - let i = buf && offset || 0; - const b = buf || new Array(16); - options = options || {}; - let node = options.node || _nodeId; - let clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not - // specified. We do this lazily to minimize issues related to insufficient - // system entropy. See #189 - - if (node == null || clockseq == null) { - const seedBytes = options.random || (options.rng || rng)(); - - if (node == null) { - // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1) - node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]]; - } - - if (clockseq == null) { - // Per 4.2.2, randomize (14 bit) clockseq - clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff; - } - } // UUID timestamps are 100 nano-second units since the Gregorian epoch, - // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so - // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs' - // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00. - - - let msecs = options.msecs !== undefined ? options.msecs : Date.now(); // Per 4.2.1.2, use count of uuid's generated during the current clock - // cycle to simulate higher resolution clock - - let nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs) - - const dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression - - if (dt < 0 && options.clockseq === undefined) { - clockseq = clockseq + 1 & 0x3fff; - } // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new - // time interval - - - if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) { - nsecs = 0; - } // Per 4.2.1.2 Throw error if too many uuids are requested - - - if (nsecs >= 10000) { - throw new Error("uuid.v1(): Can't create more than 10M uuids/sec"); - } - - _lastMSecs = msecs; - _lastNSecs = nsecs; - _clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch - - msecs += 12219292800000; // `time_low` - - const tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000; - b[i++] = tl >>> 24 & 0xff; - b[i++] = tl >>> 16 & 0xff; - b[i++] = tl >>> 8 & 0xff; - b[i++] = tl & 0xff; // `time_mid` - - const tmh = msecs / 0x100000000 * 10000 & 0xfffffff; - b[i++] = tmh >>> 8 & 0xff; - b[i++] = tmh & 0xff; // `time_high_and_version` - - b[i++] = tmh >>> 24 & 0xf | 0x10; // include version - - b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant) - - b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low` - - b[i++] = clockseq & 0xff; // `node` - - for (let n = 0; n < 6; ++n) { - b[i + n] = node[n]; - } - - return buf || stringify(b); -} - -export default v1; \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/esm-node/v3.js b/deps/npm/node_modules/uuid/dist/esm-node/v3.js deleted file mode 100644 index 09063b860499e6..00000000000000 --- a/deps/npm/node_modules/uuid/dist/esm-node/v3.js +++ /dev/null @@ -1,4 +0,0 @@ -import v35 from './v35.js'; -import md5 from './md5.js'; -const v3 = v35('v3', 0x30, md5); -export default v3; \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/esm-node/v35.js b/deps/npm/node_modules/uuid/dist/esm-node/v35.js deleted file mode 100644 index 22f6a196037f91..00000000000000 --- a/deps/npm/node_modules/uuid/dist/esm-node/v35.js +++ /dev/null @@ -1,64 +0,0 @@ -import stringify from './stringify.js'; -import parse from './parse.js'; - -function stringToBytes(str) { - str = unescape(encodeURIComponent(str)); // UTF8 escape - - const bytes = []; - - for (let i = 0; i < str.length; ++i) { - bytes.push(str.charCodeAt(i)); - } - - return bytes; -} - -export const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8'; -export const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8'; -export default function (name, version, hashfunc) { - function generateUUID(value, namespace, buf, offset) { - if (typeof value === 'string') { - value = stringToBytes(value); - } - - if (typeof namespace === 'string') { - namespace = parse(namespace); - } - - if (namespace.length !== 16) { - throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)'); - } // Compute hash of namespace and value, Per 4.3 - // Future: Use spread syntax when supported on all platforms, e.g. `bytes = - // hashfunc([...namespace, ... value])` - - - let bytes = new Uint8Array(16 + value.length); - bytes.set(namespace); - bytes.set(value, namespace.length); - bytes = hashfunc(bytes); - bytes[6] = bytes[6] & 0x0f | version; - bytes[8] = bytes[8] & 0x3f | 0x80; - - if (buf) { - offset = offset || 0; - - for (let i = 0; i < 16; ++i) { - buf[offset + i] = bytes[i]; - } - - return buf; - } - - return stringify(bytes); - } // Function#name is not settable on some platforms (#270) - - - try { - generateUUID.name = name; // eslint-disable-next-line no-empty - } catch (err) {} // For CommonJS default export support - - - generateUUID.DNS = DNS; - generateUUID.URL = URL; - return generateUUID; -} \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/esm-node/v4.js b/deps/npm/node_modules/uuid/dist/esm-node/v4.js deleted file mode 100644 index efad926f68deed..00000000000000 --- a/deps/npm/node_modules/uuid/dist/esm-node/v4.js +++ /dev/null @@ -1,24 +0,0 @@ -import rng from './rng.js'; -import stringify from './stringify.js'; - -function v4(options, buf, offset) { - options = options || {}; - const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` - - rnds[6] = rnds[6] & 0x0f | 0x40; - rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided - - if (buf) { - offset = offset || 0; - - for (let i = 0; i < 16; ++i) { - buf[offset + i] = rnds[i]; - } - - return buf; - } - - return stringify(rnds); -} - -export default v4; \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/esm-node/v5.js b/deps/npm/node_modules/uuid/dist/esm-node/v5.js deleted file mode 100644 index e87fe317d70a00..00000000000000 --- a/deps/npm/node_modules/uuid/dist/esm-node/v5.js +++ /dev/null @@ -1,4 +0,0 @@ -import v35 from './v35.js'; -import sha1 from './sha1.js'; -const v5 = v35('v5', 0x50, sha1); -export default v5; \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/esm-node/validate.js b/deps/npm/node_modules/uuid/dist/esm-node/validate.js deleted file mode 100644 index f1cdc7af49bcfc..00000000000000 --- a/deps/npm/node_modules/uuid/dist/esm-node/validate.js +++ /dev/null @@ -1,7 +0,0 @@ -import REGEX from './regex.js'; - -function validate(uuid) { - return typeof uuid === 'string' && REGEX.test(uuid); -} - -export default validate; \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/esm-node/version.js b/deps/npm/node_modules/uuid/dist/esm-node/version.js deleted file mode 100644 index 77530e9cb0e355..00000000000000 --- a/deps/npm/node_modules/uuid/dist/esm-node/version.js +++ /dev/null @@ -1,11 +0,0 @@ -import validate from './validate.js'; - -function version(uuid) { - if (!validate(uuid)) { - throw TypeError('Invalid UUID'); - } - - return parseInt(uuid.substr(14, 1), 16); -} - -export default version; \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/index.js b/deps/npm/node_modules/uuid/dist/index.js deleted file mode 100644 index bf13b103c651d6..00000000000000 --- a/deps/npm/node_modules/uuid/dist/index.js +++ /dev/null @@ -1,79 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "v1", { - enumerable: true, - get: function () { - return _v.default; - } -}); -Object.defineProperty(exports, "v3", { - enumerable: true, - get: function () { - return _v2.default; - } -}); -Object.defineProperty(exports, "v4", { - enumerable: true, - get: function () { - return _v3.default; - } -}); -Object.defineProperty(exports, "v5", { - enumerable: true, - get: function () { - return _v4.default; - } -}); -Object.defineProperty(exports, "NIL", { - enumerable: true, - get: function () { - return _nil.default; - } -}); -Object.defineProperty(exports, "version", { - enumerable: true, - get: function () { - return _version.default; - } -}); -Object.defineProperty(exports, "validate", { - enumerable: true, - get: function () { - return _validate.default; - } -}); -Object.defineProperty(exports, "stringify", { - enumerable: true, - get: function () { - return _stringify.default; - } -}); -Object.defineProperty(exports, "parse", { - enumerable: true, - get: function () { - return _parse.default; - } -}); - -var _v = _interopRequireDefault(require("./v1.js")); - -var _v2 = _interopRequireDefault(require("./v3.js")); - -var _v3 = _interopRequireDefault(require("./v4.js")); - -var _v4 = _interopRequireDefault(require("./v5.js")); - -var _nil = _interopRequireDefault(require("./nil.js")); - -var _version = _interopRequireDefault(require("./version.js")); - -var _validate = _interopRequireDefault(require("./validate.js")); - -var _stringify = _interopRequireDefault(require("./stringify.js")); - -var _parse = _interopRequireDefault(require("./parse.js")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/md5-browser.js b/deps/npm/node_modules/uuid/dist/md5-browser.js deleted file mode 100644 index 7a4582ace68689..00000000000000 --- a/deps/npm/node_modules/uuid/dist/md5-browser.js +++ /dev/null @@ -1,223 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -/* - * Browser-compatible JavaScript MD5 - * - * Modification of JavaScript MD5 - * https://github.com/blueimp/JavaScript-MD5 - * - * Copyright 2011, Sebastian Tschan - * https://blueimp.net - * - * Licensed under the MIT license: - * https://opensource.org/licenses/MIT - * - * Based on - * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message - * Digest Algorithm, as defined in RFC 1321. - * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009 - * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet - * Distributed under the BSD License - * See http://pajhome.org.uk/crypt/md5 for more info. - */ -function md5(bytes) { - if (typeof bytes === 'string') { - const msg = unescape(encodeURIComponent(bytes)); // UTF8 escape - - bytes = new Uint8Array(msg.length); - - for (let i = 0; i < msg.length; ++i) { - bytes[i] = msg.charCodeAt(i); - } - } - - return md5ToHexEncodedArray(wordsToMd5(bytesToWords(bytes), bytes.length * 8)); -} -/* - * Convert an array of little-endian words to an array of bytes - */ - - -function md5ToHexEncodedArray(input) { - const output = []; - const length32 = input.length * 32; - const hexTab = '0123456789abcdef'; - - for (let i = 0; i < length32; i += 8) { - const x = input[i >> 5] >>> i % 32 & 0xff; - const hex = parseInt(hexTab.charAt(x >>> 4 & 0x0f) + hexTab.charAt(x & 0x0f), 16); - output.push(hex); - } - - return output; -} -/** - * Calculate output length with padding and bit length - */ - - -function getOutputLength(inputLength8) { - return (inputLength8 + 64 >>> 9 << 4) + 14 + 1; -} -/* - * Calculate the MD5 of an array of little-endian words, and a bit length. - */ - - -function wordsToMd5(x, len) { - /* append padding */ - x[len >> 5] |= 0x80 << len % 32; - x[getOutputLength(len) - 1] = len; - let a = 1732584193; - let b = -271733879; - let c = -1732584194; - let d = 271733878; - - for (let i = 0; i < x.length; i += 16) { - const olda = a; - const oldb = b; - const oldc = c; - const oldd = d; - a = md5ff(a, b, c, d, x[i], 7, -680876936); - d = md5ff(d, a, b, c, x[i + 1], 12, -389564586); - c = md5ff(c, d, a, b, x[i + 2], 17, 606105819); - b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330); - a = md5ff(a, b, c, d, x[i + 4], 7, -176418897); - d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426); - c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341); - b = md5ff(b, c, d, a, x[i + 7], 22, -45705983); - a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416); - d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417); - c = md5ff(c, d, a, b, x[i + 10], 17, -42063); - b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162); - a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682); - d = md5ff(d, a, b, c, x[i + 13], 12, -40341101); - c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290); - b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329); - a = md5gg(a, b, c, d, x[i + 1], 5, -165796510); - d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632); - c = md5gg(c, d, a, b, x[i + 11], 14, 643717713); - b = md5gg(b, c, d, a, x[i], 20, -373897302); - a = md5gg(a, b, c, d, x[i + 5], 5, -701558691); - d = md5gg(d, a, b, c, x[i + 10], 9, 38016083); - c = md5gg(c, d, a, b, x[i + 15], 14, -660478335); - b = md5gg(b, c, d, a, x[i + 4], 20, -405537848); - a = md5gg(a, b, c, d, x[i + 9], 5, 568446438); - d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690); - c = md5gg(c, d, a, b, x[i + 3], 14, -187363961); - b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501); - a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467); - d = md5gg(d, a, b, c, x[i + 2], 9, -51403784); - c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473); - b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734); - a = md5hh(a, b, c, d, x[i + 5], 4, -378558); - d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463); - c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562); - b = md5hh(b, c, d, a, x[i + 14], 23, -35309556); - a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060); - d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353); - c = md5hh(c, d, a, b, x[i + 7], 16, -155497632); - b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640); - a = md5hh(a, b, c, d, x[i + 13], 4, 681279174); - d = md5hh(d, a, b, c, x[i], 11, -358537222); - c = md5hh(c, d, a, b, x[i + 3], 16, -722521979); - b = md5hh(b, c, d, a, x[i + 6], 23, 76029189); - a = md5hh(a, b, c, d, x[i + 9], 4, -640364487); - d = md5hh(d, a, b, c, x[i + 12], 11, -421815835); - c = md5hh(c, d, a, b, x[i + 15], 16, 530742520); - b = md5hh(b, c, d, a, x[i + 2], 23, -995338651); - a = md5ii(a, b, c, d, x[i], 6, -198630844); - d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415); - c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905); - b = md5ii(b, c, d, a, x[i + 5], 21, -57434055); - a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571); - d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606); - c = md5ii(c, d, a, b, x[i + 10], 15, -1051523); - b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799); - a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359); - d = md5ii(d, a, b, c, x[i + 15], 10, -30611744); - c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380); - b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649); - a = md5ii(a, b, c, d, x[i + 4], 6, -145523070); - d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379); - c = md5ii(c, d, a, b, x[i + 2], 15, 718787259); - b = md5ii(b, c, d, a, x[i + 9], 21, -343485551); - a = safeAdd(a, olda); - b = safeAdd(b, oldb); - c = safeAdd(c, oldc); - d = safeAdd(d, oldd); - } - - return [a, b, c, d]; -} -/* - * Convert an array bytes to an array of little-endian words - * Characters >255 have their high-byte silently ignored. - */ - - -function bytesToWords(input) { - if (input.length === 0) { - return []; - } - - const length8 = input.length * 8; - const output = new Uint32Array(getOutputLength(length8)); - - for (let i = 0; i < length8; i += 8) { - output[i >> 5] |= (input[i / 8] & 0xff) << i % 32; - } - - return output; -} -/* - * Add integers, wrapping at 2^32. This uses 16-bit operations internally - * to work around bugs in some JS interpreters. - */ - - -function safeAdd(x, y) { - const lsw = (x & 0xffff) + (y & 0xffff); - const msw = (x >> 16) + (y >> 16) + (lsw >> 16); - return msw << 16 | lsw & 0xffff; -} -/* - * Bitwise rotate a 32-bit number to the left. - */ - - -function bitRotateLeft(num, cnt) { - return num << cnt | num >>> 32 - cnt; -} -/* - * These functions implement the four basic operations the algorithm uses. - */ - - -function md5cmn(q, a, b, x, s, t) { - return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b); -} - -function md5ff(a, b, c, d, x, s, t) { - return md5cmn(b & c | ~b & d, a, b, x, s, t); -} - -function md5gg(a, b, c, d, x, s, t) { - return md5cmn(b & d | c & ~d, a, b, x, s, t); -} - -function md5hh(a, b, c, d, x, s, t) { - return md5cmn(b ^ c ^ d, a, b, x, s, t); -} - -function md5ii(a, b, c, d, x, s, t) { - return md5cmn(c ^ (b | ~d), a, b, x, s, t); -} - -var _default = md5; -exports.default = _default; \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/md5.js b/deps/npm/node_modules/uuid/dist/md5.js deleted file mode 100644 index 824d48167a980e..00000000000000 --- a/deps/npm/node_modules/uuid/dist/md5.js +++ /dev/null @@ -1,23 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _crypto = _interopRequireDefault(require("crypto")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function md5(bytes) { - if (Array.isArray(bytes)) { - bytes = Buffer.from(bytes); - } else if (typeof bytes === 'string') { - bytes = Buffer.from(bytes, 'utf8'); - } - - return _crypto.default.createHash('md5').update(bytes).digest(); -} - -var _default = md5; -exports.default = _default; \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/nil.js b/deps/npm/node_modules/uuid/dist/nil.js deleted file mode 100644 index 7ade577b256b25..00000000000000 --- a/deps/npm/node_modules/uuid/dist/nil.js +++ /dev/null @@ -1,8 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; -var _default = '00000000-0000-0000-0000-000000000000'; -exports.default = _default; \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/parse.js b/deps/npm/node_modules/uuid/dist/parse.js deleted file mode 100644 index 4c69fc39e74c2e..00000000000000 --- a/deps/npm/node_modules/uuid/dist/parse.js +++ /dev/null @@ -1,45 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _validate = _interopRequireDefault(require("./validate.js")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function parse(uuid) { - if (!(0, _validate.default)(uuid)) { - throw TypeError('Invalid UUID'); - } - - let v; - const arr = new Uint8Array(16); // Parse ########-....-....-....-............ - - arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24; - arr[1] = v >>> 16 & 0xff; - arr[2] = v >>> 8 & 0xff; - arr[3] = v & 0xff; // Parse ........-####-....-....-............ - - arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8; - arr[5] = v & 0xff; // Parse ........-....-####-....-............ - - arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8; - arr[7] = v & 0xff; // Parse ........-....-....-####-............ - - arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8; - arr[9] = v & 0xff; // Parse ........-....-....-....-############ - // (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes) - - arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff; - arr[11] = v / 0x100000000 & 0xff; - arr[12] = v >>> 24 & 0xff; - arr[13] = v >>> 16 & 0xff; - arr[14] = v >>> 8 & 0xff; - arr[15] = v & 0xff; - return arr; -} - -var _default = parse; -exports.default = _default; \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/regex.js b/deps/npm/node_modules/uuid/dist/regex.js deleted file mode 100644 index 1ef91d64c80e22..00000000000000 --- a/deps/npm/node_modules/uuid/dist/regex.js +++ /dev/null @@ -1,8 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; -var _default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i; -exports.default = _default; \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/rng-browser.js b/deps/npm/node_modules/uuid/dist/rng-browser.js deleted file mode 100644 index 91faeae6d6acb2..00000000000000 --- a/deps/npm/node_modules/uuid/dist/rng-browser.js +++ /dev/null @@ -1,26 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = rng; -// Unique ID creation requires a high quality random # generator. In the browser we therefore -// require the crypto API and do not support built-in fallback to lower quality random number -// generators (like Math.random()). -let getRandomValues; -const rnds8 = new Uint8Array(16); - -function rng() { - // lazy load so that environments that need to polyfill have a chance to do so - if (!getRandomValues) { - // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. Also, - // find the complete implementation of crypto (msCrypto) on IE11. - getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto); - - if (!getRandomValues) { - throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported'); - } - } - - return getRandomValues(rnds8); -} \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/rng.js b/deps/npm/node_modules/uuid/dist/rng.js deleted file mode 100644 index 3507f93772a910..00000000000000 --- a/deps/npm/node_modules/uuid/dist/rng.js +++ /dev/null @@ -1,24 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = rng; - -var _crypto = _interopRequireDefault(require("crypto")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -const rnds8Pool = new Uint8Array(256); // # of random values to pre-allocate - -let poolPtr = rnds8Pool.length; - -function rng() { - if (poolPtr > rnds8Pool.length - 16) { - _crypto.default.randomFillSync(rnds8Pool); - - poolPtr = 0; - } - - return rnds8Pool.slice(poolPtr, poolPtr += 16); -} \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/sha1-browser.js b/deps/npm/node_modules/uuid/dist/sha1-browser.js deleted file mode 100644 index 24cbcedca58c8a..00000000000000 --- a/deps/npm/node_modules/uuid/dist/sha1-browser.js +++ /dev/null @@ -1,104 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -// Adapted from Chris Veness' SHA1 code at -// http://www.movable-type.co.uk/scripts/sha1.html -function f(s, x, y, z) { - switch (s) { - case 0: - return x & y ^ ~x & z; - - case 1: - return x ^ y ^ z; - - case 2: - return x & y ^ x & z ^ y & z; - - case 3: - return x ^ y ^ z; - } -} - -function ROTL(x, n) { - return x << n | x >>> 32 - n; -} - -function sha1(bytes) { - const K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6]; - const H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0]; - - if (typeof bytes === 'string') { - const msg = unescape(encodeURIComponent(bytes)); // UTF8 escape - - bytes = []; - - for (let i = 0; i < msg.length; ++i) { - bytes.push(msg.charCodeAt(i)); - } - } else if (!Array.isArray(bytes)) { - // Convert Array-like to Array - bytes = Array.prototype.slice.call(bytes); - } - - bytes.push(0x80); - const l = bytes.length / 4 + 2; - const N = Math.ceil(l / 16); - const M = new Array(N); - - for (let i = 0; i < N; ++i) { - const arr = new Uint32Array(16); - - for (let j = 0; j < 16; ++j) { - arr[j] = bytes[i * 64 + j * 4] << 24 | bytes[i * 64 + j * 4 + 1] << 16 | bytes[i * 64 + j * 4 + 2] << 8 | bytes[i * 64 + j * 4 + 3]; - } - - M[i] = arr; - } - - M[N - 1][14] = (bytes.length - 1) * 8 / Math.pow(2, 32); - M[N - 1][14] = Math.floor(M[N - 1][14]); - M[N - 1][15] = (bytes.length - 1) * 8 & 0xffffffff; - - for (let i = 0; i < N; ++i) { - const W = new Uint32Array(80); - - for (let t = 0; t < 16; ++t) { - W[t] = M[i][t]; - } - - for (let t = 16; t < 80; ++t) { - W[t] = ROTL(W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16], 1); - } - - let a = H[0]; - let b = H[1]; - let c = H[2]; - let d = H[3]; - let e = H[4]; - - for (let t = 0; t < 80; ++t) { - const s = Math.floor(t / 20); - const T = ROTL(a, 5) + f(s, b, c, d) + e + K[s] + W[t] >>> 0; - e = d; - d = c; - c = ROTL(b, 30) >>> 0; - b = a; - a = T; - } - - H[0] = H[0] + a >>> 0; - H[1] = H[1] + b >>> 0; - H[2] = H[2] + c >>> 0; - H[3] = H[3] + d >>> 0; - H[4] = H[4] + e >>> 0; - } - - return [H[0] >> 24 & 0xff, H[0] >> 16 & 0xff, H[0] >> 8 & 0xff, H[0] & 0xff, H[1] >> 24 & 0xff, H[1] >> 16 & 0xff, H[1] >> 8 & 0xff, H[1] & 0xff, H[2] >> 24 & 0xff, H[2] >> 16 & 0xff, H[2] >> 8 & 0xff, H[2] & 0xff, H[3] >> 24 & 0xff, H[3] >> 16 & 0xff, H[3] >> 8 & 0xff, H[3] & 0xff, H[4] >> 24 & 0xff, H[4] >> 16 & 0xff, H[4] >> 8 & 0xff, H[4] & 0xff]; -} - -var _default = sha1; -exports.default = _default; \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/sha1.js b/deps/npm/node_modules/uuid/dist/sha1.js deleted file mode 100644 index 03bdd63cedadaf..00000000000000 --- a/deps/npm/node_modules/uuid/dist/sha1.js +++ /dev/null @@ -1,23 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _crypto = _interopRequireDefault(require("crypto")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function sha1(bytes) { - if (Array.isArray(bytes)) { - bytes = Buffer.from(bytes); - } else if (typeof bytes === 'string') { - bytes = Buffer.from(bytes, 'utf8'); - } - - return _crypto.default.createHash('sha1').update(bytes).digest(); -} - -var _default = sha1; -exports.default = _default; \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/stringify.js b/deps/npm/node_modules/uuid/dist/stringify.js deleted file mode 100644 index b8e7519403eedc..00000000000000 --- a/deps/npm/node_modules/uuid/dist/stringify.js +++ /dev/null @@ -1,39 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _validate = _interopRequireDefault(require("./validate.js")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Convert array of 16 byte values to UUID string format of the form: - * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX - */ -const byteToHex = []; - -for (let i = 0; i < 256; ++i) { - byteToHex.push((i + 0x100).toString(16).substr(1)); -} - -function stringify(arr, offset = 0) { - // Note: Be careful editing this code! It's been tuned for performance - // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 - const uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one - // of the following: - // - One or more input array values don't map to a hex octet (leading to - // "undefined" in the uuid) - // - Invalid input values for the RFC `version` or `variant` fields - - if (!(0, _validate.default)(uuid)) { - throw TypeError('Stringified UUID is invalid'); - } - - return uuid; -} - -var _default = stringify; -exports.default = _default; \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/umd/uuid.min.js b/deps/npm/node_modules/uuid/dist/umd/uuid.min.js deleted file mode 100644 index 639ca2f2ddc41d..00000000000000 --- a/deps/npm/node_modules/uuid/dist/umd/uuid.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((r="undefined"!=typeof globalThis?globalThis:r||self).uuid={})}(this,(function(r){"use strict";var e,n=new Uint8Array(16);function t(){if(!e&&!(e="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return e(n)}var o=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function a(r){return"string"==typeof r&&o.test(r)}for(var i,u,f=[],s=0;s<256;++s)f.push((s+256).toString(16).substr(1));function c(r){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(f[r[e+0]]+f[r[e+1]]+f[r[e+2]]+f[r[e+3]]+"-"+f[r[e+4]]+f[r[e+5]]+"-"+f[r[e+6]]+f[r[e+7]]+"-"+f[r[e+8]]+f[r[e+9]]+"-"+f[r[e+10]]+f[r[e+11]]+f[r[e+12]]+f[r[e+13]]+f[r[e+14]]+f[r[e+15]]).toLowerCase();if(!a(n))throw TypeError("Stringified UUID is invalid");return n}var l=0,d=0;function v(r){if(!a(r))throw TypeError("Invalid UUID");var e,n=new Uint8Array(16);return n[0]=(e=parseInt(r.slice(0,8),16))>>>24,n[1]=e>>>16&255,n[2]=e>>>8&255,n[3]=255&e,n[4]=(e=parseInt(r.slice(9,13),16))>>>8,n[5]=255&e,n[6]=(e=parseInt(r.slice(14,18),16))>>>8,n[7]=255&e,n[8]=(e=parseInt(r.slice(19,23),16))>>>8,n[9]=255&e,n[10]=(e=parseInt(r.slice(24,36),16))/1099511627776&255,n[11]=e/4294967296&255,n[12]=e>>>24&255,n[13]=e>>>16&255,n[14]=e>>>8&255,n[15]=255&e,n}function p(r,e,n){function t(r,t,o,a){if("string"==typeof r&&(r=function(r){r=unescape(encodeURIComponent(r));for(var e=[],n=0;n>>9<<4)+1}function y(r,e){var n=(65535&r)+(65535&e);return(r>>16)+(e>>16)+(n>>16)<<16|65535&n}function g(r,e,n,t,o,a){return y((i=y(y(e,r),y(t,a)))<<(u=o)|i>>>32-u,n);var i,u}function m(r,e,n,t,o,a,i){return g(e&n|~e&t,r,e,o,a,i)}function w(r,e,n,t,o,a,i){return g(e&t|n&~t,r,e,o,a,i)}function b(r,e,n,t,o,a,i){return g(e^n^t,r,e,o,a,i)}function A(r,e,n,t,o,a,i){return g(n^(e|~t),r,e,o,a,i)}var U=p("v3",48,(function(r){if("string"==typeof r){var e=unescape(encodeURIComponent(r));r=new Uint8Array(e.length);for(var n=0;n>5]>>>o%32&255,i=parseInt(t.charAt(a>>>4&15)+t.charAt(15&a),16);e.push(i)}return e}(function(r,e){r[e>>5]|=128<>5]|=(255&r[t/8])<>>32-e}var R=p("v5",80,(function(r){var e=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof r){var t=unescape(encodeURIComponent(r));r=[];for(var o=0;o>>0;w=m,m=g,g=C(y,30)>>>0,y=h,h=U}n[0]=n[0]+h>>>0,n[1]=n[1]+y>>>0,n[2]=n[2]+g>>>0,n[3]=n[3]+m>>>0,n[4]=n[4]+w>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,255&n[0],n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,255&n[1],n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,255&n[2],n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,255&n[3],n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,255&n[4]]}));r.NIL="00000000-0000-0000-0000-000000000000",r.parse=v,r.stringify=c,r.v1=function(r,e,n){var o=e&&n||0,a=e||new Array(16),f=(r=r||{}).node||i,s=void 0!==r.clockseq?r.clockseq:u;if(null==f||null==s){var v=r.random||(r.rng||t)();null==f&&(f=i=[1|v[0],v[1],v[2],v[3],v[4],v[5]]),null==s&&(s=u=16383&(v[6]<<8|v[7]))}var p=void 0!==r.msecs?r.msecs:Date.now(),h=void 0!==r.nsecs?r.nsecs:d+1,y=p-l+(h-d)/1e4;if(y<0&&void 0===r.clockseq&&(s=s+1&16383),(y<0||p>l)&&void 0===r.nsecs&&(h=0),h>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");l=p,d=h,u=s;var g=(1e4*(268435455&(p+=122192928e5))+h)%4294967296;a[o++]=g>>>24&255,a[o++]=g>>>16&255,a[o++]=g>>>8&255,a[o++]=255&g;var m=p/4294967296*1e4&268435455;a[o++]=m>>>8&255,a[o++]=255&m,a[o++]=m>>>24&15|16,a[o++]=m>>>16&255,a[o++]=s>>>8|128,a[o++]=255&s;for(var w=0;w<6;++w)a[o+w]=f[w];return e||c(a)},r.v3=U,r.v4=function(r,e,n){var o=(r=r||{}).random||(r.rng||t)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,e){n=n||0;for(var a=0;a<16;++a)e[n+a]=o[a];return e}return c(o)},r.v5=R,r.validate=a,r.version=function(r){if(!a(r))throw TypeError("Invalid UUID");return parseInt(r.substr(14,1),16)},Object.defineProperty(r,"__esModule",{value:!0})})); \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/umd/uuidNIL.min.js b/deps/npm/node_modules/uuid/dist/umd/uuidNIL.min.js deleted file mode 100644 index 30b28a7e0faf01..00000000000000 --- a/deps/npm/node_modules/uuid/dist/umd/uuidNIL.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).uuidNIL=n()}(this,(function(){"use strict";return"00000000-0000-0000-0000-000000000000"})); \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/umd/uuidParse.min.js b/deps/npm/node_modules/uuid/dist/umd/uuidParse.min.js deleted file mode 100644 index d48ea6af50a42a..00000000000000 --- a/deps/npm/node_modules/uuid/dist/umd/uuidParse.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).uuidParse=n()}(this,(function(){"use strict";var e=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;return function(n){if(!function(n){return"string"==typeof n&&e.test(n)}(n))throw TypeError("Invalid UUID");var t,i=new Uint8Array(16);return i[0]=(t=parseInt(n.slice(0,8),16))>>>24,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i[4]=(t=parseInt(n.slice(9,13),16))>>>8,i[5]=255&t,i[6]=(t=parseInt(n.slice(14,18),16))>>>8,i[7]=255&t,i[8]=(t=parseInt(n.slice(19,23),16))>>>8,i[9]=255&t,i[10]=(t=parseInt(n.slice(24,36),16))/1099511627776&255,i[11]=t/4294967296&255,i[12]=t>>>24&255,i[13]=t>>>16&255,i[14]=t>>>8&255,i[15]=255&t,i}})); \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/umd/uuidStringify.min.js b/deps/npm/node_modules/uuid/dist/umd/uuidStringify.min.js deleted file mode 100644 index fd39adc330cf2b..00000000000000 --- a/deps/npm/node_modules/uuid/dist/umd/uuidStringify.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).uuidStringify=t()}(this,(function(){"use strict";var e=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function t(t){return"string"==typeof t&&e.test(t)}for(var i=[],n=0;n<256;++n)i.push((n+256).toString(16).substr(1));return function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,f=(i[e[n+0]]+i[e[n+1]]+i[e[n+2]]+i[e[n+3]]+"-"+i[e[n+4]]+i[e[n+5]]+"-"+i[e[n+6]]+i[e[n+7]]+"-"+i[e[n+8]]+i[e[n+9]]+"-"+i[e[n+10]]+i[e[n+11]]+i[e[n+12]]+i[e[n+13]]+i[e[n+14]]+i[e[n+15]]).toLowerCase();if(!t(f))throw TypeError("Stringified UUID is invalid");return f}})); \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/umd/uuidValidate.min.js b/deps/npm/node_modules/uuid/dist/umd/uuidValidate.min.js deleted file mode 100644 index 378e5b902131fd..00000000000000 --- a/deps/npm/node_modules/uuid/dist/umd/uuidValidate.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).uuidValidate=t()}(this,(function(){"use strict";var e=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;return function(t){return"string"==typeof t&&e.test(t)}})); \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/umd/uuidVersion.min.js b/deps/npm/node_modules/uuid/dist/umd/uuidVersion.min.js deleted file mode 100644 index 274bb090db76ec..00000000000000 --- a/deps/npm/node_modules/uuid/dist/umd/uuidVersion.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).uuidVersion=t()}(this,(function(){"use strict";var e=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;return function(t){if(!function(t){return"string"==typeof t&&e.test(t)}(t))throw TypeError("Invalid UUID");return parseInt(t.substr(14,1),16)}})); \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/umd/uuidv1.min.js b/deps/npm/node_modules/uuid/dist/umd/uuidv1.min.js deleted file mode 100644 index 2622889a25e52b..00000000000000 --- a/deps/npm/node_modules/uuid/dist/umd/uuidv1.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o():"function"==typeof define&&define.amd?define(o):(e="undefined"!=typeof globalThis?globalThis:e||self).uuidv1=o()}(this,(function(){"use strict";var e,o=new Uint8Array(16);function t(){if(!e&&!(e="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return e(o)}var n=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function r(e){return"string"==typeof e&&n.test(e)}for(var i,u,s=[],a=0;a<256;++a)s.push((a+256).toString(16).substr(1));var d=0,f=0;return function(e,o,n){var a=o&&n||0,c=o||new Array(16),l=(e=e||{}).node||i,p=void 0!==e.clockseq?e.clockseq:u;if(null==l||null==p){var v=e.random||(e.rng||t)();null==l&&(l=i=[1|v[0],v[1],v[2],v[3],v[4],v[5]]),null==p&&(p=u=16383&(v[6]<<8|v[7]))}var y=void 0!==e.msecs?e.msecs:Date.now(),m=void 0!==e.nsecs?e.nsecs:f+1,g=y-d+(m-f)/1e4;if(g<0&&void 0===e.clockseq&&(p=p+1&16383),(g<0||y>d)&&void 0===e.nsecs&&(m=0),m>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");d=y,f=m,u=p;var h=(1e4*(268435455&(y+=122192928e5))+m)%4294967296;c[a++]=h>>>24&255,c[a++]=h>>>16&255,c[a++]=h>>>8&255,c[a++]=255&h;var w=y/4294967296*1e4&268435455;c[a++]=w>>>8&255,c[a++]=255&w,c[a++]=w>>>24&15|16,c[a++]=w>>>16&255,c[a++]=p>>>8|128,c[a++]=255&p;for(var b=0;b<6;++b)c[a+b]=l[b];return o||function(e){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=(s[e[o+0]]+s[e[o+1]]+s[e[o+2]]+s[e[o+3]]+"-"+s[e[o+4]]+s[e[o+5]]+"-"+s[e[o+6]]+s[e[o+7]]+"-"+s[e[o+8]]+s[e[o+9]]+"-"+s[e[o+10]]+s[e[o+11]]+s[e[o+12]]+s[e[o+13]]+s[e[o+14]]+s[e[o+15]]).toLowerCase();if(!r(t))throw TypeError("Stringified UUID is invalid");return t}(c)}})); \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/umd/uuidv3.min.js b/deps/npm/node_modules/uuid/dist/umd/uuidv3.min.js deleted file mode 100644 index 8d37b62d708701..00000000000000 --- a/deps/npm/node_modules/uuid/dist/umd/uuidv3.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(n,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(n="undefined"!=typeof globalThis?globalThis:n||self).uuidv3=r()}(this,(function(){"use strict";var n=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function r(r){return"string"==typeof r&&n.test(r)}for(var e=[],t=0;t<256;++t)e.push((t+256).toString(16).substr(1));function i(n){return 14+(n+64>>>9<<4)+1}function o(n,r){var e=(65535&n)+(65535&r);return(n>>16)+(r>>16)+(e>>16)<<16|65535&e}function a(n,r,e,t,i,a){return o((f=o(o(r,n),o(t,a)))<<(u=i)|f>>>32-u,e);var f,u}function f(n,r,e,t,i,o,f){return a(r&e|~r&t,n,r,i,o,f)}function u(n,r,e,t,i,o,f){return a(r&t|e&~t,n,r,i,o,f)}function c(n,r,e,t,i,o,f){return a(r^e^t,n,r,i,o,f)}function s(n,r,e,t,i,o,f){return a(e^(r|~t),n,r,i,o,f)}return function(n,t,i){function o(n,o,a,f){if("string"==typeof n&&(n=function(n){n=unescape(encodeURIComponent(n));for(var r=[],e=0;e>>24,t[1]=e>>>16&255,t[2]=e>>>8&255,t[3]=255&e,t[4]=(e=parseInt(n.slice(9,13),16))>>>8,t[5]=255&e,t[6]=(e=parseInt(n.slice(14,18),16))>>>8,t[7]=255&e,t[8]=(e=parseInt(n.slice(19,23),16))>>>8,t[9]=255&e,t[10]=(e=parseInt(n.slice(24,36),16))/1099511627776&255,t[11]=e/4294967296&255,t[12]=e>>>24&255,t[13]=e>>>16&255,t[14]=e>>>8&255,t[15]=255&e,t}(o)),16!==o.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var u=new Uint8Array(16+n.length);if(u.set(o),u.set(n,o.length),(u=i(u))[6]=15&u[6]|t,u[8]=63&u[8]|128,a){f=f||0;for(var c=0;c<16;++c)a[f+c]=u[c];return a}return function(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=(e[n[t+0]]+e[n[t+1]]+e[n[t+2]]+e[n[t+3]]+"-"+e[n[t+4]]+e[n[t+5]]+"-"+e[n[t+6]]+e[n[t+7]]+"-"+e[n[t+8]]+e[n[t+9]]+"-"+e[n[t+10]]+e[n[t+11]]+e[n[t+12]]+e[n[t+13]]+e[n[t+14]]+e[n[t+15]]).toLowerCase();if(!r(i))throw TypeError("Stringified UUID is invalid");return i}(u)}try{o.name=n}catch(n){}return o.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",o.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",o}("v3",48,(function(n){if("string"==typeof n){var r=unescape(encodeURIComponent(n));n=new Uint8Array(r.length);for(var e=0;e>5]>>>i%32&255,a=parseInt(t.charAt(o>>>4&15)+t.charAt(15&o),16);r.push(a)}return r}(function(n,r){n[r>>5]|=128<>5]|=(255&n[t/8])<1&&void 0!==arguments[1]?arguments[1]:0,o=(i[t[e+0]]+i[t[e+1]]+i[t[e+2]]+i[t[e+3]]+"-"+i[t[e+4]]+i[t[e+5]]+"-"+i[t[e+6]]+i[t[e+7]]+"-"+i[t[e+8]]+i[t[e+9]]+"-"+i[t[e+10]]+i[t[e+11]]+i[t[e+12]]+i[t[e+13]]+i[t[e+14]]+i[t[e+15]]).toLowerCase();if(!r(o))throw TypeError("Stringified UUID is invalid");return o}(u)}})); \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/umd/uuidv5.min.js b/deps/npm/node_modules/uuid/dist/umd/uuidv5.min.js deleted file mode 100644 index ba6fc63da76e4e..00000000000000 --- a/deps/npm/node_modules/uuid/dist/umd/uuidv5.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(r="undefined"!=typeof globalThis?globalThis:r||self).uuidv5=e()}(this,(function(){"use strict";var r=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function e(e){return"string"==typeof e&&r.test(e)}for(var t=[],n=0;n<256;++n)t.push((n+256).toString(16).substr(1));function a(r,e,t,n){switch(r){case 0:return e&t^~e&n;case 1:return e^t^n;case 2:return e&t^e&n^t&n;case 3:return e^t^n}}function o(r,e){return r<>>32-e}return function(r,n,a){function o(r,o,i,f){if("string"==typeof r&&(r=function(r){r=unescape(encodeURIComponent(r));for(var e=[],t=0;t>>24,n[1]=t>>>16&255,n[2]=t>>>8&255,n[3]=255&t,n[4]=(t=parseInt(r.slice(9,13),16))>>>8,n[5]=255&t,n[6]=(t=parseInt(r.slice(14,18),16))>>>8,n[7]=255&t,n[8]=(t=parseInt(r.slice(19,23),16))>>>8,n[9]=255&t,n[10]=(t=parseInt(r.slice(24,36),16))/1099511627776&255,n[11]=t/4294967296&255,n[12]=t>>>24&255,n[13]=t>>>16&255,n[14]=t>>>8&255,n[15]=255&t,n}(o)),16!==o.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var s=new Uint8Array(16+r.length);if(s.set(o),s.set(r,o.length),(s=a(s))[6]=15&s[6]|n,s[8]=63&s[8]|128,i){f=f||0;for(var u=0;u<16;++u)i[f+u]=s[u];return i}return function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=(t[r[n+0]]+t[r[n+1]]+t[r[n+2]]+t[r[n+3]]+"-"+t[r[n+4]]+t[r[n+5]]+"-"+t[r[n+6]]+t[r[n+7]]+"-"+t[r[n+8]]+t[r[n+9]]+"-"+t[r[n+10]]+t[r[n+11]]+t[r[n+12]]+t[r[n+13]]+t[r[n+14]]+t[r[n+15]]).toLowerCase();if(!e(a))throw TypeError("Stringified UUID is invalid");return a}(s)}try{o.name=r}catch(r){}return o.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",o.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",o}("v5",80,(function(r){var e=[1518500249,1859775393,2400959708,3395469782],t=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof r){var n=unescape(encodeURIComponent(r));r=[];for(var i=0;i>>0;A=U,U=w,w=o(b,30)>>>0,b=g,g=C}t[0]=t[0]+g>>>0,t[1]=t[1]+b>>>0,t[2]=t[2]+w>>>0,t[3]=t[3]+U>>>0,t[4]=t[4]+A>>>0}return[t[0]>>24&255,t[0]>>16&255,t[0]>>8&255,255&t[0],t[1]>>24&255,t[1]>>16&255,t[1]>>8&255,255&t[1],t[2]>>24&255,t[2]>>16&255,t[2]>>8&255,255&t[2],t[3]>>24&255,t[3]>>16&255,t[3]>>8&255,255&t[3],t[4]>>24&255,t[4]>>16&255,t[4]>>8&255,255&t[4]]}))})); \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/uuid-bin.js b/deps/npm/node_modules/uuid/dist/uuid-bin.js deleted file mode 100644 index 50a7a9f17a065c..00000000000000 --- a/deps/npm/node_modules/uuid/dist/uuid-bin.js +++ /dev/null @@ -1,85 +0,0 @@ -"use strict"; - -var _assert = _interopRequireDefault(require("assert")); - -var _v = _interopRequireDefault(require("./v1.js")); - -var _v2 = _interopRequireDefault(require("./v3.js")); - -var _v3 = _interopRequireDefault(require("./v4.js")); - -var _v4 = _interopRequireDefault(require("./v5.js")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function usage() { - console.log('Usage:'); - console.log(' uuid'); - console.log(' uuid v1'); - console.log(' uuid v3 '); - console.log(' uuid v4'); - console.log(' uuid v5 '); - console.log(' uuid --help'); - console.log('\nNote: may be "URL" or "DNS" to use the corresponding UUIDs defined by RFC4122'); -} - -const args = process.argv.slice(2); - -if (args.indexOf('--help') >= 0) { - usage(); - process.exit(0); -} - -const version = args.shift() || 'v4'; - -switch (version) { - case 'v1': - console.log((0, _v.default)()); - break; - - case 'v3': - { - const name = args.shift(); - let namespace = args.shift(); - (0, _assert.default)(name != null, 'v3 name not specified'); - (0, _assert.default)(namespace != null, 'v3 namespace not specified'); - - if (namespace === 'URL') { - namespace = _v2.default.URL; - } - - if (namespace === 'DNS') { - namespace = _v2.default.DNS; - } - - console.log((0, _v2.default)(name, namespace)); - break; - } - - case 'v4': - console.log((0, _v3.default)()); - break; - - case 'v5': - { - const name = args.shift(); - let namespace = args.shift(); - (0, _assert.default)(name != null, 'v5 name not specified'); - (0, _assert.default)(namespace != null, 'v5 namespace not specified'); - - if (namespace === 'URL') { - namespace = _v4.default.URL; - } - - if (namespace === 'DNS') { - namespace = _v4.default.DNS; - } - - console.log((0, _v4.default)(name, namespace)); - break; - } - - default: - usage(); - process.exit(1); -} \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/v1.js b/deps/npm/node_modules/uuid/dist/v1.js deleted file mode 100644 index abb9b3d1672a32..00000000000000 --- a/deps/npm/node_modules/uuid/dist/v1.js +++ /dev/null @@ -1,107 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _rng = _interopRequireDefault(require("./rng.js")); - -var _stringify = _interopRequireDefault(require("./stringify.js")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -// **`v1()` - Generate time-based UUID** -// -// Inspired by https://github.com/LiosK/UUID.js -// and http://docs.python.org/library/uuid.html -let _nodeId; - -let _clockseq; // Previous uuid creation time - - -let _lastMSecs = 0; -let _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details - -function v1(options, buf, offset) { - let i = buf && offset || 0; - const b = buf || new Array(16); - options = options || {}; - let node = options.node || _nodeId; - let clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not - // specified. We do this lazily to minimize issues related to insufficient - // system entropy. See #189 - - if (node == null || clockseq == null) { - const seedBytes = options.random || (options.rng || _rng.default)(); - - if (node == null) { - // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1) - node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]]; - } - - if (clockseq == null) { - // Per 4.2.2, randomize (14 bit) clockseq - clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff; - } - } // UUID timestamps are 100 nano-second units since the Gregorian epoch, - // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so - // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs' - // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00. - - - let msecs = options.msecs !== undefined ? options.msecs : Date.now(); // Per 4.2.1.2, use count of uuid's generated during the current clock - // cycle to simulate higher resolution clock - - let nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs) - - const dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression - - if (dt < 0 && options.clockseq === undefined) { - clockseq = clockseq + 1 & 0x3fff; - } // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new - // time interval - - - if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) { - nsecs = 0; - } // Per 4.2.1.2 Throw error if too many uuids are requested - - - if (nsecs >= 10000) { - throw new Error("uuid.v1(): Can't create more than 10M uuids/sec"); - } - - _lastMSecs = msecs; - _lastNSecs = nsecs; - _clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch - - msecs += 12219292800000; // `time_low` - - const tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000; - b[i++] = tl >>> 24 & 0xff; - b[i++] = tl >>> 16 & 0xff; - b[i++] = tl >>> 8 & 0xff; - b[i++] = tl & 0xff; // `time_mid` - - const tmh = msecs / 0x100000000 * 10000 & 0xfffffff; - b[i++] = tmh >>> 8 & 0xff; - b[i++] = tmh & 0xff; // `time_high_and_version` - - b[i++] = tmh >>> 24 & 0xf | 0x10; // include version - - b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant) - - b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low` - - b[i++] = clockseq & 0xff; // `node` - - for (let n = 0; n < 6; ++n) { - b[i + n] = node[n]; - } - - return buf || (0, _stringify.default)(b); -} - -var _default = v1; -exports.default = _default; \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/v3.js b/deps/npm/node_modules/uuid/dist/v3.js deleted file mode 100644 index 6b47ff517535a6..00000000000000 --- a/deps/npm/node_modules/uuid/dist/v3.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _v = _interopRequireDefault(require("./v35.js")); - -var _md = _interopRequireDefault(require("./md5.js")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -const v3 = (0, _v.default)('v3', 0x30, _md.default); -var _default = v3; -exports.default = _default; \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/v35.js b/deps/npm/node_modules/uuid/dist/v35.js deleted file mode 100644 index f784c6337fa0e2..00000000000000 --- a/deps/npm/node_modules/uuid/dist/v35.js +++ /dev/null @@ -1,78 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = _default; -exports.URL = exports.DNS = void 0; - -var _stringify = _interopRequireDefault(require("./stringify.js")); - -var _parse = _interopRequireDefault(require("./parse.js")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function stringToBytes(str) { - str = unescape(encodeURIComponent(str)); // UTF8 escape - - const bytes = []; - - for (let i = 0; i < str.length; ++i) { - bytes.push(str.charCodeAt(i)); - } - - return bytes; -} - -const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8'; -exports.DNS = DNS; -const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8'; -exports.URL = URL; - -function _default(name, version, hashfunc) { - function generateUUID(value, namespace, buf, offset) { - if (typeof value === 'string') { - value = stringToBytes(value); - } - - if (typeof namespace === 'string') { - namespace = (0, _parse.default)(namespace); - } - - if (namespace.length !== 16) { - throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)'); - } // Compute hash of namespace and value, Per 4.3 - // Future: Use spread syntax when supported on all platforms, e.g. `bytes = - // hashfunc([...namespace, ... value])` - - - let bytes = new Uint8Array(16 + value.length); - bytes.set(namespace); - bytes.set(value, namespace.length); - bytes = hashfunc(bytes); - bytes[6] = bytes[6] & 0x0f | version; - bytes[8] = bytes[8] & 0x3f | 0x80; - - if (buf) { - offset = offset || 0; - - for (let i = 0; i < 16; ++i) { - buf[offset + i] = bytes[i]; - } - - return buf; - } - - return (0, _stringify.default)(bytes); - } // Function#name is not settable on some platforms (#270) - - - try { - generateUUID.name = name; // eslint-disable-next-line no-empty - } catch (err) {} // For CommonJS default export support - - - generateUUID.DNS = DNS; - generateUUID.URL = URL; - return generateUUID; -} \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/v4.js b/deps/npm/node_modules/uuid/dist/v4.js deleted file mode 100644 index 838ce0b28d7436..00000000000000 --- a/deps/npm/node_modules/uuid/dist/v4.js +++ /dev/null @@ -1,37 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _rng = _interopRequireDefault(require("./rng.js")); - -var _stringify = _interopRequireDefault(require("./stringify.js")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function v4(options, buf, offset) { - options = options || {}; - - const rnds = options.random || (options.rng || _rng.default)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` - - - rnds[6] = rnds[6] & 0x0f | 0x40; - rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided - - if (buf) { - offset = offset || 0; - - for (let i = 0; i < 16; ++i) { - buf[offset + i] = rnds[i]; - } - - return buf; - } - - return (0, _stringify.default)(rnds); -} - -var _default = v4; -exports.default = _default; \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/v5.js b/deps/npm/node_modules/uuid/dist/v5.js deleted file mode 100644 index 99d615e096c5e1..00000000000000 --- a/deps/npm/node_modules/uuid/dist/v5.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _v = _interopRequireDefault(require("./v35.js")); - -var _sha = _interopRequireDefault(require("./sha1.js")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -const v5 = (0, _v.default)('v5', 0x50, _sha.default); -var _default = v5; -exports.default = _default; \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/validate.js b/deps/npm/node_modules/uuid/dist/validate.js deleted file mode 100644 index fd052157d4400d..00000000000000 --- a/deps/npm/node_modules/uuid/dist/validate.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _regex = _interopRequireDefault(require("./regex.js")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function validate(uuid) { - return typeof uuid === 'string' && _regex.default.test(uuid); -} - -var _default = validate; -exports.default = _default; \ No newline at end of file diff --git a/deps/npm/node_modules/uuid/dist/version.js b/deps/npm/node_modules/uuid/dist/version.js deleted file mode 100644 index b72949cdb96e7e..00000000000000 --- a/deps/npm/node_modules/uuid/dist/version.js +++ /dev/null @@ -1,21 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _validate = _interopRequireDefault(require("./validate.js")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function version(uuid) { - if (!(0, _validate.default)(uuid)) { - throw TypeError('Invalid UUID'); - } - - return parseInt(uuid.substr(14, 1), 16); -} - -var _default = version; -exports.default = _default; \ No newline at end of file diff --git a/deps/npm/node_modules/request/node_modules/uuid/index.js b/deps/npm/node_modules/uuid/index.js similarity index 100% rename from deps/npm/node_modules/request/node_modules/uuid/index.js rename to deps/npm/node_modules/uuid/index.js diff --git a/deps/npm/node_modules/request/node_modules/uuid/lib/bytesToUuid.js b/deps/npm/node_modules/uuid/lib/bytesToUuid.js similarity index 100% rename from deps/npm/node_modules/request/node_modules/uuid/lib/bytesToUuid.js rename to deps/npm/node_modules/uuid/lib/bytesToUuid.js diff --git a/deps/npm/node_modules/request/node_modules/uuid/lib/md5-browser.js b/deps/npm/node_modules/uuid/lib/md5-browser.js similarity index 100% rename from deps/npm/node_modules/request/node_modules/uuid/lib/md5-browser.js rename to deps/npm/node_modules/uuid/lib/md5-browser.js diff --git a/deps/npm/node_modules/request/node_modules/uuid/lib/md5.js b/deps/npm/node_modules/uuid/lib/md5.js similarity index 100% rename from deps/npm/node_modules/request/node_modules/uuid/lib/md5.js rename to deps/npm/node_modules/uuid/lib/md5.js diff --git a/deps/npm/node_modules/request/node_modules/uuid/lib/rng-browser.js b/deps/npm/node_modules/uuid/lib/rng-browser.js similarity index 100% rename from deps/npm/node_modules/request/node_modules/uuid/lib/rng-browser.js rename to deps/npm/node_modules/uuid/lib/rng-browser.js diff --git a/deps/npm/node_modules/request/node_modules/uuid/lib/rng.js b/deps/npm/node_modules/uuid/lib/rng.js similarity index 100% rename from deps/npm/node_modules/request/node_modules/uuid/lib/rng.js rename to deps/npm/node_modules/uuid/lib/rng.js diff --git a/deps/npm/node_modules/request/node_modules/uuid/lib/sha1-browser.js b/deps/npm/node_modules/uuid/lib/sha1-browser.js similarity index 100% rename from deps/npm/node_modules/request/node_modules/uuid/lib/sha1-browser.js rename to deps/npm/node_modules/uuid/lib/sha1-browser.js diff --git a/deps/npm/node_modules/request/node_modules/uuid/lib/sha1.js b/deps/npm/node_modules/uuid/lib/sha1.js similarity index 100% rename from deps/npm/node_modules/request/node_modules/uuid/lib/sha1.js rename to deps/npm/node_modules/uuid/lib/sha1.js diff --git a/deps/npm/node_modules/request/node_modules/uuid/lib/v35.js b/deps/npm/node_modules/uuid/lib/v35.js similarity index 100% rename from deps/npm/node_modules/request/node_modules/uuid/lib/v35.js rename to deps/npm/node_modules/uuid/lib/v35.js diff --git a/deps/npm/node_modules/uuid/package.json b/deps/npm/node_modules/uuid/package.json index f0ab3711ee4f49..efc07b8f6c3f73 100644 --- a/deps/npm/node_modules/uuid/package.json +++ b/deps/npm/node_modules/uuid/package.json @@ -1,6 +1,6 @@ { "name": "uuid", - "version": "8.3.2", + "version": "3.4.0", "description": "RFC4122 (v1, v4, and v5) UUIDs", "commitlint": { "extends": [ @@ -14,100 +14,28 @@ ], "license": "MIT", "bin": { - "uuid": "./dist/bin/uuid" + "uuid": "./bin/uuid" }, - "sideEffects": false, - "main": "./dist/index.js", - "exports": { - ".": { - "node": { - "module": "./dist/esm-node/index.js", - "require": "./dist/index.js", - "import": "./wrapper.mjs" - }, - "default": "./dist/esm-browser/index.js" - }, - "./package.json": "./package.json" - }, - "module": "./dist/esm-node/index.js", - "browser": { - "./dist/md5.js": "./dist/md5-browser.js", - "./dist/rng.js": "./dist/rng-browser.js", - "./dist/sha1.js": "./dist/sha1-browser.js", - "./dist/esm-node/index.js": "./dist/esm-browser/index.js" - }, - "files": [ - "CHANGELOG.md", - "CONTRIBUTING.md", - "LICENSE.md", - "README.md", - "dist", - "wrapper.mjs" - ], "devDependencies": { - "@babel/cli": "7.11.6", - "@babel/core": "7.11.6", - "@babel/preset-env": "7.11.5", - "@commitlint/cli": "11.0.0", - "@commitlint/config-conventional": "11.0.0", - "@rollup/plugin-node-resolve": "9.0.0", - "babel-eslint": "10.1.0", - "bundlewatch": "0.3.1", - "eslint": "7.10.0", - "eslint-config-prettier": "6.12.0", - "eslint-config-standard": "14.1.1", - "eslint-plugin-import": "2.22.1", - "eslint-plugin-node": "11.1.0", - "eslint-plugin-prettier": "3.1.4", - "eslint-plugin-promise": "4.2.1", - "eslint-plugin-standard": "4.0.1", - "husky": "4.3.0", - "jest": "25.5.4", - "lint-staged": "10.4.0", - "npm-run-all": "4.1.5", - "optional-dev-dependency": "2.0.1", - "prettier": "2.1.2", - "random-seed": "0.3.0", - "rollup": "2.28.2", - "rollup-plugin-terser": "7.0.2", - "runmd": "1.3.2", - "standard-version": "9.0.0" - }, - "optionalDevDependencies": { - "@wdio/browserstack-service": "6.4.0", - "@wdio/cli": "6.4.0", - "@wdio/jasmine-framework": "6.4.0", - "@wdio/local-runner": "6.4.0", - "@wdio/spec-reporter": "6.4.0", - "@wdio/static-server-service": "6.4.0", - "@wdio/sync": "6.4.0" + "@commitlint/cli": "~8.2.0", + "@commitlint/config-conventional": "~8.2.0", + "eslint": "~6.4.0", + "husky": "~3.0.5", + "mocha": "6.2.0", + "runmd": "1.2.1", + "standard-version": "7.0.0" }, "scripts": { - "examples:browser:webpack:build": "cd examples/browser-webpack && npm install && npm run build", - "examples:browser:rollup:build": "cd examples/browser-rollup && npm install && npm run build", - "examples:node:commonjs:test": "cd examples/node-commonjs && npm install && npm test", - "examples:node:esmodules:test": "cd examples/node-esmodules && npm install && npm test", - "lint": "npm run eslint:check && npm run prettier:check", - "eslint:check": "eslint src/ test/ examples/ *.js", - "eslint:fix": "eslint --fix src/ test/ examples/ *.js", - "pretest": "[ -n $CI ] || npm run build", - "test": "BABEL_ENV=commonjs node --throw-deprecation node_modules/.bin/jest test/unit/", - "pretest:browser": "optional-dev-dependency && npm run build && npm-run-all --parallel examples:browser:**", - "test:browser": "wdio run ./wdio.conf.js", - "pretest:node": "npm run build", - "test:node": "npm-run-all --parallel examples:node:**", - "test:pack": "./scripts/testpack.sh", - "pretest:benchmark": "npm run build", - "test:benchmark": "cd examples/benchmark && npm install && npm test", - "prettier:check": "prettier --ignore-path .prettierignore --check '**/*.{js,jsx,json,md}'", - "prettier:fix": "prettier --ignore-path .prettierignore --write '**/*.{js,jsx,json,md}'", - "bundlewatch": "npm run pretest:browser && bundlewatch --config bundlewatch.config.json", + "lint": "eslint .", + "test": "npm run lint && mocha test/test.js", "md": "runmd --watch --output=README.md README_js.md", - "docs": "( node --version | grep -q 'v12' ) && ( npm run build && runmd --output=README.md README_js.md )", - "docs:diff": "npm run docs && git diff --quiet README.md", - "build": "./scripts/build.sh", - "prepack": "npm run build", - "release": "standard-version --no-verify" + "release": "standard-version", + "prepare": "runmd --output=README.md README_js.md" + }, + "browser": { + "./lib/rng.js": "./lib/rng-browser.js", + "./lib/sha1.js": "./lib/sha1-browser.js", + "./lib/md5.js": "./lib/md5-browser.js" }, "repository": { "type": "git", @@ -115,21 +43,7 @@ }, "husky": { "hooks": { - "commit-msg": "commitlint -E HUSKY_GIT_PARAMS", - "pre-commit": "lint-staged" - } - }, - "lint-staged": { - "*.{js,jsx,json,md}": [ - "prettier --write" - ], - "*.{js,jsx}": [ - "eslint --fix" - ] - }, - "standard-version": { - "scripts": { - "postchangelog": "prettier --write CHANGELOG.md" + "commit-msg": "commitlint -E HUSKY_GIT_PARAMS" } } } diff --git a/deps/npm/node_modules/request/node_modules/uuid/v1.js b/deps/npm/node_modules/uuid/v1.js similarity index 100% rename from deps/npm/node_modules/request/node_modules/uuid/v1.js rename to deps/npm/node_modules/uuid/v1.js diff --git a/deps/npm/node_modules/request/node_modules/uuid/v3.js b/deps/npm/node_modules/uuid/v3.js similarity index 100% rename from deps/npm/node_modules/request/node_modules/uuid/v3.js rename to deps/npm/node_modules/uuid/v3.js diff --git a/deps/npm/node_modules/request/node_modules/uuid/v4.js b/deps/npm/node_modules/uuid/v4.js similarity index 100% rename from deps/npm/node_modules/request/node_modules/uuid/v4.js rename to deps/npm/node_modules/uuid/v4.js diff --git a/deps/npm/node_modules/request/node_modules/uuid/v5.js b/deps/npm/node_modules/uuid/v5.js similarity index 100% rename from deps/npm/node_modules/request/node_modules/uuid/v5.js rename to deps/npm/node_modules/uuid/v5.js diff --git a/deps/npm/node_modules/uuid/wrapper.mjs b/deps/npm/node_modules/uuid/wrapper.mjs deleted file mode 100644 index c31e9cef45e2b9..00000000000000 --- a/deps/npm/node_modules/uuid/wrapper.mjs +++ /dev/null @@ -1,10 +0,0 @@ -import uuid from './dist/index.js'; -export const v1 = uuid.v1; -export const v3 = uuid.v3; -export const v4 = uuid.v4; -export const v5 = uuid.v5; -export const NIL = uuid.NIL; -export const version = uuid.version; -export const validate = uuid.validate; -export const stringify = uuid.stringify; -export const parse = uuid.parse; diff --git a/deps/npm/node_modules/verror/CONTRIBUTING.md b/deps/npm/node_modules/verror/CONTRIBUTING.md new file mode 100644 index 00000000000000..750cef8dfd54a6 --- /dev/null +++ b/deps/npm/node_modules/verror/CONTRIBUTING.md @@ -0,0 +1,19 @@ +# Contributing + +This repository uses [cr.joyent.us](https://cr.joyent.us) (Gerrit) for new +changes. Anyone can submit changes. To get started, see the [cr.joyent.us user +guide](https://github.com/joyent/joyent-gerrit/blob/master/docs/user/README.md). +This repo does not use GitHub pull requests. + +See the [Joyent Engineering +Guidelines](https://github.com/joyent/eng/blob/master/docs/index.md) for general +best practices expected in this repository. + +Contributions should be "make prepush" clean. The "prepush" target runs the +"check" target, which requires these separate tools: + +* https://github.com/davepacheco/jsstyle +* https://github.com/davepacheco/javascriptlint + +If you're changing something non-trivial or user-facing, you may want to submit +an issue first. diff --git a/deps/npm/package.json b/deps/npm/package.json index 8f88726ad1e04e..8ed3c32b88900a 100644 --- a/deps/npm/package.json +++ b/deps/npm/package.json @@ -1,5 +1,5 @@ { - "version": "7.5.3", + "version": "7.6.0", "name": "npm", "description": "a package manager for JavaScript", "keywords": [ @@ -42,11 +42,10 @@ "./package.json": "./package.json" }, "dependencies": { - "@npmcli/arborist": "^2.2.1", + "@npmcli/arborist": "^2.2.5", "@npmcli/ci-detect": "^1.2.0", "@npmcli/config": "^1.2.9", - "@npmcli/installed-package-contents": "^1.0.7", - "@npmcli/run-script": "^1.8.2", + "@npmcli/run-script": "^1.8.3", "abbrev": "~1.1.1", "ansicolors": "~0.3.2", "ansistyles": "~0.1.3", @@ -59,7 +58,7 @@ "cli-table3": "^0.6.0", "columnify": "~1.5.4", "glob": "^7.1.4", - "graceful-fs": "^4.2.5", + "graceful-fs": "^4.2.6", "hosted-git-info": "^3.0.8", "ini": "^2.0.0", "init-package-json": "^2.0.2", @@ -71,12 +70,12 @@ "libnpmfund": "^1.0.2", "libnpmhook": "^6.0.1", "libnpmorg": "^2.0.1", - "libnpmpack": "^2.0.0", + "libnpmpack": "^2.0.1", "libnpmpublish": "^4.0.0", "libnpmsearch": "^3.1.0", "libnpmteam": "^2.0.2", - "libnpmversion": "^1.0.8", - "make-fetch-happen": "^8.0.13", + "libnpmversion": "^1.0.11", + "make-fetch-happen": "^8.0.14", "minipass": "^3.1.3", "minipass-pipeline": "^1.2.4", "mkdirp": "^1.0.4", @@ -85,19 +84,19 @@ "node-gyp": "^7.1.2", "nopt": "^5.0.0", "npm-audit-report": "^2.1.4", - "npm-package-arg": "^8.1.0", + "npm-package-arg": "^8.1.1", "npm-pick-manifest": "^6.1.0", "npm-profile": "^5.0.2", "npm-registry-fetch": "^9.0.0", "npm-user-validate": "^1.0.1", "npmlog": "~4.1.2", "opener": "^1.5.2", - "pacote": "^11.2.6", + "pacote": "^11.2.7", "parse-conflict-json": "^1.1.1", "qrcode-terminal": "^0.12.0", "read": "~1.0.7", - "read-package-json": "^3.0.0", - "read-package-json-fast": "^2.0.1", + "read-package-json": "^3.0.1", + "read-package-json-fast": "^2.0.2", "readdir-scoped-modules": "^1.1.0", "rimraf": "^3.0.2", "semver": "^7.3.4", @@ -106,7 +105,6 @@ "text-table": "~0.2.0", "tiny-relative-date": "^1.3.0", "treeverse": "^1.0.4", - "uuid": "^8.3.1", "validate-npm-package-name": "~3.0.0", "which": "^2.0.2", "write-file-atomic": "^3.0.3" @@ -175,19 +173,20 @@ "text-table", "tiny-relative-date", "treeverse", - "uuid", "validate-npm-package-name", "which", "write-file-atomic" ], "devDependencies": { + "@mdx-js/mdx": "^1.6.22", "cmark-gfm": "^0.8.5", "eslint": "^7.19.0", "eslint-plugin-import": "^2.22.1", "eslint-plugin-node": "^11.1.0", - "eslint-plugin-promise": "^4.2.1", + "eslint-plugin-promise": "^4.3.1", "eslint-plugin-standard": "^5.0.0", "jsdom": "^16.4.0", + "licensee": "^8.1.0", "marked-man": "^0.7.0", "require-inject": "^1.4.4", "tap": "^14.11.0", diff --git a/deps/npm/tap-snapshots/test-lib-utils-cmd-list.js-TAP.test.js b/deps/npm/tap-snapshots/test-lib-utils-cmd-list.js-TAP.test.js index 1c91975c7a152b..832f8560125a3d 100644 --- a/deps/npm/tap-snapshots/test-lib-utils-cmd-list.js-TAP.test.js +++ b/deps/npm/tap-snapshots/test-lib-utils-cmd-list.js-TAP.test.js @@ -173,6 +173,15 @@ Object { "birthday", "help-search", ], + "shellouts": Array [ + "exec", + "run-script", + "test", + "start", + "stop", + "restart", + "birthday", + ], "shorthands": Object { "c": "config", "cit": "install-ci-test", diff --git a/deps/npm/tap-snapshots/test-lib-utils-explain-dep.js-TAP.test.js b/deps/npm/tap-snapshots/test-lib-utils-explain-dep.js-TAP.test.js index 54a77bc122b4db..6d169bca698067 100644 --- a/deps/npm/tap-snapshots/test-lib-utils-explain-dep.js-TAP.test.js +++ b/deps/npm/tap-snapshots/test-lib-utils-explain-dep.js-TAP.test.js @@ -21,6 +21,28 @@ manydep@1.0.0 6 more (optdep, extra-neos, deep-dev, peer, the root project, a package with a pretty long name) ` +exports[`test/lib/utils/explain-dep.js TAP bundled > explain color deep 1`] = ` +bundle-of-joy@1.0.0 bundled +node_modules/bundle-of-joy + prod-dep@"1.x" from the root project +` + +exports[`test/lib/utils/explain-dep.js TAP bundled > explain nocolor shallow 1`] = ` +bundle-of-joy@1.0.0 bundled +node_modules/bundle-of-joy + prod-dep@"1.x" from the root project +` + +exports[`test/lib/utils/explain-dep.js TAP bundled > print color 1`] = ` +bundle-of-joy@1.0.0 bundled +node_modules/bundle-of-joy +` + +exports[`test/lib/utils/explain-dep.js TAP bundled > print nocolor 1`] = ` +bundle-of-joy@1.0.0 bundled +node_modules/bundle-of-joy +` + exports[`test/lib/utils/explain-dep.js TAP deepDev > explain color deep 1`] = ` deep-dev@2.3.4 dev node_modules/deep-dev diff --git a/deps/npm/test/lib/access.js b/deps/npm/test/lib/access.js index 3063b6c53263f2..fb799f2df29d88 100644 --- a/deps/npm/test/lib/access.js +++ b/deps/npm/test/lib/access.js @@ -1,35 +1,24 @@ const { test } = require('tap') const requireInject = require('require-inject') -const emptyMock = requireInject('../../lib/access.js', { +const access = requireInject('../../lib/access.js', { '../../lib/npm.js': { flatOptions: {}, }, }) test('completion', t => { - const { completion } = emptyMock + const { completion } = access const testComp = (argv, expect) => { - completion({conf: {argv: {remain: argv}}}, (er, res) => { - if (er) - throw er - t.strictSame(res, expect, argv.join(' ')) - }) + const res = completion({conf: {argv: {remain: argv}}}) + t.resolves(res, expect, argv.join(' ')) } testComp(['npm', 'access'], [ - 'public', - 'restricted', - 'grant', - 'revoke', - 'ls-packages', - 'ls-collaborators', - 'edit', - '2fa-required', - '2fa-not-required', + 'public', 'restricted', 'grant', 'revoke', 'ls-packages', + 'ls-collaborators', 'edit', '2fa-required', '2fa-not-required', ]) - testComp(['npm', 'access', 'grant'], ['read-only', 'read-write']) testComp(['npm', 'access', 'grant', 'read-only'], []) testComp(['npm', 'access', 'public'], []) @@ -42,15 +31,15 @@ test('completion', t => { testComp(['npm', 'access', '2fa-not-required'], []) testComp(['npm', 'access', 'revoke'], []) - completion({conf: {argv: {remain: ['npm', 'access', 'foobar']}}}, (er) => { - t.match(er, { message: 'foobar not recognized' }) - }) + t.rejects( + completion({conf: {argv: {remain: ['npm', 'access', 'foobar']}}}), + { message: 'foobar not recognized' } + ) t.end() }) test('subcommand required', t => { - const access = emptyMock access([], (err) => { t.equal(err, '\nUsage: Subcommand is required.\n\n' + access.usage) t.end() @@ -58,8 +47,6 @@ test('subcommand required', t => { }) test('unrecognized subcommand', (t) => { - const access = emptyMock - access(['blerg'], (err) => { t.match( err, @@ -71,8 +58,6 @@ test('unrecognized subcommand', (t) => { }) test('edit', (t) => { - const access = emptyMock - access([ 'edit', '@scoped/another', @@ -349,8 +334,6 @@ test('access grant current cwd', (t) => { }) test('access grant others', (t) => { - const access = emptyMock - access([ 'grant', 'rerere', @@ -367,8 +350,6 @@ test('access grant others', (t) => { }) test('access grant missing team args', (t) => { - const access = emptyMock - access([ 'grant', 'read-only', @@ -385,8 +366,6 @@ test('access grant missing team args', (t) => { }) test('access grant malformed team arg', (t) => { - const access = emptyMock - access([ 'grant', 'read-only', @@ -452,8 +431,6 @@ test('access revoke', (t) => { }) test('access revoke missing team args', (t) => { - const access = emptyMock - access([ 'revoke', undefined, @@ -469,8 +446,6 @@ test('access revoke missing team args', (t) => { }) test('access revoke malformed team arg', (t) => { - const access = emptyMock - access([ 'revoke', 'foo', diff --git a/deps/npm/test/lib/audit.js b/deps/npm/test/lib/audit.js index cc7379394b2adb..3d6296bac64866 100644 --- a/deps/npm/test/lib/audit.js +++ b/deps/npm/test/lib/audit.js @@ -168,35 +168,22 @@ t.test('report endpoint error', t => { }) t.test('completion', t => { - t.test('fix', t => { - audit.completion({ - conf: { argv: { remain: ['npm', 'audit'] } }, - }, (err, res) => { - if (err) - throw err - const subcmd = res.pop() - t.equals('fix', subcmd, 'completes to fix') - t.end() - }) + t.test('fix', async t => { + t.resolveMatch(audit.completion({ conf: { argv: { remain: ['npm', 'audit'] } } }), ['fix'], 'completes to fix') + t.end() }) t.test('subcommand fix', t => { - audit.completion({ - conf: { argv: { remain: ['npm', 'audit', 'fix'] } }, - }, (err) => { - if (err) - throw err - t.end() - }) + t.resolveMatch(audit.completion({ conf: { argv: { remain: ['npm', 'audit', 'fix'] } } }), [], 'resolves to ?') + t.end() }) t.test('subcommand not recognized', t => { - audit.completion({ - conf: { argv: { remain: ['npm', 'audit', 'repare'] } }, - }, (err) => { - t.ok(err, 'not recognized') - t.end() - }) + t.rejects( + audit.completion({ conf: { argv: { remain: ['npm', 'audit', 'repare'] } } }), + { message: 'repare not recognized' } + ) + t.end() }) t.end() diff --git a/deps/npm/test/lib/birthday.js b/deps/npm/test/lib/birthday.js index e7cd4702202983..3b8110fc8f3bcd 100644 --- a/deps/npm/test/lib/birthday.js +++ b/deps/npm/test/lib/birthday.js @@ -1,116 +1,26 @@ -const { test } = require('tap') +const t = require('tap') const requireInject = require('require-inject') +const npm = { + flatOptions: { + yes: false, + package: [], + }, + commands: { + exec: (args, cb) => { + t.equal(npm.flatOptions.yes, true, 'should say yes') + t.strictSame(npm.flatOptions.package, ['@npmcli/npm-birthday'], + 'uses correct package') + t.strictSame(args, ['npm-birthday'], 'called with correct args') + t.match(cb, Function, 'callback is a function') + cb() + }, + }, +} -test('birthday (nope)', (t) => { - t.plan(1) - const B = global[Buffer.from([66, 117, 102, 102, 101, 114])] - const f = B.from([102, 114, 111, 109]) - const D = global[B[f]([68, 97, 116, 101])] - const _6 = B[f]([98, 97, 115, 101, 54, 52]) + '' - const l = B[f]('dG9TdHJpbmc=', _6) - class FD extends D { - [B[f]('Z2V0VVRDTW9udGg=', _6)[l]()] () { - return 7 - } - } - global[B[f]([68, 97, 116, 101])] = FD - const consoleLog = console.log - console.log = () => undefined - t.tearDown(() => { - global[B[f]([68, 97, 116, 101])] = D - console.log = consoleLog - }) - const birthday = requireInject('../../lib/birthday', {}) - birthday([], (err) => { - t.match(err, 'try again', 'not telling you the secret that easily are we?') - }) +const birthday = requireInject('../../lib/birthday.js', { + '../../lib/npm.js': npm, }) -test('birthday (nope again)', (t) => { - t.plan(1) - const B = global[Buffer.from([66, 117, 102, 102, 101, 114])] - const f = B.from([102, 114, 111, 109]) - const D = global[B[f]([68, 97, 116, 101])] - const _6 = B[f]([98, 97, 115, 101, 54, 52]) + '' - const l = B[f]('dG9TdHJpbmc=', _6) - class FD extends D { - [B[f]('Z2V0RnVsbFllYXI=', _6)[l]()] () { - const d = new D() - return d[B[f]('Z2V0RnVsbFllYXI=', _6)[l]()]() + 1 - } - - [B[f]('Z2V0VVRDTW9udGg=', _6)[l]()] () { - return 9 - } - } - global[B[f]([68, 97, 116, 101])] = FD - const consoleLog = console.log - console.log = () => undefined - t.tearDown(() => { - global[B[f]([68, 97, 116, 101])] = D - console.log = consoleLog - }) - const birthday = requireInject('../../lib/birthday', {}) - birthday([], (err) => { - t.match(err, 'try again', 'not telling you the secret that easily are we?') - }) -}) - -test('birthday (strike 3)', (t) => { - t.plan(1) - const B = global[Buffer.from([66, 117, 102, 102, 101, 114])] - const f = B.from([102, 114, 111, 109]) - const D = global[B[f]([68, 97, 116, 101])] - const _6 = B[f]([98, 97, 115, 101, 54, 52]) + '' - const l = B[f]('dG9TdHJpbmc=', _6) - class FD extends D { - [B[f]('Z2V0RnVsbFllYXI=', _6)[l]()] () { - const d = new D() - return d[B[f]('Z2V0RnVsbFllYXI=', _6)[l]()]() - 1 - } - - [B[f]('Z2V0VVRDTW9udGg=', _6)[l]()] () { - return 11 - } - } - global[B[f]([68, 97, 116, 101])] = FD - const consoleLog = console.log - console.log = () => undefined - t.tearDown(() => { - global[B[f]([68, 97, 116, 101])] = D - console.log = consoleLog - }) - const birthday = requireInject('../../lib/birthday', {}) - birthday([], (err) => { - t.match(err, 'try again', 'not telling you the secret that easily are we?') - }) -}) - -test('birthday (yup)', (t) => { - t.plan(1) - const B = global[Buffer.from([66, 117, 102, 102, 101, 114])] - const f = B.from([102, 114, 111, 109]) - const D = global[B[f]([68, 97, 116, 101])] - const _6 = B[f]([98, 97, 115, 101, 54, 52]) + '' - const l = B[f]('dG9TdHJpbmc=', _6) - class FD extends D { - [B[f]('Z2V0VVRDTW9udGg=', _6)[l]()] () { - return 8 - } - - [B[f]('Z2V0VVRDRGF0ZQ==', _6)[l]()] () { - return 29 - } - } - global[B[f]([68, 97, 116, 101])] = FD - const consoleLog = console.log - console.log = () => undefined - t.tearDown(() => { - global[B[f]([68, 97, 116, 101])] = D - console.log = consoleLog - }) - const birthday = requireInject('../../lib/birthday', {}) - birthday([], (err) => { - t.ifError(err, 'npm birthday') - }) -}) +let calledCb = false +birthday([], () => calledCb = true) +t.equal(calledCb, true, 'called the callback') diff --git a/deps/npm/test/lib/bugs.js b/deps/npm/test/lib/bugs.js index df64349878e619..992bd9f614686c 100644 --- a/deps/npm/test/lib/bugs.js +++ b/deps/npm/test/lib/bugs.js @@ -54,14 +54,6 @@ const bugs = requireInject('../../lib/bugs.js', { '../../lib/utils/open-url.js': openUrl, }) -t.test('completion', t => { - bugs.completion({}, (er, res) => { - t.equal(er, null) - t.same(res, []) - t.end() - }) -}) - t.test('open bugs urls', t => { const expect = { nobugs: 'https://www.npmjs.com/package/nobugs', diff --git a/deps/npm/test/lib/cache.js b/deps/npm/test/lib/cache.js index 2e9ad346bb59bc..05d269dd4dca77 100644 --- a/deps/npm/test/lib/cache.js +++ b/deps/npm/test/lib/cache.js @@ -208,18 +208,10 @@ t.test('cache completion', t => { const { completion } = cache const testComp = (argv, expect) => { - completion({ conf: { argv: { remain: argv } } }, (err, res) => { - t.ifError(err) - t.strictSame(res, expect, argv.join(' ')) - }) + t.resolveMatch(completion({ conf: { argv: { remain: argv } } }), expect, argv.join(' ')) } - testComp(['npm', 'cache'], [ - 'add', - 'clean', - 'verify', - ]) - + testComp(['npm', 'cache'], ['add', 'clean', 'verify']) testComp(['npm', 'cache', 'add'], []) testComp(['npm', 'cache', 'clean'], []) testComp(['npm', 'cache', 'verify'], []) diff --git a/deps/npm/test/lib/completion.js b/deps/npm/test/lib/completion.js index 367a1c03ab68e6..19f70df20eec65 100644 --- a/deps/npm/test/lib/completion.js +++ b/deps/npm/test/lib/completion.js @@ -21,28 +21,28 @@ const npm = { }, commands: { completion: { - completion: (opts, cb) => { - return cb(null, [['>>', '~/.bashrc']]) - }, + completion: () => [['>>', '~/.bashrc']], }, adduser: {}, access: { - completion: (opts, cb) => { + completion: () => { if (accessCompletionError) - return cb(new Error('access completion failed')) + throw new Error('access completion failed') - return cb(null, ['public', 'restricted']) + return ['public', 'restricted'] }, }, + promise: { + completion: () => Promise.resolve(['resolved_completion_promise']), + }, donothing: { - completion: (opts, cb) => { - return cb(null, null) + completion: () => { + return null }, }, driveaboat: { - completion: (opts, cb) => { - // the leading space here is to exercise the escape method - return cb(null, ' fast') + completion: () => { + return ' fast' }, }, }, @@ -86,7 +86,7 @@ const completion = requireInject('../../lib/completion.js', { }, }) -test('completion completion', t => { +test('completion completion', async t => { const home = process.env.HOME t.teardown(() => { process.env.HOME = home @@ -97,19 +97,15 @@ test('completion completion', t => { '.zshrc': '', }) - completion.completion({ w: 2 }, (err, res) => { - if (err) - throw err - - t.strictSame(res, [ - ['>>', '~/.zshrc'], - ['>>', '~/.bashrc'], - ], 'identifies both shells') - t.end() - }) + const res = await completion.completion({ w: 2 }) + t.strictSame(res, [ + ['>>', '~/.zshrc'], + ['>>', '~/.bashrc'], + ], 'identifies both shells') + t.end() }) -test('completion completion no known shells', t => { +test('completion completion no known shells', async t => { const home = process.env.HOME t.teardown(() => { process.env.HOME = home @@ -117,23 +113,15 @@ test('completion completion no known shells', t => { process.env.HOME = t.testdir() - completion.completion({ w: 2 }, (err, res) => { - if (err) - throw err - - t.strictSame(res, [], 'no responses') - t.end() - }) + const res = await completion.completion({ w: 2 }) + t.strictSame(res, [], 'no responses') + t.end() }) -test('completion completion wrong word count', t => { - completion.completion({ w: 3 }, (err, res) => { - if (err) - throw err - - t.strictSame(res, undefined, 'no responses') - t.end() - }) +test('completion completion wrong word count', async t => { + const res = await completion.completion({ w: 3 }) + t.strictSame(res, undefined, 'no responses') + t.end() }) test('completion errors in windows without bash', t => { @@ -313,6 +301,35 @@ test('completion of invalid command name does nothing', t => { }) }) +test('handles async completion function', t => { + process.env.COMP_CWORD = 2 + process.env.COMP_LINE = 'npm promise' + process.env.COMP_POINT = process.env.COMP_LINE.length + + t.teardown(() => { + delete process.env.COMP_CWORD + delete process.env.COMP_LINE + delete process.env.COMP_POINT + npm.config.clear() + output.length = 0 + }) + + completion(['npm', 'promise', ''], (err, res) => { + if (err) + throw err + + t.strictSame(npmConfig, { + argv: { + remain: ['npm', 'promise'], + cooked: ['npm', 'promise'], + original: ['npm', 'promise'], + }, + }, 'applies command config appropriately') + t.strictSame(output, ['resolved_completion_promise'], 'resolves async completion results') + t.end() + }) +}) + test('completion triggers command completions', t => { process.env.COMP_CWORD = 2 process.env.COMP_LINE = 'npm access ' diff --git a/deps/npm/test/lib/config.js b/deps/npm/test/lib/config.js index 5d2f54249cfe3b..edaa6486cdc95e 100644 --- a/deps/npm/test/lib/config.js +++ b/deps/npm/test/lib/config.js @@ -610,23 +610,13 @@ t.test('completion', t => { const { completion } = config const testComp = (argv, expect) => { - completion({ conf: { argv: { remain: argv } } }, (er, res) => { - t.ifError(er) - t.strictSame(res, expect, argv.join(' ')) - }) + t.resolveMatch(completion({ conf: { argv: { remain: argv } } }), expect, argv.join(' ')) } testComp(['npm', 'foo'], []) - testComp(['npm', 'config'], [ - 'get', - 'set', - 'delete', - 'ls', - 'rm', - 'edit', - 'list', - ]) + testComp(['npm', 'config'], ['get', 'set', 'delete', 'ls', 'rm', 'edit', 'list']) testComp(['npm', 'config', 'set', 'foo'], []) + const possibleConfigKeys = [...Object.keys(types)] testComp(['npm', 'config', 'get'], possibleConfigKeys) testComp(['npm', 'config', 'set'], possibleConfigKeys) @@ -636,24 +626,8 @@ t.test('completion', t => { testComp(['npm', 'config', 'list'], []) testComp(['npm', 'config', 'ls'], []) - completion({ - conf: { - argv: { - remain: ['npm', 'config'], - }, - }, - partialWord: 'l', - }, (er, res) => { - t.ifError(er) - t.strictSame(res, [ - 'get', - 'set', - 'delete', - 'ls', - 'rm', - 'edit', - ], 'npm config') - }) + const partial = completion({conf: { argv: { remain: ['npm', 'config'] } }, partialWord: 'l'}) + t.resolveMatch(partial, ['get', 'set', 'delete', 'ls', 'rm', 'edit'], 'npm config') t.end() }) diff --git a/deps/npm/test/lib/dedupe.js b/deps/npm/test/lib/dedupe.js index ff2d2be5340524..b14185525bbeaf 100644 --- a/deps/npm/test/lib/dedupe.js +++ b/deps/npm/test/lib/dedupe.js @@ -1,6 +1,21 @@ const { test } = require('tap') const requireInject = require('require-inject') +test('should throw in global mode', (t) => { + const dedupe = requireInject('../../lib/dedupe.js', { + '../../lib/npm.js': { + flatOptions: { + global: true, + }, + }, + }) + + dedupe([], er => { + t.match(er, { code: 'EDEDUPEGLOBAL' }, 'throws EDEDUPEGLOBAL') + t.end() + }) +}) + test('should remove dupes using Arborist', (t) => { const dedupe = requireInject('../../lib/dedupe.js', { '../../lib/npm.js': { diff --git a/deps/npm/test/lib/deprecate.js b/deps/npm/test/lib/deprecate.js index 229cb9137a42c5..fd563de1209dd0 100644 --- a/deps/npm/test/lib/deprecate.js +++ b/deps/npm/test/lib/deprecate.js @@ -38,29 +38,24 @@ test('completion', async t => { const { completion } = deprecate - const testComp = (argv, expect) => { - return new Promise((resolve, reject) => { - completion({ conf: { argv: { remain: argv } } }, (err, res) => { - if (err) - return reject(err) - - t.strictSame(res, expect, `completion: ${argv}`) - resolve() - }) - }) + const testComp = async (argv, expect) => { + const res = await completion({ conf: { argv: { remain: argv } } }) + t.strictSame(res, expect, `completion: ${argv}`) } - await testComp([], ['foo', 'bar', 'baz']) - await testComp(['b'], ['bar', 'baz']) - await testComp(['fo'], ['foo']) - await testComp(['g'], []) - await testComp(['foo', 'something'], []) + await Promise.all([ + testComp([], ['foo', 'bar', 'baz']), + testComp(['b'], ['bar', 'baz']), + testComp(['fo'], ['foo']), + testComp(['g'], []), + testComp(['foo', 'something'], []), + ]) getIdentityImpl = () => { - throw new Error('unknown failure') + throw new Error('deprecate test failure') } - t.rejects(testComp([], []), /unknown failure/) + t.rejects(testComp([], []), { message: 'deprecate test failure' }) }) test('no args', t => { diff --git a/deps/npm/test/lib/dist-tag.js b/deps/npm/test/lib/dist-tag.js index 8b1106fa39e5d2..c189352302e9a4 100644 --- a/deps/npm/test/lib/dist-tag.js +++ b/deps/npm/test/lib/dist-tag.js @@ -294,35 +294,13 @@ test('remove missing pkg name', (t) => { test('completion', t => { const { completion } = distTag - t.plan(3) + t.plan(2) - completion({ - conf: { - argv: { - remain: ['npm', 'dist-tag'], - }, - }, - }, (err, res) => { - t.ifError(err, 'npm dist-tags completion') - - t.strictSame( - res, - [ - 'add', - 'rm', - 'ls', - ], - 'should list npm dist-tag commands for completion' - ) - }) + const match = completion({ conf: { argv: { remain: ['npm', 'dist-tag'] } } }) + t.resolveMatch(match, ['add', 'rm', 'ls'], + 'should list npm dist-tag commands for completion') - completion({ - conf: { - argv: { - remain: ['npm', 'dist-tag', 'foobar'], - }, - }, - }, (err) => { - t.notOk(err, 'should ignore any unknown name') - }) + const noMatch = completion({ conf: { argv: { remain: ['npm', 'dist-tag', 'foobar'] } } }) + t.resolveMatch(noMatch, []) + t.end() }) diff --git a/deps/npm/test/lib/docs.js b/deps/npm/test/lib/docs.js index b4ede873167d4f..8a59ed7cc0b095 100644 --- a/deps/npm/test/lib/docs.js +++ b/deps/npm/test/lib/docs.js @@ -44,14 +44,6 @@ const docs = requireInject('../../lib/docs.js', { '../../lib/utils/open-url.js': openUrl, }) -t.test('completion', t => { - docs.completion({}, (er, res) => { - t.equal(er, null) - t.same(res, []) - t.end() - }) -}) - t.test('open docs urls', t => { const expect = { nodocs: 'https://www.npmjs.com/package/nodocs', diff --git a/deps/npm/test/lib/doctor.js b/deps/npm/test/lib/doctor.js index db41fc8e5dd56b..f5e6fd062a3311 100644 --- a/deps/npm/test/lib/doctor.js +++ b/deps/npm/test/lib/doctor.js @@ -22,6 +22,13 @@ const ping = async () => { throw pingError } +let whichError = null +const which = async () => { + if (whichError) + throw whichError + return '/path/to/git' +} + const nodeVersions = [ { version: 'v14.0.0', lts: false }, { version: 'v13.0.0', lts: false }, @@ -106,13 +113,6 @@ const pacote = { }, } -let whichError = null -const which = async () => { - if (whichError) - throw whichError - return '/path/to/git' -} - let verifyResponse = { verifiedCount: 1, verifiedContent: 1 } const cacache = { verify: async () => { @@ -133,811 +133,837 @@ const doctor = requireInject('../../lib/doctor.js', { which, }) -test('npm doctor checks ok', t => { - const dir = t.testdir() - npm.cache = npm.flatOptions.cache = dir - npm.localDir = dir - npm.globalDir = dir - npm.localBin = dir - npm.globalBin = dir - - t.teardown(() => { - delete npm.cache - delete npm.flatOptions.cache - delete npm.localDir - delete npm.globalDir - delete npm.localBin - delete npm.globalBin - clearLogs() - }) - - doctor([], (err) => { - if (err) { - t.fail(output) - return t.end() - } - - t.match(logs, { - checkPing: { finished: true }, - getLatestNpmVersion: { finished: true }, - getLatestNodejsVersion: { finished: true }, - getGitPath: { finished: true }, - [dir]: { finished: true }, - verifyCachedFiles: { finished: true }, - }, 'trackers all finished') - t.match(output, /npm ping\s*ok/, 'ping output is ok') - t.match(output, /npm -v\s*ok/, 'npm -v output is ok') - t.match(output, /node -v\s*ok/, 'node -v output is ok') - t.match(output, /npm config get registry\s*ok\s*using default/, 'npm config get registry output is ok') - t.match(output, /which git\s*ok/, 'which git output is ok') - t.match(output, /cached files\s*ok/, 'cached files are ok') - t.match(output, /local node_modules\s*ok/, 'local node_modules are ok') - t.match(output, /global node_modules\s*ok/, 'global node_modules are ok') - t.match(output, /local bin folder\s*ok/, 'local bin is ok') - t.match(output, /global bin folder\s*ok/, 'global bin is ok') - t.match(output, /cache contents\s*ok/, 'cache contents is ok') - t.end() - }) -}) - -test('npm doctor supports silent', t => { - const dir = t.testdir() - npm.cache = npm.flatOptions.cache = dir - npm.localDir = dir - npm.globalDir = dir - npm.localBin = dir - npm.globalBin = dir - npm.log.level = 'info' - - t.teardown(() => { - delete npm.cache - delete npm.flatOptions.cache - delete npm.localDir - delete npm.globalDir - delete npm.localBin - delete npm.globalBin - npm.log.level = 'error' - clearLogs() - }) - - doctor([], (err) => { - if (err) { - t.fail(err) - return t.end() - } - - t.match(logs, { - checkPing: { finished: true }, - getLatestNpmVersion: { finished: true }, - getLatestNodejsVersion: { finished: true }, - getGitPath: { finished: true }, - [dir]: { finished: true }, - verifyCachedFiles: { finished: true }, - }, 'trackers all finished') - t.strictSame(output, [], 'did not print output') - t.end() - }) -}) - -test('npm doctor supports color', t => { - const dir = t.testdir() - npm.cache = npm.flatOptions.cache = dir - npm.localDir = dir - npm.globalDir = dir - npm.localBin = dir - npm.globalBin = dir - npm.color = true - pingError = { message: 'generic error' } - const _consoleError = console.error - console.error = () => {} - - t.teardown(() => { - delete npm.cache - delete npm.flatOptions.cache - delete npm.localDir - delete npm.globalDir - delete npm.localBin - delete npm.globalBin - delete npm.color - pingError = null - console.error = _consoleError - clearLogs() - }) - - doctor([], (err) => { - t.match(err, /Some problems found/, 'detected the ping error') - t.match(logs, { - checkPing: { finished: true }, - getLatestNpmVersion: { finished: true }, - getLatestNodejsVersion: { finished: true }, - getGitPath: { finished: true }, - [dir]: { finished: true }, - verifyCachedFiles: { finished: true }, - }, 'trackers all finished') - t.match(output, /npm ping.*not ok/, 'ping output is ok') - t.match(output, /npm -v.*ok/, 'npm -v output is ok') - t.match(output, /node -v.*ok/, 'node -v output is ok') - t.match(output, /npm config get registry.*ok.*using default/, 'npm config get registry output is ok') - t.match(output, /which git.*ok/, 'which git output is ok') - t.match(output, /cached files.*ok/, 'cached files are ok') - t.match(output, /local node_modules.*ok/, 'local node_modules are ok') - t.match(output, /global node_modules.*ok/, 'global node_modules are ok') - t.match(output, /local bin folder.*ok/, 'local bin is ok') - t.match(output, /global bin folder.*ok/, 'global bin is ok') - t.match(output, /cache contents.*ok/, 'cache contents is ok') - t.notEqual(output[0], ansiTrim(output[0]), 'output should contain color codes') - t.end() - }) -}) - -test('npm doctor skips some tests in windows', t => { - const winDoctor = requireInject('../../lib/doctor.js', { - '../../lib/utils/is-windows.js': true, - '../../lib/utils/ping.js': ping, - '../../lib/utils/output.js': (data) => { - output.push(data) - }, - '../../lib/npm.js': npm, - cacache, - pacote, - 'make-fetch-happen': fetch, - which, - }) - - const dir = t.testdir() - npm.cache = npm.flatOptions.cache = dir - npm.localDir = dir - npm.globalDir = dir - npm.localBin = dir - npm.globalBin = dir - - t.teardown(() => { - delete npm.cache - delete npm.flatOptions.cache - delete npm.localDir - delete npm.globalDir - delete npm.localBin - delete npm.globalBin - clearLogs() - }) - - winDoctor([], (err) => { - if (err) { - t.fail(output) - return t.end() - } - - t.match(logs, { - checkPing: { finished: true }, - getLatestNpmVersion: { finished: true }, - getLatestNodejsVersion: { finished: true }, - getGitPath: { finished: true }, - [dir]: undefined, - verifyCachedFiles: { finished: true }, - }, 'trackers all finished') - t.match(output, /npm ping\s*ok/, 'ping output is ok') - t.match(output, /npm -v\s*ok/, 'npm -v output is ok') - t.match(output, /node -v\s*ok/, 'node -v output is ok') - t.match(output, /npm config get registry\s*ok\s*using default/, 'npm config get registry output is ok') - t.match(output, /which git\s*ok/, 'which git output is ok') - t.match(output, /cache contents\s*ok/, 'cache contents is ok') - t.end() +const origVersion = process.version +test('node versions', t => { + t.plan(nodeVersions.length) + + nodeVersions.forEach(({ version }) => { + t.test(`${version}:`, vt => { + Object.defineProperty(process, 'version', { value: version }) + vt.teardown(() => { + Object.defineProperty(process, 'version', { value: origVersion }) + }) + + vt.test(`${version}: npm doctor checks ok`, st => { + const dir = st.testdir() + npm.cache = npm.flatOptions.cache = dir + npm.localDir = dir + npm.globalDir = dir + npm.localBin = dir + npm.globalBin = dir + + st.teardown(() => { + delete npm.cache + delete npm.flatOptions.cache + delete npm.localDir + delete npm.globalDir + delete npm.localBin + delete npm.globalBin + clearLogs() + }) + + doctor([], (err) => { + if (err) { + st.fail(output) + return st.end() + } + + st.match(logs, { + checkPing: { finished: true }, + getLatestNpmVersion: { finished: true }, + getLatestNodejsVersion: { finished: true }, + getGitPath: { finished: true }, + [dir]: { finished: true }, + verifyCachedFiles: { finished: true }, + }, 'trackers all finished') + st.match(output, /npm ping\s*ok/, 'ping output is ok') + st.match(output, /npm -v\s*ok/, 'npm -v output is ok') + st.match(output, /node -v\s*ok/, 'node -v output is ok') + st.match(output, /npm config get registry\s*ok\s*using default/, 'npm config get registry output is ok') + st.match(output, /which git\s*ok/, 'which git output is ok') + st.match(output, /cached files\s*ok/, 'cached files are ok') + st.match(output, /local node_modules\s*ok/, 'local node_modules are ok') + st.match(output, /global node_modules\s*ok/, 'global node_modules are ok') + st.match(output, /local bin folder\s*ok/, 'local bin is ok') + st.match(output, /global bin folder\s*ok/, 'global bin is ok') + st.match(output, /cache contents\s*ok/, 'cache contents is ok') + st.end() + }) + }) + + vt.test('npm doctor supports silent', st => { + const dir = st.testdir() + npm.cache = npm.flatOptions.cache = dir + npm.localDir = dir + npm.globalDir = dir + npm.localBin = dir + npm.globalBin = dir + npm.log.level = 'info' + + st.teardown(() => { + delete npm.cache + delete npm.flatOptions.cache + delete npm.localDir + delete npm.globalDir + delete npm.localBin + delete npm.globalBin + npm.log.level = 'error' + clearLogs() + }) + + doctor([], (err) => { + if (err) { + st.fail(err) + return st.end() + } + + st.match(logs, { + checkPing: { finished: true }, + getLatestNpmVersion: { finished: true }, + getLatestNodejsVersion: { finished: true }, + getGitPath: { finished: true }, + [dir]: { finished: true }, + verifyCachedFiles: { finished: true }, + }, 'trackers all finished') + st.strictSame(output, [], 'did not print output') + st.end() + }) + }) + + vt.test('npm doctor supports color', st => { + const dir = st.testdir() + npm.cache = npm.flatOptions.cache = dir + npm.localDir = dir + npm.globalDir = dir + npm.localBin = dir + npm.globalBin = dir + npm.color = true + pingError = { message: 'generic error' } + const _consoleError = console.error + console.error = () => {} + + st.teardown(() => { + delete npm.cache + delete npm.flatOptions.cache + delete npm.localDir + delete npm.globalDir + delete npm.localBin + delete npm.globalBin + delete npm.color + pingError = null + console.error = _consoleError + clearLogs() + }) + + doctor([], (err) => { + st.match(err, /Some problems found/, 'detected the ping error') + st.match(logs, { + checkPing: { finished: true }, + getLatestNpmVersion: { finished: true }, + getLatestNodejsVersion: { finished: true }, + getGitPath: { finished: true }, + [dir]: { finished: true }, + verifyCachedFiles: { finished: true }, + }, 'trackers all finished') + st.match(output, /npm ping.*not ok/, 'ping output is ok') + st.match(output, /npm -v.*ok/, 'npm -v output is ok') + st.match(output, /node -v.*ok/, 'node -v output is ok') + st.match(output, /npm config get registry.*ok.*using default/, 'npm config get registry output is ok') + st.match(output, /which git.*ok/, 'which git output is ok') + st.match(output, /cached files.*ok/, 'cached files are ok') + st.match(output, /local node_modules.*ok/, 'local node_modules are ok') + st.match(output, /global node_modules.*ok/, 'global node_modules are ok') + st.match(output, /local bin folder.*ok/, 'local bin is ok') + st.match(output, /global bin folder.*ok/, 'global bin is ok') + st.match(output, /cache contents.*ok/, 'cache contents is ok') + st.notEqual(output[0], ansiTrim(output[0]), 'output should contain color codes') + st.end() + }) + }) + + vt.test('npm doctor skips some tests in windows', st => { + const winDoctor = requireInject('../../lib/doctor.js', { + '../../lib/utils/is-windows.js': true, + '../../lib/utils/ping.js': ping, + '../../lib/utils/output.js': (data) => { + output.push(data) + }, + '../../lib/npm.js': npm, + cacache, + pacote, + 'make-fetch-happen': fetch, + which, + }) + + const dir = st.testdir() + npm.cache = npm.flatOptions.cache = dir + npm.localDir = dir + npm.globalDir = dir + npm.localBin = dir + npm.globalBin = dir + + st.teardown(() => { + delete npm.cache + delete npm.flatOptions.cache + delete npm.localDir + delete npm.globalDir + delete npm.localBin + delete npm.globalBin + clearLogs() + }) + + winDoctor([], (err) => { + if (err) { + st.fail(output) + return st.end() + } + + st.match(logs, { + checkPing: { finished: true }, + getLatestNpmVersion: { finished: true }, + getLatestNodejsVersion: { finished: true }, + getGitPath: { finished: true }, + [dir]: undefined, + verifyCachedFiles: { finished: true }, + }, 'trackers all finished') + st.match(output, /npm ping\s*ok/, 'ping output is ok') + st.match(output, /npm -v\s*ok/, 'npm -v output is ok') + st.match(output, /node -v\s*ok/, 'node -v output is ok') + st.match(output, /npm config get registry\s*ok\s*using default/, 'npm config get registry output is ok') + st.match(output, /which git\s*ok/, 'which git output is ok') + st.match(output, /cache contents\s*ok/, 'cache contents is ok') + st.end() + }) + }) + + vt.test('npm doctor ping error E{3}', st => { + const dir = st.testdir() + npm.cache = npm.flatOptions.cache = dir + npm.localDir = dir + npm.globalDir = dir + npm.localBin = dir + npm.globalBin = dir + pingError = { code: 'E111', message: 'this error is 111' } + const consoleError = console.error + // we just print an empty line here, so swallow it and ignore + console.error = () => {} + + st.teardown(() => { + delete npm.cache + delete npm.flatOptions.cache + delete npm.localDir + delete npm.globalDir + delete npm.localBin + delete npm.globalBin + pingError = null + console.error = consoleError + clearLogs() + }) + + doctor([], (err) => { + st.match(err, /Some problems found/, 'detected the ping error') + st.match(logs, { + checkPing: { finished: true }, + getLatestNpmVersion: { finished: true }, + getLatestNodejsVersion: { finished: true }, + getGitPath: { finished: true }, + [dir]: { finished: true }, + verifyCachedFiles: { finished: true }, + }, 'trackers all finished') + st.match(output, /npm ping\s*not ok\s*111 this error is 111/, 'ping output contains trimmed error') + st.match(output, /npm -v\s*ok/, 'npm -v output is ok') + st.match(output, /node -v\s*ok/, 'node -v output is ok') + st.match(output, /npm config get registry\s*ok\s*using default/, 'npm config get registry output is ok') + st.match(output, /which git\s*ok/, 'which git output is ok') + st.match(output, /cached files\s*ok/, 'cached files are ok') + st.match(output, /local node_modules\s*ok/, 'local node_modules are ok') + st.match(output, /global node_modules\s*ok/, 'global node_modules are ok') + st.match(output, /local bin folder\s*ok/, 'local bin is ok') + st.match(output, /global bin folder\s*ok/, 'global bin is ok') + st.match(output, /cache contents\s*ok/, 'cache contents is ok') + st.end() + }) + }) + + vt.test('npm doctor generic ping error', st => { + const dir = st.testdir() + npm.cache = npm.flatOptions.cache = dir + npm.localDir = dir + npm.globalDir = dir + npm.localBin = dir + npm.globalBin = dir + pingError = { message: 'generic error' } + const consoleError = console.error + // we just print an empty line here, so swallow it and ignore + console.error = () => {} + + st.teardown(() => { + delete npm.cache + delete npm.flatOptions.cache + delete npm.localDir + delete npm.globalDir + delete npm.localBin + delete npm.globalBin + pingError = null + console.error = consoleError + clearLogs() + }) + + doctor([], (err) => { + st.match(err, /Some problems found/, 'detected the ping error') + st.match(logs, { + checkPing: { finished: true }, + getLatestNpmVersion: { finished: true }, + getLatestNodejsVersion: { finished: true }, + getGitPath: { finished: true }, + [dir]: { finished: true }, + verifyCachedFiles: { finished: true }, + }, 'trackers all finished') + st.match(output, /npm ping\s*not ok\s*generic error/, 'ping output contains trimmed error') + st.match(output, /npm -v\s*ok/, 'npm -v output is ok') + st.match(output, /node -v\s*ok/, 'node -v output is ok') + st.match(output, /npm config get registry\s*ok\s*using default/, 'npm config get registry output is ok') + st.match(output, /which git\s*ok/, 'which git output is ok') + st.match(output, /cached files\s*ok/, 'cached files are ok') + st.match(output, /local node_modules\s*ok/, 'local node_modules are ok') + st.match(output, /global node_modules\s*ok/, 'global node_modules are ok') + st.match(output, /local bin folder\s*ok/, 'local bin is ok') + st.match(output, /global bin folder\s*ok/, 'global bin is ok') + st.match(output, /cache contents\s*ok/, 'cache contents is ok') + st.end() + }) + }) + + vt.test('npm doctor outdated npm version', st => { + const dir = st.testdir() + npm.cache = npm.flatOptions.cache = dir + npm.localDir = dir + npm.globalDir = dir + npm.localBin = dir + npm.globalBin = dir + latestNpm = '7.1.1' + const consoleError = console.error + // we just print an empty line here, so swallow it and ignore + console.error = () => {} + + st.teardown(() => { + delete npm.cache + delete npm.flatOptions.cache + delete npm.localDir + delete npm.globalDir + delete npm.localBin + delete npm.globalBin + latestNpm = npm.version + console.error = consoleError + clearLogs() + }) + + doctor([], (err) => { + st.match(err, /Some problems found/, 'detected the out of date npm') + st.match(logs, { + checkPing: { finished: true }, + getLatestNpmVersion: { finished: true }, + getLatestNodejsVersion: { finished: true }, + getGitPath: { finished: true }, + [dir]: { finished: true }, + verifyCachedFiles: { finished: true }, + }, 'trackers all finished') + st.match(output, /npm ping\s*ok/, 'ping output is ok') + st.match(output, /npm -v\s*not ok/, 'npm -v output is not ok') + st.match(output, /node -v\s*ok/, 'node -v output is ok') + st.match(output, /npm config get registry\s*ok\s*using default/, 'npm config get registry output is ok') + st.match(output, /which git\s*ok/, 'which git output is ok') + st.match(output, /cached files\s*ok/, 'cached files are ok') + st.match(output, /local node_modules\s*ok/, 'local node_modules are ok') + st.match(output, /global node_modules\s*ok/, 'global node_modules are ok') + st.match(output, /local bin folder\s*ok/, 'local bin is ok') + st.match(output, /global bin folder\s*ok/, 'global bin is ok') + st.match(output, /cache contents\s*ok/, 'cache contents is ok') + st.end() + }) + }) + + vt.test('npm doctor file permission checks', st => { + const dir = st.testdir({ + cache: { + one: 'one', + link: st.fixture('symlink', './one'), + unreadable: 'unreadable', + baddir: {}, + }, + local: { + two: 'two', + notmine: 'notmine', + }, + global: { + three: 'three', + broken: 'broken', + }, + localBin: { + four: 'four', + five: 'five', + }, + globalBin: { + six: 'six', + seven: 'seven', + }, + }) + + const _fsLstat = fs.lstat + fs.lstat = (p, cb) => { + let err = null + let stat = null + + try { + stat = fs.lstatSync(p) + } catch (err) { + return cb(err) + } + + switch (p) { + case join(dir, 'local', 'notmine'): + stat.uid += 1 + stat.gid += 1 + break + case join(dir, 'global', 'broken'): + err = new Error('broken') + break + } + + return cb(err, stat) + } + + const _fsReaddir = fs.readdir + fs.readdir = (p, cb) => { + let err = null + let result = null + + try { + result = fs.readdirSync(p) + } catch (err) { + return cb(err) + } + + if (p === join(dir, 'cache', 'baddir')) + err = new Error('broken') + + return cb(err, result) + } + + const _fsAccess = fs.access + fs.access = (p, mask, cb) => { + const err = new Error('failed') + switch (p) { + case join(dir, 'cache', 'unreadable'): + case join(dir, 'localBin', 'four'): + case join(dir, 'globalBin', 'six'): + return cb(err) + default: + return cb(null) + } + } + + const doctor = requireInject('../../lib/doctor.js', { + '../../lib/utils/is-windows.js': false, + '../../lib/utils/ping.js': ping, + '../../lib/utils/output.js': (data) => { + output.push(data) + }, + '../../lib/npm.js': npm, + cacache, + pacote, + 'make-fetch-happen': fetch, + which, + fs, + }) + // it's necessary to allow tests in node 10.x to not mark 12.x as lted + + npm.cache = npm.flatOptions.cache = join(dir, 'cache') + npm.localDir = join(dir, 'local') + npm.globalDir = join(dir, 'global') + npm.localBin = join(dir, 'localBin') + npm.globalBin = join(dir, 'globalBin') + const _consoleError = console.error + console.error = () => {} + + st.teardown(() => { + delete npm.cache + delete npm.flatOptions.cache + delete npm.localDir + delete npm.globalDir + delete npm.localBin + delete npm.globalBin + console.error = _consoleError + fs.lstat = _fsLstat + fs.readdir = _fsReaddir + fs.access = _fsAccess + clearLogs() + }) + + doctor([], (err) => { + st.match(err, /Some problems found/, 'identified problems') + st.match(logs, { + checkPing: { finished: true }, + getLatestNpmVersion: { finished: true }, + getLatestNodejsVersion: { finished: true }, + getGitPath: { finished: true }, + [join(dir, 'cache')]: { finished: true }, + [join(dir, 'local')]: { finished: true }, + [join(dir, 'global')]: { finished: true }, + [join(dir, 'localBin')]: { finished: true }, + [join(dir, 'globalBin')]: { finished: true }, + verifyCachedFiles: { finished: true }, + }, 'trackers all finished') + st.match(output, /npm ping\s*ok/, 'ping output is ok') + st.match(output, /npm -v\s*ok/, 'npm -v output is ok') + st.match(output, /node -v\s*ok/, 'node -v output is ok') + st.match(output, /npm config get registry\s*ok\s*using default/, 'npm config get registry output is ok') + st.match(output, /which git\s*ok/, 'which git output is ok') + st.match(output, /cached files\s*not ok/, 'cached files are not ok') + st.match(output, /local node_modules\s*not ok/, 'local node_modules are not ok') + st.match(output, /global node_modules\s*not ok/, 'global node_modules are not ok') + st.match(output, /local bin folder\s*not ok/, 'local bin is not ok') + st.match(output, /global bin folder\s*not ok/, 'global bin is not ok') + st.match(output, /cache contents\s*ok/, 'cache contents is ok') + st.end() + }) + }) + + vt.test('npm doctor missing git', st => { + const dir = st.testdir() + npm.cache = npm.flatOptions.cache = dir + npm.localDir = dir + npm.globalDir = dir + npm.localBin = dir + npm.globalBin = dir + whichError = new Error('boom') + const consoleError = console.error + // we just print an empty line here, so swallow it and ignore + console.error = () => {} + + st.teardown(() => { + delete npm.cache + delete npm.flatOptions.cache + delete npm.localDir + delete npm.globalDir + delete npm.localBin + delete npm.globalBin + whichError = null + console.error = consoleError + clearLogs() + }) + + doctor([], (err) => { + st.match(err, /Some problems found/, 'detected the missing git') + st.match(logs, { + checkPing: { finished: true }, + getLatestNpmVersion: { finished: true }, + getLatestNodejsVersion: { finished: true }, + getGitPath: { finished: true }, + [dir]: { finished: true }, + verifyCachedFiles: { finished: true }, + }, 'trackers all finished') + st.match(output, /npm ping\s*ok/, 'ping output is ok') + st.match(output, /npm -v\s*ok/, 'npm -v output is ok') + st.match(output, /node -v\s*ok/, 'node -v output is ok') + st.match(output, /npm config get registry\s*ok\s*using default/, 'npm config get registry output is ok') + st.match(output, /which git\s*not ok/, 'which git output is not ok') + st.match(output, /cached files\s*ok/, 'cached files are ok') + st.match(output, /local node_modules\s*ok/, 'local node_modules are ok') + st.match(output, /global node_modules\s*ok/, 'global node_modules are ok') + st.match(output, /local bin folder\s*ok/, 'local bin is ok') + st.match(output, /global bin folder\s*ok/, 'global bin is ok') + st.match(output, /cache contents\s*ok/, 'cache contents is ok') + st.end() + }) + }) + + vt.test('npm doctor cache verification showed bad content', st => { + const dir = st.testdir() + npm.cache = npm.flatOptions.cache = dir + npm.localDir = dir + npm.globalDir = dir + npm.localBin = dir + npm.globalBin = dir + const _verifyResponse = verifyResponse + verifyResponse = { + ...verifyResponse, + badContentCount: 1, + } + const consoleError = console.error + // we just print an empty line here, so swallow it and ignore + console.error = () => {} + + st.teardown(() => { + delete npm.cache + delete npm.flatOptions.cache + delete npm.localDir + delete npm.globalDir + delete npm.localBin + delete npm.globalBin + verifyResponse = _verifyResponse + console.error = consoleError + clearLogs() + }) + + doctor([], (err) => { + // cache verification problems get fixed and so do not throw an error + if (err) { + st.fail(output) + return st.end() + } + + st.match(logs, { + checkPing: { finished: true }, + getLatestNpmVersion: { finished: true }, + getLatestNodejsVersion: { finished: true }, + getGitPath: { finished: true }, + [dir]: { finished: true }, + verifyCachedFiles: { finished: true }, + }, 'trackers all finished') + st.match(output, /npm ping\s*ok/, 'ping output is ok') + st.match(output, /npm -v\s*ok/, 'npm -v output is ok') + st.match(output, /node -v\s*ok/, 'node -v output is ok') + st.match(output, /npm config get registry\s*ok\s*using default/, 'npm config get registry output is ok') + st.match(output, /which git\s*ok/, 'which git output is ok') + st.match(output, /cached files\s*ok/, 'cached files are ok') + st.match(output, /local node_modules\s*ok/, 'local node_modules are ok') + st.match(output, /global node_modules\s*ok/, 'global node_modules are ok') + st.match(output, /local bin folder\s*ok/, 'local bin is ok') + st.match(output, /global bin folder\s*ok/, 'global bin is ok') + st.match(output, /cache contents\s*ok/, 'cache contents is not ok') + st.end() + }) + }) + + vt.test('npm doctor cache verification showed reclaimed content', st => { + const dir = st.testdir() + npm.cache = npm.flatOptions.cache = dir + npm.localDir = dir + npm.globalDir = dir + npm.localBin = dir + npm.globalBin = dir + const _verifyResponse = verifyResponse + verifyResponse = { + ...verifyResponse, + reclaimedCount: 1, + reclaimedSize: 100, + } + const consoleError = console.error + // we just print an empty line here, so swallow it and ignore + console.error = () => {} + + st.teardown(() => { + delete npm.cache + delete npm.flatOptions.cache + delete npm.localDir + delete npm.globalDir + delete npm.localBin + delete npm.globalBin + verifyResponse = _verifyResponse + console.error = consoleError + clearLogs() + }) + + doctor([], (err) => { + // cache verification problems get fixed and so do not throw an error + if (err) { + st.fail(output) + return st.end() + } + + st.match(logs, { + checkPing: { finished: true }, + getLatestNpmVersion: { finished: true }, + getLatestNodejsVersion: { finished: true }, + getGitPath: { finished: true }, + [dir]: { finished: true }, + verifyCachedFiles: { finished: true }, + }, 'trackers all finished') + st.match(output, /npm ping\s*ok/, 'ping output is ok') + st.match(output, /npm -v\s*ok/, 'npm -v output is ok') + st.match(output, /node -v\s*ok/, 'node -v output is ok') + st.match(output, /npm config get registry\s*ok\s*using default/, 'npm config get registry output is ok') + st.match(output, /which git\s*ok/, 'which git output is ok') + st.match(output, /cached files\s*ok/, 'cached files are ok') + st.match(output, /local node_modules\s*ok/, 'local node_modules are ok') + st.match(output, /global node_modules\s*ok/, 'global node_modules are ok') + st.match(output, /local bin folder\s*ok/, 'local bin is ok') + st.match(output, /global bin folder\s*ok/, 'global bin is ok') + st.match(output, /cache contents\s*ok/, 'cache contents is not ok') + st.end() + }) + }) + + vt.test('npm doctor cache verification showed missing content', st => { + const dir = t.testdir() + npm.cache = npm.flatOptions.cache = dir + npm.localDir = dir + npm.globalDir = dir + npm.localBin = dir + npm.globalBin = dir + const _verifyResponse = verifyResponse + verifyResponse = { + ...verifyResponse, + missingContent: 1, + } + const consoleError = console.error + // we just print an empty line here, so swallow it and ignore + console.error = () => {} + + st.teardown(() => { + delete npm.cache + delete npm.flatOptions.cache + delete npm.localDir + delete npm.globalDir + delete npm.localBin + delete npm.globalBin + verifyResponse = _verifyResponse + console.error = consoleError + clearLogs() + }) + + doctor([], (err) => { + // cache verification problems get fixed and so do not throw an error + if (err) { + st.fail(output) + return st.end() + } + + st.match(logs, { + checkPing: { finished: true }, + getLatestNpmVersion: { finished: true }, + getLatestNodejsVersion: { finished: true }, + getGitPath: { finished: true }, + [dir]: { finished: true }, + verifyCachedFiles: { finished: true }, + }, 'trackers all finished') + st.match(output, /npm ping\s*ok/, 'ping output is ok') + st.match(output, /npm -v\s*ok/, 'npm -v output is ok') + st.match(output, /node -v\s*ok/, 'node -v output is ok') + st.match(output, /npm config get registry\s*ok\s*using default/, 'npm config get registry output is ok') + st.match(output, /which git\s*ok/, 'which git output is ok') + st.match(output, /cached files\s*ok/, 'cached files are ok') + st.match(output, /local node_modules\s*ok/, 'local node_modules are ok') + st.match(output, /global node_modules\s*ok/, 'global node_modules are ok') + st.match(output, /local bin folder\s*ok/, 'local bin is ok') + st.match(output, /global bin folder\s*ok/, 'global bin is ok') + st.match(output, /cache contents\s*ok/, 'cache contents is not ok') + st.end() + }) + }) + + vt.test('npm doctor not using default registry', st => { + const dir = st.testdir() + npm.cache = npm.flatOptions.cache = dir + npm.localDir = dir + npm.globalDir = dir + npm.localBin = dir + npm.globalBin = dir + const _currentRegistry = npm.flatOptions.registry + npm.flatOptions.registry = 'https://google.com' + const consoleError = console.error + // we just print an empty line here, so swallow it and ignore + console.error = () => {} + + st.teardown(() => { + delete npm.cache + delete npm.flatOptions.cache + delete npm.localDir + delete npm.globalDir + delete npm.localBin + delete npm.globalBin + npm.flatOptions.registry = _currentRegistry + console.error = consoleError + clearLogs() + }) + + doctor([], (err) => { + // cache verification problems get fixed and so do not throw an error + st.match(err, /Some problems found/, 'detected the non-default registry') + st.match(logs, { + checkPing: { finished: true }, + getLatestNpmVersion: { finished: true }, + getLatestNodejsVersion: { finished: true }, + getGitPath: { finished: true }, + [dir]: { finished: true }, + verifyCachedFiles: { finished: true }, + }, 'trackers all finished') + st.match(output, /npm ping\s*ok/, 'ping output is ok') + st.match(output, /npm -v\s*ok/, 'npm -v output is ok') + st.match(output, /node -v\s*ok/, 'node -v output is ok') + st.match(output, /npm config get registry\s*not ok/, 'npm config get registry output is not ok') + st.match(output, /which git\s*ok/, 'which git output is ok') + st.match(output, /cached files\s*ok/, 'cached files are ok') + st.match(output, /local node_modules\s*ok/, 'local node_modules are ok') + st.match(output, /global node_modules\s*ok/, 'global node_modules are ok') + st.match(output, /local bin folder\s*ok/, 'local bin is ok') + st.match(output, /global bin folder\s*ok/, 'global bin is ok') + st.match(output, /cache contents\s*ok/, 'cache contents is ok') + st.end() + }) + }) + + vt.end() + }) }) }) -test('npm doctor ping error E{3}', t => { - const dir = t.testdir() - npm.cache = npm.flatOptions.cache = dir - npm.localDir = dir - npm.globalDir = dir - npm.localBin = dir - npm.globalBin = dir - pingError = { code: 'E111', message: 'this error is 111' } - const consoleError = console.error - // we just print an empty line here, so swallow it and ignore - console.error = () => {} - - t.teardown(() => { - delete npm.cache - delete npm.flatOptions.cache - delete npm.localDir - delete npm.globalDir - delete npm.localBin - delete npm.globalBin - pingError = null - console.error = consoleError - clearLogs() - }) - - doctor([], (err) => { - t.match(err, /Some problems found/, 'detected the ping error') - t.match(logs, { - checkPing: { finished: true }, - getLatestNpmVersion: { finished: true }, - getLatestNodejsVersion: { finished: true }, - getGitPath: { finished: true }, - [dir]: { finished: true }, - verifyCachedFiles: { finished: true }, - }, 'trackers all finished') - t.match(output, /npm ping\s*not ok\s*111 this error is 111/, 'ping output contains trimmed error') - t.match(output, /npm -v\s*ok/, 'npm -v output is ok') - t.match(output, /node -v\s*ok/, 'node -v output is ok') - t.match(output, /npm config get registry\s*ok\s*using default/, 'npm config get registry output is ok') - t.match(output, /which git\s*ok/, 'which git output is ok') - t.match(output, /cached files\s*ok/, 'cached files are ok') - t.match(output, /local node_modules\s*ok/, 'local node_modules are ok') - t.match(output, /global node_modules\s*ok/, 'global node_modules are ok') - t.match(output, /local bin folder\s*ok/, 'local bin is ok') - t.match(output, /global bin folder\s*ok/, 'global bin is ok') - t.match(output, /cache contents\s*ok/, 'cache contents is ok') - t.end() - }) -}) - -test('npm doctor generic ping error', t => { - const dir = t.testdir() - npm.cache = npm.flatOptions.cache = dir - npm.localDir = dir - npm.globalDir = dir - npm.localBin = dir - npm.globalBin = dir - pingError = { message: 'generic error' } - const consoleError = console.error - // we just print an empty line here, so swallow it and ignore - console.error = () => {} - - t.teardown(() => { - delete npm.cache - delete npm.flatOptions.cache - delete npm.localDir - delete npm.globalDir - delete npm.localBin - delete npm.globalBin - pingError = null - console.error = consoleError - clearLogs() - }) - - doctor([], (err) => { - t.match(err, /Some problems found/, 'detected the ping error') - t.match(logs, { - checkPing: { finished: true }, - getLatestNpmVersion: { finished: true }, - getLatestNodejsVersion: { finished: true }, - getGitPath: { finished: true }, - [dir]: { finished: true }, - verifyCachedFiles: { finished: true }, - }, 'trackers all finished') - t.match(output, /npm ping\s*not ok\s*generic error/, 'ping output contains trimmed error') - t.match(output, /npm -v\s*ok/, 'npm -v output is ok') - t.match(output, /node -v\s*ok/, 'node -v output is ok') - t.match(output, /npm config get registry\s*ok\s*using default/, 'npm config get registry output is ok') - t.match(output, /which git\s*ok/, 'which git output is ok') - t.match(output, /cached files\s*ok/, 'cached files are ok') - t.match(output, /local node_modules\s*ok/, 'local node_modules are ok') - t.match(output, /global node_modules\s*ok/, 'global node_modules are ok') - t.match(output, /local bin folder\s*ok/, 'local bin is ok') - t.match(output, /global bin folder\s*ok/, 'global bin is ok') - t.match(output, /cache contents\s*ok/, 'cache contents is ok') - t.end() - }) -}) - -test('npm doctor outdated npm version', t => { - const dir = t.testdir() - npm.cache = npm.flatOptions.cache = dir - npm.localDir = dir - npm.globalDir = dir - npm.localBin = dir - npm.globalBin = dir - latestNpm = '7.1.1' - const consoleError = console.error - // we just print an empty line here, so swallow it and ignore - console.error = () => {} - - t.teardown(() => { - delete npm.cache - delete npm.flatOptions.cache - delete npm.localDir - delete npm.globalDir - delete npm.localBin - delete npm.globalBin - latestNpm = npm.version - console.error = consoleError - clearLogs() - }) - - doctor([], (err) => { - t.match(err, /Some problems found/, 'detected the out of date npm') - t.match(logs, { - checkPing: { finished: true }, - getLatestNpmVersion: { finished: true }, - getLatestNodejsVersion: { finished: true }, - getGitPath: { finished: true }, - [dir]: { finished: true }, - verifyCachedFiles: { finished: true }, - }, 'trackers all finished') - t.match(output, /npm ping\s*ok/, 'ping output is ok') - t.match(output, /npm -v\s*not ok/, 'npm -v output is not ok') - t.match(output, /node -v\s*ok/, 'node -v output is ok') - t.match(output, /npm config get registry\s*ok\s*using default/, 'npm config get registry output is ok') - t.match(output, /which git\s*ok/, 'which git output is ok') - t.match(output, /cached files\s*ok/, 'cached files are ok') - t.match(output, /local node_modules\s*ok/, 'local node_modules are ok') - t.match(output, /global node_modules\s*ok/, 'global node_modules are ok') - t.match(output, /local bin folder\s*ok/, 'local bin is ok') - t.match(output, /global bin folder\s*ok/, 'global bin is ok') - t.match(output, /cache contents\s*ok/, 'cache contents is ok') - t.end() - }) -}) - -test('npm doctor outdated nodejs version', t => { - const dir = t.testdir() - npm.cache = npm.flatOptions.cache = dir - npm.localDir = dir - npm.globalDir = dir - npm.localBin = dir - npm.globalBin = dir - nodeVersions.push({ version: process.version.replace(/\d+(-.*)?$/, '999'), lts: false }) - const consoleError = console.error - // we just print an empty line here, so swallow it and ignore - console.error = () => {} - - t.teardown(() => { - delete npm.cache - delete npm.flatOptions.cache - delete npm.localDir - delete npm.globalDir - delete npm.localBin - delete npm.globalBin - nodeVersions.pop() - console.error = consoleError - clearLogs() - }) - - doctor([], (err) => { - t.match(err, /Some problems found/, 'detected the out of date nodejs') - t.match(logs, { - checkPing: { finished: true }, - getLatestNpmVersion: { finished: true }, - getLatestNodejsVersion: { finished: true }, - getGitPath: { finished: true }, - [dir]: { finished: true }, - verifyCachedFiles: { finished: true }, - }, 'trackers all finished') - t.match(output, /npm ping\s*ok/, 'ping output is ok') - t.match(output, /npm -v\s*ok/, 'npm -v output is ok') - t.match(output, /node -v\s*not ok/, 'node -v output is not ok') - t.match(output, /npm config get registry\s*ok\s*using default/, 'npm config get registry output is ok') - t.match(output, /which git\s*ok/, 'which git output is ok') - t.match(output, /cached files\s*ok/, 'cached files are ok') - t.match(output, /local node_modules\s*ok/, 'local node_modules are ok') - t.match(output, /global node_modules\s*ok/, 'global node_modules are ok') - t.match(output, /local bin folder\s*ok/, 'local bin is ok') - t.match(output, /global bin folder\s*ok/, 'global bin is ok') - t.match(output, /cache contents\s*ok/, 'cache contents is ok') - t.end() - }) -}) - -test('npm doctor file permission checks', t => { - const dir = t.testdir({ - cache: { - one: 'one', - link: t.fixture('symlink', './one'), - unreadable: 'unreadable', - baddir: {}, - }, - local: { - two: 'two', - notmine: 'notmine', - }, - global: { - three: 'three', - broken: 'broken', - }, - localBin: { - four: 'four', - five: 'five', - }, - globalBin: { - six: 'six', - seven: 'seven', - }, - }) - - const _fsLstat = fs.lstat - fs.lstat = (p, cb) => { - let err = null - let stat = null - - try { - stat = fs.lstatSync(p) - } catch (err) { - return cb(err) - } - - switch (p) { - case join(dir, 'local', 'notmine'): - stat.uid += 1 - stat.gid += 1 - break - case join(dir, 'global', 'broken'): - err = new Error('broken') - break - } - - return cb(err, stat) - } - - const _fsReaddir = fs.readdir - fs.readdir = (p, cb) => { - let err = null - let result = null - - try { - result = fs.readdirSync(p) - } catch (err) { - return cb(err) - } - - if (p === join(dir, 'cache', 'baddir')) - err = new Error('broken') - - return cb(err, result) - } - - const _fsAccess = fs.access - fs.access = (p, mask, cb) => { - const err = new Error('failed') - switch (p) { - case join(dir, 'cache', 'unreadable'): - case join(dir, 'localBin', 'four'): - case join(dir, 'globalBin', 'six'): - return cb(err) - default: - return cb(null) - } - } - - const doctor = requireInject('../../lib/doctor.js', { - '../../lib/utils/is-windows.js': false, - '../../lib/utils/ping.js': ping, - '../../lib/utils/output.js': (data) => { - output.push(data) - }, - '../../lib/npm.js': npm, - cacache, - pacote, - 'make-fetch-happen': fetch, - which, - fs, - }) - // it's necessary to allow tests in node 10.x to not mark 12.x as lted - - npm.cache = npm.flatOptions.cache = join(dir, 'cache') - npm.localDir = join(dir, 'local') - npm.globalDir = join(dir, 'global') - npm.localBin = join(dir, 'localBin') - npm.globalBin = join(dir, 'globalBin') - const _consoleError = console.error - console.error = () => {} - - t.teardown(() => { - delete npm.cache - delete npm.flatOptions.cache - delete npm.localDir - delete npm.globalDir - delete npm.localBin - delete npm.globalBin - console.error = _consoleError - fs.lstat = _fsLstat - fs.readdir = _fsReaddir - fs.access = _fsAccess - clearLogs() - }) - - doctor([], (err) => { - t.match(err, /Some problems found/, 'identified problems') - t.match(logs, { - checkPing: { finished: true }, - getLatestNpmVersion: { finished: true }, - getLatestNodejsVersion: { finished: true }, - getGitPath: { finished: true }, - [join(dir, 'cache')]: { finished: true }, - [join(dir, 'local')]: { finished: true }, - [join(dir, 'global')]: { finished: true }, - [join(dir, 'localBin')]: { finished: true }, - [join(dir, 'globalBin')]: { finished: true }, - verifyCachedFiles: { finished: true }, - }, 'trackers all finished') - t.match(output, /npm ping\s*ok/, 'ping output is ok') - t.match(output, /npm -v\s*ok/, 'npm -v output is ok') - t.match(output, /node -v\s*ok/, 'node -v output is ok') - t.match(output, /npm config get registry\s*ok\s*using default/, 'npm config get registry output is ok') - t.match(output, /which git\s*ok/, 'which git output is ok') - t.match(output, /cached files\s*not ok/, 'cached files are not ok') - t.match(output, /local node_modules\s*not ok/, 'local node_modules are not ok') - t.match(output, /global node_modules\s*not ok/, 'global node_modules are not ok') - t.match(output, /local bin folder\s*not ok/, 'local bin is not ok') - t.match(output, /global bin folder\s*not ok/, 'global bin is not ok') - t.match(output, /cache contents\s*ok/, 'cache contents is ok') - t.end() - }) -}) - -test('npm doctor missing git', t => { - const dir = t.testdir() - npm.cache = npm.flatOptions.cache = dir - npm.localDir = dir - npm.globalDir = dir - npm.localBin = dir - npm.globalBin = dir - whichError = new Error('boom') - const consoleError = console.error - // we just print an empty line here, so swallow it and ignore - console.error = () => {} - - t.teardown(() => { - delete npm.cache - delete npm.flatOptions.cache - delete npm.localDir - delete npm.globalDir - delete npm.localBin - delete npm.globalBin - whichError = null - console.error = consoleError - clearLogs() - }) - - doctor([], (err) => { - t.match(err, /Some problems found/, 'detected the missing git') - t.match(logs, { - checkPing: { finished: true }, - getLatestNpmVersion: { finished: true }, - getLatestNodejsVersion: { finished: true }, - getGitPath: { finished: true }, - [dir]: { finished: true }, - verifyCachedFiles: { finished: true }, - }, 'trackers all finished') - t.match(output, /npm ping\s*ok/, 'ping output is ok') - t.match(output, /npm -v\s*ok/, 'npm -v output is ok') - t.match(output, /node -v\s*ok/, 'node -v output is ok') - t.match(output, /npm config get registry\s*ok\s*using default/, 'npm config get registry output is ok') - t.match(output, /which git\s*not ok/, 'which git output is not ok') - t.match(output, /cached files\s*ok/, 'cached files are ok') - t.match(output, /local node_modules\s*ok/, 'local node_modules are ok') - t.match(output, /global node_modules\s*ok/, 'global node_modules are ok') - t.match(output, /local bin folder\s*ok/, 'local bin is ok') - t.match(output, /global bin folder\s*ok/, 'global bin is ok') - t.match(output, /cache contents\s*ok/, 'cache contents is ok') - t.end() - }) -}) - -test('npm doctor cache verification showed bad content', t => { - const dir = t.testdir() - npm.cache = npm.flatOptions.cache = dir - npm.localDir = dir - npm.globalDir = dir - npm.localBin = dir - npm.globalBin = dir - const _verifyResponse = verifyResponse - verifyResponse = { - ...verifyResponse, - badContentCount: 1, - } - const consoleError = console.error - // we just print an empty line here, so swallow it and ignore - console.error = () => {} - - t.teardown(() => { - delete npm.cache - delete npm.flatOptions.cache - delete npm.localDir - delete npm.globalDir - delete npm.localBin - delete npm.globalBin - verifyResponse = _verifyResponse - console.error = consoleError - clearLogs() - }) - - doctor([], (err) => { - // cache verification problems get fixed and so do not throw an error - if (err) { - t.fail(output) - return t.end() - } - - t.match(logs, { - checkPing: { finished: true }, - getLatestNpmVersion: { finished: true }, - getLatestNodejsVersion: { finished: true }, - getGitPath: { finished: true }, - [dir]: { finished: true }, - verifyCachedFiles: { finished: true }, - }, 'trackers all finished') - t.match(output, /npm ping\s*ok/, 'ping output is ok') - t.match(output, /npm -v\s*ok/, 'npm -v output is ok') - t.match(output, /node -v\s*ok/, 'node -v output is ok') - t.match(output, /npm config get registry\s*ok\s*using default/, 'npm config get registry output is ok') - t.match(output, /which git\s*ok/, 'which git output is ok') - t.match(output, /cached files\s*ok/, 'cached files are ok') - t.match(output, /local node_modules\s*ok/, 'local node_modules are ok') - t.match(output, /global node_modules\s*ok/, 'global node_modules are ok') - t.match(output, /local bin folder\s*ok/, 'local bin is ok') - t.match(output, /global bin folder\s*ok/, 'global bin is ok') - t.match(output, /cache contents\s*ok/, 'cache contents is not ok') - t.end() - }) -}) - -test('npm doctor cache verification showed reclaimed content', t => { - const dir = t.testdir() - npm.cache = npm.flatOptions.cache = dir - npm.localDir = dir - npm.globalDir = dir - npm.localBin = dir - npm.globalBin = dir - const _verifyResponse = verifyResponse - verifyResponse = { - ...verifyResponse, - reclaimedCount: 1, - reclaimedSize: 100, - } - const consoleError = console.error - // we just print an empty line here, so swallow it and ignore - console.error = () => {} - - t.teardown(() => { - delete npm.cache - delete npm.flatOptions.cache - delete npm.localDir - delete npm.globalDir - delete npm.localBin - delete npm.globalBin - verifyResponse = _verifyResponse - console.error = consoleError - clearLogs() - }) - - doctor([], (err) => { - // cache verification problems get fixed and so do not throw an error - if (err) { - t.fail(output) - return t.end() - } - - t.match(logs, { - checkPing: { finished: true }, - getLatestNpmVersion: { finished: true }, - getLatestNodejsVersion: { finished: true }, - getGitPath: { finished: true }, - [dir]: { finished: true }, - verifyCachedFiles: { finished: true }, - }, 'trackers all finished') - t.match(output, /npm ping\s*ok/, 'ping output is ok') - t.match(output, /npm -v\s*ok/, 'npm -v output is ok') - t.match(output, /node -v\s*ok/, 'node -v output is ok') - t.match(output, /npm config get registry\s*ok\s*using default/, 'npm config get registry output is ok') - t.match(output, /which git\s*ok/, 'which git output is ok') - t.match(output, /cached files\s*ok/, 'cached files are ok') - t.match(output, /local node_modules\s*ok/, 'local node_modules are ok') - t.match(output, /global node_modules\s*ok/, 'global node_modules are ok') - t.match(output, /local bin folder\s*ok/, 'local bin is ok') - t.match(output, /global bin folder\s*ok/, 'global bin is ok') - t.match(output, /cache contents\s*ok/, 'cache contents is not ok') - t.end() - }) -}) - -test('npm doctor cache verification showed missing content', t => { - const dir = t.testdir() - npm.cache = npm.flatOptions.cache = dir - npm.localDir = dir - npm.globalDir = dir - npm.localBin = dir - npm.globalBin = dir - const _verifyResponse = verifyResponse - verifyResponse = { - ...verifyResponse, - missingContent: 1, - } - const consoleError = console.error - // we just print an empty line here, so swallow it and ignore - console.error = () => {} - - t.teardown(() => { - delete npm.cache - delete npm.flatOptions.cache - delete npm.localDir - delete npm.globalDir - delete npm.localBin - delete npm.globalBin - verifyResponse = _verifyResponse - console.error = consoleError - clearLogs() - }) - - doctor([], (err) => { - // cache verification problems get fixed and so do not throw an error - if (err) { - t.fail(output) - return t.end() - } - - t.match(logs, { - checkPing: { finished: true }, - getLatestNpmVersion: { finished: true }, - getLatestNodejsVersion: { finished: true }, - getGitPath: { finished: true }, - [dir]: { finished: true }, - verifyCachedFiles: { finished: true }, - }, 'trackers all finished') - t.match(output, /npm ping\s*ok/, 'ping output is ok') - t.match(output, /npm -v\s*ok/, 'npm -v output is ok') - t.match(output, /node -v\s*ok/, 'node -v output is ok') - t.match(output, /npm config get registry\s*ok\s*using default/, 'npm config get registry output is ok') - t.match(output, /which git\s*ok/, 'which git output is ok') - t.match(output, /cached files\s*ok/, 'cached files are ok') - t.match(output, /local node_modules\s*ok/, 'local node_modules are ok') - t.match(output, /global node_modules\s*ok/, 'global node_modules are ok') - t.match(output, /local bin folder\s*ok/, 'local bin is ok') - t.match(output, /global bin folder\s*ok/, 'global bin is ok') - t.match(output, /cache contents\s*ok/, 'cache contents is not ok') - t.end() - }) -}) +test('outdated node version', vt => { + vt.plan(1) + const version = 'v10.0.0' -test('npm doctor not using default registry', t => { - const dir = t.testdir() - npm.cache = npm.flatOptions.cache = dir - npm.localDir = dir - npm.globalDir = dir - npm.localBin = dir - npm.globalBin = dir - const _currentRegistry = npm.flatOptions.registry - npm.flatOptions.registry = 'https://google.com' - const consoleError = console.error - // we just print an empty line here, so swallow it and ignore - console.error = () => {} - - t.teardown(() => { - delete npm.cache - delete npm.flatOptions.cache - delete npm.localDir - delete npm.globalDir - delete npm.localBin - delete npm.globalBin - npm.flatOptions.registry = _currentRegistry - console.error = consoleError - clearLogs() + Object.defineProperty(process, 'version', { value: version }) + vt.teardown(() => { + Object.defineProperty(process, 'version', { value: origVersion }) }) - doctor([], (err) => { - // cache verification problems get fixed and so do not throw an error - t.match(err, /Some problems found/, 'detected the non-default registry') - t.match(logs, { - checkPing: { finished: true }, - getLatestNpmVersion: { finished: true }, - getLatestNodejsVersion: { finished: true }, - getGitPath: { finished: true }, - [dir]: { finished: true }, - verifyCachedFiles: { finished: true }, - }, 'trackers all finished') - t.match(output, /npm ping\s*ok/, 'ping output is ok') - t.match(output, /npm -v\s*ok/, 'npm -v output is ok') - t.match(output, /node -v\s*ok/, 'node -v output is ok') - t.match(output, /npm config get registry\s*not ok/, 'npm config get registry output is not ok') - t.match(output, /which git\s*ok/, 'which git output is ok') - t.match(output, /cached files\s*ok/, 'cached files are ok') - t.match(output, /local node_modules\s*ok/, 'local node_modules are ok') - t.match(output, /global node_modules\s*ok/, 'global node_modules are ok') - t.match(output, /local bin folder\s*ok/, 'local bin is ok') - t.match(output, /global bin folder\s*ok/, 'global bin is ok') - t.match(output, /cache contents\s*ok/, 'cache contents is ok') - t.end() + vt.test('npm doctor outdated nodejs version', st => { + const dir = st.testdir() + npm.cache = npm.flatOptions.cache = dir + npm.localDir = dir + npm.globalDir = dir + npm.localBin = dir + npm.globalBin = dir + nodeVersions.push({ version: process.version.replace(/\d+(-.*)?$/, '999'), lts: false }) + const consoleError = console.error + // we just print an empty line here, so swallow it and ignore + console.error = () => {} + + st.teardown(() => { + delete npm.cache + delete npm.flatOptions.cache + delete npm.localDir + delete npm.globalDir + delete npm.localBin + delete npm.globalBin + nodeVersions.pop() + console.error = consoleError + clearLogs() + }) + + doctor([], (err) => { + st.match(err, /Some problems found/, 'detected the out of date nodejs') + st.match(logs, { + checkPing: { finished: true }, + getLatestNpmVersion: { finished: true }, + getLatestNodejsVersion: { finished: true }, + getGitPath: { finished: true }, + [dir]: { finished: true }, + verifyCachedFiles: { finished: true }, + }, 'trackers all finished') + st.match(output, /npm ping\s*ok/, 'ping output is ok') + st.match(output, /npm -v\s*ok/, 'npm -v output is ok') + st.match(output, /node -v\s*not ok/, 'node -v output is not ok') + st.match(output, /npm config get registry\s*ok\s*using default/, 'npm config get registry output is ok') + st.match(output, /which git\s*ok/, 'which git output is ok') + st.match(output, /cached files\s*ok/, 'cached files are ok') + st.match(output, /local node_modules\s*ok/, 'local node_modules are ok') + st.match(output, /global node_modules\s*ok/, 'global node_modules are ok') + st.match(output, /local bin folder\s*ok/, 'local bin is ok') + st.match(output, /global bin folder\s*ok/, 'global bin is ok') + st.match(output, /cache contents\s*ok/, 'cache contents is ok') + st.end() + }) }) }) diff --git a/deps/npm/test/lib/help.js b/deps/npm/test/lib/help.js index 40a0354210b92e..fc4a32e07beaaf 100644 --- a/deps/npm/test/lib/help.js +++ b/deps/npm/test/lib/help.js @@ -101,20 +101,13 @@ test('npm help completion', async t => { t.teardown(() => { globErr = null }) - const completion = (opts) => new Promise((resolve, reject) => { - help.completion(opts, (err, res) => { - if (err) - return reject(err) - return resolve(res) - }) - }) - const noArgs = await completion({ conf: { argv: { remain: [] } } }) + const noArgs = await help.completion({ conf: { argv: { remain: [] } } }) t.strictSame(noArgs, ['help', 'whoami', 'npmrc', 'disputes'], 'outputs available help pages') - const threeArgs = await completion({ conf: { argv: { remain: ['one', 'two', 'three'] } } }) + const threeArgs = await help.completion({ conf: { argv: { remain: ['one', 'two', 'three'] } } }) t.strictSame(threeArgs, [], 'outputs no results when more than 2 args are provided') globErr = new Error('glob failed') - t.rejects(completion({ conf: { argv: { remain: [] } } }), /glob failed/, 'glob errors propagate') + t.rejects(help.completion({ conf: { argv: { remain: [] } } }), /glob failed/, 'glob errors propagate') }) test('npm help -h', t => { diff --git a/deps/npm/test/lib/install.js b/deps/npm/test/lib/install.js index 177952b9e9d662..859a4bdaaaafde 100644 --- a/deps/npm/test/lib/install.js +++ b/deps/npm/test/lib/install.js @@ -130,7 +130,7 @@ test('should install globally using Arborist', (t) => { }) }) -test('completion to folder', (t) => { +test('completion to folder', async t => { const install = requireInject('../../lib/install.js', { '../../lib/utils/reify-finish.js': async () => {}, util: { @@ -145,17 +145,13 @@ test('completion to folder', (t) => { }, }, }) - install.completion({ - partialWord: '/ar', - }, (er, res) => { - t.equal(er, null) - const expect = process.platform === 'win32' ? '\\arborist' : '/arborist' - t.strictSame(res, [expect], 'package dir match') - t.end() - }) + const res = await install.completion({ partialWord: '/ar' }) + const expect = process.platform === 'win32' ? '\\arborist' : '/arborist' + t.strictSame(res, [expect], 'package dir match') + t.end() }) -test('completion to folder - invalid dir', (t) => { +test('completion to folder - invalid dir', async t => { const install = requireInject('../../lib/install.js', { '../../lib/utils/reify-finish.js': async () => {}, util: { @@ -167,16 +163,12 @@ test('completion to folder - invalid dir', (t) => { }, }, }) - install.completion({ - partialWord: 'path/to/folder', - }, (er, res) => { - t.equal(er, null) - t.strictSame(res, [], 'invalid dir: no matching') - t.end() - }) + const res = await install.completion({ partialWord: 'path/to/folder' }) + t.strictSame(res, [], 'invalid dir: no matching') + t.end() }) -test('completion to folder - no matches', (t) => { +test('completion to folder - no matches', async t => { const install = requireInject('../../lib/install.js', { '../../lib/utils/reify-finish.js': async () => {}, util: { @@ -188,16 +180,12 @@ test('completion to folder - no matches', (t) => { }, }, }) - install.completion({ - partialWord: '/pa', - }, (er, res) => { - t.equal(er, null) - t.strictSame(res, [], 'no name match') - t.end() - }) + const res = await install.completion({ partialWord: '/pa' }) + t.strictSame(res, [], 'no name match') + t.end() }) -test('completion to folder - match is not a package', (t) => { +test('completion to folder - match is not a package', async t => { const install = requireInject('../../lib/install.js', { '../../lib/utils/reify-finish.js': async () => {}, util: { @@ -212,31 +200,19 @@ test('completion to folder - match is not a package', (t) => { }, }, }) - install.completion({ - partialWord: '/ar', - }, (er, res) => { - t.equal(er, null) - t.strictSame(res, [], 'no name match') - t.end() - }) + const res = await install.completion({ partialWord: '/ar' }) + t.strictSame(res, [], 'no name match') + t.end() }) -test('completion to url', (t) => { - install.completion({ - partialWord: 'http://path/to/url', - }, (er, res) => { - t.equal(er, null) - t.strictSame(res, []) - t.end() - }) +test('completion to url', async t => { + const res = await install.completion({ partialWord: 'http://path/to/url' }) + t.strictSame(res, []) + t.end() }) -test('completion', (t) => { - install.completion({ - partialWord: 'toto', - }, (er, res) => { - t.notOk(er) - t.notOk(res) - t.end() - }) +test('completion', async t => { + const res = await install.completion({ partialWord: 'toto' }) + t.notOk(res) + t.end() }) diff --git a/deps/npm/test/lib/link.js b/deps/npm/test/lib/link.js index c39026a49163f6..b1048427d78f3a 100644 --- a/deps/npm/test/lib/link.js +++ b/deps/npm/test/lib/link.js @@ -317,7 +317,7 @@ t.test('link pkg already in global space when prefix is a symlink', (t) => { }) }) -t.test('completion', (t) => { +t.test('completion', async t => { const testdir = t.testdir({ 'global-prefix': { lib: { @@ -332,31 +332,30 @@ t.test('completion', (t) => { }) npm.globalDir = resolve(testdir, 'global-prefix', 'lib', 'node_modules') - link.completion({}, (err, words) => { - t.ifError(err, 'should not error out') - t.deepEqual( - words, - ['bar', 'foo', 'ipsum', 'lorem'], - 'should list all package names available in globalDir' - ) - t.end() - }) + const words = await link.completion({}) + t.deepEqual( + words, + ['bar', 'foo', 'ipsum', 'lorem'], + 'should list all package names available in globalDir' + ) + t.end() }) -t.test('--global option', (t) => { +t.test('--global option', async t => { const _config = npm.config npm.config = { get () { return true } } - link([], (err) => { + try { + await link([]) + t.fail('should not get here') + } catch (err) { npm.config = _config - t.match( err.message, /link should never be --global/, 'should throw an useful error' ) - - t.end() - }) + } + t.end() }) diff --git a/deps/npm/test/lib/load-all-commands.js b/deps/npm/test/lib/load-all-commands.js index fa73b8a78d8fa2..02cb0be650c902 100644 --- a/deps/npm/test/lib/load-all-commands.js +++ b/deps/npm/test/lib/load-all-commands.js @@ -12,11 +12,14 @@ t.test('load each command', t => { t.plan(cmdList.length) for (const cmd of cmdList.sort((a, b) => a.localeCompare(b))) { t.test(cmd, t => { - t.plan(3) const impl = npm.commands[cmd] + if (impl.completion) { + t.plan(3) + t.isa(impl.completion, 'function', 'completion, if present, is a function') + } else + t.plan(2) t.isa(impl, 'function', 'implementation is a function') t.isa(impl.usage, 'string', 'usage is a string') - t.isa(impl.completion, 'function', 'completion is a function') }) } }) diff --git a/deps/npm/test/lib/ls.js b/deps/npm/test/lib/ls.js index a9504a2ad055ca..b1df9067c3d575 100644 --- a/deps/npm/test/lib/ls.js +++ b/deps/npm/test/lib/ls.js @@ -3,6 +3,12 @@ const { resolve } = require('path') const t = require('tap') const requireInject = require('require-inject') +const { utimesSync } = require('fs') +const touchHiddenPackageLock = prefix => { + const later = new Date(Date.now() + 10000) + utimesSync(`${prefix}/node_modules/.package-lock.json`, later, later) +} + t.cleanSnapshot = str => str.split(/\r\n/).join('\n') const simpleNmFixture = { @@ -1160,6 +1166,19 @@ t.test('ls', (t) => { }, }), node_modules: { + '.package-lock.json': JSON.stringify({ + packages: { + 'node_modules/a': { + name: 'b', + version: '1.0.0', + from: 'a@npm:b', + resolved: 'https://localhost:8080/abbrev/-/abbrev-1.1.1.tgz', + requested: { + type: 'alias', + }, + }, + }, + }), a: { 'package.json': JSON.stringify({ name: 'b', @@ -1173,6 +1192,7 @@ t.test('ls', (t) => { }, }, }) + touchHiddenPackageLock(prefix) ls([], () => { t.matchSnapshot(redactCwd(result), 'should output tree containing aliases') t.end() @@ -1189,6 +1209,16 @@ t.test('ls', (t) => { }, }), node_modules: { + '.package-lock.json': JSON.stringify({ + packages: { + 'node_modules/abbrev': { + name: 'abbrev', + version: '1.1.1', + from: 'git+https://github.com/isaacs/abbrev-js.git', + resolved: 'git+https://github.com/isaacs/abbrev-js.git#b8f3a2fc0c3bb8ffd8b0d0072cc6b5a3667e963c', + }, + }, + }), abbrev: { 'package.json': JSON.stringify({ name: 'abbrev', @@ -1208,6 +1238,7 @@ t.test('ls', (t) => { }, }, }) + touchHiddenPackageLock(prefix) ls([], (err) => { t.ifError(err, 'npm ls') t.matchSnapshot(redactCwd(result), 'should output tree containing git refs') @@ -1269,6 +1300,16 @@ t.test('ls', (t) => { }, }), node_modules: { + '.package-lock.json': JSON.stringify({ + packages: { + 'node_modules/simple-output': { + name: 'simple-output', + version: '2.1.1', + resolved: 'https://registry.npmjs.org/simple-output/-/simple-output-2.1.1.tgz', + shasum: '3c07708ec9ef3e3c985cf0ddd67df09ab8ec2abc', + }, + }, + }), 'simple-output': { 'package.json': JSON.stringify({ name: 'simple-output', @@ -1296,6 +1337,7 @@ t.test('ls', (t) => { }, }, }) + touchHiddenPackageLock(prefix) ls([], () => { t.matchSnapshot(redactCwd(result), 'should not be printed in tree output') t.end() @@ -2173,6 +2215,15 @@ t.test('ls --parseable', (t) => { }, }), node_modules: { + '.package-lock.json': JSON.stringify({ + packages: { + 'node_modules/a': { + name: 'b', + version: '1.0.0', + resolved: 'https://localhost:8080/abbrev/-/abbrev-1.1.1.tgz', + }, + }, + }), a: { 'package.json': JSON.stringify({ name: 'b', @@ -2186,6 +2237,7 @@ t.test('ls --parseable', (t) => { }, }, }) + touchHiddenPackageLock(prefix) ls([], () => { t.matchSnapshot(redactCwd(result), 'should output tree containing aliases') t.end() @@ -2202,6 +2254,15 @@ t.test('ls --parseable', (t) => { }, }), node_modules: { + '.package-lock.json': JSON.stringify({ + packages: { + 'node_modules/abbrev': { + name: 'abbrev', + version: '1.1.1', + resolved: 'git+https://github.com/isaacs/abbrev-js.git#b8f3a2fc0c3bb8ffd8b0d0072cc6b5a3667e963c', + }, + }, + }), abbrev: { 'package.json': JSON.stringify({ name: 'abbrev', @@ -2221,6 +2282,7 @@ t.test('ls --parseable', (t) => { }, }, }) + touchHiddenPackageLock(prefix) ls([], () => { t.matchSnapshot(redactCwd(result), 'should output tree containing git refs') t.end() @@ -2237,6 +2299,16 @@ t.test('ls --parseable', (t) => { }, }), node_modules: { + '.package-lock.json': JSON.stringify({ + packages: { + 'node_modules/simple-output': { + name: 'simple-output', + version: '2.1.1', + resolved: 'https://registry.npmjs.org/simple-output/-/simple-output-2.1.1.tgz', + shasum: '3c07708ec9ef3e3c985cf0ddd67df09ab8ec2abc', + }, + }, + }), 'simple-output': { 'package.json': JSON.stringify({ name: 'simple-output', @@ -2264,6 +2336,7 @@ t.test('ls --parseable', (t) => { }, }, }) + touchHiddenPackageLock(prefix) ls([], () => { t.matchSnapshot(redactCwd(result), 'should not be printed in tree output') t.end() @@ -3606,19 +3679,28 @@ t.test('ls --json', (t) => { }, }), node_modules: { + '.package-lock.json': JSON.stringify({ + packages: { + 'node_modules/a': { + name: 'b', + version: '1.0.0', + from: 'a@npm:b', + resolved: 'https://localhost:8080/abbrev/-/abbrev-1.1.1.tgz', + requested: { + type: 'alias', + }, + }, + }, + }), a: { 'package.json': JSON.stringify({ name: 'b', version: '1.0.0', - _from: 'a@npm:b', - _resolved: 'https://localhost:8080/abbrev/-/abbrev-1.1.1.tgz', - _requested: { - type: 'alias', - }, }), }, }, }) + touchHiddenPackageLock(prefix) ls([], () => { t.deepEqual( jsonParse(result), @@ -3648,6 +3730,17 @@ t.test('ls --json', (t) => { }, }), node_modules: { + '.package-lock.json': JSON.stringify({ + packages: { + 'node_modules/abbrev': { + name: 'abbrev', + version: '1.1.1', + id: 'abbrev@1.1.1', + from: 'git+https://github.com/isaacs/abbrev-js.git', + resolved: 'git+https://github.com/isaacs/abbrev-js.git#b8f3a2fc0c3bb8ffd8b0d0072cc6b5a3667e963c', + }, + }, + }), abbrev: { 'package.json': JSON.stringify({ name: 'abbrev', @@ -3667,6 +3760,7 @@ t.test('ls --json', (t) => { }, }, }) + touchHiddenPackageLock(prefix) ls([], () => { t.deepEqual( jsonParse(result), @@ -3696,6 +3790,33 @@ t.test('ls --json', (t) => { }, }), node_modules: { + '.package-lock.json': JSON.stringify({ + packages: { + 'node_modules/simple-output': { + name: 'simple-output', + version: '2.1.1', + _from: 'simple-output', + _id: 'simple-output@2.1.1', + _resolved: 'https://registry.npmjs.org/simple-output/-/simple-output-2.1.1.tgz', + _requested: { + type: 'tag', + registry: true, + raw: 'simple-output', + name: 'simple-output', + escapedName: 'simple-output', + rawSpec: '', + saveSpec: null, + fetchSpec: 'latest', + }, + _requiredBy: [ + '#USER', + '/', + ], + _shasum: '3c07708ec9ef3e3c985cf0ddd67df09ab8ec2abc', + _spec: 'simple-output', + }, + }, + }), 'simple-output': { 'package.json': JSON.stringify({ name: 'simple-output', @@ -3723,6 +3844,7 @@ t.test('ls --json', (t) => { }, }, }) + touchHiddenPackageLock(prefix) ls([], () => { t.deepEqual( jsonParse(result), diff --git a/deps/npm/test/lib/npm.js b/deps/npm/test/lib/npm.js index 8494af6bb80982..9fd9888b97b752 100644 --- a/deps/npm/test/lib/npm.js +++ b/deps/npm/test/lib/npm.js @@ -79,6 +79,7 @@ t.test('not yet loaded', t => { set: Function, }, version: String, + shelloutCommands: Array, }) t.throws(() => npm.config.set('foo', 'bar')) t.throws(() => npm.config.get('foo')) diff --git a/deps/npm/test/lib/org.js b/deps/npm/test/lib/org.js index 68e3c9f0d6c8b8..1e8aabc1d7eddd 100644 --- a/deps/npm/test/lib/org.js +++ b/deps/npm/test/lib/org.js @@ -49,13 +49,8 @@ const org = requireInject('../../lib/org.js', { }) test('completion', async t => { - const completion = (argv) => new Promise((resolve, reject) => { - org.completion({ conf: { argv: { remain: argv } } }, (err, res) => { - if (err) - return reject(err) - return resolve(res) - }) - }) + const completion = (argv) => + org.completion({ conf: { argv: { remain: argv } } }) const assertions = [ [['npm', 'org'], ['set', 'rm', 'ls']], @@ -66,7 +61,7 @@ test('completion', async t => { ] for (const [argv, expected] of assertions) - t.strictSame(await completion(argv), expected, `completion for: ${argv.join(', ')}`) + t.resolveMatch(completion(argv), expected, `completion for: ${argv.join(', ')}`) t.rejects(completion(['npm', 'org', 'flurb']), /flurb not recognized/, 'errors for unknown subcommand') }) diff --git a/deps/npm/test/lib/owner.js b/deps/npm/test/lib/owner.js index c5f9d646c24b8a..aa5e3ee63798e9 100644 --- a/deps/npm/test/lib/owner.js +++ b/deps/npm/test/lib/owner.js @@ -699,29 +699,25 @@ t.test('owner rm no cwd package', t => { }) }) -t.test('completion', t => { +t.test('completion', async t => { const { completion } = owner - const testComp = (argv, expect) => { - completion({ conf: { argv: { remain: argv } } }, (err, res) => { - t.ifError(err) - t.strictSame(res, expect, argv.join(' ')) - }) + const testComp = async (argv, expect) => { + const res = await completion({ conf: { argv: { remain: argv } } }) + t.strictSame(res, expect, argv.join(' ')) } - testComp(['npm', 'foo'], []) - testComp(['npm', 'owner'], [ - 'add', - 'rm', - 'ls', + await Promise.all([ + testComp(['npm', 'foo'], []), + testComp(['npm', 'owner'], ['add', 'rm', 'ls']), + testComp(['npm', 'owner', 'add'], []), + testComp(['npm', 'owner', 'ls'], []), + testComp(['npm', 'owner', 'rm', 'foo'], []), ]) - testComp(['npm', 'owner', 'add'], []) - testComp(['npm', 'owner', 'ls'], []) - testComp(['npm', 'owner', 'rm', 'foo'], []) // npm owner rm completion is async - t.test('completion npm owner rm', t => { - t.plan(3) + t.test('completion npm owner rm', async t => { + t.plan(2) readLocalPkgResponse = '@npmcli/map-workspaces' pacote.packument = async spec => { t.equal(spec.name, readLocalPkgResponse, 'should use package spec') @@ -734,31 +730,21 @@ t.test('completion', t => { pacote.packument = noop }) - completion({ conf: { argv: { remain: ['npm', 'owner', 'rm'] } } }, (err, res) => { - t.ifError(err, 'npm owner rm completion') - t.strictSame( - res, - [ - 'nlf', - 'ruyadorno', - 'darcyclarke', - 'isaacs', - ], - 'should return list of current owners' - ) - }) + const res = await completion({ conf: { argv: { remain: ['npm', 'owner', 'rm'] } } }) + t.strictSame(res, + ['nlf', 'ruyadorno', 'darcyclarke', 'isaacs'], + 'should return list of current owners' + ) }) - t.test('completion npm owner rm no cwd package', t => { - completion({ conf: { argv: { remain: ['npm', 'owner', 'rm'] } } }, (err, res) => { - t.ifError(err, 'npm owner rm completion') - t.strictSame(res, [], 'should have no owners to autocomplete if not cwd package') - t.end() - }) + t.test('completion npm owner rm no cwd package', async t => { + const res = await completion({ conf: { argv: { remain: ['npm', 'owner', 'rm'] } } }) + t.strictSame(res, [], 'should have no owners to autocomplete if not cwd package') + t.end() }) - t.test('completion npm owner rm no owners found', t => { - t.plan(3) + t.test('completion npm owner rm no owners found', async t => { + t.plan(2) readLocalPkgResponse = '@npmcli/map-workspaces' pacote.packument = async spec => { t.equal(spec.name, readLocalPkgResponse, 'should use package spec') @@ -771,10 +757,8 @@ t.test('completion', t => { pacote.packument = noop }) - completion({ conf: { argv: { remain: ['npm', 'owner', 'rm'] } } }, (err, res) => { - t.ifError(err, 'npm owner rm completion') - t.strictSame(res, [], 'should return no owners if not found') - }) + const res = await completion({ conf: { argv: { remain: ['npm', 'owner', 'rm'] } } }) + t.strictSame(res, [], 'should return no owners if not found') }) t.end() diff --git a/deps/npm/test/lib/profile.js b/deps/npm/test/lib/profile.js index 48a558cacec646..3b2e140036c7eb 100644 --- a/deps/npm/test/lib/profile.js +++ b/deps/npm/test/lib/profile.js @@ -1398,17 +1398,16 @@ t.test('unknown subcommand', t => { t.test('completion', t => { const { completion } = profile - const testComp = ({ t, argv, expect, title }) => { - completion({ conf: { argv: { remain: argv } } }, (err, res) => { - if (err) - throw err - - t.strictSame(res, expect, title) - }) + const testComp = async ({ t, argv, expect, title }) => { + t.resolveMatch( + completion({ conf: { argv: { remain: argv } } }), + expect, + title + ) } - t.test('npm profile autocomplete', t => { - testComp({ + t.test('npm profile autocomplete', async t => { + await testComp({ t, argv: ['npm', 'profile'], expect: ['enable-2fa', 'disable-2fa', 'get', 'set'], @@ -1418,8 +1417,8 @@ t.test('completion', t => { t.end() }) - t.test('npm profile enable autocomplete', t => { - testComp({ + t.test('npm profile enable autocomplete', async t => { + await testComp({ t, argv: ['npm', 'profile', 'enable-2fa'], expect: ['auth-and-writes', 'auth-only'], @@ -1429,10 +1428,10 @@ t.test('completion', t => { t.end() }) - t.test('npm profile no autocomplete', t => { + t.test('npm profile no autocomplete', async t => { const noAutocompleteCmds = ['disable-2fa', 'disable-tfa', 'get', 'set'] for (const subcmd of noAutocompleteCmds) { - testComp({ + await testComp({ t, argv: ['npm', 'profile', subcmd], expect: [], @@ -1443,22 +1442,12 @@ t.test('completion', t => { t.end() }) - t.test('npm profile unknown subcommand autocomplete', t => { - completion({ - conf: { - argv: { - remain: ['npm', 'profile', 'asdf'], - }, - }, - }, (err, res) => { - t.match( - err, - /asdf not recognized/, - 'should throw unknown cmd error' - ) - - t.end() - }) + t.test('npm profile unknown subcommand autocomplete', async t => { + t.rejects( + completion({ conf: { argv: { remain: ['npm', 'profile', 'asdf'] } } }), + { message: 'asdf not recognized' }, 'should throw unknown cmd error' + ) + t.end() }) t.end() diff --git a/deps/npm/test/lib/publish.js b/deps/npm/test/lib/publish.js index 6d5cebf5406988..5243b5254201e0 100644 --- a/deps/npm/test/lib/publish.js +++ b/deps/npm/test/lib/publish.js @@ -1,40 +1,28 @@ const t = require('tap') const requireInject = require('require-inject') +const fs = require('fs') + +// The way we set loglevel is kind of convoluted, and there is no way to affect +// it from these tests, which only interact with lib/publish.js, which assumes +// that the code that is requiring and calling lib/publish.js has already +// taken care of the loglevel +const log = require('npmlog') +log.level = 'silent' // mock config const {defaults} = require('../../lib/utils/config.js') -const credentials = { - 'https://unauthed.registry': { - email: 'me@example.com', - }, - 'https://scope.specific.registry': { - token: 'some.registry.token', - alwaysAuth: false, - }, - 'https://some.registry': { - token: 'some.registry.token', - alwaysAuth: false, - }, - 'https://registry.npmjs.org/': { - token: 'npmjs.registry.token', - alwaysAuth: false, - }, -} + const config = { list: [defaults], } -const registryCredentials = (t, registry) => { - return (uri) => { - t.same(uri, registry, 'gets credentials for expected registry') - return credentials[uri] - } -} - -const fs = require('fs') +t.afterEach(cb => { + log.level = 'silent' + cb() +}) -t.test('should publish with libnpmpublish, respecting publishConfig', (t) => { - t.plan(6) +t.test('should publish with libnpmpublish, passing through flatOptions and respecting publishConfig.registry', (t) => { + t.plan(7) const registry = 'https://some.registry' const publishConfig = { registry } @@ -49,25 +37,16 @@ t.test('should publish with libnpmpublish, respecting publishConfig', (t) => { const publish = requireInject('../../lib/publish.js', { '../../lib/npm.js': { flatOptions: { - json: true, - defaultTag: 'latest', - registry, + customValue: true, }, config: { ...config, - getCredentialsByURI: registryCredentials(t, registry), + getCredentialsByURI: (uri) => { + t.same(uri, registry, 'gets credentials for expected registry') + return { token: 'some.registry.token' } + }, }, }, - '../../lib/utils/tar.js': { - getContents: () => ({ - id: 'someid', - }), - logTar: () => {}, - }, - '../../lib/utils/output.js': () => {}, - '../../lib/utils/otplease.js': (opts, fn) => { - return Promise.resolve().then(() => fn(opts)) - }, // verify that we do NOT remove publishConfig if it was there originally // and then removed during the script/pack process libnpmpack: async () => { @@ -82,7 +61,8 @@ t.test('should publish with libnpmpublish, respecting publishConfig', (t) => { t.match(manifest, { name: 'my-cool-pkg', version: '1.0.0' }, 'gets manifest') t.isa(tarData, Buffer, 'tarData is a buffer') t.ok(opts, 'gets opts object') - t.same(opts.registry, publishConfig.registry, 'publishConfig is passed through') + t.same(opts.customValue, true, 'flatOptions values are passed through') + t.same(opts.registry, registry, 'publishConfig.registry is passed through') }, }, }) @@ -94,7 +74,7 @@ t.test('should publish with libnpmpublish, respecting publishConfig', (t) => { }) }) -t.test('re-loads publishConfig if added during script process', (t) => { +t.test('re-loads publishConfig.registry if added during script process', (t) => { t.plan(6) const registry = 'https://some.registry' const publishConfig = { registry } @@ -107,26 +87,14 @@ t.test('re-loads publishConfig if added during script process', (t) => { const publish = requireInject('../../lib/publish.js', { '../../lib/npm.js': { - flatOptions: { - json: true, - defaultTag: 'latest', - registry: 'https://registry.npmjs.org/', - }, config: { ...config, - getCredentialsByURI: registryCredentials(t, registry), + getCredentialsByURI: (uri) => { + t.same(uri, registry, 'gets credentials for expected registry') + return { token: 'some.registry.token' } + }, }, }, - '../../lib/utils/tar.js': { - getContents: () => ({ - id: 'someid', - }), - logTar: () => {}, - }, - '../../lib/utils/output.js': () => {}, - '../../lib/utils/otplease.js': (opts, fn) => { - return Promise.resolve().then(() => fn(opts)) - }, libnpmpack: async () => { fs.writeFileSync(`${testDir}/package.json`, JSON.stringify({ name: 'my-cool-pkg', @@ -140,7 +108,7 @@ t.test('re-loads publishConfig if added during script process', (t) => { t.match(manifest, { name: 'my-cool-pkg', version: '1.0.0' }, 'gets manifest') t.isa(tarData, Buffer, 'tarData is a buffer') t.ok(opts, 'gets opts object') - t.same(opts.registry, registry, 'publishConfig is passed through') + t.same(opts.registry, registry, 'publishConfig.registry is passed through') }, }, }) @@ -152,10 +120,9 @@ t.test('re-loads publishConfig if added during script process', (t) => { }) }) -t.test('should not log if silent (dry run)', (t) => { - t.plan(2) +t.test('if loglevel=info and json, should not output package contents', (t) => { + t.plan(4) - const registry = 'https://registry.npmjs.org' const testDir = t.testdir({ 'package.json': JSON.stringify({ name: 'my-cool-pkg', @@ -163,41 +130,81 @@ t.test('should not log if silent (dry run)', (t) => { }, null, 2), }) + log.level = 'info' const publish = requireInject('../../lib/publish.js', { '../../lib/npm.js': { flatOptions: { - json: false, - defaultTag: 'latest', - dryRun: true, - registry, + json: true, }, config: { ...config, - getCredentialsByURI: () => { - throw new Error('should not call getCredentialsByURI in dry run') + getCredentialsByURI: (uri) => { + t.same(uri, defaults.registry, 'gets credentials for expected registry') + return { token: 'some.registry.token' } }, }, }, + '../../lib/utils/output.js': () => { + t.pass('output is called') + }, '../../lib/utils/tar.js': { - getContents: () => ({}), + getContents: () => ({ + id: 'someid', + }), logTar: () => { - t.pass('called logTar (but nothing actually printed)') + t.pass('logTar is called') + }, + }, + libnpmpublish: { + publish: () => { + t.pass('publish called') }, }, - '../../lib/utils/otplease.js': (opts, fn) => { - return Promise.resolve().then(() => fn(opts)) + }) + + return publish([testDir], (er) => { + if (er) + throw er + t.pass('got to callback') + }) +}) + +t.test('if loglevel=silent and dry-run, should not output package contents or publish or validate credentials, should log tarball contents', (t) => { + t.plan(2) + + const testDir = t.testdir({ + 'package.json': JSON.stringify({ + name: 'my-cool-pkg', + version: '1.0.0', + }, null, 2), + }) + + log.level = 'silent' + const publish = requireInject('../../lib/publish.js', { + '../../lib/npm.js': { + flatOptions: { + dryRun: true, + }, + config: { + ...config, + getCredentialsByURI: () => { + throw new Error('should not call getCredentialsByURI in dry run') + }, + }, }, '../../lib/utils/output.js': () => { - throw new Error('should not output in silent mode') + throw new Error('should not output in dry run mode') }, - npmlog: { - verbose: () => {}, - notice: () => {}, - level: 'silent', + '../../lib/utils/tar.js': { + getContents: () => ({ + id: 'someid', + }), + logTar: () => { + t.pass('logTar is called') + }, }, - libnpmpack: async () => '', libnpmpublish: { - publish: (manifest, tarData, opts) => { + publish: () => { throw new Error('should not call libnpmpublish in dry run') }, }, @@ -210,10 +217,9 @@ t.test('should not log if silent (dry run)', (t) => { }) }) -t.test('should log tarball contents (dry run)', (t) => { +t.test('if loglevel=info and dry-run, should not publish, should log package contents and log tarball contents', (t) => { t.plan(3) - const registry = 'https://registry.npmjs.org' const testDir = t.testdir({ 'package.json': JSON.stringify({ name: 'my-cool-pkg', @@ -221,13 +227,11 @@ t.test('should log tarball contents (dry run)', (t) => { }, null, 2), }) + log.level = 'info' const publish = requireInject('../../lib/publish.js', { '../../lib/npm.js': { flatOptions: { - json: false, - defaultTag: 'latest', dryRun: true, - registry, }, config: { ...config, @@ -246,10 +250,6 @@ t.test('should log tarball contents (dry run)', (t) => { '../../lib/utils/output.js': () => { t.pass('output fn is called') }, - '../../lib/utils/otplease.js': (opts, fn) => { - return Promise.resolve().then(() => fn(opts)) - }, - libnpmpack: async () => '', libnpmpublish: { publish: () => { throw new Error('should not call libnpmpublish in dry run') @@ -266,16 +266,7 @@ t.test('should log tarball contents (dry run)', (t) => { t.test('shows usage with wrong set of arguments', (t) => { t.plan(1) - const publish = requireInject('../../lib/publish.js', { - '../../lib/npm.js': { - flatOptions: { - json: false, - defaultTag: '0.0.13', - registry: 'https://registry.npmjs.org/', - }, - config, - }, - }) + const publish = requireInject('../../lib/publish.js') return publish(['a', 'b', 'c'], (er) => t.matchSnapshot(er, 'should print usage')) }) @@ -283,14 +274,10 @@ t.test('shows usage with wrong set of arguments', (t) => { t.test('throws when invalid tag', (t) => { t.plan(1) - const registry = 'https://registry.npmjs.org' - const publish = requireInject('../../lib/publish.js', { '../../lib/npm.js': { flatOptions: { - json: false, defaultTag: '0.0.13', - registry, }, config, }, @@ -306,8 +293,8 @@ t.test('throws when invalid tag', (t) => { t.test('can publish a tarball', t => { t.plan(4) - const registry = 'https://registry.npmjs.org/' const testDir = t.testdir({ + tarball: {}, package: { 'package.json': JSON.stringify({ name: 'my-cool-tarball', @@ -318,37 +305,21 @@ t.test('can publish a tarball', t => { const tar = require('tar') tar.c({ cwd: testDir, - file: `${testDir}/package.tgz`, + file: `${testDir}/tarball/package.tgz`, sync: true, }, ['package']) - // no cheating! read it from the tarball. - fs.unlinkSync(`${testDir}/package/package.json`) - fs.rmdirSync(`${testDir}/package`) - - const tarFile = fs.readFileSync(`${testDir}/package.tgz`) + const tarFile = fs.readFileSync(`${testDir}/tarball/package.tgz`) const publish = requireInject('../../lib/publish.js', { '../../lib/npm.js': { - flatOptions: { - json: true, - defaultTag: 'latest', - registry, - }, config: { ...config, - getCredentialsByURI: registryCredentials(t, registry), + getCredentialsByURI: (uri) => { + t.same(uri, defaults.registry, 'gets credentials for expected registry') + return { token: 'some.registry.token' } + }, }, }, - '../../lib/utils/tar.js': { - getContents: () => ({ - id: 'someid', - }), - logTar: () => {}, - }, - '../../lib/utils/output.js': () => {}, - '../../lib/utils/otplease.js': (opts, fn) => { - return Promise.resolve().then(() => fn(opts)) - }, libnpmpublish: { publish: (manifest, tarData, opts) => { t.match(manifest, { @@ -360,32 +331,49 @@ t.test('can publish a tarball', t => { }, }) - return publish([`${testDir}/package.tgz`], (er) => { + return publish([`${testDir}/tarball/package.tgz`], (er) => { if (er) throw er t.pass('got to callback') }) }) -t.test('throw if not logged in', async t => { +t.test('should check auth for default registry', async t => { t.plan(2) - const registry = 'https://unauthed.registry' - const publish = requireInject('../../lib/publish.js', { - '../../lib/utils/tar.js': { - getContents: () => ({ - id: 'someid', - }), - logTar: () => {}, + '../../lib/npm.js': { + config: { + ...config, + getCredentialsByURI: (uri) => { + t.same(uri, defaults.registry, 'gets credentials for expected registry') + return {} + }, + }, }, + }) + + return publish([], (err) => { + t.match(err, { + message: 'This command requires you to be logged in.', + code: 'ENEEDAUTH', + }, 'throws when not logged in') + }) +}) + +t.test('should check auth for configured registry', async t => { + t.plan(2) + const registry = 'https://some.registry' + const publish = requireInject('../../lib/publish.js', { '../../lib/npm.js': { flatOptions: { - json: false, registry, }, config: { ...config, - getCredentialsByURI: registryCredentials(t, registry), + getCredentialsByURI: (uri) => { + t.same(uri, registry, 'gets credentials for expected registry') + return {} + }, }, }, }) @@ -398,44 +386,69 @@ t.test('throw if not logged in', async t => { }) }) -t.test('read registry only from publishConfig', t => { - t.plan(4) - +t.test('should check auth for scope specific registry', async t => { + t.plan(2) const registry = 'https://some.registry' - const publishConfig = { registry } const testDir = t.testdir({ 'package.json': JSON.stringify({ - name: 'my-cool-pkg', + name: '@npm/my-cool-pkg', version: '1.0.0', - publishConfig, }, null, 2), }) const publish = requireInject('../../lib/publish.js', { '../../lib/npm.js': { flatOptions: { - json: false, + '@npm:registry': registry, }, config: { ...config, - getCredentialsByURI: registryCredentials(t, registry), + getCredentialsByURI: (uri) => { + t.same(uri, registry, 'gets credentials for expected registry') + return {} + }, }, }, - '../../lib/utils/tar.js': { - getContents: () => ({ - id: 'someid', - }), - logTar: () => {}, + }) + + return publish([testDir], (err) => { + t.match(err, { + message: 'This command requires you to be logged in.', + code: 'ENEEDAUTH', + }, 'throws when not logged in') + }) +}) + +t.test('should use auth for scope specific registry', t => { + t.plan(4) + const registry = 'https://some.registry' + const testDir = t.testdir({ + 'package.json': JSON.stringify({ + name: '@npm/my-cool-pkg', + version: '1.0.0', + }, null, 2), + }) + + const publish = requireInject('../../lib/publish.js', { + '../../lib/npm.js': { + flatOptions: { + '@npm:registry': registry, + }, + config: { + ...config, + getCredentialsByURI: (uri) => { + t.same(uri, registry, 'gets credentials for expected registry') + return { token: 'some.registry.token' } + }, + }, }, - '../../lib/utils/output.js': () => {}, libnpmpublish: { publish: (manifest, tarData, opts) => { - t.match(manifest, { name: 'my-cool-pkg', version: '1.0.0' }, 'gets manifest') - t.same(opts.registry, registry, 'publishConfig is passed through') + t.ok(opts, 'gets opts object') + t.same(opts['@npm:registry'], registry, 'scope specific registry is passed through') }, }, }) - return publish([testDir], (er) => { if (er) throw er @@ -443,40 +456,37 @@ t.test('read registry only from publishConfig', t => { }) }) -t.test('should check auth for scope specific registry', t => { +t.test('read registry only from publishConfig', t => { + t.plan(4) + + const registry = 'https://some.registry' + const publishConfig = { registry } const testDir = t.testdir({ 'package.json': JSON.stringify({ - name: '@npm/my-cool-pkg', + name: 'my-cool-pkg', version: '1.0.0', + publishConfig, }, null, 2), }) - const registry = 'https://scope.specific.registry' const publish = requireInject('../../lib/publish.js', { '../../lib/npm.js': { - flatOptions: { - json: false, - '@npm:registry': registry, - }, config: { ...config, - getCredentialsByURI: registryCredentials(t, registry), + getCredentialsByURI: (uri) => { + t.same(uri, registry, 'gets credentials for expected registry') + return { token: 'some.registry.token' } + }, }, }, - '../../lib/utils/tar.js': { - getContents: () => ({ - id: 'someid', - }), - logTar: () => {}, - }, - '../../lib/utils/output.js': () => {}, - '../../lib/utils/otplease.js': (opts, fn) => { - return Promise.resolve().then(() => fn(opts)) - }, libnpmpublish: { - publish: () => '', + publish: (manifest, tarData, opts) => { + t.match(manifest, { name: 'my-cool-pkg', version: '1.0.0' }, 'gets manifest') + t.same(opts.registry, registry, 'publishConfig is passed through') + }, }, }) + return publish([testDir], (er) => { if (er) throw er diff --git a/deps/npm/test/lib/repo.js b/deps/npm/test/lib/repo.js index c4b1b46e7342b7..3367f7c8858c36 100644 --- a/deps/npm/test/lib/repo.js +++ b/deps/npm/test/lib/repo.js @@ -119,14 +119,6 @@ const repo = requireInject('../../lib/repo.js', { '../../lib/utils/open-url.js': openUrl, }) -t.test('completion', t => { - repo.completion({}, (er, res) => { - t.equal(er, null) - t.same(res, []) - t.end() - }) -}) - t.test('open repo urls', t => { const expect = { hostedgit: 'https://github.com/foo/hostedgit', diff --git a/deps/npm/test/lib/restart.js b/deps/npm/test/lib/restart.js index fde798888810f8..a19bfd0d41a17e 100644 --- a/deps/npm/test/lib/restart.js +++ b/deps/npm/test/lib/restart.js @@ -1,5 +1,4 @@ const t = require('tap') const restart = require('../../lib/restart.js') t.isa(restart, Function) -t.equal(restart.completion, require('../../lib/utils/completion/none.js'), 'empty completion') t.equal(restart.usage, 'npm restart [-- ]') diff --git a/deps/npm/test/lib/run-script.js b/deps/npm/test/lib/run-script.js index bad8a63c0d7783..974202aa8c6f0a 100644 --- a/deps/npm/test/lib/run-script.js +++ b/deps/npm/test/lib/run-script.js @@ -42,45 +42,29 @@ const { writeFileSync } = require('fs') t.test('completion', t => { const dir = t.testdir() npm.localPrefix = dir - t.test('already have a script name', t => { - runScript.completion({conf: {argv: {remain: ['npm', 'run', 'x']}}}, (er, results) => { - if (er) - throw er - - t.equal(results, undefined) - t.end() - }) + t.test('already have a script name', async t => { + const res = await runScript.completion({conf: {argv: {remain: ['npm', 'run', 'x']}}}) + t.equal(res, undefined) + t.end() }) - t.test('no package.json', t => { - runScript.completion({conf: {argv: {remain: ['npm', 'run']}}}, (er, results) => { - if (er) - throw er - - t.strictSame(results, []) - t.end() - }) + t.test('no package.json', async t => { + const res = await runScript.completion({conf: {argv: {remain: ['npm', 'run']}}}) + t.strictSame(res, []) + t.end() }) - t.test('has package.json, no scripts', t => { + t.test('has package.json, no scripts', async t => { writeFileSync(`${dir}/package.json`, JSON.stringify({})) - runScript.completion({conf: {argv: {remain: ['npm', 'run']}}}, (er, results) => { - if (er) - throw er - - t.strictSame(results, []) - t.end() - }) + const res = await runScript.completion({conf: {argv: {remain: ['npm', 'run']}}}) + t.strictSame(res, []) + t.end() }) - t.test('has package.json, with scripts', t => { + t.test('has package.json, with scripts', async t => { writeFileSync(`${dir}/package.json`, JSON.stringify({ scripts: { hello: 'echo hello', world: 'echo world' }, })) - runScript.completion({conf: {argv: {remain: ['npm', 'run']}}}, (er, results) => { - if (er) - throw er - - t.strictSame(results, ['hello', 'world']) - t.end() - }) + const res = await runScript.completion({conf: {argv: {remain: ['npm', 'run']}}}) + t.strictSame(res, ['hello', 'world']) + t.end() }) t.end() }) @@ -126,12 +110,14 @@ t.test('default env, start, and restart scripts', async t => { scriptShell: undefined, stdio: 'inherit', stdioString: true, - pkg: { name: 'x', + pkg: { + name: 'x', version: '1.2.3', _id: 'x@1.2.3', scripts: { env: 'env', - } }, + }, + }, event: 'env', }, ]) @@ -185,6 +171,67 @@ t.test('default env, start, and restart scripts', async t => { RUN_SCRIPTS.length = 0 }) +t.test('non-default env script', async t => { + npm.localPrefix = t.testdir({ + 'package.json': JSON.stringify({ + name: 'x', + version: '1.2.3', + scripts: { + env: 'hello', + }, + }), + }) + + await runScript(['env'], er => { + if (er) + throw er + + t.match(RUN_SCRIPTS, [ + { + path: npm.localPrefix, + args: [], + scriptShell: undefined, + stdio: 'inherit', + stdioString: true, + pkg: { + name: 'x', + version: '1.2.3', + _id: 'x@1.2.3', + scripts: { + env: 'hello', + }, + }, + event: 'env', + }, + ]) + }) + RUN_SCRIPTS.length = 0 + + await runScriptWin(['env'], er => { + if (er) + throw er + + t.match(RUN_SCRIPTS, [ + { + path: npm.localPrefix, + args: [], + scriptShell: undefined, + stdio: 'inherit', + stdioString: true, + pkg: { name: 'x', + version: '1.2.3', + _id: 'x@1.2.3', + scripts: { + env: 'hello', + }, + }, + event: 'env', + }, + ]) + }) + RUN_SCRIPTS.length = 0 +}) + t.test('try to run missing script', t => { npm.localPrefix = t.testdir({ 'package.json': JSON.stringify({ diff --git a/deps/npm/test/lib/set-script.js b/deps/npm/test/lib/set-script.js index ab25ba968a92c3..196fd3d3e614e6 100644 --- a/deps/npm/test/lib/set-script.js +++ b/deps/npm/test/lib/set-script.js @@ -4,7 +4,6 @@ const setScriptDefault = require('../../lib/set-script.js') const parseJSON = require('json-parse-even-better-errors') test.type(setScriptDefault, 'function', 'command is function') -test.equal(setScriptDefault.completion, require('../../lib/utils/completion/none.js'), 'empty completion') test.equal(setScriptDefault.usage, 'npm set-script [