wxt 0.20.13 → 0.20.15
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/browser.d.mts +20 -0
- package/dist/browser.mjs +18 -3
- package/dist/builtin-modules/index.mjs +7 -2
- package/dist/builtin-modules/unimport.mjs +69 -75
- package/dist/cli/cli-utils.mjs +54 -50
- package/dist/cli/commands.mjs +78 -103
- package/dist/cli/index.d.mts +1 -0
- package/dist/cli/index.mjs +9 -4
- package/dist/core/{build.d.ts → build.d.mts} +6 -2
- package/dist/core/build.mjs +23 -4
- package/dist/core/builders/vite/index.mjs +293 -343
- package/dist/core/builders/vite/plugins/bundleAnalysis.mjs +11 -12
- package/dist/core/builders/vite/plugins/cssEntrypoints.mjs +27 -20
- package/dist/core/builders/vite/plugins/defineImportMeta.mjs +17 -12
- package/dist/core/builders/vite/plugins/devHtmlPrerender.mjs +105 -136
- package/dist/core/builders/vite/plugins/devServerGlobals.mjs +15 -14
- package/dist/core/builders/vite/plugins/download.mjs +23 -12
- package/dist/core/builders/vite/plugins/entrypointGroupGlobals.mjs +18 -14
- package/dist/core/builders/vite/plugins/extensionApiMock.mjs +31 -33
- package/dist/core/builders/vite/plugins/globals.mjs +14 -13
- package/dist/core/builders/vite/plugins/iifeFooter.mjs +17 -11
- package/dist/core/builders/vite/plugins/index.mjs +18 -16
- package/dist/core/builders/vite/plugins/noopBackground.mjs +21 -15
- package/dist/core/builders/vite/plugins/removeEntrypointMainFunction.mjs +26 -23
- package/dist/core/builders/vite/plugins/resolveAppConfig.mjs +26 -24
- package/dist/core/builders/vite/plugins/resolveVirtualModules.mjs +28 -26
- package/dist/core/builders/vite/plugins/tsconfigPaths.mjs +11 -11
- package/dist/core/builders/vite/plugins/wxtPluginLoader.mjs +42 -47
- package/dist/core/{clean.d.ts → clean.d.mts} +7 -3
- package/dist/core/clean.mjs +38 -35
- package/dist/core/{create-server.d.ts → create-server.d.mts} +6 -2
- package/dist/core/create-server.mjs +236 -247
- package/dist/core/define-config.d.mts +6 -0
- package/dist/core/define-config.mjs +6 -2
- package/dist/core/define-web-ext-config.d.mts +13 -0
- package/dist/core/define-web-ext-config.mjs +16 -7
- package/dist/core/generate-wxt-dir.mjs +110 -148
- package/dist/core/index.d.mts +9 -0
- package/dist/core/index.mjs +12 -8
- package/dist/core/initialize.d.mts +8 -0
- package/dist/core/initialize.mjs +110 -124
- package/dist/core/keyboard-shortcuts.mjs +30 -28
- package/dist/core/package-managers/bun.mjs +18 -16
- package/dist/core/package-managers/deno.mjs +12 -8
- package/dist/core/package-managers/index.mjs +52 -60
- package/dist/core/package-managers/npm.mjs +51 -52
- package/dist/core/package-managers/pnpm.mjs +21 -18
- package/dist/core/package-managers/yarn.mjs +31 -28
- package/dist/core/prepare.d.mts +6 -0
- package/dist/core/prepare.mjs +12 -7
- package/dist/core/resolve-config.mjs +393 -462
- package/dist/core/runners/index.mjs +15 -10
- package/dist/core/runners/manual.mjs +13 -14
- package/dist/core/runners/safari.mjs +13 -14
- package/dist/core/runners/web-ext.mjs +62 -83
- package/dist/core/runners/wsl.mjs +13 -14
- package/dist/core/utils/arrays.mjs +23 -12
- package/dist/core/utils/building/build-entrypoints.mjs +44 -40
- package/dist/core/utils/building/detect-dev-changes.mjs +84 -105
- package/dist/core/utils/building/find-entrypoints.mjs +278 -359
- package/dist/core/utils/building/group-entrypoints.mjs +42 -35
- package/dist/core/utils/building/index.mjs +8 -6
- package/dist/core/utils/building/internal-build.mjs +86 -102
- package/dist/core/utils/building/rebuild.mjs +50 -30
- package/dist/core/utils/cache.mjs +29 -18
- package/dist/core/utils/constants.mjs +9 -1
- package/dist/core/utils/content-scripts.mjs +56 -54
- package/dist/core/utils/content-security-policy.mjs +36 -39
- package/dist/core/utils/entrypoints.mjs +51 -28
- package/dist/core/utils/env.mjs +22 -17
- package/dist/core/utils/environments/browser-environment.mjs +13 -12
- package/dist/core/utils/environments/environment.mjs +36 -33
- package/dist/core/utils/environments/extension-environment.mjs +15 -10
- package/dist/core/utils/environments/index.mjs +4 -2
- package/dist/core/utils/eslint.mjs +11 -10
- package/dist/core/utils/fs.mjs +23 -11
- package/dist/core/utils/globals.mjs +53 -51
- package/dist/core/utils/i18n.mjs +41 -32
- package/dist/core/utils/index.mjs +3 -0
- package/dist/core/utils/log/index.mjs +6 -4
- package/dist/core/utils/log/printBuildSummary.mjs +20 -25
- package/dist/core/utils/log/printFileList.mjs +30 -33
- package/dist/core/utils/log/printHeader.mjs +9 -5
- package/dist/core/utils/log/printTable.mjs +19 -21
- package/dist/core/utils/manifest.mjs +366 -479
- package/dist/core/utils/minimatch-multiple.mjs +26 -15
- package/dist/core/utils/network.mjs +27 -33
- package/dist/core/utils/number.mjs +7 -3
- package/dist/core/utils/package.mjs +20 -13
- package/dist/core/utils/paths.d.mts +8 -0
- package/dist/core/utils/paths.mjs +26 -7
- package/dist/core/utils/strings.mjs +19 -14
- package/dist/core/utils/syntax-errors.mjs +14 -16
- package/dist/core/utils/time.mjs +19 -15
- package/dist/core/utils/transform.mjs +129 -160
- package/dist/core/utils/types.d.mts +6 -0
- package/dist/core/utils/validation.mjs +43 -50
- package/dist/core/utils/virtual-modules.mjs +20 -12
- package/dist/core/utils/wsl.mjs +11 -3
- package/dist/core/wxt.mjs +65 -60
- package/dist/core/{zip.d.ts → zip.d.mts} +6 -2
- package/dist/core/zip.mjs +118 -140
- package/dist/index.d.mts +13 -0
- package/dist/index.mjs +13 -3
- package/dist/{modules.d.ts → modules.d.mts} +14 -16
- package/dist/modules.mjs +179 -51
- package/dist/testing/fake-browser.d.mts +2 -0
- package/dist/testing/fake-browser.mjs +3 -1
- package/dist/testing/index.d.mts +3 -0
- package/dist/testing/index.mjs +4 -2
- package/dist/testing/{wxt-vitest-plugin.d.ts → wxt-vitest-plugin.d.mts} +7 -9
- package/dist/testing/wxt-vitest-plugin.mjs +38 -19
- package/dist/types.d.mts +1475 -0
- package/dist/utils/app-config.d.mts +6 -0
- package/dist/utils/app-config.mjs +8 -2
- package/dist/utils/content-script-context.d.mts +134 -0
- package/dist/utils/content-script-context.mjs +187 -175
- package/dist/utils/content-script-ui/iframe.d.mts +42 -0
- package/dist/utils/content-script-ui/iframe.mjs +42 -27
- package/dist/utils/content-script-ui/integrated.d.mts +37 -0
- package/dist/utils/content-script-ui/integrated.mjs +36 -29
- package/dist/utils/content-script-ui/shadow-root.d.mts +80 -0
- package/dist/utils/content-script-ui/shadow-root.mjs +75 -82
- package/dist/utils/content-script-ui/shared.mjs +115 -150
- package/dist/utils/content-script-ui/types.d.mts +107 -0
- package/dist/utils/content-script-ui/types.mjs +1 -0
- package/dist/utils/{define-app-config.d.ts → define-app-config.d.mts} +5 -3
- package/dist/utils/define-app-config.mjs +22 -2
- package/dist/utils/define-background.d.mts +7 -0
- package/dist/utils/define-background.mjs +7 -3
- package/dist/utils/define-content-script.d.mts +6 -0
- package/dist/utils/define-content-script.mjs +6 -2
- package/dist/utils/define-unlisted-script.d.mts +7 -0
- package/dist/utils/define-unlisted-script.mjs +7 -3
- package/dist/utils/define-wxt-plugin.d.mts +6 -0
- package/dist/utils/define-wxt-plugin.mjs +6 -2
- package/dist/utils/inject-script.d.mts +41 -0
- package/dist/utils/inject-script.mjs +44 -34
- package/dist/utils/internal/custom-events.d.mts +9 -0
- package/dist/utils/internal/custom-events.mjs +18 -10
- package/dist/utils/internal/location-watcher.mjs +23 -20
- package/dist/utils/internal/logger.mjs +15 -12
- package/dist/utils/match-patterns.d.mts +1 -0
- package/dist/utils/match-patterns.mjs +3 -1
- package/dist/utils/{split-shadow-root-css.d.ts → split-shadow-root-css.d.mts} +6 -3
- package/dist/utils/split-shadow-root-css.mjs +16 -7
- package/dist/utils/storage.d.mts +1 -0
- package/dist/utils/storage.mjs +3 -1
- package/dist/version.d.mts +4 -0
- package/dist/version.mjs +5 -1
- package/dist/virtual/background-entrypoint.d.mts +4 -0
- package/dist/virtual/background-entrypoint.mjs +143 -161
- package/dist/virtual/content-script-isolated-world-entrypoint.d.mts +4 -0
- package/dist/virtual/content-script-isolated-world-entrypoint.mjs +26 -27
- package/dist/virtual/content-script-main-world-entrypoint.d.mts +4 -0
- package/dist/virtual/content-script-main-world-entrypoint.mjs +24 -24
- package/dist/virtual/mock-browser.d.mts +6 -0
- package/dist/virtual/mock-browser.mjs +5 -3
- package/dist/virtual/reload-html.d.mts +1 -0
- package/dist/virtual/reload-html.mjs +57 -53
- package/dist/virtual/unlisted-script-entrypoint.d.mts +4 -0
- package/dist/virtual/unlisted-script-entrypoint.mjs +35 -43
- package/package.json +56 -50
- package/dist/browser.d.ts +0 -30
- package/dist/builtin-modules/index.d.ts +0 -2
- package/dist/builtin-modules/unimport.d.ts +0 -5
- package/dist/cli/cli-utils.d.ts +0 -25
- package/dist/cli/commands.d.ts +0 -2
- package/dist/cli/index.d.ts +0 -1
- package/dist/core/builders/vite/index.d.ts +0 -7
- package/dist/core/builders/vite/plugins/bundleAnalysis.d.ts +0 -7
- package/dist/core/builders/vite/plugins/cssEntrypoints.d.ts +0 -13
- package/dist/core/builders/vite/plugins/defineImportMeta.d.ts +0 -14
- package/dist/core/builders/vite/plugins/devHtmlPrerender.d.ts +0 -7
- package/dist/core/builders/vite/plugins/devServerGlobals.d.ts +0 -6
- package/dist/core/builders/vite/plugins/download.d.ts +0 -10
- package/dist/core/builders/vite/plugins/entrypointGroupGlobals.d.ts +0 -6
- package/dist/core/builders/vite/plugins/extensionApiMock.d.ts +0 -6
- package/dist/core/builders/vite/plugins/globals.d.ts +0 -3
- package/dist/core/builders/vite/plugins/iifeFooter.d.ts +0 -8
- package/dist/core/builders/vite/plugins/index.d.ts +0 -16
- package/dist/core/builders/vite/plugins/noopBackground.d.ts +0 -6
- package/dist/core/builders/vite/plugins/removeEntrypointMainFunction.d.ts +0 -6
- package/dist/core/builders/vite/plugins/resolveAppConfig.d.ts +0 -6
- package/dist/core/builders/vite/plugins/resolveVirtualModules.d.ts +0 -6
- package/dist/core/builders/vite/plugins/tsconfigPaths.d.ts +0 -3
- package/dist/core/builders/vite/plugins/wxtPluginLoader.d.ts +0 -6
- package/dist/core/define-config.d.ts +0 -2
- package/dist/core/define-web-ext-config.d.ts +0 -9
- package/dist/core/generate-wxt-dir.d.ts +0 -5
- package/dist/core/index.d.ts +0 -8
- package/dist/core/initialize.d.ts +0 -5
- package/dist/core/keyboard-shortcuts.d.ts +0 -12
- package/dist/core/package-managers/bun.d.ts +0 -2
- package/dist/core/package-managers/deno.d.ts +0 -2
- package/dist/core/package-managers/index.d.ts +0 -2
- package/dist/core/package-managers/npm.d.ts +0 -17
- package/dist/core/package-managers/pnpm.d.ts +0 -2
- package/dist/core/package-managers/types.d.ts +0 -2
- package/dist/core/package-managers/types.mjs +0 -0
- package/dist/core/package-managers/yarn.d.ts +0 -2
- package/dist/core/prepare.d.ts +0 -2
- package/dist/core/resolve-config.d.ts +0 -11
- package/dist/core/runners/index.d.ts +0 -2
- package/dist/core/runners/manual.d.ts +0 -5
- package/dist/core/runners/safari.d.ts +0 -5
- package/dist/core/runners/web-ext.d.ts +0 -5
- package/dist/core/runners/wsl.d.ts +0 -5
- package/dist/core/utils/arrays.d.ts +0 -13
- package/dist/core/utils/building/build-entrypoints.d.ts +0 -3
- package/dist/core/utils/building/detect-dev-changes.d.ts +0 -61
- package/dist/core/utils/building/find-entrypoints.d.ts +0 -5
- package/dist/core/utils/building/group-entrypoints.d.ts +0 -8
- package/dist/core/utils/building/index.d.ts +0 -6
- package/dist/core/utils/building/internal-build.d.ts +0 -12
- package/dist/core/utils/building/rebuild.d.ts +0 -23
- package/dist/core/utils/cache.d.ts +0 -8
- package/dist/core/utils/cli.d.ts +0 -3
- package/dist/core/utils/cli.mjs +0 -26
- package/dist/core/utils/constants.d.ts +0 -5
- package/dist/core/utils/content-scripts.d.ts +0 -12
- package/dist/core/utils/content-security-policy.d.ts +0 -14
- package/dist/core/utils/entrypoints.d.ts +0 -31
- package/dist/core/utils/env.d.ts +0 -5
- package/dist/core/utils/environments/browser-environment.d.ts +0 -3
- package/dist/core/utils/environments/environment.d.ts +0 -8
- package/dist/core/utils/environments/extension-environment.d.ts +0 -6
- package/dist/core/utils/environments/index.d.ts +0 -2
- package/dist/core/utils/eslint.d.ts +0 -1
- package/dist/core/utils/fs.d.ts +0 -13
- package/dist/core/utils/globals.d.ts +0 -11
- package/dist/core/utils/i18n.d.ts +0 -11
- package/dist/core/utils/log/index.d.ts +0 -4
- package/dist/core/utils/log/printBuildSummary.d.ts +0 -2
- package/dist/core/utils/log/printFileList.d.ts +0 -1
- package/dist/core/utils/log/printHeader.d.ts +0 -1
- package/dist/core/utils/log/printTable.d.ts +0 -1
- package/dist/core/utils/manifest.d.ts +0 -40
- package/dist/core/utils/minimatch-multiple.d.ts +0 -15
- package/dist/core/utils/network.d.ts +0 -7
- package/dist/core/utils/number.d.ts +0 -1
- package/dist/core/utils/package.d.ts +0 -6
- package/dist/core/utils/paths.d.ts +0 -11
- package/dist/core/utils/strings.d.ts +0 -14
- package/dist/core/utils/syntax-errors.d.ts +0 -11
- package/dist/core/utils/testing/fake-objects.d.ts +0 -11665
- package/dist/core/utils/testing/fake-objects.mjs +0 -326
- package/dist/core/utils/time.d.ts +0 -9
- package/dist/core/utils/transform.d.ts +0 -11
- package/dist/core/utils/types.d.ts +0 -13
- package/dist/core/utils/types.mjs +0 -0
- package/dist/core/utils/validation.d.ts +0 -15
- package/dist/core/utils/virtual-modules.d.ts +0 -22
- package/dist/core/utils/wsl.d.ts +0 -4
- package/dist/core/wxt.d.ts +0 -24
- package/dist/index.d.ts +0 -11
- package/dist/testing/fake-browser.d.ts +0 -10
- package/dist/testing/index.d.ts +0 -10
- package/dist/types.d.ts +0 -1459
- package/dist/types.mjs +0 -0
- package/dist/utils/app-config.d.ts +0 -2
- package/dist/utils/content-script-context.d.ts +0 -134
- package/dist/utils/content-script-ui/iframe.d.ts +0 -32
- package/dist/utils/content-script-ui/integrated.d.ts +0 -34
- package/dist/utils/content-script-ui/shadow-root.d.ts +0 -76
- package/dist/utils/content-script-ui/shared.d.ts +0 -5
- package/dist/utils/content-script-ui/types.d.ts +0 -104
- package/dist/utils/define-background.d.ts +0 -4
- package/dist/utils/define-content-script.d.ts +0 -3
- package/dist/utils/define-unlisted-script.d.ts +0 -4
- package/dist/utils/define-wxt-plugin.d.ts +0 -3
- package/dist/utils/inject-script.d.ts +0 -36
- package/dist/utils/internal/custom-events.d.ts +0 -10
- package/dist/utils/internal/dev-server-websocket.d.ts +0 -21
- package/dist/utils/internal/dev-server-websocket.mjs +0 -37
- package/dist/utils/internal/location-watcher.d.ts +0 -12
- package/dist/utils/internal/logger.d.ts +0 -9
- package/dist/utils/match-patterns.d.ts +0 -5
- package/dist/utils/storage.d.ts +0 -5
- package/dist/version.d.ts +0 -1
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Dependency } from '../../types';
|
|
2
|
-
import { WxtPackageManagerImpl } from './types';
|
|
3
|
-
export declare const npm: WxtPackageManagerImpl;
|
|
4
|
-
export declare function flattenNpmListOutput(projects: NpmListProject[]): Dependency[];
|
|
5
|
-
export declare function dedupeDependencies(dependencies: Dependency[]): Dependency[];
|
|
6
|
-
export interface NpmListProject {
|
|
7
|
-
name: string;
|
|
8
|
-
dependencies?: Record<string, NpmListDependency>;
|
|
9
|
-
devDependencies?: Record<string, NpmListDependency>;
|
|
10
|
-
}
|
|
11
|
-
export interface NpmListDependency {
|
|
12
|
-
version: string;
|
|
13
|
-
resolved?: string;
|
|
14
|
-
overridden?: boolean;
|
|
15
|
-
dependencies?: Record<string, NpmListDependency>;
|
|
16
|
-
devDependencies?: Record<string, NpmListDependency>;
|
|
17
|
-
}
|
|
File without changes
|
package/dist/core/prepare.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { InlineConfig, ResolvedConfig, UserConfig, Logger, WxtCommand, WxtModuleWithMetadata } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* Given an inline config, discover the config file if necessary, merge the results, resolve any
|
|
4
|
-
* relative paths, and apply any defaults.
|
|
5
|
-
*
|
|
6
|
-
* Inline config always has priority over user config. Cli flags are passed as inline config if set.
|
|
7
|
-
* If unset, undefined is passed in, letting this function decide default values.
|
|
8
|
-
*/
|
|
9
|
-
export declare function resolveConfig(inlineConfig: InlineConfig, command: WxtCommand): Promise<ResolvedConfig>;
|
|
10
|
-
export declare function mergeBuilderConfig(logger: Logger, inlineConfig: InlineConfig, userConfig: UserConfig): Promise<Pick<InlineConfig, 'vite'>>;
|
|
11
|
-
export declare function resolveWxtUserModules(root: string, modulesDir: string, modules?: string[]): Promise<WxtModuleWithMetadata<any>[]>;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Checks if `predicate` returns truthy for all elements of the array.
|
|
3
|
-
*/
|
|
4
|
-
export declare function every<T>(array: T[], predicate: (item: T, index: number) => boolean): boolean;
|
|
5
|
-
/**
|
|
6
|
-
* Returns true when any of the predicates return true;
|
|
7
|
-
*/
|
|
8
|
-
export declare function some<T>(array: T[], predicate: (item: T, index: number) => boolean): boolean;
|
|
9
|
-
/**
|
|
10
|
-
* Convert an item or array to an array.
|
|
11
|
-
*/
|
|
12
|
-
export declare function toArray<T>(a: T | T[]): T[];
|
|
13
|
-
export declare function filterTruthy<T>(array: Array<T | undefined>): T[];
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { BuildOutput, BuildStepOutput, EntrypointGroup } from '../../../types';
|
|
2
|
-
/**
|
|
3
|
-
* Compare the changed files vs the build output and determine what kind of reload needs to happen:
|
|
4
|
-
*
|
|
5
|
-
* - Do nothing
|
|
6
|
-
* - CSS or JS file associated with an HTML page is changed - this is handled automatically by the
|
|
7
|
-
* dev server
|
|
8
|
-
* - Change isn't used by any of the entrypoints
|
|
9
|
-
* - Reload Content script
|
|
10
|
-
* - CSS or JS file associated with a content script
|
|
11
|
-
* - Background script will be told to reload the content script
|
|
12
|
-
* - Reload HTML file
|
|
13
|
-
* - HTML file itself is saved - HMR doesn't handle this because the HTML pages are pre-rendered
|
|
14
|
-
* - Chrome is OK reloading the page when the HTML file is changed without reloading the whole
|
|
15
|
-
* extension. Not sure about firefox, this might need to change to an extension reload
|
|
16
|
-
* - Reload extension
|
|
17
|
-
* - Background script is changed
|
|
18
|
-
* - Manifest is different
|
|
19
|
-
* - Restart browser
|
|
20
|
-
* - web-ext.config.ts (runner config changes)
|
|
21
|
-
* - Full dev server restart
|
|
22
|
-
* - wxt.config.ts (main config file)
|
|
23
|
-
* - modules/* (any file related to WXT modules)
|
|
24
|
-
* - .env (environment variable changed could effect build)
|
|
25
|
-
*/
|
|
26
|
-
export declare function detectDevChanges(changedFiles: string[], currentOutput: BuildOutput): DevModeChange;
|
|
27
|
-
/**
|
|
28
|
-
* Contains information about what files changed, what needs rebuilt, and the type of reload that is
|
|
29
|
-
* required.
|
|
30
|
-
*/
|
|
31
|
-
export type DevModeChange = NoChange | HtmlReload | ExtensionReload | ContentScriptReload | FullRestart | BrowserRestart;
|
|
32
|
-
interface NoChange {
|
|
33
|
-
type: 'no-change';
|
|
34
|
-
}
|
|
35
|
-
interface RebuildChange {
|
|
36
|
-
/**
|
|
37
|
-
* The list of entrypoints that need rebuilt.
|
|
38
|
-
*/
|
|
39
|
-
rebuildGroups: EntrypointGroup[];
|
|
40
|
-
/**
|
|
41
|
-
* The previous output stripped of any files are going to change.
|
|
42
|
-
*/
|
|
43
|
-
cachedOutput: BuildOutput;
|
|
44
|
-
}
|
|
45
|
-
interface FullRestart {
|
|
46
|
-
type: 'full-restart';
|
|
47
|
-
}
|
|
48
|
-
interface BrowserRestart {
|
|
49
|
-
type: 'browser-restart';
|
|
50
|
-
}
|
|
51
|
-
interface HtmlReload extends RebuildChange {
|
|
52
|
-
type: 'html-reload';
|
|
53
|
-
}
|
|
54
|
-
interface ExtensionReload extends RebuildChange {
|
|
55
|
-
type: 'extension-reload';
|
|
56
|
-
}
|
|
57
|
-
interface ContentScriptReload extends RebuildChange {
|
|
58
|
-
type: 'content-script-reload';
|
|
59
|
-
changedSteps: BuildStepOutput[];
|
|
60
|
-
}
|
|
61
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Entrypoint, EntrypointGroup } from '../../../types';
|
|
2
|
-
/**
|
|
3
|
-
* Entrypoints are built in groups. HTML pages can all be built together in a single step,
|
|
4
|
-
* content scripts must be build individually, etc.
|
|
5
|
-
*
|
|
6
|
-
* This function returns the entrypoints put into these types of groups.
|
|
7
|
-
*/
|
|
8
|
-
export declare function groupEntrypoints(entrypoints: Entrypoint[]): EntrypointGroup[];
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { BuildOutput } from '../../../types';
|
|
2
|
-
/**
|
|
3
|
-
* Builds the extension based on an internal config. No more config discovery is performed, the
|
|
4
|
-
* build is based on exactly what is passed in.
|
|
5
|
-
*
|
|
6
|
-
* This function:
|
|
7
|
-
* 1. Cleans the output directory
|
|
8
|
-
* 2. Executes the rebuild function with a blank previous output so everything is built (see
|
|
9
|
-
* `rebuild` for more details)
|
|
10
|
-
* 3. Prints the summary
|
|
11
|
-
*/
|
|
12
|
-
export declare function internalBuild(): Promise<BuildOutput>;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { BuildOutput, Entrypoint, EntrypointGroup } from '../../../types';
|
|
2
|
-
import type { Browser } from '@wxt-dev/browser';
|
|
3
|
-
/**
|
|
4
|
-
* Given a configuration, list of entrypoints, and an existing, partial output, build the
|
|
5
|
-
* entrypoints and merge the new output with the existing output.
|
|
6
|
-
*
|
|
7
|
-
* This function will:
|
|
8
|
-
* 1. Generate the .wxt directory's types
|
|
9
|
-
* 2. Build the `entrypointGroups` (and copies public files)
|
|
10
|
-
* 3. Generate the latest manifest for all entrypoints
|
|
11
|
-
* 4. Write the new manifest to the file system
|
|
12
|
-
*
|
|
13
|
-
* @param config Internal config containing all the project information.
|
|
14
|
-
* @param allEntrypoints List of entrypoints used to generate the types inside .wxt directory.
|
|
15
|
-
* @param entrypointGroups The list of entrypoint groups to build.
|
|
16
|
-
* @param existingOutput The previous output to combine the rebuild results into. An emptry array if
|
|
17
|
-
* this is the first build.
|
|
18
|
-
*/
|
|
19
|
-
export declare function rebuild(allEntrypoints: Entrypoint[], entrypointGroups: EntrypointGroup[], existingOutput?: Omit<BuildOutput, 'manifest'>): Promise<{
|
|
20
|
-
output: BuildOutput;
|
|
21
|
-
manifest: Browser.runtime.Manifest;
|
|
22
|
-
warnings: any[][];
|
|
23
|
-
}>;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { FsCache } from '../../types';
|
|
2
|
-
/**
|
|
3
|
-
* A basic file system cache stored at `<srcDir>/.wxt/cache/<key>`. Just caches a string in a
|
|
4
|
-
* file for the given key.
|
|
5
|
-
*
|
|
6
|
-
* @param srcDir Absolute path to source directory. See `InternalConfig.srcDir`
|
|
7
|
-
*/
|
|
8
|
-
export declare function createFsCache(wxtDir: string): FsCache;
|
package/dist/core/utils/cli.d.ts
DELETED
package/dist/core/utils/cli.mjs
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { LogLevels, consola } from "consola";
|
|
2
|
-
import { printHeader } from "./log/index.mjs";
|
|
3
|
-
import { formatDuration } from "./time.mjs";
|
|
4
|
-
export function defineCommand(cb, options) {
|
|
5
|
-
return async (...args) => {
|
|
6
|
-
const isDebug = !!args.find((arg) => arg?.debug);
|
|
7
|
-
if (isDebug) {
|
|
8
|
-
consola.level = LogLevels.debug;
|
|
9
|
-
}
|
|
10
|
-
const startTime = Date.now();
|
|
11
|
-
try {
|
|
12
|
-
printHeader();
|
|
13
|
-
const ongoing = await cb(...args);
|
|
14
|
-
if (!ongoing && !options?.disableFinishedLog)
|
|
15
|
-
consola.success(
|
|
16
|
-
`Finished in ${formatDuration(Date.now() - startTime)}`
|
|
17
|
-
);
|
|
18
|
-
} catch (err) {
|
|
19
|
-
consola.fail(
|
|
20
|
-
`Command failed after ${formatDuration(Date.now() - startTime)}`
|
|
21
|
-
);
|
|
22
|
-
consola.error(err);
|
|
23
|
-
process.exit(1);
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { Browser } from '@wxt-dev/browser';
|
|
2
|
-
import { ContentScriptEntrypoint, ResolvedConfig } from '../../types';
|
|
3
|
-
import { ManifestContentScript } from './types';
|
|
4
|
-
/**
|
|
5
|
-
* Returns a unique and consistent string hash based on a content scripts options.
|
|
6
|
-
*
|
|
7
|
-
* It is able to recognize default values,
|
|
8
|
-
*/
|
|
9
|
-
export declare function hashContentScriptOptions(options: ContentScriptEntrypoint['options']): string;
|
|
10
|
-
export declare function mapWxtOptionsToContentScript(options: ContentScriptEntrypoint['options'], js: string[] | undefined, css: string[] | undefined): ManifestContentScript;
|
|
11
|
-
export declare function mapWxtOptionsToRegisteredContentScript(options: ContentScriptEntrypoint['options'], js: string[] | undefined, css: string[] | undefined): Omit<Browser.scripting.RegisteredContentScript, 'id'>;
|
|
12
|
-
export declare function getContentScriptJs(config: ResolvedConfig, entrypoint: ContentScriptEntrypoint): string[];
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Directive names that make up CSPs. There are more, this is all I need for the plugin.
|
|
3
|
-
*/
|
|
4
|
-
export type CspDirective = 'default-src' | 'script-src' | 'object-src';
|
|
5
|
-
export declare class ContentSecurityPolicy {
|
|
6
|
-
private static DIRECTIVE_ORDER;
|
|
7
|
-
data: Record<string, string[]>;
|
|
8
|
-
constructor(csp?: string);
|
|
9
|
-
/**
|
|
10
|
-
* Ensure a set of values are listed under a directive.
|
|
11
|
-
*/
|
|
12
|
-
add(directive: CspDirective, ...newValues: string[]): ContentSecurityPolicy;
|
|
13
|
-
toString(): string;
|
|
14
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Entrypoint, PerBrowserOption, ResolvedPerBrowserOptions, TargetBrowser } from '../../types';
|
|
2
|
-
export declare function getEntrypointName(entrypointsDir: string, inputPath: string): string;
|
|
3
|
-
export declare function getEntrypointOutputFile(entrypoint: Entrypoint, ext: string): string;
|
|
4
|
-
/**
|
|
5
|
-
* Return's the entrypoint's output path relative to the output directory. Used for paths in the
|
|
6
|
-
* manifest and rollup's bundle.
|
|
7
|
-
*/
|
|
8
|
-
export declare function getEntrypointBundlePath(entrypoint: Entrypoint, outDir: string, ext: string): string;
|
|
9
|
-
/**
|
|
10
|
-
* Given an entrypoint option, resolve it's value based on a target browser.
|
|
11
|
-
*/
|
|
12
|
-
export declare function resolvePerBrowserOption<T>(option: PerBrowserOption<T>, browser: TargetBrowser): T;
|
|
13
|
-
/**
|
|
14
|
-
* Given an entrypoint option, resolve it's value based on a target browser.
|
|
15
|
-
*
|
|
16
|
-
* defaultIcon is special, it's the only key that's a record, which can confuse this function. So
|
|
17
|
-
* it's been manually excluded from resolution.
|
|
18
|
-
*/
|
|
19
|
-
export declare function resolvePerBrowserOptions<T extends Record<string, any>, TKeys extends keyof T>(options: T, browser: TargetBrowser): ResolvedPerBrowserOptions<T, TKeys>;
|
|
20
|
-
/**
|
|
21
|
-
* Returns true when the entrypoint is an HTML entrypoint.
|
|
22
|
-
*
|
|
23
|
-
* Naively just checking the file extension of the input path.
|
|
24
|
-
*/
|
|
25
|
-
export declare function isHtmlEntrypoint(entrypoint: Pick<Entrypoint, 'inputPath'>): boolean;
|
|
26
|
-
/**
|
|
27
|
-
* Returns true when the entrypoint is a JS entrypoint.
|
|
28
|
-
*
|
|
29
|
-
* Naively just checking the file extension of the input path.
|
|
30
|
-
*/
|
|
31
|
-
export declare function isJsEntrypoint(entrypoint: Pick<Entrypoint, 'inputPath'>): boolean;
|
package/dist/core/utils/env.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export interface Environment {
|
|
2
|
-
setup: () => () => void;
|
|
3
|
-
run: <T>(fn: () => Promise<T>) => Promise<T>;
|
|
4
|
-
}
|
|
5
|
-
export declare function createEnvironment(getGlobals: () => EnvGlobals): Environment;
|
|
6
|
-
export type EnvGlobals = Record<string, any>;
|
|
7
|
-
export declare function getOgGlobals(envGlobals: EnvGlobals): EnvGlobals;
|
|
8
|
-
export declare function applyGlobals(globals: EnvGlobals): void;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { Environment } from './environment';
|
|
2
|
-
export declare function createExtensionEnvironment(): Environment;
|
|
3
|
-
export declare function getExtensionEnvironmentGlobals(): {
|
|
4
|
-
chrome: import("@webext-core/fake-browser").FakeBrowser;
|
|
5
|
-
browser: import("@webext-core/fake-browser").FakeBrowser;
|
|
6
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function getEslintVersion(): Promise<string[]>;
|
package/dist/core/utils/fs.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Only write the contents to a file if it results in a change. This prevents unnecessary file
|
|
3
|
-
* watchers from being triggered, like WXT's dev server or the TS language server in editors.
|
|
4
|
-
*
|
|
5
|
-
* @param file The file to write to.
|
|
6
|
-
* @param newContents The new text content to write.
|
|
7
|
-
*/
|
|
8
|
-
export declare function writeFileIfDifferent(file: string, newContents: string): Promise<void>;
|
|
9
|
-
/**
|
|
10
|
-
* Get all the files in the project's public directory. Returned paths are relative to the
|
|
11
|
-
* `config.publicDir`.
|
|
12
|
-
*/
|
|
13
|
-
export declare function getPublicFiles(): Promise<string[]>;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ResolvedConfig } from '../../types';
|
|
2
|
-
export declare function getGlobals(config: ResolvedConfig): Array<{
|
|
3
|
-
name: string;
|
|
4
|
-
value: any;
|
|
5
|
-
type: string;
|
|
6
|
-
}>;
|
|
7
|
-
export declare function getEntrypointGlobals(entrypointName: string): {
|
|
8
|
-
name: string;
|
|
9
|
-
value: string;
|
|
10
|
-
type: string;
|
|
11
|
-
}[];
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export interface Message {
|
|
2
|
-
name: string;
|
|
3
|
-
message: string;
|
|
4
|
-
description?: string;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Get a list of all messages and their metadata from JSON file contents.
|
|
8
|
-
*
|
|
9
|
-
* @param messagesJson The contents of a `_locales/en/messages.json` file.
|
|
10
|
-
*/
|
|
11
|
-
export declare function parseI18nMessages(messagesJson: object): Message[];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function printFileList(log: (message: string) => void, header: string, baseDir: string, files: string[]): Promise<void>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function printHeader(): void;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function printTable(log: (message: string) => void, header: string, rows: string[][], gap?: number): void;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { Entrypoint, BuildOutput, ContentScriptEntrypoint } from '../../types';
|
|
2
|
-
import type { Browser } from '@wxt-dev/browser';
|
|
3
|
-
/**
|
|
4
|
-
* Writes the manifest to the output directory and the build output.
|
|
5
|
-
*/
|
|
6
|
-
export declare function writeManifest(manifest: Browser.runtime.Manifest, output: BuildOutput): Promise<void>;
|
|
7
|
-
/**
|
|
8
|
-
* Generates the manifest based on the config and entrypoints.
|
|
9
|
-
*/
|
|
10
|
-
export declare function generateManifest(allEntrypoints: Entrypoint[], buildOutput: Omit<BuildOutput, 'manifest'>): Promise<{
|
|
11
|
-
manifest: Browser.runtime.Manifest;
|
|
12
|
-
warnings: any[][];
|
|
13
|
-
}>;
|
|
14
|
-
/**
|
|
15
|
-
* Returns the bundle paths to CSS files associated with a list of content scripts, or undefined if
|
|
16
|
-
* there is no associated CSS.
|
|
17
|
-
*/
|
|
18
|
-
export declare function getContentScriptCssFiles(contentScripts: ContentScriptEntrypoint[], contentScriptCssMap: Record<string, string | undefined>): string[] | undefined;
|
|
19
|
-
/**
|
|
20
|
-
* Content scripts configured with `cssInjectionMode: "ui"` need to add their CSS files to web
|
|
21
|
-
* accessible resources so they can be fetched as text and added to shadow roots that the UI is
|
|
22
|
-
* added to.
|
|
23
|
-
*/
|
|
24
|
-
export declare function getContentScriptCssWebAccessibleResources(contentScripts: ContentScriptEntrypoint[], contentScriptCssMap: Record<string, string | undefined>): any[];
|
|
25
|
-
/**
|
|
26
|
-
* Based on the build output, return a Record of each content script's name to it CSS file if the
|
|
27
|
-
* script includes one.
|
|
28
|
-
*/
|
|
29
|
-
export declare function getContentScriptsCssMap(buildOutput: Omit<BuildOutput, 'manifest'>, scripts: ContentScriptEntrypoint[]): Record<string, string | undefined>;
|
|
30
|
-
/**
|
|
31
|
-
* - "<all_urls>" → "<all_urls>"
|
|
32
|
-
* - "*://play.google.com/books/*" → "*://play.google.com/*"
|
|
33
|
-
*/
|
|
34
|
-
export declare function stripPathFromMatchPattern(pattern: string): string;
|
|
35
|
-
/**
|
|
36
|
-
* Converts all MV3 web accessible resources to their MV2 forms. MV3 web accessible resources are
|
|
37
|
-
* generated in this file, and may be defined by the user in their manifest. In both cases, when
|
|
38
|
-
* targeting MV2, automatically convert their definitions down to the basic MV2 array.
|
|
39
|
-
*/
|
|
40
|
-
export declare function convertWebAccessibleResourcesToMv2(manifest: Browser.runtime.Manifest): void;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { MinimatchOptions } from 'minimatch';
|
|
2
|
-
/**
|
|
3
|
-
* Run [`minimatch`](https://npmjs.com/package/minimatch) against multiple
|
|
4
|
-
* patterns.
|
|
5
|
-
*
|
|
6
|
-
* Supports negated patterns, the order does not matter. If your `search` string
|
|
7
|
-
* matches any of the negative patterns, it will return `false`.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```ts
|
|
11
|
-
* minimatchMultiple('a.json', ['*.json', '!b.json']); // => true
|
|
12
|
-
* minimatchMultiple('b.json', ['*.json', '!b.json']); // => false
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
export declare function minimatchMultiple(search: string, patterns: string[] | undefined, options?: MinimatchOptions): boolean;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ResolvedConfig } from '../../types';
|
|
2
|
-
export declare function isOnline(): Promise<boolean>;
|
|
3
|
-
/**
|
|
4
|
-
* Fetches a URL with a simple GET request. Grabs it from cache if it doesn't exist, or throws an
|
|
5
|
-
* error if it can't be resolved via the network or cache.
|
|
6
|
-
*/
|
|
7
|
-
export declare function fetchCached(url: string, config: ResolvedConfig): Promise<string>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function safeStringToNumber(str: string | undefined): number | null;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Converts system paths to normalized bundler path. On windows and unix, this returns paths with /
|
|
3
|
-
* instead of \.
|
|
4
|
-
*/
|
|
5
|
-
export declare function normalizePath(path: string): string;
|
|
6
|
-
/**
|
|
7
|
-
* Given a normalized path, convert it to the system path style. On Windows, switch to \, otherwise use /.
|
|
8
|
-
*/
|
|
9
|
-
export declare function unnormalizePath(path: string): string;
|
|
10
|
-
export declare const CSS_EXTENSIONS: string[];
|
|
11
|
-
export declare const CSS_EXTENSIONS_PATTERN: string;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export declare function kebabCaseAlphanumeric(str: string): string;
|
|
2
|
-
/**
|
|
3
|
-
* Return a safe variable name for a given string.
|
|
4
|
-
*/
|
|
5
|
-
export declare function safeVarName(str: string): string;
|
|
6
|
-
/**
|
|
7
|
-
* Converts a string to a valid filename (NOT path), stripping out invalid characters.
|
|
8
|
-
*/
|
|
9
|
-
export declare function safeFilename(str: string): string;
|
|
10
|
-
/**
|
|
11
|
-
* Removes import statements from the top of a file. Keeps import.meta and inline, async `import()`
|
|
12
|
-
* calls.
|
|
13
|
-
*/
|
|
14
|
-
export declare function removeImportStatements(text: string): string;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export interface BabelSyntaxError extends SyntaxError {
|
|
2
|
-
code: 'BABEL_PARSER_SYNTAX_ERROR';
|
|
3
|
-
frame?: string;
|
|
4
|
-
id: string;
|
|
5
|
-
loc: {
|
|
6
|
-
line: number;
|
|
7
|
-
column: number;
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
export declare function isBabelSyntaxError(error: unknown): error is BabelSyntaxError;
|
|
11
|
-
export declare function logBabelSyntaxError(error: BabelSyntaxError): void;
|