@crxjs/vite-plugin 2.0.0-beta.16 → 2.0.0-beta.17
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 +5 -5
- package/dist/index.mjs +21 -3
- package/package.json +7 -5
package/dist/index.d.ts
CHANGED
|
@@ -118,12 +118,12 @@ interface ManifestV3 {
|
|
|
118
118
|
} | undefined;
|
|
119
119
|
incognito?: string | undefined;
|
|
120
120
|
input_components?: {
|
|
121
|
-
name
|
|
122
|
-
type?: string | undefined;
|
|
121
|
+
name: string;
|
|
123
122
|
id?: string | undefined;
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
123
|
+
language?: string | string[] | undefined;
|
|
124
|
+
layouts?: string | string[] | undefined;
|
|
125
|
+
input_view?: string | undefined;
|
|
126
|
+
options_page?: string | undefined;
|
|
127
127
|
}[] | undefined;
|
|
128
128
|
key?: string | undefined;
|
|
129
129
|
minimum_chrome_version?: string | undefined;
|
package/dist/index.mjs
CHANGED
|
@@ -10,6 +10,7 @@ import { rollup } from 'rollup';
|
|
|
10
10
|
import * as lexer from 'es-module-lexer';
|
|
11
11
|
import { readFile as readFile$1 } from 'fs/promises';
|
|
12
12
|
import MagicString from 'magic-string';
|
|
13
|
+
import convertSourceMap from 'convert-source-map';
|
|
13
14
|
import { createLogger } from 'vite';
|
|
14
15
|
import { readFileSync, existsSync, promises } from 'fs';
|
|
15
16
|
import { createRequire } from 'module';
|
|
@@ -441,8 +442,25 @@ function prepScript(fileName, script) {
|
|
|
441
442
|
const transformResult = await server.transformRequest(viteUrl);
|
|
442
443
|
if (!transformResult)
|
|
443
444
|
throw new TypeError(`Unable to load "${script.id}" from server.`);
|
|
444
|
-
const {
|
|
445
|
-
|
|
445
|
+
const { deps = [], dynamicDeps = [], map: map2 } = transformResult;
|
|
446
|
+
let { code } = transformResult;
|
|
447
|
+
try {
|
|
448
|
+
if (map2 && server.config.build.sourcemap === "inline") {
|
|
449
|
+
code = code.replace(/\n*\/\/# sourceMappingURL=[^\n]+/g, "");
|
|
450
|
+
const sourceMap = convertSourceMap.fromObject(map2).toComment();
|
|
451
|
+
code += `
|
|
452
|
+
${sourceMap}
|
|
453
|
+
`;
|
|
454
|
+
}
|
|
455
|
+
} catch (error) {
|
|
456
|
+
console.warn("Failed to inline source map", error);
|
|
457
|
+
}
|
|
458
|
+
return {
|
|
459
|
+
target,
|
|
460
|
+
code,
|
|
461
|
+
deps: [...deps, ...dynamicDeps].flat(),
|
|
462
|
+
server
|
|
463
|
+
};
|
|
446
464
|
}),
|
|
447
465
|
// retry in case of dependency rebundle
|
|
448
466
|
retry({ count: 10, delay: 100 }),
|
|
@@ -1568,7 +1586,7 @@ const pluginManifest = () => {
|
|
|
1568
1586
|
}
|
|
1569
1587
|
}
|
|
1570
1588
|
const encoded = encodeManifest(manifest2);
|
|
1571
|
-
return encoded;
|
|
1589
|
+
return { code: encoded, map: null };
|
|
1572
1590
|
},
|
|
1573
1591
|
async generateBundle(options, bundle) {
|
|
1574
1592
|
const manifestName = this.getFileName(refId);
|
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.17",
|
|
4
4
|
"description": "Build Chrome Extensions with this Vite plugin.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rollup-plugin",
|
|
@@ -68,6 +68,7 @@
|
|
|
68
68
|
"acorn-walk": "^8.2.0",
|
|
69
69
|
"cheerio": "^1.0.0-rc.10",
|
|
70
70
|
"connect-injector": "^0.4.4",
|
|
71
|
+
"convert-source-map": "^1.7.0",
|
|
71
72
|
"debug": "^4.3.3",
|
|
72
73
|
"es-module-lexer": "^0.10.0",
|
|
73
74
|
"fast-glob": "^3.2.11",
|
|
@@ -89,6 +90,7 @@
|
|
|
89
90
|
"@sveltejs/vite-plugin-svelte": "1.1.0",
|
|
90
91
|
"@types/acorn": "4.0.6",
|
|
91
92
|
"@types/chrome": "0.0.209",
|
|
93
|
+
"@types/convert-source-map": "^2.0.0",
|
|
92
94
|
"@types/debug": "4.1.7",
|
|
93
95
|
"@types/fs-extra": "9.0.13",
|
|
94
96
|
"@types/jest-image-snapshot": "^5.1.0",
|
|
@@ -103,11 +105,11 @@
|
|
|
103
105
|
"chokidar": "^3.5.3",
|
|
104
106
|
"esbuild": "0.17.14",
|
|
105
107
|
"esbuild-runner": "2.2.2",
|
|
106
|
-
"eslint": "8.
|
|
108
|
+
"eslint": "8.39.0",
|
|
107
109
|
"eslint-plugin-react": "^7.29.4",
|
|
108
110
|
"jest-image-snapshot": "^5.2.0",
|
|
109
111
|
"npm-run-all": "^4.1.5",
|
|
110
|
-
"playwright-chromium": "1.
|
|
112
|
+
"playwright-chromium": "1.33.0",
|
|
111
113
|
"react": "17.0.2",
|
|
112
114
|
"react-dom": "17.0.2",
|
|
113
115
|
"rimraf": "3.0.2",
|
|
@@ -116,8 +118,8 @@
|
|
|
116
118
|
"svelte": "^3.48.0",
|
|
117
119
|
"typescript": "^4.6.4",
|
|
118
120
|
"vite": "^3.1.7",
|
|
119
|
-
"vite-plugin-inspect": "0.7.
|
|
121
|
+
"vite-plugin-inspect": "0.7.25",
|
|
120
122
|
"vitest": "0.28.5",
|
|
121
|
-
"vue": "3.2.
|
|
123
|
+
"vue": "3.2.47"
|
|
122
124
|
}
|
|
123
125
|
}
|