vite-plugin-singlefile-compression 2.1.0 → 2.1.1

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
@@ -25,7 +25,7 @@ Then modify `vite.config.ts`, like [test/vite.config.ts](test/vite.config.ts)
25
25
  ],
26
26
  ```
27
27
 
28
- Then use hash history, like [test/src/router/index.ts](test/src/router/index.ts#L5)
28
+ Then use hash history, like [test/src/router/index.ts](test/src/router/index.ts)
29
29
 
30
30
  ```diff
31
31
  const router = createRouter({
@@ -126,20 +126,20 @@ Preview: https://bddjr.github.io/vite-plugin-singlefile-compression/
126
126
 
127
127
  ```
128
128
  vite v8.0.0 building client environment for production...
129
- 315 modules transformed.
129
+ 42 modules transformed.
130
+ rendering chunks (1)...
130
131
 
131
-
132
- vite-plugin-singlefile-compression 2.1.0 deflate-raw
132
+ vite-plugin-singlefile-compression 2.1.1 deflate-raw base128-ascii
133
133
 
134
134
  file:///D:/code/js/vite-plugin-singlefile-compression/test/dist/index.html
135
- 1085.847 kB -> 455.561 kB
135
+ 124.013 kB -> 50.35 kB
136
136
 
137
137
  Finish.
138
138
 
139
139
  computing gzip size...
140
- dist/index.html 455.56 kB │ gzip: 397.49 kB
140
+ dist/index.html 50.35 kB │ gzip: 43.87 kB
141
141
 
142
- ✓ built in 416ms
142
+ ✓ built in 296ms
143
143
  ```
144
144
 
145
145
  ![](effect.jpg)
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import zlib from "zlib";
9
9
  import svgToTinyDataUri from "mini-svg-data-uri";
10
10
  import mime from "mime";
11
11
  //#region _dist/getVersion.js
12
- var version = "2.1.0";
12
+ var version = "2.1.1";
13
13
  //#endregion
14
14
  //#region _dist/compress.js
15
15
  const compressors = {
@@ -175,7 +175,7 @@ function setConfig(opt, config, env) {
175
175
  }
176
176
  }
177
177
  async function generateBundle(bundle, config, options) {
178
- console.log(pc.reset("\n\n") + pc.cyan("vite-plugin-singlefile-compression " + version) + " " + (options.enableCompress ? pc.green(options.compressFormat) : pc.red("disable compress")));
178
+ console.log(pc.reset("\n\n") + pc.cyan("vite-plugin-singlefile-compression " + version) + " " + (options.enableCompress ? pc.green(options.compressFormat + " " + (options.useBase128 ? "base128-ascii" : "base64")) : pc.red("disable compress")));
179
179
  if (options.rename && options.rename != "index.html" && Object.prototype.hasOwnProperty.call(bundle, "index.html") && !Object.prototype.hasOwnProperty.call(bundle, options.rename)) {
180
180
  bundle[options.rename] = bundle["index.html"];
181
181
  bundle[options.rename].fileName = options.rename;
@@ -204,7 +204,7 @@ async function generateBundle(bundle, config, options) {
204
204
  if (cssSource) {
205
205
  oldSize += cssSource.length;
206
206
  for (const name of bundleAssetsNames) if (cssSource.includes(name.slice(assetsDir.length))) globalDoNotDelete.add(name);
207
- allCSS += cssSource.replace(/(\/\*[^*]*\*\/)?\s*$/, "");
207
+ allCSS += cssSource.replace(/\s*(\/\*[^*]*\*\/)?\s*$/, "");
208
208
  }
209
209
  if (options.enableCompress) element.remove();
210
210
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-singlefile-compression",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "author": "bddjr",
5
5
  "license": "MIT",
6
6
  "description": "Compress all assets and embeds them into dist/index.html, making it convenient to share as a single HTML file.",