extension-develop 4.0.26 → 4.0.27
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/README.md +5 -1
- package/dist/0~dev-server.mjs +5 -5
- package/dist/0~rspack-config.mjs +298 -139
- package/dist/101.mjs +1099 -972
- package/dist/494.mjs +12 -1
- package/dist/839.mjs +105 -25
- package/dist/command-preview.d.ts +7 -0
- package/dist/dev-server/control-bridge/producer-runtime.d.ts +2 -1
- package/dist/feature-scripts-content-script-wrapper.js +2 -1
- package/dist/feature-scripts-content-script-wrapper.mjs +2 -1
- package/dist/lib/atomic-dist.d.ts +5 -0
- package/dist/lib/config-loader.d.ts +12 -12
- package/dist/lib/constants.d.ts +2 -0
- package/dist/lib/merge-options.d.ts +67 -0
- package/dist/lib/paths.d.ts +1 -1
- package/dist/lib/session-paths.d.ts +1 -0
- package/dist/plugin-compilation/boring.d.ts +1 -0
- package/dist/plugin-compilation/zip.d.ts +2 -0
- package/dist/plugin-playwright/index.d.ts +2 -0
- package/dist/plugin-web-extension/feature-html/html-lib/utils.d.ts +2 -1
- package/dist/plugin-web-extension/feature-json/messages.d.ts +2 -0
- package/dist/plugin-web-extension/feature-manifest/messages.d.ts +1 -0
- package/dist/plugin-web-extension/feature-web-resources/collect-entry-imports.d.ts +1 -0
- package/dist/types.d.ts +24 -3
- package/package.json +1 -1
|
@@ -2,33 +2,33 @@ import type { Configuration } from '@rspack/core';
|
|
|
2
2
|
import type { BrowserConfig, DevOptions } from '../types';
|
|
3
3
|
export declare function loadCustomConfig(projectPath: string): Promise<(config: Configuration) => Configuration>;
|
|
4
4
|
export declare function loadCommandConfig(projectPath: string, command: 'dev' | 'build' | 'start' | 'preview'): Promise<{
|
|
5
|
-
extensions:
|
|
6
|
-
transpilePackages:
|
|
7
|
-
perfBudgets:
|
|
5
|
+
extensions: import("../module").CompanionExtensionsConfig;
|
|
6
|
+
transpilePackages: string[];
|
|
7
|
+
perfBudgets: Partial<Record<import("../plugin-perf-budgets").AssetCategory, number>>;
|
|
8
8
|
} | {
|
|
9
|
-
extensions:
|
|
10
|
-
transpilePackages:
|
|
9
|
+
extensions: import("../module").CompanionExtensionsConfig;
|
|
10
|
+
transpilePackages: string[];
|
|
11
11
|
perfBudgets?: undefined;
|
|
12
12
|
} | {
|
|
13
|
-
extensions:
|
|
13
|
+
extensions: import("../module").CompanionExtensionsConfig;
|
|
14
14
|
transpilePackages?: undefined;
|
|
15
|
-
perfBudgets:
|
|
15
|
+
perfBudgets: Partial<Record<import("../plugin-perf-budgets").AssetCategory, number>>;
|
|
16
16
|
} | {
|
|
17
|
-
extensions:
|
|
17
|
+
extensions: import("../module").CompanionExtensionsConfig;
|
|
18
18
|
transpilePackages?: undefined;
|
|
19
19
|
perfBudgets?: undefined;
|
|
20
20
|
} | {
|
|
21
21
|
extensions?: undefined;
|
|
22
|
-
transpilePackages:
|
|
23
|
-
perfBudgets:
|
|
22
|
+
transpilePackages: string[];
|
|
23
|
+
perfBudgets: Partial<Record<import("../plugin-perf-budgets").AssetCategory, number>>;
|
|
24
24
|
} | {
|
|
25
25
|
extensions?: undefined;
|
|
26
|
-
transpilePackages:
|
|
26
|
+
transpilePackages: string[];
|
|
27
27
|
perfBudgets?: undefined;
|
|
28
28
|
} | {
|
|
29
29
|
extensions?: undefined;
|
|
30
30
|
transpilePackages?: undefined;
|
|
31
|
-
perfBudgets:
|
|
31
|
+
perfBudgets: Partial<Record<import("../plugin-perf-budgets").AssetCategory, number>>;
|
|
32
32
|
} | {
|
|
33
33
|
extensions?: undefined;
|
|
34
34
|
transpilePackages?: undefined;
|
package/dist/lib/constants.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare const CERTIFICATE_DESTINATION_PATH: string;
|
|
2
2
|
export declare const CHROMIUM_BASED_BROWSERS: string[];
|
|
3
3
|
export declare const GECKO_BASED_BROWSERS: string[];
|
|
4
|
+
export declare const WEBKIT_BASED_BROWSERS: string[];
|
|
4
5
|
export declare const CHROMIUM_FAMILY_ALIASES: string[];
|
|
5
6
|
export declare const GECKO_FAMILY_ALIASES: string[];
|
|
6
7
|
export declare const SUPPORTED_BROWSERS: string[];
|
|
@@ -9,3 +10,4 @@ export declare const SUPPORTED_UI_FRAMEWORKS: readonly ['react', 'preact', 'vue'
|
|
|
9
10
|
export declare const SUPPORTED_CSS_TECH: readonly ['css', 'css-modules', 'sass', 'less', 'postcss', 'tailwind'];
|
|
10
11
|
export declare function isChromiumBasedBrowser(browser: string): boolean;
|
|
11
12
|
export declare function isGeckoBasedBrowser(browser: string): boolean;
|
|
13
|
+
export declare function isWebkitBasedBrowser(browser: string): boolean;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stock defaults for `extension dev`. Applied only when neither
|
|
3
|
+
* extension.config.js nor an explicit CLI flag set the option.
|
|
4
|
+
*/
|
|
5
|
+
export declare const DEV_COMMAND_DEFAULTS: {
|
|
6
|
+
polyfill: boolean;
|
|
7
|
+
logFormat: 'pretty';
|
|
8
|
+
logTimestamps: boolean;
|
|
9
|
+
logColor: boolean;
|
|
10
|
+
logLevel: 'off';
|
|
11
|
+
noOpen: boolean;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Stock defaults for `extension build`. Zip and silent stay off unless set.
|
|
15
|
+
*/
|
|
16
|
+
export declare const BUILD_COMMAND_DEFAULTS: {
|
|
17
|
+
polyfill: boolean;
|
|
18
|
+
zip: boolean;
|
|
19
|
+
zipSource: boolean;
|
|
20
|
+
silent: boolean;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Stock defaults for the `extension start` / `extension preview` browser
|
|
24
|
+
* phase. Same logger defaults dev uses.
|
|
25
|
+
*/
|
|
26
|
+
export declare const SERVE_COMMAND_DEFAULTS: {
|
|
27
|
+
logFormat: 'pretty';
|
|
28
|
+
logTimestamps: boolean;
|
|
29
|
+
logColor: boolean;
|
|
30
|
+
logLevel: 'off';
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Stock defaults for the silent production build `extension start` runs
|
|
34
|
+
* before its preview phase. Polyfill defaults on, matching start's
|
|
35
|
+
* historical behavior.
|
|
36
|
+
*/
|
|
37
|
+
export declare const START_BUILD_DEFAULTS: {
|
|
38
|
+
polyfill: boolean;
|
|
39
|
+
silent: boolean;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Array-valued option keys that concatenate across layers (browser config,
|
|
43
|
+
* then command config, then CLI). Order is preserved and duplicates are
|
|
44
|
+
* dropped, keeping the first occurrence, so repeating a flag in a later
|
|
45
|
+
* layer never doubles it on the browser command line.
|
|
46
|
+
*/
|
|
47
|
+
export declare const CONCAT_ARRAY_KEYS: Set<string>;
|
|
48
|
+
/**
|
|
49
|
+
* Plain-object option keys that deep-merge across layers. Later layers win
|
|
50
|
+
* on key conflict and nested plain objects recurse.
|
|
51
|
+
*/
|
|
52
|
+
export declare const DEEP_MERGE_OBJECT_KEYS: Set<string>;
|
|
53
|
+
/**
|
|
54
|
+
* Layered option merge with one predictable precedence for every command:
|
|
55
|
+
* stock defaults, then browser config, then command config, then CLI.
|
|
56
|
+
*
|
|
57
|
+
* Per-value strategy:
|
|
58
|
+
* - Scalars (and most keys): the last defined layer wins, including `false`.
|
|
59
|
+
* - List keys (`browserFlags`, `excludeBrowserFlags`): concatenate in layer
|
|
60
|
+
* order and dedupe, so CLI adds to config rather than replacing it.
|
|
61
|
+
* - Object keys (`preferences`): deep-merge, later layers win on conflict.
|
|
62
|
+
*
|
|
63
|
+
* `undefined` values are stripped per layer (via {@link sanitize}) so an
|
|
64
|
+
* unset CLI flag never clobbers extension.config.js, and config never
|
|
65
|
+
* clobbers a flag the user actually typed (including `false`).
|
|
66
|
+
*/
|
|
67
|
+
export declare function mergeOptionLayers<T extends object>(defaults: Partial<T>, ...layers: Array<object | null | undefined>): T;
|
package/dist/lib/paths.d.ts
CHANGED
|
@@ -16,4 +16,4 @@ export declare function normalizeBrowser(browser: BrowserInput, chromiumBinary?:
|
|
|
16
16
|
export declare function getDistPath(packageJsonDir: AbsolutePath, browser: string): AbsolutePath;
|
|
17
17
|
export declare function computePreviewOutputPath(struct: ProjectStructure, browser: string, explicitOutputPath?: string): AbsolutePath;
|
|
18
18
|
export declare function ensureDirSync(dir: AbsolutePath): void;
|
|
19
|
-
export declare function devtoolsEngineFor(browser: unknown): 'chrome' | 'edge' | 'chromium' | 'firefox';
|
|
19
|
+
export declare function devtoolsEngineFor(browser: unknown): 'chrome' | 'edge' | 'chromium' | 'firefox' | 'safari';
|
|
@@ -29,6 +29,7 @@ export declare function sessionArtifactsRootDir(projectPath: string): string;
|
|
|
29
29
|
export declare const SESSION_ARTIFACTS_IGNORE_CONTENT: string;
|
|
30
30
|
export declare function sessionArtifactsIgnoreFilePath(projectPath: string): string;
|
|
31
31
|
export declare function ensureSessionArtifactsIgnoreFile(projectPath: string): void;
|
|
32
|
+
export declare function ensureSessionStateInProjectGitignore(projectPath: string): void;
|
|
32
33
|
export declare function browserArtifactsDir(projectPath: string, browser: string): string;
|
|
33
34
|
export declare function browserProfileRootDir(projectPath: string, browser: string): string;
|
|
34
35
|
export declare function browserDistDir(projectPath: string, browser: string): string;
|
|
@@ -6,6 +6,7 @@ export declare class BoringPlugin {
|
|
|
6
6
|
readonly browser: PluginInterface['browser'];
|
|
7
7
|
private sawUserInvalidation;
|
|
8
8
|
private printedStartupSuccess;
|
|
9
|
+
private printedStartupWarning;
|
|
9
10
|
private lastKnownManifestName?;
|
|
10
11
|
constructor(options: PluginInterface);
|
|
11
12
|
apply(compiler: Compiler): void;
|
|
@@ -9,6 +9,8 @@ export interface ZipPluginOptions {
|
|
|
9
9
|
zipFilename?: string;
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
|
+
export declare function isDeniedFromSourceZip(file: string): boolean;
|
|
13
|
+
export declare function getFilesToZip(projectDir: string): Promise<string[]>;
|
|
12
14
|
export declare class ZipPlugin {
|
|
13
15
|
private readonly options;
|
|
14
16
|
private readonly browser;
|
|
@@ -83,6 +83,8 @@ type PluginOptions = {
|
|
|
83
83
|
};
|
|
84
84
|
export declare function formatStatsErrors(errors: unknown): string[];
|
|
85
85
|
export declare function getSessionRunId(packageJsonDir: string, browser: string): string;
|
|
86
|
+
export declare function stampReadyDistExtensionId(packageJsonDir: string, browser: string, distPath: string): void;
|
|
87
|
+
export declare function stampReadyKnownExtensionId(packageJsonDir: string, browser: string, extensionId: string): void;
|
|
86
88
|
export interface LiveDevSessionOwner {
|
|
87
89
|
pid: number;
|
|
88
90
|
runId: string;
|
|
@@ -5,7 +5,8 @@ export interface ParsedHtmlAsset {
|
|
|
5
5
|
moduleJs?: string[];
|
|
6
6
|
static?: string[];
|
|
7
7
|
}
|
|
8
|
-
export declare function
|
|
8
|
+
export declare function evictAssetsFromHtmlCache(htmlFilePath?: string): void;
|
|
9
|
+
export declare function getAssetsFromHtml(htmlFilePath: string | undefined, htmlContent?: string): ParsedHtmlAsset;
|
|
9
10
|
export declare function getHtmlPageDeclaredAssetPath(filepathList: FilepathList, filePath: string, extension: string): string;
|
|
10
11
|
export declare function getExtname(filePath: string): string;
|
|
11
12
|
export declare function getFilePath(filePath: string, extension: string, isPublic: boolean): string;
|
|
@@ -5,6 +5,8 @@ export declare function jsonMissingFile(manifestField: string, filePath: string,
|
|
|
5
5
|
}): string;
|
|
6
6
|
export declare function invalidJsonSyntax(manifestField: string, file: string, cause: string): string;
|
|
7
7
|
export declare function invalidRulesetStructure(manifestField: string, file: string): string;
|
|
8
|
+
export declare function invalidRulesetRule(manifestField: string, file: string, ruleIndex: number, reason: string): string;
|
|
9
|
+
export declare function rulesetRuleShapeIssue(manifestField: string, file: string, ruleIndex: number, reason: string): string;
|
|
8
10
|
export declare function invalidManagedSchemaStructure(manifestField: string, file: string): string;
|
|
9
11
|
export declare function jsonEmitSummary(feature: string, stats: {
|
|
10
12
|
entries: number;
|
|
@@ -2,6 +2,7 @@ export declare function serverRestartRequiredFromManifestError(fileAdded: string
|
|
|
2
2
|
export declare function legacyManifestPathWarning(legacyPath: string): string;
|
|
3
3
|
export declare function fatalManifestShapeFixed(field: string, detail: string): string;
|
|
4
4
|
export declare function invalidThemeValue(field: string, detail: string, value: string): string;
|
|
5
|
+
export declare function themeNotSupportedByBrowser(browser: string): string;
|
|
5
6
|
export declare function missingGeckoDataCollectionPermissions(): string;
|
|
6
7
|
export declare function manifestInvalidError(error: NodeJS.ErrnoException): string;
|
|
7
8
|
export declare function manifestIncludeSummary(browser: string, manifestPath: string): string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { Compilation } from '@rspack/core';
|
|
2
2
|
import type { FilepathList } from '../../types';
|
|
3
|
+
export declare const EMITTED_ASSET_REF_PATTERN: RegExp;
|
|
3
4
|
export declare function collectContentScriptEntryImports(compilation: Compilation, includeList?: FilepathList): Record<string, string[]>;
|
package/dist/types.d.ts
CHANGED
|
@@ -110,6 +110,8 @@ export interface SafariPackagerOverrides {
|
|
|
110
110
|
macOsOnly?: boolean;
|
|
111
111
|
forceRegenerate?: boolean;
|
|
112
112
|
safariBinary?: string;
|
|
113
|
+
/** When set, overrides the factory `noOpen` for this packaging call. */
|
|
114
|
+
noOpen?: boolean;
|
|
113
115
|
}
|
|
114
116
|
/**
|
|
115
117
|
* The packaging callback develop calls once the Safari dist is on disk. The
|
|
@@ -335,7 +337,19 @@ export interface BrowserConfig extends BrowserOptionsBase {
|
|
|
335
337
|
export type OutputConfig = {
|
|
336
338
|
clean: boolean;
|
|
337
339
|
path: string;
|
|
340
|
+
/**
|
|
341
|
+
* Internal: the final dist path when `path` points at the staging
|
|
342
|
+
* directory a one-shot build is later promoted from. Metadata surfaces
|
|
343
|
+
* (ready.json) advertise this path, never the staging directory.
|
|
344
|
+
*/
|
|
345
|
+
finalPath?: string;
|
|
338
346
|
};
|
|
347
|
+
/**
|
|
348
|
+
* Per-category asset size budgets (bytes) for the perf-budgets plugin.
|
|
349
|
+
* Set at the top level of extension.config.js, or per command via
|
|
350
|
+
* `commands.dev.perfBudgets` / `commands.build.perfBudgets`.
|
|
351
|
+
*/
|
|
352
|
+
export type PerfBudgetsConfig = Partial<Record<import('./plugin-perf-budgets').AssetCategory, number>>;
|
|
339
353
|
export interface CommonWebpackOptions {
|
|
340
354
|
output: OutputConfig;
|
|
341
355
|
preferences?: Record<string, unknown>;
|
|
@@ -346,7 +360,7 @@ export interface CommonWebpackOptions {
|
|
|
346
360
|
* Useful for monorepos where package exports point to TS/TSX files.
|
|
347
361
|
*/
|
|
348
362
|
transpilePackages?: string[];
|
|
349
|
-
perfBudgets?:
|
|
363
|
+
perfBudgets?: PerfBudgetsConfig;
|
|
350
364
|
/**
|
|
351
365
|
* Companion extensions (load-only). Each entry must be an unpacked extension root
|
|
352
366
|
* containing a manifest.json. These are loaded alongside the user extension in
|
|
@@ -386,13 +400,14 @@ export interface FileConfig {
|
|
|
386
400
|
[K in BrowserType]?: BrowserConfig;
|
|
387
401
|
};
|
|
388
402
|
commands?: {
|
|
389
|
-
dev?: Pick<DevOptions, 'browser' | 'profile' | 'chromiumBinary' | 'geckoBinary' | 'noOpen' | 'noBrowser' | 'polyfill'> & Pick<DevOptions, 'logLevel' | 'logContexts' | 'logFormat' | 'logTimestamps' | 'logColor' | 'logUrl' | 'logTab' | 'hashContentScripts'> & {
|
|
403
|
+
dev?: Pick<DevOptions, 'browser' | 'profile' | 'chromiumBinary' | 'geckoBinary' | 'safariBinary' | 'appName' | 'bundleId' | 'macOsOnly' | 'noOpen' | 'noBrowser' | 'polyfill'> & Pick<DevOptions, 'logLevel' | 'logContexts' | 'logFormat' | 'logTimestamps' | 'logColor' | 'logUrl' | 'logTab' | 'hashContentScripts'> & {
|
|
390
404
|
browserFlags?: string[];
|
|
391
405
|
excludeBrowserFlags?: string[];
|
|
392
406
|
preferences?: Record<string, unknown>;
|
|
393
407
|
persistProfile?: boolean;
|
|
394
408
|
extensions?: CompanionExtensionsConfig;
|
|
395
409
|
transpilePackages?: string[];
|
|
410
|
+
perfBudgets?: PerfBudgetsConfig;
|
|
396
411
|
};
|
|
397
412
|
start?: Pick<StartOptions, 'browser' | 'profile' | 'chromiumBinary' | 'geckoBinary' | 'polyfill' | 'noBrowser' | 'port' | 'host' | 'publicHost' | 'logLevel' | 'logContexts' | 'logFormat' | 'logTimestamps' | 'logColor' | 'logUrl' | 'logTab'> & {
|
|
398
413
|
browserFlags?: string[];
|
|
@@ -410,9 +425,10 @@ export interface FileConfig {
|
|
|
410
425
|
extensions?: CompanionExtensionsConfig;
|
|
411
426
|
transpilePackages?: string[];
|
|
412
427
|
};
|
|
413
|
-
build?: Pick<BuildOptions, 'browser' | 'zipFilename' | 'zip' | 'zipSource' | 'polyfill'> & {
|
|
428
|
+
build?: Pick<BuildOptions, 'browser' | 'zipFilename' | 'zip' | 'zipSource' | 'polyfill' | 'silent' | 'safariBinary' | 'appName' | 'bundleId' | 'macOsOnly'> & {
|
|
414
429
|
extensions?: CompanionExtensionsConfig;
|
|
415
430
|
transpilePackages?: string[];
|
|
431
|
+
perfBudgets?: PerfBudgetsConfig;
|
|
416
432
|
};
|
|
417
433
|
};
|
|
418
434
|
/**
|
|
@@ -425,5 +441,10 @@ export interface FileConfig {
|
|
|
425
441
|
* Per-command `commands.<name>.transpilePackages` overrides this value.
|
|
426
442
|
*/
|
|
427
443
|
transpilePackages?: string[];
|
|
444
|
+
/**
|
|
445
|
+
* Default per-category asset budgets for all commands.
|
|
446
|
+
* Per-command `commands.dev|build.perfBudgets` overrides this value.
|
|
447
|
+
*/
|
|
448
|
+
perfBudgets?: PerfBudgetsConfig;
|
|
428
449
|
config?: (config: Configuration) => Configuration;
|
|
429
450
|
}
|