wxt 0.8.4 → 0.8.6

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 (36) hide show
  1. package/README.md +3 -2
  2. package/dist/browser.js +3 -4
  3. package/dist/chunk-FNTE2L27.js +7 -0
  4. package/dist/chunk-VFZ5667B.js +2410 -0
  5. package/dist/chunk-YUG22S6W.js +38 -0
  6. package/dist/cli.cjs +3941 -3775
  7. package/dist/cli.d.cts +2 -0
  8. package/dist/client.d.ts +5 -171
  9. package/dist/client.js +128 -131
  10. package/dist/execa-WKZHVHC5.js +2043 -0
  11. package/dist/external-9107db91.d.ts +176 -0
  12. package/dist/external-cb0967d6.d.ts +572 -0
  13. package/dist/index.cjs +2727 -2355
  14. package/dist/index.d.cts +36 -583
  15. package/dist/index.d.ts +36 -583
  16. package/dist/index.js +330 -4484
  17. package/dist/sandbox.d.ts +2 -23
  18. package/dist/sandbox.js +1 -2
  19. package/dist/testing.cjs +161 -35
  20. package/dist/testing.d.cts +7 -273
  21. package/dist/testing.d.ts +7 -273
  22. package/dist/testing.js +12 -676
  23. package/dist/{virtual-modules → virtual}/background-entrypoint.js +6 -7
  24. package/dist/{virtual-modules → virtual}/content-script-entrypoint.js +4 -5
  25. package/dist/virtual/mock-browser.js +152 -0
  26. package/dist/{virtual-modules → virtual}/reload-html.js +2 -3
  27. package/dist/{virtual-modules → virtual}/unlisted-script-entrypoint.js +2 -3
  28. package/package.json +6 -5
  29. package/dist/index.cjs.map +0 -1
  30. package/dist/index.js.map +0 -1
  31. package/dist/virtual-modules/background-entrypoint.js.map +0 -1
  32. package/dist/virtual-modules/content-script-entrypoint.js.map +0 -1
  33. package/dist/virtual-modules/fake-browser.cjs +0 -31
  34. package/dist/virtual-modules/fake-browser.js +0 -8
  35. package/dist/virtual-modules/reload-html.js.map +0 -1
  36. package/dist/virtual-modules/unlisted-script-entrypoint.js.map +0 -1
@@ -1,4 +1,4 @@
1
- // src/client/virtual-modules/background-entrypoint.ts
1
+ // src/virtual/background-entrypoint.ts
2
2
  import definition from "virtual:user-background";
3
3
 
4
4
  // src/client/utils/logger.ts
@@ -19,7 +19,7 @@ var logger = {
19
19
  error: (...args) => print(console.error, ...args)
20
20
  };
21
21
 
22
- // src/client/utils/setupWebSocket.ts
22
+ // src/client/utils/setup-web-socket.ts
23
23
  function setupWebSocket(onMessage) {
24
24
  const serverUrl = `${__DEV_SERVER_PROTOCOL__}//${__DEV_SERVER_HOSTNAME__}:${__DEV_SERVER_PORT__}`;
25
25
  logger.debug("Connecting to dev server @", serverUrl);
@@ -46,10 +46,10 @@ function setupWebSocket(onMessage) {
46
46
  return ws;
47
47
  }
48
48
 
49
- // src/client/virtual-modules/background-entrypoint.ts
49
+ // src/virtual/background-entrypoint.ts
50
50
  import browser3 from "webextension-polyfill";
51
51
 
52
- // src/client/utils/keepServiceWorkerAlive.ts
52
+ // src/client/utils/keep-service-worker-alive.ts
53
53
  import browser from "webextension-polyfill";
54
54
  function keepServiceWorkerAlive() {
55
55
  setInterval(async () => {
@@ -57,7 +57,7 @@ function keepServiceWorkerAlive() {
57
57
  }, 5e3);
58
58
  }
59
59
 
60
- // src/client/utils/reloadContentScript.ts
60
+ // src/client/utils/reload-content-scripts.ts
61
61
  import browser2 from "webextension-polyfill";
62
62
  import { MatchPattern } from "@webext-core/match-patterns";
63
63
  function reloadContentScript(contentScript) {
@@ -97,7 +97,7 @@ async function reloadContentScriptMv2(contentScript) {
97
97
  throw Error("TODO: reloadContentScriptMv2");
98
98
  }
99
99
 
100
- // src/client/virtual-modules/background-entrypoint.ts
100
+ // src/virtual/background-entrypoint.ts
101
101
  if (__COMMAND__ === "serve") {
102
102
  try {
103
103
  const ws = setupWebSocket((message) => {
@@ -128,4 +128,3 @@ try {
128
128
  logger.error("The background crashed on startup!");
129
129
  throw err;
130
130
  }
131
- //# sourceMappingURL=background-entrypoint.js.map
@@ -1,4 +1,4 @@
1
- // src/client/virtual-modules/content-script-entrypoint.ts
1
+ // src/virtual/content-script-entrypoint.ts
2
2
  import definition from "virtual:user-content-script";
3
3
 
4
4
  // src/client/utils/logger.ts
@@ -19,11 +19,11 @@ var logger = {
19
19
  error: (...args) => print(console.error, ...args)
20
20
  };
21
21
 
22
- // src/client/browser.ts
22
+ // src/browser.ts
23
23
  import originalBrowser from "webextension-polyfill";
24
24
  var browser = originalBrowser;
25
25
 
26
- // src/client/utils/ContentScriptContext.ts
26
+ // src/client/content-scripts/content-script-context.ts
27
27
  var ContentScriptContext = class _ContentScriptContext {
28
28
  constructor(contentScriptName, options) {
29
29
  this.contentScriptName = contentScriptName;
@@ -179,7 +179,7 @@ var ContentScriptContext = class _ContentScriptContext {
179
179
  }
180
180
  };
181
181
 
182
- // src/client/virtual-modules/content-script-entrypoint.ts
182
+ // src/virtual/content-script-entrypoint.ts
183
183
  (async () => {
184
184
  try {
185
185
  const { main, ...options } = definition;
@@ -192,4 +192,3 @@ var ContentScriptContext = class _ContentScriptContext {
192
192
  );
193
193
  }
194
194
  })();
195
- //# sourceMappingURL=content-script-entrypoint.js.map
@@ -0,0 +1,152 @@
1
+ // src/testing/fake-browser.ts
2
+ import { fakeBrowser } from "@webext-core/fake-browser";
3
+
4
+ // src/core/utils/paths.ts
5
+ import * as vite from "vite";
6
+ var CSS_EXTENSIONS = ["css", "scss", "sass", "less", "styl", "stylus"];
7
+ var CSS_EXTENSIONS_PATTERN = `+(${CSS_EXTENSIONS.join("|")})`;
8
+
9
+ // src/core/vite-plugins/devHtmlPrerender.ts
10
+ import { parseHTML } from "linkedom";
11
+
12
+ // src/core/vite-plugins/multipageMove.ts
13
+ import fs, { ensureDir } from "fs-extra";
14
+
15
+ // src/core/vite-plugins/unimport.ts
16
+ import { createUnimport } from "unimport";
17
+
18
+ // src/core/utils/unimport.ts
19
+ import { mergeConfig } from "vite";
20
+
21
+ // src/core/vite-plugins/virtualEntrypoint.ts
22
+ import fs2 from "fs-extra";
23
+
24
+ // src/core/vite-plugins/noopBackground.ts
25
+ var VIRTUAL_NOOP_BACKGROUND_MODULE_ID = "virtual:user-background";
26
+
27
+ // src/core/vite-plugins/bundleAnalysis.ts
28
+ import { visualizer } from "rollup-plugin-visualizer";
29
+
30
+ // src/core/utils/building/build-entrypoints.ts
31
+ import * as vite2 from "vite";
32
+
33
+ // src/core/utils/fs.ts
34
+ import fs3 from "fs-extra";
35
+ import glob from "fast-glob";
36
+
37
+ // src/core/utils/building/build-entrypoints.ts
38
+ import fs4 from "fs-extra";
39
+ import pc from "picocolors";
40
+
41
+ // src/core/utils/building/find-entrypoints.ts
42
+ import fs5 from "fs-extra";
43
+ import { minimatch } from "minimatch";
44
+ import { parseHTML as parseHTML2 } from "linkedom";
45
+ import JSON5 from "json5";
46
+ import glob2 from "fast-glob";
47
+ var PATH_GLOB_TO_TYPE_MAP = {
48
+ "sandbox.html": "sandbox",
49
+ "sandbox/index.html": "sandbox",
50
+ "*.sandbox.html": "sandbox",
51
+ "*.sandbox/index.html": "sandbox",
52
+ "bookmarks.html": "bookmarks",
53
+ "bookmarks/index.html": "bookmarks",
54
+ "history.html": "history",
55
+ "history/index.html": "history",
56
+ "newtab.html": "newtab",
57
+ "newtab/index.html": "newtab",
58
+ "sidepanel.html": "sidepanel",
59
+ "sidepanel/index.html": "sidepanel",
60
+ "*.sidepanel.html": "sidepanel",
61
+ "*.sidepanel/index.html": "sidepanel",
62
+ "devtools.html": "devtools",
63
+ "devtools/index.html": "devtools",
64
+ "background.[jt]s": "background",
65
+ "background/index.[jt]s": "background",
66
+ [VIRTUAL_NOOP_BACKGROUND_MODULE_ID]: "background",
67
+ "content.[jt]s?(x)": "content-script",
68
+ "content/index.[jt]s?(x)": "content-script",
69
+ "*.content.[jt]s?(x)": "content-script",
70
+ "*.content/index.[jt]s?(x)": "content-script",
71
+ [`content.${CSS_EXTENSIONS_PATTERN}`]: "content-script-style",
72
+ [`*.content.${CSS_EXTENSIONS_PATTERN}`]: "content-script-style",
73
+ [`content/index.${CSS_EXTENSIONS_PATTERN}`]: "content-script-style",
74
+ [`*.content/index.${CSS_EXTENSIONS_PATTERN}`]: "content-script-style",
75
+ "popup.html": "popup",
76
+ "popup/index.html": "popup",
77
+ "options.html": "options",
78
+ "options/index.html": "options",
79
+ "*.html": "unlisted-page",
80
+ "*/index.html": "unlisted-page",
81
+ "*.[jt]s": "unlisted-script",
82
+ "*/index.ts": "unlisted-script",
83
+ [`*.${CSS_EXTENSIONS_PATTERN}`]: "unlisted-style",
84
+ [`*/index.${CSS_EXTENSIONS_PATTERN}`]: "unlisted-style",
85
+ // Don't warn about any files in subdirectories, like CSS or JS entrypoints for HTML files or tests
86
+ "*/**": "ignored"
87
+ };
88
+
89
+ // src/core/utils/building/generate-wxt-dir.ts
90
+ import { createUnimport as createUnimport2 } from "unimport";
91
+ import fs6 from "fs-extra";
92
+
93
+ // src/core/utils/building/get-internal-config.ts
94
+ import { loadConfig } from "c12";
95
+ import * as vite3 from "vite";
96
+
97
+ // src/core/utils/cache.ts
98
+ import fs7, { ensureDir as ensureDir2 } from "fs-extra";
99
+
100
+ // src/core/utils/building/get-internal-config.ts
101
+ import consola, { LogLevels } from "consola";
102
+
103
+ // src/core/utils/building/import-entrypoint.ts
104
+ import createJITI from "jiti";
105
+ import { createUnimport as createUnimport3 } from "unimport";
106
+ import fs8 from "fs-extra";
107
+ import { transformSync } from "esbuild";
108
+
109
+ // src/core/utils/building/internal-build.ts
110
+ import pc4 from "picocolors";
111
+ import * as vite5 from "vite";
112
+ import fs12 from "fs-extra";
113
+
114
+ // src/core/utils/log/printFileList.ts
115
+ import pc2 from "picocolors";
116
+ import fs9 from "fs-extra";
117
+ import { filesize } from "filesize";
118
+ var DEFAULT_COLOR = pc2.blue;
119
+ var CHUNK_COLORS = {
120
+ ".js.map": pc2.gray,
121
+ ".cjs.map": pc2.gray,
122
+ ".mjs.map": pc2.gray,
123
+ ".html": pc2.green,
124
+ ".css": pc2.magenta,
125
+ ".js": pc2.cyan,
126
+ ".cjs": pc2.cyan,
127
+ ".mjs": pc2.cyan,
128
+ ".zip": pc2.yellow
129
+ };
130
+
131
+ // src/core/utils/log/printHeader.ts
132
+ import pc3 from "picocolors";
133
+ import { consola as consola2 } from "consola";
134
+
135
+ // src/core/utils/building/internal-build.ts
136
+ import glob3 from "fast-glob";
137
+
138
+ // src/core/utils/manifest.ts
139
+ import fs11 from "fs-extra";
140
+
141
+ // src/core/utils/package.ts
142
+ import fs10 from "fs-extra";
143
+
144
+ // src/core/utils/manifest.ts
145
+ import { produce } from "immer";
146
+ import * as vite4 from "vite";
147
+
148
+ // src/virtual/mock-browser.ts
149
+ var mock_browser_default = fakeBrowser;
150
+ export {
151
+ mock_browser_default as default
152
+ };
@@ -16,7 +16,7 @@ var logger = {
16
16
  error: (...args) => print(console.error, ...args)
17
17
  };
18
18
 
19
- // src/client/utils/setupWebSocket.ts
19
+ // src/client/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);
@@ -43,7 +43,7 @@ function setupWebSocket(onMessage) {
43
43
  return ws;
44
44
  }
45
45
 
46
- // src/client/virtual-modules/reload-html.ts
46
+ // src/virtual/reload-html.ts
47
47
  if (__COMMAND__ === "serve") {
48
48
  try {
49
49
  setupWebSocket((message) => {
@@ -57,4 +57,3 @@ if (__COMMAND__ === "serve") {
57
57
  logger.error("Failed to setup web socket connection with dev server", err);
58
58
  }
59
59
  }
60
- //# sourceMappingURL=reload-html.js.map
@@ -1,4 +1,4 @@
1
- // src/client/virtual-modules/unlisted-script-entrypoint.ts
1
+ // src/virtual/unlisted-script-entrypoint.ts
2
2
  import definition from "virtual:user-unlisted-script";
3
3
 
4
4
  // src/client/utils/logger.ts
@@ -19,7 +19,7 @@ var logger = {
19
19
  error: (...args) => print(console.error, ...args)
20
20
  };
21
21
 
22
- // src/client/virtual-modules/unlisted-script-entrypoint.ts
22
+ // src/virtual/unlisted-script-entrypoint.ts
23
23
  (async () => {
24
24
  try {
25
25
  await definition.main();
@@ -30,4 +30,3 @@ var logger = {
30
30
  );
31
31
  }
32
32
  })();
33
- //# sourceMappingURL=unlisted-script-entrypoint.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "wxt",
3
3
  "type": "module",
4
- "version": "0.8.4",
4
+ "version": "0.8.6",
5
5
  "description": "Next gen framework for developing web extensions",
6
6
  "engines": {
7
7
  "node": ">=18",
@@ -97,13 +97,14 @@
97
97
  "@types/prompts": "^2.4.4",
98
98
  "@vitest/coverage-v8": "^0.34.6",
99
99
  "execa": "^7.2.0",
100
- "jsdom": "^22.1.0",
100
+ "happy-dom": "^12.4.0",
101
101
  "lint-staged": "^14.0.0",
102
102
  "lodash.merge": "^4.6.2",
103
103
  "npm-run-all": "^4.1.5",
104
+ "p-map": "^6.0.0",
104
105
  "prettier": "^3.0.1",
105
106
  "simple-git-hooks": "^2.9.0",
106
- "tsup": "^7.1.0",
107
+ "tsup": "^7.2.0",
107
108
  "tsx": "^3.12.7",
108
109
  "typedoc": "^0.25.2",
109
110
  "typedoc-plugin-markdown": "4.0.0-next.23",
@@ -131,13 +132,13 @@
131
132
  ]
132
133
  },
133
134
  "scripts": {
134
- "wxt": "tsx src/cli/index.ts",
135
+ "wxt": "tsx src/cli.ts",
135
136
  "build": "tsx scripts/build.ts",
136
137
  "format": "prettier --write .",
137
138
  "format:check": "prettier --write .",
138
139
  "compile": "tsc --noEmit",
139
140
  "test": "vitest",
140
- "test:coverage": "vitest run --coverage.enabled --coverage.exclude=e2e --coverage.exclude=src/testing",
141
+ "test:coverage": "vitest run --coverage",
141
142
  "prepublish": "pnpm -s build",
142
143
  "docs:gen": "typedoc --options docs/typedoc.json",
143
144
  "docs:dev": "pnpm -s docs:gen && vitepress dev docs",