@trayai/tray-sync-cli 1.0.13 → 1.0.14
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/dist/api/resources/me.js +14 -0
- package/dist/commands/api/api.js +4 -0
- package/dist/commands/api/login.js +91 -0
- package/dist/commands/api/logout.js +39 -0
- package/dist/commands/api/project.js +2 -2
- package/dist/commands/api/shared.js +10 -4
- package/dist/commands/api/workflow.js +4 -4
- package/dist/lib/apiAuth.js +25 -2
- package/dist/lib/apiSessionStore.js +104 -0
- package/dist/lib/browserOpener.js +24 -0
- package/dist/lib/dotenvEdit.js +31 -0
- package/dist/lib/oauth.js +125 -0
- package/dist/lib/oauthCallbackServer.js +97 -0
- package/dist/lib/oauthRefresh.js +65 -0
- package/dist/lib/region.js +1 -0
- package/node_modules/bundle-name/index.js +5 -0
- package/node_modules/bundle-name/license +9 -0
- package/node_modules/bundle-name/package.json +45 -0
- package/node_modules/bundle-name/readme.md +23 -0
- package/node_modules/default-browser/index.d.ts +29 -0
- package/node_modules/default-browser/index.js +34 -0
- package/node_modules/default-browser/license +9 -0
- package/node_modules/default-browser/package.json +54 -0
- package/node_modules/default-browser/readme.md +24 -0
- package/node_modules/default-browser/windows.js +59 -0
- package/node_modules/default-browser-id/index.js +25 -0
- package/node_modules/default-browser-id/license +9 -0
- package/node_modules/default-browser-id/package.json +41 -0
- package/node_modules/default-browser-id/readme.md +19 -0
- package/node_modules/define-lazy-prop/index.d.ts +31 -0
- package/node_modules/define-lazy-prop/index.js +18 -0
- package/node_modules/define-lazy-prop/license +9 -0
- package/node_modules/define-lazy-prop/package.json +51 -0
- package/node_modules/define-lazy-prop/readme.md +55 -0
- package/node_modules/dotenv/CHANGELOG.md +643 -0
- package/node_modules/dotenv/LICENSE +23 -0
- package/node_modules/dotenv/README-es.md +757 -0
- package/node_modules/dotenv/README.md +812 -0
- package/node_modules/dotenv/SECURITY.md +1 -0
- package/node_modules/dotenv/config.d.ts +1 -0
- package/node_modules/dotenv/config.js +9 -0
- package/node_modules/dotenv/lib/cli-options.js +17 -0
- package/node_modules/dotenv/lib/env-options.js +28 -0
- package/node_modules/dotenv/lib/main.d.ts +179 -0
- package/node_modules/dotenv/lib/main.js +423 -0
- package/node_modules/dotenv/package.json +62 -0
- package/node_modules/dotenv/skills/dotenv/SKILL.md +200 -0
- package/node_modules/dotenv/skills/dotenvx/SKILL.md +118 -0
- package/node_modules/graceful-fs/LICENSE +15 -0
- package/node_modules/graceful-fs/README.md +143 -0
- package/node_modules/graceful-fs/clone.js +23 -0
- package/node_modules/graceful-fs/graceful-fs.js +448 -0
- package/node_modules/graceful-fs/legacy-streams.js +118 -0
- package/node_modules/graceful-fs/package.json +53 -0
- package/node_modules/graceful-fs/polyfills.js +355 -0
- package/node_modules/is-docker/cli.js +5 -0
- package/node_modules/is-docker/index.d.ts +13 -0
- package/node_modules/is-docker/index.js +29 -0
- package/node_modules/is-docker/license +9 -0
- package/node_modules/is-docker/package.json +44 -0
- package/node_modules/is-docker/readme.md +27 -0
- package/node_modules/is-in-ssh/index.d.ts +15 -0
- package/node_modules/is-in-ssh/index.js +7 -0
- package/node_modules/is-in-ssh/license +9 -0
- package/node_modules/is-in-ssh/package.json +43 -0
- package/node_modules/is-in-ssh/readme.md +43 -0
- package/node_modules/is-inside-container/cli.js +5 -0
- package/node_modules/is-inside-container/index.d.ts +13 -0
- package/node_modules/is-inside-container/index.js +23 -0
- package/node_modules/is-inside-container/license +9 -0
- package/node_modules/is-inside-container/package.json +51 -0
- package/node_modules/is-inside-container/readme.md +36 -0
- package/node_modules/is-wsl/index.d.ts +15 -0
- package/node_modules/is-wsl/index.js +36 -0
- package/node_modules/is-wsl/license +9 -0
- package/node_modules/is-wsl/package.json +58 -0
- package/node_modules/is-wsl/readme.md +21 -0
- package/node_modules/open/index.d.ts +158 -0
- package/node_modules/open/index.js +425 -0
- package/node_modules/open/license +9 -0
- package/node_modules/open/package.json +70 -0
- package/node_modules/open/readme.md +197 -0
- package/node_modules/open/xdg-open +1267 -0
- package/node_modules/powershell-utils/index.d.ts +175 -0
- package/node_modules/powershell-utils/index.js +79 -0
- package/node_modules/powershell-utils/license +9 -0
- package/node_modules/powershell-utils/package.json +47 -0
- package/node_modules/powershell-utils/readme.md +209 -0
- package/node_modules/proper-lockfile/CHANGELOG.md +108 -0
- package/node_modules/proper-lockfile/LICENSE +21 -0
- package/node_modules/proper-lockfile/README.md +183 -0
- package/node_modules/proper-lockfile/index.js +40 -0
- package/node_modules/proper-lockfile/lib/adapter.js +85 -0
- package/node_modules/proper-lockfile/lib/lockfile.js +342 -0
- package/node_modules/proper-lockfile/lib/mtime-precision.js +55 -0
- package/node_modules/proper-lockfile/package.json +71 -0
- package/node_modules/retry/.npmignore +3 -0
- package/node_modules/retry/.travis.yml +15 -0
- package/node_modules/retry/License +21 -0
- package/node_modules/retry/Makefile +18 -0
- package/node_modules/retry/README.md +227 -0
- package/node_modules/retry/equation.gif +0 -0
- package/node_modules/retry/example/dns.js +31 -0
- package/node_modules/retry/example/stop.js +40 -0
- package/node_modules/retry/index.js +1 -0
- package/node_modules/retry/lib/retry.js +100 -0
- package/node_modules/retry/lib/retry_operation.js +158 -0
- package/node_modules/retry/package.json +32 -0
- package/node_modules/retry/test/common.js +10 -0
- package/node_modules/retry/test/integration/test-forever.js +24 -0
- package/node_modules/retry/test/integration/test-retry-operation.js +258 -0
- package/node_modules/retry/test/integration/test-retry-wrap.js +101 -0
- package/node_modules/retry/test/integration/test-timeouts.js +69 -0
- package/node_modules/run-applescript/index.d.ts +66 -0
- package/node_modules/run-applescript/index.js +37 -0
- package/node_modules/run-applescript/license +9 -0
- package/node_modules/run-applescript/package.json +42 -0
- package/node_modules/run-applescript/readme.md +78 -0
- package/node_modules/signal-exit/LICENSE.txt +16 -0
- package/node_modules/signal-exit/README.md +39 -0
- package/node_modules/signal-exit/index.js +202 -0
- package/node_modules/signal-exit/package.json +38 -0
- package/node_modules/signal-exit/signals.js +53 -0
- package/node_modules/wsl-utils/index.d.ts +180 -0
- package/node_modules/wsl-utils/index.js +145 -0
- package/node_modules/wsl-utils/license +9 -0
- package/node_modules/wsl-utils/node_modules/powershell-utils/index.d.ts +122 -0
- package/node_modules/wsl-utils/node_modules/powershell-utils/index.js +58 -0
- package/node_modules/wsl-utils/node_modules/powershell-utils/license +9 -0
- package/node_modules/wsl-utils/node_modules/powershell-utils/package.json +47 -0
- package/node_modules/wsl-utils/node_modules/powershell-utils/readme.md +153 -0
- package/node_modules/wsl-utils/package.json +48 -0
- package/node_modules/wsl-utils/readme.md +223 -0
- package/node_modules/wsl-utils/utilities.js +19 -0
- package/package.json +8 -1
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# run-applescript
|
|
2
|
+
|
|
3
|
+
> Run AppleScript and get the result
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install run-applescript
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
import {runAppleScript} from 'run-applescript';
|
|
15
|
+
|
|
16
|
+
const result = await runAppleScript('return "unicorn"');
|
|
17
|
+
|
|
18
|
+
console.log(result);
|
|
19
|
+
//=> 'unicorn'
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## API
|
|
23
|
+
|
|
24
|
+
### runAppleScript(script, options?)
|
|
25
|
+
|
|
26
|
+
Returns a `Promise<string>` with the script result.
|
|
27
|
+
|
|
28
|
+
#### script
|
|
29
|
+
|
|
30
|
+
Type: `string`
|
|
31
|
+
|
|
32
|
+
The script to run.
|
|
33
|
+
|
|
34
|
+
#### options
|
|
35
|
+
|
|
36
|
+
Type: `object`
|
|
37
|
+
|
|
38
|
+
##### humanReadableOutput
|
|
39
|
+
|
|
40
|
+
Type: `boolean`\
|
|
41
|
+
Default: `true`
|
|
42
|
+
|
|
43
|
+
Change the output style.
|
|
44
|
+
|
|
45
|
+
When `false`, returns the value in a [recompilable source form](https://ss64.com/osx/osascript.html).
|
|
46
|
+
|
|
47
|
+
##### signal
|
|
48
|
+
|
|
49
|
+
Type: `AbortSignal`
|
|
50
|
+
|
|
51
|
+
An AbortSignal that can be used to cancel the AppleScript execution.
|
|
52
|
+
|
|
53
|
+
### runAppleScriptSync(script, options?)
|
|
54
|
+
|
|
55
|
+
Returns a `string` with the script result.
|
|
56
|
+
|
|
57
|
+
#### script
|
|
58
|
+
|
|
59
|
+
Type: `string`
|
|
60
|
+
|
|
61
|
+
The script to run.
|
|
62
|
+
|
|
63
|
+
#### options
|
|
64
|
+
|
|
65
|
+
Type: `object`
|
|
66
|
+
|
|
67
|
+
##### humanReadableOutput
|
|
68
|
+
|
|
69
|
+
Type: `boolean`\
|
|
70
|
+
Default: `true`
|
|
71
|
+
|
|
72
|
+
Change the output style.
|
|
73
|
+
|
|
74
|
+
When `false`, returns the value in a [recompilable source form](https://ss64.com/osx/osascript.html).
|
|
75
|
+
|
|
76
|
+
## Related
|
|
77
|
+
|
|
78
|
+
- [run-jxa](https://github.com/sindresorhus/run-jxa) - Run JXA code and get the result
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
The ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2015, Contributors
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software
|
|
6
|
+
for any purpose with or without fee is hereby granted, provided
|
|
7
|
+
that the above copyright notice and this permission notice
|
|
8
|
+
appear in all copies.
|
|
9
|
+
|
|
10
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
11
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
|
|
12
|
+
OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE
|
|
13
|
+
LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
|
|
14
|
+
OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
|
15
|
+
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
|
16
|
+
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# signal-exit
|
|
2
|
+
|
|
3
|
+
[](https://travis-ci.org/tapjs/signal-exit)
|
|
4
|
+
[](https://coveralls.io/r/tapjs/signal-exit?branch=master)
|
|
5
|
+
[](https://www.npmjs.com/package/signal-exit)
|
|
6
|
+
[](https://github.com/conventional-changelog/standard-version)
|
|
7
|
+
|
|
8
|
+
When you want to fire an event no matter how a process exits:
|
|
9
|
+
|
|
10
|
+
* reaching the end of execution.
|
|
11
|
+
* explicitly having `process.exit(code)` called.
|
|
12
|
+
* having `process.kill(pid, sig)` called.
|
|
13
|
+
* receiving a fatal signal from outside the process
|
|
14
|
+
|
|
15
|
+
Use `signal-exit`.
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
var onExit = require('signal-exit')
|
|
19
|
+
|
|
20
|
+
onExit(function (code, signal) {
|
|
21
|
+
console.log('process exited!')
|
|
22
|
+
})
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## API
|
|
26
|
+
|
|
27
|
+
`var remove = onExit(function (code, signal) {}, options)`
|
|
28
|
+
|
|
29
|
+
The return value of the function is a function that will remove the
|
|
30
|
+
handler.
|
|
31
|
+
|
|
32
|
+
Note that the function *only* fires for signals if the signal would
|
|
33
|
+
cause the process to exit. That is, there are no other listeners, and
|
|
34
|
+
it is a fatal signal.
|
|
35
|
+
|
|
36
|
+
## Options
|
|
37
|
+
|
|
38
|
+
* `alwaysLast`: Run this handler after any other signal or exit
|
|
39
|
+
handlers. This causes `process.emit` to be monkeypatched.
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
// Note: since nyc uses this module to output coverage, any lines
|
|
2
|
+
// that are in the direct sync flow of nyc's outputCoverage are
|
|
3
|
+
// ignored, since we can never get coverage for them.
|
|
4
|
+
// grab a reference to node's real process object right away
|
|
5
|
+
var process = global.process
|
|
6
|
+
|
|
7
|
+
const processOk = function (process) {
|
|
8
|
+
return process &&
|
|
9
|
+
typeof process === 'object' &&
|
|
10
|
+
typeof process.removeListener === 'function' &&
|
|
11
|
+
typeof process.emit === 'function' &&
|
|
12
|
+
typeof process.reallyExit === 'function' &&
|
|
13
|
+
typeof process.listeners === 'function' &&
|
|
14
|
+
typeof process.kill === 'function' &&
|
|
15
|
+
typeof process.pid === 'number' &&
|
|
16
|
+
typeof process.on === 'function'
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// some kind of non-node environment, just no-op
|
|
20
|
+
/* istanbul ignore if */
|
|
21
|
+
if (!processOk(process)) {
|
|
22
|
+
module.exports = function () {
|
|
23
|
+
return function () {}
|
|
24
|
+
}
|
|
25
|
+
} else {
|
|
26
|
+
var assert = require('assert')
|
|
27
|
+
var signals = require('./signals.js')
|
|
28
|
+
var isWin = /^win/i.test(process.platform)
|
|
29
|
+
|
|
30
|
+
var EE = require('events')
|
|
31
|
+
/* istanbul ignore if */
|
|
32
|
+
if (typeof EE !== 'function') {
|
|
33
|
+
EE = EE.EventEmitter
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
var emitter
|
|
37
|
+
if (process.__signal_exit_emitter__) {
|
|
38
|
+
emitter = process.__signal_exit_emitter__
|
|
39
|
+
} else {
|
|
40
|
+
emitter = process.__signal_exit_emitter__ = new EE()
|
|
41
|
+
emitter.count = 0
|
|
42
|
+
emitter.emitted = {}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Because this emitter is a global, we have to check to see if a
|
|
46
|
+
// previous version of this library failed to enable infinite listeners.
|
|
47
|
+
// I know what you're about to say. But literally everything about
|
|
48
|
+
// signal-exit is a compromise with evil. Get used to it.
|
|
49
|
+
if (!emitter.infinite) {
|
|
50
|
+
emitter.setMaxListeners(Infinity)
|
|
51
|
+
emitter.infinite = true
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
module.exports = function (cb, opts) {
|
|
55
|
+
/* istanbul ignore if */
|
|
56
|
+
if (!processOk(global.process)) {
|
|
57
|
+
return function () {}
|
|
58
|
+
}
|
|
59
|
+
assert.equal(typeof cb, 'function', 'a callback must be provided for exit handler')
|
|
60
|
+
|
|
61
|
+
if (loaded === false) {
|
|
62
|
+
load()
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
var ev = 'exit'
|
|
66
|
+
if (opts && opts.alwaysLast) {
|
|
67
|
+
ev = 'afterexit'
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
var remove = function () {
|
|
71
|
+
emitter.removeListener(ev, cb)
|
|
72
|
+
if (emitter.listeners('exit').length === 0 &&
|
|
73
|
+
emitter.listeners('afterexit').length === 0) {
|
|
74
|
+
unload()
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
emitter.on(ev, cb)
|
|
78
|
+
|
|
79
|
+
return remove
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
var unload = function unload () {
|
|
83
|
+
if (!loaded || !processOk(global.process)) {
|
|
84
|
+
return
|
|
85
|
+
}
|
|
86
|
+
loaded = false
|
|
87
|
+
|
|
88
|
+
signals.forEach(function (sig) {
|
|
89
|
+
try {
|
|
90
|
+
process.removeListener(sig, sigListeners[sig])
|
|
91
|
+
} catch (er) {}
|
|
92
|
+
})
|
|
93
|
+
process.emit = originalProcessEmit
|
|
94
|
+
process.reallyExit = originalProcessReallyExit
|
|
95
|
+
emitter.count -= 1
|
|
96
|
+
}
|
|
97
|
+
module.exports.unload = unload
|
|
98
|
+
|
|
99
|
+
var emit = function emit (event, code, signal) {
|
|
100
|
+
/* istanbul ignore if */
|
|
101
|
+
if (emitter.emitted[event]) {
|
|
102
|
+
return
|
|
103
|
+
}
|
|
104
|
+
emitter.emitted[event] = true
|
|
105
|
+
emitter.emit(event, code, signal)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// { <signal>: <listener fn>, ... }
|
|
109
|
+
var sigListeners = {}
|
|
110
|
+
signals.forEach(function (sig) {
|
|
111
|
+
sigListeners[sig] = function listener () {
|
|
112
|
+
/* istanbul ignore if */
|
|
113
|
+
if (!processOk(global.process)) {
|
|
114
|
+
return
|
|
115
|
+
}
|
|
116
|
+
// If there are no other listeners, an exit is coming!
|
|
117
|
+
// Simplest way: remove us and then re-send the signal.
|
|
118
|
+
// We know that this will kill the process, so we can
|
|
119
|
+
// safely emit now.
|
|
120
|
+
var listeners = process.listeners(sig)
|
|
121
|
+
if (listeners.length === emitter.count) {
|
|
122
|
+
unload()
|
|
123
|
+
emit('exit', null, sig)
|
|
124
|
+
/* istanbul ignore next */
|
|
125
|
+
emit('afterexit', null, sig)
|
|
126
|
+
/* istanbul ignore next */
|
|
127
|
+
if (isWin && sig === 'SIGHUP') {
|
|
128
|
+
// "SIGHUP" throws an `ENOSYS` error on Windows,
|
|
129
|
+
// so use a supported signal instead
|
|
130
|
+
sig = 'SIGINT'
|
|
131
|
+
}
|
|
132
|
+
/* istanbul ignore next */
|
|
133
|
+
process.kill(process.pid, sig)
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
module.exports.signals = function () {
|
|
139
|
+
return signals
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
var loaded = false
|
|
143
|
+
|
|
144
|
+
var load = function load () {
|
|
145
|
+
if (loaded || !processOk(global.process)) {
|
|
146
|
+
return
|
|
147
|
+
}
|
|
148
|
+
loaded = true
|
|
149
|
+
|
|
150
|
+
// This is the number of onSignalExit's that are in play.
|
|
151
|
+
// It's important so that we can count the correct number of
|
|
152
|
+
// listeners on signals, and don't wait for the other one to
|
|
153
|
+
// handle it instead of us.
|
|
154
|
+
emitter.count += 1
|
|
155
|
+
|
|
156
|
+
signals = signals.filter(function (sig) {
|
|
157
|
+
try {
|
|
158
|
+
process.on(sig, sigListeners[sig])
|
|
159
|
+
return true
|
|
160
|
+
} catch (er) {
|
|
161
|
+
return false
|
|
162
|
+
}
|
|
163
|
+
})
|
|
164
|
+
|
|
165
|
+
process.emit = processEmit
|
|
166
|
+
process.reallyExit = processReallyExit
|
|
167
|
+
}
|
|
168
|
+
module.exports.load = load
|
|
169
|
+
|
|
170
|
+
var originalProcessReallyExit = process.reallyExit
|
|
171
|
+
var processReallyExit = function processReallyExit (code) {
|
|
172
|
+
/* istanbul ignore if */
|
|
173
|
+
if (!processOk(global.process)) {
|
|
174
|
+
return
|
|
175
|
+
}
|
|
176
|
+
process.exitCode = code || /* istanbul ignore next */ 0
|
|
177
|
+
emit('exit', process.exitCode, null)
|
|
178
|
+
/* istanbul ignore next */
|
|
179
|
+
emit('afterexit', process.exitCode, null)
|
|
180
|
+
/* istanbul ignore next */
|
|
181
|
+
originalProcessReallyExit.call(process, process.exitCode)
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
var originalProcessEmit = process.emit
|
|
185
|
+
var processEmit = function processEmit (ev, arg) {
|
|
186
|
+
if (ev === 'exit' && processOk(global.process)) {
|
|
187
|
+
/* istanbul ignore else */
|
|
188
|
+
if (arg !== undefined) {
|
|
189
|
+
process.exitCode = arg
|
|
190
|
+
}
|
|
191
|
+
var ret = originalProcessEmit.apply(this, arguments)
|
|
192
|
+
/* istanbul ignore next */
|
|
193
|
+
emit('exit', process.exitCode, null)
|
|
194
|
+
/* istanbul ignore next */
|
|
195
|
+
emit('afterexit', process.exitCode, null)
|
|
196
|
+
/* istanbul ignore next */
|
|
197
|
+
return ret
|
|
198
|
+
} else {
|
|
199
|
+
return originalProcessEmit.apply(this, arguments)
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "signal-exit",
|
|
3
|
+
"version": "3.0.7",
|
|
4
|
+
"description": "when you want to fire an event no matter how a process exits.",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "tap",
|
|
8
|
+
"snap": "tap",
|
|
9
|
+
"preversion": "npm test",
|
|
10
|
+
"postversion": "npm publish",
|
|
11
|
+
"prepublishOnly": "git push origin --follow-tags"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"index.js",
|
|
15
|
+
"signals.js"
|
|
16
|
+
],
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "https://github.com/tapjs/signal-exit.git"
|
|
20
|
+
},
|
|
21
|
+
"keywords": [
|
|
22
|
+
"signal",
|
|
23
|
+
"exit"
|
|
24
|
+
],
|
|
25
|
+
"author": "Ben Coe <ben@npmjs.com>",
|
|
26
|
+
"license": "ISC",
|
|
27
|
+
"bugs": {
|
|
28
|
+
"url": "https://github.com/tapjs/signal-exit/issues"
|
|
29
|
+
},
|
|
30
|
+
"homepage": "https://github.com/tapjs/signal-exit",
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"chai": "^3.5.0",
|
|
33
|
+
"coveralls": "^3.1.1",
|
|
34
|
+
"nyc": "^15.1.0",
|
|
35
|
+
"standard-version": "^9.3.1",
|
|
36
|
+
"tap": "^15.1.1"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// This is not the set of all possible signals.
|
|
2
|
+
//
|
|
3
|
+
// It IS, however, the set of all signals that trigger
|
|
4
|
+
// an exit on either Linux or BSD systems. Linux is a
|
|
5
|
+
// superset of the signal names supported on BSD, and
|
|
6
|
+
// the unknown signals just fail to register, so we can
|
|
7
|
+
// catch that easily enough.
|
|
8
|
+
//
|
|
9
|
+
// Don't bother with SIGKILL. It's uncatchable, which
|
|
10
|
+
// means that we can't fire any callbacks anyway.
|
|
11
|
+
//
|
|
12
|
+
// If a user does happen to register a handler on a non-
|
|
13
|
+
// fatal signal like SIGWINCH or something, and then
|
|
14
|
+
// exit, it'll end up firing `process.emit('exit')`, so
|
|
15
|
+
// the handler will be fired anyway.
|
|
16
|
+
//
|
|
17
|
+
// SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
|
|
18
|
+
// artificially, inherently leave the process in a
|
|
19
|
+
// state from which it is not safe to try and enter JS
|
|
20
|
+
// listeners.
|
|
21
|
+
module.exports = [
|
|
22
|
+
'SIGABRT',
|
|
23
|
+
'SIGALRM',
|
|
24
|
+
'SIGHUP',
|
|
25
|
+
'SIGINT',
|
|
26
|
+
'SIGTERM'
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
if (process.platform !== 'win32') {
|
|
30
|
+
module.exports.push(
|
|
31
|
+
'SIGVTALRM',
|
|
32
|
+
'SIGXCPU',
|
|
33
|
+
'SIGXFSZ',
|
|
34
|
+
'SIGUSR2',
|
|
35
|
+
'SIGTRAP',
|
|
36
|
+
'SIGSYS',
|
|
37
|
+
'SIGQUIT',
|
|
38
|
+
'SIGIOT'
|
|
39
|
+
// should detect profiler and enable/disable accordingly.
|
|
40
|
+
// see #21
|
|
41
|
+
// 'SIGPROF'
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (process.platform === 'linux') {
|
|
46
|
+
module.exports.push(
|
|
47
|
+
'SIGIO',
|
|
48
|
+
'SIGPOLL',
|
|
49
|
+
'SIGPWR',
|
|
50
|
+
'SIGSTKFLT',
|
|
51
|
+
'SIGUNUSED'
|
|
52
|
+
)
|
|
53
|
+
}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Check if the current environment is Windows Subsystem for Linux (WSL).
|
|
3
|
+
*/
|
|
4
|
+
export const isWsl: boolean;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
Get the PowerShell executable path in WSL environment.
|
|
8
|
+
*/
|
|
9
|
+
export function powerShellPathFromWsl(): Promise<string>;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
Get the PowerShell executable path for the current environment.
|
|
13
|
+
|
|
14
|
+
Returns WSL path if in WSL, otherwise returns Windows path.
|
|
15
|
+
*/
|
|
16
|
+
export function powerShellPath(): Promise<string>;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
Check if PowerShell is accessible in the current environment.
|
|
20
|
+
|
|
21
|
+
This is useful to determine whether Windows integration features can be used. In sandboxed WSL environments or systems where PowerShell is not accessible, this will return `false`.
|
|
22
|
+
|
|
23
|
+
@returns A promise that resolves to `true` if PowerShell is accessible, `false` otherwise.
|
|
24
|
+
|
|
25
|
+
@example
|
|
26
|
+
```
|
|
27
|
+
import {canAccessPowerShell} from 'wsl-utils';
|
|
28
|
+
|
|
29
|
+
if (await canAccessPowerShell()) {
|
|
30
|
+
// Use Windows integration features
|
|
31
|
+
console.log('PowerShell is accessible');
|
|
32
|
+
} else {
|
|
33
|
+
// Fall back to Linux-native behavior
|
|
34
|
+
console.log('PowerShell is not accessible');
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
*/
|
|
38
|
+
export function canAccessPowerShell(): Promise<boolean>;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
Get the default browser in WSL.
|
|
42
|
+
|
|
43
|
+
@returns A promise that resolves to the [ProgID](https://setuserfta.com/guide-to-understanding-progids-and-file-type-associations/) of the default browser (e.g., `'ChromeHTML'`, `'FirefoxURL'`).
|
|
44
|
+
|
|
45
|
+
@example
|
|
46
|
+
```
|
|
47
|
+
import {wslDefaultBrowser} from 'wsl-utils';
|
|
48
|
+
|
|
49
|
+
const progId = await wslDefaultBrowser();
|
|
50
|
+
//=> 'ChromeHTML'
|
|
51
|
+
```
|
|
52
|
+
*/
|
|
53
|
+
export function wslDefaultBrowser(): Promise<string>;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
Get the mount point for fixed drives in WSL.
|
|
57
|
+
*/
|
|
58
|
+
export function wslDrivesMountPoint(): Promise<string>;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
Convert a WSL Linux path to a Windows-accessible path.
|
|
62
|
+
|
|
63
|
+
URLs (strings starting with a protocol like `https://`) are returned unchanged.
|
|
64
|
+
|
|
65
|
+
@param path - The WSL path to convert (e.g., `/home/user/file.html`).
|
|
66
|
+
@returns The Windows-accessible path (e.g., `\\wsl.localhost\Ubuntu\home\user\file.html`) or the original path if conversion fails.
|
|
67
|
+
|
|
68
|
+
@example
|
|
69
|
+
```
|
|
70
|
+
import {convertWslPathToWindows} from 'wsl-utils';
|
|
71
|
+
|
|
72
|
+
// Convert a Linux path
|
|
73
|
+
const windowsPath = await convertWslPathToWindows('/home/user/file.html');
|
|
74
|
+
//=> '\\wsl.localhost\Ubuntu\home\user\file.html'
|
|
75
|
+
|
|
76
|
+
// URLs are not converted
|
|
77
|
+
const url = await convertWslPathToWindows('https://example.com');
|
|
78
|
+
//=> 'https://example.com'
|
|
79
|
+
```
|
|
80
|
+
*/
|
|
81
|
+
export function convertWslPathToWindows(path: string): Promise<string>;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
Convert multiple WSL Linux paths to Windows-accessible paths.
|
|
85
|
+
|
|
86
|
+
URLs (strings starting with a protocol like `https://`) are returned unchanged.
|
|
87
|
+
|
|
88
|
+
@param paths - The WSL paths to convert.
|
|
89
|
+
@returns The Windows-accessible paths in the same order, or the original paths if conversion fails.
|
|
90
|
+
|
|
91
|
+
@example
|
|
92
|
+
```
|
|
93
|
+
import {convertWslPathToWindows} from 'wsl-utils';
|
|
94
|
+
|
|
95
|
+
const windowsPaths = await convertWslPathToWindows([
|
|
96
|
+
'/home/user/file.html',
|
|
97
|
+
'/mnt/c/Users/file.txt',
|
|
98
|
+
'https://example.com'
|
|
99
|
+
]);
|
|
100
|
+
//=> ['\\wsl.localhost\Ubuntu\home\user\file.html', 'C:\Users\file.txt', 'https://example.com']
|
|
101
|
+
```
|
|
102
|
+
*/
|
|
103
|
+
export function convertWslPathToWindows(paths: string[]): Promise<string[]>;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
Check if a Windows path is a UNC path (e.g., `\\wsl.localhost\...` or `\\wsl$\...`).
|
|
107
|
+
|
|
108
|
+
UNC paths indicate the file resides on the WSL Linux filesystem rather than a Windows drive.
|
|
109
|
+
|
|
110
|
+
@param path - The Windows path to check.
|
|
111
|
+
@returns `true` if the path is a UNC path, `false` otherwise.
|
|
112
|
+
|
|
113
|
+
@example
|
|
114
|
+
```
|
|
115
|
+
import {isUncPath} from 'wsl-utils';
|
|
116
|
+
|
|
117
|
+
isUncPath('\\\\wsl.localhost\\Ubuntu\\home\\user');
|
|
118
|
+
//=> true
|
|
119
|
+
|
|
120
|
+
isUncPath('C:\\Users\\file.txt');
|
|
121
|
+
//=> false
|
|
122
|
+
```
|
|
123
|
+
*/
|
|
124
|
+
export function isUncPath(path: string): boolean;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
Check if a WSL path maps to the Windows filesystem.
|
|
128
|
+
|
|
129
|
+
This converts the path and checks if it's on a Windows drive (e.g., `/mnt/c/...` → `C:\...`) rather than the Linux filesystem (e.g., `/home/...` → `\\wsl$\...`).
|
|
130
|
+
|
|
131
|
+
@param path - The WSL path to check.
|
|
132
|
+
@returns `true` if the path is on a Windows drive, `false` if it's on the Linux filesystem.
|
|
133
|
+
|
|
134
|
+
@example
|
|
135
|
+
```
|
|
136
|
+
import {isPathOnWindowsFilesystem} from 'wsl-utils';
|
|
137
|
+
|
|
138
|
+
await isPathOnWindowsFilesystem('/mnt/c/Users/file.txt');
|
|
139
|
+
//=> true
|
|
140
|
+
|
|
141
|
+
await isPathOnWindowsFilesystem('/home/user/file.txt');
|
|
142
|
+
//=> false
|
|
143
|
+
```
|
|
144
|
+
*/
|
|
145
|
+
export function isPathOnWindowsFilesystem(path: string): Promise<boolean>;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
Convert a Windows path to a WSL Linux path.
|
|
149
|
+
|
|
150
|
+
@param path - The Windows path to convert (e.g., `C:\Users\file.txt`).
|
|
151
|
+
@returns The WSL path (e.g., `/mnt/c/Users/file.txt`) or the original path if conversion fails.
|
|
152
|
+
|
|
153
|
+
@example
|
|
154
|
+
```
|
|
155
|
+
import {convertWindowsPathToWsl} from 'wsl-utils';
|
|
156
|
+
|
|
157
|
+
const wslPath = await convertWindowsPathToWsl('C:\\Users\\file.txt');
|
|
158
|
+
//=> '/mnt/c/Users/file.txt'
|
|
159
|
+
```
|
|
160
|
+
*/
|
|
161
|
+
export function convertWindowsPathToWsl(path: string): Promise<string>;
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
Convert multiple Windows paths to WSL Linux paths.
|
|
165
|
+
|
|
166
|
+
@param paths - The Windows paths to convert.
|
|
167
|
+
@returns The WSL paths in the same order, or the original paths if conversion fails.
|
|
168
|
+
|
|
169
|
+
@example
|
|
170
|
+
```
|
|
171
|
+
import {convertWindowsPathToWsl} from 'wsl-utils';
|
|
172
|
+
|
|
173
|
+
const wslPaths = await convertWindowsPathToWsl([
|
|
174
|
+
'C:\\Users\\file.txt',
|
|
175
|
+
'D:\\Projects\\app'
|
|
176
|
+
]);
|
|
177
|
+
//=> ['/mnt/c/Users/file.txt', '/mnt/d/Projects/app']
|
|
178
|
+
```
|
|
179
|
+
*/
|
|
180
|
+
export function convertWindowsPathToWsl(paths: string[]): Promise<string[]>;
|