From 7f87c9de959ed841edb04f0bfa5791fcd6ec2b36 Mon Sep 17 00:00:00 2001 From: Kiril Vatev Date: Sun, 5 Nov 2023 00:44:56 -0400 Subject: [PATCH 01/19] using the new tarball releases to fetch both js and wasm files --- .gitignore | 1 + package.json | 4 +++- scripts/install.js | 38 +++++++++++++++++++++++++++----------- 3 files changed, 31 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index 107d7e8..dc0e3a3 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,4 @@ temp/ # not source code libheif/ +libheif-wasm/ diff --git a/package.json b/package.json index cbb5bf6..7294163 100644 --- a/package.json +++ b/package.json @@ -28,11 +28,13 @@ "chai": "^4.2.0", "eslint": "^5.16.0", "fs-extra": "^8.1.0", + "gunzip-maybe": "^1.4.2", "mocha": "^7.0.0", "node-fetch": "^2.6.0", "pixelmatch": "^5.2.1", "pngjs": "^3.4.0", - "rootrequire": "^1.0.0" + "rootrequire": "^1.0.0", + "tar-stream": "^3.1.6" }, "engines": { "node": ">=8.0.0" diff --git a/scripts/install.js b/scripts/install.js index f7773a7..4142dbc 100644 --- a/scripts/install.js +++ b/scripts/install.js @@ -3,30 +3,46 @@ const path = require('path'); const fs = require('fs-extra'); const fetch = require('node-fetch'); const root = require('rootrequire'); +const tar = require('tar-stream'); +const gunzip = require('gunzip-maybe'); -const libheifDir = path.resolve(root, 'libheif'); -const libheif = path.resolve(libheifDir, 'libheif.js'); -const libheifLicense = path.resolve(libheifDir, 'LICENSE'); - -const version = 'v1.15.1'; +const version = 'v1.17.1'; const base = `https://github.com/catdad-experiments/libheif-emscripten/releases/download/${version}`; -const lib = `${base}/libheif.js`; -const license = `${base}/LICENSE`; +const tarball = `${base}/libheif.tar.gz`; -const response = async url => { +const getStream = async url => { const res = await fetch(url); if (!res.ok) { throw new Error(`failed response: ${res.status} ${res.statusText}`); } - return await res.buffer(); + return res.body; +}; + +const autoReadStream = async stream => { + let result = Buffer.from(''); + + for await (const data of stream) { + result = Buffer.concat([result, data]); + } + + return result; }; (async () => { - await fs.outputFile(libheif, await response(lib)); - await fs.outputFile(libheifLicense, await response(license)); + for await (const entry of (await getStream(tarball)).pipe(gunzip()).pipe(tar.extract())) { + const basedir = entry.header.name.split('/')[0]; + + if (entry.header.type === 'file' && ['libheif', 'libheif-wasm'].includes(basedir)) { + const outfile = path.resolve(root, entry.header.name); + console.log(` writing "${outfile}"`); + await fs.outputFile(outfile, await autoReadStream(entry)); + } else { + await autoReadStream(entry); + } + } })().then(() => { console.log(`fetched libheif ${version}`); }).catch(err => { From 554a1dfaa568dd8711eec7f4bad69fab33f3a46b Mon Sep 17 00:00:00 2001 From: Kiril Vatev Date: Sun, 5 Nov 2023 00:46:41 -0400 Subject: [PATCH 02/19] adding an index and wasm files to initialize the module this maintains API compatibility with the versions that used to be compiled with the older emscripten --- index.js | 1 + package.json | 4 ++-- test/libheif.test.js | 33 +++++++++++++++++++++++++++++---- wasm.js | 30 ++++++++++++++++++++++++++++++ 4 files changed, 62 insertions(+), 6 deletions(-) create mode 100644 index.js create mode 100644 wasm.js diff --git a/index.js b/index.js new file mode 100644 index 0000000..3381a4c --- /dev/null +++ b/index.js @@ -0,0 +1 @@ +module.exports = require('./libheif/libheif.js')(); diff --git a/package.json b/package.json index 7294163..c1ff461 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "libheif-js", - "version": "1.15.1", + "version": "1.17.1", "description": "Emscripten distribution of libheif for Node.JS and the browser", - "main": "libheif/libheif.js", + "main": "index.js", "scripts": { "pretest": "npm run -s images", "test": "mocha test/**/*.test.js", diff --git a/test/libheif.test.js b/test/libheif.test.js index 18c4b45..d0c1082 100644 --- a/test/libheif.test.js +++ b/test/libheif.test.js @@ -8,9 +8,34 @@ const { PNG } = require('pngjs'); const pixelmatch = require('pixelmatch'); const pkg = require('../package.json'); -const libheif = require('../'); -describe('libheif', () => { +describe('libheif (JS)', () => { + const moduleFile = '../'; + + runTests(require(moduleFile)); + + it('resolves to index file', () => { + const expected = path.resolve(root, 'index.js'); + const actual = require.resolve(moduleFile); + + expect(actual).to.equal(expected); + }); +}); + +describe('libheif (WASM)', () => { + const moduleFile = '../wasm'; + + runTests(require(moduleFile)); + + it('resolves to wasm file', () => { + const expected = path.resolve(root, 'wasm.js'); + const actual = require.resolve(moduleFile); + + expect(actual).to.equal(expected); + }); +}); + +function runTests(libheif) { const readControl = async name => { const buffer = await fs.readFile(path.resolve(root, `temp/${name}`)); const { data, width, height } = PNG.sync.read(buffer); @@ -30,7 +55,7 @@ describe('libheif', () => { it('is the correct version', () => { expect(libheif).to.have.property('heif_get_version') .and.to.be.a('function'); - expect(libheif.heif_get_version()).to.equal('1.15.1') + expect(libheif.heif_get_version()).to.equal('1.17.1') .and.to.equal(pkg.version); }); @@ -85,4 +110,4 @@ describe('libheif', () => { compare(control.data, arrayBuffer, control.width, control.height); }); }); -}); +} diff --git a/wasm.js b/wasm.js new file mode 100644 index 0000000..c67694c --- /dev/null +++ b/wasm.js @@ -0,0 +1,30 @@ +// I technically don't have to do this, but I am keeping it around +// for demonstration purposes +const fs = require('fs'); +const wasmBinary = fs.readFileSync('./libheif-wasm/libheif.wasm'); + +module.exports = require('./libheif-wasm/libheif.js')({ wasmBinary }); + +// NOTE: for webpack, you need to do something like: +/* + +import libheif from './libheif-wasm/libheif.js' +import wasmBinary from './libheif-wasm/libheif.wasm' + +export default libheif({ wasmBinary }); + +*/ + +// then add this to rules: +/* + +module.exports = { + module: { + rules: [{ + test: /\.wasm$/, + type: "asset/inline", + }] + }, +}; + +*/ From d6b11a563f58cd3b693491b392408330d81bf42b Mon Sep 17 00:00:00 2001 From: Kiril Vatev Date: Sun, 5 Nov 2023 00:51:09 -0400 Subject: [PATCH 03/19] excluding node 8 and 10 8 can't run the new install script, 10 seems to not be able to run the wasm package --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c65ff82..7bcda01 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,6 +15,9 @@ jobs: strategy: matrix: node-version: [8, 10, 12, 14, 16, 18] + exclude: + - node-version: 9 + - node-version: 10 steps: - uses: actions/checkout@v2 - name: Use Node.js ${{ matrix.node-version }} From 0e29984a2967012e9e10bfa5ef1d23d6c1d125f2 Mon Sep 17 00:00:00 2001 From: Kiril Vatev Date: Sun, 5 Nov 2023 00:52:17 -0400 Subject: [PATCH 04/19] oops... correctly excluding node 8 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7bcda01..c93d936 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: matrix: node-version: [8, 10, 12, 14, 16, 18] exclude: - - node-version: 9 + - node-version: 8 - node-version: 10 steps: - uses: actions/checkout@v2 From 1bb99a4b9762e90d98edcf4d8476f101d1f9096c Mon Sep 17 00:00:00 2001 From: Kiril Vatev Date: Sun, 5 Nov 2023 00:54:31 -0400 Subject: [PATCH 05/19] adding node 20 to the test matrix --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c93d936..f38eb2a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [8, 10, 12, 14, 16, 18] + node-version: [8, 10, 12, 14, 16, 18, 20] exclude: - node-version: 8 - node-version: 10 From 3330bcf5a004733bd9fd7c897dde19a77d1f353d Mon Sep 17 00:00:00 2001 From: Kiril Vatev Date: Sun, 5 Nov 2023 00:57:36 -0400 Subject: [PATCH 06/19] pack can just be a dry run --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f38eb2a..b4dd095 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,8 +28,8 @@ jobs: - run: npm run fetch - run: npm test - run: npm run lint - - name: inspect tarball - run: npm pack + - name: Inspect tarball + run: npm pack --dry-run publish: runs-on: ubuntu-latest if: startsWith(github.ref, 'refs/tags/') && github.event_name != 'pull_request' From 340ae272bda34270f889e1ba04ab8879256b9212 Mon Sep 17 00:00:00 2001 From: Kiril Vatev Date: Sun, 5 Nov 2023 00:57:54 -0400 Subject: [PATCH 07/19] adding the rest of the lib files to the files entry so they get packed --- package.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index c1ff461..c3e362b 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,10 @@ "url": "git+https://github.com/catdad-experiments/libheif-js.git" }, "files": [ - "libheif" + "index.js", + "wasm.js", + "libheif", + "libheif-wasm" ], "author": "Kiril Vatev ", "license": "LGPL-3.0", From aa6b023e2ae8983663be42f50b8d6aef0061facd Mon Sep 17 00:00:00 2001 From: Kiril Vatev Date: Sun, 5 Nov 2023 01:00:38 -0400 Subject: [PATCH 08/19] using latest actions to avoid warnings --- .github/workflows/ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b4dd095..ddb6192 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,9 +19,9 @@ jobs: - node-version: 8 - node-version: 10 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - run: npm install @@ -35,9 +35,9 @@ jobs: if: startsWith(github.ref, 'refs/tags/') && github.event_name != 'pull_request' needs: test steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Use Node.js 14 - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: node-version: 14 registry-url: https://registry.npmjs.org/ @@ -49,7 +49,7 @@ jobs: NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} - name: Output logs if: ${{ always() }} - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: npm-logs path: /home/runner/.npm/_logs/** From 5517efaf073b52faabc83aa09d37a4a7748acdb2 Mon Sep 17 00:00:00 2001 From: Kiril Vatev Date: Mon, 6 Nov 2023 01:03:38 -0500 Subject: [PATCH 09/19] building libheif bundles for use as cjs/browser and esm, with the wasm binary built in --- package.json | 2 ++ scripts/bundle.js | 4 ++++ scripts/install.js | 43 +++++++++++++++++++++++++++++++++++++++++++ test/libheif.test.js | 32 ++++++++++++++++++++++++++++++++ wasm-bundle.js | 1 + 5 files changed, 82 insertions(+) create mode 100644 scripts/bundle.js create mode 100644 wasm-bundle.js diff --git a/package.json b/package.json index c3e362b..1e558fe 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "files": [ "index.js", "wasm.js", + "wasm-bundle.js", "libheif", "libheif-wasm" ], @@ -29,6 +30,7 @@ "homepage": "https://github.com/catdad-experiments/libheif-js#readme", "devDependencies": { "chai": "^4.2.0", + "esbuild": "^0.19.5", "eslint": "^5.16.0", "fs-extra": "^8.1.0", "gunzip-maybe": "^1.4.2", diff --git a/scripts/bundle.js b/scripts/bundle.js new file mode 100644 index 0000000..cc56c21 --- /dev/null +++ b/scripts/bundle.js @@ -0,0 +1,4 @@ +import libheif from '../libheif-wasm/libheif.js'; +import wasmBinary from '../libheif-wasm/libheif.wasm'; + +export default (opts = {}) => libheif({ ...opts, wasmBinary }); diff --git a/scripts/install.js b/scripts/install.js index 4142dbc..408e9cb 100644 --- a/scripts/install.js +++ b/scripts/install.js @@ -6,6 +6,8 @@ const root = require('rootrequire'); const tar = require('tar-stream'); const gunzip = require('gunzip-maybe'); +const esbuild = require('esbuild'); + const version = 'v1.17.1'; const base = `https://github.com/catdad-experiments/libheif-emscripten/releases/download/${version}`; @@ -32,6 +34,9 @@ const autoReadStream = async stream => { }; (async () => { + await fs.remove(path.resolve(root, 'libheif')); + await fs.remove(path.resolve(root, 'libheif-wasm')); + for await (const entry of (await getStream(tarball)).pipe(gunzip()).pipe(tar.extract())) { const basedir = entry.header.name.split('/')[0]; @@ -43,6 +48,44 @@ const autoReadStream = async stream => { await autoReadStream(entry); } } + + const buildOptions = { + entryPoints: [path.resolve(root, 'scripts/bundle.js')], + bundle: true, + minify: true, + external: ['fs', 'path', 'require'], + loader: { + '.wasm': 'binary' + }, + platform: 'neutral' + }; + + await esbuild.build({ + ...buildOptions, + outfile: path.resolve(root, 'libheif-wasm/libheif-bundle.js'), + format: 'iife', + globalName: 'libheif', + footer: { + // hack to support a single bundle as a node cjs module + // and a browser + ``` +* Use the wasm bundle, exposing a `libheif` global: + ```html + + ``` +* Use the ES Module version, which now works in all major browsers and you should try it: + ```html + + ``` + ## Related This module contains the low-level `libheif` implementation. For more user-friendly functionality, check out these projects: From 05a818d70aa67b63e5f75599b87b04e1f317ed86 Mon Sep 17 00:00:00 2001 From: Kiril Vatev Date: Mon, 6 Nov 2023 01:45:59 -0500 Subject: [PATCH 12/19] clarifying some bundler info, adding jsdelivr badge --- README.md | 5 ++++- package.json | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d66c037..58a4180 100644 --- a/README.md +++ b/README.md @@ -5,12 +5,15 @@ [![github actions test][github-actions-test.svg]][github-actions-test.link] [![npm-downloads][npm-downloads.svg]][npm.link] [![npm-version][npm-version.svg]][npm.link] +[![jsdelivr][jsdelivr.svg]][jsdelivr.link] [github-actions-test.link]: https://github.com/catdad-experiments/libheif-js/actions?query=workflow%3ACI [github-actions-test.svg]: https://github.com/catdad-experiments/libheif-js/actions/workflows/ci.yml/badge.svg [npm-downloads.svg]: https://img.shields.io/npm/dm/libheif-js.svg [npm.link]: https://www.npmjs.com/package/libheif-js [npm-version.svg]: https://img.shields.io/npm/v/libheif-js.svg +[jsdelivr.svg]: https://img.shields.io/jsdelivr/npm/hm/libheif-js +[jsdelivr.link]: https://www.jsdelivr.com/package/npm/libheif-js This module will respect the major and minor versions of the included `libheif`, with the patch version representing changes in this module itself. For the exact version of `libheif`, please see the [install script](scripts/install.js). @@ -24,7 +27,7 @@ npm install libheif-js Starting with version 1.17, there are multiple variants of `libheif` that you can use: -* The default is still the classic pure-javascript implementation (for backwards compatibility, of course). +* The default is still the classic pure-javascript implementation (for backwards compatibility, of course). You can still bundle this into your project with your bundler of choice. ```js const libheif = require('libheif-js'); ``` diff --git a/package.json b/package.json index 73dd01a..49b1908 100644 --- a/package.json +++ b/package.json @@ -52,6 +52,7 @@ "decoder", "node", "browser", - "emscripten" + "emscripten", + "wasm" ] } From ff6f927aab2b26ff9f86548f0e6aebfccb2065e7 Mon Sep 17 00:00:00 2001 From: Kiril Vatev Date: Mon, 6 Nov 2023 01:51:17 -0500 Subject: [PATCH 13/19] I like a nice pink badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 58a4180..c7e5576 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ [npm-downloads.svg]: https://img.shields.io/npm/dm/libheif-js.svg [npm.link]: https://www.npmjs.com/package/libheif-js [npm-version.svg]: https://img.shields.io/npm/v/libheif-js.svg -[jsdelivr.svg]: https://img.shields.io/jsdelivr/npm/hm/libheif-js +[jsdelivr.svg]: https://img.shields.io/jsdelivr/npm/hm/libheif-js?color=bd33a4 [jsdelivr.link]: https://www.jsdelivr.com/package/npm/libheif-js This module will respect the major and minor versions of the included `libheif`, with the patch version representing changes in this module itself. For the exact version of `libheif`, please see the [install script](scripts/install.js). From 0346cc46246f2cb40676829ed8b4682ff4b9c517 Mon Sep 17 00:00:00 2001 From: Kiril Vatev Date: Mon, 6 Nov 2023 10:24:08 -0500 Subject: [PATCH 14/19] =?UTF-8?q?=F0=9F=A4=B7=E2=80=8D=E2=99=80=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c7e5576..6893224 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,9 @@ > An Emscripten build of [`libheif`](https://github.com/strukturag/libheif) distributed as an npm module for Node.JS and the browser. [![github actions test][github-actions-test.svg]][github-actions-test.link] +[![jsdelivr][jsdelivr.svg]][jsdelivr.link] [![npm-downloads][npm-downloads.svg]][npm.link] [![npm-version][npm-version.svg]][npm.link] -[![jsdelivr][jsdelivr.svg]][jsdelivr.link] [github-actions-test.link]: https://github.com/catdad-experiments/libheif-js/actions?query=workflow%3ACI [github-actions-test.svg]: https://github.com/catdad-experiments/libheif-js/actions/workflows/ci.yml/badge.svg From ba1f2053df522a1c18a56c50a09dfc932acf1d80 Mon Sep 17 00:00:00 2001 From: Kiril Vatev Date: Mon, 6 Nov 2023 10:59:21 -0500 Subject: [PATCH 15/19] adding code examples --- README.md | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/README.md b/README.md index 6893224..97a3ef8 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,67 @@ _Note: in the examples below, make sure to set the latest version when you use i ``` +In all cases, you can use this sample code to decode an image: + +```js +const file = fs.readFileSync('./temp/0002.heic'); + +const decoder = new libheif.HeifDecoder(); +const data = decoder.decode(file); +// data in an array holding all images inside the heic file + +const image = data[0]; +const width = image.get_width(); +const height = image.get_height(); +``` + +In NodeJS, you might use this decoded data with other libraries, such as `pngjs`: + +```js +const { PNG } = require('pngjs'); + +const arrayBuffer = await new Promise((resolve, reject) => { + image.display({ data: new Uint8ClampedArray(width*height*4), width, height }, (displayData) => { + if (!displayData) { + return reject(new Error('HEIF processing error')); + } + + resolve(displayData.data.buffer); + }); +}); + +const imageData = { width, height, data: arrayBuffer }; + +const png = new PNG({ width: imageData.width, height: imageData.height }); +png.data = Buffer.from(imageData.data); + +const pngBuffer = PNG.sync.write(png); +``` + +In the browser, you might use this decoded data with `canvas` to display or convert the image: + +```js +const canvas = document.createElement('canvas'); + +canvas.width = width; +canvas.height = height; + +const context = canvas.getContext('2d'); +const imageData = context.createImageData(width, height); + +await new Promise((resolve, reject) => { + image.display(imageData, (displayData) => { + if (!displayData) { + return reject(new Error('HEIF processing error')); + } + + resolve(); + }); +}); + +context.putImageData(imageData, 0, 0); +``` + ## Related This module contains the low-level `libheif` implementation. For more user-friendly functionality, check out these projects: From f1c69d14095849af991594deda0b3528657fdbea Mon Sep 17 00:00:00 2001 From: Kiril Vatev Date: Mon, 6 Nov 2023 23:12:21 -0500 Subject: [PATCH 16/19] just gonna go ahead and remote 8 and 10 --- .github/workflows/ci.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ddb6192..ac0966e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,10 +14,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [8, 10, 12, 14, 16, 18, 20] - exclude: - - node-version: 8 - - node-version: 10 + node-version: [12, 14, 16, 18, 20] steps: - uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node-version }} From 414200b7cc0a6970a1e2db4fd9c52201b6b0402f Mon Sep 17 00:00:00 2001 From: Kiril Vatev Date: Mon, 6 Nov 2023 23:30:22 -0500 Subject: [PATCH 17/19] cleanup --- test/libheif.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/libheif.test.js b/test/libheif.test.js index 32a1e68..ae8e694 100644 --- a/test/libheif.test.js +++ b/test/libheif.test.js @@ -36,7 +36,7 @@ describe('libheif (WASM)', () => { }); describe('libheif (WASM bundle)', () => { - const moduleFile = '../wasm-bundle.js'; + const moduleFile = '../wasm-bundle'; runTests(require(moduleFile)); From 610b242ae4f6c5e00dc034a66a9f9fac09a5c024 Mon Sep 17 00:00:00 2001 From: Kiril Vatev Date: Tue, 7 Nov 2023 01:43:21 -0500 Subject: [PATCH 18/19] removing unnecessary comment --- wasm.js | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/wasm.js b/wasm.js index c67694c..2ac9483 100644 --- a/wasm.js +++ b/wasm.js @@ -4,27 +4,3 @@ const fs = require('fs'); const wasmBinary = fs.readFileSync('./libheif-wasm/libheif.wasm'); module.exports = require('./libheif-wasm/libheif.js')({ wasmBinary }); - -// NOTE: for webpack, you need to do something like: -/* - -import libheif from './libheif-wasm/libheif.js' -import wasmBinary from './libheif-wasm/libheif.wasm' - -export default libheif({ wasmBinary }); - -*/ - -// then add this to rules: -/* - -module.exports = { - module: { - rules: [{ - test: /\.wasm$/, - type: "asset/inline", - }] - }, -}; - -*/ From 0d5195ed944ae225d0ea3220a83621923f72eaf7 Mon Sep 17 00:00:00 2001 From: Kiril Vatev Date: Tue, 7 Nov 2023 01:47:24 -0500 Subject: [PATCH 19/19] let's increase the timeout I guess... it seems to be failing sometimes in CI --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 49b1908..b790790 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "index.js", "scripts": { "pretest": "npm run -s images", - "test": "mocha test/**/*.test.js", + "test": "mocha test/**/*.test.js --timeout 4000", "fetch": "node scripts/install.js", "images": "node scripts/images.js", "inspect": "node scripts/convert.js < temp/0002.heic > out.png",