serverless-spy 0.0.41 → 0.0.42

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.
Files changed (63) hide show
  1. package/.jsii +2 -3
  2. package/cli/cli.ts +53 -12
  3. package/cli/package.json +1 -4
  4. package/dist/releasetag.txt +1 -1
  5. package/lib/cli/cli.js +37 -13
  6. package/lib/cli/cli.mjs +37 -13
  7. package/lib/cli/cli.ts +53 -12
  8. package/lib/cli/package.json +1 -4
  9. package/lib/src/ServerlessSpy.js +1 -1
  10. package/package.json +1 -3
  11. package/node_modules/expand-tilde/LICENSE +0 -21
  12. package/node_modules/expand-tilde/README.md +0 -80
  13. package/node_modules/expand-tilde/index.js +0 -22
  14. package/node_modules/expand-tilde/package.json +0 -67
  15. package/node_modules/get-installed-path/CHANGELOG.md +0 -99
  16. package/node_modules/get-installed-path/LICENSE +0 -21
  17. package/node_modules/get-installed-path/README.md +0 -282
  18. package/node_modules/get-installed-path/dist/index.es.js +0 -181
  19. package/node_modules/get-installed-path/dist/index.js +0 -188
  20. package/node_modules/get-installed-path/package.json +0 -101
  21. package/node_modules/global-modules/LICENSE +0 -21
  22. package/node_modules/global-modules/README.md +0 -75
  23. package/node_modules/global-modules/index.js +0 -31
  24. package/node_modules/global-modules/package.json +0 -72
  25. package/node_modules/global-prefix/LICENSE +0 -21
  26. package/node_modules/global-prefix/README.md +0 -78
  27. package/node_modules/global-prefix/index.js +0 -96
  28. package/node_modules/global-prefix/node_modules/which/CHANGELOG.md +0 -152
  29. package/node_modules/global-prefix/node_modules/which/LICENSE +0 -15
  30. package/node_modules/global-prefix/node_modules/which/README.md +0 -51
  31. package/node_modules/global-prefix/node_modules/which/bin/which +0 -52
  32. package/node_modules/global-prefix/node_modules/which/package.json +0 -30
  33. package/node_modules/global-prefix/node_modules/which/which.js +0 -135
  34. package/node_modules/global-prefix/package.json +0 -75
  35. package/node_modules/homedir-polyfill/LICENSE +0 -21
  36. package/node_modules/homedir-polyfill/README.md +0 -96
  37. package/node_modules/homedir-polyfill/index.js +0 -9
  38. package/node_modules/homedir-polyfill/package.json +0 -62
  39. package/node_modules/homedir-polyfill/polyfill.js +0 -81
  40. package/node_modules/ini/LICENSE +0 -15
  41. package/node_modules/ini/README.md +0 -102
  42. package/node_modules/ini/ini.js +0 -206
  43. package/node_modules/ini/package.json +0 -33
  44. package/node_modules/is-windows/LICENSE +0 -21
  45. package/node_modules/is-windows/README.md +0 -95
  46. package/node_modules/is-windows/index.js +0 -27
  47. package/node_modules/is-windows/package.json +0 -71
  48. package/node_modules/isexe/.npmignore +0 -2
  49. package/node_modules/isexe/LICENSE +0 -15
  50. package/node_modules/isexe/README.md +0 -51
  51. package/node_modules/isexe/index.js +0 -57
  52. package/node_modules/isexe/mode.js +0 -41
  53. package/node_modules/isexe/package.json +0 -31
  54. package/node_modules/isexe/test/basic.js +0 -221
  55. package/node_modules/isexe/windows.js +0 -42
  56. package/node_modules/parse-passwd/LICENSE +0 -21
  57. package/node_modules/parse-passwd/README.md +0 -86
  58. package/node_modules/parse-passwd/index.js +0 -56
  59. package/node_modules/parse-passwd/package.json +0 -55
  60. package/node_modules/resolve-dir/LICENSE +0 -21
  61. package/node_modules/resolve-dir/README.md +0 -88
  62. package/node_modules/resolve-dir/index.js +0 -22
  63. package/node_modules/resolve-dir/package.json +0 -73
@@ -1,102 +0,0 @@
1
- An ini format parser and serializer for node.
2
-
3
- Sections are treated as nested objects. Items before the first
4
- heading are saved on the object directly.
5
-
6
- ## Usage
7
-
8
- Consider an ini-file `config.ini` that looks like this:
9
-
10
- ; this comment is being ignored
11
- scope = global
12
-
13
- [database]
14
- user = dbuser
15
- password = dbpassword
16
- database = use_this_database
17
-
18
- [paths.default]
19
- datadir = /var/lib/data
20
- array[] = first value
21
- array[] = second value
22
- array[] = third value
23
-
24
- You can read, manipulate and write the ini-file like so:
25
-
26
- var fs = require('fs')
27
- , ini = require('ini')
28
-
29
- var config = ini.parse(fs.readFileSync('./config.ini', 'utf-8'))
30
-
31
- config.scope = 'local'
32
- config.database.database = 'use_another_database'
33
- config.paths.default.tmpdir = '/tmp'
34
- delete config.paths.default.datadir
35
- config.paths.default.array.push('fourth value')
36
-
37
- fs.writeFileSync('./config_modified.ini', ini.stringify(config, { section: 'section' }))
38
-
39
- This will result in a file called `config_modified.ini` being written
40
- to the filesystem with the following content:
41
-
42
- [section]
43
- scope=local
44
- [section.database]
45
- user=dbuser
46
- password=dbpassword
47
- database=use_another_database
48
- [section.paths.default]
49
- tmpdir=/tmp
50
- array[]=first value
51
- array[]=second value
52
- array[]=third value
53
- array[]=fourth value
54
-
55
-
56
- ## API
57
-
58
- ### decode(inistring)
59
-
60
- Decode the ini-style formatted `inistring` into a nested object.
61
-
62
- ### parse(inistring)
63
-
64
- Alias for `decode(inistring)`
65
-
66
- ### encode(object, [options])
67
-
68
- Encode the object `object` into an ini-style formatted string. If the
69
- optional parameter `section` is given, then all top-level properties
70
- of the object are put into this section and the `section`-string is
71
- prepended to all sub-sections, see the usage example above.
72
-
73
- The `options` object may contain the following:
74
-
75
- * `section` A string which will be the first `section` in the encoded
76
- ini data. Defaults to none.
77
- * `whitespace` Boolean to specify whether to put whitespace around the
78
- `=` character. By default, whitespace is omitted, to be friendly to
79
- some persnickety old parsers that don't tolerate it well. But some
80
- find that it's more human-readable and pretty with the whitespace.
81
-
82
- For backwards compatibility reasons, if a `string` options is passed
83
- in, then it is assumed to be the `section` value.
84
-
85
- ### stringify(object, [options])
86
-
87
- Alias for `encode(object, [options])`
88
-
89
- ### safe(val)
90
-
91
- Escapes the string `val` such that it is safe to be used as a key or
92
- value in an ini-file. Basically escapes quotes. For example
93
-
94
- ini.safe('"unsafe string"')
95
-
96
- would result in
97
-
98
- "\"unsafe string\""
99
-
100
- ### unsafe(val)
101
-
102
- Unescapes the string `val`
@@ -1,206 +0,0 @@
1
- exports.parse = exports.decode = decode
2
-
3
- exports.stringify = exports.encode = encode
4
-
5
- exports.safe = safe
6
- exports.unsafe = unsafe
7
-
8
- var eol = typeof process !== 'undefined' &&
9
- process.platform === 'win32' ? '\r\n' : '\n'
10
-
11
- function encode (obj, opt) {
12
- var children = []
13
- var out = ''
14
-
15
- if (typeof opt === 'string') {
16
- opt = {
17
- section: opt,
18
- whitespace: false,
19
- }
20
- } else {
21
- opt = opt || {}
22
- opt.whitespace = opt.whitespace === true
23
- }
24
-
25
- var separator = opt.whitespace ? ' = ' : '='
26
-
27
- Object.keys(obj).forEach(function (k, _, __) {
28
- var val = obj[k]
29
- if (val && Array.isArray(val)) {
30
- val.forEach(function (item) {
31
- out += safe(k + '[]') + separator + safe(item) + '\n'
32
- })
33
- } else if (val && typeof val === 'object')
34
- children.push(k)
35
- else
36
- out += safe(k) + separator + safe(val) + eol
37
- })
38
-
39
- if (opt.section && out.length)
40
- out = '[' + safe(opt.section) + ']' + eol + out
41
-
42
- children.forEach(function (k, _, __) {
43
- var nk = dotSplit(k).join('\\.')
44
- var section = (opt.section ? opt.section + '.' : '') + nk
45
- var child = encode(obj[k], {
46
- section: section,
47
- whitespace: opt.whitespace,
48
- })
49
- if (out.length && child.length)
50
- out += eol
51
-
52
- out += child
53
- })
54
-
55
- return out
56
- }
57
-
58
- function dotSplit (str) {
59
- return str.replace(/\1/g, '\u0002LITERAL\\1LITERAL\u0002')
60
- .replace(/\\\./g, '\u0001')
61
- .split(/\./).map(function (part) {
62
- return part.replace(/\1/g, '\\.')
63
- .replace(/\2LITERAL\\1LITERAL\2/g, '\u0001')
64
- })
65
- }
66
-
67
- function decode (str) {
68
- var out = {}
69
- var p = out
70
- var section = null
71
- // section |key = value
72
- var re = /^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i
73
- var lines = str.split(/[\r\n]+/g)
74
-
75
- lines.forEach(function (line, _, __) {
76
- if (!line || line.match(/^\s*[;#]/))
77
- return
78
- var match = line.match(re)
79
- if (!match)
80
- return
81
- if (match[1] !== undefined) {
82
- section = unsafe(match[1])
83
- if (section === '__proto__') {
84
- // not allowed
85
- // keep parsing the section, but don't attach it.
86
- p = {}
87
- return
88
- }
89
- p = out[section] = out[section] || {}
90
- return
91
- }
92
- var key = unsafe(match[2])
93
- if (key === '__proto__')
94
- return
95
- var value = match[3] ? unsafe(match[4]) : true
96
- switch (value) {
97
- case 'true':
98
- case 'false':
99
- case 'null': value = JSON.parse(value)
100
- }
101
-
102
- // Convert keys with '[]' suffix to an array
103
- if (key.length > 2 && key.slice(-2) === '[]') {
104
- key = key.substring(0, key.length - 2)
105
- if (key === '__proto__')
106
- return
107
- if (!p[key])
108
- p[key] = []
109
- else if (!Array.isArray(p[key]))
110
- p[key] = [p[key]]
111
- }
112
-
113
- // safeguard against resetting a previously defined
114
- // array by accidentally forgetting the brackets
115
- if (Array.isArray(p[key]))
116
- p[key].push(value)
117
- else
118
- p[key] = value
119
- })
120
-
121
- // {a:{y:1},"a.b":{x:2}} --> {a:{y:1,b:{x:2}}}
122
- // use a filter to return the keys that have to be deleted.
123
- Object.keys(out).filter(function (k, _, __) {
124
- if (!out[k] ||
125
- typeof out[k] !== 'object' ||
126
- Array.isArray(out[k]))
127
- return false
128
-
129
- // see if the parent section is also an object.
130
- // if so, add it to that, and mark this one for deletion
131
- var parts = dotSplit(k)
132
- var p = out
133
- var l = parts.pop()
134
- var nl = l.replace(/\\\./g, '.')
135
- parts.forEach(function (part, _, __) {
136
- if (part === '__proto__')
137
- return
138
- if (!p[part] || typeof p[part] !== 'object')
139
- p[part] = {}
140
- p = p[part]
141
- })
142
- if (p === out && nl === l)
143
- return false
144
-
145
- p[nl] = out[k]
146
- return true
147
- }).forEach(function (del, _, __) {
148
- delete out[del]
149
- })
150
-
151
- return out
152
- }
153
-
154
- function isQuoted (val) {
155
- return (val.charAt(0) === '"' && val.slice(-1) === '"') ||
156
- (val.charAt(0) === "'" && val.slice(-1) === "'")
157
- }
158
-
159
- function safe (val) {
160
- return (typeof val !== 'string' ||
161
- val.match(/[=\r\n]/) ||
162
- val.match(/^\[/) ||
163
- (val.length > 1 &&
164
- isQuoted(val)) ||
165
- val !== val.trim())
166
- ? JSON.stringify(val)
167
- : val.replace(/;/g, '\\;').replace(/#/g, '\\#')
168
- }
169
-
170
- function unsafe (val, doUnesc) {
171
- val = (val || '').trim()
172
- if (isQuoted(val)) {
173
- // remove the single quotes before calling JSON.parse
174
- if (val.charAt(0) === "'")
175
- val = val.substr(1, val.length - 2)
176
-
177
- try {
178
- val = JSON.parse(val)
179
- } catch (_) {}
180
- } else {
181
- // walk the val to find the first not-escaped ; character
182
- var esc = false
183
- var unesc = ''
184
- for (var i = 0, l = val.length; i < l; i++) {
185
- var c = val.charAt(i)
186
- if (esc) {
187
- if ('\\;#'.indexOf(c) !== -1)
188
- unesc += c
189
- else
190
- unesc += '\\' + c
191
-
192
- esc = false
193
- } else if (';#'.indexOf(c) !== -1)
194
- break
195
- else if (c === '\\')
196
- esc = true
197
- else
198
- unesc += c
199
- }
200
- if (esc)
201
- unesc += '\\'
202
-
203
- return unesc.trim()
204
- }
205
- return val
206
- }
@@ -1,33 +0,0 @@
1
- {
2
- "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
3
- "name": "ini",
4
- "description": "An ini encoder/decoder for node",
5
- "version": "1.3.8",
6
- "repository": {
7
- "type": "git",
8
- "url": "git://github.com/isaacs/ini.git"
9
- },
10
- "main": "ini.js",
11
- "scripts": {
12
- "eslint": "eslint",
13
- "lint": "npm run eslint -- ini.js test/*.js",
14
- "lintfix": "npm run lint -- --fix",
15
- "test": "tap",
16
- "posttest": "npm run lint",
17
- "preversion": "npm test",
18
- "postversion": "npm publish",
19
- "prepublishOnly": "git push origin --follow-tags"
20
- },
21
- "devDependencies": {
22
- "eslint": "^7.9.0",
23
- "eslint-plugin-import": "^2.22.0",
24
- "eslint-plugin-node": "^11.1.0",
25
- "eslint-plugin-promise": "^4.2.1",
26
- "eslint-plugin-standard": "^4.0.1",
27
- "tap": "14"
28
- },
29
- "license": "ISC",
30
- "files": [
31
- "ini.js"
32
- ]
33
- }
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2015-2018, Jon Schlinkert.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
@@ -1,95 +0,0 @@
1
- # is-windows [![NPM version](https://img.shields.io/npm/v/is-windows.svg?style=flat)](https://www.npmjs.com/package/is-windows) [![NPM monthly downloads](https://img.shields.io/npm/dm/is-windows.svg?style=flat)](https://npmjs.org/package/is-windows) [![NPM total downloads](https://img.shields.io/npm/dt/is-windows.svg?style=flat)](https://npmjs.org/package/is-windows) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/is-windows.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/is-windows)
2
-
3
- > Returns true if the platform is windows. UMD module, works with node.js, commonjs, browser, AMD, electron, etc.
4
-
5
- Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.
6
-
7
- ## Install
8
-
9
- Install with [npm](https://www.npmjs.com/):
10
-
11
- ```sh
12
- $ npm install --save is-windows
13
- ```
14
-
15
- ## Heads up!
16
-
17
- As of `v0.2.0` this module always returns a function.
18
-
19
- ## Node.js usage
20
-
21
- ```js
22
- var isWindows = require('is-windows');
23
-
24
- console.log(isWindows());
25
- //=> returns true if the platform is windows
26
- ```
27
-
28
- ## About
29
-
30
- <details>
31
- <summary><strong>Contributing</strong></summary>
32
-
33
- Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
34
-
35
- </details>
36
-
37
- <details>
38
- <summary><strong>Running Tests</strong></summary>
39
-
40
- Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
41
-
42
- ```sh
43
- $ npm install && npm test
44
- ```
45
-
46
- </details>
47
-
48
- <details>
49
- <summary><strong>Building docs</strong></summary>
50
-
51
- _(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
52
-
53
- To generate the readme, run the following command:
54
-
55
- ```sh
56
- $ npm install -g verbose/verb#dev verb-generate-readme && verb
57
- ```
58
-
59
- </details>
60
-
61
- ### Related projects
62
-
63
- You might also be interested in these projects:
64
-
65
- * [is-absolute](https://www.npmjs.com/package/is-absolute): Returns true if a file path is absolute. Does not rely on the path module… [more](https://github.com/jonschlinkert/is-absolute) | [homepage](https://github.com/jonschlinkert/is-absolute "Returns true if a file path is absolute. Does not rely on the path module and can be used as a polyfill for node.js native `path.isAbolute`.")
66
- * [is-glob](https://www.npmjs.com/package/is-glob): Returns `true` if the given string looks like a glob pattern or an extglob pattern… [more](https://github.com/jonschlinkert/is-glob) | [homepage](https://github.com/jonschlinkert/is-glob "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a bet")
67
- * [is-relative](https://www.npmjs.com/package/is-relative): Returns `true` if the path appears to be relative. | [homepage](https://github.com/jonschlinkert/is-relative "Returns `true` if the path appears to be relative.")
68
- * [isobject](https://www.npmjs.com/package/isobject): Returns true if the value is an object and not an array or null. | [homepage](https://github.com/jonschlinkert/isobject "Returns true if the value is an object and not an array or null.")
69
- * [window-size](https://www.npmjs.com/package/window-size): Reliable way to get the height and width of terminal/console, since it's not calculated or… [more](https://github.com/jonschlinkert/window-size) | [homepage](https://github.com/jonschlinkert/window-size "Reliable way to get the height and width of terminal/console, since it's not calculated or updated the same way on all platforms, environments and node.js versions.")
70
-
71
- ### Contributors
72
-
73
- | **Commits** | **Contributor** |
74
- | --- | --- |
75
- | 11 | [jonschlinkert](https://github.com/jonschlinkert) |
76
- | 4 | [doowb](https://github.com/doowb) |
77
- | 1 | [SimenB](https://github.com/SimenB) |
78
- | 1 | [gucong3000](https://github.com/gucong3000) |
79
-
80
- ### Author
81
-
82
- **Jon Schlinkert**
83
-
84
- * [linkedin/in/jonschlinkert](https://linkedin.com/in/jonschlinkert)
85
- * [github/jonschlinkert](https://github.com/jonschlinkert)
86
- * [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
87
-
88
- ### License
89
-
90
- Copyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert).
91
- Released under the [MIT License](LICENSE).
92
-
93
- ***
94
-
95
- _This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on February 14, 2018._
@@ -1,27 +0,0 @@
1
- /*!
2
- * is-windows <https://github.com/jonschlinkert/is-windows>
3
- *
4
- * Copyright © 2015-2018, Jon Schlinkert.
5
- * Released under the MIT License.
6
- */
7
-
8
- (function(factory) {
9
- if (exports && typeof exports === 'object' && typeof module !== 'undefined') {
10
- module.exports = factory();
11
- } else if (typeof define === 'function' && define.amd) {
12
- define([], factory);
13
- } else if (typeof window !== 'undefined') {
14
- window.isWindows = factory();
15
- } else if (typeof global !== 'undefined') {
16
- global.isWindows = factory();
17
- } else if (typeof self !== 'undefined') {
18
- self.isWindows = factory();
19
- } else {
20
- this.isWindows = factory();
21
- }
22
- })(function() {
23
- 'use strict';
24
- return function isWindows() {
25
- return process && (process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE));
26
- };
27
- });
@@ -1,71 +0,0 @@
1
- {
2
- "name": "is-windows",
3
- "description": "Returns true if the platform is windows. UMD module, works with node.js, commonjs, browser, AMD, electron, etc.",
4
- "version": "1.0.2",
5
- "homepage": "https://github.com/jonschlinkert/is-windows",
6
- "author": "Jon Schlinkert (https://github.com/jonschlinkert)",
7
- "contributors": [
8
- "Jon Schlinkert (http://twitter.com/jonschlinkert)",
9
- "Simen Bekkhus (https://github.com/SimenB)",
10
- "刘祺 (gucong.co.cc)"
11
- ],
12
- "repository": "jonschlinkert/is-windows",
13
- "bugs": {
14
- "url": "https://github.com/jonschlinkert/is-windows/issues"
15
- },
16
- "license": "MIT",
17
- "files": [
18
- "index.js"
19
- ],
20
- "main": "index.js",
21
- "engines": {
22
- "node": ">=0.10.0"
23
- },
24
- "scripts": {
25
- "test": "mocha"
26
- },
27
- "devDependencies": {
28
- "gulp-format-md": "^1.0.0",
29
- "mocha": "^3.5.3"
30
- },
31
- "keywords": [
32
- "check",
33
- "cywin",
34
- "is",
35
- "is-windows",
36
- "nix",
37
- "operating system",
38
- "os",
39
- "platform",
40
- "process",
41
- "unix",
42
- "win",
43
- "win32",
44
- "windows"
45
- ],
46
- "verb": {
47
- "toc": false,
48
- "layout": "default",
49
- "tasks": [
50
- "readme"
51
- ],
52
- "plugins": [
53
- "gulp-format-md"
54
- ],
55
- "related": {
56
- "list": [
57
- "is-absolute",
58
- "is-glob",
59
- "is-relative",
60
- "isobject",
61
- "window-size"
62
- ]
63
- },
64
- "lint": {
65
- "reflinks": true
66
- },
67
- "reflinks": [
68
- "verb"
69
- ]
70
- }
71
- }
@@ -1,2 +0,0 @@
1
- .nyc_output/
2
- coverage/
@@ -1,15 +0,0 @@
1
- The ISC License
2
-
3
- Copyright (c) Isaac Z. Schlueter and Contributors
4
-
5
- Permission to use, copy, modify, and/or distribute this software for any
6
- purpose with or without fee is hereby granted, provided that the above
7
- copyright notice and this permission notice appear in all copies.
8
-
9
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
15
- IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
@@ -1,51 +0,0 @@
1
- # isexe
2
-
3
- Minimal module to check if a file is executable, and a normal file.
4
-
5
- Uses `fs.stat` and tests against the `PATHEXT` environment variable on
6
- Windows.
7
-
8
- ## USAGE
9
-
10
- ```javascript
11
- var isexe = require('isexe')
12
- isexe('some-file-name', function (err, isExe) {
13
- if (err) {
14
- console.error('probably file does not exist or something', err)
15
- } else if (isExe) {
16
- console.error('this thing can be run')
17
- } else {
18
- console.error('cannot be run')
19
- }
20
- })
21
-
22
- // same thing but synchronous, throws errors
23
- var isExe = isexe.sync('some-file-name')
24
-
25
- // treat errors as just "not executable"
26
- isexe('maybe-missing-file', { ignoreErrors: true }, callback)
27
- var isExe = isexe.sync('maybe-missing-file', { ignoreErrors: true })
28
- ```
29
-
30
- ## API
31
-
32
- ### `isexe(path, [options], [callback])`
33
-
34
- Check if the path is executable. If no callback provided, and a
35
- global `Promise` object is available, then a Promise will be returned.
36
-
37
- Will raise whatever errors may be raised by `fs.stat`, unless
38
- `options.ignoreErrors` is set to true.
39
-
40
- ### `isexe.sync(path, [options])`
41
-
42
- Same as `isexe` but returns the value and throws any errors raised.
43
-
44
- ### Options
45
-
46
- * `ignoreErrors` Treat all errors as "no, this is not executable", but
47
- don't raise them.
48
- * `uid` Number to use as the user id
49
- * `gid` Number to use as the group id
50
- * `pathExt` List of path extensions to use instead of `PATHEXT`
51
- environment variable on Windows.
@@ -1,57 +0,0 @@
1
- var fs = require('fs')
2
- var core
3
- if (process.platform === 'win32' || global.TESTING_WINDOWS) {
4
- core = require('./windows.js')
5
- } else {
6
- core = require('./mode.js')
7
- }
8
-
9
- module.exports = isexe
10
- isexe.sync = sync
11
-
12
- function isexe (path, options, cb) {
13
- if (typeof options === 'function') {
14
- cb = options
15
- options = {}
16
- }
17
-
18
- if (!cb) {
19
- if (typeof Promise !== 'function') {
20
- throw new TypeError('callback not provided')
21
- }
22
-
23
- return new Promise(function (resolve, reject) {
24
- isexe(path, options || {}, function (er, is) {
25
- if (er) {
26
- reject(er)
27
- } else {
28
- resolve(is)
29
- }
30
- })
31
- })
32
- }
33
-
34
- core(path, options || {}, function (er, is) {
35
- // ignore EACCES because that just means we aren't allowed to run it
36
- if (er) {
37
- if (er.code === 'EACCES' || options && options.ignoreErrors) {
38
- er = null
39
- is = false
40
- }
41
- }
42
- cb(er, is)
43
- })
44
- }
45
-
46
- function sync (path, options) {
47
- // my kingdom for a filtered catch
48
- try {
49
- return core.sync(path, options || {})
50
- } catch (er) {
51
- if (options && options.ignoreErrors || er.code === 'EACCES') {
52
- return false
53
- } else {
54
- throw er
55
- }
56
- }
57
- }