@powerlines/plugin-image-compression 0.2.0

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/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,304 @@
1
+ <!-- START header -->
2
+ <!-- prettier-ignore-start -->
3
+ <!-- markdownlint-disable -->
4
+
5
+
6
+ <div align="center">
7
+ <picture>
8
+ <source media="(prefers-color-scheme: dark)" srcset="https://public.storm-cdn.com/powerlines/banner-1280x640-dark-optimized.gif">
9
+ <source media="(prefers-color-scheme: light)" srcset="https://public.storm-cdn.com/powerlines/banner-1280x640-light-optimized.gif">
10
+ <img src="https://public.storm-cdn.com/powerlines/banner-1280x640-dark-optimized.gif" width="100%" alt="Powerlines" />
11
+ </picture>
12
+ </div>
13
+ <br />
14
+
15
+ <div align="center">
16
+ <b>
17
+ <a href="https://stormsoftware.com" target="_blank">Website</a> •
18
+ <a href="https://github.com/storm-software/powerlines" target="_blank">GitHub</a> •
19
+ <a href="https://discord.gg/MQ6YVzakM5">Discord</a> • <a href="https://stormstack.github.io/stormstack/" target="_blank">Docs</a> • <a href="https://stormsoftware.com/contact" target="_blank">Contact</a> •
20
+ <a href="https://github.com/storm-software/powerlines/issues/new?assignees=&labels=bug&template=bug-report.yml&title=Bug Report%3A+">Report a Bug</a>
21
+ </b>
22
+ </div>
23
+
24
+ <br />
25
+ This package is part of the 🔌 <b>Powerlines</b> monorepo. Powerlines packages include CLI utility applications, tools, and various libraries used to create modern, scalable web applications.
26
+ <br />
27
+
28
+ <h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
29
+
30
+ [![Version](https://img.shields.io/badge/version-0.2.0-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with Fumadocs](https://img.shields.io/badge/documented_with-fumadocs-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://fumadocs.vercel.app/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/powerlines/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
31
+
32
+ <!-- prettier-ignore-start -->
33
+ <!-- markdownlint-disable -->
34
+
35
+ > [!IMPORTANT]
36
+ > This repository, and the apps, libraries, and tools contained within, is still in it's initial development phase. As a result, bugs and issues are expected with it's usage. When the main development phase completes, a proper release will be performed, the packages will be available through NPM (and other distributions), and this message will be removed. However, in the meantime, please feel free to report any issues you may come across.
37
+
38
+ <!-- markdownlint-restore -->
39
+ <!-- prettier-ignore-end -->
40
+
41
+ <div align="center">
42
+ <b>Be sure to ⭐ this repository on <a href="https://github.com/storm-software/powerlines" target="_blank">GitHub</a> so you can keep up to date on any daily progress!</b>
43
+ </div>
44
+
45
+ <br />
46
+
47
+ <!-- markdownlint-restore -->
48
+ <!-- prettier-ignore-end -->
49
+
50
+ <!-- END header -->
51
+
52
+ # Powerlines - Image Compression Plugin
53
+
54
+ A Powerlines plugin to use [Sharp](https://sharp.pixelplumbing.com) to optimize images used by the project.
55
+
56
+ <!-- START doctoc -->
57
+ <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
58
+ ## Table of Contents
59
+
60
+ - [Powerlines - Image Compression Plugin](#powerlines---image-compression-plugin)
61
+ - [Table of Contents](#table-of-contents)
62
+ - [Installing](#installing)
63
+ - [Reduced Package Size](#reduced-package-size)
64
+ - [Development](#development)
65
+ - [Building](#building)
66
+ - [Running unit tests](#running-unit-tests)
67
+ - [Linting](#linting)
68
+ - [Storm Workspaces](#storm-workspaces)
69
+ - [Roadmap](#roadmap)
70
+ - [Support](#support)
71
+ - [License](#license)
72
+ - [Changelog](#changelog)
73
+ - [Contributing](#contributing)
74
+ - [Contributors](#contributors)
75
+
76
+ <!-- END doctoc -->
77
+
78
+ ## Installing
79
+
80
+ Using [pnpm](http://pnpm.io):
81
+
82
+ ```bash
83
+ pnpm add @powerlines/plugin-image-compression
84
+ ```
85
+
86
+ <details>
87
+ <summary>Using npm</summary>
88
+
89
+ ```bash
90
+ npm install @powerlines/plugin-image-compression
91
+ ```
92
+
93
+ </details>
94
+
95
+ <details>
96
+ <summary>Using yarn</summary>
97
+
98
+ ```bash
99
+ yarn add @powerlines/plugin-image-compression
100
+ ```
101
+
102
+ </details>
103
+
104
+ ## Reduced Package Size
105
+
106
+ This project uses [tsup](https://tsup.egoist.dev/) to package the source code
107
+ due to its ability to remove unused code and ship smaller javascript files
108
+ thanks to code splitting. This helps to greatly reduce the size of the package
109
+ and to make it easier to use in other projects.
110
+
111
+ ## Development
112
+
113
+ This project is built using [Nx](https://nx.dev). As a result, many of the usual
114
+ commands are available to assist in development.
115
+
116
+ ### Building
117
+
118
+ Run `nx build plugin-image-compression` to build the library.
119
+
120
+ ### Running unit tests
121
+
122
+ Run `nx test plugin-image-compression` to execute the unit tests via
123
+ [Jest](https://jestjs.io).
124
+
125
+ ### Linting
126
+
127
+ Run `nx lint plugin-image-compression` to run
128
+ [ESLint](https://eslint.org/) on the package.
129
+
130
+ <!-- START footer -->
131
+ <!-- prettier-ignore-start -->
132
+ <!-- markdownlint-disable -->
133
+
134
+
135
+ ## Storm Workspaces
136
+
137
+ Storm workspaces are built using
138
+ <a href="https://nx.dev/" target="_blank">Nx</a>, a set of extensible dev tools
139
+ for monorepos, which helps you develop like Google, Facebook, and Microsoft.
140
+ Building on top of Nx, the Open System provides a set of tools and patterns that
141
+ help you scale your monorepo to many teams while keeping the codebase
142
+ maintainable.
143
+
144
+ <div align="right">[ <a href="#table-of-contents">Back to top ▲</a> ]</div>
145
+ <br />
146
+
147
+ ## Roadmap
148
+
149
+ See the [open issues](https://github.com/storm-software/powerlines/issues) for
150
+ a list of proposed features (and known issues).
151
+
152
+ - [Top Feature Requests](https://github.com/storm-software/powerlines/issues?q=label%3Aenhancement+is%3Aopen+sort%3Areactions-%2B1-desc)
153
+ (Add your votes using the 👍 reaction)
154
+ - [Top Bugs](https://github.com/storm-software/powerlines/issues?q=is%3Aissue+is%3Aopen+label%3Abug+sort%3Areactions-%2B1-desc)
155
+ (Add your votes using the 👍 reaction)
156
+ - [Newest Bugs](https://github.com/storm-software/powerlines/issues?q=is%3Aopen+is%3Aissue+label%3Abug)
157
+
158
+ <div align="right">[ <a href="#table-of-contents">Back to top ▲</a> ]</div>
159
+ <br />
160
+
161
+ ## Support
162
+
163
+ Reach out to the maintainer at one of the following places:
164
+
165
+ - [Contact](https://stormsoftware.com/contact)
166
+ - [GitHub discussions](https://github.com/storm-software/powerlines/discussions)
167
+ - <support@stormsoftware.com>
168
+
169
+ <div align="right">[ <a href="#table-of-contents">Back to top ▲</a> ]</div>
170
+ <br />
171
+
172
+ ## License
173
+
174
+ This project is licensed under the **Apache License 2.0**. Feel free to edit and
175
+ distribute this template as you like.
176
+
177
+ See [LICENSE](LICENSE) for more information.
178
+
179
+ <div align="right">[ <a href="#table-of-contents">Back to top ▲</a> ]</div>
180
+ <br />
181
+
182
+ ## Changelog
183
+
184
+ This project adheres to
185
+ [Semantic Versioning](https://semver.org/spec/v2.0.0.html). Every release, along
186
+ with the migration instructions, is documented in the [CHANGELOG](CHANGELOG.md)
187
+ file
188
+
189
+ <div align="right">[ <a href="#table-of-contents">Back to top ▲</a> ]</div>
190
+ <br />
191
+
192
+ ## Contributing
193
+
194
+ First off, thanks for taking the time to contribute! Contributions are what
195
+ makes the open-source community such an amazing place to learn, inspire, and
196
+ create. Any contributions you make will benefit everybody else and are **greatly
197
+ appreciated**.
198
+
199
+ Please try to create bug reports that are:
200
+
201
+ - _Reproducible._ Include steps to reproduce the problem.
202
+ - _Specific._ Include as much detail as possible: which version, what
203
+ environment, etc.
204
+ - _Unique._ Do not duplicate existing opened issues.
205
+ - _Scoped to a Single Bug._ One bug per report.
206
+
207
+ Please adhere to this project's [code of conduct](.github/CODE_OF_CONDUCT.md).
208
+
209
+ You can use
210
+ [markdownlint-cli](https://github.com/storm-software/powerlines/markdownlint-cli)
211
+ to check for common markdown style inconsistency.
212
+
213
+ <div align="right">[ <a href="#table-of-contents">Back to top ▲</a> ]</div>
214
+ <br />
215
+
216
+ ## Contributors
217
+
218
+ Thanks goes to these wonderful people
219
+ ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
220
+
221
+ <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
222
+
223
+ <table>
224
+ <tbody>
225
+ <tr>
226
+ <td align="center" valign="top" width="14.28%"><a href="http://www.sullypat.com/"><img src="https://avatars.githubusercontent.com/u/99053093?v=4?s=100" width="100px;" alt="Patrick Sullivan"/><br /><sub><b>Patrick Sullivan</b></sub></a><br /><a href="#design-sullivanpj" title="Design">🎨</a> <a href="https://github.com/storm-software/powerlines/commits?author=sullivanpj" title="Code">💻</a> <a href="#tool-sullivanpj" title="Tools">🔧</a> <a href="https://github.com/storm-software/powerlines/commits?author=sullivanpj" title="Documentation">📖</a> <a href="https://github.com/storm-software/powerlines/commits?author=sullivanpj" title="Tests">⚠️</a></td>
227
+ <td align="center" valign="top" width="14.28%"><a href="https://tylerbenning.com/"><img src="https://avatars.githubusercontent.com/u/7265547?v=4?s=100" width="100px;" alt="Tyler Benning"/><br /><sub><b>Tyler Benning</b></sub></a><br /><a href="#design-tbenning" title="Design">🎨</a></td>
228
+ <td align="center" valign="top" width="14.28%"><a href="http://stormsoftware.com"><img src="https://avatars.githubusercontent.com/u/149802440?v=4?s=100" width="100px;" alt="Stormie"/><br /><sub><b>Stormie</b></sub></a><br /><a href="#maintenance-stormie-bot" title="Maintenance">🚧</a></td>
229
+ </tr>
230
+ </tbody>
231
+ <tfoot>
232
+ <tr>
233
+ <td align="center" size="13px" colspan="7">
234
+ <img src="https://raw.githubusercontent.com/all-contributors/all-contributors-cli/1b8533af435da9854653492b1327a23a4dbd0a10/assets/logo-small.svg" alt="All Contributors">
235
+ <a href="https://all-contributors.js.org/docs/en/bot/usage">Add your contributions</a>
236
+ </img>
237
+ </td>
238
+ </tr>
239
+ </tfoot>
240
+ </table>
241
+
242
+ <!-- ALL-CONTRIBUTORS-LIST:END -->
243
+
244
+ This project follows the
245
+ [all-contributors](https://github.com/all-contributors/all-contributors)
246
+ specification. Contributions of any kind welcome!
247
+
248
+ <div align="right">[ <a href="#table-of-contents">Back to top ▲</a> ]</div>
249
+ <br />
250
+
251
+ <hr />
252
+ <br />
253
+
254
+ <div align="center">
255
+ <picture>
256
+ <source media="(prefers-color-scheme: dark)" srcset="https://public.storm-cdn.com/storm-software/banner-1280x320-dark-optimized.webp">
257
+ <source media="(prefers-color-scheme: light)" srcset="https://public.storm-cdn.com/storm-software/banner-1280x320-light-optimized.webp">
258
+ <img src="https://public.storm-cdn.com/storm-software/banner-1280x320-dark-optimized.webp" width="100%" alt="Storm Software" />
259
+ </picture>
260
+ </div>
261
+ <br />
262
+
263
+ <div align="center">
264
+ <a href="https://stormsoftware.com" target="_blank">Website</a> • <a href="https://stormsoftware.com/contact" target="_blank">Contact</a> • <a href="https://linkedin.com/in/patrick-sullivan-865526b0" target="_blank">LinkedIn</a> • <a href="https://medium.com/@pat.joseph.sullivan" target="_blank">Medium</a> • <a href="https://github.com/storm-software" target="_blank">GitHub</a> • <a href="https://keybase.io/sullivanp" target="_blank">OpenPGP Key</a>
265
+ </div>
266
+
267
+ <div align="center">
268
+ <b>Fingerprint:</b> 1BD2 7192 7770 2549 F4C9 F238 E6AD C420 DA5C 4C2D
269
+ </div>
270
+ <br />
271
+
272
+ Storm Software is an open source software development organization and creator
273
+ of Acidic, StormStack and StormCloud.
274
+
275
+ Our mission is to make software development more accessible. Our ideal future is
276
+ one where anyone can create software without years of prior development
277
+ experience serving as a barrier to entry. We hope to achieve this via LLMs,
278
+ Generative AI, and intuitive, high-level data modeling/programming languages.
279
+
280
+ Join us on [Discord](https://discord.gg/MQ6YVzakM5) to chat with the team,
281
+ receive release notifications, ask questions, and get involved.
282
+
283
+ If this sounds interesting, and you would like to help us in creating the next
284
+ generation of development tools, please reach out on our
285
+ [website](https://stormsoftware.com/contact) or join our
286
+ [Slack channel](https://join.slack.com/t/storm-software/shared_invite/zt-2gsmk04hs-i6yhK_r6urq0dkZYAwq2pA)!
287
+
288
+ <br />
289
+
290
+ <div align="center"><a href="https://stormsoftware.com" target="_blank"><img src="https://public.storm-cdn.com/icon-fill.png" alt="Storm Software" width="200px"/></a></div>
291
+ <br />
292
+ <div align="center"><a href="https://stormsoftware.com" target="_blank"><img src="https://public.storm-cdn.com/visit-us-text.svg" alt="Visit us at stormsoftware.com" height="90px"/></a></div>
293
+
294
+ <br />
295
+
296
+ <div align="right">[ <a href="#table-of-contents">Back to top ▲</a> ]</div>
297
+ <br />
298
+ <br />
299
+
300
+
301
+ <!-- markdownlint-restore -->
302
+ <!-- prettier-ignore-end -->
303
+
304
+ <!-- END footer -->
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1 @@
1
+ export { };
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,`__esModule`,{value:!0});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));require(`./plugin-DHXHjv16.cjs`),require(`./types-DHkg7xmX.cjs`);let c=require(`@stryke/convert/to-array`),l=require(`@stryke/fs/list-files`),u=require(`@stryke/fs/read-file`),d=require(`@stryke/fs/write-file`),f=require(`@stryke/path/find`),p=require(`@stryke/string-format/pretty-bytes`),m=require(`chalk`);m=s(m);let h=require(`node:buffer`),g=require(`node:fs/promises`),_=require(`@stryke/path/replace`),v=require(`svgo`);function y(e,t){return t&&t.replaceAll(`{workspaceRoot}`,e.workspaceConfig.workspaceRoot).replaceAll(`{root}`,e.config.projectRoot).replaceAll(`{projectRoot}`,e.config.projectRoot).replaceAll(`{sourceRoot}`,e.config.sourceRoot).replaceAll(`{powerlinesPath}`,e.powerlinesPath).replaceAll(`{cachePath}`,e.cachePath).replaceAll(`{dataPath}`,e.dataPath).replaceAll(`{logPath}`,e.envPaths.log).replaceAll(`{tempPath}`,e.envPaths.temp).replaceAll(`{configPath}`,e.envPaths.config).replaceAll(`{outputPath}`,e.config.output.outputPath).replaceAll(`{buildPath}`,e.config.output.buildPath).replaceAll(`{artifactsPath}`,(0,_.replacePath)(e.artifactsPath,e.workspaceConfig.workspaceRoot)).replaceAll(`{builtinPath}`,(0,_.replacePath)(e.builtinsPath,e.workspaceConfig.workspaceRoot)).replaceAll(`{entryPath}`,(0,_.replacePath)(e.entryPath,e.workspaceConfig.workspaceRoot))}const b=(e={})=>({name:`image-compression`,config(){return{imageCompression:{filter:`{projectRoot}/**/*.{svg,jpg,jpeg,png,webp,avif,heif,gif,tiff,jp2,jxl}`,svg:{},jpeg:{},png:{},webp:{},avif:{},heif:{},tiff:{},jp2:{},jxl:{},...e}}},async configResolved(){if(!this.config.imageCompression.filter)throw Error(`ImageCompression plugin requires a filter or glob pattern to be specified in the configuration.`);this.config.imageCompression.filter=(0,c.toArray)(this.config.imageCompression.filter).map(e=>y(this,e)).filter(Boolean)},async prepare(){await Promise.all((0,c.toArray)(this.config.imageCompression.filter).map(async e=>{await Promise.all((await(0,l.listFiles)(e)).map(async e=>{let t=this.config.imageCompression.outputPath?y(this,this.config.imageCompression.outputPath).replace(/\{fileName\}/g,e.split(`/`).pop()||`output`):e,n=performance.now(),r=(await(0,g.stat)(e)).size,i=0,a=(0,f.findFileExtensionSafe)(e).toLowerCase();if(!a){this.error(` ✘ Failed to optimize ${e} - Unable to determine file extension`);return}if(a===`svg`){let n=(0,v.optimize)(await(0,u.readFile)(e),{multipass:!0,path:e,...this.config.imageCompression.svg});n.data&&(i=h.Buffer.byteLength(n.data,`utf8`),await(0,d.writeFile)(t,n.data))}else{let n=await import(`sharp`).then(t=>t.default(e,{animated:a===`gif`}));switch(a){case`jpeg`:case`jpg`:n=n.jpeg(this.config.imageCompression.jpeg);break;case`png`:n=n.png(this.config.imageCompression.png);break;case`webp`:n=n.webp(this.config.imageCompression.webp);break;case`avif`:n=n.avif(this.config.imageCompression.avif);break;case`gif`:n=n.gif(this.config.imageCompression.gif);break;case`heif`:n=n.heif(this.config.imageCompression.heif);break;case`tiff`:n=n.tiff(this.config.imageCompression.tiff);break;case`jp2`:n=n.jp2(this.config.imageCompression.jp2);break;case`jxl`:n=n.jxl(this.config.imageCompression.jxl);break}i=(await n.toFile(t)).size}if(!i){this.error(` ✘ Failed to optimize ${e} - No data returned`);return}if(i>=r){this.error(` ✘ Failed to optimize ${e} - Compression output was not smaller than the original`);return}this.info(` ✔ Successfully optimized ${e}: ${m.default.redBright((0,p.prettyBytes)(r))} -> ${m.default.greenBright((0,p.prettyBytes)(i))} (${m.default.green((100-i/r*100).toFixed(2))}%) in ${(performance.now()-n).toFixed(2)} ms`)}))}))}});var x=b;exports.default=x,exports.plugin=b;
@@ -0,0 +1,16 @@
1
+ import { a as __ΩImageCompressionPluginContext, c as __ΩImageCompressionPluginUserConfig, i as ImageCompressionPluginUserConfig, l as Plugin, n as ImageCompressionPluginOptions, o as __ΩImageCompressionPluginOptions, r as ImageCompressionPluginResolvedConfig, s as __ΩImageCompressionPluginResolvedConfig, t as ImageCompressionPluginContext } from "./plugin-CBOUmI8x.cjs";
2
+ import "./index-CEgs-Dz2.cjs";
3
+
4
+ //#region src/index.d.ts
5
+
6
+ /**
7
+ * A Powerlines plugin to optimize image assets used by the project.
8
+ *
9
+ * @see https://sharp.pixelplumbing.com
10
+ *
11
+ * @param options - The plugin options.
12
+ * @returns A Powerlines plugin instance.
13
+ */
14
+ declare const plugin: <TContext extends ImageCompressionPluginContext = ImageCompressionPluginContext>(options?: ImageCompressionPluginOptions) => Plugin<TContext>;
15
+ //#endregion
16
+ export { ImageCompressionPluginContext, ImageCompressionPluginOptions, ImageCompressionPluginResolvedConfig, ImageCompressionPluginUserConfig, __ΩImageCompressionPluginContext, __ΩImageCompressionPluginOptions, __ΩImageCompressionPluginResolvedConfig, __ΩImageCompressionPluginUserConfig, plugin as default, plugin };
@@ -0,0 +1,16 @@
1
+ import { a as __ΩImageCompressionPluginContext, c as __ΩImageCompressionPluginUserConfig, i as ImageCompressionPluginUserConfig, l as Plugin, n as ImageCompressionPluginOptions, o as __ΩImageCompressionPluginOptions, r as ImageCompressionPluginResolvedConfig, s as __ΩImageCompressionPluginResolvedConfig, t as ImageCompressionPluginContext } from "./plugin-B-03uFr0.mjs";
2
+ import "./index-BgAdqTbb.mjs";
3
+
4
+ //#region src/index.d.ts
5
+
6
+ /**
7
+ * A Powerlines plugin to optimize image assets used by the project.
8
+ *
9
+ * @see https://sharp.pixelplumbing.com
10
+ *
11
+ * @param options - The plugin options.
12
+ * @returns A Powerlines plugin instance.
13
+ */
14
+ declare const plugin: <TContext extends ImageCompressionPluginContext = ImageCompressionPluginContext>(options?: ImageCompressionPluginOptions) => Plugin<TContext>;
15
+ //#endregion
16
+ export { ImageCompressionPluginContext, ImageCompressionPluginOptions, ImageCompressionPluginResolvedConfig, ImageCompressionPluginUserConfig, __ΩImageCompressionPluginContext, __ΩImageCompressionPluginOptions, __ΩImageCompressionPluginResolvedConfig, __ΩImageCompressionPluginUserConfig, plugin as default, plugin };
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ import"./plugin-Bvn-he2n.mjs";import"./types-B7VYa_Pp.mjs";import{toArray as e}from"@stryke/convert/to-array";import{listFiles as t}from"@stryke/fs/list-files";import{readFile as n}from"@stryke/fs/read-file";import{writeFile as r}from"@stryke/fs/write-file";import{findFileExtensionSafe as i}from"@stryke/path/find";import{prettyBytes as a}from"@stryke/string-format/pretty-bytes";import o from"chalk";import{Buffer as s}from"node:buffer";import{stat as c}from"node:fs/promises";import{replacePath as l}from"@stryke/path/replace";import{optimize as u}from"svgo";function d(e,t){return t&&t.replaceAll(`{workspaceRoot}`,e.workspaceConfig.workspaceRoot).replaceAll(`{root}`,e.config.projectRoot).replaceAll(`{projectRoot}`,e.config.projectRoot).replaceAll(`{sourceRoot}`,e.config.sourceRoot).replaceAll(`{powerlinesPath}`,e.powerlinesPath).replaceAll(`{cachePath}`,e.cachePath).replaceAll(`{dataPath}`,e.dataPath).replaceAll(`{logPath}`,e.envPaths.log).replaceAll(`{tempPath}`,e.envPaths.temp).replaceAll(`{configPath}`,e.envPaths.config).replaceAll(`{outputPath}`,e.config.output.outputPath).replaceAll(`{buildPath}`,e.config.output.buildPath).replaceAll(`{artifactsPath}`,l(e.artifactsPath,e.workspaceConfig.workspaceRoot)).replaceAll(`{builtinPath}`,l(e.builtinsPath,e.workspaceConfig.workspaceRoot)).replaceAll(`{entryPath}`,l(e.entryPath,e.workspaceConfig.workspaceRoot))}const f=(l={})=>({name:`image-compression`,config(){return{imageCompression:{filter:`{projectRoot}/**/*.{svg,jpg,jpeg,png,webp,avif,heif,gif,tiff,jp2,jxl}`,svg:{},jpeg:{},png:{},webp:{},avif:{},heif:{},tiff:{},jp2:{},jxl:{},...l}}},async configResolved(){if(!this.config.imageCompression.filter)throw Error(`ImageCompression plugin requires a filter or glob pattern to be specified in the configuration.`);this.config.imageCompression.filter=e(this.config.imageCompression.filter).map(e=>d(this,e)).filter(Boolean)},async prepare(){await Promise.all(e(this.config.imageCompression.filter).map(async e=>{await Promise.all((await t(e)).map(async e=>{let t=this.config.imageCompression.outputPath?d(this,this.config.imageCompression.outputPath).replace(/\{fileName\}/g,e.split(`/`).pop()||`output`):e,l=performance.now(),f=(await c(e)).size,p=0,m=i(e).toLowerCase();if(!m){this.error(` ✘ Failed to optimize ${e} - Unable to determine file extension`);return}if(m===`svg`){let i=u(await n(e),{multipass:!0,path:e,...this.config.imageCompression.svg});i.data&&(p=s.byteLength(i.data,`utf8`),await r(t,i.data))}else{let n=await import(`sharp`).then(t=>t.default(e,{animated:m===`gif`}));switch(m){case`jpeg`:case`jpg`:n=n.jpeg(this.config.imageCompression.jpeg);break;case`png`:n=n.png(this.config.imageCompression.png);break;case`webp`:n=n.webp(this.config.imageCompression.webp);break;case`avif`:n=n.avif(this.config.imageCompression.avif);break;case`gif`:n=n.gif(this.config.imageCompression.gif);break;case`heif`:n=n.heif(this.config.imageCompression.heif);break;case`tiff`:n=n.tiff(this.config.imageCompression.tiff);break;case`jp2`:n=n.jp2(this.config.imageCompression.jp2);break;case`jxl`:n=n.jxl(this.config.imageCompression.jxl);break}p=(await n.toFile(t)).size}if(!p){this.error(` ✘ Failed to optimize ${e} - No data returned`);return}if(p>=f){this.error(` ✘ Failed to optimize ${e} - Compression output was not smaller than the original`);return}this.info(` ✔ Successfully optimized ${e}: ${o.redBright(a(f))} -> ${o.greenBright(a(p))} (${o.green((100-p/f*100).toFixed(2))}%) in ${(performance.now()-l).toFixed(2)} ms`)}))}))}});var p=f;export{p as default,f as plugin};