wxt 0.18.1 → 0.18.3

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.
@@ -12,7 +12,7 @@ import {
12
12
  } from "./chunk-VBXJIVYU.js";
13
13
 
14
14
  // package.json
15
- var version = "0.18.0";
15
+ var version = "0.18.2";
16
16
 
17
17
  // src/core/utils/paths.ts
18
18
  import systemPath from "node:path";
@@ -700,7 +700,7 @@ function safeVarName(str) {
700
700
  }
701
701
  function removeImportStatements(text) {
702
702
  return text.replace(
703
- /(import\s?[{\w][\s\S]*?from\s?["'][\s\S]*?["'];?|import\s?["'][\s\S]*?["'];?)/gm,
703
+ /(import\s?[\s\S]*?from\s?["'][\s\S]*?["'];?|import\s?["'][\s\S]*?["'];?)/gm,
704
704
  ""
705
705
  );
706
706
  }
@@ -2373,6 +2373,7 @@ function addEntrypoints(manifest, entrypoints, buildOutput) {
2373
2373
  manifest.side_panel = {
2374
2374
  default_path: page
2375
2375
  };
2376
+ addPermission(manifest, "sidePanel");
2376
2377
  } else {
2377
2378
  wxt.logger.warn(
2378
2379
  "Side panel not supported by Chromium using MV2. side_panel.default_path was not added to the manifest"
@@ -2476,20 +2477,28 @@ function addDevModeCsp(manifest) {
2476
2477
  } else {
2477
2478
  addPermission(manifest, permission);
2478
2479
  }
2479
- const csp = new ContentSecurityPolicy(
2480
+ const extensionPagesCsp = new ContentSecurityPolicy(
2480
2481
  manifest.manifest_version === 3 ? (
2481
2482
  // @ts-expect-error: extension_pages is not typed
2482
2483
  manifest.content_security_policy?.extension_pages ?? "script-src 'self' 'wasm-unsafe-eval'; object-src 'self';"
2483
2484
  ) : manifest.content_security_policy ?? "script-src 'self'; object-src 'self';"
2484
2485
  // default CSP for MV2
2485
2486
  );
2486
- if (wxt.server)
2487
- csp.add("script-src", allowedCsp);
2487
+ const sandboxCsp = new ContentSecurityPolicy(
2488
+ // @ts-expect-error: sandbox is not typed
2489
+ manifest.content_security_policy?.sandbox ?? "sandbox allow-scripts allow-forms allow-popups allow-modals; script-src 'self' 'unsafe-inline' 'unsafe-eval'; child-src 'self';"
2490
+ // default sandbox CSP for MV3
2491
+ );
2492
+ if (wxt.server) {
2493
+ extensionPagesCsp.add("script-src", allowedCsp);
2494
+ sandboxCsp.add("script-src", allowedCsp);
2495
+ }
2488
2496
  if (manifest.manifest_version === 3) {
2489
2497
  manifest.content_security_policy ??= {};
2490
- manifest.content_security_policy.extension_pages = csp.toString();
2498
+ manifest.content_security_policy.extension_pages = extensionPagesCsp.toString();
2499
+ manifest.content_security_policy.sandbox = sandboxCsp.toString();
2491
2500
  } else {
2492
- manifest.content_security_policy = csp.toString();
2501
+ manifest.content_security_policy = extensionPagesCsp.toString();
2493
2502
  }
2494
2503
  }
2495
2504
  function addDevModePermissions(manifest) {
package/dist/cli.js CHANGED
@@ -930,7 +930,7 @@ function safeVarName(str) {
930
930
  }
931
931
  function removeImportStatements(text) {
932
932
  return text.replace(
933
- /(import\s?[{\w][\s\S]*?from\s?["'][\s\S]*?["'];?|import\s?["'][\s\S]*?["'];?)/gm,
933
+ /(import\s?[\s\S]*?from\s?["'][\s\S]*?["'];?|import\s?["'][\s\S]*?["'];?)/gm,
934
934
  ""
935
935
  );
936
936
  }
@@ -2515,7 +2515,7 @@ function getChunkSortWeight(filename) {
2515
2515
  import pc4 from "picocolors";
2516
2516
 
2517
2517
  // package.json
2518
- var version = "0.18.0";
2518
+ var version = "0.18.2";
2519
2519
 
2520
2520
  // src/core/utils/log/printHeader.ts
2521
2521
  function printHeader() {
@@ -2881,6 +2881,7 @@ function addEntrypoints(manifest, entrypoints, buildOutput) {
2881
2881
  manifest.side_panel = {
2882
2882
  default_path: page
2883
2883
  };
2884
+ addPermission(manifest, "sidePanel");
2884
2885
  } else {
2885
2886
  wxt.logger.warn(
2886
2887
  "Side panel not supported by Chromium using MV2. side_panel.default_path was not added to the manifest"
@@ -2984,20 +2985,28 @@ function addDevModeCsp(manifest) {
2984
2985
  } else {
2985
2986
  addPermission(manifest, permission);
2986
2987
  }
2987
- const csp = new ContentSecurityPolicy(
2988
+ const extensionPagesCsp = new ContentSecurityPolicy(
2988
2989
  manifest.manifest_version === 3 ? (
2989
2990
  // @ts-expect-error: extension_pages is not typed
2990
2991
  manifest.content_security_policy?.extension_pages ?? "script-src 'self' 'wasm-unsafe-eval'; object-src 'self';"
2991
2992
  ) : manifest.content_security_policy ?? "script-src 'self'; object-src 'self';"
2992
2993
  // default CSP for MV2
2993
2994
  );
2994
- if (wxt.server)
2995
- csp.add("script-src", allowedCsp);
2995
+ const sandboxCsp = new ContentSecurityPolicy(
2996
+ // @ts-expect-error: sandbox is not typed
2997
+ manifest.content_security_policy?.sandbox ?? "sandbox allow-scripts allow-forms allow-popups allow-modals; script-src 'self' 'unsafe-inline' 'unsafe-eval'; child-src 'self';"
2998
+ // default sandbox CSP for MV3
2999
+ );
3000
+ if (wxt.server) {
3001
+ extensionPagesCsp.add("script-src", allowedCsp);
3002
+ sandboxCsp.add("script-src", allowedCsp);
3003
+ }
2996
3004
  if (manifest.manifest_version === 3) {
2997
3005
  manifest.content_security_policy ??= {};
2998
- manifest.content_security_policy.extension_pages = csp.toString();
3006
+ manifest.content_security_policy.extension_pages = extensionPagesCsp.toString();
3007
+ manifest.content_security_policy.sandbox = sandboxCsp.toString();
2999
3008
  } else {
3000
- manifest.content_security_policy = csp.toString();
3009
+ manifest.content_security_policy = extensionPagesCsp.toString();
3001
3010
  }
3002
3011
  }
3003
3012
  function addDevModePermissions(manifest) {
@@ -3429,6 +3438,7 @@ function createWebExtRunner() {
3429
3438
  console: wxtUserConfig?.openConsole,
3430
3439
  devtools: wxtUserConfig?.openDevtools,
3431
3440
  startUrl: wxtUserConfig?.startUrls,
3441
+ keepProfileChanges: wxtUserConfig?.keepProfileChanges,
3432
3442
  ...wxt.config.browser === "firefox" ? {
3433
3443
  firefox: wxtUserConfig?.binaries?.firefox,
3434
3444
  firefoxProfile: wxtUserConfig?.firefoxProfile,
@@ -926,6 +926,10 @@ interface ExtensionRunnerConfig {
926
926
  * @see https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#start-url
927
927
  */
928
928
  startUrls?: string[];
929
+ /**
930
+ * @see https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#keep-profile-changes
931
+ */
932
+ keepProfileChanges?: boolean;
929
933
  }
930
934
  interface WxtBuilder {
931
935
  /**
@@ -926,6 +926,10 @@ interface ExtensionRunnerConfig {
926
926
  * @see https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#start-url
927
927
  */
928
928
  startUrls?: string[];
929
+ /**
930
+ * @see https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#keep-profile-changes
931
+ */
932
+ keepProfileChanges?: boolean;
929
933
  }
930
934
  interface WxtBuilder {
931
935
  /**
package/dist/index.cjs CHANGED
@@ -5208,7 +5208,7 @@ function safeVarName(str) {
5208
5208
  }
5209
5209
  function removeImportStatements(text2) {
5210
5210
  return text2.replace(
5211
- /(import\s?[{\w][\s\S]*?from\s?["'][\s\S]*?["'];?|import\s?["'][\s\S]*?["'];?)/gm,
5211
+ /(import\s?[\s\S]*?from\s?["'][\s\S]*?["'];?|import\s?["'][\s\S]*?["'];?)/gm,
5212
5212
  ""
5213
5213
  );
5214
5214
  }
@@ -6805,7 +6805,7 @@ function getChunkSortWeight(filename) {
6805
6805
  var import_picocolors4 = __toESM(require("picocolors"), 1);
6806
6806
 
6807
6807
  // package.json
6808
- var version = "0.18.0";
6808
+ var version = "0.18.2";
6809
6809
 
6810
6810
  // src/core/utils/building/internal-build.ts
6811
6811
  var import_fast_glob3 = __toESM(require("fast-glob"), 1);
@@ -7165,6 +7165,7 @@ function addEntrypoints(manifest, entrypoints, buildOutput) {
7165
7165
  manifest.side_panel = {
7166
7166
  default_path: page
7167
7167
  };
7168
+ addPermission(manifest, "sidePanel");
7168
7169
  } else {
7169
7170
  wxt.logger.warn(
7170
7171
  "Side panel not supported by Chromium using MV2. side_panel.default_path was not added to the manifest"
@@ -7268,20 +7269,28 @@ function addDevModeCsp(manifest) {
7268
7269
  } else {
7269
7270
  addPermission(manifest, permission);
7270
7271
  }
7271
- const csp = new ContentSecurityPolicy(
7272
+ const extensionPagesCsp = new ContentSecurityPolicy(
7272
7273
  manifest.manifest_version === 3 ? (
7273
7274
  // @ts-expect-error: extension_pages is not typed
7274
7275
  manifest.content_security_policy?.extension_pages ?? "script-src 'self' 'wasm-unsafe-eval'; object-src 'self';"
7275
7276
  ) : manifest.content_security_policy ?? "script-src 'self'; object-src 'self';"
7276
7277
  // default CSP for MV2
7277
7278
  );
7278
- if (wxt.server)
7279
- csp.add("script-src", allowedCsp);
7279
+ const sandboxCsp = new ContentSecurityPolicy(
7280
+ // @ts-expect-error: sandbox is not typed
7281
+ manifest.content_security_policy?.sandbox ?? "sandbox allow-scripts allow-forms allow-popups allow-modals; script-src 'self' 'unsafe-inline' 'unsafe-eval'; child-src 'self';"
7282
+ // default sandbox CSP for MV3
7283
+ );
7284
+ if (wxt.server) {
7285
+ extensionPagesCsp.add("script-src", allowedCsp);
7286
+ sandboxCsp.add("script-src", allowedCsp);
7287
+ }
7280
7288
  if (manifest.manifest_version === 3) {
7281
7289
  manifest.content_security_policy ??= {};
7282
- manifest.content_security_policy.extension_pages = csp.toString();
7290
+ manifest.content_security_policy.extension_pages = extensionPagesCsp.toString();
7291
+ manifest.content_security_policy.sandbox = sandboxCsp.toString();
7283
7292
  } else {
7284
- manifest.content_security_policy = csp.toString();
7293
+ manifest.content_security_policy = extensionPagesCsp.toString();
7285
7294
  }
7286
7295
  }
7287
7296
  function addDevModePermissions(manifest) {
@@ -7723,6 +7732,7 @@ function createWebExtRunner() {
7723
7732
  console: wxtUserConfig?.openConsole,
7724
7733
  devtools: wxtUserConfig?.openDevtools,
7725
7734
  startUrl: wxtUserConfig?.startUrls,
7735
+ keepProfileChanges: wxtUserConfig?.keepProfileChanges,
7726
7736
  ...wxt.config.browser === "firefox" ? {
7727
7737
  firefox: wxtUserConfig?.binaries?.firefox,
7728
7738
  firefoxProfile: wxtUserConfig?.firefoxProfile,
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { I as InlineConfig, B as BuildOutput, U as UserConfig, E as ExtensionRunnerConfig, W as WxtDevServer } from './index-DKN-8I90.cjs';
2
- export { x as BackgroundDefinition, n as BackgroundEntrypoint, i as BackgroundEntrypointOptions, j as BaseContentScriptEntrypointOptions, m as BaseEntrypoint, h as BaseEntrypointOptions, e as BuildStepOutput, J as ConfigEnv, w as ContentScriptDefinition, C as ContentScriptEntrypoint, a5 as Dependency, r as Entrypoint, s as EntrypointGroup, $ as EslintGlobalsPropValue, a0 as Eslintrc, _ as ExtensionRunner, Z as FsCache, G as GenericEntrypoint, X as HookResult, u as IsolatedWorldContentScriptDefinition, k as IsolatedWorldContentScriptEntrypointOptions, L as Logger, v as MainWorldContentScriptDefinition, M as MainWorldContentScriptEntrypointOptions, t as OnContentScriptStopped, p as OptionsEntrypoint, l as OptionsEntrypointOptions, d as OutputAsset, c as OutputChunk, O as OutputFile, A as PerBrowserMap, z as PerBrowserOption, o as PopupEntrypoint, P as PopupEntrypointOptions, f as ReloadContentScriptPayload, R as ResolvedConfig, a1 as ResolvedEslintrc, D as ResolvedPerBrowserOptions, V as ServerInfo, q as SidepanelEntrypoint, S as SidepanelEntrypointOptions, T as TargetBrowser, g as TargetManifestVersion, y as UnlistedScriptDefinition, F as UserManifest, H as UserManifestFn, Y as Wxt, N as WxtBuilder, Q as WxtBuilderServer, K as WxtCommand, b as WxtHooks, a4 as WxtPackageManager, a3 as WxtResolvedUnimportOptions, a2 as WxtUnimportOptions, a as WxtViteConfig } from './index-DKN-8I90.cjs';
1
+ import { I as InlineConfig, B as BuildOutput, U as UserConfig, E as ExtensionRunnerConfig, W as WxtDevServer } from './index-xOGXP3vY.cjs';
2
+ export { x as BackgroundDefinition, n as BackgroundEntrypoint, i as BackgroundEntrypointOptions, j as BaseContentScriptEntrypointOptions, m as BaseEntrypoint, h as BaseEntrypointOptions, e as BuildStepOutput, J as ConfigEnv, w as ContentScriptDefinition, C as ContentScriptEntrypoint, a5 as Dependency, r as Entrypoint, s as EntrypointGroup, $ as EslintGlobalsPropValue, a0 as Eslintrc, _ as ExtensionRunner, Z as FsCache, G as GenericEntrypoint, X as HookResult, u as IsolatedWorldContentScriptDefinition, k as IsolatedWorldContentScriptEntrypointOptions, L as Logger, v as MainWorldContentScriptDefinition, M as MainWorldContentScriptEntrypointOptions, t as OnContentScriptStopped, p as OptionsEntrypoint, l as OptionsEntrypointOptions, d as OutputAsset, c as OutputChunk, O as OutputFile, A as PerBrowserMap, z as PerBrowserOption, o as PopupEntrypoint, P as PopupEntrypointOptions, f as ReloadContentScriptPayload, R as ResolvedConfig, a1 as ResolvedEslintrc, D as ResolvedPerBrowserOptions, V as ServerInfo, q as SidepanelEntrypoint, S as SidepanelEntrypointOptions, T as TargetBrowser, g as TargetManifestVersion, y as UnlistedScriptDefinition, F as UserManifest, H as UserManifestFn, Y as Wxt, N as WxtBuilder, Q as WxtBuilderServer, K as WxtCommand, b as WxtHooks, a4 as WxtPackageManager, a3 as WxtResolvedUnimportOptions, a2 as WxtUnimportOptions, a as WxtViteConfig } from './index-xOGXP3vY.cjs';
3
3
  import 'vite';
4
4
  import 'webextension-polyfill';
5
5
  import 'unimport';
@@ -65,6 +65,6 @@ declare function prepare(config: InlineConfig): Promise<void>;
65
65
  */
66
66
  declare function zip(config?: InlineConfig): Promise<string[]>;
67
67
 
68
- var version = "0.18.0";
68
+ var version = "0.18.2";
69
69
 
70
70
  export { BuildOutput, ExtensionRunnerConfig, InlineConfig, UserConfig, WxtDevServer, build, clean, createServer, defineConfig, defineRunnerConfig, initialize, prepare, version, zip };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { I as InlineConfig, B as BuildOutput, U as UserConfig, E as ExtensionRunnerConfig, W as WxtDevServer } from './index-DKN-8I90.js';
2
- export { x as BackgroundDefinition, n as BackgroundEntrypoint, i as BackgroundEntrypointOptions, j as BaseContentScriptEntrypointOptions, m as BaseEntrypoint, h as BaseEntrypointOptions, e as BuildStepOutput, J as ConfigEnv, w as ContentScriptDefinition, C as ContentScriptEntrypoint, a5 as Dependency, r as Entrypoint, s as EntrypointGroup, $ as EslintGlobalsPropValue, a0 as Eslintrc, _ as ExtensionRunner, Z as FsCache, G as GenericEntrypoint, X as HookResult, u as IsolatedWorldContentScriptDefinition, k as IsolatedWorldContentScriptEntrypointOptions, L as Logger, v as MainWorldContentScriptDefinition, M as MainWorldContentScriptEntrypointOptions, t as OnContentScriptStopped, p as OptionsEntrypoint, l as OptionsEntrypointOptions, d as OutputAsset, c as OutputChunk, O as OutputFile, A as PerBrowserMap, z as PerBrowserOption, o as PopupEntrypoint, P as PopupEntrypointOptions, f as ReloadContentScriptPayload, R as ResolvedConfig, a1 as ResolvedEslintrc, D as ResolvedPerBrowserOptions, V as ServerInfo, q as SidepanelEntrypoint, S as SidepanelEntrypointOptions, T as TargetBrowser, g as TargetManifestVersion, y as UnlistedScriptDefinition, F as UserManifest, H as UserManifestFn, Y as Wxt, N as WxtBuilder, Q as WxtBuilderServer, K as WxtCommand, b as WxtHooks, a4 as WxtPackageManager, a3 as WxtResolvedUnimportOptions, a2 as WxtUnimportOptions, a as WxtViteConfig } from './index-DKN-8I90.js';
1
+ import { I as InlineConfig, B as BuildOutput, U as UserConfig, E as ExtensionRunnerConfig, W as WxtDevServer } from './index-xOGXP3vY.js';
2
+ export { x as BackgroundDefinition, n as BackgroundEntrypoint, i as BackgroundEntrypointOptions, j as BaseContentScriptEntrypointOptions, m as BaseEntrypoint, h as BaseEntrypointOptions, e as BuildStepOutput, J as ConfigEnv, w as ContentScriptDefinition, C as ContentScriptEntrypoint, a5 as Dependency, r as Entrypoint, s as EntrypointGroup, $ as EslintGlobalsPropValue, a0 as Eslintrc, _ as ExtensionRunner, Z as FsCache, G as GenericEntrypoint, X as HookResult, u as IsolatedWorldContentScriptDefinition, k as IsolatedWorldContentScriptEntrypointOptions, L as Logger, v as MainWorldContentScriptDefinition, M as MainWorldContentScriptEntrypointOptions, t as OnContentScriptStopped, p as OptionsEntrypoint, l as OptionsEntrypointOptions, d as OutputAsset, c as OutputChunk, O as OutputFile, A as PerBrowserMap, z as PerBrowserOption, o as PopupEntrypoint, P as PopupEntrypointOptions, f as ReloadContentScriptPayload, R as ResolvedConfig, a1 as ResolvedEslintrc, D as ResolvedPerBrowserOptions, V as ServerInfo, q as SidepanelEntrypoint, S as SidepanelEntrypointOptions, T as TargetBrowser, g as TargetManifestVersion, y as UnlistedScriptDefinition, F as UserManifest, H as UserManifestFn, Y as Wxt, N as WxtBuilder, Q as WxtBuilderServer, K as WxtCommand, b as WxtHooks, a4 as WxtPackageManager, a3 as WxtResolvedUnimportOptions, a2 as WxtUnimportOptions, a as WxtViteConfig } from './index-xOGXP3vY.js';
3
3
  import 'vite';
4
4
  import 'webextension-polyfill';
5
5
  import 'unimport';
@@ -65,6 +65,6 @@ declare function prepare(config: InlineConfig): Promise<void>;
65
65
  */
66
66
  declare function zip(config?: InlineConfig): Promise<string[]>;
67
67
 
68
- var version = "0.18.0";
68
+ var version = "0.18.2";
69
69
 
70
70
  export { BuildOutput, ExtensionRunnerConfig, InlineConfig, UserConfig, WxtDevServer, build, clean, createServer, defineConfig, defineRunnerConfig, initialize, prepare, version, zip };
package/dist/index.js CHANGED
@@ -19,7 +19,7 @@ import {
19
19
  unnormalizePath,
20
20
  version,
21
21
  wxt
22
- } from "./chunk-EI323YQS.js";
22
+ } from "./chunk-XAYX5BXI.js";
23
23
  import "./chunk-5X3S6AWF.js";
24
24
  import {
25
25
  consola
@@ -117,6 +117,7 @@ function createWebExtRunner() {
117
117
  console: wxtUserConfig?.openConsole,
118
118
  devtools: wxtUserConfig?.openDevtools,
119
119
  startUrl: wxtUserConfig?.startUrls,
120
+ keepProfileChanges: wxtUserConfig?.keepProfileChanges,
120
121
  ...wxt.config.browser === "firefox" ? {
121
122
  firefox: wxtUserConfig?.binaries?.firefox,
122
123
  firefoxProfile: wxtUserConfig?.firefoxProfile,
@@ -1,6 +1,6 @@
1
1
  export { FakeBrowser, fakeBrowser } from '@webext-core/fake-browser';
2
2
  import * as vite from 'vite';
3
- import { I as InlineConfig } from './index-DKN-8I90.cjs';
3
+ import { I as InlineConfig } from './index-xOGXP3vY.cjs';
4
4
  import 'webextension-polyfill';
5
5
  import 'unimport';
6
6
  import 'consola';
package/dist/testing.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { FakeBrowser, fakeBrowser } from '@webext-core/fake-browser';
2
2
  import * as vite from 'vite';
3
- import { I as InlineConfig } from './index-DKN-8I90.js';
3
+ import { I as InlineConfig } from './index-xOGXP3vY.js';
4
4
  import 'webextension-polyfill';
5
5
  import 'unimport';
6
6
  import 'consola';
package/dist/testing.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  tsconfigPaths,
6
6
  unimport,
7
7
  webextensionPolyfillMock
8
- } from "./chunk-EI323YQS.js";
8
+ } from "./chunk-XAYX5BXI.js";
9
9
  import "./chunk-5X3S6AWF.js";
10
10
  import "./chunk-ZZCTFNQ5.js";
11
11
  import "./chunk-VBXJIVYU.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "wxt",
3
3
  "type": "module",
4
- "version": "0.18.1",
4
+ "version": "0.18.3",
5
5
  "description": "Next gen framework for developing web extensions",
6
6
  "repository": {
7
7
  "type": "git",