doc-detective 4.6.0-next.6 → 4.6.0-next.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.
- package/README.md +4 -2
- package/dist/core/tests/typeKeys.d.ts.map +1 -1
- package/dist/core/tests/typeKeys.js +95 -67
- package/dist/core/tests/typeKeys.js.map +1 -1
- package/dist/index.cjs +185 -95
- package/dist/runtime/installOutput.d.ts +3 -0
- package/dist/runtime/installOutput.d.ts.map +1 -0
- package/dist/runtime/installOutput.js +22 -0
- package/dist/runtime/installOutput.js.map +1 -0
- package/dist/runtime/loader.d.ts.map +1 -1
- package/dist/runtime/loader.js +117 -30
- package/dist/runtime/loader.js.map +1 -1
- package/package.json +1 -1
- package/scripts/postinstall.js +144 -9
package/README.md
CHANGED
|
@@ -37,9 +37,11 @@ Doc Detective has multiple components to integrate with your workflows as you ne
|
|
|
37
37
|
|
|
38
38
|
### Lazy-installed runtime
|
|
39
39
|
|
|
40
|
-
`npm i doc-detective` installs
|
|
40
|
+
`npm i doc-detective` installs the CLI and then, at postinstall, pre-installs the heavy runtime assets — browsers (Chrome, Firefox), drivers (ChromeDriver, Geckodriver), ffmpeg, and the npm packages that drive them (webdriverio, appium, sharp, etc.) — into `<os.tmpdir()>/doc-detective/` (or `DOC_DETECTIVE_CACHE_DIR`). This keeps a fresh install — and any Docker image built `FROM` it — ready to run without a separate step. The pre-install runs in a child process whose output is captured, so npm's deprecation warnings from the heavy transitive trees never reach your terminal.
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
**Opt out of the heavy pre-install** by setting `DOC_DETECTIVE_AUTOINSTALL=0` (also accepts `false`/`no`/`off`). The CLI install then stays small — no browser download, no heavy npm packages — and the heavy assets install lazily the first time a test needs them instead, or up front via `doc-detective install all`.
|
|
43
|
+
|
|
44
|
+
Either way, the heavy packages are never declared in `dependencies` or `optionalDependencies`, so npm itself never fetches them as part of the dependency tree. Their version constraints live in a custom `ddRuntimeDependencies` field that the resolver reads when it installs each dep into the cache — whether at postinstall or on first use.
|
|
43
45
|
|
|
44
46
|
- **Pre-install everything up front:**
|
|
45
47
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typeKeys.d.ts","sourceRoot":"","sources":["../../../src/core/tests/typeKeys.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,QAAQ,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"typeKeys.d.ts","sourceRoot":"","sources":["../../../src/core/tests/typeKeys.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,QAAQ,EAAE,CAAC;AAqFpB,iBAAe,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,GAAG,CAAC;IAAC,IAAI,EAAE,GAAG,CAAC;IAAC,MAAM,EAAE,GAAG,CAAA;CAAE;;;GA+IxF"}
|
|
@@ -1,66 +1,77 @@
|
|
|
1
1
|
import { validate } from "../../common/src/validate.js";
|
|
2
|
-
import { Key } from "webdriverio";
|
|
3
2
|
import { findElementByCriteria, } from "./findStrategies.js";
|
|
3
|
+
import { loadHeavyDep } from "../../runtime/loader.js";
|
|
4
4
|
export { typeKeys };
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
5
|
+
let _specialKeyMap = null;
|
|
6
|
+
async function getSpecialKeyMap(ctx = {}) {
|
|
7
|
+
if (_specialKeyMap)
|
|
8
|
+
return _specialKeyMap;
|
|
9
|
+
const wdio = await loadHeavyDep("webdriverio", { ctx });
|
|
10
|
+
const { Key } = wdio;
|
|
11
|
+
_specialKeyMap = {
|
|
12
|
+
$CTRL$: Key.Ctrl,
|
|
13
|
+
$NULL$: Key.NULL,
|
|
14
|
+
$CANCEL$: Key.Cancel,
|
|
15
|
+
$HELP$: Key.Help,
|
|
16
|
+
$BACKSPACE$: Key.Backspace,
|
|
17
|
+
$TAB$: Key.Tab,
|
|
18
|
+
$CLEAR$: Key.Clear,
|
|
19
|
+
$RETURN$: Key.Return,
|
|
20
|
+
$ENTER$: Key.Enter,
|
|
21
|
+
$SHIFT$: Key.Shift,
|
|
22
|
+
$CONTROL$: Key.Control,
|
|
23
|
+
$ALT$: Key.Alt,
|
|
24
|
+
$PAUSE$: Key.Pause,
|
|
25
|
+
$ESCAPE$: Key.Escape,
|
|
26
|
+
$SPACE$: Key.Space,
|
|
27
|
+
$PAGE_UP$: Key.PageUp,
|
|
28
|
+
$PAGE_DOWN$: Key.PageDown,
|
|
29
|
+
$END$: Key.End,
|
|
30
|
+
$HOME$: Key.Home,
|
|
31
|
+
$ARROW_LEFT$: Key.ArrowLeft,
|
|
32
|
+
$ARROW_UP$: Key.ArrowUp,
|
|
33
|
+
$ARROW_RIGHT$: Key.ArrowRight,
|
|
34
|
+
$ARROW_DOWN$: Key.ArrowDown,
|
|
35
|
+
$INSERT$: Key.Insert,
|
|
36
|
+
$DELETE$: Key.Delete,
|
|
37
|
+
$SEMICOLON$: Key.Semicolon,
|
|
38
|
+
$EQUALS$: Key.Equals,
|
|
39
|
+
$NUMPAD_0$: Key.Numpad0,
|
|
40
|
+
$NUMPAD_1$: Key.Numpad1,
|
|
41
|
+
$NUMPAD_2$: Key.Numpad2,
|
|
42
|
+
$NUMPAD_3$: Key.Numpad3,
|
|
43
|
+
$NUMPAD_4$: Key.Numpad4,
|
|
44
|
+
$NUMPAD_5$: Key.Numpad5,
|
|
45
|
+
$NUMPAD_6$: Key.Numpad6,
|
|
46
|
+
$NUMPAD_7$: Key.Numpad7,
|
|
47
|
+
$NUMPAD_8$: Key.Numpad8,
|
|
48
|
+
$NUMPAD_9$: Key.Numpad9,
|
|
49
|
+
$MULTIPLY$: Key.Multiply,
|
|
50
|
+
$ADD$: Key.Add,
|
|
51
|
+
$SEPARATOR$: Key.Separator,
|
|
52
|
+
// `$SUBSTRACT$` is a long-standing misspelling kept for backwards
|
|
53
|
+
// compatibility; `$SUBTRACT$` is the correctly-spelled alias.
|
|
54
|
+
$SUBSTRACT$: Key.Subtract,
|
|
55
|
+
$SUBTRACT$: Key.Subtract,
|
|
56
|
+
$DECIMAL$: Key.Decimal,
|
|
57
|
+
$DIVIDE$: Key.Divide,
|
|
58
|
+
$F1$: Key.F1,
|
|
59
|
+
$F2$: Key.F2,
|
|
60
|
+
$F3$: Key.F3,
|
|
61
|
+
$F4$: Key.F4,
|
|
62
|
+
$F5$: Key.F5,
|
|
63
|
+
$F6$: Key.F6,
|
|
64
|
+
$F7$: Key.F7,
|
|
65
|
+
$F8$: Key.F8,
|
|
66
|
+
$F9$: Key.F9,
|
|
67
|
+
$F10$: Key.F10,
|
|
68
|
+
$F11$: Key.F11,
|
|
69
|
+
$F12$: Key.F12,
|
|
70
|
+
$COMMAND$: Key.Command,
|
|
71
|
+
$ZANKAKU_HANDKAKU$: Key.ZenkakuHankaku,
|
|
72
|
+
};
|
|
73
|
+
return _specialKeyMap;
|
|
74
|
+
}
|
|
64
75
|
// Type a sequence of keys in the active element.
|
|
65
76
|
async function typeKeys({ config, step, driver }) {
|
|
66
77
|
let result = { status: "PASS", description: "Typed keys." };
|
|
@@ -148,14 +159,31 @@ async function typeKeys({ config, step, driver }) {
|
|
|
148
159
|
step.type.keys = keys;
|
|
149
160
|
}
|
|
150
161
|
// Substitute special keys
|
|
151
|
-
// 1. For each key, identify if it
|
|
152
|
-
// 2. If it does, replace it with the corresponding `Key`
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
162
|
+
// 1. For each key, identify if it follows the escape pattern of `$...$`.
|
|
163
|
+
// 2. If it does, replace it with the corresponding `Key` value from `specialKeyMap`.
|
|
164
|
+
// Only load the map (and thus webdriverio) when a sentinel token is actually
|
|
165
|
+
// present — plain-text typing must not pull in the heavy dep or risk a
|
|
166
|
+
// load-time FAIL. Loading webdriverio can throw (e.g. the runtime dep isn't
|
|
167
|
+
// installed yet); return a step-level FAIL rather than aborting the whole run,
|
|
168
|
+
// matching how other heavy-dep-backed steps behave.
|
|
169
|
+
const hasSpecialTokens = step.type.keys.some((key) => key.startsWith("$") && key.endsWith("$"));
|
|
170
|
+
if (hasSpecialTokens) {
|
|
171
|
+
let specialKeyMap;
|
|
172
|
+
try {
|
|
173
|
+
specialKeyMap = await getSpecialKeyMap({ cacheDir: config?.cacheDir });
|
|
174
|
+
}
|
|
175
|
+
catch (error) {
|
|
176
|
+
result.status = "FAIL";
|
|
177
|
+
result.description = `Couldn't load key definitions: ${error.message}`;
|
|
178
|
+
return result;
|
|
156
179
|
}
|
|
157
|
-
|
|
158
|
-
|
|
180
|
+
step.type.keys = step.type.keys.map((key) => {
|
|
181
|
+
if (key.startsWith("$") && key.endsWith("$") && specialKeyMap[key]) {
|
|
182
|
+
return specialKeyMap[key];
|
|
183
|
+
}
|
|
184
|
+
return key;
|
|
185
|
+
});
|
|
186
|
+
}
|
|
159
187
|
// Run action
|
|
160
188
|
try {
|
|
161
189
|
if (config.recording) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typeKeys.js","sourceRoot":"","sources":["../../../src/core/tests/typeKeys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,
|
|
1
|
+
{"version":3,"file":"typeKeys.js","sourceRoot":"","sources":["../../../src/core/tests/typeKeys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EACL,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,OAAO,EAAE,QAAQ,EAAE,CAAC;AAWpB,IAAI,cAAc,GAAkC,IAAI,CAAC;AAEzD,KAAK,UAAU,gBAAgB,CAC7B,MAA6B,EAAE;IAE/B,IAAI,cAAc;QAAE,OAAO,cAAc,CAAC;IAC1C,MAAM,IAAI,GAAG,MAAM,YAAY,CAAa,aAAa,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;IACpE,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IACrB,cAAc,GAAG;QACf,MAAM,EAAE,GAAG,CAAC,IAAI;QAChB,MAAM,EAAE,GAAG,CAAC,IAAI;QAChB,QAAQ,EAAE,GAAG,CAAC,MAAM;QACpB,MAAM,EAAE,GAAG,CAAC,IAAI;QAChB,WAAW,EAAE,GAAG,CAAC,SAAS;QAC1B,KAAK,EAAE,GAAG,CAAC,GAAG;QACd,OAAO,EAAE,GAAG,CAAC,KAAK;QAClB,QAAQ,EAAE,GAAG,CAAC,MAAM;QACpB,OAAO,EAAE,GAAG,CAAC,KAAK;QAClB,OAAO,EAAE,GAAG,CAAC,KAAK;QAClB,SAAS,EAAE,GAAG,CAAC,OAAO;QACtB,KAAK,EAAE,GAAG,CAAC,GAAG;QACd,OAAO,EAAE,GAAG,CAAC,KAAK;QAClB,QAAQ,EAAE,GAAG,CAAC,MAAM;QACpB,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H,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;YACrB,0BAA0B;YAC1B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC/C,MAAM,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;gBACrC,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAC5B,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAC1C,CAAC,CAAC,iCAAiC;YACtC,CAAC;QACH,CAAC;aAAM,CAAC;YACN,wBAAwB;YACxB,MAAM,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACpC,CAAC;IACH,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,0BAA0B;QAC1B,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;QACvB,MAAM,CAAC,WAAW,GAAG,uBAAuB,KAAK,CAAC,OAAO,GAAG,CAAC;QAC7D,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO;IACP,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -130574,6 +130574,19 @@ var init_heavyDeps = __esm({
|
|
|
130574
130574
|
}
|
|
130575
130575
|
});
|
|
130576
130576
|
|
|
130577
|
+
// dist/runtime/installOutput.js
|
|
130578
|
+
function isNpmNoiseLine(line) {
|
|
130579
|
+
const l = line.trim();
|
|
130580
|
+
if (!l)
|
|
130581
|
+
return true;
|
|
130582
|
+
return /^npm warn deprecated/i.test(l) || /^npm notice/i.test(l) || /^npm fund/i.test(l) || /packages are looking for funding/i.test(l);
|
|
130583
|
+
}
|
|
130584
|
+
var init_installOutput = __esm({
|
|
130585
|
+
"dist/runtime/installOutput.js"() {
|
|
130586
|
+
"use strict";
|
|
130587
|
+
}
|
|
130588
|
+
});
|
|
130589
|
+
|
|
130577
130590
|
// dist/runtime/cacheDir.js
|
|
130578
130591
|
function emptyRecord() {
|
|
130579
130592
|
return { npmPackages: {}, browsers: {} };
|
|
@@ -130775,7 +130788,7 @@ async function ensureRuntimeInstalled(packages, options = {}) {
|
|
|
130775
130788
|
const specs = toInstall.map((name) => `${name}@${getDeclaredVersion(name)}`);
|
|
130776
130789
|
const runtimeDir = getRuntimeDir(ctx);
|
|
130777
130790
|
ensureRuntimePackageJson(runtimeDir);
|
|
130778
|
-
logger(
|
|
130791
|
+
logger("Installing dependencies\u2026", "info");
|
|
130779
130792
|
const npmExe = process.platform === "win32" ? "npm.cmd" : "npm";
|
|
130780
130793
|
const args = [
|
|
130781
130794
|
"install",
|
|
@@ -130788,50 +130801,104 @@ async function ensureRuntimeInstalled(packages, options = {}) {
|
|
|
130788
130801
|
];
|
|
130789
130802
|
assertSafeRuntimePath(runtimeDir, "DOC_DETECTIVE_CACHE_DIR / config.cacheDir");
|
|
130790
130803
|
await new Promise((resolve, reject) => {
|
|
130791
|
-
const
|
|
130792
|
-
|
|
130793
|
-
|
|
130794
|
-
|
|
130795
|
-
|
|
130796
|
-
|
|
130797
|
-
|
|
130798
|
-
|
|
130799
|
-
|
|
130800
|
-
|
|
130801
|
-
|
|
130804
|
+
const logPath = import_node_path4.default.join(runtimeDir, "install.log");
|
|
130805
|
+
let logStream = null;
|
|
130806
|
+
try {
|
|
130807
|
+
import_node_fs4.default.mkdirSync(runtimeDir, { recursive: true });
|
|
130808
|
+
logStream = import_node_fs4.default.createWriteStream(logPath, { flags: "w" });
|
|
130809
|
+
logStream.on("error", () => {
|
|
130810
|
+
logStream = null;
|
|
130811
|
+
});
|
|
130812
|
+
logStream.write(`# doc-detective: installing ${specs.join(", ")}
|
|
130813
|
+
# into ${runtimeDir}
|
|
130814
|
+
|
|
130815
|
+
`);
|
|
130816
|
+
} catch {
|
|
130817
|
+
logStream = null;
|
|
130818
|
+
}
|
|
130819
|
+
const logHint = logStream ? ` See full npm output: ${logPath}` : "";
|
|
130820
|
+
const child = (() => {
|
|
130821
|
+
const prevNoDeprecation = process.noDeprecation;
|
|
130822
|
+
process.noDeprecation = true;
|
|
130823
|
+
try {
|
|
130824
|
+
return spawner(npmExe, args, {
|
|
130825
|
+
cwd: runtimeDir,
|
|
130826
|
+
env: process.env,
|
|
130827
|
+
shell: process.platform === "win32",
|
|
130828
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
130829
|
+
});
|
|
130830
|
+
} finally {
|
|
130831
|
+
process.noDeprecation = prevNoDeprecation;
|
|
130802
130832
|
}
|
|
130833
|
+
})();
|
|
130834
|
+
const emitLine = (stream, line) => {
|
|
130835
|
+
if (line.length === 0)
|
|
130836
|
+
return;
|
|
130837
|
+
if (!RUNTIME_DEBUG && isNpmNoiseLine(line))
|
|
130838
|
+
return;
|
|
130839
|
+
logger(`npm[${stream}]: ${line}`, "debug");
|
|
130840
|
+
};
|
|
130841
|
+
const buffers = { stdout: "", stderr: "" };
|
|
130842
|
+
const onChunk = (stream, chunk) => {
|
|
130843
|
+
const text = typeof chunk === "string" ? chunk : chunk.toString("utf8");
|
|
130844
|
+
if (logStream)
|
|
130845
|
+
logStream.write(text);
|
|
130846
|
+
const parts = (buffers[stream] + text).split(/\r?\n/);
|
|
130847
|
+
buffers[stream] = parts.pop() ?? "";
|
|
130848
|
+
for (const line of parts)
|
|
130849
|
+
emitLine(stream, line);
|
|
130850
|
+
};
|
|
130851
|
+
const flushBuffers = () => {
|
|
130852
|
+
emitLine("stdout", buffers.stdout);
|
|
130853
|
+
emitLine("stderr", buffers.stderr);
|
|
130854
|
+
buffers.stdout = "";
|
|
130855
|
+
buffers.stderr = "";
|
|
130803
130856
|
};
|
|
130804
130857
|
if (child.stdout)
|
|
130805
|
-
child.stdout.on("data", (c) =>
|
|
130858
|
+
child.stdout.on("data", (c) => onChunk("stdout", c));
|
|
130806
130859
|
if (child.stderr)
|
|
130807
|
-
child.stderr.on("data", (c) =>
|
|
130860
|
+
child.stderr.on("data", (c) => onChunk("stderr", c));
|
|
130808
130861
|
let timer = null;
|
|
130862
|
+
const clearTimer = () => {
|
|
130863
|
+
if (timer)
|
|
130864
|
+
clearTimeout(timer);
|
|
130865
|
+
};
|
|
130866
|
+
let settled = false;
|
|
130867
|
+
const finish = (action) => {
|
|
130868
|
+
if (settled)
|
|
130869
|
+
return;
|
|
130870
|
+
settled = true;
|
|
130871
|
+
clearTimer();
|
|
130872
|
+
flushBuffers();
|
|
130873
|
+
const stream = logStream;
|
|
130874
|
+
logStream = null;
|
|
130875
|
+
if (stream) {
|
|
130876
|
+
let acted = false;
|
|
130877
|
+
const once = () => {
|
|
130878
|
+
if (!acted) {
|
|
130879
|
+
acted = true;
|
|
130880
|
+
action();
|
|
130881
|
+
}
|
|
130882
|
+
};
|
|
130883
|
+
stream.once("error", once);
|
|
130884
|
+
stream.end(once);
|
|
130885
|
+
} else {
|
|
130886
|
+
action();
|
|
130887
|
+
}
|
|
130888
|
+
};
|
|
130809
130889
|
if (installTimeoutMs > 0) {
|
|
130810
130890
|
timer = setTimeout(() => {
|
|
130811
130891
|
try {
|
|
130812
130892
|
child.kill();
|
|
130813
130893
|
} catch {
|
|
130814
130894
|
}
|
|
130815
|
-
reject(new Error(`npm install timed out after ${installTimeoutMs}ms while installing ${specs.join(", ")} into ${runtimeDir}`));
|
|
130895
|
+
finish(() => reject(new Error(`npm install timed out after ${installTimeoutMs}ms while installing ${specs.join(", ")} into ${runtimeDir}.${logHint}`)));
|
|
130816
130896
|
}, installTimeoutMs);
|
|
130817
130897
|
if (typeof timer.unref === "function")
|
|
130818
130898
|
timer.unref();
|
|
130819
130899
|
}
|
|
130820
|
-
|
|
130821
|
-
|
|
130822
|
-
clearTimeout(timer);
|
|
130823
|
-
};
|
|
130824
|
-
child.on("error", (err) => {
|
|
130825
|
-
clearTimer();
|
|
130826
|
-
reject(err);
|
|
130827
|
-
});
|
|
130828
|
-
child.on("close", (code) => {
|
|
130829
|
-
clearTimer();
|
|
130830
|
-
if (code === 0)
|
|
130831
|
-
resolve();
|
|
130832
|
-
else
|
|
130833
|
-
reject(new Error(`npm install exited with code ${code ?? "null"}`));
|
|
130834
|
-
});
|
|
130900
|
+
child.on("error", (err) => finish(() => reject(err)));
|
|
130901
|
+
child.on("close", (code) => finish(() => code === 0 ? resolve() : reject(new Error(`npm install exited with code ${code ?? "null"} while installing ${specs.join(", ")}.${logHint}`))));
|
|
130835
130902
|
});
|
|
130836
130903
|
const record = readInstalledRecord(ctx);
|
|
130837
130904
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -130851,6 +130918,7 @@ var init_loader = __esm({
|
|
|
130851
130918
|
import_node_url3 = require("node:url");
|
|
130852
130919
|
import_node_module = require("node:module");
|
|
130853
130920
|
init_heavyDeps();
|
|
130921
|
+
init_installOutput();
|
|
130854
130922
|
init_cacheDir();
|
|
130855
130923
|
RUNTIME_DEBUG = process.env.DOC_DETECTIVE_RUNTIME_DEBUG === "1";
|
|
130856
130924
|
defaultLogger = (msg, level = "info") => {
|
|
@@ -135402,66 +135470,77 @@ async function findElementByCriteria({ selector, elementText, elementId, element
|
|
|
135402
135470
|
|
|
135403
135471
|
// dist/core/tests/typeKeys.js
|
|
135404
135472
|
init_validate();
|
|
135405
|
-
|
|
135406
|
-
var
|
|
135407
|
-
|
|
135408
|
-
|
|
135409
|
-
|
|
135410
|
-
|
|
135411
|
-
|
|
135412
|
-
|
|
135413
|
-
|
|
135414
|
-
|
|
135415
|
-
|
|
135416
|
-
|
|
135417
|
-
|
|
135418
|
-
|
|
135419
|
-
|
|
135420
|
-
|
|
135421
|
-
|
|
135422
|
-
|
|
135423
|
-
|
|
135424
|
-
|
|
135425
|
-
|
|
135426
|
-
|
|
135427
|
-
|
|
135428
|
-
|
|
135429
|
-
|
|
135430
|
-
|
|
135431
|
-
|
|
135432
|
-
|
|
135433
|
-
|
|
135434
|
-
|
|
135435
|
-
|
|
135436
|
-
|
|
135437
|
-
|
|
135438
|
-
|
|
135439
|
-
|
|
135440
|
-
|
|
135441
|
-
|
|
135442
|
-
|
|
135443
|
-
|
|
135444
|
-
|
|
135445
|
-
|
|
135446
|
-
|
|
135447
|
-
|
|
135448
|
-
|
|
135449
|
-
|
|
135450
|
-
|
|
135451
|
-
|
|
135452
|
-
|
|
135453
|
-
|
|
135454
|
-
|
|
135455
|
-
|
|
135456
|
-
|
|
135457
|
-
|
|
135458
|
-
|
|
135459
|
-
|
|
135460
|
-
|
|
135461
|
-
|
|
135462
|
-
|
|
135463
|
-
|
|
135464
|
-
|
|
135473
|
+
init_loader();
|
|
135474
|
+
var _specialKeyMap = null;
|
|
135475
|
+
async function getSpecialKeyMap(ctx = {}) {
|
|
135476
|
+
if (_specialKeyMap)
|
|
135477
|
+
return _specialKeyMap;
|
|
135478
|
+
const wdio = await loadHeavyDep("webdriverio", { ctx });
|
|
135479
|
+
const { Key } = wdio;
|
|
135480
|
+
_specialKeyMap = {
|
|
135481
|
+
$CTRL$: Key.Ctrl,
|
|
135482
|
+
$NULL$: Key.NULL,
|
|
135483
|
+
$CANCEL$: Key.Cancel,
|
|
135484
|
+
$HELP$: Key.Help,
|
|
135485
|
+
$BACKSPACE$: Key.Backspace,
|
|
135486
|
+
$TAB$: Key.Tab,
|
|
135487
|
+
$CLEAR$: Key.Clear,
|
|
135488
|
+
$RETURN$: Key.Return,
|
|
135489
|
+
$ENTER$: Key.Enter,
|
|
135490
|
+
$SHIFT$: Key.Shift,
|
|
135491
|
+
$CONTROL$: Key.Control,
|
|
135492
|
+
$ALT$: Key.Alt,
|
|
135493
|
+
$PAUSE$: Key.Pause,
|
|
135494
|
+
$ESCAPE$: Key.Escape,
|
|
135495
|
+
$SPACE$: Key.Space,
|
|
135496
|
+
$PAGE_UP$: Key.PageUp,
|
|
135497
|
+
$PAGE_DOWN$: Key.PageDown,
|
|
135498
|
+
$END$: Key.End,
|
|
135499
|
+
$HOME$: Key.Home,
|
|
135500
|
+
$ARROW_LEFT$: Key.ArrowLeft,
|
|
135501
|
+
$ARROW_UP$: Key.ArrowUp,
|
|
135502
|
+
$ARROW_RIGHT$: Key.ArrowRight,
|
|
135503
|
+
$ARROW_DOWN$: Key.ArrowDown,
|
|
135504
|
+
$INSERT$: Key.Insert,
|
|
135505
|
+
$DELETE$: Key.Delete,
|
|
135506
|
+
$SEMICOLON$: Key.Semicolon,
|
|
135507
|
+
$EQUALS$: Key.Equals,
|
|
135508
|
+
$NUMPAD_0$: Key.Numpad0,
|
|
135509
|
+
$NUMPAD_1$: Key.Numpad1,
|
|
135510
|
+
$NUMPAD_2$: Key.Numpad2,
|
|
135511
|
+
$NUMPAD_3$: Key.Numpad3,
|
|
135512
|
+
$NUMPAD_4$: Key.Numpad4,
|
|
135513
|
+
$NUMPAD_5$: Key.Numpad5,
|
|
135514
|
+
$NUMPAD_6$: Key.Numpad6,
|
|
135515
|
+
$NUMPAD_7$: Key.Numpad7,
|
|
135516
|
+
$NUMPAD_8$: Key.Numpad8,
|
|
135517
|
+
$NUMPAD_9$: Key.Numpad9,
|
|
135518
|
+
$MULTIPLY$: Key.Multiply,
|
|
135519
|
+
$ADD$: Key.Add,
|
|
135520
|
+
$SEPARATOR$: Key.Separator,
|
|
135521
|
+
// `$SUBSTRACT$` is a long-standing misspelling kept for backwards
|
|
135522
|
+
// compatibility; `$SUBTRACT$` is the correctly-spelled alias.
|
|
135523
|
+
$SUBSTRACT$: Key.Subtract,
|
|
135524
|
+
$SUBTRACT$: Key.Subtract,
|
|
135525
|
+
$DECIMAL$: Key.Decimal,
|
|
135526
|
+
$DIVIDE$: Key.Divide,
|
|
135527
|
+
$F1$: Key.F1,
|
|
135528
|
+
$F2$: Key.F2,
|
|
135529
|
+
$F3$: Key.F3,
|
|
135530
|
+
$F4$: Key.F4,
|
|
135531
|
+
$F5$: Key.F5,
|
|
135532
|
+
$F6$: Key.F6,
|
|
135533
|
+
$F7$: Key.F7,
|
|
135534
|
+
$F8$: Key.F8,
|
|
135535
|
+
$F9$: Key.F9,
|
|
135536
|
+
$F10$: Key.F10,
|
|
135537
|
+
$F11$: Key.F11,
|
|
135538
|
+
$F12$: Key.F12,
|
|
135539
|
+
$COMMAND$: Key.Command,
|
|
135540
|
+
$ZANKAKU_HANDKAKU$: Key.ZenkakuHankaku
|
|
135541
|
+
};
|
|
135542
|
+
return _specialKeyMap;
|
|
135543
|
+
}
|
|
135465
135544
|
async function typeKeys({ config, step, driver }) {
|
|
135466
135545
|
let result = { status: "PASS", description: "Typed keys." };
|
|
135467
135546
|
const isValidStep = validate({ schemaKey: "step_v3", object: step });
|
|
@@ -135530,12 +135609,23 @@ async function typeKeys({ config, step, driver }) {
|
|
|
135530
135609
|
});
|
|
135531
135610
|
step.type.keys = keys;
|
|
135532
135611
|
}
|
|
135533
|
-
|
|
135534
|
-
|
|
135535
|
-
|
|
135612
|
+
const hasSpecialTokens = step.type.keys.some((key) => key.startsWith("$") && key.endsWith("$"));
|
|
135613
|
+
if (hasSpecialTokens) {
|
|
135614
|
+
let specialKeyMap;
|
|
135615
|
+
try {
|
|
135616
|
+
specialKeyMap = await getSpecialKeyMap({ cacheDir: config?.cacheDir });
|
|
135617
|
+
} catch (error) {
|
|
135618
|
+
result.status = "FAIL";
|
|
135619
|
+
result.description = `Couldn't load key definitions: ${error.message}`;
|
|
135620
|
+
return result;
|
|
135536
135621
|
}
|
|
135537
|
-
|
|
135538
|
-
|
|
135622
|
+
step.type.keys = step.type.keys.map((key) => {
|
|
135623
|
+
if (key.startsWith("$") && key.endsWith("$") && specialKeyMap[key]) {
|
|
135624
|
+
return specialKeyMap[key];
|
|
135625
|
+
}
|
|
135626
|
+
return key;
|
|
135627
|
+
});
|
|
135628
|
+
}
|
|
135539
135629
|
try {
|
|
135540
135630
|
if (config.recording) {
|
|
135541
135631
|
for (let i = 0; i < step.type.keys.length; i++) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installOutput.d.ts","sourceRoot":"","sources":["../../src/runtime/installOutput.ts"],"names":[],"mappings":"AAYA,2EAA2E;AAC3E,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CASpD"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Shared classifier for npm's noisy, non-actionable output. Deprecation,
|
|
2
|
+
// funding, and notice lines (e.g. `npm warn deprecated glob@10.5.0: …`,
|
|
3
|
+
// `npm warn deprecated whatwg-encoding@3.1.1: …`) are about transitive
|
|
4
|
+
// dependencies the user can't change, and they alarm users out of context.
|
|
5
|
+
// We drop them from all user-facing install output — `install all`,
|
|
6
|
+
// lazy-install on first use, and the postinstall pre-warm — so a noisy
|
|
7
|
+
// transitive tree never produces scary terminal output.
|
|
8
|
+
//
|
|
9
|
+
// NOTE: scripts/postinstall.js keeps a parallel copy of this predicate because
|
|
10
|
+
// it is a plain Node script that runs before/without the compiled `dist/`. Keep
|
|
11
|
+
// the two in sync.
|
|
12
|
+
/** True for npm deprecation / funding / notice noise (and blank lines). */
|
|
13
|
+
export function isNpmNoiseLine(line) {
|
|
14
|
+
const l = line.trim();
|
|
15
|
+
if (!l)
|
|
16
|
+
return true;
|
|
17
|
+
return (/^npm warn deprecated/i.test(l) ||
|
|
18
|
+
/^npm notice/i.test(l) ||
|
|
19
|
+
/^npm fund/i.test(l) ||
|
|
20
|
+
/packages are looking for funding/i.test(l));
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=installOutput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installOutput.js","sourceRoot":"","sources":["../../src/runtime/installOutput.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,wEAAwE;AACxE,uEAAuE;AACvE,2EAA2E;AAC3E,oEAAoE;AACpE,uEAAuE;AACvE,wDAAwD;AACxD,EAAE;AACF,+EAA+E;AAC/E,gFAAgF;AAChF,mBAAmB;AAEnB,2EAA2E;AAC3E,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IACtB,IAAI,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IACpB,OAAO,CACL,uBAAuB,CAAC,IAAI,CAAC,CAAC,CAAC;QAC/B,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC;QACtB,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;QACpB,mCAAmC,CAAC,IAAI,CAAC,CAAC,CAAC,CAC5C,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/runtime/loader.ts"],"names":[],"mappings":"AAEA,OAAO,EAAsB,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/runtime/loader.ts"],"names":[],"mappings":"AAEA,OAAO,EAAsB,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAK9F,OAAO,EAKL,KAAK,eAAe,EACrB,MAAM,eAAe,CAAC;AAEvB,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;AAC3D,MAAM,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,QAAQ,KAAK,IAAI,CAAC;AAe7D,MAAM,MAAM,OAAO,GAAG,CACpB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,OAAO,EAAE,YAAY,KAClB,YAAY,CAAC;AAElB,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IAC1B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,GAAG,CAAC,EAAE,eAAe,CAAC;IACtB,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB;AA8BD;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,GAAG,GAAE,eAAoB,GACxB,MAAM,GAAG,IAAI,CAEf;AAED;;;;;GAKG;AACH,wBAAsB,YAAY,CAAC,CAAC,GAAG,OAAO,EAC5C,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,WAAgB,GACxB,OAAO,CAAC,CAAC,CAAC,CAsBZ;AAED,MAAM,WAAW,6BAA6B;IAC5C,GAAG,CAAC,EAAE,eAAe,CAAC;IACtB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,uEAAuE;IACvE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAuCD;;;;;;;;GAQG;AACH,wBAAsB,sBAAsB,CAC1C,QAAQ,EAAE,MAAM,EAAE,EAClB,OAAO,GAAE,6BAAkC,GAC1C,OAAO,CAAC,IAAI,CAAC,CAmOf"}
|
package/dist/runtime/loader.js
CHANGED
|
@@ -4,6 +4,7 @@ import { spawn as nodeSpawn } from "node:child_process";
|
|
|
4
4
|
import { pathToFileURL } from "node:url";
|
|
5
5
|
import { createRequire } from "node:module";
|
|
6
6
|
import { getDeclaredVersion, satisfiesRange, withPeerCompanions } from "./heavyDeps.js";
|
|
7
|
+
import { isNpmNoiseLine } from "./installOutput.js";
|
|
7
8
|
import { assertSafeRuntimePath, getRuntimeDir, readInstalledRecord, writeInstalledRecord, } from "./cacheDir.js";
|
|
8
9
|
// The default logger gates `debug` output OFF so call sites that omit a
|
|
9
10
|
// logger (the JIT pre-flight, the CLI startup self-update check) don't
|
|
@@ -164,7 +165,11 @@ export async function ensureRuntimeInstalled(packages, options = {}) {
|
|
|
164
165
|
const specs = toInstall.map((name) => `${name}@${getDeclaredVersion(name)}`);
|
|
165
166
|
const runtimeDir = getRuntimeDir(ctx);
|
|
166
167
|
ensureRuntimePackageJson(runtimeDir);
|
|
167
|
-
|
|
168
|
+
// Keep the announcement calm — no dependency list or count. The resolved
|
|
169
|
+
// versions are reported once the install completes (the install command's
|
|
170
|
+
// per-asset report; the lazy path stays quiet on success). The full spec list
|
|
171
|
+
// still goes to the install.log for diagnostics.
|
|
172
|
+
logger("Installing dependencies…", "info");
|
|
168
173
|
const npmExe = process.platform === "win32" ? "npm.cmd" : "npm";
|
|
169
174
|
const args = [
|
|
170
175
|
"install",
|
|
@@ -184,27 +189,118 @@ export async function ensureRuntimeInstalled(packages, options = {}) {
|
|
|
184
189
|
// without a shell.
|
|
185
190
|
assertSafeRuntimePath(runtimeDir, "DOC_DETECTIVE_CACHE_DIR / config.cacheDir");
|
|
186
191
|
await new Promise((resolve, reject) => {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
192
|
+
// Tee the full, RAW npm output (deprecation noise included) to a log file so
|
|
193
|
+
// a non-zero exit is debuggable. The terminal only shows filtered output, so
|
|
194
|
+
// without this the failure reason is lost. Best-effort — logging must never
|
|
195
|
+
// break the install.
|
|
196
|
+
const logPath = path.join(runtimeDir, "install.log");
|
|
197
|
+
let logStream = null;
|
|
198
|
+
try {
|
|
199
|
+
fs.mkdirSync(runtimeDir, { recursive: true });
|
|
200
|
+
logStream = fs.createWriteStream(logPath, { flags: "w" });
|
|
201
|
+
// A write/flush error (disk full, EIO, permissions) must never crash the
|
|
202
|
+
// install via an unhandled 'error' event. Swallow it and stop logging.
|
|
203
|
+
logStream.on("error", () => {
|
|
204
|
+
logStream = null;
|
|
205
|
+
});
|
|
206
|
+
// Header so the log is self-contained for diagnostics, even though the
|
|
207
|
+
// terminal no longer lists the deps.
|
|
208
|
+
logStream.write(`# doc-detective: installing ${specs.join(", ")}\n# into ${runtimeDir}\n\n`);
|
|
209
|
+
}
|
|
210
|
+
catch {
|
|
211
|
+
logStream = null;
|
|
212
|
+
}
|
|
213
|
+
const logHint = logStream ? ` See full npm output: ${logPath}` : "";
|
|
214
|
+
// DEP0190: spawning npm.cmd on Windows needs shell:true, and passing args
|
|
215
|
+
// with shell:true emits a deprecation warning. We keep the CodeQL-safe args
|
|
216
|
+
// array (runtimeDir is validated above), so just suppress that one warning
|
|
217
|
+
// around the synchronous spawn() call — emitWarning() reads
|
|
218
|
+
// process.noDeprecation synchronously.
|
|
219
|
+
const child = (() => {
|
|
220
|
+
const prevNoDeprecation = process.noDeprecation;
|
|
221
|
+
process.noDeprecation = true;
|
|
222
|
+
try {
|
|
223
|
+
return spawner(npmExe, args, {
|
|
224
|
+
cwd: runtimeDir,
|
|
225
|
+
env: process.env,
|
|
226
|
+
shell: process.platform === "win32",
|
|
227
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
finally {
|
|
231
|
+
process.noDeprecation = prevNoDeprecation;
|
|
198
232
|
}
|
|
233
|
+
})();
|
|
234
|
+
const emitLine = (stream, line) => {
|
|
235
|
+
if (line.length === 0)
|
|
236
|
+
return;
|
|
237
|
+
// Drop npm's deprecation/funding/notice noise (about transitive deps
|
|
238
|
+
// the user can't fix) so even `--verbose` install output stays calm.
|
|
239
|
+
// DOC_DETECTIVE_RUNTIME_DEBUG=1 shows everything raw for diagnostics.
|
|
240
|
+
if (!RUNTIME_DEBUG && isNpmNoiseLine(line))
|
|
241
|
+
return;
|
|
242
|
+
logger(`npm[${stream}]: ${line}`, "debug");
|
|
243
|
+
};
|
|
244
|
+
// Buffer each stream so a line split across `data` chunks is reassembled
|
|
245
|
+
// before isNpmNoiseLine classifies it — otherwise a fragmented
|
|
246
|
+
// `npm warn deprecated …` line could slip past the filter.
|
|
247
|
+
const buffers = { stdout: "", stderr: "" };
|
|
248
|
+
const onChunk = (stream, chunk) => {
|
|
249
|
+
const text = typeof chunk === "string" ? chunk : chunk.toString("utf8");
|
|
250
|
+
if (logStream)
|
|
251
|
+
logStream.write(text); // full raw output → log file
|
|
252
|
+
const parts = (buffers[stream] + text).split(/\r?\n/);
|
|
253
|
+
buffers[stream] = parts.pop() ?? ""; // trailing partial line
|
|
254
|
+
for (const line of parts)
|
|
255
|
+
emitLine(stream, line);
|
|
256
|
+
};
|
|
257
|
+
const flushBuffers = () => {
|
|
258
|
+
emitLine("stdout", buffers.stdout);
|
|
259
|
+
emitLine("stderr", buffers.stderr);
|
|
260
|
+
buffers.stdout = "";
|
|
261
|
+
buffers.stderr = "";
|
|
199
262
|
};
|
|
200
263
|
if (child.stdout)
|
|
201
|
-
child.stdout.on("data", (c) =>
|
|
264
|
+
child.stdout.on("data", (c) => onChunk("stdout", c));
|
|
202
265
|
if (child.stderr)
|
|
203
|
-
child.stderr.on("data", (c) =>
|
|
266
|
+
child.stderr.on("data", (c) => onChunk("stderr", c));
|
|
204
267
|
// Wall-clock cap so a stalled npm never freezes the first run. 0 opts
|
|
205
268
|
// out (callers that explicitly want to wait forever, or unit tests
|
|
206
269
|
// with a synchronously-resolving fake spawner).
|
|
207
270
|
let timer = null;
|
|
271
|
+
const clearTimer = () => {
|
|
272
|
+
if (timer)
|
|
273
|
+
clearTimeout(timer);
|
|
274
|
+
};
|
|
275
|
+
// Settle exactly once, flushing the log stream first so the file is fully
|
|
276
|
+
// written before the error propagates and the process may exit. end()'s
|
|
277
|
+
// callback only fires on 'finish'; pair it with a one-shot 'error' guard so
|
|
278
|
+
// a stream error (disk full mid-flush) still settles the promise instead of
|
|
279
|
+
// hanging the install.
|
|
280
|
+
let settled = false;
|
|
281
|
+
const finish = (action) => {
|
|
282
|
+
if (settled)
|
|
283
|
+
return;
|
|
284
|
+
settled = true;
|
|
285
|
+
clearTimer();
|
|
286
|
+
flushBuffers();
|
|
287
|
+
const stream = logStream;
|
|
288
|
+
logStream = null;
|
|
289
|
+
if (stream) {
|
|
290
|
+
let acted = false;
|
|
291
|
+
const once = () => {
|
|
292
|
+
if (!acted) {
|
|
293
|
+
acted = true;
|
|
294
|
+
action();
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
stream.once("error", once);
|
|
298
|
+
stream.end(once);
|
|
299
|
+
}
|
|
300
|
+
else {
|
|
301
|
+
action();
|
|
302
|
+
}
|
|
303
|
+
};
|
|
208
304
|
if (installTimeoutMs > 0) {
|
|
209
305
|
timer = setTimeout(() => {
|
|
210
306
|
try {
|
|
@@ -213,27 +309,18 @@ export async function ensureRuntimeInstalled(packages, options = {}) {
|
|
|
213
309
|
catch {
|
|
214
310
|
// best-effort — the child may already have exited
|
|
215
311
|
}
|
|
216
|
-
reject(new Error(`npm install timed out after ${installTimeoutMs}ms while installing ${specs.join(", ")} into ${runtimeDir}`));
|
|
312
|
+
finish(() => reject(new Error(`npm install timed out after ${installTimeoutMs}ms while installing ${specs.join(", ")} into ${runtimeDir}.${logHint}`)));
|
|
217
313
|
}, installTimeoutMs);
|
|
218
314
|
// Don't keep the event loop alive solely for this timer.
|
|
219
315
|
if (typeof timer.unref === "function")
|
|
220
316
|
timer.unref();
|
|
221
317
|
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
reject(err);
|
|
229
|
-
});
|
|
230
|
-
child.on("close", (code) => {
|
|
231
|
-
clearTimer();
|
|
232
|
-
if (code === 0)
|
|
233
|
-
resolve();
|
|
234
|
-
else
|
|
235
|
-
reject(new Error(`npm install exited with code ${code ?? "null"}`));
|
|
236
|
-
});
|
|
318
|
+
// Spawn failure (ENOENT/EINVAL): the OS error is self-descriptive and the
|
|
319
|
+
// log holds no npm output for this path, so we don't append logHint.
|
|
320
|
+
child.on("error", (err) => finish(() => reject(err)));
|
|
321
|
+
child.on("close", (code) => finish(() => code === 0
|
|
322
|
+
? resolve()
|
|
323
|
+
: reject(new Error(`npm install exited with code ${code ?? "null"} while installing ${specs.join(", ")}.${logHint}`))));
|
|
237
324
|
});
|
|
238
325
|
const record = readInstalledRecord(ctx);
|
|
239
326
|
const now = new Date().toISOString();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/runtime/loader.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,KAAK,IAAI,SAAS,EAAwC,MAAM,oBAAoB,CAAC;AAC9F,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACxF,OAAO,EACL,qBAAqB,EACrB,aAAa,EACb,mBAAmB,EACnB,oBAAoB,GAErB,MAAM,eAAe,CAAC;AAKvB,wEAAwE;AACxE,uEAAuE;AACvE,sEAAsE;AACtE,iEAAiE;AACjE,qEAAqE;AACrE,sDAAsD;AACtD,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,2BAA2B,KAAK,GAAG,CAAC;AACtE,MAAM,aAAa,GAAW,CAAC,GAAG,EAAE,KAAK,GAAG,MAAM,EAAE,EAAE;IACpD,IAAI,KAAK,KAAK,OAAO,IAAI,CAAC,aAAa;QAAE,OAAO;IAChD,IAAI,KAAK,KAAK,OAAO;QAAE,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;;QACrC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACxB,CAAC,CAAC;AAmBF,MAAM,eAAe,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEvD,SAAS,kBAAkB,CAAC,IAAY;IACtC,IAAI,CAAC;QACH,OAAO,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC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AAE,CAAC,OAAO,EAAE,CAAC,GAAU,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAC7D,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAmB,EAAE,EAAE,CACxC,MAAM,CAAC,GAAG,EAAE,CACV,IAAI,KAAK,CAAC;YACR,CAAC,CAAC,OAAO,EAAE;YACX,CAAC,CAAC,MAAM,CACJ,IAAI,KAAK,CACP,gCAAgC,IAAI,IAAI,MAAM,qBAAqB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,OAAO,EAAE,CACjG,CACF,CACN,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC;IACxC,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACrC,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE,CAAC;QAC7B,MAAM,gBAAgB,GACpB,6BAA6B,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,kBAAkB,CAAC,IAAI,CAAC,CAAC;QACvE,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,EAAE,gBAAgB,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC;IACpE,CAAC;IACD,oBAAoB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AACpC,CAAC"}
|
package/package.json
CHANGED
package/scripts/postinstall.js
CHANGED
|
@@ -1,21 +1,157 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
1
2
|
import path from "node:path";
|
|
2
3
|
import { spawn } from "node:child_process";
|
|
3
4
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
4
5
|
|
|
5
6
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
6
7
|
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
// first use into <cacheDir>/ (default <os.tmpdir()>/doc-detective/), or
|
|
10
|
-
// up-front via `doc-detective install all`. This postinstall script
|
|
11
|
-
// keeps only the optional agent-tools install prompt — it's lightweight
|
|
12
|
-
// (TTY-gated, time-bounded, skipped in CI) and unrelated to the runtime.
|
|
8
|
+
// Resolved path to the compiled CLI, shared by both install steps below.
|
|
9
|
+
const CLI_PATH = path.join(__dirname, "..", "bin", "doc-detective.js");
|
|
13
10
|
|
|
11
|
+
// Two steps run at `npm install` time:
|
|
12
|
+
// 1. maybeInstallRuntime(): eagerly install the heavy runtime assets
|
|
13
|
+
// (webdriverio/appium/sharp + browsers) via `doc-detective install all`,
|
|
14
|
+
// so a fresh install — and any Docker image built `FROM` it — is ready to
|
|
15
|
+
// run without a separate install step. On by default; opt out with
|
|
16
|
+
// DOC_DETECTIVE_AUTOINSTALL=0.
|
|
17
|
+
// 2. maybePromptInstallAgents(): the optional agent-tools install prompt —
|
|
18
|
+
// lightweight (TTY-gated, time-bounded, skipped in CI).
|
|
14
19
|
async function main() {
|
|
20
|
+
await maybeInstallRuntime();
|
|
15
21
|
await maybePromptInstallAgents();
|
|
16
22
|
}
|
|
17
23
|
|
|
18
|
-
|
|
24
|
+
// Only run the install steps when executed as the npm lifecycle script, not
|
|
25
|
+
// when a test imports this module for the exported pure helpers below.
|
|
26
|
+
function isInvokedDirectly() {
|
|
27
|
+
try {
|
|
28
|
+
if (!process.argv[1]) return false;
|
|
29
|
+
return (
|
|
30
|
+
fs.realpathSync(process.argv[1]) ===
|
|
31
|
+
fs.realpathSync(fileURLToPath(import.meta.url))
|
|
32
|
+
);
|
|
33
|
+
} catch {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
// Swallow any unexpected rejection: a postinstall script must always exit 0,
|
|
38
|
+
// otherwise it fails the user's `npm install`.
|
|
39
|
+
if (isInvokedDirectly()) main().catch(() => {});
|
|
40
|
+
|
|
41
|
+
// --- Runtime + browsers auto-install ----------------------------------------
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* True when the user has opted out of the postinstall heavy install via
|
|
45
|
+
* DOC_DETECTIVE_AUTOINSTALL (0/false/no/off, case-insensitive). Default
|
|
46
|
+
* (unset or any other value) installs. Exported for tests.
|
|
47
|
+
*/
|
|
48
|
+
export function isRuntimeInstallOptedOut(env = process.env) {
|
|
49
|
+
const v = String(env.DOC_DETECTIVE_AUTOINSTALL ?? "").trim().toLowerCase();
|
|
50
|
+
return v === "0" || v === "false" || v === "no" || v === "off";
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* A line we surface to the user: the installer's own clean progress output
|
|
55
|
+
* (`Installing runtime…`, ` [npm] webdriverio — installed`, …). Everything
|
|
56
|
+
* else from the child — npm deprecation/funding noise, blank lines — is
|
|
57
|
+
* suppressed on the success path. Exported for tests.
|
|
58
|
+
*/
|
|
59
|
+
export function isProgressLine(line) {
|
|
60
|
+
return /^\s*Installing\b/.test(line) || /^\s*\[(npm|browser)\]/.test(line);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Pure npm noise (deprecation/funding/notice). Dropped from the captured
|
|
65
|
+
* buffer when surfacing a failure tail so the dump stays readable — genuine
|
|
66
|
+
* warnings/errors (e.g. EBADENGINE) are kept. Exported for tests.
|
|
67
|
+
*
|
|
68
|
+
* Kept in sync with src/runtime/installOutput.ts#isNpmNoiseLine (this is a
|
|
69
|
+
* plain Node script that can't import the compiled TS module reliably).
|
|
70
|
+
*/
|
|
71
|
+
export function isNpmNoiseLine(line) {
|
|
72
|
+
const l = line.trim();
|
|
73
|
+
if (!l) return true;
|
|
74
|
+
return (
|
|
75
|
+
/^npm warn deprecated/i.test(l) ||
|
|
76
|
+
/^npm notice/i.test(l) ||
|
|
77
|
+
/^npm fund/i.test(l) ||
|
|
78
|
+
/packages are looking for funding/i.test(l)
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Install the heavy runtime assets in a CHILD PROCESS whose stdout/stderr we
|
|
83
|
+
// capture (pipe) rather than inherit, so npm's deprecated-transitive-dependency
|
|
84
|
+
// warnings (glob, whatwg-encoding, …) never reach the user's terminal. We
|
|
85
|
+
// forward only the installer's own progress lines; on failure we surface a
|
|
86
|
+
// curated tail. This never fails the npm install — the assets also lazy-install
|
|
87
|
+
// on first use, so a failure here just forfeits the pre-warm.
|
|
88
|
+
async function maybeInstallRuntime() {
|
|
89
|
+
if (isRuntimeInstallOptedOut()) return;
|
|
90
|
+
|
|
91
|
+
const distDir = path.join(__dirname, "..", "dist");
|
|
92
|
+
// Dev checkout / partial install without a build: the CLI can't run yet.
|
|
93
|
+
// Skip silently — postinstall must never fail.
|
|
94
|
+
if (!fs.existsSync(CLI_PATH) || !fs.existsSync(distDir)) return;
|
|
95
|
+
|
|
96
|
+
console.log(
|
|
97
|
+
"doc-detective: installing runtime + browsers " +
|
|
98
|
+
"(set DOC_DETECTIVE_AUTOINSTALL=0 to skip)…"
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
const captured = [];
|
|
102
|
+
const handleLine = (raw, forward) => {
|
|
103
|
+
if (!raw.trim()) return;
|
|
104
|
+
captured.push(raw);
|
|
105
|
+
if (forward && isProgressLine(raw)) console.log(" " + raw.trim());
|
|
106
|
+
};
|
|
107
|
+
// Buffer per stream so a line split across data chunks is reassembled before
|
|
108
|
+
// the allow-list filter sees it. Returns the new buffer remainder.
|
|
109
|
+
const consume = (buf, chunk, forward) => {
|
|
110
|
+
const parts = (buf + chunk.toString()).split(/\r?\n/);
|
|
111
|
+
const remainder = parts.pop(); // trailing partial line (no newline yet)
|
|
112
|
+
for (const line of parts) handleLine(line, forward);
|
|
113
|
+
return remainder;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const { code, signal, errored } = await new Promise((resolve) => {
|
|
117
|
+
let child;
|
|
118
|
+
try {
|
|
119
|
+
child = spawn(
|
|
120
|
+
process.execPath,
|
|
121
|
+
[CLI_PATH, "install", "all", "--yes"],
|
|
122
|
+
{ stdio: ["ignore", "pipe", "pipe"], env: process.env }
|
|
123
|
+
);
|
|
124
|
+
} catch {
|
|
125
|
+
resolve({ code: 1, signal: null, errored: true });
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
let outBuf = "";
|
|
129
|
+
let errBuf = "";
|
|
130
|
+
child.stdout?.on("data", (chunk) => (outBuf = consume(outBuf, chunk, true)));
|
|
131
|
+
// stderr is captured for a possible failure dump but never forwarded live.
|
|
132
|
+
child.stderr?.on("data", (chunk) => (errBuf = consume(errBuf, chunk, false)));
|
|
133
|
+
child.on("close", (exitCode, exitSignal) => {
|
|
134
|
+
// Flush any trailing partial lines left without a final newline.
|
|
135
|
+
handleLine(outBuf, true);
|
|
136
|
+
handleLine(errBuf, false);
|
|
137
|
+
resolve({ code: exitCode, signal: exitSignal, errored: false });
|
|
138
|
+
});
|
|
139
|
+
child.on("error", () => resolve({ code: 1, signal: null, errored: true }));
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
if (!errored && !signal && code === 0) {
|
|
143
|
+
console.log("doc-detective: runtime + browsers ready.");
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const tail = captured.filter((l) => !isNpmNoiseLine(l)).slice(-20);
|
|
148
|
+
console.error(
|
|
149
|
+
"doc-detective: runtime install did not complete " +
|
|
150
|
+
(signal ? `(signal ${signal})` : `(exit ${code})`) +
|
|
151
|
+
". Assets will install on first use, or run `doc-detective install all`."
|
|
152
|
+
);
|
|
153
|
+
if (tail.length) console.error(tail.map((l) => " " + l).join("\n"));
|
|
154
|
+
}
|
|
19
155
|
|
|
20
156
|
async function maybePromptInstallAgents() {
|
|
21
157
|
// Don't prompt in non-interactive contexts. npm sets many of these during
|
|
@@ -187,7 +323,6 @@ async function maybePromptInstallAgents() {
|
|
|
187
323
|
|
|
188
324
|
// Pre-fill --agent so the CLI doesn't re-prompt for the picker. Scope stays
|
|
189
325
|
// interactive on purpose — project vs global is a per-user decision.
|
|
190
|
-
const cliPath = path.join(__dirname, "..", "bin", "doc-detective.js");
|
|
191
326
|
const cliArgs = ["install-agents"];
|
|
192
327
|
for (const a of adaptersNeedingInstall) {
|
|
193
328
|
cliArgs.push("--agent", a.id);
|
|
@@ -197,7 +332,7 @@ async function maybePromptInstallAgents() {
|
|
|
197
332
|
// `node_modules/.bin` during the install step either.
|
|
198
333
|
const childEnv = { ...process.env, [pathKey]: sanitizedPath };
|
|
199
334
|
const { code, signal } = await new Promise((resolve) => {
|
|
200
|
-
const child = spawn(process.execPath, [
|
|
335
|
+
const child = spawn(process.execPath, [CLI_PATH, ...cliArgs], {
|
|
201
336
|
stdio: "inherit",
|
|
202
337
|
cwd: targetCwd,
|
|
203
338
|
env: childEnv,
|