wxt 0.19.26 → 0.19.27
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,8 +1,5 @@
|
|
|
1
1
|
import type { EslintGlobalsPropValue, WxtDirFileEntry, WxtModule, WxtResolvedUnimportOptions } from '../types';
|
|
2
|
-
import { type Unimport } from 'unimport';
|
|
3
|
-
import { Plugin } from 'vite';
|
|
4
2
|
declare const _default: WxtModule<import("../types").WxtModuleOptions>;
|
|
5
3
|
export default _default;
|
|
6
|
-
export declare function vitePlugin(unimport: Unimport): Plugin;
|
|
7
4
|
export declare function getEslint8ConfigEntry(options: WxtResolvedUnimportOptions, globals: Record<string, EslintGlobalsPropValue>): WxtDirFileEntry;
|
|
8
5
|
export declare function getEslint9ConfigEntry(options: WxtResolvedUnimportOptions, globals: Record<string, EslintGlobalsPropValue>): WxtDirFileEntry;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { addViteConfig, defineWxtModule } from "../modules.mjs";
|
|
2
2
|
import { createUnimport } from "unimport";
|
|
3
|
-
import
|
|
3
|
+
import UnimportPlugin from "unimport/unplugin";
|
|
4
4
|
export default defineWxtModule({
|
|
5
5
|
name: "wxt:built-in:unimport",
|
|
6
6
|
setup(wxt) {
|
|
@@ -30,32 +30,10 @@ export default defineWxtModule({
|
|
|
30
30
|
);
|
|
31
31
|
});
|
|
32
32
|
addViteConfig(wxt, () => ({
|
|
33
|
-
plugins: [
|
|
33
|
+
plugins: [UnimportPlugin.vite(options)]
|
|
34
34
|
}));
|
|
35
35
|
}
|
|
36
36
|
});
|
|
37
|
-
export function vitePlugin(unimport) {
|
|
38
|
-
const ENABLED_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
39
|
-
".js",
|
|
40
|
-
".jsx",
|
|
41
|
-
".ts",
|
|
42
|
-
".tsx",
|
|
43
|
-
".vue",
|
|
44
|
-
".svelte"
|
|
45
|
-
]);
|
|
46
|
-
return {
|
|
47
|
-
name: "wxt:unimport",
|
|
48
|
-
async transform(code, id) {
|
|
49
|
-
if (id.includes("node_modules")) return;
|
|
50
|
-
if (!ENABLED_EXTENSIONS.has(extname(id))) return;
|
|
51
|
-
const injected = await unimport.injectImports(code, id);
|
|
52
|
-
return {
|
|
53
|
-
code: injected.code,
|
|
54
|
-
map: injected.s.generateMap({ hires: "boundary", source: id })
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
37
|
async function getImportsDeclarationEntry(unimport) {
|
|
60
38
|
await unimport.init();
|
|
61
39
|
return {
|
|
@@ -162,7 +162,7 @@ function getMainDeclarationEntry(references) {
|
|
|
162
162
|
} else if (ref.tsReference) {
|
|
163
163
|
const absolutePath = resolve(wxt.config.wxtDir, ref.path);
|
|
164
164
|
const relativePath = relative(wxt.config.wxtDir, absolutePath);
|
|
165
|
-
lines.push(`/// <reference
|
|
165
|
+
lines.push(`/// <reference path="./${normalizePath(relativePath)}" />`);
|
|
166
166
|
}
|
|
167
167
|
});
|
|
168
168
|
return {
|
package/dist/core/wxt.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { builtinModules } from "../builtin-modules/index.mjs";
|
|
|
6
6
|
import { relative } from "path";
|
|
7
7
|
export let wxt;
|
|
8
8
|
export async function registerWxt(command, inlineConfig = {}) {
|
|
9
|
-
process.env.NODE_ENV ??= command === "serve" ? "development" : "production";
|
|
9
|
+
process.env.NODE_ENV ??= inlineConfig.mode ?? (command === "serve" ? "development" : "production");
|
|
10
10
|
const hooks = createHooks();
|
|
11
11
|
const config = await resolveConfig(inlineConfig, command);
|
|
12
12
|
const builder = await createViteBuilder(config, hooks, () => wxt.server);
|
|
@@ -5,8 +5,7 @@ import {
|
|
|
5
5
|
extensionApiMock,
|
|
6
6
|
resolveAppConfig
|
|
7
7
|
} from "../core/builders/vite/plugins/index.mjs";
|
|
8
|
-
import
|
|
9
|
-
import { createUnimport } from "unimport";
|
|
8
|
+
import UnimportPlugin from "unimport/unplugin";
|
|
10
9
|
import { registerWxt, wxt } from "../core/wxt.mjs";
|
|
11
10
|
export async function WxtVitest(inlineConfig) {
|
|
12
11
|
await registerWxt("serve", inlineConfig ?? {});
|
|
@@ -18,9 +17,7 @@ export async function WxtVitest(inlineConfig) {
|
|
|
18
17
|
extensionApiMock(wxt.config)
|
|
19
18
|
];
|
|
20
19
|
if (wxt.config.imports !== false) {
|
|
21
|
-
|
|
22
|
-
await unimport.init();
|
|
23
|
-
plugins.push(unimportPlugin(unimport));
|
|
20
|
+
plugins.push(UnimportPlugin.vite(wxt.config.imports));
|
|
24
21
|
}
|
|
25
22
|
return plugins;
|
|
26
23
|
}
|
package/dist/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "0.19.
|
|
1
|
+
export const version = "0.19.27";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wxt",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.19.
|
|
4
|
+
"version": "0.19.27",
|
|
5
5
|
"description": "Next gen framework for developing web extensions",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -109,11 +109,11 @@
|
|
|
109
109
|
"perfect-debounce": "^1.0.0",
|
|
110
110
|
"picocolors": "^1.1.1",
|
|
111
111
|
"prompts": "^2.4.2",
|
|
112
|
-
"publish-browser-extension": "^2.
|
|
112
|
+
"publish-browser-extension": "^2.3.0 || ^3.0.0",
|
|
113
113
|
"scule": "^1.3.0",
|
|
114
114
|
"unimport": "^3.13.1",
|
|
115
115
|
"vite": "^5.0.0 || <=6.0.8",
|
|
116
|
-
"vite-node": "^2.1.4",
|
|
116
|
+
"vite-node": "^2.1.4 || ^3.0.0",
|
|
117
117
|
"web-ext-run": "^0.2.1",
|
|
118
118
|
"webextension-polyfill": "^0.12.0"
|
|
119
119
|
},
|