wasm-image-optimization 1.2.19 → 1.2.21
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/dist/next/index.js +1 -10
- package/dist/next/index.js.map +1 -1
- package/package.json +2 -2
package/dist/next/index.js
CHANGED
|
@@ -1,16 +1,7 @@
|
|
|
1
|
-
import { promises as fs } from "fs";
|
|
2
1
|
import LibImage from "../cjs/libImage.js";
|
|
3
2
|
import { _optimizeImage, _optimizeImageExt } from "../lib/optimizeImage.js";
|
|
4
|
-
const url = new URL("../esm/libImage.wasm", import.meta.url)
|
|
5
|
-
.toString()
|
|
6
|
-
.replace("/_next/static", process.env.NODE_ENV === "development"
|
|
7
|
-
? ".next/server/static"
|
|
8
|
-
: ".next/server/chunks/static");
|
|
9
3
|
const getLibImage = async () => LibImage({
|
|
10
|
-
wasmBinary: await
|
|
11
|
-
.readFile(url)
|
|
12
|
-
.then((v) => v.buffer)
|
|
13
|
-
.catch(() => fetch("https://cdn.jsdelivr.net/npm/wasm-image-optimization@1.2.18/dist/esm/libImage.wasm").then((v) => v.arrayBuffer())),
|
|
4
|
+
wasmBinary: await fetch("https://cdn.jsdelivr.net/npm/wasm-image-optimization@1.2.18/dist/esm/libImage.wasm").then((v) => v.arrayBuffer()),
|
|
14
5
|
});
|
|
15
6
|
export const optimizeImage = async (params) => _optimizeImage({ ...params, libImage: getLibImage() });
|
|
16
7
|
export const optimizeImageExt = async (params) => _optimizeImageExt({ ...params, libImage: getLibImage() });
|
package/dist/next/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/next/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/next/index.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAG5E,MAAM,WAAW,GAAG,KAAK,IAAI,EAAE,CAC7B,QAAQ,CAAC;IACP,UAAU,EAAE,MAAM,KAAK,CACrB,oFAAoF,CACrF,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;CAC/B,CAAC,CAAC;AAEL,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,EAAE,MAAsB,EAAE,EAAE,CAC5D,cAAc,CAAC,EAAE,GAAG,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,EAAE,CAAC,CAAC;AAEzD,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,EAAE,MAAsB,EAAE,EAAE,CAC/D,iBAAiB,CAAC,EAAE,GAAG,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,EAAE,CAAC,CAAC;AAE5D,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,MAAc,EAAQ,EAAE,GAAE,CAAC,CAAC;AACrD,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC","sourcesContent":["import LibImage from \"../cjs/libImage.js\";\nimport { _optimizeImage, _optimizeImageExt } from \"../lib/optimizeImage.js\";\nimport type { OptimizeParams } from \"../types/index.js\";\n\nconst getLibImage = async () =>\n LibImage({\n wasmBinary: await fetch(\n \"https://cdn.jsdelivr.net/npm/wasm-image-optimization@1.2.18/dist/esm/libImage.wasm\"\n ).then((v) => v.arrayBuffer()),\n });\n\nexport const optimizeImage = async (params: OptimizeParams) =>\n _optimizeImage({ ...params, libImage: getLibImage() });\n\nexport const optimizeImageExt = async (params: OptimizeParams) =>\n _optimizeImageExt({ ...params, libImage: getLibImage() });\n\nexport const setLimit = (_limit: number): void => {};\nexport const close = () => {};\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wasm-image-optimization",
|
|
3
3
|
"description": "Optimize images with wasm on edge runtime",
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.21",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "yarn ts-node test",
|
|
7
7
|
"lint:fix": "eslint --fix src/ && prettier -w src",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"./next": {
|
|
18
18
|
"types": "./dist/next-web-worker/index.d.ts",
|
|
19
19
|
"browser": "./dist/next-web-worker/index.js",
|
|
20
|
-
"edge-light": "./dist/
|
|
20
|
+
"edge-light": "./dist/next/index.js",
|
|
21
21
|
"node": "./dist/next/index.js"
|
|
22
22
|
},
|
|
23
23
|
"./next-back": {
|