@qontinui/ui-bridge-wrapper 0.4.0 → 0.4.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"capture-specs-cli.d.ts","sourceRoot":"","sources":["../src/capture-specs-cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AASH,eAAO,MAAM,KAAK,uqCAsBjB,CAAC;AAOF,2EAA2E;AAC3E,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb;AAED,uCAAuC;AACvC,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,KAAK,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC;IAC3B,IAAI,EAAE,OAAO,CAAC;CACf;AAED,6EAA6E;AAC7E,qBAAa,kBAAmB,SAAQ,KAAK;gBAC/B,OAAO,EAAE,MAAM;CAI5B;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,UAAU,EAAE,CAoBrE;AAED,gEAAgE;AAChE,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,UAAU,EAAE,CAK3E;AAED;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,GAAI,GAAG,MAAM,KAAG,OACuB,CAAC;AAE9D,6DAA6D;AAC7D,eAAO,MAAM,MAAM,GAAI,GAAG,MAAM,KAAG,MAMlC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,WAAW,GAAI,GAAG,MAAM,KAAG,OACa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EAAE,MAAM,EAAE,MAAM,GAAG,UAAU,EAAE,CAK3E;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,UAAU,EAAE,EACrB,MAAM,EAAE,MAAM,GACb;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAYhD;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,cAAc,CA8CxD;AAaD,8EAA8E;AAC9E,wBAAgB,YAAY,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,CAKvD"}
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Shared CLI argument primitives for the package bins (`ui-bridge-login-web`,
3
+ * `ui-bridge-capture-specs`, `ui-bridge-inject`). Each bin used to re-implement
4
+ * its own `valueOf`/`has`/unknown-flag kit, and those copies drifted — most
5
+ * importantly, every one of them silently SWALLOWED a flag-shaped value: a
6
+ * value-flag followed by another `--flag` (e.g. `--success --headed`) captured
7
+ * the flag as the value, so a *successful* login could report `ok:false` because
8
+ * its `--success` target was literally `"--headed"`. The kit below is the single
9
+ * home for argument reading and rejects that swallow uniformly.
10
+ *
11
+ * The bins keep their own typed `parseArgs` (the arg SHAPE differs per bin); this
12
+ * module only owns the low-level reading + the cross-bin invariants (flag-shaped
13
+ * value rejection, unknown-flag rejection, the shared `--quiet`/`--help` flags,
14
+ * and a `--quiet`-aware stderr logger).
15
+ */
16
+ /**
17
+ * Construct a bin's own domain error from a message. Passing the factory keeps
18
+ * thrown errors the bin's specific type (`LoginCliArgError` / `CaptureCliArgError`
19
+ * / `InjectCliArgError`) so each bin's `main()` `instanceof` catch still fires.
20
+ */
21
+ export type ArgErrorFactory = (message: string) => Error;
22
+ /**
23
+ * Flags shared by every bin. A bin unions these into its own KNOWN set so the
24
+ * common surface (`--help`, `-h`, `--quiet`) is defined in exactly one place.
25
+ */
26
+ export declare const COMMON_FLAGS: ReadonlySet<string>;
27
+ /**
28
+ * Guard a single value consumed by a *switch-style* parser (`argv[++i]`) against
29
+ * the flag-shaped swallow. Returns the value, `null` when it's simply absent
30
+ * (end of argv — the caller applies its own required/default handling), and
31
+ * THROWS (via `error`) when the value is flag-shaped — that is never an intended
32
+ * value, it's an omitted argument.
33
+ */
34
+ export declare function consumeValue(flag: string, raw: string | undefined, error: ArgErrorFactory): string | null;
35
+ /**
36
+ * An `indexOf`-based reader for the browser bins' flat arg lists. Rejects unknown
37
+ * `--flags` up front (matching each bin's prior behavior) and rejects flag-shaped
38
+ * values for value-flags (the swallow fix).
39
+ */
40
+ export declare class ArgReader {
41
+ private readonly argv;
42
+ private readonly error;
43
+ /**
44
+ * @param argv Already sliced past `node script`.
45
+ * @param known All flags the bin recognizes (union the bin's set with {@link COMMON_FLAGS}).
46
+ * @param error Factory producing the bin's domain error type.
47
+ */
48
+ constructor(argv: readonly string[], known: ReadonlySet<string>, error: ArgErrorFactory);
49
+ /** True if `name` appears as a bare boolean flag. */
50
+ has(name: string): boolean;
51
+ /**
52
+ * Value following the value-flag `name`, or `null` when the flag is absent OR
53
+ * has no following token (the caller defaults it). Throws when the following
54
+ * token is flag-shaped — the swallow this kit exists to kill.
55
+ */
56
+ value(name: string): string | null;
57
+ }
58
+ /**
59
+ * Build a `--quiet`-aware stderr logger. When `quiet` is true it drops every
60
+ * line; otherwise it writes `<prefix> <message>` (or just `<message>` when
61
+ * `prefix` is empty) to stderr. Shared so all three bins honor `--quiet`
62
+ * identically.
63
+ */
64
+ export declare function makeLogger(prefix: string, quiet: boolean): (message: string) => void;
65
+ //# sourceMappingURL=cli-args.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-args.d.ts","sourceRoot":"","sources":["../src/cli-args.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,KAAK,CAAC;AAEzD;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,WAAW,CAAC,MAAM,CAAwC,CAAC;AAWtF;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,GAAG,SAAS,EACvB,KAAK,EAAE,eAAe,GACrB,MAAM,GAAG,IAAI,CAMf;AAED;;;;GAIG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAoB;IACzC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAkB;IAExC;;;;OAIG;gBACS,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,eAAe;IAUvF,qDAAqD;IACrD,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI1B;;;;OAIG;IACH,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;CAWnC;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAKpF"}
package/dist/index.cjs CHANGED
@@ -226,7 +226,20 @@ var HeadlessTransport = class extends BaseTransport {
226
226
  };
227
227
  }
228
228
  async onReady() {
229
- const { launchHeadlessTab } = await import('@qontinui/ui-bridge-headless');
229
+ let launchHeadlessTab;
230
+ try {
231
+ ({ launchHeadlessTab } = await import('@qontinui/ui-bridge-headless'));
232
+ } catch (err) {
233
+ const cause = err instanceof Error ? err.message : String(err);
234
+ throw new WrapperTransportError(
235
+ "INVALID_CONFIG",
236
+ `Transport kind '${this.kind}' needs the optional '@qontinui/ui-bridge-headless' peer, which is not installed. Install it and the Chromium browser:
237
+ npm i @qontinui/ui-bridge-headless && npx playwright install chromium
238
+ (bare \`npx @qontinui/ui-bridge-wrapper \u2026\` does NOT install peers \u2014 pass each peer with \`-p\`, e.g.
239
+ npx -y -p @qontinui/ui-bridge-wrapper -p @qontinui/ui-bridge -p @qontinui/ui-bridge-headless -p playwright ui-bridge-login-web \u2026)
240
+ Underlying import error: ${cause}`
241
+ );
242
+ }
230
243
  const initScripts = await this.buildInitScripts();
231
244
  const tab = await launchHeadlessTab({
232
245
  url: this.options.targetUrl,