tslaws 1.0.0 → 1.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 (51) hide show
  1. package/README.md +183 -187
  2. package/dist/api.d.ts +86 -0
  3. package/dist/api.js +78 -0
  4. package/dist/badge.d.ts +111 -0
  5. package/dist/badge.js +288 -0
  6. package/dist/browser.d.ts +5 -2
  7. package/dist/browser.js +403 -173
  8. package/dist/browserApi.d.ts +305 -0
  9. package/dist/browserApi.js +456 -0
  10. package/dist/browserServer.d.ts +13 -0
  11. package/dist/browserServer.js +406 -0
  12. package/dist/certificates.js +50 -28
  13. package/dist/chc.d.ts +13 -1
  14. package/dist/chc.js +40 -8
  15. package/dist/check.js +64 -36
  16. package/dist/cli.d.ts +16 -0
  17. package/dist/cli.js +78 -1
  18. package/dist/compile.js +46 -5
  19. package/dist/coverage.d.ts +17 -0
  20. package/dist/coverage.js +297 -24
  21. package/dist/derived.d.ts +2 -0
  22. package/dist/derived.js +9 -4
  23. package/dist/generators.d.ts +5 -1
  24. package/dist/generators.js +50 -4
  25. package/dist/githubCli.js +88 -15
  26. package/dist/isolate.d.ts +5 -0
  27. package/dist/isolate.js +1 -1
  28. package/dist/lawHost.d.ts +2 -0
  29. package/dist/lawHost.js +32 -21
  30. package/dist/lawRuntime.d.ts +6 -0
  31. package/dist/lawRuntime.js +86 -7
  32. package/dist/nativeZ3.d.ts +11 -0
  33. package/dist/nativeZ3.js +162 -0
  34. package/dist/plan.d.ts +7 -0
  35. package/dist/plan.js +11 -0
  36. package/dist/pluginHooks.d.ts +4 -0
  37. package/dist/pluginHooks.js +13 -4
  38. package/dist/proofCache.d.ts +24 -0
  39. package/dist/proofCache.js +135 -0
  40. package/dist/property.d.ts +2 -2
  41. package/dist/property.js +33 -8
  42. package/dist/propertyWorker.js +14 -8
  43. package/dist/sandbox.d.ts +1 -1
  44. package/dist/sandbox.js +48 -8
  45. package/dist/seal.js +47 -8
  46. package/dist/smt.d.ts +16 -2
  47. package/dist/smt.js +241 -31
  48. package/dist/symbolic.d.ts +38 -3
  49. package/dist/symbolic.js +504 -47
  50. package/dist/types.d.ts +9 -0
  51. package/package.json +7 -7
@@ -48,6 +48,462 @@ export function type(field, text) {
48
48
  fire(field, 'input');
49
49
  fire(field, 'change');
50
50
  }
51
+ function bridge() {
52
+ const fn = globalThis.__tslawsBridge;
53
+ if (typeof fn !== 'function')
54
+ throw new Error('trusted browser interactions (`page`, `userEvent`, `user`, `mock`) require running inside `tslaws` browser runner');
55
+ return fn;
56
+ }
57
+ function wirePattern(text) {
58
+ return typeof text === 'string' ? text : { __re: true, source: text.source, flags: text.flags };
59
+ }
60
+ let targetSeq = 0;
61
+ async function withLocatorSteps(target, run) {
62
+ if (target instanceof Locator)
63
+ return run(target.steps);
64
+ if (typeof target === 'string')
65
+ return run([{ k: 'css', selector: target }]);
66
+ const id = `t${++targetSeq}`;
67
+ target.setAttribute('data-tslaws-uid', id);
68
+ try {
69
+ return await run([{ k: 'css', selector: `[data-tslaws-uid="${id}"]` }]);
70
+ }
71
+ finally {
72
+ target.removeAttribute('data-tslaws-uid');
73
+ }
74
+ }
75
+ /**
76
+ * Chainable, auto-waiting Playwright-backed browser locator (`page.getByRole(...)`, `page.getByText(...)`, etc.),
77
+ * providing Vitest Browser Mode ergonomics natively inside `tslaws` with zero external runner or Vite dependency.
78
+ */
79
+ export class Locator {
80
+ steps;
81
+ constructor(steps) {
82
+ this.steps = steps;
83
+ }
84
+ next(step) {
85
+ return new Locator([...this.steps, step]);
86
+ }
87
+ getByRole(role, options) {
88
+ const wire = options === undefined
89
+ ? undefined
90
+ : {
91
+ ...options,
92
+ ...(options.name === undefined ? {} : { name: wirePattern(options.name) }),
93
+ };
94
+ return this.next({ k: 'role', role, ...(wire === undefined ? {} : { options: wire }) });
95
+ }
96
+ getByText(text, options) {
97
+ return this.next({ k: 'text', text: wirePattern(text), exact: options?.exact });
98
+ }
99
+ getByLabelText(text, options) {
100
+ return this.next({ k: 'label', text: wirePattern(text), exact: options?.exact });
101
+ }
102
+ getByPlaceholder(text, options) {
103
+ return this.next({ k: 'placeholder', text: wirePattern(text), exact: options?.exact });
104
+ }
105
+ getByTestId(testId) {
106
+ return this.next({ k: 'testId', testId });
107
+ }
108
+ getByAltText(text, options) {
109
+ return this.next({ k: 'altText', text: wirePattern(text), exact: options?.exact });
110
+ }
111
+ getByTitle(text, options) {
112
+ return this.next({ k: 'title', text: wirePattern(text), exact: options?.exact });
113
+ }
114
+ locator(selector) {
115
+ return this.next({ k: 'css', selector });
116
+ }
117
+ first() {
118
+ return this.next({ k: 'first' });
119
+ }
120
+ last() {
121
+ return this.next({ k: 'last' });
122
+ }
123
+ nth(index) {
124
+ return this.next({ k: 'nth', index });
125
+ }
126
+ filter(options) {
127
+ return this.next({
128
+ k: 'filter',
129
+ ...(options.hasText === undefined ? {} : { hasText: wirePattern(options.hasText) }),
130
+ ...(options.hasNotText === undefined ? {} : { hasNotText: wirePattern(options.hasNotText) }),
131
+ ...(options.has === undefined ? {} : { has: options.has.steps }),
132
+ ...(options.hasNot === undefined ? {} : { hasNot: options.hasNot.steps }),
133
+ });
134
+ }
135
+ async click(options) {
136
+ await bridge()({ action: 'click', locator: this.steps, button: options?.button, force: options?.force });
137
+ }
138
+ async dblClick(options) {
139
+ await bridge()({ action: 'dblClick', locator: this.steps, button: options?.button, force: options?.force });
140
+ }
141
+ async tripleClick(options) {
142
+ await bridge()({ action: 'tripleClick', locator: this.steps, button: options?.button, force: options?.force });
143
+ }
144
+ async hover(options) {
145
+ await bridge()({ action: 'hover', locator: this.steps, force: options?.force });
146
+ }
147
+ async unhover() {
148
+ await bridge()({ action: 'unhover' });
149
+ }
150
+ async focus() {
151
+ await bridge()({ action: 'focus', locator: this.steps });
152
+ }
153
+ async fill(value) {
154
+ await bridge()({ action: 'fill', locator: this.steps, text: value });
155
+ }
156
+ async clear() {
157
+ await bridge()({ action: 'clear', locator: this.steps });
158
+ }
159
+ async type(value) {
160
+ await bridge()({ action: 'type', locator: this.steps, text: value });
161
+ }
162
+ async press(key) {
163
+ await bridge()({ action: 'press', locator: this.steps, key });
164
+ }
165
+ async selectOptions(values) {
166
+ await bridge()({ action: 'select', locator: this.steps, values });
167
+ }
168
+ async check(options) {
169
+ await bridge()({ action: 'check', locator: this.steps, force: options?.force });
170
+ }
171
+ async uncheck(options) {
172
+ await bridge()({ action: 'uncheck', locator: this.steps, force: options?.force });
173
+ }
174
+ async dropTo(target) {
175
+ await withLocatorSteps(target, async (targetLocator) => {
176
+ await bridge()({ action: 'dragAndDrop', locator: this.steps, targetLocator });
177
+ });
178
+ }
179
+ async screenshot(options) {
180
+ return (await bridge()({ action: 'screenshot', locator: this.steps, path: options?.path }));
181
+ }
182
+ async count() {
183
+ return (await bridge()({ action: 'count', locator: this.steps }));
184
+ }
185
+ async isVisible() {
186
+ return (await bridge()({ action: 'isVisible', locator: this.steps }));
187
+ }
188
+ async isEnabled() {
189
+ return (await bridge()({ action: 'isEnabled', locator: this.steps }));
190
+ }
191
+ async isChecked() {
192
+ return (await bridge()({ action: 'isChecked', locator: this.steps }));
193
+ }
194
+ async textContent() {
195
+ return (await bridge()({ action: 'textContent', locator: this.steps }));
196
+ }
197
+ async inputValue() {
198
+ return (await bridge()({ action: 'inputValue', locator: this.steps }));
199
+ }
200
+ async getAttribute(name) {
201
+ return (await bridge()({ action: 'getAttribute', locator: this.steps, name }));
202
+ }
203
+ async waitFor(options) {
204
+ await bridge()({ action: 'waitFor', locator: this.steps, state: options?.state, timeout: options?.timeout });
205
+ }
206
+ /** Returns all currently matching live DOM elements in the page. */
207
+ async elements() {
208
+ const token = `f${++targetSeq}`;
209
+ await bridge()({ action: 'markElements', locator: this.steps, token });
210
+ const found = [...document.querySelectorAll(`[data-tslaws-found^="${token}:"]`)];
211
+ for (const el of found)
212
+ el.removeAttribute('data-tslaws-found');
213
+ return found;
214
+ }
215
+ /** Returns the single matching DOM element, or `null` if none matched (throws if multiple match). */
216
+ async query() {
217
+ const found = await this.elements();
218
+ if (found.length > 1)
219
+ throw new Error(`locator matched ${found.length} elements; narrow it with .first() or .nth()`);
220
+ return found[0] ?? null;
221
+ }
222
+ /** Returns the single matching DOM element, throwing if zero or multiple elements match. */
223
+ async element() {
224
+ const found = await this.elements();
225
+ if (found.length === 0)
226
+ throw new Error('locator matched no elements');
227
+ if (found.length > 1)
228
+ throw new Error(`locator matched ${found.length} elements; narrow it with .first() or .nth()`);
229
+ return found[0];
230
+ }
231
+ }
232
+ const rootLocator = new Locator([]);
233
+ /**
234
+ * Native Vitest-Browser-style `page` API backed directly by Playwright: auto-retrying accessible locators
235
+ * (`getByRole`, `getByText`, `getByLabelText`, `getByPlaceholder`, `getByTestId`, `getByAltText`, `getByTitle`,
236
+ * `locator`), viewport resizing, and page screenshots.
237
+ */
238
+ export const page = {
239
+ getByRole(role, options) {
240
+ return rootLocator.getByRole(role, options);
241
+ },
242
+ getByText(text, options) {
243
+ return rootLocator.getByText(text, options);
244
+ },
245
+ getByLabelText(text, options) {
246
+ return rootLocator.getByLabelText(text, options);
247
+ },
248
+ getByPlaceholder(text, options) {
249
+ return rootLocator.getByPlaceholder(text, options);
250
+ },
251
+ getByTestId(testId) {
252
+ return rootLocator.getByTestId(testId);
253
+ },
254
+ getByAltText(text, options) {
255
+ return rootLocator.getByAltText(text, options);
256
+ },
257
+ getByTitle(text, options) {
258
+ return rootLocator.getByTitle(text, options);
259
+ },
260
+ locator(selector) {
261
+ return rootLocator.locator(selector);
262
+ },
263
+ /** Wraps a live DOM element in a Playwright-backed `Locator`. */
264
+ elementLocator(el) {
265
+ let id = el.getAttribute('data-tslaws-uid');
266
+ if (id === null) {
267
+ id = `e${++targetSeq}`;
268
+ el.setAttribute('data-tslaws-uid', id);
269
+ registry().push(() => el.removeAttribute('data-tslaws-uid'));
270
+ }
271
+ return new Locator([{ k: 'css', selector: `[data-tslaws-uid="${id}"]` }]);
272
+ },
273
+ /** Resizes the browser viewport (for responsive layout and media-query laws). */
274
+ async viewport(width, height) {
275
+ await bridge()({ action: 'setViewport', width, height });
276
+ },
277
+ /** Takes a real Playwright PNG screenshot of the page (returns base64, and writes to `path` if provided). */
278
+ async screenshot(options) {
279
+ return (await bridge()({ action: 'screenshot', path: options?.path, fullPage: options?.fullPage }));
280
+ },
281
+ };
282
+ /**
283
+ * Trusted browser interactions driven by Playwright (`isTrusted: true`, real hit-testing, `:hover`, `:focus-visible`,
284
+ * native form controls, keyboard navigation, and drag-and-drop), matching Vitest Browser Mode's `userEvent`.
285
+ */
286
+ export const userEvent = {
287
+ /** Performs a real pointer/mouse click with hit-testing and focus. */
288
+ async click(target, options) {
289
+ await withLocatorSteps(target, async (locator) => {
290
+ await bridge()({ action: 'click', locator, button: options?.button, force: options?.force });
291
+ });
292
+ },
293
+ /** Performs a real double click. */
294
+ async dblClick(target, options) {
295
+ await withLocatorSteps(target, async (locator) => {
296
+ await bridge()({ action: 'dblClick', locator, button: options?.button, force: options?.force });
297
+ });
298
+ },
299
+ /** Performs a real triple click. */
300
+ async tripleClick(target, options) {
301
+ await withLocatorSteps(target, async (locator) => {
302
+ await bridge()({ action: 'tripleClick', locator, button: options?.button, force: options?.force });
303
+ });
304
+ },
305
+ /** Moves the real pointer over `target`, triggering `:hover` and pointer events. */
306
+ async hover(target, options) {
307
+ await withLocatorSteps(target, async (locator) => {
308
+ await bridge()({ action: 'hover', locator, force: options?.force });
309
+ });
310
+ },
311
+ /** Moves the pointer away from the hovered element. */
312
+ async unhover() {
313
+ await bridge()({ action: 'unhover' });
314
+ },
315
+ /** Focuses `target` through the browser engine. */
316
+ async focus(target) {
317
+ await withLocatorSteps(target, async (locator) => {
318
+ await bridge()({ action: 'focus', locator });
319
+ });
320
+ },
321
+ /** Clears and fills an input/textarea with real browser input events. */
322
+ async fill(target, value) {
323
+ await withLocatorSteps(target, async (locator) => {
324
+ await bridge()({ action: 'fill', locator, text: value });
325
+ });
326
+ },
327
+ /** Clears an input/textarea value. */
328
+ async clear(target) {
329
+ await withLocatorSteps(target, async (locator) => {
330
+ await bridge()({ action: 'clear', locator });
331
+ });
332
+ },
333
+ /** Types `value` keystroke by keystroke into `target`. */
334
+ async type(target, value) {
335
+ await withLocatorSteps(target, async (locator) => {
336
+ await bridge()({ action: 'type', locator, text: value });
337
+ });
338
+ },
339
+ /** Presses a keyboard key (for example `'Enter'`, `'Escape'`, `'Tab'`, `'ArrowDown'`). */
340
+ async press(key) {
341
+ await bridge()({ action: 'press', key });
342
+ },
343
+ /** Types text and special key sequences (e.g. `'hello{Enter}'`, `'{Shift>}a{/Shift}'`) through the browser keyboard. */
344
+ async keyboard(keys) {
345
+ await bridge()({ action: 'keyboard', text: keys });
346
+ },
347
+ /** Moves focus via the Tab key (`{ shift: true }` for Shift+Tab). */
348
+ async tab(options) {
349
+ await bridge()({ action: 'tab', shift: options?.shift });
350
+ },
351
+ /** Selects one or more `<option>` values on a `<select>` element. */
352
+ async selectOptions(target, values) {
353
+ await withLocatorSteps(target, async (locator) => {
354
+ await bridge()({ action: 'select', locator, values });
355
+ });
356
+ },
357
+ /** Checks a checkbox or radio control. */
358
+ async check(target, options) {
359
+ await withLocatorSteps(target, async (locator) => {
360
+ await bridge()({ action: 'check', locator, force: options?.force });
361
+ });
362
+ },
363
+ /** Unchecks a checkbox control. */
364
+ async uncheck(target, options) {
365
+ await withLocatorSteps(target, async (locator) => {
366
+ await bridge()({ action: 'uncheck', locator, force: options?.force });
367
+ });
368
+ },
369
+ /** Drags `source` onto `target` with real browser pointer/drag events. */
370
+ async dragAndDrop(source, target) {
371
+ await withLocatorSteps(source, async (locator) => {
372
+ await withLocatorSteps(target, async (targetLocator) => {
373
+ await bridge()({ action: 'dragAndDrop', locator, targetLocator });
374
+ });
375
+ });
376
+ },
377
+ };
378
+ /** Backwards-compatible alias for `userEvent`, also exposing `select` and `setViewport`. */
379
+ export const user = {
380
+ ...userEvent,
381
+ select: userEvent.selectOptions,
382
+ setViewport: page.viewport,
383
+ };
384
+ /** Polls `predicate` until it returns a truthy value (or non-throwing result), failing after `timeout` ms. */
385
+ export async function waitFor(predicate, options = {}) {
386
+ const timeout = options.timeout ?? 5000;
387
+ const interval = options.interval ?? 50;
388
+ const deadline = Date.now() + timeout;
389
+ let lastError;
390
+ for (;;) {
391
+ try {
392
+ const value = await predicate();
393
+ if (value !== false && value !== null && value !== undefined)
394
+ return value;
395
+ }
396
+ catch (error) {
397
+ lastError = error;
398
+ }
399
+ if (Date.now() >= deadline) {
400
+ if (lastError !== undefined)
401
+ throw lastError;
402
+ throw new Error(`waitFor timed out after ${timeout}ms`);
403
+ }
404
+ await new Promise((done) => setTimeout(done, interval));
405
+ }
406
+ }
407
+ /**
408
+ * Intercepts network requests matching `urlPattern` (e.g. `'**\/api\/user'`) in this browser law via Playwright routing,
409
+ * returning `response`. Automatically cleared after each law input.
410
+ */
411
+ export async function mock(urlPattern, response) {
412
+ await bridge()({ action: 'mock', urlPattern, response });
413
+ }
414
+ /** Clears all active `mock()` network routes for the current law run. */
415
+ export async function clearMocks() {
416
+ await bridge()({ action: 'resetMocks' });
417
+ }
418
+ function matchesText(actual, expected) {
419
+ if (actual === null)
420
+ return false;
421
+ return typeof expected === 'string' ? actual.includes(expected) : expected.test(actual);
422
+ }
423
+ function toLocator(target) {
424
+ if (target instanceof Locator)
425
+ return target;
426
+ if (typeof target === 'string')
427
+ return page.locator(target);
428
+ return page.elementLocator(target);
429
+ }
430
+ /**
431
+ * Auto-retrying Playwright-backed DOM assertions matching Vitest Browser Mode's `expect.element(locator)`:
432
+ * polls until the condition holds (up to `timeout`, default 5000 ms), returning `true` or throwing a descriptive error.
433
+ */
434
+ export function expectElement(target, options = {}) {
435
+ const loc = toLocator(target);
436
+ const timeout = options.timeout ?? 5000;
437
+ const interval = options.interval ?? 50;
438
+ const makeMatchers = (negate) => {
439
+ const check = async (description, probe) => {
440
+ let lastDetail = '';
441
+ try {
442
+ await waitFor(async () => {
443
+ const { ok, detail } = await probe();
444
+ lastDetail = detail;
445
+ return negate ? !ok : ok;
446
+ }, { timeout, interval });
447
+ return true;
448
+ }
449
+ catch {
450
+ const prefix = negate ? 'expected element NOT ' : 'expected element ';
451
+ throw new Error(`${prefix}${description} (timed out after ${timeout}ms; last observed: ${lastDetail})`);
452
+ }
453
+ };
454
+ return {
455
+ toBeVisible: () => check('to be visible', async () => {
456
+ const v = await loc.isVisible();
457
+ return { ok: v, detail: `visible=${v}` };
458
+ }),
459
+ toBeHidden: () => check('to be hidden', async () => {
460
+ const v = await loc.isVisible();
461
+ return { ok: !v, detail: `visible=${v}` };
462
+ }),
463
+ toBeInTheDocument: () => check('to be in the document', async () => {
464
+ const c = await loc.count();
465
+ return { ok: c > 0, detail: `count=${c}` };
466
+ }),
467
+ toBeEnabled: () => check('to be enabled', async () => {
468
+ const e = await loc.isEnabled();
469
+ return { ok: e, detail: `enabled=${e}` };
470
+ }),
471
+ toBeDisabled: () => check('to be disabled', async () => {
472
+ const e = await loc.isEnabled();
473
+ return { ok: !e, detail: `enabled=${e}` };
474
+ }),
475
+ toBeChecked: () => check('to be checked', async () => {
476
+ const c = await loc.isChecked();
477
+ return { ok: c, detail: `checked=${c}` };
478
+ }),
479
+ toHaveTextContent: (expected) => check(`to have text content ${String(expected)}`, async () => {
480
+ const actual = await loc.textContent();
481
+ return { ok: matchesText(actual, expected), detail: JSON.stringify(actual) };
482
+ }),
483
+ toHaveValue: (expected) => check(`to have value ${String(expected)}`, async () => {
484
+ const actual = await loc.inputValue();
485
+ const ok = typeof expected === 'string' ? actual === expected : expected.test(actual);
486
+ return { ok, detail: JSON.stringify(actual) };
487
+ }),
488
+ toHaveAttribute: (name, expected) => check(`to have attribute "${name}"${expected === undefined ? '' : `=${String(expected)}`}`, async () => {
489
+ const actual = await loc.getAttribute(name);
490
+ const ok = actual !== null &&
491
+ (expected === undefined
492
+ ? true
493
+ : typeof expected === 'string'
494
+ ? actual === expected
495
+ : expected.test(actual));
496
+ return { ok, detail: JSON.stringify(actual) };
497
+ }),
498
+ toHaveCount: (count) => check(`to have count ${count}`, async () => {
499
+ const actual = await loc.count();
500
+ return { ok: actual === count, detail: `count=${actual}` };
501
+ }),
502
+ };
503
+ };
504
+ const pos = makeMatchers(false);
505
+ return { ...pos, not: makeMatchers(true) };
506
+ }
51
507
  // Rules about a whole page, which an element on its own cannot satisfy.
52
508
  const pageRules = ['region', 'page-has-heading-one', 'landmark-one-main'];
53
509
  /**
@@ -0,0 +1,13 @@
1
+ export interface BundledLawFile {
2
+ id: string;
3
+ js: string;
4
+ css: string;
5
+ cwd: string;
6
+ }
7
+ /** Bundles `jsFile` once per file version and registers it with the local HTTP server. */
8
+ export declare function bundleLawFile(jsFile: string, cwd: string): Promise<BundledLawFile>;
9
+ export declare const pageHarnessScript = "\nwindow.__runLaw = async (name, args, keep, pause, raw) => {\n const clean = async () => {\n for (const undo of (window.__tslawsCleanup || []).splice(0)) {\n try { await undo(); } catch (e) {}\n }\n try { localStorage.clear(); } catch (e) {}\n try { sessionStorage.clear(); } catch (e) {}\n document.body.innerHTML = '';\n if (typeof window.__tslawsBridge === 'function') {\n try { await window.__tslawsBridge({ action: 'resetMocks' }); } catch (e) {}\n }\n };\n const revive = (v) => {\n if (Array.isArray(v)) return v.map(revive);\n if (v && typeof v === 'object') {\n if (Array.isArray(v.$tslawsFn)) {\n const samples = v.$tslawsFn;\n return (...a) => {\n let key = '';\n try { key = JSON.stringify(a) || ''; } catch (e) {}\n let h = 5381;\n for (let i = 0; i < key.length; i++) h = (Math.imul(h, 33) + key.charCodeAt(i)) | 0;\n return samples[(h >>> 0) % samples.length];\n };\n }\n return Object.fromEntries(Object.entries(v).map(([k, x]) => [k, revive(x)]));\n }\n return v;\n };\n await clean();\n try {\n const input = raw ? args : revive(args);\n const result = await window.__lawModule[name](...input);\n return { ok: result !== false };\n } catch (error) {\n if (error && error.name === 'LawDiscard') return { discarded: true };\n return {\n error: {\n name: error && error.name,\n message: error && error.message ? error.message : String(error),\n stack: error && error.stack ? String(error.stack) : undefined,\n },\n };\n } finally {\n if (pause > 0) {\n window.__shown = true;\n await new Promise((done) => setTimeout(done, pause));\n window.__shown = false;\n }\n if (!keep) await clean();\n }\n};\n";
10
+ /** Ensures the local HTTP server for browser laws is listening and returns its base URL (`http://127.0.0.1:<port>`). */
11
+ export declare function ensureBrowserServer(): Promise<string>;
12
+ /** Stops the local browser HTTP server. */
13
+ export declare function closeBrowserServer(): Promise<void>;