wxt 0.12.2-alpha1 → 0.12.2-alpha2

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.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import {
2
2
  browser
3
3
  } from "./chunk-FNTE2L27.js";
4
- import "./chunk-M6BUQN66.js";
5
4
  export {
6
5
  browser
7
6
  };
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "0.12.2-alpha1";
2
+ var version = "0.12.2-alpha2";
3
3
 
4
4
  // src/core/utils/arrays.ts
5
5
  function every(array, predicate) {
package/dist/cli.d.ts ADDED
@@ -0,0 +1,2 @@
1
+
2
+ export { }
package/dist/cli.js CHANGED
@@ -4,7 +4,7 @@ import "./chunk-VBXJIVYU.js";
4
4
  import cac from "cac";
5
5
 
6
6
  // package.json
7
- var version = "0.12.2-alpha1";
7
+ var version = "0.12.2-alpha2";
8
8
 
9
9
  // src/core/utils/fs.ts
10
10
  import fs from "fs-extra";
@@ -2933,12 +2933,6 @@ async function cloneProject({
2933
2933
  ).catch(
2934
2934
  (err) => consola5.warn("Failed to move _gitignore to .gitignore:", err)
2935
2935
  );
2936
- if (packageManager === "pnpm") {
2937
- await fs14.writeFile(
2938
- path6.join(directory, ".npmrc"),
2939
- "shamefully-hoist=true\n"
2940
- );
2941
- }
2942
2936
  spinner.succeed();
2943
2937
  } catch (err) {
2944
2938
  spinner.fail();
package/dist/client.js CHANGED
@@ -1,9 +1,8 @@
1
1
  import {
2
2
  browser
3
3
  } from "./chunk-FNTE2L27.js";
4
- import "./chunk-M6BUQN66.js";
5
4
 
6
- // src/client/utils/logger.ts
5
+ // src/sandbox/utils/logger.ts
7
6
  function print(method, ...args) {
8
7
  if (import.meta.env.MODE === "production")
9
8
  return;
package/dist/index.cjs CHANGED
@@ -4334,7 +4334,7 @@ function getChunkSortWeight(filename) {
4334
4334
  var import_picocolors3 = __toESM(require("picocolors"), 1);
4335
4335
 
4336
4336
  // package.json
4337
- var version = "0.12.2-alpha1";
4337
+ var version = "0.12.2-alpha2";
4338
4338
 
4339
4339
  // src/core/utils/log/printHeader.ts
4340
4340
  var import_consola2 = require("consola");
@@ -5369,12 +5369,6 @@ async function cloneProject({
5369
5369
  ).catch(
5370
5370
  (err) => import_consola5.consola.warn("Failed to move _gitignore to .gitignore:", err)
5371
5371
  );
5372
- if (packageManager === "pnpm") {
5373
- await import_fs_extra14.default.writeFile(
5374
- import_node_path18.default.join(directory, ".npmrc"),
5375
- "shamefully-hoist=true\n"
5376
- );
5377
- }
5378
5372
  spinner.succeed();
5379
5373
  } catch (err) {
5380
5374
  spinner.fail();
package/dist/index.d.cts CHANGED
@@ -62,6 +62,6 @@ declare function prepare(config: InlineConfig): Promise<void>;
62
62
  */
63
63
  declare function zip(config?: InlineConfig): Promise<string[]>;
64
64
 
65
- var version = "0.12.2-alpha1";
65
+ var version = "0.12.2-alpha2";
66
66
 
67
67
  export { BuildOutput, ExtensionRunnerConfig, InlineConfig, UserConfig, WxtDevServer, build, clean, createServer, defineConfig, defineRunnerConfig, initialize, prepare, version, zip };
package/dist/index.d.ts CHANGED
@@ -62,6 +62,6 @@ declare function prepare(config: InlineConfig): Promise<void>;
62
62
  */
63
63
  declare function zip(config?: InlineConfig): Promise<string[]>;
64
64
 
65
- var version = "0.12.2-alpha1";
65
+ var version = "0.12.2-alpha2";
66
66
 
67
67
  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-UX5XHE4P.js";
18
+ } from "./chunk-LDULNXMK.js";
19
19
  import "./chunk-VBXJIVYU.js";
20
20
 
21
21
  // src/core/build.ts
@@ -457,12 +457,6 @@ async function cloneProject({
457
457
  ).catch(
458
458
  (err) => consola3.warn("Failed to move _gitignore to .gitignore:", err)
459
459
  );
460
- if (packageManager === "pnpm") {
461
- await fs2.writeFile(
462
- path2.join(directory, ".npmrc"),
463
- "shamefully-hoist=true\n"
464
- );
465
- }
466
460
  spinner.succeed();
467
461
  } catch (err) {
468
462
  spinner.fail();
package/dist/sandbox.js CHANGED
@@ -1,16 +1,3 @@
1
- import {
2
- __export,
3
- __reExport
4
- } from "./chunk-M6BUQN66.js";
5
-
6
- // src/sandbox/index.ts
7
- var sandbox_exports = {};
8
- __export(sandbox_exports, {
9
- defineBackground: () => defineBackground,
10
- defineContentScript: () => defineContentScript,
11
- defineUnlistedScript: () => defineUnlistedScript
12
- });
13
-
14
1
  // src/sandbox/define-unlisted-script.ts
15
2
  function defineUnlistedScript(arg) {
16
3
  if (typeof arg === "function")
@@ -30,13 +17,8 @@ function defineContentScript(definition) {
30
17
  return definition;
31
18
  }
32
19
 
33
- // src/sandbox/match-patterns.ts
34
- var match_patterns_exports = {};
35
- __reExport(match_patterns_exports, match_patterns_star);
36
- import * as match_patterns_star from "@webext-core/match-patterns";
37
-
38
20
  // src/sandbox/index.ts
39
- __reExport(sandbox_exports, match_patterns_exports);
21
+ export * from "@webext-core/match-patterns";
40
22
  export {
41
23
  defineBackground,
42
24
  defineContentScript,
package/dist/testing.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  unimport,
7
7
  webextensionPolyfillAlias,
8
8
  webextensionPolyfillInlineDeps
9
- } from "./chunk-UX5XHE4P.js";
9
+ } from "./chunk-LDULNXMK.js";
10
10
  import "./chunk-VBXJIVYU.js";
11
11
 
12
12
  // src/testing/fake-browser.ts
@@ -1,25 +1,7 @@
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
 
22
- // src/client/utils/logger.ts
4
+ // src/sandbox/utils/logger.ts
23
5
  function print(method, ...args) {
24
6
  if (import.meta.env.MODE === "production")
25
7
  return;
@@ -37,7 +19,7 @@ var logger = {
37
19
  error: (...args) => print(console.error, ...args)
38
20
  };
39
21
 
40
- // src/client/utils/setup-web-socket.ts
22
+ // src/virtual/utils/setup-web-socket.ts
41
23
  function setupWebSocket(onMessage) {
42
24
  const serverUrl = `${__DEV_SERVER_PROTOCOL__}//${__DEV_SERVER_HOSTNAME__}:${__DEV_SERVER_PORT__}`;
43
25
  logger.debug("Connecting to dev server @", serverUrl);
@@ -64,55 +46,22 @@ function setupWebSocket(onMessage) {
64
46
  return ws;
65
47
  }
66
48
 
67
- // src/browser.ts
68
- import originalBrowser from "webextension-polyfill";
69
- var browser = originalBrowser;
49
+ // src/virtual/background-entrypoint.ts
50
+ import { browser as browser3 } from "wxt/browser";
70
51
 
71
- // src/client/utils/keep-service-worker-alive.ts
52
+ // src/virtual/utils/keep-service-worker-alive.ts
53
+ import { browser } from "wxt/browser";
72
54
  function keepServiceWorkerAlive() {
73
55
  setInterval(async () => {
74
56
  await browser.runtime.getPlatformInfo();
75
57
  }, 5e3);
76
58
  }
77
59
 
78
- // src/sandbox/index.ts
79
- var sandbox_exports = {};
80
- __export(sandbox_exports, {
81
- defineBackground: () => defineBackground,
82
- defineContentScript: () => defineContentScript,
83
- defineUnlistedScript: () => defineUnlistedScript
84
- });
85
-
86
- // src/sandbox/define-unlisted-script.ts
87
- function defineUnlistedScript(arg) {
88
- if (typeof arg === "function")
89
- return { main: arg };
90
- return arg;
91
- }
92
-
93
- // src/sandbox/define-background.ts
94
- function defineBackground(arg) {
95
- if (typeof arg === "function")
96
- return { main: arg };
97
- return arg;
98
- }
99
-
100
- // src/sandbox/define-content-script.ts
101
- function defineContentScript(definition2) {
102
- return definition2;
103
- }
104
-
105
- // src/sandbox/match-patterns.ts
106
- var match_patterns_exports = {};
107
- __reExport(match_patterns_exports, match_patterns_star);
108
- import * as match_patterns_star from "@webext-core/match-patterns";
109
-
110
- // src/sandbox/index.ts
111
- __reExport(sandbox_exports, match_patterns_exports);
112
-
113
- // src/client/utils/reload-content-scripts.ts
60
+ // src/virtual/utils/reload-content-scripts.ts
61
+ import { browser as browser2 } from "wxt/browser";
62
+ import { MatchPattern } from "wxt/sandbox";
114
63
  function reloadContentScript(contentScript) {
115
- const manifest = browser.runtime.getManifest();
64
+ const manifest = browser2.runtime.getManifest();
116
65
  if (manifest.manifest_version == 2) {
117
66
  void reloadContentScriptMv2(contentScript);
118
67
  } else {
@@ -122,19 +71,19 @@ function reloadContentScript(contentScript) {
122
71
  async function reloadContentScriptMv3(contentScript) {
123
72
  const id = `wxt:${contentScript.js[0]}`;
124
73
  logger.log("Reloading content script:", contentScript);
125
- const registered = await browser.scripting.getRegisteredContentScripts();
74
+ const registered = await browser2.scripting.getRegisteredContentScripts();
126
75
  logger.debug("Existing scripts:", registered);
127
76
  const existing = registered.find((cs) => cs.id === id);
128
77
  if (existing) {
129
78
  logger.debug("Updating content script", existing);
130
- await browser.scripting.updateContentScripts([{ ...contentScript, id }]);
79
+ await browser2.scripting.updateContentScripts([{ ...contentScript, id }]);
131
80
  } else {
132
81
  logger.debug("Registering new content script...");
133
- await browser.scripting.registerContentScripts([{ ...contentScript, id }]);
82
+ await browser2.scripting.registerContentScripts([{ ...contentScript, id }]);
134
83
  }
135
- const allTabs = await browser.tabs.query({});
84
+ const allTabs = await browser2.tabs.query({});
136
85
  const matchPatterns = contentScript.matches.map(
137
- (match) => new sandbox_exports.MatchPattern(match)
86
+ (match) => new MatchPattern(match)
138
87
  );
139
88
  const matchingTabs = allTabs.filter((tab) => {
140
89
  const url = tab.url;
@@ -142,7 +91,7 @@ async function reloadContentScriptMv3(contentScript) {
142
91
  return false;
143
92
  return !!matchPatterns.find((pattern) => pattern.includes(url));
144
93
  });
145
- await Promise.all(matchingTabs.map((tab) => browser.tabs.reload(tab.id)));
94
+ await Promise.all(matchingTabs.map((tab) => browser2.tabs.reload(tab.id)));
146
95
  }
147
96
  async function reloadContentScriptMv2(contentScript) {
148
97
  throw Error("TODO: reloadContentScriptMv2");
@@ -153,7 +102,7 @@ if (__COMMAND__ === "serve") {
153
102
  try {
154
103
  const ws = setupWebSocket((message) => {
155
104
  if (message.event === "wxt:reload-extension")
156
- browser.runtime.reload();
105
+ browser3.runtime.reload();
157
106
  if (message.event === "wxt:reload-content-script" && message.data != null)
158
107
  reloadContentScript(message.data);
159
108
  });
@@ -1,7 +1,7 @@
1
1
  // src/virtual/content-script-isolated-world-entrypoint.ts
2
2
  import definition from "virtual:user-content-script-isolated-world";
3
3
 
4
- // src/client/utils/logger.ts
4
+ // src/sandbox/utils/logger.ts
5
5
  function print(method, ...args) {
6
6
  if (import.meta.env.MODE === "production")
7
7
  return;
@@ -19,221 +19,8 @@ var logger = {
19
19
  error: (...args) => print(console.error, ...args)
20
20
  };
21
21
 
22
- // src/browser.ts
23
- import originalBrowser from "webextension-polyfill";
24
- var browser = originalBrowser;
25
-
26
- // src/client/content-scripts/custom-events.ts
27
- var WxtLocationChangeEvent = class _WxtLocationChangeEvent extends Event {
28
- constructor(newUrl, oldUrl) {
29
- super(_WxtLocationChangeEvent.EVENT_NAME, {});
30
- this.newUrl = newUrl;
31
- this.oldUrl = oldUrl;
32
- }
33
- static EVENT_NAME = getUniqueEventName("wxt:locationchange");
34
- };
35
- function getUniqueEventName(eventName) {
36
- const entrypointName = typeof __ENTRYPOINT__ === "undefined" ? "build" : __ENTRYPOINT__;
37
- return `${browser.runtime.id}:${entrypointName}:${eventName}`;
38
- }
39
-
40
- // src/client/content-scripts/location-watcher.ts
41
- function createLocationWatcher(ctx) {
42
- let interval;
43
- let oldUrl;
44
- return {
45
- /**
46
- * Ensure the location watcher is actively looking for URL changes. If it's already watching,
47
- * this is a noop.
48
- */
49
- run() {
50
- if (interval != null)
51
- return;
52
- oldUrl = new URL(location.href);
53
- interval = ctx.setInterval(() => {
54
- let newUrl = new URL(location.href);
55
- if (newUrl.href !== oldUrl.href) {
56
- window.dispatchEvent(new WxtLocationChangeEvent(newUrl, oldUrl));
57
- oldUrl = newUrl;
58
- }
59
- }, 1e3);
60
- }
61
- };
62
- }
63
-
64
- // src/client/content-scripts/content-script-context.ts
65
- var ContentScriptContext = class _ContentScriptContext {
66
- constructor(contentScriptName, options) {
67
- this.contentScriptName = contentScriptName;
68
- this.options = options;
69
- this.#abortController = new AbortController();
70
- if (this.#isTopFrame) {
71
- this.#stopOldScripts();
72
- }
73
- this.setTimeout(() => {
74
- this.#listenForNewerScripts();
75
- });
76
- }
77
- static SCRIPT_STARTED_MESSAGE_TYPE = "wxt:content-script-started";
78
- #isTopFrame = window.self === window.top;
79
- #abortController;
80
- #locationWatcher = createLocationWatcher(this);
81
- get signal() {
82
- return this.#abortController.signal;
83
- }
84
- abort(reason) {
85
- return this.#abortController.abort(reason);
86
- }
87
- get isInvalid() {
88
- if (browser.runtime.id == null) {
89
- this.notifyInvalidated();
90
- }
91
- return this.signal.aborted;
92
- }
93
- get isValid() {
94
- return !this.isInvalid;
95
- }
96
- /**
97
- * Add a listener that is called when the content script's context is invalidated.
98
- *
99
- * @returns A function to remove the listener.
100
- *
101
- * @example
102
- * browser.runtime.onMessage.addListener(cb);
103
- * const removeInvalidatedListener = ctx.onInvalidated(() => {
104
- * browser.runtime.onMessage.removeListener(cb);
105
- * })
106
- * // ...
107
- * removeInvalidatedListener();
108
- */
109
- onInvalidated(cb) {
110
- this.signal.addEventListener("abort", cb);
111
- return () => this.signal.removeEventListener("abort", cb);
112
- }
113
- /**
114
- * Return a promise that never resolves. Useful if you have an async function that shouldn't run
115
- * after the context is expired.
116
- *
117
- * @example
118
- * const getValueFromStorage = async () => {
119
- * if (ctx.isInvalid) return ctx.block();
120
- *
121
- * // ...
122
- * }
123
- */
124
- block() {
125
- return new Promise(() => {
126
- });
127
- }
128
- /**
129
- * Wrapper around `window.setInterval` that automatically clears the interval when invalidated.
130
- */
131
- setInterval(handler, timeout) {
132
- const id = setInterval(() => {
133
- if (this.isValid)
134
- handler();
135
- }, timeout);
136
- this.onInvalidated(() => clearInterval(id));
137
- return id;
138
- }
139
- /**
140
- * Wrapper around `window.setTimeout` that automatically clears the interval when invalidated.
141
- */
142
- setTimeout(handler, timeout) {
143
- const id = setTimeout(() => {
144
- if (this.isValid)
145
- handler();
146
- }, timeout);
147
- this.onInvalidated(() => clearTimeout(id));
148
- return id;
149
- }
150
- /**
151
- * Wrapper around `window.requestAnimationFrame` that automatically cancels the request when
152
- * invalidated.
153
- */
154
- requestAnimationFrame(callback) {
155
- const id = requestAnimationFrame((...args) => {
156
- if (this.isValid)
157
- callback(...args);
158
- });
159
- this.onInvalidated(() => cancelAnimationFrame(id));
160
- return id;
161
- }
162
- /**
163
- * Wrapper around `window.requestIdleCallback` that automatically cancels the request when
164
- * invalidated.
165
- */
166
- requestIdleCallback(callback, options) {
167
- const id = requestIdleCallback((...args) => {
168
- if (!this.signal.aborted)
169
- callback(...args);
170
- }, options);
171
- this.onInvalidated(() => cancelIdleCallback(id));
172
- return id;
173
- }
174
- /**
175
- * Call `target.addEventListener` and remove the event listener when the context is invalidated.
176
- *
177
- * Includes additional events useful for content scripts:
178
- *
179
- * - `"wxt:locationchange"` - Triggered when HTML5 history mode is used to change URL. Content
180
- * scripts are not reloaded when navigating this way, so this can be used to reset the content
181
- * script state on URL change, or run custom code.
182
- *
183
- * @example
184
- * ctx.addEventListener(document, "visibilitychange", () => {
185
- * // ...
186
- * });
187
- * ctx.addEventListener(document, "wxt:locationchange", () => {
188
- * // ...
189
- * });
190
- */
191
- addEventListener(target, type, handler, options) {
192
- if (type === "wxt:locationchange") {
193
- if (this.isValid)
194
- this.#locationWatcher.run();
195
- }
196
- target.addEventListener?.(
197
- type.startsWith("wxt:") ? getUniqueEventName(type) : type,
198
- // @ts-expect-error: Event don't match, but that's OK, EventTarget doesn't allow custom types in the callback
199
- handler,
200
- {
201
- ...options,
202
- signal: this.signal
203
- }
204
- );
205
- }
206
- /**
207
- * @internal
208
- * Abort the abort controller and execute all `onInvalidated` listeners.
209
- */
210
- notifyInvalidated() {
211
- this.abort("Content script context invalidated");
212
- logger.debug(
213
- `Content script "${this.contentScriptName}" context invalidated`
214
- );
215
- }
216
- #stopOldScripts() {
217
- window.postMessage(
218
- {
219
- event: _ContentScriptContext.SCRIPT_STARTED_MESSAGE_TYPE,
220
- contentScriptName: this.contentScriptName
221
- },
222
- "*"
223
- );
224
- }
225
- #listenForNewerScripts() {
226
- const cb = (event) => {
227
- if (event.data?.type === _ContentScriptContext.SCRIPT_STARTED_MESSAGE_TYPE && event.data?.contentScriptName === this.contentScriptName) {
228
- this.notifyInvalidated();
229
- }
230
- };
231
- addEventListener("message", cb);
232
- this.onInvalidated(() => removeEventListener("message", cb));
233
- }
234
- };
235
-
236
22
  // src/virtual/content-script-isolated-world-entrypoint.ts
23
+ import { ContentScriptContext } from "wxt/client";
237
24
  (async () => {
238
25
  try {
239
26
  const { main, ...options } = definition;
@@ -1,7 +1,7 @@
1
1
  // src/virtual/content-script-main-world-entrypoint.ts
2
2
  import definition from "virtual:user-content-script-main-world";
3
3
 
4
- // src/client/utils/logger.ts
4
+ // src/sandbox/utils/logger.ts
5
5
  function print(method, ...args) {
6
6
  if (import.meta.env.MODE === "production")
7
7
  return;
@@ -1,146 +1,6 @@
1
- // src/testing/fake-browser.ts
2
- import { fakeBrowser } from "@webext-core/fake-browser";
3
-
4
- // src/core/utils/paths.ts
5
- import normalize from "normalize-path";
6
- var CSS_EXTENSIONS = ["css", "scss", "sass", "less", "styl", "stylus"];
7
- var CSS_EXTENSIONS_PATTERN = `+(${CSS_EXTENSIONS.join("|")})`;
8
-
9
- // src/core/builders/vite/plugins/devHtmlPrerender.ts
10
- import { parseHTML } from "linkedom";
11
-
12
- // src/core/builders/vite/plugins/multipageMove.ts
13
- import fs, { ensureDir } from "fs-extra";
14
-
15
- // src/core/builders/vite/plugins/unimport.ts
16
- import { createUnimport } from "unimport";
17
-
18
- // src/core/utils/unimport.ts
19
- import { defu } from "defu";
20
-
21
- // src/core/builders/vite/plugins/virtualEntrypoint.ts
22
- import fs2 from "fs-extra";
23
-
24
- // src/core/utils/constants.ts
25
- var VIRTUAL_NOOP_BACKGROUND_MODULE_ID = "virtual:user-background";
26
-
27
- // src/core/builders/vite/plugins/bundleAnalysis.ts
28
- import { visualizer } from "rollup-plugin-visualizer";
29
-
30
- // src/core/utils/fs.ts
31
- import fs3 from "fs-extra";
32
- import glob from "fast-glob";
33
-
34
- // src/core/utils/building/build-entrypoints.ts
35
- import fs4 from "fs-extra";
36
- import pc from "picocolors";
37
-
38
- // src/core/utils/building/find-entrypoints.ts
39
- import fs5 from "fs-extra";
40
- import { minimatch } from "minimatch";
41
- import { parseHTML as parseHTML2 } from "linkedom";
42
- import JSON5 from "json5";
43
- import glob2 from "fast-glob";
44
- var PATH_GLOB_TO_TYPE_MAP = {
45
- "sandbox.html": "sandbox",
46
- "sandbox/index.html": "sandbox",
47
- "*.sandbox.html": "sandbox",
48
- "*.sandbox/index.html": "sandbox",
49
- "bookmarks.html": "bookmarks",
50
- "bookmarks/index.html": "bookmarks",
51
- "history.html": "history",
52
- "history/index.html": "history",
53
- "newtab.html": "newtab",
54
- "newtab/index.html": "newtab",
55
- "sidepanel.html": "sidepanel",
56
- "sidepanel/index.html": "sidepanel",
57
- "*.sidepanel.html": "sidepanel",
58
- "*.sidepanel/index.html": "sidepanel",
59
- "devtools.html": "devtools",
60
- "devtools/index.html": "devtools",
61
- "background.[jt]s": "background",
62
- "background/index.[jt]s": "background",
63
- [VIRTUAL_NOOP_BACKGROUND_MODULE_ID]: "background",
64
- "content.[jt]s?(x)": "content-script",
65
- "content/index.[jt]s?(x)": "content-script",
66
- "*.content.[jt]s?(x)": "content-script",
67
- "*.content/index.[jt]s?(x)": "content-script",
68
- [`content.${CSS_EXTENSIONS_PATTERN}`]: "content-script-style",
69
- [`*.content.${CSS_EXTENSIONS_PATTERN}`]: "content-script-style",
70
- [`content/index.${CSS_EXTENSIONS_PATTERN}`]: "content-script-style",
71
- [`*.content/index.${CSS_EXTENSIONS_PATTERN}`]: "content-script-style",
72
- "popup.html": "popup",
73
- "popup/index.html": "popup",
74
- "options.html": "options",
75
- "options/index.html": "options",
76
- "*.html": "unlisted-page",
77
- "*/index.html": "unlisted-page",
78
- "*.[jt]s?(x)": "unlisted-script",
79
- "*/index.[jt]s?(x)": "unlisted-script",
80
- [`*.${CSS_EXTENSIONS_PATTERN}`]: "unlisted-style",
81
- [`*/index.${CSS_EXTENSIONS_PATTERN}`]: "unlisted-style"
82
- };
83
-
84
- // src/core/utils/building/generate-wxt-dir.ts
85
- import { createUnimport as createUnimport2 } from "unimport";
86
- import fs6 from "fs-extra";
87
-
88
- // src/core/utils/building/get-internal-config.ts
89
- import { loadConfig } from "c12";
90
-
91
- // src/core/utils/cache.ts
92
- import fs7, { ensureDir as ensureDir2 } from "fs-extra";
93
-
94
- // src/core/utils/building/get-internal-config.ts
95
- import consola, { LogLevels } from "consola";
96
- import defu2 from "defu";
97
-
98
- // src/core/utils/building/import-entrypoint.ts
99
- import createJITI from "jiti";
100
- import { createUnimport as createUnimport3 } from "unimport";
101
- import fs8 from "fs-extra";
102
- import { transformSync } from "esbuild";
103
-
104
- // src/core/utils/building/internal-build.ts
105
- import pc4 from "picocolors";
106
- import fs12 from "fs-extra";
107
-
108
- // src/core/utils/log/printFileList.ts
109
- import pc2 from "picocolors";
110
- import fs9 from "fs-extra";
111
- import { filesize } from "filesize";
112
- var DEFAULT_COLOR = pc2.blue;
113
- var CHUNK_COLORS = {
114
- ".js.map": pc2.gray,
115
- ".cjs.map": pc2.gray,
116
- ".mjs.map": pc2.gray,
117
- ".html": pc2.green,
118
- ".css": pc2.magenta,
119
- ".js": pc2.cyan,
120
- ".cjs": pc2.cyan,
121
- ".mjs": pc2.cyan,
122
- ".zip": pc2.yellow
123
- };
124
-
125
- // src/core/utils/log/printHeader.ts
126
- import pc3 from "picocolors";
127
- import { consola as consola2 } from "consola";
128
-
129
- // src/core/utils/building/internal-build.ts
130
- import glob3 from "fast-glob";
131
-
132
- // src/core/utils/manifest.ts
133
- import fs11 from "fs-extra";
134
-
135
- // src/core/utils/package.ts
136
- import fs10 from "fs-extra";
137
-
138
- // src/core/utils/manifest.ts
139
- import { produce } from "immer";
140
- import defu3 from "defu";
141
-
142
1
  // src/virtual/mock-browser.ts
143
- var mock_browser_default = fakeBrowser;
2
+ import { fakeBrowser as mockBrowser } from "wxt/testing";
3
+ var mock_browser_default = mockBrowser;
144
4
  export {
145
5
  mock_browser_default as default
146
6
  };
@@ -1,4 +1,4 @@
1
- // src/client/utils/logger.ts
1
+ // src/sandbox/utils/logger.ts
2
2
  function print(method, ...args) {
3
3
  if (import.meta.env.MODE === "production")
4
4
  return;
@@ -16,7 +16,7 @@ var logger = {
16
16
  error: (...args) => print(console.error, ...args)
17
17
  };
18
18
 
19
- // src/client/utils/setup-web-socket.ts
19
+ // src/virtual/utils/setup-web-socket.ts
20
20
  function setupWebSocket(onMessage) {
21
21
  const serverUrl = `${__DEV_SERVER_PROTOCOL__}//${__DEV_SERVER_HOSTNAME__}:${__DEV_SERVER_PORT__}`;
22
22
  logger.debug("Connecting to dev server @", serverUrl);
@@ -1,7 +1,7 @@
1
1
  // src/virtual/unlisted-script-entrypoint.ts
2
2
  import definition from "virtual:user-unlisted-script";
3
3
 
4
- // src/client/utils/logger.ts
4
+ // src/sandbox/utils/logger.ts
5
5
  function print(method, ...args) {
6
6
  if (import.meta.env.MODE === "production")
7
7
  return;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "wxt",
3
3
  "type": "module",
4
- "version": "0.12.2-alpha1",
4
+ "version": "0.12.2-alpha2",
5
5
  "description": "Next gen framework for developing web extensions",
6
6
  "engines": {
7
7
  "node": ">=18",
@@ -161,7 +161,9 @@
161
161
  "lint": "run-p -c -s lint:*",
162
162
  "lint:eslint": "echo 'ESLint: TODO'",
163
163
  "lint:package": "publint",
164
- "compile": "tsc --noEmit",
164
+ "compile": "run-s -c compile:*",
165
+ "compile:wxt": "tsc --noEmit",
166
+ "compile:virtual": "tsc --noEmit",
165
167
  "test": "vitest",
166
168
  "test:coverage": "vitest run --coverage",
167
169
  "prepublish": "pnpm -s build",
@@ -1,22 +0,0 @@
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
- export {
20
- __export,
21
- __reExport
22
- };