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.
Files changed (99) hide show
  1. package/build/tsconfig.json +15 -0
  2. package/dist/backpressure.d.ts +1 -1
  3. package/dist/backpressure.js +4 -4
  4. package/dist/backpressure.js.map +1 -1
  5. package/dist/cli/index.d.ts +93 -5
  6. package/dist/cli/index.js +296 -30
  7. package/dist/cli/index.js.map +1 -1
  8. package/dist/clock-double.js +2 -2
  9. package/dist/clock-double.js.map +1 -1
  10. package/dist/disposable-stack.d.ts +59 -0
  11. package/dist/disposable-stack.js +155 -0
  12. package/dist/disposable-stack.js.map +1 -0
  13. package/dist/docChrome.d.ts +263 -0
  14. package/dist/docChrome.js +364 -0
  15. package/dist/docChrome.js.map +1 -0
  16. package/dist/featureOptions-docs.d.ts +2 -2
  17. package/dist/featureOptions-docs.js +1 -1
  18. package/dist/featureOptions.d.ts +5 -5
  19. package/dist/featureOptions.js +6 -6
  20. package/dist/ffmpeg/exec.d.ts +2 -2
  21. package/dist/ffmpeg/exec.js +2 -2
  22. package/dist/ffmpeg/fmp4-builders.d.ts +77 -0
  23. package/dist/ffmpeg/fmp4-builders.js +163 -0
  24. package/dist/ffmpeg/fmp4-builders.js.map +1 -0
  25. package/dist/ffmpeg/index.d.ts +1 -0
  26. package/dist/ffmpeg/index.js +1 -0
  27. package/dist/ffmpeg/index.js.map +1 -1
  28. package/dist/ffmpeg/mp4-assembler.d.ts +45 -4
  29. package/dist/ffmpeg/mp4-assembler.js +45 -8
  30. package/dist/ffmpeg/mp4-assembler.js.map +1 -1
  31. package/dist/ffmpeg/mp4-parser.d.ts +1 -1
  32. package/dist/ffmpeg/mp4-parser.js +1 -1
  33. package/dist/ffmpeg/options.d.ts +17 -0
  34. package/dist/ffmpeg/options.js +50 -25
  35. package/dist/ffmpeg/options.js.map +1 -1
  36. package/dist/ffmpeg/process.d.ts +1 -1
  37. package/dist/ffmpeg/process.js +4 -4
  38. package/dist/ffmpeg/process.js.map +1 -1
  39. package/dist/ffmpeg/record.d.ts +26 -1
  40. package/dist/ffmpeg/record.js +12 -0
  41. package/dist/ffmpeg/record.js.map +1 -1
  42. package/dist/ffmpeg/recording-process-double.d.ts +13 -0
  43. package/dist/ffmpeg/recording-process-double.js +22 -0
  44. package/dist/ffmpeg/recording-process-double.js.map +1 -1
  45. package/dist/ffmpeg/rtp-parser.d.ts +1 -1
  46. package/dist/ffmpeg/rtp-parser.js +1 -1
  47. package/dist/ffmpeg/rtp.d.ts +4 -4
  48. package/dist/ffmpeg/rtp.js +7 -6
  49. package/dist/ffmpeg/rtp.js.map +1 -1
  50. package/dist/ffmpeg/stream.js +1 -1
  51. package/dist/ffmpeg/stream.js.map +1 -1
  52. package/dist/index.d.ts +3 -0
  53. package/dist/index.js +3 -0
  54. package/dist/index.js.map +1 -1
  55. package/dist/logclient/auth.d.ts +3 -3
  56. package/dist/logclient/auth.js +2 -2
  57. package/dist/logclient/auth.js.map +1 -1
  58. package/dist/logclient/cli-run.js +2 -2
  59. package/dist/logclient/cli-run.js.map +1 -1
  60. package/dist/logclient/cli.js +2 -2
  61. package/dist/logclient/client.js +2 -2
  62. package/dist/logclient/client.js.map +1 -1
  63. package/dist/logclient/rest.js +1 -1
  64. package/dist/logclient/socket-double.d.ts +1 -1
  65. package/dist/logclient/socket-double.js +1 -1
  66. package/dist/logclient/socket.js +5 -5
  67. package/dist/logclient/socket.js.map +1 -1
  68. package/dist/logclient/time-window.d.ts +1 -1
  69. package/dist/mqttClient.d.ts +1 -1
  70. package/dist/mqttClient.js +3 -3
  71. package/dist/mqttClient.js.map +1 -1
  72. package/dist/timer-registry.d.ts +100 -0
  73. package/dist/timer-registry.js +184 -0
  74. package/dist/timer-registry.js.map +1 -0
  75. package/dist/ui/featureOptions.js +6 -6
  76. package/dist/ui/pluginConfigSession.mjs +1 -1
  77. package/dist/ui/webUi-featureOptions/effects/persist.mjs +2 -2
  78. package/dist/ui/webUi-featureOptions/effects/theme.mjs +1 -1
  79. package/dist/ui/webUi-featureOptions/effects/tokens.mjs +1 -1
  80. package/dist/ui/webUi-featureOptions/rendering.mjs +2 -2
  81. package/dist/ui/webUi-featureOptions/selectors.mjs +3 -3
  82. package/dist/ui/webUi-featureOptions/state.mjs +72 -15
  83. package/dist/ui/webUi-featureOptions/store.mjs +1 -1
  84. package/dist/ui/webUi-featureOptions/utils.mjs +25 -1
  85. package/dist/ui/webUi-featureOptions/views/connectionError.mjs +28 -11
  86. package/dist/ui/webUi-featureOptions/views/deviceInfo.mjs +7 -0
  87. package/dist/ui/webUi-featureOptions/views/header.mjs +22 -5
  88. package/dist/ui/webUi-featureOptions/views/nav.mjs +39 -32
  89. package/dist/ui/webUi-featureOptions/views/options.mjs +13 -7
  90. package/dist/ui/webUi-featureOptions/views/search.mjs +2 -2
  91. package/dist/ui/webUi-featureOptions.mjs +109 -61
  92. package/dist/ui/webUi.mjs +48 -11
  93. package/dist/util.d.ts +118 -16
  94. package/dist/util.js +96 -14
  95. package/dist/util.js.map +1 -1
  96. package/dist/webui-loader.d.ts +80 -0
  97. package/dist/webui-loader.js +373 -0
  98. package/dist/webui-loader.js.map +1 -0
  99. package/package.json +10 -10
package/dist/cli/index.js CHANGED
@@ -11,25 +11,8 @@ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExte
11
11
  }
12
12
  return path;
13
13
  };
14
- /**
15
- * 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`
16
- * and `prepareDocs` transforms, the `runCli` dispatcher, and the entry-point execution all live here with no inter-file relative VALUE imports.
17
- *
18
- * 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
19
- * 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
20
- * every runtime edge pointing only at `node:` builtins, there is nothing to fracture - the CLI runs identically whether reached directly, through a symlink, through
21
- * 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,
22
- * 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
23
- * dynamic import the dispatch site supplies, the same indirection the `hblog` bin uses.
24
- *
25
- * The module is simultaneously the executable (run via the bin) and a side-effect-free library surface (`prepareUi` / `prepareDocs` / `runCli` / `USAGE`) that the
26
- * test suite imports. The entry block at the bottom only executes when this module is the program entry point, detected by comparing canonicalized real paths - see
27
- * its comment for why a raw path comparison is insufficient.
28
- *
29
- * @module
30
- */
14
+ import { basename, dirname, join, relative, resolve, sep } from "node:path";
31
15
  import { cp, mkdir, readFile, readdir, rename, rm, stat, writeFile } from "node:fs/promises";
32
- import { dirname, join, relative, resolve, sep } from "node:path";
33
16
  import { fileURLToPath, pathToFileURL } from "node:url";
34
17
  import { createHash } from "node:crypto";
35
18
  import { parseArgs } from "node:util";
@@ -51,7 +34,8 @@ const HASH_LENGTH = 16;
51
34
  */
52
35
  export const USAGE = "Usage: homebridge-plugin-utils <command> [options]\n\n" +
53
36
  "Commands:\n prepare-ui <destination> Mirror HBPU's webUI into the plugin's lib directory.\n" +
54
- " prepare-docs <catalog-module> [--doc <path>] Generate the Feature Options reference into the plugin's docs.\n";
37
+ " prepare-docs <catalog-module> [--doc <path>] Generate the Feature Options reference into the plugin's docs.\n" +
38
+ " prepare-chrome <manifest> [--root <dir>] Stamp the doc-chrome regions (masthead, nav, badges, projects) across the plugin's docs, README, and webUI.\n";
55
39
  /**
56
40
  * Compute a deterministic content hash over `root`'s file tree. Walks every file in lexicographic order of relative POSIX path so two runs against the same content
57
41
  * produce the same hash regardless of underlying filesystem ordering or the absolute path the tree sits at. Mixes both the relative path and the file bytes into
@@ -102,24 +86,32 @@ async function computeContentHash(root) {
102
86
  * injects a trailing-slash importmap entry that prefixes every `./lib/` import with the hashed-versioned path. Transitive imports inherit the prefix through
103
87
  * relative-URL resolution, so cache-busting reaches files the importmap never names.
104
88
  *
105
- * The content hash is the load-bearing piece for the maintainer-iteration use case. A semver-only subdir name would stay constant across the maintainer's
89
+ * The content hash is what makes the maintainer-iteration use case work. A semver-only subdir name would stay constant across the maintainer's
106
90
  * 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
107
91
  * source change produces a different subdir name, which produces different URLs, which forces fresh fetches. Same code path serves the published-release case: a
108
92
  * release ships with a fixed hash, and every consumer fetching it sees the same URL space and caches aggressively within it.
109
93
  *
110
- * Operates idempotently. A re-run against unchanged source content produces the same subdir name + same contents + same manifest. Stale prior-build subdirs are
94
+ * Operates repeatably. A re-run against unchanged source content produces the same subdir name + same contents + same manifest. Stale prior-build subdirs are
111
95
  * 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)
112
96
  * survive across runs.
113
97
  *
98
+ * 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
99
+ * `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
100
+ * 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
101
+ * 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.
102
+ *
114
103
  * @param args
115
104
  * @param args.dest - The plugin's destination directory (typically `homebridge-ui/public/lib`). Created if missing.
105
+ * @param args.loader - The injected webUI-loader namespace (marker constants, `parseWebUiLoaderConfig`, `renderWebUiBootRegion`). Absent = no stamp step, so the
106
+ * mirror-only path and its existing tests are untouched. Supplied with `splice`, it stamps the plugin's `index.html` loader region.
116
107
  * @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
117
108
  * real path; tests pass a tmpdir populated with a synthetic HBPU layout.
109
+ * @param args.splice - The injected {@link spliceMarkedRegion} that replaces the loader's marked region. Paired with `loader`; absent = no stamp step.
118
110
  *
119
- * @throws When the source has not been built (`dist/ui/` missing), the source `package.json` lacks a `version` field, or the source `dist/ui` path exists but is not a
120
- * directory.
111
+ * @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
112
+ * `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.
121
113
  */
122
- export async function prepareUi({ dest, sourceRoot }) {
114
+ export async function prepareUi({ dest, loader, sourceRoot, splice }) {
123
115
  const sourceUiDir = join(sourceRoot, "dist", "ui");
124
116
  const sourcePackageJson = join(sourceRoot, "package.json");
125
117
  // Validate the source side first so failures name the corrective action rather than the operation we couldn't perform. The two ways the source can be wrong are
@@ -152,7 +144,7 @@ export async function prepareUi({ dest, sourceRoot }) {
152
144
  const absDest = resolve(dest);
153
145
  await mkdir(absDest, { recursive: true });
154
146
  const versionedDest = join(absDest, subdir);
155
- // Idempotent reset of the versioned subdir. Wipe first so the copy step always starts from a known-empty target; the same-content idempotency property is upheld
147
+ // Repeatable reset of the versioned subdir. Wipe first so the copy step always starts from a known-empty target; the same-content stability is upheld
156
148
  // by the hash being a deterministic function of the source, so re-running with unchanged content produces the same subdir name + same contents + same manifest,
157
149
  // even though the implementation re-does the work. `force: true` swallows ENOENT so a first run against an empty destination doesn't surface the missing-target
158
150
  // as an error.
@@ -171,6 +163,49 @@ export async function prepareUi({ dest, sourceRoot }) {
171
163
  await Promise.all(entries
172
164
  .filter((entry) => entry.isDirectory() && VERSION_PATTERN.test(entry.name) && (entry.name !== subdir))
173
165
  .map((entry) => rm(join(absDest, entry.name), { force: true, recursive: true })));
166
+ // Stamp the webUI script loader when the loader namespace is injected. The mirror is complete by now (subdir, manifest, sweep), so the stamp is a final overlay on
167
+ // the plugin's index.html; without injection this is skipped entirely and the mirror-only path is unchanged. The importmap prefix derives from the mirrored package's
168
+ // own name, so a missing name is a stamp-only precondition failure rather than a mirror one.
169
+ if (loader && splice) {
170
+ const packageName = packageManifest.name;
171
+ if (!packageName) {
172
+ throw new Error("HBPU package.json at " + sourcePackageJson + " has no name field; the webUI loader importmap prefix derives from it.");
173
+ }
174
+ await stampWebUiLoader({ absDest, loader, packageName, splice });
175
+ }
176
+ }
177
+ // Stamp the rendered loader block into the plugin's index.html. Marker-gated and a no-op on repeat: no index.html beside the destination, or no BEGIN marker, is a
178
+ // silent skip (a plugin without a config UI, or one that has not opted into the stamped loader, is left untouched); otherwise the config comment is parsed, the block
179
+ // rendered from it plus this run's destination-relative libPath and the mirrored package's name, and spliced into the marked region with an atomic `.tmp` + rename.
180
+ // The parse and splice throw their own framed errors; a stamp-phase failure re-frames them so the message states the mirror already succeeded and only the stamp
181
+ // failed, since by this point the destination has been mirrored and only the plugin's index.html overlay remains.
182
+ async function stampWebUiLoader({ absDest, loader, packageName, splice }) {
183
+ const indexPath = join(dirname(absDest), "index.html");
184
+ let html;
185
+ try {
186
+ html = await readFile(indexPath, "utf8");
187
+ }
188
+ catch {
189
+ // No index.html beside the destination: a plugin without a custom config UI page has nothing to stamp.
190
+ return;
191
+ }
192
+ // No marked region means the plugin has not opted into the stamped loader; leave its index.html untouched.
193
+ if (!html.includes(loader.WEBUI_LOADER_BEGIN)) {
194
+ return;
195
+ }
196
+ try {
197
+ const config = loader.parseWebUiLoaderConfig(html, indexPath);
198
+ // The destination-relative segment the manifest fetch and the importmap prefix resolve against - `"./lib/"` for the family convention - derived from the mirror's
199
+ // own destination basename so it is correct for any destination the plugin chose.
200
+ const libPath = "./" + basename(absDest) + "/";
201
+ const script = loader.renderWebUiBootRegion({ bust: config.bust, entry: config.entry, libPath, packageName });
202
+ const stamped = splice(html, script, { beginMarker: loader.WEBUI_LOADER_BEGIN, endMarker: loader.WEBUI_LOADER_END });
203
+ await writeFile(indexPath + ".tmp", stamped, "utf8");
204
+ await rename(indexPath + ".tmp", indexPath);
205
+ }
206
+ catch (error) {
207
+ throw new Error("The webUI mirror succeeded but stamping the loader in " + indexPath + " failed: " + (error instanceof Error ? error.message : String(error)) + ".");
208
+ }
174
209
  }
175
210
  /**
176
211
  * 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
@@ -244,6 +279,188 @@ export async function prepareDocs({ catalogModulePath, docPath, render, splice }
244
279
  await writeFile(docPath + ".tmp", updated, "utf8");
245
280
  await rename(docPath + ".tmp", docPath);
246
281
  }
282
+ // The diagnostic thrown when the manifest's `projects` field is neither an inline array nor a { file } / { url } reference. Named so the two guard clauses in
283
+ // resolveProjects share one message rather than duplicating the string.
284
+ const PROJECTS_SOURCE_ERROR = "The manifest `projects` field must be an array, a { file } reference, or a { url } reference.";
285
+ // Parse JSON, re-throwing a parse failure as a framed error that names where the invalid JSON lives. Plain `JSON.parse` throws a bare `SyntaxError` with no source
286
+ // attribution; wrapping it keeps a malformed manifest or project list reporting the same "names the source" quality as the shape validators.
287
+ function parseJsonFramed(raw, describe) {
288
+ try {
289
+ return JSON.parse(raw);
290
+ }
291
+ catch (error) {
292
+ throw new Error(describe + " is not valid JSON: " + (error instanceof Error ? error.message : String(error)) + ".");
293
+ }
294
+ }
295
+ // Load a documentation-chrome manifest, dispatching on the path's extension: a `.json` file is read and parsed as data, while a `.js`/`.mjs` module is dynamically
296
+ // imported and its `docChrome` (or default) export taken. Both paths converge on one in-memory value the caller validates, so a plugin may author its manifest as a
297
+ // typed module or a static JSON file with no change to the mechanism. The dynamic import goes through a `file:` URL for the same portability reason `prepareDocs`
298
+ // converts the catalog path.
299
+ async function loadDocChromeManifest(manifestPath) {
300
+ if (manifestPath.endsWith(".json")) {
301
+ return parseJsonFramed(await readFile(manifestPath, "utf8"), "Doc-chrome manifest " + manifestPath);
302
+ }
303
+ const namespace = await import(__rewriteRelativeImportExtension(pathToFileURL(manifestPath).href));
304
+ return namespace.docChrome ?? namespace.default;
305
+ }
306
+ // Resolve the manifest's project source to an inline array of entries. The source may be omitted (no project region is stamped), an inline array, a local file relative
307
+ // to the plugin root, or a remote URL fetched at stamp time. The remote form is what lets a family-wide project list live in one external file that every plugin's build
308
+ // pulls from, keeping this library free of any plugin-specific data. The injected `parseEntries` validates the resolved entries and returns them typed, so every
309
+ // manifest-shape check stays the single responsibility of `docChrome.ts`.
310
+ async function resolveProjects(source, { fetchImpl, manifestPath, parseEntries, pluginRoot }) {
311
+ if (source === undefined) {
312
+ return undefined;
313
+ }
314
+ // An inline array is validated against the manifest path, since that is where it was authored.
315
+ if (Array.isArray(source)) {
316
+ return parseEntries(source, manifestPath);
317
+ }
318
+ if ((typeof source !== "object") || (source === null)) {
319
+ throw new Error(PROJECTS_SOURCE_ERROR);
320
+ }
321
+ // A remote reference is fetched at stamp time; a non-OK response is a framed error naming the URL and status. We read the body as text and parse it ourselves so a
322
+ // malformed remote list reports through the same framed-JSON path as a local one.
323
+ if (("url" in source) && (typeof source.url === "string")) {
324
+ const response = await fetchImpl(source.url);
325
+ if (!response.ok) {
326
+ throw new Error("Failed to fetch the project list from " + source.url + ": HTTP " + String(response.status) + ".");
327
+ }
328
+ return parseEntries(parseJsonFramed(await response.text(), "The project list fetched from " + source.url), source.url);
329
+ }
330
+ // A local-file reference is read relative to the plugin root and parsed as JSON.
331
+ if (("file" in source) && (typeof source.file === "string")) {
332
+ const filePath = resolve(pluginRoot, source.file);
333
+ return parseEntries(parseJsonFramed(await readFile(filePath, "utf8"), "The project list at " + filePath), filePath);
334
+ }
335
+ throw new Error(PROJECTS_SOURCE_ERROR);
336
+ }
337
+ /**
338
+ * Stamp a plugin's documentation-chrome regions - the masthead, the documentation index, the dashboard badges, and the project list - across its README, every content
339
+ * 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
340
+ * 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
341
+ * repeat them.
342
+ *
343
+ * Pure-by-injection like {@link prepareDocs}: the `docChrome` renderers and validator arrive through the injected `chrome` namespace and the splice helper through
344
+ * `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
345
+ * preserved. `fetchImpl` is injected (defaulting to the global `fetch`) so the remote project-source path is testable without network access.
346
+ *
347
+ * 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
348
+ * 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
349
+ * 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
350
+ * its own marker pair through the shared, ambiguity-rejecting splice primitive.
351
+ *
352
+ * 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
353
+ * 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
354
+ * are they renamed over their targets - so a staging failure leaves every original untouched and each promotion is an atomic rename.
355
+ *
356
+ * @param args
357
+ * @param args.chrome - The injected `docChrome` module namespace (its renderers, marker constants, and validators).
358
+ * @param args.fetchImpl - The `fetch` implementation used to resolve a remote project source. Defaults to the global `fetch`; tests inject a fake.
359
+ * @param args.manifestPath - Absolute path to the plugin's manifest - a compiled module or a `.json` file.
360
+ * @param args.pluginRoot - Absolute path to the plugin root that the manifest's surface and file references resolve against.
361
+ * @param args.splice - The injected {@link spliceMarkedRegion} from `featureOptions-docs.ts`.
362
+ *
363
+ * @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
364
+ * ambiguous - propagating the splice's own framed errors so the dispatch site frames them uniformly.
365
+ */
366
+ export async function prepareChrome({ chrome, fetchImpl = fetch, manifestPath, pluginRoot, splice }) {
367
+ const { DEV_BADGES_BEGIN, DEV_BADGES_END, DOCUMENTATION_BEGIN, DOCUMENTATION_END, MASTHEAD_BEGIN, MASTHEAD_END, PROJECTS_BEGIN, PROJECTS_END, parseDocChromeManifest, parseProjectEntries, renderDevBadges, renderDocIndex, renderMasthead, renderProjects } = chrome;
368
+ // Load and validate the manifest up front so a mis-shaped manifest fails with a diagnostic naming the offending field rather than a downstream render error. Parsing
369
+ // returns the same value typed as a validated manifest, so every field access below is type-checked.
370
+ const manifest = parseDocChromeManifest(await loadDocChromeManifest(manifestPath), manifestPath);
371
+ // Resolve the optional project source to inline data before rendering; the renderers never perform I/O.
372
+ const projects = await resolveProjects(manifest.projects, { fetchImpl, manifestPath, parseEntries: parseProjectEntries, pluginRoot });
373
+ // Build the per-file edit plan. Each target file collects the ordered marked-region splices that apply to it; a file may carry more than one region (the README
374
+ // carries three), each spliced independently against its own marker pair.
375
+ const plan = new Map();
376
+ const addRegion = (path, begin, end, content) => {
377
+ const edits = plan.get(path) ?? [];
378
+ edits.push({ begin, content, end });
379
+ plan.set(path, edits);
380
+ };
381
+ // The README: the masthead, the documentation index, and - when declared - the dashboard badges.
382
+ const readmePath = resolve(pluginRoot, manifest.surfaces?.readme ?? "README.md");
383
+ addRegion(readmePath, MASTHEAD_BEGIN, MASTHEAD_END, renderMasthead(manifest));
384
+ addRegion(readmePath, DOCUMENTATION_BEGIN, DOCUMENTATION_END, renderDocIndex({ manifest, surface: "readme" }));
385
+ if ((manifest.devBadges !== undefined) && (manifest.devBadges.length > 0)) {
386
+ addRegion(readmePath, DEV_BADGES_BEGIN, DEV_BADGES_END, renderDevBadges(manifest));
387
+ }
388
+ // Each content doc: the masthead and the self-omitting footer index, each unless the entry opts out. A file opted out of both - the changelog is the canonical case -
389
+ // receives no stamped regions at all while remaining listed in every documentation index.
390
+ for (const section of manifest.nav) {
391
+ for (const entry of section.entries) {
392
+ if (entry.kind !== "doc") {
393
+ continue;
394
+ }
395
+ const docPath = resolve(pluginRoot, entry.file);
396
+ if (entry.masthead !== false) {
397
+ addRegion(docPath, MASTHEAD_BEGIN, MASTHEAD_END, renderMasthead(manifest));
398
+ }
399
+ if (entry.footer !== false) {
400
+ addRegion(docPath, DOCUMENTATION_BEGIN, DOCUMENTATION_END, renderDocIndex({ currentFile: entry.file, manifest, surface: "doc-footer" }));
401
+ }
402
+ }
403
+ }
404
+ // The webUI Support tab is optional: a plugin without a custom config UI has no target to stamp, so we include its regions only when the file exists. The
405
+ // documentation index is always stamped there; the project list only when a source resolved.
406
+ const webuiPath = resolve(pluginRoot, manifest.surfaces?.webui ?? "homebridge-ui/public/index.html");
407
+ let webuiExists = true;
408
+ try {
409
+ await stat(webuiPath);
410
+ }
411
+ catch (error) {
412
+ // A missing webUI is expected for a plugin without a custom config UI; any other stat failure (a permissions error, say) is a genuine problem we must surface rather
413
+ // than silently treat as "no webUI".
414
+ if ((error instanceof Error) && ("code" in error) && (error.code === "ENOENT")) {
415
+ webuiExists = false;
416
+ }
417
+ else {
418
+ throw error;
419
+ }
420
+ }
421
+ if (webuiExists) {
422
+ addRegion(webuiPath, DOCUMENTATION_BEGIN, DOCUMENTATION_END, renderDocIndex({ manifest, surface: "webui" }));
423
+ if (projects !== undefined) {
424
+ addRegion(webuiPath, PROJECTS_BEGIN, PROJECTS_END, renderProjects(projects));
425
+ }
426
+ }
427
+ // Validate-all: read each target and splice every region in memory. Splicing validates each marker pair, so a missing, inverted, or duplicated marker anywhere aborts
428
+ // the whole run here - before any file is written - rather than leaving a partial stamp behind.
429
+ const staged = await Promise.all([...plan].map(async ([path, edits]) => {
430
+ let content;
431
+ try {
432
+ content = await readFile(path, "utf8");
433
+ }
434
+ catch {
435
+ throw new Error("Target file " + path + " could not be read; ensure it exists and carries the required markers.");
436
+ }
437
+ // Splice each region against its own marker pair; a malformed marker throws, rejecting the whole collection (per the validate-all note above).
438
+ for (const edit of edits) {
439
+ content = splice(content, edit.content, { beginMarker: edit.begin, endMarker: edit.end });
440
+ }
441
+ return { content, path };
442
+ }));
443
+ // Write-all in two phases for strong cross-file atomicity. Stage every file's new content in a sibling `.tmp` first; if any staging write fails, remove the temps
444
+ // already written and abort with every original untouched. Only once all temps exist do we rename them over their targets, so the promotion phase - a set of atomic
445
+ // renames - cannot leave a half-spliced file behind.
446
+ const tmpPaths = staged.map(({ path }) => path + ".tmp");
447
+ try {
448
+ await Promise.all(staged.map(({ content, path }) => writeFile(path + ".tmp", content, "utf8")));
449
+ }
450
+ catch (error) {
451
+ await Promise.all(tmpPaths.map((tmpPath) => rm(tmpPath, { force: true })));
452
+ throw error;
453
+ }
454
+ try {
455
+ await Promise.all(staged.map(({ path }) => rename(path + ".tmp", path)));
456
+ }
457
+ catch (error) {
458
+ // A rename-phase failure is rare - every temp staged successfully - but it can leave some targets promoted and others not. Best-effort remove any temp that survives
459
+ // so a failed run does not litter the tree; the already-promoted targets are left as they are, since their content is the intended new content.
460
+ await Promise.all(tmpPaths.map((tmpPath) => rm(tmpPath, { force: true })));
461
+ throw error;
462
+ }
463
+ }
247
464
  /**
248
465
  * 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
249
466
  * `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
@@ -261,7 +478,7 @@ export async function runCli({ argv, cwd, sourceRoot, stderr }) {
261
478
  // parseArgs runs in strict mode, so an unrecognized flag (e.g. a typo'd `--docs`) throws `ERR_PARSE_ARGS_UNKNOWN_OPTION` here rather than falling through to the
262
479
  // usage banner. That throw is intentionally uncaught - the per-case try/catch blocks below wrap only the subcommand work - so it surfaces as a rejected `runCli`
263
480
  // promise at the entry point, distinct from the default case's banner handling for an unknown positional command.
264
- const { positionals, values } = parseArgs({ allowPositionals: true, args: [...argv], options: { doc: { type: "string" } }, strict: true });
481
+ const { positionals, values } = parseArgs({ allowPositionals: true, args: [...argv], options: { doc: { type: "string" }, root: { type: "string" } }, strict: true });
265
482
  const [command, ...rest] = positionals;
266
483
  switch (command) {
267
484
  case "prepare-ui": {
@@ -270,8 +487,24 @@ export async function runCli({ argv, cwd, sourceRoot, stderr }) {
270
487
  stderr.write("homebridge-plugin-utils prepare-ui: missing required destination argument.\n");
271
488
  return 1;
272
489
  }
490
+ // Reach HBPU's own loader renderer and the splice primitive through computed dynamic imports of their compiled modules - never static relative imports - so the
491
+ // single-file bin stays symlink-safe. A dist complete enough to mirror `dist/ui` yet missing these is a build inconsistency that must fail loudly rather than
492
+ // silently skip the wanted stamp, exactly as prepare-docs hard-fails on its own missing renderer.
493
+ const loaderPath = join(sourceRoot, "dist", "webui-loader.js");
494
+ const uiSplicePath = join(sourceRoot, "dist", "featureOptions-docs.js");
495
+ let loader;
496
+ let uiSplicer;
497
+ try {
498
+ loader = await import(__rewriteRelativeImportExtension(pathToFileURL(loaderPath).href));
499
+ uiSplicer = await import(__rewriteRelativeImportExtension(pathToFileURL(uiSplicePath).href));
500
+ }
501
+ catch {
502
+ stderr.write("homebridge-plugin-utils prepare-ui: HBPU has not been built: " + loaderPath + " or " + uiSplicePath + " is missing. Run `npm run build` in " +
503
+ "HBPU first.\n");
504
+ return 1;
505
+ }
273
506
  try {
274
- await prepareUi({ dest: destination, sourceRoot });
507
+ await prepareUi({ dest: destination, loader, sourceRoot, splice: uiSplicer.spliceMarkedRegion });
275
508
  }
276
509
  catch (error) {
277
510
  stderr.write("homebridge-plugin-utils prepare-ui: " + (error instanceof Error ? error.message : String(error)) + "\n");
@@ -310,6 +543,39 @@ export async function runCli({ argv, cwd, sourceRoot, stderr }) {
310
543
  }
311
544
  return 0;
312
545
  }
546
+ case "prepare-chrome": {
547
+ const [manifestArg] = rest;
548
+ if (!manifestArg) {
549
+ stderr.write("homebridge-plugin-utils prepare-chrome: missing required manifest argument.\n");
550
+ return 1;
551
+ }
552
+ // Resolve the manifest path and the plugin root that the manifest's surface and file references resolve against. The root defaults to the working directory.
553
+ const manifestPath = resolve(cwd, manifestArg);
554
+ const pluginRoot = resolve(cwd, values.root ?? ".");
555
+ // Reach HBPU's own doc-chrome renderers and the splice primitive through computed dynamic imports of their compiled modules - never static relative imports - so
556
+ // the single-file bin stays symlink-safe. A failed import means HBPU itself has not been built, a distinct and actionable condition from a downstream failure.
557
+ const chromePath = join(sourceRoot, "dist", "docChrome.js");
558
+ const splicePath = join(sourceRoot, "dist", "featureOptions-docs.js");
559
+ let chrome;
560
+ let splicer;
561
+ try {
562
+ chrome = await import(__rewriteRelativeImportExtension(pathToFileURL(chromePath).href));
563
+ splicer = await import(__rewriteRelativeImportExtension(pathToFileURL(splicePath).href));
564
+ }
565
+ catch {
566
+ stderr.write("homebridge-plugin-utils prepare-chrome: HBPU has not been built: " + chromePath + " or " + splicePath + " is missing. Run `npm run build` in " +
567
+ "HBPU first.\n");
568
+ return 1;
569
+ }
570
+ try {
571
+ await prepareChrome({ chrome, manifestPath, pluginRoot, splice: splicer.spliceMarkedRegion });
572
+ }
573
+ catch (error) {
574
+ stderr.write("homebridge-plugin-utils prepare-chrome: " + (error instanceof Error ? error.message : String(error)) + "\n");
575
+ return 1;
576
+ }
577
+ return 0;
578
+ }
313
579
  default: {
314
580
  stderr.write(USAGE);
315
581
  // A bare `homebridge-plugin-utils` invocation (no command at all) is treated as a help request and exits 0; an unknown command is a misuse and exits 1. Both
@@ -322,11 +588,11 @@ export async function runCli({ argv, cwd, sourceRoot, stderr }) {
322
588
  * Decide whether this module is the program entry point (run as the bin) versus imported as a library (by the test suite). Canonicalizes the real path of both the
323
589
  * launch path (`process.argv[1]`) and this module's own URL before comparing them.
324
590
  *
325
- * The realpath normalization is the load-bearing detail. npm exposes a bin as a symlink in `node_modules/.bin`, so under default Node the launch path is the
591
+ * The realpath normalization is the detail that matters. npm exposes a bin as a symlink in `node_modules/.bin`, so under default Node the launch path is the
326
592
  * symlink while `import.meta.url` is the resolved target - a raw string comparison never matches and the CLI silently does nothing. Canonicalizing both sides
327
593
  * collapses that indirection (and any `file:`-dependency, copied-package, or `--preserve-symlinks` layout) to a single real path, so the check holds however the
328
594
  * launcher reached this file. We keep this explicit realpath comparison rather than deferring to `import.meta.main`: the symlink and copied-package indirection is the
329
- * load-bearing concern the entry-point check exists to handle, and resolving it explicitly keeps that handling visible at the call site.
595
+ * concern the entry-point check exists to handle, and resolving it explicitly keeps that handling visible at the call site.
330
596
  *
331
597
  * @returns `true` when invoked as the program entry, `false` when imported or when the launch path cannot be resolved.
332
598
  */
@@ -344,7 +610,7 @@ function isEntryPoint() {
344
610
  }
345
611
  }
346
612
  // Execute the CLI when this module is the program entry point. When imported by the test suite instead, `isEntryPoint()` is false and the module exposes
347
- // `prepareUi` / `prepareDocs` / `runCli` / `USAGE` as a side-effect-free library surface.
613
+ // `prepareUi` / `prepareDocs` / `prepareChrome` / `runCli` / `USAGE` as a side-effect-free library surface.
348
614
  if (isEntryPoint()) {
349
615
  // Resolve HBPU's package root from this file's real location. The compiled CLI sits at `dist/cli/index.js`; walking two segments up from its real directory
350
616
  // reaches the package root regardless of how the package is installed (a plugin's `node_modules`, a workspace symlink, a global install) or which Node
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AACA;;;GAGG;;;;;;;;;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7F,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAExD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,4JAA4J;AAC5J,kKAAkK;AAClK,sJAAsJ;AACtJ,4JAA4J;AAC5J,mDAAmD;AACnD,MAAM,eAAe,GAAG,4CAA4C,CAAC;AAErE,gKAAgK;AAChK,qKAAqK;AACrK,iKAAiK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CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;AACtH,CAAC"}
@@ -7,7 +7,7 @@ import { onAbort } from "./util.js";
7
7
  * Construct the rejection a {@link TestClock} `delay` produces when its signal aborts, matching `node:timers/promises` `setTimeout` exactly: a plain `Error` whose `name`
8
8
  * is `"AbortError"` and whose `code` is the STRING `"ABORT_ERR"`. The real primitive's rejection is a dedicated internal class (not a `DOMException`, whose `code` is the
9
9
  * numeric `20`, and there is no constructable `AbortError` global), so the double cannot match the constructor or prototype identity - it matches the observable `name`
10
- * and `code` a consumer discriminates on, which is the contract that matters.
10
+ * and `code` a consumer branches on, which is the contract that matters.
11
11
  *
12
12
  * @returns The `AbortError`-shaped rejection.
13
13
  */
@@ -129,7 +129,7 @@ export class TestClock {
129
129
  get pending() {
130
130
  return this.#pending.length;
131
131
  }
132
- // Remove `entry` from `#pending` by identity. Idempotent: a guarded `indexOf` + `splice` makes a second removal (e.g. an abort that races a resolve) a safe no-op and
132
+ // Remove `entry` from `#pending` by identity. A guarded `indexOf` + `splice` makes a second removal (e.g. an abort that races a resolve) a safe no-op and
133
133
  // never removes the wrong entry, so `#pending` stays consistent across any resolve-and-abort interleaving.
134
134
  #remove(entry) {
135
135
  const index = this.#pending.indexOf(entry);
@@ -1 +1 @@
1
- {"version":3,"file":"clock-double.js","sourceRoot":"","sources":["../src/clock-double.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAiBH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAcpC;;;;;;;GAOG;AACH,SAAS,UAAU;IAEjB,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAErD,KAAK,CAAC,IAAI,GAAG,YAAY,CAAC;IAE1B,+JAA+J;IAC/J,2GAA2G;IAC1G,KAAkC,CAA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KAAK,CAAC,CAAC;QAE1B,IAAG,IAAI,EAAE,MAAM,KAAK,SAAS,EAAE,CAAC;YAE9B,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE;gBAExC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;gBACpB,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;YACvB,CAAC,CAAC,CAAC;QACL,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;;;OAIG;IACI,GAAG;QAER,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED;;;;;OAKG;IACH,IAAW,OAAO;QAEhB,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;IAC9B,CAAC;IAED,0JAA0J;IAC1J,2GAA2G;IAC3G,OAAO,CAAC,KAAiB;QAEvB,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAE3C,IAAG,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;YAEhB,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QACjC,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * A container that aggregates disposable resources and disposes them, in reverse (last-in-first-out) order, when the stack itself is disposed.
3
+ *
4
+ * The class satisfies the platform `DisposableStack` interface by construction - the `implements` clause below binds it to `globalThis.DisposableStack`, so the
5
+ * compiler enforces that the name's promise (the platform contract) is kept at the definition site.
6
+ *
7
+ * @category Utilities
8
+ */
9
+ export declare class DisposableStack implements InstanceType<typeof globalThis.DisposableStack> {
10
+ #private;
11
+ readonly [Symbol.toStringTag] = "DisposableStack";
12
+ /**
13
+ * Whether this stack has been disposed.
14
+ */
15
+ get disposed(): boolean;
16
+ /**
17
+ * Register a {@link Disposable} whose `[Symbol.dispose]()` runs when this stack is disposed, returning the value unchanged.
18
+ *
19
+ * `null` and `undefined` pass through without being registered. The dispose method is captured at registration time and invoked with the value as its receiver, so
20
+ * a later mutation of `value[Symbol.dispose]` cannot change what runs.
21
+ *
22
+ * @param value - The resource to register, or `null`/`undefined` to skip registration.
23
+ * @returns The provided `value`.
24
+ */
25
+ use<T extends Disposable | null | undefined>(value: T): T;
26
+ /**
27
+ * Register a value together with an explicit disposal callback, returning the value unchanged. The callback is invoked with the value as its first argument when
28
+ * this stack is disposed.
29
+ *
30
+ * @param value - The value to associate with the callback.
31
+ * @param onDispose - The disposal callback, invoked with `value`.
32
+ * @returns The provided `value`.
33
+ */
34
+ adopt<T>(value: T, onDispose: (value: T) => void): T;
35
+ /**
36
+ * Register a callback to run when this stack is disposed.
37
+ *
38
+ * @param onDispose - The callback to run on disposal.
39
+ */
40
+ defer(onDispose: () => void): void;
41
+ /**
42
+ * Move every pending disposer out of this stack into a fresh {@link DisposableStack}, preserving registration order, and mark this stack disposed without running
43
+ * anything. This is the "commit" primitive: after a successful acquire sequence, moving the disposers away disarms this stack's scope-bound cleanup while handing
44
+ * responsibility for those resources to the returned stack.
45
+ *
46
+ * @returns A new stack owning the transferred disposers.
47
+ */
48
+ move(): DisposableStack;
49
+ /**
50
+ * Dispose every registered resource in reverse (last-in-first-out) order. A second call is a no-op. Every disposer runs even when an earlier one throws: a single
51
+ * failure is rethrown after the sweep completes, and multiple failures chain through `SuppressedError` (the newest failure wrapping the accumulated one).
52
+ */
53
+ dispose(): void;
54
+ /**
55
+ * Dispose this stack. Enables `using` semantics by delegating to {@link dispose}.
56
+ */
57
+ [Symbol.dispose](): void;
58
+ }
59
+ //# sourceMappingURL=disposable-stack.d.ts.map