extension-develop 4.1.19 → 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.
- package/dist/832~0.mjs +26 -6
- package/dist/840~0.mjs +75 -6
- package/dist/950~0.mjs +3 -2
- package/dist/command-preview.d.ts +0 -8
- package/dist/dev-server/control-bridge/actions-file.d.ts +0 -1
- package/dist/dev-server/control-bridge/broker.d.ts +6 -4
- package/dist/dev-server/control-bridge/consumer-client.d.ts +0 -10
- package/dist/dev-server/control-bridge/contracts.d.ts +1 -43
- package/dist/dev-server/control-bridge/logs-file.d.ts +0 -1
- package/dist/dev-server/control-bridge/logs-query.d.ts +0 -16
- package/dist/dev-server/control-bridge/producer-runtime.d.ts +1 -2
- package/dist/dev-server~0.mjs +17 -5
- package/dist/extension-js-devtools/edge/manifest.json +0 -1
- package/dist/lib/build-summary.d.ts +0 -11
- package/dist/lib/constants.d.ts +1 -0
- package/dist/lib/ensure-develop-artifacts.d.ts +0 -7
- package/dist/lib/has-dependency.d.ts +0 -5
- package/dist/lib/merge-options.d.ts +0 -40
- package/dist/lib/messages.d.ts +1 -1
- package/dist/lib/project-manifest.d.ts +0 -1
- package/dist/lib/session-paths.d.ts +0 -22
- package/dist/plugin-browsers/index.d.ts +0 -35
- package/dist/plugin-browsers/safari-dev-plugin.d.ts +4 -0
- package/dist/plugin-compatibility/feature-polyfill.d.ts +0 -4
- package/dist/plugin-compilation/env.d.ts +0 -5
- package/dist/plugin-css/css-lib/dead-url-refs.d.ts +0 -6
- package/dist/plugin-css/css-lib/inline-content-script-css.d.ts +0 -15
- package/dist/plugin-css/css-lib/resolve-css-asset.d.ts +0 -8
- package/dist/plugin-perf-budgets/index.d.ts +0 -21
- package/dist/plugin-playwright/index.d.ts +3 -2
- package/dist/plugin-reload/classify-reload.d.ts +0 -4
- package/dist/plugin-reload/index.d.ts +1 -19
- package/dist/plugin-reload/reload-dispatch.d.ts +6 -3
- package/dist/plugin-reload/steps/setup-chunk-loading-target.d.ts +0 -13
- package/dist/plugin-special-folders/folder-extensions/types.d.ts +0 -13
- package/dist/plugin-special-folders/index.d.ts +0 -9
- package/dist/plugin-web-extension/feature-html/html-lib/utils.d.ts +0 -1
- package/dist/plugin-web-extension/feature-html/index.d.ts +0 -27
- package/dist/plugin-web-extension/feature-icons/index.d.ts +0 -12
- package/dist/plugin-web-extension/feature-json/index.d.ts +0 -9
- package/dist/plugin-web-extension/feature-locales/index.d.ts +0 -4
- package/dist/plugin-web-extension/feature-manifest/index.d.ts +0 -10
- package/dist/plugin-web-extension/feature-manifest/manifest-lib/filter-key-edge.d.ts +5 -0
- package/dist/plugin-web-extension/feature-manifest/manifest-lib/filter-keys-safari.d.ts +11 -0
- package/dist/plugin-web-extension/feature-manifest/manifest-lib/gecko-data-collection.d.ts +0 -12
- package/dist/plugin-web-extension/feature-manifest/manifest-lib/legacy-paths.d.ts +0 -13
- package/dist/plugin-web-extension/feature-manifest/manifest-lib/sanitize-fatal-shapes.d.ts +0 -36
- package/dist/plugin-web-extension/feature-manifest/messages.d.ts +19 -0
- package/dist/plugin-web-extension/feature-manifest/steps/apply-dev-defaults-lib/dev-injected-hosts.d.ts +0 -5
- package/dist/plugin-web-extension/feature-manifest/steps/patch-war.d.ts +0 -5
- package/dist/plugin-web-extension/feature-manifest/steps/patch-webkit-background.d.ts +2 -0
- package/dist/plugin-web-extension/feature-manifest/steps/update-manifest.d.ts +1 -0
- package/dist/plugin-web-extension/feature-manifest/steps/warn-gecko-unsupported-apis.d.ts +117 -13
- package/dist/plugin-web-extension/feature-scripts/index.d.ts +0 -10
- package/dist/plugin-web-extension/feature-scripts/steps/native-geturl-import-loader.d.ts +0 -3
- package/dist/plugin-web-extension/feature-web-resources/index.d.ts +0 -10
- package/dist/plugin-web-extension/feature-web-resources/web-resources-lib/clean-matches.d.ts +0 -6
- package/dist/plugin-web-extension/shared/discover-devtools-panels.d.ts +0 -6
- package/dist/plugin-web-extension/shared/paths.d.ts +0 -1
- package/dist/rspack-config~0.mjs +666 -133
- package/dist/types.d.ts +0 -190
- package/package.json +1 -1
- package/runtime/process-shim.cjs +2 -0
|
@@ -49,7 +49,6 @@ export interface BrowserLaunchOptions {
|
|
|
49
49
|
logTab?: number | string;
|
|
50
50
|
logSink?: BrowserLogSink;
|
|
51
51
|
}
|
|
52
|
-
/** Browser-generated log entry normalized by the launcher's CDP controller. */
|
|
53
52
|
export interface BrowserLogSinkEvent {
|
|
54
53
|
level: 'log' | 'info' | 'warn' | 'error' | 'debug';
|
|
55
54
|
text: string;
|
|
@@ -74,9 +73,7 @@ export interface BrowserController {
|
|
|
74
73
|
urlFilter?: string;
|
|
75
74
|
tabFilter?: number | string;
|
|
76
75
|
}): Promise<void>;
|
|
77
|
-
/** The browser's refusal reason for this session, or null when it loaded. */
|
|
78
76
|
getExtensionLoadRefusal?(): string | null;
|
|
79
|
-
/** Re-offer the current dist. Only ever called while the session is refused. */
|
|
80
77
|
retryExtensionLoad?(): Promise<ExtensionLoadRetryResult>;
|
|
81
78
|
}
|
|
82
79
|
export type BrowserLauncherFn = (opts: BrowserLaunchOptions) => Promise<BrowserController>;
|
|
@@ -86,33 +83,13 @@ export interface RunnerPlugin {
|
|
|
86
83
|
apply(compiler: Compiler): void;
|
|
87
84
|
}
|
|
88
85
|
export interface BrowsersPluginOptions {
|
|
89
|
-
/** Injected browser launcher, provided by the CLI from programs/extension/browsers/ */
|
|
90
86
|
launcher: BrowserLauncherFn;
|
|
91
|
-
/** Browser-related options forwarded to the launcher (outputPath/contextDir/extensionsToLoad are filled at compile time) */
|
|
92
87
|
browserOptions: Omit<BrowserLaunchOptions, 'outputPath' | 'contextDir' | 'extensionsToLoad'>;
|
|
93
88
|
}
|
|
94
|
-
/**
|
|
95
|
-
* BrowsersPlugin
|
|
96
|
-
*
|
|
97
|
-
* An rspack plugin that manages the browser lifecycle for extension development.
|
|
98
|
-
* On first successful compilation it launches a browser via the injected launcher
|
|
99
|
-
* function; on subsequent compilations it classifies changed files and triggers
|
|
100
|
-
* the appropriate reload strategy (full / service-worker / content-scripts).
|
|
101
|
-
*
|
|
102
|
-
* A `BuildEmitter` is exposed as `plugin.emitter` so that external consumers
|
|
103
|
-
* (CLI telemetry, wait-mode, etc.) can subscribe to build events without
|
|
104
|
-
* coupling to rspack.
|
|
105
|
-
*/
|
|
106
89
|
export declare class BrowsersPlugin implements RunnerPlugin {
|
|
107
90
|
private readonly options;
|
|
108
91
|
static readonly name = "plugin-browsers";
|
|
109
|
-
/** EventEmitter for build lifecycle events (compiled, error, close). */
|
|
110
92
|
readonly emitter: BuildEmitter;
|
|
111
|
-
/**
|
|
112
|
-
* Extension directories to load alongside the user extension.
|
|
113
|
-
* Set externally by webpack-config after computing companion extensions,
|
|
114
|
-
* before the first compilation.
|
|
115
|
-
*/
|
|
116
93
|
extensionsToLoad: string[];
|
|
117
94
|
private isFirstCompile;
|
|
118
95
|
private controller;
|
|
@@ -120,20 +97,8 @@ export declare class BrowsersPlugin implements RunnerPlugin {
|
|
|
120
97
|
private logSink;
|
|
121
98
|
private lastReportedRefusal;
|
|
122
99
|
constructor(options: BrowsersPluginOptions);
|
|
123
|
-
/**
|
|
124
|
-
* The dev server injects the control-bridge broker so a launched
|
|
125
|
-
* Chromium reloads through the SW producer (the same path as `--no-browser`),
|
|
126
|
-
* not the CDP controller. Called once, before the first compile.
|
|
127
|
-
*/
|
|
128
100
|
setReloadBroker(broker: ReloadBroker): void;
|
|
129
101
|
setLogSink(sink: BrowserLogSink): void;
|
|
130
|
-
/**
|
|
131
|
-
* Re-offer the dist to a browser that refused it at launch. Returns true
|
|
132
|
-
* when the browser has now accepted it, so the caller skips the reload.
|
|
133
|
-
*
|
|
134
|
-
* Only ever runs while the session is refused: re-asking a healthy browser
|
|
135
|
-
* would restart the guest and destroy its HMR state.
|
|
136
|
-
*/
|
|
137
102
|
private retryRefusedExtensionLoad;
|
|
138
103
|
apply(compiler: Compiler): void;
|
|
139
104
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Compiler } from '@rspack/core';
|
|
2
|
+
import { type ReloadBroker, type ReloadInstruction } from '../plugin-reload/index.js';
|
|
2
3
|
import { BuildEmitter, type RunnerPlugin } from './index.js';
|
|
3
4
|
export type SafariPackagerFn = (distPath: string, mode: 'full' | 'resync') => Promise<unknown>;
|
|
5
|
+
export declare function reloadSurvivingPackage(instruction: ReloadInstruction | undefined): ReloadInstruction | undefined;
|
|
4
6
|
export declare class SafariDevPlugin implements RunnerPlugin {
|
|
5
7
|
private readonly packager;
|
|
6
8
|
static readonly name = "safari-dev";
|
|
@@ -10,7 +12,9 @@ export declare class SafariDevPlugin implements RunnerPlugin {
|
|
|
10
12
|
private active;
|
|
11
13
|
private pending;
|
|
12
14
|
private idleWaiters;
|
|
15
|
+
private reloadBroker;
|
|
13
16
|
constructor(packager: SafariPackagerFn);
|
|
17
|
+
setReloadBroker(broker: ReloadBroker): void;
|
|
14
18
|
apply(compiler: Compiler): void;
|
|
15
19
|
idle(): Promise<void>;
|
|
16
20
|
private drain;
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { type Compiler } from '@rspack/core';
|
|
2
2
|
import type { DevOptions, PluginInterface } from '../types.js';
|
|
3
|
-
/**
|
|
4
|
-
* PolyfillPlugin is responsible for providing the `browser`
|
|
5
|
-
* global variable to the extension's codebase.
|
|
6
|
-
*/
|
|
7
3
|
export declare class PolyfillPlugin {
|
|
8
4
|
readonly browser: DevOptions['browser'];
|
|
9
5
|
constructor(options: PluginInterface);
|
|
@@ -8,9 +8,4 @@ export declare class EnvPlugin {
|
|
|
8
8
|
constructor(options: Partial<PluginInterface>);
|
|
9
9
|
apply(compiler: Compiler): void;
|
|
10
10
|
}
|
|
11
|
-
/**
|
|
12
|
-
* Env values available to `$EXTENSION_*` placeholders in emitted .json/.html.
|
|
13
|
-
* Mirrors DefinePlugin: dotenv/process values plus the per-build-target
|
|
14
|
-
* browser and mode synthetics JS already reads via import.meta.env.
|
|
15
|
-
*/
|
|
16
11
|
export declare function buildTemplateVars(combinedVars: Record<string, unknown>, browser: DevOptions['browser'], mode: string): Record<string, string>;
|
|
@@ -3,12 +3,6 @@ export interface DeadUrlRefContext {
|
|
|
3
3
|
issuerDir: string;
|
|
4
4
|
roots: string[];
|
|
5
5
|
}
|
|
6
|
-
/** True when the reference names no file under the issuer or any project root. */
|
|
7
6
|
export declare function isDeadCssUrlRef(rawRequest: string, { issuerDir, roots }: DeadUrlRefContext): boolean;
|
|
8
|
-
/**
|
|
9
|
-
* Rewrites url() targets in place. The replacer returns the new target, or
|
|
10
|
-
* undefined to keep the reference exactly as authored.
|
|
11
|
-
*/
|
|
12
7
|
export declare function replaceCssUrlRefs(source: string, replacer: (request: string) => string | undefined): string;
|
|
13
|
-
/** Every url() target in a stylesheet, in source order, duplicates collapsed. */
|
|
14
8
|
export declare function extractCssUrlRefs(source: string): string[];
|
|
@@ -10,23 +10,8 @@ export interface RewriteInlinedCssUrlsContext {
|
|
|
10
10
|
manifestDir: string;
|
|
11
11
|
publicRoot: string;
|
|
12
12
|
}
|
|
13
|
-
/**
|
|
14
|
-
* Every relative or root-absolute url() that names a real file is rewritten
|
|
15
|
-
* to `<placeholder><output name><query/hash>` and reported so the caller can
|
|
16
|
-
* emit it. A file public/ owns keeps the name the public copier gives it at
|
|
17
|
-
* the dist root. Remote, data:, fragment-only, protocol-relative and already
|
|
18
|
-
* absolute references stay as authored, and so does a reference to a file
|
|
19
|
-
* that does not exist (the dead-reference scan reports those).
|
|
20
|
-
*/
|
|
21
13
|
export declare function rewriteInlinedCssUrls(source: string, context: RewriteInlinedCssUrlsContext): {
|
|
22
14
|
css: string;
|
|
23
15
|
targets: InlinedCssUrlTarget[];
|
|
24
16
|
};
|
|
25
|
-
/**
|
|
26
|
-
* The JavaScript module a content script gets for an inlined stylesheet: a
|
|
27
|
-
* CommonJS export of a data: URL, so `import sheet from './x.css'` and
|
|
28
|
-
* `new URL('./x.css', import.meta.url)` both keep working as they did when
|
|
29
|
-
* rspack inlined the file itself. The placeholder becomes the extension root
|
|
30
|
-
* when the module evaluates, which is after the runtime API exists.
|
|
31
|
-
*/
|
|
32
17
|
export declare function toRuntimeStylesheetModule(css: string): string;
|
|
@@ -3,12 +3,4 @@ export interface CssAssetResult {
|
|
|
3
3
|
found: boolean;
|
|
4
4
|
href: string | undefined;
|
|
5
5
|
}
|
|
6
|
-
/**
|
|
7
|
-
* Resolves the CSS asset emitted for a given entry feature.
|
|
8
|
-
*
|
|
9
|
-
* First tries the canonical name (`<feature>.css`). If that misses,
|
|
10
|
-
* which can happen when rspack's native CSS (`experiments.css`) splits
|
|
11
|
-
* the stylesheet into a chunk whose name differs from the entry, it
|
|
12
|
-
* falls back to inspecting the entrypoint's actual chunk files.
|
|
13
|
-
*/
|
|
14
6
|
export declare function resolveCssAsset(compilation: Compilation, feature: string): CssAssetResult;
|
|
@@ -4,27 +4,6 @@ interface PerfBudgetsPluginOptions {
|
|
|
4
4
|
enabled?: boolean;
|
|
5
5
|
budgets?: Partial<Record<AssetCategory, number>>;
|
|
6
6
|
}
|
|
7
|
-
/**
|
|
8
|
-
* PerfBudgetsPlugin, extension-aware performance budgets.
|
|
9
|
-
*
|
|
10
|
-
* Replaces rspack's stock single-threshold `performance.hints` with a
|
|
11
|
-
* per-asset-category budget tuned to how browser extensions actually
|
|
12
|
-
* load code:
|
|
13
|
-
*
|
|
14
|
-
* content_scripts/* → 512 KiB (injected on every navigation)
|
|
15
|
-
* background / SW → 512 KiB (wakes from cold each session)
|
|
16
|
-
* pages / sidebar / … → 1 MiB (opened on demand)
|
|
17
|
-
* runtime / wasm cores → 1 MiB (hashed payloads at the output root)
|
|
18
|
-
* images, fonts, etc. → silenced (not a code-splitting concern)
|
|
19
|
-
*
|
|
20
|
-
* Numbers are sized to clear realistic framework templates (React/Vue/
|
|
21
|
-
* Preact/Svelte + a design system) and still flag genuine outliers
|
|
22
|
-
* (multi-MiB AI sidebars, heavyweight WASM service workers). Override
|
|
23
|
-
* per-category via `perfBudgets` in `extension.config.{js,ts}`.
|
|
24
|
-
*
|
|
25
|
-
* Set `compiler.options.performance.hints = false` when this plugin is
|
|
26
|
-
* registered to avoid double-warnings.
|
|
27
|
-
*/
|
|
28
7
|
export declare class PerfBudgetsPlugin {
|
|
29
8
|
static readonly name = "plugin-perf-budgets";
|
|
30
9
|
private readonly options;
|
|
@@ -36,7 +36,7 @@ export type ReadyMetadata = {
|
|
|
36
36
|
extensionId?: string;
|
|
37
37
|
browserExitedAt?: string;
|
|
38
38
|
browserExitCode?: number | null;
|
|
39
|
-
runtime?: 'attached';
|
|
39
|
+
runtime?: 'attached' | 'detached';
|
|
40
40
|
executorAttachedAt?: string;
|
|
41
41
|
managedExtensions?: ManagedExtensionRecord[];
|
|
42
42
|
};
|
|
@@ -105,7 +105,8 @@ export declare function createPlaywrightMetadataWriter(options: WriterOptions):
|
|
|
105
105
|
writeStarting(): void;
|
|
106
106
|
writeReady(compiledAt?: string | null): void;
|
|
107
107
|
writeError(code: string, message: string, errors?: string[]): void;
|
|
108
|
-
writeShutdown(): void;
|
|
108
|
+
writeShutdown(message?: string): void;
|
|
109
|
+
stampExecutorDetached(): void;
|
|
109
110
|
stampExecutorAttached(): void;
|
|
110
111
|
appendEvent: (event: PlaywrightAutomationEvent) => void;
|
|
111
112
|
};
|
|
@@ -6,17 +6,13 @@ export interface ReloadInstruction {
|
|
|
6
6
|
changedScriptFiles?: string[];
|
|
7
7
|
label?: string;
|
|
8
8
|
}
|
|
9
|
-
/** "context (fileA, fileB +2 more)", the one label every reload surface shows. */
|
|
10
9
|
export declare function formatReloadContextLabel(context: string, files: string[]): string;
|
|
11
10
|
export declare function pageContextFromSources(changedSources: string[]): string;
|
|
12
11
|
export interface SourceFeatureIndex {
|
|
13
12
|
swSources: Set<string>;
|
|
14
|
-
/** Source → canonical content_scripts entry names whose chunks contain it. */
|
|
15
13
|
contentEntriesBySource: Map<string, Set<string>>;
|
|
16
14
|
pageSources: Set<string>;
|
|
17
|
-
/** Source → emitted scripts/ bundle names whose chunks contain it. */
|
|
18
15
|
scriptFilesBySource?: Map<string, Set<string>>;
|
|
19
|
-
/** Project-relative public/ roots the copier ships at the dist root. */
|
|
20
16
|
publicRoots?: string[];
|
|
21
17
|
}
|
|
22
18
|
export declare function publicOutputPath(rel: string, publicRoots: string[] | undefined): string | undefined;
|
|
@@ -1,26 +1,8 @@
|
|
|
1
1
|
import type { Compiler } from '@rspack/core';
|
|
2
2
|
import type { DevOptions, PluginInterface } from '../types.js';
|
|
3
3
|
export { buildSourceFeatureIndex, classifyReloadFromSources, formatReloadContextLabel, pageContextFromSources, publicOutputPath, type ReloadInstruction, type ReloadType, readContentScriptCount, type SourceFeatureIndex } from './classify-reload.js';
|
|
4
|
-
export { type ChangedSourcesSnapshot, type ChangedSourcesTracker, createChangedSourcesTracker, dispatchReload, type ReloadBroker, type ReloadExecutor } from './reload-dispatch.js';
|
|
4
|
+
export { type ChangedSourcesSnapshot, type ChangedSourcesTracker, createChangedSourcesTracker, dispatchReload, type ReloadBroker, type ReloadExecutor, type UndeliveredReloadContext } from './reload-dispatch.js';
|
|
5
5
|
export { SetupChunkLoadingTarget } from './steps/setup-chunk-loading-target.js';
|
|
6
|
-
/**
|
|
7
|
-
* ReloadPlugin owns the dev-only reload/HMR strategy end to end:
|
|
8
|
-
*
|
|
9
|
-
* - build-time injection of the reload runtime (SetupReloadStrategy and the
|
|
10
|
-
* vendored webpack-target-webextension fork), the SW scripts-replay shim,
|
|
11
|
-
* and the control-bridge producer/relay instrumentation
|
|
12
|
-
* - the reload classifier and dispatch seam consumed by plugin-browsers'
|
|
13
|
-
* BrowsersPlugin and the dev server's `--no-browser` broadcast path
|
|
14
|
-
* (re-exported above from classify-reload.ts / reload-dispatch.ts)
|
|
15
|
-
*
|
|
16
|
-
* Registration order matters: this plugin must be applied AFTER
|
|
17
|
-
* plugin-web-extension, SetupReloadStrategy decorates the background and
|
|
18
|
-
* content-script entries that feature-scripts' AddScripts declares.
|
|
19
|
-
*
|
|
20
|
-
* The whole pipeline is dev-only; `EXTENSION_NO_RELOAD=true` opts out. The
|
|
21
|
-
* every-mode content-script wrapper (mount lifecycle) is NOT part of this
|
|
22
|
-
* plugin. It lives in feature-scripts/steps/add-content-script-wrapper.
|
|
23
|
-
*/
|
|
24
6
|
export declare class ReloadPlugin {
|
|
25
7
|
static readonly name = "plugin-reload";
|
|
26
8
|
readonly manifestPath: string;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { Compiler } from '@rspack/core';
|
|
2
2
|
import type { ReloadInstruction } from './classify-reload.js';
|
|
3
|
+
export interface UndeliveredReloadContext {
|
|
4
|
+
producerRestartExpected?: boolean;
|
|
5
|
+
}
|
|
3
6
|
export interface ReloadBroker {
|
|
4
7
|
broadcastReload(instruction: {
|
|
5
8
|
type: ReloadInstruction['type'];
|
|
@@ -8,17 +11,17 @@ export interface ReloadBroker {
|
|
|
8
11
|
changedFiles?: string[];
|
|
9
12
|
changedScriptFiles?: string[];
|
|
10
13
|
}): number;
|
|
11
|
-
undeliveredReloadWarning?(): string | null;
|
|
14
|
+
undeliveredReloadWarning?(context?: UndeliveredReloadContext): string | null;
|
|
12
15
|
}
|
|
13
16
|
export interface ReloadExecutor {
|
|
14
17
|
broker?: ReloadBroker;
|
|
18
|
+
producerRestartExpected?: boolean;
|
|
15
19
|
}
|
|
16
20
|
export declare function formatReloadingLine(label: string): string;
|
|
21
|
+
export declare function formatQueuedReloadLine(label: string): string;
|
|
17
22
|
export declare function dispatchReload(instruction: ReloadInstruction | undefined, executor: ReloadExecutor): Promise<void>;
|
|
18
23
|
export interface ChangedSourcesSnapshot {
|
|
19
|
-
/** A manifest.json / _locales change, forces a full reload regardless of which other files changed. */
|
|
20
24
|
forcedFull: boolean;
|
|
21
|
-
/** Project-relative, forward-slashed paths of every file changed since the last successful compile. */
|
|
22
25
|
changedSources: string[];
|
|
23
26
|
}
|
|
24
27
|
export interface ChangedSourcesTracker {
|
|
@@ -1,18 +1,5 @@
|
|
|
1
1
|
import type { Compiler } from '@rspack/core';
|
|
2
2
|
import type { PluginInterface } from '../../types.js';
|
|
3
|
-
/**
|
|
4
|
-
* How a chunk gets loaded is a property of the extension platform, not of dev
|
|
5
|
-
* mode. Without this, a production build falls back to rspack's web target,
|
|
6
|
-
* whose loader appends a `<script>` to the host document: that runs in the MAIN
|
|
7
|
-
* world while the content script lives in the isolated world, so the chunk never
|
|
8
|
-
* reaches the requester and a dynamic `import()` dies with ChunkLoadError. Dev
|
|
9
|
-
* looked fine only because the target rode along inside the reload plugin
|
|
10
|
-
* (issue #507).
|
|
11
|
-
*
|
|
12
|
-
* This is the target ALONE. Everything reload-specific, including the
|
|
13
|
-
* synthesized background entry, stays in SetupReloadStrategy: production must
|
|
14
|
-
* never gain a background script the author did not write.
|
|
15
|
-
*/
|
|
16
3
|
export declare class SetupChunkLoadingTarget {
|
|
17
4
|
private readonly manifestPath;
|
|
18
5
|
private readonly browser;
|
|
@@ -1,17 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Companion extensions are "load-only" unpacked extension directories that
|
|
3
|
-
* should be loaded alongside the user extension in dev/preview/start.
|
|
4
|
-
*
|
|
5
|
-
* Each directory MUST be an unpacked extension root containing a manifest.json.
|
|
6
|
-
*/
|
|
7
1
|
export type CompanionExtensionsConfig = string[] | {
|
|
8
|
-
/**
|
|
9
|
-
* Folder to scan for subfolders that contain a manifest.json.
|
|
10
|
-
* Example: "./extensions" -> loads "./extensions/*" (one level deep)
|
|
11
|
-
*/
|
|
12
2
|
dir?: string;
|
|
13
|
-
/**
|
|
14
|
-
* Explicit extension directories to load (absolute or relative to projectRoot).
|
|
15
|
-
*/
|
|
16
3
|
paths?: string[];
|
|
17
4
|
};
|
|
@@ -2,15 +2,6 @@ import { type Compiler } from '@rspack/core';
|
|
|
2
2
|
interface SpecialFoldersPluginOptions {
|
|
3
3
|
manifestPath: string;
|
|
4
4
|
}
|
|
5
|
-
/**
|
|
6
|
-
* SpecialFoldersPlugin is responsible for handling the
|
|
7
|
-
* special folders in the extension:
|
|
8
|
-
*
|
|
9
|
-
* - /pages - HTML pages not included in the manifest
|
|
10
|
-
* - /scripts - Script files not included in the manifest
|
|
11
|
-
* - /public - Static files not included in the manifest
|
|
12
|
-
* - /extensions - Load-only companion extensions (unpacked)
|
|
13
|
-
*/
|
|
14
5
|
export declare class SpecialFoldersPlugin {
|
|
15
6
|
static readonly name: string;
|
|
16
7
|
private readonly options;
|
|
@@ -34,7 +34,6 @@ export declare function resolveAbsoluteFsPath(params: {
|
|
|
34
34
|
projectRoot: string;
|
|
35
35
|
publicRootForResource: string;
|
|
36
36
|
outputRoot: string;
|
|
37
|
-
/** Manifest dir: Chrome resolves root URLs (/pages/x.html) against it. */
|
|
38
37
|
manifestRoot?: string;
|
|
39
38
|
}): {
|
|
40
39
|
absoluteFsPath: string;
|
|
@@ -1,32 +1,5 @@
|
|
|
1
1
|
import type { Compiler } from '@rspack/core';
|
|
2
2
|
import type { FilepathList, PluginInterface } from '../../types.js';
|
|
3
|
-
/**
|
|
4
|
-
* HtmlPlugin is responsible for handling the HTML file
|
|
5
|
-
* defined in the manifest.json. Static assets and CSS files
|
|
6
|
-
* within the HTML file are added to the compilation. JS files
|
|
7
|
-
* are added as webpack entrypoints. It also supports ecxtra
|
|
8
|
-
* html files defined via this.include option. These extra
|
|
9
|
-
* html files are added to the compilation and are also HMR
|
|
10
|
-
* enabled. They are useful for adding extra pages to the
|
|
11
|
-
* extension runtime that are not defined in manifest.
|
|
12
|
-
*
|
|
13
|
-
* The plugin also has a guard against recompiling entrypoints
|
|
14
|
-
* at runtime, throwing an error if any of those files change.
|
|
15
|
-
*
|
|
16
|
-
* Features supported:
|
|
17
|
-
* action.default_popup - HMR enabled
|
|
18
|
-
* background.page - HMR enabled
|
|
19
|
-
* chrome_settings_overrides.homepage - HMR enabled
|
|
20
|
-
* chrome_url_overrides.newtab - HMR enabled
|
|
21
|
-
* chrome_url_overrides.history - HMR enabled
|
|
22
|
-
* chrome_url_overrides.bookmarks - HMR enabled
|
|
23
|
-
* devtools_page - HMR enabled
|
|
24
|
-
* options_ui.page - HMR enabled
|
|
25
|
-
* page_action.default_popup - HMR enabled
|
|
26
|
-
* sandbox.page - HMR enabled
|
|
27
|
-
* side_panel.default_panel - HMR enabled
|
|
28
|
-
* sidebar_action.default_panel - HMR enabled
|
|
29
|
-
*/
|
|
30
3
|
export declare class HtmlPlugin {
|
|
31
4
|
readonly manifestPath: string;
|
|
32
5
|
readonly includeList?: FilepathList;
|
|
@@ -1,17 +1,5 @@
|
|
|
1
1
|
import type { Compiler } from '@rspack/core';
|
|
2
2
|
import type { DevOptions, FilepathList, PluginInterface, ThemeIcon } from '../../types.js';
|
|
3
|
-
/**
|
|
4
|
-
* IconsPlugin is responsible for handling the icon files defined
|
|
5
|
-
* in the manifest.json. It emits the icon files to the output
|
|
6
|
-
* directory and adds them to the file dependencies of the compilation.
|
|
7
|
-
*
|
|
8
|
-
* Features supported:
|
|
9
|
-
* action.default_icon
|
|
10
|
-
* browser_action.default_icon
|
|
11
|
-
* icons
|
|
12
|
-
* page_action.default_icon
|
|
13
|
-
* sidebar_action.default_icon
|
|
14
|
-
*/
|
|
15
3
|
export declare class IconsPlugin {
|
|
16
4
|
readonly manifestPath: string;
|
|
17
5
|
readonly includeList?: FilepathList | {
|
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
import { type Compiler } from '@rspack/core';
|
|
2
2
|
import type { DevOptions, FilepathList, PluginInterface } from '../../types.js';
|
|
3
|
-
/**
|
|
4
|
-
* JsonPlugin is responsible for handling the JSON files defined
|
|
5
|
-
* in the manifest.json. It emits the JSON files to the output
|
|
6
|
-
* directory and adds them to the file dependencies of the compilation.
|
|
7
|
-
*
|
|
8
|
-
* Features supported:
|
|
9
|
-
* - declarative_net_request.ruleset
|
|
10
|
-
* - storage.managed_schema
|
|
11
|
-
*/
|
|
12
3
|
export declare class JsonPlugin {
|
|
13
4
|
readonly manifestPath: string;
|
|
14
5
|
readonly includeList?: FilepathList;
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { type Compiler } from '@rspack/core';
|
|
2
2
|
import type { FilepathList, PluginInterface } from '../../types.js';
|
|
3
|
-
/**
|
|
4
|
-
* LocalesPlugin is responsible for emitting the locales files
|
|
5
|
-
* to the output directory.
|
|
6
|
-
*/
|
|
7
3
|
export declare class LocalesPlugin {
|
|
8
4
|
readonly manifestPath: string;
|
|
9
5
|
readonly includeList?: FilepathList;
|
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
import type { Compiler } from '@rspack/core';
|
|
2
2
|
import type { DevOptions, FilepathList, PluginInterface } from '../../types.js';
|
|
3
|
-
/**
|
|
4
|
-
* ManifestPlugin is responsible for handling the manifest.json file.
|
|
5
|
-
* It ensures that the files defined in the manifest have valid paths,
|
|
6
|
-
* throwing errors if they don't. It also ensures the manifest is emitted
|
|
7
|
-
* to the assets bundle, so other plugins can modify it, and stored
|
|
8
|
-
* as file dependency so webpack can watch and trigger changes.
|
|
9
|
-
*
|
|
10
|
-
* The plugin also has a guard against recompiling entrypoints
|
|
11
|
-
* at runtime, throwing an error if any of those files change.
|
|
12
|
-
*/
|
|
13
3
|
export declare class ManifestPlugin {
|
|
14
4
|
readonly manifestPath: string;
|
|
15
5
|
readonly browser: DevOptions['browser'];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DevOptions, Manifest } from '../../../types.js';
|
|
2
|
+
export interface WebkitDroppedKey {
|
|
3
|
+
path: string;
|
|
4
|
+
reason: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function dropWebkitUnsupportedKeys(manifest: Manifest, browser: DevOptions['browser']): {
|
|
7
|
+
manifest: Manifest;
|
|
8
|
+
dropped: WebkitDroppedKey[];
|
|
9
|
+
};
|
|
10
|
+
export declare function reportWebkitDroppedKeys(dropped: WebkitDroppedKey[], browser: DevOptions['browser']): void;
|
|
11
|
+
export declare function resetWebkitDropNotices(): void;
|
|
@@ -1,14 +1,2 @@
|
|
|
1
1
|
import type { Manifest } from '../../../types.js';
|
|
2
|
-
/**
|
|
3
|
-
* AMO rejects every new add-on submitted since 2025-11-03 whose manifest
|
|
4
|
-
* lacks `browser_specific_settings.gecko.data_collection_permissions`
|
|
5
|
-
* (add-ons that transmit nothing must declare `{"required": ["none"]}`),
|
|
6
|
-
* and Mozilla has announced the key becomes mandatory for ALL add-ons
|
|
7
|
-
* during 2026. Firefox parses the key from 140 (desktop) / 142 (Android)
|
|
8
|
-
* on both MV2 and MV3, so declaring it is safe everywhere.
|
|
9
|
-
*
|
|
10
|
-
* Returns true when the resolved Gecko manifest carries no such
|
|
11
|
-
* declaration, so the build can surface a store-readiness warning instead
|
|
12
|
-
* of letting the author discover the rejection at submission time.
|
|
13
|
-
*/
|
|
14
2
|
export declare function missingGeckoDataCollectionPermissions(manifest: Manifest): boolean;
|
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Old Extension.js scaffold layout → current standardized HTML destinations.
|
|
3
|
-
* Detection is field-scoped on purpose: a string that merely looks like an old
|
|
4
|
-
* path in description, web_accessible_resources, or any other field is not a hit.
|
|
5
|
-
*/
|
|
6
1
|
export interface LegacyManifestPathRule {
|
|
7
|
-
/** Dot-path into the author manifest (e.g. `options_ui.page`). */
|
|
8
2
|
field: string;
|
|
9
|
-
/** Exact path the old scaffold wrote into that field. */
|
|
10
3
|
legacyPath: string;
|
|
11
|
-
/** Canonical emit destination Extension.js rewrites the field to. */
|
|
12
4
|
modernPath: string;
|
|
13
5
|
}
|
|
14
6
|
export interface LegacyManifestPathHit {
|
|
@@ -17,10 +9,5 @@ export interface LegacyManifestPathHit {
|
|
|
17
9
|
modernPath: string;
|
|
18
10
|
}
|
|
19
11
|
export declare const LEGACY_MANIFEST_PATH_RULES: readonly LegacyManifestPathRule[];
|
|
20
|
-
/** Collapse author path noise so `./x` and `/x` match the scaffold form. */
|
|
21
12
|
export declare function normalizeLegacyPathRef(raw: string): string;
|
|
22
|
-
/**
|
|
23
|
-
* Field-by-field scan of the *author* manifest for old scaffold HTML paths.
|
|
24
|
-
* Call this on the pre-rewrite source; the emitted asset already has modern paths.
|
|
25
|
-
*/
|
|
26
13
|
export declare function findLegacyManifestPathHits(manifest: unknown): LegacyManifestPathHit[];
|
|
@@ -3,42 +3,6 @@ export interface FatalShapeFix {
|
|
|
3
3
|
field: string;
|
|
4
4
|
detail: string;
|
|
5
5
|
}
|
|
6
|
-
/**
|
|
7
|
-
* Repair author-manifest shapes that make Chrome refuse to load the whole
|
|
8
|
-
* extension. Loading via --load-extension surfaces the refusal as a native
|
|
9
|
-
* modal dialog (no CDP, no console), so a dev session just wedges, the
|
|
10
|
-
* browser never binds its debug endpoint. Both shapes below were found in
|
|
11
|
-
* the wild and are unambiguous to fix:
|
|
12
|
-
*
|
|
13
|
-
* - `"name"` missing, empty, or not a string, Chrome refuses with
|
|
14
|
-
* "Required value 'name' is missing or invalid" (verified live on Chrome
|
|
15
|
-
* 150 via CDP loadUnpacked for all three shapes). Coerce scalars,
|
|
16
|
-
* fall back to "Unnamed Extension".
|
|
17
|
-
* - `"version"` missing entirely, Chrome refuses with "Required value
|
|
18
|
-
* 'version' is missing or invalid" (wild: Ananyakk71/javscript). Inject
|
|
19
|
-
* "0.0.0" so the session can attach.
|
|
20
|
-
* - `"version": 1.0`, JSON authors write a number; Chrome requires a string
|
|
21
|
-
* of 1-4 dot-separated integers. String() preserves the intent.
|
|
22
|
-
* - `"version": "x.y.z"` (any string that is not 1-4 dot-separated integers
|
|
23
|
-
* 0-65535), a placeholder the author never filled in; Chrome refuses the
|
|
24
|
-
* whole extension over it. Salvage the numeric parts when there are any,
|
|
25
|
-
* fall back to "0.0.0" otherwise.
|
|
26
|
-
* - `"default_icon": ""` (in action/browser_action/page_action), an empty
|
|
27
|
-
* icon path rejects the extension. Empty means "no icon": drop the key.
|
|
28
|
-
* - An icon path (`icons`, `*_action.default_icon`) whose file exists but is
|
|
29
|
-
* 0 bytes (wild: Speak2Type ships an empty icon-128.png), Chrome cannot
|
|
30
|
-
* decode it and refuses the whole extension with "Could not load icon".
|
|
31
|
-
* Requires `manifestDir` to resolve the paths; drop the entry.
|
|
32
|
-
* - `'unsafe-inline'` in `content_security_policy.extension_pages`
|
|
33
|
-
* script-src, Chrome refuses the whole extension with "Insecure CSP
|
|
34
|
-
* value" (wild: zenwerk/tonikakuyare). MV3 never honors it, so stripping
|
|
35
|
-
* it changes nothing but the refusal.
|
|
36
|
-
* - A named (non-`_execute_*`) command whose `description` is missing,
|
|
37
|
-
* empty, or not a string, Chrome refuses the whole extension with
|
|
38
|
-
* "Invalid value for 'commands[N].description'" (seen live loading a
|
|
39
|
-
* built extension). Fall back to the command name so the shortcut stays
|
|
40
|
-
* registered and the session can attach.
|
|
41
|
-
*/
|
|
42
6
|
export declare function sanitizeFatalManifestShapes(manifest: Manifest, manifestDir?: string): {
|
|
43
7
|
manifest: Manifest;
|
|
44
8
|
fixes: FatalShapeFix[];
|
|
@@ -13,6 +13,25 @@ export declare function manifestLegacyWarningsSummary(count: number): string;
|
|
|
13
13
|
export declare function pageActionNotSupportedByBrowser(browser: string): string;
|
|
14
14
|
export declare function pageActionDroppedForBrowserAction(browser: string): string;
|
|
15
15
|
export declare function vendorPrefixedKeyDropped(key: string, familyKey: string, vendor: 'chrome' | 'edge', browser: string): string;
|
|
16
|
+
export declare function edgeStoreKeyDropped(browser: string): string;
|
|
16
17
|
export declare function mv2SandboxPolicyDropped(browser: string): string;
|
|
17
18
|
export declare function geckoSidePanelUnsupported(file: string): string;
|
|
19
|
+
export declare function safariSidePanelUnsupported(file: string): string;
|
|
20
|
+
export declare function safariOffscreenUnsupported(file: string): string;
|
|
21
|
+
export declare function safariTabGroupsUnsupported(file: string): string;
|
|
22
|
+
export declare function safariManagementUnsupported(file: string): string;
|
|
23
|
+
export declare function safariUserScriptsUnsupported(file: string): string;
|
|
24
|
+
export declare function safariIdentityUnsupported(file: string): string;
|
|
25
|
+
export declare function safariNotificationsUnsupported(file: string): string;
|
|
26
|
+
export declare function safariOmniboxUnsupported(file: string): string;
|
|
27
|
+
export declare function safariBookmarksUnsupported(file: string): string;
|
|
28
|
+
export declare function safariHistoryUnsupported(file: string): string;
|
|
29
|
+
export declare function safariDownloadsUnsupported(file: string): string;
|
|
30
|
+
export declare function safariIdleUnsupported(file: string): string;
|
|
31
|
+
export declare const safariMissingMemberDetails: Record<string, string>;
|
|
32
|
+
export declare function safariMemberUnsupported(file: string, api: string, member: string, kind: 'call' | 'read'): string;
|
|
18
33
|
export declare function geckoActionUnsupportedOnMv2(file: string): string;
|
|
34
|
+
export declare function webkitUnsupportedKeysDropped(browser: string, dropped: Array<{
|
|
35
|
+
path: string;
|
|
36
|
+
reason: string;
|
|
37
|
+
}>): string;
|
|
@@ -16,10 +16,5 @@ interface ScannableModule {
|
|
|
16
16
|
}
|
|
17
17
|
export declare function isContentScriptModule(module: ScannableModule): boolean;
|
|
18
18
|
export declare function findAbsoluteRequestUrls(source: string): string[];
|
|
19
|
-
/**
|
|
20
|
-
* Finds absolute request URLs whose host is granted only because dev unioned
|
|
21
|
-
* the content-script matches into the manifest. Content-script modules are
|
|
22
|
-
* skipped: their requests answer to page CORS rather than host permissions.
|
|
23
|
-
*/
|
|
24
19
|
export declare function findInjectedOnlyHostUses(modules: Iterable<ScannableModule>, injected: readonly string[], declared: readonly string[], optional: readonly string[]): InjectedOnlyHostUse[];
|
|
25
20
|
export {};
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { type Compiler } from '@rspack/core';
|
|
2
2
|
import type { DevOptions, PluginInterface } from '../../../types.js';
|
|
3
|
-
/**
|
|
4
|
-
* Patches manifest.json with web_accessible_resources from content script
|
|
5
|
-
* imports. Depends on CollectContentEntryImports (feature-web-resources)
|
|
6
|
-
* populating getSharedFor(compilation).entryImports before this runs.
|
|
7
|
-
*/
|
|
8
3
|
export declare class PatchWAR {
|
|
9
4
|
readonly manifestPath: string;
|
|
10
5
|
readonly browser?: DevOptions['browser'];
|
|
@@ -4,6 +4,7 @@ export declare class UpdateManifest {
|
|
|
4
4
|
readonly manifestPath: string;
|
|
5
5
|
readonly browser: DevOptions['browser'];
|
|
6
6
|
private reportedFatalFixes;
|
|
7
|
+
private reportedUnsupportedApis;
|
|
7
8
|
constructor(options: PluginInterface);
|
|
8
9
|
private applyDevOverrides;
|
|
9
10
|
apply(compiler: Compiler): void;
|