mirror of
https://github.com/github/codeql-action.git
synced 2025-12-10 01:34:36 +08:00
Compare commits
2 Commits
codeql-bun
...
henrymerce
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5a14a7b209 | ||
|
|
d060b60d93 |
1
.github/workflows/__analyze-ref-input.yml
generated
vendored
1
.github/workflows/__analyze-ref-input.yml
generated
vendored
@@ -88,7 +88,6 @@ jobs:
|
||||
run: ./build.sh
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
upload-database: false
|
||||
ref: refs/heads/main
|
||||
sha: 5e235361806c361d4d3f8859e3c897658025a9a2
|
||||
env:
|
||||
|
||||
2
.github/workflows/__autobuild-action.yml
generated
vendored
2
.github/workflows/__autobuild-action.yml
generated
vendored
@@ -56,8 +56,6 @@ jobs:
|
||||
CORECLR_PROFILER: ''
|
||||
CORECLR_PROFILER_PATH_64: ''
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
upload-database: false
|
||||
- name: Check database
|
||||
shell: bash
|
||||
run: |
|
||||
|
||||
2
.github/workflows/__go-custom-queries.yml
generated
vendored
2
.github/workflows/__go-custom-queries.yml
generated
vendored
@@ -86,8 +86,6 @@ jobs:
|
||||
shell: bash
|
||||
run: ./build.sh
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
upload-database: false
|
||||
env:
|
||||
DOTNET_GENERATE_ASPNET_CERTIFICATE: 'false'
|
||||
CODEQL_ACTION_TEST_MODE: true
|
||||
|
||||
2
.github/workflows/__go-tracing-autobuilder.yml
generated
vendored
2
.github/workflows/__go-tracing-autobuilder.yml
generated
vendored
@@ -71,8 +71,6 @@ jobs:
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
- uses: ./../action/autobuild
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
upload-database: false
|
||||
- shell: bash
|
||||
run: |
|
||||
if [[ "${CODEQL_ACTION_DID_AUTOBUILD_GOLANG}" != true ]]; then
|
||||
|
||||
2
.github/workflows/__go-tracing-custom-build-steps.yml
generated
vendored
2
.github/workflows/__go-tracing-custom-build-steps.yml
generated
vendored
@@ -73,8 +73,6 @@ jobs:
|
||||
shell: bash
|
||||
run: go build main.go
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
upload-database: false
|
||||
- shell: bash
|
||||
run: |
|
||||
# Once we start running Bash 4.2 in all environments, we can replace the
|
||||
|
||||
2
.github/workflows/__go-tracing-legacy-workflow.yml
generated
vendored
2
.github/workflows/__go-tracing-legacy-workflow.yml
generated
vendored
@@ -70,8 +70,6 @@ jobs:
|
||||
languages: go
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
upload-database: false
|
||||
- shell: bash
|
||||
run: |
|
||||
cd "$RUNNER_TEMP/codeql_databases"
|
||||
|
||||
1
.github/workflows/__javascript-source-root.yml
generated
vendored
1
.github/workflows/__javascript-source-root.yml
generated
vendored
@@ -54,7 +54,6 @@ jobs:
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
upload-database: false
|
||||
skip-queries: true
|
||||
upload: false
|
||||
- name: Assert database exists
|
||||
|
||||
2
.github/workflows/__multi-language-autodetect.yml
generated
vendored
2
.github/workflows/__multi-language-autodetect.yml
generated
vendored
@@ -81,8 +81,6 @@ jobs:
|
||||
|
||||
- uses: ./../action/analyze
|
||||
id: analysis
|
||||
with:
|
||||
upload-database: false
|
||||
|
||||
- name: Check language autodetect for all languages excluding Ruby, Swift
|
||||
shell: bash
|
||||
|
||||
1
.github/workflows/__packaging-codescanning-config-inputs-js.yml
generated
vendored
1
.github/workflows/__packaging-codescanning-config-inputs-js.yml
generated
vendored
@@ -66,7 +66,6 @@ jobs:
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
output: ${{ runner.temp }}/results
|
||||
upload-database: false
|
||||
|
||||
- name: Check results
|
||||
uses: ./../action/.github/check-sarif
|
||||
|
||||
1
.github/workflows/__packaging-config-inputs-js.yml
generated
vendored
1
.github/workflows/__packaging-config-inputs-js.yml
generated
vendored
@@ -66,7 +66,6 @@ jobs:
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
output: ${{ runner.temp }}/results
|
||||
upload-database: false
|
||||
|
||||
- name: Check results
|
||||
uses: ./../action/.github/check-sarif
|
||||
|
||||
1
.github/workflows/__packaging-config-js.yml
generated
vendored
1
.github/workflows/__packaging-config-js.yml
generated
vendored
@@ -65,7 +65,6 @@ jobs:
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
output: ${{ runner.temp }}/results
|
||||
upload-database: false
|
||||
|
||||
- name: Check results
|
||||
uses: ./../action/.github/check-sarif
|
||||
|
||||
2
.github/workflows/__ruby.yml
generated
vendored
2
.github/workflows/__ruby.yml
generated
vendored
@@ -54,8 +54,6 @@ jobs:
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
- uses: ./../action/analyze
|
||||
id: analysis
|
||||
with:
|
||||
upload-database: false
|
||||
- name: Check database
|
||||
shell: bash
|
||||
run: |
|
||||
|
||||
1
.github/workflows/__split-workflow.yml
generated
vendored
1
.github/workflows/__split-workflow.yml
generated
vendored
@@ -61,7 +61,6 @@ jobs:
|
||||
with:
|
||||
skip-queries: true
|
||||
output: ${{ runner.temp }}/results
|
||||
upload-database: false
|
||||
|
||||
- name: Assert No Results
|
||||
shell: bash
|
||||
|
||||
2
.github/workflows/__swift-autobuild.yml
generated
vendored
2
.github/workflows/__swift-autobuild.yml
generated
vendored
@@ -57,8 +57,6 @@ jobs:
|
||||
timeout-minutes: 10
|
||||
- uses: ./../action/analyze
|
||||
id: analysis
|
||||
with:
|
||||
upload-database: false
|
||||
- name: Check database
|
||||
shell: bash
|
||||
run: |
|
||||
|
||||
2
.github/workflows/__swift-custom-build.yml
generated
vendored
2
.github/workflows/__swift-custom-build.yml
generated
vendored
@@ -64,8 +64,6 @@ jobs:
|
||||
run: ./build.sh
|
||||
- uses: ./../action/analyze
|
||||
id: analysis
|
||||
with:
|
||||
upload-database: false
|
||||
- name: Check database
|
||||
shell: bash
|
||||
run: |
|
||||
|
||||
2
.github/workflows/__test-autobuild-working-dir.yml
generated
vendored
2
.github/workflows/__test-autobuild-working-dir.yml
generated
vendored
@@ -53,8 +53,6 @@ jobs:
|
||||
with:
|
||||
working-directory: autobuild-dir
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
upload-database: false
|
||||
- name: Check database
|
||||
shell: bash
|
||||
run: |
|
||||
|
||||
2
.github/workflows/__test-local-codeql.yml
generated
vendored
2
.github/workflows/__test-local-codeql.yml
generated
vendored
@@ -51,7 +51,5 @@ jobs:
|
||||
shell: bash
|
||||
run: ./build.sh
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
upload-database: false
|
||||
env:
|
||||
CODEQL_ACTION_TEST_MODE: true
|
||||
|
||||
2
.github/workflows/__test-proxy.yml
generated
vendored
2
.github/workflows/__test-proxy.yml
generated
vendored
@@ -43,8 +43,6 @@ jobs:
|
||||
languages: javascript
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
upload-database: false
|
||||
env:
|
||||
https_proxy: http://squid-proxy:3128
|
||||
CODEQL_ACTION_TEST_MODE: true
|
||||
|
||||
2
.github/workflows/__unset-environment.yml
generated
vendored
2
.github/workflows/__unset-environment.yml
generated
vendored
@@ -65,8 +65,6 @@ jobs:
|
||||
./build.sh
|
||||
- uses: ./../action/analyze
|
||||
id: analysis
|
||||
with:
|
||||
upload-database: false
|
||||
- shell: bash
|
||||
run: |
|
||||
CPP_DB="${{ fromJson(steps.analysis.outputs.db-locations).cpp }}"
|
||||
|
||||
1
.github/workflows/__upload-ref-sha-input.yml
generated
vendored
1
.github/workflows/__upload-ref-sha-input.yml
generated
vendored
@@ -88,7 +88,6 @@ jobs:
|
||||
run: ./build.sh
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
upload-database: false
|
||||
ref: refs/heads/main
|
||||
sha: 5e235361806c361d4d3f8859e3c897658025a9a2
|
||||
upload: false
|
||||
|
||||
1
.github/workflows/__with-checkout-path.yml
generated
vendored
1
.github/workflows/__with-checkout-path.yml
generated
vendored
@@ -104,7 +104,6 @@ jobs:
|
||||
ref: v1.1.0
|
||||
sha: 474bbf07f9247ffe1856c6a0f94aeeb10e7afee6
|
||||
upload: false
|
||||
upload-database: false
|
||||
|
||||
- uses: ./../action/upload-sarif
|
||||
with:
|
||||
|
||||
@@ -4,10 +4,6 @@
|
||||
|
||||
No user facing changes.
|
||||
|
||||
## 2.2.7 - 15 Mar 2023
|
||||
|
||||
No user facing changes.
|
||||
|
||||
## 2.2.6 - 10 Mar 2023
|
||||
|
||||
- Update default CodeQL bundle version to 2.12.4.
|
||||
|
||||
7
lib/codeql.js
generated
7
lib/codeql.js
generated
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getExtraOptions = exports.getCodeQLForCmd = exports.getCodeQLForTesting = exports.getCachedCodeQL = exports.setCodeQL = exports.getCodeQL = exports.setupCodeQL = exports.CODEQL_VERSION_INIT_WITH_QLCONFIG = exports.CODEQL_VERSION_SECURITY_EXPERIMENTAL_SUITE = exports.CODEQL_VERSION_BETTER_RESOLVE_LANGUAGES = exports.CODEQL_VERSION_ML_POWERED_QUERIES_WINDOWS = exports.CODEQL_VERSION_TRACING_GLIBC_2_34 = exports.CODEQL_VERSION_NEW_TRACING = exports.CODEQL_VERSION_GHES_PACK_DOWNLOAD = exports.CommandInvocationError = void 0;
|
||||
exports.getExtraOptions = exports.getCodeQLForCmd = exports.getCodeQLForTesting = exports.getCachedCodeQL = exports.setCodeQL = exports.getCodeQL = exports.setupCodeQL = exports.CODEQL_VERSION_INIT_WITH_QLCONFIG = exports.CODEQL_VERSION_EXPORT_CODE_SCANNING_CONFIG = exports.CODEQL_VERSION_SECURITY_EXPERIMENTAL_SUITE = exports.CODEQL_VERSION_BETTER_RESOLVE_LANGUAGES = exports.CODEQL_VERSION_ML_POWERED_QUERIES_WINDOWS = exports.CODEQL_VERSION_TRACING_GLIBC_2_34 = exports.CODEQL_VERSION_NEW_TRACING = exports.CODEQL_VERSION_GHES_PACK_DOWNLOAD = exports.CommandInvocationError = void 0;
|
||||
const fs = __importStar(require("fs"));
|
||||
const path = __importStar(require("path"));
|
||||
const toolrunner = __importStar(require("@actions/exec/lib/toolrunner"));
|
||||
@@ -100,6 +100,11 @@ exports.CODEQL_VERSION_BETTER_RESOLVE_LANGUAGES = "2.10.3";
|
||||
* Versions 2.11.1+ of the CodeQL Bundle include a `security-experimental` built-in query suite for each language.
|
||||
*/
|
||||
exports.CODEQL_VERSION_SECURITY_EXPERIMENTAL_SUITE = "2.12.1";
|
||||
/**
|
||||
* Versions 2.12.3+ of the CodeQL CLI support exporting information in the code scanning
|
||||
* configuration file to SARIF.
|
||||
*/
|
||||
exports.CODEQL_VERSION_EXPORT_CODE_SCANNING_CONFIG = "2.12.3";
|
||||
/**
|
||||
* Versions 2.12.4+ of the CodeQL CLI support the `--qlconfig-file` flag in calls to `database init`.
|
||||
*/
|
||||
|
||||
File diff suppressed because one or more lines are too long
6
lib/feature-flags.js
generated
6
lib/feature-flags.js
generated
@@ -105,6 +105,7 @@ class Features {
|
||||
}
|
||||
// Never use this feature if the CLI version explicitly can't support it.
|
||||
const minimumVersion = exports.featureConfig[feature].minimumVersion;
|
||||
this.logger.debug(`Minimum version for feature ${feature} is ${minimumVersion}.`);
|
||||
if (codeql && minimumVersion) {
|
||||
if (!(await util.codeQlVersionAbove(codeql, minimumVersion))) {
|
||||
this.logger.debug(`Feature ${feature} is disabled because the CodeQL CLI version is older than the minimum ` +
|
||||
@@ -127,9 +128,8 @@ class Features {
|
||||
this.logger.debug(`Feature ${feature} is ${apiValue ? "enabled" : "disabled"} via the GitHub API.`);
|
||||
return apiValue;
|
||||
}
|
||||
const defaultValue = exports.featureConfig[feature].defaultValue;
|
||||
this.logger.debug(`Feature ${feature} is ${defaultValue ? "enabled" : "disabled"} due to its default value.`);
|
||||
return defaultValue;
|
||||
this.logger.debug(`Feature ${feature} is ${exports.featureConfig[feature].defaultValue ? "enabled" : "disabled"} due to its default value.`);
|
||||
return exports.featureConfig[feature].defaultValue;
|
||||
}
|
||||
}
|
||||
exports.Features = Features;
|
||||
|
||||
File diff suppressed because one or more lines are too long
142
node_modules/.package-lock.json
generated
vendored
142
node_modules/.package-lock.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "codeql",
|
||||
"version": "2.2.8",
|
||||
"version": "2.2.7",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
@@ -142,16 +142,16 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@ava/typescript": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@ava/typescript/-/typescript-4.0.0.tgz",
|
||||
"integrity": "sha512-QFIPeqkEbdvn7Pob0wVeYpeZD0eXd8nDYdCl+knJVaIJrHdF2fXa58vFaig26cmYwnsEN0KRNTYJKbqW1B0lfg==",
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@ava/typescript/-/typescript-3.0.1.tgz",
|
||||
"integrity": "sha512-/JXIUuKsvkaneaiA9ckk3ksFTqvu0mDNlChASrTe2BnDsvMbhQdPWyqQjJ9WRJWVhhs5TWn1/0Pp1G6Rv8Syrw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"escape-string-regexp": "^5.0.0",
|
||||
"execa": "^7.1.0"
|
||||
"execa": "^5.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.19 <15 || >=16.15 <17 || >=18"
|
||||
"node": ">=12.22 <13 || >=14.17 <15 || >=16.4 <17 || >=17"
|
||||
}
|
||||
},
|
||||
"node_modules/@ava/typescript/node_modules/escape-string-regexp": {
|
||||
@@ -3043,28 +3043,40 @@
|
||||
}
|
||||
},
|
||||
"node_modules/execa": {
|
||||
"version": "7.1.0",
|
||||
"resolved": "https://registry.npmjs.org/execa/-/execa-7.1.0.tgz",
|
||||
"integrity": "sha512-T6nIJO3LHxUZ6ahVRaxXz9WLEruXLqdcluA+UuTptXmLM7nDAn9lx9IfkxPyzEL21583qSt4RmL44pO71EHaJQ==",
|
||||
"version": "5.1.1",
|
||||
"resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz",
|
||||
"integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"cross-spawn": "^7.0.3",
|
||||
"get-stream": "^6.0.1",
|
||||
"human-signals": "^4.3.0",
|
||||
"is-stream": "^3.0.0",
|
||||
"get-stream": "^6.0.0",
|
||||
"human-signals": "^2.1.0",
|
||||
"is-stream": "^2.0.0",
|
||||
"merge-stream": "^2.0.0",
|
||||
"npm-run-path": "^5.1.0",
|
||||
"onetime": "^6.0.0",
|
||||
"signal-exit": "^3.0.7",
|
||||
"strip-final-newline": "^3.0.0"
|
||||
"npm-run-path": "^4.0.1",
|
||||
"onetime": "^5.1.2",
|
||||
"signal-exit": "^3.0.3",
|
||||
"strip-final-newline": "^2.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^14.18.0 || ^16.14.0 || >=18.0.0"
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sindresorhus/execa?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/execa/node_modules/get-stream": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz",
|
||||
"integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/fast-deep-equal": {
|
||||
"version": "3.1.3",
|
||||
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="
|
||||
@@ -3316,18 +3328,6 @@
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/get-stream": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz",
|
||||
"integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/get-symbol-description": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz",
|
||||
@@ -3560,12 +3560,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/human-signals": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.0.tgz",
|
||||
"integrity": "sha512-zyzVyMjpGBX2+6cDVZeFPCdtOtdsxOeseRhB9tkQ6xXmGUNrcnBzdEKPy3VPNYz+4gy1oukVOXcrJCunSyc6QQ==",
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz",
|
||||
"integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=14.18.0"
|
||||
"node": ">=10.17.0"
|
||||
}
|
||||
},
|
||||
"node_modules/ignore": {
|
||||
@@ -3939,12 +3939,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/is-stream": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz",
|
||||
"integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==",
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz",
|
||||
"integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
||||
"node": ">=8"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
@@ -4341,6 +4341,18 @@
|
||||
"url": "https://github.com/sindresorhus/mem?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/mem/node_modules/mimic-fn": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz",
|
||||
"integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/merge-stream": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz",
|
||||
@@ -4387,15 +4399,11 @@
|
||||
}
|
||||
},
|
||||
"node_modules/mimic-fn": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz",
|
||||
"integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==",
|
||||
"version": "2.1.0",
|
||||
"integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/minimatch": {
|
||||
@@ -4532,30 +4540,15 @@
|
||||
}
|
||||
},
|
||||
"node_modules/npm-run-path": {
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.1.0.tgz",
|
||||
"integrity": "sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==",
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz",
|
||||
"integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"path-key": "^4.0.0"
|
||||
"path-key": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/npm-run-path/node_modules/path-key": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz",
|
||||
"integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/object-inspect": {
|
||||
@@ -4666,15 +4659,15 @@
|
||||
}
|
||||
},
|
||||
"node_modules/onetime": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz",
|
||||
"integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==",
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz",
|
||||
"integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"mimic-fn": "^4.0.0"
|
||||
"mimic-fn": "^2.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
"node": ">=6"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
@@ -5511,15 +5504,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/strip-final-newline": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz",
|
||||
"integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==",
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz",
|
||||
"integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/strip-json-comments": {
|
||||
|
||||
16
node_modules/@ava/typescript/README.md
generated
vendored
16
node_modules/@ava/typescript/README.md
generated
vendored
@@ -1,11 +1,21 @@
|
||||
# @ava/typescript
|
||||
|
||||
Adds [TypeScript](https://www.typescriptlang.org/) support to [AVA](https://avajs.dev).
|
||||
Adds [TypeScript](https://www.typescriptlang.org/) support to [AVA 4](https://avajs.dev).
|
||||
|
||||
This is designed to work for projects that precompile TypeScript. It allows AVA to load the compiled JavaScript, while configuring AVA to treat the TypeScript files as test files.
|
||||
|
||||
In other words, say you have a test file at `src/test.ts`. You've configured TypeScript to output to `build/`. Using `@ava/typescript` you can run the test using `npx ava src/test.ts`.
|
||||
|
||||
## For AVA 3 users
|
||||
|
||||
Use version 2:
|
||||
|
||||
```console
|
||||
npm install --save-dev @ava/typescript@2
|
||||
```
|
||||
|
||||
Note that v2 does not support ES modules. This requires v3 and AVA 4.
|
||||
|
||||
## Enabling TypeScript support
|
||||
|
||||
Add this package to your project:
|
||||
@@ -37,7 +47,7 @@ You can enable compilation via the `compile` property. If `false`, AVA will assu
|
||||
|
||||
Output files are expected to have the `.js` extension.
|
||||
|
||||
AVA searches your entire project for `*.js`, `*.cjs`, `*.mjs`, `*.ts`, `*.cts` and `*.mts` files (or other extensions you've configured). It will ignore such files found in the `rewritePaths` targets (e.g. `build/`). If you use more specific paths, for instance `build/main/`, you may need to change AVA's `files` configuration to ignore other directories.
|
||||
AVA searches your entire project for `*.js`, `*.cjs`, `*.mjs` and `*.ts` files (or other extensions you've configured). It will ignore such files found in the `rewritePaths` targets (e.g. `build/`). If you use more specific paths, for instance `build/main/`, you may need to change AVA's `files` configuration to ignore other directories.
|
||||
|
||||
## ES Modules
|
||||
|
||||
@@ -65,8 +75,6 @@ You can configure AVA to recognize additional file extensions. To add (partial
|
||||
}
|
||||
```
|
||||
|
||||
If you use the [`allowJs` TypeScript option](https://www.typescriptlang.org/tsconfig/allowJs.html) you'll have to specify the `js`, `cjs` and `mjs` extensions for them to be rewritten.
|
||||
|
||||
See also AVA's [`extensions` option](https://github.com/avajs/ava/blob/master/docs/06-configuration.md#options).
|
||||
|
||||
† Note that the [*preserve* mode for JSX](https://www.typescriptlang.org/docs/handbook/jsx.html) is not (yet) supported.
|
||||
|
||||
40
node_modules/@ava/typescript/index.js
generated
vendored
40
node_modules/@ava/typescript/index.js
generated
vendored
@@ -2,7 +2,7 @@ import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import {pathToFileURL} from 'node:url';
|
||||
import escapeStringRegexp from 'escape-string-regexp';
|
||||
import {execa} from 'execa';
|
||||
import execa from 'execa';
|
||||
|
||||
const pkg = JSON.parse(fs.readFileSync(new URL('package.json', import.meta.url)));
|
||||
const help = `See https://github.com/avajs/typescript/blob/v${pkg.version}/README.md`;
|
||||
@@ -83,7 +83,7 @@ export default function typescriptProvider({negotiateProtocol}) {
|
||||
validate(config, configProperties);
|
||||
|
||||
const {
|
||||
extensions = ['ts', 'cts', 'mts'],
|
||||
extensions = ['ts'],
|
||||
rewritePaths: relativeRewritePaths,
|
||||
compile,
|
||||
} = config;
|
||||
@@ -118,7 +118,7 @@ export default function typescriptProvider({negotiateProtocol}) {
|
||||
return rewritePaths.some(([from]) => filePath.startsWith(from));
|
||||
},
|
||||
|
||||
resolveTestFile(testfile) { // Used under AVA 3.2 protocol by legacy watcher implementation.
|
||||
resolveTestFile(testfile) {
|
||||
if (!testFileExtension.test(testfile)) {
|
||||
return testfile;
|
||||
}
|
||||
@@ -129,14 +129,8 @@ export default function typescriptProvider({negotiateProtocol}) {
|
||||
}
|
||||
|
||||
const [from, to] = rewrite;
|
||||
let newExtension = '.js';
|
||||
if (testfile.endsWith('.cts')) {
|
||||
newExtension = '.cjs';
|
||||
} else if (testfile.endsWith('.mts')) {
|
||||
newExtension = '.mjs';
|
||||
}
|
||||
|
||||
return `${to}${testfile.slice(from.length)}`.replace(testFileExtension, newExtension);
|
||||
// TODO: Support JSX preserve mode — https://www.typescriptlang.org/docs/handbook/jsx.html
|
||||
return `${to}${testfile.slice(from.length)}`.replace(testFileExtension, '.js');
|
||||
},
|
||||
|
||||
updateGlobs({filePatterns, ignoredByWatcherPatterns}) {
|
||||
@@ -148,11 +142,7 @@ export default function typescriptProvider({negotiateProtocol}) {
|
||||
],
|
||||
ignoredByWatcherPatterns: [
|
||||
...ignoredByWatcherPatterns,
|
||||
...Object.values(relativeRewritePaths).flatMap(to => [
|
||||
`${to}**/*.js.map`,
|
||||
`${to}**/*.cjs.map`,
|
||||
`${to}**/*.mjs.map`,
|
||||
]),
|
||||
...Object.values(relativeRewritePaths).map(to => `${to}**/*.js.map`),
|
||||
],
|
||||
};
|
||||
},
|
||||
@@ -160,7 +150,7 @@ export default function typescriptProvider({negotiateProtocol}) {
|
||||
},
|
||||
|
||||
worker({extensionsToLoadAsModules, state: {extensions, rewritePaths}}) {
|
||||
const importJs = extensionsToLoadAsModules.includes('js');
|
||||
const useImport = extensionsToLoadAsModules.includes('js');
|
||||
const testFileExtension = new RegExp(`\\.(${extensions.map(ext => escapeStringRegexp(ext)).join('|')})$`);
|
||||
|
||||
return {
|
||||
@@ -170,19 +160,9 @@ export default function typescriptProvider({negotiateProtocol}) {
|
||||
|
||||
async load(ref, {requireFn}) {
|
||||
const [from, to] = rewritePaths.find(([from]) => ref.startsWith(from));
|
||||
let rewritten = `${to}${ref.slice(from.length)}`;
|
||||
let useImport = true;
|
||||
if (ref.endsWith('.cts')) {
|
||||
rewritten = rewritten.replace(/\.cts$/, '.cjs');
|
||||
useImport = false;
|
||||
} else if (ref.endsWith('.mts')) {
|
||||
rewritten = rewritten.replace(/\.mts$/, '.mjs');
|
||||
} else {
|
||||
rewritten = rewritten.replace(testFileExtension, '.js');
|
||||
useImport = importJs;
|
||||
}
|
||||
|
||||
return useImport ? import(pathToFileURL(rewritten)) : requireFn(rewritten);
|
||||
// TODO: Support JSX preserve mode — https://www.typescriptlang.org/docs/handbook/jsx.html
|
||||
const rewritten = `${to}${ref.slice(from.length)}`.replace(testFileExtension, '.js');
|
||||
return useImport ? import(pathToFileURL(rewritten)) : requireFn(rewritten); // eslint-disable-line node/no-unsupported-features/es-syntax
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
19
node_modules/@ava/typescript/package.json
generated
vendored
19
node_modules/@ava/typescript/package.json
generated
vendored
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"name": "@ava/typescript",
|
||||
"version": "4.0.0",
|
||||
"version": "3.0.1",
|
||||
"description": "TypeScript provider for AVA",
|
||||
"engines": {
|
||||
"node": ">=14.19 <15 || >=16.15 <17 || >=18"
|
||||
"node": ">=12.22 <13 || >=14.17 <15 || >=16.4 <17 || >=17"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
@@ -24,14 +24,14 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"escape-string-regexp": "^5.0.0",
|
||||
"execa": "^7.1.0"
|
||||
"execa": "^5.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^5.2.0",
|
||||
"c8": "^7.13.0",
|
||||
"del": "^7.0.0",
|
||||
"typescript": "^4.9.5",
|
||||
"xo": "^0.53.1"
|
||||
"ava": "4.0.0-rc.1",
|
||||
"c8": "^7.10.0",
|
||||
"del": "^6.0.0",
|
||||
"typescript": "^4.4.4",
|
||||
"xo": "^0.46.3"
|
||||
},
|
||||
"c8": {
|
||||
"reporter": [
|
||||
@@ -52,8 +52,7 @@
|
||||
},
|
||||
"xo": {
|
||||
"ignores": [
|
||||
"test/broken-fixtures",
|
||||
"test/fixtures/**/compiled/**"
|
||||
"test/broken-fixtures"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
1442
node_modules/execa/index.d.ts
generated
vendored
1442
node_modules/execa/index.d.ts
generated
vendored
File diff suppressed because it is too large
Load Diff
119
node_modules/execa/index.js
generated
vendored
119
node_modules/execa/index.js
generated
vendored
@@ -1,19 +1,16 @@
|
||||
import {Buffer} from 'node:buffer';
|
||||
import path from 'node:path';
|
||||
import childProcess from 'node:child_process';
|
||||
import process from 'node:process';
|
||||
import crossSpawn from 'cross-spawn';
|
||||
import stripFinalNewline from 'strip-final-newline';
|
||||
import {npmRunPathEnv} from 'npm-run-path';
|
||||
import onetime from 'onetime';
|
||||
import {makeError} from './lib/error.js';
|
||||
import {normalizeStdio, normalizeStdioNode} from './lib/stdio.js';
|
||||
import {spawnedKill, spawnedCancel, setupTimeout, validateTimeout, setExitHandler} from './lib/kill.js';
|
||||
import {addPipeMethods} from './lib/pipe.js';
|
||||
import {handleInput, getSpawnedResult, makeAllStream, handleInputSync} from './lib/stream.js';
|
||||
import {mergePromise, getSpawnedPromise} from './lib/promise.js';
|
||||
import {joinCommand, parseCommand, parseTemplates, getEscapedCommand} from './lib/command.js';
|
||||
import {logCommand, verboseDefault} from './lib/verbose.js';
|
||||
'use strict';
|
||||
const path = require('path');
|
||||
const childProcess = require('child_process');
|
||||
const crossSpawn = require('cross-spawn');
|
||||
const stripFinalNewline = require('strip-final-newline');
|
||||
const npmRunPath = require('npm-run-path');
|
||||
const onetime = require('onetime');
|
||||
const makeError = require('./lib/error');
|
||||
const normalizeStdio = require('./lib/stdio');
|
||||
const {spawnedKill, spawnedCancel, setupTimeout, validateTimeout, setExitHandler} = require('./lib/kill');
|
||||
const {handleInput, getSpawnedResult, makeAllStream, validateInputSync} = require('./lib/stream');
|
||||
const {mergePromise, getSpawnedPromise} = require('./lib/promise');
|
||||
const {joinCommand, parseCommand, getEscapedCommand} = require('./lib/command');
|
||||
|
||||
const DEFAULT_MAX_BUFFER = 1000 * 1000 * 100;
|
||||
|
||||
@@ -21,7 +18,7 @@ const getEnv = ({env: envOption, extendEnv, preferLocal, localDir, execPath}) =>
|
||||
const env = extendEnv ? {...process.env, ...envOption} : envOption;
|
||||
|
||||
if (preferLocal) {
|
||||
return npmRunPathEnv({env, cwd: localDir, execPath});
|
||||
return npmRunPath.env({env, cwd: localDir, execPath});
|
||||
}
|
||||
|
||||
return env;
|
||||
@@ -46,8 +43,7 @@ const handleArguments = (file, args, options = {}) => {
|
||||
cleanup: true,
|
||||
all: false,
|
||||
windowsHide: true,
|
||||
verbose: verboseDefault,
|
||||
...options,
|
||||
...options
|
||||
};
|
||||
|
||||
options.env = getEnv(options);
|
||||
@@ -64,7 +60,7 @@ const handleArguments = (file, args, options = {}) => {
|
||||
|
||||
const handleOutput = (options, value, error) => {
|
||||
if (typeof value !== 'string' && !Buffer.isBuffer(value)) {
|
||||
// When `execaSync()` errors, we normalize it to '' to mimic `execa()`
|
||||
// When `execa.sync()` errors, we normalize it to '' to mimic `execa()`
|
||||
return error === undefined ? undefined : '';
|
||||
}
|
||||
|
||||
@@ -75,11 +71,10 @@ const handleOutput = (options, value, error) => {
|
||||
return value;
|
||||
};
|
||||
|
||||
export function execa(file, args, options) {
|
||||
const execa = (file, args, options) => {
|
||||
const parsed = handleArguments(file, args, options);
|
||||
const command = joinCommand(file, args);
|
||||
const escapedCommand = getEscapedCommand(file, args);
|
||||
logCommand(escapedCommand, parsed.options);
|
||||
|
||||
validateTimeout(parsed.options);
|
||||
|
||||
@@ -99,10 +94,9 @@ export function execa(file, args, options) {
|
||||
parsed,
|
||||
timedOut: false,
|
||||
isCanceled: false,
|
||||
killed: false,
|
||||
killed: false
|
||||
}));
|
||||
mergePromise(dummySpawned, errorPromise);
|
||||
return dummySpawned;
|
||||
return mergePromise(dummySpawned, errorPromise);
|
||||
}
|
||||
|
||||
const spawnedPromise = getSpawnedPromise(spawned);
|
||||
@@ -132,8 +126,8 @@ export function execa(file, args, options) {
|
||||
escapedCommand,
|
||||
parsed,
|
||||
timedOut,
|
||||
isCanceled: context.isCanceled || (parsed.options.signal ? parsed.options.signal.aborted : false),
|
||||
killed: spawned.killed,
|
||||
isCanceled: context.isCanceled,
|
||||
killed: spawned.killed
|
||||
});
|
||||
|
||||
if (!parsed.options.reject) {
|
||||
@@ -153,32 +147,31 @@ export function execa(file, args, options) {
|
||||
failed: false,
|
||||
timedOut: false,
|
||||
isCanceled: false,
|
||||
killed: false,
|
||||
killed: false
|
||||
};
|
||||
};
|
||||
|
||||
const handlePromiseOnce = onetime(handlePromise);
|
||||
|
||||
handleInput(spawned, parsed.options);
|
||||
handleInput(spawned, parsed.options.input);
|
||||
|
||||
spawned.all = makeAllStream(spawned, parsed.options);
|
||||
|
||||
addPipeMethods(spawned);
|
||||
mergePromise(spawned, handlePromiseOnce);
|
||||
return spawned;
|
||||
}
|
||||
return mergePromise(spawned, handlePromiseOnce);
|
||||
};
|
||||
|
||||
export function execaSync(file, args, options) {
|
||||
module.exports = execa;
|
||||
|
||||
module.exports.sync = (file, args, options) => {
|
||||
const parsed = handleArguments(file, args, options);
|
||||
const command = joinCommand(file, args);
|
||||
const escapedCommand = getEscapedCommand(file, args);
|
||||
logCommand(escapedCommand, parsed.options);
|
||||
|
||||
const input = handleInputSync(parsed.options);
|
||||
validateInputSync(parsed.options);
|
||||
|
||||
let result;
|
||||
try {
|
||||
result = childProcess.spawnSync(parsed.file, parsed.args, {...parsed.options, input});
|
||||
result = childProcess.spawnSync(parsed.file, parsed.args, parsed.options);
|
||||
} catch (error) {
|
||||
throw makeError({
|
||||
error,
|
||||
@@ -190,7 +183,7 @@ export function execaSync(file, args, options) {
|
||||
parsed,
|
||||
timedOut: false,
|
||||
isCanceled: false,
|
||||
killed: false,
|
||||
killed: false
|
||||
});
|
||||
}
|
||||
|
||||
@@ -209,7 +202,7 @@ export function execaSync(file, args, options) {
|
||||
parsed,
|
||||
timedOut: result.error && result.error.code === 'ETIMEDOUT',
|
||||
isCanceled: false,
|
||||
killed: result.signal !== null,
|
||||
killed: result.signal !== null
|
||||
});
|
||||
|
||||
if (!parsed.options.reject) {
|
||||
@@ -228,52 +221,32 @@ export function execaSync(file, args, options) {
|
||||
failed: false,
|
||||
timedOut: false,
|
||||
isCanceled: false,
|
||||
killed: false,
|
||||
killed: false
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
function create$(options) {
|
||||
function $(templatesOrOptions, ...expressions) {
|
||||
if (Array.isArray(templatesOrOptions)) {
|
||||
const [file, ...args] = parseTemplates(templatesOrOptions, expressions);
|
||||
return execa(file, args, options);
|
||||
}
|
||||
|
||||
return create$({...options, ...templatesOrOptions});
|
||||
}
|
||||
|
||||
$.sync = (templates, ...expressions) => {
|
||||
const [file, ...args] = parseTemplates(templates, expressions);
|
||||
return execaSync(file, args, options);
|
||||
};
|
||||
|
||||
return $;
|
||||
}
|
||||
|
||||
export const $ = create$({preferLocal: true});
|
||||
|
||||
export function execaCommand(command, options) {
|
||||
module.exports.command = (command, options) => {
|
||||
const [file, ...args] = parseCommand(command);
|
||||
return execa(file, args, options);
|
||||
}
|
||||
};
|
||||
|
||||
export function execaCommandSync(command, options) {
|
||||
module.exports.commandSync = (command, options) => {
|
||||
const [file, ...args] = parseCommand(command);
|
||||
return execaSync(file, args, options);
|
||||
}
|
||||
return execa.sync(file, args, options);
|
||||
};
|
||||
|
||||
export function execaNode(scriptPath, args, options = {}) {
|
||||
module.exports.node = (scriptPath, args, options = {}) => {
|
||||
if (args && !Array.isArray(args) && typeof args === 'object') {
|
||||
options = args;
|
||||
args = [];
|
||||
}
|
||||
|
||||
const stdio = normalizeStdioNode(options);
|
||||
const stdio = normalizeStdio.node(options);
|
||||
const defaultExecArgv = process.execArgv.filter(arg => !arg.startsWith('--inspect'));
|
||||
|
||||
const {
|
||||
nodePath = process.execPath,
|
||||
nodeOptions = defaultExecArgv,
|
||||
nodeOptions = defaultExecArgv
|
||||
} = options;
|
||||
|
||||
return execa(
|
||||
@@ -281,7 +254,7 @@ export function execaNode(scriptPath, args, options = {}) {
|
||||
[
|
||||
...nodeOptions,
|
||||
scriptPath,
|
||||
...(Array.isArray(args) ? args : []),
|
||||
...(Array.isArray(args) ? args : [])
|
||||
],
|
||||
{
|
||||
...options,
|
||||
@@ -289,7 +262,7 @@ export function execaNode(scriptPath, args, options = {}) {
|
||||
stdout: undefined,
|
||||
stderr: undefined,
|
||||
stdio,
|
||||
shell: false,
|
||||
},
|
||||
shell: false
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
70
node_modules/execa/lib/command.js
generated
vendored
70
node_modules/execa/lib/command.js
generated
vendored
@@ -1,6 +1,4 @@
|
||||
import {Buffer} from 'node:buffer';
|
||||
import {ChildProcess} from 'node:child_process';
|
||||
|
||||
'use strict';
|
||||
const normalizeArgs = (file, args = []) => {
|
||||
if (!Array.isArray(args)) {
|
||||
return [file];
|
||||
@@ -20,14 +18,18 @@ const escapeArg = arg => {
|
||||
return `"${arg.replace(DOUBLE_QUOTES_REGEXP, '\\"')}"`;
|
||||
};
|
||||
|
||||
export const joinCommand = (file, args) => normalizeArgs(file, args).join(' ');
|
||||
const joinCommand = (file, args) => {
|
||||
return normalizeArgs(file, args).join(' ');
|
||||
};
|
||||
|
||||
export const getEscapedCommand = (file, args) => normalizeArgs(file, args).map(arg => escapeArg(arg)).join(' ');
|
||||
const getEscapedCommand = (file, args) => {
|
||||
return normalizeArgs(file, args).map(arg => escapeArg(arg)).join(' ');
|
||||
};
|
||||
|
||||
const SPACES_REGEXP = / +/g;
|
||||
|
||||
// Handle `execaCommand()`
|
||||
export const parseCommand = command => {
|
||||
// Handle `execa.command()`
|
||||
const parseCommand = command => {
|
||||
const tokens = [];
|
||||
for (const token of command.trim().split(SPACES_REGEXP)) {
|
||||
// Allow spaces to be escaped by a backslash if not meant as a delimiter
|
||||
@@ -43,54 +45,8 @@ export const parseCommand = command => {
|
||||
return tokens;
|
||||
};
|
||||
|
||||
const parseExpression = expression => {
|
||||
const typeOfExpression = typeof expression;
|
||||
|
||||
if (typeOfExpression === 'string') {
|
||||
return expression;
|
||||
}
|
||||
|
||||
if (typeOfExpression === 'number') {
|
||||
return String(expression);
|
||||
}
|
||||
|
||||
if (
|
||||
typeOfExpression === 'object'
|
||||
&& expression !== null
|
||||
&& !(expression instanceof ChildProcess)
|
||||
&& 'stdout' in expression
|
||||
) {
|
||||
const typeOfStdout = typeof expression.stdout;
|
||||
|
||||
if (typeOfStdout === 'string') {
|
||||
return expression.stdout;
|
||||
}
|
||||
|
||||
if (Buffer.isBuffer(expression.stdout)) {
|
||||
return expression.stdout.toString();
|
||||
}
|
||||
|
||||
throw new TypeError(`Unexpected "${typeOfStdout}" stdout in template expression`);
|
||||
}
|
||||
|
||||
throw new TypeError(`Unexpected "${typeOfExpression}" in template expression`);
|
||||
module.exports = {
|
||||
joinCommand,
|
||||
getEscapedCommand,
|
||||
parseCommand
|
||||
};
|
||||
|
||||
const parseTemplate = (template, index, templates, expressions) => {
|
||||
const templateString = template ?? templates.raw[index];
|
||||
const templateTokens = templateString.split(SPACES_REGEXP).filter(Boolean);
|
||||
|
||||
if (index === expressions.length) {
|
||||
return templateTokens;
|
||||
}
|
||||
|
||||
const expression = expressions[index];
|
||||
|
||||
return Array.isArray(expression)
|
||||
? [...templateTokens, ...expression.map(expression => parseExpression(expression))]
|
||||
: [...templateTokens, parseExpression(expression)];
|
||||
};
|
||||
|
||||
export const parseTemplates = (templates, expressions) => templates.flatMap(
|
||||
(template, index) => parseTemplate(template, index, templates, expressions),
|
||||
);
|
||||
|
||||
9
node_modules/execa/lib/error.js
generated
vendored
9
node_modules/execa/lib/error.js
generated
vendored
@@ -1,4 +1,5 @@
|
||||
import {signalsByName} from 'human-signals';
|
||||
'use strict';
|
||||
const {signalsByName} = require('human-signals');
|
||||
|
||||
const getErrorPrefix = ({timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled}) => {
|
||||
if (timedOut) {
|
||||
@@ -24,7 +25,7 @@ const getErrorPrefix = ({timedOut, timeout, errorCode, signal, signalDescription
|
||||
return 'failed';
|
||||
};
|
||||
|
||||
export const makeError = ({
|
||||
const makeError = ({
|
||||
stdout,
|
||||
stderr,
|
||||
all,
|
||||
@@ -36,7 +37,7 @@ export const makeError = ({
|
||||
timedOut,
|
||||
isCanceled,
|
||||
killed,
|
||||
parsed: {options: {timeout}},
|
||||
parsed: {options: {timeout}}
|
||||
}) => {
|
||||
// `signal` and `exitCode` emitted on `spawned.on('exit')` event can be `null`.
|
||||
// We normalize them to `undefined`
|
||||
@@ -83,3 +84,5 @@ export const makeError = ({
|
||||
|
||||
return error;
|
||||
};
|
||||
|
||||
module.exports = makeError;
|
||||
|
||||
33
node_modules/execa/lib/kill.js
generated
vendored
33
node_modules/execa/lib/kill.js
generated
vendored
@@ -1,10 +1,11 @@
|
||||
import os from 'node:os';
|
||||
import onExit from 'signal-exit';
|
||||
'use strict';
|
||||
const os = require('os');
|
||||
const onExit = require('signal-exit');
|
||||
|
||||
const DEFAULT_FORCE_KILL_TIMEOUT = 1000 * 5;
|
||||
|
||||
// Monkey-patches `childProcess.kill()` to add `forceKillAfterTimeout` behavior
|
||||
export const spawnedKill = (kill, signal = 'SIGTERM', options = {}) => {
|
||||
const spawnedKill = (kill, signal = 'SIGTERM', options = {}) => {
|
||||
const killResult = kill(signal);
|
||||
setKillTimeout(kill, signal, options, killResult);
|
||||
return killResult;
|
||||
@@ -29,10 +30,14 @@ const setKillTimeout = (kill, signal, options, killResult) => {
|
||||
}
|
||||
};
|
||||
|
||||
const shouldForceKill = (signal, {forceKillAfterTimeout}, killResult) => isSigterm(signal) && forceKillAfterTimeout !== false && killResult;
|
||||
const shouldForceKill = (signal, {forceKillAfterTimeout}, killResult) => {
|
||||
return isSigterm(signal) && forceKillAfterTimeout !== false && killResult;
|
||||
};
|
||||
|
||||
const isSigterm = signal => signal === os.constants.signals.SIGTERM
|
||||
|| (typeof signal === 'string' && signal.toUpperCase() === 'SIGTERM');
|
||||
const isSigterm = signal => {
|
||||
return signal === os.constants.signals.SIGTERM ||
|
||||
(typeof signal === 'string' && signal.toUpperCase() === 'SIGTERM');
|
||||
};
|
||||
|
||||
const getForceKillAfterTimeout = ({forceKillAfterTimeout = true}) => {
|
||||
if (forceKillAfterTimeout === true) {
|
||||
@@ -47,7 +52,7 @@ const getForceKillAfterTimeout = ({forceKillAfterTimeout = true}) => {
|
||||
};
|
||||
|
||||
// `childProcess.cancel()`
|
||||
export const spawnedCancel = (spawned, context) => {
|
||||
const spawnedCancel = (spawned, context) => {
|
||||
const killResult = spawned.kill();
|
||||
|
||||
if (killResult) {
|
||||
@@ -61,7 +66,7 @@ const timeoutKill = (spawned, signal, reject) => {
|
||||
};
|
||||
|
||||
// `timeout` option handling
|
||||
export const setupTimeout = (spawned, {timeout, killSignal = 'SIGTERM'}, spawnedPromise) => {
|
||||
const setupTimeout = (spawned, {timeout, killSignal = 'SIGTERM'}, spawnedPromise) => {
|
||||
if (timeout === 0 || timeout === undefined) {
|
||||
return spawnedPromise;
|
||||
}
|
||||
@@ -80,14 +85,14 @@ export const setupTimeout = (spawned, {timeout, killSignal = 'SIGTERM'}, spawned
|
||||
return Promise.race([timeoutPromise, safeSpawnedPromise]);
|
||||
};
|
||||
|
||||
export const validateTimeout = ({timeout}) => {
|
||||
const validateTimeout = ({timeout}) => {
|
||||
if (timeout !== undefined && (!Number.isFinite(timeout) || timeout < 0)) {
|
||||
throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${timeout}\` (${typeof timeout})`);
|
||||
}
|
||||
};
|
||||
|
||||
// `cleanup` option handling
|
||||
export const setExitHandler = async (spawned, {cleanup, detached}, timedPromise) => {
|
||||
const setExitHandler = async (spawned, {cleanup, detached}, timedPromise) => {
|
||||
if (!cleanup || detached) {
|
||||
return timedPromise;
|
||||
}
|
||||
@@ -100,3 +105,11 @@ export const setExitHandler = async (spawned, {cleanup, detached}, timedPromise)
|
||||
removeExitHandler();
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
spawnedKill,
|
||||
spawnedCancel,
|
||||
setupTimeout,
|
||||
validateTimeout,
|
||||
setExitHandler
|
||||
};
|
||||
|
||||
42
node_modules/execa/lib/pipe.js
generated
vendored
42
node_modules/execa/lib/pipe.js
generated
vendored
@@ -1,42 +0,0 @@
|
||||
import {createWriteStream} from 'node:fs';
|
||||
import {ChildProcess} from 'node:child_process';
|
||||
import {isWritableStream} from 'is-stream';
|
||||
|
||||
const isExecaChildProcess = target => target instanceof ChildProcess && typeof target.then === 'function';
|
||||
|
||||
const pipeToTarget = (spawned, streamName, target) => {
|
||||
if (typeof target === 'string') {
|
||||
spawned[streamName].pipe(createWriteStream(target));
|
||||
return spawned;
|
||||
}
|
||||
|
||||
if (isWritableStream(target)) {
|
||||
spawned[streamName].pipe(target);
|
||||
return spawned;
|
||||
}
|
||||
|
||||
if (!isExecaChildProcess(target)) {
|
||||
throw new TypeError('The second argument must be a string, a stream or an Execa child process.');
|
||||
}
|
||||
|
||||
if (!isWritableStream(target.stdin)) {
|
||||
throw new TypeError('The target child process\'s stdin must be available.');
|
||||
}
|
||||
|
||||
spawned[streamName].pipe(target.stdin);
|
||||
return target;
|
||||
};
|
||||
|
||||
export const addPipeMethods = spawned => {
|
||||
if (spawned.stdout !== null) {
|
||||
spawned.pipeStdout = pipeToTarget.bind(undefined, spawned, 'stdout');
|
||||
}
|
||||
|
||||
if (spawned.stderr !== null) {
|
||||
spawned.pipeStderr = pipeToTarget.bind(undefined, spawned, 'stderr');
|
||||
}
|
||||
|
||||
if (spawned.all !== undefined) {
|
||||
spawned.pipeAll = pipeToTarget.bind(undefined, spawned, 'all');
|
||||
}
|
||||
};
|
||||
48
node_modules/execa/lib/promise.js
generated
vendored
48
node_modules/execa/lib/promise.js
generated
vendored
@@ -1,36 +1,46 @@
|
||||
// eslint-disable-next-line unicorn/prefer-top-level-await
|
||||
const nativePromisePrototype = (async () => {})().constructor.prototype;
|
||||
'use strict';
|
||||
|
||||
const nativePromisePrototype = (async () => {})().constructor.prototype;
|
||||
const descriptors = ['then', 'catch', 'finally'].map(property => [
|
||||
property,
|
||||
Reflect.getOwnPropertyDescriptor(nativePromisePrototype, property),
|
||||
Reflect.getOwnPropertyDescriptor(nativePromisePrototype, property)
|
||||
]);
|
||||
|
||||
// The return value is a mixin of `childProcess` and `Promise`
|
||||
export const mergePromise = (spawned, promise) => {
|
||||
const mergePromise = (spawned, promise) => {
|
||||
for (const [property, descriptor] of descriptors) {
|
||||
// Starting the main `promise` is deferred to avoid consuming streams
|
||||
const value = typeof promise === 'function'
|
||||
? (...args) => Reflect.apply(descriptor.value, promise(), args)
|
||||
: descriptor.value.bind(promise);
|
||||
const value = typeof promise === 'function' ?
|
||||
(...args) => Reflect.apply(descriptor.value, promise(), args) :
|
||||
descriptor.value.bind(promise);
|
||||
|
||||
Reflect.defineProperty(spawned, property, {...descriptor, value});
|
||||
}
|
||||
|
||||
return spawned;
|
||||
};
|
||||
|
||||
// Use promises instead of `child_process` events
|
||||
export const getSpawnedPromise = spawned => new Promise((resolve, reject) => {
|
||||
spawned.on('exit', (exitCode, signal) => {
|
||||
resolve({exitCode, signal});
|
||||
});
|
||||
const getSpawnedPromise = spawned => {
|
||||
return new Promise((resolve, reject) => {
|
||||
spawned.on('exit', (exitCode, signal) => {
|
||||
resolve({exitCode, signal});
|
||||
});
|
||||
|
||||
spawned.on('error', error => {
|
||||
reject(error);
|
||||
});
|
||||
|
||||
if (spawned.stdin) {
|
||||
spawned.stdin.on('error', error => {
|
||||
spawned.on('error', error => {
|
||||
reject(error);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
if (spawned.stdin) {
|
||||
spawned.stdin.on('error', error => {
|
||||
reject(error);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
mergePromise,
|
||||
getSpawnedPromise
|
||||
};
|
||||
|
||||
|
||||
7
node_modules/execa/lib/stdio.js
generated
vendored
7
node_modules/execa/lib/stdio.js
generated
vendored
@@ -1,8 +1,9 @@
|
||||
'use strict';
|
||||
const aliases = ['stdin', 'stdout', 'stderr'];
|
||||
|
||||
const hasAlias = options => aliases.some(alias => options[alias] !== undefined);
|
||||
|
||||
export const normalizeStdio = options => {
|
||||
const normalizeStdio = options => {
|
||||
if (!options) {
|
||||
return;
|
||||
}
|
||||
@@ -29,8 +30,10 @@ export const normalizeStdio = options => {
|
||||
return Array.from({length}, (value, index) => stdio[index]);
|
||||
};
|
||||
|
||||
module.exports = normalizeStdio;
|
||||
|
||||
// `ipc` is pushed unless it is already present
|
||||
export const normalizeStdioNode = options => {
|
||||
module.exports.node = options => {
|
||||
const stdio = normalizeStdio(options);
|
||||
|
||||
if (stdio === 'ipc') {
|
||||
|
||||
76
node_modules/execa/lib/stream.js
generated
vendored
76
node_modules/execa/lib/stream.js
generated
vendored
@@ -1,48 +1,13 @@
|
||||
import {createReadStream, readFileSync} from 'node:fs';
|
||||
import {isStream} from 'is-stream';
|
||||
import getStream from 'get-stream';
|
||||
import mergeStream from 'merge-stream';
|
||||
'use strict';
|
||||
const isStream = require('is-stream');
|
||||
const getStream = require('get-stream');
|
||||
const mergeStream = require('merge-stream');
|
||||
|
||||
const validateInputOptions = input => {
|
||||
if (input !== undefined) {
|
||||
throw new TypeError('The `input` and `inputFile` options cannot be both set.');
|
||||
}
|
||||
};
|
||||
|
||||
const getInputSync = ({input, inputFile}) => {
|
||||
if (typeof inputFile !== 'string') {
|
||||
return input;
|
||||
}
|
||||
|
||||
validateInputOptions(input);
|
||||
return readFileSync(inputFile);
|
||||
};
|
||||
|
||||
// `input` and `inputFile` option in sync mode
|
||||
export const handleInputSync = options => {
|
||||
const input = getInputSync(options);
|
||||
|
||||
if (isStream(input)) {
|
||||
throw new TypeError('The `input` option cannot be a stream in sync mode');
|
||||
}
|
||||
|
||||
return input;
|
||||
};
|
||||
|
||||
const getInput = ({input, inputFile}) => {
|
||||
if (typeof inputFile !== 'string') {
|
||||
return input;
|
||||
}
|
||||
|
||||
validateInputOptions(input);
|
||||
return createReadStream(inputFile);
|
||||
};
|
||||
|
||||
// `input` and `inputFile` option in async mode
|
||||
export const handleInput = (spawned, options) => {
|
||||
const input = getInput(options);
|
||||
|
||||
if (input === undefined) {
|
||||
// `input` option
|
||||
const handleInput = (spawned, input) => {
|
||||
// Checking for stdin is workaround for https://github.com/nodejs/node/issues/26852
|
||||
// @todo remove `|| spawned.stdin === undefined` once we drop support for Node.js <=12.2.0
|
||||
if (input === undefined || spawned.stdin === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -54,7 +19,7 @@ export const handleInput = (spawned, options) => {
|
||||
};
|
||||
|
||||
// `all` interleaves `stdout` and `stderr`
|
||||
export const makeAllStream = (spawned, {all}) => {
|
||||
const makeAllStream = (spawned, {all}) => {
|
||||
if (!all || (!spawned.stdout && !spawned.stderr)) {
|
||||
return;
|
||||
}
|
||||
@@ -74,8 +39,7 @@ export const makeAllStream = (spawned, {all}) => {
|
||||
|
||||
// On failure, `result.stdout|stderr|all` should contain the currently buffered stream
|
||||
const getBufferedData = async (stream, streamPromise) => {
|
||||
// When `buffer` is `false`, `streamPromise` is `undefined` and there is no buffered data to retrieve
|
||||
if (!stream || streamPromise === undefined) {
|
||||
if (!stream) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -101,7 +65,7 @@ const getStreamPromise = (stream, {encoding, buffer, maxBuffer}) => {
|
||||
};
|
||||
|
||||
// Retrieve result of child process: exit code, signal, error, streams (stdout/stderr/all)
|
||||
export const getSpawnedResult = async ({stdout, stderr, all}, {encoding, buffer, maxBuffer}, processDone) => {
|
||||
const getSpawnedResult = async ({stdout, stderr, all}, {encoding, buffer, maxBuffer}, processDone) => {
|
||||
const stdoutPromise = getStreamPromise(stdout, {encoding, buffer, maxBuffer});
|
||||
const stderrPromise = getStreamPromise(stderr, {encoding, buffer, maxBuffer});
|
||||
const allPromise = getStreamPromise(all, {encoding, buffer, maxBuffer: maxBuffer * 2});
|
||||
@@ -113,7 +77,21 @@ export const getSpawnedResult = async ({stdout, stderr, all}, {encoding, buffer,
|
||||
{error, signal: error.signal, timedOut: error.timedOut},
|
||||
getBufferedData(stdout, stdoutPromise),
|
||||
getBufferedData(stderr, stderrPromise),
|
||||
getBufferedData(all, allPromise),
|
||||
getBufferedData(all, allPromise)
|
||||
]);
|
||||
}
|
||||
};
|
||||
|
||||
const validateInputSync = ({input}) => {
|
||||
if (isStream(input)) {
|
||||
throw new TypeError('The `input` option cannot be a stream in sync mode');
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
handleInput,
|
||||
makeAllStream,
|
||||
getSpawnedResult,
|
||||
validateInputSync
|
||||
};
|
||||
|
||||
|
||||
19
node_modules/execa/lib/verbose.js
generated
vendored
19
node_modules/execa/lib/verbose.js
generated
vendored
@@ -1,19 +0,0 @@
|
||||
import {debuglog} from 'node:util';
|
||||
import process from 'node:process';
|
||||
|
||||
export const verboseDefault = debuglog('execa').enabled;
|
||||
|
||||
const padField = (field, padding) => String(field).padStart(padding, '0');
|
||||
|
||||
const getTimestamp = () => {
|
||||
const date = new Date();
|
||||
return `${padField(date.getHours(), 2)}:${padField(date.getMinutes(), 2)}:${padField(date.getSeconds(), 2)}.${padField(date.getMilliseconds(), 3)}`;
|
||||
};
|
||||
|
||||
export const logCommand = (escapedCommand, {verbose}) => {
|
||||
if (!verbose) {
|
||||
return;
|
||||
}
|
||||
|
||||
process.stderr.write(`[${getTimestamp()}] ${escapedCommand}\n`);
|
||||
};
|
||||
0
node_modules/get-stream/license → node_modules/execa/node_modules/get-stream/license
generated
vendored
0
node_modules/get-stream/license → node_modules/execa/node_modules/get-stream/license
generated
vendored
50
node_modules/execa/package.json
generated
vendored
50
node_modules/execa/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "execa",
|
||||
"version": "7.1.0",
|
||||
"version": "5.1.1",
|
||||
"description": "Process execution for humans",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/execa",
|
||||
@@ -10,13 +10,11 @@
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"type": "module",
|
||||
"exports": "./index.js",
|
||||
"engines": {
|
||||
"node": "^14.18.0 || ^16.14.0 || >=18.0.0"
|
||||
"node": ">=10"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && c8 ava && tsd"
|
||||
"test": "xo && nyc ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
@@ -42,28 +40,27 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"cross-spawn": "^7.0.3",
|
||||
"get-stream": "^6.0.1",
|
||||
"human-signals": "^4.3.0",
|
||||
"is-stream": "^3.0.0",
|
||||
"get-stream": "^6.0.0",
|
||||
"human-signals": "^2.1.0",
|
||||
"is-stream": "^2.0.0",
|
||||
"merge-stream": "^2.0.0",
|
||||
"npm-run-path": "^5.1.0",
|
||||
"onetime": "^6.0.0",
|
||||
"signal-exit": "^3.0.7",
|
||||
"strip-final-newline": "^3.0.0"
|
||||
"npm-run-path": "^4.0.1",
|
||||
"onetime": "^5.1.2",
|
||||
"signal-exit": "^3.0.3",
|
||||
"strip-final-newline": "^2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^18.13.0",
|
||||
"ava": "^5.2.0",
|
||||
"c8": "^7.12.0",
|
||||
"get-node": "^13.5.0",
|
||||
"@types/node": "^14.14.10",
|
||||
"ava": "^2.4.0",
|
||||
"get-node": "^11.0.1",
|
||||
"is-running": "^2.1.0",
|
||||
"p-event": "^5.0.1",
|
||||
"path-key": "^4.0.0",
|
||||
"tempfile": "^4.0.0",
|
||||
"tsd": "^0.25.0",
|
||||
"xo": "^0.53.1"
|
||||
"nyc": "^15.1.0",
|
||||
"p-event": "^4.2.0",
|
||||
"tempfile": "^3.0.0",
|
||||
"tsd": "^0.13.1",
|
||||
"xo": "^0.35.0"
|
||||
},
|
||||
"c8": {
|
||||
"nyc": {
|
||||
"reporter": [
|
||||
"text",
|
||||
"lcov"
|
||||
@@ -73,14 +70,5 @@
|
||||
"**/test.js",
|
||||
"**/test/**"
|
||||
]
|
||||
},
|
||||
"ava": {
|
||||
"workerThreads": false
|
||||
},
|
||||
"xo": {
|
||||
"rules": {
|
||||
"unicorn/no-empty-file": "off",
|
||||
"@typescript-eslint/ban-types": "off"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
439
node_modules/execa/readme.md
generated
vendored
439
node_modules/execa/readme.md
generated
vendored
@@ -1,7 +1,4 @@
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="media/logo_dark.svg">
|
||||
<img alt="execa logo" src="media/logo.svg" width="400">
|
||||
</picture>
|
||||
<img src="media/logo.svg" width="400">
|
||||
<br>
|
||||
|
||||
[](https://codecov.io/gh/sindresorhus/execa)
|
||||
@@ -12,173 +9,123 @@
|
||||
|
||||
This package improves [`child_process`](https://nodejs.org/api/child_process.html) methods with:
|
||||
|
||||
- [Promise interface](#execacommandcommand-options).
|
||||
- [Scripts interface](#scripts-interface), like `zx`.
|
||||
- Improved [Windows support](https://github.com/IndigoUnited/node-cross-spawn#why), including [shebang](https://en.wikipedia.org/wiki/Shebang_(Unix)) binaries.
|
||||
- Executes [locally installed binaries](#preferlocal) without `npx`.
|
||||
- [Cleans up](#cleanup) child processes when the parent process ends.
|
||||
- [Graceful termination](#optionsforcekillaftertimeout).
|
||||
- Get [interleaved output](#all) from `stdout` and `stderr` similar to what is printed on the terminal.
|
||||
- Promise interface.
|
||||
- [Strips the final newline](#stripfinalnewline) from the output so you don't have to do `stdout.trim()`.
|
||||
- Convenience methods to pipe processes' [input](#input) and [output](#redirect-output-to-a-file).
|
||||
- Can specify file and arguments [as a single string](#execacommandcommand-options) without a shell.
|
||||
- [Verbose mode](#verbose-mode) for debugging.
|
||||
- Supports [shebang](https://en.wikipedia.org/wiki/Shebang_(Unix)) binaries cross-platform.
|
||||
- [Improved Windows support.](https://github.com/IndigoUnited/node-cross-spawn#why)
|
||||
- Higher max buffer. 100 MB instead of 200 KB.
|
||||
- [Executes locally installed binaries by name.](#preferlocal)
|
||||
- [Cleans up spawned processes when the parent process dies.](#cleanup)
|
||||
- [Get interleaved output](#all) from `stdout` and `stderr` similar to what is printed on the terminal. [*(Async only)*](#execasyncfile-arguments-options)
|
||||
- [Can specify file and arguments as a single string without a shell](#execacommandcommand-options)
|
||||
- More descriptive errors.
|
||||
- Higher max buffer: 100 MB instead of 1 MB.
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
npm install execa
|
||||
```
|
||||
$ npm install execa
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Promise interface
|
||||
|
||||
```js
|
||||
import {execa} from 'execa';
|
||||
const execa = require('execa');
|
||||
|
||||
const {stdout} = await execa('echo', ['unicorns']);
|
||||
console.log(stdout);
|
||||
//=> 'unicorns'
|
||||
(async () => {
|
||||
const {stdout} = await execa('echo', ['unicorns']);
|
||||
console.log(stdout);
|
||||
//=> 'unicorns'
|
||||
})();
|
||||
```
|
||||
|
||||
### Scripts interface
|
||||
|
||||
For more information about Execa scripts, please see [this page](docs/scripts.md).
|
||||
|
||||
#### Basic
|
||||
### Pipe the child process stdout to the parent
|
||||
|
||||
```js
|
||||
import {$} from 'execa';
|
||||
const execa = require('execa');
|
||||
|
||||
const branch = await $`git branch --show-current`;
|
||||
await $`dep deploy --branch=${branch}`;
|
||||
```
|
||||
|
||||
#### Multiple arguments
|
||||
|
||||
```js
|
||||
import {$} from 'execa';
|
||||
|
||||
const args = ['unicorns', '&', 'rainbows!'];
|
||||
const {stdout} = await $`echo ${args}`;
|
||||
console.log(stdout);
|
||||
//=> 'unicorns & rainbows!'
|
||||
```
|
||||
|
||||
#### With options
|
||||
|
||||
```js
|
||||
import {$} from 'execa';
|
||||
|
||||
await $({stdio: 'inherit'})`echo unicorns`;
|
||||
//=> 'unicorns'
|
||||
```
|
||||
|
||||
#### Shared options
|
||||
|
||||
```js
|
||||
import {$} from 'execa';
|
||||
|
||||
const $$ = $({stdio: 'inherit'});
|
||||
|
||||
await $$`echo unicorns`;
|
||||
//=> 'unicorns'
|
||||
|
||||
await $$`echo rainbows`;
|
||||
//=> 'rainbows'
|
||||
```
|
||||
|
||||
#### Verbose mode
|
||||
|
||||
```sh
|
||||
> node file.js
|
||||
unicorns
|
||||
rainbows
|
||||
|
||||
> NODE_DEBUG=execa node file.js
|
||||
[16:50:03.305] echo unicorns
|
||||
unicorns
|
||||
[16:50:03.308] echo rainbows
|
||||
rainbows
|
||||
```
|
||||
|
||||
### Input/output
|
||||
|
||||
#### Redirect output to a file
|
||||
|
||||
```js
|
||||
import {execa} from 'execa';
|
||||
|
||||
// Similar to `echo unicorns > stdout.txt` in Bash
|
||||
await execa('echo', ['unicorns']).pipeStdout('stdout.txt');
|
||||
|
||||
// Similar to `echo unicorns 2> stdout.txt` in Bash
|
||||
await execa('echo', ['unicorns']).pipeStderr('stderr.txt');
|
||||
|
||||
// Similar to `echo unicorns &> stdout.txt` in Bash
|
||||
await execa('echo', ['unicorns'], {all: true}).pipeAll('all.txt');
|
||||
```
|
||||
|
||||
#### Redirect input from a file
|
||||
|
||||
```js
|
||||
import {execa} from 'execa';
|
||||
|
||||
// Similar to `cat < stdin.txt` in Bash
|
||||
const {stdout} = await execa('cat', {inputFile: 'stdin.txt'});
|
||||
console.log(stdout);
|
||||
//=> 'unicorns'
|
||||
```
|
||||
|
||||
#### Save and pipe output from a child process
|
||||
|
||||
```js
|
||||
import {execa} from 'execa';
|
||||
|
||||
const {stdout} = await execa('echo', ['unicorns']).pipeStdout(process.stdout);
|
||||
// Prints `unicorns`
|
||||
console.log(stdout);
|
||||
// Also returns 'unicorns'
|
||||
```
|
||||
|
||||
#### Pipe multiple processes
|
||||
|
||||
```js
|
||||
import {execa} from 'execa';
|
||||
|
||||
// Similar to `echo unicorns | cat` in Bash
|
||||
const {stdout} = await execa('echo', ['unicorns']).pipeStdout(execa('cat'));
|
||||
console.log(stdout);
|
||||
//=> 'unicorns'
|
||||
execa('echo', ['unicorns']).stdout.pipe(process.stdout);
|
||||
```
|
||||
|
||||
### Handling Errors
|
||||
|
||||
```js
|
||||
import {execa} from 'execa';
|
||||
const execa = require('execa');
|
||||
|
||||
// Catching an error
|
||||
(async () => {
|
||||
// Catching an error
|
||||
try {
|
||||
await execa('unknown', ['command']);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
/*
|
||||
{
|
||||
message: 'Command failed with ENOENT: unknown command spawn unknown ENOENT',
|
||||
errno: -2,
|
||||
code: 'ENOENT',
|
||||
syscall: 'spawn unknown',
|
||||
path: 'unknown',
|
||||
spawnargs: ['command'],
|
||||
originalMessage: 'spawn unknown ENOENT',
|
||||
shortMessage: 'Command failed with ENOENT: unknown command spawn unknown ENOENT',
|
||||
command: 'unknown command',
|
||||
escapedCommand: 'unknown command',
|
||||
stdout: '',
|
||||
stderr: '',
|
||||
all: '',
|
||||
failed: true,
|
||||
timedOut: false,
|
||||
isCanceled: false,
|
||||
killed: false
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
})();
|
||||
```
|
||||
|
||||
### Cancelling a spawned process
|
||||
|
||||
```js
|
||||
const execa = require('execa');
|
||||
|
||||
(async () => {
|
||||
const subprocess = execa('node');
|
||||
|
||||
setTimeout(() => {
|
||||
subprocess.cancel();
|
||||
}, 1000);
|
||||
|
||||
try {
|
||||
await subprocess;
|
||||
} catch (error) {
|
||||
console.log(subprocess.killed); // true
|
||||
console.log(error.isCanceled); // true
|
||||
}
|
||||
})()
|
||||
```
|
||||
|
||||
### Catching an error with the sync method
|
||||
|
||||
```js
|
||||
try {
|
||||
await execa('unknown', ['command']);
|
||||
execa.sync('unknown', ['command']);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
/*
|
||||
{
|
||||
message: 'Command failed with ENOENT: unknown command spawn unknown ENOENT',
|
||||
message: 'Command failed with ENOENT: unknown command spawnSync unknown ENOENT',
|
||||
errno: -2,
|
||||
code: 'ENOENT',
|
||||
syscall: 'spawn unknown',
|
||||
syscall: 'spawnSync unknown',
|
||||
path: 'unknown',
|
||||
spawnargs: ['command'],
|
||||
originalMessage: 'spawn unknown ENOENT',
|
||||
shortMessage: 'Command failed with ENOENT: unknown command spawn unknown ENOENT',
|
||||
originalMessage: 'spawnSync unknown ENOENT',
|
||||
shortMessage: 'Command failed with ENOENT: unknown command spawnSync unknown ENOENT',
|
||||
command: 'unknown command',
|
||||
escapedCommand: 'unknown command',
|
||||
stdout: '',
|
||||
stderr: '',
|
||||
all: '',
|
||||
failed: true,
|
||||
timedOut: false,
|
||||
isCanceled: false,
|
||||
@@ -188,7 +135,7 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
### Graceful termination
|
||||
### Kill a process
|
||||
|
||||
Using SIGTERM, and after 2 seconds, kill it with SIGKILL.
|
||||
|
||||
@@ -204,84 +151,17 @@ setTimeout(() => {
|
||||
|
||||
## API
|
||||
|
||||
### Methods
|
||||
### execa(file, arguments, options?)
|
||||
|
||||
#### execa(file, arguments?, options?)
|
||||
Execute a file. Think of this as a mix of [`child_process.execFile()`](https://nodejs.org/api/child_process.html#child_process_child_process_execfile_file_args_options_callback) and [`child_process.spawn()`](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options).
|
||||
|
||||
Executes a command using `file ...arguments`. `arguments` are specified as an array of strings. Returns a [`childProcess`](#childprocess).
|
||||
No escaping/quoting is needed.
|
||||
|
||||
Arguments are [automatically escaped](#shell-syntax). They can contain any character, including spaces.
|
||||
Unless the [`shell`](#shell) option is used, no shell interpreter (Bash, `cmd.exe`, etc.) is used, so shell features such as variables substitution (`echo $PATH`) are not allowed.
|
||||
|
||||
This is the preferred method when executing single commands.
|
||||
|
||||
#### execaNode(scriptPath, arguments?, options?)
|
||||
|
||||
Executes a Node.js file using `node scriptPath ...arguments`. `arguments` are specified as an array of strings. Returns a [`childProcess`](#childprocess).
|
||||
|
||||
Arguments are [automatically escaped](#shell-syntax). They can contain any character, including spaces.
|
||||
|
||||
This is the preferred method when executing Node.js files.
|
||||
|
||||
Like [`child_process#fork()`](https://nodejs.org/api/child_process.html#child_process_child_process_fork_modulepath_args_options):
|
||||
- the current Node version and options are used. This can be overridden using the [`nodePath`](#nodepath-for-node-only) and [`nodeOptions`](#nodeoptions-for-node-only) options.
|
||||
- the [`shell`](#shell) option cannot be used
|
||||
- an extra channel [`ipc`](https://nodejs.org/api/child_process.html#child_process_options_stdio) is passed to [`stdio`](#stdio)
|
||||
|
||||
#### $\`command\`
|
||||
|
||||
Executes a command. The `command` string includes both the `file` and its `arguments`. Returns a [`childProcess`](#childprocess).
|
||||
|
||||
Arguments are [automatically escaped](#shell-syntax). They can contain any character, but spaces must use `${}` like `` $`echo ${'has space'}` ``.
|
||||
|
||||
This is the preferred method when executing multiple commands in a script file.
|
||||
|
||||
The `command` string can inject any `${value}` with the following types: string, number, [`childProcess`](#childprocess) or an array of those types. For example: `` $`echo one ${'two'} ${3} ${['four', 'five']}` ``. For `${childProcess}`, the process's `stdout` is used.
|
||||
|
||||
For more information, please see [this section](#scripts-interface) and [this page](docs/scripts.md).
|
||||
|
||||
#### $(options)
|
||||
|
||||
Returns a new instance of [`$`](#command) but with different default `options`. Consecutive calls are merged to previous ones.
|
||||
|
||||
This can be used to either:
|
||||
- Set options for a specific command: `` $(options)`command` ``
|
||||
- Share options for multiple commands: `` const $$ = $(options); $$`command`; $$`otherCommand`; ``
|
||||
|
||||
#### execaCommand(command, options?)
|
||||
|
||||
Executes a command. The `command` string includes both the `file` and its `arguments`. Returns a [`childProcess`](#childprocess).
|
||||
|
||||
Arguments are [automatically escaped](#shell-syntax). They can contain any character, but spaces must be escaped with a backslash like `execaCommand('echo has\\ space')`.
|
||||
|
||||
This is the preferred method when executing a user-supplied `command` string, such as in a REPL.
|
||||
|
||||
### execaSync(file, arguments?, options?)
|
||||
|
||||
Same as [`execa()`](#execacommandcommand-options) but synchronous.
|
||||
|
||||
Returns or throws a [`childProcessResult`](#childProcessResult).
|
||||
|
||||
### $.sync\`command\`
|
||||
|
||||
Same as [$\`command\`](#command) but synchronous.
|
||||
|
||||
Returns or throws a [`childProcessResult`](#childProcessResult).
|
||||
|
||||
### execaCommandSync(command, options?)
|
||||
|
||||
Same as [`execaCommand()`](#execacommand-command-options) but synchronous.
|
||||
|
||||
Returns or throws a [`childProcessResult`](#childProcessResult).
|
||||
|
||||
### Shell syntax
|
||||
|
||||
For all the [methods above](#methods), no shell interpreter (Bash, cmd.exe, etc.) is used unless the [`shell` option](#shell) is set. This means shell-specific characters and expressions (`$variable`, `&&`, `||`, `;`, `|`, etc.) have no special meaning and do not need to be escaped.
|
||||
|
||||
### childProcess
|
||||
|
||||
The return value of all [asynchronous methods](#methods) is both:
|
||||
- a `Promise` resolving or rejecting with a [`childProcessResult`](#childProcessResult).
|
||||
- a [`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess) with the following additional methods and properties.
|
||||
Returns a [`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess) which:
|
||||
- is also a `Promise` resolving or rejecting with a [`childProcessResult`](#childProcessResult).
|
||||
- exposes the following additional methods and properties.
|
||||
|
||||
#### kill(signal?, options?)
|
||||
|
||||
@@ -296,6 +176,10 @@ Milliseconds to wait for the child process to terminate before sending `SIGKILL`
|
||||
|
||||
Can be disabled with `false`.
|
||||
|
||||
#### cancel()
|
||||
|
||||
Similar to [`childProcess.kill()`](https://nodejs.org/api/child_process.html#child_process_subprocess_kill_signal). This is preferred when cancelling the child process execution as the error is more descriptive and [`childProcessResult.isCanceled`](#iscanceled) is set to `true`.
|
||||
|
||||
#### all
|
||||
|
||||
Type: `ReadableStream | undefined`
|
||||
@@ -306,28 +190,34 @@ This is `undefined` if either:
|
||||
- the [`all` option](#all-2) is `false` (the default value)
|
||||
- both [`stdout`](#stdout-1) and [`stderr`](#stderr-1) options are set to [`'inherit'`, `'ipc'`, `Stream` or `integer`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio)
|
||||
|
||||
#### pipeStdout(target)
|
||||
### execa.sync(file, arguments?, options?)
|
||||
|
||||
[Pipe](https://nodejs.org/api/stream.html#readablepipedestination-options) the child process's `stdout` to `target`, which can be:
|
||||
- Another [`execa()` return value](#pipe-multiple-processes)
|
||||
- A [writable stream](#save-and-pipe-output-from-a-child-process)
|
||||
- A [file path string](#redirect-output-to-a-file)
|
||||
Execute a file synchronously.
|
||||
|
||||
If the `target` is another [`execa()` return value](#execacommandcommand-options), it is returned. Otherwise, the original `execa()` return value is returned. This allows chaining `pipeStdout()` then `await`ing the [final result](#childprocessresult).
|
||||
Returns or throws a [`childProcessResult`](#childProcessResult).
|
||||
|
||||
The [`stdout` option](#stdout-1) must be kept as `pipe`, its default value.
|
||||
### execa.command(command, options?)
|
||||
|
||||
#### pipeStderr(target)
|
||||
Same as [`execa()`](#execafile-arguments-options) except both file and arguments are specified in a single `command` string. For example, `execa('echo', ['unicorns'])` is the same as `execa.command('echo unicorns')`.
|
||||
|
||||
Like [`pipeStdout()`](#pipestdouttarget) but piping the child process's `stderr` instead.
|
||||
If the file or an argument contains spaces, they must be escaped with backslashes. This matters especially if `command` is not a constant but a variable, for example with `__dirname` or `process.cwd()`. Except for spaces, no escaping/quoting is needed.
|
||||
|
||||
The [`stderr` option](#stderr-1) must be kept as `pipe`, its default value.
|
||||
The [`shell` option](#shell) must be used if the `command` uses shell-specific features (for example, `&&` or `||`), as opposed to being a simple `file` followed by its `arguments`.
|
||||
|
||||
#### pipeAll(target)
|
||||
### execa.commandSync(command, options?)
|
||||
|
||||
Combines both [`pipeStdout()`](#pipestdouttarget) and [`pipeStderr()`](#pipestderrtarget).
|
||||
Same as [`execa.command()`](#execacommand-command-options) but synchronous.
|
||||
|
||||
Either the [`stdout` option](#stdout-1) or the [`stderr` option](#stderr-1) must be kept as `pipe`, their default value. Also, the [`all` option](#all-2) must be set to `true`.
|
||||
Returns or throws a [`childProcessResult`](#childProcessResult).
|
||||
|
||||
### execa.node(scriptPath, arguments?, options?)
|
||||
|
||||
Execute a Node.js script as a child process.
|
||||
|
||||
Same as `execa('node', [scriptPath, ...arguments], options)` except (like [`child_process#fork()`](https://nodejs.org/api/child_process.html#child_process_child_process_fork_modulepath_args_options)):
|
||||
- the current Node version and options are used. This can be overridden using the [`nodePath`](#nodepath-for-node-only) and [`nodeOptions`](#nodeoptions-for-node-only) options.
|
||||
- the [`shell`](#shell) option cannot be used
|
||||
- an extra channel [`ipc`](https://nodejs.org/api/child_process.html#child_process_options_stdio) is passed to [`stdio`](#stdio)
|
||||
|
||||
### childProcessResult
|
||||
|
||||
@@ -348,16 +238,16 @@ Type: `string`
|
||||
|
||||
The file and arguments that were run, for logging purposes.
|
||||
|
||||
This is not escaped and should not be executed directly as a process, including using [`execa()`](#execafile-arguments-options) or [`execaCommand()`](#execacommandcommand-options).
|
||||
This is not escaped and should not be executed directly as a process, including using [`execa()`](#execafile-arguments-options) or [`execa.command()`](#execacommandcommand-options).
|
||||
|
||||
#### escapedCommand
|
||||
|
||||
Type: `string`
|
||||
|
||||
Same as [`command`](#command-1) but escaped.
|
||||
Same as [`command`](#command) but escaped.
|
||||
|
||||
This is meant to be copy and pasted into a shell, for debugging purposes.
|
||||
Since the escaping is fairly basic, this should not be executed directly as a process, including using [`execa()`](#execafile-arguments-options) or [`execaCommand()`](#execacommandcommand-options).
|
||||
Since the escaping is fairly basic, this should not be executed directly as a process, including using [`execa()`](#execafile-arguments-options) or [`execa.command()`](#execacommandcommand-options).
|
||||
|
||||
#### exitCode
|
||||
|
||||
@@ -385,7 +275,7 @@ The output of the process with `stdout` and `stderr` interleaved.
|
||||
|
||||
This is `undefined` if either:
|
||||
- the [`all` option](#all-2) is `false` (the default value)
|
||||
- `execaSync()` was used
|
||||
- `execa.sync()` was used
|
||||
|
||||
#### failed
|
||||
|
||||
@@ -405,8 +295,6 @@ Type: `boolean`
|
||||
|
||||
Whether the process was canceled.
|
||||
|
||||
You can cancel the spawned process using the [`signal`](#signal-1) option.
|
||||
|
||||
#### killed
|
||||
|
||||
Type: `boolean`
|
||||
@@ -467,14 +355,14 @@ Kill the spawned process when the parent process exits unless either:
|
||||
#### preferLocal
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `true` with [`$`](#command)/[`$.sync`](#synccommand), `false` otherwise
|
||||
Default: `false`
|
||||
|
||||
Prefer locally installed binaries when looking for a binary to execute.\
|
||||
If you `$ npm install foo`, you can then `execa('foo')`.
|
||||
|
||||
#### localDir
|
||||
|
||||
Type: `string | URL`\
|
||||
Type: `string`\
|
||||
Default: `process.cwd()`
|
||||
|
||||
Preferred path to find locally installed binaries in (use with `preferLocal`).
|
||||
@@ -508,16 +396,6 @@ Type: `string | Buffer | stream.Readable`
|
||||
Write some input to the `stdin` of your binary.\
|
||||
Streams are not allowed when using the synchronous methods.
|
||||
|
||||
If the input is a file, use the [`inputFile` option](#inputfile) instead.
|
||||
|
||||
#### inputFile
|
||||
|
||||
Type: `string`
|
||||
|
||||
Use a file as input to the the `stdin` of your binary.
|
||||
|
||||
If the input is not a file, use the [`input` option](#input) instead.
|
||||
|
||||
#### stdin
|
||||
|
||||
Type: `string | number | Stream | undefined`\
|
||||
@@ -573,7 +451,7 @@ Execa also accepts the below options which are the same as the options for [`chi
|
||||
|
||||
#### cwd
|
||||
|
||||
Type: `string | URL`\
|
||||
Type: `string`\
|
||||
Default: `process.cwd()`
|
||||
|
||||
Current working directory of the child process.
|
||||
@@ -603,10 +481,12 @@ Child's [stdio](https://nodejs.org/api/child_process.html#child_process_options_
|
||||
Type: `string`\
|
||||
Default: `'json'`
|
||||
|
||||
Specify the kind of serialization used for sending messages between processes when using the [`stdio: 'ipc'`](#stdio) option or [`execaNode()`](#execanodescriptpath-arguments-options):
|
||||
Specify the kind of serialization used for sending messages between processes when using the [`stdio: 'ipc'`](#stdio) option or [`execa.node()`](#execanodescriptpath-arguments-options):
|
||||
- `json`: Uses `JSON.stringify()` and `JSON.parse()`.
|
||||
- `advanced`: Uses [`v8.serialize()`](https://nodejs.org/api/v8.html#v8_v8_serialize_value)
|
||||
|
||||
Requires Node.js `13.2.0` or later.
|
||||
|
||||
[More info.](https://nodejs.org/api/child_process.html#child_process_advanced_serialization)
|
||||
|
||||
#### detached
|
||||
@@ -667,16 +547,6 @@ Default: `SIGTERM`
|
||||
|
||||
Signal value to be used when the spawned process will be killed.
|
||||
|
||||
#### signal
|
||||
|
||||
Type: [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)
|
||||
|
||||
You can abort the spawned process using [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).
|
||||
|
||||
When `AbortController.abort()` is called, [`.isCanceled`](#iscanceled) becomes `false`.
|
||||
|
||||
*Requires Node.js 16 or later.*
|
||||
|
||||
#### windowsVerbatimArguments
|
||||
|
||||
Type: `boolean`\
|
||||
@@ -691,15 +561,6 @@ Default: `true`
|
||||
|
||||
On Windows, do not create a new console window. Please note this also prevents `CTRL-C` [from working](https://github.com/nodejs/node/issues/29837) on Windows.
|
||||
|
||||
#### verbose
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `false`
|
||||
|
||||
[Print each command](#verbose-mode) on `stderr` before executing it.
|
||||
|
||||
This can also be enabled by setting the `NODE_DEBUG=execa` environment variable in the current process.
|
||||
|
||||
#### nodePath *(For `.node()` only)*
|
||||
|
||||
Type: `string`\
|
||||
@@ -721,43 +582,59 @@ List of [CLI options](https://nodejs.org/api/cli.html#cli_options) passed to the
|
||||
Gracefully handle failures by using automatic retries and exponential backoff with the [`p-retry`](https://github.com/sindresorhus/p-retry) package:
|
||||
|
||||
```js
|
||||
import pRetry from 'p-retry';
|
||||
const pRetry = require('p-retry');
|
||||
|
||||
const run = async () => {
|
||||
const results = await execa('curl', ['-sSL', 'https://sindresorhus.com/unicorn']);
|
||||
return results;
|
||||
};
|
||||
|
||||
console.log(await pRetry(run, {retries: 5}));
|
||||
(async () => {
|
||||
console.log(await pRetry(run, {retries: 5}));
|
||||
})();
|
||||
```
|
||||
|
||||
### Cancelling a spawned process
|
||||
### Save and pipe output from a child process
|
||||
|
||||
Let's say you want to show the output of a child process in real-time while also saving it to a variable.
|
||||
|
||||
```js
|
||||
import {execa} from 'execa';
|
||||
const execa = require('execa');
|
||||
|
||||
const abortController = new AbortController();
|
||||
const subprocess = execa('node', [], {signal: abortController.signal});
|
||||
const subprocess = execa('echo', ['foo']);
|
||||
subprocess.stdout.pipe(process.stdout);
|
||||
|
||||
setTimeout(() => {
|
||||
abortController.abort();
|
||||
}, 1000);
|
||||
(async () => {
|
||||
const {stdout} = await subprocess;
|
||||
console.log('child output:', stdout);
|
||||
})();
|
||||
```
|
||||
|
||||
try {
|
||||
await subprocess;
|
||||
} catch (error) {
|
||||
console.log(subprocess.killed); // true
|
||||
console.log(error.isCanceled); // true
|
||||
}
|
||||
### Redirect output to a file
|
||||
|
||||
```js
|
||||
const execa = require('execa');
|
||||
|
||||
const subprocess = execa('echo', ['foo'])
|
||||
subprocess.stdout.pipe(fs.createWriteStream('stdout.txt'))
|
||||
```
|
||||
|
||||
### Redirect input from a file
|
||||
|
||||
```js
|
||||
const execa = require('execa');
|
||||
|
||||
const subprocess = execa('cat')
|
||||
fs.createReadStream('stdin.txt').pipe(subprocess.stdin)
|
||||
```
|
||||
|
||||
### Execute the current package's binary
|
||||
|
||||
```js
|
||||
import {getBinPath} from 'get-bin-path';
|
||||
const {getBinPathSync} = require('get-bin-path');
|
||||
|
||||
const binPath = await getBinPath();
|
||||
await execa(binPath);
|
||||
const binPath = getBinPathSync();
|
||||
const subprocess = execa(binPath);
|
||||
```
|
||||
|
||||
`execa` can be combined with [`get-bin-path`](https://github.com/ehmicky/get-bin-path) to test the current package's binary. As opposed to hard-coding the path to the binary, this validates that the `package.json` `bin` field is correctly set up.
|
||||
|
||||
11
node_modules/human-signals/CHANGELOG.md
generated
vendored
Normal file
11
node_modules/human-signals/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
# 2.1.0
|
||||
|
||||
## TypeScript types
|
||||
|
||||
- Add [TypeScript definitions](src/main.d.ts)
|
||||
|
||||
# 2.0.0
|
||||
|
||||
## Breaking changes
|
||||
|
||||
- Minimal supported Node.js version is now `10.17.0`
|
||||
2
node_modules/human-signals/LICENSE
generated
vendored
2
node_modules/human-signals/LICENSE
generated
vendored
@@ -186,7 +186,7 @@
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2022 ehmicky <ehmicky@gmail.com>
|
||||
Copyright 2019 ehmicky <ehmicky@gmail.com>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
||||
26
node_modules/human-signals/README.md
generated
vendored
26
node_modules/human-signals/README.md
generated
vendored
@@ -1,8 +1,9 @@
|
||||
[](https://www.npmjs.com/package/human-signals)
|
||||
[](/types/main.d.ts)
|
||||
[](https://codecov.io/gh/ehmicky/human-signals)
|
||||
[](https://twitter.com/intent/follow?screen_name=ehmicky)
|
||||
[](https://medium.com/@ehmicky)
|
||||
[](https://codecov.io/gh/ehmicky/human-signals)
|
||||
[](https://travis-ci.org/ehmicky/human-signals)
|
||||
[](https://www.npmjs.com/package/human-signals)
|
||||
[](https://gitter.im/ehmicky/human-signals)
|
||||
[](https://twitter.com/intent/follow?screen_name=ehmicky)
|
||||
[](https://medium.com/@ehmicky)
|
||||
|
||||
Human-friendly process signals.
|
||||
|
||||
@@ -19,7 +20,7 @@ this includes:
|
||||
# Example
|
||||
|
||||
```js
|
||||
import { signalsByName, signalsByNumber } from 'human-signals'
|
||||
const { signalsByName, signalsByNumber } = require('human-signals')
|
||||
|
||||
console.log(signalsByName.SIGINT)
|
||||
// {
|
||||
@@ -50,11 +51,6 @@ console.log(signalsByNumber[8])
|
||||
npm install human-signals
|
||||
```
|
||||
|
||||
This package works in Node.js >=14.18.0. It is an ES module and must be loaded
|
||||
using
|
||||
[an `import` or `import()` statement](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c),
|
||||
not `require()`.
|
||||
|
||||
# Usage
|
||||
|
||||
## signalsByName
|
||||
@@ -105,7 +101,7 @@ Whether the current OS can handle this signal in Node.js using
|
||||
[`process.on(name, handler)`](https://nodejs.org/api/process.html#process_signal_events).
|
||||
|
||||
The list of supported signals
|
||||
[is OS-specific](https://github.com/ehmicky/cross-platform-node-guide/blob/main/docs/6_networking_ipc/signals.md#cross-platform-signals).
|
||||
[is OS-specific](https://github.com/ehmicky/cross-platform-node-guide/blob/master/docs/6_networking_ipc/signals.md#cross-platform-signals).
|
||||
|
||||
### action
|
||||
|
||||
@@ -130,7 +126,11 @@ Which standard defined that signal.
|
||||
|
||||
# Support
|
||||
|
||||
For any question, _don't hesitate_ to [submit an issue on GitHub](../../issues).
|
||||
If you found a bug or would like a new feature, _don't hesitate_ to
|
||||
[submit an issue on GitHub](../../issues).
|
||||
|
||||
For other questions, feel free to
|
||||
[chat with us on Gitter](https://gitter.im/ehmicky/human-signals).
|
||||
|
||||
Everyone is welcome regardless of personal background. We enforce a
|
||||
[Code of conduct](CODE_OF_CONDUCT.md) in order to promote a positive and
|
||||
|
||||
6
node_modules/human-signals/build/src/core.js
generated
vendored
6
node_modules/human-signals/build/src/core.js
generated
vendored
@@ -1,6 +1,6 @@
|
||||
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.SIGNALS=void 0;
|
||||
|
||||
|
||||
export const SIGNALS=[
|
||||
const SIGNALS=[
|
||||
{
|
||||
name:"SIGHUP",
|
||||
number:1,
|
||||
@@ -269,5 +269,5 @@ name:"SIGUNUSED",
|
||||
number:31,
|
||||
action:"terminate",
|
||||
description:"Invalid system call",
|
||||
standard:"other"}];
|
||||
standard:"other"}];exports.SIGNALS=SIGNALS;
|
||||
//# sourceMappingURL=core.js.map
|
||||
1
node_modules/human-signals/build/src/core.js.map
generated
vendored
Normal file
1
node_modules/human-signals/build/src/core.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
52
node_modules/human-signals/build/src/main.d.ts
generated
vendored
Normal file
52
node_modules/human-signals/build/src/main.d.ts
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* Object whose keys are signal names and values are signal objects.
|
||||
*/
|
||||
export declare const signalsByName: { [signalName: string]: Signal }
|
||||
/**
|
||||
* Object whose keys are signal numbers and values are signal objects.
|
||||
*/
|
||||
export declare const signalsByNumber: { [signalNumber: string]: Signal }
|
||||
|
||||
export declare type SignalAction =
|
||||
| 'terminate'
|
||||
| 'core'
|
||||
| 'ignore'
|
||||
| 'pause'
|
||||
| 'unpause'
|
||||
export declare type SignalStandard =
|
||||
| 'ansi'
|
||||
| 'posix'
|
||||
| 'bsd'
|
||||
| 'systemv'
|
||||
| 'other'
|
||||
|
||||
export declare type Signal = {
|
||||
/**
|
||||
* Standard name of the signal, for example 'SIGINT'.
|
||||
*/
|
||||
name: string
|
||||
/**
|
||||
* Code number of the signal, for example 2. While most number are cross-platform, some are different between different OS.
|
||||
*/
|
||||
number: number
|
||||
/**
|
||||
* Human-friendly description for the signal, for example 'User interruption with CTRL-C'.
|
||||
*/
|
||||
description: string
|
||||
/**
|
||||
* Whether the current OS can handle this signal in Node.js using process.on(name, handler). The list of supported signals is OS-specific.
|
||||
*/
|
||||
supported: boolean
|
||||
/**
|
||||
* What is the default action for this signal when it is not handled.
|
||||
*/
|
||||
action: SignalAction
|
||||
/**
|
||||
* Whether the signal's default action cannot be prevented. This is true for SIGTERM, SIGKILL and SIGSTOP.
|
||||
*/
|
||||
forced: boolean
|
||||
/**
|
||||
* Which standard defined that signal.
|
||||
*/
|
||||
standard: SignalStandard
|
||||
}
|
||||
39
node_modules/human-signals/build/src/main.js
generated
vendored
39
node_modules/human-signals/build/src/main.js
generated
vendored
@@ -1,38 +1,33 @@
|
||||
import{constants}from"node:os";
|
||||
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.signalsByNumber=exports.signalsByName=void 0;var _os=require("os");
|
||||
|
||||
import{SIGRTMAX}from"./realtime.js";
|
||||
import{getSignals}from"./signals.js";
|
||||
var _signals=require("./signals.js");
|
||||
var _realtime=require("./realtime.js");
|
||||
|
||||
|
||||
|
||||
const getSignalsByName=function(){
|
||||
const signals=getSignals();
|
||||
return Object.fromEntries(signals.map(getSignalByName));
|
||||
const signals=(0,_signals.getSignals)();
|
||||
return signals.reduce(getSignalByName,{});
|
||||
};
|
||||
|
||||
const getSignalByName=function({
|
||||
name,
|
||||
number,
|
||||
description,
|
||||
supported,
|
||||
action,
|
||||
forced,
|
||||
standard})
|
||||
const getSignalByName=function(
|
||||
signalByNameMemo,
|
||||
{name,number,description,supported,action,forced,standard})
|
||||
{
|
||||
return[
|
||||
name,
|
||||
{name,number,description,supported,action,forced,standard}];
|
||||
return{
|
||||
...signalByNameMemo,
|
||||
[name]:{name,number,description,supported,action,forced,standard}};
|
||||
|
||||
};
|
||||
|
||||
export const signalsByName=getSignalsByName();
|
||||
const signalsByName=getSignalsByName();exports.signalsByName=signalsByName;
|
||||
|
||||
|
||||
|
||||
|
||||
const getSignalsByNumber=function(){
|
||||
const signals=getSignals();
|
||||
const length=SIGRTMAX+1;
|
||||
const signals=(0,_signals.getSignals)();
|
||||
const length=_realtime.SIGRTMAX+1;
|
||||
const signalsA=Array.from({length},(value,number)=>
|
||||
getSignalByNumber(number,signals));
|
||||
|
||||
@@ -63,14 +58,14 @@ standard}};
|
||||
|
||||
|
||||
const findSignalByNumber=function(number,signals){
|
||||
const signal=signals.find(({name})=>constants.signals[name]===number);
|
||||
const signal=signals.find(({name})=>_os.constants.signals[name]===number);
|
||||
|
||||
if(signal!==undefined){
|
||||
return signal;
|
||||
}
|
||||
|
||||
return signals.find((signalA)=>signalA.number===number);
|
||||
return signals.find(signalA=>signalA.number===number);
|
||||
};
|
||||
|
||||
export const signalsByNumber=getSignalsByNumber();
|
||||
const signalsByNumber=getSignalsByNumber();exports.signalsByNumber=signalsByNumber;
|
||||
//# sourceMappingURL=main.js.map
|
||||
1
node_modules/human-signals/build/src/main.js.map
generated
vendored
Normal file
1
node_modules/human-signals/build/src/main.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/main.js"],"names":["getSignalsByName","signals","reduce","getSignalByName","signalByNameMemo","name","number","description","supported","action","forced","standard","signalsByName","getSignalsByNumber","length","SIGRTMAX","signalsA","Array","from","value","getSignalByNumber","Object","assign","signal","findSignalByNumber","undefined","find","constants","signalA","signalsByNumber"],"mappings":"2HAAA;;AAEA;AACA;;;;AAIA,KAAMA,CAAAA,gBAAgB,CAAG,UAAW;AAClC,KAAMC,CAAAA,OAAO,CAAG,yBAAhB;AACA,MAAOA,CAAAA,OAAO,CAACC,MAAR,CAAeC,eAAf,CAAgC,EAAhC,CAAP;AACD,CAHD;;AAKA,KAAMA,CAAAA,eAAe,CAAG;AACtBC,gBADsB;AAEtB,CAAEC,IAAF,CAAQC,MAAR,CAAgBC,WAAhB,CAA6BC,SAA7B,CAAwCC,MAAxC,CAAgDC,MAAhD,CAAwDC,QAAxD,CAFsB;AAGtB;AACA,MAAO;AACL,GAAGP,gBADE;AAEL,CAACC,IAAD,EAAQ,CAAEA,IAAF,CAAQC,MAAR,CAAgBC,WAAhB,CAA6BC,SAA7B,CAAwCC,MAAxC,CAAgDC,MAAhD,CAAwDC,QAAxD,CAFH,CAAP;;AAID,CARD;;AAUO,KAAMC,CAAAA,aAAa,CAAGZ,gBAAgB,EAAtC,C;;;;;AAKP,KAAMa,CAAAA,kBAAkB,CAAG,UAAW;AACpC,KAAMZ,CAAAA,OAAO,CAAG,yBAAhB;AACA,KAAMa,CAAAA,MAAM,CAAGC,mBAAW,CAA1B;AACA,KAAMC,CAAAA,QAAQ,CAAGC,KAAK,CAACC,IAAN,CAAW,CAAEJ,MAAF,CAAX,CAAuB,CAACK,KAAD,CAAQb,MAAR;AACtCc,iBAAiB,CAACd,MAAD,CAASL,OAAT,CADF,CAAjB;;AAGA,MAAOoB,CAAAA,MAAM,CAACC,MAAP,CAAc,EAAd,CAAkB,GAAGN,QAArB,CAAP;AACD,CAPD;;AASA,KAAMI,CAAAA,iBAAiB,CAAG,SAASd,MAAT,CAAiBL,OAAjB,CAA0B;AAClD,KAAMsB,CAAAA,MAAM,CAAGC,kBAAkB,CAAClB,MAAD,CAASL,OAAT,CAAjC;;AAEA,GAAIsB,MAAM,GAAKE,SAAf,CAA0B;AACxB,MAAO,EAAP;AACD;;AAED,KAAM,CAAEpB,IAAF,CAAQE,WAAR,CAAqBC,SAArB,CAAgCC,MAAhC,CAAwCC,MAAxC,CAAgDC,QAAhD,EAA6DY,MAAnE;AACA,MAAO;AACL,CAACjB,MAAD,EAAU;AACRD,IADQ;AAERC,MAFQ;AAGRC,WAHQ;AAIRC,SAJQ;AAKRC,MALQ;AAMRC,MANQ;AAORC,QAPQ,CADL,CAAP;;;AAWD,CAnBD;;;;AAuBA,KAAMa,CAAAA,kBAAkB,CAAG,SAASlB,MAAT,CAAiBL,OAAjB,CAA0B;AACnD,KAAMsB,CAAAA,MAAM,CAAGtB,OAAO,CAACyB,IAAR,CAAa,CAAC,CAAErB,IAAF,CAAD,GAAcsB,cAAU1B,OAAV,CAAkBI,IAAlB,IAA4BC,MAAvD,CAAf;;AAEA,GAAIiB,MAAM,GAAKE,SAAf,CAA0B;AACxB,MAAOF,CAAAA,MAAP;AACD;;AAED,MAAOtB,CAAAA,OAAO,CAACyB,IAAR,CAAaE,OAAO,EAAIA,OAAO,CAACtB,MAAR,GAAmBA,MAA3C,CAAP;AACD,CARD;;AAUO,KAAMuB,CAAAA,eAAe,CAAGhB,kBAAkB,EAA1C,C","sourcesContent":["import { constants } from 'os'\n\nimport { getSignals } from './signals.js'\nimport { SIGRTMAX } from './realtime.js'\n\n// Retrieve `signalsByName`, an object mapping signal name to signal properties.\n// We make sure the object is sorted by `number`.\nconst getSignalsByName = function() {\n const signals = getSignals()\n return signals.reduce(getSignalByName, {})\n}\n\nconst getSignalByName = function(\n signalByNameMemo,\n { name, number, description, supported, action, forced, standard },\n) {\n return {\n ...signalByNameMemo,\n [name]: { name, number, description, supported, action, forced, standard },\n }\n}\n\nexport const signalsByName = getSignalsByName()\n\n// Retrieve `signalsByNumber`, an object mapping signal number to signal\n// properties.\n// We make sure the object is sorted by `number`.\nconst getSignalsByNumber = function() {\n const signals = getSignals()\n const length = SIGRTMAX + 1\n const signalsA = Array.from({ length }, (value, number) =>\n getSignalByNumber(number, signals),\n )\n return Object.assign({}, ...signalsA)\n}\n\nconst getSignalByNumber = function(number, signals) {\n const signal = findSignalByNumber(number, signals)\n\n if (signal === undefined) {\n return {}\n }\n\n const { name, description, supported, action, forced, standard } = signal\n return {\n [number]: {\n name,\n number,\n description,\n supported,\n action,\n forced,\n standard,\n },\n }\n}\n\n// Several signals might end up sharing the same number because of OS-specific\n// numbers, in which case those prevail.\nconst findSignalByNumber = function(number, signals) {\n const signal = signals.find(({ name }) => constants.signals[name] === number)\n\n if (signal !== undefined) {\n return signal\n }\n\n return signals.find(signalA => signalA.number === number)\n}\n\nexport const signalsByNumber = getSignalsByNumber()\n"],"file":"src/main.js"}
|
||||
8
node_modules/human-signals/build/src/realtime.js
generated
vendored
8
node_modules/human-signals/build/src/realtime.js
generated
vendored
@@ -1,8 +1,8 @@
|
||||
|
||||
export const getRealtimeSignals=function(){
|
||||
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.SIGRTMAX=exports.getRealtimeSignals=void 0;
|
||||
const getRealtimeSignals=function(){
|
||||
const length=SIGRTMAX-SIGRTMIN+1;
|
||||
return Array.from({length},getRealtimeSignal);
|
||||
};
|
||||
};exports.getRealtimeSignals=getRealtimeSignals;
|
||||
|
||||
const getRealtimeSignal=function(value,index){
|
||||
return{
|
||||
@@ -15,5 +15,5 @@ standard:"posix"};
|
||||
};
|
||||
|
||||
const SIGRTMIN=34;
|
||||
export const SIGRTMAX=64;
|
||||
const SIGRTMAX=64;exports.SIGRTMAX=SIGRTMAX;
|
||||
//# sourceMappingURL=realtime.js.map
|
||||
1
node_modules/human-signals/build/src/realtime.js.map
generated
vendored
Normal file
1
node_modules/human-signals/build/src/realtime.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/realtime.js"],"names":["getRealtimeSignals","length","SIGRTMAX","SIGRTMIN","Array","from","getRealtimeSignal","value","index","name","number","action","description","standard"],"mappings":";AACO,KAAMA,CAAAA,kBAAkB,CAAG,UAAW;AAC3C,KAAMC,CAAAA,MAAM,CAAGC,QAAQ,CAAGC,QAAX,CAAsB,CAArC;AACA,MAAOC,CAAAA,KAAK,CAACC,IAAN,CAAW,CAAEJ,MAAF,CAAX,CAAuBK,iBAAvB,CAAP;AACD,CAHM,C;;AAKP,KAAMA,CAAAA,iBAAiB,CAAG,SAASC,KAAT,CAAgBC,KAAhB,CAAuB;AAC/C,MAAO;AACLC,IAAI,CAAG,QAAOD,KAAK,CAAG,CAAE,EADnB;AAELE,MAAM,CAAEP,QAAQ,CAAGK,KAFd;AAGLG,MAAM,CAAE,WAHH;AAILC,WAAW,CAAE,wCAJR;AAKLC,QAAQ,CAAE,OALL,CAAP;;AAOD,CARD;;AAUA,KAAMV,CAAAA,QAAQ,CAAG,EAAjB;AACO,KAAMD,CAAAA,QAAQ,CAAG,EAAjB,C","sourcesContent":["// List of realtime signals with information about them\nexport const getRealtimeSignals = function() {\n const length = SIGRTMAX - SIGRTMIN + 1\n return Array.from({ length }, getRealtimeSignal)\n}\n\nconst getRealtimeSignal = function(value, index) {\n return {\n name: `SIGRT${index + 1}`,\n number: SIGRTMIN + index,\n action: 'terminate',\n description: 'Application-specific signal (realtime)',\n standard: 'posix',\n }\n}\n\nconst SIGRTMIN = 34\nexport const SIGRTMAX = 64\n"],"file":"src/realtime.js"}
|
||||
16
node_modules/human-signals/build/src/signals.js
generated
vendored
16
node_modules/human-signals/build/src/signals.js
generated
vendored
@@ -1,15 +1,15 @@
|
||||
import{constants}from"node:os";
|
||||
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.getSignals=void 0;var _os=require("os");
|
||||
|
||||
import{SIGNALS}from"./core.js";
|
||||
import{getRealtimeSignals}from"./realtime.js";
|
||||
var _core=require("./core.js");
|
||||
var _realtime=require("./realtime.js");
|
||||
|
||||
|
||||
|
||||
export const getSignals=function(){
|
||||
const realtimeSignals=getRealtimeSignals();
|
||||
const signals=[...SIGNALS,...realtimeSignals].map(normalizeSignal);
|
||||
const getSignals=function(){
|
||||
const realtimeSignals=(0,_realtime.getRealtimeSignals)();
|
||||
const signals=[..._core.SIGNALS,...realtimeSignals].map(normalizeSignal);
|
||||
return signals;
|
||||
};
|
||||
};exports.getSignals=getSignals;
|
||||
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ standard})
|
||||
{
|
||||
const{
|
||||
signals:{[name]:constantSignal}}=
|
||||
constants;
|
||||
_os.constants;
|
||||
const supported=constantSignal!==undefined;
|
||||
const number=supported?constantSignal:defaultNumber;
|
||||
return{name,number,description,supported,action,forced,standard};
|
||||
|
||||
1
node_modules/human-signals/build/src/signals.js.map
generated
vendored
Normal file
1
node_modules/human-signals/build/src/signals.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/signals.js"],"names":["getSignals","realtimeSignals","signals","SIGNALS","map","normalizeSignal","name","number","defaultNumber","description","action","forced","standard","constantSignal","constants","supported","undefined"],"mappings":"gGAAA;;AAEA;AACA;;;;AAIO,KAAMA,CAAAA,UAAU,CAAG,UAAW;AACnC,KAAMC,CAAAA,eAAe,CAAG,kCAAxB;AACA,KAAMC,CAAAA,OAAO,CAAG,CAAC,GAAGC,aAAJ,CAAa,GAAGF,eAAhB,EAAiCG,GAAjC,CAAqCC,eAArC,CAAhB;AACA,MAAOH,CAAAA,OAAP;AACD,CAJM,C;;;;;;;;AAYP,KAAMG,CAAAA,eAAe,CAAG,SAAS;AAC/BC,IAD+B;AAE/BC,MAAM,CAAEC,aAFuB;AAG/BC,WAH+B;AAI/BC,MAJ+B;AAK/BC,MAAM,CAAG,KALsB;AAM/BC,QAN+B,CAAT;AAOrB;AACD,KAAM;AACJV,OAAO,CAAE,CAAE,CAACI,IAAD,EAAQO,cAAV,CADL;AAEFC,aAFJ;AAGA,KAAMC,CAAAA,SAAS,CAAGF,cAAc,GAAKG,SAArC;AACA,KAAMT,CAAAA,MAAM,CAAGQ,SAAS,CAAGF,cAAH,CAAoBL,aAA5C;AACA,MAAO,CAAEF,IAAF,CAAQC,MAAR,CAAgBE,WAAhB,CAA6BM,SAA7B,CAAwCL,MAAxC,CAAgDC,MAAhD,CAAwDC,QAAxD,CAAP;AACD,CAdD","sourcesContent":["import { constants } from 'os'\n\nimport { SIGNALS } from './core.js'\nimport { getRealtimeSignals } from './realtime.js'\n\n// Retrieve list of know signals (including realtime) with information about\n// them\nexport const getSignals = function() {\n const realtimeSignals = getRealtimeSignals()\n const signals = [...SIGNALS, ...realtimeSignals].map(normalizeSignal)\n return signals\n}\n\n// Normalize signal:\n// - `number`: signal numbers are OS-specific. This is taken into account by\n// `os.constants.signals`. However we provide a default `number` since some\n// signals are not defined for some OS.\n// - `forced`: set default to `false`\n// - `supported`: set value\nconst normalizeSignal = function({\n name,\n number: defaultNumber,\n description,\n action,\n forced = false,\n standard,\n}) {\n const {\n signals: { [name]: constantSignal },\n } = constants\n const supported = constantSignal !== undefined\n const number = supported ? constantSignal : defaultNumber\n return { name, number, description, supported, action, forced, standard }\n}\n"],"file":"src/signals.js"}
|
||||
73
node_modules/human-signals/build/types/main.d.ts
generated
vendored
73
node_modules/human-signals/build/types/main.d.ts
generated
vendored
@@ -1,73 +0,0 @@
|
||||
/**
|
||||
* What is the default action for this signal when it is not handled.
|
||||
*/
|
||||
export type SignalAction = 'terminate' | 'core' | 'ignore' | 'pause' | 'unpause'
|
||||
|
||||
/**
|
||||
* Which standard defined that signal.
|
||||
*/
|
||||
export type SignalStandard = 'ansi' | 'posix' | 'bsd' | 'systemv' | 'other'
|
||||
|
||||
/**
|
||||
* Standard name of the signal, for example 'SIGINT'.
|
||||
*/
|
||||
export type SignalName = `SIG${string}`
|
||||
|
||||
/**
|
||||
* Code number of the signal, for example 2.
|
||||
* While most number are cross-platform, some are different between different
|
||||
* OS.
|
||||
*/
|
||||
export type SignalNumber = number
|
||||
|
||||
export type Signal = {
|
||||
/**
|
||||
* Standard name of the signal, for example 'SIGINT'.
|
||||
*/
|
||||
name: SignalName
|
||||
|
||||
/**
|
||||
* Code number of the signal, for example 2.
|
||||
* While most number are cross-platform, some are different between different
|
||||
* OS.
|
||||
*/
|
||||
number: SignalNumber
|
||||
|
||||
/**
|
||||
* Human-friendly description for the signal, for example
|
||||
* 'User interruption with CTRL-C'.
|
||||
*/
|
||||
description: string
|
||||
|
||||
/**
|
||||
* Whether the current OS can handle this signal in Node.js using
|
||||
* `process.on(name, handler)`. The list of supported signals is OS-specific.
|
||||
*/
|
||||
supported: boolean
|
||||
|
||||
/**
|
||||
* What is the default action for this signal when it is not handled.
|
||||
*/
|
||||
action: SignalAction
|
||||
|
||||
/**
|
||||
* Whether the signal's default action cannot be prevented.
|
||||
* This is true for SIGTERM, SIGKILL and SIGSTOP.
|
||||
*/
|
||||
forced: boolean
|
||||
|
||||
/**
|
||||
* Which standard defined that signal.
|
||||
*/
|
||||
standard: SignalStandard
|
||||
}
|
||||
|
||||
/**
|
||||
* Object whose keys are signal names and values are signal objects.
|
||||
*/
|
||||
export declare const signalsByName: { [signalName: SignalName]: Signal }
|
||||
|
||||
/**
|
||||
* Object whose keys are signal numbers and values are signal objects.
|
||||
*/
|
||||
export declare const signalsByNumber: { [signalNumber: SignalNumber]: Signal }
|
||||
37
node_modules/human-signals/package.json
generated
vendored
37
node_modules/human-signals/package.json
generated
vendored
@@ -1,27 +1,26 @@
|
||||
{
|
||||
"name": "human-signals",
|
||||
"version": "4.3.0",
|
||||
"type": "module",
|
||||
"exports": {
|
||||
"types": "./build/types/main.d.ts",
|
||||
"default": "./build/src/main.js"
|
||||
},
|
||||
"main": "./build/src/main.js",
|
||||
"types": "./build/types/main.d.ts",
|
||||
"version": "2.1.0",
|
||||
"main": "build/src/main.js",
|
||||
"files": [
|
||||
"build/src/**/*.{js,json}",
|
||||
"build/types/**/*.d.ts"
|
||||
"build/src",
|
||||
"!~"
|
||||
],
|
||||
"sideEffects": false,
|
||||
"scripts": {
|
||||
"test": "gulp test"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-push": "gulp check --full"
|
||||
}
|
||||
},
|
||||
"description": "Human-friendly process signals",
|
||||
"keywords": [
|
||||
"signal",
|
||||
"signals",
|
||||
"handlers",
|
||||
"error-handling",
|
||||
"errors",
|
||||
"interrupts",
|
||||
"sigterm",
|
||||
"sigint",
|
||||
@@ -33,14 +32,13 @@
|
||||
"operating-system",
|
||||
"es6",
|
||||
"javascript",
|
||||
"typescript",
|
||||
"linux",
|
||||
"macos",
|
||||
"windows",
|
||||
"nodejs"
|
||||
],
|
||||
"license": "Apache-2.0",
|
||||
"homepage": "https://www.github.com/ehmicky/human-signals",
|
||||
"homepage": "https://git.io/JeluP",
|
||||
"repository": "ehmicky/human-signals",
|
||||
"bugs": {
|
||||
"url": "https://github.com/ehmicky/human-signals/issues"
|
||||
@@ -50,12 +48,17 @@
|
||||
"lib": "src",
|
||||
"test": "test"
|
||||
},
|
||||
"types": "build/src/main.d.ts",
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"@ehmicky/dev-tasks": "^1.0.102",
|
||||
"ajv": "^8.11.0",
|
||||
"test-each": "^5.5.0"
|
||||
"@ehmicky/dev-tasks": "^0.31.9",
|
||||
"ajv": "^6.12.0",
|
||||
"ava": "^3.5.0",
|
||||
"gulp": "^4.0.2",
|
||||
"husky": "^4.2.3",
|
||||
"test-each": "^2.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.18.0"
|
||||
"node": ">=10.17.0"
|
||||
}
|
||||
}
|
||||
|
||||
128
node_modules/is-stream/index.d.ts
generated
vendored
128
node_modules/is-stream/index.d.ts
generated
vendored
@@ -1,81 +1,79 @@
|
||||
import {
|
||||
Stream,
|
||||
Writable as WritableStream,
|
||||
Readable as ReadableStream,
|
||||
Duplex as DuplexStream,
|
||||
Transform as TransformStream,
|
||||
} from 'node:stream';
|
||||
import * as stream from 'stream';
|
||||
|
||||
/**
|
||||
@returns Whether `stream` is a [`Stream`](https://nodejs.org/api/stream.html#stream_stream).
|
||||
declare const isStream: {
|
||||
/**
|
||||
@returns Whether `stream` is a [`Stream`](https://nodejs.org/api/stream.html#stream_stream).
|
||||
|
||||
@example
|
||||
```
|
||||
import fs from 'node:fs';
|
||||
import {isStream} from 'is-stream';
|
||||
@example
|
||||
```
|
||||
import * as fs from 'fs';
|
||||
import isStream = require('is-stream');
|
||||
|
||||
isStream(fs.createReadStream('unicorn.png'));
|
||||
//=> true
|
||||
isStream(fs.createReadStream('unicorn.png'));
|
||||
//=> true
|
||||
|
||||
isStream({});
|
||||
//=> false
|
||||
```
|
||||
*/
|
||||
export function isStream(stream: unknown): stream is Stream;
|
||||
isStream({});
|
||||
//=> false
|
||||
```
|
||||
*/
|
||||
(stream: unknown): stream is stream.Stream;
|
||||
|
||||
/**
|
||||
@returns Whether `stream` is a [`stream.Writable`](https://nodejs.org/api/stream.html#stream_class_stream_writable).
|
||||
/**
|
||||
@returns Whether `stream` is a [`stream.Writable`](https://nodejs.org/api/stream.html#stream_class_stream_writable).
|
||||
|
||||
@example
|
||||
```
|
||||
import fs from 'node:fs';
|
||||
import {isWritableStream} from 'is-stream';
|
||||
@example
|
||||
```
|
||||
import * as fs from 'fs';
|
||||
import isStream = require('is-stream');
|
||||
|
||||
isWritableStream(fs.createWriteStrem('unicorn.txt'));
|
||||
//=> true
|
||||
```
|
||||
*/
|
||||
export function isWritableStream(stream: unknown): stream is WritableStream;
|
||||
isStream.writable(fs.createWriteStrem('unicorn.txt'));
|
||||
//=> true
|
||||
```
|
||||
*/
|
||||
writable(stream: unknown): stream is stream.Writable;
|
||||
|
||||
/**
|
||||
@returns Whether `stream` is a [`stream.Readable`](https://nodejs.org/api/stream.html#stream_class_stream_readable).
|
||||
/**
|
||||
@returns Whether `stream` is a [`stream.Readable`](https://nodejs.org/api/stream.html#stream_class_stream_readable).
|
||||
|
||||
@example
|
||||
```
|
||||
import fs from 'node:fs';
|
||||
import {isReadableStream} from 'is-stream';
|
||||
@example
|
||||
```
|
||||
import * as fs from 'fs';
|
||||
import isStream = require('is-stream');
|
||||
|
||||
isReadableStream(fs.createReadStream('unicorn.png'));
|
||||
//=> true
|
||||
```
|
||||
*/
|
||||
export function isReadableStream(stream: unknown): stream is ReadableStream;
|
||||
isStream.readable(fs.createReadStream('unicorn.png'));
|
||||
//=> true
|
||||
```
|
||||
*/
|
||||
readable(stream: unknown): stream is stream.Readable;
|
||||
|
||||
/**
|
||||
@returns Whether `stream` is a [`stream.Duplex`](https://nodejs.org/api/stream.html#stream_class_stream_duplex).
|
||||
/**
|
||||
@returns Whether `stream` is a [`stream.Duplex`](https://nodejs.org/api/stream.html#stream_class_stream_duplex).
|
||||
|
||||
@example
|
||||
```
|
||||
import {Duplex as DuplexStream} from 'node:stream';
|
||||
import {isDuplexStream} from 'is-stream';
|
||||
@example
|
||||
```
|
||||
import {Duplex} from 'stream';
|
||||
import isStream = require('is-stream');
|
||||
|
||||
isDuplexStream(new DuplexStream());
|
||||
//=> true
|
||||
```
|
||||
*/
|
||||
export function isDuplexStream(stream: unknown): stream is DuplexStream;
|
||||
isStream.duplex(new Duplex());
|
||||
//=> true
|
||||
```
|
||||
*/
|
||||
duplex(stream: unknown): stream is stream.Duplex;
|
||||
|
||||
/**
|
||||
@returns Whether `stream` is a [`stream.Transform`](https://nodejs.org/api/stream.html#stream_class_stream_transform).
|
||||
/**
|
||||
@returns Whether `stream` is a [`stream.Transform`](https://nodejs.org/api/stream.html#stream_class_stream_transform).
|
||||
|
||||
@example
|
||||
```
|
||||
import fs from 'node:fs';
|
||||
import StringifyStream from 'streaming-json-stringify';
|
||||
import {isTransformStream} from 'is-stream';
|
||||
@example
|
||||
```
|
||||
import * as fs from 'fs';
|
||||
import Stringify = require('streaming-json-stringify');
|
||||
import isStream = require('is-stream');
|
||||
|
||||
isTransformStream(StringifyStream());
|
||||
//=> true
|
||||
```
|
||||
*/
|
||||
export function isTransformStream(stream: unknown): stream is TransformStream;
|
||||
isStream.transform(Stringify());
|
||||
//=> true
|
||||
```
|
||||
*/
|
||||
transform(input: unknown): input is stream.Transform;
|
||||
};
|
||||
|
||||
export = isStream;
|
||||
|
||||
49
node_modules/is-stream/index.js
generated
vendored
49
node_modules/is-stream/index.js
generated
vendored
@@ -1,29 +1,28 @@
|
||||
export function isStream(stream) {
|
||||
return stream !== null
|
||||
&& typeof stream === 'object'
|
||||
&& typeof stream.pipe === 'function';
|
||||
}
|
||||
'use strict';
|
||||
|
||||
export function isWritableStream(stream) {
|
||||
return isStream(stream)
|
||||
&& stream.writable !== false
|
||||
&& typeof stream._write === 'function'
|
||||
&& typeof stream._writableState === 'object';
|
||||
}
|
||||
const isStream = stream =>
|
||||
stream !== null &&
|
||||
typeof stream === 'object' &&
|
||||
typeof stream.pipe === 'function';
|
||||
|
||||
export function isReadableStream(stream) {
|
||||
return isStream(stream)
|
||||
&& stream.readable !== false
|
||||
&& typeof stream._read === 'function'
|
||||
&& typeof stream._readableState === 'object';
|
||||
}
|
||||
isStream.writable = stream =>
|
||||
isStream(stream) &&
|
||||
stream.writable !== false &&
|
||||
typeof stream._write === 'function' &&
|
||||
typeof stream._writableState === 'object';
|
||||
|
||||
export function isDuplexStream(stream) {
|
||||
return isWritableStream(stream)
|
||||
&& isReadableStream(stream);
|
||||
}
|
||||
isStream.readable = stream =>
|
||||
isStream(stream) &&
|
||||
stream.readable !== false &&
|
||||
typeof stream._read === 'function' &&
|
||||
typeof stream._readableState === 'object';
|
||||
|
||||
export function isTransformStream(stream) {
|
||||
return isDuplexStream(stream)
|
||||
&& typeof stream._transform === 'function';
|
||||
}
|
||||
isStream.duplex = stream =>
|
||||
isStream.writable(stream) &&
|
||||
isStream.readable(stream);
|
||||
|
||||
isStream.transform = stream =>
|
||||
isStream.duplex(stream) &&
|
||||
typeof stream._transform === 'function';
|
||||
|
||||
module.exports = isStream;
|
||||
|
||||
16
node_modules/is-stream/package.json
generated
vendored
16
node_modules/is-stream/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "is-stream",
|
||||
"version": "3.0.0",
|
||||
"version": "2.0.1",
|
||||
"description": "Check if something is a Node.js stream",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/is-stream",
|
||||
@@ -10,10 +10,8 @@
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"type": "module",
|
||||
"exports": "./index.js",
|
||||
"engines": {
|
||||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
@@ -35,10 +33,10 @@
|
||||
"is"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@types/node": "^16.4.13",
|
||||
"ava": "^3.15.0",
|
||||
"tempy": "^1.0.1",
|
||||
"tsd": "^0.17.0",
|
||||
"xo": "^0.44.0"
|
||||
"@types/node": "^11.13.6",
|
||||
"ava": "^1.4.1",
|
||||
"tempy": "^0.3.0",
|
||||
"tsd": "^0.7.2",
|
||||
"xo": "^0.24.0"
|
||||
}
|
||||
}
|
||||
|
||||
12
node_modules/is-stream/readme.md
generated
vendored
12
node_modules/is-stream/readme.md
generated
vendored
@@ -11,8 +11,8 @@ $ npm install is-stream
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import fs from 'node:fs';
|
||||
import {isStream} from 'is-stream';
|
||||
const fs = require('fs');
|
||||
const isStream = require('is-stream');
|
||||
|
||||
isStream(fs.createReadStream('unicorn.png'));
|
||||
//=> true
|
||||
@@ -27,19 +27,19 @@ isStream({});
|
||||
|
||||
Returns a `boolean` for whether it's a [`Stream`](https://nodejs.org/api/stream.html#stream_stream).
|
||||
|
||||
#### isWritableStream(stream)
|
||||
#### isStream.writable(stream)
|
||||
|
||||
Returns a `boolean` for whether it's a [`stream.Writable`](https://nodejs.org/api/stream.html#stream_class_stream_writable).
|
||||
|
||||
#### isReadableStream(stream)
|
||||
#### isStream.readable(stream)
|
||||
|
||||
Returns a `boolean` for whether it's a [`stream.Readable`](https://nodejs.org/api/stream.html#stream_class_stream_readable).
|
||||
|
||||
#### isDuplexStream(stream)
|
||||
#### isStream.duplex(stream)
|
||||
|
||||
Returns a `boolean` for whether it's a [`stream.Duplex`](https://nodejs.org/api/stream.html#stream_class_stream_duplex).
|
||||
|
||||
#### isTransformStream(stream)
|
||||
#### isStream.transform(stream)
|
||||
|
||||
Returns a `boolean` for whether it's a [`stream.Transform`](https://nodejs.org/api/stream.html#stream_class_stream_transform).
|
||||
|
||||
|
||||
52
node_modules/mem/node_modules/mimic-fn/index.d.ts
generated
vendored
Normal file
52
node_modules/mem/node_modules/mimic-fn/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
export interface Options {
|
||||
/**
|
||||
Skip modifying [non-configurable properties](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor#Description) instead of throwing an error.
|
||||
|
||||
@default false
|
||||
*/
|
||||
readonly ignoreNonConfigurable?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
Modifies the `to` function to mimic the `from` function. Returns the `to` function.
|
||||
|
||||
`name`, `displayName`, and any other properties of `from` are copied. The `length` property is not copied. Prototype, class, and inherited properties are copied.
|
||||
|
||||
`to.toString()` will return the same as `from.toString()` but prepended with a `Wrapped with to()` comment.
|
||||
|
||||
@param to - Mimicking function.
|
||||
@param from - Function to mimic.
|
||||
@returns The modified `to` function.
|
||||
|
||||
@example
|
||||
```
|
||||
import mimicFunction from 'mimic-fn';
|
||||
|
||||
function foo() {}
|
||||
foo.unicorn = '🦄';
|
||||
|
||||
function wrapper() {
|
||||
return foo();
|
||||
}
|
||||
|
||||
console.log(wrapper.name);
|
||||
//=> 'wrapper'
|
||||
|
||||
mimicFunction(wrapper, foo);
|
||||
|
||||
console.log(wrapper.name);
|
||||
//=> 'foo'
|
||||
|
||||
console.log(wrapper.unicorn);
|
||||
//=> '🦄'
|
||||
```
|
||||
*/
|
||||
export default function mimicFunction<
|
||||
ArgumentsType extends unknown[],
|
||||
ReturnType,
|
||||
FunctionType extends (...arguments: ArgumentsType) => ReturnType
|
||||
>(
|
||||
to: (...arguments: ArgumentsType) => ReturnType,
|
||||
from: FunctionType,
|
||||
options?: Options,
|
||||
): FunctionType;
|
||||
71
node_modules/mem/node_modules/mimic-fn/index.js
generated
vendored
Normal file
71
node_modules/mem/node_modules/mimic-fn/index.js
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
const copyProperty = (to, from, property, ignoreNonConfigurable) => {
|
||||
// `Function#length` should reflect the parameters of `to` not `from` since we keep its body.
|
||||
// `Function#prototype` is non-writable and non-configurable so can never be modified.
|
||||
if (property === 'length' || property === 'prototype') {
|
||||
return;
|
||||
}
|
||||
|
||||
// `Function#arguments` and `Function#caller` should not be copied. They were reported to be present in `Reflect.ownKeys` for some devices in React Native (#41), so we explicitly ignore them here.
|
||||
if (property === 'arguments' || property === 'caller') {
|
||||
return;
|
||||
}
|
||||
|
||||
const toDescriptor = Object.getOwnPropertyDescriptor(to, property);
|
||||
const fromDescriptor = Object.getOwnPropertyDescriptor(from, property);
|
||||
|
||||
if (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {
|
||||
return;
|
||||
}
|
||||
|
||||
Object.defineProperty(to, property, fromDescriptor);
|
||||
};
|
||||
|
||||
// `Object.defineProperty()` throws if the property exists, is not configurable and either:
|
||||
// - one its descriptors is changed
|
||||
// - it is non-writable and its value is changed
|
||||
const canCopyProperty = function (toDescriptor, fromDescriptor) {
|
||||
return toDescriptor === undefined || toDescriptor.configurable || (
|
||||
toDescriptor.writable === fromDescriptor.writable &&
|
||||
toDescriptor.enumerable === fromDescriptor.enumerable &&
|
||||
toDescriptor.configurable === fromDescriptor.configurable &&
|
||||
(toDescriptor.writable || toDescriptor.value === fromDescriptor.value)
|
||||
);
|
||||
};
|
||||
|
||||
const changePrototype = (to, from) => {
|
||||
const fromPrototype = Object.getPrototypeOf(from);
|
||||
if (fromPrototype === Object.getPrototypeOf(to)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Object.setPrototypeOf(to, fromPrototype);
|
||||
};
|
||||
|
||||
const wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/\n${fromBody}`;
|
||||
|
||||
const toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, 'toString');
|
||||
const toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, 'name');
|
||||
|
||||
// We call `from.toString()` early (not lazily) to ensure `from` can be garbage collected.
|
||||
// We use `bind()` instead of a closure for the same reason.
|
||||
// Calling `from.toString()` early also allows caching it in case `to.toString()` is called several times.
|
||||
const changeToString = (to, from, name) => {
|
||||
const withName = name === '' ? '' : `with ${name.trim()}() `;
|
||||
const newToString = wrappedToString.bind(null, withName, from.toString());
|
||||
// Ensure `to.toString.toString` is non-enumerable and has the same `same`
|
||||
Object.defineProperty(newToString, 'name', toStringName);
|
||||
Object.defineProperty(to, 'toString', {...toStringDescriptor, value: newToString});
|
||||
};
|
||||
|
||||
export default function mimicFunction(to, from, {ignoreNonConfigurable = false} = {}) {
|
||||
const {name} = to;
|
||||
|
||||
for (const property of Reflect.ownKeys(from)) {
|
||||
copyProperty(to, from, property, ignoreNonConfigurable);
|
||||
}
|
||||
|
||||
changePrototype(to, from);
|
||||
changeToString(to, from, name);
|
||||
|
||||
return to;
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"name": "path-key",
|
||||
"name": "mimic-fn",
|
||||
"version": "4.0.0",
|
||||
"description": "Get the PATH environment variable key cross-platform",
|
||||
"description": "Make a function mimic another one",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/path-key",
|
||||
"repository": "sindresorhus/mimic-fn",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
@@ -23,17 +23,21 @@
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"path",
|
||||
"key",
|
||||
"environment",
|
||||
"env",
|
||||
"variable",
|
||||
"get",
|
||||
"cross-platform",
|
||||
"windows"
|
||||
"function",
|
||||
"mimic",
|
||||
"imitate",
|
||||
"rename",
|
||||
"copy",
|
||||
"inherit",
|
||||
"properties",
|
||||
"name",
|
||||
"func",
|
||||
"fn",
|
||||
"set",
|
||||
"infer",
|
||||
"change"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@types/node": "^14.14.37",
|
||||
"ava": "^3.15.0",
|
||||
"tsd": "^0.14.0",
|
||||
"xo": "^0.38.2"
|
||||
90
node_modules/mem/node_modules/mimic-fn/readme.md
generated
vendored
Normal file
90
node_modules/mem/node_modules/mimic-fn/readme.md
generated
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
<img src="media/logo.svg" alt="mimic-fn" width="400">
|
||||
<br>
|
||||
|
||||
> Make a function mimic another one
|
||||
|
||||
Useful when you wrap a function in another function and like to preserve the original name and other properties.
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install mimic-fn
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import mimicFunction from 'mimic-fn';
|
||||
|
||||
function foo() {}
|
||||
foo.unicorn = '🦄';
|
||||
|
||||
function wrapper() {
|
||||
return foo();
|
||||
}
|
||||
|
||||
console.log(wrapper.name);
|
||||
//=> 'wrapper'
|
||||
|
||||
mimicFunction(wrapper, foo);
|
||||
|
||||
console.log(wrapper.name);
|
||||
//=> 'foo'
|
||||
|
||||
console.log(wrapper.unicorn);
|
||||
//=> '🦄'
|
||||
|
||||
console.log(String(wrapper));
|
||||
//=> '/* Wrapped with wrapper() */\nfunction foo() {}'
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### mimicFunction(to, from, options?)
|
||||
|
||||
Modifies the `to` function to mimic the `from` function. Returns the `to` function.
|
||||
|
||||
`name`, `displayName`, and any other properties of `from` are copied. The `length` property is not copied. Prototype, class, and inherited properties are copied.
|
||||
|
||||
`to.toString()` will return the same as `from.toString()` but prepended with a `Wrapped with to()` comment.
|
||||
|
||||
#### to
|
||||
|
||||
Type: `Function`
|
||||
|
||||
Mimicking function.
|
||||
|
||||
#### from
|
||||
|
||||
Type: `Function`
|
||||
|
||||
Function to mimic.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
##### ignoreNonConfigurable
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `false`
|
||||
|
||||
Skip modifying [non-configurable properties](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor#Description) instead of throwing an error.
|
||||
|
||||
## Related
|
||||
|
||||
- [rename-fn](https://github.com/sindresorhus/rename-fn) - Rename a function
|
||||
- [keep-func-props](https://github.com/ehmicky/keep-func-props) - Wrap a function without changing its name and other properties
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-mimic-fn?utm_source=npm-mimic-fn&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
||||
96
node_modules/mimic-fn/index.d.ts
generated
vendored
96
node_modules/mimic-fn/index.d.ts
generated
vendored
@@ -1,52 +1,54 @@
|
||||
export interface Options {
|
||||
declare const mimicFn: {
|
||||
/**
|
||||
Skip modifying [non-configurable properties](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor#Description) instead of throwing an error.
|
||||
Make a function mimic another one. It will copy over the properties `name`, `length`, `displayName`, and any custom properties you may have set.
|
||||
|
||||
@default false
|
||||
@param to - Mimicking function.
|
||||
@param from - Function to mimic.
|
||||
@returns The modified `to` function.
|
||||
|
||||
@example
|
||||
```
|
||||
import mimicFn = require('mimic-fn');
|
||||
|
||||
function foo() {}
|
||||
foo.unicorn = '🦄';
|
||||
|
||||
function wrapper() {
|
||||
return foo();
|
||||
}
|
||||
|
||||
console.log(wrapper.name);
|
||||
//=> 'wrapper'
|
||||
|
||||
mimicFn(wrapper, foo);
|
||||
|
||||
console.log(wrapper.name);
|
||||
//=> 'foo'
|
||||
|
||||
console.log(wrapper.unicorn);
|
||||
//=> '🦄'
|
||||
```
|
||||
*/
|
||||
readonly ignoreNonConfigurable?: boolean;
|
||||
}
|
||||
<
|
||||
ArgumentsType extends unknown[],
|
||||
ReturnType,
|
||||
FunctionType extends (...arguments: ArgumentsType) => ReturnType
|
||||
>(
|
||||
to: (...arguments: ArgumentsType) => ReturnType,
|
||||
from: FunctionType
|
||||
): FunctionType;
|
||||
|
||||
/**
|
||||
Modifies the `to` function to mimic the `from` function. Returns the `to` function.
|
||||
// TODO: Remove this for the next major release, refactor the whole definition to:
|
||||
// declare function mimicFn<
|
||||
// ArgumentsType extends unknown[],
|
||||
// ReturnType,
|
||||
// FunctionType extends (...arguments: ArgumentsType) => ReturnType
|
||||
// >(
|
||||
// to: (...arguments: ArgumentsType) => ReturnType,
|
||||
// from: FunctionType
|
||||
// ): FunctionType;
|
||||
// export = mimicFn;
|
||||
default: typeof mimicFn;
|
||||
};
|
||||
|
||||
`name`, `displayName`, and any other properties of `from` are copied. The `length` property is not copied. Prototype, class, and inherited properties are copied.
|
||||
|
||||
`to.toString()` will return the same as `from.toString()` but prepended with a `Wrapped with to()` comment.
|
||||
|
||||
@param to - Mimicking function.
|
||||
@param from - Function to mimic.
|
||||
@returns The modified `to` function.
|
||||
|
||||
@example
|
||||
```
|
||||
import mimicFunction from 'mimic-fn';
|
||||
|
||||
function foo() {}
|
||||
foo.unicorn = '🦄';
|
||||
|
||||
function wrapper() {
|
||||
return foo();
|
||||
}
|
||||
|
||||
console.log(wrapper.name);
|
||||
//=> 'wrapper'
|
||||
|
||||
mimicFunction(wrapper, foo);
|
||||
|
||||
console.log(wrapper.name);
|
||||
//=> 'foo'
|
||||
|
||||
console.log(wrapper.unicorn);
|
||||
//=> '🦄'
|
||||
```
|
||||
*/
|
||||
export default function mimicFunction<
|
||||
ArgumentsType extends unknown[],
|
||||
ReturnType,
|
||||
FunctionType extends (...arguments: ArgumentsType) => ReturnType
|
||||
>(
|
||||
to: (...arguments: ArgumentsType) => ReturnType,
|
||||
from: FunctionType,
|
||||
options?: Options,
|
||||
): FunctionType;
|
||||
export = mimicFn;
|
||||
|
||||
78
node_modules/mimic-fn/index.js
generated
vendored
78
node_modules/mimic-fn/index.js
generated
vendored
@@ -1,71 +1,13 @@
|
||||
const copyProperty = (to, from, property, ignoreNonConfigurable) => {
|
||||
// `Function#length` should reflect the parameters of `to` not `from` since we keep its body.
|
||||
// `Function#prototype` is non-writable and non-configurable so can never be modified.
|
||||
if (property === 'length' || property === 'prototype') {
|
||||
return;
|
||||
'use strict';
|
||||
|
||||
const mimicFn = (to, from) => {
|
||||
for (const prop of Reflect.ownKeys(from)) {
|
||||
Object.defineProperty(to, prop, Object.getOwnPropertyDescriptor(from, prop));
|
||||
}
|
||||
|
||||
// `Function#arguments` and `Function#caller` should not be copied. They were reported to be present in `Reflect.ownKeys` for some devices in React Native (#41), so we explicitly ignore them here.
|
||||
if (property === 'arguments' || property === 'caller') {
|
||||
return;
|
||||
}
|
||||
|
||||
const toDescriptor = Object.getOwnPropertyDescriptor(to, property);
|
||||
const fromDescriptor = Object.getOwnPropertyDescriptor(from, property);
|
||||
|
||||
if (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {
|
||||
return;
|
||||
}
|
||||
|
||||
Object.defineProperty(to, property, fromDescriptor);
|
||||
};
|
||||
|
||||
// `Object.defineProperty()` throws if the property exists, is not configurable and either:
|
||||
// - one its descriptors is changed
|
||||
// - it is non-writable and its value is changed
|
||||
const canCopyProperty = function (toDescriptor, fromDescriptor) {
|
||||
return toDescriptor === undefined || toDescriptor.configurable || (
|
||||
toDescriptor.writable === fromDescriptor.writable &&
|
||||
toDescriptor.enumerable === fromDescriptor.enumerable &&
|
||||
toDescriptor.configurable === fromDescriptor.configurable &&
|
||||
(toDescriptor.writable || toDescriptor.value === fromDescriptor.value)
|
||||
);
|
||||
};
|
||||
|
||||
const changePrototype = (to, from) => {
|
||||
const fromPrototype = Object.getPrototypeOf(from);
|
||||
if (fromPrototype === Object.getPrototypeOf(to)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Object.setPrototypeOf(to, fromPrototype);
|
||||
};
|
||||
|
||||
const wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/\n${fromBody}`;
|
||||
|
||||
const toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, 'toString');
|
||||
const toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, 'name');
|
||||
|
||||
// We call `from.toString()` early (not lazily) to ensure `from` can be garbage collected.
|
||||
// We use `bind()` instead of a closure for the same reason.
|
||||
// Calling `from.toString()` early also allows caching it in case `to.toString()` is called several times.
|
||||
const changeToString = (to, from, name) => {
|
||||
const withName = name === '' ? '' : `with ${name.trim()}() `;
|
||||
const newToString = wrappedToString.bind(null, withName, from.toString());
|
||||
// Ensure `to.toString.toString` is non-enumerable and has the same `same`
|
||||
Object.defineProperty(newToString, 'name', toStringName);
|
||||
Object.defineProperty(to, 'toString', {...toStringDescriptor, value: newToString});
|
||||
};
|
||||
|
||||
export default function mimicFunction(to, from, {ignoreNonConfigurable = false} = {}) {
|
||||
const {name} = to;
|
||||
|
||||
for (const property of Reflect.ownKeys(from)) {
|
||||
copyProperty(to, from, property, ignoreNonConfigurable);
|
||||
}
|
||||
|
||||
changePrototype(to, from);
|
||||
changeToString(to, from, name);
|
||||
|
||||
return to;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = mimicFn;
|
||||
// TODO: Remove this for the next major release
|
||||
module.exports.default = mimicFn;
|
||||
|
||||
2
node_modules/mimic-fn/license
generated
vendored
2
node_modules/mimic-fn/license
generated
vendored
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
|
||||
15
node_modules/mimic-fn/package.json
generated
vendored
15
node_modules/mimic-fn/package.json
generated
vendored
@@ -1,19 +1,16 @@
|
||||
{
|
||||
"name": "mimic-fn",
|
||||
"version": "4.0.0",
|
||||
"version": "2.1.0",
|
||||
"description": "Make a function mimic another one",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/mimic-fn",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"type": "module",
|
||||
"exports": "./index.js",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
"node": ">=6"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
@@ -38,8 +35,8 @@
|
||||
"change"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "^3.15.0",
|
||||
"tsd": "^0.14.0",
|
||||
"xo": "^0.38.2"
|
||||
"ava": "^1.4.1",
|
||||
"tsd": "^0.7.1",
|
||||
"xo": "^0.24.0"
|
||||
}
|
||||
}
|
||||
|
||||
45
node_modules/mimic-fn/readme.md
generated
vendored
45
node_modules/mimic-fn/readme.md
generated
vendored
@@ -1,20 +1,21 @@
|
||||
<img src="media/logo.svg" alt="mimic-fn" width="400">
|
||||
<br>
|
||||
# mimic-fn [](https://travis-ci.org/sindresorhus/mimic-fn)
|
||||
|
||||
> Make a function mimic another one
|
||||
|
||||
Useful when you wrap a function in another function and like to preserve the original name and other properties.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install mimic-fn
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import mimicFunction from 'mimic-fn';
|
||||
const mimicFn = require('mimic-fn');
|
||||
|
||||
function foo() {}
|
||||
foo.unicorn = '🦄';
|
||||
@@ -26,28 +27,23 @@ function wrapper() {
|
||||
console.log(wrapper.name);
|
||||
//=> 'wrapper'
|
||||
|
||||
mimicFunction(wrapper, foo);
|
||||
mimicFn(wrapper, foo);
|
||||
|
||||
console.log(wrapper.name);
|
||||
//=> 'foo'
|
||||
|
||||
console.log(wrapper.unicorn);
|
||||
//=> '🦄'
|
||||
|
||||
console.log(String(wrapper));
|
||||
//=> '/* Wrapped with wrapper() */\nfunction foo() {}'
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### mimicFunction(to, from, options?)
|
||||
It will copy over the properties `name`, `length`, `displayName`, and any custom properties you may have set.
|
||||
|
||||
Modifies the `to` function to mimic the `from` function. Returns the `to` function.
|
||||
### mimicFn(to, from)
|
||||
|
||||
`name`, `displayName`, and any other properties of `from` are copied. The `length` property is not copied. Prototype, class, and inherited properties are copied.
|
||||
|
||||
`to.toString()` will return the same as `from.toString()` but prepended with a `Wrapped with to()` comment.
|
||||
Modifies the `to` function and returns it.
|
||||
|
||||
#### to
|
||||
|
||||
@@ -61,30 +57,13 @@ Type: `Function`
|
||||
|
||||
Function to mimic.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
##### ignoreNonConfigurable
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `false`
|
||||
|
||||
Skip modifying [non-configurable properties](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor#Description) instead of throwing an error.
|
||||
|
||||
## Related
|
||||
|
||||
- [rename-fn](https://github.com/sindresorhus/rename-fn) - Rename a function
|
||||
- [keep-func-props](https://github.com/ehmicky/keep-func-props) - Wrap a function without changing its name and other properties
|
||||
- [keep-func-props](https://github.com/ehmicky/keep-func-props) - Wrap a function without changing its name, length and other properties
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-mimic-fn?utm_source=npm-mimic-fn&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
|
||||
141
node_modules/npm-run-path/index.d.ts
generated
vendored
141
node_modules/npm-run-path/index.d.ts
generated
vendored
@@ -1,84 +1,89 @@
|
||||
export interface RunPathOptions {
|
||||
/**
|
||||
Working directory.
|
||||
declare namespace npmRunPath {
|
||||
interface RunPathOptions {
|
||||
/**
|
||||
Working directory.
|
||||
|
||||
@default process.cwd()
|
||||
*/
|
||||
readonly cwd?: string | URL;
|
||||
@default process.cwd()
|
||||
*/
|
||||
readonly cwd?: string;
|
||||
|
||||
/**
|
||||
PATH to be appended. Default: [`PATH`](https://github.com/sindresorhus/path-key).
|
||||
/**
|
||||
PATH to be appended. Default: [`PATH`](https://github.com/sindresorhus/path-key).
|
||||
|
||||
Set it to an empty string to exclude the default PATH.
|
||||
*/
|
||||
readonly path?: string;
|
||||
Set it to an empty string to exclude the default PATH.
|
||||
*/
|
||||
readonly path?: string;
|
||||
|
||||
/**
|
||||
Path to the Node.js executable to use in child processes if that is different from the current one. Its directory is pushed to the front of PATH.
|
||||
/**
|
||||
Path to the Node.js executable to use in child processes if that is different from the current one. Its directory is pushed to the front of PATH.
|
||||
|
||||
This can be either an absolute path or a path relative to the `cwd` option.
|
||||
This can be either an absolute path or a path relative to the `cwd` option.
|
||||
|
||||
@default process.execPath
|
||||
*/
|
||||
readonly execPath?: string;
|
||||
@default process.execPath
|
||||
*/
|
||||
readonly execPath?: string;
|
||||
}
|
||||
|
||||
interface ProcessEnv {
|
||||
[key: string]: string | undefined;
|
||||
}
|
||||
|
||||
interface EnvOptions {
|
||||
/**
|
||||
Working directory.
|
||||
|
||||
@default process.cwd()
|
||||
*/
|
||||
readonly cwd?: string;
|
||||
|
||||
/**
|
||||
Accepts an object of environment variables, like `process.env`, and modifies the PATH using the correct [PATH key](https://github.com/sindresorhus/path-key). Use this if you're modifying the PATH for use in the `child_process` options.
|
||||
*/
|
||||
readonly env?: ProcessEnv;
|
||||
|
||||
/**
|
||||
Path to the current Node.js executable. Its directory is pushed to the front of PATH.
|
||||
|
||||
This can be either an absolute path or a path relative to the `cwd` option.
|
||||
|
||||
@default process.execPath
|
||||
*/
|
||||
readonly execPath?: string;
|
||||
}
|
||||
}
|
||||
|
||||
export type ProcessEnv = Record<string, string | undefined>;
|
||||
|
||||
export interface EnvOptions {
|
||||
declare const npmRunPath: {
|
||||
/**
|
||||
The working directory.
|
||||
Get your [PATH](https://en.wikipedia.org/wiki/PATH_(variable)) prepended with locally installed binaries.
|
||||
|
||||
@default process.cwd()
|
||||
@returns The augmented path string.
|
||||
|
||||
@example
|
||||
```
|
||||
import * as childProcess from 'child_process';
|
||||
import npmRunPath = require('npm-run-path');
|
||||
|
||||
console.log(process.env.PATH);
|
||||
//=> '/usr/local/bin'
|
||||
|
||||
console.log(npmRunPath());
|
||||
//=> '/Users/sindresorhus/dev/foo/node_modules/.bin:/Users/sindresorhus/dev/node_modules/.bin:/Users/sindresorhus/node_modules/.bin:/Users/node_modules/.bin:/node_modules/.bin:/usr/local/bin'
|
||||
|
||||
// `foo` is a locally installed binary
|
||||
childProcess.execFileSync('foo', {
|
||||
env: npmRunPath.env()
|
||||
});
|
||||
```
|
||||
*/
|
||||
readonly cwd?: string | URL;
|
||||
(options?: npmRunPath.RunPathOptions): string;
|
||||
|
||||
/**
|
||||
Accepts an object of environment variables, like `process.env`, and modifies the PATH using the correct [PATH key](https://github.com/sindresorhus/path-key). Use this if you're modifying the PATH for use in the `child_process` options.
|
||||
@returns The augmented [`process.env`](https://nodejs.org/api/process.html#process_process_env) object.
|
||||
*/
|
||||
readonly env?: ProcessEnv;
|
||||
env(options?: npmRunPath.EnvOptions): npmRunPath.ProcessEnv;
|
||||
|
||||
/**
|
||||
The path to the current Node.js executable. Its directory is pushed to the front of PATH.
|
||||
// TODO: Remove this for the next major release
|
||||
default: typeof npmRunPath;
|
||||
};
|
||||
|
||||
This can be either an absolute path or a path relative to the `cwd` option.
|
||||
|
||||
@default process.execPath
|
||||
*/
|
||||
readonly execPath?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
Get your [PATH](https://en.wikipedia.org/wiki/PATH_(variable)) prepended with locally installed binaries.
|
||||
|
||||
@returns The augmented path string.
|
||||
|
||||
@example
|
||||
```
|
||||
import childProcess from 'node:child_process';
|
||||
import {npmRunPath} from 'npm-run-path';
|
||||
|
||||
console.log(process.env.PATH);
|
||||
//=> '/usr/local/bin'
|
||||
|
||||
console.log(npmRunPath());
|
||||
//=> '/Users/sindresorhus/dev/foo/node_modules/.bin:/Users/sindresorhus/dev/node_modules/.bin:/Users/sindresorhus/node_modules/.bin:/Users/node_modules/.bin:/node_modules/.bin:/usr/local/bin'
|
||||
```
|
||||
*/
|
||||
export function npmRunPath(options?: RunPathOptions): string;
|
||||
|
||||
/**
|
||||
@returns The augmented [`process.env`](https://nodejs.org/api/process.html#process_process_env) object.
|
||||
|
||||
@example
|
||||
```
|
||||
import childProcess from 'node:child_process';
|
||||
import {npmRunPathEnv} from 'npm-run-path';
|
||||
|
||||
// `foo` is a locally installed binary
|
||||
childProcess.execFileSync('foo', {
|
||||
env: npmRunPathEnv()
|
||||
});
|
||||
```
|
||||
*/
|
||||
export function npmRunPathEnv(options?: EnvOptions): ProcessEnv;
|
||||
export = npmRunPath;
|
||||
|
||||
49
node_modules/npm-run-path/index.js
generated
vendored
49
node_modules/npm-run-path/index.js
generated
vendored
@@ -1,18 +1,17 @@
|
||||
import process from 'node:process';
|
||||
import path from 'node:path';
|
||||
import url from 'node:url';
|
||||
import pathKey from 'path-key';
|
||||
'use strict';
|
||||
const path = require('path');
|
||||
const pathKey = require('path-key');
|
||||
|
||||
export function npmRunPath(options = {}) {
|
||||
const {
|
||||
cwd = process.cwd(),
|
||||
path: path_ = process.env[pathKey()],
|
||||
execPath = process.execPath,
|
||||
} = options;
|
||||
const npmRunPath = options => {
|
||||
options = {
|
||||
cwd: process.cwd(),
|
||||
path: process.env[pathKey()],
|
||||
execPath: process.execPath,
|
||||
...options
|
||||
};
|
||||
|
||||
let previous;
|
||||
const cwdString = cwd instanceof URL ? url.fileURLToPath(cwd) : cwd;
|
||||
let cwdPath = path.resolve(cwdString);
|
||||
let cwdPath = path.resolve(options.cwd);
|
||||
const result = [];
|
||||
|
||||
while (previous !== cwdPath) {
|
||||
@@ -21,18 +20,28 @@ export function npmRunPath(options = {}) {
|
||||
cwdPath = path.resolve(cwdPath, '..');
|
||||
}
|
||||
|
||||
// Ensure the running `node` binary is used.
|
||||
result.push(path.resolve(cwdString, execPath, '..'));
|
||||
// Ensure the running `node` binary is used
|
||||
const execPathDir = path.resolve(options.cwd, options.execPath, '..');
|
||||
result.push(execPathDir);
|
||||
|
||||
return [...result, path_].join(path.delimiter);
|
||||
}
|
||||
return result.concat(options.path).join(path.delimiter);
|
||||
};
|
||||
|
||||
export function npmRunPathEnv({env = process.env, ...options} = {}) {
|
||||
env = {...env};
|
||||
module.exports = npmRunPath;
|
||||
// TODO: Remove this for the next major release
|
||||
module.exports.default = npmRunPath;
|
||||
|
||||
module.exports.env = options => {
|
||||
options = {
|
||||
env: process.env,
|
||||
...options
|
||||
};
|
||||
|
||||
const env = {...options.env};
|
||||
const path = pathKey({env});
|
||||
|
||||
options.path = env[path];
|
||||
env[path] = npmRunPath(options);
|
||||
env[path] = module.exports(options);
|
||||
|
||||
return env;
|
||||
}
|
||||
};
|
||||
|
||||
2
node_modules/npm-run-path/license
generated
vendored
2
node_modules/npm-run-path/license
generated
vendored
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
|
||||
31
node_modules/npm-run-path/node_modules/path-key/index.d.ts
generated
vendored
31
node_modules/npm-run-path/node_modules/path-key/index.d.ts
generated
vendored
@@ -1,31 +0,0 @@
|
||||
export interface Options {
|
||||
/**
|
||||
Use a custom environment variables object.
|
||||
|
||||
Default: [`process.env`](https://nodejs.org/api/process.html#process_process_env).
|
||||
*/
|
||||
readonly env?: Record<string, string | undefined>;
|
||||
|
||||
/**
|
||||
Get the PATH key for a specific platform.
|
||||
|
||||
Default: [`process.platform`](https://nodejs.org/api/process.html#process_process_platform).
|
||||
*/
|
||||
readonly platform?: NodeJS.Platform;
|
||||
}
|
||||
|
||||
/**
|
||||
Get the [PATH](https://en.wikipedia.org/wiki/PATH_(variable)) environment variable key cross-platform.
|
||||
|
||||
@example
|
||||
```
|
||||
import pathKey from 'path-key';
|
||||
|
||||
const key = pathKey();
|
||||
//=> 'PATH'
|
||||
|
||||
const PATH = process.env[key];
|
||||
//=> '/usr/local/bin:/usr/bin:/bin'
|
||||
```
|
||||
*/
|
||||
export default function pathKey(options?: Options): string;
|
||||
12
node_modules/npm-run-path/node_modules/path-key/index.js
generated
vendored
12
node_modules/npm-run-path/node_modules/path-key/index.js
generated
vendored
@@ -1,12 +0,0 @@
|
||||
export default function pathKey(options = {}) {
|
||||
const {
|
||||
env = process.env,
|
||||
platform = process.platform
|
||||
} = options;
|
||||
|
||||
if (platform !== 'win32') {
|
||||
return 'PATH';
|
||||
}
|
||||
|
||||
return Object.keys(env).reverse().find(key => key.toUpperCase() === 'PATH') || 'Path';
|
||||
}
|
||||
57
node_modules/npm-run-path/node_modules/path-key/readme.md
generated
vendored
57
node_modules/npm-run-path/node_modules/path-key/readme.md
generated
vendored
@@ -1,57 +0,0 @@
|
||||
# path-key
|
||||
|
||||
> Get the [PATH](https://en.wikipedia.org/wiki/PATH_(variable)) environment variable key cross-platform
|
||||
|
||||
It's usually `PATH` but on Windows it can be any casing like `Path`...
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install path-key
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import pathKey from 'path-key';
|
||||
|
||||
const key = pathKey();
|
||||
//=> 'PATH'
|
||||
|
||||
const PATH = process.env[key];
|
||||
//=> '/usr/local/bin:/usr/bin:/bin'
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### pathKey(options?)
|
||||
|
||||
#### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
##### env
|
||||
|
||||
Type: `object`\
|
||||
Default: [`process.env`](https://nodejs.org/api/process.html#process_process_env)
|
||||
|
||||
Use a custom environment variables object.
|
||||
|
||||
#### platform
|
||||
|
||||
Type: `string`\
|
||||
Default: [`process.platform`](https://nodejs.org/api/process.html#process_process_platform)
|
||||
|
||||
Get the PATH key for a specific platform.
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-path-key?utm_source=npm-path-key&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
||||
17
node_modules/npm-run-path/package.json
generated
vendored
17
node_modules/npm-run-path/package.json
generated
vendored
@@ -1,19 +1,16 @@
|
||||
{
|
||||
"name": "npm-run-path",
|
||||
"version": "5.1.0",
|
||||
"version": "4.0.1",
|
||||
"description": "Get your PATH prepended with locally installed binaries",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/npm-run-path",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"type": "module",
|
||||
"exports": "./index.js",
|
||||
"engines": {
|
||||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
@@ -37,11 +34,11 @@
|
||||
"executable"
|
||||
],
|
||||
"dependencies": {
|
||||
"path-key": "^4.0.0"
|
||||
"path-key": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^3.15.0",
|
||||
"tsd": "^0.17.0",
|
||||
"xo": "^0.45.0"
|
||||
"ava": "^1.4.1",
|
||||
"tsd": "^0.7.2",
|
||||
"xo": "^0.24.0"
|
||||
}
|
||||
}
|
||||
|
||||
44
node_modules/npm-run-path/readme.md
generated
vendored
44
node_modules/npm-run-path/readme.md
generated
vendored
@@ -1,20 +1,22 @@
|
||||
# npm-run-path
|
||||
# npm-run-path [](https://travis-ci.org/sindresorhus/npm-run-path)
|
||||
|
||||
> Get your [PATH](https://en.wikipedia.org/wiki/PATH_(variable)) prepended with locally installed binaries
|
||||
|
||||
In [npm run scripts](https://docs.npmjs.com/cli/run-script) you can execute locally installed binaries by name. This enables the same outside npm.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
npm install npm-run-path
|
||||
```
|
||||
$ npm install npm-run-path
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import childProcess from 'node:child_process';
|
||||
import {npmRunPath, npmRunPathEnv} from 'npm-run-path';
|
||||
const childProcess = require('child_process');
|
||||
const npmRunPath = require('npm-run-path');
|
||||
|
||||
console.log(process.env.PATH);
|
||||
//=> '/usr/local/bin'
|
||||
@@ -24,15 +26,16 @@ console.log(npmRunPath());
|
||||
|
||||
// `foo` is a locally installed binary
|
||||
childProcess.execFileSync('foo', {
|
||||
env: npmRunPathEnv()
|
||||
env: npmRunPath.env()
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### npmRunPath(options?)
|
||||
|
||||
Returns the augmented PATH string.
|
||||
Returns the augmented path string.
|
||||
|
||||
#### options
|
||||
|
||||
@@ -40,30 +43,29 @@ Type: `object`
|
||||
|
||||
##### cwd
|
||||
|
||||
Type: `string | URL`\
|
||||
Type: `string`<br>
|
||||
Default: `process.cwd()`
|
||||
|
||||
The working directory.
|
||||
Working directory.
|
||||
|
||||
##### path
|
||||
|
||||
Type: `string`\
|
||||
Type: `string`<br>
|
||||
Default: [`PATH`](https://github.com/sindresorhus/path-key)
|
||||
|
||||
The PATH to be appended.
|
||||
|
||||
PATH to be appended.<br>
|
||||
Set it to an empty string to exclude the default PATH.
|
||||
|
||||
##### execPath
|
||||
|
||||
Type: `string`\
|
||||
Type: `string`<br>
|
||||
Default: `process.execPath`
|
||||
|
||||
The path to the current Node.js executable. Its directory is pushed to the front of PATH.
|
||||
Path to the current Node.js executable. Its directory is pushed to the front of PATH.
|
||||
|
||||
This can be either an absolute path or a path relative to the [`cwd` option](#cwd).
|
||||
|
||||
### npmRunPathEnv(options?)
|
||||
### npmRunPath.env(options?)
|
||||
|
||||
Returns the augmented [`process.env`](https://nodejs.org/api/process.html#process_process_env) object.
|
||||
|
||||
@@ -73,31 +75,33 @@ Type: `object`
|
||||
|
||||
##### cwd
|
||||
|
||||
Type: `string | URL`\
|
||||
Type: `string`<br>
|
||||
Default: `process.cwd()`
|
||||
|
||||
The working directory.
|
||||
Working directory.
|
||||
|
||||
##### env
|
||||
|
||||
Type: `object`
|
||||
Type: `Object`
|
||||
|
||||
Accepts an object of environment variables, like `process.env`, and modifies the PATH using the correct [PATH key](https://github.com/sindresorhus/path-key). Use this if you're modifying the PATH for use in the `child_process` options.
|
||||
|
||||
##### execPath
|
||||
|
||||
Type: `string`\
|
||||
Type: `string`<br>
|
||||
Default: `process.execPath`
|
||||
|
||||
The path to the Node.js executable to use in child processes if that is different from the current one. Its directory is pushed to the front of PATH.
|
||||
Path to the Node.js executable to use in child processes if that is different from the current one. Its directory is pushed to the front of PATH.
|
||||
|
||||
This can be either an absolute path or a path relative to the [`cwd` option](#cwd).
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [npm-run-path-cli](https://github.com/sindresorhus/npm-run-path-cli) - CLI for this module
|
||||
- [execa](https://github.com/sindresorhus/execa) - Execute a locally installed binary
|
||||
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
|
||||
29
node_modules/onetime/index.d.ts
generated
vendored
29
node_modules/onetime/index.d.ts
generated
vendored
@@ -1,10 +1,12 @@
|
||||
export interface Options {
|
||||
/**
|
||||
Throw an error when called more than once.
|
||||
declare namespace onetime {
|
||||
interface Options {
|
||||
/**
|
||||
Throw an error when called more than once.
|
||||
|
||||
@default false
|
||||
*/
|
||||
readonly throw?: boolean;
|
||||
@default false
|
||||
*/
|
||||
throw?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
declare const onetime: {
|
||||
@@ -16,11 +18,11 @@ declare const onetime: {
|
||||
|
||||
@example
|
||||
```
|
||||
import onetime from 'onetime';
|
||||
import onetime = require('onetime');
|
||||
|
||||
let index = 0;
|
||||
let i = 0;
|
||||
|
||||
const foo = onetime(() => ++index);
|
||||
const foo = onetime(() => ++i);
|
||||
|
||||
foo(); //=> 1
|
||||
foo(); //=> 1
|
||||
@@ -31,7 +33,7 @@ declare const onetime: {
|
||||
*/
|
||||
<ArgumentsType extends unknown[], ReturnType>(
|
||||
fn: (...arguments: ArgumentsType) => ReturnType,
|
||||
options?: Options
|
||||
options?: onetime.Options
|
||||
): (...arguments: ArgumentsType) => ReturnType;
|
||||
|
||||
/**
|
||||
@@ -42,7 +44,7 @@ declare const onetime: {
|
||||
|
||||
@example
|
||||
```
|
||||
import onetime from 'onetime';
|
||||
import onetime = require('onetime');
|
||||
|
||||
const foo = onetime(() => {});
|
||||
foo();
|
||||
@@ -54,6 +56,9 @@ declare const onetime: {
|
||||
```
|
||||
*/
|
||||
callCount(fn: (...arguments: any[]) => unknown): number;
|
||||
|
||||
// TODO: Remove this for the next major release
|
||||
default: typeof onetime;
|
||||
};
|
||||
|
||||
export default onetime;
|
||||
export = onetime;
|
||||
|
||||
13
node_modules/onetime/index.js
generated
vendored
13
node_modules/onetime/index.js
generated
vendored
@@ -1,4 +1,5 @@
|
||||
import mimicFunction from 'mimic-fn';
|
||||
'use strict';
|
||||
const mimicFn = require('mimic-fn');
|
||||
|
||||
const calledFunctions = new WeakMap();
|
||||
|
||||
@@ -24,18 +25,20 @@ const onetime = (function_, options = {}) => {
|
||||
return returnValue;
|
||||
};
|
||||
|
||||
mimicFunction(onetime, function_);
|
||||
mimicFn(onetime, function_);
|
||||
calledFunctions.set(onetime, callCount);
|
||||
|
||||
return onetime;
|
||||
};
|
||||
|
||||
onetime.callCount = function_ => {
|
||||
module.exports = onetime;
|
||||
// TODO: Remove this for the next major release
|
||||
module.exports.default = onetime;
|
||||
|
||||
module.exports.callCount = function_ => {
|
||||
if (!calledFunctions.has(function_)) {
|
||||
throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
|
||||
}
|
||||
|
||||
return calledFunctions.get(function_);
|
||||
};
|
||||
|
||||
export default onetime;
|
||||
|
||||
14
node_modules/onetime/package.json
generated
vendored
14
node_modules/onetime/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "onetime",
|
||||
"version": "6.0.0",
|
||||
"version": "5.1.2",
|
||||
"description": "Ensure a function is only called once",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/onetime",
|
||||
@@ -10,10 +10,8 @@
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"type": "module",
|
||||
"exports": "./index.js",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
"node": ">=6"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
@@ -35,11 +33,11 @@
|
||||
"prevent"
|
||||
],
|
||||
"dependencies": {
|
||||
"mimic-fn": "^4.0.0"
|
||||
"mimic-fn": "^2.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^3.15.0",
|
||||
"tsd": "^0.14.0",
|
||||
"xo": "^0.38.2"
|
||||
"ava": "^1.4.1",
|
||||
"tsd": "^0.7.1",
|
||||
"xo": "^0.24.0"
|
||||
}
|
||||
}
|
||||
|
||||
12
node_modules/onetime/readme.md
generated
vendored
12
node_modules/onetime/readme.md
generated
vendored
@@ -1,4 +1,4 @@
|
||||
# onetime
|
||||
# onetime [](https://travis-ci.com/github/sindresorhus/onetime)
|
||||
|
||||
> Ensure a function is only called once
|
||||
|
||||
@@ -15,11 +15,11 @@ $ npm install onetime
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import onetime from 'onetime';
|
||||
const onetime = require('onetime');
|
||||
|
||||
let index = 0;
|
||||
let i = 0;
|
||||
|
||||
const foo = onetime(() => ++index);
|
||||
const foo = onetime(() => ++i);
|
||||
|
||||
foo(); //=> 1
|
||||
foo(); //=> 1
|
||||
@@ -29,7 +29,7 @@ onetime.callCount(foo); //=> 3
|
||||
```
|
||||
|
||||
```js
|
||||
import onetime from 'onetime';
|
||||
const onetime = require('onetime');
|
||||
|
||||
const foo = onetime(() => {}, {throw: true});
|
||||
|
||||
@@ -69,7 +69,7 @@ Returns a number representing how many times `fn` has been called.
|
||||
Note: It throws an error if you pass in a function that is not wrapped by `onetime`.
|
||||
|
||||
```js
|
||||
import onetime from 'onetime';
|
||||
const onetime = require('onetime');
|
||||
|
||||
const foo = onetime(() => {});
|
||||
|
||||
|
||||
10
node_modules/strip-final-newline/index.js
generated
vendored
10
node_modules/strip-final-newline/index.js
generated
vendored
@@ -1,14 +1,16 @@
|
||||
export default function stripFinalNewline(input) {
|
||||
'use strict';
|
||||
|
||||
module.exports = input => {
|
||||
const LF = typeof input === 'string' ? '\n' : '\n'.charCodeAt();
|
||||
const CR = typeof input === 'string' ? '\r' : '\r'.charCodeAt();
|
||||
|
||||
if (input[input.length - 1] === LF) {
|
||||
input = input.slice(0, -1);
|
||||
input = input.slice(0, input.length - 1);
|
||||
}
|
||||
|
||||
if (input[input.length - 1] === CR) {
|
||||
input = input.slice(0, -1);
|
||||
input = input.slice(0, input.length - 1);
|
||||
}
|
||||
|
||||
return input;
|
||||
}
|
||||
};
|
||||
|
||||
2
node_modules/strip-final-newline/license
generated
vendored
2
node_modules/strip-final-newline/license
generated
vendored
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
|
||||
13
node_modules/strip-final-newline/package.json
generated
vendored
13
node_modules/strip-final-newline/package.json
generated
vendored
@@ -1,19 +1,16 @@
|
||||
{
|
||||
"name": "strip-final-newline",
|
||||
"version": "3.0.0",
|
||||
"version": "2.0.0",
|
||||
"description": "Strip the final newline character from a string/buffer",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/strip-final-newline",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"type": "module",
|
||||
"exports": "./index.js",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
"node": ">=6"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
@@ -37,7 +34,7 @@
|
||||
"buffer"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "^3.15.0",
|
||||
"xo": "^0.39.1"
|
||||
"ava": "^0.25.0",
|
||||
"xo": "^0.23.0"
|
||||
}
|
||||
}
|
||||
|
||||
19
node_modules/strip-final-newline/readme.md
generated
vendored
19
node_modules/strip-final-newline/readme.md
generated
vendored
@@ -1,19 +1,21 @@
|
||||
# strip-final-newline
|
||||
# strip-final-newline [](https://travis-ci.com/sindresorhus/strip-final-newline)
|
||||
|
||||
> Strip the final [newline character](https://en.wikipedia.org/wiki/Newline) from a string/buffer
|
||||
|
||||
Can be useful when parsing the output of, for example, `ChildProcess#execFile`, as [binaries usually output a newline at the end](https://stackoverflow.com/questions/729692/why-should-text-files-end-with-a-newline). Normally, you would use `stdout.trim()`, but that would also remove newlines at the start and whitespace.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install strip-final-newline
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import stripFinalNewline from 'strip-final-newline';
|
||||
const stripFinalNewline = require('strip-final-newline');
|
||||
|
||||
stripFinalNewline('foo\nbar\n\n');
|
||||
//=> 'foo\nbar\n'
|
||||
@@ -22,14 +24,7 @@ stripFinalNewline(Buffer.from('foo\nbar\n\n')).toString();
|
||||
//=> 'foo\nbar\n'
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-strip-eof?utm_source=npm-strip-eof&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
|
||||
146
package-lock.json
generated
146
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "codeql",
|
||||
"version": "2.2.8",
|
||||
"version": "2.2.7",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "codeql",
|
||||
"version": "2.2.8",
|
||||
"version": "2.2.7",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/artifact": "^1.1.0",
|
||||
@@ -40,7 +40,7 @@
|
||||
"zlib": "^1.0.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ava/typescript": "4.0.0",
|
||||
"@ava/typescript": "3.0.1",
|
||||
"@types/adm-zip": "^0.5.0",
|
||||
"@types/get-folder-size": "^2.0.0",
|
||||
"@types/js-yaml": "^4.0.5",
|
||||
@@ -201,16 +201,16 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@ava/typescript": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@ava/typescript/-/typescript-4.0.0.tgz",
|
||||
"integrity": "sha512-QFIPeqkEbdvn7Pob0wVeYpeZD0eXd8nDYdCl+knJVaIJrHdF2fXa58vFaig26cmYwnsEN0KRNTYJKbqW1B0lfg==",
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@ava/typescript/-/typescript-3.0.1.tgz",
|
||||
"integrity": "sha512-/JXIUuKsvkaneaiA9ckk3ksFTqvu0mDNlChASrTe2BnDsvMbhQdPWyqQjJ9WRJWVhhs5TWn1/0Pp1G6Rv8Syrw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"escape-string-regexp": "^5.0.0",
|
||||
"execa": "^7.1.0"
|
||||
"execa": "^5.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.19 <15 || >=16.15 <17 || >=18"
|
||||
"node": ">=12.22 <13 || >=14.17 <15 || >=16.4 <17 || >=17"
|
||||
}
|
||||
},
|
||||
"node_modules/@ava/typescript/node_modules/escape-string-regexp": {
|
||||
@@ -3102,28 +3102,40 @@
|
||||
}
|
||||
},
|
||||
"node_modules/execa": {
|
||||
"version": "7.1.0",
|
||||
"resolved": "https://registry.npmjs.org/execa/-/execa-7.1.0.tgz",
|
||||
"integrity": "sha512-T6nIJO3LHxUZ6ahVRaxXz9WLEruXLqdcluA+UuTptXmLM7nDAn9lx9IfkxPyzEL21583qSt4RmL44pO71EHaJQ==",
|
||||
"version": "5.1.1",
|
||||
"resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz",
|
||||
"integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"cross-spawn": "^7.0.3",
|
||||
"get-stream": "^6.0.1",
|
||||
"human-signals": "^4.3.0",
|
||||
"is-stream": "^3.0.0",
|
||||
"get-stream": "^6.0.0",
|
||||
"human-signals": "^2.1.0",
|
||||
"is-stream": "^2.0.0",
|
||||
"merge-stream": "^2.0.0",
|
||||
"npm-run-path": "^5.1.0",
|
||||
"onetime": "^6.0.0",
|
||||
"signal-exit": "^3.0.7",
|
||||
"strip-final-newline": "^3.0.0"
|
||||
"npm-run-path": "^4.0.1",
|
||||
"onetime": "^5.1.2",
|
||||
"signal-exit": "^3.0.3",
|
||||
"strip-final-newline": "^2.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^14.18.0 || ^16.14.0 || >=18.0.0"
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sindresorhus/execa?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/execa/node_modules/get-stream": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz",
|
||||
"integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/fast-deep-equal": {
|
||||
"version": "3.1.3",
|
||||
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="
|
||||
@@ -3375,18 +3387,6 @@
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/get-stream": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz",
|
||||
"integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/get-symbol-description": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz",
|
||||
@@ -3619,12 +3619,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/human-signals": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.0.tgz",
|
||||
"integrity": "sha512-zyzVyMjpGBX2+6cDVZeFPCdtOtdsxOeseRhB9tkQ6xXmGUNrcnBzdEKPy3VPNYz+4gy1oukVOXcrJCunSyc6QQ==",
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz",
|
||||
"integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=14.18.0"
|
||||
"node": ">=10.17.0"
|
||||
}
|
||||
},
|
||||
"node_modules/ignore": {
|
||||
@@ -3998,12 +3998,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/is-stream": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz",
|
||||
"integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==",
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz",
|
||||
"integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
||||
"node": ">=8"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
@@ -4400,6 +4400,18 @@
|
||||
"url": "https://github.com/sindresorhus/mem?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/mem/node_modules/mimic-fn": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz",
|
||||
"integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/merge-stream": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz",
|
||||
@@ -4446,15 +4458,11 @@
|
||||
}
|
||||
},
|
||||
"node_modules/mimic-fn": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz",
|
||||
"integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==",
|
||||
"version": "2.1.0",
|
||||
"integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/minimatch": {
|
||||
@@ -4591,30 +4599,15 @@
|
||||
}
|
||||
},
|
||||
"node_modules/npm-run-path": {
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.1.0.tgz",
|
||||
"integrity": "sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==",
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz",
|
||||
"integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"path-key": "^4.0.0"
|
||||
"path-key": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/npm-run-path/node_modules/path-key": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz",
|
||||
"integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/object-inspect": {
|
||||
@@ -4725,15 +4718,15 @@
|
||||
}
|
||||
},
|
||||
"node_modules/onetime": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz",
|
||||
"integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==",
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz",
|
||||
"integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"mimic-fn": "^4.0.0"
|
||||
"mimic-fn": "^2.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
"node": ">=6"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
@@ -5570,15 +5563,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/strip-final-newline": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz",
|
||||
"integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==",
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz",
|
||||
"integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/strip-json-comments": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "codeql",
|
||||
"version": "2.2.8",
|
||||
"version": "2.2.7",
|
||||
"private": true,
|
||||
"description": "CodeQL action",
|
||||
"scripts": {
|
||||
@@ -55,7 +55,7 @@
|
||||
"micromatch is an unspecified dependency of ava"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@ava/typescript": "4.0.0",
|
||||
"@ava/typescript": "3.0.1",
|
||||
"@types/adm-zip": "^0.5.0",
|
||||
"@types/get-folder-size": "^2.0.0",
|
||||
"@types/js-yaml": "^4.0.5",
|
||||
|
||||
@@ -11,6 +11,5 @@ steps:
|
||||
run: ./build.sh
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
upload-database: false
|
||||
ref: 'refs/heads/main'
|
||||
sha: '5e235361806c361d4d3f8859e3c897658025a9a2'
|
||||
|
||||
@@ -16,8 +16,6 @@ steps:
|
||||
CORECLR_PROFILER: ""
|
||||
CORECLR_PROFILER_PATH_64: ""
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
upload-database: false
|
||||
- name: Check database
|
||||
shell: bash
|
||||
run: |
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
name: "Go: Custom queries"
|
||||
description: "Checks that Go works in conjunction with a config file specifying custom queries"
|
||||
env:
|
||||
env:
|
||||
DOTNET_GENERATE_ASPNET_CERTIFICATE: "false"
|
||||
steps:
|
||||
- uses: ./../action/init
|
||||
@@ -12,5 +12,3 @@ steps:
|
||||
shell: bash
|
||||
run: ./build.sh
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
upload-database: false
|
||||
|
||||
@@ -10,8 +10,6 @@ steps:
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
- uses: ./../action/autobuild
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
upload-database: false
|
||||
- shell: bash
|
||||
run: |
|
||||
if [[ "${CODEQL_ACTION_DID_AUTOBUILD_GOLANG}" != true ]]; then
|
||||
|
||||
@@ -10,8 +10,6 @@ steps:
|
||||
shell: bash
|
||||
run: go build main.go
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
upload-database: false
|
||||
- shell: bash
|
||||
run: |
|
||||
# Once we start running Bash 4.2 in all environments, we can replace the
|
||||
|
||||
@@ -9,8 +9,6 @@ steps:
|
||||
languages: go
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
upload-database: false
|
||||
- shell: bash
|
||||
run: |
|
||||
cd "$RUNNER_TEMP/codeql_databases"
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user