wxt 0.19.22 → 0.20.0-beta1

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 (103) hide show
  1. package/README.md +6 -0
  2. package/dist/browser.d.ts +28 -0
  3. package/dist/builtin-modules/unimport.d.ts +1 -1
  4. package/dist/builtin-modules/unimport.mjs +36 -12
  5. package/dist/cli/index.mjs +0 -1
  6. package/dist/core/builders/vite/index.mjs +21 -38
  7. package/dist/core/builders/vite/plugins/extensionApiMock.d.ts +1 -6
  8. package/dist/core/builders/vite/plugins/extensionApiMock.mjs +2 -4
  9. package/dist/core/builders/vite/plugins/index.d.ts +0 -1
  10. package/dist/core/builders/vite/plugins/index.mjs +0 -1
  11. package/dist/core/builders/vite/plugins/noopBackground.mjs +1 -1
  12. package/dist/core/create-server.mjs +1 -0
  13. package/dist/core/define-web-ext-config.d.ts +9 -0
  14. package/dist/core/define-web-ext-config.mjs +10 -0
  15. package/dist/core/generate-wxt-dir.mjs +4 -6
  16. package/dist/core/index.d.ts +1 -1
  17. package/dist/core/index.mjs +1 -1
  18. package/dist/core/initialize.mjs +2 -5
  19. package/dist/core/keyboard-shortcuts.mjs +3 -9
  20. package/dist/core/resolve-config.mjs +152 -55
  21. package/dist/core/runners/web-ext.mjs +1 -1
  22. package/dist/core/utils/building/find-entrypoints.mjs +2 -1
  23. package/dist/core/utils/building/index.d.ts +0 -1
  24. package/dist/core/utils/building/index.mjs +0 -1
  25. package/dist/core/utils/building/rebuild.d.ts +1 -2
  26. package/dist/core/utils/content-scripts.d.ts +3 -3
  27. package/dist/core/utils/content-scripts.mjs +2 -0
  28. package/dist/core/utils/eslint.mjs +3 -5
  29. package/dist/core/utils/manifest.d.ts +3 -8
  30. package/dist/core/utils/manifest.mjs +4 -7
  31. package/dist/core/utils/strings.d.ts +0 -4
  32. package/dist/core/utils/strings.mjs +0 -6
  33. package/dist/core/utils/testing/fake-objects.d.ts +3416 -991
  34. package/dist/core/utils/testing/fake-objects.mjs +19 -22
  35. package/dist/core/utils/transform.d.ts +1 -1
  36. package/dist/core/utils/types.d.ts +2 -0
  37. package/dist/core/utils/validation.mjs +2 -2
  38. package/dist/index.d.ts +5 -0
  39. package/dist/modules.d.ts +1 -1
  40. package/dist/testing/index.d.ts +1 -0
  41. package/dist/testing/wxt-vitest-plugin.mjs +3 -5
  42. package/dist/types.d.ts +48 -70
  43. package/dist/utils/app-config.d.ts +2 -0
  44. package/dist/{client/content-scripts → utils}/content-script-context.d.ts +4 -3
  45. package/dist/{client/content-scripts → utils}/content-script-context.mjs +5 -3
  46. package/dist/utils/content-script-ui/iframe.d.ts +32 -0
  47. package/dist/utils/content-script-ui/iframe.mjs +30 -0
  48. package/dist/utils/content-script-ui/integrated.d.ts +34 -0
  49. package/dist/utils/content-script-ui/integrated.mjs +32 -0
  50. package/dist/utils/content-script-ui/shadow-root.d.ts +76 -0
  51. package/dist/utils/content-script-ui/shadow-root.mjs +73 -0
  52. package/dist/utils/content-script-ui/shared.d.ts +5 -0
  53. package/dist/{client/content-scripts/ui/index.mjs → utils/content-script-ui/shared.mjs} +5 -138
  54. package/dist/{client/content-scripts/ui → utils/content-script-ui}/types.d.ts +0 -96
  55. package/dist/{sandbox → utils}/define-app-config.d.ts +3 -2
  56. package/dist/{sandbox → utils}/define-background.d.ts +1 -0
  57. package/dist/{sandbox → utils}/define-content-script.d.ts +1 -0
  58. package/dist/{sandbox → utils}/define-unlisted-script.d.ts +1 -0
  59. package/dist/{sandbox → utils}/define-wxt-plugin.d.ts +1 -0
  60. package/dist/{sandbox → utils/internal}/dev-server-websocket.mjs +1 -1
  61. package/dist/{client/content-scripts → utils/internal}/location-watcher.d.ts +1 -1
  62. package/dist/utils/match-patterns.d.ts +5 -0
  63. package/dist/utils/match-patterns.mjs +1 -0
  64. package/dist/utils/storage.d.ts +5 -0
  65. package/dist/version.mjs +1 -1
  66. package/dist/virtual/background-entrypoint.mjs +1 -1
  67. package/dist/virtual/content-script-isolated-world-entrypoint.mjs +1 -1
  68. package/package.json +108 -71
  69. package/dist/browser/chrome.d.ts +0 -13
  70. package/dist/browser/index.d.ts +0 -26
  71. package/dist/browser/index.mjs +0 -2
  72. package/dist/client/app-config.d.ts +0 -2
  73. package/dist/client/content-scripts/index.d.ts +0 -2
  74. package/dist/client/content-scripts/index.mjs +0 -2
  75. package/dist/client/content-scripts/ui/index.d.ts +0 -23
  76. package/dist/client/index.d.ts +0 -8
  77. package/dist/client/index.mjs +0 -3
  78. package/dist/core/builders/vite/plugins/resolveExtensionApi.d.ts +0 -10
  79. package/dist/core/builders/vite/plugins/resolveExtensionApi.mjs +0 -15
  80. package/dist/core/define-runner-config.d.ts +0 -2
  81. package/dist/core/define-runner-config.mjs +0 -3
  82. package/dist/core/utils/building/import-entrypoint.d.ts +0 -16
  83. package/dist/core/utils/building/import-entrypoint.mjs +0 -100
  84. package/dist/sandbox/index.d.ts +0 -11
  85. package/dist/sandbox/index.mjs +0 -6
  86. package/dist/storage.d.ts +0 -4
  87. /package/dist/{browser/chrome.mjs → browser.mjs} +0 -0
  88. /package/dist/{client → utils}/app-config.mjs +0 -0
  89. /package/dist/{client/content-scripts/ui → utils/content-script-ui}/types.mjs +0 -0
  90. /package/dist/{sandbox → utils}/define-app-config.mjs +0 -0
  91. /package/dist/{sandbox → utils}/define-background.mjs +0 -0
  92. /package/dist/{sandbox → utils}/define-content-script.mjs +0 -0
  93. /package/dist/{sandbox → utils}/define-unlisted-script.mjs +0 -0
  94. /package/dist/{sandbox → utils}/define-wxt-plugin.mjs +0 -0
  95. /package/dist/{client → utils}/inject-script.d.ts +0 -0
  96. /package/dist/{client → utils}/inject-script.mjs +0 -0
  97. /package/dist/{client/content-scripts → utils/internal}/custom-events.d.ts +0 -0
  98. /package/dist/{client/content-scripts → utils/internal}/custom-events.mjs +0 -0
  99. /package/dist/{sandbox → utils/internal}/dev-server-websocket.d.ts +0 -0
  100. /package/dist/{client/content-scripts → utils/internal}/location-watcher.mjs +0 -0
  101. /package/dist/{sandbox/utils → utils/internal}/logger.d.ts +0 -0
  102. /package/dist/{sandbox/utils → utils/internal}/logger.mjs +0 -0
  103. /package/dist/{storage.mjs → utils/storage.mjs} +0 -0
@@ -0,0 +1,73 @@
1
+ import { browser } from "wxt/browser";
2
+ import { createIsolatedElement } from "@webext-core/isolated-element";
3
+ import { applyPosition, createMountFunctions, mountUi } from "./shared.mjs";
4
+ import { logger } from "../internal/logger.mjs";
5
+ export async function createShadowRootUi(ctx, options) {
6
+ const css = [];
7
+ if (!options.inheritStyles) {
8
+ css.push(`/* WXT Shadow Root Reset */ body{all:initial;}`);
9
+ }
10
+ if (options.css) {
11
+ css.push(options.css);
12
+ }
13
+ if (ctx.options?.cssInjectionMode === "ui") {
14
+ const entryCss = await loadCss();
15
+ css.push(entryCss.replaceAll(":root", ":host"));
16
+ }
17
+ const {
18
+ isolatedElement: uiContainer,
19
+ parentElement: shadowHost,
20
+ shadow
21
+ } = await createIsolatedElement({
22
+ name: options.name,
23
+ css: {
24
+ textContent: css.join("\n").trim()
25
+ },
26
+ mode: options.mode ?? "open",
27
+ isolateEvents: options.isolateEvents
28
+ });
29
+ shadowHost.setAttribute("data-wxt-shadow-root", "");
30
+ let mounted;
31
+ const mount = () => {
32
+ mountUi(shadowHost, options);
33
+ applyPosition(shadowHost, shadow.querySelector("html"), options);
34
+ mounted = options.onMount(uiContainer, shadow, shadowHost);
35
+ };
36
+ const remove = () => {
37
+ options.onRemove?.(mounted);
38
+ shadowHost.remove();
39
+ while (uiContainer.lastChild)
40
+ uiContainer.removeChild(uiContainer.lastChild);
41
+ mounted = void 0;
42
+ };
43
+ const mountFunctions = createMountFunctions(
44
+ {
45
+ mount,
46
+ remove
47
+ },
48
+ options
49
+ );
50
+ ctx.onInvalidated(remove);
51
+ return {
52
+ shadow,
53
+ shadowHost,
54
+ uiContainer,
55
+ ...mountFunctions,
56
+ get mounted() {
57
+ return mounted;
58
+ }
59
+ };
60
+ }
61
+ async function loadCss() {
62
+ const url = browser.runtime.getURL(`/content-scripts/${import.meta.env.ENTRYPOINT}.css`);
63
+ try {
64
+ const res = await fetch(url);
65
+ return await res.text();
66
+ } catch (err) {
67
+ logger.warn(
68
+ `Failed to load styles @ ${url}. Did you forget to import the stylesheet in your entrypoint?`,
69
+ err
70
+ );
71
+ return "";
72
+ }
73
+ }
@@ -0,0 +1,5 @@
1
+ import type { ContentScriptAnchoredOptions, ContentScriptPositioningOptions, BaseMountFunctions, ContentScriptUiOptions, MountFunctions } from './types';
2
+ export declare function applyPosition(root: HTMLElement, positionedElement: HTMLElement | undefined | null, options: ContentScriptPositioningOptions): void;
3
+ export declare function getAnchor(options: ContentScriptAnchoredOptions): Element | undefined;
4
+ export declare function mountUi(root: HTMLElement, options: ContentScriptAnchoredOptions): void;
5
+ export declare function createMountFunctions<TMounted>(baseFunctions: BaseMountFunctions, options: ContentScriptUiOptions<TMounted>): MountFunctions;
@@ -1,128 +1,10 @@
1
- import { browser } from "wxt/browser";
2
1
  import { waitElement } from "@1natsu/wait-element";
3
2
  import {
4
3
  isExist as mountDetector,
5
4
  isNotExist as removeDetector
6
5
  } from "@1natsu/wait-element/detectors";
7
- import { logger } from "../../../sandbox/utils/logger.mjs";
8
- import { createIsolatedElement } from "@webext-core/isolated-element";
9
- export * from "./types.mjs";
10
- export function createIntegratedUi(ctx, options) {
11
- const wrapper = document.createElement(options.tag || "div");
12
- wrapper.setAttribute("data-wxt-integrated", "");
13
- let mounted = void 0;
14
- const mount = () => {
15
- applyPosition(wrapper, void 0, options);
16
- mountUi(wrapper, options);
17
- mounted = options.onMount?.(wrapper);
18
- };
19
- const remove = () => {
20
- options.onRemove?.(mounted);
21
- wrapper.replaceChildren();
22
- wrapper.remove();
23
- mounted = void 0;
24
- };
25
- const mountFunctions = createMountFunctions(
26
- {
27
- mount,
28
- remove
29
- },
30
- options
31
- );
32
- ctx.onInvalidated(remove);
33
- return {
34
- get mounted() {
35
- return mounted;
36
- },
37
- wrapper,
38
- ...mountFunctions
39
- };
40
- }
41
- export function createIframeUi(ctx, options) {
42
- const wrapper = document.createElement("div");
43
- wrapper.setAttribute("data-wxt-iframe", "");
44
- const iframe = document.createElement("iframe");
45
- iframe.src = browser.runtime.getURL(options.page);
46
- wrapper.appendChild(iframe);
47
- let mounted = void 0;
48
- const mount = () => {
49
- applyPosition(wrapper, iframe, options);
50
- mountUi(wrapper, options);
51
- mounted = options.onMount?.(wrapper, iframe);
52
- };
53
- const remove = () => {
54
- options.onRemove?.(mounted);
55
- wrapper.remove();
56
- mounted = void 0;
57
- };
58
- const mountFunctions = createMountFunctions(
59
- {
60
- mount,
61
- remove
62
- },
63
- options
64
- );
65
- ctx.onInvalidated(remove);
66
- return {
67
- get mounted() {
68
- return mounted;
69
- },
70
- iframe,
71
- wrapper,
72
- ...mountFunctions
73
- };
74
- }
75
- export async function createShadowRootUi(ctx, options) {
76
- const css = [options.css ?? ""];
77
- if (ctx.options?.cssInjectionMode === "ui") {
78
- const entryCss = await loadCss();
79
- css.push(entryCss.replaceAll(":root", ":host"));
80
- }
81
- const {
82
- isolatedElement: uiContainer,
83
- parentElement: shadowHost,
84
- shadow
85
- } = await createIsolatedElement({
86
- name: options.name,
87
- css: {
88
- textContent: css.join("\n").trim()
89
- },
90
- mode: options.mode ?? "open",
91
- isolateEvents: options.isolateEvents
92
- });
93
- shadowHost.setAttribute("data-wxt-shadow-root", "");
94
- let mounted;
95
- const mount = () => {
96
- mountUi(shadowHost, options);
97
- applyPosition(shadowHost, shadow.querySelector("html"), options);
98
- mounted = options.onMount(uiContainer, shadow, shadowHost);
99
- };
100
- const remove = () => {
101
- options.onRemove?.(mounted);
102
- shadowHost.remove();
103
- while (uiContainer.lastChild)
104
- uiContainer.removeChild(uiContainer.lastChild);
105
- mounted = void 0;
106
- };
107
- const mountFunctions = createMountFunctions(
108
- {
109
- mount,
110
- remove
111
- },
112
- options
113
- );
114
- ctx.onInvalidated(remove);
115
- return {
116
- shadow,
117
- shadowHost,
118
- uiContainer,
119
- ...mountFunctions,
120
- get mounted() {
121
- return mounted;
122
- }
123
- };
124
- }
125
- function applyPosition(root, positionedElement, options) {
6
+ import { logger } from "../../utils/internal/logger.mjs";
7
+ export function applyPosition(root, positionedElement, options) {
126
8
  if (options.position === "inline") return;
127
9
  if (options.zIndex != null) root.style.zIndex = String(options.zIndex);
128
10
  root.style.overflow = "visible";
@@ -148,7 +30,7 @@ function applyPosition(root, positionedElement, options) {
148
30
  }
149
31
  }
150
32
  }
151
- function getAnchor(options) {
33
+ export function getAnchor(options) {
152
34
  if (options.anchor == null) return document.body;
153
35
  let resolved = typeof options.anchor === "function" ? options.anchor() : options.anchor;
154
36
  if (typeof resolved === "string") {
@@ -167,7 +49,7 @@ function getAnchor(options) {
167
49
  }
168
50
  return resolved ?? void 0;
169
51
  }
170
- function mountUi(root, options) {
52
+ export function mountUi(root, options) {
171
53
  const anchor = getAnchor(options);
172
54
  if (anchor == null)
173
55
  throw Error(
@@ -195,7 +77,7 @@ function mountUi(root, options) {
195
77
  break;
196
78
  }
197
79
  }
198
- function createMountFunctions(baseFunctions, options) {
80
+ export function createMountFunctions(baseFunctions, options) {
199
81
  let autoMountInstance = void 0;
200
82
  const stopAutoMount = () => {
201
83
  autoMountInstance?.stopAutoMount();
@@ -270,18 +152,3 @@ function autoMountUi(uiCallbacks, options) {
270
152
  observeElement(resolvedAnchor);
271
153
  return { stopAutoMount: _stopAutoMount };
272
154
  }
273
- async function loadCss() {
274
- const url = browser.runtime.getURL(
275
- `/content-scripts/${import.meta.env.ENTRYPOINT}.css`
276
- );
277
- try {
278
- const res = await fetch(url);
279
- return await res.text();
280
- } catch (err) {
281
- logger.warn(
282
- `Failed to load styles @ ${url}. Did you forget to import the stylesheet in your entrypoint?`,
283
- err
284
- );
285
- return "";
286
- }
287
- }
@@ -1,35 +1,3 @@
1
- export interface IntegratedContentScriptUi<TMounted> extends ContentScriptUi<TMounted> {
2
- /**
3
- * A wrapper div that assists in positioning.
4
- */
5
- wrapper: HTMLElement;
6
- }
7
- export interface IframeContentScriptUi<TMounted> extends ContentScriptUi<TMounted> {
8
- /**
9
- * The iframe added to the DOM.
10
- */
11
- iframe: HTMLIFrameElement;
12
- /**
13
- * A wrapper div that assists in positioning.
14
- */
15
- wrapper: HTMLDivElement;
16
- }
17
- export interface ShadowRootContentScriptUi<TMounted> extends ContentScriptUi<TMounted> {
18
- /**
19
- * The `HTMLElement` hosting the shadow root used to isolate the UI's styles. This is the element
20
- * that get's added to the DOM. This element's style is not isolated from the webpage.
21
- */
22
- shadowHost: HTMLElement;
23
- /**
24
- * The container element inside the `ShadowRoot` whose styles are isolated. The UI is mounted
25
- * inside this `HTMLElement`.
26
- */
27
- uiContainer: HTMLElement;
28
- /**
29
- * The shadow root performing the isolation.
30
- */
31
- shadow: ShadowRoot;
32
- }
33
1
  export interface ContentScriptUi<TMounted> extends MountFunctions {
34
2
  mounted: TMounted | undefined;
35
3
  }
@@ -40,70 +8,6 @@ export type ContentScriptUiOptions<TMounted> = ContentScriptPositioningOptions &
40
8
  */
41
9
  onRemove?: (mounted: TMounted | undefined) => void;
42
10
  };
43
- export type IntegratedContentScriptUiOptions<TMounted> = ContentScriptUiOptions<TMounted> & {
44
- /**
45
- * Tag used to create the wrapper element.
46
- *
47
- * @default "div"
48
- */
49
- tag?: string;
50
- /**
51
- * Callback executed when mounting the UI. This function should create and append the UI to the
52
- * `wrapper` element. It is called every time `ui.mount()` is called.
53
- *
54
- * Optionally return a value that can be accessed at `ui.mounted` or in the `onRemove` callback.
55
- */
56
- onMount: (wrapper: HTMLElement) => TMounted;
57
- };
58
- export type IframeContentScriptUiOptions<TMounted> = ContentScriptUiOptions<TMounted> & {
59
- /**
60
- * The path to the HTML page that will be shown in the iframe. This string is passed into
61
- * `browser.runtime.getURL`.
62
- */
63
- page: import('wxt/browser').HtmlPublicPath;
64
- /**
65
- * Callback executed when mounting the UI. Use this function to customize the iframe or wrapper
66
- * element's appearance. It is called every time `ui.mount()` is called.
67
- *
68
- * Optionally return a value that can be accessed at `ui.mounted` or in the `onRemove` callback.
69
- */
70
- onMount?: (wrapper: HTMLElement, iframe: HTMLIFrameElement) => TMounted;
71
- };
72
- export type ShadowRootContentScriptUiOptions<TMounted> = ContentScriptUiOptions<TMounted> & {
73
- /**
74
- * The name of the custom component used to host the ShadowRoot. Must be kebab-case.
75
- */
76
- name: string;
77
- /**
78
- * Custom CSS text to apply to the UI. If your content script imports/generates CSS and you've
79
- * set `cssInjectionMode: "ui"`, the imported CSS will be included automatically. You do not need
80
- * to pass those styles in here. This is for any additional styles not in the imported CSS.
81
- */
82
- css?: string;
83
- /**
84
- * ShadowRoot's mode.
85
- *
86
- * @see https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot/mode
87
- * @default "open"
88
- */
89
- mode?: 'open' | 'closed';
90
- /**
91
- * When enabled, `event.stopPropagation` will be called on events trying to bubble out of the
92
- * shadow root.
93
- *
94
- * - Set to `true` to stop the propagation of a default set of events,
95
- * `["keyup", "keydown", "keypress"]`
96
- * - Set to an array of event names to stop the propagation of a custom list of events
97
- */
98
- isolateEvents?: boolean | string[];
99
- /**
100
- * Callback executed when mounting the UI. This function should create and append the UI to the
101
- * `uiContainer` element. It is called every time `ui.mount()` is called.
102
- *
103
- * Optionally return a value that can be accessed at `ui.mounted` or in the `onRemove` callback.
104
- */
105
- onMount: (uiContainer: HTMLElement, shadow: ShadowRoot, shadowHost: HTMLElement) => TMounted;
106
- };
107
11
  export type ContentScriptOverlayAlignment = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
108
12
  /**
109
13
  * ![Visualization of different append modes](https://wxt.dev/content-script-ui-append.png)
@@ -1,3 +1,4 @@
1
+ /** @module wxt/utils/define-app-config */
1
2
  export interface WxtAppConfig {
2
3
  }
3
4
  /**
@@ -7,9 +8,9 @@ export interface WxtAppConfig {
7
8
  *
8
9
  * ```ts
9
10
  * // app.config.ts
10
- * import 'wxt/sandbox';
11
+ * import 'wxt/utils/define-app-config';
11
12
  *
12
- * declare module "wxt/sandbox" {
13
+ * declare module "wxt/utils/define-app-config" {
13
14
  * export interface WxtAppConfig {
14
15
  * analytics: AnalyticsConfig
15
16
  * }
@@ -1,3 +1,4 @@
1
+ /** @module wxt/utils/define-background */
1
2
  import type { BackgroundDefinition } from '../types';
2
3
  export declare function defineBackground(main: () => void): BackgroundDefinition;
3
4
  export declare function defineBackground(definition: BackgroundDefinition): BackgroundDefinition;
@@ -1,2 +1,3 @@
1
+ /** @module wxt/utils/define-content-script */
1
2
  import type { ContentScriptDefinition } from '../types';
2
3
  export declare function defineContentScript(definition: ContentScriptDefinition): ContentScriptDefinition;
@@ -1,3 +1,4 @@
1
+ /** @module wxt/utils/define-unlisted-script */
1
2
  import type { UnlistedScriptDefinition } from '../types';
2
3
  export declare function defineUnlistedScript(main: () => void): UnlistedScriptDefinition;
3
4
  export declare function defineUnlistedScript(definition: UnlistedScriptDefinition): UnlistedScriptDefinition;
@@ -1,2 +1,3 @@
1
+ /** @module wxt/utils/define-wxt-plugin */
1
2
  import type { WxtPlugin } from '../types';
2
3
  export declare function defineWxtPlugin(plugin: WxtPlugin): WxtPlugin;
@@ -1,4 +1,4 @@
1
- import { logger } from "./utils/logger.mjs";
1
+ import { logger } from "./logger.mjs";
2
2
  let ws;
3
3
  export function getDevServerWebSocket() {
4
4
  if (import.meta.env.COMMAND !== "serve")
@@ -1,4 +1,4 @@
1
- import { ContentScriptContext } from '.';
1
+ import { ContentScriptContext } from '../content-script-context';
2
2
  /**
3
3
  * Create a util that watches for URL changes, dispatching the custom event when detected. Stops
4
4
  * watching when content script is invalidated.
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Re-export the [`@webext-core/match-patterns` package](https://www.npmjs.com/package/@webext-core/match-patterns).
3
+ * @module wxt/utils/match-patterns
4
+ */
5
+ export * from '@webext-core/match-patterns';
@@ -0,0 +1 @@
1
+ export * from "@webext-core/match-patterns";
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Re-export the [`@wxt-dev/storage` package](https://www.npmjs.com/package/@wxt-dev/storage).
3
+ * @module wxt/utils/storage
4
+ */
5
+ export * from '@wxt-dev/storage';
package/dist/version.mjs CHANGED
@@ -1 +1 @@
1
- export const version = "0.19.22";
1
+ export const version = "0.20.0-beta1";
@@ -1,7 +1,7 @@
1
1
  import definition from 'virtual:user-background-entrypoint';
2
2
  import { initPlugins } from 'virtual:wxt-plugins';
3
3
  import { browser } from 'wxt/browser';
4
- import { MatchPattern } from 'wxt/sandbox';
4
+ import { MatchPattern } from 'wxt/utils/match-patterns';
5
5
 
6
6
  function print(method, ...args) {
7
7
  if (import.meta.env.MODE === "production")
@@ -1,5 +1,5 @@
1
1
  import definition from 'virtual:user-content-script-isolated-world-entrypoint';
2
- import { ContentScriptContext } from 'wxt/client';
2
+ import { ContentScriptContext } from 'wxt/utils/content-script-context';
3
3
  import { initPlugins } from 'virtual:wxt-plugins';
4
4
 
5
5
  function print(method, ...args) {
package/package.json CHANGED
@@ -1,85 +1,19 @@
1
1
  {
2
2
  "name": "wxt",
3
3
  "type": "module",
4
- "version": "0.19.22",
4
+ "version": "0.20.0-beta1",
5
5
  "description": "Next gen framework for developing web extensions",
6
- "repository": {
7
- "type": "git",
8
- "url": "git+https://github.com/wxt-dev/wxt.git"
9
- },
10
- "homepage": "https://wxt.dev",
11
- "keywords": [
12
- "vite",
13
- "chrome",
14
- "web",
15
- "extension",
16
- "browser",
17
- "bundler",
18
- "framework"
19
- ],
20
- "author": {
21
- "name": "Aaron Klinker",
22
- "email": "aaronklinker1+wxt@gmail.com"
23
- },
24
6
  "license": "MIT",
25
- "files": [
26
- "bin",
27
- "dist"
28
- ],
29
- "bin": {
30
- "wxt": "./bin/wxt.mjs",
31
- "wxt-publish-extension": "./bin/wxt-publish-extension.cjs"
32
- },
33
- "module": "./dist/index.mjs",
34
- "types": "./dist/index.d.ts",
35
- "exports": {
36
- ".": {
37
- "types": "./dist/index.d.ts",
38
- "default": "./dist/index.mjs"
39
- },
40
- "./client": {
41
- "types": "./dist/client/index.d.ts",
42
- "default": "./dist/client/index.mjs"
43
- },
44
- "./sandbox": {
45
- "types": "./dist/sandbox/index.d.ts",
46
- "default": "./dist/sandbox/index.mjs"
47
- },
48
- "./browser": {
49
- "types": "./dist/browser/index.d.ts",
50
- "default": "./dist/browser/index.mjs"
51
- },
52
- "./browser/chrome": {
53
- "types": "./dist/browser/chrome.d.ts",
54
- "import": "./dist/browser/chrome.mjs"
55
- },
56
- "./testing": {
57
- "types": "./dist/testing/index.d.ts",
58
- "default": "./dist/testing/index.mjs"
59
- },
60
- "./storage": {
61
- "types": "./dist/storage.d.ts",
62
- "default": "./dist/storage.mjs"
63
- },
64
- "./vite-builder-env": {
65
- "types": "./dist/vite-builder-env.d.ts"
66
- },
67
- "./modules": {
68
- "types": "./dist/modules.d.ts",
69
- "default": "./dist/modules.mjs"
70
- }
71
- },
72
7
  "dependencies": {
73
8
  "@1natsu/wait-element": "^4.1.2",
74
9
  "@aklinker1/rollup-plugin-visualizer": "5.12.0",
75
10
  "@types/chrome": "^0.0.280",
76
- "@types/webextension-polyfill": "^0.12.1",
77
11
  "@webext-core/fake-browser": "^1.3.1",
78
12
  "@webext-core/isolated-element": "^1.1.2",
79
13
  "@webext-core/match-patterns": "^1.0.3",
80
14
  "@wxt-dev/storage": "^1.0.0",
81
15
  "async-mutex": "^0.5.0",
82
- "c12": "^1.11.2",
16
+ "c12": "^2.0.1",
83
17
  "cac": "^6.7.14",
84
18
  "chokidar": "^3.6.0",
85
19
  "ci-info": "^4.1.0",
@@ -94,7 +28,6 @@
94
28
  "giget": "^1.2.3",
95
29
  "hookable": "^5.5.3",
96
30
  "is-wsl": "^3.1.0",
97
- "jiti": "^1.21.6",
98
31
  "json5": "^2.2.3",
99
32
  "jszip": "^3.10.1",
100
33
  "linkedom": "^0.18.5",
@@ -114,8 +47,7 @@
114
47
  "unimport": "^3.13.1",
115
48
  "vite": "^5.0.0 || ^6.0.0",
116
49
  "vite-node": "^2.1.4",
117
- "web-ext-run": "^0.2.1",
118
- "webextension-polyfill": "^0.12.0"
50
+ "web-ext-run": "^0.2.1"
119
51
  },
120
52
  "devDependencies": {
121
53
  "@aklinker1/check": "^1.4.5",
@@ -141,6 +73,111 @@
141
73
  "optional": true
142
74
  }
143
75
  },
76
+ "repository": {
77
+ "type": "git",
78
+ "url": "git+https://github.com/wxt-dev/wxt.git"
79
+ },
80
+ "homepage": "https://wxt.dev",
81
+ "keywords": [
82
+ "vite",
83
+ "chrome",
84
+ "web",
85
+ "extension",
86
+ "browser",
87
+ "bundler",
88
+ "framework"
89
+ ],
90
+ "author": {
91
+ "name": "Aaron Klinker",
92
+ "email": "aaronklinker1+wxt@gmail.com"
93
+ },
94
+ "files": [
95
+ "bin",
96
+ "dist"
97
+ ],
98
+ "bin": {
99
+ "wxt": "./bin/wxt.mjs",
100
+ "wxt-publish-extension": "./bin/wxt-publish-extension.cjs"
101
+ },
102
+ "module": "./dist/index.mjs",
103
+ "types": "./dist/index.d.ts",
104
+ "exports": {
105
+ ".": {
106
+ "types": "./dist/index.d.ts",
107
+ "default": "./dist/index.mjs"
108
+ },
109
+ "./utils/app-config": {
110
+ "types": "./dist/utils/app-config.d.ts",
111
+ "default": "./dist/utils/app-config.mjs"
112
+ },
113
+ "./utils/inject-script": {
114
+ "types": "./dist/utils/inject-script.d.ts",
115
+ "default": "./dist/utils/inject-script.mjs"
116
+ },
117
+ "./utils/content-script-context": {
118
+ "types": "./dist/utils/content-script-context.d.ts",
119
+ "default": "./dist/utils/content-script-context.mjs"
120
+ },
121
+ "./utils/content-script-ui/types": {
122
+ "types": "./dist/utils/content-script-ui/types.d.ts",
123
+ "default": "./dist/utils/content-script-ui/types.mjs"
124
+ },
125
+ "./utils/content-script-ui/integrated": {
126
+ "types": "./dist/utils/content-script-ui/integrated.d.ts",
127
+ "default": "./dist/utils/content-script-ui/integrated.mjs"
128
+ },
129
+ "./utils/content-script-ui/shadow-root": {
130
+ "types": "./dist/utils/content-script-ui/shadow-root.d.ts",
131
+ "default": "./dist/utils/content-script-ui/shadow-root.mjs"
132
+ },
133
+ "./utils/content-script-ui/iframe": {
134
+ "types": "./dist/utils/content-script-ui/iframe.d.ts",
135
+ "default": "./dist/utils/content-script-ui/iframe.mjs"
136
+ },
137
+ "./utils/define-app-config": {
138
+ "types": "./dist/utils/define-app-config.d.ts",
139
+ "default": "./dist/utils/define-app-config.mjs"
140
+ },
141
+ "./utils/define-background": {
142
+ "types": "./dist/utils/define-background.d.ts",
143
+ "default": "./dist/utils/define-background.mjs"
144
+ },
145
+ "./utils/define-content-script": {
146
+ "types": "./dist/utils/define-content-script.d.ts",
147
+ "default": "./dist/utils/define-content-script.mjs"
148
+ },
149
+ "./utils/define-unlisted-script": {
150
+ "types": "./dist/utils/define-unlisted-script.d.ts",
151
+ "default": "./dist/utils/define-unlisted-script.mjs"
152
+ },
153
+ "./utils/define-wxt-plugin": {
154
+ "types": "./dist/utils/define-wxt-plugin.d.ts",
155
+ "default": "./dist/utils/define-wxt-plugin.mjs"
156
+ },
157
+ "./utils/match-patterns": {
158
+ "types": "./dist/utils/match-patterns.d.ts",
159
+ "default": "./dist/utils/match-patterns.mjs"
160
+ },
161
+ "./utils/storage": {
162
+ "types": "./dist/utils/storage.d.ts",
163
+ "default": "./dist/utils/storage.mjs"
164
+ },
165
+ "./browser": {
166
+ "types": "./dist/browser.d.ts",
167
+ "default": "./dist/browser.mjs"
168
+ },
169
+ "./testing": {
170
+ "types": "./dist/testing/index.d.ts",
171
+ "default": "./dist/testing/index.mjs"
172
+ },
173
+ "./vite-builder-env": {
174
+ "types": "./dist/vite-builder-env.d.ts"
175
+ },
176
+ "./modules": {
177
+ "types": "./dist/modules.d.ts",
178
+ "default": "./dist/modules.mjs"
179
+ }
180
+ },
144
181
  "scripts": {
145
182
  "wxt": "tsx src/cli/index.ts",
146
183
  "build": "buildc -- unbuild",