wxt 0.19.8 → 0.19.10-alpha1
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/client/content-scripts/ui/index.d.ts +3 -3
- package/dist/core/create-server.mjs +1 -1
- package/dist/core/utils/building/generate-wxt-dir.mjs +0 -1
- package/dist/core/utils/building/rebuild.mjs +4 -10
- package/dist/core/utils/building/resolve-config.mjs +1 -1
- package/dist/core/utils/entrypoints.mjs +1 -1
- package/dist/core/utils/environments/environment.mjs +1 -1
- package/dist/core/utils/eslint.mjs +1 -1
- package/dist/core/utils/manifest.mjs +5 -5
- package/dist/core/utils/package.mjs +2 -1
- package/dist/core/utils/strings.d.ts +4 -0
- package/dist/core/utils/strings.mjs +7 -1
- package/dist/core/utils/testing/fake-objects.d.ts +779 -19
- package/dist/core/utils/testing/fake-objects.mjs +1 -0
- package/dist/core/utils/transform.mjs +1 -3
- package/dist/core/wxt.mjs +1 -0
- package/dist/core/zip.mjs +2 -4
- package/dist/modules.d.ts +9 -5
- package/dist/storage.d.ts +1 -1
- package/dist/storage.mjs +1 -1
- package/dist/types.d.ts +36 -3
- package/dist/version.mjs +1 -1
- package/package.json +8 -9
- package/README.md +0 -71
|
@@ -4,13 +4,13 @@ export * from './types';
|
|
|
4
4
|
/**
|
|
5
5
|
* Create a content script UI without any isolation.
|
|
6
6
|
*
|
|
7
|
-
* @see https://wxt.dev/guide/key-concepts/content-script-ui
|
|
7
|
+
* @see https://wxt.dev/guide/key-concepts/content-script-ui#integrated
|
|
8
8
|
*/
|
|
9
9
|
export declare function createIntegratedUi<TMounted>(ctx: ContentScriptContext, options: IntegratedContentScriptUiOptions<TMounted>): IntegratedContentScriptUi<TMounted>;
|
|
10
10
|
/**
|
|
11
11
|
* Create a content script UI using an iframe.
|
|
12
12
|
*
|
|
13
|
-
* @see https://wxt.dev/guide/key-concepts/content-script-ui
|
|
13
|
+
* @see https://wxt.dev/guide/key-concepts/content-script-ui#iframe
|
|
14
14
|
*/
|
|
15
15
|
export declare function createIframeUi<TMounted>(ctx: ContentScriptContext, options: IframeContentScriptUiOptions<TMounted>): IframeContentScriptUi<TMounted>;
|
|
16
16
|
/**
|
|
@@ -18,6 +18,6 @@ export declare function createIframeUi<TMounted>(ctx: ContentScriptContext, opti
|
|
|
18
18
|
*
|
|
19
19
|
* > This function is async because it has to load the CSS via a network call.
|
|
20
20
|
*
|
|
21
|
-
* @see https://wxt.dev/guide/key-concepts/content-script-ui
|
|
21
|
+
* @see https://wxt.dev/guide/key-concepts/content-script-ui#shadowroot
|
|
22
22
|
*/
|
|
23
23
|
export declare function createShadowRootUi<TMounted>(ctx: ContentScriptContext, options: ShadowRootContentScriptUiOptions<TMounted>): Promise<ShadowRootContentScriptUi<TMounted>>;
|
|
@@ -15,24 +15,18 @@ export async function rebuild(allEntrypoints, entrypointGroups, existingOutput =
|
|
|
15
15
|
const newOutput = await buildEntrypoints(entrypointGroups, spinner);
|
|
16
16
|
const mergedOutput = {
|
|
17
17
|
steps: [...existingOutput.steps, ...newOutput.steps],
|
|
18
|
-
|
|
18
|
+
// Do not merge existing because all publicAssets copied everytime
|
|
19
|
+
publicAssets: newOutput.publicAssets
|
|
19
20
|
};
|
|
20
21
|
const { manifest: newManifest, warnings: manifestWarnings } = await generateManifest(allEntrypoints, mergedOutput);
|
|
21
22
|
const finalOutput = {
|
|
22
23
|
manifest: newManifest,
|
|
23
|
-
...
|
|
24
|
+
...mergedOutput
|
|
24
25
|
};
|
|
25
26
|
await writeManifest(newManifest, finalOutput);
|
|
26
27
|
spinner.clear().stop();
|
|
27
28
|
return {
|
|
28
|
-
output:
|
|
29
|
-
manifest: newManifest,
|
|
30
|
-
steps: [...existingOutput.steps, ...finalOutput.steps],
|
|
31
|
-
publicAssets: [
|
|
32
|
-
...existingOutput.publicAssets,
|
|
33
|
-
...finalOutput.publicAssets
|
|
34
|
-
]
|
|
35
|
-
},
|
|
29
|
+
output: finalOutput,
|
|
36
30
|
manifest: newManifest,
|
|
37
31
|
warnings: manifestWarnings
|
|
38
32
|
};
|
|
@@ -46,7 +46,7 @@ export async function resolveConfig(inlineConfig, command) {
|
|
|
46
46
|
if (await isDirMissing(entrypointsDir)) {
|
|
47
47
|
logMissingDir(logger, "Entrypoints", entrypointsDir);
|
|
48
48
|
}
|
|
49
|
-
const filterEntrypoints =
|
|
49
|
+
const filterEntrypoints = mergedConfig.filterEntrypoints?.length ? new Set(mergedConfig.filterEntrypoints) : void 0;
|
|
50
50
|
const publicDir = path.resolve(srcDir, mergedConfig.publicDir ?? "public");
|
|
51
51
|
const typesDir = path.resolve(wxtDir, "types");
|
|
52
52
|
const outBaseDir = path.resolve(root, mergedConfig.outDir ?? ".output");
|
|
@@ -2,7 +2,7 @@ import path, { relative, resolve } from "node:path";
|
|
|
2
2
|
import { normalizePath } from "./paths.mjs";
|
|
3
3
|
export function getEntrypointName(entrypointsDir, inputPath) {
|
|
4
4
|
const relativePath = path.relative(entrypointsDir, inputPath);
|
|
5
|
-
const name = relativePath.split(/[
|
|
5
|
+
const name = relativePath.split(/[./\\]/, 2)[0];
|
|
6
6
|
return name;
|
|
7
7
|
}
|
|
8
8
|
export function getEntrypointOutputFile(entrypoint, ext) {
|
|
@@ -27,7 +27,7 @@ export async function generateManifest(entrypoints, buildOutput) {
|
|
|
27
27
|
if (versionName == null) {
|
|
28
28
|
versionName = "0.0.0";
|
|
29
29
|
wxt.logger.warn(
|
|
30
|
-
'Extension version not found, defaulting to "0.0.0". Add a version to your `package.json` or `wxt.config.ts` file. For more details, see: https://wxt.dev/guide/key-concepts/manifest
|
|
30
|
+
'Extension version not found, defaulting to "0.0.0". Add a version to your `package.json` or `wxt.config.ts` file. For more details, see: https://wxt.dev/guide/key-concepts/manifest#version-and-version-name'
|
|
31
31
|
);
|
|
32
32
|
}
|
|
33
33
|
const version = wxt.config.manifest.version ?? simplifyVersion(versionName);
|
|
@@ -190,14 +190,14 @@ function addEntrypoints(manifest, entrypoints, buildOutput) {
|
|
|
190
190
|
options2.browser_style = popup.options.browserStyle;
|
|
191
191
|
if (manifest.manifest_version === 3) {
|
|
192
192
|
manifest.action = {
|
|
193
|
-
...manifest.action
|
|
193
|
+
...manifest.action,
|
|
194
194
|
...options2,
|
|
195
195
|
default_popup
|
|
196
196
|
};
|
|
197
197
|
} else {
|
|
198
198
|
const key = popup.options.mv2Key ?? "browser_action";
|
|
199
199
|
manifest[key] = {
|
|
200
|
-
...manifest[key]
|
|
200
|
+
...manifest[key],
|
|
201
201
|
...options2,
|
|
202
202
|
default_popup
|
|
203
203
|
};
|
|
@@ -325,9 +325,9 @@ function discoverIcons(buildOutput) {
|
|
|
325
325
|
// icon@16h.png
|
|
326
326
|
/^icon@([0-9]+)\.png$/,
|
|
327
327
|
// icon@16.png
|
|
328
|
-
/^icons?[
|
|
328
|
+
/^icons?[/\\]([0-9]+)\.png$/,
|
|
329
329
|
// icon/16.png | icons/16.png
|
|
330
|
-
/^icons?[
|
|
330
|
+
/^icons?[/\\]([0-9]+)x[0-9]+\.png$/
|
|
331
331
|
// icon/16x16.png | icons/16x16.png
|
|
332
332
|
];
|
|
333
333
|
buildOutput.publicAssets.forEach((asset) => {
|
|
@@ -7,7 +7,8 @@ export async function getPackageJson() {
|
|
|
7
7
|
return await fs.readJson(file);
|
|
8
8
|
} catch (err) {
|
|
9
9
|
wxt.logger.debug(
|
|
10
|
-
`Failed to read package.json at: ${file}. Returning undefined
|
|
10
|
+
`Failed to read package.json at: ${file}. Returning undefined.`,
|
|
11
|
+
err
|
|
11
12
|
);
|
|
12
13
|
return {};
|
|
13
14
|
}
|
|
@@ -3,6 +3,10 @@ export declare function kebabCaseAlphanumeric(str: string): string;
|
|
|
3
3
|
* Return a safe variable name for a given string.
|
|
4
4
|
*/
|
|
5
5
|
export declare function safeVarName(str: string): string;
|
|
6
|
+
/**
|
|
7
|
+
* Converts a string to a valid filename (NOT path), stripping out invalid characters.
|
|
8
|
+
*/
|
|
9
|
+
export declare function safeFilename(str: string): string;
|
|
6
10
|
/**
|
|
7
11
|
* Removes import statements from the top of a file. Keeps import.meta and inline, async `import()`
|
|
8
12
|
* calls.
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
import { camelCase } from "scule";
|
|
1
2
|
export function kebabCaseAlphanumeric(str) {
|
|
2
3
|
return str.toLowerCase().replace(/[^a-z0-9-\s]/g, "").replace(/\s+/g, "-");
|
|
3
4
|
}
|
|
4
5
|
export function safeVarName(str) {
|
|
5
|
-
|
|
6
|
+
const name = camelCase(kebabCaseAlphanumeric(str));
|
|
7
|
+
if (name.match(/^[a-z]/)) return name;
|
|
8
|
+
return "_" + name;
|
|
9
|
+
}
|
|
10
|
+
export function safeFilename(str) {
|
|
11
|
+
return kebabCaseAlphanumeric(str);
|
|
6
12
|
}
|
|
7
13
|
export function removeImportStatements(text) {
|
|
8
14
|
return text.replace(
|