@powerlines/plugin-image-compression 0.2.186 → 0.2.188
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/index-BgAdqTbb.d.mts +1 -0
- package/dist/index-CEgs-Dz2.d.cts +1 -0
- package/dist/index.cjs +157 -4
- package/dist/index.d.cts +4 -3
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +4 -3
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +130 -2
- package/dist/index.mjs.map +1 -0
- package/dist/plugin-BX_Z82RH.d.mts +76 -0
- package/dist/plugin-BX_Z82RH.d.mts.map +1 -0
- package/dist/plugin-C3MaN5jp.mjs +1 -0
- package/dist/plugin-CJ3kcwOQ.d.cts +76 -0
- package/dist/plugin-CJ3kcwOQ.d.cts.map +1 -0
- package/dist/plugin-DHXHjv16.cjs +0 -0
- package/dist/types/index.cjs +2 -0
- package/dist/types/index.d.cts +2 -1
- package/dist/types/index.d.mts +2 -1
- package/dist/types/index.mjs +3 -0
- package/dist/types/plugin.cjs +1 -0
- package/dist/types/plugin.d.cts +1 -74
- package/dist/types/plugin.d.mts +1 -74
- package/dist/types/plugin.mjs +2 -0
- package/dist/types-CTUnla4x.mjs +1 -0
- package/dist/types-DHkg7xmX.cjs +0 -0
- package/package.json +4 -4
- package/dist/_virtual/rolldown_runtime.cjs +0 -29
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/index.cjs
CHANGED
|
@@ -1,18 +1,171 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
-
|
|
2
|
+
//#region rolldown:runtime
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
12
|
+
key = keys[i];
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
14
|
+
__defProp(to, key, {
|
|
15
|
+
get: ((k) => from[k]).bind(null, key),
|
|
16
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
22
|
+
};
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
24
|
+
value: mod,
|
|
25
|
+
enumerable: true
|
|
26
|
+
}) : target, mod));
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
require('./plugin-DHXHjv16.cjs');
|
|
30
|
+
require('./types-DHkg7xmX.cjs');
|
|
3
31
|
let __stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
4
32
|
let __stryke_fs_list_files = require("@stryke/fs/list-files");
|
|
5
33
|
let __stryke_fs_read_file = require("@stryke/fs/read-file");
|
|
6
34
|
let __stryke_fs_write_file = require("@stryke/fs/write-file");
|
|
7
35
|
let __stryke_path_find = require("@stryke/path/find");
|
|
8
|
-
let __stryke_string_format_pretty_bytes = require("@stryke/string-format/pretty-bytes");
|
|
9
36
|
let chalk = require("chalk");
|
|
10
|
-
chalk =
|
|
37
|
+
chalk = __toESM(chalk);
|
|
11
38
|
let node_buffer = require("node:buffer");
|
|
12
39
|
let node_fs_promises = require("node:fs/promises");
|
|
13
40
|
let powerlines_plugin_utils_paths = require("powerlines/plugin-utils/paths");
|
|
14
41
|
let svgo = require("svgo");
|
|
15
42
|
|
|
43
|
+
//#region ../../node_modules/.pnpm/@stryke+string-format@0.13.6/node_modules/@stryke/string-format/dist/pretty-bytes.mjs
|
|
44
|
+
const BYTE_UNITS = [
|
|
45
|
+
"B",
|
|
46
|
+
"kB",
|
|
47
|
+
"MB",
|
|
48
|
+
"GB",
|
|
49
|
+
"TB",
|
|
50
|
+
"PB",
|
|
51
|
+
"EB",
|
|
52
|
+
"ZB",
|
|
53
|
+
"YB"
|
|
54
|
+
];
|
|
55
|
+
const BIBYTE_UNITS = [
|
|
56
|
+
"B",
|
|
57
|
+
"KiB",
|
|
58
|
+
"MiB",
|
|
59
|
+
"GiB",
|
|
60
|
+
"TiB",
|
|
61
|
+
"PiB",
|
|
62
|
+
"EiB",
|
|
63
|
+
"ZiB",
|
|
64
|
+
"YiB"
|
|
65
|
+
];
|
|
66
|
+
const BIT_UNITS = [
|
|
67
|
+
"b",
|
|
68
|
+
"kbit",
|
|
69
|
+
"Mbit",
|
|
70
|
+
"Gbit",
|
|
71
|
+
"Tbit",
|
|
72
|
+
"Pbit",
|
|
73
|
+
"Ebit",
|
|
74
|
+
"Zbit",
|
|
75
|
+
"Ybit"
|
|
76
|
+
];
|
|
77
|
+
const BIBIT_UNITS = [
|
|
78
|
+
"b",
|
|
79
|
+
"kibit",
|
|
80
|
+
"Mibit",
|
|
81
|
+
"Gibit",
|
|
82
|
+
"Tibit",
|
|
83
|
+
"Pibit",
|
|
84
|
+
"Eibit",
|
|
85
|
+
"Zibit",
|
|
86
|
+
"Yibit"
|
|
87
|
+
];
|
|
88
|
+
/**
|
|
89
|
+
* Formats the given number using `Number#toLocaleString`.
|
|
90
|
+
*
|
|
91
|
+
* @remarks
|
|
92
|
+
* - If locale is a string, the value is expected to be a locale-key (for example: `de`).
|
|
93
|
+
* - If locale is true, the system default locale is used for translation.
|
|
94
|
+
* - If no value for locale is specified, the number is returned unmodified.
|
|
95
|
+
*
|
|
96
|
+
* @param number - The number to format.
|
|
97
|
+
* @param locale - The locale to use for formatting the number.
|
|
98
|
+
* @param options - The options to use for formatting the number.
|
|
99
|
+
* @returns The formatted number.
|
|
100
|
+
*/
|
|
101
|
+
const toLocaleString = (number, locale, options = {}) => {
|
|
102
|
+
let result = number;
|
|
103
|
+
let _locale = locale;
|
|
104
|
+
if (typeof _locale === "string") {
|
|
105
|
+
if (!_locale) _locale = process.env.STORM_LOCALE || "en-US";
|
|
106
|
+
if (Array.isArray(_locale)) result = number?.toLocaleString(_locale, options);
|
|
107
|
+
} else if (_locale === true || options !== void 0) result = number?.toLocaleString(void 0, options);
|
|
108
|
+
return String(result);
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* Convert bytes to a human readable string: `1337` → `1.34 kB`.
|
|
112
|
+
*
|
|
113
|
+
* @param number - The number to format.
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```ts
|
|
117
|
+
* import { prettyBytes } from '@stryke/string-fns/pretty-bytes';
|
|
118
|
+
*
|
|
119
|
+
* prettyBytes(1337);
|
|
120
|
+
* //=> '1.34 kB'
|
|
121
|
+
*
|
|
122
|
+
* prettyBytes(100);
|
|
123
|
+
* //=> '100 B'
|
|
124
|
+
*
|
|
125
|
+
* // Display file size differences
|
|
126
|
+
* prettyBytes(42, {signed: true});
|
|
127
|
+
* //=> '+42 B'
|
|
128
|
+
*
|
|
129
|
+
* // Localized output using German locale
|
|
130
|
+
* prettyBytes(1337, {locale: 'de'});
|
|
131
|
+
* //=> '1,34 kB'
|
|
132
|
+
* ```
|
|
133
|
+
*
|
|
134
|
+
* @param number - The number to format.
|
|
135
|
+
* @param options - The options to use.
|
|
136
|
+
* @returns The formatted string.
|
|
137
|
+
*/
|
|
138
|
+
function prettyBytes(number, options) {
|
|
139
|
+
let _number = number;
|
|
140
|
+
if (!Number.isFinite(_number)) throw new TypeError(`Expected a finite number, got ${typeof _number}: ${_number}`);
|
|
141
|
+
const opts = {
|
|
142
|
+
bits: false,
|
|
143
|
+
binary: false,
|
|
144
|
+
space: true,
|
|
145
|
+
...options
|
|
146
|
+
};
|
|
147
|
+
const UNITS = opts.bits ? opts.binary ? BIBIT_UNITS : BIT_UNITS : opts.binary ? BIBYTE_UNITS : BYTE_UNITS;
|
|
148
|
+
const separator = opts.space ? " " : "";
|
|
149
|
+
if (opts.signed && _number === 0) return ` 0${separator}${UNITS[0]}`;
|
|
150
|
+
const isNegative = _number < 0;
|
|
151
|
+
const prefix = isNegative ? "-" : opts.signed ? "+" : "";
|
|
152
|
+
if (isNegative) _number = -_number;
|
|
153
|
+
let localeOptions;
|
|
154
|
+
if (opts.minimumFractionDigits !== void 0) localeOptions = { minimumFractionDigits: opts.minimumFractionDigits };
|
|
155
|
+
if (opts.maximumFractionDigits !== void 0) localeOptions = {
|
|
156
|
+
maximumFractionDigits: opts.maximumFractionDigits,
|
|
157
|
+
...localeOptions
|
|
158
|
+
};
|
|
159
|
+
if (_number < 1) return prefix + toLocaleString(_number, opts.locale, localeOptions) + separator + UNITS[0];
|
|
160
|
+
const exponent = Math.min(Math.floor(opts.binary ? Math.log(_number) / Math.log(1024) : Math.log10(_number) / 3), UNITS.length - 1);
|
|
161
|
+
_number /= (opts.binary ? 1024 : 1e3) ** exponent;
|
|
162
|
+
if (!localeOptions) _number = _number.toPrecision(3);
|
|
163
|
+
const numberString = toLocaleString(Number(_number), opts.locale, localeOptions);
|
|
164
|
+
const unit = UNITS[exponent];
|
|
165
|
+
return prefix + numberString + separator + unit;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
//#endregion
|
|
16
169
|
//#region src/index.ts
|
|
17
170
|
/**
|
|
18
171
|
* A Powerlines plugin to optimize image assets used by the project.
|
|
@@ -108,7 +261,7 @@ const plugin = (options = {}) => {
|
|
|
108
261
|
this.error(` ✘ Failed to optimize ${file} - Compression output was not smaller than the original`);
|
|
109
262
|
return;
|
|
110
263
|
}
|
|
111
|
-
this.info(` ✔ Successfully optimized ${file}: ${chalk.default.redBright(
|
|
264
|
+
this.info(` ✔ Successfully optimized ${file}: ${chalk.default.redBright(prettyBytes(originalSize))} -> ${chalk.default.greenBright(prettyBytes(compressedSize))} (${chalk.default.green((100 - compressedSize / originalSize * 100).toFixed(2))}%) in ${(performance.now() - start).toFixed(2)} ms`);
|
|
112
265
|
}));
|
|
113
266
|
}));
|
|
114
267
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ImageCompressionPluginContext,
|
|
2
|
-
import "./
|
|
1
|
+
import { a as __ΩImageCompressionPluginContext, c as __ΩImageCompressionPluginUserConfig, i as ImageCompressionPluginUserConfig, n as ImageCompressionPluginOptions, o as __ΩImageCompressionPluginOptions, r as ImageCompressionPluginResolvedConfig, s as __ΩImageCompressionPluginResolvedConfig, t as ImageCompressionPluginContext } from "./plugin-CJ3kcwOQ.cjs";
|
|
2
|
+
import "./index-CEgs-Dz2.cjs";
|
|
3
3
|
import { Plugin } from "powerlines/types/plugin";
|
|
4
4
|
|
|
5
5
|
//#region src/index.d.ts
|
|
@@ -14,4 +14,5 @@ import { Plugin } from "powerlines/types/plugin";
|
|
|
14
14
|
*/
|
|
15
15
|
declare const plugin: <TContext extends ImageCompressionPluginContext = ImageCompressionPluginContext>(options?: ImageCompressionPluginOptions) => Plugin<TContext>;
|
|
16
16
|
//#endregion
|
|
17
|
-
export { ImageCompressionPluginContext, ImageCompressionPluginOptions, ImageCompressionPluginResolvedConfig, ImageCompressionPluginUserConfig, __ΩImageCompressionPluginContext, __ΩImageCompressionPluginOptions, __ΩImageCompressionPluginResolvedConfig, __ΩImageCompressionPluginUserConfig, plugin as default, plugin };
|
|
17
|
+
export { ImageCompressionPluginContext, ImageCompressionPluginOptions, ImageCompressionPluginResolvedConfig, ImageCompressionPluginUserConfig, __ΩImageCompressionPluginContext, __ΩImageCompressionPluginOptions, __ΩImageCompressionPluginResolvedConfig, __ΩImageCompressionPluginUserConfig, plugin as default, plugin };
|
|
18
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;AA6CA;;;;;;AAIS,cAJI,MAIJ,EAAA,CAAA,iBAHU,6BAGV,GAH0C,6BAG1C,CAAA,CAAA,OAAA,CAAA,EADE,6BACF,EAAA,GAAN,MAAM,CAAC,QAAD,CAAA"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ImageCompressionPluginContext,
|
|
2
|
-
import "./
|
|
1
|
+
import { a as __ΩImageCompressionPluginContext, c as __ΩImageCompressionPluginUserConfig, i as ImageCompressionPluginUserConfig, n as ImageCompressionPluginOptions, o as __ΩImageCompressionPluginOptions, r as ImageCompressionPluginResolvedConfig, s as __ΩImageCompressionPluginResolvedConfig, t as ImageCompressionPluginContext } from "./plugin-BX_Z82RH.mjs";
|
|
2
|
+
import "./index-BgAdqTbb.mjs";
|
|
3
3
|
import { Plugin } from "powerlines/types/plugin";
|
|
4
4
|
|
|
5
5
|
//#region src/index.d.ts
|
|
@@ -14,4 +14,5 @@ import { Plugin } from "powerlines/types/plugin";
|
|
|
14
14
|
*/
|
|
15
15
|
declare const plugin: <TContext extends ImageCompressionPluginContext = ImageCompressionPluginContext>(options?: ImageCompressionPluginOptions) => Plugin<TContext>;
|
|
16
16
|
//#endregion
|
|
17
|
-
export { ImageCompressionPluginContext, ImageCompressionPluginOptions, ImageCompressionPluginResolvedConfig, ImageCompressionPluginUserConfig, __ΩImageCompressionPluginContext, __ΩImageCompressionPluginOptions, __ΩImageCompressionPluginResolvedConfig, __ΩImageCompressionPluginUserConfig, plugin as default, plugin };
|
|
17
|
+
export { ImageCompressionPluginContext, ImageCompressionPluginOptions, ImageCompressionPluginResolvedConfig, ImageCompressionPluginUserConfig, __ΩImageCompressionPluginContext, __ΩImageCompressionPluginOptions, __ΩImageCompressionPluginResolvedConfig, __ΩImageCompressionPluginUserConfig, plugin as default, plugin };
|
|
18
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;AA6CA;;;;;;AAIS,cAJI,MAIJ,EAAA,CAAA,iBAHU,6BAGV,GAH0C,6BAG1C,CAAA,CAAA,OAAA,CAAA,EADE,6BACF,EAAA,GAAN,MAAM,CAAC,QAAD,CAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,15 +1,142 @@
|
|
|
1
|
+
import "./plugin-C3MaN5jp.mjs";
|
|
2
|
+
import "./types-CTUnla4x.mjs";
|
|
1
3
|
import { toArray } from "@stryke/convert/to-array";
|
|
2
4
|
import { listFiles } from "@stryke/fs/list-files";
|
|
3
5
|
import { readFile } from "@stryke/fs/read-file";
|
|
4
6
|
import { writeFile } from "@stryke/fs/write-file";
|
|
5
7
|
import { findFileExtensionSafe } from "@stryke/path/find";
|
|
6
|
-
import { prettyBytes } from "@stryke/string-format/pretty-bytes";
|
|
7
8
|
import chalk from "chalk";
|
|
8
9
|
import { Buffer } from "node:buffer";
|
|
9
10
|
import { stat } from "node:fs/promises";
|
|
10
11
|
import { replacePathTokens } from "powerlines/plugin-utils/paths";
|
|
11
12
|
import { optimize } from "svgo";
|
|
12
13
|
|
|
14
|
+
//#region ../../node_modules/.pnpm/@stryke+string-format@0.13.6/node_modules/@stryke/string-format/dist/pretty-bytes.mjs
|
|
15
|
+
const BYTE_UNITS = [
|
|
16
|
+
"B",
|
|
17
|
+
"kB",
|
|
18
|
+
"MB",
|
|
19
|
+
"GB",
|
|
20
|
+
"TB",
|
|
21
|
+
"PB",
|
|
22
|
+
"EB",
|
|
23
|
+
"ZB",
|
|
24
|
+
"YB"
|
|
25
|
+
];
|
|
26
|
+
const BIBYTE_UNITS = [
|
|
27
|
+
"B",
|
|
28
|
+
"KiB",
|
|
29
|
+
"MiB",
|
|
30
|
+
"GiB",
|
|
31
|
+
"TiB",
|
|
32
|
+
"PiB",
|
|
33
|
+
"EiB",
|
|
34
|
+
"ZiB",
|
|
35
|
+
"YiB"
|
|
36
|
+
];
|
|
37
|
+
const BIT_UNITS = [
|
|
38
|
+
"b",
|
|
39
|
+
"kbit",
|
|
40
|
+
"Mbit",
|
|
41
|
+
"Gbit",
|
|
42
|
+
"Tbit",
|
|
43
|
+
"Pbit",
|
|
44
|
+
"Ebit",
|
|
45
|
+
"Zbit",
|
|
46
|
+
"Ybit"
|
|
47
|
+
];
|
|
48
|
+
const BIBIT_UNITS = [
|
|
49
|
+
"b",
|
|
50
|
+
"kibit",
|
|
51
|
+
"Mibit",
|
|
52
|
+
"Gibit",
|
|
53
|
+
"Tibit",
|
|
54
|
+
"Pibit",
|
|
55
|
+
"Eibit",
|
|
56
|
+
"Zibit",
|
|
57
|
+
"Yibit"
|
|
58
|
+
];
|
|
59
|
+
/**
|
|
60
|
+
* Formats the given number using `Number#toLocaleString`.
|
|
61
|
+
*
|
|
62
|
+
* @remarks
|
|
63
|
+
* - If locale is a string, the value is expected to be a locale-key (for example: `de`).
|
|
64
|
+
* - If locale is true, the system default locale is used for translation.
|
|
65
|
+
* - If no value for locale is specified, the number is returned unmodified.
|
|
66
|
+
*
|
|
67
|
+
* @param number - The number to format.
|
|
68
|
+
* @param locale - The locale to use for formatting the number.
|
|
69
|
+
* @param options - The options to use for formatting the number.
|
|
70
|
+
* @returns The formatted number.
|
|
71
|
+
*/
|
|
72
|
+
const toLocaleString = (number, locale, options = {}) => {
|
|
73
|
+
let result = number;
|
|
74
|
+
let _locale = locale;
|
|
75
|
+
if (typeof _locale === "string") {
|
|
76
|
+
if (!_locale) _locale = process.env.STORM_LOCALE || "en-US";
|
|
77
|
+
if (Array.isArray(_locale)) result = number?.toLocaleString(_locale, options);
|
|
78
|
+
} else if (_locale === true || options !== void 0) result = number?.toLocaleString(void 0, options);
|
|
79
|
+
return String(result);
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Convert bytes to a human readable string: `1337` → `1.34 kB`.
|
|
83
|
+
*
|
|
84
|
+
* @param number - The number to format.
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```ts
|
|
88
|
+
* import { prettyBytes } from '@stryke/string-fns/pretty-bytes';
|
|
89
|
+
*
|
|
90
|
+
* prettyBytes(1337);
|
|
91
|
+
* //=> '1.34 kB'
|
|
92
|
+
*
|
|
93
|
+
* prettyBytes(100);
|
|
94
|
+
* //=> '100 B'
|
|
95
|
+
*
|
|
96
|
+
* // Display file size differences
|
|
97
|
+
* prettyBytes(42, {signed: true});
|
|
98
|
+
* //=> '+42 B'
|
|
99
|
+
*
|
|
100
|
+
* // Localized output using German locale
|
|
101
|
+
* prettyBytes(1337, {locale: 'de'});
|
|
102
|
+
* //=> '1,34 kB'
|
|
103
|
+
* ```
|
|
104
|
+
*
|
|
105
|
+
* @param number - The number to format.
|
|
106
|
+
* @param options - The options to use.
|
|
107
|
+
* @returns The formatted string.
|
|
108
|
+
*/
|
|
109
|
+
function prettyBytes(number, options) {
|
|
110
|
+
let _number = number;
|
|
111
|
+
if (!Number.isFinite(_number)) throw new TypeError(`Expected a finite number, got ${typeof _number}: ${_number}`);
|
|
112
|
+
const opts = {
|
|
113
|
+
bits: false,
|
|
114
|
+
binary: false,
|
|
115
|
+
space: true,
|
|
116
|
+
...options
|
|
117
|
+
};
|
|
118
|
+
const UNITS = opts.bits ? opts.binary ? BIBIT_UNITS : BIT_UNITS : opts.binary ? BIBYTE_UNITS : BYTE_UNITS;
|
|
119
|
+
const separator = opts.space ? " " : "";
|
|
120
|
+
if (opts.signed && _number === 0) return ` 0${separator}${UNITS[0]}`;
|
|
121
|
+
const isNegative = _number < 0;
|
|
122
|
+
const prefix = isNegative ? "-" : opts.signed ? "+" : "";
|
|
123
|
+
if (isNegative) _number = -_number;
|
|
124
|
+
let localeOptions;
|
|
125
|
+
if (opts.minimumFractionDigits !== void 0) localeOptions = { minimumFractionDigits: opts.minimumFractionDigits };
|
|
126
|
+
if (opts.maximumFractionDigits !== void 0) localeOptions = {
|
|
127
|
+
maximumFractionDigits: opts.maximumFractionDigits,
|
|
128
|
+
...localeOptions
|
|
129
|
+
};
|
|
130
|
+
if (_number < 1) return prefix + toLocaleString(_number, opts.locale, localeOptions) + separator + UNITS[0];
|
|
131
|
+
const exponent = Math.min(Math.floor(opts.binary ? Math.log(_number) / Math.log(1024) : Math.log10(_number) / 3), UNITS.length - 1);
|
|
132
|
+
_number /= (opts.binary ? 1024 : 1e3) ** exponent;
|
|
133
|
+
if (!localeOptions) _number = _number.toPrecision(3);
|
|
134
|
+
const numberString = toLocaleString(Number(_number), opts.locale, localeOptions);
|
|
135
|
+
const unit = UNITS[exponent];
|
|
136
|
+
return prefix + numberString + separator + unit;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
//#endregion
|
|
13
140
|
//#region src/index.ts
|
|
14
141
|
/**
|
|
15
142
|
* A Powerlines plugin to optimize image assets used by the project.
|
|
@@ -114,4 +241,5 @@ const plugin = (options = {}) => {
|
|
|
114
241
|
var src_default = plugin;
|
|
115
242
|
|
|
116
243
|
//#endregion
|
|
117
|
-
export { src_default as default, plugin };
|
|
244
|
+
export { src_default as default, plugin };
|
|
245
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../node_modules/.pnpm/@stryke+string-format@0.13.6/node_modules/@stryke/string-format/dist/pretty-bytes.mjs","../src/index.ts"],"sourcesContent":["//#region src/pretty-bytes.ts\nconst BYTE_UNITS = [\n\t\"B\",\n\t\"kB\",\n\t\"MB\",\n\t\"GB\",\n\t\"TB\",\n\t\"PB\",\n\t\"EB\",\n\t\"ZB\",\n\t\"YB\"\n];\nconst BIBYTE_UNITS = [\n\t\"B\",\n\t\"KiB\",\n\t\"MiB\",\n\t\"GiB\",\n\t\"TiB\",\n\t\"PiB\",\n\t\"EiB\",\n\t\"ZiB\",\n\t\"YiB\"\n];\nconst BIT_UNITS = [\n\t\"b\",\n\t\"kbit\",\n\t\"Mbit\",\n\t\"Gbit\",\n\t\"Tbit\",\n\t\"Pbit\",\n\t\"Ebit\",\n\t\"Zbit\",\n\t\"Ybit\"\n];\nconst BIBIT_UNITS = [\n\t\"b\",\n\t\"kibit\",\n\t\"Mibit\",\n\t\"Gibit\",\n\t\"Tibit\",\n\t\"Pibit\",\n\t\"Eibit\",\n\t\"Zibit\",\n\t\"Yibit\"\n];\n/**\n* Formats the given number using `Number#toLocaleString`.\n*\n* @remarks\n* - If locale is a string, the value is expected to be a locale-key (for example: `de`).\n* - If locale is true, the system default locale is used for translation.\n* - If no value for locale is specified, the number is returned unmodified.\n*\n* @param number - The number to format.\n* @param locale - The locale to use for formatting the number.\n* @param options - The options to use for formatting the number.\n* @returns The formatted number.\n*/\nconst toLocaleString = (number, locale, options = {}) => {\n\tlet result = number;\n\tlet _locale = locale;\n\tif (typeof _locale === \"string\") {\n\t\tif (!_locale) _locale = process.env.STORM_LOCALE || \"en-US\";\n\t\tif (Array.isArray(_locale)) result = number?.toLocaleString(_locale, options);\n\t} else if (_locale === true || options !== void 0) result = number?.toLocaleString(void 0, options);\n\treturn String(result);\n};\n/**\n* Convert bytes to a human readable string: `1337` → `1.34 kB`.\n*\n* @param number - The number to format.\n*\n* @example\n* ```ts\n* import { prettyBytes } from '@stryke/string-fns/pretty-bytes';\n*\n* prettyBytes(1337);\n* //=> '1.34 kB'\n*\n* prettyBytes(100);\n* //=> '100 B'\n*\n* // Display file size differences\n* prettyBytes(42, {signed: true});\n* //=> '+42 B'\n*\n* // Localized output using German locale\n* prettyBytes(1337, {locale: 'de'});\n* //=> '1,34 kB'\n* ```\n*\n* @param number - The number to format.\n* @param options - The options to use.\n* @returns The formatted string.\n*/\nfunction prettyBytes(number, options) {\n\tlet _number = number;\n\tif (!Number.isFinite(_number)) throw new TypeError(`Expected a finite number, got ${typeof _number}: ${_number}`);\n\tconst opts = {\n\t\tbits: false,\n\t\tbinary: false,\n\t\tspace: true,\n\t\t...options\n\t};\n\tconst UNITS = opts.bits ? opts.binary ? BIBIT_UNITS : BIT_UNITS : opts.binary ? BIBYTE_UNITS : BYTE_UNITS;\n\tconst separator = opts.space ? \" \" : \"\";\n\tif (opts.signed && _number === 0) return ` 0${separator}${UNITS[0]}`;\n\tconst isNegative = _number < 0;\n\tconst prefix = isNegative ? \"-\" : opts.signed ? \"+\" : \"\";\n\tif (isNegative) _number = -_number;\n\tlet localeOptions;\n\tif (opts.minimumFractionDigits !== void 0) localeOptions = { minimumFractionDigits: opts.minimumFractionDigits };\n\tif (opts.maximumFractionDigits !== void 0) localeOptions = {\n\t\tmaximumFractionDigits: opts.maximumFractionDigits,\n\t\t...localeOptions\n\t};\n\tif (_number < 1) return prefix + toLocaleString(_number, opts.locale, localeOptions) + separator + UNITS[0];\n\tconst exponent = Math.min(Math.floor(opts.binary ? Math.log(_number) / Math.log(1024) : Math.log10(_number) / 3), UNITS.length - 1);\n\t_number /= (opts.binary ? 1024 : 1e3) ** exponent;\n\tif (!localeOptions) _number = _number.toPrecision(3);\n\tconst numberString = toLocaleString(Number(_number), opts.locale, localeOptions);\n\tconst unit = UNITS[exponent];\n\treturn prefix + numberString + separator + unit;\n}\n\n//#endregion\nexport { prettyBytes, toLocaleString };\n//# sourceMappingURL=pretty-bytes.mjs.map","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { listFiles } from \"@stryke/fs/list-files\";\nimport { readFile } from \"@stryke/fs/read-file\";\nimport { writeFile } from \"@stryke/fs/write-file\";\nimport { findFileExtensionSafe } from \"@stryke/path/find\";\nimport { prettyBytes } from \"@stryke/string-format/pretty-bytes\";\nimport chalk from \"chalk\";\nimport { Buffer } from \"node:buffer\";\nimport { stat } from \"node:fs/promises\";\nimport { replacePathTokens } from \"powerlines/plugin-utils/paths\";\nimport type { Plugin } from \"powerlines/types/plugin\";\nimport { optimize } from \"svgo\";\nimport {\n ImageCompressionPluginContext,\n ImageCompressionPluginOptions\n} from \"./types/plugin\";\n\nexport * from \"./types\";\n\n/**\n * A Powerlines plugin to optimize image assets used by the project.\n *\n * @see https://sharp.pixelplumbing.com\n *\n * @param options - The plugin options.\n * @returns A Powerlines plugin instance.\n */\nexport const plugin = <\n TContext extends ImageCompressionPluginContext = ImageCompressionPluginContext\n>(\n options: ImageCompressionPluginOptions = {}\n): Plugin<TContext> => {\n return {\n name: \"image-compression\",\n config() {\n return {\n imageCompression: {\n filter:\n \"{projectRoot}/**/*.{svg,jpg,jpeg,png,webp,avif,heif,gif,tiff,jp2,jxl}\",\n svg: {},\n jpeg: {},\n png: {},\n webp: {},\n avif: {},\n heif: {},\n tiff: {},\n jp2: {},\n jxl: {},\n ...options\n }\n };\n },\n async configResolved() {\n if (!this.config.imageCompression.filter) {\n throw new Error(\n \"ImageCompression plugin requires a filter or glob pattern to be specified in the configuration.\"\n );\n }\n\n this.config.imageCompression.filter = toArray(\n this.config.imageCompression.filter\n )\n .map(path => replacePathTokens(this, path))\n .filter(Boolean);\n },\n async prepare() {\n await Promise.all(\n toArray(this.config.imageCompression.filter).map(async path => {\n await Promise.all(\n (await listFiles(path)).map(async file => {\n const outputPath = this.config.imageCompression.outputPath\n ? replacePathTokens(\n this,\n this.config.imageCompression.outputPath\n ).replace(/\\{fileName\\}/g, file.split(\"/\").pop() || \"output\")\n : file;\n\n const start = performance.now();\n const originalSize = (await stat(file)).size;\n let compressedSize = 0;\n\n const extension = findFileExtensionSafe(file).toLowerCase();\n if (!extension) {\n this.error(\n ` ✘ Failed to optimize ${file} - Unable to determine file extension`\n );\n return;\n }\n\n if (extension === \"svg\") {\n const result = optimize(await readFile(file), {\n multipass: true,\n path: file,\n ...this.config.imageCompression.svg\n });\n if (result.data) {\n compressedSize = Buffer.byteLength(result.data, \"utf8\");\n await writeFile(outputPath, result.data);\n }\n } else {\n let image = await import(\"sharp\").then(sharpModule =>\n sharpModule.default(file, { animated: extension === \"gif\" })\n );\n\n switch (extension) {\n case \"jpeg\":\n case \"jpg\":\n image = image.jpeg(this.config.imageCompression.jpeg);\n break;\n case \"png\":\n image = image.png(this.config.imageCompression.png);\n break;\n case \"webp\":\n image = image.webp(this.config.imageCompression.webp);\n break;\n case \"avif\":\n image = image.avif(this.config.imageCompression.avif);\n break;\n case \"gif\":\n image = image.gif(this.config.imageCompression.gif);\n break;\n case \"heif\":\n image = image.heif(this.config.imageCompression.heif);\n break;\n case \"tiff\":\n image = image.tiff(this.config.imageCompression.tiff);\n break;\n case \"jp2\":\n image = image.jp2(this.config.imageCompression.jp2);\n break;\n case \"jxl\":\n image = image.jxl(this.config.imageCompression.jxl);\n break;\n }\n\n const result = await image.toFile(outputPath);\n compressedSize = result.size;\n }\n\n if (!compressedSize) {\n this.error(` ✘ Failed to optimize ${file} - No data returned`);\n return;\n }\n\n if (compressedSize >= originalSize) {\n this.error(\n ` ✘ Failed to optimize ${file} - Compression output was not smaller than the original`\n );\n return;\n }\n\n this.info(\n ` ✔ Successfully optimized ${\n file\n }: ${chalk.redBright(prettyBytes(originalSize))} -> ${chalk.greenBright(\n prettyBytes(compressedSize)\n )} (${chalk.green(\n (100 - (compressedSize / originalSize) * 100).toFixed(2)\n )}%) in ${(performance.now() - start).toFixed(2)} ms`\n );\n })\n );\n })\n );\n }\n };\n};\n\nexport default plugin;\n"],"x_google_ignoreList":[0],"mappings":"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"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { Config } from "svgo";
|
|
2
|
+
import { AvifOptions, GifOptions, HeifOptions, Jp2Options, JpegOptions, JxlOptions, PngOptions, TiffOptions, WebpOptions } from "sharp";
|
|
3
|
+
import { UserConfig } from "powerlines/types/config";
|
|
4
|
+
import { PluginContext } from "powerlines/types/context";
|
|
5
|
+
import { ResolvedConfig } from "powerlines/types/resolved";
|
|
6
|
+
|
|
7
|
+
//#region src/types/plugin.d.ts
|
|
8
|
+
interface ImageCompressionPluginOptions {
|
|
9
|
+
/**
|
|
10
|
+
* A path or glob pattern (or an array of paths and glob patterns) to image files to optimize during Powerlines processing.
|
|
11
|
+
*
|
|
12
|
+
* @defaultValue "\{projectRoot\}/**\/*.\{svg,jpg,jpeg,png,webp,avif,heif,gif,tiff,jp2,jxl\}"
|
|
13
|
+
*/
|
|
14
|
+
filter?: string | string[];
|
|
15
|
+
/**
|
|
16
|
+
* The output directory for the optimized images.
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* By default, it will generate the output files alongside each input image file.
|
|
20
|
+
*/
|
|
21
|
+
outputPath?: string;
|
|
22
|
+
/**
|
|
23
|
+
* These SVGO options used for SVG optimization
|
|
24
|
+
*/
|
|
25
|
+
svg?: Config;
|
|
26
|
+
/**
|
|
27
|
+
* These JPEG options used for output image
|
|
28
|
+
*/
|
|
29
|
+
jpeg?: JpegOptions;
|
|
30
|
+
/**
|
|
31
|
+
* These JP2 (JPEG 2000) options used for output image
|
|
32
|
+
*/
|
|
33
|
+
jp2?: Jp2Options;
|
|
34
|
+
/**
|
|
35
|
+
* These JPEG-XL (JXL) options used for output image
|
|
36
|
+
*/
|
|
37
|
+
jxl?: JxlOptions;
|
|
38
|
+
/**
|
|
39
|
+
* These PNG options used for output image
|
|
40
|
+
*/
|
|
41
|
+
png?: PngOptions;
|
|
42
|
+
/**
|
|
43
|
+
* These WebP options used for output image
|
|
44
|
+
*/
|
|
45
|
+
webp?: WebpOptions;
|
|
46
|
+
/**
|
|
47
|
+
* These GIF options used for output image
|
|
48
|
+
*/
|
|
49
|
+
gif?: GifOptions;
|
|
50
|
+
/**
|
|
51
|
+
* These AVIF options used for output image
|
|
52
|
+
*/
|
|
53
|
+
avif?: AvifOptions;
|
|
54
|
+
/**
|
|
55
|
+
* These HEIF options used for output image
|
|
56
|
+
*/
|
|
57
|
+
heif?: HeifOptions;
|
|
58
|
+
/**
|
|
59
|
+
* These TIFF options used for output image
|
|
60
|
+
*/
|
|
61
|
+
tiff?: TiffOptions;
|
|
62
|
+
}
|
|
63
|
+
interface ImageCompressionPluginUserConfig extends UserConfig {
|
|
64
|
+
imageCompression?: ImageCompressionPluginOptions;
|
|
65
|
+
}
|
|
66
|
+
interface ImageCompressionPluginResolvedConfig extends ResolvedConfig {
|
|
67
|
+
imageCompression: Omit<ImageCompressionPluginOptions, "filter" | "svg" | "jpeg" | "png" | "webp" | "avif" | "heif" | "tiff" | "jp2" | "jxl" | "gif"> & Required<Pick<ImageCompressionPluginOptions, "filter" | "svg" | "jpeg" | "png" | "webp" | "avif" | "heif" | "tiff" | "jp2" | "jxl" | "gif">>;
|
|
68
|
+
}
|
|
69
|
+
type ImageCompressionPluginContext<TResolvedConfig extends ImageCompressionPluginResolvedConfig = ImageCompressionPluginResolvedConfig> = PluginContext<TResolvedConfig>;
|
|
70
|
+
declare type __ΩImageCompressionPluginOptions = any[];
|
|
71
|
+
declare type __ΩImageCompressionPluginUserConfig = any[];
|
|
72
|
+
declare type __ΩImageCompressionPluginResolvedConfig = any[];
|
|
73
|
+
declare type __ΩImageCompressionPluginContext = any[];
|
|
74
|
+
//#endregion
|
|
75
|
+
export { __ΩImageCompressionPluginContext as a, __ΩImageCompressionPluginUserConfig as c, ImageCompressionPluginUserConfig as i, ImageCompressionPluginOptions as n, __ΩImageCompressionPluginOptions as o, ImageCompressionPluginResolvedConfig as r, __ΩImageCompressionPluginResolvedConfig as s, ImageCompressionPluginContext as t };
|
|
76
|
+
//# sourceMappingURL=plugin-BX_Z82RH.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-BX_Z82RH.d.mts","names":[],"sources":["../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;;;;UAkCiB,6BAAA;;AAAjB;;;;EAkCQ,MAAA,CAAA,EAAA,MAAA,GAAA,MAAA,EAAA;EAKA;;;;;;EAyBY,UAAA,CAAA,EAAA,MAAA;EAGH;AAIjB;;EACoB,GAAA,CAAA,EArDZ,MAqDY;EAgBZ;;;EAjBsD,IAAA,CAAA,EA/CrD,WA+CqD;EAAc;AAiC5E;;EAEI,GAAA,CAAA,EA7EI,UA6EJ;EACc;;;QAzEV;;;;QAKA;;;;SAKC;;;;QAKD;;;;SAKC;;;;SAKA;;;;SAKA;;UAGQ,gCAAA,SAAyC;qBACrC;;UAGJ,oCAAA,SAA6C;oBAC1C,KAChB,gIAaA,SACE,KACE;;KAgBI,sDACc,uCACtB,wCACA,cAAc"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { UserConfig } from "powerlines/types/config";
|
|
2
|
+
import { PluginContext } from "powerlines/types/context";
|
|
3
|
+
import { ResolvedConfig } from "powerlines/types/resolved";
|
|
4
|
+
import { AvifOptions, GifOptions, HeifOptions, Jp2Options, JpegOptions, JxlOptions, PngOptions, TiffOptions, WebpOptions } from "sharp";
|
|
5
|
+
import { Config } from "svgo";
|
|
6
|
+
|
|
7
|
+
//#region src/types/plugin.d.ts
|
|
8
|
+
interface ImageCompressionPluginOptions {
|
|
9
|
+
/**
|
|
10
|
+
* A path or glob pattern (or an array of paths and glob patterns) to image files to optimize during Powerlines processing.
|
|
11
|
+
*
|
|
12
|
+
* @defaultValue "\{projectRoot\}/**\/*.\{svg,jpg,jpeg,png,webp,avif,heif,gif,tiff,jp2,jxl\}"
|
|
13
|
+
*/
|
|
14
|
+
filter?: string | string[];
|
|
15
|
+
/**
|
|
16
|
+
* The output directory for the optimized images.
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* By default, it will generate the output files alongside each input image file.
|
|
20
|
+
*/
|
|
21
|
+
outputPath?: string;
|
|
22
|
+
/**
|
|
23
|
+
* These SVGO options used for SVG optimization
|
|
24
|
+
*/
|
|
25
|
+
svg?: Config;
|
|
26
|
+
/**
|
|
27
|
+
* These JPEG options used for output image
|
|
28
|
+
*/
|
|
29
|
+
jpeg?: JpegOptions;
|
|
30
|
+
/**
|
|
31
|
+
* These JP2 (JPEG 2000) options used for output image
|
|
32
|
+
*/
|
|
33
|
+
jp2?: Jp2Options;
|
|
34
|
+
/**
|
|
35
|
+
* These JPEG-XL (JXL) options used for output image
|
|
36
|
+
*/
|
|
37
|
+
jxl?: JxlOptions;
|
|
38
|
+
/**
|
|
39
|
+
* These PNG options used for output image
|
|
40
|
+
*/
|
|
41
|
+
png?: PngOptions;
|
|
42
|
+
/**
|
|
43
|
+
* These WebP options used for output image
|
|
44
|
+
*/
|
|
45
|
+
webp?: WebpOptions;
|
|
46
|
+
/**
|
|
47
|
+
* These GIF options used for output image
|
|
48
|
+
*/
|
|
49
|
+
gif?: GifOptions;
|
|
50
|
+
/**
|
|
51
|
+
* These AVIF options used for output image
|
|
52
|
+
*/
|
|
53
|
+
avif?: AvifOptions;
|
|
54
|
+
/**
|
|
55
|
+
* These HEIF options used for output image
|
|
56
|
+
*/
|
|
57
|
+
heif?: HeifOptions;
|
|
58
|
+
/**
|
|
59
|
+
* These TIFF options used for output image
|
|
60
|
+
*/
|
|
61
|
+
tiff?: TiffOptions;
|
|
62
|
+
}
|
|
63
|
+
interface ImageCompressionPluginUserConfig extends UserConfig {
|
|
64
|
+
imageCompression?: ImageCompressionPluginOptions;
|
|
65
|
+
}
|
|
66
|
+
interface ImageCompressionPluginResolvedConfig extends ResolvedConfig {
|
|
67
|
+
imageCompression: Omit<ImageCompressionPluginOptions, "filter" | "svg" | "jpeg" | "png" | "webp" | "avif" | "heif" | "tiff" | "jp2" | "jxl" | "gif"> & Required<Pick<ImageCompressionPluginOptions, "filter" | "svg" | "jpeg" | "png" | "webp" | "avif" | "heif" | "tiff" | "jp2" | "jxl" | "gif">>;
|
|
68
|
+
}
|
|
69
|
+
type ImageCompressionPluginContext<TResolvedConfig extends ImageCompressionPluginResolvedConfig = ImageCompressionPluginResolvedConfig> = PluginContext<TResolvedConfig>;
|
|
70
|
+
declare type __ΩImageCompressionPluginOptions = any[];
|
|
71
|
+
declare type __ΩImageCompressionPluginUserConfig = any[];
|
|
72
|
+
declare type __ΩImageCompressionPluginResolvedConfig = any[];
|
|
73
|
+
declare type __ΩImageCompressionPluginContext = any[];
|
|
74
|
+
//#endregion
|
|
75
|
+
export { __ΩImageCompressionPluginContext as a, __ΩImageCompressionPluginUserConfig as c, ImageCompressionPluginUserConfig as i, ImageCompressionPluginOptions as n, __ΩImageCompressionPluginOptions as o, ImageCompressionPluginResolvedConfig as r, __ΩImageCompressionPluginResolvedConfig as s, ImageCompressionPluginContext as t };
|
|
76
|
+
//# sourceMappingURL=plugin-CJ3kcwOQ.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-CJ3kcwOQ.d.cts","names":[],"sources":["../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;;;;UAkCiB,6BAAA;;AAAjB;;;;EAkCQ,MAAA,CAAA,EAAA,MAAA,GAAA,MAAA,EAAA;EAKA;;;;;;EAyBY,UAAA,CAAA,EAAA,MAAA;EAGH;AAIjB;;EACoB,GAAA,CAAA,EArDZ,MAqDY;EAgBZ;;;EAjBsD,IAAA,CAAA,EA/CrD,WA+CqD;EAAc;AAiC5E;;EAEI,GAAA,CAAA,EA7EI,UA6EJ;EACc;;;QAzEV;;;;QAKA;;;;SAKC;;;;QAKD;;;;SAKC;;;;SAKA;;;;SAKA;;UAGQ,gCAAA,SAAyC;qBACrC;;UAGJ,oCAAA,SAA6C;oBAC1C,KAChB,gIAaA,SACE,KACE;;KAgBI,sDACc,uCACtB,wCACA,cAAc"}
|
|
File without changes
|
package/dist/types/index.cjs
CHANGED
package/dist/types/index.d.cts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import { ImageCompressionPluginContext,
|
|
1
|
+
import { a as __ΩImageCompressionPluginContext, c as __ΩImageCompressionPluginUserConfig, i as ImageCompressionPluginUserConfig, n as ImageCompressionPluginOptions, o as __ΩImageCompressionPluginOptions, r as ImageCompressionPluginResolvedConfig, s as __ΩImageCompressionPluginResolvedConfig, t as ImageCompressionPluginContext } from "../plugin-CJ3kcwOQ.cjs";
|
|
2
|
+
import "../index-CEgs-Dz2.cjs";
|
|
2
3
|
export { ImageCompressionPluginContext, ImageCompressionPluginOptions, ImageCompressionPluginResolvedConfig, ImageCompressionPluginUserConfig, __ΩImageCompressionPluginContext, __ΩImageCompressionPluginOptions, __ΩImageCompressionPluginResolvedConfig, __ΩImageCompressionPluginUserConfig };
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import { ImageCompressionPluginContext,
|
|
1
|
+
import { a as __ΩImageCompressionPluginContext, c as __ΩImageCompressionPluginUserConfig, i as ImageCompressionPluginUserConfig, n as ImageCompressionPluginOptions, o as __ΩImageCompressionPluginOptions, r as ImageCompressionPluginResolvedConfig, s as __ΩImageCompressionPluginResolvedConfig, t as ImageCompressionPluginContext } from "../plugin-BX_Z82RH.mjs";
|
|
2
|
+
import "../index-BgAdqTbb.mjs";
|
|
2
3
|
export { ImageCompressionPluginContext, ImageCompressionPluginOptions, ImageCompressionPluginResolvedConfig, ImageCompressionPluginUserConfig, __ΩImageCompressionPluginContext, __ΩImageCompressionPluginOptions, __ΩImageCompressionPluginResolvedConfig, __ΩImageCompressionPluginUserConfig };
|
package/dist/types/index.mjs
CHANGED
package/dist/types/plugin.cjs
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require('../plugin-DHXHjv16.cjs');
|
package/dist/types/plugin.d.cts
CHANGED
|
@@ -1,75 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { PluginContext } from "powerlines/types/context";
|
|
3
|
-
import { ResolvedConfig } from "powerlines/types/resolved";
|
|
4
|
-
import { AvifOptions, GifOptions, HeifOptions, Jp2Options, JpegOptions, JxlOptions, PngOptions, TiffOptions, WebpOptions } from "sharp";
|
|
5
|
-
import { Config } from "svgo";
|
|
6
|
-
|
|
7
|
-
//#region src/types/plugin.d.ts
|
|
8
|
-
interface ImageCompressionPluginOptions {
|
|
9
|
-
/**
|
|
10
|
-
* A path or glob pattern (or an array of paths and glob patterns) to image files to optimize during Powerlines processing.
|
|
11
|
-
*
|
|
12
|
-
* @defaultValue "\{projectRoot\}/**\/*.\{svg,jpg,jpeg,png,webp,avif,heif,gif,tiff,jp2,jxl\}"
|
|
13
|
-
*/
|
|
14
|
-
filter?: string | string[];
|
|
15
|
-
/**
|
|
16
|
-
* The output directory for the optimized images.
|
|
17
|
-
*
|
|
18
|
-
* @remarks
|
|
19
|
-
* By default, it will generate the output files alongside each input image file.
|
|
20
|
-
*/
|
|
21
|
-
outputPath?: string;
|
|
22
|
-
/**
|
|
23
|
-
* These SVGO options used for SVG optimization
|
|
24
|
-
*/
|
|
25
|
-
svg?: Config;
|
|
26
|
-
/**
|
|
27
|
-
* These JPEG options used for output image
|
|
28
|
-
*/
|
|
29
|
-
jpeg?: JpegOptions;
|
|
30
|
-
/**
|
|
31
|
-
* These JP2 (JPEG 2000) options used for output image
|
|
32
|
-
*/
|
|
33
|
-
jp2?: Jp2Options;
|
|
34
|
-
/**
|
|
35
|
-
* These JPEG-XL (JXL) options used for output image
|
|
36
|
-
*/
|
|
37
|
-
jxl?: JxlOptions;
|
|
38
|
-
/**
|
|
39
|
-
* These PNG options used for output image
|
|
40
|
-
*/
|
|
41
|
-
png?: PngOptions;
|
|
42
|
-
/**
|
|
43
|
-
* These WebP options used for output image
|
|
44
|
-
*/
|
|
45
|
-
webp?: WebpOptions;
|
|
46
|
-
/**
|
|
47
|
-
* These GIF options used for output image
|
|
48
|
-
*/
|
|
49
|
-
gif?: GifOptions;
|
|
50
|
-
/**
|
|
51
|
-
* These AVIF options used for output image
|
|
52
|
-
*/
|
|
53
|
-
avif?: AvifOptions;
|
|
54
|
-
/**
|
|
55
|
-
* These HEIF options used for output image
|
|
56
|
-
*/
|
|
57
|
-
heif?: HeifOptions;
|
|
58
|
-
/**
|
|
59
|
-
* These TIFF options used for output image
|
|
60
|
-
*/
|
|
61
|
-
tiff?: TiffOptions;
|
|
62
|
-
}
|
|
63
|
-
interface ImageCompressionPluginUserConfig extends UserConfig {
|
|
64
|
-
imageCompression?: ImageCompressionPluginOptions;
|
|
65
|
-
}
|
|
66
|
-
interface ImageCompressionPluginResolvedConfig extends ResolvedConfig {
|
|
67
|
-
imageCompression: Omit<ImageCompressionPluginOptions, "filter" | "svg" | "jpeg" | "png" | "webp" | "avif" | "heif" | "tiff" | "jp2" | "jxl" | "gif"> & Required<Pick<ImageCompressionPluginOptions, "filter" | "svg" | "jpeg" | "png" | "webp" | "avif" | "heif" | "tiff" | "jp2" | "jxl" | "gif">>;
|
|
68
|
-
}
|
|
69
|
-
type ImageCompressionPluginContext<TResolvedConfig extends ImageCompressionPluginResolvedConfig = ImageCompressionPluginResolvedConfig> = PluginContext<TResolvedConfig>;
|
|
70
|
-
declare type __ΩImageCompressionPluginOptions = any[];
|
|
71
|
-
declare type __ΩImageCompressionPluginUserConfig = any[];
|
|
72
|
-
declare type __ΩImageCompressionPluginResolvedConfig = any[];
|
|
73
|
-
declare type __ΩImageCompressionPluginContext = any[];
|
|
74
|
-
//#endregion
|
|
1
|
+
import { a as __ΩImageCompressionPluginContext, c as __ΩImageCompressionPluginUserConfig, i as ImageCompressionPluginUserConfig, n as ImageCompressionPluginOptions, o as __ΩImageCompressionPluginOptions, r as ImageCompressionPluginResolvedConfig, s as __ΩImageCompressionPluginResolvedConfig, t as ImageCompressionPluginContext } from "../plugin-CJ3kcwOQ.cjs";
|
|
75
2
|
export { ImageCompressionPluginContext, ImageCompressionPluginOptions, ImageCompressionPluginResolvedConfig, ImageCompressionPluginUserConfig, __ΩImageCompressionPluginContext, __ΩImageCompressionPluginOptions, __ΩImageCompressionPluginResolvedConfig, __ΩImageCompressionPluginUserConfig };
|
package/dist/types/plugin.d.mts
CHANGED
|
@@ -1,75 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AvifOptions, GifOptions, HeifOptions, Jp2Options, JpegOptions, JxlOptions, PngOptions, TiffOptions, WebpOptions } from "sharp";
|
|
3
|
-
import { UserConfig } from "powerlines/types/config";
|
|
4
|
-
import { PluginContext } from "powerlines/types/context";
|
|
5
|
-
import { ResolvedConfig } from "powerlines/types/resolved";
|
|
6
|
-
|
|
7
|
-
//#region src/types/plugin.d.ts
|
|
8
|
-
interface ImageCompressionPluginOptions {
|
|
9
|
-
/**
|
|
10
|
-
* A path or glob pattern (or an array of paths and glob patterns) to image files to optimize during Powerlines processing.
|
|
11
|
-
*
|
|
12
|
-
* @defaultValue "\{projectRoot\}/**\/*.\{svg,jpg,jpeg,png,webp,avif,heif,gif,tiff,jp2,jxl\}"
|
|
13
|
-
*/
|
|
14
|
-
filter?: string | string[];
|
|
15
|
-
/**
|
|
16
|
-
* The output directory for the optimized images.
|
|
17
|
-
*
|
|
18
|
-
* @remarks
|
|
19
|
-
* By default, it will generate the output files alongside each input image file.
|
|
20
|
-
*/
|
|
21
|
-
outputPath?: string;
|
|
22
|
-
/**
|
|
23
|
-
* These SVGO options used for SVG optimization
|
|
24
|
-
*/
|
|
25
|
-
svg?: Config;
|
|
26
|
-
/**
|
|
27
|
-
* These JPEG options used for output image
|
|
28
|
-
*/
|
|
29
|
-
jpeg?: JpegOptions;
|
|
30
|
-
/**
|
|
31
|
-
* These JP2 (JPEG 2000) options used for output image
|
|
32
|
-
*/
|
|
33
|
-
jp2?: Jp2Options;
|
|
34
|
-
/**
|
|
35
|
-
* These JPEG-XL (JXL) options used for output image
|
|
36
|
-
*/
|
|
37
|
-
jxl?: JxlOptions;
|
|
38
|
-
/**
|
|
39
|
-
* These PNG options used for output image
|
|
40
|
-
*/
|
|
41
|
-
png?: PngOptions;
|
|
42
|
-
/**
|
|
43
|
-
* These WebP options used for output image
|
|
44
|
-
*/
|
|
45
|
-
webp?: WebpOptions;
|
|
46
|
-
/**
|
|
47
|
-
* These GIF options used for output image
|
|
48
|
-
*/
|
|
49
|
-
gif?: GifOptions;
|
|
50
|
-
/**
|
|
51
|
-
* These AVIF options used for output image
|
|
52
|
-
*/
|
|
53
|
-
avif?: AvifOptions;
|
|
54
|
-
/**
|
|
55
|
-
* These HEIF options used for output image
|
|
56
|
-
*/
|
|
57
|
-
heif?: HeifOptions;
|
|
58
|
-
/**
|
|
59
|
-
* These TIFF options used for output image
|
|
60
|
-
*/
|
|
61
|
-
tiff?: TiffOptions;
|
|
62
|
-
}
|
|
63
|
-
interface ImageCompressionPluginUserConfig extends UserConfig {
|
|
64
|
-
imageCompression?: ImageCompressionPluginOptions;
|
|
65
|
-
}
|
|
66
|
-
interface ImageCompressionPluginResolvedConfig extends ResolvedConfig {
|
|
67
|
-
imageCompression: Omit<ImageCompressionPluginOptions, "filter" | "svg" | "jpeg" | "png" | "webp" | "avif" | "heif" | "tiff" | "jp2" | "jxl" | "gif"> & Required<Pick<ImageCompressionPluginOptions, "filter" | "svg" | "jpeg" | "png" | "webp" | "avif" | "heif" | "tiff" | "jp2" | "jxl" | "gif">>;
|
|
68
|
-
}
|
|
69
|
-
type ImageCompressionPluginContext<TResolvedConfig extends ImageCompressionPluginResolvedConfig = ImageCompressionPluginResolvedConfig> = PluginContext<TResolvedConfig>;
|
|
70
|
-
declare type __ΩImageCompressionPluginOptions = any[];
|
|
71
|
-
declare type __ΩImageCompressionPluginUserConfig = any[];
|
|
72
|
-
declare type __ΩImageCompressionPluginResolvedConfig = any[];
|
|
73
|
-
declare type __ΩImageCompressionPluginContext = any[];
|
|
74
|
-
//#endregion
|
|
1
|
+
import { a as __ΩImageCompressionPluginContext, c as __ΩImageCompressionPluginUserConfig, i as ImageCompressionPluginUserConfig, n as ImageCompressionPluginOptions, o as __ΩImageCompressionPluginOptions, r as ImageCompressionPluginResolvedConfig, s as __ΩImageCompressionPluginResolvedConfig, t as ImageCompressionPluginContext } from "../plugin-BX_Z82RH.mjs";
|
|
75
2
|
export { ImageCompressionPluginContext, ImageCompressionPluginOptions, ImageCompressionPluginResolvedConfig, ImageCompressionPluginUserConfig, __ΩImageCompressionPluginContext, __ΩImageCompressionPluginOptions, __ΩImageCompressionPluginResolvedConfig, __ΩImageCompressionPluginUserConfig };
|
package/dist/types/plugin.mjs
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-image-compression",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.188",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A Powerlines plugin to optimize images used by the project.",
|
|
6
6
|
"repository": {
|
|
@@ -101,16 +101,16 @@
|
|
|
101
101
|
"chalk": "5.6.2",
|
|
102
102
|
"defu": "^6.1.4",
|
|
103
103
|
"jiti": "^2.6.1",
|
|
104
|
-
"powerlines": "^0.38.
|
|
104
|
+
"powerlines": "^0.38.6",
|
|
105
105
|
"sharp": "^0.34.5",
|
|
106
106
|
"svgo": "^4.0.0"
|
|
107
107
|
},
|
|
108
108
|
"devDependencies": {
|
|
109
|
-
"@powerlines/plugin-plugin": "^0.12.
|
|
109
|
+
"@powerlines/plugin-plugin": "^0.12.190",
|
|
110
110
|
"@storm-software/config": "^1.135.1",
|
|
111
111
|
"@types/node": "^24.10.9"
|
|
112
112
|
},
|
|
113
113
|
"publishConfig": { "access": "public" },
|
|
114
114
|
"types": "./dist/index.d.cts",
|
|
115
|
-
"gitHead": "
|
|
115
|
+
"gitHead": "f90d675c44d4323d447a46c8a4c833420543cc0a"
|
|
116
116
|
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
//#region rolldown:runtime
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
-
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
-
key = keys[i];
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
13
|
-
__defProp(to, key, {
|
|
14
|
-
get: ((k) => from[k]).bind(null, key),
|
|
15
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return to;
|
|
21
|
-
};
|
|
22
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
-
value: mod,
|
|
24
|
-
enumerable: true
|
|
25
|
-
}) : target, mod));
|
|
26
|
-
|
|
27
|
-
//#endregion
|
|
28
|
-
|
|
29
|
-
exports.__toESM = __toESM;
|