libnpmexec 10.1.7 → 10.1.9
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/README.md +1 -1
- package/lib/get-bin-from-manifest.js +1 -1
- package/lib/with-lock.js +7 -5
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -40,7 +40,7 @@ await libexec({
|
|
|
40
40
|
- `runPath`: Location to where to execute the script **String**, defaults to `.`
|
|
41
41
|
- `scriptShell`: Default shell to be used **String**, defaults to `sh` on POSIX systems, `process.env.ComSpec` OR `cmd` on Windows
|
|
42
42
|
- `yes`: Should skip download confirmation prompt when fetching missing packages from the registry? **Boolean**
|
|
43
|
-
- `registry`, `cache`, and more options that are forwarded to [@npmcli/arborist](https://github.com/npm/arborist/) and [pacote](https://github.com/npm/pacote/#options) **Object**
|
|
43
|
+
- `registry`, `cache`, and more options that are forwarded to [@npmcli/arborist](https://github.com/npm/cli/blob/latest/workspaces/arborist/README.md) and [pacote](https://github.com/npm/pacote/#options) **Object**
|
|
44
44
|
|
|
45
45
|
## LICENSE
|
|
46
46
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const getBinFromManifest = (mani) => {
|
|
2
2
|
// if we have a bin matching (unscoped portion of) packagename, use that
|
|
3
3
|
// otherwise if there's 1 bin or all bin value is the same (alias), use
|
|
4
|
-
// that
|
|
4
|
+
// that; otherwise, fail
|
|
5
5
|
const bin = mani.bin || {}
|
|
6
6
|
if (new Set(Object.values(bin)).size === 1) {
|
|
7
7
|
return Object.keys(bin)[0]
|
package/lib/with-lock.js
CHANGED
|
@@ -18,9 +18,10 @@ const { onExit } = require('signal-exit')
|
|
|
18
18
|
// - more ergonomic compromised lock handling (i.e. withLock will reject, and callbacks have access to an AbortSignal)
|
|
19
19
|
// - uses a more recent version of signal-exit
|
|
20
20
|
|
|
21
|
+
// mtime precision is platform dependent, so deal in seconds
|
|
21
22
|
const touchInterval = 1_000
|
|
22
|
-
//
|
|
23
|
-
const staleThreshold =
|
|
23
|
+
// use a reasonably large threshold, in case stat calls take a while
|
|
24
|
+
const staleThreshold = 60_000
|
|
24
25
|
|
|
25
26
|
// track current locks and their cleanup functions
|
|
26
27
|
const currentLocks = new Map()
|
|
@@ -144,6 +145,7 @@ async function maintainLock (lockPath) {
|
|
|
144
145
|
let mtime = Math.round(stats.mtimeMs / 1000)
|
|
145
146
|
const signal = controller.signal
|
|
146
147
|
|
|
148
|
+
let timeout
|
|
147
149
|
async function touchLock () {
|
|
148
150
|
try {
|
|
149
151
|
const currentStats = (await fs.stat(lockPath))
|
|
@@ -156,16 +158,16 @@ async function maintainLock (lockPath) {
|
|
|
156
158
|
if (currentLocks.has(lockPath)) {
|
|
157
159
|
await fs.utimes(lockPath, mtime, mtime)
|
|
158
160
|
}
|
|
161
|
+
timeout = setTimeout(touchLock, touchInterval).unref()
|
|
159
162
|
} catch (err) {
|
|
160
163
|
// stats mismatch or other fs error means the lock was compromised
|
|
161
164
|
controller.abort()
|
|
162
165
|
}
|
|
163
166
|
}
|
|
164
167
|
|
|
165
|
-
|
|
166
|
-
timeout.unref()
|
|
168
|
+
timeout = setTimeout(touchLock, touchInterval).unref()
|
|
167
169
|
function cleanup () {
|
|
168
|
-
|
|
170
|
+
clearTimeout(timeout)
|
|
169
171
|
deleteLock(lockPath)
|
|
170
172
|
}
|
|
171
173
|
currentLocks.set(lockPath, cleanup)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "libnpmexec",
|
|
3
|
-
"version": "10.1.
|
|
3
|
+
"version": "10.1.9",
|
|
4
4
|
"files": [
|
|
5
5
|
"bin/",
|
|
6
6
|
"lib/"
|
|
@@ -53,20 +53,20 @@
|
|
|
53
53
|
"@npmcli/eslint-config": "^5.0.1",
|
|
54
54
|
"@npmcli/mock-registry": "^1.0.0",
|
|
55
55
|
"@npmcli/template-oss": "4.25.1",
|
|
56
|
-
"bin-links": "^
|
|
56
|
+
"bin-links": "^6.0.0",
|
|
57
57
|
"chalk": "^5.2.0",
|
|
58
58
|
"just-extend": "^6.2.0",
|
|
59
59
|
"just-safe-set": "^4.2.1",
|
|
60
60
|
"tap": "^16.3.8"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@npmcli/arborist": "^9.1.
|
|
63
|
+
"@npmcli/arborist": "^9.1.7",
|
|
64
64
|
"@npmcli/package-json": "^7.0.0",
|
|
65
65
|
"@npmcli/run-script": "^10.0.0",
|
|
66
66
|
"ci-info": "^4.0.0",
|
|
67
67
|
"npm-package-arg": "^13.0.0",
|
|
68
68
|
"pacote": "^21.0.2",
|
|
69
|
-
"proc-log": "^
|
|
69
|
+
"proc-log": "^6.0.0",
|
|
70
70
|
"promise-retry": "^2.0.1",
|
|
71
71
|
"read": "^4.0.0",
|
|
72
72
|
"semver": "^7.3.7",
|