wxt 0.20.11 → 0.20.13

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.
@@ -20,12 +20,8 @@ export async function resolveConfig(inlineConfig, command) {
20
20
  const { config: loadedConfig, ...metadata } = await loadConfig({
21
21
  configFile: inlineConfig.configFile,
22
22
  name: "wxt",
23
- cwd: inlineConfig.root ?? process.cwd(),
24
- rcFile: false
23
+ cwd: inlineConfig.root ?? process.cwd()
25
24
  });
26
- if (inlineConfig.configFile && metadata.layers?.length === 0) {
27
- throw Error(`Config file "${inlineConfig.configFile}" not found`);
28
- }
29
25
  userConfig = loadedConfig ?? {};
30
26
  userConfigMetadata = metadata;
31
27
  }
@@ -3,6 +3,7 @@ import { expand } from "dotenv-expand";
3
3
  export function loadEnv(mode, browser) {
4
4
  return expand(
5
5
  config({
6
+ quiet: true,
6
7
  // Files on top override files below
7
8
  path: [
8
9
  `.env.${mode}.${browser}.local`,
@@ -402,6 +402,7 @@ export function getContentScriptCssWebAccessibleResources(contentScripts, conten
402
402
  if (cssFile == null) return;
403
403
  resources.push({
404
404
  resources: [cssFile],
405
+ use_dynamic_url: true,
405
406
  matches: script.options.matches?.map(
406
407
  (matchPattern) => stripPathFromMatchPattern(matchPattern)
407
408
  ) ?? []
@@ -146,8 +146,8 @@ export declare const fakeManifest: (overrides?: {
146
146
  persistent?: boolean | undefined | undefined;
147
147
  } | undefined;
148
148
  content_security_policy?: string | undefined | undefined;
149
- optional_permissions?: (string | undefined)[] | (Browser.runtime.ManifestOptionalPermissions | undefined)[] | undefined;
150
- permissions?: (string | undefined)[] | (Browser.runtime.ManifestPermissions | undefined)[] | undefined;
149
+ optional_permissions?: (string | undefined)[] | undefined;
150
+ permissions?: (string | undefined)[] | undefined;
151
151
  web_accessible_resources?: (string | undefined)[] | undefined;
152
152
  name?: string | undefined;
153
153
  version?: string | undefined;
@@ -380,12 +380,19 @@ export declare const fakeManifest: (overrides?: {
380
380
  sandbox?: string | undefined;
381
381
  } | undefined;
382
382
  host_permissions?: (string | undefined)[] | undefined;
383
- optional_permissions?: (Browser.runtime.ManifestOptionalPermissions | undefined)[] | undefined;
383
+ optional_permissions?: (Browser.runtime.ManifestOptionalPermission | undefined)[] | undefined;
384
384
  optional_host_permissions?: (string | undefined)[] | undefined;
385
- permissions?: (Browser.runtime.ManifestPermissions | undefined)[] | undefined;
385
+ permissions?: (Browser.runtime.ManifestPermission | undefined)[] | undefined;
386
386
  web_accessible_resources?: ({
387
387
  resources?: (string | undefined)[] | undefined;
388
+ use_dynamic_url?: boolean | undefined | undefined;
389
+ extension_ids?: (string | undefined)[] | undefined;
388
390
  matches?: (string | undefined)[] | undefined;
391
+ } | {
392
+ resources?: (string | undefined)[] | undefined;
393
+ use_dynamic_url?: boolean | undefined | undefined;
394
+ matches?: (string | undefined)[] | undefined;
395
+ extension_ids?: (string | undefined)[] | undefined;
389
396
  } | undefined)[] | undefined;
390
397
  name?: string | undefined;
391
398
  version?: string | undefined;
@@ -596,7 +603,7 @@ export declare const fakeUserManifest: (overrides?: {
596
603
  sandbox?: string | undefined;
597
604
  } | undefined;
598
605
  host_permissions?: (string | undefined)[] | undefined;
599
- optional_permissions?: (Browser.runtime.ManifestOptionalPermissions | undefined)[] | undefined;
606
+ optional_permissions?: (Browser.runtime.ManifestOptionalPermission | undefined)[] | undefined;
600
607
  optional_host_permissions?: (string | undefined)[] | undefined;
601
608
  name?: string | undefined;
602
609
  version?: string | undefined;
@@ -811,7 +818,7 @@ export declare const fakeUserManifest: (overrides?: {
811
818
  strict_max_version?: string | undefined;
812
819
  } | undefined;
813
820
  } | undefined;
814
- permissions?: (Browser.runtime.ManifestPermissions | {
821
+ permissions?: (Browser.runtime.ManifestPermission | {
815
822
  readonly [x: number]: string | undefined;
816
823
  toString?: {} | undefined;
817
824
  charAt?: {} | undefined;
@@ -865,7 +872,14 @@ export declare const fakeUserManifest: (overrides?: {
865
872
  } | undefined)[] | undefined;
866
873
  web_accessible_resources?: (string | undefined)[] | ({
867
874
  resources?: (string | undefined)[] | undefined;
875
+ use_dynamic_url?: boolean | undefined | undefined;
876
+ extension_ids?: (string | undefined)[] | undefined;
877
+ matches?: (string | undefined)[] | undefined;
878
+ } | {
879
+ resources?: (string | undefined)[] | undefined;
880
+ use_dynamic_url?: boolean | undefined | undefined;
868
881
  matches?: (string | undefined)[] | undefined;
882
+ extension_ids?: (string | undefined)[] | undefined;
869
883
  } | undefined)[] | undefined;
870
884
  } | undefined) => UserManifest;
871
885
  export declare function fakeArray<T>(createItem: () => T, count?: number): T[];
@@ -1067,7 +1081,7 @@ export declare const fakeResolvedConfig: (overrides?: {
1067
1081
  sandbox?: string | undefined;
1068
1082
  } | undefined;
1069
1083
  host_permissions?: (string | undefined)[] | undefined;
1070
- optional_permissions?: (Browser.runtime.ManifestOptionalPermissions | undefined)[] | undefined;
1084
+ optional_permissions?: (Browser.runtime.ManifestOptionalPermission | undefined)[] | undefined;
1071
1085
  optional_host_permissions?: (string | undefined)[] | undefined;
1072
1086
  name?: string | undefined;
1073
1087
  version?: string | undefined;
@@ -1282,7 +1296,7 @@ export declare const fakeResolvedConfig: (overrides?: {
1282
1296
  strict_max_version?: string | undefined;
1283
1297
  } | undefined;
1284
1298
  } | undefined;
1285
- permissions?: (Browser.runtime.ManifestPermissions | {
1299
+ permissions?: (Browser.runtime.ManifestPermission | {
1286
1300
  readonly [x: number]: string | undefined;
1287
1301
  toString?: {} | undefined;
1288
1302
  charAt?: {} | undefined;
@@ -1336,7 +1350,14 @@ export declare const fakeResolvedConfig: (overrides?: {
1336
1350
  } | undefined)[] | undefined;
1337
1351
  web_accessible_resources?: (string | undefined)[] | ({
1338
1352
  resources?: (string | undefined)[] | undefined;
1353
+ use_dynamic_url?: boolean | undefined | undefined;
1354
+ extension_ids?: (string | undefined)[] | undefined;
1339
1355
  matches?: (string | undefined)[] | undefined;
1356
+ } | {
1357
+ resources?: (string | undefined)[] | undefined;
1358
+ use_dynamic_url?: boolean | undefined | undefined;
1359
+ matches?: (string | undefined)[] | undefined;
1360
+ extension_ids?: (string | undefined)[] | undefined;
1340
1361
  } | undefined)[] | undefined;
1341
1362
  } | undefined;
1342
1363
  fsCache?: {
@@ -1568,7 +1589,7 @@ export declare const fakeResolvedConfig: (overrides?: {
1568
1589
  sandbox?: string | undefined;
1569
1590
  } | undefined;
1570
1591
  host_permissions?: (string | undefined)[] | undefined;
1571
- optional_permissions?: (Browser.runtime.ManifestOptionalPermissions | undefined)[] | undefined;
1592
+ optional_permissions?: (Browser.runtime.ManifestOptionalPermission | undefined)[] | undefined;
1572
1593
  optional_host_permissions?: (string | undefined)[] | undefined;
1573
1594
  name?: string | undefined;
1574
1595
  version?: string | undefined;
@@ -1783,7 +1804,7 @@ export declare const fakeResolvedConfig: (overrides?: {
1783
1804
  strict_max_version?: string | undefined;
1784
1805
  } | undefined;
1785
1806
  } | undefined;
1786
- permissions?: (Browser.runtime.ManifestPermissions | {
1807
+ permissions?: (Browser.runtime.ManifestPermission | {
1787
1808
  readonly [x: number]: string | undefined;
1788
1809
  toString?: {} | undefined;
1789
1810
  charAt?: {} | undefined;
@@ -1837,7 +1858,14 @@ export declare const fakeResolvedConfig: (overrides?: {
1837
1858
  } | undefined)[] | undefined;
1838
1859
  web_accessible_resources?: (string | undefined)[] | ({
1839
1860
  resources?: (string | undefined)[] | undefined;
1861
+ use_dynamic_url?: boolean | undefined | undefined;
1862
+ extension_ids?: (string | undefined)[] | undefined;
1863
+ matches?: (string | undefined)[] | undefined;
1864
+ } | {
1865
+ resources?: (string | undefined)[] | undefined;
1866
+ use_dynamic_url?: boolean | undefined | undefined;
1840
1867
  matches?: (string | undefined)[] | undefined;
1868
+ extension_ids?: (string | undefined)[] | undefined;
1841
1869
  } | undefined)[] | undefined;
1842
1870
  } | {
1843
1871
  then?: {} | undefined;
@@ -2339,7 +2367,7 @@ export declare const fakeResolvedConfig: (overrides?: {
2339
2367
  sandbox?: string | undefined;
2340
2368
  } | undefined;
2341
2369
  host_permissions?: (string | undefined)[] | undefined;
2342
- optional_permissions?: (Browser.runtime.ManifestOptionalPermissions | undefined)[] | undefined;
2370
+ optional_permissions?: (Browser.runtime.ManifestOptionalPermission | undefined)[] | undefined;
2343
2371
  optional_host_permissions?: (string | undefined)[] | undefined;
2344
2372
  name?: string | undefined;
2345
2373
  version?: string | undefined;
@@ -2554,7 +2582,7 @@ export declare const fakeResolvedConfig: (overrides?: {
2554
2582
  strict_max_version?: string | undefined;
2555
2583
  } | undefined;
2556
2584
  } | undefined;
2557
- permissions?: (Browser.runtime.ManifestPermissions | {
2585
+ permissions?: (Browser.runtime.ManifestPermission | {
2558
2586
  readonly [x: number]: string | undefined;
2559
2587
  toString?: {} | undefined;
2560
2588
  charAt?: {} | undefined;
@@ -2608,7 +2636,14 @@ export declare const fakeResolvedConfig: (overrides?: {
2608
2636
  } | undefined)[] | undefined;
2609
2637
  web_accessible_resources?: (string | undefined)[] | ({
2610
2638
  resources?: (string | undefined)[] | undefined;
2639
+ use_dynamic_url?: boolean | undefined | undefined;
2640
+ extension_ids?: (string | undefined)[] | undefined;
2611
2641
  matches?: (string | undefined)[] | undefined;
2642
+ } | {
2643
+ resources?: (string | undefined)[] | undefined;
2644
+ use_dynamic_url?: boolean | undefined | undefined;
2645
+ matches?: (string | undefined)[] | undefined;
2646
+ extension_ids?: (string | undefined)[] | undefined;
2612
2647
  } | undefined)[] | undefined;
2613
2648
  } | {
2614
2649
  then?: {} | undefined;
@@ -3138,7 +3173,7 @@ export declare const fakeResolvedConfig: (overrides?: {
3138
3173
  sandbox?: string | undefined;
3139
3174
  } | undefined;
3140
3175
  host_permissions?: (string | undefined)[] | undefined;
3141
- optional_permissions?: (Browser.runtime.ManifestOptionalPermissions | undefined)[] | undefined;
3176
+ optional_permissions?: (Browser.runtime.ManifestOptionalPermission | undefined)[] | undefined;
3142
3177
  optional_host_permissions?: (string | undefined)[] | undefined;
3143
3178
  name?: string | undefined;
3144
3179
  version?: string | undefined;
@@ -3353,7 +3388,7 @@ export declare const fakeResolvedConfig: (overrides?: {
3353
3388
  strict_max_version?: string | undefined;
3354
3389
  } | undefined;
3355
3390
  } | undefined;
3356
- permissions?: (Browser.runtime.ManifestPermissions | {
3391
+ permissions?: (Browser.runtime.ManifestPermission | {
3357
3392
  readonly [x: number]: string | undefined;
3358
3393
  toString?: {} | undefined;
3359
3394
  charAt?: {} | undefined;
@@ -3407,7 +3442,14 @@ export declare const fakeResolvedConfig: (overrides?: {
3407
3442
  } | undefined)[] | undefined;
3408
3443
  web_accessible_resources?: (string | undefined)[] | ({
3409
3444
  resources?: (string | undefined)[] | undefined;
3445
+ use_dynamic_url?: boolean | undefined | undefined;
3446
+ extension_ids?: (string | undefined)[] | undefined;
3447
+ matches?: (string | undefined)[] | undefined;
3448
+ } | {
3449
+ resources?: (string | undefined)[] | undefined;
3450
+ use_dynamic_url?: boolean | undefined | undefined;
3410
3451
  matches?: (string | undefined)[] | undefined;
3452
+ extension_ids?: (string | undefined)[] | undefined;
3411
3453
  } | undefined)[] | undefined;
3412
3454
  } | {
3413
3455
  then?: {} | undefined;
@@ -4851,7 +4893,7 @@ export declare const fakeWxt: (overrides?: {
4851
4893
  sandbox?: string | undefined;
4852
4894
  } | undefined;
4853
4895
  host_permissions?: (string | undefined)[] | undefined;
4854
- optional_permissions?: (Browser.runtime.ManifestOptionalPermissions | undefined)[] | undefined;
4896
+ optional_permissions?: (Browser.runtime.ManifestOptionalPermission | undefined)[] | undefined;
4855
4897
  optional_host_permissions?: (string | undefined)[] | undefined;
4856
4898
  name?: string | undefined;
4857
4899
  version?: string | undefined;
@@ -5066,7 +5108,7 @@ export declare const fakeWxt: (overrides?: {
5066
5108
  strict_max_version?: string | undefined;
5067
5109
  } | undefined;
5068
5110
  } | undefined;
5069
- permissions?: (Browser.runtime.ManifestPermissions | {
5111
+ permissions?: (Browser.runtime.ManifestPermission | {
5070
5112
  readonly [x: number]: string | undefined;
5071
5113
  toString?: {} | undefined;
5072
5114
  charAt?: {} | undefined;
@@ -5120,7 +5162,14 @@ export declare const fakeWxt: (overrides?: {
5120
5162
  } | undefined)[] | undefined;
5121
5163
  web_accessible_resources?: (string | undefined)[] | ({
5122
5164
  resources?: (string | undefined)[] | undefined;
5165
+ use_dynamic_url?: boolean | undefined | undefined;
5166
+ extension_ids?: (string | undefined)[] | undefined;
5123
5167
  matches?: (string | undefined)[] | undefined;
5168
+ } | {
5169
+ resources?: (string | undefined)[] | undefined;
5170
+ use_dynamic_url?: boolean | undefined | undefined;
5171
+ matches?: (string | undefined)[] | undefined;
5172
+ extension_ids?: (string | undefined)[] | undefined;
5124
5173
  } | undefined)[] | undefined;
5125
5174
  } | undefined;
5126
5175
  fsCache?: {
@@ -5352,7 +5401,7 @@ export declare const fakeWxt: (overrides?: {
5352
5401
  sandbox?: string | undefined;
5353
5402
  } | undefined;
5354
5403
  host_permissions?: (string | undefined)[] | undefined;
5355
- optional_permissions?: (Browser.runtime.ManifestOptionalPermissions | undefined)[] | undefined;
5404
+ optional_permissions?: (Browser.runtime.ManifestOptionalPermission | undefined)[] | undefined;
5356
5405
  optional_host_permissions?: (string | undefined)[] | undefined;
5357
5406
  name?: string | undefined;
5358
5407
  version?: string | undefined;
@@ -5567,7 +5616,7 @@ export declare const fakeWxt: (overrides?: {
5567
5616
  strict_max_version?: string | undefined;
5568
5617
  } | undefined;
5569
5618
  } | undefined;
5570
- permissions?: (Browser.runtime.ManifestPermissions | {
5619
+ permissions?: (Browser.runtime.ManifestPermission | {
5571
5620
  readonly [x: number]: string | undefined;
5572
5621
  toString?: {} | undefined;
5573
5622
  charAt?: {} | undefined;
@@ -5621,7 +5670,14 @@ export declare const fakeWxt: (overrides?: {
5621
5670
  } | undefined)[] | undefined;
5622
5671
  web_accessible_resources?: (string | undefined)[] | ({
5623
5672
  resources?: (string | undefined)[] | undefined;
5673
+ use_dynamic_url?: boolean | undefined | undefined;
5674
+ extension_ids?: (string | undefined)[] | undefined;
5675
+ matches?: (string | undefined)[] | undefined;
5676
+ } | {
5677
+ resources?: (string | undefined)[] | undefined;
5678
+ use_dynamic_url?: boolean | undefined | undefined;
5624
5679
  matches?: (string | undefined)[] | undefined;
5680
+ extension_ids?: (string | undefined)[] | undefined;
5625
5681
  } | undefined)[] | undefined;
5626
5682
  } | {
5627
5683
  then?: {} | undefined;
@@ -6123,7 +6179,7 @@ export declare const fakeWxt: (overrides?: {
6123
6179
  sandbox?: string | undefined;
6124
6180
  } | undefined;
6125
6181
  host_permissions?: (string | undefined)[] | undefined;
6126
- optional_permissions?: (Browser.runtime.ManifestOptionalPermissions | undefined)[] | undefined;
6182
+ optional_permissions?: (Browser.runtime.ManifestOptionalPermission | undefined)[] | undefined;
6127
6183
  optional_host_permissions?: (string | undefined)[] | undefined;
6128
6184
  name?: string | undefined;
6129
6185
  version?: string | undefined;
@@ -6338,7 +6394,7 @@ export declare const fakeWxt: (overrides?: {
6338
6394
  strict_max_version?: string | undefined;
6339
6395
  } | undefined;
6340
6396
  } | undefined;
6341
- permissions?: (Browser.runtime.ManifestPermissions | {
6397
+ permissions?: (Browser.runtime.ManifestPermission | {
6342
6398
  readonly [x: number]: string | undefined;
6343
6399
  toString?: {} | undefined;
6344
6400
  charAt?: {} | undefined;
@@ -6392,7 +6448,14 @@ export declare const fakeWxt: (overrides?: {
6392
6448
  } | undefined)[] | undefined;
6393
6449
  web_accessible_resources?: (string | undefined)[] | ({
6394
6450
  resources?: (string | undefined)[] | undefined;
6451
+ use_dynamic_url?: boolean | undefined | undefined;
6452
+ extension_ids?: (string | undefined)[] | undefined;
6453
+ matches?: (string | undefined)[] | undefined;
6454
+ } | {
6455
+ resources?: (string | undefined)[] | undefined;
6456
+ use_dynamic_url?: boolean | undefined | undefined;
6395
6457
  matches?: (string | undefined)[] | undefined;
6458
+ extension_ids?: (string | undefined)[] | undefined;
6396
6459
  } | undefined)[] | undefined;
6397
6460
  } | {
6398
6461
  then?: {} | undefined;
@@ -6922,7 +6985,7 @@ export declare const fakeWxt: (overrides?: {
6922
6985
  sandbox?: string | undefined;
6923
6986
  } | undefined;
6924
6987
  host_permissions?: (string | undefined)[] | undefined;
6925
- optional_permissions?: (Browser.runtime.ManifestOptionalPermissions | undefined)[] | undefined;
6988
+ optional_permissions?: (Browser.runtime.ManifestOptionalPermission | undefined)[] | undefined;
6926
6989
  optional_host_permissions?: (string | undefined)[] | undefined;
6927
6990
  name?: string | undefined;
6928
6991
  version?: string | undefined;
@@ -7137,7 +7200,7 @@ export declare const fakeWxt: (overrides?: {
7137
7200
  strict_max_version?: string | undefined;
7138
7201
  } | undefined;
7139
7202
  } | undefined;
7140
- permissions?: (Browser.runtime.ManifestPermissions | {
7203
+ permissions?: (Browser.runtime.ManifestPermission | {
7141
7204
  readonly [x: number]: string | undefined;
7142
7205
  toString?: {} | undefined;
7143
7206
  charAt?: {} | undefined;
@@ -7191,7 +7254,14 @@ export declare const fakeWxt: (overrides?: {
7191
7254
  } | undefined)[] | undefined;
7192
7255
  web_accessible_resources?: (string | undefined)[] | ({
7193
7256
  resources?: (string | undefined)[] | undefined;
7257
+ use_dynamic_url?: boolean | undefined | undefined;
7258
+ extension_ids?: (string | undefined)[] | undefined;
7259
+ matches?: (string | undefined)[] | undefined;
7260
+ } | {
7261
+ resources?: (string | undefined)[] | undefined;
7262
+ use_dynamic_url?: boolean | undefined | undefined;
7194
7263
  matches?: (string | undefined)[] | undefined;
7264
+ extension_ids?: (string | undefined)[] | undefined;
7195
7265
  } | undefined)[] | undefined;
7196
7266
  } | {
7197
7267
  then?: {} | undefined;
@@ -8505,8 +8575,8 @@ export declare const fakeWxt: (overrides?: {
8505
8575
  persistent?: boolean | undefined | undefined;
8506
8576
  } | undefined;
8507
8577
  content_security_policy?: string | undefined | undefined;
8508
- optional_permissions?: (string | undefined)[] | (Browser.runtime.ManifestOptionalPermissions | undefined)[] | undefined;
8509
- permissions?: (string | undefined)[] | (Browser.runtime.ManifestPermissions | undefined)[] | undefined;
8578
+ optional_permissions?: (string | undefined)[] | undefined;
8579
+ permissions?: (string | undefined)[] | undefined;
8510
8580
  web_accessible_resources?: (string | undefined)[] | undefined;
8511
8581
  name?: string | undefined;
8512
8582
  version?: string | undefined;
@@ -8739,12 +8809,19 @@ export declare const fakeWxt: (overrides?: {
8739
8809
  sandbox?: string | undefined;
8740
8810
  } | undefined;
8741
8811
  host_permissions?: (string | undefined)[] | undefined;
8742
- optional_permissions?: (Browser.runtime.ManifestOptionalPermissions | undefined)[] | undefined;
8812
+ optional_permissions?: (Browser.runtime.ManifestOptionalPermission | undefined)[] | undefined;
8743
8813
  optional_host_permissions?: (string | undefined)[] | undefined;
8744
- permissions?: (Browser.runtime.ManifestPermissions | undefined)[] | undefined;
8814
+ permissions?: (Browser.runtime.ManifestPermission | undefined)[] | undefined;
8745
8815
  web_accessible_resources?: ({
8746
8816
  resources?: (string | undefined)[] | undefined;
8817
+ use_dynamic_url?: boolean | undefined | undefined;
8818
+ extension_ids?: (string | undefined)[] | undefined;
8819
+ matches?: (string | undefined)[] | undefined;
8820
+ } | {
8821
+ resources?: (string | undefined)[] | undefined;
8822
+ use_dynamic_url?: boolean | undefined | undefined;
8747
8823
  matches?: (string | undefined)[] | undefined;
8824
+ extension_ids?: (string | undefined)[] | undefined;
8748
8825
  } | undefined)[] | undefined;
8749
8826
  name?: string | undefined;
8750
8827
  version?: string | undefined;
@@ -9259,8 +9336,8 @@ export declare const fakeWxtDevServer: (overrides?: {
9259
9336
  persistent?: boolean | undefined | undefined;
9260
9337
  } | undefined;
9261
9338
  content_security_policy?: string | undefined | undefined;
9262
- optional_permissions?: (string | undefined)[] | (Browser.runtime.ManifestOptionalPermissions | undefined)[] | undefined;
9263
- permissions?: (string | undefined)[] | (Browser.runtime.ManifestPermissions | undefined)[] | undefined;
9339
+ optional_permissions?: (string | undefined)[] | undefined;
9340
+ permissions?: (string | undefined)[] | undefined;
9264
9341
  web_accessible_resources?: (string | undefined)[] | undefined;
9265
9342
  name?: string | undefined;
9266
9343
  version?: string | undefined;
@@ -9493,12 +9570,19 @@ export declare const fakeWxtDevServer: (overrides?: {
9493
9570
  sandbox?: string | undefined;
9494
9571
  } | undefined;
9495
9572
  host_permissions?: (string | undefined)[] | undefined;
9496
- optional_permissions?: (Browser.runtime.ManifestOptionalPermissions | undefined)[] | undefined;
9573
+ optional_permissions?: (Browser.runtime.ManifestOptionalPermission | undefined)[] | undefined;
9497
9574
  optional_host_permissions?: (string | undefined)[] | undefined;
9498
- permissions?: (Browser.runtime.ManifestPermissions | undefined)[] | undefined;
9575
+ permissions?: (Browser.runtime.ManifestPermission | undefined)[] | undefined;
9499
9576
  web_accessible_resources?: ({
9500
9577
  resources?: (string | undefined)[] | undefined;
9578
+ use_dynamic_url?: boolean | undefined | undefined;
9579
+ extension_ids?: (string | undefined)[] | undefined;
9501
9580
  matches?: (string | undefined)[] | undefined;
9581
+ } | {
9582
+ resources?: (string | undefined)[] | undefined;
9583
+ use_dynamic_url?: boolean | undefined | undefined;
9584
+ matches?: (string | undefined)[] | undefined;
9585
+ extension_ids?: (string | undefined)[] | undefined;
9502
9586
  } | undefined)[] | undefined;
9503
9587
  name?: string | undefined;
9504
9588
  version?: string | undefined;
@@ -10004,8 +10088,8 @@ export declare const fakeBuildOutput: (overrides?: {
10004
10088
  persistent?: boolean | undefined | undefined;
10005
10089
  } | undefined;
10006
10090
  content_security_policy?: string | undefined | undefined;
10007
- optional_permissions?: (string | undefined)[] | (Browser.runtime.ManifestOptionalPermissions | undefined)[] | undefined;
10008
- permissions?: (string | undefined)[] | (Browser.runtime.ManifestPermissions | undefined)[] | undefined;
10091
+ optional_permissions?: (string | undefined)[] | undefined;
10092
+ permissions?: (string | undefined)[] | undefined;
10009
10093
  web_accessible_resources?: (string | undefined)[] | undefined;
10010
10094
  name?: string | undefined;
10011
10095
  version?: string | undefined;
@@ -10238,12 +10322,19 @@ export declare const fakeBuildOutput: (overrides?: {
10238
10322
  sandbox?: string | undefined;
10239
10323
  } | undefined;
10240
10324
  host_permissions?: (string | undefined)[] | undefined;
10241
- optional_permissions?: (Browser.runtime.ManifestOptionalPermissions | undefined)[] | undefined;
10325
+ optional_permissions?: (Browser.runtime.ManifestOptionalPermission | undefined)[] | undefined;
10242
10326
  optional_host_permissions?: (string | undefined)[] | undefined;
10243
- permissions?: (Browser.runtime.ManifestPermissions | undefined)[] | undefined;
10327
+ permissions?: (Browser.runtime.ManifestPermission | undefined)[] | undefined;
10244
10328
  web_accessible_resources?: ({
10245
10329
  resources?: (string | undefined)[] | undefined;
10330
+ use_dynamic_url?: boolean | undefined | undefined;
10331
+ extension_ids?: (string | undefined)[] | undefined;
10246
10332
  matches?: (string | undefined)[] | undefined;
10333
+ } | {
10334
+ resources?: (string | undefined)[] | undefined;
10335
+ use_dynamic_url?: boolean | undefined | undefined;
10336
+ matches?: (string | undefined)[] | undefined;
10337
+ extension_ids?: (string | undefined)[] | undefined;
10247
10338
  } | undefined)[] | undefined;
10248
10339
  name?: string | undefined;
10249
10340
  version?: string | undefined;
@@ -10844,8 +10935,8 @@ export declare const fakeDevServer: (overrides?: {
10844
10935
  persistent?: boolean | undefined | undefined;
10845
10936
  } | undefined;
10846
10937
  content_security_policy?: string | undefined | undefined;
10847
- optional_permissions?: (string | undefined)[] | (Browser.runtime.ManifestOptionalPermissions | undefined)[] | undefined;
10848
- permissions?: (string | undefined)[] | (Browser.runtime.ManifestPermissions | undefined)[] | undefined;
10938
+ optional_permissions?: (string | undefined)[] | undefined;
10939
+ permissions?: (string | undefined)[] | undefined;
10849
10940
  web_accessible_resources?: (string | undefined)[] | undefined;
10850
10941
  name?: string | undefined;
10851
10942
  version?: string | undefined;
@@ -11078,12 +11169,19 @@ export declare const fakeDevServer: (overrides?: {
11078
11169
  sandbox?: string | undefined;
11079
11170
  } | undefined;
11080
11171
  host_permissions?: (string | undefined)[] | undefined;
11081
- optional_permissions?: (Browser.runtime.ManifestOptionalPermissions | undefined)[] | undefined;
11172
+ optional_permissions?: (Browser.runtime.ManifestOptionalPermission | undefined)[] | undefined;
11082
11173
  optional_host_permissions?: (string | undefined)[] | undefined;
11083
- permissions?: (Browser.runtime.ManifestPermissions | undefined)[] | undefined;
11174
+ permissions?: (Browser.runtime.ManifestPermission | undefined)[] | undefined;
11084
11175
  web_accessible_resources?: ({
11085
11176
  resources?: (string | undefined)[] | undefined;
11177
+ use_dynamic_url?: boolean | undefined | undefined;
11178
+ extension_ids?: (string | undefined)[] | undefined;
11179
+ matches?: (string | undefined)[] | undefined;
11180
+ } | {
11181
+ resources?: (string | undefined)[] | undefined;
11182
+ use_dynamic_url?: boolean | undefined | undefined;
11086
11183
  matches?: (string | undefined)[] | undefined;
11184
+ extension_ids?: (string | undefined)[] | undefined;
11087
11185
  } | undefined)[] | undefined;
11088
11186
  name?: string | undefined;
11089
11187
  version?: string | undefined;
package/dist/types.d.ts CHANGED
@@ -199,7 +199,7 @@ export interface InlineConfig {
199
199
  *
200
200
  * @example
201
201
  * [
202
- * "coverage", // Ignore the coverage directory in the `sourcesRoot`
202
+ * "coverage", // Include the coverage directory in the `sourcesRoot`
203
203
  * ]
204
204
  */
205
205
  includeSources?: string[];
@@ -212,7 +212,7 @@ export interface InlineConfig {
212
212
  *
213
213
  * @example
214
214
  * [
215
- * "coverage", // Include the coverage directory in the `sourcesRoot`
215
+ * "coverage", // Ignore the coverage directory in the `sourcesRoot`
216
216
  * ]
217
217
  */
218
218
  excludeSources?: string[];
@@ -2,7 +2,6 @@ import { browser } from "wxt/browser";
2
2
  import { applyPosition, createMountFunctions, mountUi } from "./shared.mjs";
3
3
  export function createIframeUi(ctx, options) {
4
4
  const wrapper = document.createElement("div");
5
- wrapper.setAttribute("data-wxt-iframe", "");
6
5
  const iframe = document.createElement("iframe");
7
6
  iframe.src = browser.runtime.getURL(options.page);
8
7
  wrapper.appendChild(iframe);
@@ -1,7 +1,6 @@
1
1
  import { applyPosition, createMountFunctions, mountUi } from "./shared.mjs";
2
2
  export function createIntegratedUi(ctx, options) {
3
3
  const wrapper = document.createElement(options.tag || "div");
4
- wrapper.setAttribute("data-wxt-integrated", "");
5
4
  let mounted = void 0;
6
5
  const mount = () => {
7
6
  applyPosition(wrapper, void 0, options);
@@ -29,7 +29,6 @@ export async function createShadowRootUi(ctx, options) {
29
29
  mode: options.mode ?? "open",
30
30
  isolateEvents: options.isolateEvents
31
31
  });
32
- shadowHost.setAttribute("data-wxt-shadow-root", "");
33
32
  let mounted;
34
33
  const mount = () => {
35
34
  mountUi(shadowHost, options);
@@ -7,12 +7,30 @@ export type ScriptPublicPath = Extract<import('wxt/browser').PublicPath, `${stri
7
7
  *
8
8
  * Make sure to add the injected script to your manifest's
9
9
  * `web_accessible_resources`.
10
+ *
11
+ * @returns A result object containing the created script element.
10
12
  */
11
- export declare function injectScript(path: ScriptPublicPath, options?: InjectScriptOptions): Promise<void>;
13
+ export declare function injectScript(path: ScriptPublicPath, options?: InjectScriptOptions): Promise<InjectScriptResult>;
12
14
  export interface InjectScriptOptions {
13
15
  /**
14
16
  * By default, the injected script is removed from the DOM after being
15
17
  * injected. To disable this behavior, set this flag to true.
16
18
  */
17
19
  keepInDom?: boolean;
20
+ /**
21
+ * Modify the script element just before it is added to the DOM.
22
+ *
23
+ * It can be used to e.g. modify `script.async`/`script.defer`, add event
24
+ * listeners to the element, or pass data to the script via `script.dataset`
25
+ * (which can be accessed by the script via `document.currentScript`).
26
+ */
27
+ modifyScript?: (script: HTMLScriptElement) => Promise<void> | void;
28
+ }
29
+ export interface InjectScriptResult {
30
+ /**
31
+ * The created script element. It can be used to e.g. send messages to the
32
+ * script in the form of custom events. The script can add an event listener
33
+ * for them via `document.currentScript`.
34
+ */
35
+ script: HTMLScriptElement;
18
36
  }
@@ -3,12 +3,36 @@ export async function injectScript(path, options) {
3
3
  const url = browser.runtime.getURL(path);
4
4
  const script = document.createElement("script");
5
5
  if (browser.runtime.getManifest().manifest_version === 2) {
6
- script.innerHTML = await fetch(url).then((res) => res.text());
6
+ script.text = await fetch(url).then((res) => res.text());
7
7
  } else {
8
8
  script.src = url;
9
9
  }
10
+ const loadedPromise = makeLoadedPromise(script);
11
+ await options?.modifyScript?.(script);
12
+ (document.head ?? document.documentElement).append(script);
10
13
  if (!options?.keepInDom) {
11
- script.onload = () => script.remove();
14
+ script.remove();
12
15
  }
13
- (document.head ?? document.documentElement).append(script);
16
+ await loadedPromise;
17
+ return {
18
+ script
19
+ };
20
+ }
21
+ function makeLoadedPromise(script) {
22
+ return new Promise((resolve, reject) => {
23
+ const onload = () => {
24
+ resolve();
25
+ cleanup();
26
+ };
27
+ const onerror = () => {
28
+ reject(new Error(`Failed to load script: ${script.src}`));
29
+ cleanup();
30
+ };
31
+ const cleanup = () => {
32
+ script.removeEventListener("load", onload);
33
+ script.removeEventListener("error", onerror);
34
+ };
35
+ script.addEventListener("load", onload);
36
+ script.addEventListener("error", onerror);
37
+ });
14
38
  }
@@ -1,14 +1,9 @@
1
+ const AT_RULE_BLOCKS = /(\s*@(property|font-face)[\s\S]*?{[\s\S]*?})/gm;
1
2
  export function splitShadowRootCss(css) {
2
- let shadowCss = css;
3
- let documentCss = "";
4
- const rulesRegex = /(\s*@(property|font-face)[\s\S]*?{[\s\S]*?})/gm;
5
- let match;
6
- while ((match = rulesRegex.exec(css)) !== null) {
7
- documentCss += match[1];
8
- shadowCss = shadowCss.replace(match[1], "");
9
- }
3
+ const documentCss = Array.from(css.matchAll(AT_RULE_BLOCKS), (m) => m[0]).join("").trim();
4
+ const shadowCss = css.replace(AT_RULE_BLOCKS, "").trim();
10
5
  return {
11
- documentCss: documentCss.trim(),
12
- shadowCss: shadowCss.trim()
6
+ documentCss,
7
+ shadowCss
13
8
  };
14
9
  }
package/dist/version.mjs CHANGED
@@ -1 +1 @@
1
- export const version = "0.20.11";
1
+ export const version = "0.20.13";
@@ -17,10 +17,28 @@ const logger = {
17
17
  error: (...args) => print(console.error, ...args)
18
18
  };
19
19
 
20
- const result = (async () => {
20
+ const result = (() => {
21
21
  try {
22
22
  initPlugins();
23
- return await definition.main();
23
+ } catch (err) {
24
+ logger.error(
25
+ `Failed to initialize plugins for "${import.meta.env.ENTRYPOINT}"`,
26
+ err
27
+ );
28
+ throw err;
29
+ }
30
+ let result2;
31
+ try {
32
+ result2 = definition.main();
33
+ if (result2 instanceof Promise) {
34
+ result2 = result2.catch((err) => {
35
+ logger.error(
36
+ `The unlisted script "${import.meta.env.ENTRYPOINT}" crashed on startup!`,
37
+ err
38
+ );
39
+ throw err;
40
+ });
41
+ }
24
42
  } catch (err) {
25
43
  logger.error(
26
44
  `The unlisted script "${import.meta.env.ENTRYPOINT}" crashed on startup!`,
@@ -28,6 +46,7 @@ const result = (async () => {
28
46
  );
29
47
  throw err;
30
48
  }
49
+ return result2;
31
50
  })();
32
51
 
33
52
  export { result as default };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "wxt",
3
3
  "type": "module",
4
- "version": "0.20.11",
4
+ "version": "0.20.13",
5
5
  "description": "⚡ Next-gen Web Extension Framework",
6
6
  "license": "MIT",
7
7
  "dependencies": {
@@ -12,18 +12,18 @@
12
12
  "@webext-core/match-patterns": "^1.0.3",
13
13
  "@wxt-dev/storage": "^1.0.0",
14
14
  "async-mutex": "^0.5.0",
15
- "c12": "^3.2.0",
15
+ "c12": "^3.3.2",
16
16
  "cac": "^6.7.14",
17
17
  "chokidar": "^4.0.3",
18
- "ci-info": "^4.3.0",
18
+ "ci-info": "^4.3.1",
19
19
  "consola": "^3.4.2",
20
20
  "defu": "^6.1.4",
21
- "dotenv": "^17.2.2",
21
+ "dotenv": "^17.2.3",
22
22
  "dotenv-expand": "^12.0.3",
23
- "esbuild": "^0.25.0",
23
+ "esbuild": "^0.27.1",
24
24
  "fast-glob": "^3.3.3",
25
- "filesize": "^11.0.2",
26
- "fs-extra": "^11.3.1",
25
+ "filesize": "^11.0.13",
26
+ "fs-extra": "^11.3.2",
27
27
  "get-port-please": "^3.2.0",
28
28
  "giget": "^1.2.3 || ^2.0.0",
29
29
  "hookable": "^5.5.3",
@@ -33,10 +33,10 @@
33
33
  "jszip": "^3.10.1",
34
34
  "linkedom": "^0.18.12",
35
35
  "magicast": "^0.3.5",
36
- "minimatch": "^10.0.3",
37
- "nano-spawn": "^1.0.2",
36
+ "minimatch": "^10.1.1",
37
+ "nano-spawn": "^1.0.3",
38
38
  "normalize-path": "^3.0.0",
39
- "nypm": "^0.6.1",
39
+ "nypm": "^0.6.2",
40
40
  "ohash": "^2.0.11",
41
41
  "open": "^10.2.0",
42
42
  "ora": "^8.2.0",
@@ -47,27 +47,27 @@
47
47
  "scule": "^1.3.0",
48
48
  "unimport": "^3.13.1 || ^4.0.0 || ^5.0.0",
49
49
  "vite": "^5.4.19 || ^6.3.4 || ^7.0.0",
50
- "vite-node": "^2.1.4 || ^3.1.2",
50
+ "vite-node": "^3.2.4 || ^5.0.0",
51
51
  "web-ext-run": "^0.2.4",
52
- "@wxt-dev/browser": "^0.1.4"
52
+ "@wxt-dev/browser": "^0.1.32"
53
53
  },
54
54
  "devDependencies": {
55
- "@aklinker1/check": "^2.1.0",
56
- "@faker-js/faker": "^10.0.0",
55
+ "@aklinker1/check": "^2.2.0",
56
+ "@faker-js/faker": "^10.1.0",
57
57
  "@types/fs-extra": "^11.0.4",
58
58
  "@types/lodash.merge": "^4.6.9",
59
59
  "@types/node": "^20.17.6",
60
60
  "@types/normalize-path": "^3.0.2",
61
61
  "@types/prompts": "^2.4.9",
62
62
  "extract-zip": "^2.0.1",
63
- "happy-dom": "^18.0.1",
63
+ "happy-dom": "^20.0.0",
64
64
  "lodash.merge": "^4.6.2",
65
- "oxlint": "^1.14.0",
66
- "publint": "^0.3.12",
67
- "typescript": "^5.9.2",
65
+ "oxlint": "^1.33.0",
66
+ "publint": "^0.3.16",
67
+ "typescript": "^5.9.3",
68
68
  "unbuild": "^3.6.1",
69
- "vitest": "^3.2.4",
70
- "vitest-plugin-random-seed": "^1.1.1"
69
+ "vitest": "^4.0.16",
70
+ "vitest-plugin-random-seed": "^1.1.2"
71
71
  },
72
72
  "peerDependenciesMeta": {},
73
73
  "repository": {