@crxjs/vite-plugin 1.0.14 → 2.0.0-beta.2
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 +1 -1
- package/dist/index.cjs +1293 -3008
- package/dist/index.d.ts +31 -19
- package/dist/index.mjs +1291 -3007
- package/package.json +34 -36
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ConfigEnv, Plugin,
|
|
2
|
-
import { PluginContext, OutputBundle, OutputOptions } from 'rollup';
|
|
1
|
+
import { ConfigEnv, Plugin, PluginOption } from 'vite';
|
|
3
2
|
import { Options } from 'fast-glob';
|
|
3
|
+
import { PluginContext, OutputBundle } from 'rollup';
|
|
4
4
|
|
|
5
5
|
interface DeclarativeNetRequestResource {
|
|
6
6
|
id: string;
|
|
@@ -209,7 +209,7 @@ declare const defineManifest: (manifest: ManifestV3Export) => ManifestV3Export;
|
|
|
209
209
|
* const manifest = defineManifest({
|
|
210
210
|
* "web_accessible_resources": [
|
|
211
211
|
* defineDynamicResource({
|
|
212
|
-
* matches: ["https://
|
|
212
|
+
* matches: ["https://example.com/*", "file:///*.mp3", "..."]
|
|
213
213
|
* use_dynamic_url?: true
|
|
214
214
|
* })
|
|
215
215
|
* ]
|
|
@@ -218,13 +218,25 @@ declare const defineManifest: (manifest: ManifestV3Export) => ManifestV3Export;
|
|
|
218
218
|
*/
|
|
219
219
|
declare const defineDynamicResource: ({ matches, use_dynamic_url, }: Omit<WebAccessibleResourceByMatch, 'resources'>) => WebAccessibleResourceByMatch;
|
|
220
220
|
|
|
221
|
+
declare type CrxDevAssetId = {
|
|
222
|
+
id: string;
|
|
223
|
+
type: 'asset';
|
|
224
|
+
source?: string | Uint8Array;
|
|
225
|
+
};
|
|
226
|
+
declare type CrxDevScriptId = {
|
|
227
|
+
id: string;
|
|
228
|
+
type: 'module' | 'iife';
|
|
229
|
+
};
|
|
221
230
|
interface CrxPlugin extends Plugin {
|
|
222
|
-
/** Runs during
|
|
223
|
-
fileWriterStart?: (server: ViteDevServer) => Promise<void> | void;
|
|
224
|
-
/** Runs during the transform hook for the manifest. */
|
|
231
|
+
/** Runs during the transform hook for the manifest. Filenames use input filenames. */
|
|
225
232
|
transformCrxManifest?: (this: PluginContext, manifest: ManifestV3) => Promise<ManifestV3 | null | undefined> | ManifestV3 | null | undefined;
|
|
226
|
-
/** Runs during generateBundle, before manifest output. */
|
|
233
|
+
/** Runs during generateBundle, before manifest output. Filenames use output filenames. */
|
|
227
234
|
renderCrxManifest?: (this: PluginContext, manifest: ManifestV3, bundle: OutputBundle) => Promise<ManifestV3 | null | undefined> | ManifestV3 | null | undefined;
|
|
235
|
+
/**
|
|
236
|
+
* Runs in the file writer on content scripts during development. `script.id`
|
|
237
|
+
* is Vite URL format.
|
|
238
|
+
*/
|
|
239
|
+
renderCrxDevScript?: (code: string, script: CrxDevScriptId) => Promise<string | null | undefined> | string | null | undefined;
|
|
228
240
|
}
|
|
229
241
|
interface CrxOptions {
|
|
230
242
|
contentScripts?: {
|
|
@@ -235,21 +247,21 @@ interface CrxOptions {
|
|
|
235
247
|
fastGlobOptions?: Options;
|
|
236
248
|
}
|
|
237
249
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
}
|
|
245
|
-
/**
|
|
246
|
-
declare
|
|
250
|
+
/** Resolves when all existing files in scriptFiles are written. */
|
|
251
|
+
declare function allFilesReady(): Promise<void>;
|
|
252
|
+
|
|
253
|
+
declare type FileWriterId = {
|
|
254
|
+
type: CrxDevAssetId['type'] | CrxDevScriptId['type'] | 'loader';
|
|
255
|
+
id: string;
|
|
256
|
+
};
|
|
257
|
+
/** Resolves when file and dependencies are written. */
|
|
258
|
+
declare function fileReady(script: FileWriterId): Promise<void>;
|
|
247
259
|
|
|
248
|
-
declare const crx: (
|
|
260
|
+
declare const crx: (options: {
|
|
249
261
|
manifest: ManifestV3Export;
|
|
250
262
|
} & CrxOptions) => PluginOption[];
|
|
251
|
-
declare const chromeExtension: (
|
|
263
|
+
declare const chromeExtension: (options: {
|
|
252
264
|
manifest: ManifestV3Export;
|
|
253
265
|
} & CrxOptions) => PluginOption[];
|
|
254
266
|
|
|
255
|
-
export { CrxPlugin, ManifestV3Export, chromeExtension, crx, defineDynamicResource, defineManifest, filesReady
|
|
267
|
+
export { CrxPlugin, ManifestV3Export, allFilesReady, chromeExtension, crx, defineDynamicResource, defineManifest, fileReady as filesReady };
|