vite-plugin-singlefile-compression 2.0.6 → 2.0.8
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 +2 -2
- package/browser.min.js +1 -0
- package/dist/compress.js +8 -5
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -115,7 +115,7 @@ vite v7.3.1 building client environment for production...
|
|
|
115
115
|
✓ 46 modules transformed.
|
|
116
116
|
rendering chunks (1)...
|
|
117
117
|
|
|
118
|
-
vite-plugin-singlefile-compression 2.0.
|
|
118
|
+
vite-plugin-singlefile-compression 2.0.8 building...
|
|
119
119
|
|
|
120
120
|
file:///D:/code/js/vite-plugin-singlefile-compression/test/dist/index.html
|
|
121
121
|
107.124 kB -> 48.342 kB
|
|
@@ -123,7 +123,7 @@ vite-plugin-singlefile-compression 2.0.6 building...
|
|
|
123
123
|
Finish.
|
|
124
124
|
|
|
125
125
|
dist/index.html 48.34 kB
|
|
126
|
-
✓ built in
|
|
126
|
+
✓ built in 800ms
|
|
127
127
|
```
|
|
128
128
|
|
|
129
129
|

|
package/browser.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
throw Error("This npm package does not support running in the web browser.")
|
package/dist/compress.js
CHANGED
|
@@ -17,12 +17,15 @@ const compressors = {
|
|
|
17
17
|
zstd: zlib.zstdCompressSync,
|
|
18
18
|
};
|
|
19
19
|
function switchCompressor(format) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
if (
|
|
23
|
-
throw Error(`Could not get compressor:
|
|
24
|
-
|
|
20
|
+
if (!Object.prototype.hasOwnProperty.call(compressors, format)) {
|
|
21
|
+
const f = zlib[format + 'CompressSync'];
|
|
22
|
+
if (!f)
|
|
23
|
+
throw Error(`Could not get compressor: Unknown compress format '${format}', please set your compressor function.`);
|
|
24
|
+
return f;
|
|
25
25
|
}
|
|
26
|
+
const f = compressors[format];
|
|
27
|
+
if (!f)
|
|
28
|
+
throw Error(`Could not get compressor: Please upgrade node.js or set your compressor function.`);
|
|
26
29
|
return f;
|
|
27
30
|
}
|
|
28
31
|
export function compress(format, buf, useBase128, compressor) {
|
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.8",
|
|
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": {
|