extension-develop 4.1.20 → 4.1.22

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 (47) hide show
  1. package/dist/672~0.mjs +24 -1
  2. package/dist/747~0.mjs +4 -2
  3. package/dist/832~0.mjs +8 -19
  4. package/dist/840~0.mjs +434 -36
  5. package/dist/852~0.mjs +5 -1
  6. package/dist/950~0.mjs +45 -28
  7. package/dist/command-preview.d.ts +8 -0
  8. package/dist/dev-server/control-bridge/consumer-client.d.ts +10 -0
  9. package/dist/dev-server/control-bridge/contracts.d.ts +42 -0
  10. package/dist/dev-server/control-bridge/logs-query.d.ts +16 -0
  11. package/dist/dev-server~0.mjs +2 -0
  12. package/dist/lib/addon-lint.d.ts +4 -1
  13. package/dist/lib/build-summary.d.ts +11 -0
  14. package/dist/lib/chunk-dependency-provenance.d.ts +14 -0
  15. package/dist/lib/constants.d.ts +1 -1
  16. package/dist/lib/manifest-utils.d.ts +2 -0
  17. package/dist/lib/messages.d.ts +3 -3
  18. package/dist/lib/messaging.d.ts +1 -0
  19. package/dist/lib/package-manager.d.ts +2 -0
  20. package/dist/lib/paths.d.ts +3 -0
  21. package/dist/plugin-browsers/index.d.ts +28 -0
  22. package/dist/plugin-compilation/env.d.ts +2 -0
  23. package/dist/plugin-js-frameworks/js-frameworks-lib/messages.d.ts +1 -0
  24. package/dist/plugin-js-frameworks/js-tools/solid.d.ts +3 -0
  25. package/dist/plugin-js-frameworks/js-tools/typescript.d.ts +16 -0
  26. package/dist/plugin-perf-budgets/categorize.d.ts +2 -1
  27. package/dist/plugin-perf-budgets/index.d.ts +1 -1
  28. package/dist/plugin-playwright/index.d.ts +1 -0
  29. package/dist/plugin-reload/classify-reload.d.ts +4 -0
  30. package/dist/plugin-reload/index.d.ts +18 -0
  31. package/dist/plugin-special-folders/folder-extensions/types.d.ts +13 -0
  32. package/dist/plugin-special-folders/messages.d.ts +2 -2
  33. package/dist/plugin-web-extension/feature-manifest/messages.d.ts +1 -0
  34. package/dist/plugin-web-extension/feature-manifest/steps/apply-dev-defaults-lib/emitted-evidence.d.ts +22 -0
  35. package/dist/plugin-web-extension/feature-manifest/steps/apply-dev-defaults-lib/patch-background.d.ts +9 -0
  36. package/dist/plugin-web-extension/feature-manifest/steps/apply-dev-defaults-lib/patch-web-resources.d.ts +7 -16
  37. package/dist/plugin-web-extension/feature-manifest/steps/apply-dev-defaults.d.ts +6 -2
  38. package/dist/plugin-web-extension/feature-manifest/steps/warn-gecko-unsupported-apis.d.ts +2 -13
  39. package/dist/plugin-web-extension/feature-scripts/messages.d.ts +5 -0
  40. package/dist/plugin-web-extension/feature-scripts/steps/warn-page-context-worker.d.ts +5 -0
  41. package/dist/plugin-web-extension/feature-web-resources/collect-entry-imports.d.ts +1 -0
  42. package/dist/plugin-web-extension/feature-web-resources/web-resources-lib/messages.d.ts +1 -0
  43. package/dist/plugin-web-extension/feature-web-resources/web-resources-lib/unreachable-resources.d.ts +9 -0
  44. package/dist/rspack-config.d.ts +1 -1
  45. package/dist/rspack-config~0.mjs +432 -465
  46. package/dist/types.d.ts +190 -0
  47. package/package.json +1 -1
package/dist/types.d.ts CHANGED
@@ -1,5 +1,8 @@
1
1
  import type { LoaderContext as RspackLoaderContext, RspackPluginInstance } from '@rspack/core';
2
2
  /**
3
+ * Firefox-only `theme_experiment` manifest key.
4
+ * Not present in `@types/chrome`; declared here so the manifest pipeline can
5
+ * read it type-safely instead of casting `manifest as any`.
3
6
  * @see https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/theme_experiment
4
7
  */
5
8
  export interface ThemeExperiment {
@@ -31,6 +34,9 @@ export type PluginInterface = {
31
34
  browser?: DevOptions['browser'];
32
35
  includeList?: FilepathList;
33
36
  transpilePackages?: string[];
37
+ /** True inside `extension dev`: the one axis that turns dev instrumentation
38
+ * (dev CSP, injected permissions, reload client, page HMR) on. A build in
39
+ * development mode is shippable and keeps the author's manifest. */
34
40
  devSession?: boolean;
35
41
  };
36
42
  export interface LoaderInterface extends RspackLoaderContext<LoaderInterface> {
@@ -63,8 +69,21 @@ export type BrowserType = 'chrome' | 'edge' | 'firefox' | 'chromium' | 'brave' |
63
69
  export interface BrowserOptionsBase {
64
70
  noOpen?: boolean;
65
71
  profile?: string | false;
72
+ /**
73
+ * Opt-in persistent managed profile for development.
74
+ * Defaults to false (ephemeral temp profiles are used).
75
+ */
66
76
  persistProfile?: boolean;
77
+ /**
78
+ * Keep the managed profile and its changes across runs (persistent `dev`
79
+ * profile, skipped by cleanup). Seeded once when combined with
80
+ * `copyFromProfile`.
81
+ */
67
82
  keepProfileChanges?: boolean;
83
+ /**
84
+ * Seed the managed profile as a copy of this profile directory on first
85
+ * creation.
86
+ */
68
87
  copyFromProfile?: string;
69
88
  startingUrl?: string;
70
89
  browser: BrowserType;
@@ -80,11 +99,19 @@ export interface GeckoOptions extends BrowserOptionsBase {
80
99
  export interface SafariOptions extends BrowserOptionsBase {
81
100
  browser: 'webkit-based';
82
101
  safariBinary?: string;
102
+ /** Override the Safari app name (defaults to the manifest name). */
83
103
  appName?: string;
104
+ /** User-owned bundle identifier (defaults to a dev.extensionjs.* id). */
84
105
  bundleId?: string;
85
106
  developmentTeam?: string;
107
+ /** Generate the macOS-only Xcode project (default true). */
86
108
  macOsOnly?: boolean;
87
109
  }
110
+ /**
111
+ * Safari identity/packaging options resolved by develop (CLI flags merged
112
+ * with extension.config.js `browser.safari`) and forwarded to the packager
113
+ * the CLI injects.
114
+ */
88
115
  export interface SafariPackagerOverrides {
89
116
  appName?: string;
90
117
  bundleId?: string;
@@ -92,8 +119,15 @@ export interface SafariPackagerOverrides {
92
119
  macOsOnly?: boolean;
93
120
  forceRegenerate?: boolean;
94
121
  safariBinary?: string;
122
+ /** When set, overrides the factory `noOpen` for this packaging call. */
95
123
  noOpen?: boolean;
96
124
  }
125
+ /**
126
+ * The packaging callback develop calls once the Safari dist is on disk. The
127
+ * CLI injects `createSafariPackager()` from `extension/browsers`; a library
128
+ * caller must inject the same thing or no Safari app is produced at all.
129
+ * Returning a summary is optional so older packagers keep type-checking.
130
+ */
97
131
  export type SafariPackagerFn = (distPath: string, mode: 'full' | 'resync', overrides?: SafariPackagerOverrides) => Promise<SafariPackageSummary | void>;
98
132
  export interface NonBinaryOptions extends BrowserOptionsBase {
99
133
  browser: Exclude<BrowserType, 'chromium-based' | 'gecko-based' | 'webkit-based'>;
@@ -102,10 +136,26 @@ export interface DevOptions extends BrowserOptionsBase {
102
136
  mode: 'development' | 'production' | 'none';
103
137
  polyfill?: boolean;
104
138
  port?: string | number | undefined;
139
+ /**
140
+ * Host to bind the dev server to.
141
+ * Use '0.0.0.0' for Docker/devcontainer environments.
142
+ * Defaults to '127.0.0.1'.
143
+ */
105
144
  host?: string;
145
+ /**
146
+ * Connectable host the browser (HMR client + control-bridge producer) dials,
147
+ * when it differs from the bind `host` (e.g. a remote/devcontainer). Defaults
148
+ * to the bind host, or 127.0.0.1 when bound to a wildcard like '0.0.0.0'.
149
+ */
106
150
  publicHost?: string;
107
151
  install?: boolean;
152
+ /**
153
+ * Companion extensions (load-only) for this command.
154
+ */
108
155
  extensions?: CompanionExtensionsConfig;
156
+ /**
157
+ * Skip launching the browser (dev server still starts).
158
+ */
109
159
  noBrowser?: boolean;
110
160
  preferences?: Record<string, unknown>;
111
161
  browserFlags?: string[];
@@ -125,7 +175,16 @@ export interface DevOptions extends BrowserOptionsBase {
125
175
  logUrl?: string;
126
176
  logTab?: number | string;
127
177
  hashContentScripts?: boolean;
178
+ /**
179
+ * Open the agent-bridge control channel for the bounded act verbs
180
+ * (storage/reload/open). The CLI sets this from `--allow-control`.
181
+ */
128
182
  allowControl?: boolean;
183
+ /**
184
+ * Additionally allow the `eval` verb, which runs arbitrary code inside a
185
+ * context and writes a 0600 session token. Implies `allowControl`, since
186
+ * eval is strictly stronger. The CLI sets this from `--allow-eval`.
187
+ */
129
188
  allowEval?: boolean;
130
189
  exitOnError?: boolean;
131
190
  appName?: SafariOptions['appName'];
@@ -141,17 +200,42 @@ export interface BuildOptions {
141
200
  geckoBinary?: GeckoOptions['geckoBinary'];
142
201
  firefoxBinary?: GeckoOptions['geckoBinary'];
143
202
  safariBinary?: SafariOptions['safariBinary'];
203
+ /**
204
+ * Companion extensions (load-only) for this command.
205
+ */
144
206
  extensions?: CompanionExtensionsConfig;
145
207
  zipFilename?: string;
146
208
  zip?: boolean;
147
209
  zipSource?: boolean;
148
210
  polyfill?: boolean;
149
211
  silent?: boolean;
212
+ /**
213
+ * Run Mozilla's addons-linter over the emitted dist after a production
214
+ * build for a Gecko target and print its findings as build warnings.
215
+ * Needs `addons-linter` installed in the project. Defaults to `true`.
216
+ */
150
217
  addonLint?: boolean;
218
+ /**
219
+ * Override the bundler mode (and NODE_ENV). Defaults to 'production' to
220
+ * preserve historical behavior. Setting 'development' is useful for
221
+ * staging/QA dists that should still pass through the bundler's debug
222
+ * pipeline (sourcemaps, looser minification). Mirrors `vite build --mode`
223
+ * and `webpack --mode`. The artifact stays shippable: it carries the
224
+ * author's CSP and permissions, no reload client, and its zip holds no
225
+ * maps. Only `extension dev` turns the dev instrumentation on.
226
+ */
151
227
  mode?: 'development' | 'production' | 'none';
228
+ /**
229
+ * [internal] Auto-install project dependencies when missing.
230
+ */
152
231
  install?: boolean;
153
232
  failOnWarning?: boolean;
154
233
  exitOnError?: boolean;
234
+ /**
235
+ * Internal: the command stamped into ready.json/events.ndjson. Defaults to
236
+ * 'build'; `extension start` passes 'start' for its build phase so the
237
+ * receipt names the command the user actually ran.
238
+ */
155
239
  metadataCommand?: 'dev' | 'start' | 'preview' | 'build';
156
240
  appName?: SafariOptions['appName'];
157
241
  bundleId?: SafariOptions['bundleId'];
@@ -163,17 +247,47 @@ export interface BuildOptions {
163
247
  export interface PreviewOptions extends BrowserOptionsBase {
164
248
  mode: 'production';
165
249
  outputPath?: string;
250
+ /**
251
+ * Internal metadata command override used by start->preview delegation.
252
+ * (Full command union so the WebpackConfigOptions intersection with
253
+ * BuildOptions.metadataCommand doesn't narrow the field.)
254
+ */
166
255
  metadataCommand?: 'dev' | 'start' | 'preview' | 'build';
167
256
  chromiumBinary?: ChromiumOptions['chromiumBinary'];
168
257
  geckoBinary?: GeckoOptions['geckoBinary'];
169
258
  firefoxBinary?: GeckoOptions['geckoBinary'];
259
+ /**
260
+ * Companion extensions (load-only) for this command.
261
+ */
170
262
  extensions?: CompanionExtensionsConfig;
263
+ /**
264
+ * Skip launching the browser (no preview window).
265
+ */
171
266
  noBrowser?: boolean;
267
+ /**
268
+ * Internal auto-generated instance ID, not user-configurable.
269
+ */
172
270
  instanceId?: string;
271
+ /**
272
+ * Internal: true when the instance ID came from the user, not autogenerated.
273
+ */
173
274
  instanceExplicit?: boolean;
275
+ /**
276
+ * Dry run mode (no browser launch) for diagnostics.
277
+ */
174
278
  dryRun?: boolean;
175
279
  port?: string | number;
280
+ /**
281
+ * Host to bind the dev server to.
282
+ * Use '0.0.0.0' for Docker/devcontainer environments.
283
+ * Defaults to '127.0.0.1'.
284
+ */
176
285
  host?: string;
286
+ /**
287
+ * Connectable host the browser (HMR client + control-bridge producer) dials,
288
+ * when it differs from the bind `host` (e.g. a remote/devcontainer). Defaults
289
+ * to the bind host, or 127.0.0.1 when bound to a wildcard like '0.0.0.0'.
290
+ */
177
291
  publicHost?: string;
178
292
  logLevel?: 'off' | 'error' | 'warn' | 'info' | 'debug' | 'trace' | 'all';
179
293
  logContexts?: ('background' | 'content' | 'page' | 'sidebar' | 'popup' | 'options' | 'devtools')[];
@@ -189,11 +303,30 @@ export interface StartOptions extends BrowserOptionsBase {
189
303
  chromiumBinary?: ChromiumOptions['chromiumBinary'];
190
304
  geckoBinary?: GeckoOptions['geckoBinary'];
191
305
  firefoxBinary?: GeckoOptions['geckoBinary'];
306
+ /**
307
+ * Companion extensions (load-only) for this command.
308
+ */
192
309
  extensions?: CompanionExtensionsConfig;
310
+ /**
311
+ * [internal] Auto-install project dependencies when missing.
312
+ */
193
313
  install?: boolean;
314
+ /**
315
+ * Skip launching the browser (build still runs).
316
+ */
194
317
  noBrowser?: boolean;
195
318
  port?: string | number;
319
+ /**
320
+ * Host to bind the dev server to.
321
+ * Use '0.0.0.0' for Docker/devcontainer environments.
322
+ * Defaults to '127.0.0.1'.
323
+ */
196
324
  host?: string;
325
+ /**
326
+ * Connectable host the browser (HMR client + control-bridge producer) dials,
327
+ * when it differs from the bind `host` (e.g. a remote/devcontainer). Defaults
328
+ * to the bind host, or 127.0.0.1 when bound to a wildcard like '0.0.0.0'.
329
+ */
197
330
  publicHost?: string;
198
331
  logLevel?: 'off' | 'error' | 'warn' | 'info' | 'debug' | 'trace' | 'all';
199
332
  logContexts?: ('background' | 'content' | 'page' | 'sidebar' | 'popup' | 'options' | 'devtools')[];
@@ -215,27 +348,70 @@ export interface BrowserConfig extends BrowserOptionsBase {
215
348
  bundleId?: SafariOptions['bundleId'];
216
349
  developmentTeam?: SafariOptions['developmentTeam'];
217
350
  macOsOnly?: SafariOptions['macOsOnly'];
351
+ /**
352
+ * Companion extensions (load-only) scoped to a browser config.
353
+ * Useful for per-browser store URLs or local unpacked extensions.
354
+ */
218
355
  extensions?: CompanionExtensionsConfig;
219
356
  }
220
357
  export type OutputConfig = {
221
358
  clean: boolean;
222
359
  path: string;
360
+ /**
361
+ * Internal: the final dist path when `path` points at the staging
362
+ * directory a one-shot build is later promoted from. Metadata surfaces
363
+ * (ready.json) advertise this path, never the staging directory.
364
+ */
223
365
  finalPath?: string;
224
366
  };
367
+ /**
368
+ * Per-category asset size budgets (bytes) for the perf-budgets plugin.
369
+ * Set at the top level of extension.config.js (weakest), under
370
+ * `browser.<vendor>.perfBudgets`, or per command via
371
+ * `commands.dev.perfBudgets` / `commands.build.perfBudgets` (strongest
372
+ * below a CLI flag).
373
+ */
225
374
  export type PerfBudgetsConfig = Partial<Record<import('./plugin-perf-budgets/index.js').AssetCategory, number>>;
226
375
  export interface CommonWebpackOptions {
227
376
  output: OutputConfig;
228
377
  preferences?: Record<string, unknown>;
229
378
  browserFlags?: string[];
230
379
  excludeBrowserFlags?: string[];
380
+ /**
381
+ * Workspace/dependency packages that should be transpiled from source.
382
+ * Useful for monorepos where package exports point to TS/TSX files.
383
+ */
231
384
  transpilePackages?: string[];
232
385
  perfBudgets?: PerfBudgetsConfig;
386
+ /**
387
+ * Companion extensions (load-only). Each entry must be an unpacked extension root
388
+ * containing a manifest.json. These are loaded alongside the user extension in
389
+ * dev/preview/start (and can also be applied to build for packaging scenarios).
390
+ */
233
391
  extensions?: CompanionExtensionsConfig;
392
+ /**
393
+ * Internal auto-generated instance ID, not user-configurable
394
+ */
234
395
  instanceId?: string;
396
+ /**
397
+ * Agent-bridge control channel. Injected by dev-server so the
398
+ * PlaywrightPlugin can advertise them in ready.json. Not user-configurable.
399
+ */
235
400
  controlPort?: number | null;
236
401
  controlPath?: string;
237
402
  logsPath?: string;
238
403
  }
404
+ /**
405
+ * Canonical options type for webpack-config consumers.
406
+ * Accepts any of the command option fields (dev/preview/start/build),
407
+ * while requiring browser and mode, and the common output settings.
408
+ *
409
+ * `mode` is omitted from the partial intersection because PreviewOptions
410
+ * and StartOptions narrow it to `'production'`. Without the omit the
411
+ * outer override below becomes ineffective: TypeScript intersects the
412
+ * outer `'development' | 'production' | 'none'` with the inner
413
+ * `'production'` and the input is locked back to `'production'`.
414
+ */
239
415
  export type WebpackConfigOptions = CommonWebpackOptions & Omit<Partial<DevOptions & PreviewOptions & StartOptions & BuildOptions>, 'mode'> & {
240
416
  browser: BrowserType;
241
417
  mode: 'development' | 'production' | 'none';
@@ -277,8 +453,22 @@ export interface FileConfig {
277
453
  perfBudgets?: PerfBudgetsConfig;
278
454
  };
279
455
  };
456
+ /**
457
+ * Companion extensions (load-only) applied to commands unless overridden per-command.
458
+ * This is merged into `commands.dev|start|preview|build` by the config loader.
459
+ */
280
460
  extensions?: CompanionExtensionsConfig;
461
+ /**
462
+ * Default transpile allowlist for all commands, the weakest layer.
463
+ * `browser.<vendor>.transpilePackages` overrides it, and per-command
464
+ * `commands.<name>.transpilePackages` overrides both.
465
+ */
281
466
  transpilePackages?: string[];
467
+ /**
468
+ * Default per-category asset budgets for all commands, the weakest layer.
469
+ * `browser.<vendor>.perfBudgets` overrides it, and per-command
470
+ * `commands.dev|build.perfBudgets` overrides both.
471
+ */
282
472
  perfBudgets?: PerfBudgetsConfig;
283
473
  config?: (config: Configuration) => Configuration;
284
474
  }
package/package.json CHANGED
@@ -43,7 +43,7 @@
43
43
  "runtime"
44
44
  ],
45
45
  "name": "extension-develop",
46
- "version": "4.1.20",
46
+ "version": "4.1.22",
47
47
  "description": "Develop, build, preview, and package Extension.js projects.",
48
48
  "author": {
49
49
  "name": "Cezar Augusto",