wxt 0.10.0 → 0.10.2

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.
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "0.10.0";
2
+ var version = "0.10.2";
3
3
 
4
4
  // src/core/utils/entrypoints.ts
5
5
  import path, { relative, resolve } from "node:path";
@@ -749,6 +749,7 @@ async function buildSingleEntrypoint(entrypoint, config) {
749
749
  plugins.push(cssEntrypoints(entrypoint, config));
750
750
  }
751
751
  const libMode = {
752
+ mode: config.mode,
752
753
  plugins,
753
754
  build: {
754
755
  lib: {
@@ -798,6 +799,7 @@ async function buildSingleEntrypoint(entrypoint, config) {
798
799
  }
799
800
  async function buildMultipleEntrypoints(entrypoints, config) {
800
801
  const multiPage = {
802
+ mode: config.mode,
801
803
  plugins: [multipageMove(entrypoints, config)],
802
804
  build: {
803
805
  rollupOptions: {
package/dist/cli.cjs CHANGED
@@ -2415,7 +2415,7 @@ var init_execa = __esm({
2415
2415
  var import_cac = __toESM(require("cac"), 1);
2416
2416
 
2417
2417
  // package.json
2418
- var version = "0.10.0";
2418
+ var version = "0.10.2";
2419
2419
 
2420
2420
  // src/core/utils/building/build-entrypoints.ts
2421
2421
  var vite2 = __toESM(require("vite"), 1);
@@ -3032,6 +3032,7 @@ async function buildSingleEntrypoint(entrypoint, config) {
3032
3032
  plugins.push(cssEntrypoints(entrypoint, config));
3033
3033
  }
3034
3034
  const libMode = {
3035
+ mode: config.mode,
3035
3036
  plugins,
3036
3037
  build: {
3037
3038
  lib: {
@@ -3081,6 +3082,7 @@ async function buildSingleEntrypoint(entrypoint, config) {
3081
3082
  }
3082
3083
  async function buildMultipleEntrypoints(entrypoints, config) {
3083
3084
  const multiPage = {
3085
+ mode: config.mode,
3084
3086
  plugins: [multipageMove(entrypoints, config)],
3085
3087
  build: {
3086
3088
  rollupOptions: {
package/dist/index.cjs CHANGED
@@ -3042,6 +3042,7 @@ async function buildSingleEntrypoint(entrypoint, config) {
3042
3042
  plugins.push(cssEntrypoints(entrypoint, config));
3043
3043
  }
3044
3044
  const libMode = {
3045
+ mode: config.mode,
3045
3046
  plugins,
3046
3047
  build: {
3047
3048
  lib: {
@@ -3091,6 +3092,7 @@ async function buildSingleEntrypoint(entrypoint, config) {
3091
3092
  }
3092
3093
  async function buildMultipleEntrypoints(entrypoints, config) {
3093
3094
  const multiPage = {
3095
+ mode: config.mode,
3094
3096
  plugins: [multipageMove(entrypoints, config)],
3095
3097
  build: {
3096
3098
  rollupOptions: {
@@ -4228,7 +4230,7 @@ function getChunkSortWeight(filename) {
4228
4230
  var import_picocolors3 = __toESM(require("picocolors"), 1);
4229
4231
 
4230
4232
  // package.json
4231
- var version = "0.10.0";
4233
+ var version = "0.10.2";
4232
4234
 
4233
4235
  // src/core/utils/log/printHeader.ts
4234
4236
  var import_consola2 = require("consola");
package/dist/index.d.cts CHANGED
@@ -61,6 +61,6 @@ declare function prepare(config: InlineConfig): Promise<void>;
61
61
  */
62
62
  declare function zip(config?: InlineConfig): Promise<string[]>;
63
63
 
64
- var version = "0.10.0";
64
+ var version = "0.10.2";
65
65
 
66
66
  export { BuildOutput, ExtensionRunnerConfig, InlineConfig, UserConfig, WxtDevServer, build, clean, createServer, defineConfig, defineRunnerConfig, initialize, prepare, version, zip };
package/dist/index.d.ts CHANGED
@@ -61,6 +61,6 @@ declare function prepare(config: InlineConfig): Promise<void>;
61
61
  */
62
62
  declare function zip(config?: InlineConfig): Promise<string[]>;
63
63
 
64
- var version = "0.10.0";
64
+ var version = "0.10.2";
65
65
 
66
66
  export { BuildOutput, ExtensionRunnerConfig, InlineConfig, UserConfig, WxtDevServer, build, clean, createServer, defineConfig, defineRunnerConfig, initialize, prepare, version, zip };
package/dist/index.js CHANGED
@@ -15,7 +15,7 @@ import {
15
15
  rebuild,
16
16
  resolvePerBrowserOption,
17
17
  version
18
- } from "./chunk-4ACVTNQN.js";
18
+ } from "./chunk-6APJQ3J3.js";
19
19
  import "./chunk-YUG22S6W.js";
20
20
 
21
21
  // src/core/build.ts
package/dist/testing.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  unimport,
7
7
  webextensionPolyfillAlias,
8
8
  webextensionPolyfillInlineDeps
9
- } from "./chunk-4ACVTNQN.js";
9
+ } from "./chunk-6APJQ3J3.js";
10
10
  import "./chunk-YUG22S6W.js";
11
11
 
12
12
  // src/testing/fake-browser.ts
@@ -1,21 +1,3 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
18
-
19
1
  // src/virtual/background-entrypoint.ts
20
2
  import definition from "virtual:user-background";
21
3
 
@@ -65,125 +47,21 @@ function setupWebSocket(onMessage) {
65
47
  }
66
48
 
67
49
  // src/virtual/background-entrypoint.ts
68
- import browser4 from "webextension-polyfill";
69
-
70
- // src/storage.ts
71
- var storage_exports = {};
72
- __export(storage_exports, {
73
- storage: () => storage,
74
- webExtensionDriver: () => webExtensionDriver
75
- });
76
- __reExport(storage_exports, unstorage_star);
77
- import {
78
- createStorage,
79
- defineDriver
80
- } from "unstorage";
81
- import browser from "webextension-polyfill";
82
- import * as unstorage_star from "unstorage";
83
- var webExtensionDriver = defineDriver((opts) => {
84
- const checkPermission = () => {
85
- if (browser.storage == null)
86
- throw Error(
87
- "You must request the 'storage' permission to use webExtensionDriver"
88
- );
89
- };
90
- const _storageListener = (changes) => {
91
- Object.entries(changes).forEach(([key, { newValue }]) => {
92
- _listeners.forEach((callback) => {
93
- callback(newValue ? "update" : "remove", key);
94
- });
95
- });
96
- };
97
- const _listeners = /* @__PURE__ */ new Set();
98
- return {
99
- name: "web-extension:" + opts.storageArea,
100
- async hasItem(key) {
101
- checkPermission();
102
- const res = await browser.storage[opts.storageArea].get(key);
103
- return res[key] != null;
104
- },
105
- async getItem(key) {
106
- checkPermission();
107
- const res = await browser.storage[opts.storageArea].get(key);
108
- return res[key] ?? null;
109
- },
110
- async getItems(items) {
111
- checkPermission();
112
- const res = await browser.storage[opts.storageArea].get(
113
- items.map((item) => item.key)
114
- );
115
- return items.map((item) => ({
116
- key: item.key,
117
- value: res[item.key] ?? null
118
- }));
119
- },
120
- async setItem(key, value) {
121
- checkPermission();
122
- await browser.storage[opts.storageArea].set({ [key]: value ?? null });
123
- },
124
- async setItems(items) {
125
- checkPermission();
126
- const map = items.reduce((map2, item) => {
127
- map2[item.key] = item.value ?? null;
128
- return map2;
129
- }, {});
130
- await browser.storage[opts.storageArea].set(map);
131
- },
132
- async removeItem(key) {
133
- checkPermission();
134
- await browser.storage[opts.storageArea].remove(key);
135
- },
136
- async getKeys() {
137
- checkPermission();
138
- const all = await browser.storage[opts.storageArea].get();
139
- return Object.keys(all);
140
- },
141
- async clear() {
142
- checkPermission();
143
- await browser.storage[opts.storageArea].clear();
144
- },
145
- watch(callback) {
146
- checkPermission();
147
- _listeners.add(callback);
148
- if (_listeners.size === 1) {
149
- browser.storage[opts.storageArea].onChanged.addListener(
150
- _storageListener
151
- );
152
- }
153
- return () => {
154
- _listeners.delete(callback);
155
- if (_listeners.size === 0) {
156
- browser.storage[opts.storageArea].onChanged.removeListener(
157
- _storageListener
158
- );
159
- }
160
- };
161
- }
162
- };
163
- });
164
- function createWebExtensionStorage() {
165
- const storage2 = createStorage();
166
- storage2.mount("local", webExtensionDriver({ storageArea: "local" }));
167
- storage2.mount("session", webExtensionDriver({ storageArea: "session" }));
168
- storage2.mount("sync", webExtensionDriver({ storageArea: "sync" }));
169
- storage2.mount("managed", webExtensionDriver({ storageArea: "managed" }));
170
- return storage2;
171
- }
172
- var storage = createWebExtensionStorage();
50
+ import browser3 from "webextension-polyfill";
173
51
 
174
52
  // src/client/utils/keep-service-worker-alive.ts
175
- import browser2 from "webextension-polyfill";
53
+ import browser from "webextension-polyfill";
176
54
  function keepServiceWorkerAlive() {
177
55
  setInterval(async () => {
178
- await browser2.runtime.getPlatformInfo();
56
+ await browser.runtime.getPlatformInfo();
179
57
  }, 5e3);
180
58
  }
181
59
 
182
60
  // src/client/utils/reload-content-scripts.ts
183
- import browser3 from "webextension-polyfill";
61
+ import browser2 from "webextension-polyfill";
184
62
  import { MatchPattern } from "@webext-core/match-patterns";
185
63
  function reloadContentScript(contentScript) {
186
- const manifest = browser3.runtime.getManifest();
64
+ const manifest = browser2.runtime.getManifest();
187
65
  if (manifest.manifest_version == 2) {
188
66
  void reloadContentScriptMv2(contentScript);
189
67
  } else {
@@ -193,17 +71,17 @@ function reloadContentScript(contentScript) {
193
71
  async function reloadContentScriptMv3(contentScript) {
194
72
  const id = `wxt:${contentScript.js[0]}`;
195
73
  logger.log("Reloading content script:", contentScript);
196
- const registered = await browser3.scripting.getRegisteredContentScripts();
74
+ const registered = await browser2.scripting.getRegisteredContentScripts();
197
75
  logger.debug("Existing scripts:", registered);
198
76
  const existing = registered.find((cs) => cs.id === id);
199
77
  if (existing) {
200
78
  logger.debug("Updating content script", existing);
201
- await browser3.scripting.updateContentScripts([{ ...contentScript, id }]);
79
+ await browser2.scripting.updateContentScripts([{ ...contentScript, id }]);
202
80
  } else {
203
81
  logger.debug("Registering new content script...");
204
- await browser3.scripting.registerContentScripts([{ ...contentScript, id }]);
82
+ await browser2.scripting.registerContentScripts([{ ...contentScript, id }]);
205
83
  }
206
- const allTabs = await browser3.tabs.query({});
84
+ const allTabs = await browser2.tabs.query({});
207
85
  const matchPatterns = contentScript.matches.map(
208
86
  (match) => new MatchPattern(match)
209
87
  );
@@ -213,7 +91,7 @@ async function reloadContentScriptMv3(contentScript) {
213
91
  return false;
214
92
  return !!matchPatterns.find((pattern) => pattern.includes(url));
215
93
  });
216
- await Promise.all(matchingTabs.map((tab) => browser3.tabs.reload(tab.id)));
94
+ await Promise.all(matchingTabs.map((tab) => browser2.tabs.reload(tab.id)));
217
95
  }
218
96
  async function reloadContentScriptMv2(contentScript) {
219
97
  throw Error("TODO: reloadContentScriptMv2");
@@ -224,7 +102,7 @@ if (__COMMAND__ === "serve") {
224
102
  try {
225
103
  const ws = setupWebSocket((message) => {
226
104
  if (message.event === "wxt:reload-extension")
227
- browser4.runtime.reload();
105
+ browser3.runtime.reload();
228
106
  if (message.event === "wxt:reload-content-script" && message.data != null)
229
107
  reloadContentScript(message.data);
230
108
  });
@@ -240,11 +118,6 @@ if (__COMMAND__ === "serve") {
240
118
  }
241
119
  }
242
120
  try {
243
- if (import.meta.env.DEV) {
244
- globalThis.wxt = {
245
- storage
246
- };
247
- }
248
121
  const res = definition.main();
249
122
  if (res instanceof Promise) {
250
123
  console.warn(
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "wxt",
3
3
  "type": "module",
4
- "version": "0.10.0",
4
+ "version": "0.10.2",
5
5
  "description": "Next gen framework for developing web extensions",
6
6
  "engines": {
7
7
  "node": ">=18",
package/dist/cli.d.cts DELETED
@@ -1,2 +0,0 @@
1
-
2
- export { }