wxt 0.16.5 → 0.16.7
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-N5MSLHHE.js → chunk-KKL6XTRP.js} +113 -72
- package/dist/cli.js +114 -73
- package/dist/client.js +3 -7
- package/dist/{index-znx-ff-l.d.cts → index-sl22zA2Z.d.cts} +62 -4
- package/dist/{index-znx-ff-l.d.ts → index-sl22zA2Z.d.ts} +62 -4
- package/dist/index.cjs +130 -89
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/testing.cjs +86 -61
- package/dist/testing.d.cts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -3019,29 +3019,6 @@ var import_unimport = require("unimport");
|
|
|
3019
3019
|
var import_fs_extra4 = __toESM(require("fs-extra"), 1);
|
|
3020
3020
|
var import_path3 = require("path");
|
|
3021
3021
|
|
|
3022
|
-
// src/core/utils/unimport.ts
|
|
3023
|
-
var import_defu = require("defu");
|
|
3024
|
-
function getUnimportOptions(config) {
|
|
3025
|
-
if (config.imports === false)
|
|
3026
|
-
return false;
|
|
3027
|
-
const defaultOptions = {
|
|
3028
|
-
debugLog: config.logger.debug,
|
|
3029
|
-
imports: [
|
|
3030
|
-
{ name: "defineConfig", from: "wxt" },
|
|
3031
|
-
{ name: "fakeBrowser", from: "wxt/testing" }
|
|
3032
|
-
],
|
|
3033
|
-
presets: [
|
|
3034
|
-
{ package: "wxt/client" },
|
|
3035
|
-
{ package: "wxt/browser" },
|
|
3036
|
-
{ package: "wxt/sandbox" },
|
|
3037
|
-
{ package: "wxt/storage" }
|
|
3038
|
-
],
|
|
3039
|
-
warn: config.logger.warn,
|
|
3040
|
-
dirs: ["components", "composables", "hooks", "utils"]
|
|
3041
|
-
};
|
|
3042
|
-
return (0, import_defu.defu)(config.imports, defaultOptions);
|
|
3043
|
-
}
|
|
3044
|
-
|
|
3045
3022
|
// src/core/utils/globals.ts
|
|
3046
3023
|
function getGlobals(config) {
|
|
3047
3024
|
return [
|
|
@@ -3141,9 +3118,12 @@ function parseI18nMessages(messagesJson) {
|
|
|
3141
3118
|
async function generateTypesDir(entrypoints) {
|
|
3142
3119
|
await import_fs_extra4.default.ensureDir(wxt.config.typesDir);
|
|
3143
3120
|
const references = [];
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
references.push(await writeImportsDeclarationFile(
|
|
3121
|
+
if (wxt.config.imports !== false) {
|
|
3122
|
+
const unimport2 = (0, import_unimport.createUnimport)(wxt.config.imports);
|
|
3123
|
+
references.push(await writeImportsDeclarationFile(unimport2));
|
|
3124
|
+
if (wxt.config.imports.eslintrc.enabled) {
|
|
3125
|
+
await writeImportsEslintFile(unimport2, wxt.config.imports);
|
|
3126
|
+
}
|
|
3147
3127
|
}
|
|
3148
3128
|
references.push(await writePathsDeclarationFile(entrypoints));
|
|
3149
3129
|
references.push(await writeI18nDeclarationFile());
|
|
@@ -3151,9 +3131,8 @@ async function generateTypesDir(entrypoints) {
|
|
|
3151
3131
|
const mainReference = await writeMainDeclarationFile(references);
|
|
3152
3132
|
await writeTsConfigFile(mainReference);
|
|
3153
3133
|
}
|
|
3154
|
-
async function writeImportsDeclarationFile(
|
|
3134
|
+
async function writeImportsDeclarationFile(unimport2) {
|
|
3155
3135
|
const filePath = (0, import_path3.resolve)(wxt.config.typesDir, "imports.d.ts");
|
|
3156
|
-
const unimport2 = (0, import_unimport.createUnimport)(unimportOptions);
|
|
3157
3136
|
await unimport2.scanImportsFromDir(void 0, { cwd: wxt.config.srcDir });
|
|
3158
3137
|
await writeFileIfDifferent(
|
|
3159
3138
|
filePath,
|
|
@@ -3163,6 +3142,14 @@ async function writeImportsDeclarationFile(unimportOptions) {
|
|
|
3163
3142
|
);
|
|
3164
3143
|
return filePath;
|
|
3165
3144
|
}
|
|
3145
|
+
async function writeImportsEslintFile(unimport2, options) {
|
|
3146
|
+
const globals2 = {};
|
|
3147
|
+
const eslintrc = { globals: globals2 };
|
|
3148
|
+
(await unimport2.getImports()).map((i) => i.as ?? i.name).filter(Boolean).sort().forEach((name) => {
|
|
3149
|
+
eslintrc.globals[name] = options.eslintrc.globalsPropValue;
|
|
3150
|
+
});
|
|
3151
|
+
await import_fs_extra4.default.writeJson(options.eslintrc.filePath, eslintrc, { spaces: 2 });
|
|
3152
|
+
}
|
|
3166
3153
|
async function writePathsDeclarationFile(entrypoints) {
|
|
3167
3154
|
const filePath = (0, import_path3.resolve)(wxt.config.typesDir, "paths.d.ts");
|
|
3168
3155
|
const unions = entrypoints.map(
|
|
@@ -3315,7 +3302,7 @@ ${paths}
|
|
|
3315
3302
|
|
|
3316
3303
|
// src/core/utils/building/resolve-config.ts
|
|
3317
3304
|
var import_c12 = require("c12");
|
|
3318
|
-
var
|
|
3305
|
+
var import_node_path9 = __toESM(require("path"), 1);
|
|
3319
3306
|
|
|
3320
3307
|
// src/core/utils/cache.ts
|
|
3321
3308
|
var import_fs_extra5 = __toESM(require("fs-extra"), 1);
|
|
@@ -3641,7 +3628,7 @@ async function removeEmptyDirs(dir) {
|
|
|
3641
3628
|
}
|
|
3642
3629
|
|
|
3643
3630
|
// src/core/builders/vite/plugins/unimport.ts
|
|
3644
|
-
var
|
|
3631
|
+
var import_unimport2 = require("unimport");
|
|
3645
3632
|
var import_path5 = require("path");
|
|
3646
3633
|
var ENABLED_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
3647
3634
|
".js",
|
|
@@ -3652,10 +3639,10 @@ var ENABLED_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
|
3652
3639
|
".svelte"
|
|
3653
3640
|
]);
|
|
3654
3641
|
function unimport(config) {
|
|
3655
|
-
const options =
|
|
3642
|
+
const options = config.imports;
|
|
3656
3643
|
if (options === false)
|
|
3657
3644
|
return [];
|
|
3658
|
-
const unimport2 = (0,
|
|
3645
|
+
const unimport2 = (0, import_unimport2.createUnimport)(options);
|
|
3659
3646
|
return {
|
|
3660
3647
|
name: "wxt:unimport",
|
|
3661
3648
|
async config() {
|
|
@@ -3770,7 +3757,10 @@ var increment = 0;
|
|
|
3770
3757
|
function bundleAnalysis(config) {
|
|
3771
3758
|
return (0, import_rollup_plugin_visualizer.visualizer)({
|
|
3772
3759
|
template: "raw-data",
|
|
3773
|
-
filename: import_node_path6.default.resolve(
|
|
3760
|
+
filename: import_node_path6.default.resolve(
|
|
3761
|
+
config.analysis.outputDir,
|
|
3762
|
+
`${config.analysis.outputName}-${increment++}.json`
|
|
3763
|
+
)
|
|
3774
3764
|
});
|
|
3775
3765
|
}
|
|
3776
3766
|
|
|
@@ -4065,7 +4055,27 @@ function getRollupEntry(entrypoint) {
|
|
|
4065
4055
|
}
|
|
4066
4056
|
|
|
4067
4057
|
// src/core/utils/building/resolve-config.ts
|
|
4068
|
-
var
|
|
4058
|
+
var import_defu = __toESM(require("defu"), 1);
|
|
4059
|
+
|
|
4060
|
+
// src/core/utils/package.ts
|
|
4061
|
+
var import_node_path8 = require("path");
|
|
4062
|
+
var import_fs_extra8 = __toESM(require("fs-extra"), 1);
|
|
4063
|
+
async function getPackageJson() {
|
|
4064
|
+
const file = (0, import_node_path8.resolve)(wxt.config.root, "package.json");
|
|
4065
|
+
try {
|
|
4066
|
+
return await import_fs_extra8.default.readJson(file);
|
|
4067
|
+
} catch (err) {
|
|
4068
|
+
wxt.logger.debug(
|
|
4069
|
+
`Failed to read package.json at: ${file}. Returning undefined.`
|
|
4070
|
+
);
|
|
4071
|
+
return {};
|
|
4072
|
+
}
|
|
4073
|
+
}
|
|
4074
|
+
function isModuleInstalled(name) {
|
|
4075
|
+
return import(name).then(() => true).catch(() => false);
|
|
4076
|
+
}
|
|
4077
|
+
|
|
4078
|
+
// src/core/utils/building/resolve-config.ts
|
|
4069
4079
|
async function resolveConfig(inlineConfig, command, server) {
|
|
4070
4080
|
let userConfig = {};
|
|
4071
4081
|
let userConfigMetadata;
|
|
@@ -4090,20 +4100,20 @@ async function resolveConfig(inlineConfig, command, server) {
|
|
|
4090
4100
|
const manifestVersion = mergedConfig.manifestVersion ?? (browser === "firefox" || browser === "safari" ? 2 : 3);
|
|
4091
4101
|
const mode = mergedConfig.mode ?? (command === "build" ? "production" : "development");
|
|
4092
4102
|
const env = { browser, command, manifestVersion, mode };
|
|
4093
|
-
const root =
|
|
4103
|
+
const root = import_node_path9.default.resolve(
|
|
4094
4104
|
inlineConfig.root ?? userConfig.root ?? process.cwd()
|
|
4095
4105
|
);
|
|
4096
|
-
const wxtDir =
|
|
4097
|
-
const srcDir =
|
|
4098
|
-
const entrypointsDir =
|
|
4106
|
+
const wxtDir = import_node_path9.default.resolve(root, ".wxt");
|
|
4107
|
+
const srcDir = import_node_path9.default.resolve(root, mergedConfig.srcDir ?? root);
|
|
4108
|
+
const entrypointsDir = import_node_path9.default.resolve(
|
|
4099
4109
|
srcDir,
|
|
4100
4110
|
mergedConfig.entrypointsDir ?? "entrypoints"
|
|
4101
4111
|
);
|
|
4102
4112
|
const filterEntrypoints = !!mergedConfig.filterEntrypoints?.length ? new Set(mergedConfig.filterEntrypoints) : void 0;
|
|
4103
|
-
const publicDir =
|
|
4104
|
-
const typesDir =
|
|
4105
|
-
const outBaseDir =
|
|
4106
|
-
const outDir =
|
|
4113
|
+
const publicDir = import_node_path9.default.resolve(srcDir, mergedConfig.publicDir ?? "public");
|
|
4114
|
+
const typesDir = import_node_path9.default.resolve(wxtDir, "types");
|
|
4115
|
+
const outBaseDir = import_node_path9.default.resolve(root, mergedConfig.outDir ?? ".output");
|
|
4116
|
+
const outDir = import_node_path9.default.resolve(outBaseDir, `${browser}-mv${manifestVersion}`);
|
|
4107
4117
|
const reloadCommand = mergedConfig.dev?.reloadCommand ?? "Alt+R";
|
|
4108
4118
|
const runnerConfig = await (0, import_c12.loadConfig)({
|
|
4109
4119
|
name: "web-ext",
|
|
@@ -4120,8 +4130,14 @@ async function resolveConfig(inlineConfig, command, server) {
|
|
|
4120
4130
|
"~": srcDir,
|
|
4121
4131
|
"@@": root,
|
|
4122
4132
|
"~~": root
|
|
4123
|
-
}).map(([key, value]) => [key,
|
|
4133
|
+
}).map(([key, value]) => [key, import_node_path9.default.resolve(root, value)])
|
|
4124
4134
|
);
|
|
4135
|
+
const analysisOutputFile = import_node_path9.default.resolve(
|
|
4136
|
+
root,
|
|
4137
|
+
mergedConfig.analysis?.outputFile ?? "stats.html"
|
|
4138
|
+
);
|
|
4139
|
+
const analysisOutputDir = import_node_path9.default.dirname(analysisOutputFile);
|
|
4140
|
+
const analysisOutputName = import_node_path9.default.parse(analysisOutputFile).name;
|
|
4125
4141
|
const finalConfig = {
|
|
4126
4142
|
browser,
|
|
4127
4143
|
command,
|
|
@@ -4130,7 +4146,7 @@ async function resolveConfig(inlineConfig, command, server) {
|
|
|
4130
4146
|
filterEntrypoints,
|
|
4131
4147
|
env,
|
|
4132
4148
|
fsCache: createFsCache(wxtDir),
|
|
4133
|
-
imports:
|
|
4149
|
+
imports: await getUnimportOptions(wxtDir, logger, mergedConfig),
|
|
4134
4150
|
logger,
|
|
4135
4151
|
manifest: await resolveManifestConfig(env, mergedConfig.manifest),
|
|
4136
4152
|
manifestVersion,
|
|
@@ -4151,10 +4167,10 @@ async function resolveConfig(inlineConfig, command, server) {
|
|
|
4151
4167
|
analysis: {
|
|
4152
4168
|
enabled: mergedConfig.analysis?.enabled ?? false,
|
|
4153
4169
|
template: mergedConfig.analysis?.template ?? "treemap",
|
|
4154
|
-
outputFile:
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4170
|
+
outputFile: analysisOutputFile,
|
|
4171
|
+
outputDir: analysisOutputDir,
|
|
4172
|
+
outputName: analysisOutputName,
|
|
4173
|
+
keepArtifacts: mergedConfig.analysis?.keepArtifacts ?? false
|
|
4158
4174
|
},
|
|
4159
4175
|
userConfigMetadata: userConfigMetadata ?? {},
|
|
4160
4176
|
alias,
|
|
@@ -4187,22 +4203,22 @@ function mergeInlineConfig(inlineConfig, userConfig) {
|
|
|
4187
4203
|
} else if (userConfig.imports == null && inlineConfig.imports == null) {
|
|
4188
4204
|
imports = void 0;
|
|
4189
4205
|
} else {
|
|
4190
|
-
imports = (0,
|
|
4206
|
+
imports = (0, import_defu.default)(inlineConfig.imports ?? {}, userConfig.imports ?? {});
|
|
4191
4207
|
}
|
|
4192
4208
|
const manifest = async (env) => {
|
|
4193
4209
|
const user = await resolveManifestConfig(env, userConfig.manifest);
|
|
4194
4210
|
const inline = await resolveManifestConfig(env, inlineConfig.manifest);
|
|
4195
|
-
return (0,
|
|
4211
|
+
return (0, import_defu.default)(inline, user);
|
|
4196
4212
|
};
|
|
4197
|
-
const runner = (0,
|
|
4213
|
+
const runner = (0, import_defu.default)(
|
|
4198
4214
|
inlineConfig.runner ?? {},
|
|
4199
4215
|
userConfig.runner ?? {}
|
|
4200
4216
|
);
|
|
4201
|
-
const zip2 = (0,
|
|
4217
|
+
const zip2 = (0, import_defu.default)(
|
|
4202
4218
|
inlineConfig.zip ?? {},
|
|
4203
4219
|
userConfig.zip ?? {}
|
|
4204
4220
|
);
|
|
4205
|
-
const hooks = (0,
|
|
4221
|
+
const hooks = (0, import_defu.default)(
|
|
4206
4222
|
inlineConfig.hooks ?? {},
|
|
4207
4223
|
userConfig.hooks ?? {}
|
|
4208
4224
|
);
|
|
@@ -4266,6 +4282,44 @@ function resolveInternalZipConfig(root, mergedConfig) {
|
|
|
4266
4282
|
]
|
|
4267
4283
|
};
|
|
4268
4284
|
}
|
|
4285
|
+
async function getUnimportOptions(wxtDir, logger, config) {
|
|
4286
|
+
if (config.imports === false)
|
|
4287
|
+
return false;
|
|
4288
|
+
const enabledConfig = config.imports?.eslintrc?.enabled;
|
|
4289
|
+
let enabled;
|
|
4290
|
+
switch (enabledConfig) {
|
|
4291
|
+
case void 0:
|
|
4292
|
+
case "auto":
|
|
4293
|
+
enabled = await isModuleInstalled("eslint");
|
|
4294
|
+
break;
|
|
4295
|
+
default:
|
|
4296
|
+
enabled = enabledConfig;
|
|
4297
|
+
}
|
|
4298
|
+
const defaultOptions = {
|
|
4299
|
+
debugLog: logger.debug,
|
|
4300
|
+
imports: [
|
|
4301
|
+
{ name: "defineConfig", from: "wxt" },
|
|
4302
|
+
{ name: "fakeBrowser", from: "wxt/testing" }
|
|
4303
|
+
],
|
|
4304
|
+
presets: [
|
|
4305
|
+
{ package: "wxt/client" },
|
|
4306
|
+
{ package: "wxt/browser" },
|
|
4307
|
+
{ package: "wxt/sandbox" },
|
|
4308
|
+
{ package: "wxt/storage" }
|
|
4309
|
+
],
|
|
4310
|
+
warn: logger.warn,
|
|
4311
|
+
dirs: ["components", "composables", "hooks", "utils"],
|
|
4312
|
+
eslintrc: {
|
|
4313
|
+
enabled,
|
|
4314
|
+
filePath: import_node_path9.default.resolve(wxtDir, "eslintrc-auto-import.json"),
|
|
4315
|
+
globalsPropValue: true
|
|
4316
|
+
}
|
|
4317
|
+
};
|
|
4318
|
+
return (0, import_defu.default)(
|
|
4319
|
+
config.imports ?? {},
|
|
4320
|
+
defaultOptions
|
|
4321
|
+
);
|
|
4322
|
+
}
|
|
4269
4323
|
|
|
4270
4324
|
// src/core/utils/building/group-entrypoints.ts
|
|
4271
4325
|
function groupEntrypoints(entrypoints) {
|
|
@@ -4308,9 +4362,9 @@ var ENTRY_TYPE_TO_GROUP_MAP = {
|
|
|
4308
4362
|
|
|
4309
4363
|
// src/core/utils/building/import-entrypoint.ts
|
|
4310
4364
|
var import_jiti = __toESM(require("jiti"), 1);
|
|
4311
|
-
var
|
|
4312
|
-
var
|
|
4313
|
-
var
|
|
4365
|
+
var import_unimport3 = require("unimport");
|
|
4366
|
+
var import_fs_extra9 = __toESM(require("fs-extra"), 1);
|
|
4367
|
+
var import_node_path10 = require("path");
|
|
4314
4368
|
|
|
4315
4369
|
// src/core/utils/strings.ts
|
|
4316
4370
|
function kebabCaseAlphanumeric(str) {
|
|
@@ -4336,13 +4390,13 @@ var import_meta = {};
|
|
|
4336
4390
|
async function importEntrypointFile(path11) {
|
|
4337
4391
|
wxt.logger.debug("Loading file metadata:", path11);
|
|
4338
4392
|
const normalPath = normalizePath(path11);
|
|
4339
|
-
const unimport2 = (0,
|
|
4340
|
-
...
|
|
4393
|
+
const unimport2 = (0, import_unimport3.createUnimport)({
|
|
4394
|
+
...wxt.config.imports,
|
|
4341
4395
|
// Only allow specific imports, not all from the project
|
|
4342
4396
|
dirs: []
|
|
4343
4397
|
});
|
|
4344
4398
|
await unimport2.init();
|
|
4345
|
-
const text = await
|
|
4399
|
+
const text = await import_fs_extra9.default.readFile(path11, "utf-8");
|
|
4346
4400
|
const textNoImports = removeProjectImportStatements(text);
|
|
4347
4401
|
const { code } = await unimport2.injectImports(textNoImports);
|
|
4348
4402
|
wxt.logger.debug(
|
|
@@ -4355,7 +4409,7 @@ async function importEntrypointFile(path11) {
|
|
|
4355
4409
|
debug: wxt.config.debug,
|
|
4356
4410
|
esmResolve: true,
|
|
4357
4411
|
alias: {
|
|
4358
|
-
"webextension-polyfill": (0,
|
|
4412
|
+
"webextension-polyfill": (0, import_node_path10.resolve)(
|
|
4359
4413
|
wxt.config.root,
|
|
4360
4414
|
"node_modules/wxt/dist/virtual/mock-browser.js"
|
|
4361
4415
|
)
|
|
@@ -4388,7 +4442,7 @@ async function importEntrypointFile(path11) {
|
|
|
4388
4442
|
const res = await jiti(path11);
|
|
4389
4443
|
return res.default;
|
|
4390
4444
|
} catch (err) {
|
|
4391
|
-
const filePath = (0,
|
|
4445
|
+
const filePath = (0, import_node_path10.relative)(wxt.config.root, path11);
|
|
4392
4446
|
if (err instanceof ReferenceError) {
|
|
4393
4447
|
const variableName = err.message.replace(" is not defined", "");
|
|
4394
4448
|
throw Error(
|
|
@@ -4418,9 +4472,9 @@ var import_fs_extra12 = __toESM(require("fs-extra"), 1);
|
|
|
4418
4472
|
var import_path7 = require("path");
|
|
4419
4473
|
|
|
4420
4474
|
// src/core/utils/log/printFileList.ts
|
|
4421
|
-
var
|
|
4475
|
+
var import_node_path11 = __toESM(require("path"), 1);
|
|
4422
4476
|
var import_picocolors3 = __toESM(require("picocolors"), 1);
|
|
4423
|
-
var
|
|
4477
|
+
var import_fs_extra10 = __toESM(require("fs-extra"), 1);
|
|
4424
4478
|
var import_filesize = require("filesize");
|
|
4425
4479
|
|
|
4426
4480
|
// src/core/utils/log/printTable.ts
|
|
@@ -4456,12 +4510,12 @@ async function printFileList(log, header, baseDir, files) {
|
|
|
4456
4510
|
const fileRows = await Promise.all(
|
|
4457
4511
|
files.map(async (file, i) => {
|
|
4458
4512
|
const parts = [
|
|
4459
|
-
|
|
4460
|
-
|
|
4513
|
+
import_node_path11.default.relative(process.cwd(), baseDir) + import_node_path11.default.sep,
|
|
4514
|
+
import_node_path11.default.relative(baseDir, file)
|
|
4461
4515
|
];
|
|
4462
4516
|
const prefix = i === files.length - 1 ? " \u2514\u2500" : " \u251C\u2500";
|
|
4463
4517
|
const color = getChunkColor(file);
|
|
4464
|
-
const stats = await
|
|
4518
|
+
const stats = await import_fs_extra10.default.lstat(file);
|
|
4465
4519
|
totalSize += stats.size;
|
|
4466
4520
|
const size = String((0, import_filesize.filesize)(stats.size));
|
|
4467
4521
|
return [
|
|
@@ -4525,7 +4579,7 @@ function getChunkSortWeight(filename) {
|
|
|
4525
4579
|
var import_picocolors4 = __toESM(require("picocolors"), 1);
|
|
4526
4580
|
|
|
4527
4581
|
// package.json
|
|
4528
|
-
var version = "0.16.
|
|
4582
|
+
var version = "0.16.7";
|
|
4529
4583
|
|
|
4530
4584
|
// src/core/utils/log/printHeader.ts
|
|
4531
4585
|
var import_consola2 = require("consola");
|
|
@@ -4638,23 +4692,8 @@ function mapWxtOptionsToContentScript(options) {
|
|
|
4638
4692
|
};
|
|
4639
4693
|
}
|
|
4640
4694
|
|
|
4641
|
-
// src/core/utils/package.ts
|
|
4642
|
-
var import_node_path11 = require("path");
|
|
4643
|
-
var import_fs_extra10 = __toESM(require("fs-extra"), 1);
|
|
4644
|
-
async function getPackageJson() {
|
|
4645
|
-
const file = (0, import_node_path11.resolve)(wxt.config.root, "package.json");
|
|
4646
|
-
try {
|
|
4647
|
-
return await import_fs_extra10.default.readJson(file);
|
|
4648
|
-
} catch (err) {
|
|
4649
|
-
wxt.logger.debug(
|
|
4650
|
-
`Failed to read package.json at: ${file}. Returning undefined.`
|
|
4651
|
-
);
|
|
4652
|
-
return {};
|
|
4653
|
-
}
|
|
4654
|
-
}
|
|
4655
|
-
|
|
4656
4695
|
// src/core/utils/manifest.ts
|
|
4657
|
-
var
|
|
4696
|
+
var import_defu2 = __toESM(require("defu"), 1);
|
|
4658
4697
|
async function writeManifest(manifest, output) {
|
|
4659
4698
|
const str = wxt.config.mode === "production" ? JSON.stringify(manifest) : JSON.stringify(manifest, null, 2);
|
|
4660
4699
|
await import_fs_extra11.default.ensureDir(wxt.config.outDir);
|
|
@@ -4684,7 +4723,7 @@ async function generateManifest(entrypoints, buildOutput) {
|
|
|
4684
4723
|
icons: discoverIcons(buildOutput)
|
|
4685
4724
|
};
|
|
4686
4725
|
const userManifest = wxt.config.manifest;
|
|
4687
|
-
let manifest = (0,
|
|
4726
|
+
let manifest = (0, import_defu2.default)(
|
|
4688
4727
|
userManifest,
|
|
4689
4728
|
baseManifest
|
|
4690
4729
|
);
|
|
@@ -5263,8 +5302,8 @@ async function internalBuild() {
|
|
|
5263
5302
|
return output;
|
|
5264
5303
|
}
|
|
5265
5304
|
async function combineAnalysisStats() {
|
|
5266
|
-
const unixFiles = await (0, import_fast_glob3.default)(
|
|
5267
|
-
cwd: wxt.config.
|
|
5305
|
+
const unixFiles = await (0, import_fast_glob3.default)(`${wxt.config.analysis.outputName}-*.json`, {
|
|
5306
|
+
cwd: wxt.config.analysis.outputDir,
|
|
5268
5307
|
absolute: true
|
|
5269
5308
|
});
|
|
5270
5309
|
const absolutePaths = unixFiles.map(unnormalizePath);
|
|
@@ -5279,7 +5318,9 @@ async function combineAnalysisStats() {
|
|
|
5279
5318
|
],
|
|
5280
5319
|
{ cwd: wxt.config.root, stdio: "inherit" }
|
|
5281
5320
|
);
|
|
5282
|
-
|
|
5321
|
+
if (!wxt.config.analysis.keepArtifacts) {
|
|
5322
|
+
await Promise.all(absolutePaths.map((statsFile) => import_fs_extra12.default.remove(statsFile)));
|
|
5323
|
+
}
|
|
5283
5324
|
}
|
|
5284
5325
|
function printValidationResults({
|
|
5285
5326
|
errorCount,
|
|
@@ -5377,7 +5418,7 @@ function createWslRunner() {
|
|
|
5377
5418
|
}
|
|
5378
5419
|
|
|
5379
5420
|
// src/core/runners/web-ext.ts
|
|
5380
|
-
var
|
|
5421
|
+
var import_defu3 = __toESM(require("defu"), 1);
|
|
5381
5422
|
function createWebExtRunner() {
|
|
5382
5423
|
let runner;
|
|
5383
5424
|
return {
|
|
@@ -5408,7 +5449,7 @@ function createWebExtRunner() {
|
|
|
5408
5449
|
} : {
|
|
5409
5450
|
chromiumBinary: wxtUserConfig?.binaries?.[wxt.config.browser],
|
|
5410
5451
|
chromiumProfile: wxtUserConfig?.chromiumProfile,
|
|
5411
|
-
chromiumPref: (0,
|
|
5452
|
+
chromiumPref: (0, import_defu3.default)(
|
|
5412
5453
|
wxtUserConfig?.chromiumPref,
|
|
5413
5454
|
DEFAULT_CHROMIUM_PREFS
|
|
5414
5455
|
),
|
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 { q as BackgroundDefinition, h as BackgroundEntrypoint, g as BaseEntrypoint, f as BaseEntrypointOptions, d as BuildStepOutput, w as ConfigEnv, p as ContentScriptBaseDefinition, m as ContentScriptDefinition, C as ContentScriptEntrypoint, n as ContentScriptIsolatedWorldDefinition, o as ContentScriptMainWorldDefinition, j as Entrypoint, k as EntrypointGroup, t as ExcludableEntrypoint, D as ExtensionRunner, F as FsCache, G as GenericEntrypoint, H as HookResult, L as Logger, l as OnContentScriptStopped, i as OptionsEntrypoint, c as OutputAsset, b as OutputChunk, O as OutputFile, s as PerBrowserOption, P as PopupEntrypoint, R as ResolvedConfig, S as ServerInfo, T as TargetBrowser, e as TargetManifestVersion, r as UnlistedScriptDefinition, u as UserManifest, v as UserManifestFn, V as VirtualEntrypointType, A as Wxt, x as WxtBuilder, y as WxtBuilderServer, z as WxtHooks, a as WxtViteConfig } from './index-
|
|
1
|
+
import { I as InlineConfig, B as BuildOutput, U as UserConfig, E as ExtensionRunnerConfig, W as WxtDevServer } from './index-sl22zA2Z.cjs';
|
|
2
|
+
export { q as BackgroundDefinition, h as BackgroundEntrypoint, g as BaseEntrypoint, f as BaseEntrypointOptions, d as BuildStepOutput, w as ConfigEnv, p as ContentScriptBaseDefinition, m as ContentScriptDefinition, C as ContentScriptEntrypoint, n as ContentScriptIsolatedWorldDefinition, o as ContentScriptMainWorldDefinition, j as Entrypoint, k as EntrypointGroup, J as EslintGlobalsPropValue, K as Eslintrc, t as ExcludableEntrypoint, D as ExtensionRunner, F as FsCache, G as GenericEntrypoint, H as HookResult, L as Logger, l as OnContentScriptStopped, i as OptionsEntrypoint, c as OutputAsset, b as OutputChunk, O as OutputFile, s as PerBrowserOption, P as PopupEntrypoint, R as ResolvedConfig, M as ResolvedEslintrc, S as ServerInfo, T as TargetBrowser, e as TargetManifestVersion, r as UnlistedScriptDefinition, u as UserManifest, v as UserManifestFn, V as VirtualEntrypointType, A as Wxt, x as WxtBuilder, y as WxtBuilderServer, z as WxtHooks, Q as WxtResolvedUnimportOptions, N as WxtUnimportOptions, a as WxtViteConfig } from './index-sl22zA2Z.cjs';
|
|
3
3
|
import 'vite';
|
|
4
4
|
import 'webextension-polyfill';
|
|
5
5
|
import 'unimport';
|
|
@@ -64,6 +64,6 @@ declare function prepare(config: InlineConfig): Promise<void>;
|
|
|
64
64
|
*/
|
|
65
65
|
declare function zip(config?: InlineConfig): Promise<string[]>;
|
|
66
66
|
|
|
67
|
-
var version = "0.16.
|
|
67
|
+
var version = "0.16.7";
|
|
68
68
|
|
|
69
69
|
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 { q as BackgroundDefinition, h as BackgroundEntrypoint, g as BaseEntrypoint, f as BaseEntrypointOptions, d as BuildStepOutput, w as ConfigEnv, p as ContentScriptBaseDefinition, m as ContentScriptDefinition, C as ContentScriptEntrypoint, n as ContentScriptIsolatedWorldDefinition, o as ContentScriptMainWorldDefinition, j as Entrypoint, k as EntrypointGroup, t as ExcludableEntrypoint, D as ExtensionRunner, F as FsCache, G as GenericEntrypoint, H as HookResult, L as Logger, l as OnContentScriptStopped, i as OptionsEntrypoint, c as OutputAsset, b as OutputChunk, O as OutputFile, s as PerBrowserOption, P as PopupEntrypoint, R as ResolvedConfig, S as ServerInfo, T as TargetBrowser, e as TargetManifestVersion, r as UnlistedScriptDefinition, u as UserManifest, v as UserManifestFn, V as VirtualEntrypointType, A as Wxt, x as WxtBuilder, y as WxtBuilderServer, z as WxtHooks, a as WxtViteConfig } from './index-
|
|
1
|
+
import { I as InlineConfig, B as BuildOutput, U as UserConfig, E as ExtensionRunnerConfig, W as WxtDevServer } from './index-sl22zA2Z.js';
|
|
2
|
+
export { q as BackgroundDefinition, h as BackgroundEntrypoint, g as BaseEntrypoint, f as BaseEntrypointOptions, d as BuildStepOutput, w as ConfigEnv, p as ContentScriptBaseDefinition, m as ContentScriptDefinition, C as ContentScriptEntrypoint, n as ContentScriptIsolatedWorldDefinition, o as ContentScriptMainWorldDefinition, j as Entrypoint, k as EntrypointGroup, J as EslintGlobalsPropValue, K as Eslintrc, t as ExcludableEntrypoint, D as ExtensionRunner, F as FsCache, G as GenericEntrypoint, H as HookResult, L as Logger, l as OnContentScriptStopped, i as OptionsEntrypoint, c as OutputAsset, b as OutputChunk, O as OutputFile, s as PerBrowserOption, P as PopupEntrypoint, R as ResolvedConfig, M as ResolvedEslintrc, S as ServerInfo, T as TargetBrowser, e as TargetManifestVersion, r as UnlistedScriptDefinition, u as UserManifest, v as UserManifestFn, V as VirtualEntrypointType, A as Wxt, x as WxtBuilder, y as WxtBuilderServer, z as WxtHooks, Q as WxtResolvedUnimportOptions, N as WxtUnimportOptions, a as WxtViteConfig } from './index-sl22zA2Z.js';
|
|
3
3
|
import 'vite';
|
|
4
4
|
import 'webextension-polyfill';
|
|
5
5
|
import 'unimport';
|
|
@@ -64,6 +64,6 @@ declare function prepare(config: InlineConfig): Promise<void>;
|
|
|
64
64
|
*/
|
|
65
65
|
declare function zip(config?: InlineConfig): Promise<string[]>;
|
|
66
66
|
|
|
67
|
-
var version = "0.16.
|
|
67
|
+
var version = "0.16.7";
|
|
68
68
|
|
|
69
69
|
export { BuildOutput, ExtensionRunnerConfig, InlineConfig, UserConfig, WxtDevServer, build, clean, createServer, defineConfig, defineRunnerConfig, initialize, prepare, version, zip };
|