wxt 0.0.2 → 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 +3 -4
- package/dist/cli.cjs +585 -483
- package/dist/index.cjs +581 -483
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +17 -38
- package/dist/index.js +577 -478
- package/dist/index.js.map +1 -1
- package/dist/virtual-modules/background-entrypoint.js +52 -4
- package/dist/virtual-modules/background-entrypoint.js.map +1 -1
- package/package.json +3 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as vite from 'vite';
|
|
2
2
|
import { Manifest } from 'webextension-polyfill';
|
|
3
3
|
import { UnimportOptions } from 'unimport';
|
|
4
|
-
import { ResolvedConfig } from 'c12';
|
|
5
4
|
|
|
6
5
|
interface InlineConfig {
|
|
7
6
|
root?: string;
|
|
@@ -49,6 +48,14 @@ interface WxtDevServer extends vite.ViteDevServer {
|
|
|
49
48
|
* Ex: `"http://localhost:3000"`
|
|
50
49
|
*/
|
|
51
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>;
|
|
52
59
|
/**
|
|
53
60
|
* Tell the extension to reload by running `browser.runtime.reload`.
|
|
54
61
|
*/
|
|
@@ -65,6 +72,12 @@ interface WxtDevServer extends vite.ViteDevServer {
|
|
|
65
72
|
* server.reloadPage("sandbox.html")
|
|
66
73
|
*/
|
|
67
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;
|
|
68
81
|
}
|
|
69
82
|
type TargetBrowser = 'chrome' | 'firefox' | 'safari' | 'edge' | 'opera';
|
|
70
83
|
type TargetManifestVersion = 2 | 3;
|
|
@@ -107,7 +120,7 @@ interface BaseEntrypoint {
|
|
|
107
120
|
outputDir: string;
|
|
108
121
|
}
|
|
109
122
|
interface GenericEntrypoint extends BaseEntrypoint {
|
|
110
|
-
type: 'sandbox' | 'bookmarks' | 'history' | 'newtab' | 'sidepanel' | 'devtools' | 'unlisted-page' | 'unlisted-
|
|
123
|
+
type: 'sandbox' | 'bookmarks' | 'history' | 'newtab' | 'sidepanel' | 'devtools' | 'unlisted-page' | 'unlisted-script';
|
|
111
124
|
}
|
|
112
125
|
interface BackgroundEntrypoint extends BaseEntrypoint {
|
|
113
126
|
type: 'background';
|
|
@@ -217,39 +230,9 @@ interface ExtensionRunnerConfig {
|
|
|
217
230
|
startUrls?: string[];
|
|
218
231
|
}
|
|
219
232
|
|
|
220
|
-
interface InternalConfig {
|
|
221
|
-
root: string;
|
|
222
|
-
srcDir: string;
|
|
223
|
-
publicDir: string;
|
|
224
|
-
wxtDir: string;
|
|
225
|
-
typesDir: string;
|
|
226
|
-
entrypointsDir: string;
|
|
227
|
-
outBaseDir: string;
|
|
228
|
-
outDir: string;
|
|
229
|
-
storeIds: {
|
|
230
|
-
chrome?: string;
|
|
231
|
-
firefox?: string;
|
|
232
|
-
edge?: string;
|
|
233
|
-
};
|
|
234
|
-
mode: string;
|
|
235
|
-
command: 'build' | 'serve';
|
|
236
|
-
browser: TargetBrowser;
|
|
237
|
-
manifestVersion: TargetManifestVersion;
|
|
238
|
-
logger: Logger;
|
|
239
|
-
imports: Partial<UnimportOptions>;
|
|
240
|
-
vite: vite.InlineConfig;
|
|
241
|
-
manifest: UserManifest;
|
|
242
|
-
fsCache: FsCache;
|
|
243
|
-
server?: WxtDevServer;
|
|
244
|
-
runnerConfig: ResolvedConfig<ExtensionRunnerConfig>;
|
|
245
|
-
}
|
|
246
233
|
type EntrypointGroup = Entrypoint | Entrypoint[];
|
|
247
|
-
interface FsCache {
|
|
248
|
-
set(key: string, value: string): Promise<void>;
|
|
249
|
-
get(key: string): Promise<string | undefined>;
|
|
250
|
-
}
|
|
251
234
|
|
|
252
|
-
var version = "0.0
|
|
235
|
+
var version = "0.1.0";
|
|
253
236
|
|
|
254
237
|
declare function defineConfig(config: UserConfig): UserConfig;
|
|
255
238
|
|
|
@@ -260,9 +243,5 @@ declare function defineRunnerConfig(config: ExtensionRunnerConfig): ExtensionRun
|
|
|
260
243
|
*/
|
|
261
244
|
declare function build(config: InlineConfig): Promise<BuildOutput>;
|
|
262
245
|
declare function createServer(config?: InlineConfig): Promise<WxtDevServer>;
|
|
263
|
-
declare function rebuild(config: InternalConfig, entrypointGroups: EntrypointGroup[], existingOutput?: Omit<BuildOutput, 'manifest'>): Promise<{
|
|
264
|
-
output: BuildOutput;
|
|
265
|
-
manifest: Manifest.WebExtensionManifest;
|
|
266
|
-
}>;
|
|
267
246
|
|
|
268
|
-
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,
|
|
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 };
|