wxt 0.19.5 → 0.19.6

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.
@@ -227,7 +227,10 @@ export async function createViteBuilder(wxtConfig, hooks, server) {
227
227
  port: info.port,
228
228
  strictPort: true,
229
229
  host: info.hostname,
230
- origin: info.origin
230
+ origin: info.origin,
231
+ watch: {
232
+ ignored: [`${wxtConfig.outBaseDir}/**`, `${wxtConfig.wxtDir}/**`]
233
+ }
231
234
  }
232
235
  };
233
236
  const baseConfig = await getBaseConfig();
@@ -99,14 +99,12 @@ function createFileReloader(server) {
99
99
  const fileChangedMutex = new Mutex();
100
100
  const changeQueue = [];
101
101
  return async (event, path) => {
102
- await wxt.reloadConfig();
103
- if (path.startsWith(wxt.config.outBaseDir)) return;
104
- if (path.startsWith(wxt.config.wxtDir)) return;
105
102
  changeQueue.push([event, path]);
106
103
  await fileChangedMutex.runExclusive(async () => {
107
104
  if (server.currentOutput == null) return;
108
105
  const fileChanges = changeQueue.splice(0, changeQueue.length).map(([_, file]) => file);
109
106
  if (fileChanges.length === 0) return;
107
+ await wxt.reloadConfig();
110
108
  const changes = detectDevChanges(fileChanges, server.currentOutput);
111
109
  if (changes.type === "no-change") return;
112
110
  if (changes.type === "full-restart") {
@@ -313,7 +313,7 @@ async function getSidepanelEntrypoint(info) {
313
313
  const options = await getHtmlEntrypointOptions(
314
314
  info,
315
315
  {
316
- browserStyle: "browse_style",
316
+ browserStyle: "browser_style",
317
317
  exclude: "exclude",
318
318
  include: "include",
319
319
  defaultIcon: "default_icon",
@@ -102,18 +102,38 @@ declare module "wxt/browser" {
102
102
  } else {
103
103
  messages = parseI18nMessages({});
104
104
  }
105
- const overrides = messages.map((message) => {
106
- return ` /**
107
- * ${message.description || "No message description."}
108
- *
109
- * "${message.message}"
105
+ const renderGetMessageOverload = (keyType, description, translation) => {
106
+ const commentLines = [];
107
+ if (description) commentLines.push(...description.split("\n"));
108
+ if (translation) {
109
+ if (commentLines.length > 0) commentLines.push("");
110
+ commentLines.push(`"${translation}"`);
111
+ }
112
+ const comment = commentLines.length > 0 ? `/**
113
+ ${commentLines.map((line) => ` * ${line}`.trimEnd()).join("\n")}
110
114
  */
111
- getMessage(
112
- messageName: "${message.name}",
115
+ ` : "";
116
+ return ` ${comment}getMessage(
117
+ messageName: ${keyType},
113
118
  substitutions?: string | string[],
114
119
  options?: GetMessageOptions,
115
120
  ): string;`;
116
- });
121
+ };
122
+ const overrides = [
123
+ // Generate individual overloads for each message so JSDoc contains description and base translation.
124
+ ...messages.map(
125
+ (message) => renderGetMessageOverload(
126
+ `"${message.name}"`,
127
+ message.description,
128
+ message.message
129
+ )
130
+ ),
131
+ // Include a final union-based override so TS accepts valid string templates or concatinations
132
+ // ie: browser.i18n.getMessage(`some_enum_${enumValue}`)
133
+ renderGetMessageOverload(
134
+ messages.map((message) => `"${message.name}"`).join(" | ")
135
+ )
136
+ ];
117
137
  return {
118
138
  path: "types/i18n.d.ts",
119
139
  text: template.replace("{{ overrides }}", overrides.join("\n")),
package/dist/version.mjs CHANGED
@@ -1 +1 @@
1
- export const version = "0.19.5";
1
+ export const version = "0.19.6";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "wxt",
3
3
  "type": "module",
4
- "version": "0.19.5",
4
+ "version": "0.19.6",
5
5
  "description": "Next gen framework for developing web extensions",
6
6
  "repository": {
7
7
  "type": "git",