wasm-image-optimization 2.0.2 → 2.0.4

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.
@@ -0,0 +1,3 @@
1
+ import type { Plugin } from "vite";
2
+ declare const _default: () => Plugin[];
3
+ export default _default;
@@ -0,0 +1,15 @@
1
+ export default () => {
2
+ return [
3
+ {
4
+ name: "wasm-image-optimization-serve",
5
+ apply: "serve",
6
+ config: () => {
7
+ return {
8
+ optimizeDeps: {
9
+ exclude: ["wasm-image-optimization"],
10
+ },
11
+ };
12
+ },
13
+ },
14
+ ];
15
+ };
package/dist/workers.js CHANGED
@@ -32,11 +32,9 @@ const createImageConverterWorker = (params) => {
32
32
  get(target, prop, receiver) {
33
33
  if (prop === "optimizeImage") {
34
34
  return async (options) => {
35
- const image = options.image instanceof Uint8Array
36
- ? options.image
37
- : typeof options.image === "string"
38
- ? new TextEncoder().encode(options.image)
39
- : new Uint8Array(options.image);
35
+ const image = typeof options.image === "string"
36
+ ? new TextEncoder().encode(options.image)
37
+ : new Uint8Array(options.image);
40
38
  return await target.execute("optimizeImage", {
41
39
  ...options,
42
40
  image,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wasm-image-optimization",
3
- "version": "2.0.2",
3
+ "version": "2.0.4",
4
4
  "description": "Optimize images with wasm on edge runtime",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -42,7 +42,11 @@
42
42
  "import": "./dist/single.js"
43
43
  },
44
44
  "./wasm-image-optimization.js": "./dist/wasm-image-optimization.js",
45
- "./wasm-image-optimization.wasm": "./dist/wasm-image-optimization.wasm"
45
+ "./wasm-image-optimization.wasm": "./dist/wasm-image-optimization.wasm",
46
+ "./vite-plugin": {
47
+ "types": "./dist/vite-plugin.d.ts",
48
+ "default": "./dist/vite-plugin.js"
49
+ }
46
50
  },
47
51
  "typesVersions": {
48
52
  "*": {
@@ -81,7 +85,7 @@
81
85
  "devDependencies": {
82
86
  "rolldown": "1.0.0-rc.7",
83
87
  "typescript": "^5.9.3",
84
- "vitest": "^4.0.18"
88
+ "vite": "7.3.1"
85
89
  },
86
90
  "dependencies": {
87
91
  "commander": "14.0.3",