extension 4.1.18 → 4.1.20

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.
@@ -29,143 +29,55 @@ export interface BrowserConfig {
29
29
  browserFlags: string[];
30
30
  startingUrl: string | undefined;
31
31
  }
32
- /**
33
- * List of default browser flags used by extension.js.
34
- * These can be excluded using the `excludeBrowserFlags` option.
35
- *
36
- * Each flag disables or modifies a specific browser feature for a more controlled development environment.
37
- */
38
32
  export type DefaultBrowserFlags = '--no-first-run' | '--disable-client-side-phishing-detection' | '--disable-component-extensions-with-background-pages' | '--disable-default-apps' | '--disable-features=InterestFeedContentSuggestions' | '--disable-features=Translate' | '--hide-scrollbars' | '--mute-audio' | '--no-default-browser-check' | '--ash-no-nudges' | '--disable-search-engine-choice-screen' | '--disable-features=MediaRoute' | '--use-mock-keychain' | '--disable-background-networking' | '--disable-breakpad' | '--disable-component-update' | '--disable-domain-reliability' | '--disable-features=AutofillServerCommunicatio' | '--disable-features=CertificateTransparencyComponentUpdate' | '--disable-sync' | '--disable-features=OptimizationHints' | '--disable-features=DialMediaRouteProvider' | '--no-pings' | '--enable-features=SidePanelUpdates' | '--disable-features=DisableLoadExtensionCommandLineSwitch' | '--disable-features=ExtensionDisableUnsupportedDeveloper' | '--enable-unsafe-extension-debugging' | '--silent-debugger-extension-api';
39
- /**
40
- * Options for the browser plugin.
41
- */
42
33
  export interface PluginOptions {
43
34
  /**
44
- * Launch the browser but open no tab, not even the starting URL.
45
35
  * @default false
46
36
  */
47
37
  noOpen?: boolean;
48
- /**
49
- * Additional browser flags to pass to the browser process.
50
- * Example: ['--disable-extensions', '--disable-gpu']
51
- */
52
38
  browserFlags?: string[];
53
- /**
54
- * Array of browser flags to exclude from the default set.
55
- * Example: ['--hide-scrollbars', '--mute-audio']
56
- */
57
39
  excludeBrowserFlags?: Array<DefaultBrowserFlags | string>;
58
- /**
59
- * Path to the browser profile directory, or false for a temporary profile.
60
- * Example: 'dist/extension' or false
61
- */
62
40
  profile?: string | false;
63
- /**
64
- * Use a persistent managed profile for development.
65
- * Defaults to false (ephemeral temp profiles are used).
66
- */
67
41
  persistProfile?: boolean;
68
- /**
69
- * Browser preferences object.
70
- * Example: { extensions: ['dist/extension', 'dist/extension2'] }
71
- */
72
42
  preferences?: Record<string, unknown>;
73
- /**
74
- * Firefox only: persist changes made to the profile directory.
75
- */
76
43
  keepProfileChanges?: boolean;
77
- /**
78
- * Firefox only: copy an existing profile before launching.
79
- */
80
44
  copyFromProfile?: string;
81
- /**
82
- * URL to open when the browser starts.
83
- * Example: 'http://localhost:3000'
84
- */
85
45
  startingUrl?: string;
86
46
  /**
87
- * Enable the browser console.
88
47
  * @default false
89
48
  */
90
49
  browserConsole?: boolean;
91
50
  /**
92
- * Open DevTools automatically.
93
51
  * @default false
94
52
  */
95
53
  devtools?: boolean;
96
- /**
97
- * Path to the Chromium binary.
98
- * Example: '/path/to/chromium'
99
- */
100
54
  chromiumBinary?: string;
101
- /**
102
- * Path to the Gecko (Firefox) binary.
103
- * Example: '/path/to/gecko'
104
- */
105
55
  geckoBinary?: string;
106
56
  }
107
- /**
108
- * Main interface for the browser plugin.
109
- */
110
57
  export interface PluginInterface extends PluginOptions {
111
58
  /**
112
- * Browser type to launch.
113
59
  * @default 'chrome'
114
60
  * @see DevOptions['browser']
115
61
  * Example: 'chrome' | 'edge' | 'firefox'
116
62
  */
117
63
  browser: BrowserType;
118
- /**
119
- * Path(s) to the extension(s) to load.
120
- * Example: 'dist/extension' or ['dist/extension', 'dist/extension2']
121
- */
122
64
  extension: string | string[];
123
- /**
124
- * Port to use for the extension or debugging.
125
- * Example: 12345 or '12345'
126
- */
127
65
  port?: string | number;
128
- /**
129
- * Internal auto-generated instance ID (not user-configurable).
130
- * Example: '1234567890'
131
- */
132
66
  instanceId?: string;
133
- /**
134
- * Log level for unified logger (Chromium CDP logging).
135
- * One of: 'off', 'error', 'warn', 'info', 'debug', 'trace', 'all'
136
- */
137
67
  logLevel?: 'off' | 'error' | 'warn' | 'info' | 'debug' | 'trace' | 'all';
138
- /**
139
- * Log contexts to enable.
140
- * Example: ['background', 'content', 'page']
141
- */
142
68
  logContexts?: Array<'background' | 'content' | 'page' | 'sidebar' | 'popup' | 'options' | 'devtools'>;
143
- /**
144
- * Log output format.
145
- * One of: 'pretty', 'json'
146
- */
147
69
  logFormat?: 'pretty' | 'json' | 'ndjson';
148
70
  /**
149
- * Include timestamps in logs.
150
71
  * @default true
151
72
  */
152
73
  logTimestamps?: boolean;
153
74
  /**
154
- * Enable colored log output.
155
75
  * @default false
156
76
  */
157
77
  logColor?: boolean;
158
- /**
159
- * URL to send logs to.
160
- * Example: 'http://localhost:3000'
161
- */
162
78
  logUrl?: string;
163
- /**
164
- * Tab ID or index for logging context.
165
- */
166
79
  logTab?: number | string;
167
80
  /**
168
- * Perform a dry run without launching the browser.
169
81
  * @default false
170
82
  */
171
83
  dryRun?: boolean;
@@ -183,7 +95,6 @@ export interface BrowserLogSinkEvent {
183
95
  lineNumber?: number;
184
96
  timestamp?: number;
185
97
  }
186
- /** Host-provided sink for {@link BrowserLogSinkEvent}s. Must never throw. */
187
98
  export type BrowserLogSink = (event: BrowserLogSinkEvent) => void;
188
99
  export interface ExtensionLoadRetryResult {
189
100
  status: 'loaded' | 'refused' | 'unknown';
@@ -1,8 +1,5 @@
1
1
  import type { BrowserLogSink, BrowserType, ExtensionLoadRetryResult } from './browsers-types.js';
2
2
  export type { BrowserType, CompilationLike, Controller } from './browsers-types.js';
3
- /**
4
- * Options for launching a browser with an extension loaded.
5
- */
6
3
  export interface BrowserLaunchOptions {
7
4
  browser: BrowserType;
8
5
  outputPath: string;
@@ -31,24 +28,8 @@ export interface BrowserLaunchOptions {
31
28
  logColor?: boolean;
32
29
  logUrl?: string;
33
30
  logTab?: number | string;
34
- /**
35
- * Host log pipeline for browser-generated CDP `Log.entryAdded` entries
36
- * (E21). Provided by the dev server so alarm clamps / CSP refusals land in
37
- * logs.ndjson; Chromium-only (Firefox RDP exposes no equivalent stream).
38
- */
39
31
  logSink?: BrowserLogSink;
40
32
  }
41
- /**
42
- * Handle returned by `launchBrowser`, provides logging control.
43
- *
44
- * Reload is owned by the dev server's control-bridge SW producer (the same
45
- * executor for launched + `--no-browser`), not this controller; the CDP/RDP
46
- * controller is kept only for unified logging.
47
- *
48
- * Browser process cleanup is owned by signal handlers installed during launch
49
- * (`setupFirefoxProcessHandlers` / Chromium equivalents). The controller is
50
- * deliberately not responsible for teardown, so there is no `close()`.
51
- */
52
33
  export type { ExtensionLoadRetryResult };
53
34
  export interface BrowserController {
54
35
  enableUnifiedLogging(opts: {
@@ -60,18 +41,9 @@ export interface BrowserController {
60
41
  urlFilter?: string;
61
42
  tabFilter?: number | string;
62
43
  }): Promise<void>;
63
- /** The browser's refusal reason for this session, or null when it loaded. */
64
44
  getExtensionLoadRefusal?(): string | null;
65
- /** Re-offer the current dist. Only ever called while the session is refused. */
66
45
  retryExtensionLoad?(): Promise<ExtensionLoadRetryResult>;
67
46
  }
68
- /**
69
- * Launch a browser with the given extension(s) loaded.
70
- *
71
- * Returns a `BrowserController` that provides unified-logging control.
72
- * This is the primary entry point for the CLI orchestration layer, it replaces
73
- * the old BrowsersPlugin that lived inside the bundler.
74
- */
75
47
  export declare function launchBrowser(opts: BrowserLaunchOptions): Promise<BrowserController>;
76
48
  export { runOnlyPreviewBrowser } from './run-only.js';
77
49
  export { packageSafariExtension, type SafariBuildPreflight, type SafariPackageResult, type SafariPipelineMode, safariBuildPreflight, safariPreflightError } from './run-safari/safari-launch/index.js';
@@ -1,8 +1,2 @@
1
1
  import type { CompilationLike } from '../../browsers-types.js';
2
- /**
3
- * Derive the user extension output path from `--load-extension=...` flags.
4
- *
5
- * Kept in a standalone module so run-only preview can reuse it without
6
- * importing CDP/WS-related code paths.
7
- */
8
2
  export declare function getExtensionOutputPath(compilation: CompilationLike | undefined, loadExtensionFlag: string | undefined): string;
@@ -3,15 +3,6 @@ import type { CompilationLike } from '../../browsers-types.js';
3
3
  import type { ChromiumContext } from '../chromium-context/index.js';
4
4
  import type { ChromiumLaunchOptions } from '../chromium-types.js';
5
5
  export { stampReadyBrowserExited };
6
- /**
7
- * ChromiumLaunchPlugin
8
- *
9
- * Intended responsibilities (will be wired incrementally without changing inner logic):
10
- * - Resolve binary; compose flags (profiles, excludes, overrides)
11
- * - Allocate CDP port; spawn process; setup signals; dry-run
12
- * - Connect CDP; ensure extension loaded; print dev banner
13
- * - Publish controller + port via ChromiumContext
14
- */
15
6
  export declare class ChromiumLaunchPlugin {
16
7
  private readonly options;
17
8
  private readonly ctx;
@@ -55,7 +55,6 @@ export interface ChromiumLogger {
55
55
  timestamps?: boolean;
56
56
  color?: boolean;
57
57
  }
58
- /** CDP `Target.TargetInfo`, the fields read off `Target.getTargets` results. */
59
58
  export interface CdpTargetInfo {
60
59
  type?: string;
61
60
  targetId?: string;
@@ -70,12 +69,10 @@ export interface CdpExecutionContextDescription {
70
69
  frameId?: string;
71
70
  };
72
71
  }
73
- /** A CDP `Runtime.RemoteObject` as seen in console-call args. */
74
72
  export interface CdpRemoteObject {
75
73
  value?: unknown;
76
74
  description?: string;
77
75
  }
78
- /** A CDP `Log.LogEntry` as delivered by `Log.entryAdded`. */
79
76
  export interface CdpLogEntry {
80
77
  source?: string;
81
78
  level?: string;
@@ -85,7 +82,6 @@ export interface CdpLogEntry {
85
82
  columnNumber?: number;
86
83
  timestamp?: number;
87
84
  }
88
- /** A CDP `Runtime.StackTrace`, only the top call frame fields are read. */
89
85
  export interface CdpStackTrace {
90
86
  callFrames?: Array<{
91
87
  url?: string;
@@ -93,7 +89,6 @@ export interface CdpStackTrace {
93
89
  columnNumber?: number;
94
90
  }>;
95
91
  }
96
- /** The `params` bag carried on a raw CDP protocol message. */
97
92
  export interface CdpProtocolParams {
98
93
  targetInfo?: CdpTargetInfo;
99
94
  context?: CdpExecutionContextDescription;
@@ -110,7 +105,6 @@ export interface CdpProtocolMessage {
110
105
  sessionId?: string;
111
106
  id?: number;
112
107
  }
113
- /** A CDP `DOM.Node` subtree as returned by `DOM.getDocument` (fields walked). */
114
108
  export interface CdpDomNode {
115
109
  localName?: string;
116
110
  nodeName?: string;
@@ -120,19 +114,16 @@ export interface CdpDomNode {
120
114
  children?: CdpDomNode[];
121
115
  contentDocument?: CdpDomNode;
122
116
  }
123
- /** A frame node read off a CDP `Page.getFrameTree` result. */
124
117
  export interface CdpFrameNode {
125
118
  id?: string;
126
119
  url?: string;
127
120
  }
128
- /** A CDP `Page.getFrameTree` result (only the frame id/url are read). */
129
121
  export interface CdpFrameTreeResult {
130
122
  frameTree?: {
131
123
  frame?: CdpFrameNode;
132
124
  };
133
125
  frame?: CdpFrameNode;
134
126
  }
135
- /** The console-count buckets keyed by normalized console level. */
136
127
  export type ConsoleCountKey = 'error' | 'warn' | 'info' | 'log' | 'debug';
137
128
  export type PageMetaSnapshot = {
138
129
  readyState?: string;
@@ -143,7 +134,6 @@ export type PageMetaSnapshot = {
143
134
  };
144
135
  frameCount?: number;
145
136
  };
146
- /** One selector-probe sample collected from the inspected page. */
147
137
  export interface SelectorProbeSample {
148
138
  tag: string;
149
139
  id?: string;
@@ -153,7 +143,6 @@ export interface SelectorProbeSample {
153
143
  textLength?: number;
154
144
  textSnippet?: string;
155
145
  }
156
- /** A single selector-probe result (selector + match count + samples). */
157
146
  export interface SelectorProbeResult {
158
147
  selector: string;
159
148
  count: number;
@@ -1,13 +1,8 @@
1
1
  import type { BrowserLogger } from '../../browsers-types.js';
2
2
  import type { SafariPluginLike } from '../safari-types.js';
3
3
  export declare function toolOutputTail(output: string): string;
4
+ export declare function converterWarnings(output: string): string[];
4
5
  export type SafariPipelineMode = 'full' | 'resync';
5
- /**
6
- * What the pipeline resolved for this app. `bundleIdDerived` used to exist
7
- * only as a log line, which left a machine caller unable to learn that its
8
- * app carries a generated dev.extensionjs.* id shared with every project
9
- * built from the same source.
10
- */
11
6
  export interface SafariPackageResult {
12
7
  appName: string;
13
8
  bundleId: string;
@@ -1,34 +1,19 @@
1
1
  import type { BrowserLogger } from '../browsers-types.js';
2
2
  import { type SafariPackageResult, type SafariPipelineMode } from './safari-launch/index.js';
3
- /**
4
- * Identity overrides develop resolves per build (CLI flags merged with
5
- * `extension.config.js` `browser.safari`) and hands to the packager.
6
- */
7
3
  export interface SafariPackagerOverrides {
8
4
  appName?: string;
9
5
  bundleId?: string;
10
6
  macOsOnly?: boolean;
11
7
  forceRegenerate?: boolean;
12
8
  safariBinary?: string;
13
- /** When set, overrides the factory `noOpen` for this packaging call. */
14
9
  noOpen?: boolean;
15
10
  }
16
11
  export interface SafariPackagerOptions extends SafariPackagerOverrides {
17
- /** 'safari' or 'webkit-based'. Defaults to 'safari'. */
18
12
  browser?: 'safari' | 'webkit-based';
19
- /** Print the dev identity card and ready line after the first full package. */
20
13
  announceDevReady?: boolean;
21
- /** Skip opening the packaged app. Defaults to true: packaging is not launching. */
22
14
  noOpen?: boolean;
23
- /** Print the commands instead of running them. */
24
15
  dryRun?: boolean;
25
16
  logger?: BrowserLogger;
26
17
  }
27
18
  export type SafariPackagerFn = (distPath: string, mode?: SafariPipelineMode, overrides?: SafariPackagerOverrides) => Promise<SafariPackageResult>;
28
- /**
29
- * Builds the `safariPackager` callback `extensionBuild`/`extensionDev` accept.
30
- * Without it a library caller that asks for `browser: 'safari'` gets a plain
31
- * dist and no app at all, because develop deliberately owns no Xcode code and
32
- * only packages when a packager is injected.
33
- */
34
19
  export declare function createSafariPackager(options?: SafariPackagerOptions): SafariPackagerFn;
@@ -14,7 +14,6 @@ export interface SafariBuildConfig {
14
14
  projectLocation: string;
15
15
  appName: string;
16
16
  bundleIdentifier: string;
17
- /** True when the bundle id was derived (dev.extensionjs.*), not user-set. */
18
17
  bundleIdDerived: boolean;
19
18
  macOsOnly: boolean;
20
19
  language: 'swift' | 'objc';
@@ -14,12 +14,6 @@ interface ActResultLike {
14
14
  code?: unknown;
15
15
  };
16
16
  }
17
- /**
18
- * Wrap an act frame in the schema-1 envelope without dropping a key. `value`,
19
- * `truncated`, `error.name`, `error.engine`, `error.hint` and any verb
20
- * augmentation (`inspect --with-console` merges `console`) are what the MCP
21
- * reads today, so they keep their exact place.
22
- */
23
17
  export declare function buildActEnvelope(command: string, result: ActResultLike): Record<string, unknown>;
24
18
  export declare function registerActCommands(program: Command): void;
25
19
  export {};
@@ -14,13 +14,6 @@ export declare function resolveDoctorBrowser(projectPath: string | undefined, op
14
14
  browser: string;
15
15
  sessionBrowsers: string[];
16
16
  };
17
- /**
18
- * Walks the control-channel legs in dependency order and reports the first
19
- * failing one with a remediation, instead of the dead-end errors each verb
20
- * gives on its own. Checks keep running past a failure wherever the answer
21
- * is still meaningful (a skip always names the check that blocked it, a
22
- * skip is NOT a pass).
23
- */
24
17
  export declare function runDoctor(projectPathArg: string | undefined, opts: DoctorOptions): Promise<DoctorCheckResult[]>;
25
18
  export declare function registerDoctorCommand(program: Command): void;
26
19
  export {};
@@ -21,18 +21,12 @@ export interface PublishInput {
21
21
  projectPath?: string;
22
22
  project?: string;
23
23
  }
24
- /**
25
- * The project this publish will act for, and where that answer came from. A
26
- * stored login is scoped to one project, so a publish run anywhere else answers
27
- * for the wrong one; `actsFor` is what the command prints and refuses on.
28
- */
29
24
  export interface PublishScope {
30
25
  source: 'flag' | 'env' | 'stored-login';
31
26
  actsFor: string;
32
27
  workspace: string;
33
28
  localName: string;
34
29
  }
35
- /** Build the HTTP request (pure, unit-testable, no network). */
36
30
  export declare function buildPublishRequest(opts: PublishInput): PublishRequest;
37
31
  export declare function buildPublishPlan(opts: PublishInput): {
38
32
  request: PublishRequest;
@@ -1,19 +1,4 @@
1
1
  import type { Command } from 'commander';
2
- /**
3
- * True when the user typed this option on the CLI (not a commander default).
4
- * Negated boolean options (`--no-open`, `--no-log-color`) set a default value
5
- * even when absent. Use this to leave those unset so extension.config.js
6
- * `commands.*` values can apply downstream.
7
- */
8
2
  export declare function isExplicitCliOption(command: Command, name: string): boolean;
9
- /**
10
- * Return `value` only when the user typed the flag, `undefined` otherwise,
11
- * so develop can fall through to extension.config.js and stock defaults.
12
- */
13
3
  export declare function explicitCliValue<T>(command: Command, name: string, value: T): T | undefined;
14
- /**
15
- * Coerce an optional boolean CLI value without inventing a default. Commander
16
- * may leave the key unset, or set a boolean/string from `--flag`,
17
- * `--flag false`, or `--no-flag`.
18
- */
19
4
  export declare function explicitOptionalBoolean(value: boolean | string | undefined): boolean | undefined;
@@ -1,4 +1,7 @@
1
1
  export declare function isSupportedNodeVersion(version: string): boolean;
2
+ export declare function isSupportedDenoVersion(version: string): boolean;
2
3
  export declare function detectBunVersion(versions?: NodeJS.ProcessVersions): string | undefined;
4
+ export declare function detectDenoVersion(versions?: NodeJS.ProcessVersions): string | undefined;
5
+ export declare function unsupportedDenoVersionMessage(version: string): string;
3
6
  export declare function unsupportedNodeVersionMessage(version: string, bunVersion?: string): string;
4
- export declare function enforceSupportedNodeVersion(version?: string, bunVersion?: string | undefined): void;
7
+ export declare function enforceSupportedNodeVersion(version?: string, bunVersion?: string | undefined, denoVersion?: string | undefined): void;
@@ -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/examples/tree/e552f6db6f2862093ba9d7026e0d376f002d95cc/examples";
3
+ export declare const TEMPLATE_CATALOG_URL = "https://github.com/extension-js/examples/tree/39448a235ea1b02516e6d555bcae409db2258b7f/examples";
4
4
  export interface TemplateGroup {
5
5
  title: string;
6
6
  summary: string;
@@ -1,3 +1,3 @@
1
1
  export declare const TEMPLATE_CORPUS_REPO = "extension-js/examples";
2
- export declare const TEMPLATE_CORPUS_REF = "e552f6db6f2862093ba9d7026e0d376f002d95cc";
2
+ export declare const TEMPLATE_CORPUS_REF = "39448a235ea1b02516e6d555bcae409db2258b7f";
3
3
  export declare const TEMPLATE_CORPUS_SLUGS: readonly string[];
@@ -2,6 +2,7 @@ export type Browser = 'chrome' | 'edge' | 'firefox' | 'chromium' | 'chromium-bas
2
2
  export declare function isSafariVendor(value: string): boolean;
3
3
  export declare const SUPPORTED_BROWSER_TARGETS: string[];
4
4
  export declare const BROWSER_TARGETS_HELP: string;
5
+ export declare const SESSION_BROWSER_TARGETS_HELP: string;
5
6
  export declare const NO_SAFARI_BROWSER_TARGETS_HELP: string;
6
7
  export declare function parseOptionalBoolean(value?: string): boolean;
7
8
  export declare const vendors: (browser?: Browser | 'all') => string[];
package/package.json CHANGED
@@ -38,7 +38,7 @@
38
38
  "extension": "./bin/extension.cjs"
39
39
  },
40
40
  "name": "extension",
41
- "version": "4.1.18",
41
+ "version": "4.1.20",
42
42
  "description": "The cross-browser extension framework. Build Chrome, Edge, Firefox, and Safari extensions with no build configuration.",
43
43
  "homepage": "https://extension.js.org/",
44
44
  "bugs": {
@@ -106,24 +106,24 @@
106
106
  "vivaldi-location2": "2.1.1",
107
107
  "waterfox-location": "2.1.1",
108
108
  "yandex-location": "2.1.1",
109
- "extension-create": "4.1.18",
110
- "extension-develop": "4.1.18",
111
- "extension-install": "4.1.18",
109
+ "extension-create": "4.1.20",
110
+ "extension-develop": "4.1.20",
111
+ "extension-install": "4.1.20",
112
112
  "commander": "^15.0.0",
113
113
  "pintor": "0.3.0",
114
114
  "semver": "^7.7.3",
115
115
  "unique-names-generator": "^4.7.1",
116
116
  "ws": "^8.20.1",
117
117
  "update-check": "^1.5.4",
118
- "wsl-support": "0.1.0"
118
+ "wsl-support": "0.1.0",
119
+ "@types/chrome": "*",
120
+ "@types/node": "*",
121
+ "@types/webextension-polyfill": "*"
119
122
  },
120
123
  "devDependencies": {
121
124
  "@rslib/core": "^1.0.0",
122
- "@types/chrome": "^0.1.33",
123
125
  "@types/cross-spawn": "^6.0.6",
124
- "@types/node": "^26",
125
126
  "@types/semver": "^7.7.1",
126
- "@types/webextension-polyfill": "0.12.4",
127
127
  "@types/ws": "^8.18.1",
128
128
  "webextension-polyfill": "^0.12.0",
129
129
  "tsconfig": "*",