@mrgrain/cdk-esbuild 4.0.0-alpha.5 → 4.0.0-alpha.8

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.
@@ -1,52 +0,0 @@
1
- #!/usr/bin/env node
2
- var which = require("../")
3
- if (process.argv.length < 3)
4
- usage()
5
-
6
- function usage () {
7
- console.error('usage: which [-as] program ...')
8
- process.exit(1)
9
- }
10
-
11
- var all = false
12
- var silent = false
13
- var dashdash = false
14
- var args = process.argv.slice(2).filter(function (arg) {
15
- if (dashdash || !/^-/.test(arg))
16
- return true
17
-
18
- if (arg === '--') {
19
- dashdash = true
20
- return false
21
- }
22
-
23
- var flags = arg.substr(1).split('')
24
- for (var f = 0; f < flags.length; f++) {
25
- var flag = flags[f]
26
- switch (flag) {
27
- case 's':
28
- silent = true
29
- break
30
- case 'a':
31
- all = true
32
- break
33
- default:
34
- console.error('which: illegal option -- ' + flag)
35
- usage()
36
- }
37
- }
38
- return false
39
- })
40
-
41
- process.exit(args.reduce(function (pv, current) {
42
- try {
43
- var f = which.sync(current, { all: all })
44
- if (all)
45
- f = f.join('\n')
46
- if (!silent)
47
- console.log(f)
48
- return pv;
49
- } catch (e) {
50
- return 1;
51
- }
52
- }, 0))
@@ -1,47 +0,0 @@
1
- {
2
- "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me)",
3
- "name": "which",
4
- "description": "Like which(1) unix command. Find the first instance of an executable in the PATH.",
5
- "version": "2.0.2",
6
- "repository": {
7
- "type": "git",
8
- "url": "git://github.com/isaacs/node-which.git"
9
- },
10
- "main": "which.js",
11
- "bin": {
12
- "node-which": "./bin/node-which"
13
- },
14
- "license": "ISC",
15
- "dependencies": {
16
- "isexe": "^2.0.0"
17
- },
18
- "devDependencies": {
19
- "mkdirp": "^0.5.0",
20
- "rimraf": "^2.6.2",
21
- "tap": "^14.6.9"
22
- },
23
- "scripts": {
24
- "test": "tap",
25
- "preversion": "npm test",
26
- "postversion": "npm publish",
27
- "prepublish": "npm run changelog",
28
- "prechangelog": "bash gen-changelog.sh",
29
- "changelog": "git add CHANGELOG.md",
30
- "postchangelog": "git commit -m 'update changelog - '${npm_package_version}",
31
- "postpublish": "git push origin --follow-tags"
32
- },
33
- "files": [
34
- "which.js",
35
- "bin/node-which"
36
- ],
37
- "tap": {
38
- "check-coverage": true
39
- },
40
- "engines": {
41
- "node": ">= 8"
42
- }
43
-
44
- ,"_resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz"
45
- ,"_integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA=="
46
- ,"_from": "which@2.0.2"
47
- }
@@ -1,125 +0,0 @@
1
- const isWindows = process.platform === 'win32' ||
2
- process.env.OSTYPE === 'cygwin' ||
3
- process.env.OSTYPE === 'msys'
4
-
5
- const path = require('path')
6
- const COLON = isWindows ? ';' : ':'
7
- const isexe = require('isexe')
8
-
9
- const getNotFoundError = (cmd) =>
10
- Object.assign(new Error(`not found: ${cmd}`), { code: 'ENOENT' })
11
-
12
- const getPathInfo = (cmd, opt) => {
13
- const colon = opt.colon || COLON
14
-
15
- // If it has a slash, then we don't bother searching the pathenv.
16
- // just check the file itself, and that's it.
17
- const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? ['']
18
- : (
19
- [
20
- // windows always checks the cwd first
21
- ...(isWindows ? [process.cwd()] : []),
22
- ...(opt.path || process.env.PATH ||
23
- /* istanbul ignore next: very unusual */ '').split(colon),
24
- ]
25
- )
26
- const pathExtExe = isWindows
27
- ? opt.pathExt || process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM'
28
- : ''
29
- const pathExt = isWindows ? pathExtExe.split(colon) : ['']
30
-
31
- if (isWindows) {
32
- if (cmd.indexOf('.') !== -1 && pathExt[0] !== '')
33
- pathExt.unshift('')
34
- }
35
-
36
- return {
37
- pathEnv,
38
- pathExt,
39
- pathExtExe,
40
- }
41
- }
42
-
43
- const which = (cmd, opt, cb) => {
44
- if (typeof opt === 'function') {
45
- cb = opt
46
- opt = {}
47
- }
48
- if (!opt)
49
- opt = {}
50
-
51
- const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt)
52
- const found = []
53
-
54
- const step = i => new Promise((resolve, reject) => {
55
- if (i === pathEnv.length)
56
- return opt.all && found.length ? resolve(found)
57
- : reject(getNotFoundError(cmd))
58
-
59
- const ppRaw = pathEnv[i]
60
- const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw
61
-
62
- const pCmd = path.join(pathPart, cmd)
63
- const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd
64
- : pCmd
65
-
66
- resolve(subStep(p, i, 0))
67
- })
68
-
69
- const subStep = (p, i, ii) => new Promise((resolve, reject) => {
70
- if (ii === pathExt.length)
71
- return resolve(step(i + 1))
72
- const ext = pathExt[ii]
73
- isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
74
- if (!er && is) {
75
- if (opt.all)
76
- found.push(p + ext)
77
- else
78
- return resolve(p + ext)
79
- }
80
- return resolve(subStep(p, i, ii + 1))
81
- })
82
- })
83
-
84
- return cb ? step(0).then(res => cb(null, res), cb) : step(0)
85
- }
86
-
87
- const whichSync = (cmd, opt) => {
88
- opt = opt || {}
89
-
90
- const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt)
91
- const found = []
92
-
93
- for (let i = 0; i < pathEnv.length; i ++) {
94
- const ppRaw = pathEnv[i]
95
- const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw
96
-
97
- const pCmd = path.join(pathPart, cmd)
98
- const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd
99
- : pCmd
100
-
101
- for (let j = 0; j < pathExt.length; j ++) {
102
- const cur = p + pathExt[j]
103
- try {
104
- const is = isexe.sync(cur, { pathExt: pathExtExe })
105
- if (is) {
106
- if (opt.all)
107
- found.push(cur)
108
- else
109
- return cur
110
- }
111
- } catch (ex) {}
112
- }
113
- }
114
-
115
- if (opt.all && found.length)
116
- return found
117
-
118
- if (opt.nothrow)
119
- return null
120
-
121
- throw getNotFoundError(cmd)
122
- }
123
-
124
- module.exports = which
125
- which.sync = whichSync