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/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
- type BuildOutput = (vite.Rollup.OutputChunk | vite.Rollup.OutputAsset)[];
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
- logger: Logger;
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-page' | 'unlisted-script';
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(onStopped: OnContentScriptStopped): void | Promise<void>;
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
- var version = "0.0.1";
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 };