html-minifier-next 4.2.0 → 4.2.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 CHANGED
@@ -180,8 +180,8 @@ program.option('-d --dry', 'Dry run: process and report statistics without writi
180
180
  function readFile(file) {
181
181
  try {
182
182
  return fs.readFileSync(file, { encoding: 'utf8' });
183
- } catch (e) {
184
- fatal('Cannot read ' + file + '\n' + e.message);
183
+ } catch (err) {
184
+ fatal('Cannot read ' + file + '\n' + err.message);
185
185
  }
186
186
  }
187
187
 
@@ -196,7 +196,7 @@ async function loadConfigFromPath(configPath) {
196
196
  // Try JSON first
197
197
  try {
198
198
  return JSON.parse(data);
199
- } catch (je) {
199
+ } catch (jsonErr) {
200
200
  const abs = path.resolve(configPath);
201
201
 
202
202
  // Try CJS require
@@ -204,13 +204,13 @@ async function loadConfigFromPath(configPath) {
204
204
  const result = require(abs);
205
205
  // Handle ESM interop: if `require()` loads an ESM file, it may return `{__esModule: true, default: …}`
206
206
  return (result && result.__esModule && result.default) ? result.default : result;
207
- } catch (ne) {
207
+ } catch (cjsErr) {
208
208
  // Try ESM import
209
209
  try {
210
210
  const mod = await import(pathToFileURL(abs).href);
211
211
  return mod.default || mod;
212
- } catch (ee) {
213
- fatal('Cannot read the specified config file.\nAs JSON: ' + je.message + '\nAs CJS: ' + ne.message + '\nAs ESM: ' + ee.message);
212
+ } catch (esmErr) {
213
+ fatal('Cannot read the specified config file.\nAs JSON: ' + jsonErr.message + '\nAs CJS: ' + cjsErr.message + '\nAs ESM: ' + esmErr.message);
214
214
  }
215
215
  }
216
216
  }
@@ -307,8 +307,8 @@ program.option('--file-ext <extensions>', 'Specify file extension(s) to process
307
307
  let minified;
308
308
  try {
309
309
  minified = await minify(data, createOptions());
310
- } catch (e) {
311
- fatal('Minification error on ' + inputFile + '\n' + e.message);
310
+ } catch (err) {
311
+ fatal('Minification error on ' + inputFile + '\n' + err.message);
312
312
  }
313
313
 
314
314
  const stats = calculateStats(data, minified);
@@ -466,8 +466,8 @@ program.option('--file-ext <extensions>', 'Specify file extension(s) to process
466
466
 
467
467
  try {
468
468
  minified = await minify(content, minifierOptions);
469
- } catch (e) {
470
- fatal('Minification error:\n' + e.message);
469
+ } catch (err) {
470
+ fatal('Minification error:\n' + err.message);
471
471
  }
472
472
 
473
473
  const stats = calculateStats(content, minified);
@@ -1328,8 +1328,8 @@ const processOptions = (inputOptions) => {
1328
1328
  try {
1329
1329
  const result = await terser.minify(code, terserOptions);
1330
1330
  return result.code.replace(/;$/, '');
1331
- } catch (error) {
1332
- options.log(error);
1331
+ } catch (err) {
1332
+ options.log(err);
1333
1333
  return text;
1334
1334
  }
1335
1335
  };
@@ -40381,8 +40381,8 @@ const processOptions = (inputOptions) => {
40381
40381
  try {
40382
40382
  const result = await minify$1(code, terserOptions);
40383
40383
  return result.code.replace(/;$/, '');
40384
- } catch (error) {
40385
- options.log(error);
40384
+ } catch (err) {
40385
+ options.log(err);
40386
40386
  return text;
40387
40387
  }
40388
40388
  };
package/package.json CHANGED
@@ -84,5 +84,5 @@
84
84
  "test:watch": "node --test --watch tests/*.spec.js"
85
85
  },
86
86
  "type": "module",
87
- "version": "4.2.0"
87
+ "version": "4.2.2"
88
88
  }
@@ -798,8 +798,8 @@ const processOptions = (inputOptions) => {
798
798
  try {
799
799
  const result = await terser(code, terserOptions);
800
800
  return result.code.replace(/;$/, '');
801
- } catch (error) {
802
- options.log(error);
801
+ } catch (err) {
802
+ options.log(err);
803
803
  return text;
804
804
  }
805
805
  };