homebridge-plugin-utils 2.0.0 → 2.2.0
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/build/tsconfig.json +15 -0
- package/dist/backpressure.d.ts +1 -1
- package/dist/backpressure.js +4 -4
- package/dist/backpressure.js.map +1 -1
- package/dist/cli/index.d.ts +93 -5
- package/dist/cli/index.js +296 -30
- package/dist/cli/index.js.map +1 -1
- package/dist/clock-double.js +2 -2
- package/dist/clock-double.js.map +1 -1
- package/dist/disposable-stack.d.ts +59 -0
- package/dist/disposable-stack.js +155 -0
- package/dist/disposable-stack.js.map +1 -0
- package/dist/docChrome.d.ts +263 -0
- package/dist/docChrome.js +364 -0
- package/dist/docChrome.js.map +1 -0
- package/dist/featureOptions-docs.d.ts +2 -2
- package/dist/featureOptions-docs.js +1 -1
- package/dist/featureOptions.d.ts +5 -5
- package/dist/featureOptions.js +6 -6
- package/dist/ffmpeg/exec.d.ts +2 -2
- package/dist/ffmpeg/exec.js +2 -2
- package/dist/ffmpeg/fmp4-builders.d.ts +77 -0
- package/dist/ffmpeg/fmp4-builders.js +163 -0
- package/dist/ffmpeg/fmp4-builders.js.map +1 -0
- package/dist/ffmpeg/index.d.ts +1 -0
- package/dist/ffmpeg/index.js +1 -0
- package/dist/ffmpeg/index.js.map +1 -1
- package/dist/ffmpeg/mp4-assembler.d.ts +45 -4
- package/dist/ffmpeg/mp4-assembler.js +45 -8
- package/dist/ffmpeg/mp4-assembler.js.map +1 -1
- package/dist/ffmpeg/mp4-parser.d.ts +1 -1
- package/dist/ffmpeg/mp4-parser.js +1 -1
- package/dist/ffmpeg/options.d.ts +17 -0
- package/dist/ffmpeg/options.js +50 -25
- package/dist/ffmpeg/options.js.map +1 -1
- package/dist/ffmpeg/process.d.ts +1 -1
- package/dist/ffmpeg/process.js +4 -4
- package/dist/ffmpeg/process.js.map +1 -1
- package/dist/ffmpeg/record.d.ts +26 -1
- package/dist/ffmpeg/record.js +12 -0
- package/dist/ffmpeg/record.js.map +1 -1
- package/dist/ffmpeg/recording-process-double.d.ts +13 -0
- package/dist/ffmpeg/recording-process-double.js +22 -0
- package/dist/ffmpeg/recording-process-double.js.map +1 -1
- package/dist/ffmpeg/rtp-parser.d.ts +1 -1
- package/dist/ffmpeg/rtp-parser.js +1 -1
- package/dist/ffmpeg/rtp.d.ts +4 -4
- package/dist/ffmpeg/rtp.js +7 -6
- package/dist/ffmpeg/rtp.js.map +1 -1
- package/dist/ffmpeg/stream.js +1 -1
- package/dist/ffmpeg/stream.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/logclient/auth.d.ts +3 -3
- package/dist/logclient/auth.js +2 -2
- package/dist/logclient/auth.js.map +1 -1
- package/dist/logclient/cli-run.js +2 -2
- package/dist/logclient/cli-run.js.map +1 -1
- package/dist/logclient/cli.js +2 -2
- package/dist/logclient/client.js +2 -2
- package/dist/logclient/client.js.map +1 -1
- package/dist/logclient/rest.js +1 -1
- package/dist/logclient/socket-double.d.ts +1 -1
- package/dist/logclient/socket-double.js +1 -1
- package/dist/logclient/socket.js +5 -5
- package/dist/logclient/socket.js.map +1 -1
- package/dist/logclient/time-window.d.ts +1 -1
- package/dist/mqttClient.d.ts +1 -1
- package/dist/mqttClient.js +3 -3
- package/dist/mqttClient.js.map +1 -1
- package/dist/timer-registry.d.ts +100 -0
- package/dist/timer-registry.js +184 -0
- package/dist/timer-registry.js.map +1 -0
- package/dist/ui/featureOptions.js +6 -6
- package/dist/ui/pluginConfigSession.mjs +1 -1
- package/dist/ui/webUi-featureOptions/effects/persist.mjs +2 -2
- package/dist/ui/webUi-featureOptions/effects/theme.mjs +1 -1
- package/dist/ui/webUi-featureOptions/effects/tokens.mjs +1 -1
- package/dist/ui/webUi-featureOptions/rendering.mjs +2 -2
- package/dist/ui/webUi-featureOptions/selectors.mjs +3 -3
- package/dist/ui/webUi-featureOptions/state.mjs +72 -15
- package/dist/ui/webUi-featureOptions/store.mjs +1 -1
- package/dist/ui/webUi-featureOptions/utils.mjs +25 -1
- package/dist/ui/webUi-featureOptions/views/connectionError.mjs +28 -11
- package/dist/ui/webUi-featureOptions/views/deviceInfo.mjs +7 -0
- package/dist/ui/webUi-featureOptions/views/header.mjs +22 -5
- package/dist/ui/webUi-featureOptions/views/nav.mjs +39 -32
- package/dist/ui/webUi-featureOptions/views/options.mjs +13 -7
- package/dist/ui/webUi-featureOptions/views/search.mjs +2 -2
- package/dist/ui/webUi-featureOptions.mjs +109 -61
- package/dist/ui/webUi.mjs +48 -11
- package/dist/util.d.ts +118 -16
- package/dist/util.js +96 -14
- package/dist/util.js.map +1 -1
- package/dist/webui-loader.d.ts +80 -0
- package/dist/webui-loader.js +373 -0
- package/dist/webui-loader.js.map +1 -0
- package/package.json +10 -10
package/build/tsconfig.json
CHANGED
|
@@ -31,6 +31,21 @@
|
|
|
31
31
|
"noPropertyAccessFromIndexSignature": true,
|
|
32
32
|
"noUncheckedIndexedAccess": true,
|
|
33
33
|
"noUncheckedSideEffectImports": true,
|
|
34
|
+
|
|
35
|
+
/* Host-package type identity for composed development rigs. TypeScript unifies two physical copies of a package into one type identity only when their
|
|
36
|
+
* package name and version match exactly, so a plugin tree and a symlinked library tree holding different homebridge or hap-nodejs versions split every HAP
|
|
37
|
+
* type into two incompatible identities. Mapping the host packages to the extending project's own node_modules makes the consumer's copy the single source of
|
|
38
|
+
* type truth for the whole compilation - the same composition npm produces in a published install - so version skew surfaces only as genuine API
|
|
39
|
+
* incompatibilities. ${configDir} resolves to the directory of the final extending tsconfig, so every consumer resolves its own tree rather than this base
|
|
40
|
+
* file's. The mappings name each package's declaration entry file rather than its package directory: a paths substitution is a bare file lookup that never
|
|
41
|
+
* consults the target's package.json, so a directory target fails silently and resolution falls back to the importing file's own tree.
|
|
42
|
+
*/
|
|
43
|
+
"paths": {
|
|
44
|
+
|
|
45
|
+
"@homebridge/hap-nodejs": ["${configDir}/node_modules/@homebridge/hap-nodejs/dist/index.d.ts"],
|
|
46
|
+
"homebridge": ["${configDir}/node_modules/homebridge/dist/index.d.ts"]
|
|
47
|
+
},
|
|
48
|
+
|
|
34
49
|
"resolveJsonModule": true,
|
|
35
50
|
"rewriteRelativeImportExtensions": true,
|
|
36
51
|
"skipLibCheck": true,
|
package/dist/backpressure.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { Writable } from "node:stream";
|
|
|
4
4
|
* Thrown synchronously by {@link BackpressureWriter.write} when the pending queue is already at the configured {@link BackpressureWriterInit.highWaterMark} and
|
|
5
5
|
* accepting the new chunk would push it over.
|
|
6
6
|
*
|
|
7
|
-
* Separate from the "writer has aborted" and "underlying stream is dead" failure modes so callers can
|
|
7
|
+
* Separate from the "writer has aborted" and "underlying stream is dead" failure modes so callers can distinguish backpressure-overflow (back off and retry later)
|
|
8
8
|
* from terminal failures (give up or escalate) by type rather than by inspecting error message text.
|
|
9
9
|
*
|
|
10
10
|
* @category Utilities
|
package/dist/backpressure.js
CHANGED
|
@@ -17,7 +17,7 @@ import { once } from "node:events";
|
|
|
17
17
|
* Thrown synchronously by {@link BackpressureWriter.write} when the pending queue is already at the configured {@link BackpressureWriterInit.highWaterMark} and
|
|
18
18
|
* accepting the new chunk would push it over.
|
|
19
19
|
*
|
|
20
|
-
* Separate from the "writer has aborted" and "underlying stream is dead" failure modes so callers can
|
|
20
|
+
* Separate from the "writer has aborted" and "underlying stream is dead" failure modes so callers can distinguish backpressure-overflow (back off and retry later)
|
|
21
21
|
* from terminal failures (give up or escalate) by type rather than by inspecting error message text.
|
|
22
22
|
*
|
|
23
23
|
* @category Utilities
|
|
@@ -109,7 +109,7 @@ export class BackpressureWriter {
|
|
|
109
109
|
// Single teardown convergence point. `onAbort` registers the one-shot teardown handler AND handles the pre-aborted-signal edge case where `addEventListener`
|
|
110
110
|
// would otherwise skip the handler. Rejects every pending entry - including the in-flight entry when the drain loop is parked on
|
|
111
111
|
// `events.once(stream, "drain", { signal })`. The drain loop's catch branch may also reject the in-flight resolver under the same abort; promise resolvers are
|
|
112
|
-
//
|
|
112
|
+
// inert after first settlement, so the second call is a no-op. Rejecting from here unconditionally is required in the stream-error escalation path,
|
|
113
113
|
// where the drain loop shifts the in-flight entry before calling `this.#controller.abort(...)` - by the time the listener runs, only the queued entries remain
|
|
114
114
|
// in the queue, and leaving any of them unrejected would orphan the caller's promise.
|
|
115
115
|
onAbort(this.signal, () => this.#teardown());
|
|
@@ -131,7 +131,7 @@ export class BackpressureWriter {
|
|
|
131
131
|
*/
|
|
132
132
|
async write(chunk) {
|
|
133
133
|
// Pre-aborted short-circuit: a write issued after teardown has nothing live to attach to. Rejecting with the signal's reason keeps semantics uniform with the
|
|
134
|
-
// mid-write abort path - callers
|
|
134
|
+
// mid-write abort path - callers branch on `signal.reason` / `isHbpuAbortReason` in either case.
|
|
135
135
|
if (this.signal.aborted) {
|
|
136
136
|
throw this.signal.reason;
|
|
137
137
|
}
|
|
@@ -256,7 +256,7 @@ export class BackpressureWriter {
|
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
258
|
// Teardown convergence point, fired exactly once when `this.signal` aborts. Rejects every pending entry with the signal's reason, regardless of whether the drain
|
|
259
|
-
// loop is currently processing. Promise resolvers are
|
|
259
|
+
// loop is currently processing. Promise resolvers are inert after first settlement, so if the drain loop's catch branch also rejects the in-flight resolver
|
|
260
260
|
// (e.g., when `events.once(..., { signal })` rejects on the same abort), the second call is a no-op. Draining the queue unconditionally here prevents the
|
|
261
261
|
// stream-error escalation path from orphaning queued resolvers - `#drain`'s catch shifts the in-flight entry and then calls `this.#controller.abort(...)`, which
|
|
262
262
|
// fires this listener synchronously while the remaining queued entries are still in the queue.
|
package/dist/backpressure.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backpressure.js","sourceRoot":"","sources":["../src/backpressure.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;GAQG;AACH,OAAO,EAAE,cAAc,EAAE,cAAc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OAAO;gBACT,CAAC;YACH,CAAC;QACH,CAAC;gBAAS,CAAC;YAET,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QAC3B,CAAC;IACH,CAAC;IAED,kKAAkK;IAClK,4JAA4J;IAC5J,0JAA0J;IAC1J,iKAAiK;IACjK,+FAA+F;IAC/F,SAAS;QAEP,kKAAkK;QAClK,gIAAgI;QAChI,MAAM,MAAM,GAAY,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;QAC3C,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAEtC,KAAI,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;YAE3B,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACjC,CAAC;IACH,CAAC;CACF"}
|
package/dist/cli/index.d.ts
CHANGED
|
@@ -1,4 +1,23 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* The homebridge-plugin-utils CLI, exposed to consumers via the `bin` field in `package.json`. A single cohesive module: the content-hash helper, the `prepareUi`,
|
|
4
|
+
* `prepareDocs`, and `prepareChrome` transforms, the `runCli` dispatcher, and the entry-point execution all live here with no inter-file relative VALUE imports.
|
|
5
|
+
*
|
|
6
|
+
* That single-file shape is deliberate, not incidental. A bin is invoked through an `npm`-managed symlink in `node_modules/.bin`; if the entry imported a sibling
|
|
7
|
+
* module by relative path AT LOAD TIME, that import would resolve against the symlink's directory under symlink-preserving or copied-package layouts and fail. With
|
|
8
|
+
* every runtime edge pointing only at `node:` builtins, there is nothing to fracture - the CLI runs identically whether reached directly, through a symlink, through
|
|
9
|
+
* a `file:` dependency, or under `--preserve-symlinks`. The lone `import type` of the renderer's signatures is fully erased by the compiler and emits no runtime edge,
|
|
10
|
+
* so it carries the SSOT types without reintroducing a load-time relative dependency; when `prepareDocs` actually needs the renderer it reaches it through a computed
|
|
11
|
+
* dynamic import the dispatch site supplies, the same indirection the `hblog` bin uses.
|
|
12
|
+
*
|
|
13
|
+
* The module is simultaneously the executable (run via the bin) and a side-effect-free library surface (`prepareUi` / `prepareDocs` / `prepareChrome` / `runCli` /
|
|
14
|
+
* `USAGE`) that the test suite imports. The entry block at the bottom only executes when this module is the program entry point, detected by comparing canonicalized
|
|
15
|
+
* real paths - see its comment for why a raw path comparison is insufficient.
|
|
16
|
+
*
|
|
17
|
+
* @module
|
|
18
|
+
*/
|
|
19
|
+
import type { parseDocChromeManifest, parseProjectEntries, renderDevBadges, renderDocIndex, renderMasthead, renderProjects } from "../docChrome.ts";
|
|
20
|
+
import type { parseWebUiLoaderConfig, renderWebUiBootRegion } from "../webui-loader.ts";
|
|
2
21
|
import type { renderFeatureOptionsReference, spliceMarkedRegion } from "../featureOptions-docs.ts";
|
|
3
22
|
/**
|
|
4
23
|
* Usage banner shown on no command or an unknown command. Kept as an exported constant so tests assert against its text without
|
|
@@ -12,27 +31,43 @@ export declare const USAGE: string;
|
|
|
12
31
|
* injects a trailing-slash importmap entry that prefixes every `./lib/` import with the hashed-versioned path. Transitive imports inherit the prefix through
|
|
13
32
|
* relative-URL resolution, so cache-busting reaches files the importmap never names.
|
|
14
33
|
*
|
|
15
|
-
* The content hash is
|
|
34
|
+
* The content hash is what makes the maintainer-iteration use case work. A semver-only subdir name would stay constant across the maintainer's
|
|
16
35
|
* edit/rebuild/test cycle (version doesn't bump on every save), and the browser would happily serve cached copies of the stale URLs. Hashing the tree means any
|
|
17
36
|
* source change produces a different subdir name, which produces different URLs, which forces fresh fetches. Same code path serves the published-release case: a
|
|
18
37
|
* release ships with a fixed hash, and every consumer fetching it sees the same URL space and caches aggressively within it.
|
|
19
38
|
*
|
|
20
|
-
* Operates
|
|
39
|
+
* Operates repeatably. A re-run against unchanged source content produces the same subdir name + same contents + same manifest. Stale prior-build subdirs are
|
|
21
40
|
* removed in the same pass; non-version-shaped entries in the destination are left untouched so a plugin's own files (assets, sibling tooling, README copies)
|
|
22
41
|
* survive across runs.
|
|
23
42
|
*
|
|
43
|
+
* When the `loader` and `splice` namespaces are injected, a final step stamps the plugin's webUI script loader: the `index.html` beside the destination is read, its
|
|
44
|
+
* `WEBUI LOADER CONFIG` comment parsed, the loader block rendered from that config plus this run's `libPath` and package name, and spliced into its marked region with
|
|
45
|
+
* an atomic `.tmp` + rename. The step is marker-gated - no `index.html`, or no BEGIN marker, is a silent no-op - so a plugin that has not opted in, and every
|
|
46
|
+
* no-injection caller, mirror exactly as before. The stamp derives from the same package name and destination the mirror used, so the two never drift.
|
|
47
|
+
*
|
|
24
48
|
* @param args
|
|
25
49
|
* @param args.dest - The plugin's destination directory (typically `homebridge-ui/public/lib`). Created if missing.
|
|
50
|
+
* @param args.loader - The injected webUI-loader namespace (marker constants, `parseWebUiLoaderConfig`, `renderWebUiBootRegion`). Absent = no stamp step, so the
|
|
51
|
+
* mirror-only path and its existing tests are untouched. Supplied with `splice`, it stamps the plugin's `index.html` loader region.
|
|
26
52
|
* @param args.sourceRoot - Path to HBPU's package root (the directory containing `package.json` and `dist/`). The entry block resolves this from the CLI's own
|
|
27
53
|
* real path; tests pass a tmpdir populated with a synthetic HBPU layout.
|
|
54
|
+
* @param args.splice - The injected {@link spliceMarkedRegion} that replaces the loader's marked region. Paired with `loader`; absent = no stamp step.
|
|
28
55
|
*
|
|
29
|
-
* @throws When the source has not been built (`dist/ui/` missing), the source `package.json` lacks a `version` field
|
|
30
|
-
* directory.
|
|
56
|
+
* @throws When the source has not been built (`dist/ui/` missing), the source `package.json` lacks a `version` field (or, when stamping, a `name` field), or the source
|
|
57
|
+
* `dist/ui` path exists but is not a directory; and, when stamping, propagates the parse/splice framed errors under a "mirror succeeded, stamp failed" frame.
|
|
31
58
|
*/
|
|
32
|
-
export declare function prepareUi({ dest, sourceRoot }: {
|
|
59
|
+
export declare function prepareUi({ dest, loader, sourceRoot, splice }: {
|
|
33
60
|
dest: string;
|
|
61
|
+
loader?: WebUiLoaderModule;
|
|
34
62
|
sourceRoot: string;
|
|
63
|
+
splice?: typeof spliceMarkedRegion;
|
|
35
64
|
}): Promise<void>;
|
|
65
|
+
interface WebUiLoaderModule {
|
|
66
|
+
readonly WEBUI_LOADER_BEGIN: string;
|
|
67
|
+
readonly WEBUI_LOADER_END: string;
|
|
68
|
+
readonly parseWebUiLoaderConfig: typeof parseWebUiLoaderConfig;
|
|
69
|
+
readonly renderWebUiBootRegion: typeof renderWebUiBootRegion;
|
|
70
|
+
}
|
|
36
71
|
/**
|
|
37
72
|
* Regenerate a plugin's Feature Options reference by projecting its live catalog through HBPU's shared renderer and splicing the result into the plugin's doc, in
|
|
38
73
|
* place between the shared `FEATURE OPTIONS:BEGIN` / `END` markers. This centralizes the read/splice/atomic-write orchestration so a plugin's `build-docs` script
|
|
@@ -71,6 +106,58 @@ export declare function prepareDocs({ catalogModulePath, docPath, render, splice
|
|
|
71
106
|
render: typeof renderFeatureOptionsReference;
|
|
72
107
|
splice: typeof spliceMarkedRegion;
|
|
73
108
|
}): Promise<void>;
|
|
109
|
+
interface DocChromeModule {
|
|
110
|
+
readonly DEV_BADGES_BEGIN: string;
|
|
111
|
+
readonly DEV_BADGES_END: string;
|
|
112
|
+
readonly DOCUMENTATION_BEGIN: string;
|
|
113
|
+
readonly DOCUMENTATION_END: string;
|
|
114
|
+
readonly MASTHEAD_BEGIN: string;
|
|
115
|
+
readonly MASTHEAD_END: string;
|
|
116
|
+
readonly PROJECTS_BEGIN: string;
|
|
117
|
+
readonly PROJECTS_END: string;
|
|
118
|
+
readonly parseDocChromeManifest: typeof parseDocChromeManifest;
|
|
119
|
+
readonly parseProjectEntries: typeof parseProjectEntries;
|
|
120
|
+
readonly renderDevBadges: typeof renderDevBadges;
|
|
121
|
+
readonly renderDocIndex: typeof renderDocIndex;
|
|
122
|
+
readonly renderMasthead: typeof renderMasthead;
|
|
123
|
+
readonly renderProjects: typeof renderProjects;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Stamp a plugin's documentation-chrome regions - the masthead, the documentation index, the dashboard badges, and the project list - across its README, every content
|
|
127
|
+
* doc, and its webUI Support tab, from one per-plugin manifest. This is the multi-region, multi-file counterpart to {@link prepareDocs}: where that regenerates one
|
|
128
|
+
* feature-options region in one doc, this regenerates several named regions in many files, so a plugin's masthead and navigation cannot drift between the surfaces that
|
|
129
|
+
* repeat them.
|
|
130
|
+
*
|
|
131
|
+
* Pure-by-injection like {@link prepareDocs}: the `docChrome` renderers and validator arrive through the injected `chrome` namespace and the splice helper through
|
|
132
|
+
* `splice`, so this function is unit-testable against the real exports without a built `dist/`, and the CLI's single-file no-static-relative-import discipline is
|
|
133
|
+
* preserved. `fetchImpl` is injected (defaulting to the global `fetch`) so the remote project-source path is testable without network access.
|
|
134
|
+
*
|
|
135
|
+
* The manifest is loaded (a typed module or a static JSON file), validated with a field-naming diagnostic, and its optional project source resolved to inline data. The
|
|
136
|
+
* per-file edit plan is then built - the README carries the masthead, the documentation index, and the dashboard badges; each content doc carries the masthead (unless
|
|
137
|
+
* its entry opts out) and a self-omitting footer index; the webUI, when present, carries the documentation index and the project list. Every region is spliced against
|
|
138
|
+
* its own marker pair through the shared, ambiguity-rejecting splice primitive.
|
|
139
|
+
*
|
|
140
|
+
* The write is all-or-nothing across files in the realistic failure mode. Splicing happens entirely in memory first, so a missing or ambiguous marker in any file
|
|
141
|
+
* aborts the run before a single write. The writes then proceed in two phases - every file's new content is staged in a sibling `.tmp`, and only once all temps exist
|
|
142
|
+
* are they renamed over their targets - so a staging failure leaves every original untouched and each promotion is an atomic rename.
|
|
143
|
+
*
|
|
144
|
+
* @param args
|
|
145
|
+
* @param args.chrome - The injected `docChrome` module namespace (its renderers, marker constants, and validators).
|
|
146
|
+
* @param args.fetchImpl - The `fetch` implementation used to resolve a remote project source. Defaults to the global `fetch`; tests inject a fake.
|
|
147
|
+
* @param args.manifestPath - Absolute path to the plugin's manifest - a compiled module or a `.json` file.
|
|
148
|
+
* @param args.pluginRoot - Absolute path to the plugin root that the manifest's surface and file references resolve against.
|
|
149
|
+
* @param args.splice - The injected {@link spliceMarkedRegion} from `featureOptions-docs.ts`.
|
|
150
|
+
*
|
|
151
|
+
* @throws When the manifest is mis-shaped, when a resolved project source is malformed, when a target file cannot be read, or when any region's marker pair is absent or
|
|
152
|
+
* ambiguous - propagating the splice's own framed errors so the dispatch site frames them uniformly.
|
|
153
|
+
*/
|
|
154
|
+
export declare function prepareChrome({ chrome, fetchImpl, manifestPath, pluginRoot, splice }: {
|
|
155
|
+
chrome: DocChromeModule;
|
|
156
|
+
fetchImpl?: typeof fetch;
|
|
157
|
+
manifestPath: string;
|
|
158
|
+
pluginRoot: string;
|
|
159
|
+
splice: typeof spliceMarkedRegion;
|
|
160
|
+
}): Promise<void>;
|
|
74
161
|
/**
|
|
75
162
|
* Run the CLI against a synthetic argv vector. Returns the process exit code that the entry block propagates. Pure-by-injection: takes its `cwd`, `stderr`, and
|
|
76
163
|
* `sourceRoot` as arguments rather than reading them from globals, so tests exercise the full dispatch path against a captured stderr, a tmpdir source root, and a
|
|
@@ -92,4 +179,5 @@ export declare function runCli({ argv, cwd, sourceRoot, stderr }: {
|
|
|
92
179
|
write: (chunk: string) => unknown;
|
|
93
180
|
};
|
|
94
181
|
}): Promise<number>;
|
|
182
|
+
export {};
|
|
95
183
|
//# sourceMappingURL=index.d.ts.map
|