extension 4.2.0 → 4.3.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 (46) hide show
  1. package/dist/browsers.cjs +505 -543
  2. package/dist/cli.cjs +3195 -994
  3. package/dist/extension/browsers/browsers-lib/first-run-install.d.ts +1 -1
  4. package/dist/extension/browsers/browsers-lib/output-binaries-resolver.d.ts +1 -1
  5. package/dist/extension/browsers/browsers-lib/process-teardown.d.ts +12 -2
  6. package/dist/extension/browsers/browsers-lib/ready-stamp.d.ts +3 -1
  7. package/dist/extension/browsers/browsers-lib/resolve-live-pid.d.ts +14 -2
  8. package/dist/extension/browsers/browsers-types.d.ts +4 -0
  9. package/dist/extension/browsers/run-chromium/chromium-launch/index.d.ts +9 -0
  10. package/dist/extension/browsers/run-chromium/chromium-launch/launch-dependencies.d.ts +0 -1
  11. package/dist/extension/browsers/run-firefox/firefox-launch/browser-config.d.ts +2 -2
  12. package/dist/extension/browsers/run-firefox/firefox-launch/index.d.ts +5 -2
  13. package/dist/extension/browsers/run-firefox/firefox-launch/launch-dependencies.d.ts +1 -0
  14. package/dist/extension/browsers/run-firefox/firefox-launch/managed-update-policy.d.ts +1 -1
  15. package/dist/extension/browsers/run-firefox/firefox-launch/process-handlers.d.ts +1 -0
  16. package/dist/extension/browsers/run-only.d.ts +3 -0
  17. package/dist/extension/browsers/run-safari/safari-launch/container-app.d.ts +1 -1
  18. package/dist/extension/browsers/run-safari/safari-types.d.ts +1 -0
  19. package/dist/extension/commands/create.d.ts +4 -9
  20. package/dist/extension/commands/dev-wait.d.ts +9 -1
  21. package/dist/extension/commands/doctor.d.ts +2 -1
  22. package/dist/extension/commands/preview.d.ts +1 -0
  23. package/dist/extension/config-types.d.ts +3 -3
  24. package/dist/extension/helpers/check-updates.d.ts +11 -1
  25. package/dist/extension/helpers/choice-flags.d.ts +6 -0
  26. package/dist/extension/helpers/cli-argv.d.ts +4 -1
  27. package/dist/extension/helpers/config-browser.d.ts +1 -1
  28. package/dist/extension/helpers/early-interrupt-arm.d.ts +1 -0
  29. package/dist/extension/helpers/early-interrupt.d.ts +35 -0
  30. package/dist/extension/helpers/extension-develop-runtime.d.ts +2 -1
  31. package/dist/extension/helpers/messages.d.ts +5 -0
  32. package/dist/extension/helpers/messaging.d.ts +12 -0
  33. package/dist/extension/helpers/no-browser.d.ts +1 -1
  34. package/dist/extension/helpers/project-name-prompt.d.ts +2 -3
  35. package/dist/extension/helpers/ready-contract-codes.d.ts +1 -0
  36. package/dist/extension/helpers/session-interrupt-frame.d.ts +8 -0
  37. package/dist/extension/helpers/session-liveness.d.ts +3 -2
  38. package/dist/extension/helpers/template-catalog.d.ts +1 -1
  39. package/dist/extension/helpers/template-corpus.generated.d.ts +1 -1
  40. package/dist/extension/helpers/vendors.d.ts +0 -1
  41. package/dist/extension/index.d.ts +1 -0
  42. package/dist/extension/run.d.ts +1 -0
  43. package/dist/{6.cjs → n.cjs} +80 -5
  44. package/package.json +6 -7
  45. package/dist/extension/browsers/browsers-lib/rename-with-retry.d.ts +0 -6
  46. package/dist/extension/browsers/browsers-lib/write-json-atomic.d.ts +0 -2
@@ -1,4 +1,4 @@
1
- export type InstallableTarget = 'chrome' | 'chromium' | 'edge' | 'firefox';
1
+ export type InstallableTarget = 'chrome';
2
2
  export declare function canPromptForInstall(): boolean;
3
3
  export declare function askToInstall(question: string): Promise<boolean>;
4
4
  export interface OfferInstallOptions {
@@ -1,5 +1,5 @@
1
1
  import type { CompilationLike } from '../browsers-types.js';
2
- export declare function computeSharedCacheRoot(): string;
2
+ export declare function computeSharedCacheRoot(env?: Record<string, string | undefined>, platform?: NodeJS.Platform, cwd?: string): string;
3
3
  export declare function sharedManagedCacheEnv(browser: Parameters<typeof managedBrowserCacheEnv>[1]): NodeJS.ProcessEnv;
4
4
  export declare function getCompilationOutputPath(compilation: CompilationLike): string;
5
5
  export declare function computeBinariesBaseDir(compilation: CompilationLike): string;
@@ -1,6 +1,7 @@
1
1
  import { type ChildProcess } from 'node:child_process';
2
2
  import type { BrowserType } from '../browsers-types.js';
3
3
  export declare const FORCE_KILL_GRACE_MS = 5000;
4
+ export declare const EXIT_PROBE_TIMEOUT_MS = 1500;
4
5
  export interface ProcessMark {
5
6
  pid: number;
6
7
  started: string;
@@ -10,19 +11,28 @@ export interface TeardownDependencies {
10
11
  now: () => number;
11
12
  isAlive: (pid: number) => boolean;
12
13
  startedAt: (pid: number) => number | null;
14
+ startedAtOnExit: (pid: number) => number | null;
15
+ startId: (pid: number) => string | undefined;
13
16
  mark: (pid: number | undefined) => ProcessMark[];
14
17
  sweep: (marks: ProcessMark[]) => number[];
15
18
  kill: (pid: number, signal: NodeJS.Signals) => boolean;
16
19
  killTree: (pid: number) => void;
20
+ killTreeOnExit: (pid: number) => void;
21
+ askTree: (pid: number) => void;
17
22
  print: (line: string) => void;
18
23
  }
19
24
  export declare function wasTerminatedByUs(child: ChildProcess | null): boolean;
20
25
  export declare function wasPidTerminatedByUs(pid: number | null | undefined): boolean;
26
+ export declare function windowsTaskkillPath(env?: NodeJS.ProcessEnv): string;
27
+ export declare function killProcessTree(pid: number | undefined, options?: {
28
+ sync?: boolean;
29
+ platform?: NodeJS.Platform;
30
+ }): void;
21
31
  export declare const teardownDefaults: TeardownDependencies;
22
32
  export declare function gracefulTerminatePid(pid: number | null | undefined, browser: BrowserType, deps?: TeardownDependencies): void;
23
- export declare function forceKillPidOnExit(pid: number | null | undefined, browser: BrowserType, adoptedAt: number, deps?: TeardownDependencies): void;
33
+ export declare function forceKillPidOnExit(pid: number | null | undefined, browser: BrowserType, adoptedAt: number, deps?: TeardownDependencies, adoptedStartId?: string): void;
24
34
  export declare function gracefulTerminateChild(child: ChildProcess | null, browser: BrowserType, helpers?: ProcessMark[], deps?: TeardownDependencies): void;
25
- export declare function forceKillChildOnExit(child: ChildProcess | null, browser: BrowserType): void;
35
+ export declare function forceKillChildOnExit(child: ChildProcess | null, browser: BrowserType, deps?: TeardownDependencies): void;
26
36
  export declare function markDescendants(rootPid: number | undefined, ownerPid?: number): ProcessMark[];
27
37
  export declare function forceKillMarkedOnExit(marks: ProcessMark[]): number[];
28
38
  export declare function isBenignSocketTeardown(value: unknown): boolean;
@@ -1,3 +1,4 @@
1
+ import { type PidStartProbes } from '../../../develop/lib/ready-contract-writer.js';
1
2
  export declare function claimReadyPath(extensionOutputPath: string | undefined, readyPath: string | undefined): void;
2
3
  export declare function sessionRootFor(extensionOutputPath: string): string;
3
4
  export declare function managedProfileBaseDir(extensionOutputPath: string, browser: string): string;
@@ -33,6 +34,7 @@ export declare function stampReadyStartingUrl(extensionOutputPath: string | unde
33
34
  opened: boolean;
34
35
  reason?: string;
35
36
  }, runId?: string): void;
37
+ export type { PidStartProbes };
36
38
  export declare function stampReadyBrowserLaunch(extensionOutputPath: string | undefined, details: {
37
39
  profilePath?: string;
38
40
  browserPid?: number;
@@ -42,7 +44,7 @@ export declare function stampReadyBrowserLaunch(extensionOutputPath: string | un
42
44
  binaryProvenance?: 'managed' | 'pinned' | 'system' | 'snapshot';
43
45
  binaryPinnedBy?: string;
44
46
  profileReused?: boolean;
45
- }, runId?: string): void;
47
+ }, runId?: string, probes?: PidStartProbes): void;
46
48
  export declare function readReadyExecutorAttached(extensionOutputPath: string | undefined, runId?: string): boolean;
47
49
  export declare function stampReadyBrowserUpNotAttached(extensionOutputPath: string | undefined, details: {
48
50
  waitedMs: number;
@@ -5,23 +5,35 @@ export interface ProcessRow {
5
5
  }
6
6
  export type ProcessLister = () => ProcessRow[];
7
7
  export declare function parseProcessRows(output: string): ProcessRow[];
8
- export declare function listProcesses(platform?: NodeJS.Platform): ProcessRow[];
8
+ export interface ProcessTableIo {
9
+ run: (bin: string, args: string[]) => string | null;
10
+ readFile: (file: string) => string;
11
+ }
12
+ export declare function listProcesses(platform?: NodeJS.Platform, io?: ProcessTableIo): ProcessRow[];
9
13
  export declare function executableOf(command: string): string;
10
14
  export declare function findLiveBrowserPid(input: {
11
15
  profilePath: string;
12
16
  binary: string;
13
17
  launcherPid?: number;
14
18
  rows: ProcessRow[];
19
+ platform?: NodeJS.Platform;
15
20
  }): number | null;
16
21
  export declare function isPidAlive(pid: number | null | undefined): boolean;
17
22
  export declare const PID_START_PROBE_TIMEOUT_MS = 5000;
18
- export declare function pidStartedAtMs(pid: number | null | undefined, platform?: NodeJS.Platform): number | null;
23
+ export declare function pidStartedAtMs(pid: number | null | undefined, platform?: NodeJS.Platform, timeoutMs?: number): number | null;
24
+ export interface StartIdReader {
25
+ platform?: NodeJS.Platform;
26
+ readFile?: (file: string) => string;
27
+ }
28
+ export declare function pidStartId(pid: number | null | undefined, reader?: StartIdReader): string | undefined;
29
+ export declare function sameStartId(stamped: unknown, pid: number | null | undefined, startIdOf?: (pid: number) => string | undefined): boolean | undefined;
19
30
  export declare function pidStartedAtIso(pid: number | null | undefined, platform?: NodeJS.Platform): string | undefined;
20
31
  export declare function resolveLiveBrowserPid(input: {
21
32
  profilePath: string;
22
33
  binary: string;
23
34
  launcherPid?: number;
24
35
  list?: ProcessLister;
36
+ platform?: NodeJS.Platform;
25
37
  attempts?: number;
26
38
  intervalMs?: number;
27
39
  sleep?: (ms: number) => Promise<void>;
@@ -9,10 +9,14 @@ export interface CompilationLike {
9
9
  path?: string;
10
10
  };
11
11
  context?: string;
12
+ devServer?: {
13
+ port?: number | string;
14
+ };
12
15
  };
13
16
  outputOptions?: {
14
17
  path?: string;
15
18
  };
19
+ errors?: unknown[];
16
20
  getAsset?: (name: string) => {
17
21
  source: {
18
22
  source: () => string;
@@ -9,6 +9,15 @@ interface ChromiumRunOptions {
9
9
  sessionCommand?: 'preview' | 'start';
10
10
  debugPortClaim?: DebugPortClaim;
11
11
  }
12
+ export interface LaunchDoneStats {
13
+ hasErrors?: () => boolean;
14
+ compilation: CompilationLike & {
15
+ options: {
16
+ mode?: string;
17
+ };
18
+ errors?: unknown[];
19
+ };
20
+ }
12
21
  export { stampReadyBrowserExited };
13
22
  export declare class ChromiumLaunchPlugin {
14
23
  private readonly options;
@@ -13,7 +13,6 @@ export interface ChromiumLaunchDependencies {
13
13
  claimPort: (startPort: number) => Promise<DebugPortClaim>;
14
14
  spawn: typeof spawnChromiumProcess;
15
15
  watchSignals: typeof setupProcessSignalHandlers;
16
- portIsOpen: (port: number) => Promise<boolean>;
17
16
  loadCdpSetup: () => Promise<typeof import('./setup-cdp-after-launch.js')>;
18
17
  terminate: (child: ChildProcess | null, browser: BrowserType) => void;
19
18
  terminatedByUs: (child: ChildProcess | null) => boolean;
@@ -1,10 +1,11 @@
1
1
  import type { BrowserConfig, BrowserType, CompilationLike } from '../../browsers-types.js';
2
- type BrowserConfigOptions = {
2
+ export type BrowserConfigOptions = {
3
3
  browser: BrowserType;
4
4
  mode: 'development' | 'production' | 'none';
5
5
  browserFlags?: string[];
6
6
  excludeBrowserFlags?: string[];
7
7
  profile?: string | false;
8
+ persistProfile?: boolean;
8
9
  preferences?: Record<string, unknown>;
9
10
  startingUrl?: string;
10
11
  port?: number | string;
@@ -26,4 +27,3 @@ export interface FirefoxConfigMode {
26
27
  }
27
28
  export declare function browserConfig(compilation: CompilationLike, configOptions: BrowserConfigOptions): Promise<string>;
28
29
  export declare function resolveFirefoxLaunchConfig(compilation: CompilationLike, configOptions: BrowserConfigOptions, mode?: FirefoxConfigMode): Promise<FirefoxLaunchConfig>;
29
- export {};
@@ -2,12 +2,15 @@ import type { BrowserConfig, BrowserType, CompilationLike } from '../../browsers
2
2
  import type { FirefoxContext } from '../firefox-context/index.js';
3
3
  import type { FirefoxPluginRuntime } from '../firefox-types.js';
4
4
  import { type FirefoxLaunchDependencies } from './launch-dependencies.js';
5
- type LaunchOptions = {
5
+ export type LaunchOptions = {
6
6
  browser: BrowserType;
7
7
  mode: 'development' | 'production' | 'none';
8
8
  browserFlags?: string[];
9
9
  excludeBrowserFlags?: string[];
10
10
  profile?: string | false;
11
+ persistProfile?: boolean;
12
+ keepProfileChanges?: boolean;
13
+ copyFromProfile?: string;
11
14
  preferences?: Record<string, unknown>;
12
15
  startingUrl?: string;
13
16
  port?: number | string;
@@ -22,6 +25,7 @@ export declare class FirefoxLaunchPlugin {
22
25
  private launchRunId?;
23
26
  private livePid;
24
27
  private livePidAdoptedAt;
28
+ private livePidStartId;
25
29
  private liveExitWatcher?;
26
30
  private browserGone;
27
31
  private didReportReady;
@@ -52,4 +56,3 @@ export declare class FirefoxLaunchPlugin {
52
56
  private scheduleWatchTimeout;
53
57
  private printInstallHint;
54
58
  }
55
- export {};
@@ -25,6 +25,7 @@ export interface FirefoxLaunchDependencies {
25
25
  terminatedByUs: (child: ChildProcess | null) => boolean;
26
26
  pidTerminatedByUs: (pid: number | null | undefined) => boolean;
27
27
  isPidAlive: (pid: number | null | undefined) => boolean;
28
+ pidStartId: (pid: number) => string | undefined;
28
29
  listProcesses: () => ProcessRow[];
29
30
  resolveLivePid: typeof resolveLiveBrowserPid;
30
31
  exit: (code: number) => void;
@@ -1,5 +1,5 @@
1
1
  import * as nodeFs from 'node:fs';
2
- import { type RenameRetryOptions } from '../../browsers-lib/rename-with-retry.js';
2
+ import { type RenameRetryOptions } from '../../../../develop/lib/rename-with-retry.js';
3
3
  export declare const MANAGED_GECKO_POLICIES: {
4
4
  readonly DisableAppUpdate: true;
5
5
  };
@@ -3,6 +3,7 @@ export type FirefoxBrowserKind = 'firefox' | 'chrome' | 'edge' | 'chromium-based
3
3
  export interface AdoptedPid {
4
4
  pid: number;
5
5
  adoptedAt: number;
6
+ startId?: string;
6
7
  }
7
8
  export declare function __activeFirefoxInstanceCount(): number;
8
9
  export declare function __resetFirefoxProcessHandlersForTest(): void;
@@ -8,6 +8,8 @@ type PreviewRunOptions = {
8
8
  profile?: string | false;
9
9
  profileSource?: 'flag' | 'config';
10
10
  persistProfile?: boolean;
11
+ keepProfileChanges?: boolean;
12
+ copyFromProfile?: string;
11
13
  preferences?: Record<string, unknown>;
12
14
  browserFlags?: string[];
13
15
  excludeBrowserFlags?: string[];
@@ -30,6 +32,7 @@ type PreviewRunOptions = {
30
32
  };
31
33
  export interface PreviewBrowserSession {
32
34
  wakeBackground?(): Promise<boolean>;
35
+ ended?: Promise<void>;
33
36
  }
34
37
  export declare function warnIgnoredHostPermissionPatterns(opts: {
35
38
  outPath: string;
@@ -1,3 +1,3 @@
1
1
  import type { SafariPipelineTools } from './tools.js';
2
- export declare function rememberRaisedContainerApp(tools: SafariPipelineTools, appPath: string, before: Set<number>): Promise<number[]>;
2
+ export declare function rememberRaisedContainerApp(tools: SafariPipelineTools, appPath: string, before: Set<number>, waitMs?: number): Promise<number[]>;
3
3
  export declare function closeSafariContainerApps(): Promise<void>;
@@ -17,6 +17,7 @@ export type SafariPluginLike = Pick<PluginInterface, 'extension' | 'noOpen' | 'i
17
17
  uiTools?: SafariUiTools;
18
18
  promptWaitMs?: number;
19
19
  rowWatchMs?: number;
20
+ raiseWaitMs?: number;
20
21
  };
21
22
  export interface SafariBuildConfig {
22
23
  extensionDir: string;
@@ -1,10 +1,5 @@
1
1
  import type { Command } from 'commander';
2
- export declare const CREATE_ERROR_NEEDLES: {
3
- readonly E_DESTINATION_NOT_EMPTY: readonly ['already contains files that would be overwritten'];
4
- readonly E_DESTINATION_NOT_WRITABLE: readonly ["Couldn't write "];
5
- readonly E_TEMPLATE_NOT_FOUND: readonly ['is not in the extension-js/templates catalog', "Couldn't read a manifest.json", "Couldn't read the template's", 'that path on this machine'];
6
- readonly E_DEPENDENCY_INSTALL: readonly ["Couldn't install the dependencies"];
7
- readonly E_REMOTE_ZIP_INVALID: readonly ["The remote URL doesn't point to a ZIP archive", 'The ZIP archive at the remote URL is damaged', 'The ZIP archive at the remote URL contains a path outside its folder'];
8
- readonly E_INVALID_OPTION: readonly ['A URL is not a valid project path', "Can't download a template over plain HTTP", "Can't scaffold a project inside the template it copies"];
9
- };
10
- export declare function registerCreateCommand(program: Command): void;
2
+ import { type PromptIo } from '../helpers/project-name-prompt.js';
3
+ export declare function registerCreateCommand(program: Command, { promptIo }?: {
4
+ promptIo?: PromptIo;
5
+ }): void;
@@ -1,5 +1,6 @@
1
1
  import { type DevelopBridge } from '../helpers/extension-develop-runtime.js';
2
2
  import { type ErrorCode } from '../helpers/messaging.js';
3
+ import { type TerminationSignal } from '../helpers/telemetry-signals.js';
3
4
  export type WaitFormat = 'pretty' | 'json';
4
5
  export type WaitCommand = 'dev' | 'start';
5
6
  export declare const READY_CONTRACT_FRESHNESS_MS = 60000;
@@ -20,6 +21,7 @@ export type ReadyContractPayload = {
20
21
  port?: number | null;
21
22
  pid?: number;
22
23
  pidStartedAt?: string;
24
+ pidStartId?: string;
23
25
  ts?: string;
24
26
  compiledAt?: string | null;
25
27
  extensionLoadRefusedAt?: string;
@@ -33,11 +35,17 @@ export type RunWaitModeOptions = {
33
35
  waitTimeout?: string | number;
34
36
  waitFormat?: string;
35
37
  };
38
+ export interface WaitSignalTarget {
39
+ once(signal: TerminationSignal, listener: () => void): unknown;
40
+ removeListener(signal: TerminationSignal, listener: () => void): unknown;
41
+ }
36
42
  export type WaitModeDeps = {
37
43
  now?: () => number;
38
44
  sleep?: (ms: number) => Promise<void>;
39
45
  loadBridge?: () => Promise<DevelopBridge>;
40
46
  pidStartedAt?: (pid: number | null | undefined) => number | null;
47
+ signals?: WaitSignalTarget;
48
+ endInterrupted?: (frame: unknown, exitCode: number) => Promise<void>;
41
49
  };
42
50
  export type RunWaitModeResult = {
43
51
  projectPath: string;
@@ -64,5 +72,5 @@ export declare function describeWaitError(error: unknown): WaitFailure;
64
72
  export declare function framedWaitFailure(error: unknown, failure: WaitFailure, framedForJson: boolean): Error;
65
73
  export declare function isFreshContractPayload(payload: ReadyContractPayload, now?: () => number): boolean;
66
74
  export declare function standingLoadRefusal(payload: ReadyContractPayload): string | undefined;
67
- export declare function runWaitMode(options: RunWaitModeOptions, { now, sleep, loadBridge, pidStartedAt }?: WaitModeDeps): Promise<RunWaitModeResult>;
75
+ export declare function runWaitMode(options: RunWaitModeOptions, { now, sleep, loadBridge, pidStartedAt, signals, endInterrupted }?: WaitModeDeps): Promise<RunWaitModeResult>;
68
76
  export declare function runDevWaitMode(options: Omit<RunWaitModeOptions, 'command'>, deps?: WaitModeDeps): Promise<RunWaitModeResult>;
@@ -37,8 +37,9 @@ export interface DoctorDeps {
37
37
  engineVersion?: typeof engineRspackVersion;
38
38
  scanPeers?: typeof scanRspackPeers;
39
39
  pidStartedAt?: typeof pidStartedAtMs;
40
+ onDisk?: (file: string) => boolean;
40
41
  }
41
- export declare function runDoctor(projectPathArg: string | undefined, opts: DoctorOptions, { loadBridge, engineVersion, scanPeers, pidStartedAt }?: DoctorDeps): Promise<DoctorReport>;
42
+ export declare function runDoctor(projectPathArg: string | undefined, opts: DoctorOptions, { loadBridge, engineVersion, scanPeers, pidStartedAt, onDisk }?: DoctorDeps): Promise<DoctorReport>;
42
43
  export declare const DOCTOR_CHECK_CODES: Record<DoctorCheck, ErrorCode>;
43
44
  export declare function doctorFailureCode(row: DoctorCheckResult): ErrorCode;
44
45
  export declare function registerDoctorCommand(program: Command, deps?: DoctorDeps): void;
@@ -13,6 +13,7 @@ export type PreviewOptions = {
13
13
  open?: boolean;
14
14
  startingUrl?: string;
15
15
  port?: string | number;
16
+ host?: string;
16
17
  logs?: string;
17
18
  logContext?: string;
18
19
  logFormat?: 'pretty' | 'json' | 'ndjson';
@@ -120,7 +120,7 @@ export interface BrowserConfig extends BrowserLaunchConfig, SafariConfig {
120
120
  perfBudgets?: PerfBudgetsConfig;
121
121
  }
122
122
  /**
123
- * Asset categories the perf-budgets plugin recognizes. `shared` is the chunk
123
+ * Asset categories that take a size budget. `shared` is the chunk
124
124
  * every page that imports a framework or a common module loads. `public` is
125
125
  * a file copied from the public folder as authored. `wasm` is a WebAssembly
126
126
  * file only extension pages and workers fetch when they run it, such as an
@@ -129,7 +129,7 @@ export interface BrowserConfig extends BrowserLaunchConfig, SafariConfig {
129
129
  * service worker reaches, and root-level runtime helpers emitted outside a
130
130
  * surface folder, 1 MiB by default.
131
131
  */
132
- export type PerfBudgetCategory = 'content-script' | 'service-worker' | 'page' | 'shared' | 'public' | 'runtime' | 'wasm' | 'ignored';
132
+ export type PerfBudgetCategory = 'content-script' | 'service-worker' | 'page' | 'shared' | 'public' | 'runtime' | 'wasm';
133
133
  /**
134
134
  * Per-category asset size budgets (bytes) for compiling commands, plus
135
135
  * `ignore`, the output paths no budget applies to: exact paths as the
@@ -145,7 +145,7 @@ export type PerfBudgetCategory = 'content-script' | 'service-worker' | 'page' |
145
145
  * }
146
146
  * }
147
147
  */
148
- export type PerfBudgetsConfig = Partial<Record<Exclude<PerfBudgetCategory, 'ignored'>, number>> & {
148
+ export type PerfBudgetsConfig = Partial<Record<PerfBudgetCategory, number>> & {
149
149
  ignore?: string[];
150
150
  /** `'warn'` (default) reports an overrun, `'error'` fails the build. */
151
151
  onExceed?: 'warn' | 'error';
@@ -4,13 +4,23 @@ export interface UpdateNotice {
4
4
  suffix: string;
5
5
  message: string;
6
6
  }
7
- export declare function updateCheckWanted({ command, json, env }: {
7
+ export declare function updateCheckWanted({ command, json, terminal, env }: {
8
8
  command: string | undefined;
9
9
  json: boolean;
10
+ terminal: boolean;
10
11
  env: Env;
11
12
  }): boolean;
12
13
  export declare function resolveRegistry(env: Env, homedir?: () => string): URL | null;
13
14
  export declare function lookupLatest(name: string, registry: URL, boundMs?: number): Promise<string>;
15
+ export interface SettleTimers {
16
+ set: (run: () => void, ms: number) => unknown;
17
+ clear: (timer: unknown) => void;
18
+ }
19
+ export interface SettleSignals {
20
+ once(signal: 'SIGINT' | 'SIGTERM', listener: () => void): unknown;
21
+ removeListener(signal: 'SIGINT' | 'SIGTERM', listener: () => void): unknown;
22
+ }
23
+ export declare function settleUpdateCheck(pending: Promise<unknown>, boundMs?: number, timers?: SettleTimers, signals?: SettleSignals): Promise<void>;
14
24
  export interface UpdateCheckDeps {
15
25
  env?: Env;
16
26
  homedir?: () => string;
@@ -7,3 +7,9 @@ export declare function refuseUnlistedChoices({ skip, hints, reportFailure }?: {
7
7
  hints?: Record<string, (value: string) => string>;
8
8
  reportFailure?: typeof reportCommandFailureNow;
9
9
  }): (command: Command, actionCommand: Command) => void;
10
+ export declare function refuseUnknownListItems(flag: string, known: readonly string[], { reportFailure }?: {
11
+ reportFailure?: typeof reportCommandFailureNow;
12
+ }): (command: Command, actionCommand: Command) => void;
13
+ export declare function refuseUnknownSessionBrowser({ framed }?: {
14
+ framed?: (opts: Record<string, unknown>) => boolean;
15
+ }): (command: Command, actionCommand: Command) => void;
@@ -1,7 +1,10 @@
1
- import type { Command } from 'commander';
1
+ import type { Command, Option } from 'commander';
2
2
  export declare function scanArgvValue(argv: string[], flag: string): string | undefined;
3
3
  export declare function collectValuedLongFlags(program: Command): Set<string>;
4
4
  export declare function resolveCommandFromArgv(argv: string[], valuedFlags?: ReadonlySet<string>): string | undefined;
5
+ export declare function findSubcommand(program: Command, name: string | undefined): Command | undefined;
6
+ export declare function moveCommandFlagsBehindCommand(argv: string[], program: Command, valuedFlags?: ReadonlySet<string>): string[];
7
+ export declare function findFlagMissingItsValue(argv: string[], program: Command, valuedFlags?: ReadonlySet<string>): Option | undefined;
5
8
  export declare function movePreCommandOutputArgv(argv: string[], valuedFlags?: ReadonlySet<string>): string[];
6
9
  export declare function rewriteOutputAliasArgv(argv: string[], valuedFlags?: ReadonlySet<string>): {
7
10
  argv: string[];
@@ -1,2 +1,2 @@
1
1
  import { type DevelopFor } from './extension-develop-runtime.js';
2
- export declare function resolveConfigBrowser(projectPath: string, command: 'dev' | 'build' | 'start' | 'preview', loadDevelop?: () => Promise<DevelopFor>): Promise<string | undefined>;
2
+ export declare function resolveConfigBrowser(projectPath: string, command: 'dev' | 'build' | 'start' | 'preview', loadDevelop?: () => Promise<DevelopFor>, mode?: string): Promise<string | undefined>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,35 @@
1
+ type TerminationSignal = 'SIGINT' | 'SIGTERM';
2
+ export declare function expectBuildTold(endsRun: boolean): void;
3
+ export declare function interruptedAfterBuildTold(): boolean;
4
+ export declare function claimInterruptFrame(): void;
5
+ export declare function interruptFrameClaimed(): boolean;
6
+ export declare function streamEndedByInterrupt(): boolean;
7
+ export declare function wantsJsonFrames(argv: string[]): boolean;
8
+ export declare function commandNamedIn(argv: string[]): string;
9
+ export declare function earlyInterruptFrame(command: string, signal: TerminationSignal): {
10
+ schema: number;
11
+ ok: boolean;
12
+ command: string;
13
+ status: string;
14
+ value: {
15
+ signal: TerminationSignal;
16
+ };
17
+ error: {
18
+ code: string;
19
+ message: string;
20
+ };
21
+ warnings: never[];
22
+ };
23
+ export interface EarlyInterruptTarget {
24
+ prependOnceListener(signal: TerminationSignal, listener: () => void): unknown;
25
+ removeListener(signal: TerminationSignal, listener: () => void): unknown;
26
+ listenerCount(signal: TerminationSignal): number;
27
+ }
28
+ export interface EarlyInterruptDeps {
29
+ target: EarlyInterruptTarget;
30
+ write: (frame: unknown) => void;
31
+ closeStream: () => void;
32
+ exit: (code: number) => void;
33
+ }
34
+ export declare function armEarlyInterrupt(argv: string[], deps?: EarlyInterruptDeps): void;
35
+ export {};
@@ -1,4 +1,3 @@
1
- export type AnyDevelopModule = any;
2
1
  export type DevelopModule = typeof import('extension-develop');
3
2
  export type DevelopPreviewModule = typeof import('extension-develop/preview');
4
3
  export type DevelopFor<K extends keyof DevelopModule = never> = Pick<DevelopModule, K> & Partial<Pick<DevelopModule, 'loadCommandConfig'>>;
@@ -10,6 +9,8 @@ export declare function resolveExtensionDevelopRoot(startDir?: string): string;
10
9
  export declare function resolveExtensionDevelopVersion(startDir?: string, fallbackVersion?: string): string;
11
10
  export declare function reinstallCommandFor(engineRoot: string, version: string): string;
12
11
  export declare function assertDevelopVersionMatches(root: string, startDir?: string): void;
12
+ export declare function runnerCacheFolderOf(engineRoot: string): string | undefined;
13
+ export declare function developLoadFailure(error: unknown, root: string): Error;
13
14
  export declare function loadExtensionDevelopModule<T = DevelopModule>(startDir?: string): Promise<T>;
14
15
  export declare function loadExtensionDevelopPreviewModule<T = DevelopPreviewModule>(startDir?: string): Promise<T>;
15
16
  export declare function loadExtensionDevelopBridgeModule<T = DevelopBridge>(startDir?: string): Promise<T>;
@@ -223,9 +223,11 @@ export declare const commandDescriptions: Record<CommandName, string>;
223
223
  export declare function availableCommandsBlock(): string;
224
224
  export declare function projectCliVersionMismatch(running: string, declared: string, range: string, installCommand: string): string;
225
225
  export declare function developVersionMismatch(cliVersion: string, engineVersion: string, engineRoot: string, reinstall?: string): string;
226
+ export declare function developLoadFailed(engineRoot: string, reason: string, reinstall: string, runnerCache?: string): string;
226
227
  export declare function developRootIgnored(envRoot: string): string;
227
228
  export declare function localDevelopVersionDiffers(cliVersion: string, engineVersion: string, engineRoot: string): string;
228
229
  export declare function unhandledError(err: unknown): string;
230
+ export declare function signalAfterBuild(): string;
229
231
  export declare function updateFailed(err: unknown): string;
230
232
  export declare function checkUpdates(packageJson: Record<string, unknown>, update: {
231
233
  latest: string;
@@ -353,6 +355,9 @@ export declare function doctorRemedy(check: string, remediation: string): string
353
355
  export declare function controlDisabledInSessionPlain(browser: string, port: number | undefined, flag: string): string;
354
356
  export declare function controlDisabledInSession(browser: string, port: number | undefined, flag: string): string;
355
357
  export declare function noBrowserNotSupportedForCommand(command?: string): string;
358
+ export declare function controlNeedsBrowser(command: string): string;
359
+ export declare function noCommandGivenText(): string;
360
+ export declare function noCommandGiven(): string;
356
361
  export declare function noBrowserWithWait(command: string): string;
357
362
  export declare function waitModeFailed(failure: {
358
363
  message: string;
@@ -33,6 +33,8 @@ export declare function browserDisplayName(browser: string): string;
33
33
  export declare function browserRowValue(browser: string, versionLine?: string): string;
34
34
  export declare function isCardKeyClaimed(key: string): boolean;
35
35
  export declare function claimCardKey(key: string): boolean;
36
+ export declare function holdCardKey(key: string): (() => void) | undefined;
37
+ export declare function releaseCardKeysOf(outputPath: string): void;
36
38
  export declare function artifactNoun(browser: string): 'Add-on' | 'Extension';
37
39
  export declare const ENVELOPE_SCHEMA = 1;
38
40
  export declare const CODES: {
@@ -40,6 +42,7 @@ export declare const CODES: {
40
42
  readonly E_PROJECT_NOT_FOUND: 'E_PROJECT_NOT_FOUND';
41
43
  readonly E_MANIFEST_NOT_FOUND: 'E_MANIFEST_NOT_FOUND';
42
44
  readonly E_MANIFEST_INVALID: 'E_MANIFEST_INVALID';
45
+ readonly E_PACKAGE_JSON_INVALID: 'E_PACKAGE_JSON_INVALID';
43
46
  readonly E_FIRST_COMPILE: 'E_FIRST_COMPILE';
44
47
  readonly E_COMPILE: 'E_COMPILE';
45
48
  readonly E_BROWSER_NOT_FOUND: 'E_BROWSER_NOT_FOUND';
@@ -99,6 +102,7 @@ export declare const CODES: {
99
102
  readonly E_OPTIONAL_DEP_UNKNOWN: 'E_OPTIONAL_DEP_UNKNOWN';
100
103
  readonly E_COMPANION_EXTENSION_PATH: 'E_COMPANION_EXTENSION_PATH';
101
104
  readonly E_MANIFEST_IN_PUBLIC: 'E_MANIFEST_IN_PUBLIC';
105
+ readonly E_FOLDER_UNREADABLE: 'E_FOLDER_UNREADABLE';
102
106
  readonly E_RUNTIME_NOT_FOUND: 'E_RUNTIME_NOT_FOUND';
103
107
  readonly E_COMPILE_FATAL: 'E_COMPILE_FATAL';
104
108
  readonly E_MODULE_NOT_FOUND: 'E_MODULE_NOT_FOUND';
@@ -151,6 +155,7 @@ export declare const CODES: {
151
155
  readonly E_PROJECT_LAYOUT: 'E_PROJECT_LAYOUT';
152
156
  readonly E_ASSET_IMPORT_SHAPE: 'E_ASSET_IMPORT_SHAPE';
153
157
  readonly E_ENV_FILE_UNREADABLE: 'E_ENV_FILE_UNREADABLE';
158
+ readonly E_INLINE_SCRIPT_SYNTAX: 'E_INLINE_SCRIPT_SYNTAX';
154
159
  readonly W_MANAGED_DEP_CONFLICT: 'W_MANAGED_DEP_CONFLICT';
155
160
  readonly W_TYPES_EMIT: 'W_TYPES_EMIT';
156
161
  readonly W_MODULE_NOT_FOUND: 'W_MODULE_NOT_FOUND';
@@ -195,6 +200,13 @@ export declare const CODES: {
195
200
  readonly W_ENV_NAME_RESERVED: 'W_ENV_NAME_RESERVED';
196
201
  readonly W_COMPANION_EXTENSION_PATH: 'W_COMPANION_EXTENSION_PATH';
197
202
  readonly W_ENV_DEFINE_WRITTEN: 'W_ENV_DEFINE_WRITTEN';
203
+ readonly W_ENV_ASSET_NOT_UTF8: 'W_ENV_ASSET_NOT_UTF8';
204
+ readonly W_HTML_NOT_UTF8: 'W_HTML_NOT_UTF8';
205
+ readonly W_RELOAD_NOT_APPLIED: 'W_RELOAD_NOT_APPLIED';
206
+ readonly W_CONTENT_SCRIPT_NOT_INJECTED: 'W_CONTENT_SCRIPT_NOT_INJECTED';
207
+ readonly W_CONTENT_SCRIPT_CLEANUP: 'W_CONTENT_SCRIPT_CLEANUP';
208
+ readonly W_CONTENT_SCRIPT_MOUNT: 'W_CONTENT_SCRIPT_MOUNT';
209
+ readonly W_DEV_SERVER_SOCKET: 'W_DEV_SERVER_SOCKET';
198
210
  };
199
211
  export type ErrorCode = (typeof CODES)[keyof typeof CODES];
200
212
  export declare const CDP_FAULT_STEMS: readonly ['CDP_NOT_CONNECTED', 'CDP_TIMEOUT', 'CDP_OP_FAILED', 'BROWSER_CONNECTION_CLOSED', 'EXTENSION_ID_UNKNOWN'];
@@ -1,4 +1,4 @@
1
1
  import { type DevelopFor } from './extension-develop-runtime.js';
2
2
  export declare const BROWSER_LAUNCH_HELP_FOOTER: string;
3
3
  export declare const NO_OPEN_FLAG_DESCRIPTION = "launch the browser but do not open a tab for your extension. To stop the browser launch itself, use --no-browser";
4
- export declare function resolveNoBrowser(projectPath: string, command: 'dev' | 'start' | 'preview', loadDevelop?: () => Promise<DevelopFor>): Promise<boolean>;
4
+ export declare function resolveNoBrowser(projectPath: string, command: 'dev' | 'start' | 'preview', loadDevelop?: () => Promise<DevelopFor>, browser?: string): Promise<boolean>;
@@ -1,14 +1,13 @@
1
1
  export declare const DEFAULT_PROJECT_NAME = "my-extension";
2
- interface PromptIo {
2
+ export interface PromptIo {
3
3
  input?: NodeJS.ReadableStream & {
4
4
  isTTY?: boolean;
5
5
  };
6
6
  output?: NodeJS.WritableStream & {
7
7
  isTTY?: boolean;
8
8
  };
9
- env?: NodeJS.ProcessEnv;
9
+ env?: Record<string, string | undefined>;
10
10
  }
11
11
  export declare function canPromptForProjectName({ input, output, env }?: PromptIo): boolean;
12
12
  export declare function askProjectName(question: string, { input, output }?: PromptIo): Promise<string | null>;
13
13
  export declare function createCommandFor(template: string | undefined): string;
14
- export {};
@@ -1,5 +1,6 @@
1
1
  import { type ErrorCode } from './messaging.js';
2
2
  export declare const READY_CONTRACT_CODES: Record<string, ErrorCode>;
3
+ export declare const READY_EVENT_TYPES: readonly ['compile_start', 'compile_success', 'compile_error', 'browser_exited', 'browser_launch_failed', 'restart_failed', 'warning', 'shutdown'];
3
4
  export declare function readyContractErrorCode(code: unknown): ErrorCode | undefined;
4
5
  export declare function stampedLaunchFailureCode(ready: {
5
6
  code?: unknown;
@@ -0,0 +1,8 @@
1
+ import { type TerminationSignal } from './telemetry-signals.js';
2
+ export interface InterruptSignalTarget {
3
+ prependOnceListener(signal: TerminationSignal, listener: () => void): unknown;
4
+ removeListener(signal: TerminationSignal, listener: () => void): unknown;
5
+ listenerCount(signal: TerminationSignal): number;
6
+ }
7
+ export declare function interruptedFrame(command: 'preview' | 'start', signal: TerminationSignal, value: Record<string, unknown>): import("./messaging.js").Envelope<unknown>;
8
+ export declare function writeFrameWhenInterrupted(command: 'preview' | 'start', value: () => Record<string, unknown>, write: (frame: unknown) => void, target?: InterruptSignalTarget, exit?: (code: number) => unknown): () => void;
@@ -5,6 +5,7 @@ export interface SessionContract {
5
5
  command?: string;
6
6
  pid?: number;
7
7
  pidStartedAt?: string;
8
+ pidStartId?: string;
8
9
  startedAt?: string;
9
10
  controlPort?: number;
10
11
  }
@@ -13,11 +14,11 @@ export declare function sessionCommandOf(ready: {
13
14
  command?: unknown;
14
15
  } | null | undefined): BrowserSessionCommand;
15
16
  export declare function sessionNounOf(command: BrowserSessionCommand): string;
16
- export declare function reusedPidEvidence(ready: SessionContract, pidStartedAt?: typeof pidStartedAtMs): string | null;
17
+ export declare function reusedPidEvidence(ready: SessionContract, pidStartedAt?: typeof pidStartedAtMs, startIdOf?: (pid: number) => string | undefined): string | null;
17
18
  export declare function portAnswers(port: number, timeoutMs?: number): Promise<boolean>;
18
19
  export declare function endedSessionReason(ready: SessionContract, readyPath: string, options?: {
19
20
  dialFailed?: boolean;
20
- }, pidStartedAt?: typeof pidStartedAtMs): Promise<string | null>;
21
+ }, pidStartedAt?: typeof pidStartedAtMs, startIdOf?: (pid: number) => string | undefined): Promise<string | null>;
21
22
  export declare function isSessionRunning(ready: SessionContract | null | undefined): Promise<boolean>;
22
23
  export declare function runningSessionBrowsers(bridge: Partial<DevelopBridge> | undefined, projectPath: string, browser: string, readContract: (projectPath: string, browser: string) => SessionContract | null | undefined): Promise<string[]>;
23
24
  export declare function sessionEndedMessage(input: {
@@ -1,6 +1,6 @@
1
1
  export declare const DEFAULT_TEMPLATE = "typescript";
2
2
  export declare const BUNDLED_TEMPLATES: readonly string[];
3
- export declare const TEMPLATE_CATALOG_URL = "https://github.com/extension-js/templates/tree/983dd0447d344bc8e03f5e4b65d92267e3d6cff2/examples";
3
+ export declare const TEMPLATE_CATALOG_URL = "https://github.com/extension-js/templates/tree/355e74d00daab8083237af30949cd47c49e0c0c3/examples";
4
4
  export interface TemplateGroup {
5
5
  title: string;
6
6
  summary: string;