wxt 0.0.1 → 0.1.0
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/README.md +5 -4
- package/dist/cli.cjs +1870 -0
- package/dist/{client/index.d.ts → client.d.ts} +1 -2
- package/dist/client.js +22 -0
- package/dist/index.cjs +782 -461
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +54 -6
- package/dist/index.js +787 -466
- package/dist/index.js.map +1 -1
- package/dist/virtual-modules/background-entrypoint.js +129 -0
- package/dist/virtual-modules/background-entrypoint.js.map +1 -0
- package/dist/virtual-modules/content-script-entrypoint.js +28 -0
- package/dist/virtual-modules/content-script-entrypoint.js.map +1 -0
- package/dist/virtual-modules/reload-html.js +58 -0
- package/dist/virtual-modules/reload-html.js.map +1 -0
- package/package.json +14 -12
- package/dist/cli/index.cjs +0 -1549
- package/dist/cli/index.cjs.map +0 -1
- package/dist/client/index.cjs +0 -51
- package/dist/client/index.cjs.map +0 -1
- package/dist/client/index.js +0 -22
- package/dist/client/index.js.map +0 -1
- package/templates/template-vars.d.ts +0 -11
- package/templates/virtual-background.ts +0 -13
- package/templates/virtual-content-script.ts +0 -9
package/dist/index.d.ts
CHANGED
|
@@ -26,12 +26,58 @@ interface InlineConfig {
|
|
|
26
26
|
interface WxtInlineViteConfig extends Omit<vite.InlineConfig, 'root' | 'configFile' | 'mode' | 'build'> {
|
|
27
27
|
build?: Omit<vite.BuildOptions, 'outDir'>;
|
|
28
28
|
}
|
|
29
|
-
|
|
29
|
+
interface BuildOutput {
|
|
30
|
+
manifest: Manifest.WebExtensionManifest;
|
|
31
|
+
publicAssets: vite.Rollup.OutputAsset[];
|
|
32
|
+
steps: BuildStepOutput[];
|
|
33
|
+
}
|
|
34
|
+
interface BuildStepOutput {
|
|
35
|
+
entrypoints: EntrypointGroup;
|
|
36
|
+
chunks: (vite.Rollup.OutputChunk | vite.Rollup.OutputAsset)[];
|
|
37
|
+
}
|
|
30
38
|
interface WxtDevServer extends vite.ViteDevServer {
|
|
31
|
-
|
|
39
|
+
/**
|
|
40
|
+
* Ex: `3000`
|
|
41
|
+
*/
|
|
32
42
|
port: number;
|
|
43
|
+
/**
|
|
44
|
+
* Ex: `"localhost"`
|
|
45
|
+
*/
|
|
33
46
|
hostname: string;
|
|
47
|
+
/**
|
|
48
|
+
* Ex: `"http://localhost:3000"`
|
|
49
|
+
*/
|
|
34
50
|
origin: string;
|
|
51
|
+
/**
|
|
52
|
+
* Stores the current build output of the server.
|
|
53
|
+
*/
|
|
54
|
+
currentOutput: BuildOutput;
|
|
55
|
+
/**
|
|
56
|
+
* Start the server on the first open port.
|
|
57
|
+
*/
|
|
58
|
+
start(): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* Tell the extension to reload by running `browser.runtime.reload`.
|
|
61
|
+
*/
|
|
62
|
+
reloadExtension: () => void;
|
|
63
|
+
/**
|
|
64
|
+
* Tell an extension page to reload.
|
|
65
|
+
*
|
|
66
|
+
* The path is the bundle path, not the input paths, so if the input paths is
|
|
67
|
+
* "src/options/index.html", you would pass "options.html" because that's where it is written to
|
|
68
|
+
* in the dist directory, and where it's available at in the actual extension.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* server.reloadPage("popup.html")
|
|
72
|
+
* server.reloadPage("sandbox.html")
|
|
73
|
+
*/
|
|
74
|
+
reloadPage: (path: string) => void;
|
|
75
|
+
/**
|
|
76
|
+
* Tell the extension to restart a content script.
|
|
77
|
+
*
|
|
78
|
+
* @param contentScript The manifest definition for a content script
|
|
79
|
+
*/
|
|
80
|
+
reloadContentScript: (contentScript: Manifest.ContentScript) => void;
|
|
35
81
|
}
|
|
36
82
|
type TargetBrowser = 'chrome' | 'firefox' | 'safari' | 'edge' | 'opera';
|
|
37
83
|
type TargetManifestVersion = 2 | 3;
|
|
@@ -74,7 +120,7 @@ interface BaseEntrypoint {
|
|
|
74
120
|
outputDir: string;
|
|
75
121
|
}
|
|
76
122
|
interface GenericEntrypoint extends BaseEntrypoint {
|
|
77
|
-
type: 'sandbox' | 'bookmarks' | 'history' | 'newtab' | 'sidepanel' | 'devtools' | 'unlisted-page' | 'unlisted-
|
|
123
|
+
type: 'sandbox' | 'bookmarks' | 'history' | 'newtab' | 'sidepanel' | 'devtools' | 'unlisted-page' | 'unlisted-script';
|
|
78
124
|
}
|
|
79
125
|
interface BackgroundEntrypoint extends BaseEntrypoint {
|
|
80
126
|
type: 'background';
|
|
@@ -114,7 +160,7 @@ interface ContentScriptDefinition {
|
|
|
114
160
|
matchAboutBlank?: boolean;
|
|
115
161
|
matchOriginAsFallback?: boolean;
|
|
116
162
|
world?: 'ISOLATED' | 'MAIN';
|
|
117
|
-
main(
|
|
163
|
+
main(): void | Promise<void>;
|
|
118
164
|
}
|
|
119
165
|
interface BackgroundScriptDefintition {
|
|
120
166
|
type?: 'module';
|
|
@@ -184,7 +230,9 @@ interface ExtensionRunnerConfig {
|
|
|
184
230
|
startUrls?: string[];
|
|
185
231
|
}
|
|
186
232
|
|
|
187
|
-
|
|
233
|
+
type EntrypointGroup = Entrypoint | Entrypoint[];
|
|
234
|
+
|
|
235
|
+
var version = "0.1.0";
|
|
188
236
|
|
|
189
237
|
declare function defineConfig(config: UserConfig): UserConfig;
|
|
190
238
|
|
|
@@ -196,4 +244,4 @@ declare function defineRunnerConfig(config: ExtensionRunnerConfig): ExtensionRun
|
|
|
196
244
|
declare function build(config: InlineConfig): Promise<BuildOutput>;
|
|
197
245
|
declare function createServer(config?: InlineConfig): Promise<WxtDevServer>;
|
|
198
246
|
|
|
199
|
-
export { BackgroundEntrypoint, BackgroundScriptDefintition, BaseEntrypoint, BuildOutput, ContentScriptDefinition, ContentScriptEntrypoint, Entrypoint, ExtensionRunnerConfig, GenericEntrypoint, InlineConfig, Logger, OnContentScriptStopped, OptionsEntrypoint, PopupEntrypoint, TargetBrowser, TargetManifestVersion, UserConfig, UserManifest, WxtDevServer, WxtInlineViteConfig, build, createServer, defineConfig, defineRunnerConfig, version };
|
|
247
|
+
export { BackgroundEntrypoint, BackgroundScriptDefintition, BaseEntrypoint, BuildOutput, BuildStepOutput, ContentScriptDefinition, ContentScriptEntrypoint, Entrypoint, ExtensionRunnerConfig, GenericEntrypoint, InlineConfig, Logger, OnContentScriptStopped, OptionsEntrypoint, PopupEntrypoint, TargetBrowser, TargetManifestVersion, UserConfig, UserManifest, WxtDevServer, WxtInlineViteConfig, build, createServer, defineConfig, defineRunnerConfig, version };
|