@cjser/gif2webp-bin 5.0.0-cjser.2

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/cli.js ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env node
2
+ import {spawn} from 'node:child_process';
3
+ import process from 'node:process';
4
+ import gif2webp from '.';
5
+
6
+ const input = process.argv.slice(2);
7
+
8
+ spawn(gif2webp, input, {stdio: 'inherit'})
9
+ .on('exit', process.exit);
@@ -0,0 +1,48 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // packages/@cjser/gif2webp-bin.tmp-26-1778150976033/index.js
30
+ var index_exports = {};
31
+ __export(index_exports, {
32
+ default: () => index_default
33
+ });
34
+ module.exports = __toCommonJS(index_exports);
35
+
36
+ // packages/@cjser/gif2webp-bin.tmp-26-1778150976033/lib/index.js
37
+ var import_node_fs = __toESM(require("node:fs"), 1);
38
+ var import_node_process = __toESM(require("node:process"), 1);
39
+ var import_node_url = require("node:url");
40
+ var import_bin_wrapper = __toESM(require("bin-wrapper"), 1);
41
+ var import_meta = {};
42
+ var pkg = JSON.parse(import_node_fs.default.readFileSync(new URL("../package.json", import_meta.url)));
43
+ var url = `https://raw.github.com/imagemin/gif2webp-bin/v${pkg.version}/vendor/`;
44
+ var binWrapper = new import_bin_wrapper.default().src(`${url}macos/gif2webp`, "darwin").src(`${url}linux/gif2webp`, "linux").src(`${url}win/gif2webp.exe`, "win32").dest((0, import_node_url.fileURLToPath)(new URL("../vendor", import_meta.url))).use(import_node_process.default.platform === "win32" ? "gif2webp.exe" : "gif2webp");
45
+ var lib_default = binWrapper;
46
+
47
+ // packages/@cjser/gif2webp-bin.tmp-26-1778150976033/index.js
48
+ var index_default = lib_default.path();
package/index.js ADDED
@@ -0,0 +1,3 @@
1
+ import lib from './lib/index.js';
2
+
3
+ export default lib.path();
package/lib/index.js ADDED
@@ -0,0 +1,16 @@
1
+ import fs from 'node:fs';
2
+ import process from 'node:process';
3
+ import {fileURLToPath} from 'node:url';
4
+ import BinWrapper from 'bin-wrapper';
5
+
6
+ const pkg = JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url)));
7
+ const url = `https://raw.github.com/imagemin/gif2webp-bin/v${pkg.version}/vendor/`;
8
+
9
+ const binWrapper = new BinWrapper()
10
+ .src(`${url}macos/gif2webp`, 'darwin')
11
+ .src(`${url}linux/gif2webp`, 'linux')
12
+ .src(`${url}win/gif2webp.exe`, 'win32')
13
+ .dest(fileURLToPath(new URL('../vendor', import.meta.url)))
14
+ .use(process.platform === 'win32' ? 'gif2webp.exe' : 'gif2webp');
15
+
16
+ export default binWrapper;
package/lib/install.js ADDED
@@ -0,0 +1,24 @@
1
+ import {fileURLToPath} from 'node:url';
2
+ import binBuild from 'bin-build';
3
+ import bin from './index.js';
4
+
5
+ bin.run(['-help']).then(() => {
6
+ console.log('gif2webp pre-build test passed successfully');
7
+ }).catch(async error => {
8
+ console.warn(error.message);
9
+ console.warn('gif2webp pre-build test failed');
10
+ console.info('compiling from source');
11
+
12
+ try {
13
+ const source = fileURLToPath(new URL('../vendor/source/libwebp-1.1.0.tar.gz', import.meta.url));
14
+
15
+ await binBuild.url(source, [
16
+ `mkdir -p ${bin.dest()}`,
17
+ `make -f makefile.unix examples/gif2webp && mv ./examples/gif2webp ${bin.path()}`,
18
+ ]);
19
+
20
+ console.log('gif2webp built successfully');
21
+ } catch (error) {
22
+ console.error(error.stack);
23
+ }
24
+ });
package/license ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) Imagemin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/package.json ADDED
@@ -0,0 +1,104 @@
1
+ {
2
+ "name": "@cjser/gif2webp-bin",
3
+ "version": "5.0.0-cjser.2",
4
+ "description": "gif2webp wrapper that makes it seamlessly available as a local dependency",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://code.moenext.com/3rdeye/cjser.git"
9
+ },
10
+ "type": "module",
11
+ "exports": {
12
+ "require": "./dist-cjser/index.cjs",
13
+ "default": "./index.js"
14
+ },
15
+ "author": {
16
+ "name": "Shogo Sensui",
17
+ "email": "shogosensui@gmail.com",
18
+ "url": "github.com/1000ch"
19
+ },
20
+ "maintainers": [
21
+ {
22
+ "name": "Sindre Sorhus",
23
+ "email": "sindresorhus@gmail.com",
24
+ "url": "sindresorhus.com"
25
+ },
26
+ {
27
+ "name": "Kevin Mårtensson",
28
+ "email": "kevinmartensson@gmail.com",
29
+ "url": "github.com/kevva"
30
+ },
31
+ {
32
+ "name": "Shinnosuke Watanabe",
33
+ "url": "github.com/shinnn"
34
+ }
35
+ ],
36
+ "bin": {
37
+ "gif2webp": "cli.js"
38
+ },
39
+ "engines": {
40
+ "node": "^14.13.1 || >=16.0.0"
41
+ },
42
+ "scripts": {
43
+ "postinstall": "node lib/install.js",
44
+ "test": "xo && ava --timeout=120s"
45
+ },
46
+ "files": [
47
+ "cli.js",
48
+ "index.js",
49
+ "lib",
50
+ "vendor/source",
51
+ "dist-cjser"
52
+ ],
53
+ "keywords": [
54
+ "imagemin",
55
+ "compress",
56
+ "image",
57
+ "img",
58
+ "minify",
59
+ "optimize",
60
+ "png",
61
+ "webp",
62
+ "gif",
63
+ "gif2webp"
64
+ ],
65
+ "dependencies": {
66
+ "bin-build": "^3.0.0",
67
+ "bin-wrapper": "^4.0.0"
68
+ },
69
+ "devDependencies": {
70
+ "ava": "^4.2.0",
71
+ "bin-check": "^4.0.1",
72
+ "compare-size": "^3.0.0",
73
+ "execa": "^6.1.0",
74
+ "is-webp": "^2.0.0",
75
+ "read-chunk": "^4.0.2",
76
+ "tempy": "^3.0.0",
77
+ "xo": "^0.48.0"
78
+ },
79
+ "main": "./dist-cjser/index.cjs",
80
+ "cjser": {
81
+ "sourceVersion": "5.0.0",
82
+ "cjserVersion": 2,
83
+ "original": {
84
+ "name": "gif2webp-bin",
85
+ "version": "5.0.0",
86
+ "exports": "./index.js",
87
+ "repository": "imagemin/gif2webp-bin",
88
+ "dependencies": {
89
+ "bin-build": "^3.0.0",
90
+ "bin-wrapper": "^4.0.0"
91
+ },
92
+ "files": [
93
+ "cli.js",
94
+ "index.js",
95
+ "lib",
96
+ "vendor/source"
97
+ ],
98
+ "scripts": {
99
+ "postinstall": "node lib/install.js",
100
+ "test": "xo && ava --timeout=120s"
101
+ }
102
+ }
103
+ }
104
+ }
package/readme.md ADDED
@@ -0,0 +1,35 @@
1
+ # gif2webp-bin ![GitHub Actions Status](https://github.com/imagemin/gif2webp-bin/workflows/test/badge.svg?branch=main)
2
+
3
+ > [WebP](https://developers.google.com/speed/webp/) is a modern image format that provides superior lossless and lossy compression for images on the web. Using WebP, webmasters and web developers can create smaller, richer images that make the web faster.
4
+
5
+ ## Install
6
+
7
+ ```
8
+ $ npm install --save gif2webp-bin
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```js
14
+ import {execFile} from 'node:child_process';
15
+ import gif2webp from 'gif2webp-bin';
16
+
17
+ execFile(gif2webp, ['input.gif', '-o', 'outout.webp'], () => {
18
+ console.log('Image converted!');
19
+ });
20
+ ```
21
+
22
+ ## CLI
23
+
24
+ ```
25
+ $ npm install --global gif2webp-bin
26
+ ```
27
+
28
+ ```
29
+ $ gif2webp --help
30
+ ```
31
+
32
+ ## cjser
33
+
34
+ This package is a CommonJS-compatible build generated by cjser for projects that still need `require()` support. The source version matches the original npm package version, with a cjser prerelease suffix for this generated build.
35
+ Original repository: https://github.com/imagemin/gif2webp-bin