vite-plugin-singlefile-compression 1.1.1 → 1.1.3

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # vite plugin singlefile compression
2
2
 
3
- This plugin compresses all JavaScript, CSS, images, etc. resources using gzip and embeds them into `dist/index.html`, making it convenient to share as a single HTML file.
3
+ Compress all assets and embeds them into `dist/index.html`, making it convenient to share as a single HTML file.
4
4
 
5
5
  The recipient can open it directly in the browser without manually unzipping the file.
6
6
 
@@ -60,35 +60,35 @@ const router = createRouter({
60
60
 
61
61
  ```ts
62
62
  export interface Options {
63
- /**
64
- * https://github.com/terser/html-minifier-terser?tab=readme-ov-file#options-quick-reference
65
- * @default defaultHtmlMinifierTerserOptions
66
- */
67
- htmlMinifierTerser?: htmlMinifierOptions | boolean
68
-
69
- /**
70
- * Try inline html used assets, if inlined or not used in JS.
71
- * @default true
72
- */
73
- tryInlineHtmlAssets?: boolean
74
-
75
- /**
76
- * Remove inlined asset files.
77
- * @default true
78
- */
79
- removeInlinedAssetFiles?: boolean
80
-
81
- /**
82
- * Try inline html icon, if icon is in public dir.
83
- * @default true
84
- */
85
- tryInlineHtmlPublicIcon?: boolean
86
-
87
- /**
88
- * Remove inlined html icon files.
89
- * @default true
90
- */
91
- removeInlinedPublicIconFiles?: boolean
63
+ /**
64
+ * https://github.com/terser/html-minifier-terser?tab=readme-ov-file#options-quick-reference
65
+ * @default defaultHtmlMinifierTerserOptions
66
+ */
67
+ htmlMinifierTerser?: htmlMinifierOptions | boolean;
68
+
69
+ /**
70
+ * Try inline html used assets, if inlined or not used in JS.
71
+ * @default true
72
+ */
73
+ tryInlineHtmlAssets?: boolean;
74
+
75
+ /**
76
+ * Remove inlined asset files.
77
+ * @default true
78
+ */
79
+ removeInlinedAssetFiles?: boolean;
80
+
81
+ /**
82
+ * Try inline html icon, if icon is in public dir.
83
+ * @default true
84
+ */
85
+ tryInlineHtmlPublicIcon?: boolean;
86
+
87
+ /**
88
+ * Remove inlined html icon files.
89
+ * @default true
90
+ */
91
+ removeInlinedPublicIconFiles?: boolean;
92
92
  }
93
93
  ```
94
94
 
@@ -113,7 +113,23 @@ dist/index.html 53.60 kB
113
113
  ```
114
114
 
115
115
  ```html
116
- <!DOCTYPE html><meta charset=UTF-8><link rel=icon href=data:><meta name=viewport content="width=device-width,initial-scale=1"><title>Vite App</title><script type=module>fetch("data:application/gzip;base64,********").then(r=>r.blob()).then(b=>new Response(b.stream().pipeThrough(new DecompressionStream("gzip")),{headers:{"Content-Type":"text/javascript"}}).blob()).then(b=>import(b=URL.createObjectURL(b)).finally(()=>URL.revokeObjectURL(b)))</script><div id=app></div>
116
+ <!DOCTYPE html><meta charset="UTF-8" /><link rel="icon" href="data:" /><meta
117
+ name="viewport"
118
+ content="width=device-width,initial-scale=1"
119
+ /><title>Vite App</title>
120
+ <script type="module">
121
+ fetch("data:application/gzip;base64,********")
122
+ .then((r) => r.blob())
123
+ .then((b) =>
124
+ new Response(b.stream().pipeThrough(new DecompressionStream("gzip")), {
125
+ headers: { "Content-Type": "text/javascript" },
126
+ }).blob()
127
+ )
128
+ .then((b) =>
129
+ import((b = URL.createObjectURL(b))).finally(() => URL.revokeObjectURL(b))
130
+ );
131
+ </script>
132
+ <div id="app"></div>
117
133
  ```
118
134
 
119
135
  ## Clone
package/dist/template.js CHANGED
@@ -1 +1 @@
1
- fetch("data:application/gzip;base64,{<script>}").then(r=>r.blob()).then(b=>new Response(b.stream().pipeThrough(new DecompressionStream("gzip")),{headers:{"Content-Type":"text/javascript"}}).blob()).then(b=>import(b=URL.createObjectURL(b)).finally(()=>URL.revokeObjectURL(b)))
1
+ fetch("data:application/gzip;base64,{<script>}").then(r=>new Response(r.body.pipeThrough(new DecompressionStream("gzip")),{headers:{"Content-Type":"text/javascript"}}).blob()).then(b=>import(b=URL.createObjectURL(b)).finally(()=>URL.revokeObjectURL(b)))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-singlefile-compression",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
6
6
  "files": [
@@ -13,7 +13,7 @@
13
13
  "type": "module",
14
14
  "scripts": {
15
15
  "build": "rimraf dist && tsc && node build.js && cd test && npm run build",
16
- "prepublishOnly": "npm run build && npm config set registry https://registry.npmjs.org"
16
+ "prepublishOnly": "npm run build"
17
17
  },
18
18
  "author": "bddjr",
19
19
  "license": "MIT",
@@ -49,6 +49,6 @@
49
49
  "picocolors": "^1.1.1",
50
50
  "rimraf": "^6.0.1",
51
51
  "typescript": "^5.7.2",
52
- "vite": "^5.4.11"
52
+ "vite": "^6.0.6"
53
53
  }
54
54
  }