serverless-spy 2.2.4 → 2.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.jsii +3 -3
- package/cli/package.json +1 -1
- package/dist/releasetag.txt +1 -1
- package/lib/cli/package.json +1 -1
- package/lib/src/ServerlessSpy.js +1 -1
- package/node_modules/bundle-name/index.js +2 -2
- package/node_modules/bundle-name/package.json +6 -5
- package/node_modules/bundle-name/readme.md +2 -2
- package/node_modules/default-browser/index.d.ts +5 -4
- package/node_modules/default-browser/index.js +13 -11
- package/node_modules/default-browser/package.json +14 -12
- package/node_modules/default-browser/windows.js +11 -5
- package/node_modules/default-browser-id/index.js +8 -32
- package/node_modules/default-browser-id/package.json +5 -8
- package/node_modules/default-browser-id/readme.md +2 -2
- package/node_modules/open/index.js +10 -10
- package/node_modules/{is-wsl → open/node_modules/is-wsl}/index.d.ts +2 -2
- package/node_modules/open/node_modules/is-wsl/index.js +27 -0
- package/node_modules/{is-wsl → open/node_modules/is-wsl}/package.json +21 -9
- package/node_modules/open/node_modules/is-wsl/readme.md +21 -0
- package/node_modules/open/package.json +9 -8
- package/node_modules/open/xdg-open +338 -137
- package/node_modules/run-applescript/index.d.ts +28 -4
- package/node_modules/run-applescript/index.js +20 -7
- package/node_modules/run-applescript/package.json +10 -9
- package/node_modules/run-applescript/readme.md +44 -6
- package/package.json +2 -2
- package/node_modules/big-integer/BigInteger.d.ts +0 -2393
- package/node_modules/big-integer/BigInteger.js +0 -1453
- package/node_modules/big-integer/BigInteger.min.js +0 -1
- package/node_modules/big-integer/LICENSE +0 -24
- package/node_modules/big-integer/README.md +0 -589
- package/node_modules/big-integer/bower.json +0 -29
- package/node_modules/big-integer/package.json +0 -48
- package/node_modules/big-integer/tsconfig.json +0 -24
- package/node_modules/bplist-parser/README.md +0 -48
- package/node_modules/bplist-parser/bplistParser.js +0 -363
- package/node_modules/bplist-parser/package.json +0 -34
- package/node_modules/bplist-parser/test/airplay.bplist +0 -0
- package/node_modules/bplist-parser/test/iTunes-small.bplist +0 -0
- package/node_modules/bplist-parser/test/int64.bplist +0 -0
- package/node_modules/bplist-parser/test/int64.xml +0 -10
- package/node_modules/bplist-parser/test/parseTest.js +0 -104
- package/node_modules/bplist-parser/test/sample1.bplist +0 -0
- package/node_modules/bplist-parser/test/sample2.bplist +0 -0
- package/node_modules/bplist-parser/test/uid.bplist +0 -0
- package/node_modules/bplist-parser/test/utf16.bplist +0 -0
- package/node_modules/bplist-parser/test/utf16_chinese.plist +0 -0
- package/node_modules/cross-spawn/CHANGELOG.md +0 -130
- package/node_modules/cross-spawn/LICENSE +0 -21
- package/node_modules/cross-spawn/README.md +0 -96
- package/node_modules/cross-spawn/index.js +0 -39
- package/node_modules/cross-spawn/lib/enoent.js +0 -59
- package/node_modules/cross-spawn/lib/parse.js +0 -91
- package/node_modules/cross-spawn/lib/util/escape.js +0 -45
- package/node_modules/cross-spawn/lib/util/readShebang.js +0 -23
- package/node_modules/cross-spawn/lib/util/resolveCommand.js +0 -52
- package/node_modules/cross-spawn/package.json +0 -73
- package/node_modules/default-browser/node_modules/execa/index.d.ts +0 -937
- package/node_modules/default-browser/node_modules/execa/index.js +0 -309
- package/node_modules/default-browser/node_modules/execa/lib/command.js +0 -120
- package/node_modules/default-browser/node_modules/execa/lib/error.js +0 -87
- package/node_modules/default-browser/node_modules/execa/lib/kill.js +0 -102
- package/node_modules/default-browser/node_modules/execa/lib/pipe.js +0 -42
- package/node_modules/default-browser/node_modules/execa/lib/promise.js +0 -36
- package/node_modules/default-browser/node_modules/execa/lib/stdio.js +0 -49
- package/node_modules/default-browser/node_modules/execa/lib/stream.js +0 -119
- package/node_modules/default-browser/node_modules/execa/lib/verbose.js +0 -19
- package/node_modules/default-browser/node_modules/execa/package.json +0 -87
- package/node_modules/default-browser/node_modules/execa/readme.md +0 -824
- package/node_modules/default-browser/node_modules/human-signals/LICENSE +0 -201
- package/node_modules/default-browser/node_modules/human-signals/README.md +0 -178
- package/node_modules/default-browser/node_modules/human-signals/build/src/core.js +0 -273
- package/node_modules/default-browser/node_modules/human-signals/build/src/main.d.ts +0 -73
- package/node_modules/default-browser/node_modules/human-signals/build/src/main.js +0 -70
- package/node_modules/default-browser/node_modules/human-signals/build/src/realtime.js +0 -16
- package/node_modules/default-browser/node_modules/human-signals/build/src/signals.js +0 -34
- package/node_modules/default-browser/node_modules/human-signals/package.json +0 -61
- package/node_modules/default-browser/node_modules/is-stream/index.d.ts +0 -81
- package/node_modules/default-browser/node_modules/is-stream/index.js +0 -29
- package/node_modules/default-browser/node_modules/is-stream/license +0 -9
- package/node_modules/default-browser/node_modules/is-stream/package.json +0 -44
- package/node_modules/default-browser/node_modules/is-stream/readme.md +0 -60
- package/node_modules/default-browser/node_modules/mimic-fn/index.d.ts +0 -52
- package/node_modules/default-browser/node_modules/mimic-fn/index.js +0 -71
- package/node_modules/default-browser/node_modules/mimic-fn/license +0 -9
- package/node_modules/default-browser/node_modules/mimic-fn/package.json +0 -45
- package/node_modules/default-browser/node_modules/mimic-fn/readme.md +0 -90
- package/node_modules/default-browser/node_modules/npm-run-path/index.d.ts +0 -90
- package/node_modules/default-browser/node_modules/npm-run-path/index.js +0 -52
- package/node_modules/default-browser/node_modules/npm-run-path/license +0 -9
- package/node_modules/default-browser/node_modules/npm-run-path/package.json +0 -49
- package/node_modules/default-browser/node_modules/npm-run-path/readme.md +0 -104
- package/node_modules/default-browser/node_modules/onetime/index.d.ts +0 -59
- package/node_modules/default-browser/node_modules/onetime/index.js +0 -41
- package/node_modules/default-browser/node_modules/onetime/license +0 -9
- package/node_modules/default-browser/node_modules/onetime/package.json +0 -45
- package/node_modules/default-browser/node_modules/onetime/readme.md +0 -94
- package/node_modules/default-browser/node_modules/path-key/index.d.ts +0 -31
- package/node_modules/default-browser/node_modules/path-key/index.js +0 -12
- package/node_modules/default-browser/node_modules/path-key/license +0 -9
- package/node_modules/default-browser/node_modules/path-key/package.json +0 -41
- package/node_modules/default-browser/node_modules/path-key/readme.md +0 -57
- package/node_modules/default-browser/node_modules/strip-final-newline/index.js +0 -14
- package/node_modules/default-browser/node_modules/strip-final-newline/license +0 -9
- package/node_modules/default-browser/node_modules/strip-final-newline/package.json +0 -43
- package/node_modules/default-browser/node_modules/strip-final-newline/readme.md +0 -35
- package/node_modules/execa/index.d.ts +0 -564
- package/node_modules/execa/index.js +0 -268
- package/node_modules/execa/lib/command.js +0 -52
- package/node_modules/execa/lib/error.js +0 -88
- package/node_modules/execa/lib/kill.js +0 -115
- package/node_modules/execa/lib/promise.js +0 -46
- package/node_modules/execa/lib/stdio.js +0 -52
- package/node_modules/execa/lib/stream.js +0 -97
- package/node_modules/execa/license +0 -9
- package/node_modules/execa/package.json +0 -74
- package/node_modules/execa/readme.md +0 -663
- package/node_modules/get-stream/buffer-stream.js +0 -52
- package/node_modules/get-stream/index.d.ts +0 -105
- package/node_modules/get-stream/index.js +0 -61
- package/node_modules/get-stream/license +0 -9
- package/node_modules/get-stream/package.json +0 -47
- package/node_modules/get-stream/readme.md +0 -124
- package/node_modules/human-signals/CHANGELOG.md +0 -11
- package/node_modules/human-signals/LICENSE +0 -201
- package/node_modules/human-signals/README.md +0 -165
- package/node_modules/human-signals/build/src/core.js +0 -273
- package/node_modules/human-signals/build/src/core.js.map +0 -1
- package/node_modules/human-signals/build/src/main.d.ts +0 -52
- package/node_modules/human-signals/build/src/main.js +0 -71
- package/node_modules/human-signals/build/src/main.js.map +0 -1
- package/node_modules/human-signals/build/src/realtime.js +0 -19
- package/node_modules/human-signals/build/src/realtime.js.map +0 -1
- package/node_modules/human-signals/build/src/signals.js +0 -35
- package/node_modules/human-signals/build/src/signals.js.map +0 -1
- package/node_modules/human-signals/package.json +0 -64
- package/node_modules/is-stream/index.d.ts +0 -79
- package/node_modules/is-stream/index.js +0 -28
- package/node_modules/is-stream/license +0 -9
- package/node_modules/is-stream/package.json +0 -42
- package/node_modules/is-stream/readme.md +0 -60
- package/node_modules/is-wsl/index.js +0 -31
- package/node_modules/is-wsl/license +0 -9
- package/node_modules/is-wsl/node_modules/is-docker/cli.js +0 -5
- package/node_modules/is-wsl/node_modules/is-docker/index.d.ts +0 -15
- package/node_modules/is-wsl/node_modules/is-docker/index.js +0 -29
- package/node_modules/is-wsl/node_modules/is-docker/license +0 -9
- package/node_modules/is-wsl/node_modules/is-docker/package.json +0 -42
- package/node_modules/is-wsl/node_modules/is-docker/readme.md +0 -27
- package/node_modules/is-wsl/readme.md +0 -36
- package/node_modules/isexe/.npmignore +0 -2
- package/node_modules/isexe/LICENSE +0 -15
- package/node_modules/isexe/README.md +0 -51
- package/node_modules/isexe/index.js +0 -57
- package/node_modules/isexe/mode.js +0 -41
- package/node_modules/isexe/package.json +0 -31
- package/node_modules/isexe/test/basic.js +0 -221
- package/node_modules/isexe/windows.js +0 -42
- package/node_modules/merge-stream/LICENSE +0 -21
- package/node_modules/merge-stream/README.md +0 -78
- package/node_modules/merge-stream/index.js +0 -41
- package/node_modules/merge-stream/package.json +0 -19
- package/node_modules/mimic-fn/index.d.ts +0 -54
- package/node_modules/mimic-fn/index.js +0 -13
- package/node_modules/mimic-fn/license +0 -9
- package/node_modules/mimic-fn/package.json +0 -42
- package/node_modules/mimic-fn/readme.md +0 -69
- package/node_modules/npm-run-path/index.d.ts +0 -89
- package/node_modules/npm-run-path/index.js +0 -47
- package/node_modules/npm-run-path/license +0 -9
- package/node_modules/npm-run-path/package.json +0 -44
- package/node_modules/npm-run-path/readme.md +0 -115
- package/node_modules/onetime/index.d.ts +0 -64
- package/node_modules/onetime/index.js +0 -44
- package/node_modules/onetime/license +0 -9
- package/node_modules/onetime/package.json +0 -43
- package/node_modules/onetime/readme.md +0 -94
- package/node_modules/path-key/index.d.ts +0 -40
- package/node_modules/path-key/index.js +0 -16
- package/node_modules/path-key/license +0 -9
- package/node_modules/path-key/package.json +0 -39
- package/node_modules/path-key/readme.md +0 -61
- package/node_modules/shebang-command/index.js +0 -19
- package/node_modules/shebang-command/license +0 -9
- package/node_modules/shebang-command/package.json +0 -34
- package/node_modules/shebang-command/readme.md +0 -34
- package/node_modules/shebang-regex/index.d.ts +0 -22
- package/node_modules/shebang-regex/index.js +0 -2
- package/node_modules/shebang-regex/license +0 -9
- package/node_modules/shebang-regex/package.json +0 -35
- package/node_modules/shebang-regex/readme.md +0 -33
- package/node_modules/signal-exit/LICENSE.txt +0 -16
- package/node_modules/signal-exit/README.md +0 -39
- package/node_modules/signal-exit/index.js +0 -202
- package/node_modules/signal-exit/package.json +0 -38
- package/node_modules/signal-exit/signals.js +0 -53
- package/node_modules/strip-final-newline/index.js +0 -16
- package/node_modules/strip-final-newline/license +0 -9
- package/node_modules/strip-final-newline/package.json +0 -40
- package/node_modules/strip-final-newline/readme.md +0 -30
- package/node_modules/titleize/index.d.ts +0 -17
- package/node_modules/titleize/index.js +0 -7
- package/node_modules/titleize/license +0 -9
- package/node_modules/titleize/package.json +0 -42
- package/node_modules/titleize/readme.md +0 -25
- package/node_modules/untildify/index.d.ts +0 -14
- package/node_modules/untildify/index.js +0 -12
- package/node_modules/untildify/license +0 -9
- package/node_modules/untildify/package.json +0 -43
- package/node_modules/untildify/readme.md +0 -30
- package/node_modules/which/CHANGELOG.md +0 -166
- package/node_modules/which/LICENSE +0 -15
- package/node_modules/which/README.md +0 -54
- package/node_modules/which/bin/node-which +0 -52
- package/node_modules/which/package.json +0 -43
- package/node_modules/which/which.js +0 -125
- /package/node_modules/{default-browser/node_modules/execa → open/node_modules/is-wsl}/license +0 -0
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
<img src="media/logo.svg" alt="mimic-fn" width="400">
|
|
2
|
-
<br>
|
|
3
|
-
|
|
4
|
-
> Make a function mimic another one
|
|
5
|
-
|
|
6
|
-
Useful when you wrap a function in another function and like to preserve the original name and other properties.
|
|
7
|
-
|
|
8
|
-
## Install
|
|
9
|
-
|
|
10
|
-
```
|
|
11
|
-
$ npm install mimic-fn
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
## Usage
|
|
15
|
-
|
|
16
|
-
```js
|
|
17
|
-
import mimicFunction from 'mimic-fn';
|
|
18
|
-
|
|
19
|
-
function foo() {}
|
|
20
|
-
foo.unicorn = '🦄';
|
|
21
|
-
|
|
22
|
-
function wrapper() {
|
|
23
|
-
return foo();
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
console.log(wrapper.name);
|
|
27
|
-
//=> 'wrapper'
|
|
28
|
-
|
|
29
|
-
mimicFunction(wrapper, foo);
|
|
30
|
-
|
|
31
|
-
console.log(wrapper.name);
|
|
32
|
-
//=> 'foo'
|
|
33
|
-
|
|
34
|
-
console.log(wrapper.unicorn);
|
|
35
|
-
//=> '🦄'
|
|
36
|
-
|
|
37
|
-
console.log(String(wrapper));
|
|
38
|
-
//=> '/* Wrapped with wrapper() */\nfunction foo() {}'
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
## API
|
|
43
|
-
|
|
44
|
-
### mimicFunction(to, from, options?)
|
|
45
|
-
|
|
46
|
-
Modifies the `to` function to mimic the `from` function. Returns the `to` function.
|
|
47
|
-
|
|
48
|
-
`name`, `displayName`, and any other properties of `from` are copied. The `length` property is not copied. Prototype, class, and inherited properties are copied.
|
|
49
|
-
|
|
50
|
-
`to.toString()` will return the same as `from.toString()` but prepended with a `Wrapped with to()` comment.
|
|
51
|
-
|
|
52
|
-
#### to
|
|
53
|
-
|
|
54
|
-
Type: `Function`
|
|
55
|
-
|
|
56
|
-
Mimicking function.
|
|
57
|
-
|
|
58
|
-
#### from
|
|
59
|
-
|
|
60
|
-
Type: `Function`
|
|
61
|
-
|
|
62
|
-
Function to mimic.
|
|
63
|
-
|
|
64
|
-
#### options
|
|
65
|
-
|
|
66
|
-
Type: `object`
|
|
67
|
-
|
|
68
|
-
##### ignoreNonConfigurable
|
|
69
|
-
|
|
70
|
-
Type: `boolean`\
|
|
71
|
-
Default: `false`
|
|
72
|
-
|
|
73
|
-
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.
|
|
74
|
-
|
|
75
|
-
## Related
|
|
76
|
-
|
|
77
|
-
- [rename-fn](https://github.com/sindresorhus/rename-fn) - Rename a function
|
|
78
|
-
- [keep-func-props](https://github.com/ehmicky/keep-func-props) - Wrap a function without changing its name and other properties
|
|
79
|
-
|
|
80
|
-
---
|
|
81
|
-
|
|
82
|
-
<div align="center">
|
|
83
|
-
<b>
|
|
84
|
-
<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>
|
|
85
|
-
</b>
|
|
86
|
-
<br>
|
|
87
|
-
<sub>
|
|
88
|
-
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
|
89
|
-
</sub>
|
|
90
|
-
</div>
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
type CommonOptions = {
|
|
2
|
-
/**
|
|
3
|
-
Working directory.
|
|
4
|
-
|
|
5
|
-
@default process.cwd()
|
|
6
|
-
*/
|
|
7
|
-
readonly cwd?: string | URL;
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
The path to the current Node.js executable.
|
|
11
|
-
|
|
12
|
-
This can be either an absolute path or a path relative to the `cwd` option.
|
|
13
|
-
|
|
14
|
-
@default [process.execPath](https://nodejs.org/api/process.html#processexecpath)
|
|
15
|
-
*/
|
|
16
|
-
readonly execPath?: string | URL;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
Whether to push the current Node.js executable's directory (`execPath` option) to the front of PATH.
|
|
20
|
-
|
|
21
|
-
@default true
|
|
22
|
-
*/
|
|
23
|
-
readonly addExecPath?: boolean;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
Whether to push the locally installed binaries' directory to the front of PATH.
|
|
27
|
-
|
|
28
|
-
@default true
|
|
29
|
-
*/
|
|
30
|
-
readonly preferLocal?: boolean;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export type RunPathOptions = CommonOptions & {
|
|
34
|
-
/**
|
|
35
|
-
PATH to be appended.
|
|
36
|
-
|
|
37
|
-
Set it to an empty string to exclude the default PATH.
|
|
38
|
-
|
|
39
|
-
@default [`PATH`](https://github.com/sindresorhus/path-key)
|
|
40
|
-
*/
|
|
41
|
-
readonly path?: string;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export type ProcessEnv = Record<string, string | undefined>;
|
|
45
|
-
|
|
46
|
-
export type EnvOptions = CommonOptions & {
|
|
47
|
-
/**
|
|
48
|
-
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.
|
|
49
|
-
|
|
50
|
-
@default [process.env](https://nodejs.org/api/process.html#processenv)
|
|
51
|
-
*/
|
|
52
|
-
readonly env?: ProcessEnv;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
Get your [PATH](https://en.wikipedia.org/wiki/PATH_(variable)) prepended with locally installed binaries.
|
|
57
|
-
|
|
58
|
-
@returns The augmented path string.
|
|
59
|
-
|
|
60
|
-
@example
|
|
61
|
-
```
|
|
62
|
-
import childProcess from 'node:child_process';
|
|
63
|
-
import {npmRunPath} from 'npm-run-path';
|
|
64
|
-
|
|
65
|
-
console.log(process.env.PATH);
|
|
66
|
-
//=> '/usr/local/bin'
|
|
67
|
-
|
|
68
|
-
console.log(npmRunPath());
|
|
69
|
-
//=> '/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'
|
|
70
|
-
```
|
|
71
|
-
*/
|
|
72
|
-
export function npmRunPath(options?: RunPathOptions): string;
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
Get your [PATH](https://en.wikipedia.org/wiki/PATH_(variable)) prepended with locally installed binaries.
|
|
76
|
-
|
|
77
|
-
@returns The augmented [`process.env`](https://nodejs.org/api/process.html#process_process_env) object.
|
|
78
|
-
|
|
79
|
-
@example
|
|
80
|
-
```
|
|
81
|
-
import childProcess from 'node:child_process';
|
|
82
|
-
import {npmRunPathEnv} from 'npm-run-path';
|
|
83
|
-
|
|
84
|
-
// `foo` is a locally installed binary
|
|
85
|
-
childProcess.execFileSync('foo', {
|
|
86
|
-
env: npmRunPathEnv()
|
|
87
|
-
});
|
|
88
|
-
```
|
|
89
|
-
*/
|
|
90
|
-
export function npmRunPathEnv(options?: EnvOptions): ProcessEnv;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import process from 'node:process';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import {fileURLToPath} from 'node:url';
|
|
4
|
-
import pathKey from 'path-key';
|
|
5
|
-
|
|
6
|
-
export const npmRunPath = ({
|
|
7
|
-
cwd = process.cwd(),
|
|
8
|
-
path: pathOption = process.env[pathKey()],
|
|
9
|
-
preferLocal = true,
|
|
10
|
-
execPath = process.execPath,
|
|
11
|
-
addExecPath = true,
|
|
12
|
-
} = {}) => {
|
|
13
|
-
const cwdString = cwd instanceof URL ? fileURLToPath(cwd) : cwd;
|
|
14
|
-
const cwdPath = path.resolve(cwdString);
|
|
15
|
-
const result = [];
|
|
16
|
-
|
|
17
|
-
if (preferLocal) {
|
|
18
|
-
applyPreferLocal(result, cwdPath);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
if (addExecPath) {
|
|
22
|
-
applyExecPath(result, execPath, cwdPath);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return [...result, pathOption].join(path.delimiter);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const applyPreferLocal = (result, cwdPath) => {
|
|
29
|
-
let previous;
|
|
30
|
-
|
|
31
|
-
while (previous !== cwdPath) {
|
|
32
|
-
result.push(path.join(cwdPath, 'node_modules/.bin'));
|
|
33
|
-
previous = cwdPath;
|
|
34
|
-
cwdPath = path.resolve(cwdPath, '..');
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
// Ensure the running `node` binary is used
|
|
39
|
-
const applyExecPath = (result, execPath, cwdPath) => {
|
|
40
|
-
const execPathString = execPath instanceof URL ? fileURLToPath(execPath) : execPath;
|
|
41
|
-
result.push(path.resolve(cwdPath, execPathString, '..'));
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export const npmRunPathEnv = ({env = process.env, ...options} = {}) => {
|
|
45
|
-
env = {...env};
|
|
46
|
-
|
|
47
|
-
const pathName = pathKey({env});
|
|
48
|
-
options.path = env[pathName];
|
|
49
|
-
env[pathName] = npmRunPath(options);
|
|
50
|
-
|
|
51
|
-
return env;
|
|
52
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
4
|
-
|
|
5
|
-
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:
|
|
6
|
-
|
|
7
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
-
|
|
9
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "npm-run-path",
|
|
3
|
-
"version": "5.3.0",
|
|
4
|
-
"description": "Get your PATH prepended with locally installed binaries",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"repository": "sindresorhus/npm-run-path",
|
|
7
|
-
"funding": "https://github.com/sponsors/sindresorhus",
|
|
8
|
-
"author": {
|
|
9
|
-
"name": "Sindre Sorhus",
|
|
10
|
-
"email": "sindresorhus@gmail.com",
|
|
11
|
-
"url": "https://sindresorhus.com"
|
|
12
|
-
},
|
|
13
|
-
"type": "module",
|
|
14
|
-
"exports": "./index.js",
|
|
15
|
-
"types": "./index.d.ts",
|
|
16
|
-
"sideEffects": false,
|
|
17
|
-
"engines": {
|
|
18
|
-
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
|
19
|
-
},
|
|
20
|
-
"scripts": {
|
|
21
|
-
"test": "xo && ava && tsd"
|
|
22
|
-
},
|
|
23
|
-
"files": [
|
|
24
|
-
"index.js",
|
|
25
|
-
"index.d.ts"
|
|
26
|
-
],
|
|
27
|
-
"keywords": [
|
|
28
|
-
"npm",
|
|
29
|
-
"run",
|
|
30
|
-
"path",
|
|
31
|
-
"package",
|
|
32
|
-
"bin",
|
|
33
|
-
"binary",
|
|
34
|
-
"binaries",
|
|
35
|
-
"script",
|
|
36
|
-
"cli",
|
|
37
|
-
"command-line",
|
|
38
|
-
"execute",
|
|
39
|
-
"executable"
|
|
40
|
-
],
|
|
41
|
-
"dependencies": {
|
|
42
|
-
"path-key": "^4.0.0"
|
|
43
|
-
},
|
|
44
|
-
"devDependencies": {
|
|
45
|
-
"ava": "^3.15.0",
|
|
46
|
-
"tsd": "^0.17.0",
|
|
47
|
-
"xo": "^0.45.0"
|
|
48
|
-
}
|
|
49
|
-
}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
# npm-run-path
|
|
2
|
-
|
|
3
|
-
> Get your [PATH](https://en.wikipedia.org/wiki/PATH_(variable)) prepended with locally installed binaries
|
|
4
|
-
|
|
5
|
-
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.
|
|
6
|
-
|
|
7
|
-
## Install
|
|
8
|
-
|
|
9
|
-
```sh
|
|
10
|
-
npm install npm-run-path
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## Usage
|
|
14
|
-
|
|
15
|
-
```js
|
|
16
|
-
import childProcess from 'node:child_process';
|
|
17
|
-
import {npmRunPath, npmRunPathEnv} from 'npm-run-path';
|
|
18
|
-
|
|
19
|
-
console.log(process.env.PATH);
|
|
20
|
-
//=> '/usr/local/bin'
|
|
21
|
-
|
|
22
|
-
console.log(npmRunPath());
|
|
23
|
-
//=> '/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'
|
|
24
|
-
|
|
25
|
-
// `foo` is a locally installed binary
|
|
26
|
-
childProcess.execFileSync('foo', {
|
|
27
|
-
env: npmRunPathEnv()
|
|
28
|
-
});
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
## API
|
|
32
|
-
|
|
33
|
-
### npmRunPath(options?)
|
|
34
|
-
|
|
35
|
-
`options`: [`Options`](#options)\
|
|
36
|
-
_Returns_: `string`
|
|
37
|
-
|
|
38
|
-
Returns the augmented PATH string.
|
|
39
|
-
|
|
40
|
-
### npmRunPathEnv(options?)
|
|
41
|
-
|
|
42
|
-
`options`: [`Options`](#options)\
|
|
43
|
-
_Returns_: `object`
|
|
44
|
-
|
|
45
|
-
Returns the augmented [`process.env`](https://nodejs.org/api/process.html#process_process_env) object.
|
|
46
|
-
|
|
47
|
-
### options
|
|
48
|
-
|
|
49
|
-
Type: `object`
|
|
50
|
-
|
|
51
|
-
#### cwd
|
|
52
|
-
|
|
53
|
-
Type: `string | URL`\
|
|
54
|
-
Default: `process.cwd()`
|
|
55
|
-
|
|
56
|
-
The working directory.
|
|
57
|
-
|
|
58
|
-
#### execPath
|
|
59
|
-
|
|
60
|
-
Type: `string | URL`\
|
|
61
|
-
Default: [`process.execPath`](https://nodejs.org/api/process.html#processexecpath)
|
|
62
|
-
|
|
63
|
-
The path to the current Node.js executable.
|
|
64
|
-
|
|
65
|
-
This can be either an absolute path or a path relative to the [`cwd` option](#cwd).
|
|
66
|
-
|
|
67
|
-
#### addExecPath
|
|
68
|
-
|
|
69
|
-
Type: `boolean`\
|
|
70
|
-
Default: `true`
|
|
71
|
-
|
|
72
|
-
Whether to push the current Node.js executable's directory ([`execPath`](#execpath) option) to the front of PATH.
|
|
73
|
-
|
|
74
|
-
#### preferLocal
|
|
75
|
-
|
|
76
|
-
Type: `boolean`\
|
|
77
|
-
Default: `true`
|
|
78
|
-
|
|
79
|
-
Whether to push the locally installed binaries' directory to the front of PATH.
|
|
80
|
-
|
|
81
|
-
#### path
|
|
82
|
-
|
|
83
|
-
Type: `string`\
|
|
84
|
-
Default: [`PATH`](https://github.com/sindresorhus/path-key)
|
|
85
|
-
|
|
86
|
-
The PATH to be appended.
|
|
87
|
-
|
|
88
|
-
Set it to an empty string to exclude the default PATH.
|
|
89
|
-
|
|
90
|
-
Only available with [`npmRunPath()`](#npmrunpathoptions), not [`npmRunPathEnv()`](#npmrunpathenvoptions).
|
|
91
|
-
|
|
92
|
-
#### env
|
|
93
|
-
|
|
94
|
-
Type: `object`\
|
|
95
|
-
Default: [`process.env`](https://nodejs.org/api/process.html#processenv)
|
|
96
|
-
|
|
97
|
-
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.
|
|
98
|
-
|
|
99
|
-
Only available with [`npmRunPathEnv()`](#npmrunpathenvoptions), not [`npmRunPath()`](#npmrunpathoptions).
|
|
100
|
-
|
|
101
|
-
## Related
|
|
102
|
-
|
|
103
|
-
- [npm-run-path-cli](https://github.com/sindresorhus/npm-run-path-cli) - CLI for this module
|
|
104
|
-
- [execa](https://github.com/sindresorhus/execa) - Execute a locally installed binary
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
export interface Options {
|
|
2
|
-
/**
|
|
3
|
-
Throw an error when called more than once.
|
|
4
|
-
|
|
5
|
-
@default false
|
|
6
|
-
*/
|
|
7
|
-
readonly throw?: boolean;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
declare const onetime: {
|
|
11
|
-
/**
|
|
12
|
-
Ensure a function is only called once. When called multiple times it will return the return value from the first call.
|
|
13
|
-
|
|
14
|
-
@param fn - Function that should only be called once.
|
|
15
|
-
@returns A function that only calls `fn` once.
|
|
16
|
-
|
|
17
|
-
@example
|
|
18
|
-
```
|
|
19
|
-
import onetime from 'onetime';
|
|
20
|
-
|
|
21
|
-
let index = 0;
|
|
22
|
-
|
|
23
|
-
const foo = onetime(() => ++index);
|
|
24
|
-
|
|
25
|
-
foo(); //=> 1
|
|
26
|
-
foo(); //=> 1
|
|
27
|
-
foo(); //=> 1
|
|
28
|
-
|
|
29
|
-
onetime.callCount(foo); //=> 3
|
|
30
|
-
```
|
|
31
|
-
*/
|
|
32
|
-
<ArgumentsType extends unknown[], ReturnType>(
|
|
33
|
-
fn: (...arguments: ArgumentsType) => ReturnType,
|
|
34
|
-
options?: Options
|
|
35
|
-
): (...arguments: ArgumentsType) => ReturnType;
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
Get the number of times `fn` has been called.
|
|
39
|
-
|
|
40
|
-
@param fn - Function to get call count from.
|
|
41
|
-
@returns A number representing how many times `fn` has been called.
|
|
42
|
-
|
|
43
|
-
@example
|
|
44
|
-
```
|
|
45
|
-
import onetime from 'onetime';
|
|
46
|
-
|
|
47
|
-
const foo = onetime(() => {});
|
|
48
|
-
foo();
|
|
49
|
-
foo();
|
|
50
|
-
foo();
|
|
51
|
-
|
|
52
|
-
console.log(onetime.callCount(foo));
|
|
53
|
-
//=> 3
|
|
54
|
-
```
|
|
55
|
-
*/
|
|
56
|
-
callCount(fn: (...arguments: any[]) => unknown): number;
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
export default onetime;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import mimicFunction from 'mimic-fn';
|
|
2
|
-
|
|
3
|
-
const calledFunctions = new WeakMap();
|
|
4
|
-
|
|
5
|
-
const onetime = (function_, options = {}) => {
|
|
6
|
-
if (typeof function_ !== 'function') {
|
|
7
|
-
throw new TypeError('Expected a function');
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
let returnValue;
|
|
11
|
-
let callCount = 0;
|
|
12
|
-
const functionName = function_.displayName || function_.name || '<anonymous>';
|
|
13
|
-
|
|
14
|
-
const onetime = function (...arguments_) {
|
|
15
|
-
calledFunctions.set(onetime, ++callCount);
|
|
16
|
-
|
|
17
|
-
if (callCount === 1) {
|
|
18
|
-
returnValue = function_.apply(this, arguments_);
|
|
19
|
-
function_ = null;
|
|
20
|
-
} else if (options.throw === true) {
|
|
21
|
-
throw new Error(`Function \`${functionName}\` can only be called once`);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return returnValue;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
mimicFunction(onetime, function_);
|
|
28
|
-
calledFunctions.set(onetime, callCount);
|
|
29
|
-
|
|
30
|
-
return onetime;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
onetime.callCount = function_ => {
|
|
34
|
-
if (!calledFunctions.has(function_)) {
|
|
35
|
-
throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return calledFunctions.get(function_);
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export default onetime;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
4
|
-
|
|
5
|
-
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:
|
|
6
|
-
|
|
7
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
-
|
|
9
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "onetime",
|
|
3
|
-
"version": "6.0.0",
|
|
4
|
-
"description": "Ensure a function is only called once",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"repository": "sindresorhus/onetime",
|
|
7
|
-
"funding": "https://github.com/sponsors/sindresorhus",
|
|
8
|
-
"author": {
|
|
9
|
-
"name": "Sindre Sorhus",
|
|
10
|
-
"email": "sindresorhus@gmail.com",
|
|
11
|
-
"url": "https://sindresorhus.com"
|
|
12
|
-
},
|
|
13
|
-
"type": "module",
|
|
14
|
-
"exports": "./index.js",
|
|
15
|
-
"engines": {
|
|
16
|
-
"node": ">=12"
|
|
17
|
-
},
|
|
18
|
-
"scripts": {
|
|
19
|
-
"test": "xo && ava && tsd"
|
|
20
|
-
},
|
|
21
|
-
"files": [
|
|
22
|
-
"index.js",
|
|
23
|
-
"index.d.ts"
|
|
24
|
-
],
|
|
25
|
-
"keywords": [
|
|
26
|
-
"once",
|
|
27
|
-
"function",
|
|
28
|
-
"one",
|
|
29
|
-
"onetime",
|
|
30
|
-
"func",
|
|
31
|
-
"fn",
|
|
32
|
-
"single",
|
|
33
|
-
"call",
|
|
34
|
-
"called",
|
|
35
|
-
"prevent"
|
|
36
|
-
],
|
|
37
|
-
"dependencies": {
|
|
38
|
-
"mimic-fn": "^4.0.0"
|
|
39
|
-
},
|
|
40
|
-
"devDependencies": {
|
|
41
|
-
"ava": "^3.15.0",
|
|
42
|
-
"tsd": "^0.14.0",
|
|
43
|
-
"xo": "^0.38.2"
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
# onetime
|
|
2
|
-
|
|
3
|
-
> Ensure a function is only called once
|
|
4
|
-
|
|
5
|
-
When called multiple times it will return the return value from the first call.
|
|
6
|
-
|
|
7
|
-
*Unlike the module [once](https://github.com/isaacs/once), this one isn't naughty and extending `Function.prototype`.*
|
|
8
|
-
|
|
9
|
-
## Install
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
$ npm install onetime
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## Usage
|
|
16
|
-
|
|
17
|
-
```js
|
|
18
|
-
import onetime from 'onetime';
|
|
19
|
-
|
|
20
|
-
let index = 0;
|
|
21
|
-
|
|
22
|
-
const foo = onetime(() => ++index);
|
|
23
|
-
|
|
24
|
-
foo(); //=> 1
|
|
25
|
-
foo(); //=> 1
|
|
26
|
-
foo(); //=> 1
|
|
27
|
-
|
|
28
|
-
onetime.callCount(foo); //=> 3
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
```js
|
|
32
|
-
import onetime from 'onetime';
|
|
33
|
-
|
|
34
|
-
const foo = onetime(() => {}, {throw: true});
|
|
35
|
-
|
|
36
|
-
foo();
|
|
37
|
-
|
|
38
|
-
foo();
|
|
39
|
-
//=> Error: Function `foo` can only be called once
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
## API
|
|
43
|
-
|
|
44
|
-
### onetime(fn, options?)
|
|
45
|
-
|
|
46
|
-
Returns a function that only calls `fn` once.
|
|
47
|
-
|
|
48
|
-
#### fn
|
|
49
|
-
|
|
50
|
-
Type: `Function`
|
|
51
|
-
|
|
52
|
-
Function that should only be called once.
|
|
53
|
-
|
|
54
|
-
#### options
|
|
55
|
-
|
|
56
|
-
Type: `object`
|
|
57
|
-
|
|
58
|
-
##### throw
|
|
59
|
-
|
|
60
|
-
Type: `boolean`\
|
|
61
|
-
Default: `false`
|
|
62
|
-
|
|
63
|
-
Throw an error when called more than once.
|
|
64
|
-
|
|
65
|
-
### onetime.callCount(fn)
|
|
66
|
-
|
|
67
|
-
Returns a number representing how many times `fn` has been called.
|
|
68
|
-
|
|
69
|
-
Note: It throws an error if you pass in a function that is not wrapped by `onetime`.
|
|
70
|
-
|
|
71
|
-
```js
|
|
72
|
-
import onetime from 'onetime';
|
|
73
|
-
|
|
74
|
-
const foo = onetime(() => {});
|
|
75
|
-
|
|
76
|
-
foo();
|
|
77
|
-
foo();
|
|
78
|
-
foo();
|
|
79
|
-
|
|
80
|
-
console.log(onetime.callCount(foo));
|
|
81
|
-
//=> 3
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
#### fn
|
|
85
|
-
|
|
86
|
-
Type: `Function`
|
|
87
|
-
|
|
88
|
-
Function to get call count from.
|
|
89
|
-
|
|
90
|
-
## onetime for enterprise
|
|
91
|
-
|
|
92
|
-
Available as part of the Tidelift Subscription.
|
|
93
|
-
|
|
94
|
-
The maintainers of onetime and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-onetime?utm_source=npm-onetime&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
export interface Options {
|
|
2
|
-
/**
|
|
3
|
-
Use a custom environment variables object.
|
|
4
|
-
|
|
5
|
-
Default: [`process.env`](https://nodejs.org/api/process.html#process_process_env).
|
|
6
|
-
*/
|
|
7
|
-
readonly env?: Record<string, string | undefined>;
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
Get the PATH key for a specific platform.
|
|
11
|
-
|
|
12
|
-
Default: [`process.platform`](https://nodejs.org/api/process.html#process_process_platform).
|
|
13
|
-
*/
|
|
14
|
-
readonly platform?: NodeJS.Platform;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
Get the [PATH](https://en.wikipedia.org/wiki/PATH_(variable)) environment variable key cross-platform.
|
|
19
|
-
|
|
20
|
-
@example
|
|
21
|
-
```
|
|
22
|
-
import pathKey from 'path-key';
|
|
23
|
-
|
|
24
|
-
const key = pathKey();
|
|
25
|
-
//=> 'PATH'
|
|
26
|
-
|
|
27
|
-
const PATH = process.env[key];
|
|
28
|
-
//=> '/usr/local/bin:/usr/bin:/bin'
|
|
29
|
-
```
|
|
30
|
-
*/
|
|
31
|
-
export default function pathKey(options?: Options): string;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export default function pathKey(options = {}) {
|
|
2
|
-
const {
|
|
3
|
-
env = process.env,
|
|
4
|
-
platform = process.platform
|
|
5
|
-
} = options;
|
|
6
|
-
|
|
7
|
-
if (platform !== 'win32') {
|
|
8
|
-
return 'PATH';
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
return Object.keys(env).reverse().find(key => key.toUpperCase() === 'PATH') || 'Path';
|
|
12
|
-
}
|