vite-plugin-singlefile-compression 2.0.7 → 2.0.9
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 +10 -4
- package/browser.min.js +1 -0
- package/dist/index.js +2 -1
- package/dist/options.d.ts +6 -0
- package/dist/options.js +1 -0
- package/dist/template/importmeta.js +1 -1
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -103,6 +103,12 @@ export interface Options {
|
|
|
103
103
|
* Custom compressor.
|
|
104
104
|
*/
|
|
105
105
|
compressor?: compressor
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Use import.meta polyfill.
|
|
109
|
+
* @default true
|
|
110
|
+
*/
|
|
111
|
+
useImportMetaPolyfill?: boolean
|
|
106
112
|
}
|
|
107
113
|
```
|
|
108
114
|
|
|
@@ -115,15 +121,15 @@ vite v7.3.1 building client environment for production...
|
|
|
115
121
|
✓ 46 modules transformed.
|
|
116
122
|
rendering chunks (1)...
|
|
117
123
|
|
|
118
|
-
vite-plugin-singlefile-compression 2.0.
|
|
124
|
+
vite-plugin-singlefile-compression 2.0.9 building...
|
|
119
125
|
|
|
120
126
|
file:///D:/code/js/vite-plugin-singlefile-compression/test/dist/index.html
|
|
121
|
-
107.
|
|
127
|
+
107.149 kB -> 48.323 kB
|
|
122
128
|
|
|
123
129
|
Finish.
|
|
124
130
|
|
|
125
|
-
dist/index.html 48.
|
|
126
|
-
✓ built in
|
|
131
|
+
dist/index.html 48.32 kB
|
|
132
|
+
✓ built in 826ms
|
|
127
133
|
```
|
|
128
134
|
|
|
129
135
|

|
package/browser.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
throw Error("This npm package does not support running in the web browser.")
|
package/dist/index.js
CHANGED
|
@@ -202,7 +202,8 @@ async function generateBundle(bundle, config, options) {
|
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
inlineHtmlAssets();
|
|
205
|
-
|
|
205
|
+
if (options.useImportMetaPolyfill)
|
|
206
|
+
newJSCode.push(template.importmeta(scriptName));
|
|
206
207
|
// 此 polyfill 仅在以下选项的值为 true 时需要。
|
|
207
208
|
// config.build.rollupOptions.output.inlineDynamicImports
|
|
208
209
|
if (code.includes("__VITE_PRELOAD__"))
|
package/dist/options.d.ts
CHANGED
|
@@ -47,6 +47,11 @@ export interface Options {
|
|
|
47
47
|
* Custom compressor.
|
|
48
48
|
*/
|
|
49
49
|
compressor?: compressor;
|
|
50
|
+
/**
|
|
51
|
+
* Use import.meta polyfill.
|
|
52
|
+
* @default true
|
|
53
|
+
*/
|
|
54
|
+
useImportMetaPolyfill?: boolean;
|
|
50
55
|
}
|
|
51
56
|
export declare const defaultHtmlMinifierTerserOptions: htmlMinifierOptions;
|
|
52
57
|
export interface innerOptions {
|
|
@@ -59,5 +64,6 @@ export interface innerOptions {
|
|
|
59
64
|
useBase128: boolean;
|
|
60
65
|
compressFormat: compressFormat;
|
|
61
66
|
compressor?: compressor;
|
|
67
|
+
useImportMetaPolyfill: boolean;
|
|
62
68
|
}
|
|
63
69
|
export declare function getInnerOptions(opt?: Options): innerOptions;
|
package/dist/options.js
CHANGED
|
@@ -20,5 +20,6 @@ export function getInnerOptions(opt) {
|
|
|
20
20
|
useBase128: opt.useBase128 ?? true,
|
|
21
21
|
compressFormat: opt.compressFormat || "deflate-raw",
|
|
22
22
|
compressor: typeof opt.compressor == 'function' ? opt.compressor : undefined,
|
|
23
|
+
useImportMetaPolyfill: opt.useImportMetaPolyfill ?? true,
|
|
23
24
|
};
|
|
24
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{import.meta.url=new URL("<path>",location).href;
|
|
1
|
+
{let e=import.meta,r=e.resolve,l=e.url=new URL("<path>",location).href;e.resolve=function(t){return/^\.{0,2}\//.test(t)?new URL(t,l).href:r.apply(this,arguments)}}
|
package/package.json
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-singlefile-compression",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.9",
|
|
4
4
|
"author": "bddjr",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"description": "",
|
|
6
|
+
"description": "Compress all assets and embeds them into dist/index.html, making it convenient to share as a single HTML file.",
|
|
7
7
|
"main": "./dist/index.js",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
|
-
"browser": "
|
|
9
|
+
"browser": "./browser.min.js",
|
|
10
10
|
"files": [
|
|
11
|
-
"dist"
|
|
11
|
+
"dist",
|
|
12
|
+
"./browser.min.js"
|
|
12
13
|
],
|
|
13
14
|
"type": "module",
|
|
14
15
|
"scripts": {
|