@crxjs/vite-plugin 2.0.0-beta.2 → 2.0.0-beta.4
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.cjs +0 -1848
- package/dist/index.d.ts +2 -1
- package/dist/index.mjs +9 -8
- package/package.json +14 -14
package/dist/index.d.ts
CHANGED
|
@@ -202,7 +202,8 @@ declare const defineManifest: (manifest: ManifestV3Export) => ManifestV3Export;
|
|
|
202
202
|
*
|
|
203
203
|
* You don't need to define a match pattern for dynamic content script
|
|
204
204
|
* resources, but if you want to do so, you can use the helper function
|
|
205
|
-
* `defineDynamicResource` to define your web accessible resources in a
|
|
205
|
+
* `defineDynamicResource` to define your web accessible resources in a
|
|
206
|
+
* TypeScript file:
|
|
206
207
|
*
|
|
207
208
|
* ```typescript
|
|
208
209
|
* import { crx, defineManifest, defineDynamicResource }
|
package/dist/index.mjs
CHANGED
|
@@ -14,7 +14,6 @@ import { createLogger } from 'vite';
|
|
|
14
14
|
import { readFileSync, existsSync, promises } from 'fs';
|
|
15
15
|
import { createRequire } from 'module';
|
|
16
16
|
import fg from 'fast-glob';
|
|
17
|
-
import getPort, { portNumbers } from 'get-port';
|
|
18
17
|
import { load } from 'cheerio';
|
|
19
18
|
import jsesc from 'jsesc';
|
|
20
19
|
import colors from 'picocolors';
|
|
@@ -30,12 +29,15 @@ const pluginOptionsProvider = (options) => {
|
|
|
30
29
|
}
|
|
31
30
|
};
|
|
32
31
|
};
|
|
33
|
-
const getOptions = ({
|
|
32
|
+
const getOptions = async ({
|
|
33
|
+
plugins
|
|
34
|
+
}) => {
|
|
34
35
|
if (typeof plugins === "undefined") {
|
|
35
36
|
throw new Error("config.plugins is undefined");
|
|
36
37
|
}
|
|
38
|
+
const awaitedPlugins = await Promise.all(plugins);
|
|
37
39
|
let options;
|
|
38
|
-
for (const p of
|
|
40
|
+
for (const p of awaitedPlugins.flat()) {
|
|
39
41
|
if (isCrxPlugin(p)) {
|
|
40
42
|
if (p.name === pluginName$1) {
|
|
41
43
|
const plugin = p;
|
|
@@ -558,8 +560,8 @@ const pluginContentScripts = () => {
|
|
|
558
560
|
{
|
|
559
561
|
name: "crx:content-scripts",
|
|
560
562
|
apply: "serve",
|
|
561
|
-
config(config) {
|
|
562
|
-
const { contentScripts: contentScripts2 = {} } = getOptions(config);
|
|
563
|
+
async config(config) {
|
|
564
|
+
const { contentScripts: contentScripts2 = {} } = await getOptions(config);
|
|
563
565
|
hmrTimeout = contentScripts2.hmrTimeout ?? 5e3;
|
|
564
566
|
preambleCode = preambleCode ?? contentScripts2.preambleCode;
|
|
565
567
|
},
|
|
@@ -661,8 +663,8 @@ const pluginContentScriptsCss = () => {
|
|
|
661
663
|
return {
|
|
662
664
|
name: "crx:content-scripts-css",
|
|
663
665
|
enforce: "post",
|
|
664
|
-
config(config) {
|
|
665
|
-
const { contentScripts: contentScripts2 = {} } = getOptions(config);
|
|
666
|
+
async config(config) {
|
|
667
|
+
const { contentScripts: contentScripts2 = {} } = await getOptions(config);
|
|
666
668
|
injectCss = contentScripts2.injectCss ?? true;
|
|
667
669
|
},
|
|
668
670
|
renderCrxManifest(manifest) {
|
|
@@ -1061,7 +1063,6 @@ const pluginHMR = () => {
|
|
|
1061
1063
|
server.hmr = {};
|
|
1062
1064
|
server.hmr = server.hmr ?? {};
|
|
1063
1065
|
server.hmr.host = "localhost";
|
|
1064
|
-
server.hmr.port = server.hmr.port ?? await getPort({ port: portNumbers(5200, 5300) });
|
|
1065
1066
|
return { server, ...config2 };
|
|
1066
1067
|
},
|
|
1067
1068
|
configResolved(_config) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crxjs/vite-plugin",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.4",
|
|
4
4
|
"description": "Build Chrome Extensions with this Vite plugin.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rollup-plugin",
|
|
@@ -23,9 +23,10 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"author": "Jack and Amy Steam <jacksteamdev@gmail.com>",
|
|
26
|
+
"type": "module",
|
|
26
27
|
"exports": {
|
|
27
28
|
".": {
|
|
28
|
-
"require": "./
|
|
29
|
+
"require": "./index.cjs",
|
|
29
30
|
"import": "./dist/index.mjs",
|
|
30
31
|
"types": "./dist/index.d.ts"
|
|
31
32
|
},
|
|
@@ -71,21 +72,21 @@
|
|
|
71
72
|
"es-module-lexer": "^0.10.0",
|
|
72
73
|
"fast-glob": "^3.2.11",
|
|
73
74
|
"fs-extra": "^10.0.1",
|
|
74
|
-
"get-port": "^6.1.2",
|
|
75
75
|
"jsesc": "^3.0.2",
|
|
76
76
|
"magic-string": "^0.26.0",
|
|
77
77
|
"picocolors": "^1.0.0",
|
|
78
78
|
"react-refresh": "^0.13.0",
|
|
79
|
-
"rollup": "2.78.1"
|
|
79
|
+
"rollup": "2.78.1",
|
|
80
|
+
"rxjs": "7.5.7"
|
|
80
81
|
},
|
|
81
82
|
"devDependencies": {
|
|
82
83
|
"@extend-chrome/messages": "1.2.2",
|
|
83
84
|
"@extend-chrome/storage": "1.5.0",
|
|
84
|
-
"@rollup/plugin-alias": "
|
|
85
|
+
"@rollup/plugin-alias": "4.0.2",
|
|
85
86
|
"@rollup/plugin-commonjs": "21.1.0",
|
|
86
87
|
"@rollup/plugin-json": "^4.1.0",
|
|
87
88
|
"@rollup/plugin-node-resolve": "13.2.0",
|
|
88
|
-
"@sveltejs/vite-plugin-svelte": "1.0
|
|
89
|
+
"@sveltejs/vite-plugin-svelte": "1.1.0",
|
|
89
90
|
"@types/acorn": "4.0.6",
|
|
90
91
|
"@types/chrome": "0.0.198",
|
|
91
92
|
"@types/debug": "4.1.7",
|
|
@@ -93,16 +94,16 @@
|
|
|
93
94
|
"@types/jest-image-snapshot": "^5.1.0",
|
|
94
95
|
"@types/jsesc": "3.0.1",
|
|
95
96
|
"@types/node": "17.0.18",
|
|
96
|
-
"@types/react": "17.0.
|
|
97
|
-
"@types/react-dom": "17.0.
|
|
98
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
99
|
-
"@typescript-eslint/parser": "5.
|
|
97
|
+
"@types/react": "17.0.52",
|
|
98
|
+
"@types/react-dom": "17.0.18",
|
|
99
|
+
"@typescript-eslint/eslint-plugin": "5.41.0",
|
|
100
|
+
"@typescript-eslint/parser": "5.41.0",
|
|
100
101
|
"@vitejs/plugin-react": "^2.1.0",
|
|
101
|
-
"@vitejs/plugin-vue": "3.
|
|
102
|
+
"@vitejs/plugin-vue": "3.2.0",
|
|
102
103
|
"chokidar": "^3.5.3",
|
|
103
104
|
"esbuild": "0.15.12",
|
|
104
105
|
"esbuild-runner": "2.2.2",
|
|
105
|
-
"eslint": "8.
|
|
106
|
+
"eslint": "8.26.0",
|
|
106
107
|
"eslint-plugin-react": "^7.29.4",
|
|
107
108
|
"jest-image-snapshot": "^5.2.0",
|
|
108
109
|
"npm-run-all": "^4.1.5",
|
|
@@ -112,12 +113,11 @@
|
|
|
112
113
|
"rimraf": "3.0.2",
|
|
113
114
|
"rollup-plugin-dts": "^4.2.0",
|
|
114
115
|
"rollup-plugin-esbuild": "4.10.1",
|
|
115
|
-
"rxjs": "7.5.5",
|
|
116
116
|
"svelte": "^3.48.0",
|
|
117
117
|
"typescript": "^4.6.4",
|
|
118
118
|
"vite": "^3.1.7",
|
|
119
119
|
"vite-plugin-inspect": "0.7.5",
|
|
120
|
-
"vitest": "
|
|
120
|
+
"vitest": "0.24.3",
|
|
121
121
|
"vue": "3.2.41"
|
|
122
122
|
}
|
|
123
123
|
}
|