wxt 0.14.6 → 0.14.7

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.14.6";
2
+ var version = "0.14.7";
3
3
 
4
4
  // src/core/utils/arrays.ts
5
5
  function every(array, predicate) {
@@ -173,9 +173,14 @@ async function buildEntrypoints(groups, config, spinner) {
173
173
  const steps = [];
174
174
  for (let i = 0; i < groups.length; i++) {
175
175
  const group = groups[i];
176
- const groupNames = [group].flat().map((e) => e.name).join(pc.dim(", "));
177
- spinner.text = pc.dim(`[${i + 1}/${groups.length}]`) + ` ${groupNames}`;
178
- steps.push(await config.builder.build(group));
176
+ const groupNames = [group].flat().map((e) => e.name);
177
+ const groupNameColored = groupNames.join(pc.dim(", "));
178
+ spinner.text = pc.dim(`[${i + 1}/${groups.length}]`) + ` ${groupNameColored}`;
179
+ try {
180
+ steps.push(await config.builder.build(group));
181
+ } catch (err) {
182
+ throw Error(`Failed to build ${groupNames.join(", ")}`, { cause: err });
183
+ }
179
184
  }
180
185
  const publicAssets = await copyPublicDirectory(config);
181
186
  return { publicAssets, steps };
@@ -1525,15 +1530,15 @@ async function importEntrypointFile(path6, config) {
1525
1530
  const res = await jiti(path6);
1526
1531
  return res.default;
1527
1532
  } catch (err) {
1533
+ const filePath = relative4(config.root, path6);
1528
1534
  if (err instanceof ReferenceError) {
1529
1535
  const variableName = err.message.replace(" is not defined", "");
1530
- const filePath = relative4(config.root, path6);
1531
1536
  throw Error(
1532
1537
  `${filePath}: Cannot use imported variable "${variableName}" outside the main function. See https://wxt.dev/guide/entrypoints.html#side-effects`,
1533
1538
  { cause: err }
1534
1539
  );
1535
1540
  } else {
1536
- throw err;
1541
+ throw Error(`Failed to load entrypoint: ${filePath}`, { cause: err });
1537
1542
  }
1538
1543
  }
1539
1544
  }
package/dist/cli.js CHANGED
@@ -5,7 +5,7 @@ import "./chunk-73I7FAJU.js";
5
5
  import cac from "cac";
6
6
 
7
7
  // package.json
8
- var version = "0.14.6";
8
+ var version = "0.14.7";
9
9
 
10
10
  // src/core/utils/fs.ts
11
11
  import fs from "fs-extra";
@@ -45,9 +45,14 @@ async function buildEntrypoints(groups, config, spinner) {
45
45
  const steps = [];
46
46
  for (let i = 0; i < groups.length; i++) {
47
47
  const group = groups[i];
48
- const groupNames = [group].flat().map((e) => e.name).join(pc.dim(", "));
49
- spinner.text = pc.dim(`[${i + 1}/${groups.length}]`) + ` ${groupNames}`;
50
- steps.push(await config.builder.build(group));
48
+ const groupNames = [group].flat().map((e) => e.name);
49
+ const groupNameColored = groupNames.join(pc.dim(", "));
50
+ spinner.text = pc.dim(`[${i + 1}/${groups.length}]`) + ` ${groupNameColored}`;
51
+ try {
52
+ steps.push(await config.builder.build(group));
53
+ } catch (err) {
54
+ throw Error(`Failed to build ${groupNames.join(", ")}`, { cause: err });
55
+ }
51
56
  }
52
57
  const publicAssets = await copyPublicDirectory(config);
53
58
  return { publicAssets, steps };
@@ -1842,15 +1847,15 @@ async function importEntrypointFile(path7, config) {
1842
1847
  const res = await jiti(path7);
1843
1848
  return res.default;
1844
1849
  } catch (err) {
1850
+ const filePath = relative5(config.root, path7);
1845
1851
  if (err instanceof ReferenceError) {
1846
1852
  const variableName = err.message.replace(" is not defined", "");
1847
- const filePath = relative5(config.root, path7);
1848
1853
  throw Error(
1849
1854
  `${filePath}: Cannot use imported variable "${variableName}" outside the main function. See https://wxt.dev/guide/entrypoints.html#side-effects`,
1850
1855
  { cause: err }
1851
1856
  );
1852
1857
  } else {
1853
- throw err;
1858
+ throw Error(`Failed to load entrypoint: ${filePath}`, { cause: err });
1854
1859
  }
1855
1860
  }
1856
1861
  }
package/dist/index.cjs CHANGED
@@ -2465,9 +2465,14 @@ async function buildEntrypoints(groups, config, spinner) {
2465
2465
  const steps = [];
2466
2466
  for (let i = 0; i < groups.length; i++) {
2467
2467
  const group = groups[i];
2468
- const groupNames = [group].flat().map((e) => e.name).join(import_picocolors.default.dim(", "));
2469
- spinner.text = import_picocolors.default.dim(`[${i + 1}/${groups.length}]`) + ` ${groupNames}`;
2470
- steps.push(await config.builder.build(group));
2468
+ const groupNames = [group].flat().map((e) => e.name);
2469
+ const groupNameColored = groupNames.join(import_picocolors.default.dim(", "));
2470
+ spinner.text = import_picocolors.default.dim(`[${i + 1}/${groups.length}]`) + ` ${groupNameColored}`;
2471
+ try {
2472
+ steps.push(await config.builder.build(group));
2473
+ } catch (err) {
2474
+ throw Error(`Failed to build ${groupNames.join(", ")}`, { cause: err });
2475
+ }
2471
2476
  }
2472
2477
  const publicAssets = await copyPublicDirectory(config);
2473
2478
  return { publicAssets, steps };
@@ -4266,15 +4271,15 @@ async function importEntrypointFile(path10, config) {
4266
4271
  const res = await jiti(path10);
4267
4272
  return res.default;
4268
4273
  } catch (err) {
4274
+ const filePath = (0, import_node_path8.relative)(config.root, path10);
4269
4275
  if (err instanceof ReferenceError) {
4270
4276
  const variableName = err.message.replace(" is not defined", "");
4271
- const filePath = (0, import_node_path8.relative)(config.root, path10);
4272
4277
  throw Error(
4273
4278
  `${filePath}: Cannot use imported variable "${variableName}" outside the main function. See https://wxt.dev/guide/entrypoints.html#side-effects`,
4274
4279
  { cause: err }
4275
4280
  );
4276
4281
  } else {
4277
- throw err;
4282
+ throw Error(`Failed to load entrypoint: ${filePath}`, { cause: err });
4278
4283
  }
4279
4284
  }
4280
4285
  }
@@ -4400,7 +4405,7 @@ function getChunkSortWeight(filename) {
4400
4405
  var import_picocolors4 = __toESM(require("picocolors"), 1);
4401
4406
 
4402
4407
  // package.json
4403
- var version = "0.14.6";
4408
+ var version = "0.14.7";
4404
4409
 
4405
4410
  // src/core/utils/log/printHeader.ts
4406
4411
  var import_consola2 = require("consola");
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.14.6";
65
+ var version = "0.14.7";
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.14.6";
65
+ var version = "0.14.7";
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-XDRW7AKZ.js";
18
+ } from "./chunk-NDW6LQ5D.js";
19
19
  import "./chunk-VBXJIVYU.js";
20
20
 
21
21
  // src/core/build.ts
package/dist/storage.cjs CHANGED
@@ -295,10 +295,20 @@ function createStorage() {
295
295
  }
296
296
  function createDriver(storageArea) {
297
297
  const getStorageArea = () => {
298
- if (browser.storage == null)
298
+ if (browser.runtime == null) {
299
+ throw Error(
300
+ [
301
+ "'wxt/storage' must be loaded in a web extension environment",
302
+ "\n - If thrown during a build, see https://github.com/wxt-dev/wxt/issues/371",
303
+ " - If thrown during tests, mock 'wxt/browser' correctly. See https://wxt.dev/guide/testing.html\n"
304
+ ].join("\n")
305
+ );
306
+ }
307
+ if (browser.storage == null) {
299
308
  throw Error(
300
309
  "You must add the 'storage' permission to your manifest to use 'wxt/storage'"
301
310
  );
311
+ }
302
312
  return browser.storage[storageArea];
303
313
  };
304
314
  const watchListeners = /* @__PURE__ */ new Set();
package/dist/storage.js CHANGED
@@ -261,10 +261,20 @@ function createStorage() {
261
261
  }
262
262
  function createDriver(storageArea) {
263
263
  const getStorageArea = () => {
264
- if (browser.storage == null)
264
+ if (browser.runtime == null) {
265
+ throw Error(
266
+ [
267
+ "'wxt/storage' must be loaded in a web extension environment",
268
+ "\n - If thrown during a build, see https://github.com/wxt-dev/wxt/issues/371",
269
+ " - If thrown during tests, mock 'wxt/browser' correctly. See https://wxt.dev/guide/testing.html\n"
270
+ ].join("\n")
271
+ );
272
+ }
273
+ if (browser.storage == null) {
265
274
  throw Error(
266
275
  "You must add the 'storage' permission to your manifest to use 'wxt/storage'"
267
276
  );
277
+ }
268
278
  return browser.storage[storageArea];
269
279
  };
270
280
  const watchListeners = /* @__PURE__ */ new Set();
package/dist/testing.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  tsconfigPaths,
6
6
  unimport,
7
7
  webextensionPolyfillMock
8
- } from "./chunk-XDRW7AKZ.js";
8
+ } from "./chunk-NDW6LQ5D.js";
9
9
  import "./chunk-VBXJIVYU.js";
10
10
 
11
11
  // src/testing/fake-browser.ts
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "wxt",
3
3
  "type": "module",
4
- "version": "0.14.6",
4
+ "version": "0.14.7",
5
5
  "description": "Next gen framework for developing web extensions",
6
6
  "engines": {
7
7
  "node": ">=18",
@@ -114,7 +114,7 @@
114
114
  "rollup-plugin-visualizer": "^5.9.2",
115
115
  "unimport": "^3.4.0",
116
116
  "vite": "^5.0.0",
117
- "web-ext-run": "^0.1.0",
117
+ "web-ext-run": "^0.1.2",
118
118
  "webextension-polyfill": "^0.10.0",
119
119
  "zip-dir": "^2.0.0"
120
120
  },