uglify-js-minify-css-allfiles 2.2.3 → 2.2.4
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/CHANGELOG.md +19 -0
- package/dist/module.js +15 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,25 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [2.2.4] - 2024-08-23
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- Updated `resolveBabelOptions` function to dynamically import `@babel/preset-env` using `resolveModulePath`
|
|
13
|
+
- Modified `minifyAll` function to handle the new asynchronous `resolveBabelOptions`
|
|
14
|
+
|
|
15
|
+
### Improved
|
|
16
|
+
|
|
17
|
+
- Enhanced flexibility in loading Babel presets, allowing for better compatibility with different environments
|
|
18
|
+
|
|
19
|
+
## [2.2.3] - 2024-08-23
|
|
20
|
+
|
|
21
|
+
### Improved
|
|
22
|
+
|
|
23
|
+
- Enhanced type definitions using JSDoc comments for better IDE support and code documentation
|
|
24
|
+
- Added more specific type definitions for JSMinifyOptions and CSSMinifyOptions
|
|
25
|
+
- Improved type annotations for function parameters and return types
|
|
26
|
+
|
|
8
27
|
## [2.2.2] - 2024-08-22
|
|
9
28
|
|
|
10
29
|
### Fixed
|
package/dist/module.js
CHANGED
|
@@ -101,13 +101,22 @@ async function processFile(filePath, logger, options) {
|
|
|
101
101
|
/**
|
|
102
102
|
* Resolves Babel options based on the provided configuration.
|
|
103
103
|
* @param {boolean|BabelOptions} useBabel - The Babel options object or boolean.
|
|
104
|
-
* @returns {BabelOptions|null}
|
|
104
|
+
* @returns {Promise<BabelOptions|null>} A promise that resolves to the Babel options or null if no valid options are provided.
|
|
105
105
|
*/
|
|
106
|
-
function resolveBabelOptions(useBabel) {
|
|
106
|
+
async function resolveBabelOptions(useBabel) {
|
|
107
107
|
if (!useBabel) return null;
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
|
|
109
|
+
try {
|
|
110
|
+
const presetEnvUrl = resolveModulePath('@babel/preset-env');
|
|
111
|
+
const presetEnv = await import(presetEnvUrl);
|
|
112
|
+
|
|
113
|
+
return {
|
|
114
|
+
presets: [[presetEnv.default, typeof useBabel === 'object' ? useBabel : {}]],
|
|
115
|
+
};
|
|
116
|
+
} catch (error) {
|
|
117
|
+
console.error('Error loading @babel/preset-env:', error);
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
111
120
|
}
|
|
112
121
|
|
|
113
122
|
/**
|
|
@@ -190,7 +199,7 @@ export default async function minifyAll(contentPath, options = {}) {
|
|
|
190
199
|
}
|
|
191
200
|
|
|
192
201
|
const rootDir = path.resolve(contentPath || '');
|
|
193
|
-
const babelOptions = resolveBabelOptions(useBabel);
|
|
202
|
+
const babelOptions = await resolveBabelOptions(useBabel);
|
|
194
203
|
|
|
195
204
|
const processOptions = {
|
|
196
205
|
babelOptions,
|