wxt 0.7.4 → 0.7.5
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.
- package/dist/cli.cjs +32 -19
- package/dist/client.d.ts +2 -0
- package/dist/index.cjs +31 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +31 -18
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -128,6 +128,8 @@ interface ContentScriptDefinition extends ExcludableEntrypoint {
|
|
|
128
128
|
* - `"manual"` - Exclude the CSS from the manifest. You are responsible for manually loading it
|
|
129
129
|
* onto the page. Use `browser.runtime.getURL("content-scripts/<name>.css")` to get the file's
|
|
130
130
|
* URL
|
|
131
|
+
* - `"ui"` - Exclude the CSS from the manifest. CSS will be automatically added to your UI when
|
|
132
|
+
* calling `createContentScriptUi`
|
|
131
133
|
*
|
|
132
134
|
* @default "manifest"
|
|
133
135
|
*/
|
package/dist/index.cjs
CHANGED
|
@@ -2095,9 +2095,13 @@ async function getPopupEntrypoint(config, path9) {
|
|
|
2095
2095
|
);
|
|
2096
2096
|
}
|
|
2097
2097
|
}
|
|
2098
|
-
const
|
|
2099
|
-
if (
|
|
2100
|
-
options.mv2Key =
|
|
2098
|
+
const mv2TypeContent = document.querySelector("meta[name='manifest.type']")?.getAttribute("content");
|
|
2099
|
+
if (mv2TypeContent) {
|
|
2100
|
+
options.mv2Key = mv2TypeContent === "page_action" ? "page_action" : "browser_action";
|
|
2101
|
+
}
|
|
2102
|
+
const browserStyleContent = document.querySelector("meta[name='manifest.browser_style']")?.getAttribute("content");
|
|
2103
|
+
if (browserStyleContent) {
|
|
2104
|
+
options.browserStyle = browserStyleContent === "true";
|
|
2101
2105
|
}
|
|
2102
2106
|
return {
|
|
2103
2107
|
type: "popup",
|
|
@@ -2484,18 +2488,23 @@ var ContentSecurityPolicy = class _ContentSecurityPolicy {
|
|
|
2484
2488
|
};
|
|
2485
2489
|
|
|
2486
2490
|
// src/core/utils/content-scripts.ts
|
|
2487
|
-
function hashContentScriptOptions(options) {
|
|
2491
|
+
function hashContentScriptOptions(options, config) {
|
|
2492
|
+
const simplifiedOptions = mapWxtOptionsToContentScript(options, config);
|
|
2493
|
+
Object.keys(simplifiedOptions).forEach((key) => {
|
|
2494
|
+
if (simplifiedOptions[key] == null)
|
|
2495
|
+
delete simplifiedOptions[key];
|
|
2496
|
+
});
|
|
2488
2497
|
const withDefaults = {
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2498
|
+
exclude_globs: [],
|
|
2499
|
+
exclude_matches: [],
|
|
2500
|
+
include_globs: [],
|
|
2501
|
+
match_about_blank: false,
|
|
2502
|
+
run_at: "document_idle",
|
|
2503
|
+
all_frames: false,
|
|
2504
|
+
// @ts-expect-error - not in type
|
|
2505
|
+
match_origin_as_fallback: false,
|
|
2496
2506
|
world: "ISOLATED",
|
|
2497
|
-
|
|
2498
|
-
...options
|
|
2507
|
+
...simplifiedOptions
|
|
2499
2508
|
};
|
|
2500
2509
|
return JSON.stringify(
|
|
2501
2510
|
Object.entries(withDefaults).map(([key, value]) => {
|
|
@@ -2568,13 +2577,17 @@ async function writeManifest(manifest, output, config) {
|
|
|
2568
2577
|
}
|
|
2569
2578
|
async function generateMainfest(entrypoints, buildOutput, config) {
|
|
2570
2579
|
const pkg = await getPackageJson(config);
|
|
2580
|
+
const versionName = config.manifest.version_name ?? pkg?.version;
|
|
2581
|
+
const version3 = config.manifest.version ?? simplifyVersion(pkg?.version);
|
|
2571
2582
|
const baseManifest = {
|
|
2572
2583
|
manifest_version: config.manifestVersion,
|
|
2573
2584
|
name: pkg?.name,
|
|
2574
2585
|
description: pkg?.description,
|
|
2575
|
-
version:
|
|
2576
|
-
|
|
2577
|
-
|
|
2586
|
+
version: version3,
|
|
2587
|
+
version_name: (
|
|
2588
|
+
// Firefox doesn't support version_name
|
|
2589
|
+
config.browser === "firefox" || versionName === version3 ? void 0 : versionName
|
|
2590
|
+
),
|
|
2578
2591
|
short_name: pkg?.shortName,
|
|
2579
2592
|
icons: discoverIcons(buildOutput)
|
|
2580
2593
|
};
|
|
@@ -2768,7 +2781,7 @@ function addEntrypoints(manifest, entrypoints, buildOutput, config) {
|
|
|
2768
2781
|
);
|
|
2769
2782
|
} else {
|
|
2770
2783
|
const hashToEntrypointsMap = contentScripts.reduce((map, script) => {
|
|
2771
|
-
const hash = hashContentScriptOptions(script.options);
|
|
2784
|
+
const hash = hashContentScriptOptions(script.options, config);
|
|
2772
2785
|
if (map.has(hash))
|
|
2773
2786
|
map.get(hash)?.push(script);
|
|
2774
2787
|
else
|
|
@@ -4564,7 +4577,7 @@ async function clean(root = process.cwd()) {
|
|
|
4564
4577
|
}
|
|
4565
4578
|
|
|
4566
4579
|
// package.json
|
|
4567
|
-
var version2 = "0.7.
|
|
4580
|
+
var version2 = "0.7.5";
|
|
4568
4581
|
|
|
4569
4582
|
// src/core/utils/defineConfig.ts
|
|
4570
4583
|
function defineConfig(config) {
|