wxt 0.11.1 → 0.11.2

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.11.1";
2
+ var version = "0.11.2";
3
3
 
4
4
  // src/core/utils/arrays.ts
5
5
  function every(array, predicate) {
@@ -2203,51 +2203,46 @@ async function combineAnalysisStats(config) {
2203
2203
  // src/core/utils/building/find-entrypoints.ts
2204
2204
  import glob3 from "fast-glob";
2205
2205
  async function findEntrypoints(config) {
2206
- const relativePaths = await glob3("**/*", {
2206
+ const relativePaths = await glob3(Object.keys(PATH_GLOB_TO_TYPE_MAP), {
2207
2207
  cwd: config.entrypointsDir
2208
2208
  });
2209
2209
  relativePaths.sort();
2210
2210
  const pathGlobs = Object.keys(PATH_GLOB_TO_TYPE_MAP);
2211
- let hasBackground = false;
2212
- const possibleEntrypoints = await Promise.all(
2213
- relativePaths.map(async (relativePath) => {
2214
- const path6 = resolve12(config.entrypointsDir, relativePath);
2215
- const matchingGlob = pathGlobs.find(
2216
- (glob4) => minimatch(relativePath, glob4)
2217
- );
2218
- if (matchingGlob == null) {
2219
- config.logger.warn(
2220
- `${relativePath} does not match any known entrypoint. Known entrypoints:
2221
- ${JSON.stringify(
2222
- PATH_GLOB_TO_TYPE_MAP,
2223
- null,
2224
- 2
2225
- )}`
2226
- );
2227
- return;
2228
- }
2211
+ const entrypointInfos = relativePaths.reduce((results, relativePath) => {
2212
+ const inputPath = resolve12(config.entrypointsDir, relativePath);
2213
+ const name = getEntrypointName(config.entrypointsDir, inputPath);
2214
+ const matchingGlob = pathGlobs.find(
2215
+ (glob4) => minimatch(relativePath, glob4)
2216
+ );
2217
+ if (matchingGlob) {
2229
2218
  const type = PATH_GLOB_TO_TYPE_MAP[matchingGlob];
2230
- if (type === "ignored")
2231
- return;
2219
+ results.push({ name, inputPath, type });
2220
+ }
2221
+ return results;
2222
+ }, []);
2223
+ preventDuplicateEntrypointNames(config, entrypointInfos);
2224
+ let hasBackground = false;
2225
+ const entrypoints = await Promise.all(
2226
+ entrypointInfos.map(async (info) => {
2227
+ const { type } = info;
2232
2228
  switch (type) {
2233
2229
  case "popup":
2234
- return await getPopupEntrypoint(config, path6);
2230
+ return await getPopupEntrypoint(config, info);
2235
2231
  case "options":
2236
- return await getOptionsEntrypoint(config, path6);
2232
+ return await getOptionsEntrypoint(config, info);
2237
2233
  case "background":
2238
2234
  hasBackground = true;
2239
- return await getBackgroundEntrypoint(config, path6);
2235
+ return await getBackgroundEntrypoint(config, info);
2240
2236
  case "content-script":
2241
- return await getContentScriptEntrypoint(config, path6);
2237
+ return await getContentScriptEntrypoint(config, info);
2242
2238
  case "unlisted-page":
2243
- return await getUnlistedPageEntrypoint(config, path6);
2239
+ return await getUnlistedPageEntrypoint(config, info);
2244
2240
  case "unlisted-script":
2245
- return await getUnlistedScriptEntrypoint(config, path6);
2241
+ return await getUnlistedScriptEntrypoint(config, info);
2246
2242
  case "content-script-style":
2247
2243
  return {
2244
+ ...info,
2248
2245
  type,
2249
- name: getEntrypointName(config.entrypointsDir, path6),
2250
- inputPath: path6,
2251
2246
  outputDir: resolve12(config.outDir, CONTENT_SCRIPT_OUT_DIR),
2252
2247
  options: {
2253
2248
  include: void 0,
@@ -2256,9 +2251,8 @@ ${JSON.stringify(
2256
2251
  };
2257
2252
  default:
2258
2253
  return {
2254
+ ...info,
2259
2255
  type,
2260
- name: getEntrypointName(config.entrypointsDir, path6),
2261
- inputPath: path6,
2262
2256
  outputDir: config.outDir,
2263
2257
  options: {
2264
2258
  include: void 0,
@@ -2268,25 +2262,13 @@ ${JSON.stringify(
2268
2262
  }
2269
2263
  })
2270
2264
  );
2271
- const entrypoints = possibleEntrypoints.filter(
2272
- (entry) => !!entry
2273
- );
2274
- const existingNames = {};
2275
- entrypoints.forEach((entrypoint) => {
2276
- const withSameName = existingNames[entrypoint.name];
2277
- if (withSameName) {
2278
- throw Error(
2279
- `Multiple entrypoints with the name "${entrypoint.name}" detected, but only one is allowed: ${[
2280
- relative4(config.root, withSameName.inputPath),
2281
- relative4(config.root, entrypoint.inputPath)
2282
- ].join(", ")}`
2283
- );
2284
- }
2285
- existingNames[entrypoint.name] = entrypoint;
2286
- });
2287
2265
  if (config.command === "serve" && !hasBackground) {
2288
2266
  entrypoints.push(
2289
- await getBackgroundEntrypoint(config, VIRTUAL_NOOP_BACKGROUND_MODULE_ID)
2267
+ await getBackgroundEntrypoint(config, {
2268
+ inputPath: VIRTUAL_NOOP_BACKGROUND_MODULE_ID,
2269
+ name: "background",
2270
+ type: "background"
2271
+ })
2290
2272
  );
2291
2273
  }
2292
2274
  config.logger.debug("All entrypoints:", entrypoints);
@@ -2309,6 +2291,36 @@ ${JSON.stringify(
2309
2291
  config.logger.debug(`${config.browser} entrypoints:`, targetEntrypoints);
2310
2292
  return targetEntrypoints;
2311
2293
  }
2294
+ function preventDuplicateEntrypointNames(config, files) {
2295
+ const namesToPaths = files.reduce(
2296
+ (map, { name, inputPath }) => {
2297
+ map[name] ??= [];
2298
+ map[name].push(inputPath);
2299
+ return map;
2300
+ },
2301
+ {}
2302
+ );
2303
+ const errorLines = Object.entries(namesToPaths).reduce(
2304
+ (lines, [name, absolutePaths]) => {
2305
+ if (absolutePaths.length > 1) {
2306
+ lines.push(`- ${name}`);
2307
+ absolutePaths.forEach((absolutePath) => {
2308
+ lines.push(` - ${relative4(config.root, absolutePath)}`);
2309
+ });
2310
+ }
2311
+ return lines;
2312
+ },
2313
+ []
2314
+ );
2315
+ if (errorLines.length > 0) {
2316
+ const errorContent = errorLines.join("\n");
2317
+ throw Error(
2318
+ `Multiple entrypoints with the same name detected, only one entrypoint for each name is allowed.
2319
+
2320
+ ${errorContent}`
2321
+ );
2322
+ }
2323
+ }
2312
2324
  function getHtmlBaseOptions(document) {
2313
2325
  const options = {};
2314
2326
  const includeContent = document.querySelector("meta[name='manifest.include']")?.getAttribute("content");
@@ -2321,8 +2333,8 @@ function getHtmlBaseOptions(document) {
2321
2333
  }
2322
2334
  return options;
2323
2335
  }
2324
- async function getPopupEntrypoint(config, path6) {
2325
- const content = await fs12.readFile(path6, "utf-8");
2336
+ async function getPopupEntrypoint(config, { inputPath, name }) {
2337
+ const content = await fs12.readFile(inputPath, "utf-8");
2326
2338
  const { document } = parseHTML2(content);
2327
2339
  const options = getHtmlBaseOptions(document);
2328
2340
  const title = document.querySelector("title");
@@ -2351,12 +2363,12 @@ async function getPopupEntrypoint(config, path6) {
2351
2363
  type: "popup",
2352
2364
  name: "popup",
2353
2365
  options,
2354
- inputPath: path6,
2366
+ inputPath,
2355
2367
  outputDir: config.outDir
2356
2368
  };
2357
2369
  }
2358
- async function getOptionsEntrypoint(config, path6) {
2359
- const content = await fs12.readFile(path6, "utf-8");
2370
+ async function getOptionsEntrypoint(config, { inputPath, name }) {
2371
+ const content = await fs12.readFile(inputPath, "utf-8");
2360
2372
  const { document } = parseHTML2(content);
2361
2373
  const options = getHtmlBaseOptions(document);
2362
2374
  const openInTabContent = document.querySelector("meta[name='manifest.open_in_tab']")?.getAttribute("content");
@@ -2375,25 +2387,24 @@ async function getOptionsEntrypoint(config, path6) {
2375
2387
  type: "options",
2376
2388
  name: "options",
2377
2389
  options,
2378
- inputPath: path6,
2390
+ inputPath,
2379
2391
  outputDir: config.outDir
2380
2392
  };
2381
2393
  }
2382
- async function getUnlistedPageEntrypoint(config, path6) {
2383
- const content = await fs12.readFile(path6, "utf-8");
2394
+ async function getUnlistedPageEntrypoint(config, { inputPath, name }) {
2395
+ const content = await fs12.readFile(inputPath, "utf-8");
2384
2396
  const { document } = parseHTML2(content);
2385
2397
  return {
2386
2398
  type: "unlisted-page",
2387
- name: getEntrypointName(config.entrypointsDir, path6),
2388
- inputPath: path6,
2399
+ name: getEntrypointName(config.entrypointsDir, inputPath),
2400
+ inputPath,
2389
2401
  outputDir: config.outDir,
2390
2402
  options: getHtmlBaseOptions(document)
2391
2403
  };
2392
2404
  }
2393
- async function getUnlistedScriptEntrypoint(config, path6) {
2394
- const name = getEntrypointName(config.entrypointsDir, path6);
2405
+ async function getUnlistedScriptEntrypoint(config, { inputPath, name }) {
2395
2406
  const defaultExport = await importEntrypointFile(
2396
- path6,
2407
+ inputPath,
2397
2408
  config
2398
2409
  );
2399
2410
  if (defaultExport == null) {
@@ -2406,17 +2417,16 @@ async function getUnlistedScriptEntrypoint(config, path6) {
2406
2417
  return {
2407
2418
  type: "unlisted-script",
2408
2419
  name,
2409
- inputPath: path6,
2420
+ inputPath,
2410
2421
  outputDir: config.outDir,
2411
2422
  options
2412
2423
  };
2413
2424
  }
2414
- async function getBackgroundEntrypoint(config, path6) {
2415
- const name = "background";
2425
+ async function getBackgroundEntrypoint(config, { inputPath, name }) {
2416
2426
  let options = {};
2417
- if (path6 !== VIRTUAL_NOOP_BACKGROUND_MODULE_ID) {
2427
+ if (inputPath !== VIRTUAL_NOOP_BACKGROUND_MODULE_ID) {
2418
2428
  const defaultExport = await importEntrypointFile(
2419
- path6,
2429
+ inputPath,
2420
2430
  config
2421
2431
  );
2422
2432
  if (defaultExport == null) {
@@ -2430,7 +2440,7 @@ async function getBackgroundEntrypoint(config, path6) {
2430
2440
  return {
2431
2441
  type: "background",
2432
2442
  name,
2433
- inputPath: path6,
2443
+ inputPath,
2434
2444
  outputDir: config.outDir,
2435
2445
  options: {
2436
2446
  ...options,
@@ -2439,9 +2449,8 @@ async function getBackgroundEntrypoint(config, path6) {
2439
2449
  }
2440
2450
  };
2441
2451
  }
2442
- async function getContentScriptEntrypoint(config, path6) {
2443
- const name = getEntrypointName(config.entrypointsDir, path6);
2444
- const { main: _, ...options } = await importEntrypointFile(path6, config);
2452
+ async function getContentScriptEntrypoint(config, { inputPath, name }) {
2453
+ const { main: _, ...options } = await importEntrypointFile(inputPath, config);
2445
2454
  if (options == null) {
2446
2455
  throw Error(
2447
2456
  `${name}: Default export not found, did you forget to call "export default defineContentScript(...)"?`
@@ -2450,7 +2459,7 @@ async function getContentScriptEntrypoint(config, path6) {
2450
2459
  return {
2451
2460
  type: "content-script",
2452
2461
  name,
2453
- inputPath: path6,
2462
+ inputPath,
2454
2463
  outputDir: resolve12(config.outDir, CONTENT_SCRIPT_OUT_DIR),
2455
2464
  options
2456
2465
  };
@@ -2489,12 +2498,10 @@ var PATH_GLOB_TO_TYPE_MAP = {
2489
2498
  "options/index.html": "options",
2490
2499
  "*.html": "unlisted-page",
2491
2500
  "*/index.html": "unlisted-page",
2492
- "*.[jt]s": "unlisted-script",
2493
- "*/index.ts": "unlisted-script",
2501
+ "*.[jt]s?(x)": "unlisted-script",
2502
+ "*/index.[jt]s?(x)": "unlisted-script",
2494
2503
  [`*.${CSS_EXTENSIONS_PATTERN}`]: "unlisted-style",
2495
- [`*/index.${CSS_EXTENSIONS_PATTERN}`]: "unlisted-style",
2496
- // Don't warn about any files in subdirectories, like CSS or JS entrypoints for HTML files or tests
2497
- "*/**": "ignored"
2504
+ [`*/index.${CSS_EXTENSIONS_PATTERN}`]: "unlisted-style"
2498
2505
  };
2499
2506
  var CONTENT_SCRIPT_OUT_DIR = "content-scripts";
2500
2507
 
package/dist/cli.cjs CHANGED
@@ -2415,7 +2415,7 @@ var init_execa = __esm({
2415
2415
  var import_cac = __toESM(require("cac"), 1);
2416
2416
 
2417
2417
  // package.json
2418
- var version = "0.11.1";
2418
+ var version = "0.11.2";
2419
2419
 
2420
2420
  // src/core/utils/fs.ts
2421
2421
  var import_fs_extra = __toESM(require("fs-extra"), 1);
@@ -2606,51 +2606,46 @@ var VIRTUAL_NOOP_BACKGROUND_MODULE_ID = "virtual:user-background";
2606
2606
 
2607
2607
  // src/core/utils/building/find-entrypoints.ts
2608
2608
  async function findEntrypoints(config) {
2609
- const relativePaths = await (0, import_fast_glob2.default)("**/*", {
2609
+ const relativePaths = await (0, import_fast_glob2.default)(Object.keys(PATH_GLOB_TO_TYPE_MAP), {
2610
2610
  cwd: config.entrypointsDir
2611
2611
  });
2612
2612
  relativePaths.sort();
2613
2613
  const pathGlobs = Object.keys(PATH_GLOB_TO_TYPE_MAP);
2614
- let hasBackground = false;
2615
- const possibleEntrypoints = await Promise.all(
2616
- relativePaths.map(async (relativePath) => {
2617
- const path10 = (0, import_path2.resolve)(config.entrypointsDir, relativePath);
2618
- const matchingGlob = pathGlobs.find(
2619
- (glob5) => (0, import_minimatch.minimatch)(relativePath, glob5)
2620
- );
2621
- if (matchingGlob == null) {
2622
- config.logger.warn(
2623
- `${relativePath} does not match any known entrypoint. Known entrypoints:
2624
- ${JSON.stringify(
2625
- PATH_GLOB_TO_TYPE_MAP,
2626
- null,
2627
- 2
2628
- )}`
2629
- );
2630
- return;
2631
- }
2614
+ const entrypointInfos = relativePaths.reduce((results, relativePath) => {
2615
+ const inputPath = (0, import_path2.resolve)(config.entrypointsDir, relativePath);
2616
+ const name = getEntrypointName(config.entrypointsDir, inputPath);
2617
+ const matchingGlob = pathGlobs.find(
2618
+ (glob5) => (0, import_minimatch.minimatch)(relativePath, glob5)
2619
+ );
2620
+ if (matchingGlob) {
2632
2621
  const type = PATH_GLOB_TO_TYPE_MAP[matchingGlob];
2633
- if (type === "ignored")
2634
- return;
2622
+ results.push({ name, inputPath, type });
2623
+ }
2624
+ return results;
2625
+ }, []);
2626
+ preventDuplicateEntrypointNames(config, entrypointInfos);
2627
+ let hasBackground = false;
2628
+ const entrypoints = await Promise.all(
2629
+ entrypointInfos.map(async (info) => {
2630
+ const { type } = info;
2635
2631
  switch (type) {
2636
2632
  case "popup":
2637
- return await getPopupEntrypoint(config, path10);
2633
+ return await getPopupEntrypoint(config, info);
2638
2634
  case "options":
2639
- return await getOptionsEntrypoint(config, path10);
2635
+ return await getOptionsEntrypoint(config, info);
2640
2636
  case "background":
2641
2637
  hasBackground = true;
2642
- return await getBackgroundEntrypoint(config, path10);
2638
+ return await getBackgroundEntrypoint(config, info);
2643
2639
  case "content-script":
2644
- return await getContentScriptEntrypoint(config, path10);
2640
+ return await getContentScriptEntrypoint(config, info);
2645
2641
  case "unlisted-page":
2646
- return await getUnlistedPageEntrypoint(config, path10);
2642
+ return await getUnlistedPageEntrypoint(config, info);
2647
2643
  case "unlisted-script":
2648
- return await getUnlistedScriptEntrypoint(config, path10);
2644
+ return await getUnlistedScriptEntrypoint(config, info);
2649
2645
  case "content-script-style":
2650
2646
  return {
2647
+ ...info,
2651
2648
  type,
2652
- name: getEntrypointName(config.entrypointsDir, path10),
2653
- inputPath: path10,
2654
2649
  outputDir: (0, import_path2.resolve)(config.outDir, CONTENT_SCRIPT_OUT_DIR),
2655
2650
  options: {
2656
2651
  include: void 0,
@@ -2659,9 +2654,8 @@ ${JSON.stringify(
2659
2654
  };
2660
2655
  default:
2661
2656
  return {
2657
+ ...info,
2662
2658
  type,
2663
- name: getEntrypointName(config.entrypointsDir, path10),
2664
- inputPath: path10,
2665
2659
  outputDir: config.outDir,
2666
2660
  options: {
2667
2661
  include: void 0,
@@ -2671,25 +2665,13 @@ ${JSON.stringify(
2671
2665
  }
2672
2666
  })
2673
2667
  );
2674
- const entrypoints = possibleEntrypoints.filter(
2675
- (entry) => !!entry
2676
- );
2677
- const existingNames = {};
2678
- entrypoints.forEach((entrypoint) => {
2679
- const withSameName = existingNames[entrypoint.name];
2680
- if (withSameName) {
2681
- throw Error(
2682
- `Multiple entrypoints with the name "${entrypoint.name}" detected, but only one is allowed: ${[
2683
- (0, import_path2.relative)(config.root, withSameName.inputPath),
2684
- (0, import_path2.relative)(config.root, entrypoint.inputPath)
2685
- ].join(", ")}`
2686
- );
2687
- }
2688
- existingNames[entrypoint.name] = entrypoint;
2689
- });
2690
2668
  if (config.command === "serve" && !hasBackground) {
2691
2669
  entrypoints.push(
2692
- await getBackgroundEntrypoint(config, VIRTUAL_NOOP_BACKGROUND_MODULE_ID)
2670
+ await getBackgroundEntrypoint(config, {
2671
+ inputPath: VIRTUAL_NOOP_BACKGROUND_MODULE_ID,
2672
+ name: "background",
2673
+ type: "background"
2674
+ })
2693
2675
  );
2694
2676
  }
2695
2677
  config.logger.debug("All entrypoints:", entrypoints);
@@ -2712,6 +2694,36 @@ ${JSON.stringify(
2712
2694
  config.logger.debug(`${config.browser} entrypoints:`, targetEntrypoints);
2713
2695
  return targetEntrypoints;
2714
2696
  }
2697
+ function preventDuplicateEntrypointNames(config, files) {
2698
+ const namesToPaths = files.reduce(
2699
+ (map, { name, inputPath }) => {
2700
+ map[name] ??= [];
2701
+ map[name].push(inputPath);
2702
+ return map;
2703
+ },
2704
+ {}
2705
+ );
2706
+ const errorLines = Object.entries(namesToPaths).reduce(
2707
+ (lines, [name, absolutePaths]) => {
2708
+ if (absolutePaths.length > 1) {
2709
+ lines.push(`- ${name}`);
2710
+ absolutePaths.forEach((absolutePath) => {
2711
+ lines.push(` - ${(0, import_path2.relative)(config.root, absolutePath)}`);
2712
+ });
2713
+ }
2714
+ return lines;
2715
+ },
2716
+ []
2717
+ );
2718
+ if (errorLines.length > 0) {
2719
+ const errorContent = errorLines.join("\n");
2720
+ throw Error(
2721
+ `Multiple entrypoints with the same name detected, only one entrypoint for each name is allowed.
2722
+
2723
+ ${errorContent}`
2724
+ );
2725
+ }
2726
+ }
2715
2727
  function getHtmlBaseOptions(document) {
2716
2728
  const options = {};
2717
2729
  const includeContent = document.querySelector("meta[name='manifest.include']")?.getAttribute("content");
@@ -2724,8 +2736,8 @@ function getHtmlBaseOptions(document) {
2724
2736
  }
2725
2737
  return options;
2726
2738
  }
2727
- async function getPopupEntrypoint(config, path10) {
2728
- const content = await import_fs_extra3.default.readFile(path10, "utf-8");
2739
+ async function getPopupEntrypoint(config, { inputPath, name }) {
2740
+ const content = await import_fs_extra3.default.readFile(inputPath, "utf-8");
2729
2741
  const { document } = (0, import_linkedom.parseHTML)(content);
2730
2742
  const options = getHtmlBaseOptions(document);
2731
2743
  const title = document.querySelector("title");
@@ -2754,12 +2766,12 @@ async function getPopupEntrypoint(config, path10) {
2754
2766
  type: "popup",
2755
2767
  name: "popup",
2756
2768
  options,
2757
- inputPath: path10,
2769
+ inputPath,
2758
2770
  outputDir: config.outDir
2759
2771
  };
2760
2772
  }
2761
- async function getOptionsEntrypoint(config, path10) {
2762
- const content = await import_fs_extra3.default.readFile(path10, "utf-8");
2773
+ async function getOptionsEntrypoint(config, { inputPath, name }) {
2774
+ const content = await import_fs_extra3.default.readFile(inputPath, "utf-8");
2763
2775
  const { document } = (0, import_linkedom.parseHTML)(content);
2764
2776
  const options = getHtmlBaseOptions(document);
2765
2777
  const openInTabContent = document.querySelector("meta[name='manifest.open_in_tab']")?.getAttribute("content");
@@ -2778,25 +2790,24 @@ async function getOptionsEntrypoint(config, path10) {
2778
2790
  type: "options",
2779
2791
  name: "options",
2780
2792
  options,
2781
- inputPath: path10,
2793
+ inputPath,
2782
2794
  outputDir: config.outDir
2783
2795
  };
2784
2796
  }
2785
- async function getUnlistedPageEntrypoint(config, path10) {
2786
- const content = await import_fs_extra3.default.readFile(path10, "utf-8");
2797
+ async function getUnlistedPageEntrypoint(config, { inputPath, name }) {
2798
+ const content = await import_fs_extra3.default.readFile(inputPath, "utf-8");
2787
2799
  const { document } = (0, import_linkedom.parseHTML)(content);
2788
2800
  return {
2789
2801
  type: "unlisted-page",
2790
- name: getEntrypointName(config.entrypointsDir, path10),
2791
- inputPath: path10,
2802
+ name: getEntrypointName(config.entrypointsDir, inputPath),
2803
+ inputPath,
2792
2804
  outputDir: config.outDir,
2793
2805
  options: getHtmlBaseOptions(document)
2794
2806
  };
2795
2807
  }
2796
- async function getUnlistedScriptEntrypoint(config, path10) {
2797
- const name = getEntrypointName(config.entrypointsDir, path10);
2808
+ async function getUnlistedScriptEntrypoint(config, { inputPath, name }) {
2798
2809
  const defaultExport = await importEntrypointFile(
2799
- path10,
2810
+ inputPath,
2800
2811
  config
2801
2812
  );
2802
2813
  if (defaultExport == null) {
@@ -2809,17 +2820,16 @@ async function getUnlistedScriptEntrypoint(config, path10) {
2809
2820
  return {
2810
2821
  type: "unlisted-script",
2811
2822
  name,
2812
- inputPath: path10,
2823
+ inputPath,
2813
2824
  outputDir: config.outDir,
2814
2825
  options
2815
2826
  };
2816
2827
  }
2817
- async function getBackgroundEntrypoint(config, path10) {
2818
- const name = "background";
2828
+ async function getBackgroundEntrypoint(config, { inputPath, name }) {
2819
2829
  let options = {};
2820
- if (path10 !== VIRTUAL_NOOP_BACKGROUND_MODULE_ID) {
2830
+ if (inputPath !== VIRTUAL_NOOP_BACKGROUND_MODULE_ID) {
2821
2831
  const defaultExport = await importEntrypointFile(
2822
- path10,
2832
+ inputPath,
2823
2833
  config
2824
2834
  );
2825
2835
  if (defaultExport == null) {
@@ -2833,7 +2843,7 @@ async function getBackgroundEntrypoint(config, path10) {
2833
2843
  return {
2834
2844
  type: "background",
2835
2845
  name,
2836
- inputPath: path10,
2846
+ inputPath,
2837
2847
  outputDir: config.outDir,
2838
2848
  options: {
2839
2849
  ...options,
@@ -2842,9 +2852,8 @@ async function getBackgroundEntrypoint(config, path10) {
2842
2852
  }
2843
2853
  };
2844
2854
  }
2845
- async function getContentScriptEntrypoint(config, path10) {
2846
- const name = getEntrypointName(config.entrypointsDir, path10);
2847
- const { main: _, ...options } = await importEntrypointFile(path10, config);
2855
+ async function getContentScriptEntrypoint(config, { inputPath, name }) {
2856
+ const { main: _, ...options } = await importEntrypointFile(inputPath, config);
2848
2857
  if (options == null) {
2849
2858
  throw Error(
2850
2859
  `${name}: Default export not found, did you forget to call "export default defineContentScript(...)"?`
@@ -2853,7 +2862,7 @@ async function getContentScriptEntrypoint(config, path10) {
2853
2862
  return {
2854
2863
  type: "content-script",
2855
2864
  name,
2856
- inputPath: path10,
2865
+ inputPath,
2857
2866
  outputDir: (0, import_path2.resolve)(config.outDir, CONTENT_SCRIPT_OUT_DIR),
2858
2867
  options
2859
2868
  };
@@ -2892,12 +2901,10 @@ var PATH_GLOB_TO_TYPE_MAP = {
2892
2901
  "options/index.html": "options",
2893
2902
  "*.html": "unlisted-page",
2894
2903
  "*/index.html": "unlisted-page",
2895
- "*.[jt]s": "unlisted-script",
2896
- "*/index.ts": "unlisted-script",
2904
+ "*.[jt]s?(x)": "unlisted-script",
2905
+ "*/index.[jt]s?(x)": "unlisted-script",
2897
2906
  [`*.${CSS_EXTENSIONS_PATTERN}`]: "unlisted-style",
2898
- [`*/index.${CSS_EXTENSIONS_PATTERN}`]: "unlisted-style",
2899
- // Don't warn about any files in subdirectories, like CSS or JS entrypoints for HTML files or tests
2900
- "*/**": "ignored"
2907
+ [`*/index.${CSS_EXTENSIONS_PATTERN}`]: "unlisted-style"
2901
2908
  };
2902
2909
  var CONTENT_SCRIPT_OUT_DIR = "content-scripts";
2903
2910
 
package/dist/client.d.ts CHANGED
@@ -6,10 +6,14 @@ declare function defineBackground(main: () => void): BackgroundDefinition;
6
6
  declare function defineBackground(definition: BackgroundDefinition): BackgroundDefinition;
7
7
 
8
8
  type ContentScriptOverlayAlignment = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
9
+ /**
10
+ * ![Visualization of different append modes](https://wxt.dev/content-script-ui-append.png)
11
+ */
9
12
  type ContentScriptAppendMode = 'last' | 'first' | 'replace' | 'before' | 'after' | ((anchor: Element, ui: Element) => void);
10
- type ContentScriptPositioningOptions = {
13
+ interface ContentScriptInlinePositioningOptions {
11
14
  type: 'inline';
12
- } | {
15
+ }
16
+ interface ContentScriptOverlayPositioningOptions {
13
17
  type: 'overlay';
14
18
  /**
15
19
  * The `z-index` used on the `shadowHost`. Set to a positive number to show your UI over website
@@ -20,17 +24,26 @@ type ContentScriptPositioningOptions = {
20
24
  * When using `type: "overlay"`, the mounted element is 0px by 0px in size. Alignment specifies
21
25
  * which corner is aligned with that 0x0 pixel space.
22
26
  *
27
+ * ![Visualization of alignment options](https://wxt.dev/content-script-ui-alignment.png)
28
+ *
23
29
  * @default "top-left"
24
30
  */
25
31
  alignment?: ContentScriptOverlayAlignment;
26
- } | {
32
+ }
33
+ interface ContentScriptModalPositioningOptions {
27
34
  type: 'modal';
28
35
  /**
29
36
  * The `z-index` used on the `shadowHost`. Set to a positive number to show your UI over website
30
37
  * content.
31
38
  */
32
39
  zIndex?: number;
33
- };
40
+ }
41
+ /**
42
+ * Choose between `"inline"`, `"overlay"`, or `"modal" `types.
43
+ *
44
+ * ![Visualization of different types](https://wxt.dev/content-script-ui-types.png)
45
+ */
46
+ type ContentScriptPositioningOptions = ContentScriptInlinePositioningOptions | ContentScriptOverlayPositioningOptions | ContentScriptModalPositioningOptions;
34
47
  interface ContentScriptAnchoredOptions {
35
48
  /**
36
49
  * A CSS selector, element, or function that returns one of the two. Along with `append`, the
@@ -54,7 +67,7 @@ interface ContentScriptAnchoredOptions {
54
67
  * Utility for mounting content script UI's with isolated styles. Automatically removed from the DOM
55
68
  * when the content script's context is invalidated.
56
69
  *
57
- * See https://wxt.dev/entrypoints/content-scripts.html#ui for full documentation.
70
+ * See https://wxt.dev/guide/content-script-ui.html for full documentation.
58
71
  *
59
72
  * @example
60
73
  * // entrypoints/example-ui.content/index.ts
@@ -129,7 +142,7 @@ type ContentScriptUiOptions<TApp> = ContentScriptPositioningOptions & ContentScr
129
142
  * set `cssInjectionMode: "ui"`, the imported CSS will be included automatically. You do not need
130
143
  * to pass those styles in here. This is for any additional styles not in the imported CSS.
131
144
  *
132
- * See https://wxt.dev/entrypoints/content-scripts.html#ui for more info.
145
+ * See https://wxt.dev/guide/content-script-ui.html for more info.
133
146
  */
134
147
  css?: string;
135
148
  };
@@ -181,4 +194,4 @@ type ContentScriptIframeOptions = ContentScriptPositioningOptions & ContentScrip
181
194
 
182
195
  declare function defineContentScript(definition: ContentScriptDefinition): ContentScriptDefinition;
183
196
 
184
- export { ContentScriptContext, type ContentScriptIframe, type ContentScriptIframeOptions, type ContentScriptUi, type ContentScriptUiOptions, createContentScriptIframe, createContentScriptUi, defineBackground, defineContentScript };
197
+ export { type ContentScriptAnchoredOptions, type ContentScriptAppendMode, ContentScriptContext, type ContentScriptIframe, type ContentScriptIframeOptions, type ContentScriptInlinePositioningOptions, type ContentScriptModalPositioningOptions, type ContentScriptOverlayAlignment, type ContentScriptOverlayPositioningOptions, type ContentScriptPositioningOptions, type ContentScriptUi, type ContentScriptUiOptions, createContentScriptIframe, createContentScriptUi, defineBackground, defineContentScript };
package/dist/index.cjs CHANGED
@@ -2616,51 +2616,46 @@ var VIRTUAL_NOOP_BACKGROUND_MODULE_ID = "virtual:user-background";
2616
2616
 
2617
2617
  // src/core/utils/building/find-entrypoints.ts
2618
2618
  async function findEntrypoints(config) {
2619
- const relativePaths = await (0, import_fast_glob2.default)("**/*", {
2619
+ const relativePaths = await (0, import_fast_glob2.default)(Object.keys(PATH_GLOB_TO_TYPE_MAP), {
2620
2620
  cwd: config.entrypointsDir
2621
2621
  });
2622
2622
  relativePaths.sort();
2623
2623
  const pathGlobs = Object.keys(PATH_GLOB_TO_TYPE_MAP);
2624
- let hasBackground = false;
2625
- const possibleEntrypoints = await Promise.all(
2626
- relativePaths.map(async (relativePath) => {
2627
- const path10 = (0, import_path2.resolve)(config.entrypointsDir, relativePath);
2628
- const matchingGlob = pathGlobs.find(
2629
- (glob5) => (0, import_minimatch.minimatch)(relativePath, glob5)
2630
- );
2631
- if (matchingGlob == null) {
2632
- config.logger.warn(
2633
- `${relativePath} does not match any known entrypoint. Known entrypoints:
2634
- ${JSON.stringify(
2635
- PATH_GLOB_TO_TYPE_MAP,
2636
- null,
2637
- 2
2638
- )}`
2639
- );
2640
- return;
2641
- }
2624
+ const entrypointInfos = relativePaths.reduce((results, relativePath) => {
2625
+ const inputPath = (0, import_path2.resolve)(config.entrypointsDir, relativePath);
2626
+ const name = getEntrypointName(config.entrypointsDir, inputPath);
2627
+ const matchingGlob = pathGlobs.find(
2628
+ (glob5) => (0, import_minimatch.minimatch)(relativePath, glob5)
2629
+ );
2630
+ if (matchingGlob) {
2642
2631
  const type = PATH_GLOB_TO_TYPE_MAP[matchingGlob];
2643
- if (type === "ignored")
2644
- return;
2632
+ results.push({ name, inputPath, type });
2633
+ }
2634
+ return results;
2635
+ }, []);
2636
+ preventDuplicateEntrypointNames(config, entrypointInfos);
2637
+ let hasBackground = false;
2638
+ const entrypoints = await Promise.all(
2639
+ entrypointInfos.map(async (info) => {
2640
+ const { type } = info;
2645
2641
  switch (type) {
2646
2642
  case "popup":
2647
- return await getPopupEntrypoint(config, path10);
2643
+ return await getPopupEntrypoint(config, info);
2648
2644
  case "options":
2649
- return await getOptionsEntrypoint(config, path10);
2645
+ return await getOptionsEntrypoint(config, info);
2650
2646
  case "background":
2651
2647
  hasBackground = true;
2652
- return await getBackgroundEntrypoint(config, path10);
2648
+ return await getBackgroundEntrypoint(config, info);
2653
2649
  case "content-script":
2654
- return await getContentScriptEntrypoint(config, path10);
2650
+ return await getContentScriptEntrypoint(config, info);
2655
2651
  case "unlisted-page":
2656
- return await getUnlistedPageEntrypoint(config, path10);
2652
+ return await getUnlistedPageEntrypoint(config, info);
2657
2653
  case "unlisted-script":
2658
- return await getUnlistedScriptEntrypoint(config, path10);
2654
+ return await getUnlistedScriptEntrypoint(config, info);
2659
2655
  case "content-script-style":
2660
2656
  return {
2657
+ ...info,
2661
2658
  type,
2662
- name: getEntrypointName(config.entrypointsDir, path10),
2663
- inputPath: path10,
2664
2659
  outputDir: (0, import_path2.resolve)(config.outDir, CONTENT_SCRIPT_OUT_DIR),
2665
2660
  options: {
2666
2661
  include: void 0,
@@ -2669,9 +2664,8 @@ ${JSON.stringify(
2669
2664
  };
2670
2665
  default:
2671
2666
  return {
2667
+ ...info,
2672
2668
  type,
2673
- name: getEntrypointName(config.entrypointsDir, path10),
2674
- inputPath: path10,
2675
2669
  outputDir: config.outDir,
2676
2670
  options: {
2677
2671
  include: void 0,
@@ -2681,25 +2675,13 @@ ${JSON.stringify(
2681
2675
  }
2682
2676
  })
2683
2677
  );
2684
- const entrypoints = possibleEntrypoints.filter(
2685
- (entry) => !!entry
2686
- );
2687
- const existingNames = {};
2688
- entrypoints.forEach((entrypoint) => {
2689
- const withSameName = existingNames[entrypoint.name];
2690
- if (withSameName) {
2691
- throw Error(
2692
- `Multiple entrypoints with the name "${entrypoint.name}" detected, but only one is allowed: ${[
2693
- (0, import_path2.relative)(config.root, withSameName.inputPath),
2694
- (0, import_path2.relative)(config.root, entrypoint.inputPath)
2695
- ].join(", ")}`
2696
- );
2697
- }
2698
- existingNames[entrypoint.name] = entrypoint;
2699
- });
2700
2678
  if (config.command === "serve" && !hasBackground) {
2701
2679
  entrypoints.push(
2702
- await getBackgroundEntrypoint(config, VIRTUAL_NOOP_BACKGROUND_MODULE_ID)
2680
+ await getBackgroundEntrypoint(config, {
2681
+ inputPath: VIRTUAL_NOOP_BACKGROUND_MODULE_ID,
2682
+ name: "background",
2683
+ type: "background"
2684
+ })
2703
2685
  );
2704
2686
  }
2705
2687
  config.logger.debug("All entrypoints:", entrypoints);
@@ -2722,6 +2704,36 @@ ${JSON.stringify(
2722
2704
  config.logger.debug(`${config.browser} entrypoints:`, targetEntrypoints);
2723
2705
  return targetEntrypoints;
2724
2706
  }
2707
+ function preventDuplicateEntrypointNames(config, files) {
2708
+ const namesToPaths = files.reduce(
2709
+ (map, { name, inputPath }) => {
2710
+ map[name] ??= [];
2711
+ map[name].push(inputPath);
2712
+ return map;
2713
+ },
2714
+ {}
2715
+ );
2716
+ const errorLines = Object.entries(namesToPaths).reduce(
2717
+ (lines, [name, absolutePaths]) => {
2718
+ if (absolutePaths.length > 1) {
2719
+ lines.push(`- ${name}`);
2720
+ absolutePaths.forEach((absolutePath) => {
2721
+ lines.push(` - ${(0, import_path2.relative)(config.root, absolutePath)}`);
2722
+ });
2723
+ }
2724
+ return lines;
2725
+ },
2726
+ []
2727
+ );
2728
+ if (errorLines.length > 0) {
2729
+ const errorContent = errorLines.join("\n");
2730
+ throw Error(
2731
+ `Multiple entrypoints with the same name detected, only one entrypoint for each name is allowed.
2732
+
2733
+ ${errorContent}`
2734
+ );
2735
+ }
2736
+ }
2725
2737
  function getHtmlBaseOptions(document) {
2726
2738
  const options = {};
2727
2739
  const includeContent = document.querySelector("meta[name='manifest.include']")?.getAttribute("content");
@@ -2734,8 +2746,8 @@ function getHtmlBaseOptions(document) {
2734
2746
  }
2735
2747
  return options;
2736
2748
  }
2737
- async function getPopupEntrypoint(config, path10) {
2738
- const content = await import_fs_extra3.default.readFile(path10, "utf-8");
2749
+ async function getPopupEntrypoint(config, { inputPath, name }) {
2750
+ const content = await import_fs_extra3.default.readFile(inputPath, "utf-8");
2739
2751
  const { document } = (0, import_linkedom.parseHTML)(content);
2740
2752
  const options = getHtmlBaseOptions(document);
2741
2753
  const title = document.querySelector("title");
@@ -2764,12 +2776,12 @@ async function getPopupEntrypoint(config, path10) {
2764
2776
  type: "popup",
2765
2777
  name: "popup",
2766
2778
  options,
2767
- inputPath: path10,
2779
+ inputPath,
2768
2780
  outputDir: config.outDir
2769
2781
  };
2770
2782
  }
2771
- async function getOptionsEntrypoint(config, path10) {
2772
- const content = await import_fs_extra3.default.readFile(path10, "utf-8");
2783
+ async function getOptionsEntrypoint(config, { inputPath, name }) {
2784
+ const content = await import_fs_extra3.default.readFile(inputPath, "utf-8");
2773
2785
  const { document } = (0, import_linkedom.parseHTML)(content);
2774
2786
  const options = getHtmlBaseOptions(document);
2775
2787
  const openInTabContent = document.querySelector("meta[name='manifest.open_in_tab']")?.getAttribute("content");
@@ -2788,25 +2800,24 @@ async function getOptionsEntrypoint(config, path10) {
2788
2800
  type: "options",
2789
2801
  name: "options",
2790
2802
  options,
2791
- inputPath: path10,
2803
+ inputPath,
2792
2804
  outputDir: config.outDir
2793
2805
  };
2794
2806
  }
2795
- async function getUnlistedPageEntrypoint(config, path10) {
2796
- const content = await import_fs_extra3.default.readFile(path10, "utf-8");
2807
+ async function getUnlistedPageEntrypoint(config, { inputPath, name }) {
2808
+ const content = await import_fs_extra3.default.readFile(inputPath, "utf-8");
2797
2809
  const { document } = (0, import_linkedom.parseHTML)(content);
2798
2810
  return {
2799
2811
  type: "unlisted-page",
2800
- name: getEntrypointName(config.entrypointsDir, path10),
2801
- inputPath: path10,
2812
+ name: getEntrypointName(config.entrypointsDir, inputPath),
2813
+ inputPath,
2802
2814
  outputDir: config.outDir,
2803
2815
  options: getHtmlBaseOptions(document)
2804
2816
  };
2805
2817
  }
2806
- async function getUnlistedScriptEntrypoint(config, path10) {
2807
- const name = getEntrypointName(config.entrypointsDir, path10);
2818
+ async function getUnlistedScriptEntrypoint(config, { inputPath, name }) {
2808
2819
  const defaultExport = await importEntrypointFile(
2809
- path10,
2820
+ inputPath,
2810
2821
  config
2811
2822
  );
2812
2823
  if (defaultExport == null) {
@@ -2819,17 +2830,16 @@ async function getUnlistedScriptEntrypoint(config, path10) {
2819
2830
  return {
2820
2831
  type: "unlisted-script",
2821
2832
  name,
2822
- inputPath: path10,
2833
+ inputPath,
2823
2834
  outputDir: config.outDir,
2824
2835
  options
2825
2836
  };
2826
2837
  }
2827
- async function getBackgroundEntrypoint(config, path10) {
2828
- const name = "background";
2838
+ async function getBackgroundEntrypoint(config, { inputPath, name }) {
2829
2839
  let options = {};
2830
- if (path10 !== VIRTUAL_NOOP_BACKGROUND_MODULE_ID) {
2840
+ if (inputPath !== VIRTUAL_NOOP_BACKGROUND_MODULE_ID) {
2831
2841
  const defaultExport = await importEntrypointFile(
2832
- path10,
2842
+ inputPath,
2833
2843
  config
2834
2844
  );
2835
2845
  if (defaultExport == null) {
@@ -2843,7 +2853,7 @@ async function getBackgroundEntrypoint(config, path10) {
2843
2853
  return {
2844
2854
  type: "background",
2845
2855
  name,
2846
- inputPath: path10,
2856
+ inputPath,
2847
2857
  outputDir: config.outDir,
2848
2858
  options: {
2849
2859
  ...options,
@@ -2852,9 +2862,8 @@ async function getBackgroundEntrypoint(config, path10) {
2852
2862
  }
2853
2863
  };
2854
2864
  }
2855
- async function getContentScriptEntrypoint(config, path10) {
2856
- const name = getEntrypointName(config.entrypointsDir, path10);
2857
- const { main: _, ...options } = await importEntrypointFile(path10, config);
2865
+ async function getContentScriptEntrypoint(config, { inputPath, name }) {
2866
+ const { main: _, ...options } = await importEntrypointFile(inputPath, config);
2858
2867
  if (options == null) {
2859
2868
  throw Error(
2860
2869
  `${name}: Default export not found, did you forget to call "export default defineContentScript(...)"?`
@@ -2863,7 +2872,7 @@ async function getContentScriptEntrypoint(config, path10) {
2863
2872
  return {
2864
2873
  type: "content-script",
2865
2874
  name,
2866
- inputPath: path10,
2875
+ inputPath,
2867
2876
  outputDir: (0, import_path2.resolve)(config.outDir, CONTENT_SCRIPT_OUT_DIR),
2868
2877
  options
2869
2878
  };
@@ -2902,12 +2911,10 @@ var PATH_GLOB_TO_TYPE_MAP = {
2902
2911
  "options/index.html": "options",
2903
2912
  "*.html": "unlisted-page",
2904
2913
  "*/index.html": "unlisted-page",
2905
- "*.[jt]s": "unlisted-script",
2906
- "*/index.ts": "unlisted-script",
2914
+ "*.[jt]s?(x)": "unlisted-script",
2915
+ "*/index.[jt]s?(x)": "unlisted-script",
2907
2916
  [`*.${CSS_EXTENSIONS_PATTERN}`]: "unlisted-style",
2908
- [`*/index.${CSS_EXTENSIONS_PATTERN}`]: "unlisted-style",
2909
- // Don't warn about any files in subdirectories, like CSS or JS entrypoints for HTML files or tests
2910
- "*/**": "ignored"
2917
+ [`*/index.${CSS_EXTENSIONS_PATTERN}`]: "unlisted-style"
2911
2918
  };
2912
2919
  var CONTENT_SCRIPT_OUT_DIR = "content-scripts";
2913
2920
 
@@ -4299,7 +4306,7 @@ function getChunkSortWeight(filename) {
4299
4306
  var import_picocolors3 = __toESM(require("picocolors"), 1);
4300
4307
 
4301
4308
  // package.json
4302
- var version = "0.11.1";
4309
+ var version = "0.11.2";
4303
4310
 
4304
4311
  // src/core/utils/log/printHeader.ts
4305
4312
  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.11.1";
65
+ var version = "0.11.2";
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.11.1";
65
+ var version = "0.11.2";
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-65FJ5ESC.js";
18
+ } from "./chunk-XTGVY6KL.js";
19
19
  import "./chunk-VBXJIVYU.js";
20
20
 
21
21
  // src/core/build.ts
package/dist/testing.cjs CHANGED
@@ -691,12 +691,10 @@ var PATH_GLOB_TO_TYPE_MAP = {
691
691
  "options/index.html": "options",
692
692
  "*.html": "unlisted-page",
693
693
  "*/index.html": "unlisted-page",
694
- "*.[jt]s": "unlisted-script",
695
- "*/index.ts": "unlisted-script",
694
+ "*.[jt]s?(x)": "unlisted-script",
695
+ "*/index.[jt]s?(x)": "unlisted-script",
696
696
  [`*.${CSS_EXTENSIONS_PATTERN}`]: "unlisted-style",
697
- [`*/index.${CSS_EXTENSIONS_PATTERN}`]: "unlisted-style",
698
- // Don't warn about any files in subdirectories, like CSS or JS entrypoints for HTML files or tests
699
- "*/**": "ignored"
697
+ [`*/index.${CSS_EXTENSIONS_PATTERN}`]: "unlisted-style"
700
698
  };
701
699
 
702
700
  // src/core/utils/building/generate-wxt-dir.ts
package/dist/testing.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  unimport,
7
7
  webextensionPolyfillAlias,
8
8
  webextensionPolyfillInlineDeps
9
- } from "./chunk-65FJ5ESC.js";
9
+ } from "./chunk-XTGVY6KL.js";
10
10
  import "./chunk-VBXJIVYU.js";
11
11
 
12
12
  // src/testing/fake-browser.ts
@@ -75,12 +75,10 @@ var PATH_GLOB_TO_TYPE_MAP = {
75
75
  "options/index.html": "options",
76
76
  "*.html": "unlisted-page",
77
77
  "*/index.html": "unlisted-page",
78
- "*.[jt]s": "unlisted-script",
79
- "*/index.ts": "unlisted-script",
78
+ "*.[jt]s?(x)": "unlisted-script",
79
+ "*/index.[jt]s?(x)": "unlisted-script",
80
80
  [`*.${CSS_EXTENSIONS_PATTERN}`]: "unlisted-style",
81
- [`*/index.${CSS_EXTENSIONS_PATTERN}`]: "unlisted-style",
82
- // Don't warn about any files in subdirectories, like CSS or JS entrypoints for HTML files or tests
83
- "*/**": "ignored"
81
+ [`*/index.${CSS_EXTENSIONS_PATTERN}`]: "unlisted-style"
84
82
  };
85
83
 
86
84
  // src/core/utils/building/generate-wxt-dir.ts
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "wxt",
3
3
  "type": "module",
4
- "version": "0.11.1",
4
+ "version": "0.11.2",
5
5
  "description": "Next gen framework for developing web extensions",
6
6
  "engines": {
7
7
  "node": ">=18",