wxt 0.17.8 → 0.17.9
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/{chunk-5XQOZCZF.js → chunk-ONUEB57P.js} +41 -80
- package/dist/cli.js +42 -81
- package/dist/{index-cFBbMXAl.d.cts → index-mZodC81T.d.cts} +18 -12
- package/dist/{index-cFBbMXAl.d.ts → index-mZodC81T.d.ts} +18 -12
- package/dist/index.cjs +42 -81
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/testing.cjs +39 -78
- package/dist/testing.d.cts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +1 -1
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-VBXJIVYU.js";
|
|
4
4
|
|
|
5
5
|
// package.json
|
|
6
|
-
var version = "0.17.
|
|
6
|
+
var version = "0.17.9";
|
|
7
7
|
|
|
8
8
|
// src/core/utils/paths.ts
|
|
9
9
|
import systemPath from "node:path";
|
|
@@ -1699,7 +1699,7 @@ async function resolveConfig(inlineConfig, command, server) {
|
|
|
1699
1699
|
logger.level = LogLevels.debug;
|
|
1700
1700
|
const browser = mergedConfig.browser ?? "chrome";
|
|
1701
1701
|
const manifestVersion = mergedConfig.manifestVersion ?? (browser === "firefox" || browser === "safari" ? 2 : 3);
|
|
1702
|
-
const mode = mergedConfig.mode ??
|
|
1702
|
+
const mode = mergedConfig.mode ?? COMMAND_MODES[command];
|
|
1703
1703
|
const env = { browser, command, manifestVersion, mode };
|
|
1704
1704
|
const root = path5.resolve(
|
|
1705
1705
|
inlineConfig.root ?? userConfig.root ?? process.cwd()
|
|
@@ -1740,12 +1740,6 @@ async function resolveConfig(inlineConfig, command, server) {
|
|
|
1740
1740
|
"~~": root
|
|
1741
1741
|
}).map(([key, value]) => [key, path5.resolve(root, value)])
|
|
1742
1742
|
);
|
|
1743
|
-
const analysisOutputFile = path5.resolve(
|
|
1744
|
-
root,
|
|
1745
|
-
mergedConfig.analysis?.outputFile ?? "stats.html"
|
|
1746
|
-
);
|
|
1747
|
-
const analysisOutputDir = path5.dirname(analysisOutputFile);
|
|
1748
|
-
const analysisOutputName = path5.parse(analysisOutputFile).name;
|
|
1749
1743
|
const finalConfig = {
|
|
1750
1744
|
browser,
|
|
1751
1745
|
command,
|
|
@@ -1768,25 +1762,14 @@ async function resolveConfig(inlineConfig, command, server) {
|
|
|
1768
1762
|
srcDir,
|
|
1769
1763
|
typesDir,
|
|
1770
1764
|
wxtDir,
|
|
1771
|
-
zip:
|
|
1772
|
-
transformManifest
|
|
1773
|
-
|
|
1774
|
-
inlineConfig.transformManifest?.(manifest);
|
|
1775
|
-
},
|
|
1776
|
-
analysis: {
|
|
1777
|
-
enabled: mergedConfig.analysis?.enabled ?? false,
|
|
1778
|
-
open: mergedConfig.analysis?.open ?? false,
|
|
1779
|
-
template: mergedConfig.analysis?.template ?? "treemap",
|
|
1780
|
-
outputFile: analysisOutputFile,
|
|
1781
|
-
outputDir: analysisOutputDir,
|
|
1782
|
-
outputName: analysisOutputName,
|
|
1783
|
-
keepArtifacts: mergedConfig.analysis?.keepArtifacts ?? false
|
|
1784
|
-
},
|
|
1765
|
+
zip: resolveZipConfig(root, mergedConfig),
|
|
1766
|
+
transformManifest: mergedConfig.transformManifest,
|
|
1767
|
+
analysis: resolveAnalysisConfig(root, mergedConfig),
|
|
1785
1768
|
userConfigMetadata: userConfigMetadata ?? {},
|
|
1786
1769
|
alias,
|
|
1787
|
-
experimental: {
|
|
1788
|
-
includeBrowserPolyfill:
|
|
1789
|
-
},
|
|
1770
|
+
experimental: defu(mergedConfig.experimental, {
|
|
1771
|
+
includeBrowserPolyfill: true
|
|
1772
|
+
}),
|
|
1790
1773
|
server,
|
|
1791
1774
|
dev: {
|
|
1792
1775
|
reloadCommand
|
|
@@ -1807,70 +1790,27 @@ async function resolveManifestConfig(env, manifest) {
|
|
|
1807
1790
|
return await (typeof manifest === "function" ? manifest(env) : manifest ?? {});
|
|
1808
1791
|
}
|
|
1809
1792
|
function mergeInlineConfig(inlineConfig, userConfig) {
|
|
1810
|
-
|
|
1811
|
-
if (inlineConfig.imports === false || userConfig.imports === false) {
|
|
1812
|
-
imports = false;
|
|
1813
|
-
} else if (userConfig.imports == null && inlineConfig.imports == null) {
|
|
1814
|
-
imports = void 0;
|
|
1815
|
-
} else {
|
|
1816
|
-
imports = defu(inlineConfig.imports ?? {}, userConfig.imports ?? {});
|
|
1817
|
-
}
|
|
1793
|
+
const imports = inlineConfig.imports === false || userConfig.imports === false ? false : userConfig.imports == null && inlineConfig.imports == null ? void 0 : defu(inlineConfig.imports ?? {}, userConfig.imports ?? {});
|
|
1818
1794
|
const manifest = async (env) => {
|
|
1819
1795
|
const user = await resolveManifestConfig(env, userConfig.manifest);
|
|
1820
1796
|
const inline = await resolveManifestConfig(env, inlineConfig.manifest);
|
|
1821
1797
|
return defu(inline, user);
|
|
1822
1798
|
};
|
|
1823
|
-
const
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
const zip = defu(
|
|
1828
|
-
inlineConfig.zip ?? {},
|
|
1829
|
-
userConfig.zip ?? {}
|
|
1830
|
-
);
|
|
1831
|
-
const hooks = defu(
|
|
1832
|
-
inlineConfig.hooks ?? {},
|
|
1833
|
-
userConfig.hooks ?? {}
|
|
1834
|
-
);
|
|
1799
|
+
const transformManifest = (manifest2) => {
|
|
1800
|
+
userConfig.transformManifest?.(manifest2);
|
|
1801
|
+
inlineConfig.transformManifest?.(manifest2);
|
|
1802
|
+
};
|
|
1835
1803
|
return {
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
configFile: inlineConfig.configFile,
|
|
1840
|
-
debug: inlineConfig.debug ?? userConfig.debug,
|
|
1841
|
-
entrypointsDir: inlineConfig.entrypointsDir ?? userConfig.entrypointsDir,
|
|
1842
|
-
filterEntrypoints: inlineConfig.filterEntrypoints ?? userConfig.filterEntrypoints,
|
|
1804
|
+
...defu(inlineConfig, userConfig),
|
|
1805
|
+
// Custom merge values
|
|
1806
|
+
transformManifest,
|
|
1843
1807
|
imports,
|
|
1844
|
-
logger: inlineConfig.logger ?? userConfig.logger,
|
|
1845
1808
|
manifest,
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
runner,
|
|
1849
|
-
srcDir: inlineConfig.srcDir ?? userConfig.srcDir,
|
|
1850
|
-
outDir: inlineConfig.outDir ?? userConfig.outDir,
|
|
1851
|
-
zip,
|
|
1852
|
-
analysis: {
|
|
1853
|
-
...userConfig.analysis,
|
|
1854
|
-
...inlineConfig.analysis
|
|
1855
|
-
},
|
|
1856
|
-
alias: {
|
|
1857
|
-
...userConfig.alias,
|
|
1858
|
-
...inlineConfig.alias
|
|
1859
|
-
},
|
|
1860
|
-
experimental: {
|
|
1861
|
-
...userConfig.experimental,
|
|
1862
|
-
...inlineConfig.experimental
|
|
1863
|
-
},
|
|
1864
|
-
vite: void 0,
|
|
1865
|
-
transformManifest: void 0,
|
|
1866
|
-
dev: {
|
|
1867
|
-
...userConfig.dev,
|
|
1868
|
-
...inlineConfig.dev
|
|
1869
|
-
},
|
|
1870
|
-
hooks
|
|
1809
|
+
// Vite builder handles merging vite config internally
|
|
1810
|
+
vite: void 0
|
|
1871
1811
|
};
|
|
1872
1812
|
}
|
|
1873
|
-
function
|
|
1813
|
+
function resolveZipConfig(root, mergedConfig) {
|
|
1874
1814
|
const downloadedPackagesDir = path5.resolve(root, ".wxt/local_modules");
|
|
1875
1815
|
return {
|
|
1876
1816
|
name: void 0,
|
|
@@ -1895,6 +1835,23 @@ function resolveInternalZipConfig(root, mergedConfig) {
|
|
|
1895
1835
|
downloadedPackagesDir
|
|
1896
1836
|
};
|
|
1897
1837
|
}
|
|
1838
|
+
function resolveAnalysisConfig(root, mergedConfig) {
|
|
1839
|
+
const analysisOutputFile = path5.resolve(
|
|
1840
|
+
root,
|
|
1841
|
+
mergedConfig.analysis?.outputFile ?? "stats.html"
|
|
1842
|
+
);
|
|
1843
|
+
const analysisOutputDir = path5.dirname(analysisOutputFile);
|
|
1844
|
+
const analysisOutputName = path5.parse(analysisOutputFile).name;
|
|
1845
|
+
return {
|
|
1846
|
+
enabled: mergedConfig.analysis?.enabled ?? false,
|
|
1847
|
+
open: mergedConfig.analysis?.open ?? false,
|
|
1848
|
+
template: mergedConfig.analysis?.template ?? "treemap",
|
|
1849
|
+
outputFile: analysisOutputFile,
|
|
1850
|
+
outputDir: analysisOutputDir,
|
|
1851
|
+
outputName: analysisOutputName,
|
|
1852
|
+
keepArtifacts: mergedConfig.analysis?.keepArtifacts ?? false
|
|
1853
|
+
};
|
|
1854
|
+
}
|
|
1898
1855
|
async function getUnimportOptions(wxtDir, logger, config) {
|
|
1899
1856
|
if (config.imports === false)
|
|
1900
1857
|
return false;
|
|
@@ -1947,6 +1904,10 @@ function logMissingDir(logger, name, expected) {
|
|
|
1947
1904
|
)}`
|
|
1948
1905
|
);
|
|
1949
1906
|
}
|
|
1907
|
+
var COMMAND_MODES = {
|
|
1908
|
+
build: "production",
|
|
1909
|
+
serve: "development"
|
|
1910
|
+
};
|
|
1950
1911
|
|
|
1951
1912
|
// src/core/utils/building/group-entrypoints.ts
|
|
1952
1913
|
function groupEntrypoints(entrypoints) {
|
|
@@ -2379,7 +2340,7 @@ async function generateManifest(entrypoints, buildOutput) {
|
|
|
2379
2340
|
addDevModeCsp(manifest);
|
|
2380
2341
|
if (wxt.config.command === "serve")
|
|
2381
2342
|
addDevModePermissions(manifest);
|
|
2382
|
-
wxt.config.transformManifest(manifest);
|
|
2343
|
+
wxt.config.transformManifest?.(manifest);
|
|
2383
2344
|
await wxt.hooks.callHook("build:manifestGenerated", wxt, manifest);
|
|
2384
2345
|
if (wxt.config.manifestVersion === 2) {
|
|
2385
2346
|
convertWebAccessibleResourcesToMv2(manifest);
|
package/dist/cli.js
CHANGED
|
@@ -1906,7 +1906,7 @@ async function resolveConfig(inlineConfig, command, server) {
|
|
|
1906
1906
|
logger.level = LogLevels.debug;
|
|
1907
1907
|
const browser = mergedConfig.browser ?? "chrome";
|
|
1908
1908
|
const manifestVersion = mergedConfig.manifestVersion ?? (browser === "firefox" || browser === "safari" ? 2 : 3);
|
|
1909
|
-
const mode = mergedConfig.mode ??
|
|
1909
|
+
const mode = mergedConfig.mode ?? COMMAND_MODES[command];
|
|
1910
1910
|
const env = { browser, command, manifestVersion, mode };
|
|
1911
1911
|
const root = path5.resolve(
|
|
1912
1912
|
inlineConfig.root ?? userConfig.root ?? process.cwd()
|
|
@@ -1947,12 +1947,6 @@ async function resolveConfig(inlineConfig, command, server) {
|
|
|
1947
1947
|
"~~": root
|
|
1948
1948
|
}).map(([key, value]) => [key, path5.resolve(root, value)])
|
|
1949
1949
|
);
|
|
1950
|
-
const analysisOutputFile = path5.resolve(
|
|
1951
|
-
root,
|
|
1952
|
-
mergedConfig.analysis?.outputFile ?? "stats.html"
|
|
1953
|
-
);
|
|
1954
|
-
const analysisOutputDir = path5.dirname(analysisOutputFile);
|
|
1955
|
-
const analysisOutputName = path5.parse(analysisOutputFile).name;
|
|
1956
1950
|
const finalConfig = {
|
|
1957
1951
|
browser,
|
|
1958
1952
|
command,
|
|
@@ -1975,25 +1969,14 @@ async function resolveConfig(inlineConfig, command, server) {
|
|
|
1975
1969
|
srcDir,
|
|
1976
1970
|
typesDir,
|
|
1977
1971
|
wxtDir,
|
|
1978
|
-
zip:
|
|
1979
|
-
transformManifest
|
|
1980
|
-
|
|
1981
|
-
inlineConfig.transformManifest?.(manifest);
|
|
1982
|
-
},
|
|
1983
|
-
analysis: {
|
|
1984
|
-
enabled: mergedConfig.analysis?.enabled ?? false,
|
|
1985
|
-
open: mergedConfig.analysis?.open ?? false,
|
|
1986
|
-
template: mergedConfig.analysis?.template ?? "treemap",
|
|
1987
|
-
outputFile: analysisOutputFile,
|
|
1988
|
-
outputDir: analysisOutputDir,
|
|
1989
|
-
outputName: analysisOutputName,
|
|
1990
|
-
keepArtifacts: mergedConfig.analysis?.keepArtifacts ?? false
|
|
1991
|
-
},
|
|
1972
|
+
zip: resolveZipConfig(root, mergedConfig),
|
|
1973
|
+
transformManifest: mergedConfig.transformManifest,
|
|
1974
|
+
analysis: resolveAnalysisConfig(root, mergedConfig),
|
|
1992
1975
|
userConfigMetadata: userConfigMetadata ?? {},
|
|
1993
1976
|
alias,
|
|
1994
|
-
experimental: {
|
|
1995
|
-
includeBrowserPolyfill:
|
|
1996
|
-
},
|
|
1977
|
+
experimental: defu(mergedConfig.experimental, {
|
|
1978
|
+
includeBrowserPolyfill: true
|
|
1979
|
+
}),
|
|
1997
1980
|
server,
|
|
1998
1981
|
dev: {
|
|
1999
1982
|
reloadCommand
|
|
@@ -2014,70 +1997,27 @@ async function resolveManifestConfig(env, manifest) {
|
|
|
2014
1997
|
return await (typeof manifest === "function" ? manifest(env) : manifest ?? {});
|
|
2015
1998
|
}
|
|
2016
1999
|
function mergeInlineConfig(inlineConfig, userConfig) {
|
|
2017
|
-
|
|
2018
|
-
if (inlineConfig.imports === false || userConfig.imports === false) {
|
|
2019
|
-
imports = false;
|
|
2020
|
-
} else if (userConfig.imports == null && inlineConfig.imports == null) {
|
|
2021
|
-
imports = void 0;
|
|
2022
|
-
} else {
|
|
2023
|
-
imports = defu(inlineConfig.imports ?? {}, userConfig.imports ?? {});
|
|
2024
|
-
}
|
|
2000
|
+
const imports = inlineConfig.imports === false || userConfig.imports === false ? false : userConfig.imports == null && inlineConfig.imports == null ? void 0 : defu(inlineConfig.imports ?? {}, userConfig.imports ?? {});
|
|
2025
2001
|
const manifest = async (env) => {
|
|
2026
2002
|
const user = await resolveManifestConfig(env, userConfig.manifest);
|
|
2027
2003
|
const inline = await resolveManifestConfig(env, inlineConfig.manifest);
|
|
2028
2004
|
return defu(inline, user);
|
|
2029
2005
|
};
|
|
2030
|
-
const
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
const zip2 = defu(
|
|
2035
|
-
inlineConfig.zip ?? {},
|
|
2036
|
-
userConfig.zip ?? {}
|
|
2037
|
-
);
|
|
2038
|
-
const hooks = defu(
|
|
2039
|
-
inlineConfig.hooks ?? {},
|
|
2040
|
-
userConfig.hooks ?? {}
|
|
2041
|
-
);
|
|
2006
|
+
const transformManifest = (manifest2) => {
|
|
2007
|
+
userConfig.transformManifest?.(manifest2);
|
|
2008
|
+
inlineConfig.transformManifest?.(manifest2);
|
|
2009
|
+
};
|
|
2042
2010
|
return {
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
configFile: inlineConfig.configFile,
|
|
2047
|
-
debug: inlineConfig.debug ?? userConfig.debug,
|
|
2048
|
-
entrypointsDir: inlineConfig.entrypointsDir ?? userConfig.entrypointsDir,
|
|
2049
|
-
filterEntrypoints: inlineConfig.filterEntrypoints ?? userConfig.filterEntrypoints,
|
|
2011
|
+
...defu(inlineConfig, userConfig),
|
|
2012
|
+
// Custom merge values
|
|
2013
|
+
transformManifest,
|
|
2050
2014
|
imports,
|
|
2051
|
-
logger: inlineConfig.logger ?? userConfig.logger,
|
|
2052
2015
|
manifest,
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
runner,
|
|
2056
|
-
srcDir: inlineConfig.srcDir ?? userConfig.srcDir,
|
|
2057
|
-
outDir: inlineConfig.outDir ?? userConfig.outDir,
|
|
2058
|
-
zip: zip2,
|
|
2059
|
-
analysis: {
|
|
2060
|
-
...userConfig.analysis,
|
|
2061
|
-
...inlineConfig.analysis
|
|
2062
|
-
},
|
|
2063
|
-
alias: {
|
|
2064
|
-
...userConfig.alias,
|
|
2065
|
-
...inlineConfig.alias
|
|
2066
|
-
},
|
|
2067
|
-
experimental: {
|
|
2068
|
-
...userConfig.experimental,
|
|
2069
|
-
...inlineConfig.experimental
|
|
2070
|
-
},
|
|
2071
|
-
vite: void 0,
|
|
2072
|
-
transformManifest: void 0,
|
|
2073
|
-
dev: {
|
|
2074
|
-
...userConfig.dev,
|
|
2075
|
-
...inlineConfig.dev
|
|
2076
|
-
},
|
|
2077
|
-
hooks
|
|
2016
|
+
// Vite builder handles merging vite config internally
|
|
2017
|
+
vite: void 0
|
|
2078
2018
|
};
|
|
2079
2019
|
}
|
|
2080
|
-
function
|
|
2020
|
+
function resolveZipConfig(root, mergedConfig) {
|
|
2081
2021
|
const downloadedPackagesDir = path5.resolve(root, ".wxt/local_modules");
|
|
2082
2022
|
return {
|
|
2083
2023
|
name: void 0,
|
|
@@ -2102,6 +2042,23 @@ function resolveInternalZipConfig(root, mergedConfig) {
|
|
|
2102
2042
|
downloadedPackagesDir
|
|
2103
2043
|
};
|
|
2104
2044
|
}
|
|
2045
|
+
function resolveAnalysisConfig(root, mergedConfig) {
|
|
2046
|
+
const analysisOutputFile = path5.resolve(
|
|
2047
|
+
root,
|
|
2048
|
+
mergedConfig.analysis?.outputFile ?? "stats.html"
|
|
2049
|
+
);
|
|
2050
|
+
const analysisOutputDir = path5.dirname(analysisOutputFile);
|
|
2051
|
+
const analysisOutputName = path5.parse(analysisOutputFile).name;
|
|
2052
|
+
return {
|
|
2053
|
+
enabled: mergedConfig.analysis?.enabled ?? false,
|
|
2054
|
+
open: mergedConfig.analysis?.open ?? false,
|
|
2055
|
+
template: mergedConfig.analysis?.template ?? "treemap",
|
|
2056
|
+
outputFile: analysisOutputFile,
|
|
2057
|
+
outputDir: analysisOutputDir,
|
|
2058
|
+
outputName: analysisOutputName,
|
|
2059
|
+
keepArtifacts: mergedConfig.analysis?.keepArtifacts ?? false
|
|
2060
|
+
};
|
|
2061
|
+
}
|
|
2105
2062
|
async function getUnimportOptions(wxtDir, logger, config) {
|
|
2106
2063
|
if (config.imports === false)
|
|
2107
2064
|
return false;
|
|
@@ -2154,6 +2111,10 @@ function logMissingDir(logger, name, expected) {
|
|
|
2154
2111
|
)}`
|
|
2155
2112
|
);
|
|
2156
2113
|
}
|
|
2114
|
+
var COMMAND_MODES = {
|
|
2115
|
+
build: "production",
|
|
2116
|
+
serve: "development"
|
|
2117
|
+
};
|
|
2157
2118
|
|
|
2158
2119
|
// src/core/utils/building/group-entrypoints.ts
|
|
2159
2120
|
function groupEntrypoints(entrypoints) {
|
|
@@ -2417,7 +2378,7 @@ function getChunkSortWeight(filename) {
|
|
|
2417
2378
|
import pc4 from "picocolors";
|
|
2418
2379
|
|
|
2419
2380
|
// package.json
|
|
2420
|
-
var version = "0.17.
|
|
2381
|
+
var version = "0.17.9";
|
|
2421
2382
|
|
|
2422
2383
|
// src/core/utils/log/printHeader.ts
|
|
2423
2384
|
import { consola as consola2 } from "consola";
|
|
@@ -2595,7 +2556,7 @@ async function generateManifest(entrypoints, buildOutput) {
|
|
|
2595
2556
|
addDevModeCsp(manifest);
|
|
2596
2557
|
if (wxt.config.command === "serve")
|
|
2597
2558
|
addDevModePermissions(manifest);
|
|
2598
|
-
wxt.config.transformManifest(manifest);
|
|
2559
|
+
wxt.config.transformManifest?.(manifest);
|
|
2599
2560
|
await wxt.hooks.callHook("build:manifestGenerated", wxt, manifest);
|
|
2600
2561
|
if (wxt.config.manifestVersion === 2) {
|
|
2601
2562
|
convertWebAccessibleResourcesToMv2(manifest);
|
|
@@ -3784,7 +3745,7 @@ async function zip(config) {
|
|
|
3784
3745
|
const applyTemplate = (template) => template.replaceAll("{{name}}", projectName).replaceAll("{{browser}}", wxt.config.browser).replaceAll(
|
|
3785
3746
|
"{{version}}",
|
|
3786
3747
|
output.manifest.version_name ?? output.manifest.version
|
|
3787
|
-
).replaceAll("{{manifestVersion}}", `mv${wxt.config.manifestVersion}`);
|
|
3748
|
+
).replaceAll("{{mode}}", wxt.config.mode).replaceAll("{{manifestVersion}}", `mv${wxt.config.manifestVersion}`);
|
|
3788
3749
|
await fs16.ensureDir(wxt.config.outBaseDir);
|
|
3789
3750
|
const outZipFilename = applyTemplate(wxt.config.zip.artifactTemplate);
|
|
3790
3751
|
const outZipPath = path9.resolve(wxt.config.outBaseDir, outZipFilename);
|
|
@@ -235,10 +235,11 @@ interface InlineConfig {
|
|
|
235
235
|
*
|
|
236
236
|
* Available template variables:
|
|
237
237
|
*
|
|
238
|
-
* -
|
|
239
|
-
* -
|
|
240
|
-
* -
|
|
241
|
-
* -
|
|
238
|
+
* - <span v-pre>`{{name}}`</span> - The project's name converted to kebab-case
|
|
239
|
+
* - <span v-pre>`{{version}}`</span> - The version_name or version from the manifest
|
|
240
|
+
* - <span v-pre>`{{browser}}`</span> - The target browser from the `--browser` CLI flag
|
|
241
|
+
* - <span v-pre>`{{mode}}`</span> - The current mode
|
|
242
|
+
* - <span v-pre>`{{manifestVersion}}`</span> - Either "2" or "3"
|
|
242
243
|
*
|
|
243
244
|
* @default "{{name}}-{{version}}-{{browser}}.zip"
|
|
244
245
|
*/
|
|
@@ -248,10 +249,11 @@ interface InlineConfig {
|
|
|
248
249
|
*
|
|
249
250
|
* Available template variables:
|
|
250
251
|
*
|
|
251
|
-
* -
|
|
252
|
-
* -
|
|
253
|
-
* -
|
|
254
|
-
* -
|
|
252
|
+
* - <span v-pre>`{{name}}`</span> - The project's name converted to kebab-case
|
|
253
|
+
* - <span v-pre>`{{version}}`</span> - The version_name or version from the manifest
|
|
254
|
+
* - <span v-pre>`{{browser}}`</span> - The target browser from the `--browser` CLI flag
|
|
255
|
+
* - <span v-pre>`{{mode}}`</span> - The current mode
|
|
256
|
+
* - <span v-pre>`{{manifestVersion}}`</span> - Either "2" or "3"
|
|
255
257
|
*
|
|
256
258
|
* @default "{{name}}-{{version}}-sources.zip"
|
|
257
259
|
*/
|
|
@@ -800,7 +802,7 @@ interface ConfigEnv {
|
|
|
800
802
|
/**
|
|
801
803
|
* The command used to run WXT. `"serve"` during development and `"build"` for any other command.
|
|
802
804
|
*/
|
|
803
|
-
command:
|
|
805
|
+
command: WxtCommand;
|
|
804
806
|
/**
|
|
805
807
|
* Browser passed in from the CLI via the `-b` or `--browser` flag. Defaults to `"chrome"` when not passed.
|
|
806
808
|
*/
|
|
@@ -812,6 +814,7 @@ interface ConfigEnv {
|
|
|
812
814
|
*/
|
|
813
815
|
manifestVersion: 2 | 3;
|
|
814
816
|
}
|
|
817
|
+
type WxtCommand = 'build' | 'serve';
|
|
815
818
|
/**
|
|
816
819
|
* Configure how the browser starts up.
|
|
817
820
|
*/
|
|
@@ -1029,7 +1032,7 @@ interface ResolvedConfig {
|
|
|
1029
1032
|
*/
|
|
1030
1033
|
wxtModuleDir: string;
|
|
1031
1034
|
mode: string;
|
|
1032
|
-
command:
|
|
1035
|
+
command: WxtCommand;
|
|
1033
1036
|
browser: TargetBrowser;
|
|
1034
1037
|
manifestVersion: TargetManifestVersion;
|
|
1035
1038
|
env: ConfigEnv;
|
|
@@ -1049,7 +1052,10 @@ interface ResolvedConfig {
|
|
|
1049
1052
|
downloadedPackagesDir: string;
|
|
1050
1053
|
downloadPackages: string[];
|
|
1051
1054
|
};
|
|
1052
|
-
|
|
1055
|
+
/**
|
|
1056
|
+
* @deprecated Use `build:manifestGenerated` hook instead.
|
|
1057
|
+
*/
|
|
1058
|
+
transformManifest?: (manifest: Manifest.WebExtensionManifest) => void;
|
|
1053
1059
|
analysis: {
|
|
1054
1060
|
enabled: boolean;
|
|
1055
1061
|
open: boolean;
|
|
@@ -1160,4 +1166,4 @@ interface Dependency {
|
|
|
1160
1166
|
version: string;
|
|
1161
1167
|
}
|
|
1162
1168
|
|
|
1163
|
-
export type {
|
|
1169
|
+
export type { VirtualEntrypointType as $, UserManifest as A, BuildOutput as B, ContentScriptEntrypoint as C, UserManifestFn as D, ExtensionRunnerConfig as E, ConfigEnv as F, GenericEntrypoint as G, WxtCommand as H, InlineConfig as I, WxtBuilder as J, WxtBuilderServer as K, Logger as L, MainWorldContentScriptEntrypointOptions as M, ServerInfo as N, OutputFile as O, PopupEntrypointOptions as P, HookResult as Q, ReloadContentScriptPayload as R, SidepanelEntrypointOptions as S, TargetBrowser as T, UserConfig as U, WxtHooks as V, WxtDevServer as W, Wxt as X, ResolvedConfig as Y, FsCache as Z, ExtensionRunner as _, WxtViteConfig as a, EslintGlobalsPropValue as a0, Eslintrc as a1, ResolvedEslintrc as a2, WxtUnimportOptions as a3, WxtResolvedUnimportOptions as a4, WxtPackageManager as a5, Dependency as a6, OutputChunk as b, OutputAsset as c, BuildStepOutput as d, TargetManifestVersion as e, BaseEntrypointOptions as f, BackgroundEntrypointOptions as g, BaseContentScriptEntrypointOptions as h, IsolatedWorldContentScriptEntrypointOptions as i, OptionsEntrypointOptions as j, BaseEntrypoint as k, BackgroundEntrypoint as l, PopupEntrypoint as m, OptionsEntrypoint as n, SidepanelEntrypoint as o, Entrypoint as p, EntrypointGroup as q, OnContentScriptStopped as r, IsolatedWorldContentScriptDefinition as s, MainWorldContentScriptDefinition as t, ContentScriptDefinition as u, BackgroundDefinition as v, UnlistedScriptDefinition as w, PerBrowserOption as x, PerBrowserMap as y, ResolvedPerBrowserOptions as z };
|
|
@@ -235,10 +235,11 @@ interface InlineConfig {
|
|
|
235
235
|
*
|
|
236
236
|
* Available template variables:
|
|
237
237
|
*
|
|
238
|
-
* -
|
|
239
|
-
* -
|
|
240
|
-
* -
|
|
241
|
-
* -
|
|
238
|
+
* - <span v-pre>`{{name}}`</span> - The project's name converted to kebab-case
|
|
239
|
+
* - <span v-pre>`{{version}}`</span> - The version_name or version from the manifest
|
|
240
|
+
* - <span v-pre>`{{browser}}`</span> - The target browser from the `--browser` CLI flag
|
|
241
|
+
* - <span v-pre>`{{mode}}`</span> - The current mode
|
|
242
|
+
* - <span v-pre>`{{manifestVersion}}`</span> - Either "2" or "3"
|
|
242
243
|
*
|
|
243
244
|
* @default "{{name}}-{{version}}-{{browser}}.zip"
|
|
244
245
|
*/
|
|
@@ -248,10 +249,11 @@ interface InlineConfig {
|
|
|
248
249
|
*
|
|
249
250
|
* Available template variables:
|
|
250
251
|
*
|
|
251
|
-
* -
|
|
252
|
-
* -
|
|
253
|
-
* -
|
|
254
|
-
* -
|
|
252
|
+
* - <span v-pre>`{{name}}`</span> - The project's name converted to kebab-case
|
|
253
|
+
* - <span v-pre>`{{version}}`</span> - The version_name or version from the manifest
|
|
254
|
+
* - <span v-pre>`{{browser}}`</span> - The target browser from the `--browser` CLI flag
|
|
255
|
+
* - <span v-pre>`{{mode}}`</span> - The current mode
|
|
256
|
+
* - <span v-pre>`{{manifestVersion}}`</span> - Either "2" or "3"
|
|
255
257
|
*
|
|
256
258
|
* @default "{{name}}-{{version}}-sources.zip"
|
|
257
259
|
*/
|
|
@@ -800,7 +802,7 @@ interface ConfigEnv {
|
|
|
800
802
|
/**
|
|
801
803
|
* The command used to run WXT. `"serve"` during development and `"build"` for any other command.
|
|
802
804
|
*/
|
|
803
|
-
command:
|
|
805
|
+
command: WxtCommand;
|
|
804
806
|
/**
|
|
805
807
|
* Browser passed in from the CLI via the `-b` or `--browser` flag. Defaults to `"chrome"` when not passed.
|
|
806
808
|
*/
|
|
@@ -812,6 +814,7 @@ interface ConfigEnv {
|
|
|
812
814
|
*/
|
|
813
815
|
manifestVersion: 2 | 3;
|
|
814
816
|
}
|
|
817
|
+
type WxtCommand = 'build' | 'serve';
|
|
815
818
|
/**
|
|
816
819
|
* Configure how the browser starts up.
|
|
817
820
|
*/
|
|
@@ -1029,7 +1032,7 @@ interface ResolvedConfig {
|
|
|
1029
1032
|
*/
|
|
1030
1033
|
wxtModuleDir: string;
|
|
1031
1034
|
mode: string;
|
|
1032
|
-
command:
|
|
1035
|
+
command: WxtCommand;
|
|
1033
1036
|
browser: TargetBrowser;
|
|
1034
1037
|
manifestVersion: TargetManifestVersion;
|
|
1035
1038
|
env: ConfigEnv;
|
|
@@ -1049,7 +1052,10 @@ interface ResolvedConfig {
|
|
|
1049
1052
|
downloadedPackagesDir: string;
|
|
1050
1053
|
downloadPackages: string[];
|
|
1051
1054
|
};
|
|
1052
|
-
|
|
1055
|
+
/**
|
|
1056
|
+
* @deprecated Use `build:manifestGenerated` hook instead.
|
|
1057
|
+
*/
|
|
1058
|
+
transformManifest?: (manifest: Manifest.WebExtensionManifest) => void;
|
|
1053
1059
|
analysis: {
|
|
1054
1060
|
enabled: boolean;
|
|
1055
1061
|
open: boolean;
|
|
@@ -1160,4 +1166,4 @@ interface Dependency {
|
|
|
1160
1166
|
version: string;
|
|
1161
1167
|
}
|
|
1162
1168
|
|
|
1163
|
-
export type {
|
|
1169
|
+
export type { VirtualEntrypointType as $, UserManifest as A, BuildOutput as B, ContentScriptEntrypoint as C, UserManifestFn as D, ExtensionRunnerConfig as E, ConfigEnv as F, GenericEntrypoint as G, WxtCommand as H, InlineConfig as I, WxtBuilder as J, WxtBuilderServer as K, Logger as L, MainWorldContentScriptEntrypointOptions as M, ServerInfo as N, OutputFile as O, PopupEntrypointOptions as P, HookResult as Q, ReloadContentScriptPayload as R, SidepanelEntrypointOptions as S, TargetBrowser as T, UserConfig as U, WxtHooks as V, WxtDevServer as W, Wxt as X, ResolvedConfig as Y, FsCache as Z, ExtensionRunner as _, WxtViteConfig as a, EslintGlobalsPropValue as a0, Eslintrc as a1, ResolvedEslintrc as a2, WxtUnimportOptions as a3, WxtResolvedUnimportOptions as a4, WxtPackageManager as a5, Dependency as a6, OutputChunk as b, OutputAsset as c, BuildStepOutput as d, TargetManifestVersion as e, BaseEntrypointOptions as f, BackgroundEntrypointOptions as g, BaseContentScriptEntrypointOptions as h, IsolatedWorldContentScriptEntrypointOptions as i, OptionsEntrypointOptions as j, BaseEntrypoint as k, BackgroundEntrypoint as l, PopupEntrypoint as m, OptionsEntrypoint as n, SidepanelEntrypoint as o, Entrypoint as p, EntrypointGroup as q, OnContentScriptStopped as r, IsolatedWorldContentScriptDefinition as s, MainWorldContentScriptDefinition as t, ContentScriptDefinition as u, BackgroundDefinition as v, UnlistedScriptDefinition as w, PerBrowserOption as x, PerBrowserMap as y, ResolvedPerBrowserOptions as z };
|
package/dist/index.cjs
CHANGED
|
@@ -4324,7 +4324,7 @@ async function resolveConfig(inlineConfig, command, server) {
|
|
|
4324
4324
|
logger.level = import_consola.LogLevels.debug;
|
|
4325
4325
|
const browser = mergedConfig.browser ?? "chrome";
|
|
4326
4326
|
const manifestVersion = mergedConfig.manifestVersion ?? (browser === "firefox" || browser === "safari" ? 2 : 3);
|
|
4327
|
-
const mode = mergedConfig.mode ??
|
|
4327
|
+
const mode = mergedConfig.mode ?? COMMAND_MODES[command];
|
|
4328
4328
|
const env = { browser, command, manifestVersion, mode };
|
|
4329
4329
|
const root = import_node_path12.default.resolve(
|
|
4330
4330
|
inlineConfig.root ?? userConfig.root ?? process.cwd()
|
|
@@ -4365,12 +4365,6 @@ async function resolveConfig(inlineConfig, command, server) {
|
|
|
4365
4365
|
"~~": root
|
|
4366
4366
|
}).map(([key, value]) => [key, import_node_path12.default.resolve(root, value)])
|
|
4367
4367
|
);
|
|
4368
|
-
const analysisOutputFile = import_node_path12.default.resolve(
|
|
4369
|
-
root,
|
|
4370
|
-
mergedConfig.analysis?.outputFile ?? "stats.html"
|
|
4371
|
-
);
|
|
4372
|
-
const analysisOutputDir = import_node_path12.default.dirname(analysisOutputFile);
|
|
4373
|
-
const analysisOutputName = import_node_path12.default.parse(analysisOutputFile).name;
|
|
4374
4368
|
const finalConfig = {
|
|
4375
4369
|
browser,
|
|
4376
4370
|
command,
|
|
@@ -4393,25 +4387,14 @@ async function resolveConfig(inlineConfig, command, server) {
|
|
|
4393
4387
|
srcDir,
|
|
4394
4388
|
typesDir,
|
|
4395
4389
|
wxtDir,
|
|
4396
|
-
zip:
|
|
4397
|
-
transformManifest
|
|
4398
|
-
|
|
4399
|
-
inlineConfig.transformManifest?.(manifest);
|
|
4400
|
-
},
|
|
4401
|
-
analysis: {
|
|
4402
|
-
enabled: mergedConfig.analysis?.enabled ?? false,
|
|
4403
|
-
open: mergedConfig.analysis?.open ?? false,
|
|
4404
|
-
template: mergedConfig.analysis?.template ?? "treemap",
|
|
4405
|
-
outputFile: analysisOutputFile,
|
|
4406
|
-
outputDir: analysisOutputDir,
|
|
4407
|
-
outputName: analysisOutputName,
|
|
4408
|
-
keepArtifacts: mergedConfig.analysis?.keepArtifacts ?? false
|
|
4409
|
-
},
|
|
4390
|
+
zip: resolveZipConfig(root, mergedConfig),
|
|
4391
|
+
transformManifest: mergedConfig.transformManifest,
|
|
4392
|
+
analysis: resolveAnalysisConfig(root, mergedConfig),
|
|
4410
4393
|
userConfigMetadata: userConfigMetadata ?? {},
|
|
4411
4394
|
alias,
|
|
4412
|
-
experimental: {
|
|
4413
|
-
includeBrowserPolyfill:
|
|
4414
|
-
},
|
|
4395
|
+
experimental: (0, import_defu.default)(mergedConfig.experimental, {
|
|
4396
|
+
includeBrowserPolyfill: true
|
|
4397
|
+
}),
|
|
4415
4398
|
server,
|
|
4416
4399
|
dev: {
|
|
4417
4400
|
reloadCommand
|
|
@@ -4432,70 +4415,27 @@ async function resolveManifestConfig(env, manifest) {
|
|
|
4432
4415
|
return await (typeof manifest === "function" ? manifest(env) : manifest ?? {});
|
|
4433
4416
|
}
|
|
4434
4417
|
function mergeInlineConfig(inlineConfig, userConfig) {
|
|
4435
|
-
|
|
4436
|
-
if (inlineConfig.imports === false || userConfig.imports === false) {
|
|
4437
|
-
imports = false;
|
|
4438
|
-
} else if (userConfig.imports == null && inlineConfig.imports == null) {
|
|
4439
|
-
imports = void 0;
|
|
4440
|
-
} else {
|
|
4441
|
-
imports = (0, import_defu.default)(inlineConfig.imports ?? {}, userConfig.imports ?? {});
|
|
4442
|
-
}
|
|
4418
|
+
const imports = inlineConfig.imports === false || userConfig.imports === false ? false : userConfig.imports == null && inlineConfig.imports == null ? void 0 : (0, import_defu.default)(inlineConfig.imports ?? {}, userConfig.imports ?? {});
|
|
4443
4419
|
const manifest = async (env) => {
|
|
4444
4420
|
const user = await resolveManifestConfig(env, userConfig.manifest);
|
|
4445
4421
|
const inline = await resolveManifestConfig(env, inlineConfig.manifest);
|
|
4446
4422
|
return (0, import_defu.default)(inline, user);
|
|
4447
4423
|
};
|
|
4448
|
-
const
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
const zip2 = (0, import_defu.default)(
|
|
4453
|
-
inlineConfig.zip ?? {},
|
|
4454
|
-
userConfig.zip ?? {}
|
|
4455
|
-
);
|
|
4456
|
-
const hooks = (0, import_defu.default)(
|
|
4457
|
-
inlineConfig.hooks ?? {},
|
|
4458
|
-
userConfig.hooks ?? {}
|
|
4459
|
-
);
|
|
4424
|
+
const transformManifest = (manifest2) => {
|
|
4425
|
+
userConfig.transformManifest?.(manifest2);
|
|
4426
|
+
inlineConfig.transformManifest?.(manifest2);
|
|
4427
|
+
};
|
|
4460
4428
|
return {
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
configFile: inlineConfig.configFile,
|
|
4465
|
-
debug: inlineConfig.debug ?? userConfig.debug,
|
|
4466
|
-
entrypointsDir: inlineConfig.entrypointsDir ?? userConfig.entrypointsDir,
|
|
4467
|
-
filterEntrypoints: inlineConfig.filterEntrypoints ?? userConfig.filterEntrypoints,
|
|
4429
|
+
...(0, import_defu.default)(inlineConfig, userConfig),
|
|
4430
|
+
// Custom merge values
|
|
4431
|
+
transformManifest,
|
|
4468
4432
|
imports,
|
|
4469
|
-
logger: inlineConfig.logger ?? userConfig.logger,
|
|
4470
4433
|
manifest,
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
runner,
|
|
4474
|
-
srcDir: inlineConfig.srcDir ?? userConfig.srcDir,
|
|
4475
|
-
outDir: inlineConfig.outDir ?? userConfig.outDir,
|
|
4476
|
-
zip: zip2,
|
|
4477
|
-
analysis: {
|
|
4478
|
-
...userConfig.analysis,
|
|
4479
|
-
...inlineConfig.analysis
|
|
4480
|
-
},
|
|
4481
|
-
alias: {
|
|
4482
|
-
...userConfig.alias,
|
|
4483
|
-
...inlineConfig.alias
|
|
4484
|
-
},
|
|
4485
|
-
experimental: {
|
|
4486
|
-
...userConfig.experimental,
|
|
4487
|
-
...inlineConfig.experimental
|
|
4488
|
-
},
|
|
4489
|
-
vite: void 0,
|
|
4490
|
-
transformManifest: void 0,
|
|
4491
|
-
dev: {
|
|
4492
|
-
...userConfig.dev,
|
|
4493
|
-
...inlineConfig.dev
|
|
4494
|
-
},
|
|
4495
|
-
hooks
|
|
4434
|
+
// Vite builder handles merging vite config internally
|
|
4435
|
+
vite: void 0
|
|
4496
4436
|
};
|
|
4497
4437
|
}
|
|
4498
|
-
function
|
|
4438
|
+
function resolveZipConfig(root, mergedConfig) {
|
|
4499
4439
|
const downloadedPackagesDir = import_node_path12.default.resolve(root, ".wxt/local_modules");
|
|
4500
4440
|
return {
|
|
4501
4441
|
name: void 0,
|
|
@@ -4520,6 +4460,23 @@ function resolveInternalZipConfig(root, mergedConfig) {
|
|
|
4520
4460
|
downloadedPackagesDir
|
|
4521
4461
|
};
|
|
4522
4462
|
}
|
|
4463
|
+
function resolveAnalysisConfig(root, mergedConfig) {
|
|
4464
|
+
const analysisOutputFile = import_node_path12.default.resolve(
|
|
4465
|
+
root,
|
|
4466
|
+
mergedConfig.analysis?.outputFile ?? "stats.html"
|
|
4467
|
+
);
|
|
4468
|
+
const analysisOutputDir = import_node_path12.default.dirname(analysisOutputFile);
|
|
4469
|
+
const analysisOutputName = import_node_path12.default.parse(analysisOutputFile).name;
|
|
4470
|
+
return {
|
|
4471
|
+
enabled: mergedConfig.analysis?.enabled ?? false,
|
|
4472
|
+
open: mergedConfig.analysis?.open ?? false,
|
|
4473
|
+
template: mergedConfig.analysis?.template ?? "treemap",
|
|
4474
|
+
outputFile: analysisOutputFile,
|
|
4475
|
+
outputDir: analysisOutputDir,
|
|
4476
|
+
outputName: analysisOutputName,
|
|
4477
|
+
keepArtifacts: mergedConfig.analysis?.keepArtifacts ?? false
|
|
4478
|
+
};
|
|
4479
|
+
}
|
|
4523
4480
|
async function getUnimportOptions(wxtDir, logger, config) {
|
|
4524
4481
|
if (config.imports === false)
|
|
4525
4482
|
return false;
|
|
@@ -4572,6 +4529,10 @@ function logMissingDir(logger, name, expected) {
|
|
|
4572
4529
|
)}`
|
|
4573
4530
|
);
|
|
4574
4531
|
}
|
|
4532
|
+
var COMMAND_MODES = {
|
|
4533
|
+
build: "production",
|
|
4534
|
+
serve: "development"
|
|
4535
|
+
};
|
|
4575
4536
|
|
|
4576
4537
|
// src/core/utils/building/group-entrypoints.ts
|
|
4577
4538
|
function groupEntrypoints(entrypoints) {
|
|
@@ -4836,7 +4797,7 @@ function getChunkSortWeight(filename) {
|
|
|
4836
4797
|
var import_picocolors4 = __toESM(require("picocolors"), 1);
|
|
4837
4798
|
|
|
4838
4799
|
// package.json
|
|
4839
|
-
var version = "0.17.
|
|
4800
|
+
var version = "0.17.9";
|
|
4840
4801
|
|
|
4841
4802
|
// src/core/utils/log/printHeader.ts
|
|
4842
4803
|
var import_consola2 = require("consola");
|
|
@@ -5010,7 +4971,7 @@ async function generateManifest(entrypoints, buildOutput) {
|
|
|
5010
4971
|
addDevModeCsp(manifest);
|
|
5011
4972
|
if (wxt.config.command === "serve")
|
|
5012
4973
|
addDevModePermissions(manifest);
|
|
5013
|
-
wxt.config.transformManifest(manifest);
|
|
4974
|
+
wxt.config.transformManifest?.(manifest);
|
|
5014
4975
|
await wxt.hooks.callHook("build:manifestGenerated", wxt, manifest);
|
|
5015
4976
|
if (wxt.config.manifestVersion === 2) {
|
|
5016
4977
|
convertWebAccessibleResourcesToMv2(manifest);
|
|
@@ -6209,7 +6170,7 @@ async function zip(config) {
|
|
|
6209
6170
|
const applyTemplate = (template) => template.replaceAll("{{name}}", projectName).replaceAll("{{browser}}", wxt.config.browser).replaceAll(
|
|
6210
6171
|
"{{version}}",
|
|
6211
6172
|
output.manifest.version_name ?? output.manifest.version
|
|
6212
|
-
).replaceAll("{{manifestVersion}}", `mv${wxt.config.manifestVersion}`);
|
|
6173
|
+
).replaceAll("{{mode}}", wxt.config.mode).replaceAll("{{manifestVersion}}", `mv${wxt.config.manifestVersion}`);
|
|
6213
6174
|
await import_fs_extra17.default.ensureDir(wxt.config.outBaseDir);
|
|
6214
6175
|
const outZipFilename = applyTemplate(wxt.config.zip.artifactTemplate);
|
|
6215
6176
|
const outZipPath = import_node_path22.default.resolve(wxt.config.outBaseDir, outZipFilename);
|
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-
|
|
2
|
-
export { v as BackgroundDefinition, l as BackgroundEntrypoint, g as BackgroundEntrypointOptions, h as BaseContentScriptEntrypointOptions, k as BaseEntrypoint, f as BaseEntrypointOptions, d as BuildStepOutput, F as ConfigEnv, u as ContentScriptDefinition, C as ContentScriptEntrypoint,
|
|
1
|
+
import { I as InlineConfig, B as BuildOutput, U as UserConfig, E as ExtensionRunnerConfig, W as WxtDevServer } from './index-mZodC81T.cjs';
|
|
2
|
+
export { v as BackgroundDefinition, l as BackgroundEntrypoint, g as BackgroundEntrypointOptions, h as BaseContentScriptEntrypointOptions, k as BaseEntrypoint, f as BaseEntrypointOptions, d as BuildStepOutput, F as ConfigEnv, u as ContentScriptDefinition, C as ContentScriptEntrypoint, a6 as Dependency, p as Entrypoint, q as EntrypointGroup, a0 as EslintGlobalsPropValue, a1 as Eslintrc, _ as ExtensionRunner, Z as FsCache, G as GenericEntrypoint, Q as HookResult, s as IsolatedWorldContentScriptDefinition, i as IsolatedWorldContentScriptEntrypointOptions, L as Logger, t as MainWorldContentScriptDefinition, M as MainWorldContentScriptEntrypointOptions, r as OnContentScriptStopped, n as OptionsEntrypoint, j as OptionsEntrypointOptions, c as OutputAsset, b as OutputChunk, O as OutputFile, y as PerBrowserMap, x as PerBrowserOption, m as PopupEntrypoint, P as PopupEntrypointOptions, R as ReloadContentScriptPayload, Y as ResolvedConfig, a2 as ResolvedEslintrc, z as ResolvedPerBrowserOptions, N as ServerInfo, o as SidepanelEntrypoint, S as SidepanelEntrypointOptions, T as TargetBrowser, e as TargetManifestVersion, w as UnlistedScriptDefinition, A as UserManifest, D as UserManifestFn, $ as VirtualEntrypointType, X as Wxt, J as WxtBuilder, K as WxtBuilderServer, H as WxtCommand, V as WxtHooks, a5 as WxtPackageManager, a4 as WxtResolvedUnimportOptions, a3 as WxtUnimportOptions, a as WxtViteConfig } from './index-mZodC81T.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.17.
|
|
68
|
+
var version = "0.17.9";
|
|
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-
|
|
2
|
-
export { v as BackgroundDefinition, l as BackgroundEntrypoint, g as BackgroundEntrypointOptions, h as BaseContentScriptEntrypointOptions, k as BaseEntrypoint, f as BaseEntrypointOptions, d as BuildStepOutput, F as ConfigEnv, u as ContentScriptDefinition, C as ContentScriptEntrypoint,
|
|
1
|
+
import { I as InlineConfig, B as BuildOutput, U as UserConfig, E as ExtensionRunnerConfig, W as WxtDevServer } from './index-mZodC81T.js';
|
|
2
|
+
export { v as BackgroundDefinition, l as BackgroundEntrypoint, g as BackgroundEntrypointOptions, h as BaseContentScriptEntrypointOptions, k as BaseEntrypoint, f as BaseEntrypointOptions, d as BuildStepOutput, F as ConfigEnv, u as ContentScriptDefinition, C as ContentScriptEntrypoint, a6 as Dependency, p as Entrypoint, q as EntrypointGroup, a0 as EslintGlobalsPropValue, a1 as Eslintrc, _ as ExtensionRunner, Z as FsCache, G as GenericEntrypoint, Q as HookResult, s as IsolatedWorldContentScriptDefinition, i as IsolatedWorldContentScriptEntrypointOptions, L as Logger, t as MainWorldContentScriptDefinition, M as MainWorldContentScriptEntrypointOptions, r as OnContentScriptStopped, n as OptionsEntrypoint, j as OptionsEntrypointOptions, c as OutputAsset, b as OutputChunk, O as OutputFile, y as PerBrowserMap, x as PerBrowserOption, m as PopupEntrypoint, P as PopupEntrypointOptions, R as ReloadContentScriptPayload, Y as ResolvedConfig, a2 as ResolvedEslintrc, z as ResolvedPerBrowserOptions, N as ServerInfo, o as SidepanelEntrypoint, S as SidepanelEntrypointOptions, T as TargetBrowser, e as TargetManifestVersion, w as UnlistedScriptDefinition, A as UserManifest, D as UserManifestFn, $ as VirtualEntrypointType, X as Wxt, J as WxtBuilder, K as WxtBuilderServer, H as WxtCommand, V as WxtHooks, a5 as WxtPackageManager, a4 as WxtResolvedUnimportOptions, a3 as WxtUnimportOptions, a as WxtViteConfig } from './index-mZodC81T.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.17.
|
|
68
|
+
var version = "0.17.9";
|
|
69
69
|
|
|
70
70
|
export { BuildOutput, ExtensionRunnerConfig, InlineConfig, UserConfig, WxtDevServer, build, clean, createServer, defineConfig, defineRunnerConfig, initialize, prepare, version, zip };
|
package/dist/index.js
CHANGED
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
unnormalizePath,
|
|
19
19
|
version,
|
|
20
20
|
wxt
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-ONUEB57P.js";
|
|
22
22
|
import "./chunk-VBXJIVYU.js";
|
|
23
23
|
|
|
24
24
|
// src/core/build.ts
|
|
@@ -575,7 +575,7 @@ async function zip(config) {
|
|
|
575
575
|
const applyTemplate = (template) => template.replaceAll("{{name}}", projectName).replaceAll("{{browser}}", wxt.config.browser).replaceAll(
|
|
576
576
|
"{{version}}",
|
|
577
577
|
output.manifest.version_name ?? output.manifest.version
|
|
578
|
-
).replaceAll("{{manifestVersion}}", `mv${wxt.config.manifestVersion}`);
|
|
578
|
+
).replaceAll("{{mode}}", wxt.config.mode).replaceAll("{{manifestVersion}}", `mv${wxt.config.manifestVersion}`);
|
|
579
579
|
await fs3.ensureDir(wxt.config.outBaseDir);
|
|
580
580
|
const outZipFilename = applyTemplate(wxt.config.zip.artifactTemplate);
|
|
581
581
|
const outZipPath = path3.resolve(wxt.config.outBaseDir, outZipFilename);
|
package/dist/testing.cjs
CHANGED
|
@@ -1008,7 +1008,7 @@ async function resolveConfig(inlineConfig, command, server) {
|
|
|
1008
1008
|
logger.level = import_consola.LogLevels.debug;
|
|
1009
1009
|
const browser = mergedConfig.browser ?? "chrome";
|
|
1010
1010
|
const manifestVersion = mergedConfig.manifestVersion ?? (browser === "firefox" || browser === "safari" ? 2 : 3);
|
|
1011
|
-
const mode = mergedConfig.mode ??
|
|
1011
|
+
const mode = mergedConfig.mode ?? COMMAND_MODES[command];
|
|
1012
1012
|
const env = { browser, command, manifestVersion, mode };
|
|
1013
1013
|
const root = import_node_path10.default.resolve(
|
|
1014
1014
|
inlineConfig.root ?? userConfig.root ?? process.cwd()
|
|
@@ -1049,12 +1049,6 @@ async function resolveConfig(inlineConfig, command, server) {
|
|
|
1049
1049
|
"~~": root
|
|
1050
1050
|
}).map(([key, value]) => [key, import_node_path10.default.resolve(root, value)])
|
|
1051
1051
|
);
|
|
1052
|
-
const analysisOutputFile = import_node_path10.default.resolve(
|
|
1053
|
-
root,
|
|
1054
|
-
mergedConfig.analysis?.outputFile ?? "stats.html"
|
|
1055
|
-
);
|
|
1056
|
-
const analysisOutputDir = import_node_path10.default.dirname(analysisOutputFile);
|
|
1057
|
-
const analysisOutputName = import_node_path10.default.parse(analysisOutputFile).name;
|
|
1058
1052
|
const finalConfig = {
|
|
1059
1053
|
browser,
|
|
1060
1054
|
command,
|
|
@@ -1077,25 +1071,14 @@ async function resolveConfig(inlineConfig, command, server) {
|
|
|
1077
1071
|
srcDir,
|
|
1078
1072
|
typesDir,
|
|
1079
1073
|
wxtDir,
|
|
1080
|
-
zip:
|
|
1081
|
-
transformManifest
|
|
1082
|
-
|
|
1083
|
-
inlineConfig.transformManifest?.(manifest);
|
|
1084
|
-
},
|
|
1085
|
-
analysis: {
|
|
1086
|
-
enabled: mergedConfig.analysis?.enabled ?? false,
|
|
1087
|
-
open: mergedConfig.analysis?.open ?? false,
|
|
1088
|
-
template: mergedConfig.analysis?.template ?? "treemap",
|
|
1089
|
-
outputFile: analysisOutputFile,
|
|
1090
|
-
outputDir: analysisOutputDir,
|
|
1091
|
-
outputName: analysisOutputName,
|
|
1092
|
-
keepArtifacts: mergedConfig.analysis?.keepArtifacts ?? false
|
|
1093
|
-
},
|
|
1074
|
+
zip: resolveZipConfig(root, mergedConfig),
|
|
1075
|
+
transformManifest: mergedConfig.transformManifest,
|
|
1076
|
+
analysis: resolveAnalysisConfig(root, mergedConfig),
|
|
1094
1077
|
userConfigMetadata: userConfigMetadata ?? {},
|
|
1095
1078
|
alias,
|
|
1096
|
-
experimental: {
|
|
1097
|
-
includeBrowserPolyfill:
|
|
1098
|
-
},
|
|
1079
|
+
experimental: (0, import_defu.default)(mergedConfig.experimental, {
|
|
1080
|
+
includeBrowserPolyfill: true
|
|
1081
|
+
}),
|
|
1099
1082
|
server,
|
|
1100
1083
|
dev: {
|
|
1101
1084
|
reloadCommand
|
|
@@ -1116,70 +1099,27 @@ async function resolveManifestConfig(env, manifest) {
|
|
|
1116
1099
|
return await (typeof manifest === "function" ? manifest(env) : manifest ?? {});
|
|
1117
1100
|
}
|
|
1118
1101
|
function mergeInlineConfig(inlineConfig, userConfig) {
|
|
1119
|
-
|
|
1120
|
-
if (inlineConfig.imports === false || userConfig.imports === false) {
|
|
1121
|
-
imports = false;
|
|
1122
|
-
} else if (userConfig.imports == null && inlineConfig.imports == null) {
|
|
1123
|
-
imports = void 0;
|
|
1124
|
-
} else {
|
|
1125
|
-
imports = (0, import_defu.default)(inlineConfig.imports ?? {}, userConfig.imports ?? {});
|
|
1126
|
-
}
|
|
1102
|
+
const imports = inlineConfig.imports === false || userConfig.imports === false ? false : userConfig.imports == null && inlineConfig.imports == null ? void 0 : (0, import_defu.default)(inlineConfig.imports ?? {}, userConfig.imports ?? {});
|
|
1127
1103
|
const manifest = async (env) => {
|
|
1128
1104
|
const user = await resolveManifestConfig(env, userConfig.manifest);
|
|
1129
1105
|
const inline = await resolveManifestConfig(env, inlineConfig.manifest);
|
|
1130
1106
|
return (0, import_defu.default)(inline, user);
|
|
1131
1107
|
};
|
|
1132
|
-
const
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
const zip = (0, import_defu.default)(
|
|
1137
|
-
inlineConfig.zip ?? {},
|
|
1138
|
-
userConfig.zip ?? {}
|
|
1139
|
-
);
|
|
1140
|
-
const hooks = (0, import_defu.default)(
|
|
1141
|
-
inlineConfig.hooks ?? {},
|
|
1142
|
-
userConfig.hooks ?? {}
|
|
1143
|
-
);
|
|
1108
|
+
const transformManifest = (manifest2) => {
|
|
1109
|
+
userConfig.transformManifest?.(manifest2);
|
|
1110
|
+
inlineConfig.transformManifest?.(manifest2);
|
|
1111
|
+
};
|
|
1144
1112
|
return {
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
configFile: inlineConfig.configFile,
|
|
1149
|
-
debug: inlineConfig.debug ?? userConfig.debug,
|
|
1150
|
-
entrypointsDir: inlineConfig.entrypointsDir ?? userConfig.entrypointsDir,
|
|
1151
|
-
filterEntrypoints: inlineConfig.filterEntrypoints ?? userConfig.filterEntrypoints,
|
|
1113
|
+
...(0, import_defu.default)(inlineConfig, userConfig),
|
|
1114
|
+
// Custom merge values
|
|
1115
|
+
transformManifest,
|
|
1152
1116
|
imports,
|
|
1153
|
-
logger: inlineConfig.logger ?? userConfig.logger,
|
|
1154
1117
|
manifest,
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
runner,
|
|
1158
|
-
srcDir: inlineConfig.srcDir ?? userConfig.srcDir,
|
|
1159
|
-
outDir: inlineConfig.outDir ?? userConfig.outDir,
|
|
1160
|
-
zip,
|
|
1161
|
-
analysis: {
|
|
1162
|
-
...userConfig.analysis,
|
|
1163
|
-
...inlineConfig.analysis
|
|
1164
|
-
},
|
|
1165
|
-
alias: {
|
|
1166
|
-
...userConfig.alias,
|
|
1167
|
-
...inlineConfig.alias
|
|
1168
|
-
},
|
|
1169
|
-
experimental: {
|
|
1170
|
-
...userConfig.experimental,
|
|
1171
|
-
...inlineConfig.experimental
|
|
1172
|
-
},
|
|
1173
|
-
vite: void 0,
|
|
1174
|
-
transformManifest: void 0,
|
|
1175
|
-
dev: {
|
|
1176
|
-
...userConfig.dev,
|
|
1177
|
-
...inlineConfig.dev
|
|
1178
|
-
},
|
|
1179
|
-
hooks
|
|
1118
|
+
// Vite builder handles merging vite config internally
|
|
1119
|
+
vite: void 0
|
|
1180
1120
|
};
|
|
1181
1121
|
}
|
|
1182
|
-
function
|
|
1122
|
+
function resolveZipConfig(root, mergedConfig) {
|
|
1183
1123
|
const downloadedPackagesDir = import_node_path10.default.resolve(root, ".wxt/local_modules");
|
|
1184
1124
|
return {
|
|
1185
1125
|
name: void 0,
|
|
@@ -1204,6 +1144,23 @@ function resolveInternalZipConfig(root, mergedConfig) {
|
|
|
1204
1144
|
downloadedPackagesDir
|
|
1205
1145
|
};
|
|
1206
1146
|
}
|
|
1147
|
+
function resolveAnalysisConfig(root, mergedConfig) {
|
|
1148
|
+
const analysisOutputFile = import_node_path10.default.resolve(
|
|
1149
|
+
root,
|
|
1150
|
+
mergedConfig.analysis?.outputFile ?? "stats.html"
|
|
1151
|
+
);
|
|
1152
|
+
const analysisOutputDir = import_node_path10.default.dirname(analysisOutputFile);
|
|
1153
|
+
const analysisOutputName = import_node_path10.default.parse(analysisOutputFile).name;
|
|
1154
|
+
return {
|
|
1155
|
+
enabled: mergedConfig.analysis?.enabled ?? false,
|
|
1156
|
+
open: mergedConfig.analysis?.open ?? false,
|
|
1157
|
+
template: mergedConfig.analysis?.template ?? "treemap",
|
|
1158
|
+
outputFile: analysisOutputFile,
|
|
1159
|
+
outputDir: analysisOutputDir,
|
|
1160
|
+
outputName: analysisOutputName,
|
|
1161
|
+
keepArtifacts: mergedConfig.analysis?.keepArtifacts ?? false
|
|
1162
|
+
};
|
|
1163
|
+
}
|
|
1207
1164
|
async function getUnimportOptions(wxtDir, logger, config) {
|
|
1208
1165
|
if (config.imports === false)
|
|
1209
1166
|
return false;
|
|
@@ -1256,6 +1213,10 @@ function logMissingDir(logger, name, expected) {
|
|
|
1256
1213
|
)}`
|
|
1257
1214
|
);
|
|
1258
1215
|
}
|
|
1216
|
+
var COMMAND_MODES = {
|
|
1217
|
+
build: "production",
|
|
1218
|
+
serve: "development"
|
|
1219
|
+
};
|
|
1259
1220
|
|
|
1260
1221
|
// src/core/utils/building/import-entrypoint.ts
|
|
1261
1222
|
var import_jiti = __toESM(require("jiti"), 1);
|
package/dist/testing.d.cts
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-
|
|
3
|
+
import { I as InlineConfig } from './index-mZodC81T.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-
|
|
3
|
+
import { I as InlineConfig } from './index-mZodC81T.js';
|
|
4
4
|
import 'webextension-polyfill';
|
|
5
5
|
import 'unimport';
|
|
6
6
|
import 'consola';
|
package/dist/testing.js
CHANGED