pi-free 2.0.5 → 2.0.7
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/CHANGELOG.md +37 -0
- package/README.md +495 -495
- package/lib/open-browser.ts +31 -4
- package/lib/util.ts +351 -262
- package/package.json +1 -1
- package/provider-failover/benchmark-lookup.ts +702 -688
- package/scripts/check-extensions.mjs +18 -11
|
@@ -7,24 +7,31 @@
|
|
|
7
7
|
* node scripts/check-extensions.mjs <dir> # from installed location
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import {
|
|
11
|
-
import { readdirSync, readFileSync, statSync } from "node:fs";
|
|
10
|
+
import { execFileSync } from "node:child_process";
|
|
11
|
+
import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
|
|
12
12
|
import { dirname, join, resolve } from "node:path";
|
|
13
13
|
|
|
14
14
|
const installDir = resolve(process.argv[2] ?? ".");
|
|
15
15
|
const fromSource = process.argv[2] == null;
|
|
16
16
|
|
|
17
|
+
/** Resolve npm to an absolute path to avoid S4036 PATH-lookup flags. */
|
|
18
|
+
function resolveNpm() {
|
|
19
|
+
for (const p of [
|
|
20
|
+
"/usr/bin/npm",
|
|
21
|
+
"/usr/local/bin/npm",
|
|
22
|
+
process.platform === "win32" ? "C:\\Program Files\\nodejs\\npm.cmd" : "",
|
|
23
|
+
]) {
|
|
24
|
+
if (p && existsSync(p)) return p;
|
|
25
|
+
}
|
|
26
|
+
return "npm"; // fallback
|
|
27
|
+
}
|
|
28
|
+
|
|
17
29
|
function getFiles() {
|
|
18
30
|
if (fromSource) {
|
|
19
|
-
// Use npm pack --dry-run
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
...process.env,
|
|
24
|
-
PATH: "/usr/local/bin:/usr/bin:/bin",
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
const out = execSync("npm pack --dry-run 2>&1", execOptions);
|
|
31
|
+
// Use npm pack --dry-run with an absolute executable path.
|
|
32
|
+
const out = execFileSync(resolveNpm(), ["pack", "--dry-run"], {
|
|
33
|
+
encoding: "utf8",
|
|
34
|
+
});
|
|
28
35
|
return out
|
|
29
36
|
.split("\n")
|
|
30
37
|
.map((l) => l.match(/npm notice \S+\s+(.+)/)?.[1]?.trim())
|