From e9f3277305b7431735b63d9d70534f3a9a863207 Mon Sep 17 00:00:00 2001 From: Luke Karrys Date: Mon, 2 Oct 2023 15:21:16 -0700 Subject: [PATCH 1/7] chore: @npmcli/arborist@7.1.0 --- DEPENDENCIES.md | 6 +- mock-registry/package.json | 2 +- package-lock.json | 493 +------------------------------------ 3 files changed, 8 insertions(+), 493 deletions(-) diff --git a/DEPENDENCIES.md b/DEPENDENCIES.md index fddb46dd29b05..5107192bdbb8f 100644 --- a/DEPENDENCIES.md +++ b/DEPENDENCIES.md @@ -844,6 +844,6 @@ packages higher up the chain. - pacote, libnpmhook, libnpmorg, libnpmsearch, libnpmteam, npm-profile - npm-registry-fetch, @npmcli/package-json, libnpmversion - @npmcli/git, make-fetch-happen, @npmcli/config, init-package-json - - npm-pick-manifest, @npmcli/installed-package-contents, @npmcli/run-script, cacache, read-package-json, @npmcli/map-workspaces, promzard - - @npmcli/docs, npm-package-arg, npm-install-checks, npm-bundled, read-package-json-fast, @npmcli/fs, unique-filename, npm-packlist, normalize-package-data, @npmcli/mock-globals, bin-links, nopt, npmlog, parse-conflict-json, read - - @npmcli/eslint-config, @npmcli/template-oss, ignore-walk, semver, hosted-git-info, proc-log, validate-npm-package-name, @npmcli/promise-spawn, npm-normalize-package-bin, @npmcli/node-gyp, json-parse-even-better-errors, fs-minipass, ssri, unique-slug, @npmcli/agent, minipass-fetch, @npmcli/name-from-folder, @npmcli/query, cmd-shim, read-cmd-shim, write-file-atomic, abbrev, are-we-there-yet, gauge, minify-registry-metadata, ini, @npmcli/disparity-colors, mute-stream, npm-audit-report, npm-user-validate + - @npmcli/installed-package-contents, @npmcli/map-workspaces, cacache, npm-pick-manifest, @npmcli/run-script, read-package-json, promzard + - @npmcli/docs, @npmcli/fs, npm-bundled, read-package-json-fast, unique-filename, npm-install-checks, npm-package-arg, npm-packlist, normalize-package-data, bin-links, nopt, npmlog, parse-conflict-json, @npmcli/mock-globals, read + - @npmcli/eslint-config, @npmcli/template-oss, ignore-walk, semver, npm-normalize-package-bin, @npmcli/name-from-folder, json-parse-even-better-errors, fs-minipass, ssri, unique-slug, @npmcli/promise-spawn, hosted-git-info, proc-log, validate-npm-package-name, @npmcli/node-gyp, @npmcli/agent, minipass-fetch, @npmcli/query, cmd-shim, read-cmd-shim, write-file-atomic, abbrev, are-we-there-yet, gauge, minify-registry-metadata, ini, @npmcli/disparity-colors, mute-stream, npm-audit-report, npm-user-validate diff --git a/mock-registry/package.json b/mock-registry/package.json index ccd8eb6720d76..d774fd4e6ed8a 100644 --- a/mock-registry/package.json +++ b/mock-registry/package.json @@ -45,7 +45,7 @@ ] }, "devDependencies": { - "@npmcli/arborist": "^6.1.1", + "@npmcli/arborist": "^7.1.0", "@npmcli/eslint-config": "^4.0.1", "@npmcli/template-oss": "4.19.0", "json-stringify-safe": "^5.0.1", diff --git a/package-lock.json b/package-lock.json index 7efc38df8a7f9..db34bd1c00438 100644 --- a/package-lock.json +++ b/package-lock.json @@ -233,7 +233,7 @@ "version": "1.0.0", "license": "ISC", "devDependencies": { - "@npmcli/arborist": "^6.1.1", + "@npmcli/arborist": "^7.1.0", "@npmcli/eslint-config": "^4.0.1", "@npmcli/template-oss": "4.19.0", "json-stringify-safe": "^5.0.1", @@ -246,58 +246,11 @@ "node": "^18.17.0 || >=20.5.0" } }, - "mock-registry/node_modules/@npmcli/arborist": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-6.3.0.tgz", - "integrity": "sha512-XrS14qBDhK95RdGhjTSx8AgeZPNah949qp3b0v3GUFOugtPc9Z85rpWid57mONS8gHbuGIHjFzuA+5hSM7BuBA==", - "dev": true, - "dependencies": { - "@isaacs/string-locale-compare": "^1.1.0", - "@npmcli/fs": "^3.1.0", - "@npmcli/installed-package-contents": "^2.0.2", - "@npmcli/map-workspaces": "^3.0.2", - "@npmcli/metavuln-calculator": "^5.0.0", - "@npmcli/name-from-folder": "^2.0.0", - "@npmcli/node-gyp": "^3.0.0", - "@npmcli/package-json": "^4.0.0", - "@npmcli/query": "^3.0.0", - "@npmcli/run-script": "^6.0.0", - "bin-links": "^4.0.1", - "cacache": "^17.0.4", - "common-ancestor-path": "^1.0.1", - "hosted-git-info": "^6.1.1", - "json-parse-even-better-errors": "^3.0.0", - "json-stringify-nice": "^1.1.4", - "minimatch": "^9.0.0", - "nopt": "^7.0.0", - "npm-install-checks": "^6.0.0", - "npm-package-arg": "^10.1.0", - "npm-pick-manifest": "^8.0.1", - "npm-registry-fetch": "^14.0.3", - "npmlog": "^7.0.1", - "pacote": "^15.0.8", - "parse-conflict-json": "^3.0.0", - "proc-log": "^3.0.0", - "promise-all-reject-late": "^1.0.0", - "promise-call-limit": "^1.0.2", - "read-package-json-fast": "^3.0.2", - "semver": "^7.3.7", - "ssri": "^10.0.1", - "treeverse": "^3.0.0", - "walk-up-path": "^3.0.1" - }, - "bin": { - "arborist": "bin/index.js" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, "mock-registry/node_modules/@npmcli/arborist/node_modules/minipass": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", - "dev": true, + "extraneous": true, "engines": { "node": ">=8" } @@ -306,7 +259,7 @@ "version": "10.1.0", "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-10.1.0.tgz", "integrity": "sha512-uFyyCEmgBfZTtrKk/5xDfHp6+MdrqGotX/VoOyEEl3mBwiEE5FlBaePanazJSVMPT7vKepcjYBY2ztg9A3yPIA==", - "dev": true, + "extraneous": true, "dependencies": { "hosted-git-info": "^6.0.0", "proc-log": "^3.0.0", @@ -321,97 +274,7 @@ "version": "15.2.0", "resolved": "https://registry.npmjs.org/pacote/-/pacote-15.2.0.tgz", "integrity": "sha512-rJVZeIwHTUta23sIZgEIM62WYwbmGbThdbnkt81ravBplQv+HjyroqnLRNH2+sLJHcGZmLRmhPwACqhfTcOmnA==", - "dev": true, - "dependencies": { - "@npmcli/git": "^4.0.0", - "@npmcli/installed-package-contents": "^2.0.1", - "@npmcli/promise-spawn": "^6.0.1", - "@npmcli/run-script": "^6.0.0", - "cacache": "^17.0.0", - "fs-minipass": "^3.0.0", - "minipass": "^5.0.0", - "npm-package-arg": "^10.0.0", - "npm-packlist": "^7.0.0", - "npm-pick-manifest": "^8.0.0", - "npm-registry-fetch": "^14.0.0", - "proc-log": "^3.0.0", - "promise-retry": "^2.0.1", - "read-package-json": "^6.0.0", - "read-package-json-fast": "^3.0.0", - "sigstore": "^1.3.0", - "ssri": "^10.0.0", - "tar": "^6.1.11" - }, - "bin": { - "pacote": "lib/bin.js" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "mock-registry/node_modules/@npmcli/git": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@npmcli/git/-/git-4.1.0.tgz", - "integrity": "sha512-9hwoB3gStVfa0N31ymBmrX+GuDGdVA/QWShZVqE0HK2Af+7QGGrCTbZia/SW0ImUTjTne7SP91qxDmtXvDHRPQ==", - "dev": true, - "dependencies": { - "@npmcli/promise-spawn": "^6.0.0", - "lru-cache": "^7.4.4", - "npm-pick-manifest": "^8.0.0", - "proc-log": "^3.0.0", - "promise-inflight": "^1.0.1", - "promise-retry": "^2.0.1", - "semver": "^7.3.5", - "which": "^3.0.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "mock-registry/node_modules/@npmcli/metavuln-calculator": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/@npmcli/metavuln-calculator/-/metavuln-calculator-5.0.1.tgz", - "integrity": "sha512-qb8Q9wIIlEPj3WeA1Lba91R4ZboPL0uspzV0F9uwP+9AYMVB2zOoa7Pbk12g6D2NHAinSbHh6QYmGuRyHZ874Q==", - "dev": true, - "dependencies": { - "cacache": "^17.0.0", - "json-parse-even-better-errors": "^3.0.0", - "pacote": "^15.0.0", - "semver": "^7.3.5" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "mock-registry/node_modules/@npmcli/metavuln-calculator/node_modules/minipass": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", - "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "mock-registry/node_modules/@npmcli/metavuln-calculator/node_modules/npm-package-arg": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-10.1.0.tgz", - "integrity": "sha512-uFyyCEmgBfZTtrKk/5xDfHp6+MdrqGotX/VoOyEEl3mBwiEE5FlBaePanazJSVMPT7vKepcjYBY2ztg9A3yPIA==", - "dev": true, - "dependencies": { - "hosted-git-info": "^6.0.0", - "proc-log": "^3.0.0", - "semver": "^7.3.5", - "validate-npm-package-name": "^5.0.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "mock-registry/node_modules/@npmcli/metavuln-calculator/node_modules/pacote": { - "version": "15.2.0", - "resolved": "https://registry.npmjs.org/pacote/-/pacote-15.2.0.tgz", - "integrity": "sha512-rJVZeIwHTUta23sIZgEIM62WYwbmGbThdbnkt81ravBplQv+HjyroqnLRNH2+sLJHcGZmLRmhPwACqhfTcOmnA==", - "dev": true, + "extraneous": true, "dependencies": { "@npmcli/git": "^4.0.0", "@npmcli/installed-package-contents": "^2.0.1", @@ -439,354 +302,6 @@ "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "mock-registry/node_modules/@npmcli/package-json": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@npmcli/package-json/-/package-json-4.0.1.tgz", - "integrity": "sha512-lRCEGdHZomFsURroh522YvA/2cVb9oPIJrjHanCJZkiasz1BzcnLr3tBJhlV7S86MBJBuAQ33is2D60YitZL2Q==", - "dev": true, - "dependencies": { - "@npmcli/git": "^4.1.0", - "glob": "^10.2.2", - "hosted-git-info": "^6.1.1", - "json-parse-even-better-errors": "^3.0.0", - "normalize-package-data": "^5.0.0", - "proc-log": "^3.0.0", - "semver": "^7.5.3" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "mock-registry/node_modules/@npmcli/promise-spawn": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/@npmcli/promise-spawn/-/promise-spawn-6.0.2.tgz", - "integrity": "sha512-gGq0NJkIGSwdbUt4yhdF8ZrmkGKVz9vAdVzpOfnom+V8PLSmSOVhZwbNvZZS1EYcJN5hzzKBxmmVVAInM6HQLg==", - "dev": true, - "dependencies": { - "which": "^3.0.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "mock-registry/node_modules/@npmcli/run-script": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/@npmcli/run-script/-/run-script-6.0.2.tgz", - "integrity": "sha512-NCcr1uQo1k5U+SYlnIrbAh3cxy+OQT1VtqiAbxdymSlptbzBb62AjH2xXgjNCoP073hoa1CfCAcwoZ8k96C4nA==", - "dev": true, - "dependencies": { - "@npmcli/node-gyp": "^3.0.0", - "@npmcli/promise-spawn": "^6.0.0", - "node-gyp": "^9.0.0", - "read-package-json-fast": "^3.0.0", - "which": "^3.0.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "mock-registry/node_modules/@sigstore/bundle": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@sigstore/bundle/-/bundle-1.1.0.tgz", - "integrity": "sha512-PFutXEy0SmQxYI4texPw3dd2KewuNqv7OuK1ZFtY2fM754yhvG2KdgwIhRnoEE2uHdtdGNQ8s0lb94dW9sELog==", - "dev": true, - "dependencies": { - "@sigstore/protobuf-specs": "^0.2.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "mock-registry/node_modules/@sigstore/sign": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@sigstore/sign/-/sign-1.0.0.tgz", - "integrity": "sha512-INxFVNQteLtcfGmcoldzV6Je0sbbfh9I16DM4yJPw3j5+TFP8X6uIiA18mvpEa9yyeycAKgPmOA3X9hVdVTPUA==", - "dev": true, - "dependencies": { - "@sigstore/bundle": "^1.1.0", - "@sigstore/protobuf-specs": "^0.2.0", - "make-fetch-happen": "^11.0.1" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "mock-registry/node_modules/@sigstore/tuf": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@sigstore/tuf/-/tuf-1.0.3.tgz", - "integrity": "sha512-2bRovzs0nJZFlCN3rXirE4gwxCn97JNjMmwpecqlbgV9WcxX7WRuIrgzx/X7Ib7MYRbyUTpBYE0s2x6AmZXnlg==", - "dev": true, - "dependencies": { - "@sigstore/protobuf-specs": "^0.2.0", - "tuf-js": "^1.1.7" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "mock-registry/node_modules/@tufjs/canonical-json": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@tufjs/canonical-json/-/canonical-json-1.0.0.tgz", - "integrity": "sha512-QTnf++uxunWvG2z3UFNzAoQPHxnSXOwtaI3iJ+AohhV+5vONuArPjJE7aPXPVXfXJsqrVbZBu9b81AJoSd09IQ==", - "dev": true, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "mock-registry/node_modules/@tufjs/models": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@tufjs/models/-/models-1.0.4.tgz", - "integrity": "sha512-qaGV9ltJP0EO25YfFUPhxRVK0evXFIAGicsVXuRim4Ed9cjPxYhNnNJ49SFmbeLgtxpslIkX317IgpfcHPVj/A==", - "dev": true, - "dependencies": { - "@tufjs/canonical-json": "1.0.0", - "minimatch": "^9.0.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "mock-registry/node_modules/cacache": { - "version": "17.1.4", - "resolved": "https://registry.npmjs.org/cacache/-/cacache-17.1.4.tgz", - "integrity": "sha512-/aJwG2l3ZMJ1xNAnqbMpA40of9dj/pIH3QfiuQSqjfPJF747VR0J/bHn+/KdNnHKc6XQcWt/AfRSBft82W1d2A==", - "dev": true, - "dependencies": { - "@npmcli/fs": "^3.1.0", - "fs-minipass": "^3.0.0", - "glob": "^10.2.2", - "lru-cache": "^7.7.1", - "minipass": "^7.0.3", - "minipass-collect": "^1.0.2", - "minipass-flush": "^1.0.5", - "minipass-pipeline": "^1.2.4", - "p-map": "^4.0.0", - "ssri": "^10.0.0", - "tar": "^6.1.11", - "unique-filename": "^3.0.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "mock-registry/node_modules/hosted-git-info": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-6.1.1.tgz", - "integrity": "sha512-r0EI+HBMcXadMrugk0GCQ+6BQV39PiWAZVfq7oIckeGiN7sjRGyQxPdft3nQekFTCQbYxLBH+/axZMeH8UX6+w==", - "dev": true, - "dependencies": { - "lru-cache": "^7.5.1" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "mock-registry/node_modules/lru-cache": { - "version": "7.18.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", - "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", - "dev": true, - "engines": { - "node": ">=12" - } - }, - "mock-registry/node_modules/make-fetch-happen": { - "version": "11.1.1", - "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-11.1.1.tgz", - "integrity": "sha512-rLWS7GCSTcEujjVBs2YqG7Y4643u8ucvCJeSRqiLYhesrDuzeuFIk37xREzAsfQaqzl8b9rNCE4m6J8tvX4Q8w==", - "dev": true, - "dependencies": { - "agentkeepalive": "^4.2.1", - "cacache": "^17.0.0", - "http-cache-semantics": "^4.1.1", - "http-proxy-agent": "^5.0.0", - "https-proxy-agent": "^5.0.0", - "is-lambda": "^1.0.1", - "lru-cache": "^7.7.1", - "minipass": "^5.0.0", - "minipass-fetch": "^3.0.0", - "minipass-flush": "^1.0.5", - "minipass-pipeline": "^1.2.4", - "negotiator": "^0.6.3", - "promise-retry": "^2.0.1", - "socks-proxy-agent": "^7.0.0", - "ssri": "^10.0.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "mock-registry/node_modules/make-fetch-happen/node_modules/minipass": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", - "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "mock-registry/node_modules/normalize-package-data": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-5.0.0.tgz", - "integrity": "sha512-h9iPVIfrVZ9wVYQnxFgtw1ugSvGEMOlyPWWtm8BMJhnwyEL/FLbYbTY3V3PpjI/BUK67n9PEWDu6eHzu1fB15Q==", - "dev": true, - "dependencies": { - "hosted-git-info": "^6.0.0", - "is-core-module": "^2.8.1", - "semver": "^7.3.5", - "validate-npm-package-license": "^3.0.4" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "mock-registry/node_modules/npm-packlist": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-7.0.4.tgz", - "integrity": "sha512-d6RGEuRrNS5/N84iglPivjaJPxhDbZmlbTwTDX2IbcRHG5bZCdtysYMhwiPvcF4GisXHGn7xsxv+GQ7T/02M5Q==", - "dev": true, - "dependencies": { - "ignore-walk": "^6.0.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "mock-registry/node_modules/npm-pick-manifest": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/npm-pick-manifest/-/npm-pick-manifest-8.0.2.tgz", - "integrity": "sha512-1dKY+86/AIiq1tkKVD3l0WI+Gd3vkknVGAggsFeBkTvbhMQ1OND/LKkYv4JtXPKUJ8bOTCyLiqEg2P6QNdK+Gg==", - "dev": true, - "dependencies": { - "npm-install-checks": "^6.0.0", - "npm-normalize-package-bin": "^3.0.0", - "npm-package-arg": "^10.0.0", - "semver": "^7.3.5" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "mock-registry/node_modules/npm-pick-manifest/node_modules/npm-package-arg": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-10.1.0.tgz", - "integrity": "sha512-uFyyCEmgBfZTtrKk/5xDfHp6+MdrqGotX/VoOyEEl3mBwiEE5FlBaePanazJSVMPT7vKepcjYBY2ztg9A3yPIA==", - "dev": true, - "dependencies": { - "hosted-git-info": "^6.0.0", - "proc-log": "^3.0.0", - "semver": "^7.3.5", - "validate-npm-package-name": "^5.0.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "mock-registry/node_modules/npm-registry-fetch": { - "version": "14.0.5", - "resolved": "https://registry.npmjs.org/npm-registry-fetch/-/npm-registry-fetch-14.0.5.tgz", - "integrity": "sha512-kIDMIo4aBm6xg7jOttupWZamsZRkAqMqwqqbVXnUqstY5+tapvv6bkH/qMR76jdgV+YljEUCyWx3hRYMrJiAgA==", - "dev": true, - "dependencies": { - "make-fetch-happen": "^11.0.0", - "minipass": "^5.0.0", - "minipass-fetch": "^3.0.0", - "minipass-json-stream": "^1.0.1", - "minizlib": "^2.1.2", - "npm-package-arg": "^10.0.0", - "proc-log": "^3.0.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "mock-registry/node_modules/npm-registry-fetch/node_modules/minipass": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", - "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "mock-registry/node_modules/npm-registry-fetch/node_modules/npm-package-arg": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-10.1.0.tgz", - "integrity": "sha512-uFyyCEmgBfZTtrKk/5xDfHp6+MdrqGotX/VoOyEEl3mBwiEE5FlBaePanazJSVMPT7vKepcjYBY2ztg9A3yPIA==", - "dev": true, - "dependencies": { - "hosted-git-info": "^6.0.0", - "proc-log": "^3.0.0", - "semver": "^7.3.5", - "validate-npm-package-name": "^5.0.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "mock-registry/node_modules/read-package-json": { - "version": "6.0.4", - "resolved": "https://registry.npmjs.org/read-package-json/-/read-package-json-6.0.4.tgz", - "integrity": "sha512-AEtWXYfopBj2z5N5PbkAOeNHRPUg5q+Nen7QLxV8M2zJq1ym6/lCz3fYNTCXe19puu2d06jfHhrP7v/S2PtMMw==", - "dev": true, - "dependencies": { - "glob": "^10.2.2", - "json-parse-even-better-errors": "^3.0.0", - "normalize-package-data": "^5.0.0", - "npm-normalize-package-bin": "^3.0.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "mock-registry/node_modules/sigstore": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/sigstore/-/sigstore-1.9.0.tgz", - "integrity": "sha512-0Zjz0oe37d08VeOtBIuB6cRriqXse2e8w+7yIy2XSXjshRKxbc2KkhXjL229jXSxEm7UbcjS76wcJDGQddVI9A==", - "dev": true, - "dependencies": { - "@sigstore/bundle": "^1.1.0", - "@sigstore/protobuf-specs": "^0.2.0", - "@sigstore/sign": "^1.0.0", - "@sigstore/tuf": "^1.0.3", - "make-fetch-happen": "^11.0.1" - }, - "bin": { - "sigstore": "bin/sigstore.js" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "mock-registry/node_modules/tuf-js": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/tuf-js/-/tuf-js-1.1.7.tgz", - "integrity": "sha512-i3P9Kgw3ytjELUfpuKVDNBJvk4u5bXL6gskv572mcevPbSKCV3zt3djhmlEQ65yERjIbOSncy7U4cQJaB1CBCg==", - "dev": true, - "dependencies": { - "@tufjs/models": "1.0.4", - "debug": "^4.3.4", - "make-fetch-happen": "^11.1.1" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "mock-registry/node_modules/which": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/which/-/which-3.0.1.tgz", - "integrity": "sha512-XA1b62dzQzLfaEOSQFTCOd5KFf/1VSzZo7/7TUjnya6u0vGGKzU96UQBZTAThCb2j4/xjBAyii1OhRLJEivHvg==", - "dev": true, - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/which.js" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, "node_modules/@actions/core": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.0.tgz", From 6ce7c18c3994be2bd6797fc0d2b1bde5a397429e Mon Sep 17 00:00:00 2001 From: Luke Karrys Date: Mon, 2 Oct 2023 15:21:56 -0700 Subject: [PATCH 2/7] deps: @npmcli/query@3.0.1 --- node_modules/@npmcli/query/lib/index.js | 60 +++++++++++++++++-------- node_modules/@npmcli/query/package.json | 9 ++-- package-lock.json | 8 ++-- workspaces/arborist/package.json | 2 +- 4 files changed, 52 insertions(+), 27 deletions(-) diff --git a/node_modules/@npmcli/query/lib/index.js b/node_modules/@npmcli/query/lib/index.js index 9373a4f7adbf0..c7888d5bb5de6 100644 --- a/node_modules/@npmcli/query/lib/index.js +++ b/node_modules/@npmcli/query/lib/index.js @@ -85,31 +85,57 @@ const fixupNestedPseudo = astNode => { transformAst(newRootNode) } -// :semver(, [selector], [function]) +// :semver(, [version|range|selector], [function]) +// note: the first or second parameter must be a static version or range const fixupSemverSpecs = astNode => { - // the first child node contains the version or range, most likely as a tag and a series of - // classes. we combine them into a single string here. this is the only required input. - const children = astNode.nodes.shift().nodes - const value = children.reduce((res, i) => `${res}${String(i)}`, '') - - // next, if we have 2 nodes left then the user called us with a total of 3. that means the - // last one tells us what specific semver function the user is requesting, so we pull that out - let semverFunc - if (astNode.nodes.length === 2) { + // if we have three nodes, the last is the semver function to use, pull that out first + if (astNode.nodes.length === 3) { const funcNode = astNode.nodes.pop().nodes[0] if (funcNode.type === 'tag') { - semverFunc = funcNode.value + astNode.semverFunc = funcNode.value + } else if (funcNode.type === 'string') { + // a string is always in some type of quotes, we don't want those so slice them off + astNode.semverFunc = funcNode.value.slice(1, -1) + } else { + // anything that isn't a tag or a string isn't a function name + throw Object.assign( + new Error('`:semver` pseudo-class expects a function name as last value'), + { code: 'ESEMVERFUNC' } + ) + } + } + + // now if we have 1 node, it's a static value + // istanbul ignore else + if (astNode.nodes.length === 1) { + const semverNode = astNode.nodes.pop() + astNode.semverValue = semverNode.nodes.reduce((res, next) => `${res}${String(next)}`, '') + } else if (astNode.nodes.length === 2) { + // and if we have two nodes, one of them is a static value and we need to determine which it is + for (let i = 0; i < astNode.nodes.length; ++i) { + const type = astNode.nodes[i].nodes[0].type + // the type of the first child may be combinator for ranges, such as >14 + if (type === 'tag' || type === 'combinator') { + const semverNode = astNode.nodes.splice(i, 1)[0] + astNode.semverValue = semverNode.nodes.reduce((res, next) => `${res}${String(next)}`, '') + astNode.semverPosition = i + break + } + } + + if (typeof astNode.semverValue === 'undefined') { + throw Object.assign( + new Error('`:semver` pseudo-class expects a static value in the first or second position'), + { code: 'ESEMVERVALUE' } + ) } } - // now if there's a node left, that node is our selector. since that is the last remaining - // child node, we call fixupAttr on ourselves so that the attribute selectors get parsed + // if we got here, the last remaining child should be attribute selector if (astNode.nodes.length === 1) { fixupAttr(astNode) } else { - // we weren't provided a selector, so we default to `[version]`. note, there's no default - // operator here. that's because we don't know yet if the user has provided us a version - // or range to assert against + // if we don't have a selector, we default to `[version]` astNode.attributeMatcher = { insensitive: false, attribute: 'version', @@ -118,8 +144,6 @@ const fixupSemverSpecs = astNode => { astNode.lookupProperties = [] } - astNode.semverFunc = semverFunc - astNode.semverValue = value astNode.nodes.length = 0 } diff --git a/node_modules/@npmcli/query/package.json b/node_modules/@npmcli/query/package.json index 1e4abd37656f6..5f9fb2744538a 100644 --- a/node_modules/@npmcli/query/package.json +++ b/node_modules/@npmcli/query/package.json @@ -1,6 +1,6 @@ { "name": "@npmcli/query", - "version": "3.0.0", + "version": "3.0.1", "description": "npm query parser and tools", "main": "lib/index.js", "scripts": { @@ -39,11 +39,12 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.5.1" + "version": "4.18.0", + "publish": true }, "devDependencies": { - "@npmcli/eslint-config": "^3.0.1", - "@npmcli/template-oss": "4.5.1", + "@npmcli/eslint-config": "^4.0.0", + "@npmcli/template-oss": "4.18.0", "tap": "^16.2.0" }, "dependencies": { diff --git a/package-lock.json b/package-lock.json index db34bd1c00438..a41c2c4caac20 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2637,9 +2637,9 @@ } }, "node_modules/@npmcli/query": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@npmcli/query/-/query-3.0.0.tgz", - "integrity": "sha512-MFNDSJNgsLZIEBVZ0Q9w9K7o07j5N4o4yjtdz2uEpuCZlXGMuPENiRaFYk0vRqAA64qVuUQwC05g27fRtfUgnA==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@npmcli/query/-/query-3.0.1.tgz", + "integrity": "sha512-0jE8iHBogf/+bFDj+ju6/UMLbJ39c8h6nSe6qile+dB7PJ0iV3gNqcb2vtt6WWCBrxv9uAjzUT/8vroluulidA==", "dependencies": { "postcss-selector-parser": "^6.0.10" }, @@ -17008,7 +17008,7 @@ "@npmcli/name-from-folder": "^2.0.0", "@npmcli/node-gyp": "^3.0.0", "@npmcli/package-json": "^5.0.0", - "@npmcli/query": "^3.0.0", + "@npmcli/query": "^3.0.1", "@npmcli/run-script": "^7.0.1", "bin-links": "^4.0.1", "cacache": "^18.0.0", diff --git a/workspaces/arborist/package.json b/workspaces/arborist/package.json index ab9c51e0cff79..b15f6bb983f13 100644 --- a/workspaces/arborist/package.json +++ b/workspaces/arborist/package.json @@ -11,7 +11,7 @@ "@npmcli/name-from-folder": "^2.0.0", "@npmcli/node-gyp": "^3.0.0", "@npmcli/package-json": "^5.0.0", - "@npmcli/query": "^3.0.0", + "@npmcli/query": "^3.0.1", "@npmcli/run-script": "^7.0.1", "bin-links": "^4.0.1", "cacache": "^18.0.0", From d9188f622c36cede79ee1cb177354baa7feb5288 Mon Sep 17 00:00:00 2001 From: Luke Karrys Date: Mon, 2 Oct 2023 15:22:43 -0700 Subject: [PATCH 3/7] deps: glob@10.3.10 --- node_modules/glob/dist/cjs/package.json | 4 - .../glob/dist/{cjs/src => commonjs}/glob.js | 7 +- .../dist/{cjs/src => commonjs}/has-magic.js | 0 .../glob/dist/{cjs/src => commonjs}/ignore.js | 7 +- .../glob/dist/{cjs/src => commonjs}/index.js | 0 node_modules/glob/dist/commonjs/package.json | 1 + .../dist/{cjs/src => commonjs}/pattern.js | 0 .../dist/{cjs/src => commonjs}/processor.js | 15 +- .../glob/dist/{cjs/src => commonjs}/walker.js | 0 node_modules/glob/dist/esm/bin.d.mts | 3 + .../glob/dist/{cjs/src/bin.js => esm/bin.mjs} | 33 +-- node_modules/glob/dist/{mjs => esm}/glob.js | 7 +- .../glob/dist/{mjs => esm}/has-magic.js | 0 node_modules/glob/dist/{mjs => esm}/ignore.js | 7 +- node_modules/glob/dist/{mjs => esm}/index.js | 0 node_modules/glob/dist/esm/package.json | 1 + .../glob/dist/{mjs => esm}/pattern.js | 0 .../glob/dist/{mjs => esm}/processor.js | 15 +- node_modules/glob/dist/{mjs => esm}/walker.js | 0 node_modules/glob/dist/mjs/package.json | 4 - node_modules/glob/package.json | 69 +++--- node_modules/jackspeak/dist/cjs/package.json | 3 - .../jackspeak/dist/{cjs => commonjs}/index.js | 229 ++++++++++++++---- .../jackspeak/dist/commonjs/package.json | 1 + .../dist/{cjs => commonjs}/parse-args.js | 12 +- .../jackspeak/dist/{mjs => esm}/index.js | 229 ++++++++++++++---- node_modules/jackspeak/dist/esm/package.json | 1 + node_modules/jackspeak/dist/esm/parse-args.js | 26 ++ node_modules/jackspeak/dist/mjs/package.json | 3 - node_modules/jackspeak/dist/mjs/parse-args.js | 19 -- node_modules/jackspeak/package.json | 56 ++--- package-lock.json | 18 +- package.json | 2 +- 33 files changed, 520 insertions(+), 252 deletions(-) delete mode 100644 node_modules/glob/dist/cjs/package.json rename node_modules/glob/dist/{cjs/src => commonjs}/glob.js (96%) rename node_modules/glob/dist/{cjs/src => commonjs}/has-magic.js (100%) rename node_modules/glob/dist/{cjs/src => commonjs}/ignore.js (94%) rename node_modules/glob/dist/{cjs/src => commonjs}/index.js (100%) create mode 100644 node_modules/glob/dist/commonjs/package.json rename node_modules/glob/dist/{cjs/src => commonjs}/pattern.js (100%) rename node_modules/glob/dist/{cjs/src => commonjs}/processor.js (95%) rename node_modules/glob/dist/{cjs/src => commonjs}/walker.js (100%) create mode 100644 node_modules/glob/dist/esm/bin.d.mts rename node_modules/glob/dist/{cjs/src/bin.js => esm/bin.mjs} (91%) rename node_modules/glob/dist/{mjs => esm}/glob.js (97%) rename node_modules/glob/dist/{mjs => esm}/has-magic.js (100%) rename node_modules/glob/dist/{mjs => esm}/ignore.js (93%) rename node_modules/glob/dist/{mjs => esm}/index.js (100%) create mode 100644 node_modules/glob/dist/esm/package.json rename node_modules/glob/dist/{mjs => esm}/pattern.js (100%) rename node_modules/glob/dist/{mjs => esm}/processor.js (95%) rename node_modules/glob/dist/{mjs => esm}/walker.js (100%) delete mode 100644 node_modules/glob/dist/mjs/package.json delete mode 100644 node_modules/jackspeak/dist/cjs/package.json rename node_modules/jackspeak/dist/{cjs => commonjs}/index.js (81%) create mode 100644 node_modules/jackspeak/dist/commonjs/package.json rename node_modules/jackspeak/dist/{cjs => commonjs}/parse-args.js (84%) rename node_modules/jackspeak/dist/{mjs => esm}/index.js (81%) create mode 100644 node_modules/jackspeak/dist/esm/package.json create mode 100644 node_modules/jackspeak/dist/esm/parse-args.js delete mode 100644 node_modules/jackspeak/dist/mjs/package.json delete mode 100644 node_modules/jackspeak/dist/mjs/parse-args.js diff --git a/node_modules/glob/dist/cjs/package.json b/node_modules/glob/dist/cjs/package.json deleted file mode 100644 index c15df94a3582b..0000000000000 --- a/node_modules/glob/dist/cjs/package.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "version": "10.3.3", - "type": "commonjs" -} diff --git a/node_modules/glob/dist/cjs/src/glob.js b/node_modules/glob/dist/commonjs/glob.js similarity index 96% rename from node_modules/glob/dist/cjs/src/glob.js rename to node_modules/glob/dist/commonjs/glob.js index eb37c6b9a6601..5e37335c4426f 100644 --- a/node_modules/glob/dist/cjs/src/glob.js +++ b/node_modules/glob/dist/commonjs/glob.js @@ -162,7 +162,12 @@ class Glob { return set; }, [[], []]); this.patterns = matchSet.map((set, i) => { - return new pattern_js_1.Pattern(set, globParts[i], 0, this.platform); + const g = globParts[i]; + /* c8 ignore start */ + if (!g) + throw new Error('invalid pattern object'); + /* c8 ignore stop */ + return new pattern_js_1.Pattern(set, g, 0, this.platform); }); } async walk() { diff --git a/node_modules/glob/dist/cjs/src/has-magic.js b/node_modules/glob/dist/commonjs/has-magic.js similarity index 100% rename from node_modules/glob/dist/cjs/src/has-magic.js rename to node_modules/glob/dist/commonjs/has-magic.js diff --git a/node_modules/glob/dist/cjs/src/ignore.js b/node_modules/glob/dist/commonjs/ignore.js similarity index 94% rename from node_modules/glob/dist/cjs/src/ignore.js rename to node_modules/glob/dist/commonjs/ignore.js index 0cbcca335e1cc..6cffb49f8ed27 100644 --- a/node_modules/glob/dist/cjs/src/ignore.js +++ b/node_modules/glob/dist/commonjs/ignore.js @@ -53,6 +53,11 @@ class Ignore { for (let i = 0; i < mm.set.length; i++) { const parsed = mm.set[i]; const globParts = mm.globParts[i]; + /* c8 ignore start */ + if (!parsed || !globParts) { + throw new Error('invalid pattern object'); + } + /* c8 ignore stop */ const p = new pattern_js_1.Pattern(parsed, globParts, 0, platform); const m = new minimatch_1.Minimatch(p.globString(), mmopts); const children = globParts[globParts.length - 1] === '**'; @@ -94,7 +99,7 @@ class Ignore { } for (const m of this.absoluteChildren) { if (m.match(fullpath)) - true; + return true; } return false; } diff --git a/node_modules/glob/dist/cjs/src/index.js b/node_modules/glob/dist/commonjs/index.js similarity index 100% rename from node_modules/glob/dist/cjs/src/index.js rename to node_modules/glob/dist/commonjs/index.js diff --git a/node_modules/glob/dist/commonjs/package.json b/node_modules/glob/dist/commonjs/package.json new file mode 100644 index 0000000000000..0292b9956f2e4 --- /dev/null +++ b/node_modules/glob/dist/commonjs/package.json @@ -0,0 +1 @@ +{"type":"commonjs"} \ No newline at end of file diff --git a/node_modules/glob/dist/cjs/src/pattern.js b/node_modules/glob/dist/commonjs/pattern.js similarity index 100% rename from node_modules/glob/dist/cjs/src/pattern.js rename to node_modules/glob/dist/commonjs/pattern.js diff --git a/node_modules/glob/dist/cjs/src/processor.js b/node_modules/glob/dist/commonjs/processor.js similarity index 95% rename from node_modules/glob/dist/cjs/src/processor.js rename to node_modules/glob/dist/commonjs/processor.js index bd067e9b9033d..7d30a3b665000 100644 --- a/node_modules/glob/dist/cjs/src/processor.js +++ b/node_modules/glob/dist/commonjs/processor.js @@ -138,9 +138,6 @@ class Processor { while (typeof (p = pattern.pattern()) === 'string' && (rest = pattern.rest())) { const c = t.resolve(p); - // we can be reasonably sure that .. is a readable dir - if (c.isUnknown() && p !== '..') - break; t = c; pattern = rest; changed = true; @@ -156,14 +153,10 @@ class Processor { // more strings for an unknown entry, // or a pattern starting with magic, mounted on t. if (typeof p === 'string') { - // must be final entry - if (!rest) { - const ifDir = p === '..' || p === '' || p === '.'; - this.matches.add(t.resolve(p), absolute, ifDir); - } - else { - this.subwalks.add(t, pattern); - } + // must not be final entry, otherwise we would have + // concatenated it earlier. + const ifDir = p === '..' || p === '' || p === '.'; + this.matches.add(t.resolve(p), absolute, ifDir); continue; } else if (p === minimatch_1.GLOBSTAR) { diff --git a/node_modules/glob/dist/cjs/src/walker.js b/node_modules/glob/dist/commonjs/walker.js similarity index 100% rename from node_modules/glob/dist/cjs/src/walker.js rename to node_modules/glob/dist/commonjs/walker.js diff --git a/node_modules/glob/dist/esm/bin.d.mts b/node_modules/glob/dist/esm/bin.d.mts new file mode 100644 index 0000000000000..77298e4770817 --- /dev/null +++ b/node_modules/glob/dist/esm/bin.d.mts @@ -0,0 +1,3 @@ +#!/usr/bin/env node +export {}; +//# sourceMappingURL=bin.d.mts.map \ No newline at end of file diff --git a/node_modules/glob/dist/cjs/src/bin.js b/node_modules/glob/dist/esm/bin.mjs similarity index 91% rename from node_modules/glob/dist/cjs/src/bin.js rename to node_modules/glob/dist/esm/bin.mjs index 4a8a88f2734d2..9d57d4a943b26 100755 --- a/node_modules/glob/dist/cjs/src/bin.js +++ b/node_modules/glob/dist/esm/bin.mjs @@ -1,16 +1,19 @@ #!/usr/bin/env node -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const foreground_child_1 = require("foreground-child"); -const fs_1 = require("fs"); -const jackspeak_1 = require("jackspeak"); -const package_json_1 = require("../package.json"); -const index_js_1 = require("./index.js"); -const j = (0, jackspeak_1.jack)({ +import { foregroundChild } from 'foreground-child'; +import { existsSync } from 'fs'; +import { readFile } from 'fs/promises'; +import { jack } from 'jackspeak'; +import { join } from 'path'; +import { fileURLToPath } from 'url'; +import { globStream } from './index.js'; +/* c8 ignore start */ +const { version } = JSON.parse(await readFile(fileURLToPath(new URL('../../package.json', import.meta.url)), 'utf8').catch(() => readFile(fileURLToPath(new URL('../../package.json', import.meta.url)), 'utf8'))); +/* c8 ignore stop */ +const j = jack({ usage: 'glob [options] [ [ ...]]', }) .description(` - Glob v${package_json_1.version} + Glob v${version} Expand the positional glob expression arguments into any matching file system paths found. @@ -228,9 +231,11 @@ try { positionals.push(values.default); const patterns = values.all ? positionals - : positionals.filter(p => !(0, fs_1.existsSync)(p)); - const matches = values.all ? [] : positionals.filter(p => (0, fs_1.existsSync)(p)); - const stream = (0, index_js_1.globStream)(patterns, { + : positionals.filter(p => !existsSync(p)); + const matches = values.all + ? [] + : positionals.filter(p => existsSync(p)).map(p => join(p)); + const stream = globStream(patterns, { absolute: values.absolute, cwd: values.cwd, dot: values.dot, @@ -259,7 +264,7 @@ try { } else { stream.on('data', f => matches.push(f)); - stream.on('end', () => (0, foreground_child_1.foregroundChild)(cmd, matches, { shell: true })); + stream.on('end', () => foregroundChild(cmd, matches, { shell: true })); } } catch (e) { @@ -267,4 +272,4 @@ catch (e) { console.error(e instanceof Error ? e.message : String(e)); process.exit(1); } -//# sourceMappingURL=bin.js.map \ No newline at end of file +//# sourceMappingURL=bin.mjs.map \ No newline at end of file diff --git a/node_modules/glob/dist/mjs/glob.js b/node_modules/glob/dist/esm/glob.js similarity index 97% rename from node_modules/glob/dist/mjs/glob.js rename to node_modules/glob/dist/esm/glob.js index 8ff26154427be..2a2b15d3685b8 100644 --- a/node_modules/glob/dist/mjs/glob.js +++ b/node_modules/glob/dist/esm/glob.js @@ -159,7 +159,12 @@ export class Glob { return set; }, [[], []]); this.patterns = matchSet.map((set, i) => { - return new Pattern(set, globParts[i], 0, this.platform); + const g = globParts[i]; + /* c8 ignore start */ + if (!g) + throw new Error('invalid pattern object'); + /* c8 ignore stop */ + return new Pattern(set, g, 0, this.platform); }); } async walk() { diff --git a/node_modules/glob/dist/mjs/has-magic.js b/node_modules/glob/dist/esm/has-magic.js similarity index 100% rename from node_modules/glob/dist/mjs/has-magic.js rename to node_modules/glob/dist/esm/has-magic.js diff --git a/node_modules/glob/dist/mjs/ignore.js b/node_modules/glob/dist/esm/ignore.js similarity index 93% rename from node_modules/glob/dist/mjs/ignore.js rename to node_modules/glob/dist/esm/ignore.js index 2dbaa16a11460..e8cbaf96b3a80 100644 --- a/node_modules/glob/dist/mjs/ignore.js +++ b/node_modules/glob/dist/esm/ignore.js @@ -50,6 +50,11 @@ export class Ignore { for (let i = 0; i < mm.set.length; i++) { const parsed = mm.set[i]; const globParts = mm.globParts[i]; + /* c8 ignore start */ + if (!parsed || !globParts) { + throw new Error('invalid pattern object'); + } + /* c8 ignore stop */ const p = new Pattern(parsed, globParts, 0, platform); const m = new Minimatch(p.globString(), mmopts); const children = globParts[globParts.length - 1] === '**'; @@ -91,7 +96,7 @@ export class Ignore { } for (const m of this.absoluteChildren) { if (m.match(fullpath)) - true; + return true; } return false; } diff --git a/node_modules/glob/dist/mjs/index.js b/node_modules/glob/dist/esm/index.js similarity index 100% rename from node_modules/glob/dist/mjs/index.js rename to node_modules/glob/dist/esm/index.js diff --git a/node_modules/glob/dist/esm/package.json b/node_modules/glob/dist/esm/package.json new file mode 100644 index 0000000000000..7c34deb5837d8 --- /dev/null +++ b/node_modules/glob/dist/esm/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/node_modules/glob/dist/mjs/pattern.js b/node_modules/glob/dist/esm/pattern.js similarity index 100% rename from node_modules/glob/dist/mjs/pattern.js rename to node_modules/glob/dist/esm/pattern.js diff --git a/node_modules/glob/dist/mjs/processor.js b/node_modules/glob/dist/esm/processor.js similarity index 95% rename from node_modules/glob/dist/mjs/processor.js rename to node_modules/glob/dist/esm/processor.js index dd2228ad6761a..b5b2de2d314ca 100644 --- a/node_modules/glob/dist/mjs/processor.js +++ b/node_modules/glob/dist/esm/processor.js @@ -132,9 +132,6 @@ export class Processor { while (typeof (p = pattern.pattern()) === 'string' && (rest = pattern.rest())) { const c = t.resolve(p); - // we can be reasonably sure that .. is a readable dir - if (c.isUnknown() && p !== '..') - break; t = c; pattern = rest; changed = true; @@ -150,14 +147,10 @@ export class Processor { // more strings for an unknown entry, // or a pattern starting with magic, mounted on t. if (typeof p === 'string') { - // must be final entry - if (!rest) { - const ifDir = p === '..' || p === '' || p === '.'; - this.matches.add(t.resolve(p), absolute, ifDir); - } - else { - this.subwalks.add(t, pattern); - } + // must not be final entry, otherwise we would have + // concatenated it earlier. + const ifDir = p === '..' || p === '' || p === '.'; + this.matches.add(t.resolve(p), absolute, ifDir); continue; } else if (p === GLOBSTAR) { diff --git a/node_modules/glob/dist/mjs/walker.js b/node_modules/glob/dist/esm/walker.js similarity index 100% rename from node_modules/glob/dist/mjs/walker.js rename to node_modules/glob/dist/esm/walker.js diff --git a/node_modules/glob/dist/mjs/package.json b/node_modules/glob/dist/mjs/package.json deleted file mode 100644 index 5cc80943d565b..0000000000000 --- a/node_modules/glob/dist/mjs/package.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "version": "10.3.3", - "type": "module" -} diff --git a/node_modules/glob/package.json b/node_modules/glob/package.json index 2d25985d2bbb5..ae0dfae17460b 100644 --- a/node_modules/glob/package.json +++ b/node_modules/glob/package.json @@ -2,27 +2,35 @@ "author": "Isaac Z. Schlueter (https://blog.izs.me/)", "name": "glob", "description": "the most correct and second fastest glob implementation in JavaScript", - "version": "10.3.3", - "bin": "./dist/cjs/src/bin.js", - "repository": { - "type": "git", - "url": "git://github.com/isaacs/node-glob.git" + "version": "10.3.10", + "type": "module", + "tshy": { + "main": true, + "exports": { + "./package.json": "./package.json", + ".": "./src/index.ts" + } }, - "main": "./dist/cjs/src/index.js", - "module": "./dist/mjs/index.js", - "types": "./dist/mjs/index.d.ts", + "bin": "./dist/esm/bin.mjs", + "main": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", "exports": { + "./package.json": "./package.json", ".": { "import": { - "types": "./dist/mjs/index.d.ts", - "default": "./dist/mjs/index.js" + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.js" }, "require": { - "types": "./dist/cjs/src/index.d.ts", - "default": "./dist/cjs/src/index.js" + "types": "./dist/commonjs/index.d.ts", + "default": "./dist/commonjs/index.js" } } }, + "repository": { + "type": "git", + "url": "git://github.com/isaacs/node-glob.git" + }, "files": [ "dist" ], @@ -30,14 +38,13 @@ "preversion": "npm test", "postversion": "npm publish", "prepublishOnly": "git push origin --follow-tags", - "preprepare": "rm -rf dist", - "prepare": "tsc -p tsconfig.json && tsc -p tsconfig-esm.json && bash fixup.sh", + "prepare": "tshy", "pretest": "npm run prepare", "presnap": "npm run prepare", - "test": "c8 tap", - "snap": "c8 tap", + "test": "tap", + "snap": "tap", "format": "prettier --write . --loglevel warn", - "typedoc": "typedoc --tsconfig tsconfig-esm.json ./src/*.ts", + "typedoc": "typedoc --tsconfig .tshy/esm.json ./src/*.ts", "prepublish": "npm run benchclean", "profclean": "rm -f v8.log profile.txt", "test-regen": "npm run profclean && TEST_REGEN=1 node --no-warnings --loader ts-node/esm test/00-setup.ts", @@ -45,7 +52,7 @@ "bench": "bash benchmark.sh", "preprof": "npm run prepare", "prof": "bash prof.sh", - "benchclean": "node benchclean.js" + "benchclean": "node benchclean.cjs" }, "prettier": { "semi": false, @@ -60,33 +67,25 @@ }, "dependencies": { "foreground-child": "^3.1.0", - "jackspeak": "^2.0.3", + "jackspeak": "^2.3.5", "minimatch": "^9.0.1", "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", "path-scurry": "^1.10.1" }, "devDependencies": { "@types/node": "^20.3.2", - "@types/tap": "^15.0.7", - "c8": "^7.12.0", "memfs": "^3.4.13", - "mkdirp": "^2.1.4", + "mkdirp": "^3.0.1", "prettier": "^2.8.3", - "rimraf": "^4.1.3", - "tap": "^16.3.4", - "ts-node": "^10.9.1", - "typedoc": "^0.23.24", - "typescript": "^4.9.4" + "rimraf": "^5.0.1", + "sync-content": "^1.0.2", + "tap": "^18.1.4", + "tshy": "^1.2.2", + "typedoc": "^0.25.1", + "typescript": "^5.2.2" }, "tap": { - "before": "test/00-setup.ts", - "coverage": false, - "node-arg": [ - "--no-warnings", - "--loader", - "ts-node/esm" - ], - "ts": false + "before": "test/00-setup.ts" }, "license": "ISC", "funding": { diff --git a/node_modules/jackspeak/dist/cjs/package.json b/node_modules/jackspeak/dist/cjs/package.json deleted file mode 100644 index 5bbefffbabee3..0000000000000 --- a/node_modules/jackspeak/dist/cjs/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "type": "commonjs" -} diff --git a/node_modules/jackspeak/dist/cjs/index.js b/node_modules/jackspeak/dist/commonjs/index.js similarity index 81% rename from node_modules/jackspeak/dist/cjs/index.js rename to node_modules/jackspeak/dist/commonjs/index.js index f268e40e05afa..956d6a275c363 100644 --- a/node_modules/jackspeak/dist/cjs/index.js +++ b/node_modules/jackspeak/dist/commonjs/index.js @@ -42,7 +42,9 @@ const toEnvVal = (value, delim = '\n') => { return str; }; const fromEnvVal = (env, type, multiple, delim = '\n') => (multiple - ? env.split(delim).map(v => fromEnvVal(v, type, false)) + ? env + ? env.split(delim).map(v => fromEnvVal(v, type, false)) + : [] : type === 'string' ? env : type === 'boolean' @@ -62,7 +64,9 @@ const valueType = (v) => typeof v === 'string' : Array.isArray(v) ? joinTypes([...new Set(v.map(v => valueType(v)))]) + '[]' : `${v.type}${v.multiple ? '[]' : ''}`; -const joinTypes = (types) => types.length === 1 ? types[0] : `(${types.join('|')})`; +const joinTypes = (types) => types.length === 1 && typeof types[0] === 'string' + ? types[0] + : `(${types.join('|')})`; const isValidValue = (v, type, multi) => { if (multi) { if (!Array.isArray(v)) @@ -190,6 +194,11 @@ const toParseArgsOptionsConfig = (options) => { const c = {}; for (const longOption in options) { const config = options[longOption]; + /* c8 ignore start */ + if (!config) { + throw new Error('config must be an object: ' + longOption); + } + /* c8 ignore start */ if ((0, exports.isConfigOption)(config, 'number', true)) { c[longOption] = { type: 'string', @@ -214,8 +223,9 @@ const toParseArgsOptionsConfig = (options) => { default: conf.default, }; } + const clo = c[longOption]; if (typeof config.short === 'string') { - c[longOption].short = config.short; + clo.short = config.short; } if (config.type === 'boolean' && !longOption.startsWith('no-') && @@ -243,6 +253,7 @@ class Jack { #envPrefix; #allowPositionals; #usage; + #usageMarkdown; constructor(options = {}) { this.#options = options; this.#allowPositionals = options.allowPositionals !== false; @@ -270,6 +281,12 @@ class Jack { } for (const [field, value] of Object.entries(values)) { const my = this.#configSet[field]; + // already validated, just for TS's benefit + /* c8 ignore start */ + if (!my) { + throw new Error('unexpected field in config set: ' + field); + } + /* c8 ignore stop */ my.default = value; } return this; @@ -365,8 +382,9 @@ class Jack { } if (my.multiple) { const pv = p.values; - pv[token.name] = pv[token.name] ?? []; - pv[token.name].push(value); + const tn = pv[token.name] ?? []; + pv[token.name] = tn; + tn.push(value); } else { const pv = p.values; @@ -381,7 +399,7 @@ class Jack { } } for (const [field, value] of Object.entries(p.values)) { - const valid = this.#configSet[field].validate; + const valid = this.#configSet[field]?.validate; if (valid && !valid(value)) { throw new Error(`Invalid value provided for --${field}: ${JSON.stringify(value)}`); } @@ -389,6 +407,20 @@ class Jack { this.#writeEnv(p); return p; } + /** + * do not set fields as 'no-foo' if 'foo' exists and both are bools + * just set foo. + */ + #noNoFields(f, val, s = f) { + if (!f.startsWith('no-') || typeof val !== 'boolean') + return; + const yes = f.substring('no-'.length); + // recurse so we get the core config key we care about. + this.#noNoFields(yes, val, s); + if (this.#configSet[yes]?.type === 'boolean') { + throw new Error(`do not set '${s}', instead set '${yes}' as desired.`); + } + } /** * Validate that any arbitrary object is a valid configuration `values` * object. Useful when loading config files or other sources. @@ -398,6 +430,7 @@ class Jack { throw new Error('Invalid config: not an object'); } for (const field in o) { + this.#noNoFields(field, o[field]); const config = this.#configSet[field]; if (!config) { throw new Error(`Unknown config option: ${field}`); @@ -418,17 +451,17 @@ class Jack { return; for (const [field, value] of Object.entries(p.values)) { const my = this.#configSet[field]; - this.#env[toEnvKey(this.#envPrefix, field)] = toEnvVal(value, my.delim); + this.#env[toEnvKey(this.#envPrefix, field)] = toEnvVal(value, my?.delim); } } /** * Add a heading to the usage output banner */ - heading(text, level) { + heading(text, level, { pre = false } = {}) { if (level === undefined) { level = this.#fields.some(r => isHeading(r)) ? 2 : 1; } - this.#fields.push({ type: 'heading', text, level }); + this.#fields.push({ type: 'heading', text, level, pre }); return this; } /** @@ -555,7 +588,7 @@ class Jack { }); } else { - const cmd = (0, node_path_1.basename)(process.argv[1]); + const cmd = (0, node_path_1.basename)(String(process.argv[1])); const shortFlags = []; const shorts = []; const flags = []; @@ -586,12 +619,122 @@ class Jack { } ui.div({ padding: [0, 0, 0, 0], text: '' }); const maybeDesc = this.#fields[start]; - if (isDescription(maybeDesc)) { + if (maybeDesc && isDescription(maybeDesc)) { const print = normalize(maybeDesc.text, maybeDesc.pre); start++; ui.div({ padding: [0, 0, 0, 0], text: print }); ui.div({ padding: [0, 0, 0, 0], text: '' }); } + const { rows, maxWidth } = this.#usageRows(start); + // every heading/description after the first gets indented by 2 + // extra spaces. + for (const row of rows) { + if (row.left) { + // If the row is too long, don't wrap it + // Bump the right-hand side down a line to make room + const configIndent = indent(Math.max(headingLevel, 2)); + if (row.left.length > maxWidth - 3) { + ui.div({ text: row.left, padding: [0, 0, 0, configIndent] }); + ui.div({ text: row.text, padding: [0, 0, 0, maxWidth] }); + } + else { + ui.div({ + text: row.left, + padding: [0, 1, 0, configIndent], + width: maxWidth, + }, { padding: [0, 0, 0, 0], text: row.text }); + } + if (row.skipLine) { + ui.div({ padding: [0, 0, 0, 0], text: '' }); + } + } + else { + if (isHeading(row)) { + const { level } = row; + headingLevel = level; + // only h1 and h2 have bottom padding + // h3-h6 do not + const b = level <= 2 ? 1 : 0; + ui.div({ ...row, padding: [0, 0, b, indent(level)] }); + } + else { + ui.div({ ...row, padding: [0, 0, 1, indent(headingLevel + 1)] }); + } + } + } + return (this.#usage = ui.toString()); + } + /** + * Return the usage banner markdown for the given configuration + */ + usageMarkdown() { + if (this.#usageMarkdown) + return this.#usageMarkdown; + const out = []; + let headingLevel = 1; + const first = this.#fields[0]; + let start = first?.type === 'heading' ? 1 : 0; + if (first?.type === 'heading') { + out.push(`# ${normalizeOneLine(first.text)}`); + } + out.push('Usage:'); + if (this.#options.usage) { + out.push(normalizeMarkdown(this.#options.usage, true)); + } + else { + const cmd = (0, node_path_1.basename)(String(process.argv[1])); + const shortFlags = []; + const shorts = []; + const flags = []; + const opts = []; + for (const [field, config] of Object.entries(this.#configSet)) { + if (config.short) { + if (config.type === 'boolean') + shortFlags.push(config.short); + else + shorts.push([config.short, config.hint || field]); + } + else { + if (config.type === 'boolean') + flags.push(field); + else + opts.push([field, config.hint || field]); + } + } + const sf = shortFlags.length ? ' -' + shortFlags.join('') : ''; + const so = shorts.map(([k, v]) => ` --${k}=<${v}>`).join(''); + const lf = flags.map(k => ` --${k}`).join(''); + const lo = opts.map(([k, v]) => ` --${k}=<${v}>`).join(''); + const usage = `${cmd}${sf}${so}${lf}${lo}`.trim(); + out.push(normalizeMarkdown(usage, true)); + } + const maybeDesc = this.#fields[start]; + if (maybeDesc && isDescription(maybeDesc)) { + out.push(normalizeMarkdown(maybeDesc.text, maybeDesc.pre)); + start++; + } + const { rows } = this.#usageRows(start); + // heading level in markdown is number of # ahead of text + for (const row of rows) { + if (row.left) { + out.push('#'.repeat(headingLevel + 1) + + ' ' + + normalizeOneLine(row.left, true)); + if (row.text) + out.push(normalizeMarkdown(row.text)); + } + else if (isHeading(row)) { + const { level } = row; + headingLevel = level; + out.push(`${'#'.repeat(headingLevel)} ${normalizeOneLine(row.text, row.pre)}`); + } + else { + out.push(normalizeMarkdown(row.text, !!row.pre)); + } + } + return (this.#usageMarkdown = out.join('\n\n') + '\n'); + } + #usageRows(start) { // turn each config type into a row, and figure out the width of the // left hand indentation for the option descriptions. let maxMax = Math.max(12, Math.min(26, Math.floor(width / 3))); @@ -639,43 +782,7 @@ class Jack { } rows.push(row); } - // every heading/description after the first gets indented by 2 - // extra spaces. - for (const row of rows) { - if (row.left) { - // If the row is too long, don't wrap it - // Bump the right-hand side down a line to make room - const configIndent = indent(Math.max(headingLevel, 2)); - if (row.left.length > maxWidth - 2) { - ui.div({ text: row.left, padding: [0, 0, 0, configIndent] }); - ui.div({ text: row.text, padding: [0, 0, 0, maxWidth] }); - } - else { - ui.div({ - text: row.left, - padding: [0, 1, 0, configIndent], - width: maxWidth, - }, { padding: [0, 0, 0, 0], text: row.text }); - } - if (row.skipLine) { - ui.div({ padding: [0, 0, 0, 0], text: '' }); - } - } - else { - if (isHeading(row)) { - const { level } = row; - headingLevel = level; - // only h1 and h2 have bottom padding - // h3-h6 do not - const b = level <= 2 ? 1 : 0; - ui.div({ ...row, padding: [0, 0, b, indent(level)] }); - } - else { - ui.div({ ...row, padding: [0, 0, 1, indent(headingLevel + 1)] }); - } - } - } - return (this.#usage = ui.toString()); + return { rows, maxWidth }; } /** * Return the configuration options as a plain object @@ -688,7 +795,9 @@ class Jack { ...(def.multiple ? { multiple: true } : {}), ...(def.delim ? { delim: def.delim } : {}), ...(def.short ? { short: def.short } : {}), - ...(def.description ? { description: def.description } : {}), + ...(def.description + ? { description: normalize(def.description) } + : {}), ...(def.validate ? { validate: def.validate } : {}), ...(def.default !== undefined ? { default: def.default } : {}), }, @@ -705,8 +814,11 @@ exports.Jack = Jack; // Unwrap and un-indent, so we can wrap description // strings however makes them look nice in the code. const normalize = (s, pre = false) => pre - // prepend a ZWSP to each line so cliui doesn't strip it. - ? s.split('\n').map(l => `\u200b${l}`).join('\n') + ? // prepend a ZWSP to each line so cliui doesn't strip it. + s + .split('\n') + .map(l => `\u200b${l}`) + .join('\n') : s // remove single line breaks, except for lists .replace(/([^\n])\n[ \t]*([^\n])/g, (_, $1, $2) => !/^[-*]/.test($2) ? `${$1} ${$2}` : `${$1}\n${$2}`) @@ -714,7 +826,22 @@ const normalize = (s, pre = false) => pre .replace(/([^\n])[ \t]+([^\n])/g, '$1 $2') // two line breaks are enough .replace(/\n{3,}/g, '\n\n') + // remove any spaces at the start of a line + .replace(/\n[ \t]+/g, '\n') + .trim(); +// normalize for markdown printing, remove leading spaces on lines +const normalizeMarkdown = (s, pre = false) => { + const n = normalize(s, pre).replace(/\\/g, '\\\\'); + return pre + ? `\`\`\`\n${n.replace(/\u200b/g, '')}\n\`\`\`` + : n.replace(/\n +/g, '\n').trim(); +}; +const normalizeOneLine = (s, pre = false) => { + const n = normalize(s, pre) + .replace(/[\s\u200b]+/g, ' ') .trim(); + return pre ? `\`${n}\`` : n; +}; /** * Main entry point. Create and return a {@link Jack} object. */ diff --git a/node_modules/jackspeak/dist/commonjs/package.json b/node_modules/jackspeak/dist/commonjs/package.json new file mode 100644 index 0000000000000..0292b9956f2e4 --- /dev/null +++ b/node_modules/jackspeak/dist/commonjs/package.json @@ -0,0 +1 @@ +{"type":"commonjs"} \ No newline at end of file diff --git a/node_modules/jackspeak/dist/cjs/parse-args.js b/node_modules/jackspeak/dist/commonjs/parse-args.js similarity index 84% rename from node_modules/jackspeak/dist/cjs/parse-args.js rename to node_modules/jackspeak/dist/commonjs/parse-args.js index 471b4d97dc996..ab628be8c9d5c 100644 --- a/node_modules/jackspeak/dist/cjs/parse-args.js +++ b/node_modules/jackspeak/dist/commonjs/parse-args.js @@ -34,9 +34,17 @@ const pvs = pv .replace(/^v/, '') .split('.') .map(s => parseInt(s, 10)); +/* c8 ignore start */ +const [major = 0, minor = 0] = pvs; +/* c8 ignore stop */ let { parseArgs: pa } = util; -if (!pa || pvs[0] > 18 || pvs[1] < 11) { +/* c8 ignore start */ +if (!pa || + major < 16 || + (major === 18 && minor < 11) || + (major === 16 && minor < 19)) { + /* c8 ignore stop */ pa = require('@pkgjs/parseargs').parseArgs; } exports.parseArgs = pa; -//# sourceMappingURL=parse-args-cjs.js.map \ No newline at end of file +//# sourceMappingURL=parse-args-cjs.cjs.map \ No newline at end of file diff --git a/node_modules/jackspeak/dist/mjs/index.js b/node_modules/jackspeak/dist/esm/index.js similarity index 81% rename from node_modules/jackspeak/dist/mjs/index.js rename to node_modules/jackspeak/dist/esm/index.js index a3e2b6bab7cbb..9914049f89026 100644 --- a/node_modules/jackspeak/dist/mjs/index.js +++ b/node_modules/jackspeak/dist/esm/index.js @@ -36,7 +36,9 @@ const toEnvVal = (value, delim = '\n') => { return str; }; const fromEnvVal = (env, type, multiple, delim = '\n') => (multiple - ? env.split(delim).map(v => fromEnvVal(v, type, false)) + ? env + ? env.split(delim).map(v => fromEnvVal(v, type, false)) + : [] : type === 'string' ? env : type === 'boolean' @@ -55,7 +57,9 @@ const valueType = (v) => typeof v === 'string' : Array.isArray(v) ? joinTypes([...new Set(v.map(v => valueType(v)))]) + '[]' : `${v.type}${v.multiple ? '[]' : ''}`; -const joinTypes = (types) => types.length === 1 ? types[0] : `(${types.join('|')})`; +const joinTypes = (types) => types.length === 1 && typeof types[0] === 'string' + ? types[0] + : `(${types.join('|')})`; const isValidValue = (v, type, multi) => { if (multi) { if (!Array.isArray(v)) @@ -182,6 +186,11 @@ const toParseArgsOptionsConfig = (options) => { const c = {}; for (const longOption in options) { const config = options[longOption]; + /* c8 ignore start */ + if (!config) { + throw new Error('config must be an object: ' + longOption); + } + /* c8 ignore start */ if (isConfigOption(config, 'number', true)) { c[longOption] = { type: 'string', @@ -206,8 +215,9 @@ const toParseArgsOptionsConfig = (options) => { default: conf.default, }; } + const clo = c[longOption]; if (typeof config.short === 'string') { - c[longOption].short = config.short; + clo.short = config.short; } if (config.type === 'boolean' && !longOption.startsWith('no-') && @@ -235,6 +245,7 @@ export class Jack { #envPrefix; #allowPositionals; #usage; + #usageMarkdown; constructor(options = {}) { this.#options = options; this.#allowPositionals = options.allowPositionals !== false; @@ -262,6 +273,12 @@ export class Jack { } for (const [field, value] of Object.entries(values)) { const my = this.#configSet[field]; + // already validated, just for TS's benefit + /* c8 ignore start */ + if (!my) { + throw new Error('unexpected field in config set: ' + field); + } + /* c8 ignore stop */ my.default = value; } return this; @@ -357,8 +374,9 @@ export class Jack { } if (my.multiple) { const pv = p.values; - pv[token.name] = pv[token.name] ?? []; - pv[token.name].push(value); + const tn = pv[token.name] ?? []; + pv[token.name] = tn; + tn.push(value); } else { const pv = p.values; @@ -373,7 +391,7 @@ export class Jack { } } for (const [field, value] of Object.entries(p.values)) { - const valid = this.#configSet[field].validate; + const valid = this.#configSet[field]?.validate; if (valid && !valid(value)) { throw new Error(`Invalid value provided for --${field}: ${JSON.stringify(value)}`); } @@ -381,6 +399,20 @@ export class Jack { this.#writeEnv(p); return p; } + /** + * do not set fields as 'no-foo' if 'foo' exists and both are bools + * just set foo. + */ + #noNoFields(f, val, s = f) { + if (!f.startsWith('no-') || typeof val !== 'boolean') + return; + const yes = f.substring('no-'.length); + // recurse so we get the core config key we care about. + this.#noNoFields(yes, val, s); + if (this.#configSet[yes]?.type === 'boolean') { + throw new Error(`do not set '${s}', instead set '${yes}' as desired.`); + } + } /** * Validate that any arbitrary object is a valid configuration `values` * object. Useful when loading config files or other sources. @@ -390,6 +422,7 @@ export class Jack { throw new Error('Invalid config: not an object'); } for (const field in o) { + this.#noNoFields(field, o[field]); const config = this.#configSet[field]; if (!config) { throw new Error(`Unknown config option: ${field}`); @@ -410,17 +443,17 @@ export class Jack { return; for (const [field, value] of Object.entries(p.values)) { const my = this.#configSet[field]; - this.#env[toEnvKey(this.#envPrefix, field)] = toEnvVal(value, my.delim); + this.#env[toEnvKey(this.#envPrefix, field)] = toEnvVal(value, my?.delim); } } /** * Add a heading to the usage output banner */ - heading(text, level) { + heading(text, level, { pre = false } = {}) { if (level === undefined) { level = this.#fields.some(r => isHeading(r)) ? 2 : 1; } - this.#fields.push({ type: 'heading', text, level }); + this.#fields.push({ type: 'heading', text, level, pre }); return this; } /** @@ -547,7 +580,7 @@ export class Jack { }); } else { - const cmd = basename(process.argv[1]); + const cmd = basename(String(process.argv[1])); const shortFlags = []; const shorts = []; const flags = []; @@ -578,12 +611,122 @@ export class Jack { } ui.div({ padding: [0, 0, 0, 0], text: '' }); const maybeDesc = this.#fields[start]; - if (isDescription(maybeDesc)) { + if (maybeDesc && isDescription(maybeDesc)) { const print = normalize(maybeDesc.text, maybeDesc.pre); start++; ui.div({ padding: [0, 0, 0, 0], text: print }); ui.div({ padding: [0, 0, 0, 0], text: '' }); } + const { rows, maxWidth } = this.#usageRows(start); + // every heading/description after the first gets indented by 2 + // extra spaces. + for (const row of rows) { + if (row.left) { + // If the row is too long, don't wrap it + // Bump the right-hand side down a line to make room + const configIndent = indent(Math.max(headingLevel, 2)); + if (row.left.length > maxWidth - 3) { + ui.div({ text: row.left, padding: [0, 0, 0, configIndent] }); + ui.div({ text: row.text, padding: [0, 0, 0, maxWidth] }); + } + else { + ui.div({ + text: row.left, + padding: [0, 1, 0, configIndent], + width: maxWidth, + }, { padding: [0, 0, 0, 0], text: row.text }); + } + if (row.skipLine) { + ui.div({ padding: [0, 0, 0, 0], text: '' }); + } + } + else { + if (isHeading(row)) { + const { level } = row; + headingLevel = level; + // only h1 and h2 have bottom padding + // h3-h6 do not + const b = level <= 2 ? 1 : 0; + ui.div({ ...row, padding: [0, 0, b, indent(level)] }); + } + else { + ui.div({ ...row, padding: [0, 0, 1, indent(headingLevel + 1)] }); + } + } + } + return (this.#usage = ui.toString()); + } + /** + * Return the usage banner markdown for the given configuration + */ + usageMarkdown() { + if (this.#usageMarkdown) + return this.#usageMarkdown; + const out = []; + let headingLevel = 1; + const first = this.#fields[0]; + let start = first?.type === 'heading' ? 1 : 0; + if (first?.type === 'heading') { + out.push(`# ${normalizeOneLine(first.text)}`); + } + out.push('Usage:'); + if (this.#options.usage) { + out.push(normalizeMarkdown(this.#options.usage, true)); + } + else { + const cmd = basename(String(process.argv[1])); + const shortFlags = []; + const shorts = []; + const flags = []; + const opts = []; + for (const [field, config] of Object.entries(this.#configSet)) { + if (config.short) { + if (config.type === 'boolean') + shortFlags.push(config.short); + else + shorts.push([config.short, config.hint || field]); + } + else { + if (config.type === 'boolean') + flags.push(field); + else + opts.push([field, config.hint || field]); + } + } + const sf = shortFlags.length ? ' -' + shortFlags.join('') : ''; + const so = shorts.map(([k, v]) => ` --${k}=<${v}>`).join(''); + const lf = flags.map(k => ` --${k}`).join(''); + const lo = opts.map(([k, v]) => ` --${k}=<${v}>`).join(''); + const usage = `${cmd}${sf}${so}${lf}${lo}`.trim(); + out.push(normalizeMarkdown(usage, true)); + } + const maybeDesc = this.#fields[start]; + if (maybeDesc && isDescription(maybeDesc)) { + out.push(normalizeMarkdown(maybeDesc.text, maybeDesc.pre)); + start++; + } + const { rows } = this.#usageRows(start); + // heading level in markdown is number of # ahead of text + for (const row of rows) { + if (row.left) { + out.push('#'.repeat(headingLevel + 1) + + ' ' + + normalizeOneLine(row.left, true)); + if (row.text) + out.push(normalizeMarkdown(row.text)); + } + else if (isHeading(row)) { + const { level } = row; + headingLevel = level; + out.push(`${'#'.repeat(headingLevel)} ${normalizeOneLine(row.text, row.pre)}`); + } + else { + out.push(normalizeMarkdown(row.text, !!row.pre)); + } + } + return (this.#usageMarkdown = out.join('\n\n') + '\n'); + } + #usageRows(start) { // turn each config type into a row, and figure out the width of the // left hand indentation for the option descriptions. let maxMax = Math.max(12, Math.min(26, Math.floor(width / 3))); @@ -631,43 +774,7 @@ export class Jack { } rows.push(row); } - // every heading/description after the first gets indented by 2 - // extra spaces. - for (const row of rows) { - if (row.left) { - // If the row is too long, don't wrap it - // Bump the right-hand side down a line to make room - const configIndent = indent(Math.max(headingLevel, 2)); - if (row.left.length > maxWidth - 2) { - ui.div({ text: row.left, padding: [0, 0, 0, configIndent] }); - ui.div({ text: row.text, padding: [0, 0, 0, maxWidth] }); - } - else { - ui.div({ - text: row.left, - padding: [0, 1, 0, configIndent], - width: maxWidth, - }, { padding: [0, 0, 0, 0], text: row.text }); - } - if (row.skipLine) { - ui.div({ padding: [0, 0, 0, 0], text: '' }); - } - } - else { - if (isHeading(row)) { - const { level } = row; - headingLevel = level; - // only h1 and h2 have bottom padding - // h3-h6 do not - const b = level <= 2 ? 1 : 0; - ui.div({ ...row, padding: [0, 0, b, indent(level)] }); - } - else { - ui.div({ ...row, padding: [0, 0, 1, indent(headingLevel + 1)] }); - } - } - } - return (this.#usage = ui.toString()); + return { rows, maxWidth }; } /** * Return the configuration options as a plain object @@ -680,7 +787,9 @@ export class Jack { ...(def.multiple ? { multiple: true } : {}), ...(def.delim ? { delim: def.delim } : {}), ...(def.short ? { short: def.short } : {}), - ...(def.description ? { description: def.description } : {}), + ...(def.description + ? { description: normalize(def.description) } + : {}), ...(def.validate ? { validate: def.validate } : {}), ...(def.default !== undefined ? { default: def.default } : {}), }, @@ -696,8 +805,11 @@ export class Jack { // Unwrap and un-indent, so we can wrap description // strings however makes them look nice in the code. const normalize = (s, pre = false) => pre - // prepend a ZWSP to each line so cliui doesn't strip it. - ? s.split('\n').map(l => `\u200b${l}`).join('\n') + ? // prepend a ZWSP to each line so cliui doesn't strip it. + s + .split('\n') + .map(l => `\u200b${l}`) + .join('\n') : s // remove single line breaks, except for lists .replace(/([^\n])\n[ \t]*([^\n])/g, (_, $1, $2) => !/^[-*]/.test($2) ? `${$1} ${$2}` : `${$1}\n${$2}`) @@ -705,7 +817,22 @@ const normalize = (s, pre = false) => pre .replace(/([^\n])[ \t]+([^\n])/g, '$1 $2') // two line breaks are enough .replace(/\n{3,}/g, '\n\n') + // remove any spaces at the start of a line + .replace(/\n[ \t]+/g, '\n') + .trim(); +// normalize for markdown printing, remove leading spaces on lines +const normalizeMarkdown = (s, pre = false) => { + const n = normalize(s, pre).replace(/\\/g, '\\\\'); + return pre + ? `\`\`\`\n${n.replace(/\u200b/g, '')}\n\`\`\`` + : n.replace(/\n +/g, '\n').trim(); +}; +const normalizeOneLine = (s, pre = false) => { + const n = normalize(s, pre) + .replace(/[\s\u200b]+/g, ' ') .trim(); + return pre ? `\`${n}\`` : n; +}; /** * Main entry point. Create and return a {@link Jack} object. */ diff --git a/node_modules/jackspeak/dist/esm/package.json b/node_modules/jackspeak/dist/esm/package.json new file mode 100644 index 0000000000000..7c34deb5837d8 --- /dev/null +++ b/node_modules/jackspeak/dist/esm/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/node_modules/jackspeak/dist/esm/parse-args.js b/node_modules/jackspeak/dist/esm/parse-args.js new file mode 100644 index 0000000000000..6dbb4d813ceeb --- /dev/null +++ b/node_modules/jackspeak/dist/esm/parse-args.js @@ -0,0 +1,26 @@ +import * as util from 'util'; +const pv = typeof process === 'object' && + !!process && + typeof process.version === 'string' + ? process.version + : 'v0.0.0'; +const pvs = pv + .replace(/^v/, '') + .split('.') + .map(s => parseInt(s, 10)); +/* c8 ignore start */ +const [major = 0, minor = 0] = pvs; +/* c8 ignore stop */ +let { parseArgs: pa, } = util; +/* c8 ignore start */ +if (!pa || + major < 16 || + (major === 18 && minor < 11) || + (major === 16 && minor < 19)) { + /* c8 ignore stop */ + // Ignore because we will clobber it for commonjs + //@ts-ignore + pa = (await import('@pkgjs/parseargs')).parseArgs; +} +export const parseArgs = pa; +//# sourceMappingURL=parse-args.js.map \ No newline at end of file diff --git a/node_modules/jackspeak/dist/mjs/package.json b/node_modules/jackspeak/dist/mjs/package.json deleted file mode 100644 index 3dbc1ca591c05..0000000000000 --- a/node_modules/jackspeak/dist/mjs/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "type": "module" -} diff --git a/node_modules/jackspeak/dist/mjs/parse-args.js b/node_modules/jackspeak/dist/mjs/parse-args.js deleted file mode 100644 index 24ec319d38199..0000000000000 --- a/node_modules/jackspeak/dist/mjs/parse-args.js +++ /dev/null @@ -1,19 +0,0 @@ -// polyfill that overwrites parse-args.ts in the mjs build -import { createRequire } from 'module'; -import * as util from 'util'; -const pv = typeof process === 'object' && - !!process && - typeof process.version === 'string' - ? process.version - : 'v0.0.0'; -const pvs = pv - .replace(/^v/, '') - .split('.') - .map(s => parseInt(s, 10)); -let { parseArgs: pa } = util; -if (!pa || pvs[0] > 18 || pvs[1] < 11) { - const require = createRequire(import.meta.url); - pa = require('@pkgjs/parseargs').parseArgs; -} -export const parseArgs = pa; -//# sourceMappingURL=parse-args-esm.js.map \ No newline at end of file diff --git a/node_modules/jackspeak/package.json b/node_modules/jackspeak/package.json index afaa43e20ae4a..e5e4752ae6636 100644 --- a/node_modules/jackspeak/package.json +++ b/node_modules/jackspeak/package.json @@ -1,19 +1,27 @@ { "name": "jackspeak", - "version": "2.2.1", + "version": "2.3.6", "description": "A very strict and proper argument parser.", - "main": "./dist/cjs/index.js", - "module": "./dist/mjs/index.js", - "types": "./dist/mjs/index.js", + "tshy": { + "main": true, + "exports": { + "./package.json": "./package.json", + ".": "./src/index.js" + } + }, + "main": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", + "type": "module", "exports": { + "./package.json": "./package.json", ".": { "import": { - "types": "./dist/mjs/index.d.ts", - "default": "./dist/mjs/index.js" + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.js" }, "require": { - "types": "./dist/cjs/index.d.ts", - "default": "./dist/cjs/index.js" + "types": "./dist/commonjs/index.d.ts", + "default": "./dist/commonjs/index.js" } } }, @@ -25,13 +33,13 @@ "preversion": "npm test", "postversion": "npm publish", "prepublishOnly": "git push origin --follow-tags", - "prepare": "tsc -p tsconfig.json && tsc -p tsconfig-esm.json && bash ./scripts/fixup.sh", + "prepare": "tshy", "pretest": "npm run prepare", "presnap": "npm run prepare", - "test": "c8 tap", - "snap": "c8 tap", + "test": "tap", + "snap": "tap", "format": "prettier --write . --loglevel warn", - "typedoc": "typedoc --tsconfig tsconfig-esm.json ./src/*.ts" + "typedoc": "typedoc --tsconfig .tshy/esm.json ./src/*.ts" }, "license": "BlueOak-1.0.0", "prettier": { @@ -45,26 +53,14 @@ "arrowParens": "avoid", "endOfLine": "lf" }, - "tap": { - "coverage": false, - "node-arg": [ - "--no-warnings", - "--loader", - "ts-node/esm" - ], - "ts": false - }, "devDependencies": { - "@types/node": "^18.15.11", - "@types/pkgjs__parseargs": "^0.10.0", - "@types/tap": "^15.0.8", - "c8": "^7.13.0", - "eslint-config-prettier": "^8.8.0", + "@types/node": "^20.7.0", + "@types/pkgjs__parseargs": "^0.10.1", "prettier": "^2.8.6", - "tap": "^16.3.4", - "ts-node": "^10.9.1", - "typedoc": "^0.23.28", - "typescript": "^5.0.2" + "tap": "^18.1.4", + "tshy": "^1.2.2", + "typedoc": "^0.25.1", + "typescript": "^5.2.2" }, "dependencies": { "@isaacs/cliui": "^8.0.2" diff --git a/package-lock.json b/package-lock.json index a41c2c4caac20..073ce55e8d195 100644 --- a/package-lock.json +++ b/package-lock.json @@ -108,7 +108,7 @@ "columnify": "^1.6.0", "fastest-levenshtein": "^1.0.16", "fs-minipass": "^3.0.3", - "glob": "^10.3.3", + "glob": "^10.3.10", "graceful-fs": "^4.2.11", "hosted-git-info": "^7.0.0", "ini": "^4.1.1", @@ -6684,19 +6684,19 @@ "dev": true }, "node_modules/glob": { - "version": "10.3.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.3.tgz", - "integrity": "sha512-92vPiMb/iqpmEgsOoIDvTjc50wf9CCCvMzsi6W0JLPeUKE8TWP1a73PgqSrqy7iAZxaSD1YdzU7QZR5LF51MJw==", + "version": "10.3.10", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.10.tgz", + "integrity": "sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g==", "inBundle": true, "dependencies": { "foreground-child": "^3.1.0", - "jackspeak": "^2.0.3", + "jackspeak": "^2.3.5", "minimatch": "^9.0.1", "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", "path-scurry": "^1.10.1" }, "bin": { - "glob": "dist/cjs/src/bin.js" + "glob": "dist/esm/bin.mjs" }, "engines": { "node": ">=16 || 14 >=14.17" @@ -7910,9 +7910,9 @@ } }, "node_modules/jackspeak": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.2.1.tgz", - "integrity": "sha512-MXbxovZ/Pm42f6cDIDkl3xpwv1AGwObKwfmjs2nQePiy85tP3fatofl3FC1aBsOtP/6fq5SbtgHwWcMsLP+bDw==", + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.3.6.tgz", + "integrity": "sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==", "inBundle": true, "dependencies": { "@isaacs/cliui": "^8.0.2" diff --git a/package.json b/package.json index 824161a790795..ca843c76dbe42 100644 --- a/package.json +++ b/package.json @@ -70,7 +70,7 @@ "columnify": "^1.6.0", "fastest-levenshtein": "^1.0.16", "fs-minipass": "^3.0.3", - "glob": "^10.3.3", + "glob": "^10.3.10", "graceful-fs": "^4.2.11", "hosted-git-info": "^7.0.0", "ini": "^4.1.1", From 421656f119527ecd5a6e8a3d40564863367c8153 Mon Sep 17 00:00:00 2001 From: Luke Karrys Date: Mon, 2 Oct 2023 15:23:01 -0700 Subject: [PATCH 4/7] deps: hosted-git-info@7.0.1 --- node_modules/hosted-git-info/lib/hosts.js | 3 +-- node_modules/hosted-git-info/package.json | 2 +- package-lock.json | 10 +++++----- package.json | 2 +- workspaces/arborist/package.json | 2 +- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/node_modules/hosted-git-info/lib/hosts.js b/node_modules/hosted-git-info/lib/hosts.js index 013712b7842c8..6dac685f42cef 100644 --- a/node_modules/hosted-git-info/lib/hosts.js +++ b/node_modules/hosted-git-info/lib/hosts.js @@ -199,8 +199,7 @@ hosts.sourcehut = { `https://${domain}/${user}/${project}.git${maybeJoin('#', committish)}`, tarballtemplate: ({ domain, user, project, committish }) => `https://${domain}/${user}/${project}/archive/${maybeEncode(committish) || 'HEAD'}.tar.gz`, - bugstemplate: ({ user, project }) => - `https://todo.sr.ht/${user}/${project}`, + bugstemplate: ({ user, project }) => null, extract: (url) => { let [, user, project, aux] = url.pathname.split('/', 4) diff --git a/node_modules/hosted-git-info/package.json b/node_modules/hosted-git-info/package.json index 262a6c20fcf00..c2e31fa52676a 100644 --- a/node_modules/hosted-git-info/package.json +++ b/node_modules/hosted-git-info/package.json @@ -1,6 +1,6 @@ { "name": "hosted-git-info", - "version": "7.0.0", + "version": "7.0.1", "description": "Provides metadata and conversions from repository urls for GitHub, Bitbucket and GitLab", "main": "./lib/index.js", "repository": { diff --git a/package-lock.json b/package-lock.json index 073ce55e8d195..8bcb67955e44d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -110,7 +110,7 @@ "fs-minipass": "^3.0.3", "glob": "^10.3.10", "graceful-fs": "^4.2.11", - "hosted-git-info": "^7.0.0", + "hosted-git-info": "^7.0.1", "ini": "^4.1.1", "init-package-json": "^6.0.0", "is-cidr": "^4.0.2", @@ -7119,9 +7119,9 @@ } }, "node_modules/hosted-git-info": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-7.0.0.tgz", - "integrity": "sha512-ICclEpTLhHj+zCuSb2/usoNXSVkxUSIopre+b1w8NDY9Dntp9LO4vLdHYI336TH8sAqwrRgnSfdkBG2/YpisHA==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-7.0.1.tgz", + "integrity": "sha512-+K84LB1DYwMHoHSgaOY/Jfhw3ucPmSET5v98Ke/HdNSw4a0UktWzyW1mjhjpuxxTqOOsfWT/7iVshHmVZ4IpOA==", "inBundle": true, "dependencies": { "lru-cache": "^10.0.1" @@ -17013,7 +17013,7 @@ "bin-links": "^4.0.1", "cacache": "^18.0.0", "common-ancestor-path": "^1.0.1", - "hosted-git-info": "^7.0.0", + "hosted-git-info": "^7.0.1", "json-parse-even-better-errors": "^3.0.0", "json-stringify-nice": "^1.1.4", "minimatch": "^9.0.0", diff --git a/package.json b/package.json index ca843c76dbe42..0842e57ac46b8 100644 --- a/package.json +++ b/package.json @@ -72,7 +72,7 @@ "fs-minipass": "^3.0.3", "glob": "^10.3.10", "graceful-fs": "^4.2.11", - "hosted-git-info": "^7.0.0", + "hosted-git-info": "^7.0.1", "ini": "^4.1.1", "init-package-json": "^6.0.0", "is-cidr": "^4.0.2", diff --git a/workspaces/arborist/package.json b/workspaces/arborist/package.json index b15f6bb983f13..040ae7c9dce25 100644 --- a/workspaces/arborist/package.json +++ b/workspaces/arborist/package.json @@ -16,7 +16,7 @@ "bin-links": "^4.0.1", "cacache": "^18.0.0", "common-ancestor-path": "^1.0.1", - "hosted-git-info": "^7.0.0", + "hosted-git-info": "^7.0.1", "json-parse-even-better-errors": "^3.0.0", "json-stringify-nice": "^1.1.4", "minimatch": "^9.0.0", From 9abd060effcdf3b79a0556d60b24fb120fb7c11e Mon Sep 17 00:00:00 2001 From: Luke Karrys Date: Mon, 2 Oct 2023 15:23:34 -0700 Subject: [PATCH 5/7] deps: minipass@7.0.4 --- node_modules/minipass/dist/cjs/package.json | 3 - .../minipass/dist/{cjs => commonjs}/index.js | 0 .../minipass/dist/commonjs/package.json | 1 + .../minipass/dist/{mjs => esm}/index.js | 0 node_modules/minipass/dist/esm/package.json | 1 + node_modules/minipass/dist/mjs/package.json | 3 - node_modules/minipass/package.json | 66 +++++++++---------- package-lock.json | 10 +-- package.json | 2 +- workspaces/libnpmorg/package.json | 2 +- 10 files changed, 42 insertions(+), 46 deletions(-) delete mode 100644 node_modules/minipass/dist/cjs/package.json rename node_modules/minipass/dist/{cjs => commonjs}/index.js (100%) create mode 100644 node_modules/minipass/dist/commonjs/package.json rename node_modules/minipass/dist/{mjs => esm}/index.js (100%) create mode 100644 node_modules/minipass/dist/esm/package.json delete mode 100644 node_modules/minipass/dist/mjs/package.json diff --git a/node_modules/minipass/dist/cjs/package.json b/node_modules/minipass/dist/cjs/package.json deleted file mode 100644 index 5bbefffbabee3..0000000000000 --- a/node_modules/minipass/dist/cjs/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "type": "commonjs" -} diff --git a/node_modules/minipass/dist/cjs/index.js b/node_modules/minipass/dist/commonjs/index.js similarity index 100% rename from node_modules/minipass/dist/cjs/index.js rename to node_modules/minipass/dist/commonjs/index.js diff --git a/node_modules/minipass/dist/commonjs/package.json b/node_modules/minipass/dist/commonjs/package.json new file mode 100644 index 0000000000000..0292b9956f2e4 --- /dev/null +++ b/node_modules/minipass/dist/commonjs/package.json @@ -0,0 +1 @@ +{"type":"commonjs"} \ No newline at end of file diff --git a/node_modules/minipass/dist/mjs/index.js b/node_modules/minipass/dist/esm/index.js similarity index 100% rename from node_modules/minipass/dist/mjs/index.js rename to node_modules/minipass/dist/esm/index.js diff --git a/node_modules/minipass/dist/esm/package.json b/node_modules/minipass/dist/esm/package.json new file mode 100644 index 0000000000000..7c34deb5837d8 --- /dev/null +++ b/node_modules/minipass/dist/esm/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/node_modules/minipass/dist/mjs/package.json b/node_modules/minipass/dist/mjs/package.json deleted file mode 100644 index 3dbc1ca591c05..0000000000000 --- a/node_modules/minipass/dist/mjs/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "type": "module" -} diff --git a/node_modules/minipass/package.json b/node_modules/minipass/package.json index 6faaa247a5bc6..4398347289164 100644 --- a/node_modules/minipass/package.json +++ b/node_modules/minipass/package.json @@ -1,22 +1,29 @@ { "name": "minipass", - "version": "7.0.3", + "version": "7.0.4", "description": "minimal implementation of a PassThrough stream", - "main": "./dist/cjs/index.js", - "module": "./dist/mjs/index.js", - "types": "./dist/cjs/index.js", + "main": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", + "type": "module", + "tshy": { + "main": true, + "exports": { + "./package.json": "./package.json", + ".": "./src/index.ts" + } + }, "exports": { + "./package.json": "./package.json", ".": { "import": { - "types": "./dist/mjs/index.d.ts", - "default": "./dist/mjs/index.js" + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.js" }, "require": { - "types": "./dist/cjs/index.d.ts", - "default": "./dist/cjs/index.js" + "types": "./dist/commonjs/index.d.ts", + "default": "./dist/commonjs/index.js" } - }, - "./package.json": "./package.json" + } }, "files": [ "dist" @@ -25,24 +32,13 @@ "preversion": "npm test", "postversion": "npm publish", "prepublishOnly": "git push origin --follow-tags", - "preprepare": "rm -rf dist", - "prepare": "tsc -p tsconfig.json && tsc -p tsconfig-esm.json && bash ./scripts/fixup.sh", + "prepare": "tshy", "pretest": "npm run prepare", "presnap": "npm run prepare", - "test": "c8 tap", - "snap": "c8 tap", + "test": "tap", + "snap": "tap", "format": "prettier --write . --loglevel warn", - "typedoc": "typedoc --tsconfig tsconfig-esm.json ./src/*.ts" - }, - "tap": { - "coverage": false, - "node-arg": [ - "--enable-source-maps", - "--no-warnings", - "--loader", - "ts-node/esm" - ], - "ts": false + "typedoc": "typedoc --tsconfig .tshy/esm.json ./src/*.ts" }, "prettier": { "semi": false, @@ -56,18 +52,17 @@ "endOfLine": "lf" }, "devDependencies": { + "@types/end-of-stream": "^1.4.2", "@types/node": "^20.1.2", - "@types/tap": "^15.0.8", - "c8": "^7.13.0", - "prettier": "^2.6.2", - "tap": "^16.3.0", - "ts-node": "^10.9.1", - "typedoc": "^0.24.8", - "typescript": "^5.1.3", "end-of-stream": "^1.4.0", "node-abort-controller": "^3.1.1", + "prettier": "^2.6.2", "sync-content": "^1.0.2", - "through2": "^2.0.3" + "tap": "^18.3.0", + "through2": "^2.0.3", + "tshy": "^1.2.2", + "typedoc": "^0.25.1", + "typescript": "^5.2.2" }, "repository": "https://github.com/isaacs/minipass", "keywords": [ @@ -78,5 +73,10 @@ "license": "ISC", "engines": { "node": ">=16 || 14 >=14.17" + }, + "tap": { + "include": [ + "test/*.ts" + ] } } diff --git a/package-lock.json b/package-lock.json index 8bcb67955e44d..6d29471c3baca 100644 --- a/package-lock.json +++ b/package-lock.json @@ -128,7 +128,7 @@ "libnpmversion": "^5.0.0", "make-fetch-happen": "^13.0.0", "minimatch": "^9.0.3", - "minipass": "^7.0.3", + "minipass": "^7.0.4", "minipass-pipeline": "^1.2.4", "ms": "^2.1.2", "node-gyp": "^9.4.0", @@ -10156,9 +10156,9 @@ } }, "node_modules/minipass": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.3.tgz", - "integrity": "sha512-LhbbwCfz3vsb12j/WkWQPZfKTsgqIe1Nf/ti1pKjYESGLHIVjWU96G9/ljLH4F9mWNVhlQOm0VySdAWzf05dpg==", + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.4.tgz", + "integrity": "sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==", "inBundle": true, "engines": { "node": ">=16 || 14 >=14.17" @@ -17188,7 +17188,7 @@ "devDependencies": { "@npmcli/eslint-config": "^4.0.0", "@npmcli/template-oss": "4.19.0", - "minipass": "^7.0.3", + "minipass": "^7.0.4", "nock": "^13.3.3", "tap": "^16.3.8" }, diff --git a/package.json b/package.json index 0842e57ac46b8..f03328a803f8a 100644 --- a/package.json +++ b/package.json @@ -90,7 +90,7 @@ "libnpmversion": "^5.0.0", "make-fetch-happen": "^13.0.0", "minimatch": "^9.0.3", - "minipass": "^7.0.3", + "minipass": "^7.0.4", "minipass-pipeline": "^1.2.4", "ms": "^2.1.2", "node-gyp": "^9.4.0", diff --git a/workspaces/libnpmorg/package.json b/workspaces/libnpmorg/package.json index 5ebf8ddd6e852..d05c2498eeedd 100644 --- a/workspaces/libnpmorg/package.json +++ b/workspaces/libnpmorg/package.json @@ -29,7 +29,7 @@ "devDependencies": { "@npmcli/eslint-config": "^4.0.0", "@npmcli/template-oss": "4.19.0", - "minipass": "^7.0.3", + "minipass": "^7.0.4", "nock": "^13.3.3", "tap": "^16.3.8" }, From 1c867aa3faa4d94258c68534cc3dfb4905b072cf Mon Sep 17 00:00:00 2001 From: Luke Karrys Date: Mon, 2 Oct 2023 15:24:05 -0700 Subject: [PATCH 6/7] deps: npm-package-arg@11.0.1 --- mock-registry/package.json | 2 +- node_modules/npm-package-arg/lib/npa.js | 101 +++++++++++----------- node_modules/npm-package-arg/package.json | 5 +- package-lock.json | 22 ++--- package.json | 2 +- workspaces/arborist/package.json | 2 +- workspaces/libnpmaccess/package.json | 2 +- workspaces/libnpmdiff/package.json | 2 +- workspaces/libnpmexec/package.json | 2 +- workspaces/libnpmpack/package.json | 2 +- workspaces/libnpmpublish/package.json | 2 +- 11 files changed, 71 insertions(+), 73 deletions(-) diff --git a/mock-registry/package.json b/mock-registry/package.json index d774fd4e6ed8a..d32880e282b58 100644 --- a/mock-registry/package.json +++ b/mock-registry/package.json @@ -50,7 +50,7 @@ "@npmcli/template-oss": "4.19.0", "json-stringify-safe": "^5.0.1", "nock": "^13.3.3", - "npm-package-arg": "^11.0.0", + "npm-package-arg": "^11.0.1", "pacote": "^17.0.4", "tap": "^16.3.8" } diff --git a/node_modules/npm-package-arg/lib/npa.js b/node_modules/npm-package-arg/lib/npa.js index f5ede2326e7b4..23bf68d2e04a3 100644 --- a/node_modules/npm-package-arg/lib/npa.js +++ b/node_modules/npm-package-arg/lib/npa.js @@ -4,7 +4,7 @@ module.exports.resolve = resolve module.exports.toPurl = toPurl module.exports.Result = Result -const url = require('url') +const { URL } = require('url') const HostedGit = require('hosted-git-info') const semver = require('semver') const path = global.FAKE_WINDOWS ? require('path').win32 : require('path') @@ -183,10 +183,11 @@ Result.prototype.toJSON = function () { return result } -function setGitCommittish (res, committish) { +// sets res.gitCommittish, res.gitRange, and res.gitSubdir +function setGitAttrs (res, committish) { if (!committish) { res.gitCommittish = null - return res + return } // for each :: separated item: @@ -224,8 +225,6 @@ function setGitCommittish (res, committish) { } log.warn('npm-package-arg', `ignoring unknown key "${name}"`) } - - return res } function fromFile (res, where) { @@ -245,10 +244,10 @@ function fromFile (res, where) { const rawWithPrefix = prefix + res.rawSpec let rawNoPrefix = rawWithPrefix.replace(/^file:/, '') try { - resolvedUrl = new url.URL(rawWithPrefix, `file://${path.resolve(where)}/`) - specUrl = new url.URL(rawWithPrefix) + resolvedUrl = new URL(rawWithPrefix, `file://${path.resolve(where)}/`) + specUrl = new URL(rawWithPrefix) } catch (originalError) { - const er = new Error('Invalid file: URL, must comply with RFC 8909') + const er = new Error('Invalid file: URL, must comply with RFC 8089') throw Object.assign(er, { raw: res.rawSpec, spec: res, @@ -257,11 +256,11 @@ function fromFile (res, where) { }) } - // XXX backwards compatibility lack of compliance with RFC 8909 + // XXX backwards compatibility lack of compliance with RFC 8089 if (resolvedUrl.host && resolvedUrl.host !== 'localhost') { const rawSpec = res.rawSpec.replace(/^file:\/\//, 'file:///') - resolvedUrl = new url.URL(rawSpec, `file://${path.resolve(where)}/`) - specUrl = new url.URL(rawSpec) + resolvedUrl = new URL(rawSpec, `file://${path.resolve(where)}/`) + specUrl = new URL(rawSpec) rawNoPrefix = rawSpec.replace(/^file:/, '') } // turn file:/../foo into file:../foo @@ -269,11 +268,11 @@ function fromFile (res, where) { // in the previous step to make it a file protocol url with a leading slash if (/^\/{1,3}\.\.?(\/|$)/.test(rawNoPrefix)) { const rawSpec = res.rawSpec.replace(/^file:\/{1,3}/, 'file:') - resolvedUrl = new url.URL(rawSpec, `file://${path.resolve(where)}/`) - specUrl = new url.URL(rawSpec) + resolvedUrl = new URL(rawSpec, `file://${path.resolve(where)}/`) + specUrl = new URL(rawSpec) rawNoPrefix = rawSpec.replace(/^file:/, '') } - // XXX end RFC 8909 violation backwards compatibility section + // XXX end RFC 8089 violation backwards compatibility section // turn /C:/blah into just C:/blah on windows let specPath = decodeURIComponent(specUrl.pathname) @@ -303,7 +302,8 @@ function fromHostedGit (res, hosted) { res.hosted = hosted res.saveSpec = hosted.toString({ noGitPlus: false, noCommittish: false }) res.fetchSpec = hosted.getDefaultRepresentation() === 'shortcut' ? null : hosted.toString() - return setGitCommittish(res, hosted.committish) + setGitAttrs(res, hosted.committish) + return res } function unsupportedURLType (protocol, spec) { @@ -312,54 +312,51 @@ function unsupportedURLType (protocol, spec) { return err } -function matchGitScp (spec) { - // git ssh specifiers are overloaded to also use scp-style git - // specifiers, so we have to parse those out and treat them special. - // They are NOT true URIs, so we can't hand them to `url.parse`. - // - // This regex looks for things that look like: - // git+ssh://git@my.custom.git.com:username/project.git#deadbeef - // - // ...and various combinations. The username in the beginning is *required*. - const matched = spec.match(/^git\+ssh:\/\/([^:#]+:[^#]+(?:\.git)?)(?:#(.*))?$/i) - return matched && !matched[1].match(/:[0-9]+\/?.*$/i) && { - fetchSpec: matched[1], - gitCommittish: matched[2] == null ? null : matched[2], - } -} - function fromURL (res) { - // eslint-disable-next-line node/no-deprecated-api - const urlparse = url.parse(res.rawSpec) - res.saveSpec = res.rawSpec + let rawSpec = res.rawSpec + res.saveSpec = rawSpec + if (rawSpec.startsWith('git+ssh:')) { + // git ssh specifiers are overloaded to also use scp-style git + // specifiers, so we have to parse those out and treat them special. + // They are NOT true URIs, so we can't hand them to URL. + + // This regex looks for things that look like: + // git+ssh://git@my.custom.git.com:username/project.git#deadbeef + // ...and various combinations. The username in the beginning is *required*. + const matched = rawSpec.match(/^git\+ssh:\/\/([^:#]+:[^#]+(?:\.git)?)(?:#(.*))?$/i) + if (matched && !matched[1].match(/:[0-9]+\/?.*$/i)) { + res.type = 'git' + setGitAttrs(res, matched[2]) + res.fetchSpec = matched[1] + return res + } + } else if (rawSpec.startsWith('git+file://')) { + // URL can't handle windows paths + rawSpec = rawSpec.replace(/\\/g, '/') + } + const parsedUrl = new URL(rawSpec) // check the protocol, and then see if it's git or not - switch (urlparse.protocol) { + switch (parsedUrl.protocol) { case 'git:': case 'git+http:': case 'git+https:': case 'git+rsync:': case 'git+ftp:': case 'git+file:': - case 'git+ssh:': { + case 'git+ssh:': res.type = 'git' - const match = urlparse.protocol === 'git+ssh:' ? matchGitScp(res.rawSpec) - : null - if (match) { - setGitCommittish(res, match.gitCommittish) - res.fetchSpec = match.fetchSpec + setGitAttrs(res, parsedUrl.hash.slice(1)) + if (parsedUrl.protocol === 'git+file:' && /^git\+file:\/\/[a-z]:/i.test(rawSpec)) { + // URL can't handle drive letters on windows file paths, the host can't contain a : + res.fetchSpec = `git+file://${parsedUrl.host.toLowerCase()}:${parsedUrl.pathname}` } else { - setGitCommittish(res, urlparse.hash != null ? urlparse.hash.slice(1) : '') - urlparse.protocol = urlparse.protocol.replace(/^git[+]/, '') - if (urlparse.protocol === 'file:' && /^git\+file:\/\/[a-z]:/i.test(res.rawSpec)) { - // keep the drive letter : on windows file paths - urlparse.host += ':' - urlparse.hostname += ':' - } - delete urlparse.hash - res.fetchSpec = url.format(urlparse) + parsedUrl.hash = '' + res.fetchSpec = parsedUrl.toString() + } + if (res.fetchSpec.startsWith('git+')) { + res.fetchSpec = res.fetchSpec.slice(4) } break - } case 'http:': case 'https:': res.type = 'remote' @@ -367,7 +364,7 @@ function fromURL (res) { break default: - throw unsupportedURLType(urlparse.protocol, res.rawSpec) + throw unsupportedURLType(parsedUrl.protocol, rawSpec) } return res diff --git a/node_modules/npm-package-arg/package.json b/node_modules/npm-package-arg/package.json index 9ba1d135f3ebf..f7965d5a007c9 100644 --- a/node_modules/npm-package-arg/package.json +++ b/node_modules/npm-package-arg/package.json @@ -1,6 +1,6 @@ { "name": "npm-package-arg", - "version": "11.0.0", + "version": "11.0.1", "description": "Parse the things that can be arguments to `npm install`", "main": "./lib/npa.js", "directories": { @@ -61,6 +61,7 @@ "16.x", "18.0.0", "18.x" - ] + ], + "npmSpec": "next-9" } } diff --git a/package-lock.json b/package-lock.json index 6d29471c3baca..3899764424f8f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -136,7 +136,7 @@ "normalize-package-data": "^6.0.0", "npm-audit-report": "^5.0.0", "npm-install-checks": "^6.2.0", - "npm-package-arg": "^11.0.0", + "npm-package-arg": "^11.0.1", "npm-pick-manifest": "^9.0.0", "npm-profile": "^9.0.0", "npm-registry-fetch": "^16.0.0", @@ -238,7 +238,7 @@ "@npmcli/template-oss": "4.19.0", "json-stringify-safe": "^5.0.1", "nock": "^13.3.3", - "npm-package-arg": "^11.0.0", + "npm-package-arg": "^11.0.1", "pacote": "^17.0.4", "tap": "^16.3.8" }, @@ -10871,9 +10871,9 @@ } }, "node_modules/npm-package-arg": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-11.0.0.tgz", - "integrity": "sha512-D8sItaQ8n6VlBUFed3DLz2sCpkabRAjaiLkTamDppvh8lmmAPirzNfBuhJd/2rlmoxZ2S9mOHmIEvzV2z2jOeA==", + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-11.0.1.tgz", + "integrity": "sha512-M7s1BD4NxdAvBKUPqqRW957Xwcl/4Zvo8Aj+ANrzvIPzGJZElrH7Z//rSaec2ORcND6FHHLnZeY8qgTpXDMFQQ==", "inBundle": true, "dependencies": { "hosted-git-info": "^7.0.0", @@ -17019,7 +17019,7 @@ "minimatch": "^9.0.0", "nopt": "^7.0.0", "npm-install-checks": "^6.2.0", - "npm-package-arg": "^11.0.0", + "npm-package-arg": "^11.0.1", "npm-pick-manifest": "^9.0.0", "npm-registry-fetch": "^16.0.0", "npmlog": "^7.0.1", @@ -17079,7 +17079,7 @@ "version": "8.0.0", "license": "ISC", "dependencies": { - "npm-package-arg": "^11.0.0", + "npm-package-arg": "^11.0.1", "npm-registry-fetch": "^16.0.0" }, "devDependencies": { @@ -17103,7 +17103,7 @@ "binary-extensions": "^2.2.0", "diff": "^5.1.0", "minimatch": "^9.0.0", - "npm-package-arg": "^11.0.0", + "npm-package-arg": "^11.0.1", "pacote": "^17.0.4", "tar": "^6.1.13" }, @@ -17123,7 +17123,7 @@ "@npmcli/arborist": "^7.1.0", "@npmcli/run-script": "^7.0.1", "ci-info": "^3.7.1", - "npm-package-arg": "^11.0.0", + "npm-package-arg": "^11.0.1", "npmlog": "^7.0.1", "pacote": "^17.0.4", "proc-log": "^3.0.0", @@ -17202,7 +17202,7 @@ "dependencies": { "@npmcli/arborist": "^7.1.0", "@npmcli/run-script": "^7.0.1", - "npm-package-arg": "^11.0.0", + "npm-package-arg": "^11.0.1", "pacote": "^17.0.4" }, "devDependencies": { @@ -17222,7 +17222,7 @@ "dependencies": { "ci-info": "^3.6.1", "normalize-package-data": "^6.0.0", - "npm-package-arg": "^11.0.0", + "npm-package-arg": "^11.0.1", "npm-registry-fetch": "^16.0.0", "proc-log": "^3.0.0", "semver": "^7.3.7", diff --git a/package.json b/package.json index f03328a803f8a..35de6c0874272 100644 --- a/package.json +++ b/package.json @@ -98,7 +98,7 @@ "normalize-package-data": "^6.0.0", "npm-audit-report": "^5.0.0", "npm-install-checks": "^6.2.0", - "npm-package-arg": "^11.0.0", + "npm-package-arg": "^11.0.1", "npm-pick-manifest": "^9.0.0", "npm-profile": "^9.0.0", "npm-registry-fetch": "^16.0.0", diff --git a/workspaces/arborist/package.json b/workspaces/arborist/package.json index 040ae7c9dce25..18cd0174b7abd 100644 --- a/workspaces/arborist/package.json +++ b/workspaces/arborist/package.json @@ -22,7 +22,7 @@ "minimatch": "^9.0.0", "nopt": "^7.0.0", "npm-install-checks": "^6.2.0", - "npm-package-arg": "^11.0.0", + "npm-package-arg": "^11.0.1", "npm-pick-manifest": "^9.0.0", "npm-registry-fetch": "^16.0.0", "npmlog": "^7.0.1", diff --git a/workspaces/libnpmaccess/package.json b/workspaces/libnpmaccess/package.json index 4c71748dafcb8..47014c819757e 100644 --- a/workspaces/libnpmaccess/package.json +++ b/workspaces/libnpmaccess/package.json @@ -29,7 +29,7 @@ "bugs": "https://github.com/npm/libnpmaccess/issues", "homepage": "https://npmjs.com/package/libnpmaccess", "dependencies": { - "npm-package-arg": "^11.0.0", + "npm-package-arg": "^11.0.1", "npm-registry-fetch": "^16.0.0" }, "engines": { diff --git a/workspaces/libnpmdiff/package.json b/workspaces/libnpmdiff/package.json index f735986ab5cfa..321e003eb0020 100644 --- a/workspaces/libnpmdiff/package.json +++ b/workspaces/libnpmdiff/package.json @@ -52,7 +52,7 @@ "binary-extensions": "^2.2.0", "diff": "^5.1.0", "minimatch": "^9.0.0", - "npm-package-arg": "^11.0.0", + "npm-package-arg": "^11.0.1", "pacote": "^17.0.4", "tar": "^6.1.13" }, diff --git a/workspaces/libnpmexec/package.json b/workspaces/libnpmexec/package.json index d8d7b5c035ec8..fc8a8430fadfb 100644 --- a/workspaces/libnpmexec/package.json +++ b/workspaces/libnpmexec/package.json @@ -62,7 +62,7 @@ "@npmcli/arborist": "^7.1.0", "@npmcli/run-script": "^7.0.1", "ci-info": "^3.7.1", - "npm-package-arg": "^11.0.0", + "npm-package-arg": "^11.0.1", "npmlog": "^7.0.1", "pacote": "^17.0.4", "proc-log": "^3.0.0", diff --git a/workspaces/libnpmpack/package.json b/workspaces/libnpmpack/package.json index a3074218a9098..6893720a53b3d 100644 --- a/workspaces/libnpmpack/package.json +++ b/workspaces/libnpmpack/package.json @@ -38,7 +38,7 @@ "dependencies": { "@npmcli/arborist": "^7.1.0", "@npmcli/run-script": "^7.0.1", - "npm-package-arg": "^11.0.0", + "npm-package-arg": "^11.0.1", "pacote": "^17.0.4" }, "engines": { diff --git a/workspaces/libnpmpublish/package.json b/workspaces/libnpmpublish/package.json index 8f0e5a947b817..23b6da8b79459 100644 --- a/workspaces/libnpmpublish/package.json +++ b/workspaces/libnpmpublish/package.json @@ -40,7 +40,7 @@ "dependencies": { "ci-info": "^3.6.1", "normalize-package-data": "^6.0.0", - "npm-package-arg": "^11.0.0", + "npm-package-arg": "^11.0.1", "npm-registry-fetch": "^16.0.0", "proc-log": "^3.0.0", "semver": "^7.3.7", From 73f4419c56e94ef70bb4d92cd5fa1207727002c5 Mon Sep 17 00:00:00 2001 From: Luke Karrys Date: Mon, 2 Oct 2023 15:25:26 -0700 Subject: [PATCH 7/7] deps: tar@6.2.0 --- node_modules/tar/lib/pack.js | 24 +++++++++++---- node_modules/tar/lib/parse.js | 49 ++++++++++++++++++++++++++++-- node_modules/tar/lib/replace.js | 2 +- node_modules/tar/lib/update.js | 2 +- node_modules/tar/package.json | 9 ++---- package-lock.json | 10 +++--- package.json | 2 +- workspaces/libnpmdiff/package.json | 2 +- 8 files changed, 75 insertions(+), 25 deletions(-) diff --git a/node_modules/tar/lib/pack.js b/node_modules/tar/lib/pack.js index 938ece8e73145..d533a068f579f 100644 --- a/node_modules/tar/lib/pack.js +++ b/node_modules/tar/lib/pack.js @@ -79,14 +79,26 @@ const Pack = warner(class Pack extends Minipass { this.portable = !!opt.portable this.zip = null - if (opt.gzip) { - if (typeof opt.gzip !== 'object') { - opt.gzip = {} + + if (opt.gzip || opt.brotli) { + if (opt.gzip && opt.brotli) { + throw new TypeError('gzip and brotli are mutually exclusive') } - if (this.portable) { - opt.gzip.portable = true + if (opt.gzip) { + if (typeof opt.gzip !== 'object') { + opt.gzip = {} + } + if (this.portable) { + opt.gzip.portable = true + } + this.zip = new zlib.Gzip(opt.gzip) + } + if (opt.brotli) { + if (typeof opt.brotli !== 'object') { + opt.brotli = {} + } + this.zip = new zlib.BrotliCompress(opt.brotli) } - this.zip = new zlib.Gzip(opt.gzip) this.zip.on('data', chunk => super.write(chunk)) this.zip.on('end', _ => super.end()) this.zip.on('drain', _ => this[ONDRAIN]()) diff --git a/node_modules/tar/lib/parse.js b/node_modules/tar/lib/parse.js index 4b85915cbe01e..94e53042fad56 100644 --- a/node_modules/tar/lib/parse.js +++ b/node_modules/tar/lib/parse.js @@ -97,6 +97,16 @@ module.exports = warner(class Parser extends EE { this.strict = !!opt.strict this.maxMetaEntrySize = opt.maxMetaEntrySize || maxMetaEntrySize this.filter = typeof opt.filter === 'function' ? opt.filter : noop + // Unlike gzip, brotli doesn't have any magic bytes to identify it + // Users need to explicitly tell us they're extracting a brotli file + // Or we infer from the file extension + const isTBR = (opt.file && ( + opt.file.endsWith('.tar.br') || opt.file.endsWith('.tbr'))) + // if it's a tbr file it MIGHT be brotli, but we don't know until + // we look at it and verify it's not a valid tar file. + this.brotli = !opt.gzip && opt.brotli !== undefined ? opt.brotli + : isTBR ? undefined + : false // have to set this so that streams are ok piping into it this.writable = true @@ -347,7 +357,9 @@ module.exports = warner(class Parser extends EE { } // first write, might be gzipped - if (this[UNZIP] === null && chunk) { + const needSniff = this[UNZIP] === null || + this.brotli === undefined && this[UNZIP] === false + if (needSniff && chunk) { if (this[BUFFER]) { chunk = Buffer.concat([this[BUFFER], chunk]) this[BUFFER] = null @@ -356,15 +368,45 @@ module.exports = warner(class Parser extends EE { this[BUFFER] = chunk return true } + + // look for gzip header for (let i = 0; this[UNZIP] === null && i < gzipHeader.length; i++) { if (chunk[i] !== gzipHeader[i]) { this[UNZIP] = false } } - if (this[UNZIP] === null) { + + const maybeBrotli = this.brotli === undefined + if (this[UNZIP] === false && maybeBrotli) { + // read the first header to see if it's a valid tar file. If so, + // we can safely assume that it's not actually brotli, despite the + // .tbr or .tar.br file extension. + // if we ended before getting a full chunk, yes, def brotli + if (chunk.length < 512) { + if (this[ENDED]) { + this.brotli = true + } else { + this[BUFFER] = chunk + return true + } + } else { + // if it's tar, it's pretty reliably not brotli, chances of + // that happening are astronomical. + try { + new Header(chunk.slice(0, 512)) + this.brotli = false + } catch (_) { + this.brotli = true + } + } + } + + if (this[UNZIP] === null || (this[UNZIP] === false && this.brotli)) { const ended = this[ENDED] this[ENDED] = false - this[UNZIP] = new zlib.Unzip() + this[UNZIP] = this[UNZIP] === null + ? new zlib.Unzip() + : new zlib.BrotliDecompress() this[UNZIP].on('data', chunk => this[CONSUMECHUNK](chunk)) this[UNZIP].on('error', er => this.abort(er)) this[UNZIP].on('end', _ => { @@ -502,6 +544,7 @@ module.exports = warner(class Parser extends EE { this[UNZIP].end(chunk) } else { this[ENDED] = true + if (this.brotli === undefined) chunk = chunk || Buffer.alloc(0) this.write(chunk) } } diff --git a/node_modules/tar/lib/replace.js b/node_modules/tar/lib/replace.js index c6e619be6f032..8db6800bdf464 100644 --- a/node_modules/tar/lib/replace.js +++ b/node_modules/tar/lib/replace.js @@ -23,7 +23,7 @@ module.exports = (opt_, files, cb) => { throw new TypeError('file is required') } - if (opt.gzip) { + if (opt.gzip || opt.brotli || opt.file.endsWith('.br') || opt.file.endsWith('.tbr')) { throw new TypeError('cannot append to compressed archives') } diff --git a/node_modules/tar/lib/update.js b/node_modules/tar/lib/update.js index ded977dc1dec0..4d328543b315e 100644 --- a/node_modules/tar/lib/update.js +++ b/node_modules/tar/lib/update.js @@ -13,7 +13,7 @@ module.exports = (opt_, files, cb) => { throw new TypeError('file is required') } - if (opt.gzip) { + if (opt.gzip || opt.brotli || opt.file.endsWith('.br') || opt.file.endsWith('.tbr')) { throw new TypeError('cannot append to compressed archives') } diff --git a/node_modules/tar/package.json b/node_modules/tar/package.json index f59f54ae837bd..46d91ee1b299c 100644 --- a/node_modules/tar/package.json +++ b/node_modules/tar/package.json @@ -2,20 +2,15 @@ "author": "GitHub Inc.", "name": "tar", "description": "tar for node", - "version": "6.1.15", + "version": "6.2.0", "repository": { "type": "git", "url": "https://github.com/isaacs/node-tar.git" }, "scripts": { "genparse": "node scripts/generate-parse-fixtures.js", - "template-oss-apply": "template-oss-apply --force", - "lint": "eslint \"**/*.js\"", - "postlint": "template-oss-check", - "lintfix": "npm run lint -- --fix", "snap": "tap", - "test": "tap", - "posttest": "npm run lint" + "test": "tap" }, "dependencies": { "chownr": "^2.0.0", diff --git a/package-lock.json b/package-lock.json index 3899764424f8f..2312648a6ba0b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -153,7 +153,7 @@ "ssri": "^10.0.5", "strip-ansi": "^6.0.1", "supports-color": "^9.4.0", - "tar": "^6.1.15", + "tar": "^6.2.0", "text-table": "~0.2.0", "tiny-relative-date": "^1.3.0", "treeverse": "^3.0.0", @@ -15647,9 +15647,9 @@ } }, "node_modules/tar": { - "version": "6.1.15", - "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.15.tgz", - "integrity": "sha512-/zKt9UyngnxIT/EAGYuxaMYgOIJiP81ab9ZfkILq4oNLPFX50qyYmu7jRj9qeXoxmJHjGlbH0+cm2uy1WCs10A==", + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.0.tgz", + "integrity": "sha512-/Wo7DcT0u5HUV486xg675HtjNd3BXZ6xDbzsCUZPt5iw8bTQ63bP0Raut3mvro9u+CUyq7YQd8Cx55fsZXxqLQ==", "inBundle": true, "dependencies": { "chownr": "^2.0.0", @@ -17105,7 +17105,7 @@ "minimatch": "^9.0.0", "npm-package-arg": "^11.0.1", "pacote": "^17.0.4", - "tar": "^6.1.13" + "tar": "^6.2.0" }, "devDependencies": { "@npmcli/eslint-config": "^4.0.0", diff --git a/package.json b/package.json index 35de6c0874272..8612751859173 100644 --- a/package.json +++ b/package.json @@ -115,7 +115,7 @@ "ssri": "^10.0.5", "strip-ansi": "^6.0.1", "supports-color": "^9.4.0", - "tar": "^6.1.15", + "tar": "^6.2.0", "text-table": "~0.2.0", "tiny-relative-date": "^1.3.0", "treeverse": "^3.0.0", diff --git a/workspaces/libnpmdiff/package.json b/workspaces/libnpmdiff/package.json index 321e003eb0020..8c3fe09bad764 100644 --- a/workspaces/libnpmdiff/package.json +++ b/workspaces/libnpmdiff/package.json @@ -54,7 +54,7 @@ "minimatch": "^9.0.0", "npm-package-arg": "^11.0.1", "pacote": "^17.0.4", - "tar": "^6.1.13" + "tar": "^6.2.0" }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",